Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
LABS
Guides

How to Implement a Volatility Oracle for Peg Adjustments

This guide provides a technical walkthrough for building an on-chain oracle that measures market volatility to inform protocol parameters for algorithmic stablecoins.
Chainscore © 2026
introduction
INTRODUCTION

How to Implement a Volatility Oracle for Peg Adjustments

A volatility oracle provides real-time, on-chain data on price variance, a critical input for stabilizing algorithmic stablecoins and managing risk in DeFi protocols.

A volatility oracle is an on-chain data feed that measures the rate and magnitude of price changes for an asset over a specified period. Unlike a standard price oracle that provides a spot price, a volatility oracle quantifies market uncertainty, typically expressed as annualized volatility derived from historical price data. This metric is essential for protocols like algorithmic stablecoins (e.g., those using the Peg Stability Module model) and lending platforms, where dynamic risk parameters must adjust to market conditions to maintain system solvency and peg stability.

Implementing a volatility oracle involves several core components: a secure source of historical price data, a robust statistical model for calculation (like a rolling standard deviation of log returns), and a decentralized mechanism for updating the value on-chain. Common designs use a time-weighted average price (TWAP) from DEXes like Uniswap V3 as the data source to mitigate manipulation. The calculation is often performed off-chain by a network of node operators (e.g., using Chainlink's decentralized oracle networks) or via a more complex, gas-optimized on-chain contract using a moving average over stored price snapshots.

For peg adjustments, the oracle's output directly informs monetary policy. A sudden spike in volatility for the collateral asset might trigger a protocol to increase stability fees, reduce minting limits, or expand the arbitrage incentive band around the peg. For example, a protocol could use a volatility threshold: if the 24-hour volatility of ETH exceeds 5%, the system could temporarily widen the redemption price band from 1.00 +/- 0.01 to 1.00 +/- 0.03, allowing for larger arbitrage opportunities to absorb market shocks without breaking the peg.

Here is a simplified conceptual outline for an on-chain volatility calculation contract. This example uses a fixed window of price observations stored in a circular buffer.

solidity
// Pseudocode for a simple on-chain volatility tracker
contract VolatilityOracle {
    struct Observation { uint256 timestamp; uint256 price; }
    Observation[] public observations;
    uint256 public windowSize;
    
    function updatePrice(uint256 newPrice) external {
        // 1. Add new observation, remove oldest if window is full
        // 2. Recalculate log returns for all pairs in the window
        // 3. Compute standard deviation of the returns
        // 4. Annualize the volatility (sqrt(time periods in a year))
    }
    
    function getAnnualizedVolatility() public view returns (uint256) {
        // Returns volatility scaled by 1e18 (e.g., 0.15e18 for 15%)
    }
}

This basic structure requires careful gas optimization and protection against stale data, which is why many projects opt for hybrid or fully off-chain oracle designs.

Key challenges in volatility oracle design include data latency, manipulation resistance, and gas efficiency. Using a single on-chain source can be vulnerable to flash loan attacks or data staleness. Best practices involve sourcing data from multiple high-liquidity DEX pools, implementing heartbeat and deviation threshold triggers for updates, and using a decentralized network of reporters. Projects like Chainlink, Pyth Network, and UMA's Optimistic Oracle provide frameworks for building secure, custom data feeds that can be adapted for volatility metrics.

Integrating the oracle into a peg stability mechanism requires defining clear policy functions. A controller contract would call getAnnualizedVolatility() and map the value to a specific adjustment. For instance: if (vol > volatilityCap) { stabilityFee = baseFee * (vol / volatilityCap); }. This creates a feedback loop where the system automatically becomes more conservative during turbulent markets, protecting the protocol's reserves and the peg. Successful implementation hinges on thorough backtesting against historical market data and stress-testing under extreme volatility scenarios.

prerequisites
VOLATILITY ORACLE IMPLEMENTATION

Prerequisites

Before building a volatility oracle for peg adjustments, you need a solid foundation in core blockchain concepts and specific technical tools.

A volatility oracle is a critical piece of on-chain infrastructure that measures and reports the price volatility of an asset, such as a stablecoin's collateral or a governance token. This data is essential for peg stability mechanisms in protocols like MakerDAO's DAI or Frax Finance's FRAX, where it can trigger automated adjustments to collateral ratios, mint/burn rates, or interest rates. Understanding the difference between a standard price feed (e.g., Chainlink's ETH/USD) and a volatility feed is crucial. The latter requires calculating a statistical metric, like the standard deviation of returns over a rolling window, not just a spot price.

