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:
Example:
Raw Price:
265050000000(Integer)Exponent:
-8Real Price:
2,650.50
In our Smart Contract AureoRWAPool.sol, the steps are:
Staleness Protection
To prevent users from trading on old prices during network congestion, we implement a timestamp check in the contract.
