mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-12-26 08:15:19 +00:00
31 lines
764 B
Go
31 lines
764 B
Go
package auction
|
|
|
|
import (
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
)
|
|
|
|
// InitGenesis - initializes the store state from genesis data
|
|
func InitGenesis(ctx sdk.Context, keeper Keeper, data GenesisState) {
|
|
keeper.SetParams(ctx, data.AuctionParams)
|
|
|
|
for _, a := range data.Auctions {
|
|
keeper.SetAuction(ctx, a)
|
|
}
|
|
}
|
|
|
|
// ExportGenesis returns a GenesisState for a given context and keeper.
|
|
func ExportGenesis(ctx sdk.Context, keeper Keeper) GenesisState {
|
|
params := keeper.GetParams(ctx)
|
|
|
|
var genAuctions GenesisAuctions
|
|
iterator := keeper.GetAuctionIterator(ctx)
|
|
|
|
for ; iterator.Valid(); iterator.Next() {
|
|
|
|
auction := keeper.DecodeAuction(ctx, iterator.Value())
|
|
genAuctions = append(genAuctions, auction)
|
|
|
|
}
|
|
return NewGenesisState(params, genAuctions)
|
|
}
|