1

I am exploring a new domain and wanted to understand the difference between ERC721, ERC20, and a smart contract? ERC721 is "a standard for representing ownership of non-fungible tokens," but what does it mean? Aren't smart contracts also owned by the account that publish them? What makes ERC721 or ERC20 'ownable'?

Thank you

2 Answers 2

0

Smart contracts are not owned by anything, unless the contract itself contains code for it to know that some address has ownership permissions over it that it has defined. ERC721 is an implementation of a contract that can issue multiple non fungible tokens at once. For example most collections use one smart contract to represent all their tokens, with the most popular standards being ERC721 and ERC1155. The tokens issued by the contract have owners, and the information of who owns each token is stored in the contract. The contract itself though, does not necessarily have an owner. It has a deployer, but smart contracts are decentralized entities, and do not necessarily give any special permissions to whoever deployed them.

3
  • Interesting. So if any smart contract that is deployed by a parent contract and inherits the Ownable contract becomes ownable by anyone? May 21, 2022 at 5:54
  • The ownable implementation usually makes the deployer the owner on the deployment. So in that case, the contract that deployed the other contract will become the owner. In other words, a contract can be the owner of another contract
    – Bruce
    May 22, 2022 at 17:12
  • Or also, a contract with no ownable implementation is essentially ownerless and trustless as we would call it
    – Bruce
    May 22, 2022 at 17:15
0

So ERC20 and ERC721 are standars for smart contracts, meaning that smart contracts that are ERC20 or ERC721 complient must have a set of functions implemented inside them. So contracts that implement such functions be ERCxxx compilent. You can find the functions they must have in the following links: ERC20, ERC721

An NFT is a token in a smart contract, that smart contract is usually ERC721 or ERC1155 complient. Being complient to a standard is very helpful because it means that yo will be able to call the same functions on them even if they are not in the same contract.

Now, what makes a contract ownable is usually an inherited abstract contract called ownable. This inheritances provides the functions and logic to "own" a contract. In the OpenZeppellin edition of ownable it provides the next functions: owner(), renounceOwnership(), transferOwnership(address newOwner) and _transferOwnership(address newOwner) which do exactly what thair name says. Being the owner of the contract does not necessarily give you special permissions, but sometimes does, it all depends on what the contract does and how things are implemeted in the code itselfe. A popular thing to do is to only allow the owner run some function and that is done using the modifier onlyOwner which is also inherited from the Ownable contract.

Now the interesting part, how can an NFT contract be owned by x but the NFTs inside be owned by y? ---The representation of ownership of an NFT is given by an address inside an array inside the contract. If your address is written in the first spot of the array then you own the first token of the collection. Owning a token in the collection lets you and only you transfer it to someone else. Not even the owner of the contract can transfer the token on your behalf. For anyone, other than you, to be able to transfer that token you must first approve them using either the approve function that lives inside the contract.

I'll attach links to the contracts, reading them wil also help. ERC721 ERC20

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.