-
Notifications
You must be signed in to change notification settings - Fork 207
/
market.go
39 lines (31 loc) · 1003 Bytes
/
market.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Package v0_32_0
// nolint revive
package v0_32_0
import (
types "github.com/akash-network/akash-api/go/node/market/v1beta4"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkmodule "github.com/cosmos/cosmos-sdk/types/module"
utypes "github.com/akash-network/node/upgrades/types"
"github.com/akash-network/node/x/market/keeper/keys/v1beta4"
)
type marketMigrations struct {
utypes.Migrator
}
func newMarketMigration(m utypes.Migrator) utypes.Migration {
return marketMigrations{Migrator: m}
}
func (m marketMigrations) GetHandler() sdkmodule.MigrationHandler {
return m.handler
}
// handler migrates market from version 3 to 4.
func (m marketMigrations) handler(ctx sdk.Context) error {
store := ctx.KVStore(m.StoreKey())
iter := sdk.KVStorePrefixIterator(store, types.LeasePrefix())
defer iter.Close()
for ; iter.Valid(); iter.Next() {
var val types.Lease
m.Codec().MustUnmarshal(iter.Value(), &val)
store.Delete(v1beta4.SecondaryLeaseKeyByProvider(val.LeaseID))
}
return nil
}