Skip to content

Commit

Permalink
fix: comments
Browse files Browse the repository at this point in the history
  • Loading branch information
GitGuru7 committed Oct 23, 2023
1 parent 30116c6 commit 724fe75
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
13 changes: 8 additions & 5 deletions contracts/VToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ contract VToken is
function reduceReserves(uint256 reduceAmount) external override nonReentrant {
accrueInterest();
if (reduceReservesBlockNumber == _getBlockNumber()) return;
_reduceReservesFresh(reduceAmount, IProtocolShareReserve.IncomeType.SPREAD);
_reduceReservesFresh(reduceAmount);
}

/**
Expand Down Expand Up @@ -786,7 +786,7 @@ contract VToken is

if (currentBlockNumber - reduceReservesBlockNumber >= reduceReservesBlockDelta) {
reduceReservesBlockNumber = currentBlockNumber;
_reduceReservesFresh(totalReservesNew, IProtocolShareReserve.IncomeType.SPREAD);
_reduceReservesFresh(totalReservesNew);
}

/* We emit an AccrueInterest event */
Expand Down Expand Up @@ -1257,9 +1257,8 @@ contract VToken is
* @notice Reduces reserves by transferring to the protocol reserve contract
* @dev Requires fresh interest accrual
* @param reduceAmount Amount of reduction to reserves
* @param kind kind of reserve
*/
function _reduceReservesFresh(uint256 reduceAmount, IProtocolShareReserve.IncomeType kind) internal {
function _reduceReservesFresh(uint256 reduceAmount) internal {
if (reduceAmount == 0) {
return;
}
Expand Down Expand Up @@ -1295,7 +1294,11 @@ contract VToken is
_doTransferOut(protocolShareReserve, reduceAmount);

// Update the pool asset's state in the protocol share reserve for the above transfer.
IProtocolShareReserve(protocolShareReserve).updateAssetsState(address(comptroller), underlying, kind);
IProtocolShareReserve(protocolShareReserve).updateAssetsState(
address(comptroller),
underlying,
IProtocolShareReserve.IncomeType.SPREAD
);

emit SpreadReservesReduced(protocolShareReserve, reduceAmount, totalReservesNew);
}
Expand Down
3 changes: 3 additions & 0 deletions contracts/VTokenInterfaces.sol
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,9 @@ abstract contract VTokenInterface is VTokenStorage {
*/
event SweepToken(address indexed token);

/**
* @notice Event emitted when reduce reserves block delta is changed
*/
event NewReduceReservesBlockDelta(uint256 oldReduceReservesBlockDelta, uint256 newReduceReservesBlockDelta);

/**
Expand Down
5 changes: 2 additions & 3 deletions contracts/test/VTokenHarness.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { AccessControlManager } from "@venusprotocol/governance-contracts/contra

import { VToken } from "../VToken.sol";
import { InterestRateModel } from "../InterestRateModel.sol";
import { IProtocolShareReserve } from "@venusprotocol/protocol-reserve/contracts/Interfaces/IProtocolShareReserve.sol";

contract VTokenHarness is VToken {
uint256 public blockNumber;
Expand Down Expand Up @@ -91,8 +90,8 @@ contract VTokenHarness is VToken {
_liquidateBorrowFresh(liquidator, borrower, repayAmount, vTokenCollateral, skipLiquidityCheck);
}

function harnessReduceReservesFresh(uint256 spreadAmount, IProtocolShareReserve.IncomeType kind) external {
return _reduceReservesFresh(spreadAmount, kind);
function harnessReduceReservesFresh(uint256 spreadAmount) external {
return _reduceReservesFresh(spreadAmount);
}

function harnessSetReserveFactorFresh(uint256 newReserveFactorMantissa) external {
Expand Down

0 comments on commit 724fe75

Please sign in to comment.