Dapp-a-day 1: ERC20

Words
145
Reading
1 min
Listen
Play
10y

Dapp-a-day 1: ERC20

Nexus Logo
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 1: ERC20 | Ecency