erc20-demurrage-token

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

commit ed9d9b3833156ee471eaae0296c4107a15abd4d4
parent 3cecc77cd137eb2040bb48269aa39646c76f7608
Author: nolash <dev@holbrook.no>
Date:   Wed,  3 Feb 2021 15:22:45 +0100

Add readmE

Diffstat:
AREADME.md | 59+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 59 insertions(+), 0 deletions(-)

diff --git a/README.md b/README.md @@ -0,0 +1,59 @@ +# RedistributedDemurrageToken + +## Ownership + +* Contract creator is owner +* Ownership can be transferred (also to ownership void contract) + + +## Mint + +* Owner can add minters + - A faucet contract would be a minter +* Minters can mint any amount + + +## Demurrage + +* Decay amount (ppm) and period (blocks) is set at deploy time. + - Cannot be changed +* Tax is applied when a **mint** or **transfer** is triggered for first time in new period; + - Supply _stays the same_. + - Updates `demurrageModiifer` which represents an exponential decay step. +* All client-facing values (_balance output_ , _transfer inputs_) are adjusted with `demurrageModifier`. +* Edge case: `approve` call, which may be called on either side of a period. + + +## Redistribution + +* 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; + - Check if have participated in period. + - Balance is increased by `(total supply at end of period * demurrage modifier ) / number of participants` + - Participation field is zeroed out. +* Fractions must be rounded down (TODO) + - Remainder is "dust" and should be sent to a dedicated "sink" address (TODO) + + +## Data structures + +* One word per account: + - bits 000-159: value + - bits 160-255: period + - (we have more room here in case we want to cram something else in) +* One word per redistribution period: + - bits 000-055: period + - bits 056-215: supply + - bits 216-253: participant count + - bits 254: Set if invidiual redistribution amounts are fractions (TODO) + - bits 255: Set if "dust" has been transferred to sink (TODO) + + +## QA + +* Basic python tests in place +* How to determine and generate test vectors, and how to adapt them to scripts. +* Audit sources?