IdeaTokenVault
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
: LocksIdeaTokens
for a specified durationaddress ideaToken
: The address of theIdeaToken
to be lockeduint amount
: The amount ofIdeaTokens
to lockuint duration
: The duration in seconds to lock theIdeaTokens
address recipient
: The account to credit the lockedIdeaTokens
withdraw
: WithdrawIdeaTokens
which have exceeded their locking periodaddress ideaToken
: The address of theIdeaToken
to withdrawuint[] 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 theIdeaTokens
getLockedEntries
: Returns an array of all locked entries for an account andIdeaToken
address ideaToken
: TheIdeaToken
for which to return the locked entriesaddress user
: The address of the user for which to return the locked entriesuint maxEntries
: The maximum number of entries to return
Last updated