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

feat(UTXO swaps): kmd burn plan impl #2006

Merged
merged 12 commits into from
Nov 22, 2023
Merged

feat(UTXO swaps): kmd burn plan impl #2006

merged 12 commits into from
Nov 22, 2023

Conversation

onur-ozkan
Copy link
Member

@onur-ozkan onur-ozkan commented Nov 14, 2023

For KMD, taker fee payment algorithm is updated by burning up to 25% of the dex fee amount.

  • Add a new output to the DEX fee transaction that is an OP_RETURN with up to 25% of the fee burned in KMD.
  • Validate the new output by the maker as part of the taker fee validation step.

Helps with: #2010

@onur-ozkan onur-ozkan added enhancement New feature or request in progress Changes will be made from the author labels Nov 14, 2023
@onur-ozkan onur-ozkan changed the title feat(UTXO swaps): KMD burn plan impl feat(UTXO): KMD burn plan impl Nov 14, 2023
@onur-ozkan onur-ozkan changed the title feat(UTXO): KMD burn plan impl feat(UTXO): kmd burn plan impl Nov 14, 2023
@onur-ozkan onur-ozkan changed the title feat(UTXO): kmd burn plan impl feat(UTXO swaps): kmd burn plan impl Nov 14, 2023
@onur-ozkan onur-ozkan force-pushed the kmd-op-return branch 2 times, most recently from 5664cd9 to d07137f Compare November 14, 2023 20:20
@onur-ozkan onur-ozkan marked this pull request as ready for review November 14, 2023 20:33
Signed-off-by: onur-ozkan <work@onurozkan.dev>
@onur-ozkan onur-ozkan force-pushed the kmd-op-return branch 2 times, most recently from 5427fd1 to ffc1710 Compare November 14, 2023 21:14
Signed-off-by: onur-ozkan <work@onurozkan.dev>
Signed-off-by: onur-ozkan <work@onurozkan.dev>
Signed-off-by: onur-ozkan <work@onurozkan.dev>
Signed-off-by: onur-ozkan <work@onurozkan.dev>
Signed-off-by: onur-ozkan <work@onurozkan.dev>
@artemii235
Copy link
Member

Implement this feature for the trading protocol upgrade.

As discussed in DM, I can take care of implementing this for the trading protocol upgrade a bit later (likely in the next iteration) 🙂

@artemii235 artemii235 mentioned this pull request Nov 16, 2023
21 tasks
@onur-ozkan onur-ozkan added under review and removed in progress Changes will be made from the author labels Nov 16, 2023
Copy link
Collaborator

@shamardy shamardy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fast PR! First review iteration where I just make sure calculations are right :)

Please also fix the failing test_dex_fee_amount test.

mm2src/mm2_main/src/lp_swap.rs Outdated Show resolved Hide resolved
Signed-off-by: onur-ozkan <work@onurozkan.dev>
@onur-ozkan onur-ozkan force-pushed the kmd-op-return branch 2 times, most recently from 103e9d9 to 925b39d Compare November 18, 2023 10:19
Signed-off-by: onur-ozkan <work@onurozkan.dev>
Copy link
Member

@artemii235 artemii235 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! I have two notes.
Please also fix Clippy lints (CI fails).

mm2src/mm2_main/src/lp_swap.rs Outdated Show resolved Hide resolved
mm2src/mm2_main/src/lp_swap.rs Outdated Show resolved Hide resolved
Signed-off-by: onur-ozkan <work@onurozkan.dev>
Signed-off-by: onur-ozkan <work@onurozkan.dev>
Signed-off-by: onur-ozkan <work@onurozkan.dev>
Copy link
Collaborator

@shamardy shamardy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the Fixes! Next review iteration where we can now see how to handle different usage for dex_fee_amount after we used an enum.

mm2src/mm2_main/src/lp_swap.rs Outdated Show resolved Hide resolved
mm2src/mm2_main/src/lp_swap/taker_swap.rs Outdated Show resolved Hide resolved
mm2src/mm2_main/src/lp_swap/taker_swap.rs Outdated Show resolved Hide resolved
mm2src/mm2_main/src/lp_swap/taker_swap.rs Outdated Show resolved Hide resolved
mm2src/mm2_main/src/lp_swap/taker_swap.rs Outdated Show resolved Hide resolved
mm2src/mm2_main/src/lp_swap/taker_swap.rs Outdated Show resolved Hide resolved
Signed-off-by: onur-ozkan <work@onurozkan.dev>
Copy link
Collaborator

@shamardy shamardy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥 🔥 🔥

Copy link
Member

@artemii235 artemii235 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work 👍

@shamardy
Copy link
Collaborator

