Skip to main content
The Oracle-Priced Purchase example sells a USD-priced item for SOL using the MagicBlock real-time pricing-oracle account format. It is a focused starting point for any protocol instruction whose amount depends on a live market price.

View Repository

Build and test the Anchor example against local oracle fixtures.

Prediction & Trading Architecture

Apply the pricing pattern to positions, collateral, liquidation, and settlement.

What the example demonstrates

  • binding program configuration to an expected oracle feed ID;
  • rejecting prices that are not fully verified or are older than 60 seconds;
  • converting a USD-denominated amount into lamports;
  • enforcing a buyer-provided maximum to protect against price movement.

Oracle Overview

Understand MagicBlock’s low-latency pricing feeds.

Oracle Implementation

Read and validate pricing accounts in your program.