SupplySchedule¶
Description¶
Defines the Synthetix inflationary supply schedule, according to which the synthetix inflationary supply is released.
Minting is performed in increments of a week whenever recordMintEvent
is called from Synthetix.mint
. Minting can be called weekly after the time elapses for more than 7 days. These accrue so that no tokens are lost even if minting is not performed for several periods; the accrued total is minted at the next invocation. These computations are covered in more detail in the mintableSupply
description.
The supply decay follows an exponential decay formula calculated for each week.
supplyForWeek = Initial Weekly Supply * (1 - rate of decay) ^ number of weeks
Source: contracts/SupplySchedule.sol
Architecture¶
Related Contracts¶
Variables¶
CONTRACT_NAME
¶
Type: bytes32
INFLATION_START_DATE
¶
The timestamp at which the inflationary SNX supply began to be minted.
Value: 1551830400 (2019-03-06T00:00:00+00:00)
Type: uint256
MAX_MINTER_REWARD
¶
Type: uint256
MINT_BUFFER
¶
A buffer added to the lastMintEvent to ensure that synthetix rewards are issued after a feePeriod closes.
Value: 1 days
Type: uint256
MINT_PERIOD_DURATION
¶
The duration of each minting period. This is constant at one week.
Value: 1 weeks
Type: uint256
inflationAmount
¶
Type: uint256
lastMintEvent
¶
The timestamp when new supply was last minted - Is set to the number of weeks since inflation start date plus a minting buffer to allow feePeriod to close first.
Type: uint256
maxInflationAmount
¶
Type: uint256
minterReward
¶
Used as the quantity of SNX to reward the caller of Synthetix.mint
, which incentivises users to continue minting the inflationary supply over time. Initialised to 200 SNX.
Type: uint256
synthetixProxy
¶
The address of the main SynthetixProxy
contract.
Type: address payable
weekCounter
¶
Counter to record the number of weeks inflation has been issued and calculate the applicable supply to add based on the current weekCounter.
Type: uint256
Constructor¶
constructor
¶
Sets up the minting schedule and the inherited Owned
instance.
Details
Signature
constructor(address _owner, uint256 _lastMintEvent, uint256 _currentWeek)
Visibility
public
State Mutability
``
Views¶
isMintable
¶
Returns true if minting from the inflationary supply is permitted at the present time.
This means that tokens are only mintable once a week.
Details
Signature
isMintable() view returns (bool)
Visibility
public
State Mutability
view
mintableSupply
¶
Returns the number of tokens currently mintable from the inflationary supply.
If isMintable
returns false, this is 0. Otherwise, it is the number of tokens accruing per week in the current year, multiplied by the number of whole weeks since the last mint event.
Details
Signature
mintableSupply() view returns (uint256)
Visibility
external
State Mutability
view
weeksSinceLastIssuance
¶
This just returns its argument floor divided by MINT_PERIOD_DURATION
. Since this is only used in mintableSupply()
it seems as if a variable would have done better than a public function.
Details
Signature
weeksSinceLastIssuance() view returns (uint256)
Visibility
public
State Mutability
view
Restricted Functions¶
recordMintEvent
¶
This is called within Synthetix.mint
to declare that the outstanding inflationary supply of tokens has been minted before they are actually distributed.
When called, this function adds a quantity of mintableSupply()
tokens to the current schedule.totalSupplyMinted
entry, and updates the lastMintEvent
timestamp.
Although this function has no check that any tokens actually are mintable when it is called, the Synthetix
contract requires it to be the case, so double calls should not occur. Similarly, the function does not itself enforce that the actual token supply has been increased by Synthetix
in a manner consistent with the defined schedule and must simply trust that this compact is observed.
The function always returns true
if the transaction was not reverted.
Details
Signature
recordMintEvent(uint256 supplyMinted) returns (uint256)
Visibility
external
State Mutability
``
Modifiers
Emits
setInflationAmount
¶
Details
Signature
setInflationAmount(uint256 amount)
Visibility
external
State Mutability
``
Requires
Modifiers
Emits
setMaxInflationAmount
¶
Details
Signature
setMaxInflationAmount(uint256 amount)
Visibility
external
State Mutability
``
Modifiers
Emits
setMinterReward
¶
Allows the owner to set the current minter reward.
Details
Signature
setMinterReward(uint256 amount)
Visibility
external
State Mutability
``
Requires
Modifiers
Emits
setSynthetixProxy
¶
Allows the owner to set the synthetix
address.
Details
Signature
setSynthetixProxy(contract ISynthetix _synthetixProxy)
Visibility
external
State Mutability
``
Requires
Modifiers
Emits
Modifiers¶
onlySynthetix
¶
Reverts the transaction if msg.sender
is not the synthetix
address. Synthetix address is found by lookup to the proxy.target().
Events¶
InflationAmountUpdated
¶
Signature: InflationAmountUpdated(uint256 newInflationAmount)
MaxInflationAmountUpdated
¶
Signature: MaxInflationAmountUpdated(uint256 newInflationAmount)
MinterRewardUpdated
¶
Records that the minter reward was updated.
Signature: MinterRewardUpdated(uint256 newRewardAmount)
SupplyMinted
¶
Records that a quantity of new tokens was minted.
Signature: SupplyMinted(uint256 supplyMinted, uint256 numberOfWeeksIssued, uint256 lastMintEvent, uint256 timestamp)
SynthetixProxyUpdated
¶
Signature: SynthetixProxyUpdated(address newAddress)