Skip to content

Commit

Permalink
refactor: interface inheritance (aave-dao#21)
Browse files Browse the repository at this point in the history
* refactor: interface inheritance

* refactor: inherit permit

* fix: add inheritdoc
  • Loading branch information
sakulstra authored Sep 10, 2024
1 parent e339b57 commit 5c63d4c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
17 changes: 16 additions & 1 deletion src/periphery/contracts/static-a-token/StataTokenV2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
pragma solidity ^0.8.0;

import {ERC20Upgradeable, ERC20PermitUpgradeable} from 'openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions/ERC20PermitUpgradeable.sol';
import {IERC20Metadata} from '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';
import {PausableUpgradeable} from 'openzeppelin-contracts-upgradeable/contracts/utils/PausableUpgradeable.sol';
import {IPermissionlessRescuable, PermissionlessRescuable} from 'solidity-utils/contracts/utils/PermissionlessRescuable.sol';
import {IRescuableBase, RescuableBase} from 'solidity-utils/contracts/utils/RescuableBase.sol';
import {IERC20Permit} from '@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol';

import {IACLManager} from '../../../core/contracts/interfaces/IACLManager.sol';
import {ERC4626Upgradeable, ERC4626StataTokenUpgradeable, IPool, Math, IERC20} from './ERC4626StataTokenUpgradeable.sol';
Expand Down Expand Up @@ -80,7 +82,20 @@ contract StataTokenV2 is
return IACLManager(POOL_ADDRESSES_PROVIDER.getACLManager()).isEmergencyAdmin(actor);
}

function decimals() public view override(ERC20Upgradeable, ERC4626Upgradeable) returns (uint8) {
///@inheritdoc IERC20Permit
function nonces(
address owner
) public view virtual override(ERC20PermitUpgradeable, IERC20Permit) returns (uint256) {
return super.nonces(owner);
}

///@inheritdoc IERC20Metadata
function decimals()
public
view
override(IERC20Metadata, ERC20Upgradeable, ERC4626Upgradeable)
returns (uint8)
{
/// @notice The initialization of ERC4626Upgradeable already assures that decimal are
/// the same as the underlying asset of the StataTokenV2, e.g. decimals of WETH for stataWETH
return ERC4626Upgradeable.decimals();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ pragma solidity ^0.8.0;

import {IERC4626StataToken} from './IERC4626StataToken.sol';
import {IERC20AaveLM} from './IERC20AaveLM.sol';
import {IERC4626} from '@openzeppelin/contracts/interfaces/IERC4626.sol';
import {IERC20Permit} from '@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol';

interface IStataTokenV2 is IERC4626StataToken, IERC20AaveLM {
interface IStataTokenV2 is IERC4626, IERC20Permit, IERC4626StataToken, IERC20AaveLM {
/**
* @notice Checks if the passed actor is permissioned emergency admin.
* @param actor The reward to claim
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ contract ERC4626StataTokenUpgradeableTest is TestnetProcedures {
assertEq(erc4626Upgradeable.previewRedeem(shares), assets);
}

function test_totalAssets_shouldbeZeroOnZeroSupply() external {
function test_totalAssets_shouldbeZeroOnZeroSupply() external view {
assertEq(erc4626Upgradeable.totalAssets(), 0);
}

Expand Down

0 comments on commit 5c63d4c

Please sign in to comment.