Estoy tratando de cambiar ETH por su equivalente en WETH usando UniswapRouterV2 y ethers.js, pero no sé qué dirección poner como ETH en la matriz de ruta, ya que no tiene una, así que hágamelo saber. estoy haciendo mal
await this.uniswapRouter.swapETHForExactTokens( ethers.provider.getBalance(attacker.addres), // amountOut [0, this.weth.address], // path: what should it be instead of 0? attacker.address, // to (await ethers.provider.getBlock('latest').timestamp) * 2, // deadline {value: ethers.provider.getBalance(attacker.addres)} // msg.value )Acabo de recibirlo. Fue muy simple y el contrato UniswapRouterV2 no fue necesario en absoluto. Uno tiene que ejecutar la función de depósito del contrato WETH y el contrato devuelve ETH. Algo como esto:
await this.weth.connect(attacker).deposit({value: ethToWETHAmount})