What a dollar costs, country by country.
Ten countries, read from their own exchanges every 15 minutes and kept on Solana.
Today's readings
Read it from your program
Every reading is an account any Solana program can read. The program derives the premium from the two prices on chain, refuses a reading older than ten minutes, and keeps the last 24 hours, one reading per hour. The Wall Index account holds the average of the member feeds, and the program computes that average itself when anyone sends refresh_index with the feeds, so the index can never disagree with them; if a member goes quiet for a day the index stalls rather than quietly drop it.
- Program
// Anchor: the feed account, then a freshness check
#[account]
pub struct Feed {
pub code: [u8; 3], // "KRW", "ARS", ...
pub authority: Pubkey,
pub publisher: Pubkey,
pub bump: u8,
pub latest: Sample, // { at: i64, premium_ppm: i64 }
pub local_price: u64, // local currency per USDT, 6 decimals
pub official_rate: u64, // local currency per USD, 6 decimals
pub venues: u8,
pub hourly: [Sample; 24],
pub updates: u64,
}
let feed = Feed::try_deserialize(&mut &account.data.borrow()[..])?;
require!(Clock::get()?.unix_timestamp - feed.latest.at < 1_800, MyError::StaleFeed);
let premium_ppm = feed.latest.premium_ppm; // +0.46% is 4_600