TESTNET
Markets
Trade
Lending Vaults
More
User Docs Developer Docs Sdk API Docs Help
Welcome to Polyester
Concepts
Overview
Creating an Account
Authentication Methods
Turnkey
Smart Wallets
Dashboard
Account Security
MFA
Asset Lifecycle
Supported Assets
Deposit Funds
Withdraw Funds
Transfer Funds
Inventory and Supply
Overview
Trading Fees
Base vs Quote
Lending Fees
Withdrawal Fees
Liquidation Fees
Rebates
Overview
On-chain Visibility
Overview
Supplying
Borrowing
Collateral
Interest
Liquidations
Overview
Trades
Candles
Order Book
Data Delivery
Notifications
Appearance
Localization
Sound Effects
Overview
Architecture
Benchmarks
Matching Engine
Settlement
Safeguards
Overview
Validators
Gas Abstraction
Layer-1 Benchmarks
Audits
Read Pre-compiles
Create Invite Code
Managing Links/Codes
Claiming Rewards
Auto-Convert Rewards
Overview
Create/Delete subaccounts
Permissions
Roles
Audit Logs
Unified Trading Account
Spot Trading
Order Types
Tools
Privacy
Custom Layouts
Overview
Asset Wrapping
Vaults
Zipper Security
What Is TEE?
  1. Polyester Chain
  2. /
  3. Read Pre-compiles

Read Pre-compiles

Read precompiles provide on-chain, deterministic access to Polyester-derived market state.

They allow smart contracts running on Polyester Chain to synchronously query protocol-defined views of trading data produced by PolyEngine, without relying on external oracles or off-chain publishers.

Read precompiles are a developer-facing interface.


What Read Precompiles Are

A read precompile is a protocol-level function exposed by Polyester Chain that returns a specific, deterministic piece of market state.

These functions are read-only and derive their values from PolyEngine’s execution state.

Read precompiles do not stream data, push updates, or maintain independent state. They expose authoritative snapshots of market conditions that smart contracts can safely rely on.


Why Read Precompiles Exist

Polyester produces rich real-time market data streams for trading, analytics, and user interfaces. These streams are fast, expressive, and ideal for off-chain consumers.

However, smart contracts cannot safely consume off-chain streams.

Smart contracts require:

  • Synchronous reads
  • Deterministic results
  • Consensus-level agreement
  • Enforceable correctness

Read precompiles exist to bridge this gap. They make selected aspects of PolyEngine’s execution state available inside the execution environment of the chain, without introducing new trust assumptions.


What Can Be Read

Read precompiles expose protocol-defined, deterministic views of trading state derived from PolyEngine’s execution history.

Examples include:

  • Market reference price The current protocol-defined reference price for a market (e.g. BTC/USDT).
  • Last executed trade price The most recent finalized execution price for a market.
  • Time-weighted average price (TWAP) A protocol-defined average price over a fixed time window.
  • Market status flags Indicators such as whether a market is active, halted, or operating under restricted conditions.

These values correspond directly to state already tracked by PolyEngine and return a single, deterministic result during contract execution.

Read precompiles do not expose raw order books, individual orders, account balances, or real-time order-level activity.

For a complete list of available read functions and integration details, see the developer documentation.


Determinism and Trust Boundaries

A critical property of read precompiles is that they do not introduce new trusted actors.

Unlike oracle-style data publishing, read precompiles do not rely on third-party updaters. The data returned by a read precompile is defined by the protocol itself and evaluated consistently by all validators.

This preserves a single trust boundary: the Polyester protocol.


When to Use a Read Precompile

Read precompiles are useful when a decision must be made inside a smart contract, based on Polyester market state.

Examples include:

  • Gating on-chain actions based on market conditions
  • Coordinating risk logic across protocols
  • Validating assumptions about prices or volatility
  • Building controllers that reason about off-chain execution outcomes

If a use case does not require on-chain enforcement, market data streams are typically the better tool.


Relationship to PolyEngine

PolyEngine remains the source of truth for trading execution.

Read precompiles expose selected, derived views of PolyEngine’s state to the chain. They do not modify execution behavior, influence matching, or submit trading intent.

Execution flows off-chain. Verification and coordination flow on-chain.

Previous

Audits

Next

Create Invite Code

  • What Read Precompiles Are
  • Why Read Precompiles Exist
  • What Can Be Read
  • Determinism and Trust Boundaries
  • When to Use a Read Precompile
  • Relationship to PolyEngine