Skip to content

Synthetix

Description

Source: contracts/Synthetix.sol

Architecture

Synthetix architture graph

Details
  • Depot: The depot trades SNX and therefore knows the Synthetix address.
  • Exchanger The helper contract that performs the heavy lifting for exchange() and settle().
  • ExchangeRates: The Synthetix contract fetches prices from the exchange rates contract to facilitate synth exchange and to determine the value of various quantities of synths.
  • FeePool: The Synthetix contract remits exchange fees as sUSD to the fee pool, and also uses it to keep track of historical issuance records for each issuer.
  • Issuer The helper contract that performs the heavy lifting for issueSynths(), issueMaxSynths() and burnSynths().
  • Proxy: The Synthetix contract, which is Proxyable, exists behind a CALL-style proxy for upgradeability.
  • RewardEscrow: This is similar to the SynthetixEscrow contract, but it is where the SNX inflationary supply is kept before it is released to Synth issuers.
  • RewardsDistribution: This contract works closely with RewardEscrow to release portions of the inflationary supply to different recipients.
  • SupplySchedule: The supply schedule determines the rate at which SNX are released from the inflationary supply.
  • Synth: Synthetix manages the supply of synths. It keeps track of which ones exist, and they are all issued and burnt from the Synthetix contract. The Synthetix contract is also responsible for exchange between different synth flavours.
  • SynthetixEscrow: The escrow contract keeps track of SNX owed to participants in the initial token sale, and releases them according to specified vesting schedules.
  • SynthetixState: This state contract stores the debt ledger and the current issuance information for synth issuers.

Variables

CONTRACT_NAME

Source

Type: bytes32

Constructor

constructor

Source

Details

Signature

constructor(address payable _proxy, contract TokenState _tokenState, address _owner, uint256 _totalSupply, address _resolver)

Visibility

public

State Mutability

``

Views

resolverAddressesRequired

Source

Details

Signature

resolverAddressesRequired() view returns (bytes32[] addresses)

Visibility

public

State Mutability

view

Restricted Functions

emitAtomicSynthExchange

Source

Details

Signature

emitAtomicSynthExchange(address account, bytes32 fromCurrencyKey, uint256 fromAmount, bytes32 toCurrencyKey, uint256 toAmount, address toAddress)

Visibility

external

State Mutability

``

Modifiers

migrateEscrowBalanceToRewardEscrowV2

Source

Details

Signature

migrateEscrowBalanceToRewardEscrowV2()

Visibility

external

State Mutability

``

Modifiers

Internal Functions

emitAccountLiquidated

Source

Details

Signature

emitAccountLiquidated(address account, uint256 snxRedeemed, uint256 amountLiquidated, address liquidator)

Visibility

internal

State Mutability

``

rewardEscrow

Source

Details

Signature

rewardEscrow() view returns (contract IRewardEscrow)

Visibility

internal

State Mutability

view

rewardEscrowV2

Source

Details

Signature

rewardEscrowV2() view returns (contract IRewardEscrowV2)

Visibility

internal

State Mutability

view

supplySchedule

Source

Details

Signature

supplySchedule() view returns (contract ISupplySchedule)

Visibility

internal

State Mutability

view

External Functions

exchangeAtomically

Source

Details

Signature

exchangeAtomically(bytes32 sourceCurrencyKey, uint256 sourceAmount, bytes32 destinationCurrencyKey, bytes32 trackingCode) returns (uint256 amountReceived)

Visibility

external

State Mutability

``

Modifiers

exchangeWithTrackingForInitiator

Source

Details

Signature

exchangeWithTrackingForInitiator(bytes32 sourceCurrencyKey, uint256 sourceAmount, bytes32 destinationCurrencyKey, address rewardAddress, bytes32 trackingCode) returns (uint256 amountReceived)

Visibility

external

State Mutability

``

Modifiers

exchangeWithVirtual

Source

Details

Signature

exchangeWithVirtual(bytes32 sourceCurrencyKey, uint256 sourceAmount, bytes32 destinationCurrencyKey, bytes32 trackingCode) returns (uint256 amountReceived, contract IVirtualSynth vSynth)

Visibility

external

State Mutability

``

Modifiers

liquidateDelinquentAccount

Source

Details

Signature

liquidateDelinquentAccount(address account, uint256 susdAmount) returns (bool)

Visibility

external

State Mutability

``

Modifiers

mint

Source

This function is responsible for creating the inflationary SNX supply. It is a public function, so any address can ensure new tokens are released on schedule. When a new quantity is minted, the calling address is rewarded with a small incentive of SNX tokens, defined by SupplySchedule.minterReward.

The supply is released according to the schedule defined in SupplySchedule.schedules, being sent to the RewardsDistribution contract for distribution and escrow. The total supply SNX supply is thus increased by the quantity specified by the schedule.

This function always returns true if the transaction did not revert.

Details

Signature

mint() returns (bool)

Visibility

external

State Mutability

``

Requires

Modifiers

settle

Source

Settles any amounts oustanding for previous exchanges into the given synth.

See Exchanger for further details.

Details

Signature

settle(bytes32 currencyKey) returns (uint256 reclaimed, uint256 refunded, uint256 numEntriesSettled)

Visibility

external

State Mutability

``

Modifiers

Events

AccountLiquidated

Source

Signature: AccountLiquidated(address account, uint256 snxRedeemed, uint256 amountLiquidated, address liquidator)

AtomicSynthExchange

Source

Signature: AtomicSynthExchange(address account, bytes32 fromCurrencyKey, uint256 fromAmount, bytes32 toCurrencyKey, uint256 toAmount, address toAddress)