Add expiration, supply cap, mutability to readme

This commit is contained in:
lash 2023-03-08 07:55:52 +00:00
parent 74c0bfe43e
commit 50405b5cf6
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746
2 changed files with 31 additions and 3 deletions

View File

@ -85,6 +85,34 @@ Token parameters are truncated when calculating demurrage and redistribution:
* Demurrage modifier: 64 bits * Demurrage modifier: 64 bits
## Expiration
A token may set to expire at a certain point in time. After the expiry, no more transfers may be executed. From that point on, balances are frozen and demurrage is halted.
Expiration may be set in terms of redistribution periods.
Unless sealed (see below), expiration may be changed at any time to any future redistribution period. However, once expired, expiration may not be changed further.
## Supply
Unless sealed (see below), Supply limit may be set and change at any time. Supply may never be directly set to less than the current supply. However, contract _writers_ may burn tokens in their possession using the `burn()` method, which will effectively reduce the supply.
## Mutability
The following parameters may not be changed after contract is published:
* Demurrage level
* Redistribution period
The contract provides a sealing feature which prohibits further changes to parameters that can initially be edited. These include:
* Adding and removing writers (addresses that may mint tokens)
* Sink addres
* Expiry period
* Supply limit
## Gas usage ## Gas usage

View File

@ -121,7 +121,7 @@ contract DemurrageTokenSingleNocap {
// Implements Sealer // Implements Sealer
uint256 public sealState; uint256 public sealState;
uint8 constant MINTER_STATE = 1; uint8 constant WRITER_STATE = 1;
uint8 constant SINK_STATE = 2; uint8 constant SINK_STATE = 2;
uint8 constant EXPIRY_STATE = 4; uint8 constant EXPIRY_STATE = 4;
uint8 constant CAP_STATE = 8; uint8 constant CAP_STATE = 8;
@ -223,7 +223,7 @@ contract DemurrageTokenSingleNocap {
// Given address will be allowed to call the mintTo() function // Given address will be allowed to call the mintTo() function
function addWriter(address _minter) public returns (bool) { function addWriter(address _minter) public returns (bool) {
require(!isSealed(MINTER_STATE)); require(!isSealed(WRITER_STATE));
require(msg.sender == owner); require(msg.sender == owner);
minter[_minter] = true; minter[_minter] = true;
return true; return true;
@ -231,7 +231,7 @@ contract DemurrageTokenSingleNocap {
// Given address will no longer be allowed to call the mintTo() function // Given address will no longer be allowed to call the mintTo() function
function deleteWriter(address _minter) public returns (bool) { function deleteWriter(address _minter) public returns (bool) {
require(!isSealed(MINTER_STATE)); require(!isSealed(WRITER_STATE));
require(msg.sender == owner || _minter == msg.sender); require(msg.sender == owner || _minter == msg.sender);
minter[_minter] = false; minter[_minter] = false;
return true; return true;