Skip to content

Commit

Permalink
change require to revert
Browse files Browse the repository at this point in the history
  • Loading branch information
kyzia551 committed Aug 14, 2024
1 parent b596ccc commit 09d6ec2
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ abstract contract Stata4626Upgradable is ERC4626Upgradeable, IStata4626 {
}

function __Stata4626_init_unchained(address newAToken) internal onlyInitializing {
require(IAToken(newAToken).POOL() == address(POOL));
// sanity check, to be sure that we support that version of the aToken
address poolOfAToken = IAToken(newAToken).POOL();
if (poolOfAToken != address(POOL)) revert PoolAddressMismatch(poolOfAToken);

IERC20 aTokenUnderlying = IERC20(IAToken(newAToken).UNDERLYING_ASSET_ADDRESS());
__ERC4626_init(aTokenUnderlying);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ contract StaticATokenFactory is Initializable, IStaticATokenFactory {
address cachedStaticAToken = _underlyingToStaticAToken[underlyings[i]];
if (cachedStaticAToken == address(0)) {
DataTypes.ReserveDataLegacy memory reserveData = POOL.getReserveData(underlyings[i]);
require(reserveData.aTokenAddress != address(0), 'UNDERLYING_NOT_LISTED');
if (reserveData.aTokenAddress == address(0))
revert NotListedUnderlying(reserveData.aTokenAddress);
bytes memory symbol = abi.encodePacked(
'stat',
IERC20Metadata(reserveData.aTokenAddress).symbol()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ interface IStata4626 {
bytes32 s;
}

error PoolAddressMismatch(address pool);

error StaticATokenInvalidZeroShares();

error OnlyPauseGuardian(address caller);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
pragma solidity ^0.8.10;

interface IStaticATokenFactory {
error NotListedUnderlying(address underlying);

/**
* @notice Creates new staticATokens
* @param underlyings the addresses of the underlyings to create.
Expand Down

0 comments on commit 09d6ec2

Please sign in to comment.