You will need proficiency with a smart contract development language, primarily Solidity for Ethereum and EVM-compatible chains. Familiarity with Vyper is also beneficial. Core concepts include secure contract architecture, understanding of the gas optimization trade-offs for on-chain calculations, and robust error handling. Since oracles handle financial data, you must be adept at preventing common vulnerabilities like reentrancy, integer overflows, and ensuring data freshness to avoid manipulation through flash loans or other MEV strategies.

For off-chain components, knowledge of a backend language like Python, JavaScript/Node.js, or Go is required to build the data fetcher and calculation engine. You'll need to interact with blockchain nodes via JSON-RPC (using libraries like web3.js, ethers.js, or web3.py) and historical price data APIs from sources like CoinGecko, CoinMarketCap, or decentralized exchange subgraphs. The calculation engine must compute volatility metrics (e.g., 30-day annualized volatility) reliably and submit them to the blockchain, often via a transaction from a designated oracle operator address.

A working local development environment is essential. This includes Node.js and npm/yarn, the Hardhat or Foundry framework for smart contract testing and deployment, and a testnet faucet for ETH or other native tokens. You should be comfortable writing and running comprehensive test suites that simulate market conditions, including extreme volatility events and potential oracle attack vectors. Using Git for version control and understanding basic CI/CD pipelines for automated testing are considered best practices.

Finally, you must decide on the oracle's data sourcing and update mechanism. Will you use a single trusted source or aggregate multiple sources? Will updates be time-based (e.g., every block, every hour) or change-based (when volatility moves beyond a threshold)? These design choices directly impact the oracle's security, cost, and latency. For production systems, implementing a decentralized oracle network with multiple independent reporters and a consensus mechanism is the standard for achieving robustness and censorship resistance.

architecture-overview
VOLATILITY ORACLES

Oracle Architecture Overview

Volatility oracles provide on-chain data feeds for price variance, enabling DeFi protocols to dynamically adjust collateralization and peg stability mechanisms.

A volatility oracle is a specialized data feed that calculates and reports the historical or implied volatility of an asset's price. Unlike a standard price oracle that provides spot prices, a volatility oracle quantifies the rate and magnitude of price changes over a specific period. This metric is crucial for protocols managing peg stability mechanisms, such as algorithmic stablecoins or collateralized debt positions (CDPs), where the required collateral ratio or minting fee must adjust in response to market turbulence. High volatility signals greater risk, necessitating more conservative protocol parameters to maintain solvency.

Implementing a volatility oracle typically involves three core components: a data source, a calculation engine, and a consensus mechanism. The data source is often a decentralized price feed, like Chainlink or a custom TWAP (Time-Weighted Average Price) from a DEX. The calculation engine, which can be off-chain or on-chain, processes this price history using statistical models—commonly the standard deviation of logarithmic returns over a rolling window (e.g., 24 hours). The result is an annualized volatility percentage. The consensus mechanism, often a network of node operators, attests to the calculation's validity before it is finalized on-chain.

For peg adjustments, a smart contract queries the oracle's volatility value. A common implementation uses a PID controller or a stepped function to map volatility to a parameter change. For example, a stablecoin protocol might increase its minimum collateral ratio from 150% to 200% when 30-day volatility exceeds 80%. Code logic checks the oracle update's freshness and may use a circuit breaker if the reported volatility is anomalously high. It's critical to use a TWAP for the volatility value itself to prevent manipulation via a single-block price spike.

Security considerations are paramount. Relying on a single oracle creates a central point of failure. A robust design uses multiple independent data sources and decentralized oracle networks like Chainlink, Pyth, or a custom committee with economic security. The calculation should be transparent and verifiable. Furthermore, the on-chain contract must include staleness checks and bounding logic to reject impossible values (e.g., volatility > 500%). Without these safeguards, an oracle failure could trigger unnecessary, destabilizing peg adjustments or, worse, leave the protocol vulnerable during actual market stress.

