ERC721 | Solidity 0.8

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

КОМЕНТАРІ • 21

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

    0:00 - Intro
    0:49 - State variables
    3:31 - Function supportsInterface
    4:32 - Function balanceOf
    5:18 - Function ownerOf
    5:54 - Function setApprovalForAll
    7:36 - Function approve
    9:08 - Function getApproved
    10:03 - Internal function _isApprovedOrOwner
    11:00 - Function transferFrom
    13:18 - Function safeTransferFrom
    15:57 - Fix compiler errors
    16:29 - Internal function _mint
    18:00 - Internal function _burn
    19:04 - Create custom NFT
    Code
    solidity-by-example.org/app/erc721
    Take a course
    www.smartcontract.engineer/

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

    Wonderful! Thanks

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

    Thanks for the video, you might consider talking about the variations that exist: Fractional NFTs, Dynamic NFTs.

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

    thanks a lot

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

    Also, it looks like this is the first time overloaded functions have been introduced (2 variants of safeTransferFrom)

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

    I believe this is the first time you've used the type() operator?

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

    Also I don't think you have introduced bytes4 or bytesN formally? Solidity is really a huge thing

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

    Hi, there. Can somebody explain to me how does the safeTransferFrom function checks whether or not a contract has implemented a function to safely transfer nfts so that they do not get locked? From what I've so far understood, we just use a function selector to see if it exists, but how does that help?

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

      I am also curious about this. Not sure why the safe check is made after transferring the token. Isn't it better to not transfer if it is not safe?

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

    At 3:24, you say "mapping isApprovedForAll " is a implementation of function isApprovedForAll , so it mean "mappimg" is one kind of "function?

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

      Solidity automatically creates view functions for public state variables

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

      @@smartcontractprogrammer Probably would help to point that out explicitly, until now I've only seen auto generated view functions for simple types like uint or address. It's interesting how it converts a mapping of a mapping into a function with 2 arguments. I think the challenge in teaching is putting yourself in the position of the student who doesn't know what you know yet :) So at first I was thinking, "Oh, I guess it's OK in solidity to have a function and a state variable with the same name. I guess he's going to implement the function later".

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

    Excellent! Thanks so much! Will you have the part-2 course of ERC 721 to handle the baseURI and tokenURI which for integrate with NFT platform like Opensea? I am so confused on the baseURI and URI part and can't display my NFT image file on Opensea by code.

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

      I don't have much knowledge on URI stuff

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

      @@smartcontractprogrammer You will be an expert on that! I believe you!

  • @Abdullah-b8t8m
    @Abdullah-b8t8m 5 місяців тому

    Why there is return in balanceOf() function but not in ownerof() After require.

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

    Thanks for the video, why are you using nested functions? Like _mint inside mint? Does it have any deep reason?

    • @stalinMaciasETH
      @stalinMaciasETH 2 роки тому +4

      I haven;t watched the tutorial yet, but I've seen this pattern in different contracts, my best guess is because the mint() function is public and it allows to be called from anyone, whereas the _mint() function is a private function that can only be called from within the contract itself.... You can think of this pattern as a way to allow you to validate a number of things in the public function before calling the private function.... I'll try to update my answer after I watch the video :)

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

    I was wondering the require statement of the approve function has not _approvals[tokenId] == msg.sender also in them. If someone is approved for a single token, they should also be allowed to approve another address no?