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 ?
interface(yourContractAddress)is a way to tell your contract that whatever is atyourContractAddressis compatible withinterfaceand you can use it to interact with this contract. That's kinda the main use of interfaces tbf – Foxxxey Sep 12 '21 at 11:19