IPriceSubmitter
#
Interface for the PriceSubmitter
contract.
This is the contract used by all FTSO data providers to submit their data.
Events#
HashSubmitted
#
event HashSubmitted(
address submitter,
uint256 epochId,
bytes32 hash,
uint256 timestamp
)
Emitted when a hash is submitted through submitHash
.
Parameters | Type | Description |
---|---|---|
submitter |
address |
Address of the submitting data provider. |
epochId |
uint256 |
Current price epoch ID. |
hash |
bytes32 |
Submitted hash. |
timestamp |
uint256 |
Current block timestamp. |
PricesRevealed
#
event PricesRevealed(
address voter,
uint256 epochId,
contract IFtsoGenesis[] ftsos,
uint256[] prices,
uint256 random,
uint256 timestamp
)
Emitted when prices are revealed through revealPrice
.
Parameters | Type | Description |
---|---|---|
voter |
address |
Address of the revealing data provider. |
epochId |
uint256 |
ID of the epoch in which the price hash is revealed. |
ftsos |
contract IFtsoGenesis[] |
Array of FTSOs that correspond to the indexes in the call. |
prices |
uint256[] |
List of revealed prices. |
random |
uint256 |
Revealed random number. |
timestamp |
uint256 |
Current block timestamp. |
Functions#
getCurrentRandom
#
function getCurrentRandom(
) external view returns (
uint256);
Returns the random number for the previous epoch, obtained from the random numbers provided by all data providers along with their data submissions. Note that the random number for the previous epoch keeps updating as new submissions are revealed.
Returns | Type | Description |
---|---|---|
[0] | uint256 |
Random number calculated from all data provider's submissions. |
getFtsoManager
#
function getFtsoManager(
) external view returns (
contract IFtsoManagerGenesis);
Returns the address of the FtsoManager
contract.
getFtsoRegistry
#
function getFtsoRegistry(
) external view returns (
contract IFtsoRegistryGenesis);
Returns the address of the FtsoRegistry
contract.
getRandom
#
function getRandom(
uint256 _epochId
) external view returns (
uint256);
Returns the random number used in a specific past epoch, obtained from the random numbers provided by all data providers along with their data submissions.
Parameters | Type | Description |
---|---|---|
_epochId |
uint256 |
ID of the queried epoch. Current epoch cannot be queried, and the previous epoch is constantly updated as data providers reveal their prices and random numbers. Note that only the last 50 epochs can be queried and there is no bounds checking for this parameter. Out-of-bounds queries return undefined values. |
Returns | Type | Description |
---|---|---|
[0] | uint256 |
The random number used in that epoch. |
getVoterWhitelister
#
function getVoterWhitelister(
) external view returns (
address);
Returns the address of the VoterWhitelister
contract managing the data provider whitelist.
revealPrices
#
function revealPrices(
uint256 _epochId,
uint256[] _ftsoIndices,
uint256[] _prices,
uint256 _random
) external;
Reveals submitted prices during the epoch reveal period.
The hash of FTSO indices, prices, random number, and voter address must be equal
to the hash previously submitted with submitHash
.
Emits a PricesRevealed
event.
Parameters | Type | Description |
---|---|---|
_epochId |
uint256 |
ID of the epoch to which the price hashes are submitted. |
_ftsoIndices |
uint256[] |
List of FTSO indices in ascending order. |
_prices |
uint256[] |
List of submitted prices in USD. |
_random |
uint256 |
Submitted random number. |
submitHash
#
function submitHash(
uint256 _epochId,
bytes32 _hash
) external;
Submits a hash for the current epoch. Can only be called by FTSO data providers
whitelisted through the VoterWhitelisted
contract.
Emits the HashSubmitted
event.
Parameters | Type | Description |
---|---|---|
_epochId |
uint256 |
ID of the target epoch to which the hash is submitted. |
_hash |
bytes32 |
A hash of the FTSO indices, prices, random number, and voter address. |
voterWhitelistBitmap
#
function voterWhitelistBitmap(
address _voter
) external view returns (
uint256);
Returns a bitmap of all FTSOs for which a data provider is allowed to submit prices or hashes.
Parameters | Type | Description |
---|---|---|
_voter |
address |
Address of the voter. |
Returns | Type | Description |
---|---|---|
[0] | uint256 |
If a data provider is allowed to vote for a given FTSO index, the corresponding bit in the result is 1. |