I keep reviewing code with interfaces, without seeing any reference anywhere of what contract that interface points to. For example in this contract for the popular cryptocurrency Axie Infinity:

On line 49, we see that there is an interface for the ERC20 token contract

interface IERC20 {
  event Transfer(address indexed _from, address indexed _to, uint256 _value);
  event Approval(address indexed _owner, address indexed _spender, uint256 _value);

  function totalSupply() external view returns (uint256 _supply);
  function balanceOf(address _owner) external view returns (uint256 _balance);

But no reference to which contract on the blockchain is being referenced.

  • MY Question:

    • How does this contract and other contracts know which contract the interface is referencing when compiled, when there is absolutely no contract being referenced in the code?

1 Answer 1


It is used by the inheritance

contract ERC20 is IERC20 {

contract ERC20Detailed is ERC20, IERC20Detailed {

contract AXSToken is ERC20Detailed, ERC20GatewayWhitelist {

So by inheritance AXSToken as IERC20.

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.