OraclePegFacet API Reference
The OraclePegFacet connects external oracle feeds to pools for wrapped/bridged assets that should trade at oracle-anchored prices.
Functions
setOraclePeg
Set the oracle peg configuration for a pool (owner only).
solidity
function setOraclePeg(bytes32 poolId, PegConfig calldata config) externalParameters (PegConfig):
| Name | Type | Description |
|---|---|---|
| oracleAddress | address | IASAMMOracle implementation |
| twapPeriod | uint32 | TWAP lookback period in seconds |
| maxStaleness | uint32 | Max seconds before oracle is stale |
| maxSpotDeviation | uint256 | Max spot vs TWAP deviation (bps) |
removeOraclePeg
Remove oracle peg from a pool (owner only).
solidity
function removeOraclePeg(bytes32 poolId) externalgetOracleMidPrice
Get the oracle-derived mid-price for a pegged pool.
solidity
function getOracleMidPrice(bytes32 poolId) external view returns (uint256 midPrice, bool isValid)Returns the TWAP-based mid-price and whether the data is fresh and consistent.
getPegConfig
Get the peg configuration for a pool.
solidity
function getPegConfig(bytes32 poolId) external view returns (PegConfig memory)Oracle Interface
External oracles must implement IASAMMOracle:
solidity
interface IASAMMOracle {
function spotPrice() external view returns (uint256 price, uint256 updatedAt);
function twapPrice(uint32 period) external view returns (uint256 price);
}Circuit Breaker
The oracle peg includes safety mechanisms:
- If
updatedAtis older thanmaxStaleness, the pool pauses - If spot price deviates from TWAP by more than
maxSpotDeviation, the pool flags an anomaly - Events are emitted for monitoring:
CircuitBreakerTriggered(poolId, reason)
License
Licensed under the GNU General Public License v3.0--see LICENSE for terms.
Copyright (C) 2026 PaxLabs Inc.
SPDX-License-Identifier: GPL-3.0-onlyContact & Resources
| Resource | Link |
|---|---|
| Protocol Documentation | docs.hyperpaxeer.com |
| Block Explorer | paxscan.paxeer.app |
| Sidiora Exchange | app.hyperpaxeer.com |
| Website | paxeer.app |
| Twitter/X | @paxeer_app |
| General Inquiries | infopaxeer@paxeer.app |
| Security Reports | security@paxeer.app |