oracle_datum

Types

Represents the main oracle datum structure

Constructors

  • OracleDatum { price_data: PriceData }

Represents different types of price data

Constructors

  • SharedData

    Placeholder for shared data across multiple oracles

  • ExtendedData

    Placeholder for extended data with additional information

  • GenericData { price_map: PriceMap }

    Generic data structure for price information

Represents a map of key-value pairs for price-related data

Alias

PriceMap = Pairs<Int, Int>

Type alias for validator hash

Alias

ValidatorHash = Hash<Blake2b_224, Script>

Functions

create_oracle_datum(price: Int, timestamp: Int, expiry: Int) -> OracleDatum

Creates a new OracleDatum with the given price, timestamp, and expiry

@param price - The price to set @param timestamp - The timestamp to set @param expiry - The expiry to set @return A new OracleDatum

get_expiry(price_data: PriceData) -> Int

Retrieves the expiry from the PriceData

@param price_data - The PriceData to extract the expiry from @return The expiry as an Int

get_oracle_price(oracle_datum: OracleDatum) -> Int

Retrieves the price from the OracleDatum

@param oracle_datum - The OracleDatum to extract the price from @return The price as an Int

get_oracle_timestamp(oracle_datum: OracleDatum) -> Int

Retrieves the timestamp from the OracleDatum

@param oracle_datum - The OracleDatum to extract the timestamp from @return The timestamp as an Int

get_price(price_data: PriceData) -> Int

Retrieves the price from the PriceData

@param price_data - The PriceData to extract the price from @return The price as an Int

get_timestamp(price_data: PriceData) -> Int

Retrieves the timestamp from the PriceData

@param price_data - The PriceData to extract the timestamp from @return The timestamp as an Int

is_oracle_valid(oracle_datum: OracleDatum, current_time: Int) -> Bool

Checks if the oracle data is valid (not expired)

@param oracle_datum - The OracleDatum to check @param current_time - The current time to compare against @return True if the oracle is valid, False otherwise

Search Document