Skip to content

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

Architecture

Libraries

Inheritance Graph

graph TD SynthetixEscrow[SynthetixEscrow] --> Owned[Owned] SynthetixEscrow[SynthetixEscrow] --> LimitedSetup[LimitedSetup]

Constants

MAX_VESTING_ENTRIES

Source

This constant limits vesting schedules to be shorter than twenty entries long so that iteration is bounded.

Value: 20

Type: uint256

QUANTITY_INDEX

Source

The vesting quantity is the second entry in vesting schedule entry pairs.

Value: 1

Type: uint256

TIME_INDEX

Source

The vesting timestamp is the first entry in vesting schedule entry pairs.

Value: 0

Type: uint256

Variables

synthetix

Source

The address of the main Synthetix contract.

Type: contract ISynthetix

totalVestedAccountBalance

Source

The quantity of remaining tokens for a given account; it saves the recomputation involved in summing over vestingSchedules entries.

Type: mapping(address => uint256)

totalVestedBalance

Source

The total remaining vested balance in this contract.

Type: uint256

vestingSchedules

Source

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

Source

Initialises the Synthetix contract address, and the inherited Owned instance.

Details

Signature

(address _owner, contract ISynthetix _synthetix)

Visibility

public

State Mutability

nonpayable

Views

balanceOf

Source

An alias to totalVestedAccountBalance[account] for ERC20 integration.

Details

Signature

balanceOf(address account) returns (uint256)

Visibility

public

State Mutability

view

getNextVestingEntry

Source

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) returns (uint256[2])

Visibility

public

State Mutability

view

getNextVestingIndex

Source

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) returns (uint256)

Visibility

public

State Mutability

view

getNextVestingQuantity

Source

Returns the SNX quantity of the next vesting entry. Returns 0 if there is no such entry.

Details

Signature

getNextVestingQuantity(address account) returns (uint256)

Visibility

external

State Mutability

view

getNextVestingTime

Source

Returns the timestamp of the next vesting entry. Returns 0 if there is no such entry.

Details

Signature

getNextVestingTime(address account) returns (uint256)

Visibility

external

State Mutability

view

getVestingQuantity

Source

Returns the quantity of SNX a given schedule entry will yield.

Details

Signature

getVestingQuantity(address account, uint256 index) returns (uint256)

Visibility

public

State Mutability

view

getVestingScheduleEntry

Source

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) returns (uint256[2])

Visibility

public

State Mutability

view

getVestingTime

Source

Returns the time at which a given schedule entry will vest.

Details

Signature

getVestingTime(address account, uint256 index) returns (uint256)

Visibility

public

State Mutability

view

numVestingEntries

Source

The number of entries in an account's vesting schedule, including those already claimed.

Details

Signature

numVestingEntries(address account) returns (uint256)

Visibility

public

State Mutability

view

Restricted Functions

addVestingSchedule

Source

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

nonpayable

Modifiers

appendVestingEntry

Source

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

nonpayable

Requires

Modifiers

purgeAccount

Source

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

nonpayable

Modifiers

setSynthetix

Source

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

nonpayable

Modifiers

Emits

External Functions

vest

Source

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

nonpayable

Events

SynthetixUpdated

Source

Records that the SNX contract address was altered.

Signature: SynthetixUpdated(address newSynthetix)

Vested

Source

Records that an account vested a quantity of tokens.

Signature: Vested(address beneficiary, uint256 time, uint256 value)