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

Liquidity balancer pool PokeTokenWeights and params implementation #103

Merged
merged 19 commits into from
Apr 19, 2021
Merged
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
5ae3f53
LBP proto struct definitions & comments
ValarDragon Apr 17, 2021
0d6d75b
Make everything compile with new proto structs
ValarDragon Apr 17, 2021
c49f0ce
Delete SetTokenWeight, will convert to new API for smooth changes
ValarDragon Apr 17, 2021
12789ba
Fix bug with FuturePoolGovernor not being included in yaml
ValarDragon Apr 17, 2021
293fce1
Add PokeTokenWeights stub, complete up to missing arithmetic ops
ValarDragon Apr 17, 2021
6a6732a
Use PokeTokenWeights in correct locations
ValarDragon Apr 17, 2021
23e2d2f
Delete PoolAccount.PoolWeightsChanging
ValarDragon Apr 17, 2021
fa1c9a1
implement updateAllWeights
ValarDragon Apr 17, 2021
6db92be
Implement adding & subbing pool weights
ValarDragon Apr 17, 2021
da6ccd2
Complete initial implementation of PokeTokenWeights arithmetic
ValarDragon Apr 17, 2021
fd9bf03
Delete SetPoolParams, minor comment fixes
ValarDragon Apr 17, 2021
8dd02d5
More scaffolding for TestPoolAccountPokeTokenWeights
ValarDragon Apr 17, 2021
b31dd28
Add default test cases to every SmoothWeightChangeParams setup
ValarDragon Apr 17, 2021
ee505a3
Bug fix, tests written thus far passing
ValarDragon Apr 18, 2021
1dcd251
Figure out why SmoothWeightChangeParams weren't getting set to nil.
ValarDragon Apr 18, 2021
1f51df5
More test cases
ValarDragon Apr 18, 2021
a4d0c8e
Update test comments
ValarDragon Apr 18, 2021
93da9b9
Fix case of percent_duration_elapsed
ValarDragon Apr 19, 2021
5fca3c6
Move PokeTokenWeights to happen in GetPool()
ValarDragon Apr 19, 2021
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
Prev Previous commit
Next Next commit
More test cases
ValarDragon committed Apr 18, 2021
commit 1f51df5f0a30e0c2a7ac1a2974e620b6d97c2bd3
59 changes: 59 additions & 0 deletions x/gamm/types/account_test.go
Original file line number Diff line number Diff line change
@@ -442,6 +442,65 @@ func TestPoolAccountPokeTokenWeights(t *testing.T) {
sdk.NewInt(1500000),
},
},
{
// Quarter way through at 25 seconds elapsed
blockTime: time.Unix(defaultStartTimeUnix+25, 0),
expectedWeights: []sdk.Int{
sdk.NewInt(1 * 1000000),
// Quarter way between 1000000 & 2000000
sdk.NewInt(1250000),
},
},
},
},
{
// 2:2 pool, between test1 and test2
// transitioning to a 4:1 pool
params: SmoothWeightChangeParams{
StartTime: defaultStartTime,
Duration: defaultDuration,
InitialPoolWeights: []PoolAsset{
{
Weight: sdk.NewInt(2 * 1000000),
Token: sdk.NewCoin("asset1", sdk.NewInt(0)),
},
{
Weight: sdk.NewInt(2 * 1000000),
Token: sdk.NewCoin("asset2", sdk.NewInt(0)),
},
},
TargetPoolWeights: []PoolAsset{
{
Weight: sdk.NewInt(4 * 1000000),
Token: sdk.NewCoin("asset1", sdk.NewInt(0)),
},
{
Weight: sdk.NewInt(1 * 1000000),
Token: sdk.NewCoin("asset2", sdk.NewInt(0)),
},
},
},
cases: []testCase{
{
// Halfway through at 50 seconds elapsed
blockTime: time.Unix(defaultStartTimeUnix+50, 0),
expectedWeights: []sdk.Int{
// Halfway between 2000000 & 4000000
sdk.NewInt(3 * 1000000),
// Halfway between 1000000 & 2000000
sdk.NewInt(1500000),
},
},
{
// Quarter way through at 25 seconds elapsed
blockTime: time.Unix(defaultStartTimeUnix+25, 0),
expectedWeights: []sdk.Int{
// Quarter way between 2000000 & 4000000
sdk.NewInt(2500000),
// Quarter way between 1000000 & 2000000
ValarDragon marked this conversation as resolved.
Show resolved Hide resolved
sdk.NewInt(1750000),
},
},
},
},
}