Fast Khaki Raccoon
Medium
Stable is hardcoded to false, meaning that we would not be able to use any stable pools on aerodrome ( USDC : USDT
оr WETH : stETH
), even if they have the highest liquidity for the pair and thus the lowest slippage and fee.
We have hardcoded stable
to false, meaning that we would not be able to use aerodrome stable pools:
_routes[0] = IAerodromeRouter.Route({
from: _tokenIn,
to: _tokenOut,
stable: false,
factory: IAerodromeRouter(V2_ROUTER).defaultFactory()
});
We can see from aerodrome's code that we are not able to get a stable pool is stable is false
https://github.com/aerodrome-finance/contracts/blob/main/contracts/Router.sol#L70
function poolFor(address tokenA, address tokenB, bool stable, address _factory) public view returns (address pool) {
address _defaultFactory = defaultFactory;
address factory = _factory == address(0) ? _defaultFactory : _factory;
if (!IFactoryRegistry(factoryRegistry).isPoolFactoryApproved(factory)) revert PoolFactoryDoesNotExist();
(address token0, address token1) = sortTokens(tokenA, tokenB);
bytes32 salt = keccak256(abi.encodePacked(token0, token1, stable));
pool = Clones.predictDeterministicAddress(IPoolFactory(factory).implementation(), salt, factory);
}
No response
No response
The contract will not work with stable pools in general.
The stable pools can be the ones with highest liquidity and thus lowest slippage and fees. Even more true if we are swapping between stable pairs like USDC : USDT
оr WETH : stETH
No response
Consider adding the ability to add stable to the input parameters.