-
Notifications
You must be signed in to change notification settings - Fork 608
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
Disable create pool with non exit fee #4767
Merged
Merged
Changes from 5 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
061f0e4
disable in create pool
hieuvubk 4a35d22
fix ttests
hieuvubk 4f5773a
fix e2e
hieuvubk 6af7c9c
add test case
hieuvubk 5536b82
change exit fee e2e
hieuvubk 90730d9
refactor
hieuvubk 4a0cc6a
update changelog
hieuvubk e1304d8
update proto
hieuvubk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,7 @@ import ( | |
|
||
var ( | ||
defaultSwapFee = sdk.MustNewDecFromStr("0.025") | ||
defaultExitFee = sdk.MustNewDecFromStr("0.025") | ||
defaultExitFee = sdk.ZeroDec() | ||
defaultPoolParams = balancer.PoolParams{ | ||
SwapFee: defaultSwapFee, | ||
ExitFee: defaultExitFee, | ||
|
@@ -88,31 +88,31 @@ func (suite *KeeperTestSuite) TestCreateBalancerPool() { | |
name: "create a pool with negative swap fee", | ||
msg: balancer.NewMsgCreateBalancerPool(testAccount, balancer.PoolParams{ | ||
SwapFee: sdk.NewDecWithPrec(-1, 2), | ||
ExitFee: sdk.NewDecWithPrec(1, 2), | ||
ExitFee: defaultExitFee, | ||
}, defaultPoolAssets, defaultFutureGovernor), | ||
emptySender: false, | ||
expectPass: false, | ||
}, { | ||
name: "create a pool with negative exit fee", | ||
name: "create a pool with non zero exit fee", | ||
msg: balancer.NewMsgCreateBalancerPool(testAccount, balancer.PoolParams{ | ||
SwapFee: sdk.NewDecWithPrec(1, 2), | ||
ExitFee: sdk.NewDecWithPrec(-1, 2), | ||
ExitFee: sdk.NewDecWithPrec(1, 2), | ||
}, defaultPoolAssets, defaultFutureGovernor), | ||
emptySender: false, | ||
expectPass: false, | ||
}, { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. imo we should test both a negative and a non zero exit fee |
||
name: "create the pool with empty PoolAssets", | ||
msg: balancer.NewMsgCreateBalancerPool(testAccount, balancer.PoolParams{ | ||
SwapFee: sdk.NewDecWithPrec(1, 2), | ||
ExitFee: sdk.NewDecWithPrec(1, 2), | ||
ExitFee: defaultExitFee, | ||
}, []balancertypes.PoolAsset{}, defaultFutureGovernor), | ||
emptySender: false, | ||
expectPass: false, | ||
}, { | ||
name: "create the pool with 0 weighted PoolAsset", | ||
msg: balancer.NewMsgCreateBalancerPool(testAccount, balancer.PoolParams{ | ||
SwapFee: sdk.NewDecWithPrec(1, 2), | ||
ExitFee: sdk.NewDecWithPrec(1, 2), | ||
ExitFee: defaultExitFee, | ||
}, []balancertypes.PoolAsset{{ | ||
Weight: sdk.NewInt(0), | ||
Token: sdk.NewCoin("foo", sdk.NewInt(10000)), | ||
|
@@ -126,7 +126,7 @@ func (suite *KeeperTestSuite) TestCreateBalancerPool() { | |
name: "create the pool with negative weighted PoolAsset", | ||
msg: balancer.NewMsgCreateBalancerPool(testAccount, balancer.PoolParams{ | ||
SwapFee: sdk.NewDecWithPrec(1, 2), | ||
ExitFee: sdk.NewDecWithPrec(1, 2), | ||
ExitFee: defaultExitFee, | ||
}, []balancertypes.PoolAsset{{ | ||
Weight: sdk.NewInt(-1), | ||
Token: sdk.NewCoin("foo", sdk.NewInt(10000)), | ||
|
@@ -140,7 +140,7 @@ func (suite *KeeperTestSuite) TestCreateBalancerPool() { | |
name: "create the pool with 0 balance PoolAsset", | ||
msg: balancer.NewMsgCreateBalancerPool(testAccount, balancer.PoolParams{ | ||
SwapFee: sdk.NewDecWithPrec(1, 2), | ||
ExitFee: sdk.NewDecWithPrec(1, 2), | ||
ExitFee: defaultExitFee, | ||
}, []balancertypes.PoolAsset{{ | ||
Weight: sdk.NewInt(100), | ||
Token: sdk.NewCoin("foo", sdk.NewInt(0)), | ||
|
@@ -154,7 +154,7 @@ func (suite *KeeperTestSuite) TestCreateBalancerPool() { | |
name: "create the pool with negative balance PoolAsset", | ||
msg: balancer.NewMsgCreateBalancerPool(testAccount, balancer.PoolParams{ | ||
SwapFee: sdk.NewDecWithPrec(1, 2), | ||
ExitFee: sdk.NewDecWithPrec(1, 2), | ||
ExitFee: defaultExitFee, | ||
}, []balancertypes.PoolAsset{{ | ||
Weight: sdk.NewInt(100), | ||
Token: sdk.Coin{ | ||
|
@@ -171,7 +171,7 @@ func (suite *KeeperTestSuite) TestCreateBalancerPool() { | |
name: "create the pool with duplicated PoolAssets", | ||
msg: balancer.NewMsgCreateBalancerPool(testAccount, balancer.PoolParams{ | ||
SwapFee: sdk.NewDecWithPrec(1, 2), | ||
ExitFee: sdk.NewDecWithPrec(1, 2), | ||
ExitFee: defaultExitFee, | ||
}, []balancertypes.PoolAsset{{ | ||
Weight: sdk.NewInt(100), | ||
Token: sdk.NewCoin("foo", sdk.NewInt(10000)), | ||
|
@@ -515,7 +515,7 @@ func (suite *KeeperTestSuite) TestJoinPoolNoSwap() { | |
// Create the pool at first | ||
msg := balancer.NewMsgCreateBalancerPool(testAccount, balancer.PoolParams{ | ||
SwapFee: sdk.NewDecWithPrec(1, 2), | ||
ExitFee: sdk.NewDecWithPrec(1, 2), | ||
ExitFee: defaultExitFee, | ||
}, defaultPoolAssets, defaultFutureGovernor) | ||
poolId, err := poolmanagerKeeper.CreatePool(suite.Ctx, msg) | ||
suite.Require().NoError(err, "test: %v", test.name) | ||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -34,23 +34,23 @@ func (suite *KeeperTestSuite) TestPoolCreationFee() { | |||||
poolCreationFee: sdk.Coins{}, | ||||||
msg: balancer.NewMsgCreateBalancerPool(suite.TestAccs[0], balancer.PoolParams{ | ||||||
SwapFee: sdk.NewDecWithPrec(1, 2), | ||||||
ExitFee: sdk.NewDecWithPrec(1, 2), | ||||||
ExitFee: sdk.ZeroDec(), | ||||||
}, apptesting.DefaultPoolAssets, ""), | ||||||
expectPass: true, | ||||||
}, { | ||||||
name: "nil pool creation fee on basic pool", | ||||||
poolCreationFee: nil, | ||||||
msg: balancer.NewMsgCreateBalancerPool(suite.TestAccs[0], balancer.PoolParams{ | ||||||
SwapFee: sdk.NewDecWithPrec(1, 2), | ||||||
ExitFee: sdk.NewDecWithPrec(1, 2), | ||||||
ExitFee: sdk.ZeroDec(), | ||||||
}, apptesting.DefaultPoolAssets, ""), | ||||||
expectPass: true, | ||||||
}, { | ||||||
name: "attempt pool creation without sufficient funds for fees", | ||||||
poolCreationFee: sdk.Coins{sdk.NewCoin("atom", sdk.NewInt(10000))}, | ||||||
msg: balancer.NewMsgCreateBalancerPool(suite.TestAccs[0], balancer.PoolParams{ | ||||||
SwapFee: sdk.NewDecWithPrec(1, 2), | ||||||
ExitFee: sdk.NewDecWithPrec(1, 2), | ||||||
ExitFee: sdk.ZeroDec(), | ||||||
}, apptesting.DefaultPoolAssets, ""), | ||||||
expectPass: false, | ||||||
}, | ||||||
|
@@ -128,6 +128,17 @@ func (suite *KeeperTestSuite) TestCreatePool() { | |||||
}, | ||||||
}, "") | ||||||
|
||||||
invalidBalancerPoolMsg := balancer.NewMsgCreateBalancerPool(suite.TestAccs[0], balancer.NewPoolParams(sdk.ZeroDec(), sdk.NewDecWithPrec(1, 2), nil), []balancer.PoolAsset{ | ||||||
{ | ||||||
Token: sdk.NewCoin(foo, defaultInitPoolAmount), | ||||||
Weight: sdk.NewInt(1), | ||||||
}, | ||||||
{ | ||||||
Token: sdk.NewCoin(bar, defaultInitPoolAmount), | ||||||
Weight: sdk.NewInt(1), | ||||||
}, | ||||||
}, "") | ||||||
|
||||||
validConcentratedPoolMsg := clmodel.NewMsgCreateConcentratedPool(suite.TestAccs[0], foo, bar, 1, DefaultExponentAtPriceOne, defaultPoolSwapFee) | ||||||
|
||||||
tests := []struct { | ||||||
|
@@ -155,6 +166,13 @@ func (suite *KeeperTestSuite) TestCreatePool() { | |||||
msg: validConcentratedPoolMsg, | ||||||
expectedModuleType: concentratedKeeperType, | ||||||
}, | ||||||
{ | ||||||
name: "pool with non zero exit fee - success", | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
creatorFundAmount: sdk.NewCoins(sdk.NewCoin(foo, defaultInitPoolAmount.Mul(sdk.NewInt(2))), sdk.NewCoin(bar, defaultInitPoolAmount.Mul(sdk.NewInt(2)))), | ||||||
msg: invalidBalancerPoolMsg, | ||||||
expectedModuleType: gammKeeperType, | ||||||
expectError: true, | ||||||
}, | ||||||
// TODO: add stableswap test | ||||||
// TODO: add concentrated-liquidity test | ||||||
// TODO: cover errors and edge cases | ||||||
|
This file contains 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
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.
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.
nit: can we just define a
defaultZeroExitFee
in the keeper_test file as a global var and use it everywhere?