mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-12-26 08:15:19 +00:00
83a5f51c11
* hotfix * update params, keys * liquidation by keeper * refactor GetPendingBorrowBalance * fix app build * elegant handling of denom arrays * auction deposit in lots * add error msg * update tests with new params * happy path liquidation test * update liquidator macc name * refactor reward % to money market params * refactor tests for updated params * compile: harvest liquidator module account * add liquidate msg * liquidation approach * update liquidations * return remaining deposit coins to original borrowr * check keeper reward before sending * introduce ValuationMap * convert Ints <> Decs * implement double-loop * ModuleAccountName * sort keys for deterministic auctions * test: correct auctions created * test: preset keeper coins * ensure deterministic iteration * test cases * update repay test * auction fixes, tests * LTV index * user actions sync interest and update ltv index * tests: all deposits must have money markets * reorder borrow logic * ltv index liquidation logic * test specific items in ltv index * index liquidation tests * update repay to spendable coins * revisions * remove address sort method * merge master test package
18 lines
545 B
Go
18 lines
545 B
Go
package harvest
|
|
|
|
import (
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
)
|
|
|
|
// BeginBlocker applies rewards to liquidity providers and delegators according to params
|
|
func BeginBlocker(ctx sdk.Context, k Keeper) {
|
|
k.ApplyDepositRewards(ctx)
|
|
if k.ShouldDistributeValidatorRewards(ctx, k.BondDenom(ctx)) {
|
|
k.ApplyDelegationRewards(ctx, k.BondDenom(ctx))
|
|
k.SetPreviousDelegationDistribution(ctx, ctx.BlockTime(), k.BondDenom(ctx))
|
|
}
|
|
k.ApplyInterestRateUpdates(ctx)
|
|
k.AttemptIndexLiquidations(ctx)
|
|
k.SetPreviousBlockTime(ctx, ctx.BlockTime())
|
|
}
|