Dapp-a-day 1: ERC20
Dapp-a-day 1: ERC20
Each weekday leading up to devcon2, Nexus will highlight a dapp, library, or package (something with a dappfile
) as a promotion of our toolchain and as case studies for other developers.
Today's dapp, erc20
, contains the ERC20
type definition, a single-contract ERC20Base
implementation, and a factory for the base.
https://github.com/nexusdev/erc20
An instance constructed from the factory is not going to be very useful. The base meant to be extended with extra functionality (issuance, whitelists, etc).
Maybe the most interesting lesson from this package is how the factory must transfer
tokens to the sender in order for createERC20Base
to give the "creator" the initial balance, as if they constructed it directly. We will see this pattern most of the time there is a msg.sender
in a constructor.
For tokens that can be migrated or upgraded in-place, watch out for a post on ds-tokens
, formerly part of the dappsys
package.
Dapp a day is an awesome concept! Looking forward to seeing the followups.
What are some potential use cases for this?
It's a building block like legos. You could use it for just about anything a token is good for. I think the idea is you can use a token to keep track of any symbolic or tangible thing of value.