Skip to content

Instantly share code, notes, and snippets.

@SeanPlusPlus
Last active April 20, 2022 13:49
Show Gist options
  • Save SeanPlusPlus/1978d30463015f07dcb726cc6b6d593c to your computer and use it in GitHub Desktop.
Save SeanPlusPlus/1978d30463015f07dcb726cc6b6d593c to your computer and use it in GitHub Desktop.
ERC Tokens

ERC Tokens

ERC20

https://docs.openzeppelin.com/contracts/3.x/erc20

• fungible tokens
• integer only
• decimal conversion happens at wallet / exchange
• default decimal precision is 18
• example: Gold

image

————————

ERC721

https://docs.openzeppelin.com/contracts/3.x/erc721

• non-fungible tokens
• each token is unique
• can be traded
• no decimal field, each token is unique and can’t be partitioned
• EIP-721: Non-Fungible Token Standard
• https://eips.ethereum.org/EIPS/eip-721
• standard interface for NFTs
• “In general, all houses are distinct and no two kittens are alike”
• example: weapons in a game

image

————————

ERC1155

https://docs.openzeppelin.com/contracts/3.x/erc1155

• fungibility-agnostic, gas-efficient token contract
• draws from ERC20 and ERC721
• single smart contract to represent multiple tokens at once
• in ERC721 the id of a token has no concept of a balance
• instead of a new contract for ea. token type entire system state in 1 contract
• example: currency + weapons in a game

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment