Skip to content

Commit

Permalink
Add handleRepayment/2 to AToken mock for fork test compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlaprade committed Dec 23, 2022
1 parent cae3aa5 commit edb5661
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test/MockATokenCheckpointed.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,33 @@ contract MockATokenCheckpointed is ATokenCheckpointed {
ATokenCheckpointed(_pool, _governor, _castVoteWindow)
{}

function handleRepayment(
address user,
uint256 amount
) external virtual onlyPool {
// We need this because the Aave code we compile is ahead of the Aave code deployed on
// Optimism (where our tests fork from).
//
// Currently on Optimism, AToken.handleRepayment is a 2-argument function, as seen in the
// existing AToken implementation:
//
// https://optimistic.etherscan.io/address/0xa5ba6e5ec19a1bf23c857991c857db62b2aa187b#code
//
// But in the latest Aave v3 code, it is a 3-argument function:
//
// https://github.com/aave/aave-v3-core/blob/c38c627683c0db0449b7c9ea2fbd68bde3f8dc01/contracts/protocol/tokenization/AToken.sol#L166-L170
//
// The change was made as a result of this issue:
//
// https://github.com/aave/aave-v3-core/issues/742
//
// We expect that the on-chain AToken implementation will be upgraded to
// AToken.handleRepayment/3 at some point in the future. If/when that happens, we should remove
// this. But for now we need our aToken to have this function in our fork tests to maintain
// backwards compatibility.
}


function exposed_RawBalanceOf(address _user) public view returns (uint256) {
return _userState[_user].balance;
}
Expand Down

0 comments on commit edb5661

Please sign in to comment.