erc20-demurrage-token

ERC20 token with redistributed continual demurrage
Log | Files | Refs | README

commit 8af12b33c02fd15d62fa75b8cf30cd8d98366169
parent 0f816ebdc56d28912991a539df11328e6f1ed708
Author: Will Ruddick <willruddick@gmail.com>
Date:   Sat,  6 Feb 2021 15:50:59 +0000

Merge branch 'timebased' into 'master'

updated to a time-frame reference with minute resolution - rather than blocks

See merge request grassrootseconomics/sarafu-token!6
Diffstat:
MREADME.md | 32++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/README.md b/README.md @@ -3,14 +3,14 @@ ## Use Case * Network / Basic Income Token * 100 Sarafu is distributed to anyone in Kenya after user validation by the owner of a faucet which mints new Sarafu. - * Validated users are those that validate their phone number in Kenya. - * A monthly Sarafu holding tax aka ([demurrage](https://en.wikipedia.org/wiki/Demurrage_(currency))) of 2% is deducted from users - * Each month (after a number of blocks) the total amount tax is distributed evenly out to _active_ users. - * any single transaction by a user is considered _active_ (heartbeat) (possibly add minimum size of heartbeat in constructor (TODO)) + * Validated users are those that validate their phone number in Kenya. + * A Sarafu holding tax aka ([demurrage](https://en.wikipedia.org/wiki/Demurrage_(currency))) of 0.000050105908373373% is charged from users per minute - such that over 1 month to total tax would be 2%. + * After 1 week the total amount tax is distributed evenly out to _active_ users. + * any single transaction by a user within that week is considered _active_ (heartbeat) * This is meant to result in a disincentivization to hold (hodl) the Sarafu token and increase its usage as a medium of exchange rather than a store of value. * This token can be added to liquidity pools with other ERC20 tokens and or Community Inclusion Currencies (CICs) - and thereby act as a central network token and connect various tokens and CICs together. * Example - - With a demurrage of 2% - If there are 10 users all with balances of 1000 Sarafu and only 2 of them trade (assume they trade back and forth with no net balance change). + - With a demurrage of 2% (net per month) and a reward period of 1 month - If there are 10 users all with balances of 1000 Sarafu and only 2 of them trade that month (assume they trade back and forth with no net balance change). - Then the resulting balances after one tax period of those two trading would be 1080 Sarafu while the remaining non-active users would be 980 Sarafu. If this behaviour continued in the next tax period, with the same two users only trading (with no net balance changes), they would have 1158.39999968 Sarafu and those users that are not trading would have their balances further reduced to 960.40 Sarafu. If this continued on ~forever those two active trading users would have the entire token supply and the non-trading users would eventually reach a zero balance. - this example calculation for 3 tax periods can be found here: https://gitlab.com/grassrootseconomics/cic-docs/-/blob/master/demurrage-redist-sarafu.ods @@ -18,8 +18,8 @@ ## Variables * Inputs to Constructor (Set only once during contract deployment can't be changed ) - * `Demurrage` aka Decay amount: A percentage of token supply that will be charged once per - aka `period` and evenly redistributed to _active_ users - * Demurrage Period (blocks)- aka `period`: The number of blocks (equivalent to a time frame) over which a new Holding Fee is applied and redistributed. + * `Demurrage` aka Decay amount: A percentage of token supply that will be charged once per minute and evenly redistributed to _active_ users every Demurrage Period (minutes) + * Demurrage Period (minutes)- aka `period`: The number of minutes over which a user must be _active_ to receive tax-redistibution. * Inflated Balance: The inflated balance of each user is stored for bookkeeping. * Number of Decimals: Resolution on token (TODO) (Default 6) * Minimum Activity Volume: (TODO) the minimum transaction amount to be considered active @@ -41,12 +41,12 @@ ## Demurrage -* Holding Tax (`demurrage`) is applied when a **mint** or **transfer** is triggered for first time/block in a new `period`; (it can also be triggered explicitly) - - Supply _stays the same_. - - Updates `demurrageModifier` which represents the accumulated tax value and is an exponential decay step (of size `demurrage`) for each `period` - - `demurrageModifier = (1-demurrage)^period` - - e.g. a `demurrage` of 2% at a `period` of 1 would be give a `demurrageModifier = (1-0.02)^1 = 0.98`. - - e.g. a `demurrage` of 2% at a `period` of 2 would be give a `demurrageModifier = (1-0.02)^2 = 0.9604`. +* Holding Tax (`demurrage`) is applied when a **mint** or **transfer**; (it can also be triggered explicitly) + - Note that the token supply _stays the same_ but a virtual _balance output_ is created. + - Updates `demurrageModifier` which represents the accumulated tax value and is an exponential decay step (of size `demurrage`) for each minute that has passed. + - `demurrageModifier = (1-demurrage)^(minute_passed)` + - e.g. a `demurrage` of 2% after the 1st minute would be give a `demurrageModifier = (1-0.02)^1 = 0.98`. + - e.g. a `demurrage` after the 2nd minute would be give a `demurrageModifier = (1-0.02)^2 = 0.9604`. * All client-facing values (_balance output_ , _transfer inputs_) are adjusted with `demurrageModifier`. - e.g. `_balance output_ = user_balance - user_balance * demurrageModifier` * Edge case: `approve` call, which may be called on either side of a period. @@ -54,13 +54,13 @@ ## Redistribution -* One redistribution entry is added to storage for each period; +* One redistribution entry is added to storage for each `period`; - When `mint` is triggered, the new totalsupply is stored to the entry - When `transfer` is triggered, and the account did not yet participate in the `period`, the entry's participant count is incremented. * Account must have "participated" in a period to be redistribution beneficiary. -* Redistribution is applied when an account triggers a **transfer** for the first time in a new period; +* Redistribution is applied when an account triggers a **transfer** for the first time in a new `period`; - Check if user has participated in `period`. (_active_ user heartbeat) - - Each _active_ user balance is increased by `(total supply at end of period * demurrageModifier ) / number_of_active_participants` via minting + - Each _active_ user balance in the `period` is increased by `(total supply at end of period * demurrageModifier ) / number_of_active_participants` via minting - Participation field is zeroed out for that user. * Fractions must be rounded down (TODO) - Remainder is "dust" and should be sent to a dedicated "sink" token address (TODO)