Uniswap V2 - Swap Tokens | DeFi
Вставка
- Опубліковано 9 лют 2025
- Let's learn about DeFi. This video explains how to trade an ERC20 token for another using a decentralized exchange called Uniswap.
Overview 0:20
Solidity code 1:18
Test 4:46
Run test using Ganache 7:25
#DeFi #Uniswap #SmartContract #Ethereum
Code: github.com/t4s...
References
Uniswap app.uniswap.org/
Etherscan etherscan.io
Follow on Twitter: @ProgrammerSmart / programmersmart
Join me on Discord: / discord
Website: smartcontractp...
Overview 0:20
Solidity code 1:18
Test 4:46
Run test using Ganache 7:25
Hey, are there any other platform where I can contact you? Just wanted to ask few things about connecting smart contracts to front end. Thanks
@@harveyvanresurreccion2434 discord.gg/Ny8sPaj
Sup fella, I need your opinion. I plan to participate in UnoRe private sale, THi introduce a secured ecosystem for investing in risk capital. What is the best moment to jump in?
@@makbyl2844 I buy high sell low. You're asking the wrong person
Why haven’t I seen yachannel before?! It’s a pity youhaven’t reviewed COVIDCRYPTO yet. This unique covid charity project is fantastic! yaCandonate to charity & get huge profits at the same time!
Thanks. This Defi series is exactly what I want. It includes the math, coding and demo. Please keep on!
just discovered your video. Thank you first! Keep working on it I will share it to mass who are willing to learn!
everything is soooo clear👍 this channel definitely deserves more viewers!
one of the best channel for blockchain development
Awesome content! I will share it with my friends.
Thank you, Ive been seeeeeeeeeaaarching for this content for a minute. Subbed 👏🏾
Again your video helped.
Thank you, man!
You are amazing! I've been looking for this all over the place
Please, shoot a video about UnoRe (UNO). The idea of risk trading on crypto is so fresh. It is especially interesting to lget about developing your own insurance products. I've never heard of this before.
which previous video are you talking about ?
best channel in the space!
WOW, so that is how todo End to End tests awesome!
Thanks man, It helped a lot
This was a very much needed video
Great‼️
Thanks for your videos. Now I can swap tokens between V2 and V3 using AAVE Flashloan)
😍 awesome video!!! So well explained~~~
🤓Will be looking forward to the video explaining how is pricing determined in Uniswap!!
Be excited! Brain crushing heavy math coming your way XD
@@smartcontractprogrammer 😂 I have all my math textbooks out and ready !!!
Hey, u gf or what? U comments all vdos huhs.
@@BlurryBit Is it any of your business?
Hey ..... great video got a lot to learn from here. Im using hardhat instead of truffle for testing. Im unable to import artifacts.require(""IERC20"). For hardhat is there some other way of importing artifacts ??
hi curious, how would one swap the tokens already sitting in a smart contract in uniswap? do i still need to approve? im getting like revert: stf error. have you heard of this?
Thanks alot for the video but can you please make a swap video on V3
I did the test for uniswap but it doesn't show the proper value for swapping in the out.
4:53 what do you mean by mainnet fork?
is it free to test real contracts on mainnet there?
you can simulate transcactions on mainnet without paying fee
ua-cam.com/video/G8bDhS24eds/v-deo.html
@@smartcontractprogrammer thanks
One of the best!
So are you
thanks a lot! great video!
Something you forgot to mention is that this will require an Infura project Id to add to the .env file.
great video.
Nice video. Is there a programmatic way of determining the best “path” (dai -> weth -> wbtc) instead of hard coding the “path”?
write a program that finds the best route, keep your contracts dumb
@smartcontractprogrammer awesome content thx! you mention the setup of mainnet_fork is done in a previous video, where can I find it?
nvm i guess you refer to the mainnet fork functionality of RPC providers like infura or alchemy, and how you can configure hardhat/truffle to access them
Thanks!
What happens if for some reason the transaction is unsuccessful during the execution of the swapTokensForExactTokens function. Will the tokens be on the balance of the contract and can anyone withdraw them?
all changes will be undone. Some of your ETH will be taken for gas fee even if transaction fails
What about multicall?
May i ask...what does a smart contract looks like ?
Like is it a website?
like a code
You are great bro
how do you use approve outside of ERC20 contract?
I mean it is impossible to call approve function of some ERC20 token outside of the contract.
Like this?
github.com/t4sk/defi-by-example/blob/main/test/test-uniswap.js#L26
@@smartcontractprogrammer I was talking about this line
github.com/t4sk/defi-by-example/blob/main/contracts/TestUniswap.sol#L20
you cannot call approve function of some ERC20 contract outside of that contract (in solidity)
@@aminghasemi2621 Please give me an example of what you to do
this awesome sir, but can you teach us how to snipe token on uniswap. So we can be a early buyers of that token
I am not a sniper. This guy is
github.com/Supercycled/cake_sniper
@smartcontractprogrammer: how to run solidity in vscode ?
install foundry and execute from terminal inside VSCODE
Great 👍
Does this feature help us hide the transaction from the font-running bot?
nope all transactions are visible to bots
hello, where to find the bn.js file? i cannot find it from your github
npm i bn.js
How about use evn in windown . This source .evn in command no found
I don't use Windows
I'm skeptical about uniswap... i swapped out some FET tokens for Ocean and its like ocean stole my money cause it went to their smart contract. I made 3 swaps, two went through but the last swap didn't and all my FET is in OCeans contract. i was left with only 129 ocean tokens. I lost $14k worth of FET
Maybe you're getting front run?
What is that DAI_WHALE address? Why we are using it?
need to get DAI
why do I have to do all of this coding? why can't i just swap on the platform?
You can just swap on platform.
This channel is about coding smart contract.
Can you please make a tutorial on how to create a defi deck like pancake swap from scratch ?
Sound too big of a scope.
How to pancake swap work in code ?
Could you please explain the 10^18 math clearly? Isn't 1 DAI ~ $1???
10**18 = 1 DAI similar to 100 cent = 1 USD
thx
THANK YOU MEN YOU FUCKING BOSS I LOVE YOU
is that 9.4 Billion in your wallet, very nice
whale's wallet. Ganache can unlock any wallet
@@smartcontractprogrammer awesome, i love you man, you are one of my personal heroes.
Amazing video, may i know your TG or Email? Thanks...
contact@smartcontractprogrammer.com
ua-cam.com/video/69wd2_keiIg/v-deo.html
Gosto dessa teoria
That looks great fella
Btw, I am willing to to say that project UnoRe looksreally great. great devs and advisory team, gives me confidence toput money.