This contract composes persistent state storage for the issuance percentage and index for each address interacting with the fee pool. These details are stored for the last six fee periods.
As a persistent state contract, FeePoolState is not intended to be easily upgraded, as opposed to the
FeePool itself, which is so intended.
Caution: The Number of Stored Fee Periods
Note that this contract contains storage for up to six fee periods, while the FeePool contract limits it to only three. This is a consequence of the implementation of SIP 4, which reduced the fee window in the main
FeePool contract in order to encourage faster responses to alterations of system incentives. As part of this process, this storage contract was, of course, not upgraded.
See also: Design_Decisions.md.
No Relation To The State Contract
Although this contract is called
FeePoolState, be aware that it does not inherit from the
||The percentage of the total system debt owned by the address associated with this entry at the time of issuance. These are 27-decimal fixed point numbers, closely related to the values in
||The debt ledger index when this user issued or destroyed tokens. That is, the length of the ledger at the time of issuance.|
For more information on these fields and their meaning, see the main
Synthetix contract functions
_removeFromDebtRegister, along with the corresponding struct in
This is the same struct as
SynthetixState.issuanceData, modulo naming, but in the case of SynthetixState, only one entry is kept, corresponding to only the most recent issuance event associated with an address.
This induces a slightly awkward structure where the current and historical issuance information is stored over two separate contracts. In a future version this information could potentially be stored in a unified structure for dividends in efficiency and clarity.
The number of fee periods (6) worth of issuance data to keep. Note the inconsistency with the corresponding constant in
FeePool, which is set to 3.
uint8 constant public
The address of the main
A list of up to 6 issuance data entries for each address, for the most recent changes to their issuance level. The fee periods do not have to be consecutive, but they are ordered from newest to oldest (decreasing debt ledger indexes).
Note that the entry
accountIssuanceLedger[account] only corresponds to the current fee period if
appendAccountIssuanceRecord(account, *, *, *) has been called during the current fee period. That is, if the account has issued or burnt synths this period.
mapping(address => IssuanceData[FEE_PERIOD_LENGTH]) public
constructor(address _owner, FeePool _feepool) public
Changes the fee pool address.
setFeePool(FeePool _feePool) external
The first return value is a 27-decimal fixed point number.
getAccountsDebtEntry(address account, uint index) public view returns (uint debtPercentage, uint debtEntryIndex)
- Transaction reverts if
indexis not less than
From a given account's issuance data, retrieve the most recent entry which closed before the provided index. If there is no such entry,
(0,0) is returned.
applicableIssuanceData(address account, uint closingDebtIndex) external view returns (uint, uint)
Synthetix contract, through
FeePool.appendAccountIssuanceRecord, to record current fee period issuance information for a given account in the issuance ledger. This is used when synths are issued or burnt.
If the latest entry in this account's issuance ledger was from the current fee period, it is overwritten. Otherwise, the existing entries are shifted down one spot, dropping the last one (using a call to
issuanceDataIndexOrder), and a new entry is added at the head of the list.
debtRatio argument is a 27-decimal fixed point number.
appendAccountIssuanceRecord(address account, uint debtRatio, uint debtEntryIndex, uint currentPeriodStartDebtIndex) external
Shifts this account's array of issuance ledger entries down one place, overwriting the last entry. This is only used in
issuanceDataIndexOrder(address account) private
This function was used during the initial six week setup period to initialise the issuance ledger from the previous Synthetix version.
importIssuerData(address accounts, uint ratios, uint periodToInsert, uint feePeriodCloseIndex) external
- The transaction reverts if the length of
- IssuanceDebtRatioEntry(accounts[i], ratios[i], feePeriodCloseIndex) for each
iup to the length of the input arrays.
Reverts the transaction if
msg.sender is not the fee pool address.
IssuanceDebtRatioEntry(address indexed account, uint debtRatio, uint feePeriodCloseIndex)