Fallback | Solidity 0.8
HTML-код
- Опубликовано: 10 сен 2024
- Fallback is a special function that is executed when a non-existing function is called. It's mainly used to enable the contract to receive ETH.
#Solidity #SmartContract #Ethereum #スマートコントラクト
Remix
remix.ethereum...
Code
solidity-by-ex...
Take a course
www.smartcontr...
Follow
/ programmersmart
/ discord
t.me/smartcont...
smartcontractp...
The best profesor for blockchain ever. Thanks a lot for this video.
You have a mania or a gift 🙇🏽 of making complicated and complex things seems so simple, easy to understand, with succinct explanation and examples.
Hi! Just wanted to say that this is the most helpful solidity youtube series so far - thanks for making these!
Great explanation!!! The most efficient 5 minutes I've spent.
The best explaination I could find, thanks a lot!
Got it! I just purchased the physical book Solidity Programming Essentials; and so where ever I am with you, I go into the book to learn more on said subject. I dive into your material very early in the mornings, and I delve into the book later in the days.
Perfect video
great explanation, I learn with your videos! many thanks!
Apparently the fallback function is very useful for the upgradeable contracts pattern as well. Btw, many thanks to this video, is very helpful indeed.
Useful content 🎉
Best example for fallback function and gave clear difference for fallback and receive
best solidity tutorials on youtube! Thanks!
Excellent! Thanks
Man, I'm happy that I notice this channel.
But feel guilty that I didn't know as early as possible!
比特彭您好, 請問您是台灣的彭彭老師(Javascript及Python)嗎? 您來自台灣或大陸? 我來自台灣.
Obviously, a genius is behind all that simplicity
Great tutorial. Thank you.
thank you so much ... i learn more knowledge from your channel
In solidity 0.5 payable video, there is no fallback function inside the contract Wallet but it can receive ETH, so is the deposit function (#18) of the contract Wallet also a kind of fallback function?
hey sir i have a question why can't we send ethers directly when we deploy our smart contract using value section i have tried it and this shows execution runtime error , but i am not sure why it can't recieve the ethers even when we decalred receive aswell as fallback and why we use low level interaction?
Hello there! Thank you very much for putting together this video series, it is indeed super helpful.
I am a beginner in the Solidity world and was wondering if you can share a use case example where one would use both "receive" and "fallback" rather than just "fallback"?! From what I understood, "fallback" is enough the handle any use case where value is being sent to the smart contract..
Cheers!
expresses the intent of your code
receive means this contract can receive ETH but there is no default function to fallback to
I wonder why fallback(), receive(), and constructor() don't have "function" preceding them.
If there is a payable function like last lesson(#37), still need to have a payable fallback function or payable receive function?
if your contract is going to receive ETH directly, then yes
@@smartcontractprogrammerThanks for your teaching. But I still confuse the difference between "receive ETH directly" and "receive ETH indirectly "? Is to receive ETH directly very risky , otherwise why Fallback payable ?
Excellent Video! When you say"receive ETH directly", is the way you make a demo here to use low level code interaction? And the code and demo in solidity 0.5 fallback is also a kind of "receive ETH directly"? Please advise, Thanks!
I cant believe only 6k views, quality is not being valued!
Say that I code a wallet with both fallback() & receive(). If I send native coins to that contract wallet, receive() will listen and emit. But what if I send a token instead? receive() won't get it but will fallback() listen to it? Thanks!
both won't be called when a token is sent
Someone needs to send ether to his payable ...
Thanks for your video. I undesrstand what fallback is, but could you explain this? Why is it necessary to use a fallback with flashloan? "A fallback function is called whenever a smart contract iscalled and the selector doesn’t match any of the existing function selectors. It’s basically a catch all.
Now you can receive generalized flashloans simply by putting all the flashloan logic in the fallback
function. Be warned there are serious security vulnerabilities that will need to be patched to make
this function safe to expose."
it's not required to have fallback for flashloans
@@smartcontractprogrammer yes, but I read one of the manuals from mev searches. So they advise using a fallback when you have several flash loan providers and you simply need to receive funds from them on contract.
cool. didn't know. is it common practice to implement both functions in one contract, or is this more of an academic discussion?
depends on the code
Why the need for the fallback function when we can just create a function that is payable?
fallback is default function and a payable fallback can receive direct transfer of ETH
!
1:38 receive() executed when the data that sent is empty
okey but why there are two methods? fallback does the two jobs already
I agree.