Oracle Pricing Math

Why not an AMM?

Most DeFi tokens use an AMM (Automated Market Maker) where price is determined by the ratio of tokens in a pool (x * y = k).

  • Problem: AMMs suffer from slippage and impermanent loss. A large buy can artificially pump the price of Gold locally, decoupling it from the real world.

  • Solution: Aureo uses a Direct Oracle Model. The price is fixed to the real-world XAU/USD price feed.

Pyth Network Integration

We utilize the Pyth Network Oracle on Mantle Sepolia to fetch the Gold Spot Price.

Feed ID: 0x765d2cd... (XAU/USD)

The Normalization Formula

Pyth returns prices with a variable exponent (usually -8). However, Solidity logic usually works with 18 decimals (wei).

The math used to normalize Pyth's returned value to 18 decimals:

Ptarget=Praw×10(18+expo)P_{target} = P_{raw} \times 10^{(18 + expo)}

Example:

  • Raw Price: 265050000000 (Integer)

  • Exponent: -8

  • Real Price: 2,650.50

In our Smart Contract AureoRWAPool.sol, the steps are:

1

Receive raw price

We receive 265050000000 from the Pyth feed.

2

Compute adjustment

Calculate adjustment: 18 + (-8) = 10.

3

Apply scaling

Multiply: 265050000000 * 10^10.

4

Result (18 decimals)

Result: 2,650,500,000,000,000,000,000 (18 decimals).

Staleness Protection

To prevent users from trading on old prices during network congestion, we implement a timestamp check in the contract.