This program implements an oracle-based DEX. Unlike a traditional AMM, it does not use an internal formula (like x*y=k) to determine prices. Instead, it relies on a trusted off-chain service (price-keeper-bot) to push AI-generated exchange rates on-chain via the update_oracle_price instruction. Swaps are then executed at this externally-provided oracle price.
LiquidityPool["liquidity_pool", mint_a_pubkey, mint_b_pubkey]mint_a: Pubkey - The mint address of the first token in the pair.mint_b: Pubkey - The mint address of the second token in the pair.oracle_authority: Pubkey - The public key of the trusted bot authorized to call update_oracle_price.oracle_price: u64 - The AI-generated price of token A in terms of token B, with 9 decimals of precision.last_oracle_update: i64 - The Unix timestamp of the last price update to prevent stale prices.vault_a_bump: u8 - The bump seed for this pool's token vault for mint_a.vault_b_bump: u8 - The bump seed for this pool's token vault for mint_b.create_pooloracle_authority.oracle_authority: Pubkeyadd_liquidityamount_a: u64, amount_b: u64update_oracle_priceoracle_authority can call it. It updates the oracle_price on-chain with a new value generated by the AI.new_price: u64swaporacle_price. The transaction fails if liquidity is insufficient or the oracle price is considered stale.amount_in: u64, min_amount_out: u64SlippageExceeded, InsufficientLiquidity, Overflow, InvalidMintInvalidOracleAuthority: The signer of update_oracle_price is not the authorized authority.OraclePriceStale: The price has not been updated within the allowed time window.