call hooks in export genesis (#837)

This commit is contained in:
Denali Marsh 2021-02-19 21:49:36 +01:00 committed by GitHub
parent 0a51a737cb
commit 0b6e47ff46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -54,6 +54,7 @@ func ExportGenesis(ctx sdk.Context, k Keeper) GenesisState {
borrows := types.Borrows{} borrows := types.Borrows{}
k.IterateDeposits(ctx, func(d types.Deposit) bool { k.IterateDeposits(ctx, func(d types.Deposit) bool {
k.BeforeDepositModified(ctx, d)
syncedDeposit, found := k.GetSyncedDeposit(ctx, d.Depositor) syncedDeposit, found := k.GetSyncedDeposit(ctx, d.Depositor)
if !found { if !found {
panic(fmt.Sprintf("syncable deposit not found for %s", d.Depositor)) panic(fmt.Sprintf("syncable deposit not found for %s", d.Depositor))
@ -63,6 +64,7 @@ func ExportGenesis(ctx sdk.Context, k Keeper) GenesisState {
}) })
k.IterateBorrows(ctx, func(b types.Borrow) bool { k.IterateBorrows(ctx, func(b types.Borrow) bool {
k.BeforeBorrowModified(ctx, b)
syncedBorrow, found := k.GetSyncedBorrow(ctx, b.Borrower) syncedBorrow, found := k.GetSyncedBorrow(ctx, b.Borrower)
if !found { if !found {
panic(fmt.Sprintf("syncable borrow not found for %s", b.Borrower)) panic(fmt.Sprintf("syncable borrow not found for %s", b.Borrower))