Skip to content

PriceSubmitter#

Receives prices from FTSO data providers.

It then forwards the submissions to the appropriate FTSO contract, allowing data providers to perform all required operations in a single transaction per price epoch.

Functions#

cancelGovernanceCall#

Defined in GovernedBase (Docs, Source).

function cancelGovernanceCall(
    bytes4 _selector
) external;

Cancel a timelocked governance call before it has been executed.

Only governance can call this method.

Parameters Type Description
_selector bytes4 The method selector.

constructor#

Defined in PriceSubmitter (Docs, Source).

constructor(
) public;

This constructor should contain no code as this contract is pre-loaded into the genesis block. The super constructors are called for testing convenience.

executeGovernanceCall#

Defined in GovernedBase (Docs, Source).

function executeGovernanceCall(
    bytes4 _selector
) external;

Execute the timelocked governance calls once the timelock period expires.

Only executor can call this method.

Parameters Type Description
_selector bytes4 The method selector (only one timelocked call per method is stored).

getAddressUpdater#

Defined in AddressUpdatable (Docs, Source).

function getAddressUpdater(
) public view returns (
    address _addressUpdater);

Returns the configured address updater.

Returns Type Description
_addressUpdater address The AddresUpdater contract that can update our contract address list, as a response to a governance call.

getCurrentRandom#

Defined in PriceSubmitter (Docs, Source).

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.

It never reverts.

Returns Type Description
[0] uint256 Random number calculated from all data provider's submissions.

getFtsoManager#

Defined in PriceSubmitter (Docs, Source).

function getFtsoManager(
) external view returns (
    contract IFtsoManagerGenesis);

Returns the address of the FtsoManager contract.

getFtsoRegistry#

Defined in PriceSubmitter (Docs, Source).

function getFtsoRegistry(
) external view returns (
    contract IFtsoRegistryGenesis);

Returns the address of the FtsoRegistry contract.

getRandom#

Defined in PriceSubmitter (Docs, Source).

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.

getTrustedAddresses#

Defined in PriceSubmitter (Docs, Source).

function getTrustedAddresses(
) external view returns (
    address[]);

Returns the list of trusted addresses that are always allowed to submit and reveal.

Returns Type Description
[0] address[] address[] Array of trusted voter addresses.

getVoterWhitelister#

Defined in PriceSubmitter (Docs, Source).

function getVoterWhitelister(
) external view returns (
    address);

Returns the address of the VoterWhitelister contract managing the data provider whitelist.

governance#

Defined in GovernedBase (Docs, Source).

function governance(
) public view returns (
    address);

Returns the current effective governance address.

initialise#

Defined in GovernedAtGenesis (Docs, Source).

function initialise(
    address _governance
) public pure;

Disallow initialise to be called.

Parameters Type Description
_governance address The governance address for initial claiming.

revealPrices#

Defined in PriceSubmitter (Docs, Source).

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.

setAddressUpdater#

Defined in PriceSubmitter (Docs, Source).

function setAddressUpdater(
    address _addressUpdater
) external;

Sets the address updater contract. Only governance cal call this method.

Parameters Type Description
_addressUpdater address Address of the AddressUpdater contract.

setTrustedAddresses#

Defined in PriceSubmitter (Docs, Source).

function setTrustedAddresses(
    address[] _trustedAddresses
) external;

Set the trusted addresses that are always allowed to submit and reveal. Trusted addresses are used, for example, in fallback mode. Only FTSO Manager can call this method.

Parameters Type Description
_trustedAddresses address[] Array of FTSO data provider addresses (voters). The previous list of trusted addresses is discarded.

submitHash#

Defined in PriceSubmitter (Docs, Source).

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.

switchToProductionMode#

Defined in GovernedBase (Docs, Source).

function switchToProductionMode(
) external;

Enter the production mode after all the initial governance settings have been set. This enables timelocks and the governance can be obtained afterward by calling governanceSettings.getGovernanceAddress(). Emits GovernedProductionModeEntered.

updateContractAddresses#

Defined in AddressUpdatable (Docs, Source).

function updateContractAddresses(
    bytes32[] _contractNameHashes,
    address[] _contractAddresses
) external;

External method called from AddressUpdater only.

voterWhitelistBitmap#

Defined in PriceSubmitter (Docs, Source).

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.

voterWhitelisted#

Defined in PriceSubmitter (Docs, Source).

function voterWhitelisted(
    address _voter,
    uint256 _ftsoIndex
) external;

Called from the VoterWhitelister contract when a new voter has been whitelisted.

Only the VoterWhitelister contract can call this method.

Parameters Type Description
_voter address Voter address that has been added to the whitelist.
_ftsoIndex uint256 Index of the FTSO to which the voter has registered. Each FTSO has its own whitelist.

votersRemovedFromWhitelist#

Defined in PriceSubmitter (Docs, Source).

function votersRemovedFromWhitelist(
    address[] _removedVoters,
    uint256 _ftsoIndex
) external;

Called from the VoterWhitelister contract when one or more voters have been removed.

Only the VoterWhitelister contract can call this method.

Parameters Type Description
_removedVoters address[]
_ftsoIndex uint256 Index of the FTSO to which the voters were registered. Each FTSO has its own whitelist.

Modifiers#

onlyAddressUpdater#

Defined in AddressUpdatable (Docs, Source).

modifier onlyAddressUpdater()

Only the AdressUpdater contract can call this method. Its address is set at construction time but it can also update itself.

onlyFtsoManager#

Defined in PriceSubmitter (Docs, Source).

modifier onlyFtsoManager()

Only the ftsoManager can call this method.

onlyGovernance#

Defined in GovernedBase (Docs, Source).

modifier onlyGovernance()

onlyImmediateGovernance#

Defined in GovernedBase (Docs, Source).

modifier onlyImmediateGovernance()

onlyWhitelister#

Defined in PriceSubmitter (Docs, Source).

modifier onlyWhitelister()

Only the voterWhitelister can call this method.

Variables#

MINIMAL_RANDOM#

Defined in PriceSubmitter (Docs, Source).

    uint256 MINIMAL_RANDOM

Minimal random value accepted along price submissions. Submitted random values below this threshold will revert.

RANDOM_EPOCH_CYCLIC_BUFFER_SIZE#

Defined in PriceSubmitter (Docs, Source).

    uint256 RANDOM_EPOCH_CYCLIC_BUFFER_SIZE

Number of past random numbers remembered.

governanceSettings#

Defined in GovernedBase (Docs, Source).

    contract IGovernanceSettings governanceSettings

Governance Settings.

productionMode#

Defined in GovernedBase (Docs, Source).

    bool productionMode

When true, governance is enabled and cannot be disabled. See switchToProductionMode.

timelockedCalls#

Defined in GovernedBase (Docs, Source).

    mapping(bytes4 => struct GovernedBase.TimelockedCall) timelockedCalls

List of pending timelocked governance calls.