4

In the contract below, how to look up address of tokenContract ?

Operator != not compatible with types address and contract Token if(msg.sender != tokenContract) throw;

contract Token { }

contract A{

    Token public tokenContract

    function A(address addressOfTokenContract) {
    tokenContract = Token(addressOfTokenContract);
    }


    function B() {
    if(msg.sender != tokenContract) throw;
    }


}
6

You can cast the contract to an address type with

msg.sender != address(tokenContract)

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.