atomicDEX-API
atomicDEX-API copied to clipboard
feat(trading-proto-upgrade): fees fixes among other things
The main feat here is taker payment spend fee
negotiation (I guess we will refactor namings in the swaps v2 code and rename this to taker payment fee
/funding spend fee
):
The negotiation goes as follows:
- Taker and maker each decide how much this fee should be at the beginning of the swap.
- The taker will send the maker their proposed fee during negotiation, if the maker deems the fee as low enough (less than 90% of the maker's own calculated fee), they will refuse to trade before the trade starts. Otherwise, they will continue and use this fee for validation later.
- The maker will validate that the taker has accounted for this fee in the funding transaction.
- The taker will validate that the taker payment preimage (generated by the maker) uses the negotiated fee or greater (greater number will deduct from the maker's trading volume anyway). If not, the taker will stop the trade since the maker is clearly stealing funds that isn't his which might affect the completion of the swap if the fee is low.
- was already fixed:
- immediate taker refund using S2
-
accept_only_from
our order peer.
- fixed in this PR:
- use a
u8
fork id - negotiate funding spend fee and let taker add it to the funding tx
- use a
- still missing:
- research: concurrent conf
-
recover_funds_for_swap
rpc for swaps v2 - investigation of why
test_taker_completes_swap_after_restart
is flaky - other refactors
Fixmes & discuss comments are intended to be covered in the PR.
@mariocynicys please add label for if this is under review or in progress.
@mariocynicys please merge dev to feature branch as it contains build fixes https://github.com/KomodoPlatform/komodo-defi-framework/actions/runs/8965111556/job/24617995991?pr=2109#step:8:574
error[E0463]: can't find crate for `core`
|
= note: the `x86_64-apple-darwin` target may not be installed
= help: consider downloading the target with `rustup target add x86_64-apple-darwin`
= help: consider building the standard library from source with `cargo build -Zbuild-std`
ps @mariocynicys this pr started to have conflicts
ps @mariocynicys lint check fails