mirror of openzeppelin-contracts
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openzeppelin-contracts/docs/modules/ROOT/pages/tokens.adoc

33 lines
3.0 KiB

migrate content to format for new docs site Squashed commit of the following: commit fcf35eb806100de300bd9803ce3150dde1ecc424 Author: Francisco Giordano <frangio.1@gmail.com> Date: Wed Jul 17 17:16:04 2019 -0300 remove all docsite dependency commit eeaee9a9d43d70704f6ab17b5126ddbd52b93a50 Author: Francisco Giordano <frangio.1@gmail.com> Date: Wed Jul 17 17:15:23 2019 -0300 update solidity-docgen commit f021ff951829ea0c155186749819403c6b76e803 Author: Francisco Giordano <frangio.1@gmail.com> Date: Wed Jul 17 17:05:06 2019 -0300 update docsite script for new setup commit ff887699d381cfbbe3acf1f1c0de8e22b58480f3 Merge: c938aa1d 84f85a41 Author: Francisco Giordano <frangio.1@gmail.com> Date: Wed Jul 17 16:46:46 2019 -0300 Merge branch 'master' into antora commit c938aa1d9ed05ac83a34e2cebd8353f8331ad6d6 Author: Francisco Giordano <frangio.1@gmail.com> Date: Tue Jul 16 18:24:29 2019 -0300 make component name shorter commit 5bbd6931e02cbbd8864c82655ad0f390ceead5f3 Author: Francisco Giordano <frangio.1@gmail.com> Date: Wed Jul 10 20:16:17 2019 -0300 add all info to docs templates commit 39682c4515d7cf0f0368ed557f50d2709174208a Author: Francisco Giordano <frangio.1@gmail.com> Date: Wed Jul 10 20:13:49 2019 -0300 fix npm docsite script commit 7ae46bd4a0437abf66150d54d05adf46e3de2cab Author: Francisco Giordano <frangio.1@gmail.com> Date: Wed Jul 10 18:48:05 2019 -0300 convert inline docs to asciidoc commit cfdfd3dee4b4bf582fde22c8cb6e17a603d6e0c8 Author: Francisco Giordano <frangio.1@gmail.com> Date: Wed Jul 10 17:34:52 2019 -0300 add missing contract names in readmes commit 15b6a2f9bfb546cf1d3bf4f104278b118bf1b3f4 Author: Francisco Giordano <frangio.1@gmail.com> Date: Wed Jul 10 17:16:47 2019 -0300 fix script path commit 80d82b909f9460d1450d401f00b3f309da506b29 Author: Francisco Giordano <frangio.1@gmail.com> Date: Wed Jul 10 17:13:53 2019 -0300 update version of solidity-docgen commit a870b6c607b9c2d0012f8a60a4ed1a1c8b7e8ebd Author: Francisco Giordano <frangio.1@gmail.com> Date: Wed Jul 10 17:03:53 2019 -0300 add nav generation of api ref commit 069cff4a25b83752650b54b86d85608c2f547e5e Author: Francisco Giordano <frangio.1@gmail.com> Date: Wed Jul 10 16:32:14 2019 -0300 initial migration to asciidoc and new docgen version commit 55216eed0a6551da913c8d1da4b2a0d0d3faa1a8 Author: Francisco Giordano <frangio.1@gmail.com> Date: Tue Jun 25 20:39:35 2019 -0300 add basic api doc example commit 0cbe50ce2173b6d1d9a698329d91220f58822a53 Author: Francisco Giordano <frangio.1@gmail.com> Date: Tue Jun 25 19:31:31 2019 -0300 add sidebars commit 256fc942845307258ac9dc25aace48117fa10f79 Author: Francisco Giordano <frangio.1@gmail.com> Date: Tue Jun 25 15:22:38 2019 -0300 add page titles commit f4d0effa70e1fc0662729863e8ee72a8821bc458 Author: Francisco Giordano <frangio.1@gmail.com> Date: Tue Jun 25 15:19:41 2019 -0300 add contracts index file commit b73b06359979f7d933df7f2b283c50cb1c31b2a0 Author: Francisco Giordano <frangio.1@gmail.com> Date: Tue Jun 25 15:14:52 2019 -0300 fix header levels commit fb57d9b820f09a1b7c04eed1a205be0e45866cac Author: Francisco Giordano <frangio.1@gmail.com> Date: Tue Jun 25 15:11:47 2019 -0300 switch format to preferred asciidoctor format commit 032181d8804137332c71534753929d080a31a71f Author: Francisco Giordano <frangio.1@gmail.com> Date: Tue Jun 25 15:05:38 2019 -0300 initialize antora component and convert docs to asciidoc
6 years ago
= Tokens
Ah, the "token": blockchain's most powerful and most misunderstood tool.
A token is a _representation of something in the blockchain_. This something can be money, time, services, shares in a company, a virtual pet, anything. By representing things as tokens, we can allow smart contracts to interact with them, exchange them, create or destroy them.
[[but_first_coffee_a_primer_on_token_contracts]]
== But First, [strikethrough]#Coffee# a Primer on Token Contracts
Much of the confusion surrounding tokens comes from two concepts getting mixed up: _token contracts_ and the actual _tokens_.
A _token contract_ is simply an Ethereum smart contract. "Sending tokens" actually means "calling a method on a smart contract that someone wrote and deployed". At the end of the day, a token contract is not much more than a mapping of addresses to balances, plus some methods to add and subtract from those balances.
It is these balances that represent the _tokens_ themselves. Someone "has tokens" when their balance in the token contract is non-zero. That's it! These balances could be considered money, experience points in a game, deeds of ownership, or voting rights, and each of these tokens would be stored in different token contracts.
[[different-kinds-of-tokens]]
== Different Kinds of Tokens
migrate content to format for new docs site Squashed commit of the following: commit fcf35eb806100de300bd9803ce3150dde1ecc424 Author: Francisco Giordano <frangio.1@gmail.com> Date: Wed Jul 17 17:16:04 2019 -0300 remove all docsite dependency commit eeaee9a9d43d70704f6ab17b5126ddbd52b93a50 Author: Francisco Giordano <frangio.1@gmail.com> Date: Wed Jul 17 17:15:23 2019 -0300 update solidity-docgen commit f021ff951829ea0c155186749819403c6b76e803 Author: Francisco Giordano <frangio.1@gmail.com> Date: Wed Jul 17 17:05:06 2019 -0300 update docsite script for new setup commit ff887699d381cfbbe3acf1f1c0de8e22b58480f3 Merge: c938aa1d 84f85a41 Author: Francisco Giordano <frangio.1@gmail.com> Date: Wed Jul 17 16:46:46 2019 -0300 Merge branch 'master' into antora commit c938aa1d9ed05ac83a34e2cebd8353f8331ad6d6 Author: Francisco Giordano <frangio.1@gmail.com> Date: Tue Jul 16 18:24:29 2019 -0300 make component name shorter commit 5bbd6931e02cbbd8864c82655ad0f390ceead5f3 Author: Francisco Giordano <frangio.1@gmail.com> Date: Wed Jul 10 20:16:17 2019 -0300 add all info to docs templates commit 39682c4515d7cf0f0368ed557f50d2709174208a Author: Francisco Giordano <frangio.1@gmail.com> Date: Wed Jul 10 20:13:49 2019 -0300 fix npm docsite script commit 7ae46bd4a0437abf66150d54d05adf46e3de2cab Author: Francisco Giordano <frangio.1@gmail.com> Date: Wed Jul 10 18:48:05 2019 -0300 convert inline docs to asciidoc commit cfdfd3dee4b4bf582fde22c8cb6e17a603d6e0c8 Author: Francisco Giordano <frangio.1@gmail.com> Date: Wed Jul 10 17:34:52 2019 -0300 add missing contract names in readmes commit 15b6a2f9bfb546cf1d3bf4f104278b118bf1b3f4 Author: Francisco Giordano <frangio.1@gmail.com> Date: Wed Jul 10 17:16:47 2019 -0300 fix script path commit 80d82b909f9460d1450d401f00b3f309da506b29 Author: Francisco Giordano <frangio.1@gmail.com> Date: Wed Jul 10 17:13:53 2019 -0300 update version of solidity-docgen commit a870b6c607b9c2d0012f8a60a4ed1a1c8b7e8ebd Author: Francisco Giordano <frangio.1@gmail.com> Date: Wed Jul 10 17:03:53 2019 -0300 add nav generation of api ref commit 069cff4a25b83752650b54b86d85608c2f547e5e Author: Francisco Giordano <frangio.1@gmail.com> Date: Wed Jul 10 16:32:14 2019 -0300 initial migration to asciidoc and new docgen version commit 55216eed0a6551da913c8d1da4b2a0d0d3faa1a8 Author: Francisco Giordano <frangio.1@gmail.com> Date: Tue Jun 25 20:39:35 2019 -0300 add basic api doc example commit 0cbe50ce2173b6d1d9a698329d91220f58822a53 Author: Francisco Giordano <frangio.1@gmail.com> Date: Tue Jun 25 19:31:31 2019 -0300 add sidebars commit 256fc942845307258ac9dc25aace48117fa10f79 Author: Francisco Giordano <frangio.1@gmail.com> Date: Tue Jun 25 15:22:38 2019 -0300 add page titles commit f4d0effa70e1fc0662729863e8ee72a8821bc458 Author: Francisco Giordano <frangio.1@gmail.com> Date: Tue Jun 25 15:19:41 2019 -0300 add contracts index file commit b73b06359979f7d933df7f2b283c50cb1c31b2a0 Author: Francisco Giordano <frangio.1@gmail.com> Date: Tue Jun 25 15:14:52 2019 -0300 fix header levels commit fb57d9b820f09a1b7c04eed1a205be0e45866cac Author: Francisco Giordano <frangio.1@gmail.com> Date: Tue Jun 25 15:11:47 2019 -0300 switch format to preferred asciidoctor format commit 032181d8804137332c71534753929d080a31a71f Author: Francisco Giordano <frangio.1@gmail.com> Date: Tue Jun 25 15:05:38 2019 -0300 initialize antora component and convert docs to asciidoc
6 years ago
Note that there's a big difference between having two voting rights and two deeds of ownership: each vote is equal to all others, but houses usually are not! This is called https://en.wikipedia.org/wiki/Fungibility[fungibility]. _Fungible goods_ are equivalent and interchangeable, like Ether, fiat currencies, and voting rights. _Non-fungible_ goods are unique and distinct, like deeds of ownership, or collectibles.
In a nutshell, when dealing with non-fungibles (like your house) you care about _which ones_ you have, while in fungible assets (like your bank account statement) what matters is _how much_ you have.
== Standards
migrate content to format for new docs site Squashed commit of the following: commit fcf35eb806100de300bd9803ce3150dde1ecc424 Author: Francisco Giordano <frangio.1@gmail.com> Date: Wed Jul 17 17:16:04 2019 -0300 remove all docsite dependency commit eeaee9a9d43d70704f6ab17b5126ddbd52b93a50 Author: Francisco Giordano <frangio.1@gmail.com> Date: Wed Jul 17 17:15:23 2019 -0300 update solidity-docgen commit f021ff951829ea0c155186749819403c6b76e803 Author: Francisco Giordano <frangio.1@gmail.com> Date: Wed Jul 17 17:05:06 2019 -0300 update docsite script for new setup commit ff887699d381cfbbe3acf1f1c0de8e22b58480f3 Merge: c938aa1d 84f85a41 Author: Francisco Giordano <frangio.1@gmail.com> Date: Wed Jul 17 16:46:46 2019 -0300 Merge branch 'master' into antora commit c938aa1d9ed05ac83a34e2cebd8353f8331ad6d6 Author: Francisco Giordano <frangio.1@gmail.com> Date: Tue Jul 16 18:24:29 2019 -0300 make component name shorter commit 5bbd6931e02cbbd8864c82655ad0f390ceead5f3 Author: Francisco Giordano <frangio.1@gmail.com> Date: Wed Jul 10 20:16:17 2019 -0300 add all info to docs templates commit 39682c4515d7cf0f0368ed557f50d2709174208a Author: Francisco Giordano <frangio.1@gmail.com> Date: Wed Jul 10 20:13:49 2019 -0300 fix npm docsite script commit 7ae46bd4a0437abf66150d54d05adf46e3de2cab Author: Francisco Giordano <frangio.1@gmail.com> Date: Wed Jul 10 18:48:05 2019 -0300 convert inline docs to asciidoc commit cfdfd3dee4b4bf582fde22c8cb6e17a603d6e0c8 Author: Francisco Giordano <frangio.1@gmail.com> Date: Wed Jul 10 17:34:52 2019 -0300 add missing contract names in readmes commit 15b6a2f9bfb546cf1d3bf4f104278b118bf1b3f4 Author: Francisco Giordano <frangio.1@gmail.com> Date: Wed Jul 10 17:16:47 2019 -0300 fix script path commit 80d82b909f9460d1450d401f00b3f309da506b29 Author: Francisco Giordano <frangio.1@gmail.com> Date: Wed Jul 10 17:13:53 2019 -0300 update version of solidity-docgen commit a870b6c607b9c2d0012f8a60a4ed1a1c8b7e8ebd Author: Francisco Giordano <frangio.1@gmail.com> Date: Wed Jul 10 17:03:53 2019 -0300 add nav generation of api ref commit 069cff4a25b83752650b54b86d85608c2f547e5e Author: Francisco Giordano <frangio.1@gmail.com> Date: Wed Jul 10 16:32:14 2019 -0300 initial migration to asciidoc and new docgen version commit 55216eed0a6551da913c8d1da4b2a0d0d3faa1a8 Author: Francisco Giordano <frangio.1@gmail.com> Date: Tue Jun 25 20:39:35 2019 -0300 add basic api doc example commit 0cbe50ce2173b6d1d9a698329d91220f58822a53 Author: Francisco Giordano <frangio.1@gmail.com> Date: Tue Jun 25 19:31:31 2019 -0300 add sidebars commit 256fc942845307258ac9dc25aace48117fa10f79 Author: Francisco Giordano <frangio.1@gmail.com> Date: Tue Jun 25 15:22:38 2019 -0300 add page titles commit f4d0effa70e1fc0662729863e8ee72a8821bc458 Author: Francisco Giordano <frangio.1@gmail.com> Date: Tue Jun 25 15:19:41 2019 -0300 add contracts index file commit b73b06359979f7d933df7f2b283c50cb1c31b2a0 Author: Francisco Giordano <frangio.1@gmail.com> Date: Tue Jun 25 15:14:52 2019 -0300 fix header levels commit fb57d9b820f09a1b7c04eed1a205be0e45866cac Author: Francisco Giordano <frangio.1@gmail.com> Date: Tue Jun 25 15:11:47 2019 -0300 switch format to preferred asciidoctor format commit 032181d8804137332c71534753929d080a31a71f Author: Francisco Giordano <frangio.1@gmail.com> Date: Tue Jun 25 15:05:38 2019 -0300 initialize antora component and convert docs to asciidoc
6 years ago
Even though the concept of a token is simple, they have a variety of complexities in the implementation. Because everything in Ethereum is just a smart contract, and there are no rules about what smart contracts have to do, the community has developed a variety of *standards* (called EIPs or ERCs) for documenting how a contract can interoperate with other contracts.
You've probably heard of the ERC20 or ERC721 token standards, and that's why you're here. Head to our specialized guides to learn more about these:
* xref:erc20.adoc[ERC20]: the most widespread token standard for fungible assets, albeit somewhat limited by its simplicity.
* xref:erc721.adoc[ERC721]: the de-facto solution for non-fungible tokens, often used for collectibles and games.
* xref:erc777.adoc[ERC777]: a richer standard for fungible tokens, enabling new use cases and building on past learnings. Backwards compatible with ERC20.
* xref:erc1155.adoc[ERC1155]: a novel standard for multi-tokens, allowing for a single contract to represent multiple fungible and non-fungible tokens, along with batched operations for increased gas efficiency.