Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
dimxy opened this issue Nov 8, 2024 · 0 comments
Open

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

dimxy opened this issue Nov 8, 2024 · 0 comments

Comments

@dimxy
Copy link
Collaborator

dimxy commented Nov 8, 2024

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

  • To implement this feature we add to extend DexFee::WithBurn { burn_amount } enum variant to indicate for non-KMD coins that burn_amount should be sent to a designated burn account (High priority).
  • For UTXO, privacy, tendermint coins the taker should add an output with ‘burn_amount’ (25% of the dex fee) sent to the burn account and the maker should validate this (High priority).
  • For ETH coins or ERC20 tokens:
    • For legacy swaps - we won't add support for burning to avoid extra gas spending.
    • For swaps v2 we will need to modify the existing contract and research optimal algorithm to get the burn path.
  • When the ‘burn’ account sells its non-KMD coins as the taker then it does not send 25% of the dex fee back to the ‘burn’ account. The maker should validate this in the dex fee transaction (High priority).
  • QA team: we need to designate the ‘burn’ pubkey in the code (High priority).
    This feature should be implemented both for existing and v2 (TPU) swaps (High priority).

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant