Skip to content

Latest commit

 

History

History
205 lines (92 loc) · 7.34 KB

oracle.md

File metadata and controls

205 lines (92 loc) · 7.34 KB

Module 0x3::oracle

Resource TablePlaceholder

struct TablePlaceholder has key

Resource SimpleOracle

struct SimpleOracle has store, key

Resource OracleAdminCap

struct OracleAdminCap has store, key

Struct StoredData

struct StoredData<T: store> has copy, drop, store

Struct NewOracleEvent

struct NewOracleEvent has copy, drop

Constants

const ErrorSenderNotOracle: u64 = 0;

const ErrorTickerNotExists: u64 = 1;

Function get_historical_data

public fun get_historical_data<K: copy, drop, store, V: copy, store>(oracle_obj: &object::Object<oracle::SimpleOracle>, ticker: string::String, archival_key: K): option::Option<oracle_data::Data<V>>

Function get_latest_data

Function create_entry

Create a new shared SimpleOracle object for publishing data.

public entry fun create_entry(name: string::String, url: string::String, description: string::String)

Function create

Create a new SimpleOracle object for publishing data.

Function submit_data

public fun submit_data<T: copy, drop, store>(oracle_obj: &mut object::Object<oracle::SimpleOracle>, ticker: string::String, value: T, identifier: string::String, admin_obj: &mut object::Object<oracle::OracleAdminCap>)

Function submit_data_with_timestamp

Submit data with timestamp. This function is used to submit data with a specific timestamp. The timestamp is the time from the oracle's data source. The timestamp is measured in milliseconds.

public fun submit_data_with_timestamp<T: copy, drop, store>(oracle_obj: &mut object::Object<oracle::SimpleOracle>, ticker: string::String, value: T, identifier: string::String, timestamp: u64, admin_obj: &mut object::Object<oracle::OracleAdminCap>)

Function submit_decimal_data

public entry fun submit_decimal_data(oracle_obj: &mut object::Object<oracle::SimpleOracle>, ticker: string::String, value: u256, decimal: u8, identifier: string::String, timestamp: u64, admin_obj: &mut object::Object<oracle::OracleAdminCap>)

Function archive_data

public fun archive_data<K: copy, drop, store, V: copy, drop, store>(oracle_obj: &mut object::Object<oracle::SimpleOracle>, ticker: string::String, archival_key: K, admin_obj: &mut object::Object<oracle::OracleAdminCap>)