Practical implementation often starts with an off-chain compute job. Using a framework like Chainlink Functions or a custom node, you can fetch price data from multiple APIs (CoinGecko, Binance, DEX subgraphs), calculate rolling volatility in a serverless environment, and submit it via a transaction. On-chain, a contract like VolatilityOracle.sol would store the value with a timestamp. Other protocol contracts, such as a StableEngine.sol, would then read getVolatility() and adjust their pegFee or liquidationRatio accordingly based on pre-defined thresholds.

ORACLE DESIGN

Volatility Metric Comparison

Comparison of statistical methods for calculating price volatility in a peg-stabilization oracle.

MetricStandard Deviation (SD)Garman-Klass (GK)Realized Volatility (RV)

Data Input

Closing prices

OHLC prices (Open, High, Low, Close)

High-frequency price ticks

Noise Sensitivity

High

Medium

Low

Calculation Window

7-30 days typical

1-7 days typical

Intraday (e.g., 24h of 5-min intervals)

Gas Cost (Est.)

Low

Medium

High

Resistance to Manipulation

Best For

Long-term trend analysis

Efficient market volatility

Precise, short-term volatility

Implementation Complexity

Low

Medium

High

Typical Update Frequency

Once per epoch (e.g., daily)

Once per epoch (e.g., daily)

Continuous or per block

step-1-data-sourcing
VOLATILITY ORACLE GUIDE

Step 1: Sourcing On-Chain Price Data

The foundation of any volatility oracle is a reliable, low-latency stream of on-chain price data. This step details how to source and structure this data for subsequent statistical analysis.

A volatility oracle calculates the standard deviation of an asset's price returns over a defined period. To begin, you need a continuous feed of price data. The most common sources are decentralized exchange (DEX) oracles like Chainlink Data Feeds or Pyth Network, which aggregate prices from multiple venues. For maximum decentralization and cost-efficiency, you can also source data directly from Uniswap V3 pools using the time-weighted average price (TWAP) function. The choice depends on your required data freshness, security model, and the specific asset pairs (e.g., ETH/USD, BTC/USD).

Once a data source is selected, you must decide on the sampling interval. Common intervals for volatility calculation range from 1-hour to 24-hour periods. For a 24-hour volatility metric, you might sample the price every hour, resulting in 24 data points per day. This data must be stored on-chain in a circular buffer or array within your smart contract. Efficient storage is critical, as you'll need to maintain a rolling window of historical prices (e.g., the last 30 days) without unbounded gas costs.

Here is a simplified Solidity snippet for initializing a data structure to store price observations:

solidity
struct Observation {
    uint256 timestamp;
    uint256 price;
}

Observation[] public observations;
uint256 public constant MAX_OBSERVATIONS = 720; // e.g., 30 days of hourly data

function _writeObservation(uint256 price) internal {
    if (observations.length == MAX_OBSERVATIONS) {
        // Remove the oldest observation to make room
        for (uint i = 0; i < observations.length - 1; i++) {
            observations[i] = observations[i + 1];
        }
        observations.pop();
    }
    observations.push(Observation(block.timestamp, price));
}

This function manages a fixed-size history, overwriting the oldest entry when full.

The raw price data must be converted into log returns for volatility calculation. The log return between two consecutive prices, (P_t) and (P_{t-1}), is calculated as ( r_t = ln(P_t / P_{t-1}) ). This metric is preferred over simple percentage returns because log returns are time-additive, meaning the return over multiple periods is the sum of the individual period returns, which simplifies statistical modeling. Your oracle's update function will compute this value each time a new price is recorded and store it alongside the price data.

Finally, consider the oracle update trigger. Will your contract rely on permissionless keepers to push new data, or will it pull data on-demand when a protocol queries for volatility? A push-based model with regular updates ensures data freshness but requires incentivization (e.g., with keeper fees). A pull model reduces gas costs but may incur latency. Many production systems use a hybrid approach, where a decentralized network of keepers updates the price buffer, and the volatility calculation is performed lazily when needed by an external protocol.

