Skip to content

Commit

Permalink
demo-router: contract + task
Browse files Browse the repository at this point in the history
  • Loading branch information
Rolaman committed Sep 26, 2024
1 parent 58cf2ad commit 7560f3b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion contracts/UniswapV2Router01.sol
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ contract UniswapV2Router01 is IUniswapV2Router01, NilCurrencyBase {
if (tokens.length != 1) {
revert("UniswapV2Router: should contains only pair token");
}
smartCall(pair, tokens, abi.encodeWithSignature("swap(address)", amount0Out, amount1Out, to));
smartCall(pair, tokens, abi.encodeWithSignature("swap(uint,uint,address)", amount0Out, amount1Out, to));
}

// TODO: This method are used for swapping via multiple pairs. Not supported in nil for now
Expand Down
5 changes: 2 additions & 3 deletions tasks/core/demo-router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,7 @@ task("demo-router", "Run demo with Uniswap Router").setAction(

// 3. ROUTER: ADD LIQUIDITY
const pairArtifact = await hre.artifacts.readArtifact("UniswapV2Pair");
const routerArtifact =
await hre.artifacts.readArtifact("UniswapV2Router01");
const routerArtifact = await hre.artifacts.readArtifact("UniswapV2Router01");

// Mint liquidity
console.log("Adding liquidity...");
Expand Down Expand Up @@ -277,7 +276,7 @@ task("demo-router", "Run demo with Uniswap Router").setAction(
await waitTillCompleted(publicClient, shardNumber(walletAddress), hash2);

console.log(
`Sent ${swapAmount.toString()} of currency0 to the pair contract.`,
`Sent ${swapAmount.toString()} of currency0 to the pair contract. Tx - ${hash2}`,
);

console.log("Swap executed successfully.");
Expand Down

0 comments on commit 7560f3b

Please sign in to comment.