github.com/gravity-devs/liquidity@v1.5.3/x/liquidity/legacy/v043/store.go (about) 1 package v043 2 3 import ( 4 sdk "github.com/cosmos/cosmos-sdk/types" 5 6 v042liquidity "github.com/gravity-devs/liquidity/x/liquidity/legacy/v042" 7 ) 8 9 // MigrateStore performs in-place store migrations from v0.42 to v0.43. The 10 // migration includes: 11 // 12 // - Change addresses to be length-prefixed. 13 func MigrateStore(ctx sdk.Context, storeKey sdk.StoreKey) error { 14 store := ctx.KVStore(storeKey) 15 16 // old key format v042: 17 // PoolByReserveAccIndex: `0x12 | ReserveAcc -> ProtocolBuffer(uint64)` 18 // PoolBatchIndex: `0x21 | PoolId -> ProtocolBuffer(uint64)` 19 // new key format v043: 20 // PoolByReserveAccIndex: `0x12 | ReserveAccLen (1 byte) | ReserveAcc -> ProtocolBuffer(uint64)` 21 // PoolBatchIndex: deprecated 22 MigratePrefixAddress(store, v042liquidity.PoolByReserveAccIndexKeyPrefix) 23 DeleteDeprecatedPrefix(store, v042liquidity.PoolBatchIndexKeyPrefix) 24 return nil 25 }