Time Lock | Solidity 0.8

Поділитися
Вставка

КОМЕНТАРІ • 45

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

    1:31 - queue
    9:37 - execute
    17:53 - cancel
    19:19 - demo

  • @orleee
    @orleee 2 роки тому +5

    Thank you for continuing to deliver great tutorials

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

    Best solidity videos in UA-cam .......thanks man...

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

    best channel on youtube

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

    high quality content

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

    Thanks for your great tutorials!
    I have a question.
    Why use `revert` and `if` at error case, instead of require? Does have any gas efficient? or other benefits?

    • @illegalskillsexception9826
      @illegalskillsexception9826 2 роки тому +8

      As far as I know, require is more gas efficient than writing if + revert. However writing custom Errors is more gas efficient than the require statement. The most efficient solution would be to have a require statement with custom error, but this is not yet supported in solidity (hopefully in future). In this case it shouldnt matter much i guess because using custom errors are pretty convenient.

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

      @@illegalskillsexception9826 great! thanks

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

    Awesome video, thank you!

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

    This is amazing! Thanks!

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

    On line 103, why do you have to cast a string into bytes to check the length? From all of my previous experience I'd think a string datatype would support a length operator. If not, solidity has pretty weird exceptions.

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

    please help , this code is not running in remix ide

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

    I am confused this for 24 hours. For example, if I decide to donate 1 ETH to you today(6/19), and I set the _timestamp= 1 day, so what does that mean? then, you set min=3 days and max=10days, so what does that mean? then you set the grace_period = 30 days, so what does that mean? we already have current+min and cruuent+max, why still need grace_period? in the other word, if we have grace_period, then we don't need current+min and current+max? also, is the _timestamp really necessary?

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

      Grace period is just a period that is given to you before the transaction expires

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

      @@mustaphaidris1584 Thanks for your reply! I still don't get the answer. It would very much appreciated if you can use my donate case to explain those the relationship of block.timestamp, min delay, max delay and grace period!

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

      MIN and MAX dictate the range of time you can *set* for the transaction to be executable. Grace period is the amount of time you have after the time that was set to execute the transaction

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

      @@phlipside Thanks a lot! It’s really helpful!

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

    Amazing content, and I always refer to your work.
    Is it possible for others to view that a timelocked transaction was queued up? I know that DAOs and other web3 projects use Timelocks for certain admin controls, and this is something that others can view and withdraw from the protocol if it's malicious, for example? Is that a different Timelock implementation (OpenZeppelin, I think)?

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

    Thnx for this very helpful tutorial. Why do we need to check whether _func parameter is empty string or not, anyways its going to call receive if we just send the _data with call?

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

    9:33 how you quickly re-align the code in Remix?

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

    Isn't this what is used for vesting of tokens???

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

      No. I can make a video about vesting

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

      @@smartcontractprogrammer Was there ever a time that you weren't good at this...so good it seems you were born with it...thanks for being available ... Honestly wouldn't mind the vesting video...

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

    Could you continue this implementation focusing in atomic swaps? I wonder how can we use it to be able to transfer ERC20 tokens between EVM-based blockchains. Thank you very much about such rich content!

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

    And there is no way to keep repeating on certain interval right ? for that we may have to use Chainlink Keepers ?

  • @РомаПетров-ж1н
    @РомаПетров-ж1н 2 роки тому

    Do we get something for offchaining txs storing only its hash aside storage gas fees economy? And does it make significant difference? Am I right that we can get "cashback" when deleting executed txs from contract storage?

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

      yes you can save gas by simply storing the hash inside the contract
      yes htere is a refund for deleting data

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

    Hey, why passing all the params twice in queue and execute, instead of string the tx with a running tx_id, and just using it in execute(tx_id)?

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

    Is there any reason you use "revert" with custom defined errors, rather then "require"?

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

      Just to mix things up. Also can't use require with custom errors.

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

      I guess with custom errors you can pass in arguments appropriate to the situation, whereas when you use require, generally it outputs a fixed string. I've tried to do string manipulation in Solidiy, and let me tell you, it is really hairy & ugly. I haven't tested, but I'm guessing it would use less gas to use custom errors vs. trying some kind of string manipulation with require().

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

    Where can I find the full code?

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

    DOES THIS DELAY ALL BUYS AND SELLS?

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

    thanks!!!!!!

  • @22-Zar
    @22-Zar 2 роки тому

    Is it possible to time lock a flash loan?

    • @daniel.contreras
      @daniel.contreras 2 роки тому +1

      No, flashloans need to be repaid in the same transaction, so no delays are allowed. When doing time locks, you are operating with two or more different transactions.

    • @gosuto-inzasheru
      @gosuto-inzasheru 2 роки тому +1

      @@daniel.contreras you could still queue a flashloan into a timelock, and have it execute (and pay back) in the same future block. Not sure if that is what the question is about though.