Skip to content

Commit

Permalink
V18 Upgrade Migrations (#1084)
Browse files Browse the repository at this point in the history
Co-authored-by: sampocs <sam.pochyly@gmail.com>
Co-authored-by: sampocs <sam@stridelabs.co>
Co-authored-by: Aidan Salzmann <aidan@stridelabs.co>
Co-authored-by: riley-stride <104941670+riley-stride@users.noreply.github.com>
Co-authored-by: Riley Edmunds <riley@stridelabs.co>
  • Loading branch information
6 people authored Jan 26, 2024
1 parent 6a5dbc4 commit 57ef6c0
Show file tree
Hide file tree
Showing 8 changed files with 1,154 additions and 47 deletions.
19 changes: 19 additions & 0 deletions app/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
v15 "github.com/Stride-Labs/stride/v17/app/upgrades/v15"
v16 "github.com/Stride-Labs/stride/v17/app/upgrades/v16"
v17 "github.com/Stride-Labs/stride/v17/app/upgrades/v17"
v18 "github.com/Stride-Labs/stride/v17/app/upgrades/v18"
v2 "github.com/Stride-Labs/stride/v17/app/upgrades/v2"
v3 "github.com/Stride-Labs/stride/v17/app/upgrades/v3"
v4 "github.com/Stride-Labs/stride/v17/app/upgrades/v4"
Expand All @@ -37,6 +38,7 @@ import (
ratelimittypes "github.com/Stride-Labs/stride/v17/x/ratelimit/types"
recordtypes "github.com/Stride-Labs/stride/v17/x/records/types"
stakeibctypes "github.com/Stride-Labs/stride/v17/x/stakeibc/types"
staketiatypes "github.com/Stride-Labs/stride/v17/x/staketia/types"
)

func (app *StrideApp) setupUpgradeHandlers(appOpts servertypes.AppOptions) {
Expand Down Expand Up @@ -232,6 +234,19 @@ func (app *StrideApp) setupUpgradeHandlers(appOpts servertypes.AppOptions) {
),
)

// v18 upgrade handler
app.UpgradeKeeper.SetUpgradeHandler(
v18.UpgradeName,
v18.CreateUpgradeHandler(
app.mm,
app.configurator,
app.BankKeeper,
app.GovKeeper,
app.RecordsKeeper,
app.StakeibcKeeper,
),
)

upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk()
if err != nil {
panic(fmt.Errorf("Failed to read upgrade info from disk: %w", err))
Expand Down Expand Up @@ -277,6 +292,10 @@ func (app *StrideApp) setupUpgradeHandlers(appOpts servertypes.AppOptions) {
// Add PFM store key
Added: []string{packetforwardtypes.ModuleName},
}
case "v18":
storeUpgrades = &storetypes.StoreUpgrades{
Added: []string{staketiatypes.ModuleName},
}
}

if storeUpgrades != nil {
Expand Down
192 changes: 192 additions & 0 deletions app/upgrades/v18/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
package v18

import (
sdkmath "cosmossdk.io/math"
sdk "github.com/cosmos/cosmos-sdk/types"
)

var (
UpgradeName = "v18"

// Redemption rate bounds updated to give ~3 months of slack on outer bounds
RedemptionRateOuterMinAdjustment = sdk.MustNewDecFromStr("0.05")
RedemptionRateOuterMaxAdjustment = sdk.MustNewDecFromStr("0.10")

// Osmosis will have a slighly larger buffer with the redemption rate
// since their yield is less predictable
OsmosisChainId = "osmosis-1"
OsmosisRedemptionRateBuffer = sdk.MustNewDecFromStr("0.02")

// Terra chain ID for delegation changes in progress
TerraChainId = "phoenix-1"

// Prop 228 info
Strd = "ustrd"
Prop228ProposalId = uint64(228)
Prop228SendAmount = sdkmath.NewInt(9_000_000_000_000)
IncentiveProgramAddress = "stride1tlxk4as9sgpqkh42cfaxqja0mdj6qculqshy0gg3glazmrnx3y8s8gsvqk"
StrideFoundationAddress_F4 = "stride1yz3mp7c2m739nftfrv5r3h6j64aqp95f3degpf"

// Get Initial Redemption Rates for Unbonding Records Migration
RedemptionRatesAtTimeOfProp = map[string]sdk.Dec{
"comdex-1": sdk.MustNewDecFromStr("1.204883527965105396"),
"cosmoshub-4": sdk.MustNewDecFromStr("1.299886984330871277"),
"evmos_9001-2": sdk.MustNewDecFromStr("1.492732862363044751"),
"injective-1": sdk.MustNewDecFromStr("1.216027814303310584"),
"juno-1": sdk.MustNewDecFromStr("1.418690442281976982"),
"osmosis-1": sdk.MustNewDecFromStr("1.201662502920632779"),
"phoenix-1": sdk.MustNewDecFromStr("1.178584742254853106"),
"sommelier-3": sdk.MustNewDecFromStr("1.025900897761638723"),
"stargaze-1": sdk.MustNewDecFromStr("1.430486928659223287"),
"umee-1": sdk.MustNewDecFromStr("1.128892781103330908"),
}

// Get Amount Unbonded for each HostZone for Unbonding Records Migration
StartingEstimateEpoch = uint64(508)
RedemptionRatesBeforeProp = map[string]map[uint64]sdk.Dec{
"juno-1": {
495: sdk.MustNewDecFromStr("1.412164551270598"),
496: sdk.MustNewDecFromStr("1.412164551270598"),
497: sdk.MustNewDecFromStr("1.412164551270598"),
500: sdk.MustNewDecFromStr("1.4161495546072012"),
501: sdk.MustNewDecFromStr("1.4161495546072012"),
503: sdk.MustNewDecFromStr("1.4161495546072012"),
504: sdk.MustNewDecFromStr("1.4161495546072012"),
505: sdk.MustNewDecFromStr("1.417724248601981"),
507: sdk.MustNewDecFromStr("1.417724248601981"),
508: sdk.MustNewDecFromStr("1.417724248601981"),
},
"phoenix-1": {
496: sdk.MustNewDecFromStr("1.1740619020285001"),
498: sdk.MustNewDecFromStr("1.1740619020285001"),
499: sdk.MustNewDecFromStr("1.1740619020285001"),
500: sdk.MustNewDecFromStr("1.1757224643748854"),
503: sdk.MustNewDecFromStr("1.1757224643748854"),
504: sdk.MustNewDecFromStr("1.176553937681711"),
505: sdk.MustNewDecFromStr("1.176553937681711"),
506: sdk.MustNewDecFromStr("1.176553937681711"),
507: sdk.MustNewDecFromStr("1.176553937681711"),
},
"sommelier-3": {
495: sdk.MustNewDecFromStr("1.0241481197817144"),
496: sdk.MustNewDecFromStr("1.0241481197817144"),
497: sdk.MustNewDecFromStr("1.0241481197817144"),
499: sdk.MustNewDecFromStr("1.0241481197817144"),
501: sdk.MustNewDecFromStr("1.025236900070852"),
502: sdk.MustNewDecFromStr("1.025236900070852"),
503: sdk.MustNewDecFromStr("1.025236900070852"),
504: sdk.MustNewDecFromStr("1.025236900070852"),
505: sdk.MustNewDecFromStr("1.0259008616651284"),
507: sdk.MustNewDecFromStr("1.0259008616651284"),
508: sdk.MustNewDecFromStr("1.0259008616651284"),
509: sdk.MustNewDecFromStr("1.0259008616651284"),
},
"cosmoshub-4": {
496: sdk.MustNewDecFromStr("1.2938404518607025"),
497: sdk.MustNewDecFromStr("1.2938404518607025"),
498: sdk.MustNewDecFromStr("1.2938404518607025"),
499: sdk.MustNewDecFromStr("1.2938404518607025"),
500: sdk.MustNewDecFromStr("1.2957672912922817"),
501: sdk.MustNewDecFromStr("1.2957672912922817"),
502: sdk.MustNewDecFromStr("1.2957672912922817"),
503: sdk.MustNewDecFromStr("1.2957672912922817"),
504: sdk.MustNewDecFromStr("1.296926394723948"),
505: sdk.MustNewDecFromStr("1.296926394723948"),
506: sdk.MustNewDecFromStr("1.296926394723948"),
507: sdk.MustNewDecFromStr("1.296926394723948"),
},
"comdex-1": {
496: sdk.MustNewDecFromStr("1.1963306878344375"),
497: sdk.MustNewDecFromStr("1.1963306878344375"),
498: sdk.MustNewDecFromStr("1.1963306878344375"),
499: sdk.MustNewDecFromStr("1.1963306878344375"),
500: sdk.MustNewDecFromStr("1.1994537074221134"),
501: sdk.MustNewDecFromStr("1.1994537074221134"),
502: sdk.MustNewDecFromStr("1.1994537074221134"),
503: sdk.MustNewDecFromStr("1.1994537074221134"),
504: sdk.MustNewDecFromStr("1.2019746297343605"),
505: sdk.MustNewDecFromStr("1.2019746297343605"),
506: sdk.MustNewDecFromStr("1.2019746297343605"),
507: sdk.MustNewDecFromStr("1.2019746297343605"),
},
"injective-1": {
464: sdk.MustNewDecFromStr("1.10904028152176"),
465: sdk.MustNewDecFromStr("1.1092232046811195"),
466: sdk.MustNewDecFromStr("1.1094104738505122"),
467: sdk.MustNewDecFromStr("1.109660102119856"),
468: sdk.MustNewDecFromStr("1.1099206471560683"),
469: sdk.MustNewDecFromStr("1.1101781888690843"),
470: sdk.MustNewDecFromStr("1.1104928343163862"),
471: sdk.MustNewDecFromStr("1.1106814727683936"),
472: sdk.MustNewDecFromStr("1.1109147705303473"),
473: sdk.MustNewDecFromStr("1.1111483631454906"),
474: sdk.MustNewDecFromStr("1.1113789833325327"),
475: sdk.MustNewDecFromStr("1.1115865207841595"),
476: sdk.MustNewDecFromStr("1.1118256565192843"),
477: sdk.MustNewDecFromStr("1.112062977242558"),
478: sdk.MustNewDecFromStr("1.112305089405149"),
479: sdk.MustNewDecFromStr("1.1125496812740654"),
480: sdk.MustNewDecFromStr("1.112796928321449"),
481: sdk.MustNewDecFromStr("1.113045979582398"),
482: sdk.MustNewDecFromStr("1.1133578645679472"),
483: sdk.MustNewDecFromStr("1.1135463131500978"),
484: sdk.MustNewDecFromStr("1.113862639530537"),
485: sdk.MustNewDecFromStr("1.1140510045259582"),
486: sdk.MustNewDecFromStr("1.114295573398525"),
487: sdk.MustNewDecFromStr("1.1145990588175787"),
488: sdk.MustNewDecFromStr("1.114779498371232"),
489: sdk.MustNewDecFromStr("1.1150839991290917"),
498: sdk.MustNewDecFromStr("1.1170896901082266"),
499: sdk.MustNewDecFromStr("1.1498981693771557"),
500: sdk.MustNewDecFromStr("1.209508137205966"),
501: sdk.MustNewDecFromStr("1.209985009275008"),
502: sdk.MustNewDecFromStr("1.210478332327813"),
503: sdk.MustNewDecFromStr("1.2109676716098068"),
504: sdk.MustNewDecFromStr("1.2130924701151315"),
505: sdk.MustNewDecFromStr("1.2136053525521355"),
507: sdk.MustNewDecFromStr("1.21455566769327"),
},
"evmos_9001-2": {
499: sdk.MustNewDecFromStr("1.4895991845634247"),
500: sdk.MustNewDecFromStr("1.4895991845634247"),
501: sdk.MustNewDecFromStr("1.490098715761824"),
502: sdk.MustNewDecFromStr("1.490098715761824"),
503: sdk.MustNewDecFromStr("1.490098715761824"),
504: sdk.MustNewDecFromStr("1.4910458236916064"),
505: sdk.MustNewDecFromStr("1.4910458236916064"),
507: sdk.MustNewDecFromStr("1.4918520366929944"),
508: sdk.MustNewDecFromStr("1.4918520366929944"),
},
"osmosis-1": {
498: sdk.MustNewDecFromStr("1.1984190041836773"),
499: sdk.MustNewDecFromStr("1.1984190041836773"),
500: sdk.MustNewDecFromStr("1.1984190041836773"),
501: sdk.MustNewDecFromStr("1.1991174772238702"),
502: sdk.MustNewDecFromStr("1.1991174772238702"),
503: sdk.MustNewDecFromStr("1.1991174772238702"),
504: sdk.MustNewDecFromStr("1.2003177583397713"),
505: sdk.MustNewDecFromStr("1.2003177583397713"),
506: sdk.MustNewDecFromStr("1.2003177583397713"),
507: sdk.MustNewDecFromStr("1.2011986371246357"),
508: sdk.MustNewDecFromStr("1.2011986371246357"),
509: sdk.MustNewDecFromStr("1.2011986371246357"),
},
"stargaze-1": {
498: sdk.MustNewDecFromStr("1.4246347073913794"),
499: sdk.MustNewDecFromStr("1.4246347073913794"),
500: sdk.MustNewDecFromStr("1.4246347073913794"),
501: sdk.MustNewDecFromStr("1.4267297754925006"),
502: sdk.MustNewDecFromStr("1.4267297754925006"),
503: sdk.MustNewDecFromStr("1.4267297754925006"),
504: sdk.MustNewDecFromStr("1.4279528400269015"),
505: sdk.MustNewDecFromStr("1.4279528400269015"),
506: sdk.MustNewDecFromStr("1.4279528400269015"),
507: sdk.MustNewDecFromStr("1.430136789416802"),
508: sdk.MustNewDecFromStr("1.430136789416802"),
509: sdk.MustNewDecFromStr("1.430136789416802"),
},
"umee-1": {
505: sdk.MustNewDecFromStr("1.1266406527137283"),
},
}
)
Loading

0 comments on commit 57ef6c0

Please sign in to comment.