OracleFacet API Reference
The OracleFacet maintains an internal TWAP (Time-Weighted Average Price) oracle using a ring buffer of price observations.
Functions
consultTWAP
Get the time-weighted average tick over a period.
solidity
function consultTWAP(bytes32 poolId, uint32 period) external view returns (int24 arithmeticMeanTick)Parameters:
| Name | Type | Description |
|---|---|---|
| poolId | bytes32 | Pool identifier |
| period | uint32 | Lookback period in seconds |
getSpotTick
Get the current spot tick.
solidity
function getSpotTick(bytes32 poolId) external view returns (int24 tick)observe
Get historical tick cumulative values at specific timestamps.
solidity
function observe(bytes32 poolId, uint32[] calldata secondsAgos)
external view returns (int56[] memory tickCumulatives)increaseObservationCardinalityNext
Expand the observation buffer capacity to store more historical data.
solidity
function increaseObservationCardinalityNext(bytes32 poolId, uint16 observationCardinalityNext) externalHow TWAP Works
- Every swap records an observation: (timestamp, tickCumulative, secondsPerLiquidityCumulative)
- tickCumulative += currentTick * elapsed_seconds
- TWAP over period T: arithmeticMeanTick = (tickCumNow - tickCumTAgo) / T
- Ring buffer stores up to 65535 observations (expandable)
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 |