Synthetix¶
Description¶
Source: contracts/Synthetix.sol
Architecture¶
Related Contracts¶
Details
Depot
: The depot trades SNX and therefore knows the Synthetix address.Exchanger
The helper contract that performs the heavy lifting forexchange()
andsettle()
.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 forissueSynths()
,issueMaxSynths()
andburnSynths()
.Proxy
: The Synthetix contract, which isProxyable
, exists behind aCALL
-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
¶
Type: bytes32
Constructor¶
constructor
¶
Details
Signature
constructor(address payable _proxy, contract TokenState _tokenState, address _owner, uint256 _totalSupply, address _resolver)
Visibility
public
State Mutability
``
Views¶
resolverAddressesRequired
¶
Details
Signature
resolverAddressesRequired() view returns (bytes32[] addresses)
Visibility
public
State Mutability
view
Restricted Functions¶
emitAtomicSynthExchange
¶
Details
Signature
emitAtomicSynthExchange(address account, bytes32 fromCurrencyKey, uint256 fromAmount, bytes32 toCurrencyKey, uint256 toAmount, address toAddress)
Visibility
external
State Mutability
``
Modifiers
migrateEscrowBalanceToRewardEscrowV2
¶
Details
Signature
migrateEscrowBalanceToRewardEscrowV2()
Visibility
external
State Mutability
``
Modifiers
Internal Functions¶
rewardEscrow
¶
Details
Signature
rewardEscrow() view returns (contract IRewardEscrow)
Visibility
internal
State Mutability
view
supplySchedule
¶
Details
Signature
supplySchedule() view returns (contract ISupplySchedule)
Visibility
internal
State Mutability
view
External Functions¶
exchangeAtomically
¶
Details
Signature
exchangeAtomically(bytes32 sourceCurrencyKey, uint256 sourceAmount, bytes32 destinationCurrencyKey, bytes32 trackingCode, uint256 minAmount) returns (uint256 amountReceived)
Visibility
external
State Mutability
``
Modifiers
exchangeWithTrackingForInitiator
¶
Details
Signature
exchangeWithTrackingForInitiator(bytes32 sourceCurrencyKey, uint256 sourceAmount, bytes32 destinationCurrencyKey, address rewardAddress, bytes32 trackingCode) returns (uint256 amountReceived)
Visibility
external
State Mutability
``
Modifiers
exchangeWithVirtual
¶
Details
Signature
exchangeWithVirtual(bytes32 sourceCurrencyKey, uint256 sourceAmount, bytes32 destinationCurrencyKey, bytes32 trackingCode) returns (uint256 amountReceived, contract IVirtualSynth vSynth)
Visibility
external
State Mutability
``
Modifiers
mint
¶
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
¶
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¶
AtomicSynthExchange
¶
Signature: AtomicSynthExchange(address account, bytes32 fromCurrencyKey, uint256 fromAmount, bytes32 toCurrencyKey, uint256 toAmount, address toAddress)