Vault | Solidity 0.8

Поделиться
HTML-код
  • Опубликовано: 10 сен 2024

Комментарии • 41

  • @smartcontractprogrammer
    @smartcontractprogrammer  2 года назад +1

    Vault math
    ruclips.net/video/k7WNibJOBXE/видео.html
    0:00 - State variables and constructor
    1:20 - Internal functions - mint and burn
    2:32 - deposit
    5:00 - withdraw
    6:34 - Deploy and demo
    Code
    solidity-by-example.org/defi/vault
    Take a course
    www.smartcontract.engineer/

  • @meka4996
    @meka4996 Год назад

    This is GOLD! Thank you

  • @MrCoreyTexas
    @MrCoreyTexas 2 месяца назад

    It's worth considering what happens when your numbers don't divide evenly, in this example you doubled the tokens so it boiled down to a division of 2000/1000 =2/1=2. It's also worth considering what happens when the user puts in some more tokens after they put in the initial 1000, and how that might affect things given integer rounding errors. Also you can try having multiple users put in tokens and see how that goes.

    • @smartcontractprogrammer
      @smartcontractprogrammer  2 месяца назад +1

      usually rounding errors are circumvented by having 18 decimals

    • @kir1llusatuk530
      @kir1llusatuk530 Месяц назад

      @@smartcontractprogrammer I'm actually deal with it in my project .
      Maybe you have some kind of solution?
      Libraries , tricks , etc.

  • @franckyking93
    @franckyking93 2 года назад

    Thank you, exactly what I was waiting for.

  • @yellemonster
    @yellemonster 2 года назад

    Your channel has really grown. Really happy for you :D

    • @pooblock4092
      @pooblock4092 2 года назад +1

      Lmfao, his channel grew do much there are fake scam accounts of his channel

  • @mosipvp
    @mosipvp 2 года назад

    as always awesome

  • @veerabadhraswamygopu7994
    @veerabadhraswamygopu7994 2 года назад +1

    Love from india 😍

  • @defiler90
    @defiler90 2 года назад

    this was awesome

  • @bhok5228
    @bhok5228 2 года назад

    Great video

  • @alexisd5410
    @alexisd5410 2 года назад +1

    Hey can you explain what is the purpose of a vault contract? Im not sure I understand

    • @smartcontractprogrammer
      @smartcontractprogrammer  2 года назад

      collecting tokens and utilized by contract owner
      for example, collect DAI from users, contract owner deposits it into Curve to earn fee and rewards

  • @SuryanshShrivastava-tn4qt
    @SuryanshShrivastava-tn4qt Год назад +1

    Hi , Please cover ERC-4626

  • @cebian6223
    @cebian6223 2 года назад

    hey man just a question, any recommendations how to brush up on my general DeFi knowledge? I am okay with the coding part but some defi knowledge like shares/token amount is a bit alien to me. Thanks!

  • @TheGaneshshow
    @TheGaneshshow 2 года назад

    This contract may be abstract, it may not implement an abstract parent's methods completely or it may not invoke an inherited contract's constructor correctly.
    I'm getting this error while importing IERC20.sol
    what to do?, please explain.

  • @ivanlagade
    @ivanlagade 2 года назад

    I want to give specific amount reward for each depositor lets say 1% per day per users on the smart contract internally? how can i add it on the code as function?

  • @samuelyork
    @samuelyork 2 года назад +1

    what's the advantage of issuing the erc-20 receipt tokens when you could just increment a uint?

    • @franckyking93
      @franckyking93 2 года назад

      I’m also interested in the answer.

    • @lukefoster5990
      @lukefoster5990 2 года назад +3

      Its what you can do with the erc-20 receipt tokens, for example, you can transfer them to a lending contract that lets you borrow against them or lock them as a bond to sell to other users, etc...

    • @franckyking93
      @franckyking93 2 года назад

      @@lukefoster5990 thanks.

    • @saadabbasi2063
      @saadabbasi2063 10 месяцев назад

      It's just like a bond (IOU)
      If the vault is trusted on other ecosystems like uniswap or aave or compound, you can keep your bond/IOU as collateral.

  • @cunanh2112
    @cunanh2112 5 месяцев назад

    @smartcontractprogrammer: I don't understand B in the formula, please explain to me ?

  • @tinghuang-dv2xd
    @tinghuang-dv2xd 4 месяца назад

    I'm developing the vault protocol on Solana. Do you have any good resources you've found that I can refer to?

  • @TheGaneshshow
    @TheGaneshshow 2 года назад +1

    what is shares = _amount means?, How this is possible?. Please explain.

    • @vitock1
      @vitock1 Год назад

      This is also not clear to me, so, will be happy to know for what these shares are used and why it works like that.

  • @tigerinus
    @tigerinus 2 года назад

    Great video.
    I am new to Solidity. Out of curiousity, why do you use transfer() instead of call() which is mentioned by many best practices that call() is the better transaction method to go with?

  • @michaelchan6144
    @michaelchan6144 2 года назад

    Thanks for the fantastic content! Could you suggest some projects for people who know a bit of Solidity and want to delve deeper into the world of DeFi?

  • @tesla3714
    @tesla3714 2 года назад

    Nice, can you make a video for testing with hardhat

  • @mosipvp
    @mosipvp 2 года назад

    is there make sens to return bool for deposit & withdraw?

  • @stealtime
    @stealtime 2 года назад

    why not use the ERC 4626 standard for this?

  • @alexanderkrone5902
    @alexanderkrone5902 2 года назад

    in deposit you should NOT mint before receiving the token from the user.

    • @smartcontractprogrammer
      @smartcontractprogrammer  2 года назад

      Way we derived the equation, we must mint before deposit.
      It's also best practice to update state variables before calling external contracts