Skip to content

Commit

Permalink
feat: added additional functions to IAToken for EIP2612
Browse files Browse the repository at this point in the history
  • Loading branch information
The-3D committed Dec 21, 2021
1 parent 1e0dcf3 commit df8ee61
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 2 deletions.
12 changes: 12 additions & 0 deletions contracts/interfaces/IAToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,16 @@ interface IAToken is IERC20, IScaledBalanceToken, IInitializableAToken {
* @dev Returns the address of the Aave treasury, receiving the fees on this aToken
**/
function RESERVE_TREASURY_ADDRESS() external view returns (address);

/**
* @notice Get the domain separator for the token
* @dev Return cached value if chainid matched cache, otherwise recomputes separator
* @return The domain separator of the token at current chain
*/
function DOMAIN_SEPARATOR() external view returns (bytes32);

/**
* @notice Returns the nonce for owner
**/
function nonces(address owner) external view returns (uint256);
}
21 changes: 21 additions & 0 deletions contracts/protocol/tokenization/AToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -294,4 +294,25 @@ contract AToken is VersionedInitializable, IncentivizedERC20, IAToken {
) internal override {
_transfer(from, to, amount, true);
}

/**
* @dev overrides the base function to fully implement IAToken
* @dev see `IncentivizedERC20.DOMAIN_SEPARATOR()` for more detailed documentation
*/
function DOMAIN_SEPARATOR() public view override(IAToken, IncentivizedERC20) returns (bytes32) {
return super.DOMAIN_SEPARATOR();
}

/**
* @dev overrides the base function to fully implement IAToken
* @dev see `IncentivizedERC20.nonces()` for more detailed documentation
*/
function nonces(address owner)
public
view
override(IAToken, IncentivizedERC20)
returns (uint256)
{
return super.nonces(owner);
}
}
4 changes: 2 additions & 2 deletions contracts/protocol/tokenization/IncentivizedERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ abstract contract IncentivizedERC20 is Context, IERC20, IERC20Detailed {
* @dev Return cached value if chainid matched cache, otherwise recomputes separator
* @return The domain separator of the token at current chain
*/
function DOMAIN_SEPARATOR() public view returns (bytes32) {
function DOMAIN_SEPARATOR() public view virtual returns (bytes32) {
if (block.chainid == _chainId) {
return _domainSeparator;
}
Expand All @@ -302,7 +302,7 @@ abstract contract IncentivizedERC20 is Context, IERC20, IERC20Detailed {
);
}

function nonces(address owner) external view virtual returns (uint256) {
function nonces(address owner) public view virtual returns (uint256) {
return _nonces[owner];
}
}

0 comments on commit df8ee61

Please sign in to comment.