Skip to content

Commit

Permalink
Merge pull request #406 from comdex-official/vault-refactor-d
Browse files Browse the repository at this point in the history
update vault genesis state code
  • Loading branch information
dheerajkd30 authored Aug 22, 2022
2 parents be06dad + 3649da6 commit 80ab0c8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
24 changes: 12 additions & 12 deletions x/vault/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
)
}
14 changes: 7 additions & 7 deletions x/vault/types/genesis.go
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
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,
}
}

func DefaultGenesisState() *GenesisState {
return NewGenesisState(
[]Vault{},
[]StableMintVault{},
// []AppExtendedPairVaultMappingData{},
// []UserVaultAssetMapping{},
[]AppExtendedPairVaultMappingData{},
[]OwnerAppExtendedPairVaultMappingData{},
)
}

Expand Down

0 comments on commit 80ab0c8

Please sign in to comment.