Uniswap V3 Multicall with SwapRouter | Multiple Swaps in 1 Transaction | Multicall, V3, SwapRouter
HTML-код
- Опубликовано: 15 окт 2022
- Get my free EthersJS cheatsheet to master Web3!
👉 blockman-codes.ck.page/91b29a...
------------------------------------------
Courses:
👉 Build a Uniswap V3 interface that can do swaps: bit.ly/3JkXYqL
------------------------------------------
Uniswap V3 multicall transactions allow you to include multiple transactions in the same Ethereum transaction and block. This minimizes the state change between each transaction.
Today, we'll learn to send multicall transactions to Uniswap V3's SwapRouter.
We'll use Uniswap V3 SwapRouter's multicall function to swap WETH for USDC, and WETH for UNI, both in the same block.
---------------------
Package.json, ABIs and contract addresses:
gist.github.com/BlockmanCodes... Наука
Learn to use all the Uniswap swap and liquidity functionality with code. bit.ly/3JkXYqL
Great tutorial!
However, you forgot to add approve functions before swap, otherwise it doesn't work (unless manually approved or swapped prior to this)
Suggestion for next video: make the same multicall, but with smart contract so approve can be in same transaction. Thanks!
Thank you very much, wish you good health always 😊
Thanks man, that's useful
Multi swap should be done using ExactInput function by passing in the encoded path instead of three ExactInputSingle
Is there a way to fetch estimated output tokens for the given input tokens using these smart contracts?
If yes, I would like to know more about it.
Thanks for the great tutorial! what do you actually use the PeripheryPaymentsABI for?
just used this idea to solve my 3 day old problem on python, thank you very much
Right on. I'm glad it helped!
@@blockmancodes having a blast right now playing on testnet 😎
Thanks for de video, I have question: how do you decode the transaction data when you have read it from the blockchain?
Wow! am actually learning 🌝
I love to hear it!
Thank you for this tutorial.
it would be REALLY interesting to use Multicall with smart contracts, your code only works with stable ones to me, if I try to swap smart contracts V3 or V2 it doesn't work
thanks for your video, but I got an error that says Error: cannot estimate gas. Where should I set this gas or gasLimit then?
hello @blockmancodes, its possible to do a multicall to make a swap if a direct pair does not exist?
Token A -> Token B then Token B -> Token C, in one multicall?
Can we approve a token to swap and make swap in one multicall?
I can't find the .approve... isn't it needed with Multicall? Otherwise, my question is: If I approved, for example, 5 minutes ago: do I need to approve again?
I can not find multicall fn in PSC V3 PositionManager
Hi , is it possible to do this with alpha router? , because
this sample requires the exact fee pool value to be passed (eg:3000, 100 etc).
Alpha router will come up with it's own path between 2 tokens, which you can then send to the router
So whst's the point of multi call?Seems like it’s the same as 2 exactinputSingle swaps. Smth with gas optimisation?
Sometimes you really want 2 swaps in the same block or not at all. Can be relevant for arbitrage
do we have to call `encodeDataFunction`. is it specific to ethers.js.
In this case, its coming from the swap router contract. As far as I know for multicalls, we need to use sendTransaction, which requires encoded instructions
I’m looking for a video where two different DEXs are involved, and I’d be able to send my money from one DEX to the other.
Hi @blockmancodes , I followed this tutorial . While trying to execute the transaction , iam getting an error saying cannot estimate gas; transaction may fail or may require manual gas limit reason="execution reverted: STF", method="estimateGas" .Can you please help
You need to add Gas Estimate to the Multical function or increase your gas estimate on your hardhat config
First thing to try is adding a gas limit
@@blockmancodes i tried it ,that was also not working . Then i tried approving the tokens to be spent before swapping and then it worked .But it is not working for mainnet
@@bejojeffrin7033 Can you confirm you used the correct addesses on mainnet (will not be the same as testnet/local) for approving tokens. Otherwise, it should work the same on testnet vs mainnet
How can this same thing be done using smart contracts?
I'd need to make a whole other video because the syntax will be different. But the flow is similar. I'll add it to my list.
@@blockmancodes yeah, I'd like that. Thank you for considering it.
How can I trade within the pool that we have created using code?
I think I covered an example of that in my Uniswap Flashloan video
Newbie, what will happen if I copy the code from etherscan and change the wallet address
I don't fully understand. Can you explain in more detail?
@@blockmancodes you are searching Bitcoin can I search ethereum
What else do you want to learn to do with Uniswap?
I can swap native ETH for a token (and the reverse) through metamask and it looks like its uses multicall. How is this done programmatically?
Can you please make this video using python and web3.py
There is a mystery without answer. Quoter multihop. How to encode params to make it work? No info on uniswap at all.
@@viktorcortez5706 Can you link me to the documentation for the method you want to call?
Thank you very much. I have a question: How to wap ETH to UNI? If we need wrap ETH for WETH, we call WETH9 contract method with multicall?
I get an error : Error: cannot estimate gas; transaction may fail or may require manual gas limit
Can you try adding a gasLimit?
@@blockmancodes Im pretty much new to the whole thing. All i can say is I tried setting the gas to 3million and got the same error and tried to rewatch and build it over and over and nothing changes. Even chatgpt cant help me on this one xD
hi can you teach me how to use on pancakeswap?
It's on my long term roadmap, but I won't get to it for awhile
Blockman your tutorials are on point it has turned me into a subscriber that doesn't happen easily as there's alot of fluffy ones out there, I would like more on multi functional dapps, or break down a big real world arbitrage transaction on what you think happened from etherscan evidence, maybe. Thanks keep these up i'm already working thru all your vids slowly building up my node and solidity skills to get them as close to your understanding as poss.
Thanks brother. I'm planning on doing a lot more arbitrage related content going forward
hello sir, can i contact you? i will learning about blochchain
I have an email in about page, but just for business inquiries.
You can leave the question as a comment on any video. I try to respond to everyone.