Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: interface inheritance #21

Merged
merged 3 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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