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

Single sided liquidity add breaking/recovery #1085

Merged
merged 2 commits into from
Dec 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions x/amm/keeper/msg_server_join_pool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func (suite *AmmKeeperTestSuite) TestMsgServerJoinPool() {
FeeDenom: ptypes.BaseCurrency,
},
// shareOutAmount: math.NewInt(694444166666666666), // weight breaking fee - slippage enable
shareOutAmount: math.NewInt(997171572875253810), // weight breaking fee - slippage disable
shareOutAmount: math.NewInt(999057190958417937), // weight breaking fee - slippage disable
expSenderBalance: sdk.Coins{},
expTokenIn: sdk.Coins{sdk.NewInt64Coin("uusdt", 1000000)},
expPass: true,
Expand All @@ -75,7 +75,7 @@ func (suite *AmmKeeperTestSuite) TestMsgServerJoinPool() {
FeeDenom: ptypes.BaseCurrency,
},
// shareOutAmount: math.NewInt(805987500000000000), // weight recovery direction - slippage enable
shareOutAmount: math.NewInt(992205771365940052), // weight recovery direction - slippage disable
shareOutAmount: math.NewInt(996102885682970026), // weight recovery direction - slippage disable
expSenderBalance: sdk.Coins{},
expTokenIn: sdk.Coins{sdk.NewInt64Coin("uusdt", 1000000)},
expPass: true,
Expand Down
3 changes: 3 additions & 0 deletions x/amm/types/pool_join_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,9 @@
initialWeightIn := GetDenomOracleAssetWeight(ctx, p.PoolId, oracleKeeper, initialAssetPools, tokenInDenom)
initialWeightOut := sdkmath.LegacyOneDec().Sub(initialWeightIn)
weightBreakingFee := GetWeightBreakingFee(finalWeightIn, finalWeightOut, targetWeightIn, targetWeightOut, initialWeightIn, initialWeightOut, distanceDiff, params)
// apply percentage to fees, consider improvement or reduction of other token
// Other denom weight ratio to reduce the weight breaking fees
weightBreakingFee = weightBreakingFee.Mul(finalWeightOut)

Check warning on line 209 in x/amm/types/pool_join_pool.go

View check run for this annotation

Codecov / codecov/patch

x/amm/types/pool_join_pool.go#L207-L209

Added lines #L207 - L209 were not covered by tests

// weight recovery reward = weight breaking fee * weight breaking fee portion
weightRecoveryReward := weightBreakingFee.Mul(params.WeightBreakingFeePortion)
Expand Down
Loading