Skip to content

Commit

Permalink
feat(auction): upgrade handler and params
Browse files Browse the repository at this point in the history
  • Loading branch information
robert-zaremba committed May 15, 2024
1 parent a32c546 commit 29ba0f4
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 4 deletions.
36 changes: 34 additions & 2 deletions app/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
appparams "github.com/umee-network/umee/v6/app/params"
"github.com/umee-network/umee/v6/util"
leveragetypes "github.com/umee-network/umee/v6/x/leverage/types"
"github.com/umee-network/umee/v6/x/metoken"
)

// RegisterUpgradeHandlersregisters upgrade handlers.
Expand Down Expand Up @@ -50,9 +51,40 @@ func (app UmeeApp) RegisterUpgradeHandlers() {
app.registerOutdatedPlaceholderUpgrade("v6.1")
app.registerOutdatedPlaceholderUpgrade("v6.2")
app.registerUpgrade("v6.3", upgradeInfo, nil, nil, nil)

app.registerUpgrade6_4(upgradeInfo)
app.registerUpgrade("v6.5", upgradeInfo, nil, []string{crisistypes.ModuleName}, nil)

app.registerUpgrade6_5(upgradeInfo)
}

func (app *UmeeApp) registerUpgrade6_5(upgradeInfo upgradetypes.Plan) {
planName := "v6.5"

app.UpgradeKeeper.SetUpgradeHandler(planName,
func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
printPlanName(planName, ctx.Logger())

// update leverage and metoken params to include burn auction fee share.
lparams := app.LeverageKeeper.GetParams(ctx)
lparams.RewardsAuctionFactor = leveragetypes.DefaultParams().RewardsAuctionFactor
if err := app.LeverageKeeper.SetParams(ctx, lparams); err != nil {
return err

Check failure on line 70 in app/upgrades.go

View workflow job for this annotation

GitHub Actions / Run govulncheck

not enough return values
}

mekeeper := app.MetokenKeeperB.Keeper(&ctx)
meparams := mekeeper.GetParams()
meparams.RewardsAuctionFactor = metoken.DefaultParams().RewardsAuctionFactor
if err := mekeeper.SetParams(meparams); err != nil {
return err

Check failure on line 77 in app/upgrades.go

View workflow job for this annotation

GitHub Actions / Run govulncheck

not enough return values
}

return app.mm.RunMigrations(ctx, app.configurator, fromVM)
},
)

app.storeUpgrade(planName, upgradeInfo, storetypes.StoreUpgrades{
Added: []string{auction.ModuleName},

Check failure on line 85 in app/upgrades.go

View workflow job for this annotation

GitHub Actions / Run govulncheck

undefined: auction
Deleted: []string{crisistypes.ModuleName}

Check failure on line 86 in app/upgrades.go

View workflow job for this annotation

GitHub Actions / Run govulncheck

missing ',' before newline in composite literal

Check failure on line 86 in app/upgrades.go

View workflow job for this annotation

GitHub Actions / umeed darwin-amd64

syntax error: unexpected newline in composite literal; possibly missing comma or }

Check failure on line 86 in app/upgrades.go

View workflow job for this annotation

GitHub Actions / umeed linux-amd64

syntax error: unexpected newline in composite literal; possibly missing comma or }

Check failure on line 86 in app/upgrades.go

View workflow job for this annotation

GitHub Actions / umeed darwin-arm64

syntax error: unexpected newline in composite literal; possibly missing comma or }

Check failure on line 86 in app/upgrades.go

View workflow job for this annotation

GitHub Actions / umeed linux-arm64

syntax error: unexpected newline in composite literal; possibly missing comma or }

Check failure on line 86 in app/upgrades.go

View workflow job for this annotation

GitHub Actions / test-app-non-determinism

syntax error: unexpected newline in composite literal; possibly missing comma or }

Check failure on line 86 in app/upgrades.go

View workflow job for this annotation

GitHub Actions / Run golangci-lint

syntax error: unexpected newline in composite literal; possibly missing comma or } (typecheck)

Check failure on line 86 in app/upgrades.go

View workflow job for this annotation

GitHub Actions / Run golangci-lint

missing ',' before newline in composite literal (typecheck)

Check failure on line 86 in app/upgrades.go

View workflow job for this annotation

GitHub Actions / Run golangci-lint

syntax error: unexpected newline in composite literal; possibly missing comma or }) (typecheck)

Check failure on line 86 in app/upgrades.go

View workflow job for this annotation

GitHub Actions / Run golangci-lint

syntax error: unexpected newline in composite literal; possibly missing comma or }) (typecheck)

Check failure on line 86 in app/upgrades.go

View workflow job for this annotation

GitHub Actions / test-unit-cover

syntax error: unexpected newline in composite literal; possibly missing comma or }
})
}

func (app *UmeeApp) registerUpgrade6_4(upgradeInfo upgradetypes.Plan) {
Expand Down
2 changes: 1 addition & 1 deletion x/leverage/types/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ func DefaultParams() Params {
CompleteLiquidationThreshold: sdk.MustNewDecFromStr("0.4"),
MinimumCloseFactor: sdk.MustNewDecFromStr("0.05"),
OracleRewardFactor: sdk.MustNewDecFromStr("0.01"),
RewardsAuctionFactor: sdk.MustNewDecFromStr("0.02"),
RewardsAuctionFactor: sdk.MustNewDecFromStr("0.20"),
SmallLiquidationSize: sdk.MustNewDecFromStr("500.00"),
DirectLiquidationFee: sdk.MustNewDecFromStr("0.05"),
}
Expand Down
2 changes: 1 addition & 1 deletion x/metoken/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ func DefaultParams() Params {
return Params{
RebalancingFrequency: 60 * 60 * 12, // 12h
ClaimingFrequency: 60 * 60 * 24 * 7, // 7d
RewardsAuctionFactor: 1000, // 10% of fees goes to rewards auction
RewardsAuctionFactor: 2000, // 20% of fees goes to rewards auction
}
}

0 comments on commit 29ba0f4

Please sign in to comment.