How can I use IERC20("0xf7a35Eef60dC35fa2D3188Dfb22e635E4308fc8b"); it is throwing the error for me. I am try to use the another contract inside my contract.

contract LPTokenWrapper {
    using SafeMath for uint256;
    using SafeERC20 for IERC20;

    IERC20 public y = IERC20("0xf7a35Eef60dC35fa2D3188Dfb22e635E4308fc8b");

    uint256 private _totalSupply;
    mapping(address => uint256) private _balances;

    function totalSupply() public view returns (uint256) {
        return _totalSupply;

    function balanceOf(address account) public view returns (uint256) {
        return _balances[account];
  • I’m voting to close this question because it's not a question, it's a code dump (as in - you dumping your entire code here expecting others to find the error line, which you haven't even bothered to specify, and solve the problem for you). Please post ALL the relevant information, and ONLY the relevant information! Nov 17, 2020 at 11:15
  • I am changing it, please revert your vote. Nov 17, 2020 at 12:37

1 Answer 1


The type of "0xf7a35Eef60dC35fa2D3188Dfb22e635E4308fc8b" is string, not address.

Use address(0xf7a35Eef60dC35fa2D3188Dfb22e635E4308fc8b) instead.

In Javascript, BTW, you do need to use strings in order to denote addresses, because the integer value of an address (up to 2 ^ 160 - 1) might be larger than Number.MAX_SAFE_INTEGER (2 ^ 53 - 1).

  • It is not working getting errors Btw I have tried that one as well. SyntaxError: This looks like an address but has an invalid checksum. Correct checksummed address: "0x4d70c20155b4D6B19F0CE59E54e00ADC793a0885". If this is not used as an address, please prepend '00' Nov 17, 2020 at 12:57
  • @RahulSharma: Not sure what you're doing, but I did make one mistake in my answer, not specifying that you should explicitly cast that value to an address type (otherwise it is regarded as a uint). Please see updated answer. In either case, the error that you've described in the comment above doesn't make any sense. Nov 17, 2020 at 15:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.