227: Handle collab settlement response from the maker r=klochowicz a=klochowicz
- store TakerId for proposals to be able to respond to specific taker about
settlement proposal when the user takes action
- send the collab settlement response (accept or reject) from the maker
- handle rejection (remove from the map), CFD state in the UI returns to "Open"
Co-authored-by: Mariusz Klochowicz <mariusz@klochowicz.com>
- store TakerId for proposals to be able to respond to specific taker about
settlement proposal when the user takes action
- send the collab settlement response (accept or reject) from the maker
- handle rejection (remove from the map), CFD state in the UI returns to "Open"
222: Prevent zero-priced CFD offers r=klochowicz a=klochowicz
Simplify the UI code and disable the button for posting a new offer if there is
no price set.
Co-authored-by: Mariusz Klochowicz <mariusz@klochowicz.com>
223: Publish cet r=da-kami a=da-kami
- Handles the Oracle's attestation in the cfd actor, transition according to the knowledge we have about the timelock expiry already.
- Tries to publish the CET if we are in `CetStatus::Ready`, i.e. both the attestation and timelock expiry happened. We try publishing if either event happened, and just print a log in case it's not ready yet.
- Tries to re-publish CET if we are in `PendingCet` upon restart.
- Re-triggers CET monitoring upon startup.
- Extends any state after `ContractSetup` to be able to store the attestation. (see below for ideas to change that)
Things that could be done different:
Currently we are carrying on the attestation through a lot of states - because we cannot just transition the user to `OpenCommitted` because it is a user decision to go for commit, but we have to keep the attestation around once it happened.
To reduce the state complexity, we could store the attestation independent of the state, but associated with the cfd.
This would make things a lot simpler, but we would then always have to go to the database to check if the attestation is already around (which might make other parts more complex).
---
TODO:
- [ ] Test it 😬
Co-authored-by: Daniel Karzel <daniel@comit.network>
- Handles the Oracle's attestation in the cfd actor, transition according to the knowledge we have about the timelock expiry already.
- Tries to publish the CET if we are in `CetStatus::Ready`, i.e. both the attestation and timelock expiry happened. We try publishing if either event happened, and just print a log in case it's not ready yet.
- Tries to re-publish CET if we are in `PendingCet` upon restart.
- Re-triggers CET monitoring upon startup.
- Extends any state after `ContractSetup` to be able to store the attestation. (see below for ideas to change that)
Things that could be done different:
Currently we are carrying on the attestation through a lot of states - because we cannot just transition the user to `OpenCommitted` because it is a user decision to go for commit, but we have to keep the attestation around once it happened.
To reduce the state complexity, we could store the attestation independent of the state, but associated with the cfd.
This would make things a lot simpler, but we would then always have to go to the database to check if the attestation is already around (which might make other parts more complex).
If the switch is enabled, the maker gets price suggestions based on the current
ask price on Bitmex + 3% spread.
Auto-refresh turns off whenever user modifies the field manually, and can be
re-enabled later if desired.
Fixes#214
221: Adds boiler plate for rolling over r=bonomat a=bonomat
The actual roll over is not yet implemented but I'm afraid of the code changing below me too fast hence a PR adding the boiler plate :)
Co-authored-by: Philipp Hoenisch <philipp@hoenisch.at>
Add support for multiple update proposals.
A taker might request to update/change a CFD in different ways, e.g.: propose to settle it or roll over.
In order to support different scenarios we introduce another layer of abstraction.
The rest of the changes creates a boilerplate for the actual rollover protocol.
New HashMap can store both incoming and outgoing settlement proposals at the
same time and resulted in some code simplification, as there are less types
needed to convey the intention.
Provide a type alias for convenience (this also ensures that both binaries store
settlement proposals in the same way)
Opted not to implement an additional message to fetch a specific announcement from the Oracle actor because it would have made the oracle actor unnecessarily complex (We would have to split it into different functionality by trait).
The taker cfd actor holds a sliding window of all the announcements received from the oracle actor.
We can now pass more than one set of `nonce_pks` when creating a CFD.
Each set corresponds to (and is identified by) a different oracle
event, allowing us to construct CFDs which can be settled via oracle
attestation at more than one point in time.
We also remember the CET-event relationship in `CfdTransactions`. This
is needed so that we can select the correct CET when the oracle
attests to the outcome of an event. Additionally, we save the
`nonce_pks` to more easily verify the adaptor signatures.
By removing the onclick handler on the table row, clicking any button in the row does not fire the onclick handler of the row as well.
This has the effect that for expanding the row you need to click the expand button.
Red colour is best used for drawing attention to unusual things or marking a
hazardous action.
Sell positions on the maker side are an expected & common thing, so there is no
need for the sell positions to stand out.
Keep track of outgoing/incoming settlement proposals in a hashmap inside the CFD
rocket that is available as a Rocket state in order to derive correct CfdState
for the UI.
Add placeholders for actions for accepting/rejecting settlement offers in the maker.
Also:
- rename Accept/Reject in few places to reduce ambiguity between interacting
with an order and a settlement proposal.
- allow only one in-flight settlement proposal from the taker
CfdTable uses react-table which resets its state if the data sources changes. We don't want some state to reset, e.g. sorting and un-expanding because that will mess with the user if the table suddenly changes.
Note: it looks like that the provided types are missing this field. It's been tested and it works as expected but we need to @ts-ignore because tsc would complain.
* Offer price based on current price
To keep it simple we set the offer price to current price + 3% spread if we have a current price and the offer's initial value is 0.
This. means we cannot set the offer price to 0 anymore, but that is OK.
Additionally, there is a refresh button so the maker can refresh the offer price (no auto-refresh for now).
Co-authored-by: Thomas Eizinger <thomas@eizinger.io>