PriceFeed
This documentation provides an overview of the key functions within the PriceFeed contract, detailing their purposes, access controls, and parameters. It is intended to assist developers and users in understanding and interacting with the contract effectively.
Constructor
Initializes the contract with initial GPRO and Gold prices, initial GPRO and Gold data hashes, and an epoch interval. The deployer is set as the initial admin.
Setter Functions
setData
Purpose: Sets the price data for a new epoch.
Access: Only callable by an admin.
Parameters:
_goldPro: The 90-days moving average price of GPRO for the epoch.
_gold: The 90-days moving average price of gold for the epoch.
_goldDaily: The daily price of gold for the epoch.
_epochGoldProDataSetHash: The hash of the the GPRO data for a specific epoch.
_epochGoldDataSetHash: The hash of the Gold data for a specific epoch.
Requirements: Can only be called once per epoch interval.
updateAdminStatus
Purpose: Updates the admin status of an address.
Access: Only callable by the owner.
Parameters:
_address: The address to update.
_st: The new admin status (true or false).
updateEpochInterval
Purpose: Updates the interval between epochs.
Access: Only callable by the owner.
Parameters:
_epochInterval: The new epoch interval.
Getter Functions
getLatestPrices
Purpose: Retrieves the data of the latest epoch.
Returns: The latest epoch number, GPRO price, gold price, gold daily price, average price hash, and timestamp.
getEpochPrices
Purpose: Retrieves the data for a specific epoch.
Parameters:
_epoch: The epoch number to retrieve data for.
Returns: GPRO price, gold price, gold daily price, average price hash, and timestamp for the specified epoch.
getEpochDataSetHash
Purpose: Retrieves the data sets hashes for a specific epoch.
Parameters:
_epoch: The epoch number to retrieve the hash for.
Returns: The GPRO and Gold data set hashes for the specified epoch.
Last updated