0g-chain/x/auction/legacy/v0_17/migrate.go
Nick DeLuca bbb2235ba0
Add auction migration (#1220)
* add initial auction migration from Levi's work

* reserve bid_duration field name as well

* refactor auction specifc migration code to legacy v0_17 pkg

* Add auction migration specific test. Delete v016 migration files. Add makefile target for running migration tests.

Co-authored-by: galxy25 <levismschoen@gmail.com>
2022-04-22 11:36:05 -07:00

26 lines
809 B
Go

package v0_17
import (
v016auction "github.com/kava-labs/kava/x/auction/legacy/v0_16"
v017auction "github.com/kava-labs/kava/x/auction/types"
)
func Migrate(oldState v016auction.GenesisState) *v017auction.GenesisState {
return &v017auction.GenesisState{
NextAuctionId: oldState.NextAuctionId,
Params: migrateParams(oldState.Params),
Auctions: oldState.Auctions,
}
}
func migrateParams(params v016auction.Params) v017auction.Params {
return v017auction.Params{
MaxAuctionDuration: params.MaxAuctionDuration,
ForwardBidDuration: v017auction.DefaultForwardBidDuration,
ReverseBidDuration: v017auction.DefaultReverseBidDuration,
IncrementSurplus: params.IncrementSurplus,
IncrementDebt: params.IncrementDebt,
IncrementCollateral: params.IncrementCollateral,
}
}