Skip to content

Commit 73bc41c

Browse files
committed
modify formula annotation
1 parent 909c28c commit 73bc41c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

x/lending/keeper/pool.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,10 @@ func (k Keeper) RebalancePool(ctx sdk.Context, poolId string, maturity int64, to
148148
//
149149
// Formula:
150150
//
151-
// borrow rate = borrowAPR / blocksPerYear * (1-reserve factor)
152-
// borrowIndex_new = borrowIndex_old * (1+borrow rate)
153-
// totalBorrowed_new = totalBorrowed_old * borrowIndex_new/borrowIndex_old
151+
// borrowRatePerBlock = borrowAPR / blocksPerYear
152+
// borrowIndexRatio = 1 + borrowRatePerBlock
153+
// borrowIndex_new = borrowIndex_old * borrowIndexRatio
154+
// totalBorrowed_new = totalBorrowed_old * borrowIndexRatio
154155
func (k Keeper) UpdatePoolTranches(ctx sdk.Context, pool *types.LendingPool) {
155156
// get blocks per year
156157
blocksPerYear := k.GetBlocksPerYear(ctx)

0 commit comments

Comments
 (0)