call both incentive hooks (#804)

This commit is contained in:
Denali Marsh 2021-02-08 15:13:30 +01:00 committed by GitHub
parent 0edbdf968e
commit c60365f12e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -23,15 +23,19 @@ func (k Keeper) Deposit(ctx sdk.Context, depositor sdk.AccAddress, coins sdk.Coi
} }
} }
// Call incentive hook // Call incentive hooks
existingDeposit, hasExistingDeposit := k.GetDeposit(ctx, depositor) existingDeposit, hasExistingDeposit := k.GetDeposit(ctx, depositor)
if hasExistingDeposit { if hasExistingDeposit {
k.BeforeDepositModified(ctx, existingDeposit) k.BeforeDepositModified(ctx, existingDeposit)
} }
existingBorrow, hasExistingBorrow := k.GetBorrow(ctx, depositor)
if hasExistingBorrow {
k.BeforeBorrowModified(ctx, existingBorrow)
}
// Sync any outstanding interest // Sync any outstanding interest
k.SyncBorrowInterest(ctx, depositor)
k.SyncSupplyInterest(ctx, depositor) k.SyncSupplyInterest(ctx, depositor)
k.SyncBorrowInterest(ctx, depositor)
err := k.ValidateDeposit(ctx, coins) err := k.ValidateDeposit(ctx, coins)
if err != nil { if err != nil {