We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Here we're assuming token is an ERC20 compliant address always. To code this defensively we'd check always if it's a token contract.
Also we need to check if to != address(0).
function isERC20(address token) internal view returns (bool) { return token.code.length > 0 && IERC20(token).totalSupply() > 0; } function withdrawAndRevert(address token, address to, uint256 amount, bytes calldata data) public nonReentrant { require(isERC20(token), "Provided address is not an ERC20 token"); require(token != address(0), "Provided address is invalid"); IERC20(token).safeTransfer(address(gateway), amount);
Originally posted by @fbac in #217 (comment)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Also we need to check if to != address(0).
Originally posted by @fbac in #217 (comment)
The text was updated successfully, but these errors were encountered: