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: Network Fee from Boost #5495

Merged
merged 3 commits into from
Dec 16, 2024
Merged

Feat: Network Fee from Boost #5495

merged 3 commits into from
Dec 16, 2024

Conversation

msgmaxim
Copy link
Contributor

@msgmaxim msgmaxim commented Dec 12, 2024

Pull Request

Closes: PRO-1778

Summary

  • New storage item: NetworkFeeDeductionFromBoostPercents representing the % of boost fee to be taken as network fee. Its value is initially 0, and can be updated via update_pallet_config governance extrinsic.
  • When a deposit is boosted, the full boost fee is "deducted" from the deposit, but we now apply network fee reduction when recording the amounts to be credited to boosters upon finalisation.
  • When a boosted deposit is finalised, we add up all funds credited to boosters, and any non-zero excees amount is swaped into FLIP as network fee. (The swap request's type being NetworkFee takes care of the resulting flip being scheduled for burning later.)
  • DepositFinalised (when action is BoostersCredited) now additionally exposes network_fee_swap_request_id (of the network fee swap), and network_fee_from_boost (the amount of input asset to be swapped).
  • Added network_fee_deduction to cf_boost_pool_details rpc.
  • Added tests that should cover all new behaviour.

I haven't added network_fee_decution to DepositBoosted (there still seems to be an ongoing discussion whether this should be necessary), but it shouldn't be too difficult to add if needed (though maybe with a name indicating that it is not confirmed?).

@msgmaxim msgmaxim requested a review from kylezs December 12, 2024 06:32
@msgmaxim msgmaxim changed the title feat: boost fee split Feat: Network Fee from Boost Dec 12, 2024
Copy link

codecov bot commented Dec 12, 2024

Codecov Report

Attention: Patch coverage is 91.15385% with 23 lines in your changes missing coverage. Please review.

Project coverage is 72%. Comparing base (09292c9) to head (9390705).
Report is 8 commits behind head on main.

Files with missing lines Patch % Lines
state-chain/pallets/cf-ingress-egress/src/lib.rs 71% 18 Missing and 1 partial ⚠️
...-chain/pallets/cf-ingress-egress/src/boost_pool.rs 87% 1 Missing and 1 partial ⚠️
state-chain/runtime/src/lib.rs 33% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@          Coverage Diff           @@
##            main   #5495    +/-   ##
======================================
- Coverage     72%     72%    -0%     
======================================
  Files        495     495            
  Lines      88124   88254   +130     
  Branches   88124   88254   +130     
======================================
+ Hits       63144   63170    +26     
- Misses     22401   22516   +115     
+ Partials    2579    2568    -11     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@msgmaxim msgmaxim marked this pull request as ready for review December 13, 2024 00:15
@msgmaxim msgmaxim requested a review from dandanlen as a code owner December 13, 2024 00:15
Copy link
Contributor

@kylezs kylezs left a comment

Choose a reason for hiding this comment

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

Nice one 👌 only pretty minor things

state-chain/custom-rpc/src/lib.rs Outdated Show resolved Hide resolved
state-chain/pallets/cf-ingress-egress/src/boost_pool.rs Outdated Show resolved Hide resolved
state-chain/pallets/cf-ingress-egress/src/boost_pool.rs Outdated Show resolved Hide resolved
state-chain/pallets/cf-ingress-egress/src/lib.rs Outdated Show resolved Hide resolved
state-chain/pallets/cf-ingress-egress/src/lib.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@dandanlen dandanlen left a comment

Choose a reason for hiding this comment

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

👌

@msgmaxim msgmaxim enabled auto-merge December 16, 2024 04:59
@msgmaxim msgmaxim added this pull request to the merge queue Dec 16, 2024
Merged via the queue into main with commit fac6363 Dec 16, 2024
48 checks passed
@msgmaxim msgmaxim deleted the feat/network-fee-from-boost branch December 16, 2024 06:22
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

Successfully merging this pull request may close these issues.

3 participants