I am studying a sample contract and found the interface to be defined and declared as:

interface IUniswapV2Router02 is IUniswapV2Router01 {
    function removeLiquidityETHSupportingFeeOnTransferTokens(
        address token,
        uint liquidity,
    ) external returns (uint amountETH);

Within the contract, this interface is used seldom as

IUniswapV2Router02 public immutable uniswapV2Router;

constructor () public {
    _rOwned[_msgSender()] = _rTotal;
    IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x10ED43C718714eb63d5aA57B78B54704E256024E);
        // Create a uniswap pair for this new token

What I find hard to understand is that how is an argument (the address 0x10ED43C718714eb63d5aA57B78B54704E256024E) being passed to the interface ? Are interfaces supposed to allow this ?

  • Not sure i understand your question, but yeah, interface(yourContractAddress) is a way to tell your contract that whatever is at yourContractAddress is compatible with interface and you can use it to interact with this contract. That's kinda the main use of interfaces tbf
    – Foxxxey
    Commented Sep 12, 2021 at 11:19

1 Answer 1


This is how it is supposed to work. In the example above, you are not calling any methods in the interface contract. This is interpreted as telling EVM to create an instance (called _uniswapV2Router) with the same functions/variables of the interface at contract in address X. Then you will be able to interact with contract using the instance.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.