2025-01-07 09:23:01 +00:00
|
|
|
package wrappeda0gibase
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"github.com/0glabs/0g-chain/x/wrapped-a0gi-base/keeper"
|
|
|
|
"github.com/0glabs/0g-chain/x/wrapped-a0gi-base/types"
|
|
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
2025-01-08 04:58:14 +00:00
|
|
|
"github.com/ethereum/go-ethereum/common"
|
2025-01-07 09:23:01 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// InitGenesis initializes the store state from a genesis state.
|
|
|
|
func InitGenesis(ctx sdk.Context, keeper keeper.Keeper, gs types.GenesisState) {
|
|
|
|
if err := gs.Validate(); err != nil {
|
|
|
|
panic(fmt.Sprintf("failed to validate %s genesis state: %s", types.ModuleName, err))
|
|
|
|
}
|
2025-01-08 04:58:14 +00:00
|
|
|
keeper.SetWA0GIAddress(ctx, common.BytesToAddress(gs.WrappedA0GiAddress))
|
2025-01-07 09:23:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ExportGenesis returns a GenesisState for a given context and keeper.
|
|
|
|
func ExportGenesis(ctx sdk.Context, keeper keeper.Keeper) *types.GenesisState {
|
2025-01-08 04:58:14 +00:00
|
|
|
return &types.GenesisState{
|
|
|
|
WrappedA0GiAddress: keeper.GetWA0GIAddress(ctx),
|
|
|
|
}
|
2025-01-07 09:23:01 +00:00
|
|
|
}
|