Skip to content

Commit

Permalink
change replenish only terra and do constant product to compute luna
Browse files Browse the repository at this point in the history
  • Loading branch information
Yun committed Sep 24, 2019
1 parent 291c66f commit 2f951ed
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions x/market/internal/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ func (k Keeper) SetLastUpdateHeight(ctx sdk.Context, height int64) {
func (k Keeper) ReplenishPools(ctx sdk.Context) {
basePool := k.GetBasePool(ctx)
terraPool := k.GetTerraPool(ctx)
lunaPool := k.GetLunaPool(ctx)

regressionAmt := basePool.QuoInt64(core.BlocksPerDay)

Expand All @@ -151,18 +150,8 @@ func (k Keeper) ReplenishPools(ctx sdk.Context) {
}
}

// Replenish luna pool towards base pool
if lunaPool.GT(basePool) {
lunaPool = lunaPool.Sub(regressionAmt)
if lunaPool.LT(basePool) {
lunaPool = basePool
}
} else if lunaPool.LT(basePool) {
lunaPool = lunaPool.Add(regressionAmt)
if lunaPool.GT(basePool) {
lunaPool = basePool
}
}
cp := basePool.Mul(basePool)
lunaPool := cp.Quo(terraPool)

k.SetTerraPool(ctx, terraPool)
k.SetLunaPool(ctx, lunaPool)
Expand Down

0 comments on commit 2f951ed

Please sign in to comment.