Solidity Tutorial: ERC20 token transfers (transfer, transferFrom, approve)

  Рет қаралды 48,559

EatTheBlocks

EatTheBlocks

4 жыл бұрын

FREE MASTERCLASS "Get Into Web3 In a Bear Market"
👉 Link: eattheblocks.com/masterclass
👉 Full roadmap to learn Web3 Development & get a 6 figure remote job
👉 EVEN during this bear market
With ERC20 tokens, there are 2 APIs to transfer tokens:
- transfer() (simple transfers)
- transferFrom() (delegated transfer)
For transfer(), there are 3 steps:
1. Import the ERC20 token
2. Import the address of the token
3. Call transfer()
For transfer(), there are 4 steps:
1. Import the ERC20 token
2. Import the address of the token
3. Call approve()
4. Call transferFrom()
Watch this video to understand how this all fits together, so that you learn how to transfer ERC20 tokens in Solidity.
WATCH Whole Solidity tutorial series: • Solidity Tutorial: Int...

Пікірлер: 51
@rickhoro
@rickhoro 3 жыл бұрын
All the other videos are great to this point. Sorry, but I find this one to be confusing.
@nolestock4291
@nolestock4291 3 жыл бұрын
love the videos. small critique: i would have preferred to see you deploy everything and interact with the contract's through their interface. there's still a gap in my understanding.
@andrianski12
@andrianski12 4 жыл бұрын
Good job, keep going
@MotherCoin
@MotherCoin 3 жыл бұрын
Thank you
@sandeepbhattacharya8158
@sandeepbhattacharya8158 3 жыл бұрын
What about security and sanity checks is openzappalin contracts taking care of it or we should implement our own like checking balance first null or empty address require from owner etc?
@Artixou
@Artixou 4 жыл бұрын
Hey Julian, keep posting these - very useful.
@malkiattal4297
@malkiattal4297 3 жыл бұрын
i wish you did this amazing tutorial in french bro, still very clear and interresting, thank you !!
@EatTheBlocks
@EatTheBlocks 3 жыл бұрын
Glad you liked it!
@aga080
@aga080 3 жыл бұрын
Can you please make a video on the multiTransfer function?
@Mrpjm200
@Mrpjm200 3 жыл бұрын
Should the line: transferToken.transferFrom(recipient, amount); have been put in a separate function, which can be called by the approved contract (e.g. not in the Owner contract)?
@drakegao816
@drakegao816 2 жыл бұрын
Maybe I missed something. Why can you pass the token as an argument into the TransferToken contract at line 28? Thanks.
@aatkaKhan
@aatkaKhan 2 жыл бұрын
Hey Julian, great tutorial! Just want to know if there is another simple way to use these transfer functions in our smart contract.
@drabbani90
@drabbani90 2 жыл бұрын
hi julian , in my contract i have did the same thing the approve and transfer from function , but when i do the transfer from function with the price for example i want to send 100 Tokens it always give gas estimation errored when i do the value as '0' then it aproves the transaction but no erc tokens are transfered can you please tell me any solution for that
@amarachiugwu_
@amarachiugwu_ 2 жыл бұрын
Nice video Julian, does this also work for BEP20 Tokens?
@EatTheBlocks
@EatTheBlocks 2 жыл бұрын
Yes, it's the same
@consciousnova8337
@consciousnova8337 3 жыл бұрын
how did you declare the 'token' variable? When I try to do 'Token token = Token(_address_)' it gives me an error 'Identifier not found or not unique' I'm doing compiler ^0.8.0
@azharkhanyt
@azharkhanyt 2 жыл бұрын
Can you help me Transfer my erc20 token to on the exchanger?
@anyasiuche5617
@anyasiuche5617 3 жыл бұрын
Hey Julian thanks for this videos..but why cant i deploy the token.sol contract? remix keeps showing an error alert < _This contract may be abstract, not implement an abstract parent's methods completely or not invoke an inherited contract's constructor correctly_ >
@anyasiuche5617
@anyasiuche5617 3 жыл бұрын
lolz..i was able to solve it by watching your next video in the series by calling the parent constructor >> constructor() ERC20('Token', 'TOK'){} then i removed the _abstract_ keyword from token contract.
@wasifkarim1698
@wasifkarim1698 3 жыл бұрын
Can't it be deployed like that of sending ether videos ? please , tell me why I am able to deploy it ? Token.sol is not being compiled. It gives error. Someone please help!
@1223whiteguy
@1223whiteguy 3 жыл бұрын
Your accent makes me believe in love, merci
@EatTheBlocks
@EatTheBlocks 3 жыл бұрын
haha!
@hamza-325
@hamza-325 3 жыл бұрын
Yeah, I usually get mad when I hear the strong french accent in the tutorials done by some French people and I can't focus because of it, but his accent is an exception, it is really great!
@anthonynolanjannotta4688
@anthonynolanjannotta4688 3 жыл бұрын
How can i interact with an ERC20 token if i don't have the solidity file? Is there another way to import it into my contract? Thanks!
@EatTheBlocks
@EatTheBlocks 3 жыл бұрын
You just need the interface
@gamersvideoclips8309
@gamersvideoclips8309 2 жыл бұрын
Y dont you show its working
@victordanu5022
@victordanu5022 3 жыл бұрын
is it the same for bep20?
@EatTheBlocks
@EatTheBlocks 3 жыл бұрын
yes
@manishapadole4173
@manishapadole4173 Жыл бұрын
this is not working please share it with testnet deployment and transfer from function
@Yasinaktimur
@Yasinaktimur 4 жыл бұрын
can you share your codes as gist
@EatTheBlocks
@EatTheBlocks 4 жыл бұрын
good idea, I ll think about it. In the meantime, you can register as a free member of EatTheBlocks at pro.eattheblocks.com for the source code of many tutorials
@alexmelka5324
@alexmelka5324 4 жыл бұрын
why only two arguments line 20 ?
@EatTheBlocks
@EatTheBlocks 4 жыл бұрын
I will check
@subujekupadupa
@subujekupadupa 3 жыл бұрын
@@EatTheBlocks have you ever checked it?
@repzo5551
@repzo5551 3 жыл бұрын
Because it's msg.sender that is passed as a parameter on line 22. If you wanted to change that, then yes, an additionnal argument would be needed
@yadusolparterre
@yadusolparterre 2 жыл бұрын
What is a TransferToken? Why not call it Token? Other tokens cannot be transferred? You show the ERC20 implementation but then you import a Token.sol... what is the connection between the two? And why call a contract Owner? The contract owns another contract? This is incredibly confusing. You create more questions than you answer
@satadalchakravarty3911
@satadalchakravarty3911 2 жыл бұрын
who is going to show the deployment ????
@alexirabor
@alexirabor 3 жыл бұрын
Your videos are good, but you never run your programs. You just code and stop.
@waleednaseem8571
@waleednaseem8571 11 ай бұрын
is anyone here to guide me ?
@jorgerozenberg4519
@jorgerozenberg4519 4 жыл бұрын
I don't understand which is the address of the token
@su4per2star0
@su4per2star0 4 жыл бұрын
line 16 and 29 but he's just using a random address... if you go back one video in the playlist he shows you how to write a function to set the real address kzbin.info/www/bejne/j6m4aWqlabpon9k
@alfonsopayra
@alfonsopayra 2 жыл бұрын
this video is not clear at all, sorry mate but i will push not like for this one
@Shack318
@Shack318 3 ай бұрын
This is showing a scammer how to steal or take over a token scam. Why would youtube let this guy make a video like this, someone took control of my token I found out when I sent money it went to the new address instead of me
@EatTheBlocks
@EatTheBlocks 3 ай бұрын
What you are saying does not make any sense.
@ChamaraAriyarathne
@ChamaraAriyarathne Жыл бұрын
Ok, to be honest, this video is useless, because he doesn't deploy and show what's actually happening.
Solidity Tutorial: Constructor
6:15
EatTheBlocks
Рет қаралды 10 М.
ERC20 Token Tutorial | Create Your Own Cryptocurrency
1:13:56
Block Explorer
Рет қаралды 124 М.
Trágico final :(
01:00
Juan De Dios Pantoja
Рет қаралды 33 МЛН
100❤️
00:19
Nonomen ノノメン
Рет қаралды 37 МЛН
I Need Your Help..
00:33
Stokes Twins
Рет қаралды 106 МЛН
О, сосисочки! (Или корейская уличная еда?)
00:32
Кушать Хочу
Рет қаралды 7 МЛН
How to Use an ERC-20 Token | Solidity (0.6)
9:10
Smart Contract Programmer
Рет қаралды 9 М.
surprising my biggest fan...
KreekCraft
Рет қаралды 10 М.
A Worlds First On This Top Tier Radio - TIDRadio H3
11:52
Tech Minds
Рет қаралды 13 М.
SINNER vs GASQUET • French Open 2024 • LIVE Tennis Play-by-Play Stream
TENNIS TALK with Cam Williams
Рет қаралды 2,1 М.
What is XDR vs EDR vs MDR?  Breaking down Extended Detection and Response
8:54
The CISO Perspective
Рет қаралды 178 М.
Understanding Modbus Serial and TCP/IP
12:07
ProSoft Technology
Рет қаралды 1,3 МЛН
Front Run ERC20 Approval | Hack Solidity 0.8
5:49
Smart Contract Programmer
Рет қаралды 2,6 М.
Blockchain Ecommerce App Tutorial (Accept ERC20 Token Payments)
1:10:28
Trágico final :(
01:00
Juan De Dios Pantoja
Рет қаралды 33 МЛН