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

feat(auction): upgrade handler and params #2526

Merged
merged 9 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
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 @@
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 @@
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
}
}
Loading