mirror of
https://github.com/logos-blockchain/lez-programs.git
synced 2026-08-26 14:41:12 +00:00
Add RecordTick — a permissionless instruction that reads the current tick from a CurrentTickAccount and advances a PriceObservations ring buffer. Authorization is implicit: both PDAs are verified against price_source_id, so the tick can only have been written by whoever controls that price source. A sampling guard silently no-ops if less than `window_duration / OBSERVATIONS_CAPACITY`` ms have elapsed, allowing keepers to call blindly on every block. Tick-delta truncation clamps the per-observation delta to `MAX_TICK_DELTA (9 116)` before advancing tick_cumulative, with last_recorded_tick tracking the untruncated position for the next delta. Also switches ObservationEntry.tick_cumulative to use elapsed milliseconds rather than seconds. Closes #116
10 lines
239 B
Rust
10 lines
239 B
Rust
//! The TWAP Oracle Program implementation.
|
|
|
|
pub use twap_oracle_core as core;
|
|
|
|
pub mod create_current_tick_account;
|
|
pub mod create_oracle_price_account;
|
|
pub mod create_price_observations;
|
|
pub mod record_tick;
|
|
pub mod update_current_tick;
|