Skip to content

Commit

Permalink
Extend Checkpoints with new sizes and lookup mechanisms (OpenZeppelin…
Browse files Browse the repository at this point in the history
  • Loading branch information
Amxx authored and JulissaDantes committed Nov 4, 2022
1 parent 41ca215 commit dc62c04
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions contracts/token/ERC20/extensions/ERC4626.sol
Expand Up @@ -33,8 +33,13 @@ abstract contract ERC4626 is ERC20, IERC4626 {
* @dev Set the underlying asset contract. This must be an ERC20-compatible contract (ERC20 or ERC777).
*/
constructor(IERC20 asset_) {
(bool success, uint8 assetDecimals) = _tryGetAssetDecimals(asset_);
_decimals = success ? assetDecimals : super.decimals();
uint8 decimals_;
try IERC20Metadata(address(asset_)).decimals() returns (uint8 value) {
decimals_ = value;
} catch {
decimals_ = super.decimals();
}

_asset = asset_;
_decimals = decimals_;
}
Expand Down

0 comments on commit dc62c04

Please sign in to comment.