transmissions11 / solmate

Modern, opinionated, and gas optimized building blocks for smart contract development.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

missing check for ERC20.decimal call

charlesxsh opened this issue · comments

in solmate/src/mixins/ERC4626.sol:38

constructor(
        ERC20 _asset,
        string memory _name,
        string memory _symbol
    ) ERC20(_name, _symbol, _asset.decimals()) {              // line 38
        asset = _asset;
    }

The return value of the _asset.decimals() should be checked according to
https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md#decimals

This method can be used to improve usability, but interfaces and other contracts MUST NOT expect these values to be present.

commented

yeahhh aware of this but in practice everyone uses decimals. there's no downside here to using it, if the token is weird it forces u to be aware of that and modify slightly.