8 Commits

Author SHA1 Message Date
Eric Mastro
c80e3e5e2c
[statemachine] fix allowance of multiple source states 2023-02-21 17:21:23 +11:00
Eric Mastro
b220f4198a
[statemachine] allow multiple source states in Transition
- multiple source states allowed in transition removed need for boilerplate subscription handling

TODO:
1. fix compilation for multiple transition source states
2. add tests for:
  - no transitioning to self
  - multiple source states in transition
3. Check how CancelledError gets caught in future callback
4. Remove Future[?State] from run return type?
2023-02-21 17:21:23 +11:00
Eric Mastro
8defc00bb0
[statemachine] WIP switch to declarative machine
- restoring and not restoring state both use the same setup for SalesAgent, by setting the SalesAgent’s state during instantiation, allowing it to react according to its state
- remove returning of next State from run (actual types yet to be changed)
- subscribe to onchain events, and use TransitionProperties to react (TODO: do not react from AnyState, but set to only states that make sense)
- create setError method in asyncstatemachine that handles setting of error properties
2023-02-21 17:21:23 +11:00
Mark Spanbroek
2035568b88
WIP switch to new statemachine model
Heavy work in progress, doesn't even compile yet,
this commit will be replaced by new cleaned up small commits

- callbacks are sync again
- agent.start(slots) is replaced by new state SaleStart
- disables explicit state transition tests for now; need to be replaced
2023-02-21 17:21:21 +11:00
Eric Mastro
47da5c1625
[marketplace] sales state machine: use slotState
Use `slotState` instead of `requestState` for sales state machine.

[marketplace] clean up
2023-02-21 17:21:21 +11:00
Mark Spanbroek
8a8e7aed70
[sales] fix: do not crash when fetching state fails 2023-02-14 13:47:52 +01:00
Eric Mastro
437036a9a6
[marketplace] align with contract changes
- getState / state > requestState
- getSlot > getRequestFromSlotId
- support MarketplaceConfig
- support slotState, remove unneeded Slot type
- collateral > config.collateral.initialAmount
- remove proofPeriod contract call
- Revert reason “Slot empty” > “Slot is free”
- getProofEnd > read SlotState

Tests for changes
2023-02-14 13:47:52 +01:00
Eric Mastro
67914249b6
[marketplace] move sale process to async state machine 2023-02-14 13:47:50 +01:00