step-2-calculating-realized-volatility
IMPLEMENTATION

Step 2: Calculating Realized Volatility

This guide explains how to calculate realized volatility from on-chain price data, the core metric for a volatility oracle that informs peg adjustments.

Realized volatility (RV) quantifies the actual price fluctuations of an asset over a specific historical period. Unlike implied volatility derived from options prices, RV is calculated directly from past price returns. For a volatility oracle, you typically compute the annualized standard deviation of daily logarithmic returns. This provides a backward-looking, objective measure of market turbulence, which is essential for algorithms that need to adjust protocol parameters, like a stablecoin's peg mechanism, based on market conditions.

The calculation follows a standard statistical process. First, you collect a time series of price observations, p_t, at regular intervals (e.g., hourly or daily). For each period, calculate the log return: r_t = ln(p_t / p_{t-1}). Next, compute the standard deviation of these returns over your chosen lookback window (e.g., 30 days). Finally, annualize the result by multiplying by the square root of the number of periods in a year (e.g., sqrt(365) for daily data). The formula is: RV = stdev(r_t) * sqrt(annualization_factor).

Implementing this on-chain requires careful data sourcing and gas optimization. You cannot store extensive historical data on-chain. Instead, you must maintain a circular buffer or a rolling sum of squared returns using a library like Solady's FixedPointMathLib. A common approach is to store a cumulative sum of squared returns and update it with each new oracle price feed, subtracting the oldest value as the window moves. This allows you to compute the variance in O(1) time, which is critical for blockchain execution.

Here is a simplified Solidity snippet demonstrating the core update logic for a rolling window:

solidity
// Pseudocode using a circular buffer
uint256[] public returnSquares;
uint256 public sumSquares;
uint256 index;

function updateVolatility(uint256 newPrice, uint256 oldPrice) public {
    // 1. Calculate new log return squared
    int256 logReturn = (newPrice * 1e18) / oldPrice; // Simulated log
    uint256 newSquare = uint256(logReturn * logReturn) / 1e18;

    // 2. Subtract the oldest value and add the new one
    uint256 oldestSquare = returnSquares[index];
    sumSquares = sumSquares - oldestSquare + newSquare;
    returnSquares[index] = newSquare;
    index = (index + 1) % WINDOW_SIZE;

    // 3. Calculate realized volatility (annualized)
    volatility = sqrt(sumSquares / WINDOW_SIZE) * sqrt(ANNUALIZATION);
}

Key considerations for production include handling oracle latency and manipulation resistance. Using a decentralized oracle network like Chainlink for price feeds is essential. You should also implement a minimum update threshold and circuit breakers to prevent spam updates or extreme price spikes from distorting the volatility signal. Furthermore, the choice of lookback window (e.g., 7, 30, 90 days) depends on the peg adjustment mechanism's sensitivity; shorter windows react faster but are noisier.

The output of this calculation—a single volatility metric—becomes the primary input for the next step: the peg adjustment model. This model will define a function, such as a PID controller, that translates changes in realized volatility into adjustments for parameters like collateral ratios, mint/redeem fees, or interest rates to maintain the stablecoin's peg during volatile market regimes.

step-3-triggering-adjustments
IMPLEMENTING THE ORACLE

Step 3: Triggering Protocol Adjustments

This section details how to integrate a volatility oracle to trigger automated peg adjustments in a stablecoin or rebasing protocol.

A volatility oracle provides an on-chain, trust-minimized feed of an asset's price volatility, typically measured as a standard deviation or variance over a rolling window. Unlike a standard price oracle (e.g., Chainlink), which reports the current price, a volatility oracle calculates and reports the statistical dispersion of prices. This metric is essential for protocols that need to adjust parameters—like a redemption rate, collateral ratio, or rebase magnitude—based on market stress. Common implementations use time-weighted average price (TWAP) data from decentralized exchanges like Uniswap V3 to compute historical volatility.

To trigger an adjustment, the protocol's smart contract must read from the oracle and compare the reported volatility against predefined thresholds. For example, a stablecoin protocol might have a volatilityThreshold of 0.05 (5%). When the 24-hour volatility of the paired asset (e.g., ETH/USD) exceeds this threshold, a function like checkAndTriggerAdjustment() becomes callable. This function would then execute the core logic for a peg correction mechanism, such as adjusting the mint/redeem fee, modifying the collateral factor in a lending vault, or initiating a positive/negative rebase.

