tdex-network / tdex-daemon

Go implementation of the TDEX Beta Daemon
https://tdex.network
MIT License
11 stars 13 forks source link

[v1] Update tdex-protobuf to v2 #670

Closed tiero closed 1 year ago

tiero commented 1 year ago

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 and amount_r will need to be the actual amount WITHOUT fee added/subtracted (depending on the tradeType) and the fee_asset and fee_amount should be explicit in the SwapRequest

tiero commented 1 year ago
image image image
altafan commented 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.

altafan commented 1 year ago

Closed by #697.