KomodoPlatform / komodo-defi-framework

This is the official Komodo DeFi Framework repository
https://komodoplatform.com/en/docs/komodo-defi-framework/
106 stars 94 forks source link

Add burning part of dex fee for non-KMD coins #2269

Open dimxy opened 2 weeks ago

dimxy commented 2 weeks ago

Task description

Currently we support burning 25% of the dex fee paid by the taker only in KMD coins. This amount in KMD is sent to an OP_RETURN output that burns it. We want to retain this for KMD but for other coins send 25% percent of the taker’s dex fee to a dedicated ‘burn’ account. An off-chain node periodically will be creating swaps with coins on the ‘burn’ accounts to buy KMD which will be burned (by sending to an OP_RETURN output).

What is done already

Currently we burn 25% of the taker fee for KMD coins. This is done both for swaps v1 and v2 only. There is a DexFee::WithBurn enum variant which is created by the taker for the KMD trade part of the swap and checked by the maker that the KMD transaction has an output with this amount sent to OP_RETURN (burned). The remaining DexFee::Standard variant is used for non-KMD coins and means all the dex fee goes to the dex reward account.

Burning for all coins - requirements

Activation of the new feature in MM2

We need to add version in legacy swap protocol so updated maker node can understand that remote taker is new and support extended DexFee. The upgraded maker nodes will support both the old DexFee and extended DexFee options for some time, to allow users to upgrade. Eventually the DexFee::Standard option will be disabled in the maker dex fee validation code. For the taker code we just add the new enum variant and begin to use it after the app rebuilding.