SafeERC20
Last updated
Was this helpful?
Last updated
Was this helpful?
Source:
function``
safeApprove
(ERC20 _token, address _spender, uint256 _amount) internal returns (bool)
Same as a standards-compliant ERC20.approve() that never reverts (returns false). Note that this makes an external call to the token.
Parameters:
_token
- ERC20
_spender
- address
_amount
- uint256
Returns:
bool
function``
safeTransfer
(ERC20 _token, address _to, uint256 _amount) internal returns (bool)
Same as a standards-compliant ERC20.transfer() that never reverts (returns false). Note that this makes an external call to the token.
Parameters:
_token
- ERC20
_to
- address
_amount
- uint256
Returns:
bool
function``
safeTransferFrom
(ERC20 _token, address _from, address _to, uint256 _amount) internal returns (bool)
Same as a standards-compliant ERC20.transferFrom() that never reverts (returns false). Note that this makes an external call to the token.
Parameters:
_token
- ERC20
_from
- address
_to
- address
_amount
- uint256
Returns:
bool
function``
staticAllowance
(ERC20 _token, address _owner, address _spender) internal view returns (uint256)
Static call into ERC20.allowance(). Reverts if the call fails for some reason (should never fail).
Parameters:
_token
- ERC20
_owner
- address
_spender
- address
Returns:
uint256
function``
staticBalanceOf
(ERC20 _token, address _owner) internal view returns (uint256)
Static call into ERC20.balanceOf(). Reverts if the call fails for some reason (should never fail).
Parameters:
_token
- ERC20
_owner
- address
Returns:
uint256
function``
staticTotalSupply
(ERC20 _token) internal view returns (uint256)
Static call into ERC20.totalSupply(). Reverts if the call fails for some reason (should never fail).
Parameters:
_token
- ERC20
Returns:
uint256