@KomodoPlatform/qa this PR is ready to be tested and documented if needed, it has high priority as it's needed in the next breaking release 1.1.0-beta.

@shamardy shamardy added the breaking-change might require breaking backward compatibility label Nov 22, 2023
@shamardy
Copy link
Collaborator

As confirmed by @smk762 on DM, he already tested an earlier version of this PR so I will merge this PR to dev and then it can be tested inside GUIs along other recent changes in dev.

@shamardy shamardy merged commit 0221505 into dev Nov 22, 2023
35 of 38 checks passed
@shamardy shamardy deleted the kmd-op-return branch November 22, 2023 10:05
dimxy added a commit to dimxy/komodo-defi-framework that referenced this pull request Dec 21, 2023
* dev: (22 commits)
  chore(config): remove vscode launchjson (KomodoPlatform#2040)
  feat(trading-proto-upgrade): wasm DB, kickstart, refund states, v2 RPCs (KomodoPlatform#2015)
  feat(UTXO): balance event streaming for Electrum clients (KomodoPlatform#2013)
  feat(tx): add new sign_raw_transaction rpc for UTXO and EVM coins (KomodoPlatform#1930)
  fix(p2p): handle encode_and_sign errors (KomodoPlatform#2038)
  chore(release): add changelog entries for v2.0.0-beta (KomodoPlatform#2037)
  chore(network): write network information to stdout (KomodoPlatform#2034)
  fix(price_endpoints): add cached url (KomodoPlatform#2032)
  deps(network): sync with upstream yamux (KomodoPlatform#2030)
  fix(config): accept a string as rpcport value (KomodoPlatform#2026)
  feat(nft): move db lock, add tx fee and confirmations (KomodoPlatform#1989)
  chore(network): update seednodes for netid 8762 (KomodoPlatform#2024)
  chore(network): add todo on peer storage behaviour (KomodoPlatform#2025)
  chore(network): exclude `168.119.236.249` from the seednode list (KomodoPlatform#2021)
  feat(network): deprecate 7777 network (KomodoPlatform#2020)
  chore(release): bump mm2 version to 2.0.0-beta (KomodoPlatform#2018)
  feat(UTXO swaps): kmd burn plan impl (KomodoPlatform#2006)
  chore(docs): fix the link to simple market maker in README.md (KomodoPlatform#2011)
  refactor(cli): cli dependency updates and warn on bad config perm (KomodoPlatform#1956)
  chore(containers and docs): update docs and container images (KomodoPlatform#2003)
  ...

# Conflicts:
#	mm2src/mm2_main/tests/mm2_tests/mm2_tests_inner.rs
#	mm2src/mm2_test_helpers/src/for_tests.rs
dimxy added a commit to dimxy/komodo-defi-framework that referenced this pull request Jan 23, 2024
* dev: (24 commits)
  chore(release): bump mm2 version to 2.1.0-beta (KomodoPlatform#2044)
  feat(trezor): add segwit support for withdraw with trezor (KomodoPlatform#1984)
  chore(config): remove vscode launchjson (KomodoPlatform#2040)
  feat(trading-proto-upgrade): wasm DB, kickstart, refund states, v2 RPCs (KomodoPlatform#2015)
  feat(UTXO): balance event streaming for Electrum clients (KomodoPlatform#2013)
  feat(tx): add new sign_raw_transaction rpc for UTXO and EVM coins (KomodoPlatform#1930)
  fix(p2p): handle encode_and_sign errors (KomodoPlatform#2038)
  chore(release): add changelog entries for v2.0.0-beta (KomodoPlatform#2037)
  chore(network): write network information to stdout (KomodoPlatform#2034)
  fix(price_endpoints): add cached url (KomodoPlatform#2032)
  deps(network): sync with upstream yamux (KomodoPlatform#2030)
  fix(config): accept a string as rpcport value (KomodoPlatform#2026)
  feat(nft): move db lock, add tx fee and confirmations (KomodoPlatform#1989)
  chore(network): update seednodes for netid 8762 (KomodoPlatform#2024)
  chore(network): add todo on peer storage behaviour (KomodoPlatform#2025)
  chore(network): exclude `168.119.236.249` from the seednode list (KomodoPlatform#2021)
  feat(network): deprecate 7777 network (KomodoPlatform#2020)
  chore(release): bump mm2 version to 2.0.0-beta (KomodoPlatform#2018)
  feat(UTXO swaps): kmd burn plan impl (KomodoPlatform#2006)
  chore(docs): fix the link to simple market maker in README.md (KomodoPlatform#2011)
  ...
@shamardy shamardy added breaking-change: swaps and removed breaking-change might require breaking backward compatibility labels Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants