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: return address #58

Closed
wants to merge 2 commits into from
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ abstract contract ERC4626StataTokenUpgradeable is ERC4626Upgradeable, IERC4626St
}

///@inheritdoc IERC4626StataToken
function aToken() public view returns (IERC20) {
function aToken() public view returns (address) {
ERC4626StataTokenStorage storage $ = _getERC4626StataTokenStorage();
return $._aToken;
return address($._aToken);
}

///@inheritdoc IERC4626
Expand Down
6 changes: 3 additions & 3 deletions src/periphery/contracts/static-a-token/StataTokenV2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ contract StataTokenV2 is
function maxRescue(
address asset
) public view override(IRescuableBase, RescuableBase) returns (uint256) {
IERC20 cachedAToken = aToken();
if (asset == address(cachedAToken)) {
address cachedAToken = aToken();
if (asset == cachedAToken) {
uint256 requiredBacking = _convertToAssets(totalSupply(), Math.Rounding.Ceil);
uint256 balance = cachedAToken.balanceOf(address(this));
uint256 balance = IERC20(cachedAToken).balanceOf(address(this));
return balance > requiredBacking ? balance - requiredBacking : 0;
}
return type(uint256).max;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ interface IERC4626StataToken {

/**
* @notice The aToken used inside the 4626 vault.
* @return IERC20 The aToken IERC20.
* @return address The aToken address.
*/
function aToken() external view returns (IERC20);
function aToken() external view returns (address);

/**
* @notice Returns the current asset price of the stataToken.
Expand Down
Loading