From 82156ab74f2278dd7542c27b1884ae39b163fff0 Mon Sep 17 00:00:00 2001 From: Srinivas Baride Date: Mon, 10 Oct 2022 05:30:18 +0530 Subject: [PATCH] Removed legacy and previous upgrade related code --- app.go | 23 -- types/legacy/v0.5/bandwidth.go | 12 - types/legacy/v0.5/status.go | 5 - types/legacy/v0.6/bandwidth.go | 13 - types/legacy/v0.6/status.go | 10 - upgrades/upgrade-1/handler.go | 16 -- upgrades/upgrade-1/keys.go | 5 - upgrades/upgrade-2/handler.go | 222 ------------------ upgrades/upgrade-2/keys.go | 5 - upgrades/upgrade-3/handler.go | 39 --- upgrades/upgrade-3/keys.go | 5 - x/deposit/types/legacy/v0.5/deposit.go | 14 -- x/deposit/types/legacy/v0.5/genesis.go | 5 - x/deposit/types/legacy/v0.6/deposit.go | 22 -- x/deposit/types/legacy/v0.6/genesis.go | 12 - x/node/types/legacy/v0.5/genesis.go | 8 - x/node/types/legacy/v0.5/node.go | 23 -- x/node/types/legacy/v0.5/params.go | 14 -- x/node/types/legacy/v0.6/genesis.go | 13 - x/node/types/legacy/v0.6/node.go | 27 --- x/node/types/legacy/v0.6/params.go | 13 - x/plan/types/legacy/v0.5/genesis.go | 16 -- x/plan/types/legacy/v0.5/plan.go | 24 -- x/plan/types/legacy/v0.6/genesis.go | 33 --- x/plan/types/legacy/v0.6/plan.go | 19 -- x/provider/types/legacy/v0.5/genesis.go | 8 - x/provider/types/legacy/v0.5/params.go | 11 - x/provider/types/legacy/v0.5/provider.go | 17 -- x/provider/types/legacy/v0.6/genesis.go | 13 - x/provider/types/legacy/v0.6/params.go | 12 - x/provider/types/legacy/v0.6/provider.go | 25 -- x/session/types/legacy/v0.5/genesis.go | 8 - x/session/types/legacy/v0.5/params.go | 12 - x/session/types/legacy/v0.5/session.go | 25 -- x/session/types/legacy/v0.6/genesis.go | 13 - x/session/types/legacy/v0.6/params.go | 13 - x/session/types/legacy/v0.6/session.go | 29 --- x/subscription/types/legacy/v0.5/genesis.go | 15 -- x/subscription/types/legacy/v0.5/params.go | 11 - x/subscription/types/legacy/v0.5/quota.go | 15 -- .../types/legacy/v0.5/subscription.go | 27 --- x/subscription/types/legacy/v0.6/genesis.go | 29 --- x/subscription/types/legacy/v0.6/params.go | 12 - x/subscription/types/legacy/v0.6/quota.go | 23 -- .../types/legacy/v0.6/subscription.go | 32 --- x/swap/types/legacy/v0.5/ethereum.go | 51 ---- x/swap/types/legacy/v0.5/genesis.go | 8 - x/swap/types/legacy/v0.5/keys.go | 5 - x/swap/types/legacy/v0.5/params.go | 13 - x/swap/types/legacy/v0.5/swap.go | 15 -- x/swap/types/legacy/v0.6/genesis.go | 13 - x/swap/types/legacy/v0.6/params.go | 14 -- x/swap/types/legacy/v0.6/swap.go | 23 -- x/vpn/types/legacy/v0.5/genesis.go | 21 -- x/vpn/types/legacy/v0.5/keys.go | 5 - x/vpn/types/legacy/v0.6/genesis.go | 23 -- 56 files changed, 1139 deletions(-) delete mode 100644 types/legacy/v0.5/bandwidth.go delete mode 100644 types/legacy/v0.5/status.go delete mode 100644 types/legacy/v0.6/bandwidth.go delete mode 100644 types/legacy/v0.6/status.go delete mode 100644 upgrades/upgrade-1/handler.go delete mode 100644 upgrades/upgrade-1/keys.go delete mode 100644 upgrades/upgrade-2/handler.go delete mode 100644 upgrades/upgrade-2/keys.go delete mode 100644 upgrades/upgrade-3/handler.go delete mode 100644 upgrades/upgrade-3/keys.go delete mode 100644 x/deposit/types/legacy/v0.5/deposit.go delete mode 100644 x/deposit/types/legacy/v0.5/genesis.go delete mode 100644 x/deposit/types/legacy/v0.6/deposit.go delete mode 100644 x/deposit/types/legacy/v0.6/genesis.go delete mode 100644 x/node/types/legacy/v0.5/genesis.go delete mode 100644 x/node/types/legacy/v0.5/node.go delete mode 100644 x/node/types/legacy/v0.5/params.go delete mode 100644 x/node/types/legacy/v0.6/genesis.go delete mode 100644 x/node/types/legacy/v0.6/node.go delete mode 100644 x/node/types/legacy/v0.6/params.go delete mode 100644 x/plan/types/legacy/v0.5/genesis.go delete mode 100644 x/plan/types/legacy/v0.5/plan.go delete mode 100644 x/plan/types/legacy/v0.6/genesis.go delete mode 100644 x/plan/types/legacy/v0.6/plan.go delete mode 100644 x/provider/types/legacy/v0.5/genesis.go delete mode 100644 x/provider/types/legacy/v0.5/params.go delete mode 100644 x/provider/types/legacy/v0.5/provider.go delete mode 100644 x/provider/types/legacy/v0.6/genesis.go delete mode 100644 x/provider/types/legacy/v0.6/params.go delete mode 100644 x/provider/types/legacy/v0.6/provider.go delete mode 100644 x/session/types/legacy/v0.5/genesis.go delete mode 100644 x/session/types/legacy/v0.5/params.go delete mode 100644 x/session/types/legacy/v0.5/session.go delete mode 100644 x/session/types/legacy/v0.6/genesis.go delete mode 100644 x/session/types/legacy/v0.6/params.go delete mode 100644 x/session/types/legacy/v0.6/session.go delete mode 100644 x/subscription/types/legacy/v0.5/genesis.go delete mode 100644 x/subscription/types/legacy/v0.5/params.go delete mode 100644 x/subscription/types/legacy/v0.5/quota.go delete mode 100644 x/subscription/types/legacy/v0.5/subscription.go delete mode 100644 x/subscription/types/legacy/v0.6/genesis.go delete mode 100644 x/subscription/types/legacy/v0.6/params.go delete mode 100644 x/subscription/types/legacy/v0.6/quota.go delete mode 100644 x/subscription/types/legacy/v0.6/subscription.go delete mode 100644 x/swap/types/legacy/v0.5/ethereum.go delete mode 100644 x/swap/types/legacy/v0.5/genesis.go delete mode 100644 x/swap/types/legacy/v0.5/keys.go delete mode 100644 x/swap/types/legacy/v0.5/params.go delete mode 100644 x/swap/types/legacy/v0.5/swap.go delete mode 100644 x/swap/types/legacy/v0.6/genesis.go delete mode 100644 x/swap/types/legacy/v0.6/params.go delete mode 100644 x/swap/types/legacy/v0.6/swap.go delete mode 100644 x/vpn/types/legacy/v0.5/genesis.go delete mode 100644 x/vpn/types/legacy/v0.5/keys.go delete mode 100644 x/vpn/types/legacy/v0.6/genesis.go diff --git a/app.go b/app.go index 9f040b3f..58929bb8 100644 --- a/app.go +++ b/app.go @@ -22,7 +22,6 @@ import ( serverconfig "github.com/cosmos/cosmos-sdk/server/config" servertypes "github.com/cosmos/cosmos-sdk/server/types" "github.com/cosmos/cosmos-sdk/simapp" - storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/version" @@ -104,7 +103,6 @@ import ( tmdb "github.com/tendermint/tm-db" hubparams "github.com/sentinel-official/hub/params" - upgrade3 "github.com/sentinel-official/hub/upgrades/upgrade-3" deposittypes "github.com/sentinel-official/hub/x/deposit/types" custommint "github.com/sentinel-official/hub/x/mint" custommintkeeper "github.com/sentinel-official/hub/x/mint/keeper" @@ -664,27 +662,6 @@ func NewApp( } } - app.upgradeKeeper.SetUpgradeHandler( - upgrade3.Name, - upgrade3.Handler(app.moduleManager, app.configurator, &app.ibcKeeper.ConnectionKeeper), - ) - - upgradeInfo, err := app.upgradeKeeper.ReadUpgradeInfoFromDisk() - if err != nil { - panic(fmt.Sprintf("failed to read upgrade info from disk %s", err)) - } - - if upgradeInfo.Name == upgrade3.Name && !app.upgradeKeeper.IsSkipHeight(upgradeInfo.Height) { - storeUpgrades := storetypes.StoreUpgrades{ - Added: []string{ - ibcicahosttypes.StoreKey, - wasmtypes.StoreKey, - }, - } - - app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades)) - } - if loadLatest { if err := app.LoadLatestVersion(); err != nil { tmos.Exit(err.Error()) diff --git a/types/legacy/v0.5/bandwidth.go b/types/legacy/v0.5/bandwidth.go deleted file mode 100644 index e0f963fe..00000000 --- a/types/legacy/v0.5/bandwidth.go +++ /dev/null @@ -1,12 +0,0 @@ -package v05 - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" -) - -type ( - Bandwidth struct { - Upload sdk.Int `json:"upload"` - Download sdk.Int `json:"download"` - } -) diff --git a/types/legacy/v0.5/status.go b/types/legacy/v0.5/status.go deleted file mode 100644 index 787e9a55..00000000 --- a/types/legacy/v0.5/status.go +++ /dev/null @@ -1,5 +0,0 @@ -package v05 - -type ( - Status byte -) diff --git a/types/legacy/v0.6/bandwidth.go b/types/legacy/v0.6/bandwidth.go deleted file mode 100644 index 3d65669b..00000000 --- a/types/legacy/v0.6/bandwidth.go +++ /dev/null @@ -1,13 +0,0 @@ -package v06 - -import ( - "github.com/sentinel-official/hub/types" - v05 "github.com/sentinel-official/hub/types/legacy/v0.5" -) - -func MigrateBandwidth(v v05.Bandwidth) types.Bandwidth { - return types.Bandwidth{ - Upload: v.Upload, - Download: v.Download, - } -} diff --git a/types/legacy/v0.6/status.go b/types/legacy/v0.6/status.go deleted file mode 100644 index 92280c53..00000000 --- a/types/legacy/v0.6/status.go +++ /dev/null @@ -1,10 +0,0 @@ -package v06 - -import ( - "github.com/sentinel-official/hub/types" - v05 "github.com/sentinel-official/hub/types/legacy/v0.5" -) - -func MigrateStatus(v v05.Status) types.Status { - return types.Status(v) -} diff --git a/upgrades/upgrade-1/handler.go b/upgrades/upgrade-1/handler.go deleted file mode 100644 index 743a7e80..00000000 --- a/upgrades/upgrade-1/handler.go +++ /dev/null @@ -1,16 +0,0 @@ -package upgrade1 - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" - upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" -) - -// Handler returns UpgradeHandler function -// Sets the public key of multi-signature accounts to nil value -func Handler(_ authkeeper.AccountKeeper) upgradetypes.UpgradeHandler { - return func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { - return fromVM, nil - } -} diff --git a/upgrades/upgrade-1/keys.go b/upgrades/upgrade-1/keys.go deleted file mode 100644 index 573fd313..00000000 --- a/upgrades/upgrade-1/keys.go +++ /dev/null @@ -1,5 +0,0 @@ -package upgrade1 - -const ( - Name = "upgrade-1" -) diff --git a/upgrades/upgrade-2/handler.go b/upgrades/upgrade-2/handler.go deleted file mode 100644 index 925f224b..00000000 --- a/upgrades/upgrade-2/handler.go +++ /dev/null @@ -1,222 +0,0 @@ -package upgrade2 - -import ( - "fmt" - "time" - - "github.com/cosmos/cosmos-sdk/baseapp" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" - upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper" - upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - - custommintkeeper "github.com/sentinel-official/hub/x/mint/keeper" - customminttypes "github.com/sentinel-official/hub/x/mint/types" -) - -func Handler( - _ func(baseapp.StoreLoader), - _ authkeeper.AccountKeeper, - _ upgradekeeper.Keeper, - _ custommintkeeper.Keeper, -) upgradetypes.UpgradeHandler { - return func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { - return fromVM, nil - } -} - -func setInflations(ctx sdk.Context, k custommintkeeper.Keeper) error { - var ( - inflations = []customminttypes.Inflation{ - { - Max: sdk.NewDecWithPrec(49, 2), - Min: sdk.NewDecWithPrec(43, 2), - RateChange: sdk.NewDecWithPrec(6, 2), - Timestamp: time.Date(2021, 9, 27, 12, 0, 0, 0, time.UTC), - }, - { - Max: sdk.NewDecWithPrec(43, 2), - Min: sdk.NewDecWithPrec(37, 2), - RateChange: sdk.NewDecWithPrec(6, 2), - Timestamp: time.Date(2022, 3, 27, 12, 0, 0, 0, time.UTC), - }, - { - Max: sdk.NewDecWithPrec(37, 2), - Min: sdk.NewDecWithPrec(31, 2), - RateChange: sdk.NewDecWithPrec(6, 2), - Timestamp: time.Date(2022, 9, 27, 12, 0, 0, 0, time.UTC), - }, - { - Max: sdk.NewDecWithPrec(31, 2), - Min: sdk.NewDecWithPrec(25, 2), - RateChange: sdk.NewDecWithPrec(6, 2), - Timestamp: time.Date(2023, 3, 27, 12, 0, 0, 0, time.UTC), - }, - { - Max: sdk.NewDecWithPrec(25, 2), - Min: sdk.NewDecWithPrec(19, 2), - RateChange: sdk.NewDecWithPrec(6, 2), - Timestamp: time.Date(2023, 9, 27, 12, 0, 0, 0, time.UTC), - }, - { - Max: sdk.NewDecWithPrec(19, 2), - Min: sdk.NewDecWithPrec(13, 2), - RateChange: sdk.NewDecWithPrec(6, 2), - Timestamp: time.Date(2024, 3, 27, 12, 0, 0, 0, time.UTC), - }, - } - ) - - for _, inflation := range inflations { - if err := inflation.Validate(); err != nil { - return err - } - } - for _, inflation := range inflations { - k.SetInflation(ctx, inflation) - } - - return nil -} - -func updateVestingAccounts(ctx sdk.Context, k authkeeper.AccountKeeper) error { - var ( - foundation = "sent1vv8kmwrs24j5emzw8dp7k8satgea62l7knegd7" - investors = []string{ - "sent10lqg96mxv26k4lfcagytj7qql65nd068kpa43q", - "sent10ven70nt35qr3yjgcl7psustkmrfu35qdnxa6z", - "sent10y4eael9fpgm7pyarc7tzdfhe5n2fu4920sxel", - "sent13ggn65j009s3n37ekl5whlw80qh6vhmwsqe7uz", - "sent14am4gt4j3xa3746nc0vxx0ksej8yn8tx924exg", - "sent15gf8mpdxmkkfxl2a4mffe2l0vn08jaseztj6c5", - "sent15ptpn8qqjrgv69ayk26ap33rmkeysz7qux803h", - "sent17980ady5mgq9tcuyj6cwfvqt2duk7wyxdy26cf", - "sent189lj5prumzunezczcay0yy4tp88md6crmn6s9j", - "sent18dsg7kc3f56c0fnelqzhag4hk6snjv0rtxzspe", - "sent1ajzdnrefxnu9d9v5eh3ucn99de96zxx6muzw5a", - "sent1au4sj50sddjqaj3mg9t62dgzk7rw34p26tpg6r", - "sent1exwnrcjqc8d776v8sxevt47hvzgehlqct39elz", - "sent1ey2k5azqkshjnsugrn2xtjfdh7m0wrqehugjxr", - "sent1fa86yfpdkvj88a8p95pp3fmwsttcyg8wmy9vzm", - "sent1gvvfs5raxje8l60mg96shgny88390wyz3qmcfr", - "sent1lkjg98vpqrnr3m0n0dkdkhsmylymdt4r68u0zj", - "sent1lml57rkh0kmqan6cnj20d66f8madwc6e8397qu", - "sent1mc8m5vz62e7ymx20alr45swlmk0ta823k2xxz0", - "sent1n85kmtr94q54u0plcpuxt5lrzz4j09l69m9z3r", - "sent1pg6y9kn3jhuyzkhw5nn7jnh4mfmdzdnmpzn62a", - "sent1q8xzh6qgww5upzmwvkztmm4x0zf3n8275mp6vq", - "sent1r2el34ydppd2ugrlt9cstv0cl34yqwalwg7zm9", - "sent1reeywehc76ndcd3gkzaz3yasdk7nfxc06undq8", - "sent1s88cq7g7geukqccwrw7t6kaq8csq00na3x708t", - "sent1t4lq5fy20tane82vfyqlc700g0q8e3d9a9kkmq", - "sent1u2z7t0wcv0w9huctaat4jqed3kl790ueuvwkp8", - "sent1uddk4mfqq3uyu2yzhym8spheqatqs30fzh5tmr", - "sent1ueuncjn7devskqjjweyjhg6fvqngrzrnp8vq8n", - "sent1uysdw03gz84glddm82cgddy7jza6aeqsq2rru9", - "sent1vrt9zgl3u6yz55hssy8a2zu8u0c822u6n3xl29", - "sent1wcszkf3psqqrt4llzt0y3lahsypa5s4d0r80nf", - "sent1xp9dg7vejefvhx8nr8uedkagnk9k5muq7znrhk", - "sent1zmqe22g8k4jnqq82urfayftq4xzkkvf3rxmhet", - "sent1zx0sc9x8j6enwm7405yyk9xmwkzx7da0unu2kw", - "sent1zyjlu0s8tl3hvugfyar8evsyux8xt70rv8027j", - } - ) - - for _, s := range investors { - account, err := getContinuousVestingAccount(ctx, k, s) - if err != nil { - return err - } - - account.StartTime = time.Date(2022, 1, 1, 12, 0, 0, 0, time.UTC).Unix() - account.BaseVestingAccount.EndTime = time.Date(2023, 1, 1, 12, 0, 0, 0, time.UTC).Unix() - k.SetAccount(ctx, account) - } - - account, err := getPeriodicVestingAccount(ctx, k, foundation) - if err != nil { - return err - } - - var ( - lengths = []int64{ - 2678400, 2592000, 2678400, 2592000, 2678400, 2678400, 8294400, 2678400, 2419200, 2678400, - 2592000, 2678400, 2592000, 2678400, 2678400, 2592000, 2678400, 2592000, 2678400, 2678400, - 2419200, 2678400, 2592000, 2678400, 2592000, 2678400, 2678400, 2592000, 2678400, 2592000, - 2678400, 2678400, 2505600, 2678400, 2592000, 2678400, 2592000, 2678400, 2678400, 2592000, - 2678400, 2592000, 2678400, 2678400, 2419200, 2678400, 2592000, 2678400, 2592000, 2678400, - 2678400, 2592000, 2678400, 2592000, 2678400, 2678400, 2419200, 2678400, 2592000, 2678400, - } - amounts = []int64{ - 110000000, 110000000, 55670430, 55670430, 55670430, 81536090, 56536090, 56536090, 81536090, 56536090, - 56536090, 129136090, 78440650, 78440650, 103440650, 78440650, 78440650, 102574990, 77574990, 77574990, - 102574990, 77574990, 47600000, 93900000, 68900000, 68900000, 98900000, 73900000, 73900000, 73900000, - 73900000, 73900000, 73900000, 73900000, 73900000, 136500000, 136500000, 136500000, 136500000, 136500000, - 136500000, 136500000, 136500000, 136500000, 136500000, 136500000, 136500000, 176999999, 176999999, 176999999, - 176999999, 176999999, 176999999, 176999999, 176999999, 176999999, 176999999, 176999999, 176999999, 35000000, - } - ) - - account.VestingPeriods = make(vestingtypes.Periods, 0, len(lengths)) - account.BaseVestingAccount.EndTime = account.StartTime - - for i := 0; i < len(lengths); i++ { - account.VestingPeriods = append( - account.VestingPeriods, - vestingtypes.Period{ - Length: lengths[i], - Amount: sdk.NewCoins(sdk.NewCoin("udvpn", sdk.NewInt(amounts[i]).MulRaw(1e6))), - }, - ) - account.EndTime += lengths[i] - } - - k.SetAccount(ctx, account) - - return nil -} - -func getAccount(ctx sdk.Context, k authkeeper.AccountKeeper, s string) (authtypes.AccountI, error) { - address, err := sdk.AccAddressFromBech32(s) - if err != nil { - return nil, err - } - - account := k.GetAccount(ctx, address) - if account == nil { - return nil, fmt.Errorf("account for address %s does not exist", s) - } - - return account, nil -} - -func getContinuousVestingAccount(ctx sdk.Context, k authkeeper.AccountKeeper, s string) (*vestingtypes.ContinuousVestingAccount, error) { - base, err := getAccount(ctx, k, s) - if err != nil { - return nil, err - } - - account, ok := base.(*vestingtypes.ContinuousVestingAccount) - if !ok { - return nil, fmt.Errorf("account for address %s is not a countinuous vesting type", s) - } - - return account, nil -} - -func getPeriodicVestingAccount(ctx sdk.Context, k authkeeper.AccountKeeper, s string) (*vestingtypes.PeriodicVestingAccount, error) { - base, err := getAccount(ctx, k, s) - if err != nil { - return nil, err - } - - account, ok := base.(*vestingtypes.PeriodicVestingAccount) - if !ok { - return nil, fmt.Errorf("account for address %s is not a periodic vesting type", s) - } - - return account, nil -} diff --git a/upgrades/upgrade-2/keys.go b/upgrades/upgrade-2/keys.go deleted file mode 100644 index 07bdb473..00000000 --- a/upgrades/upgrade-2/keys.go +++ /dev/null @@ -1,5 +0,0 @@ -package upgrade2 - -const ( - Name = "upgrade-2" -) diff --git a/upgrades/upgrade-3/handler.go b/upgrades/upgrade-3/handler.go deleted file mode 100644 index ab69754d..00000000 --- a/upgrades/upgrade-3/handler.go +++ /dev/null @@ -1,39 +0,0 @@ -package upgrade3 - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - "github.com/cosmos/cosmos-sdk/x/authz" - "github.com/cosmos/cosmos-sdk/x/feegrant" - upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - ibcconnectionkeeper "github.com/cosmos/ibc-go/v3/modules/core/03-connection/keeper" - ibcconnectiontypes "github.com/cosmos/ibc-go/v3/modules/core/03-connection/types" -) - -func Handler( - mm *module.Manager, - configurator module.Configurator, - ibcConnectionKeeper *ibcconnectionkeeper.Keeper, -) upgradetypes.UpgradeHandler { - return func(ctx sdk.Context, _ upgradetypes.Plan, _ module.VersionMap) (module.VersionMap, error) { - ibcConnectionKeeper.SetParams(ctx, ibcconnectiontypes.DefaultParams()) - - fromVM := make(map[string]uint64) - for moduleName := range mm.Modules { - fromVM[moduleName] = 1 - } - fromVM[authtypes.ModuleName] = 2 - - delete(fromVM, authz.ModuleName) - delete(fromVM, feegrant.ModuleName) - - newVM, err := mm.RunMigrations(ctx, configurator, fromVM) - if err != nil { - return nil, err - } - newVM[authtypes.ModuleName] = 1 - - return mm.RunMigrations(ctx, configurator, newVM) - } -} diff --git a/upgrades/upgrade-3/keys.go b/upgrades/upgrade-3/keys.go deleted file mode 100644 index 33b8bb73..00000000 --- a/upgrades/upgrade-3/keys.go +++ /dev/null @@ -1,5 +0,0 @@ -package upgrade3 - -const ( - Name = "upgrade-3" -) diff --git a/x/deposit/types/legacy/v0.5/deposit.go b/x/deposit/types/legacy/v0.5/deposit.go deleted file mode 100644 index f1d2fc17..00000000 --- a/x/deposit/types/legacy/v0.5/deposit.go +++ /dev/null @@ -1,14 +0,0 @@ -package v05 - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" -) - -type ( - Deposit struct { - Address sdk.AccAddress `json:"address"` - Coins sdk.Coins `json:"coins"` - } - - Deposits []Deposit -) diff --git a/x/deposit/types/legacy/v0.5/genesis.go b/x/deposit/types/legacy/v0.5/genesis.go deleted file mode 100644 index 8b84e0ac..00000000 --- a/x/deposit/types/legacy/v0.5/genesis.go +++ /dev/null @@ -1,5 +0,0 @@ -package v05 - -type ( - GenesisState Deposits -) diff --git a/x/deposit/types/legacy/v0.6/deposit.go b/x/deposit/types/legacy/v0.6/deposit.go deleted file mode 100644 index 4865801c..00000000 --- a/x/deposit/types/legacy/v0.6/deposit.go +++ /dev/null @@ -1,22 +0,0 @@ -package v06 - -import ( - "github.com/sentinel-official/hub/x/deposit/types" - legacy "github.com/sentinel-official/hub/x/deposit/types/legacy/v0.5" -) - -func MigrateDeposit(item legacy.Deposit) types.Deposit { - return types.Deposit{ - Address: item.Address.String(), - Coins: item.Coins, - } -} - -func MigrateDeposits(items legacy.Deposits) types.Deposits { - var deposits types.Deposits - for _, item := range items { - deposits = append(deposits, MigrateDeposit(item)) - } - - return deposits -} diff --git a/x/deposit/types/legacy/v0.6/genesis.go b/x/deposit/types/legacy/v0.6/genesis.go deleted file mode 100644 index d2216ca0..00000000 --- a/x/deposit/types/legacy/v0.6/genesis.go +++ /dev/null @@ -1,12 +0,0 @@ -package v06 - -import ( - "github.com/sentinel-official/hub/x/deposit/types" - legacy "github.com/sentinel-official/hub/x/deposit/types/legacy/v0.5" -) - -func MigrateGenesisState(state legacy.GenesisState) types.GenesisState { - return types.NewGenesisState( - MigrateDeposits(legacy.Deposits(state)), - ) -} diff --git a/x/node/types/legacy/v0.5/genesis.go b/x/node/types/legacy/v0.5/genesis.go deleted file mode 100644 index 45630c99..00000000 --- a/x/node/types/legacy/v0.5/genesis.go +++ /dev/null @@ -1,8 +0,0 @@ -package v05 - -type ( - GenesisState struct { - Nodes Nodes `json:"_"` - Params Params `json:"params"` - } -) diff --git a/x/node/types/legacy/v0.5/node.go b/x/node/types/legacy/v0.5/node.go deleted file mode 100644 index 97abc871..00000000 --- a/x/node/types/legacy/v0.5/node.go +++ /dev/null @@ -1,23 +0,0 @@ -package v05 - -import ( - "time" - - sdk "github.com/cosmos/cosmos-sdk/types" - - hubtypes "github.com/sentinel-official/hub/types" - legacyhubtypes "github.com/sentinel-official/hub/types/legacy/v0.5" -) - -type ( - Node struct { - Address hubtypes.NodeAddress `json:"address"` - Provider hubtypes.ProvAddress `json:"provider"` - Price sdk.Coins `json:"price"` - RemoteURL string `json:"remote_url"` - Status legacyhubtypes.Status `json:"status"` - StatusAt time.Time `json:"status_at"` - } - - Nodes []Node -) diff --git a/x/node/types/legacy/v0.5/params.go b/x/node/types/legacy/v0.5/params.go deleted file mode 100644 index 18294fbf..00000000 --- a/x/node/types/legacy/v0.5/params.go +++ /dev/null @@ -1,14 +0,0 @@ -package v05 - -import ( - "time" - - sdk "github.com/cosmos/cosmos-sdk/types" -) - -type ( - Params struct { - Deposit sdk.Coin `json:"deposit"` - InactiveDuration time.Duration `json:"inactive_duration"` - } -) diff --git a/x/node/types/legacy/v0.6/genesis.go b/x/node/types/legacy/v0.6/genesis.go deleted file mode 100644 index b9d5098c..00000000 --- a/x/node/types/legacy/v0.6/genesis.go +++ /dev/null @@ -1,13 +0,0 @@ -package v06 - -import ( - "github.com/sentinel-official/hub/x/node/types" - legacy "github.com/sentinel-official/hub/x/node/types/legacy/v0.5" -) - -func MigrateGenesisState(state *legacy.GenesisState) *types.GenesisState { - return types.NewGenesisState( - MigrateNodes(state.Nodes), - MigrateParams(state.Params), - ) -} diff --git a/x/node/types/legacy/v0.6/node.go b/x/node/types/legacy/v0.6/node.go deleted file mode 100644 index 2b70bae7..00000000 --- a/x/node/types/legacy/v0.6/node.go +++ /dev/null @@ -1,27 +0,0 @@ -package v06 - -import ( - hubtypes "github.com/sentinel-official/hub/types/legacy/v0.6" - "github.com/sentinel-official/hub/x/node/types" - legacy "github.com/sentinel-official/hub/x/node/types/legacy/v0.5" -) - -func MigrateNode(item legacy.Node) types.Node { - return types.Node{ - Address: item.Address.String(), - Provider: item.Provider.String(), - Price: item.Price, - RemoteURL: item.RemoteURL, - Status: hubtypes.MigrateStatus(item.Status), - StatusAt: item.StatusAt, - } -} - -func MigrateNodes(items legacy.Nodes) types.Nodes { - var nodes types.Nodes - for _, item := range items { - nodes = append(nodes, MigrateNode(item)) - } - - return nodes -} diff --git a/x/node/types/legacy/v0.6/params.go b/x/node/types/legacy/v0.6/params.go deleted file mode 100644 index 7967d7f8..00000000 --- a/x/node/types/legacy/v0.6/params.go +++ /dev/null @@ -1,13 +0,0 @@ -package v06 - -import ( - "github.com/sentinel-official/hub/x/node/types" - legacy "github.com/sentinel-official/hub/x/node/types/legacy/v0.5" -) - -func MigrateParams(params legacy.Params) types.Params { - return types.NewParams( - params.Deposit, - params.InactiveDuration, - ) -} diff --git a/x/plan/types/legacy/v0.5/genesis.go b/x/plan/types/legacy/v0.5/genesis.go deleted file mode 100644 index fe9f4875..00000000 --- a/x/plan/types/legacy/v0.5/genesis.go +++ /dev/null @@ -1,16 +0,0 @@ -package v05 - -import ( - hubtypes "github.com/sentinel-official/hub/types" -) - -type ( - GenesisPlan struct { - Plan Plan `json:"_"` - Nodes []hubtypes.NodeAddress `json:"nodes"` - } - - GenesisPlans []GenesisPlan - - GenesisState GenesisPlans -) diff --git a/x/plan/types/legacy/v0.5/plan.go b/x/plan/types/legacy/v0.5/plan.go deleted file mode 100644 index e43eaab6..00000000 --- a/x/plan/types/legacy/v0.5/plan.go +++ /dev/null @@ -1,24 +0,0 @@ -package v05 - -import ( - "time" - - sdk "github.com/cosmos/cosmos-sdk/types" - - hubtypes "github.com/sentinel-official/hub/types" - legacyhubtypes "github.com/sentinel-official/hub/types/legacy/v0.5" -) - -type ( - Plan struct { - ID uint64 `json:"id"` - Provider hubtypes.ProvAddress `json:"provider"` - Price sdk.Coins `json:"price"` - Validity time.Duration `json:"validity"` - Bytes sdk.Int `json:"bytes"` - Status legacyhubtypes.Status `json:"status"` - StatusAt time.Time `json:"status_at"` - } - - Plans []Plan -) diff --git a/x/plan/types/legacy/v0.6/genesis.go b/x/plan/types/legacy/v0.6/genesis.go deleted file mode 100644 index b946ebec..00000000 --- a/x/plan/types/legacy/v0.6/genesis.go +++ /dev/null @@ -1,33 +0,0 @@ -package v06 - -import ( - "github.com/sentinel-official/hub/x/plan/types" - legacy "github.com/sentinel-official/hub/x/plan/types/legacy/v0.5" -) - -func MigrateGenesisPlan(item legacy.GenesisPlan) types.GenesisPlan { - var nodes = make([]string, 0, len(item.Nodes)) - for _, item := range item.Nodes { - nodes = append(nodes, item.String()) - } - - return types.GenesisPlan{ - Plan: MigratePlan(item.Plan), - Nodes: nodes, - } -} - -func MigrateGenesisPlans(items legacy.GenesisPlans) types.GenesisPlans { - var plans types.GenesisPlans - for _, item := range items { - plans = append(plans, MigrateGenesisPlan(item)) - } - - return plans -} - -func MigrateGenesisState(state legacy.GenesisState) types.GenesisState { - return types.NewGenesisState( - MigrateGenesisPlans(legacy.GenesisPlans(state)), - ) -} diff --git a/x/plan/types/legacy/v0.6/plan.go b/x/plan/types/legacy/v0.6/plan.go deleted file mode 100644 index 1b5aa4c3..00000000 --- a/x/plan/types/legacy/v0.6/plan.go +++ /dev/null @@ -1,19 +0,0 @@ -package v06 - -import ( - hubtypes "github.com/sentinel-official/hub/types/legacy/v0.6" - "github.com/sentinel-official/hub/x/plan/types" - legacy "github.com/sentinel-official/hub/x/plan/types/legacy/v0.5" -) - -func MigratePlan(item legacy.Plan) types.Plan { - return types.Plan{ - Id: item.ID, - Provider: item.Provider.String(), - Price: item.Price, - Validity: item.Validity, - Bytes: item.Bytes, - Status: hubtypes.MigrateStatus(item.Status), - StatusAt: item.StatusAt, - } -} diff --git a/x/provider/types/legacy/v0.5/genesis.go b/x/provider/types/legacy/v0.5/genesis.go deleted file mode 100644 index 79f1de46..00000000 --- a/x/provider/types/legacy/v0.5/genesis.go +++ /dev/null @@ -1,8 +0,0 @@ -package v05 - -type ( - GenesisState struct { - Providers Providers `json:"_"` - Params Params `json:"params"` - } -) diff --git a/x/provider/types/legacy/v0.5/params.go b/x/provider/types/legacy/v0.5/params.go deleted file mode 100644 index 8409380c..00000000 --- a/x/provider/types/legacy/v0.5/params.go +++ /dev/null @@ -1,11 +0,0 @@ -package v05 - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" -) - -type ( - Params struct { - Deposit sdk.Coin `json:"deposit"` - } -) diff --git a/x/provider/types/legacy/v0.5/provider.go b/x/provider/types/legacy/v0.5/provider.go deleted file mode 100644 index c68c4103..00000000 --- a/x/provider/types/legacy/v0.5/provider.go +++ /dev/null @@ -1,17 +0,0 @@ -package v05 - -import ( - hubtypes "github.com/sentinel-official/hub/types" -) - -type ( - Provider struct { - Address hubtypes.ProvAddress `json:"address"` - Name string `json:"name"` - Identity string `json:"identity"` - Website string `json:"website"` - Description string `json:"description"` - } - - Providers []Provider -) diff --git a/x/provider/types/legacy/v0.6/genesis.go b/x/provider/types/legacy/v0.6/genesis.go deleted file mode 100644 index 86167de2..00000000 --- a/x/provider/types/legacy/v0.6/genesis.go +++ /dev/null @@ -1,13 +0,0 @@ -package v06 - -import ( - "github.com/sentinel-official/hub/x/provider/types" - legacy "github.com/sentinel-official/hub/x/provider/types/legacy/v0.5" -) - -func MigrateGenesisState(state *legacy.GenesisState) *types.GenesisState { - return types.NewGenesisState( - MigrateProviders(state.Providers), - MigrateParams(state.Params), - ) -} diff --git a/x/provider/types/legacy/v0.6/params.go b/x/provider/types/legacy/v0.6/params.go deleted file mode 100644 index ffc057d2..00000000 --- a/x/provider/types/legacy/v0.6/params.go +++ /dev/null @@ -1,12 +0,0 @@ -package v06 - -import ( - "github.com/sentinel-official/hub/x/provider/types" - legacy "github.com/sentinel-official/hub/x/provider/types/legacy/v0.5" -) - -func MigrateParams(params legacy.Params) types.Params { - return types.NewParams( - params.Deposit, - ) -} diff --git a/x/provider/types/legacy/v0.6/provider.go b/x/provider/types/legacy/v0.6/provider.go deleted file mode 100644 index db5aeae8..00000000 --- a/x/provider/types/legacy/v0.6/provider.go +++ /dev/null @@ -1,25 +0,0 @@ -package v06 - -import ( - "github.com/sentinel-official/hub/x/provider/types" - legacy "github.com/sentinel-official/hub/x/provider/types/legacy/v0.5" -) - -func MigrateProvider(item legacy.Provider) types.Provider { - return types.Provider{ - Address: item.Address.String(), - Name: item.Name, - Identity: item.Identity, - Website: item.Website, - Description: item.Description, - } -} - -func MigrateProviders(items legacy.Providers) types.Providers { - var providers types.Providers - for _, item := range items { - providers = append(providers, MigrateProvider(item)) - } - - return providers -} diff --git a/x/session/types/legacy/v0.5/genesis.go b/x/session/types/legacy/v0.5/genesis.go deleted file mode 100644 index 88daa7dc..00000000 --- a/x/session/types/legacy/v0.5/genesis.go +++ /dev/null @@ -1,8 +0,0 @@ -package v05 - -type ( - GenesisState struct { - Sessions Sessions `json:"_"` - Params Params `json:"params"` - } -) diff --git a/x/session/types/legacy/v0.5/params.go b/x/session/types/legacy/v0.5/params.go deleted file mode 100644 index a6545843..00000000 --- a/x/session/types/legacy/v0.5/params.go +++ /dev/null @@ -1,12 +0,0 @@ -package v05 - -import ( - "time" -) - -type ( - Params struct { - InactiveDuration time.Duration `json:"inactive_duration"` - ProofVerificationEnabled bool `json:"proof_verification_enabled"` - } -) diff --git a/x/session/types/legacy/v0.5/session.go b/x/session/types/legacy/v0.5/session.go deleted file mode 100644 index 3affa1e7..00000000 --- a/x/session/types/legacy/v0.5/session.go +++ /dev/null @@ -1,25 +0,0 @@ -package v05 - -import ( - "time" - - sdk "github.com/cosmos/cosmos-sdk/types" - - hubtypes "github.com/sentinel-official/hub/types" - legacyhubtypes "github.com/sentinel-official/hub/types/legacy/v0.5" -) - -type ( - Session struct { - ID uint64 `json:"id"` - Subscription uint64 `json:"subscription"` - Node hubtypes.NodeAddress `json:"node"` - Address sdk.AccAddress `json:"address"` - Duration time.Duration `json:"duration"` - Bandwidth legacyhubtypes.Bandwidth `json:"bandwidth"` - Status legacyhubtypes.Status `json:"status"` - StatusAt time.Time `json:"status_at"` - } - - Sessions []Session -) diff --git a/x/session/types/legacy/v0.6/genesis.go b/x/session/types/legacy/v0.6/genesis.go deleted file mode 100644 index 1c09a295..00000000 --- a/x/session/types/legacy/v0.6/genesis.go +++ /dev/null @@ -1,13 +0,0 @@ -package v06 - -import ( - "github.com/sentinel-official/hub/x/session/types" - legacy "github.com/sentinel-official/hub/x/session/types/legacy/v0.5" -) - -func MigrateGenesisState(state *legacy.GenesisState) *types.GenesisState { - return types.NewGenesisState( - MigrateSessions(state.Sessions), - MigrateParams(state.Params), - ) -} diff --git a/x/session/types/legacy/v0.6/params.go b/x/session/types/legacy/v0.6/params.go deleted file mode 100644 index 65c73641..00000000 --- a/x/session/types/legacy/v0.6/params.go +++ /dev/null @@ -1,13 +0,0 @@ -package v06 - -import ( - "github.com/sentinel-official/hub/x/session/types" - legacy "github.com/sentinel-official/hub/x/session/types/legacy/v0.5" -) - -func MigrateParams(params legacy.Params) types.Params { - return types.NewParams( - params.InactiveDuration, - params.ProofVerificationEnabled, - ) -} diff --git a/x/session/types/legacy/v0.6/session.go b/x/session/types/legacy/v0.6/session.go deleted file mode 100644 index dbd462d8..00000000 --- a/x/session/types/legacy/v0.6/session.go +++ /dev/null @@ -1,29 +0,0 @@ -package v06 - -import ( - hubtypes "github.com/sentinel-official/hub/types/legacy/v0.6" - "github.com/sentinel-official/hub/x/session/types" - legacy "github.com/sentinel-official/hub/x/session/types/legacy/v0.5" -) - -func MigrateSession(item legacy.Session) types.Session { - return types.Session{ - Id: item.ID, - Subscription: item.Subscription, - Node: item.Node.String(), - Address: item.Address.String(), - Duration: item.Duration, - Bandwidth: hubtypes.MigrateBandwidth(item.Bandwidth), - Status: hubtypes.MigrateStatus(item.Status), - StatusAt: item.StatusAt, - } -} - -func MigrateSessions(items legacy.Sessions) types.Sessions { - var sessions types.Sessions - for _, item := range items { - sessions = append(sessions, MigrateSession(item)) - } - - return sessions -} diff --git a/x/subscription/types/legacy/v0.5/genesis.go b/x/subscription/types/legacy/v0.5/genesis.go deleted file mode 100644 index 2897fc93..00000000 --- a/x/subscription/types/legacy/v0.5/genesis.go +++ /dev/null @@ -1,15 +0,0 @@ -package v05 - -type ( - GenesisSubscription struct { - Subscription Subscription `json:"_"` - Quotas Quotas `json:"quotas"` - } - - GenesisSubscriptions []GenesisSubscription - - GenesisState struct { - Subscriptions GenesisSubscriptions `json:"_"` - Params Params `json:"params"` - } -) diff --git a/x/subscription/types/legacy/v0.5/params.go b/x/subscription/types/legacy/v0.5/params.go deleted file mode 100644 index 92ddcf04..00000000 --- a/x/subscription/types/legacy/v0.5/params.go +++ /dev/null @@ -1,11 +0,0 @@ -package v05 - -import ( - "time" -) - -type ( - Params struct { - InactiveDuration time.Duration `json:"inactive_duration"` - } -) diff --git a/x/subscription/types/legacy/v0.5/quota.go b/x/subscription/types/legacy/v0.5/quota.go deleted file mode 100644 index 121986b7..00000000 --- a/x/subscription/types/legacy/v0.5/quota.go +++ /dev/null @@ -1,15 +0,0 @@ -package v05 - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" -) - -type ( - Quota struct { - Address sdk.AccAddress `json:"address"` - Consumed sdk.Int `json:"consumed"` - Allocated sdk.Int `json:"allocated"` - } - - Quotas []Quota -) diff --git a/x/subscription/types/legacy/v0.5/subscription.go b/x/subscription/types/legacy/v0.5/subscription.go deleted file mode 100644 index 9a4ab58c..00000000 --- a/x/subscription/types/legacy/v0.5/subscription.go +++ /dev/null @@ -1,27 +0,0 @@ -package v05 - -import ( - "time" - - sdk "github.com/cosmos/cosmos-sdk/types" - - hubtypes "github.com/sentinel-official/hub/types" - legacyhubtypes "github.com/sentinel-official/hub/types/legacy/v0.5" -) - -type ( - Subscription struct { - ID uint64 `json:"id"` - Owner sdk.AccAddress `json:"owner"` - Node hubtypes.NodeAddress `json:"node"` - Price sdk.Coin `json:"price"` - Deposit sdk.Coin `json:"deposit"` - Plan uint64 `json:"plan"` - Expiry time.Time `json:"expiry"` - Free sdk.Int `json:"free"` - Status legacyhubtypes.Status `json:"status"` - StatusAt time.Time `json:"status_at"` - } - - Subscriptions []Subscription -) diff --git a/x/subscription/types/legacy/v0.6/genesis.go b/x/subscription/types/legacy/v0.6/genesis.go deleted file mode 100644 index 399e6c0f..00000000 --- a/x/subscription/types/legacy/v0.6/genesis.go +++ /dev/null @@ -1,29 +0,0 @@ -package v06 - -import ( - "github.com/sentinel-official/hub/x/subscription/types" - legacy "github.com/sentinel-official/hub/x/subscription/types/legacy/v0.5" -) - -func MigrateGenesisSubscription(item legacy.GenesisSubscription) types.GenesisSubscription { - return types.GenesisSubscription{ - Subscription: MigrateSubscription(item.Subscription), - Quotas: MigrateQuotas(item.Quotas), - } -} - -func MigrateGenesisSubscriptions(items legacy.GenesisSubscriptions) types.GenesisSubscriptions { - var subscriptions types.GenesisSubscriptions - for _, item := range items { - subscriptions = append(subscriptions, MigrateGenesisSubscription(item)) - } - - return subscriptions -} - -func MigrateGenesisState(state *legacy.GenesisState) *types.GenesisState { - return types.NewGenesisState( - MigrateGenesisSubscriptions(state.Subscriptions), - MigrateParams(state.Params), - ) -} diff --git a/x/subscription/types/legacy/v0.6/params.go b/x/subscription/types/legacy/v0.6/params.go deleted file mode 100644 index 5e561603..00000000 --- a/x/subscription/types/legacy/v0.6/params.go +++ /dev/null @@ -1,12 +0,0 @@ -package v06 - -import ( - "github.com/sentinel-official/hub/x/subscription/types" - legacy "github.com/sentinel-official/hub/x/subscription/types/legacy/v0.5" -) - -func MigrateParams(params legacy.Params) types.Params { - return types.Params{ - InactiveDuration: params.InactiveDuration, - } -} diff --git a/x/subscription/types/legacy/v0.6/quota.go b/x/subscription/types/legacy/v0.6/quota.go deleted file mode 100644 index f0d6fbc6..00000000 --- a/x/subscription/types/legacy/v0.6/quota.go +++ /dev/null @@ -1,23 +0,0 @@ -package v06 - -import ( - "github.com/sentinel-official/hub/x/subscription/types" - legacy "github.com/sentinel-official/hub/x/subscription/types/legacy/v0.5" -) - -func MigrateQuota(item legacy.Quota) types.Quota { - return types.Quota{ - Address: item.Address.String(), - Allocated: item.Allocated, - Consumed: item.Consumed, - } -} - -func MigrateQuotas(items legacy.Quotas) types.Quotas { - var quotas types.Quotas - for _, item := range items { - quotas = append(quotas, MigrateQuota(item)) - } - - return quotas -} diff --git a/x/subscription/types/legacy/v0.6/subscription.go b/x/subscription/types/legacy/v0.6/subscription.go deleted file mode 100644 index df591d6d..00000000 --- a/x/subscription/types/legacy/v0.6/subscription.go +++ /dev/null @@ -1,32 +0,0 @@ -package v06 - -import ( - hubtypes "github.com/sentinel-official/hub/types/legacy/v0.6" - "github.com/sentinel-official/hub/x/subscription/types" - legacy "github.com/sentinel-official/hub/x/subscription/types/legacy/v0.5" -) - -func MigrateSubscription(item legacy.Subscription) types.Subscription { - return types.Subscription{ - Id: item.ID, - Owner: item.Owner.String(), - Node: item.Node.String(), - Price: item.Price, - Deposit: item.Deposit, - Plan: item.Plan, - Denom: "", - Expiry: item.Expiry, - Free: item.Free, - Status: hubtypes.MigrateStatus(item.Status), - StatusAt: item.StatusAt, - } -} - -func MigrateSubscriptions(items legacy.Subscriptions) types.Subscriptions { - var subscriptions types.Subscriptions - for _, item := range items { - subscriptions = append(subscriptions, MigrateSubscription(item)) - } - - return subscriptions -} diff --git a/x/swap/types/legacy/v0.5/ethereum.go b/x/swap/types/legacy/v0.5/ethereum.go deleted file mode 100644 index bcc58928..00000000 --- a/x/swap/types/legacy/v0.5/ethereum.go +++ /dev/null @@ -1,51 +0,0 @@ -package v05 - -import ( - "encoding/hex" - "encoding/json" -) - -const ( - EthereumHashLength = 32 -) - -type ( - EthereumHash [EthereumHashLength]byte -) - -func BytesToHash(b []byte) EthereumHash { - var a EthereumHash - a.SetBytes(b) - return a -} - -func (e *EthereumHash) SetBytes(b []byte) { - if len(b) > len(e) { - b = b[len(b)-EthereumHashLength:] - } - - copy(e[EthereumHashLength-len(b):], b) -} - -func (e EthereumHash) Bytes() []byte { return e[:] } - -func (e EthereumHash) Hex() string { return hex.EncodeToString(e[:]) } - -func (e EthereumHash) String() string { return e.Hex() } - -func (e EthereumHash) MarshalJSON() ([]byte, error) { return json.Marshal(e.String()) } - -func (e *EthereumHash) UnmarshalJSON(data []byte) error { - var s string - if err := json.Unmarshal(data, &s); err != nil { - return err - } - - hash, err := hex.DecodeString(s) - if err != nil { - return err - } - - *e = BytesToHash(hash) - return nil -} diff --git a/x/swap/types/legacy/v0.5/genesis.go b/x/swap/types/legacy/v0.5/genesis.go deleted file mode 100644 index 8e47ba81..00000000 --- a/x/swap/types/legacy/v0.5/genesis.go +++ /dev/null @@ -1,8 +0,0 @@ -package v05 - -type ( - GenesisState struct { - Swaps Swaps `json:"_"` - Params Params `json:"params"` - } -) diff --git a/x/swap/types/legacy/v0.5/keys.go b/x/swap/types/legacy/v0.5/keys.go deleted file mode 100644 index 37670ccf..00000000 --- a/x/swap/types/legacy/v0.5/keys.go +++ /dev/null @@ -1,5 +0,0 @@ -package v05 - -const ( - ModuleName = "swap" -) diff --git a/x/swap/types/legacy/v0.5/params.go b/x/swap/types/legacy/v0.5/params.go deleted file mode 100644 index 78811c60..00000000 --- a/x/swap/types/legacy/v0.5/params.go +++ /dev/null @@ -1,13 +0,0 @@ -package v05 - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" -) - -type ( - Params struct { - SwapEnabled bool `json:"swap_enabled"` - SwapDenom string `json:"swap_denom"` - ApproveBy sdk.AccAddress `json:"approve_by"` - } -) diff --git a/x/swap/types/legacy/v0.5/swap.go b/x/swap/types/legacy/v0.5/swap.go deleted file mode 100644 index db026988..00000000 --- a/x/swap/types/legacy/v0.5/swap.go +++ /dev/null @@ -1,15 +0,0 @@ -package v05 - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" -) - -type ( - Swap struct { - TxHash EthereumHash `json:"tx_hash"` - Receiver sdk.AccAddress `json:"receiver"` - Amount sdk.Coin `json:"amount"` - } - - Swaps []Swap -) diff --git a/x/swap/types/legacy/v0.6/genesis.go b/x/swap/types/legacy/v0.6/genesis.go deleted file mode 100644 index ff5a44bd..00000000 --- a/x/swap/types/legacy/v0.6/genesis.go +++ /dev/null @@ -1,13 +0,0 @@ -package v06 - -import ( - "github.com/sentinel-official/hub/x/swap/types" - legacy "github.com/sentinel-official/hub/x/swap/types/legacy/v0.5" -) - -func MigrateGenesisState(state *legacy.GenesisState) *types.GenesisState { - return types.NewGenesisState( - MigrateSwaps(state.Swaps), - MigrateParams(state.Params), - ) -} diff --git a/x/swap/types/legacy/v0.6/params.go b/x/swap/types/legacy/v0.6/params.go deleted file mode 100644 index 4c6be3bc..00000000 --- a/x/swap/types/legacy/v0.6/params.go +++ /dev/null @@ -1,14 +0,0 @@ -package v06 - -import ( - "github.com/sentinel-official/hub/x/swap/types" - legacy "github.com/sentinel-official/hub/x/swap/types/legacy/v0.5" -) - -func MigrateParams(params legacy.Params) types.Params { - return types.NewParams( - params.SwapEnabled, - params.SwapDenom, - params.ApproveBy.String(), - ) -} diff --git a/x/swap/types/legacy/v0.6/swap.go b/x/swap/types/legacy/v0.6/swap.go deleted file mode 100644 index de7cf8f3..00000000 --- a/x/swap/types/legacy/v0.6/swap.go +++ /dev/null @@ -1,23 +0,0 @@ -package v06 - -import ( - "github.com/sentinel-official/hub/x/swap/types" - legacy "github.com/sentinel-official/hub/x/swap/types/legacy/v0.5" -) - -func MigrateSwap(item legacy.Swap) types.Swap { - return types.Swap{ - TxHash: item.TxHash.Bytes(), - Receiver: item.Receiver.String(), - Amount: item.Amount, - } -} - -func MigrateSwaps(items legacy.Swaps) types.Swaps { - var swaps types.Swaps - for _, item := range items { - swaps = append(swaps, MigrateSwap(item)) - } - - return swaps -} diff --git a/x/vpn/types/legacy/v0.5/genesis.go b/x/vpn/types/legacy/v0.5/genesis.go deleted file mode 100644 index 285d4b24..00000000 --- a/x/vpn/types/legacy/v0.5/genesis.go +++ /dev/null @@ -1,21 +0,0 @@ -package v05 - -import ( - deposit "github.com/sentinel-official/hub/x/deposit/types/legacy/v0.5" - node "github.com/sentinel-official/hub/x/node/types/legacy/v0.5" - plan "github.com/sentinel-official/hub/x/plan/types/legacy/v0.5" - provider "github.com/sentinel-official/hub/x/provider/types/legacy/v0.5" - session "github.com/sentinel-official/hub/x/session/types/legacy/v0.5" - subscription "github.com/sentinel-official/hub/x/subscription/types/legacy/v0.5" -) - -type ( - GenesisState struct { - Deposits deposit.GenesisState `json:"deposits"` - Providers *provider.GenesisState `json:"providers"` - Nodes *node.GenesisState `json:"nodes"` - Plans plan.GenesisState `json:"plans"` - Subscriptions *subscription.GenesisState `json:"subscriptions"` - Sessions *session.GenesisState `json:"sessions"` - } -) diff --git a/x/vpn/types/legacy/v0.5/keys.go b/x/vpn/types/legacy/v0.5/keys.go deleted file mode 100644 index b0f9e973..00000000 --- a/x/vpn/types/legacy/v0.5/keys.go +++ /dev/null @@ -1,5 +0,0 @@ -package v05 - -const ( - ModuleName = "vpn" -) diff --git a/x/vpn/types/legacy/v0.6/genesis.go b/x/vpn/types/legacy/v0.6/genesis.go deleted file mode 100644 index a49a0500..00000000 --- a/x/vpn/types/legacy/v0.6/genesis.go +++ /dev/null @@ -1,23 +0,0 @@ -package v06 - -import ( - deposit "github.com/sentinel-official/hub/x/deposit/types/legacy/v0.6" - node "github.com/sentinel-official/hub/x/node/types/legacy/v0.6" - plan "github.com/sentinel-official/hub/x/plan/types/legacy/v0.6" - provider "github.com/sentinel-official/hub/x/provider/types/legacy/v0.6" - session "github.com/sentinel-official/hub/x/session/types/legacy/v0.6" - subscription "github.com/sentinel-official/hub/x/subscription/types/legacy/v0.6" - "github.com/sentinel-official/hub/x/vpn/types" - legacy "github.com/sentinel-official/hub/x/vpn/types/legacy/v0.5" -) - -func MigrateGenesisState(state *legacy.GenesisState) *types.GenesisState { - return types.NewGenesisState( - deposit.MigrateGenesisState(state.Deposits), - provider.MigrateGenesisState(state.Providers), - node.MigrateGenesisState(state.Nodes), - plan.MigrateGenesisState(state.Plans), - subscription.MigrateGenesisState(state.Subscriptions), - session.MigrateGenesisState(state.Sessions), - ) -}