ERC 721 URI Storage: OpenZeppelin Solidity implementation

Поділитися
Вставка
  • Опубліковано 3 гру 2024

КОМЕНТАРІ • 13

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

    Dude. Just found this channel! Great intructive content!

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

    Nice video dude,Thanks

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

    Hi bob, thank you for this video. I have a question. You pass the tokenURI as an argument to the mint function. This is of course very practical, but only in the case if you, the contract owner, mints all the NFTs beforehand. In case where we would like a non-sequential (ipfs hash based) token-idx sequence to be minted by external addresses, your solution would not really make sense because 1. the onlyOwner modifier would need to be disabled and 2. users/hackers could inject their own tokenURI into the smart contract and thus change the NFT content. I need the users to be able to mint so I think my only solution would be to work with a classic tokenId -> string mapping. Thank you!!

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

      Thank you, was just thinking the same

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

      @@mertsargin3060 although admittedly since the only time the tokenURI data could be altered is at the time of minting so why would anyone spending money on an NFT (initial user or after account is hacked) be incentivised to change the tokenURI? But it could be possible.

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

    hey bob! thank you for such usefull videos, i have a question (might be a stupid one i'm sorry i'm a beginner hahaha).. my question is how can i access some fields on metadata? for example my metadata contains a field called X and i wanna specify in my smart contract that the mint price is equals to 0.01 ether * X, how do i get that X ?

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

    So there is completely no need for this addon using IPFS. More detailed use cases would be beneficial. It's cool that you can change the token URI for single NFT tho it won't be possible with the folder usage. IPNS on the other hand is super slow. But then you could implement setBaseURI inside the contract and just swap the folder for every NFT even with single NFT update :)

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

    Hey Bob, nice video . Earned a subscriber .
    I have a question related to my project.
    I am making an nft contract and it can be minted only when you have X tokens A or X tokens B or some ether written in the contract . I am unable to find implementation regarding X token A . How can I implement that my mint function can run when msg.sender address contains X token A .?

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

      You can check the ether in a balance using address(this).balance or address.balance.
      To count the number of ERC20/ERC721 tokens owned by an address, you first need a reference to the ERC20/ERC721 contract.
      Then you call the ERC20.balanceOf or ERC721.balanceOf methods
      This link may help.
      ethereum.stackexchange.com/questions/21448/how-to-get-a-contracts-balance-in-solidity
      I will also soon have a video about decentralized exchanges in which the DEX contract is counting the number of ERC20 tokens of an ERC20 contract, so that will likely be helpful too.
      Lmk if any additional questions =)

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

    do you have a discord channel?

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

    Pls help. I am a beginner , I made voting dapp , but storing candidate name and other voter details in blockchain is costly . pls advice me on storing data without compromising blockchain principles

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

      Excellent question, Pankaj!
      People are trying to scale with a variety of layer 2 approaches. I would suggest reading more about them at ethereum.org/en/developers/docs/scaling.
      For voting, a common approach used by many DAOs is Snapshot decrypt.co/resources/what-is-snapshot-the-decentralized-voting-system. They use IPFS to avoid storing votes on-chain, which avoids most of the gas fees. Depending on what kind of voting needs you have, it may be easier to use an existing voting platform (such as Snapshot) instead of creating your own voting contract.

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

      @@BlockchainBob Thank you