-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Simple Summary
A standard to keep track of the time when an amount was received by a token holder.
Motivation
The time when an amount was received by a token holder will be used to calculate the redemption fees based on the duration held by the account.
Specification
Store account, timestamp and amount.
Methods
-
public
ownerships(account, timestamp) -
public
describeOwnership(account, amount) -
private
burnOldest(account, amount)
Burns oldest ownership to latest.
- private
burnLatest(account, amount)
Burns from latest ownership to oldest.
- private
captureOwnernship(account, amount)
Usage
- When an account receives token amounts, they get recorded as follows:
t1 -> 100 (issued)
t2 -> 100 (issued)
t3 -> 200 (received)
- When an account transfers tokens out or issuer burns (not redeeming), we deduct the amounts from the latest timestamp to the oldest
At t4, 100 is transferred out.
t1 -> 100 (issued)
t2 -> 100 (issued)
t3 -> 200 (received) - 100 (t4 transferred out) = 100 (new t3 value)
If the transferred tokens are greater than the amount at a time, we loop to the previous timestamp.
At t4, 300 is transferred.
t1 -> 100 (issued)
t2 -> 100 (issued) - 100 (t4 transferred out) = 0 (new t2 value)
t3 -> 200 (received) - 200 (t4 transferred out) = 0 (new t3 value)
- When redeeming/burning tokens we subtract from the oldest to the latest timestamp. This will result in a better fee in case it's a lower fee when redeeming tokens that were held for a longer time.
t4 redeeming 300 tokens.
t1 -> 100 (issued) - 100 (t4 redeem) = 0 (new t1 value)
t2 -> 100 (issued) - 100 (t4 redeem) = 0 (new t2 value)
t3 -> 200 (received) - 100 (t4 redeem) = 100 (new t3 value)
the new table will be:
t3 -> 100
any new activity will add:
t3 -> 100
t4 -> 500 (issued)
t5 -> 400 (received)