- Resource
TablePlaceholder
- Resource
SimpleOracle
- Resource
OracleAdminCap
- Struct
StoredData
- Struct
NewOracleEvent
- Constants
- Function
get_historical_data
- Function
get_latest_data
- Function
create_entry
- Function
create
- Function
submit_data
- Function
submit_data_with_timestamp
- Function
submit_decimal_data
- Function
archive_data
use 0x1::option;
use 0x1::string;
use 0x2::decimal_value;
use 0x2::event;
use 0x2::object;
use 0x2::table;
use 0x2::timestamp;
use 0x2::tx_context;
use 0x3::oracle_data;
struct TablePlaceholder has key
struct SimpleOracle has store, key
struct OracleAdminCap has store, key
struct StoredData<T: store> has copy, drop, store
struct NewOracleEvent has copy, drop
const ErrorSenderNotOracle: u64 = 0;
const ErrorTickerNotExists: u64 = 1;
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>>
public fun get_latest_data<T: copy, store>(oracle_obj: &object::Object<oracle::SimpleOracle>, ticker: string::String): option::Option<oracle_data::Data<T>>
Create a new shared SimpleOracle object for publishing data.
public entry fun create_entry(name: string::String, url: string::String, description: string::String)
Create a new SimpleOracle object for publishing data.
public fun create(name: string::String, url: string::String, description: string::String): (object::Object<oracle::SimpleOracle>, object::Object<oracle::OracleAdminCap>)
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>)
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>)
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>)
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>)