Bxpana pfp
Bxpana
@bxpana
šŸŒĀ It's time to swap!Ā Let's trade our WETH for another ERC20 token using @Uniswap's Swap Router on our @ZKsync fork. We'll utilizeĀ `cast send`Ā to perform the swap. Ready to trade? šŸ§µšŸ‘‡
0 reply
0 recast
1 reaction

Bxpana pfp
Bxpana
@bxpana
Step 1: Find the Swap Router Address Set the Uniswap Swap Router address in yourĀ `.env` and run source .env to update your variables.
1 reply
0 recast
0 reaction

Bxpana pfp
Bxpana
@bxpana
Step 2: Approve WETH for Swapping Allow the Swap Router to spend your WETH. ReplaceĀ `<AMOUNT_IN>`Ā with the amount you want to swap (in wei). šŸ“Ā Again you can use this converter to easily get the amount in wei https://eth-converter.com/
1 reply
0 recast
0 reaction

Bxpana pfp
Bxpana
@bxpana
Step 3: Select an ERC20 Token Choose a token to swap into. Find one from theĀ ZKsync Tokens List (https://era.zksync.io/tokens)Ā and set. Make sure to use a more popular token to make sure there is plenty of liquidity for swapping.
1 reply
0 recast
0 reaction

Bxpana pfp
Bxpana
@bxpana
Step 4: Determine the Fee Tier Use https://app.uniswap.org/explore/pools/zksync to find a pool with plenty of liquidity. Choose the fee tier for the pool you're swapping in (e.g.,Ā `3000`Ā for 0.3% fee).
1 reply
0 recast
0 reaction

Bxpana pfp
Bxpana
@bxpana
šŸ’”Test your Foundry skills: You can also use cast call to read what the fee is for the pool address you chose.
1 reply
0 recast
0 reaction

Bxpana pfp
Bxpana
@bxpana
Step 5: Prepare Swap Parameters CalculateĀ `amountOutMinimum`Ā to protect against slippage. Use expected rates minus your slippage tolerance (e.g., 1%). Use tools likeĀ @krakenfx Convert https://www.kraken.com/convertĀ for estimates. āš–ļø
1 reply
0 recast
0 reaction