Here is a simplified Solidity code snippet illustrating the check. It assumes an oracle interface IVolatilityOracle that provides a getVolatility() function returning a scaled integer (e.g., 500 for 5%).

solidity
function evaluateVolatilityTrigger() public {
    uint256 currentVolatility = volatilityOracle.getVolatility();
    if (currentVolatility > volatilityThreshold) {
        _executePegAdjustment();
        emit AdjustmentTriggered(currentVolatility, block.timestamp);
    }
}

The _executePegAdjustment() internal function would contain the protocol-specific logic, such as calling a rebase() function or updating a fee parameter in a separate controller contract.

Key design considerations include oracle security and update frequency. Using a decentralized oracle network or a verifiable TWAP calculation mitigates manipulation risk. The volatility calculation period (e.g., 1-hour vs. 24-hour) must align with the protocol's adjustment speed; faster reactions require shorter windows but are more gas-intensive and noisy. Furthermore, implementing a cooldown period between adjustments prevents rapid, oscillating changes that could destabilize the system further.

In practice, protocols like Ampleforth historically used similar mechanisms, where supply rebases were influenced by price deviation from a target. Modern implementations might use the Volatility Protocol or custom-built oracles using DEX data. The trigger mechanism should be permissionless but often includes a timelock or governance override for emergencies, ensuring the system remains autonomous yet controllable in extreme scenarios.

security-considerations
SECURITY AND MANIPULATION RESISTANCE

How to Implement a Volatility Oracle for Peg Adjustments

A volatility oracle provides a decentralized, manipulation-resistant data feed for measuring price stability, essential for algorithmic stablecoins and pegged assets.

A volatility oracle measures the standard deviation of an asset's price returns over a specified time window, providing a quantitative metric for price stability. Unlike a simple price feed, it calculates the statistical dispersion of price movements, which is critical for protocols that need to adjust parameters—like mint/burn rates or collateral ratios—based on market conditions. For a pegged asset, high volatility signals instability, potentially triggering defensive protocol actions. Implementing this requires sourcing price data, calculating rolling volatility on-chain, and ensuring the feed is resistant to manipulation from flash loans or wash trading.

The core implementation involves three components: a price feed, a data storage mechanism for historical prices, and a volatility calculation module. For the price feed, use a decentralized oracle like Chainlink, which provides time-weighted average prices (TWAPs) that are inherently more resistant to short-term manipulation. Store these price updates in a circular buffer or array within a smart contract, maintaining a history (e.g., the last 24 hours of hourly prices). The calculation typically uses a rolling window to compute the standard deviation of logarithmic returns. A common formula is: σ = sqrt( (1/(N-1)) * Σ( (ln(P_t/P_{t-1}) - μ)^2 ) ), where μ is the mean return over the window.

Here is a simplified Solidity code snippet for the core calculation logic, assuming a stored array of historical prices:

solidity
function calculateVolatility(uint256[] memory prices) public pure returns (uint256) {
    require(prices.length > 1, "Insufficient data");
    int256[] memory returns = new int256[](prices.length - 1);
    int256 sumReturns;
    // Calculate log returns
    for (uint i = 1; i < prices.length; i++) {
        returns[i-1] = int256( (prices[i] * 1e18) / prices[i-1] );
        // ... log calculation and sum
    }
    int256 mean = sumReturns / int256(returns.length);
    int256 sumSquaredDiff;
    // Calculate sum of squared differences from mean
    for (uint i = 0; i < returns.length; i++) {
        int256 diff = returns[i] - mean;
        sumSquaredDiff += diff * diff;
    }
    // Calculate and return standard deviation (volatility)
    return uint256( sqrt( uint256(sumSquaredDiff / int256(returns.length - 1)) ) );
}

Note: This is a conceptual example; a production implementation needs fixed-point math libraries (like PRBMath) and gas optimization for the historical data array.

