0

Using Solidity 0.4.17, I have defined a simple library at ./Addresses.sol

     function isContract(address _base) external pure returns(bool) {
    assembly {
        _r := gt(extcodesize(_base), 0)
     }
   }
 }

Now I am trying to use it in a contract at ./AddressesTests.sol

pragma solidity >=0.4.21 <0.6.0;

import "./Addresses.sol";

contract AddressesTests {
using Addresses for address;

function testIsContract() public {
    //error  TypeError: Member "isContract" not found or not visible 
  //after argument-dependent lookup in address payable.
    assert(address(this).isContract());
    assert(!msg.sender.isContract());
   }
 }

I get the error

   TypeError: Member "isContract" not found or not visible after 
   argument-dependent lookup in address payable.
    assert(!msg.sender.isContract());
            ^-------------------^

What am I doing wrong?

  • tried address(msg.sender).isContract()? – Aniket Jan 26 at 15:55
  • try to declare an address variable , assign msg.sender to it and then try same. – Aniket Jan 26 at 17:27

Your Answer

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

Browse other questions tagged or ask your own question.