Skip to content

Commit

Permalink
Fix Etherscan warning from checkpointInterest
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlucid committed Apr 30, 2022
1 parent 78c15b2 commit a35a047
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
7 changes: 4 additions & 3 deletions contracts/CToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ contract CToken is CTokenInterface, Exponential, TokenErrorReporter {
emit AccrueInterest(cashPrior, interestAccumulated, borrowIndexNew, totalBorrowsNew);

// Attempt to add interest checkpoint
address(interestRateModel).call(abi.encodeWithSignature("checkpointInterest(uint256)", borrowRateMantissa));
if (interestRateModelReactive) address(interestRateModel).call(abi.encodeWithSignature("checkpointInterest(uint256)", borrowRateMantissa));

return uint(Error.NO_ERROR);
}
Expand Down Expand Up @@ -1503,10 +1503,11 @@ contract CToken is CTokenInterface, Exponential, TokenErrorReporter {
emit NewMarketInterestRateModel(oldInterestRateModel, newInterestRateModel);

// Attempt to reset interest checkpoints on old IRM
if (address(oldInterestRateModel) != address(0)) address(oldInterestRateModel).call(abi.encodeWithSignature("resetInterestCheckpoints()"));
if (interestRateModelReactive) address(oldInterestRateModel).call(abi.encodeWithSignature("resetInterestCheckpoints()"));

// Attempt to add first interest checkpoint on new IRM
address(newInterestRateModel).call(abi.encodeWithSignature("checkpointInterest()"));
(bool success, ) = address(newInterestRateModel).call(abi.encodeWithSignature("checkpointInterest()"));
interestRateModelReactive = success;

return uint(Error.NO_ERROR);
}
Expand Down
23 changes: 12 additions & 11 deletions contracts/CTokenInterfaces.sol
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,16 @@ contract CTokenStorage is CTokenAdminStorage {
* @notice Share of seized collateral that is added to reserves
*/
uint public constant protocolSeizeShareMantissa = 2.8e16; //2.8%

/**
* @notice Underlying asset for this CToken
*/
address public underlying;

/**
* @notice Whether or not the interestRateModel is reactive.
*/
bool public interestRateModelReactive;
}

contract CTokenInterface is CTokenStorage {
Expand Down Expand Up @@ -284,15 +294,7 @@ contract CTokenInterface is CTokenStorage {
function _setInterestRateModel(InterestRateModel newInterestRateModel) public returns (uint);
}

contract CErc20Storage {
/**
* @notice Underlying asset for this CToken
*/
address public underlying;
}

contract CErc20Interface is CErc20Storage {

contract CErc20Interface {
/*** User Interface ***/

function mint(uint mintAmount) external returns (uint);
Expand All @@ -302,10 +304,9 @@ contract CErc20Interface is CErc20Storage {
function repayBorrow(uint repayAmount) external returns (uint);
function repayBorrowBehalf(address borrower, uint repayAmount) external returns (uint);
function liquidateBorrow(address borrower, uint repayAmount, CTokenInterface cTokenCollateral) external returns (uint);

}

contract CEtherInterface is CErc20Storage {
contract CEtherInterface {
/**
* @notice Indicator that this is a CEther contract (for inspection)
*/
Expand Down

0 comments on commit a35a047

Please sign in to comment.