Delegatecall | Solidity 0.8

Поділитися
Вставка
  • Опубліковано 18 січ 2025

КОМЕНТАРІ • 44

  • @smartcontractprogrammer
    @smartcontractprogrammer  3 роки тому +8

    Why does state variables need to be defined in the same order? Storage layout.
    ua-cam.com/video/Gg6nt3YW74o/v-deo.html

  • @lorenzoaloi3419
    @lorenzoaloi3419 2 роки тому +6

    Man, your channel is gold . Nothing to add but a honestly felt thank you

  • @waffu
    @waffu 3 роки тому +7

    these tutorials are so so good. not many videos on uncommon/advanced solidity i hope u do more of these!

    • @zes7215
      @zes7215 2 роки тому

      no such thing as benefit or not, write, can write any nmw and anys perfect

  • @dennisdecoene
    @dennisdecoene 3 роки тому +1

    That made it sink in what the possibilities are with delegatecall. Thank you so very much.

  • @ZAHID543
    @ZAHID543 3 роки тому +1

    Thanks for the video I was looking for delegate call thanks again

  • @Perun42
    @Perun42 Рік тому

    Very good videos!
    Thank you!

  • @meka4996
    @meka4996 Рік тому

    This is super! Thank you

  • @sdfsfsfd437
    @sdfsfsfd437 3 роки тому +1

    your videos are great! your explanations are great! thanks a lot!

  • @andreujuanc
    @andreujuanc 3 роки тому +2

    I bet we doing Proxies on the next EP? :D

  • @Bruhne
    @Bruhne Рік тому

    Got it!

  • @markopolo2224
    @markopolo2224 2 роки тому

    thanks for the explanation

  • @borysaltynnyk4308
    @borysaltynnyk4308 3 роки тому

    Thank you

  • @unaiiglesias9901
    @unaiiglesias9901 Рік тому +1

    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

    • @smartcontractprogrammer
      @smartcontractprogrammer  Рік тому +1

      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

  • @MrCoreyTexas
    @MrCoreyTexas 7 місяців тому

    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.

  • @ThePersepolis32
    @ThePersepolis32 2 роки тому

    Great!

  • @nickeast4853
    @nickeast4853 10 місяців тому

    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 ?

    • @smartcontractprogrammer
      @smartcontractprogrammer  9 місяців тому

      yes it's possible. delegatecall can be used to forward all the calldata (whether argument is uint256, fixed size array or dynamic array)

  • @whohizzie
    @whohizzie 3 роки тому

    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?

  • @cryptosurfer2369
    @cryptosurfer2369 3 роки тому

    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

  •  2 роки тому

    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

  • @jessoctavio
    @jessoctavio 2 роки тому

    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
      @smartcontractprogrammer  2 роки тому

      not all smart contracts are proxy, they are indeed immutable

    • @jessoctavio
      @jessoctavio 2 роки тому

      @@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 😁

  • @D3athW1ng
    @D3athW1ng 3 роки тому

    Awesome videos! Wish you would go over the warnings as well though! :)

  • @binhminhnguyen4255
    @binhminhnguyen4255 2 роки тому

    when update run contract below update num it should be num of contract above, in this case it doesn't change why?

  • @collins9225
    @collins9225 3 роки тому

    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
      @smartcontractprogrammer  3 роки тому

      biggest difference
      0.8 has safe math - number overflow / underflow throw errors
      0.6 no safe math

    • @_sky_3123
      @_sky_3123 2 роки тому +2

      @@smartcontractprogrammer We are talking about the fact that 0.8 has safeMath by deafult while 0.6 needed a safe math library? Right?

    • @SmartDevs
      @SmartDevs 2 роки тому

      @@_sky_3123 That would be the safeMath.sol contract from openzeppelin

    • @jackgikandi5875
      @jackgikandi5875 9 місяців тому

      @@_sky_3123 Exactly..

  • @muhammadmubasher3583
    @muhammadmubasher3583 2 роки тому

    Following the same code but this happens: Member "delegateCall" not found or not visible after argument-dependent lookup in address

    • @jackgikandi5875
      @jackgikandi5875 9 місяців тому +1

      Make sure you dont type delegate call in camel case as so "delegateCall". It should be in lowercase as so "delegatecall".

  • @Siik94Skillz
    @Siik94Skillz 2 роки тому

    how did you comment out them 3 lines of code with a shortcut?

    • @smartcontractprogrammer
      @smartcontractprogrammer  2 роки тому +1

      ctrl + /

    • @Siik94Skillz
      @Siik94Skillz 2 роки тому

      @@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 ?

  • @muzingnimzing438
    @muzingnimzing438 2 роки тому

    please help, so when should one use call or delegate call..??????

    • @jackgikandi5875
      @jackgikandi5875 9 місяців тому +1

      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...

  • @darktools186
    @darktools186 2 роки тому

    can i do the same with an interface function ?

    • @smartcontractprogrammer
      @smartcontractprogrammer  2 роки тому +1

      yes, but the address at interface will have to have the code

    • @darktools186
      @darktools186 2 роки тому

      @@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