create account

Dapp-a-day 1: ERC20 by nikolai

View this thread on: hive.blogpeakd.comecency.com
· @nikolai · (edited)
$32.66
Dapp-a-day 1: ERC20
Dapp-a-day 1: ERC20
===
![Nexus Logo](https://avatars3.githubusercontent.com/u/16971904?v=3&s=200)
*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.
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
properties (23)
authornikolai
permlinkdapp-a-day-1-erc20
categoryethereum
json_metadata{"tags":["ethereum","dapp"],"links":["https://avatars3.githubusercontent.com/u/16971904?v=3&s=200"]}
created2016-08-08 18:42:30
last_update2016-08-08 18:43:42
depth0
children2
last_payout2016-09-08 14:20:15
cashout_time1969-12-31 23:59:59
total_payout_value29.688 HBD
curator_payout_value2.974 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length1,054
author_reputation9,571,877,600,096
root_title"Dapp-a-day 1: ERC20"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id687,680
net_rshares20,350,761,757,360
author_curate_reward""
vote details (36)
@ntomaino ·
Dapp a day is an awesome concept! Looking forward to seeing the followups. 

What are some potential use cases for this?
properties (22)
authorntomaino
permlinkre-nikolai-dapp-a-day-1-erc20-20160808t204333554z
categoryethereum
json_metadata{"tags":["ethereum"]}
created2016-08-08 20:43:33
last_update2016-08-08 20:43:33
depth1
children1
last_payout2016-09-08 14:20:15
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length120
author_reputation19,085,142,785,364
root_title"Dapp-a-day 1: ERC20"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id690,040
net_rshares0
@kennyrowe ·
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.
properties (22)
authorkennyrowe
permlinkre-ntomaino-re-nikolai-dapp-a-day-1-erc20-20160808t212926316z
categoryethereum
json_metadata{"tags":["ethereum"]}
created2016-08-08 21:29:27
last_update2016-08-08 21:29:27
depth2
children0
last_payout2016-09-08 14:20:15
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length194
author_reputation26,813,467,404,174
root_title"Dapp-a-day 1: ERC20"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id690,866
net_rshares0