OpenOracleFramework.sol

OOF Init

initialize

1
function initialize(
2
address[] memory signers_,
3
uint256 signerThreshold_,
4
address payable payoutAddress_,
5
uint256 subscriptionPassPrice_,
6
address factoryContract_
7
) external
Copied!
Initializes the OOF contract. This function takes the signer addresses, the signer threshold as well as the address used for payouts and the optional price of a subscription pass (0 for disabled).
After this function is executed, the Open Oracle Framework contract is ready to be used.

Helper Functions

sort

1
function sort(uint[] memory data) private pure returns (uint[] memory)
Copied!
Sorts incoming data, used for calculating median prices.

View Functions

getHistoricalFeed

1
function getHistoricalFeeds(uint256[] memory feedIDs, uint256[] memory timestamps) external view returns (uint256[] memory) {
Copied!
Function to look up historical prices by accepting an array of feedIDs and an array of timestamps.
If a feed is restricted, there will be a check if the address calling this function has the rights to see historic prices for that feed.
Returns the historic price for each feed requested during the timeslot for the time stamp from the storage of the contract.

getFeeds

1
function getFeeds(uint256[] memory feedIDs) external view returns (uint256[] memory, uint256[] memory, uint256[] memory)
Copied!
Function which takes an array of feed IDs as an input. Returns the price, timestamp of the last price update, and the feed decimals as a return value.
Calls getFeed internally.

getFeed

1
function getFeed(uint256 feedID) public view returns (uint256, uint256, uint256)
Copied!
This function returns the last price, timestamp of last update and feed decimals as the return value.
Also if the feed is a paid one, there will be a check if the address calling this function has the rights by having paid for the feed subscription or has an oracle feed pass.

getFeedList

1
function getFeedList(uint256[] memory feedIDs) external view returns(string[] memory, uint256[] memory, uint256[] memory, uint256[] memory, uint256[] memory)
Copied!
Accepts an array of feedIDs as an entry and returns metadata of all the feeds which have been requested.
Will return
    Feed Name
    Feed Decimals
    Feed Timeslots
    Feed Revenue Mode (free or with subscription)
    Feed Cost (if subscription)

Basic Functions

withdrawFunds

1
function withdrawFunds() external
Copied!
Withdraws funds to the payout address if funds have been accumulated by providing oracles services.
If the zero address is the payout address, this function will split the funds evenly accross all signers.

createNewFeeds

1
function createNewFeeds(string[] memory names, string[] memory descriptions, uint256[] memory decimals, uint256[] memory timeslots, uint256[] memory feedCosts, uint256[] memory revenueModes) onlySigner external {
Copied!
This function creates 1..n new feeds according to the input values. The feeds are defined by
    Name
    Description
    Decimals
    Timeslots
    Costs
    Revenue Mode

submitFeed

1
function submitFeed(uint256[] memory feedIDs, uint256[] memory values) onlySigner external
Copied!
This function is called by each singer. The signer can submit a set of feeds containing feedIDs and values.
The contract will check at which timeslot round of the corresponding feed the value is submitted and will place the value in the feed mapping of the feed.
If the signer threshold is met for a feed at during the timeslot the last price value and the last time updated value of the feed will be updated. The last price is the median price of all submitted prices of all signers in the timeslot.
Also the previous last price will be written into the historical values mapping for integrations.

signProposal

1
function signProposal(uint256 proposalId) onlySigner external
Copied!
Signs a specific proposal. If the threshold is met the proposal will be executed.

createProposal

1
function createProposal(uint256 uintValue, address addressValue, uint256 proposalType, uint256 feedId) onlySigner external {
Copied!
This function creates a new proposal. Proposals can be used to update the core contract values such as the signers, signer threshold or feed cost values.
Can only be executed and signed by a signer.
0 values can be used for types where the info is not needed for the proposal types, you can supply 0 uintValue if the proposals for a new signer address / you can supply the 0 address for updateFeedCost.
Proposal Types
    0 updatePricePass(uintValue)
    1 updateThreshold(uintValue)
    2 addSigners(addressValue)
    3 removeSigner(addressValue)
    4 updatePayoutAddress(addressValue)
    5 updateRevenueMode(feedId, uintValue)
    6 updateFeedCost(feedId, uintValue)

updateFunctions

1
function updatePricePass(uint256 newPricePass) private
Copied!
1
function updateThreshold(uint256 newThresholdValue) private
Copied!
1
function addSigners(address newSignerValue) private
Copied!
1
function removeSigner(address toRemove) internal
Copied!
1
function updatePayoutAddress(address newPayoutAddressValue) private
Copied!
1
function updateRevenueMode(uint256 newRevenueModeValue, uint256 feedId) private
Copied!
1
function updateFeedCost(uint256 feedCost, uint256 feedId) private
Copied!
Functions used to update contract values if a proposal is successful and executed.

subscribeToFeed

1
function subscribeToFeed(uint256[] memory feedIDs, uint256[] memory durations, address buyer) payable external
Copied!
Payable function which subscribes an address to the feeds provided in the arguments. Takes time in secs, as well as allows for aaddress gifting, useful for smart contracts having permission without needing to pay themselves.
A 2% fee is being sent to the Conjure Router Contract and distributed to CNJ holders.

buyPass

1
function buyPass(address buyer, uint256 duration) payable external
Copied!
This function allows an address to buy a pass for full access. With the pass all feeds can be accessed without having to buy subscriptions for each individual feed.
A 1% fee is being sent to the Conjure Router Contract and distributed to CNJ holders.

supportFeeds

1
function supportFeeds(uint256[] memory feedIds, uint256[] memory values) payable external
Copied!
This function can be used to support Feeds on a voluntary basis.
A 2% fee is being sent to the Conjure Router Contract and distributed to CNJ holders.
Last modified 3mo ago