From c60365f12ee96d83b3411003b6d2f0bcfa6baffb Mon Sep 17 00:00:00 2001 From: Denali Marsh Date: Mon, 8 Feb 2021 15:13:30 +0100 Subject: [PATCH] call both incentive hooks (#804) --- x/hard/keeper/deposit.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/x/hard/keeper/deposit.go b/x/hard/keeper/deposit.go index 3562ca62..23201fc5 100644 --- a/x/hard/keeper/deposit.go +++ b/x/hard/keeper/deposit.go @@ -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) if hasExistingDeposit { k.BeforeDepositModified(ctx, existingDeposit) } + existingBorrow, hasExistingBorrow := k.GetBorrow(ctx, depositor) + if hasExistingBorrow { + k.BeforeBorrowModified(ctx, existingBorrow) + } // Sync any outstanding interest - k.SyncBorrowInterest(ctx, depositor) k.SyncSupplyInterest(ctx, depositor) + k.SyncBorrowInterest(ctx, depositor) err := k.ValidateDeposit(ctx, coins) if err != nil {