Closed scorpion9979 closed 3 years ago
Sounds like a good idea.
This might be more costly in terms of gas, but it's a lot more dynamic and doesn't require any maintenance.
It would. But all in all, it would cost less gas than deploying a new flash swap contract for every other new collateral listing.
In
HifiFlashUniswapV2.sol
, there's this line asserting that the sender address is the pair contract that was initialized at the constructor. Having the pairs set at the constructor makes the flash swap contract very difficult to adapt to new listed collateral tokens. Instead, I would suggest initializing the constructor with the Uniswap V2 init hash and factory contract address (they would change depending on which chain and Uniswap clone is used). The pair contract address to be used in the assertion would then be computed from the collateral and underlying token addresses as follows:This might be more costly in terms of gas, but it's a lot more dynamic and doesn't require any maintenance.