If I import an openzeppelin Interface using @openzeppelin/contracts/token/ERC721/IERC721.sol
, do I still need to declare the functions I wish to use found in the Interface, or the import statement is sufficient to use all the functions defined within the said Interface without having to declare them in my smart contract? Will my smart contract be compliant with the ERC721 standard if I do not declare the functions?
1 Answer
the functions I wish to use.
Depends what you want to use them for.
If you want to interact with a token, the token interface defines the functions you are work with.
If you want to create a token then the implementation must cover each function mentioned in the interface.
Open Zeppelin is well-crafted and modular so you don't have to reinvent everything.
Consider
contract MyToken is ERC20 {
...
Hope it helps.
-
Thank you Rob. Yes, I wish to create my own token. If I understood your comment properly, I would need to list all the functions from the IERC721 found in the openzeppelin interface in my own contract if I want my contract to be compliant with the standards, and if I wish for other contracts to use it (my contract), correct? I just have difficulty understanding why one would be able to use the functions from an ERC721 library without having to declare each function (if the library is imported), while one needs to declare them for an Interface.– JF0001Dec 28, 2020 at 3:05
-
1Does this explain the purpose of the interface? ethereum.stackexchange.com/questions/44963/… Dec 28, 2020 at 7:22
-
1