From 3649da64ef886ef56bc8ab560bb6ec759b5b3547 Mon Sep 17 00:00:00 2001 From: Dheeraj Dubey Date: Mon, 22 Aug 2022 15:39:49 +0530 Subject: [PATCH] update vault genesis state code --- x/vault/genesis.go | 24 ++++++++++++------------ x/vault/types/genesis.go | 14 +++++++------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/x/vault/genesis.go b/x/vault/genesis.go index a1d305259..cd10ee446 100644 --- a/x/vault/genesis.go +++ b/x/vault/genesis.go @@ -17,23 +17,23 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, state *types.GenesisState) { k.SetStableMintVault(ctx, item) } - // for _, item := range state.AppExtendedPairVaultMapping { - // err := k.SetAppExtendedPairVaultMappingData(ctx, item) - // if err != nil { - // return - // } - // } - - // for _, item := range state.UserVaultAssetMapping { - // k.SetUserVaultExtendedPairMapping(ctx, item) - // } + for _, item := range state.AppExtendedPairVaultMapping { + err := k.SetAppExtendedPairVaultMappingData(ctx, item) + if err != nil { + return + } + } + + for _, item := range state.UserVaultAssetMapping { + k.SetUserAppExtendedPairMappingData(ctx, item) + } } func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { return types.NewGenesisState( k.GetVaults(ctx), k.GetStableMintVaults(ctx), - // k.GetAllAppExtendedPairVaultMapping(ctx), - // k.GetAllUserVaultExtendedPairMapping(ctx), + k.GetAllAppExtendedPairVaultMapping(ctx), + k.GetAllUserVaultExtendedPairMapping(ctx), ) } diff --git a/x/vault/types/genesis.go b/x/vault/types/genesis.go index 03185b924..7363eafbb 100644 --- a/x/vault/types/genesis.go +++ b/x/vault/types/genesis.go @@ -1,11 +1,11 @@ package types -func NewGenesisState(vaults []Vault, stableMintVault []StableMintVault) *GenesisState { +func NewGenesisState(vaults []Vault, stableMintVault []StableMintVault, appExtendedPairVaultMapping []AppExtendedPairVaultMappingData, userVaultAssetMapping []OwnerAppExtendedPairVaultMappingData) *GenesisState { return &GenesisState{ - Vaults: vaults, - StableMintVault: stableMintVault, - // AppExtendedPairVaultMapping: appExtendedPairVaultMapping, - // UserVaultAssetMapping: userVaultAssetMapping, + Vaults: vaults, + StableMintVault: stableMintVault, + AppExtendedPairVaultMapping: appExtendedPairVaultMapping, + UserVaultAssetMapping: userVaultAssetMapping, } } @@ -13,8 +13,8 @@ func DefaultGenesisState() *GenesisState { return NewGenesisState( []Vault{}, []StableMintVault{}, - // []AppExtendedPairVaultMappingData{}, - // []UserVaultAssetMapping{}, + []AppExtendedPairVaultMappingData{}, + []OwnerAppExtendedPairVaultMappingData{}, ) }