Interface

// @title IAggregator
contract interface IAggregator =
    record metadata = {
        decimals: int,              // Number of decimal places for precision
        description: option(string),// Oracle description
        version: int                // Oracle version
        }

    record datafeed = {
        round_id: int,              // Round ID
        answer: int,                // Computed answer for this round
        timestamp: int              // Timestamp when this data was recorded
        }

    /**
     * Creates a new oracle query with specified time-to-live values for query and response.
     * @param question The question for the oracle.
     * @param qttl Time-to-live for the query in blocks.
     * @param rttl Time-to-live for the response in blocks.
     * @return The created oracle query.
     */
    stateful entrypoint create_query : (int, string, int, int) => oracle_query(string, string)
    
    /**
     * Retrieves the question of a specified oracle query.
     * @param query The oracle query.
     * @return The question associated with the query.
     */
    entrypoint get_oracle_question: (oracle_query(string, string)) => string
    
    /**
     * Retrieves the answer of a specified oracle query, if available.
     * @param query The oracle query.
     * @return The answer associated with the query, if any.
     */    
    entrypoint get_oracle_answer : (oracle_query(string, string)) => option(string)

    /**
     * Retrieves a stored oracle query by index.
     * @param last_queries_idx The index of the query to retrieve.
     * @return The oracle query at the specified index.
     */
    entrypoint get_query_address : (int) => oracle_query(string, string)

    /**
     * Retrieves aggregator metadata.
     * @return Aggregator metadata.
     */
    entrypoint get_metadata : () => metadata 

    /**
     * Retrieves data for a specific round.
     * @param round_id The ID of the round to retrieve.
     * @return Datafeed associated with the round ID.
     */
    entrypoint get_round_data : (int) => datafeed

    /**
     * Retrieves the latest round of data.
     * @return The most recent datafeed entry.
     */
    entrypoint latest_round_data : () => datafeed

    entrypoint get_request_fees: () => int

Last updated

Was this helpful?