Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update vault genesis state code #406

Merged
merged 1 commit into from
Aug 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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