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
@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
@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
@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
@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
@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
@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
Bxpana
@bxpana
Step 6: Prepare your .env We’ll take the time to make sure we have all our variables set and run `source .env` before moving on to the next step
1 reply
0 recast
0 reaction