feat: support dynamic fee tiers based on volume (#317)#376
Open
milah-247 wants to merge 1 commit intoWeb3Novalabs:mainfrom
Open
feat: support dynamic fee tiers based on volume (#317)#376milah-247 wants to merge 1 commit intoWeb3Novalabs:mainfrom
milah-247 wants to merge 1 commit intoWeb3Novalabs:mainfrom
Conversation
|
@milah-247 is attempting to deploy a commit to the shola's projects Team on Vercel. A member of the Team first needs to authorize it. |
Collaborator
|
@milah-247 relove conflict and ci |
Collaborator
|
@milah-247 any update on this |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Implements a dynamic fee tier system where the protocol fee percentage decreases as the total pool stake increases. This encourages participation in larger markets by rewarding high-volume pools with lower fees.
Related Issue
Fixes #317
Depends on #304
Type of Change
Changes Made
Testing
Checklist
Screenshots (if applicable)
N/A
Additional Notes
Files Modified:
contracts/predifi-contract/src/lib.rsFeeTierstruct,DataKey::FeeTiers,set_fee_tiers(),get_fee_tiers(),calculate_dynamic_fee_bps(), updatedclaim_winnings()contracts/predifi-contract/src/integration_test.rssetup_integration()contracts/predifi-contract/src/test.rscategoryargument tocreate_pool()callNew Data Structures:
New Admin Functions:
set_fee_tiers(env, admin, tiers)min_stakeascendingget_fee_tiers(env)Example Fee Tier Configuration:
New Events:
FeeTierUpdateEventFeeTierAppliedEventFee Calculation Logic (
claim_winnings):calculate_dynamic_fee_bps()iterates tiers in ascending order and returns the fee for the highest qualifying tierconfig.fee_bpsif no tiers are configured, maintaining full backward compatibilityTest Results: