The Uniswap V2 docs provide an example flashswap contract here. The doc says:
For the sake of example, let's assume that we're dealing with a DAI/WETH pair, where DAI is token0 and WETH is token1.
On lines 33 & 34 the contract gets the token address using:
address token0 = IUniswapV2Pair(msg.sender).token0(); address token1 = IUniswapV2Pair(msg.sender).token1();
- What is happening when it calls IUniswapV2Pair(msg.sender)?
- How does it know which tokens we are interested in swapping? In other words what is returned when we call .token0() and .token1()? Is DAI and WETH token address always returned here?