Thanks!! Very helpfull content! Question: In delegateCall is a way to "execute code on C's state variables" ? e.g. If I want to call transfer() from an ERC20, I can only do it from the wallet? I can't do it from a smartContract(as Proxy)? -> (in order to call several function in one tx). A (wallet) --- delegateCall --> B Proxy ----> ERC20. In this case, ERC20 state variable will not be modified? Thanks for all
This will update state variables of A and ERC20 A -- delegate call --> B -- call --> ERC20 This will only update A's state variables A -- delegate call --> B -- delegate call --> ERC20
It's silly that at 4:00 there's 2 ways to do the same thing. It violates a principle of Python's design, there should most always just be 1 way to do things. If you changed the function signature of setVars, you'd have to change the selector version as well. Suppose you changed the name of the function - there's still something you have to retype in both cases. Suppose you add or remove arguments to setVars() - same issue applies.
Hi smart programmer, thanks for the tutorial ! i wonder if it is possible to pass a dynamic array or a fixed size array as an argument to the implementation contract when using delegate call ?
How would you use that TestDelegateCall selector if the contracts were deployed separately? My guess would be to define an interface that matched that countract and use the selector of the interface?
hi sir do i need to learn the latest solidarity or can i still learn from these old videos. your style fits my learning, only youtuber thats made sense so far, in a way i can undertand
Whats the point of smart contracts being immutable if you can use delegatecall or proxies, wouldn't it be better to allow changes by default but keep an open record of the changes that have been made?
@@smartcontractprogrammer yeah, but my point is that it's weird that they are immutable when there is a workaround for upgradeability. Maybe it will be more obvious to me the more I learn about smart contracts 😁
Hi, I was looking for something on the internet about smart contract and I finally found your channel, congratulations good content! I still have a question regarding versions, what is the difference between programming in version 0.8 and 0.6? are there limitations for owner?
@@smartcontractprogrammer found out yesterday, then I laughed 🤦🏾♂️ btw I have a question, might be much but might as well ask. Reckon I can text you on twitter, got an interview for trail of bits coming up next Monday. Would love to ask some questions if you have time and want to ?
Call is used every time you are executing standard external messages whereby code is run in the context of the external contract or function. The delegatecall is almost identical, except that the code executed at the targeted address is run in the context of the calling contract. In simpler terms, call executes code in the context of the called contract while delegatecall executes code in the context of the calling contract...
@@smartcontractprogrammer I cant use delegateCall to like transfer nfts right ? The msg.sender will be equal to the tx.origin though. I don't understand why it's not working like that
Why does state variables need to be defined in the same order? Storage layout.
ua-cam.com/video/Gg6nt3YW74o/v-deo.html
Man, your channel is gold . Nothing to add but a honestly felt thank you
these tutorials are so so good. not many videos on uncommon/advanced solidity i hope u do more of these!
no such thing as benefit or not, write, can write any nmw and anys perfect
That made it sink in what the possibilities are with delegatecall. Thank you so very much.
Thanks for the video I was looking for delegate call thanks again
Very good videos!
Thank you!
This is super! Thank you
your videos are great! your explanations are great! thanks a lot!
I bet we doing Proxies on the next EP? :D
Got it!
thanks for the explanation
Thank you
Thanks!! Very helpfull content! Question: In delegateCall is a way to "execute code on C's state variables" ? e.g. If I want to call transfer() from an ERC20, I can only do it from the wallet? I can't do it from a smartContract(as Proxy)? -> (in order to call several function in one tx).
A (wallet) --- delegateCall --> B Proxy ----> ERC20.
In this case, ERC20 state variable will not be modified?
Thanks for all
This will update state variables of A and ERC20
A -- delegate call --> B -- call --> ERC20
This will only update A's state variables
A -- delegate call --> B -- delegate call --> ERC20
It's silly that at 4:00 there's 2 ways to do the same thing. It violates a principle of Python's design, there should most always just be 1 way to do things. If you changed the function signature of setVars, you'd have to change the selector version as well. Suppose you changed the name of the function - there's still something you have to retype in both cases. Suppose you add or remove arguments to setVars() - same issue applies.
Great!
Hi smart programmer,
thanks for the tutorial !
i wonder if it is possible to pass a dynamic array or a fixed size array as an argument to the implementation contract when using delegate call ?
yes it's possible. delegatecall can be used to forward all the calldata (whether argument is uint256, fixed size array or dynamic array)
How would you use that TestDelegateCall selector if the contracts were deployed separately? My guess would be to define an interface that matched that countract and use the selector of the interface?
hi sir do i need to learn the latest solidarity or can i still learn from these old videos. your style fits my learning, only youtuber thats made sense so far, in a way i can undertand
I teach better in newer videos
Amazing video as well!!! You're doing a really grate job.
BTW could you explain something about the EVM? Cause I'm getting crazy to find something
smart contract compiles to bytecode
EVM is a machine that executes bytecode
Whats the point of smart contracts being immutable if you can use delegatecall or proxies, wouldn't it be better to allow changes by default but keep an open record of the changes that have been made?
not all smart contracts are proxy, they are indeed immutable
@@smartcontractprogrammer yeah, but my point is that it's weird that they are immutable when there is a workaround for upgradeability. Maybe it will be more obvious to me the more I learn about smart contracts 😁
Awesome videos! Wish you would go over the warnings as well though! :)
when update run contract below update num it should be num of contract above, in this case it doesn't change why?
Hi, I was looking for something on the internet about smart contract and I finally found your channel, congratulations good content! I still have a question regarding versions, what is the difference between programming in version 0.8 and 0.6? are there limitations for owner?
biggest difference
0.8 has safe math - number overflow / underflow throw errors
0.6 no safe math
@@smartcontractprogrammer We are talking about the fact that 0.8 has safeMath by deafult while 0.6 needed a safe math library? Right?
@@_sky_3123 That would be the safeMath.sol contract from openzeppelin
@@_sky_3123 Exactly..
Following the same code but this happens: Member "delegateCall" not found or not visible after argument-dependent lookup in address
Make sure you dont type delegate call in camel case as so "delegateCall". It should be in lowercase as so "delegatecall".
how did you comment out them 3 lines of code with a shortcut?
ctrl + /
@@smartcontractprogrammer found out yesterday, then I laughed 🤦🏾♂️ btw I have a question, might be much but might as well ask. Reckon I can text you on twitter, got an interview for trail of bits coming up next Monday. Would love to ask some questions if you have time and want to ?
please help, so when should one use call or delegate call..??????
Call is used every time you are executing standard external messages whereby code is run in the context of the external contract or function. The delegatecall is almost identical, except that the code executed at the targeted address is run in the context of the calling contract. In simpler terms, call executes code in the context of the called contract while delegatecall executes code in the context of the calling contract...
can i do the same with an interface function ?
yes, but the address at interface will have to have the code
@@smartcontractprogrammer I cant use delegateCall to like transfer nfts right ? The msg.sender will be equal to the tx.origin though. I don't understand why it's not working like that