Used to voluntarily lock IdeaTokens for a specified duration.

This contract uses a doubly linked list to keep track of locked tokens and allow for iteration. For each (IdeaToken, owner) combination a linked list is stored where new entries to the list are inserted at the head:

|-----------| --- next ---> |-----------| | LLEntry | | LLEntry | ---- > |-----------| <--- prev --- |-----------| | | _llHead[IdeaToken][owner]

Each LLEntry has an until field which is the timestamp when the tokens in this entry will be unlocked. A (IdeaToken, owner, until) combination uniquely identifies a LLEntry. Thus the until also often serves as an ID.

Since (IdeaToken, owner, until) is unique, the storage location of each LLEntry is calculated as keccak256(abi.encode(ideaToken, owner, until)).

  • lock: Locks IdeaTokens for a specified duration

    • address ideaToken: The address of the IdeaToken to be locked

    • uint amount: The amount of IdeaTokens to lock

    • uint duration: The duration in seconds to lock the IdeaTokens

    • address recipient: The account to credit the locked IdeaTokens

  • withdraw: Withdraw IdeaTokens which have exceeded their locking period

    • address ideaToken: The address of the IdeaToken to withdraw

    • uint[] untils: An array of timestamps which corresponds to the end of the locking period of the entries to be withdrawn.

    • address recipient: The account which will receive the IdeaTokens

  • getLockedEntries: Returns an array of all locked entries for an account and IdeaToken

    • address ideaToken: The IdeaToken for which to return the locked entries

    • address user: The address of the user for which to return the locked entries

    • uint maxEntries: The maximum number of entries to return

Last updated