Suppose we want to handle ERC-20 tokens, but some of the token contracts does not comply with the standard completely. In IERC20 interface, transfer
has the following signature.
function transfer(address to, uint value) external returns (bool);
In a solidity code, we can call the method of a contract like this:
bool success = IERC20(tokenAddress).transfer(to, value)
My questions are,
What happens if the transfer method of the contract does not return anything.
- Calling
transfer
ends up in revert? - Or assigning empty value to a boolean variable results in revert?
- Or it doesn't revert and some value is assigned?
- Calling
What happens if the transfer method of the contract returns a value of another data type like
uint
- assigning a uint value to a boolean variable results in revert?
- Or it doesn't revert and some value is assigned?