1. HYPR tokens can be locked for between 4 weeks ("1 month") and 208 weeks ("4 years")
  2. HYPR tokens that are locked can only be modified in 3 ways:
    1. Extend duration,
    2. Lock more tokens (which can reduce, increase, or leave unchanged duration),
    3. Tokens within the locked set may be "registered" to Hypermap entries.
  3. Modifying a lock duration works by specifying a different lock duration when locking tokens. New duration is then the weighted sum of the durations with the lock amounts (see the tokenomics paper).
  4. Locked HYPR tokens may be "registered" to Hypermap entries. Registered tokens have a registration duration and amount. These registered positions can only be modified in 2 ways:
    1. Extend duration,
    2. Register more tokens.
  5. Locked HYPR may only be registered for between 4 weeks and 208 weeks but must be registered for a duration less than or equal to the lock duration.
  6. Registered tokens can only be unregistered after their registration duration expires OR the lock duration expires. The lock duration may become shorter than the registration duration as illustrated by the following scenario:
    1. Locks tokens for duration D_0,
    2. Registers tokens for duration D_1,
    3. Locks many more tokens for duration D_2 such that the new small lock duration D_3 < D_1.
  7. Locked HYPR tokens give voting power. This is accomplished by minting non-transferable gHYPR (the Hyperware governance token) to the user who locks. Proposals, voting, etc all happen through an OpenZeppelin DAO. However, the calculation of voting power is different than usual, being dependent on both number of tokens locked AND the duration locked. See tokenomics pdf for specifics.
  8. To implement voting power that decays with time, there are two main difficulties.
    1. How to know the total voting power of all users at a given time for purposes of computing quorum, which usually takes the form QUORUM_NUMERATOR / 100 * totalVotingSupply? We cannot simply use the number of gHYPR in existence because that does not reflect the actual voting power that takes into account both tokens locked AND the duration locked.
    2. How to know the voting power of an individual voter who may have locked tokens, voting power delegated to him, or both?
  9. We solve each difficulty in a similar way: by, upon token lock or delegation, pre-computing the voting power of the user and the total voting power for all 52 future months. We keep a record of the total voting power and simply modify it appropriately with each lock call. Similarly, upon delegation, we modify a user's voting power. In this way, when it comes time to vote or compute quorum, we can simply look up a user's voting power or the total voting power at the appropriate time.
  10. We also need to make sure to "slide" the array when time passes. For example if a user locks HYPR for 1 year, we must properly update the voting power if the user, after 3 months, locks more HYPR: the 3 past months must be dropped and the array shifted so that the proper month is now indexed 0.

Original gist on GitHub