Oracles
/// Contains information about oracle sample.
struct Sample has store, copy, drop {
// Timestamp when sample created.
filled_at: u64,
// Seconds elapsed from creation to last update.
lifetime_in_secs: u64,
// Cumulative data.
cum_active_id: u256,
cum_vol_accum: u256,
cum_bins_crossed: u256,
}
/// Oracle data itself.
struct Oracle<phantom X, phantom Y, phantom BinStep> has key {
// Current active sample id.
active_sample_id: u64,
// Length of oracle (e.g. amount of samples), counts all samples: even which never filled.
length: u64,
// Active length of oracle (e.g. amount of samples filled at least once).
active_length: u64,
// Samples itself.
samples: table::Table<u64, Sample>,
// Events.
increase_length_event_handler: event::EventHandle<IncreaseLengthEvent>
}
Last updated