Skip to content

Commit

Permalink
Update Arbitrage.t.sol
Browse files Browse the repository at this point in the history
  • Loading branch information
wisley63 authored Apr 10, 2024
1 parent 822fe24 commit 89abe68
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions hw2/test/Arbitrage.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -82,22 +82,23 @@ contract Arbitrage is Test {
/**
* Please add your solution above
*/
address[] memory path = new address[](5);
address[] memory path = new address[](6);
path[0] = address(tokenB);
path[1] = address(tokenA);
path[2] = address(tokenD);
path[3] = address(tokenC);
path[4] = address(tokenB);
path[2] = address(tokenE);
path[3] = address(tokenD);
path[4] = address(tokenC);
path[5] = address(tokenB);

// 执行交易
router.swapExactTokensForTokens(
5 ether, // 使用的tokenB数量
0, // 接受的最小tokenB数量,根据实际情况调整
path, // 交换路径
arbitrager, // 接收最终代币的地址
block.timestamp + 300 // 交易的截止时间
5 ether,
0,
path,
arbitrager,
block.timestamp + 300
);


uint256 tokensAfter = tokenB.balanceOf(arbitrager);
assertGt(tokensAfter, 20 ether);
console.log("After Arbitrage tokenB Balance: %s", tokensAfter);
Expand Down

0 comments on commit 89abe68

Please sign in to comment.