Skip to content

SynthetixState

Description

This is a state contract associated with the main Synthetix contract, which is the only address permitted to invoke most of its functionality.

This contract is responsible for recording issuance and debt information for the system and users within it, as well as the global issuance ratio.

Upon system updates, this contract will continue to exist, while the Synthetix logic itself is swapped out.

Disabled: Preferred Currency Transfer Conversion

This contract also contains functionality enabling automatic preferred currency conversion on Synth transfers, but it is currently disabled.

Source: contracts/SynthetixState.sol

Architecture

Libraries

Inheritance Graph

graph TD SynthetixState[SynthetixState] --> State[State] SynthetixState[SynthetixState] --> LimitedSetup[LimitedSetup] State[State] --> Owned[Owned]
  • Issuer as this contract's State.associatedContract

Structs

IssuanceData

Source

Field Type Description
initialDebtOwnership uint256 TBA
debtEntryIndex uint256 TBA

Constants

MAX_ISSUANCE_RATIO

Source

Constraining the value of issuanceRatio to be less than 1.0 ensures that Synthetix does not become a fractional reserve system.

Value: UNIT

Type: uint256

Variables

debtLedger

Source

A list of factors indicating, for each debt-modifying event, what effect it had on the percentage of debt of all other holders. Later debt ledger entries correspond to more recent issuance events.

Type: uint256[]

issuanceData

Source

The most recent issuance data for each address.

Type: mapping(address => struct SynthetixState.IssuanceData)

issuanceRatio

Source

The current global issuance ratio, which is the conversion factor between a value of SNX and the value of synths issued against them. As a result this determines the maximum ratio between the total value of Synths and SNX in the system.

It is also the target ratio for SNX stakers. As per the logic in FeePool.feesClaimable, stakers can only claim any fee rewards if they are within ten percent of the issuance ratio. Therefore altering it will also alter the maximum total supply of Synths, as suppliers of Synths are strongly incentivised to track the issuance ratio closely.

If the issuance ratio is \rho, then the maximum value V_s of a synth s issuable against a value V_c of SNX collateral is just:

V_s = \rho \ V_c

Given that currency is worth its price times its quantity (V_x = \pi_x \ Q_x), we have:

\pi_s \ Q_s = \rho \ \pi_c \ Q_c

This implies that the quantity of synths received upon issuance is the quantity of collateral staked, multiplied by the issuance ratio and the ratio between the collateral and synth prices.

Q_s = \rho \ \frac{\pi_c}{\pi_s} \ Q_c

As a result of this calculation, the number of synths that can be issued increases as the SNX price increases, but decreases as the synth price increases. Since neither market prices nor synth supply can be controlled directly, the remaining parameter, the issuance ratio, is an important way of affecting these quantities.

The Issuance Ratio as a Macro-Economic Lever

Tweaking the issuance ratio is an effective means of altering the total synth supply, and therefore its price.

In cases where Synths are oversupplied, there is downward price pressure and decreased stability. Decreasing the issuance ratio both constrains the total supply of Synths circulating in the system, and transiently increases aggregate demand for Synths as every staker must rebuy a quantity of Synths and burn them.

For precisely these reasons the issuance ratio was altered by SCCP-2 from its initial value of \frac{1}{5} to \frac{2}{15}.

The related case of increasing the issuance ratio is similar.

Type: uint256

totalIssuerCount

Source

The number of people with outstanding synths.

Type: uint256

Constructor

constructor

Source

Initialises the inherited State and LimitedSetup instances.

Details

Signature

(address _owner, address _associatedContract)

Visibility

public

State Mutability

nonpayable

Views

debtLedgerLength

Source

Returns the number of entries currently in debtLedger.

Primarily used in FeePool for fee period computations.

Details

Signature

debtLedgerLength() returns (uint256)

Visibility

external

State Mutability

view

hasIssued

Source

Returns true if a given account has any outstanding issuance debt resulting from Synth minting.

Used in Synthetix._addToDebtRegister to determine whether an minting event requires incrementing the total issuer count.

Details

Signature

hasIssued(address account) returns (bool)

Visibility

external

State Mutability

view

lastDebtLedgerEntry

Source

Returns the most recent debtLedger entry.

Primarily used in the Synthetix for debt computations.

Details

Signature

lastDebtLedgerEntry() returns (uint256)

Visibility

external

State Mutability

view

Restricted Functions

appendDebtLedgerValue

Source

Pushes a new value to the end of the debtLedger.

This is used by Synthetix._addToDebtRegister contract whenever Synths are issued or burnt, which modifies the total outstanding system debt.

Details

Signature

appendDebtLedgerValue(uint256 value)

Visibility

external

State Mutability

nonpayable

Modifiers

clearIssuanceData

Source

Deletes the issuance data associated with a given account.

Details

Signature

clearIssuanceData(address account)

Visibility

external

State Mutability

nonpayable

Modifiers

decrementTotalIssuerCount

Source

Reduces totalIssuerCount by one. This is called within Synthetix._removeFromDebtRegister whenever an issuer burns enough Synths to pay down their entire outstanding debt.

Details

Signature

decrementTotalIssuerCount()

Visibility

external

State Mutability

nonpayable

Modifiers

incrementTotalIssuerCount

Source

Increases totalIssuerCount by one. This is called within Synthetix._addToDebtRegister whenever an account with no outstanding issuance debt mints new Synths.

Details

Signature

incrementTotalIssuerCount()

Visibility

external

State Mutability

nonpayable

Modifiers

setCurrentIssuanceData

Source

Allows the Synthetix contract to update the debt ownership entry for this account and sets their debt entry index to the current length of the debtLedger. The debt ledger itself is not modified.

Details

Signature

setCurrentIssuanceData(address account, uint256 initialDebtOwnership)

Visibility

external

State Mutability

nonpayable

Modifiers

setIssuanceRatio

Source

Allows the owner to set the Synth issuance ratio, but disallows setting it higher than 1.0, which prevents more than one dollar worth of Synths being issued against each dollar of SNX backing them.

Details

Signature

setIssuanceRatio(uint256 _issuanceRatio)

Visibility

external

State Mutability

nonpayable

Requires

Modifiers

Emits

Events

IssuanceRatioUpdated

Source

Records that the issuance ratio was modified.

Signature: IssuanceRatioUpdated(uint256 newRatio)