-
Notifications
You must be signed in to change notification settings - Fork 607
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(spike): taker fee #6034
feat(spike): taker fee #6034
Conversation
devbot help |
Hi! I'm DevBot, a bot that helps with common tasks in the development process. Commands:
|
devbot add changelog feat |
} | ||
} | ||
|
||
func TestDenomPairTakerFeeProposal_ValidateBasic(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to come back to this later, where I feel like we can make some more general method to get these guarantees
TakerFeeParams: TakerFeeParams{ | ||
DefaultTakerFee: sdk.MustNewDecFromStr("0.0015"), // 0.15% |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should be setting the precise param we want in the upgrade handler, and not have so many denoms in defaults
AuthorizedQuoteDenoms: []string{ | ||
"uosmo", | ||
"ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2", // ATOM | ||
"ibc/0CD3A0285E1341859B5E86B6AB7682F023D03E97607CCC1DC95706411D866DF7", // DAI | ||
"ibc/D189335C6E4A68B513C10AB227BF1C1D38C746766278BA3EEB4FB14124F1D858", // USDC | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(For testnets) we may want it s.t. if this list is blank, it allows anything.
That can be done in a mainnet non-breaking way, so can be done later.
I propose we get pool-manager side in a state were proud of as one PR, and then txfees as second |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Core logic LGTM, nice work. Approving to get this base PR in, understanding that there are potential changes that will need to be done in follow up PRs as discussed on call
* add taker fee determination and extraction * remove osmo multi hop logic * route to both community pool and staking rewards * fix a handfull of tests * assign taker fee to pool at time of creation * pull taker fee direct from pool struct * fix more tests * fix tests, set back up osmo multi hop discount * correct taker fee extraction * regen mocks * abstract taker fee to pool manager (highest lvl) * fix extract cmd * update changelog * tidy * remove param that no longer exists * add extra params to genesis logic * add back osmo multihop tests * add comment * fix e2e keeping prints * fixes * more test fixes * remove prints * more naive approach to determining taker fee * fix e2e * re-enable disabled test * minor cleaning * simplify params * not nullable * clean up * add whitelist set message denom pair taker fees * use real addresses * add gov prop for denom pair taker fee update * clean * move logic to its own taker_fee.go file * add CLI for gov prop for denomPairTakerFee * add admin address denomPairTakerFee cli msg * clean and simplifications * use authorized quote denoms from poolmanger * remove stableswap taker fee * sim msg change * add test for CLI * msg server tests * add route_test test * add gov_test.go * add msgs_test.go * remove print line * change from v18 to v19 * Update upgrades.go * set default taker fee to zero in upgrade handler * conflicts * Update proto/osmosis/poolmanager/v1beta1/genesis.proto * Update proto/osmosis/poolmanager/v1beta1/genesis.proto * Update x/poolmanager/taker_fee.go * Generated protofile changes * rename extractTakerFeeAndDistribute to chargeTakerFee * clean up * comment * rename * godoc for NonNativeFeeCollectorForCommunityPoolName * baseDenom to defaultFeesDenom name change * fix upgrade handler * fix AfterEpochEnd order of denoms when getting pools; reduce code dupl; tests * fix track volume * add key separator for pool manager * add comment to denom pair route * add basic lexicographical key test * update chargeTakerFee godoc * set the default taker fee back to non zero for e2e * change PoolMangerGetParams API to GetAuthorizedQuoteDenoms (same for setters) * update txfees & poolmanager READMEs with takerFee * fix merge main * add comment to denom pair taker fee * de-dup taker fee param validation * Update x/poolmanager/types/msgs.go * Apply suggestions from code review * Update x/poolmanager/taker_fee.go * remove unneeded setup test * get pool creation free from previous * take non native out of name * undo param pull instead of default * use current pool creation fee * use default * e2e --------- Co-authored-by: devbot-wizard <[email protected]> Co-authored-by: Roman <[email protected]> Co-authored-by: github-actions <[email protected]> Co-authored-by: alpo <[email protected]> Co-authored-by: Dev Ojha <[email protected]> Co-authored-by: Dev Ojha <[email protected]> (cherry picked from commit 5c8fd80) # Conflicts: # CHANGELOG.md # tests/e2e/e2e_test.go # x/poolmanager/export_test.go # x/poolmanager/router.go # x/poolmanager/types/keys.go
* feat(spike): taker fee (#6034) * add taker fee determination and extraction * remove osmo multi hop logic * route to both community pool and staking rewards * fix a handfull of tests * assign taker fee to pool at time of creation * pull taker fee direct from pool struct * fix more tests * fix tests, set back up osmo multi hop discount * correct taker fee extraction * regen mocks * abstract taker fee to pool manager (highest lvl) * fix extract cmd * update changelog * tidy * remove param that no longer exists * add extra params to genesis logic * add back osmo multihop tests * add comment * fix e2e keeping prints * fixes * more test fixes * remove prints * more naive approach to determining taker fee * fix e2e * re-enable disabled test * minor cleaning * simplify params * not nullable * clean up * add whitelist set message denom pair taker fees * use real addresses * add gov prop for denom pair taker fee update * clean * move logic to its own taker_fee.go file * add CLI for gov prop for denomPairTakerFee * add admin address denomPairTakerFee cli msg * clean and simplifications * use authorized quote denoms from poolmanger * remove stableswap taker fee * sim msg change * add test for CLI * msg server tests * add route_test test * add gov_test.go * add msgs_test.go * remove print line * change from v18 to v19 * Update upgrades.go * set default taker fee to zero in upgrade handler * conflicts * Update proto/osmosis/poolmanager/v1beta1/genesis.proto * Update proto/osmosis/poolmanager/v1beta1/genesis.proto * Update x/poolmanager/taker_fee.go * Generated protofile changes * rename extractTakerFeeAndDistribute to chargeTakerFee * clean up * comment * rename * godoc for NonNativeFeeCollectorForCommunityPoolName * baseDenom to defaultFeesDenom name change * fix upgrade handler * fix AfterEpochEnd order of denoms when getting pools; reduce code dupl; tests * fix track volume * add key separator for pool manager * add comment to denom pair route * add basic lexicographical key test * update chargeTakerFee godoc * set the default taker fee back to non zero for e2e * change PoolMangerGetParams API to GetAuthorizedQuoteDenoms (same for setters) * update txfees & poolmanager READMEs with takerFee * fix merge main * add comment to denom pair taker fee * de-dup taker fee param validation * Update x/poolmanager/types/msgs.go * Apply suggestions from code review * Update x/poolmanager/taker_fee.go * remove unneeded setup test * get pool creation free from previous * take non native out of name * undo param pull instead of default * use current pool creation fee * use default * e2e --------- Co-authored-by: devbot-wizard <[email protected]> Co-authored-by: Roman <[email protected]> Co-authored-by: github-actions <[email protected]> Co-authored-by: alpo <[email protected]> Co-authored-by: Dev Ojha <[email protected]> Co-authored-by: Dev Ojha <[email protected]> (cherry picked from commit 5c8fd80) # Conflicts: # CHANGELOG.md # tests/e2e/e2e_test.go # x/poolmanager/export_test.go # x/poolmanager/router.go # x/poolmanager/types/keys.go * fix merge conflicts * change json * inc num heights to wait * Update .github/workflows/test.yml * test with v18 init image * removed old upgrade logic --------- Co-authored-by: Adam Tucker <[email protected]> Co-authored-by: Adam Tucker <[email protected]> Co-authored-by: Dev Ojha <[email protected]>
* add taker fee determination and extraction * remove osmo multi hop logic * route to both community pool and staking rewards * fix a handfull of tests * assign taker fee to pool at time of creation * pull taker fee direct from pool struct * fix more tests * fix tests, set back up osmo multi hop discount * correct taker fee extraction * regen mocks * abstract taker fee to pool manager (highest lvl) * fix extract cmd * update changelog * tidy * remove param that no longer exists * add extra params to genesis logic * add back osmo multihop tests * add comment * fix e2e keeping prints * fixes * more test fixes * remove prints * more naive approach to determining taker fee * fix e2e * re-enable disabled test * minor cleaning * simplify params * not nullable * clean up * add whitelist set message denom pair taker fees * use real addresses * add gov prop for denom pair taker fee update * clean * move logic to its own taker_fee.go file * add CLI for gov prop for denomPairTakerFee * add admin address denomPairTakerFee cli msg * clean and simplifications * use authorized quote denoms from poolmanger * remove stableswap taker fee * sim msg change * add test for CLI * msg server tests * add route_test test * add gov_test.go * add msgs_test.go * remove print line * change from v18 to v19 * Update upgrades.go * set default taker fee to zero in upgrade handler * conflicts * Update proto/osmosis/poolmanager/v1beta1/genesis.proto * Update proto/osmosis/poolmanager/v1beta1/genesis.proto * Update x/poolmanager/taker_fee.go * Generated protofile changes * rename extractTakerFeeAndDistribute to chargeTakerFee * clean up * comment * rename * godoc for NonNativeFeeCollectorForCommunityPoolName * baseDenom to defaultFeesDenom name change * fix upgrade handler * fix AfterEpochEnd order of denoms when getting pools; reduce code dupl; tests * fix track volume * add key separator for pool manager * add comment to denom pair route * add basic lexicographical key test * update chargeTakerFee godoc * set the default taker fee back to non zero for e2e * change PoolMangerGetParams API to GetAuthorizedQuoteDenoms (same for setters) * update txfees & poolmanager READMEs with takerFee * fix merge main * add comment to denom pair taker fee * de-dup taker fee param validation * Update x/poolmanager/types/msgs.go * Apply suggestions from code review * Update x/poolmanager/taker_fee.go * remove unneeded setup test * get pool creation free from previous * take non native out of name * undo param pull instead of default * use current pool creation fee * use default * e2e --------- Co-authored-by: devbot-wizard <[email protected]> Co-authored-by: Roman <[email protected]> Co-authored-by: github-actions <[email protected]> Co-authored-by: alpo <[email protected]> Co-authored-by: Dev Ojha <[email protected]> Co-authored-by: Dev Ojha <[email protected]>
Closes: #XXX
What is the purpose of the change
This feature adds taker fee logic to poolmanager when making a swap. It is important to note that all swap logic messages are routed through poolmanager. This means that if you call a swap method directly in GAMM or CL (and not via the message), taker fees will not be charged.
There are two txfees module accounts that taker fees accrue and get swapped in: An account for staking rewards and an account for community pool.
If the taker fee is in osmo:
If the taker fee is non osmo but a whitelisted quote asset:
If the taker fee is non osmo and non whitelisted quote asset:
hooks.go, taker_fee.go, and router.go will be the ones to pay the most attention to.
Pre v19 Release:
Post v19 Release:
Testing and Verifying
TBD
Documentation and Release Note
Unreleased
section ofCHANGELOG.md
?Where is the change documented?
x/{module}/README.md
)