SynthetixEscrow¶
Description¶
Newer source than mainnet
This contract source which generated these docs is newer than the original Havven escrow contract, which is available at: contracts.synthetix.io/SynthetixEscrow
This contract holds the SNX which were escrowed at the time of the original token sale, releasing them according to a defined schedule.
The contract was subject to an eight week setup period during which the vesting schedules were set up.
This contract is augmented by the EscrowChecker
contract, which is able to return vesting schedules as an array rather than one at a time.
Source: contracts/SynthetixEscrow.sol
Variables¶
MAX_VESTING_ENTRIES
¶
This constant limits vesting schedules to be shorter than twenty entries long so that iteration is bounded.
Value: 20
Type: uint256
QUANTITY_INDEX
¶
The vesting quantity is the second entry in vesting schedule entry pairs.
Value: 1
Type: uint256
TIME_INDEX
¶
The vesting timestamp is the first entry in vesting schedule entry pairs.
Value: 0
Type: uint256
synthetix
¶
The address of the main Synthetix
contract.
Type: contract ISynthetix
totalVestedAccountBalance
¶
The quantity of remaining tokens for a given account; it saves the recomputation involved in summing over vestingSchedules
entries.
Type: mapping(address => uint256)
totalVestedBalance
¶
The total remaining vested balance in this contract.
Type: uint256
vestingSchedules
¶
Stores the vesting schedule for each for each account. Each schedule is a list of (vesting timestamp, quantity)
pairs in ascending time order.
Type: mapping(address => uint256[2][])
Constructor¶
constructor
¶
Initialises the Synthetix
contract address, and the inherited Owned
instance.
Details
Signature
constructor(address _owner, contract ISynthetix _synthetix)
Visibility
public
State Mutability
``
Views¶
balanceOf
¶
An alias to totalVestedAccountBalance[account]
for ERC20 integration.
Details
Signature
balanceOf(address account) view returns (uint256)
Visibility
public
State Mutability
view
getNextVestingEntry
¶
Returns the next vesting entry in the same manner as getNextVestingIndex
. Returns [0,0]
if there is no next vesting entry.
Details
Signature
getNextVestingEntry(address account) view returns (uint256[2])
Visibility
public
State Mutability
view
getNextVestingIndex
¶
Returns the index of the next vesting entry that will vest for a given account. Returns one past the end if there are none remaining.
The function iterates until it finds the first nonzero vesting entry timestamp, so the gas cost increases slightly as more entries vest.
Details
Signature
getNextVestingIndex(address account) view returns (uint256)
Visibility
public
State Mutability
view
getNextVestingQuantity
¶
Returns the SNX quantity of the next vesting entry. Returns 0
if there is no such entry.
Details
Signature
getNextVestingQuantity(address account) view returns (uint256)
Visibility
external
State Mutability
view
getNextVestingTime
¶
Returns the timestamp of the next vesting entry. Returns 0
if there is no such entry.
Details
Signature
getNextVestingTime(address account) view returns (uint256)
Visibility
external
State Mutability
view
getVestingQuantity
¶
Returns the quantity of SNX a given schedule entry will yield.
Details
Signature
getVestingQuantity(address account, uint256 index) view returns (uint256)
Visibility
public
State Mutability
view
getVestingScheduleEntry
¶
Returns a particular schedule entry for an account, which is a pair of uints: (vesting timestamp, SNX quantity)
.
This is here because the public function generated for vestingSchedules
awkwardly requires the index into the pair as its third argument.
Details
Signature
getVestingScheduleEntry(address account, uint256 index) view returns (uint256[2])
Visibility
public
State Mutability
view
getVestingTime
¶
Returns the time at which a given schedule entry will vest.
Details
Signature
getVestingTime(address account, uint256 index) view returns (uint256)
Visibility
public
State Mutability
view
numVestingEntries
¶
The number of entries in an account's vesting schedule, including those already claimed.
Details
Signature
numVestingEntries(address account) view returns (uint256)
Visibility
public
State Mutability
view
Restricted Functions¶
addVestingSchedule
¶
During the setup period, allows the contract owner to add an entire vesting schedule to the given account by calling appendVestingEntry
in a loop. If a schedule already exists, the new one is concatenated to the old one.
Caution
Beware that no checking is done that the lengths of the times
and quantities
input arrays are equal. If times
is shorter than quantities
, the extra quantities are ignored; if it is longer, the transaction reverts since past-the-end quantities will be 0 (but don't rely on this).
Details
Signature
addVestingSchedule(address account, uint256[] times, uint256[] quantities)
Visibility
external
State Mutability
``
Modifiers
appendVestingEntry
¶
Allows new entry to be added to the given account's vesting schedule by the owner during the setup period.
Details
Signature
appendVestingEntry(address account, uint256 time, uint256 quantity)
Visibility
public
State Mutability
``
Requires
Modifiers
purgeAccount
¶
In case a vesting schedule was incorrectly set up, this function deletes all vesting information associated with a given account and updates relevant totals. purgeAccount
was only callable by the owner, during the setup period.
Details
Signature
purgeAccount(address account)
Visibility
external
State Mutability
``
Modifiers
setSynthetix
¶
Sets the address of the Synthetix
contract, so that escrowed SNX can be transferred to accounts claiming them.
Details
Signature
setSynthetix(contract ISynthetix _synthetix)
Visibility
external
State Mutability
``
Modifiers
Emits
External Functions¶
vest
¶
Finds all vesting schedule entries that have come due for the caller and transfers the total quantity of tokens to them. Vested entries are overwritten with [0,0]
.
Details
Signature
vest()
Visibility
external
State Mutability
``
Events¶
SynthetixUpdated
¶
Records that the SNX contract address was altered.
Signature: SynthetixUpdated(address newSynthetix)
Vested
¶
Records that an account vested a quantity of tokens.
Signature: Vested(address beneficiary, uint256 time, uint256 value)