2

I came across Kyber Network DEX contract. On the very first line, they had declared a variable with ERC20 type as follows:

ERC20 constant internal ETH_TOKEN_ADDRESS = ERC20(0x00eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee);

And this is used throughout the contract. What does it means? As far I know, only address, uint, string, bytes, bool etc are some types.

Here's the code of smart contract: https://etherscan.io/address/0x964f35fae36d75b1e72770e244f6595b68508cf5#code

2

The Kyber Network DEX can be considered a program, or an application if you will, which contains more than one smart contracts.

That ERC20 variable type is defined at line 83 in the code and is an interface:

interface ERC20 {
    function totalSupply() public view returns (uint supply);
    function balanceOf(address _owner) public view returns (uint balance);
    function transfer(address _to, uint _value) public returns (bool success);
    function transferFrom(address _from, address _to, uint _value) public returns (bool success);
    function approve(address _spender, uint _value) public returns (bool success);
    function allowance(address _owner, address _spender) public view returns (uint remaining);
    function decimals() public view returns(uint digits);
    event Approval(address indexed _owner, address indexed _spender, uint _value);
}

So, whatever variable of type ERC20, needs to be an instance of a smart contract that implements that ERC20 interface.

1

In this context, ERC20 is the contract "class" that defines the interface you can use to interact with the contract in the given address.

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.