Closed tiero closed 1 year ago
We published tdex-protobuf@v2, let's update business logic accordingly:
When making a preview, the daemon must return the fee amount for the asset specified by the user (he basically selects on the way in/out) and the corresponding price without charged fees. It's up to the user to correctly add or subtract the fee amount to craft the swap transaction properly.
When serving a trade proposal, the daemon must make sure the amounts in the transaction match those defined in the swap request message by repeating the same operation of applying the fees to the propose swap amount.
Closed by #697.
We should let the trader pick which asset he wants to be charged the fee in a chosen market. (now we always charge in the asset "on the way in")
One caveat is that there should be a "fee policy" in place that allow operators to disable the fee to be charged in a specific asset, especially important in the case of securities where you MUST charge always in the quote asset (or in general in the non-security asset).
Breaking change
This should bump the protocol to the V2, since the behavior of clients will then need to change along with the Swap protocol messages, where
amount_p
andamount_r
will need to be the actual amount WITHOUT fee added/subtracted (depending on the tradeType) and thefee_asset
andfee_amount
should be explicit in the SwapRequest