As of Solidity 0.5.X, contract types do not include the address
members. Per the documentation:
Contract types do not include address
members anymore in order to
separate the namespaces. Therefore, it is now necessary to explicitly
convert values of contract type to addresses before using an address
member. Example: if c
is a contract, change c.transfer(...)
to
address(c).transfer(...)
, and c.balance
to address(c).balance
.
So you will need to update that particular line of code to be require(address(token) != address(0));
, as shown in this mvce:
pragma solidity ^0.5.2;
contract ERC20Interface {
function totalSupply() public view returns (uint);
function balanceOf(address tokenOwner) public view returns (uint balance);
function allowance(address tokenOwner, address spender) public view returns (uint remaining);
function transfer(address to, uint tokens) public returns (bool success);
function approve(address spender, uint tokens) public returns (bool success);
function transferFrom(address from, address to, uint tokens) public returns (bool success);
event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}
contract init {
ERC20Interface token;
function test() public view {
require(address(token) != address(0));
}
}