To achieve manipulation resistance, the oracle design must address several attack vectors. Using a TWAP from a DEX like Uniswap V3 as the price source is a strong first step, as it averages prices over a block range, making instantaneous manipulation costly. The volatility calculation window should be long enough (e.g., 24-72 hours) to prevent an attacker from economically influencing the entire dataset. Furthermore, the oracle should have multiple independent data reporters or use a decentralized oracle network to avoid a single point of failure. Consider implementing a stake-slashing mechanism for reporters who submit outliers beyond a statistically acceptable range.

Integrate the volatility oracle's output into your peg stability mechanism. For example, an algorithmic stablecoin might have a PegStabilityModule that reads the current volatility score. If volatility exceeds a threshold (e.g., a score of 5%), the contract could increase the mintFee or decrease the redemptionRate to discourage arbitrage during unstable periods. The key is to define clear, graduated policy responses based on volatility bands, avoiding abrupt changes that could themselves trigger instability. Always test the integration extensively on a testnet, simulating volatile market conditions using tools like Ganache or Foundry's forge to ensure the system responds as intended without introducing new vulnerabilities.

VOLATILITY ORACLES

Frequently Asked Questions

Common questions and technical clarifications for developers implementing volatility oracles for algorithmic stablecoin peg adjustments.

A volatility oracle is a decentralized data feed that provides a standardized measure of an asset's price volatility, typically expressed as an annualized percentage. Unlike a standard price oracle (e.g., Chainlink ETH/USD), which reports the current spot price, a volatility oracle calculates the magnitude of price fluctuations over a specific lookback period (e.g., 24 hours, 7 days).

Key Differences:

  • Input: Price oracles provide a single price point. Volatility oracles process a time series of historical prices.
  • Output: Price = uint256. Volatility = a calculated metric like standard deviation or variance.
  • Use Case: Price feeds enable swaps and liquidations. Volatility feeds inform risk parameters, like adjusting the peg stability module (PSM) spread or collateral ratios in response to market turbulence.

Protocols like Voltz and Panoptic use similar concepts for interest rate and options volatility, respectively.

conclusion-next-steps
IMPLEMENTATION SUMMARY

Conclusion and Next Steps

This guide has outlined the core components for building a volatility oracle to inform stablecoin peg adjustments. The next steps involve production hardening and integration.

You now have a functional blueprint for a volatility oracle. The core system involves data ingestion from sources like Chainlink or The Graph, a calculation engine using metrics like GARCH or realized volatility, and a secure publishing mechanism via a smart contract. The key is to ensure your oracle's output—a standardized volatility score—is reliable, tamper-resistant, and accessible on-chain for your peg stabilization logic.

For production, focus on decentralization and robustness. Move beyond a single data source by aggregating prices from multiple decentralized exchanges (DEXs) like Uniswap V3 and Curve. Implement a network of node operators using a framework like Chainlink Functions or API3's dAPIs to compute and submit values, with a consensus mechanism (e.g., median) to filter out outliers. This reduces single points of failure and manipulation risks.

Your stabilization contract, likely based on a PID controller or similar algorithm, will consume the oracle's data. It must define clear thresholds: for example, a 30-day volatility over 5% might trigger a gradual adjustment of protocol fees or redemption curves. Thoroughly test this interaction on a testnet like Sepolia using foundry or hardhat, simulating extreme market volatility to ensure the system responds predictably and without introducing unnecessary instability.

Next, consider advanced enhancements. Time-weighted average price (TWAP) integration for the underlying price feeds can mitigate short-term manipulation. Explore volatility forecasting models to make the system more proactive. Furthermore, implement circuit breakers and governance overrides to pause adjustments during black swan events or for scheduled parameter updates controlled by a DAO.

To continue your development, study existing implementations like MakerDAO's stability module parameters which respond to market signals, or Frax Finance's algorithmic market operations. Essential resources include the Chainlink documentation for oracle design, OpenZeppelin for secure contract patterns, and academic papers on stochastic volatility models for DeFi applications.

Start by deploying a minimal viable oracle on a testnet, iterating based on simulated market data. The goal is to create a transparent, data-driven foundation for peg management that enhances your protocol's stability and user trust in volatile market conditions.

How to Implement a Volatility Oracle for Peg Adjustments | ChainScore Guides