mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-12-25 07:45:18 +00:00
fix: set interest accumulation time and exit when borrows are zero (#840)
This commit is contained in:
parent
1ab2e9965f
commit
5cd94047a4
@ -81,6 +81,10 @@ func (k Keeper) AccrueInterest(ctx sdk.Context, denom string) error {
|
||||
if foundBorrowedCoinsPrior {
|
||||
borrowedPrior = sdk.NewCoin(denom, borrowedCoinsPrior.AmountOf(denom))
|
||||
}
|
||||
if borrowedPrior.IsZero() {
|
||||
k.SetPreviousAccrualTime(ctx, denom, ctx.BlockTime())
|
||||
return nil
|
||||
}
|
||||
|
||||
reservesPrior, foundReservesPrior := k.GetTotalReserves(ctx)
|
||||
if !foundReservesPrior {
|
||||
|
Loading…
Reference in New Issue
Block a user