# Polygon

## Strategies

### Aggregation

#### Minimum

An observation aggregation strategy that calculates the minimum (opens in a new tab) price and the total liquidity of the observations.

- Contract:
`MinimumAggregator`

(opens in a new tab)- Address: 0x90C8E14d36bfc6ea6c871F5874eE095631d4eDC6

#### Maximum

An observation aggregation strategy that calculates the maximum (opens in a new tab) price and the total liquidity of the observations.

- Contract:
`MaximumAggregator`

(opens in a new tab)- Address: 0x92Eb6895550Fd2EFc1519De69f8b85A819A1fDC1

#### Quote token weighted geometric mean

An observation aggregation strategy that calculates the geometric mean (opens in a new tab) price weighted by the quote token liquidity of each observation, and the total liquidity of the observations.

- Contract:
`QuoteTokenWeightedMeanAggregator`

(opens in a new tab)- Address: 0x76e686562B80b9A215feC2065160fE57b152f7a9

### Averaging

#### Arithmetic mean

An averaging strategy that calculates the arithmetic mean (opens in a new tab) (simple average).

- Contract:
`ArithmeticAveraging`

(opens in a new tab)- Address: 0x1ff553b040475133C6520280db551e45BDfca2C9

#### Geometric mean

An averaging strategy that calculates the geometric mean (opens in a new tab).

Note that input values of zero are treated as one as the natural log of zero is undefined.

- Contract:
`GeometricAveraging`

(opens in a new tab)- Address: 0xF6bfDE89e4848B299e36B91AcF6d327e04C19520

#### Harmonic mean

An averaging strategy that calculates the harmonic mean (opens in a new tab).

Note that since Solidity does not support floating point numbers, weights are shifted to the left by a fixed number of bits before the calculation is performed. This shift is to prevent the result from being rounded down to zero when the weights are smaller than the input values.

Consider how large the input values are and how small the weights are when choosing the number of bits to shift by. For example, if the smallest weight can be 1 and the largest input value can be 2^32 (32 bit input), then using a weight-shift of 80 bits will ensure 48 (80-32) bits of precision in the result.

- Contract:
`HarmonicAveragingWS80`

(opens in a new tab)- This contract shifts the weights to the left by 80 bits.
- Address: 0x11137bD233588ac2c2B9Ac4c2A241FB80e7E2FB4

- Contract:
`HarmonicAveragingWS140`

(opens in a new tab)- This contract shifts the weights to the left by 140 bits.
- Address: 0xd80Ee3B2b46e1515325Da214565F762EB7b40cD2

- Contract:
`HarmonicAveragingWS192`

(opens in a new tab)- This contract shifts the weights to the left by 192 bits.
- Address: 0xa46dE5a21C92a012B2C69Cc9434457d6616da675

## Oracles

### Price and Liquidity Aggregators

#### Daily Average Oracle (WETH)

Configured to provide high-precision price and medium-precision liquidity data for WETH pairs, averaged over 24 hours.

- Contract address: 0xAb46C8A1876CC3656326Bb2B3616a9B4E891007B
- Contract version: 4.0.0
- Type: Geometric-mean TWAP, harmonic-mean TWAL
- Period: 24 hours
- Granularity: 1

- Update thresholds:
- Price: 0.5% or every 4 hours
- Liquidity: 10% or every 8 hours

- Validation:
- Required liquidity for each underlying oracle:
- Minimum token liquidity value: 5 WETH
- Minimum quote token liquidity: 5 WETH
- Acceptable ratio: between 1:100 and 100:1

- Minimum valid sources: 1
- Offchain pegging

- Required liquidity for each underlying oracle:
- Aggregation strategy: Quote token weighted geometric mean average

#### Median Filtered Daily Average Oracle (WETH)

Configured to provide high-precision price and medium-precision liquidity data for WETH pairs, recording the median price and liquidity of three 24-hour TWA observations.

- Contract address: 0x0a3E7369699eeBDbAfA11fE574C8619E71e9e271
- Contract version: 4.0.0
- Type: Median filtered oracle
- Source oracle: Daily Average Oracle (WETH)
- Aggregation parameters:
- Observation offset: 0
- Observation increment: 1
- Observation amount: 3

#### 7d Daily Volatility Oracle (WETH)

Configured to provide historical price volatility, measured in log returns, for WETH pairs over seven days.

- Contract address: 0x00428b3Ab83AC7f3C953f35cF3f6dA5588613eB7
- Contract version: 4.0.0
- Type: Historical price volatility oracle
- Source oracle: Daily Average Oracle (WETH)
- Aggregation parameters:
- Observation offset: 0
- Observation increment: 1
- Observation amount: 7 (8 observations are required to calculate 7 deltas)

#### Thirty Minute Average Oracle (WETH)

Configured to provide high-precision price and medium-precision liquidity data for WETH pairs, averaged over 30 minutes.

- Contract address: 0xb349D958b9E35084814B7AAb162bf3A8079d46c2
- Contract version: 4.0.0
- Type: Geometric-mean TWAP, harmonic-mean TWAL
- Period: 30 minutes
- Granularity: 1

- Update thresholds:
- Price: 0.5% or every 4 hours
- Liquidity: 10% or every 8 hours

- Validation:
- Required liquidity for each underlying oracle:
- Minimum token liquidity value: 5 WETH
- Minimum quote token liquidity: 5 WETH
- Acceptable ratio: between 1:100 and 100:1

- Minimum valid sources: 1
- Offchain pegging

- Required liquidity for each underlying oracle:
- Aggregation strategy: Quote token weighted geometric mean average

#### Current Rate Oracle (WMATIC)

Configured to provide ultra-high-precision price and medium-precision liquidity data for WMATIC pairs.

- Contract address: 0xbcdEf2ab92B23De79f38111f4C721B3A34320b90
- Contract version: 4.0.0
- Type: Current price and liquidity oracle
- Update thresholds:
- Price: 0.1% or every 4 hours
- Liquidity: 10% or every 4 hours

- Validation:
- Required liquidity for each underlying oracle:
- Minimum token liquidity value: 10,000 MATIC
- Minimum quote token liquidity: 10,000 MATIC
- Acceptable ratio: between 1:1000 and 1000:1

- Minimum valid sources: 1
- Offchain pegging

- Required liquidity for each underlying oracle:
- Aggregation strategy: Quote token weighted geometric mean average

### Gas Prices

#### TWA Fast Gas Oracle (Gwei)

Configured to provide medium-precision fast gas prices, averaged over 15 minutes, powered by Polygonscan.

- Contract address: 0xb8fa3e600a0a37bb35fb2e68f6a288f65949df54
- Contract version: 4.0.0
- Type: Arithmetic-mean TWAP
- Period: 15 minutes
- Granularity: 1

- Update thresholds:
- Price: 25% or every 1 hour

#### Current Fast Gas Oracle (Gwei)

Configured to provide medium-precision fast gas prices, powered by Polygonscan.

- Contract address: 0xFB2a058E07E7aDadDCe98A1d836899b44a6ebD56
- Contract version: 4.0.0
- Type: Current price oracle
- Update thresholds:
- Gas price: 25% or every 1 hour

### Interest Rates

#### Compound III USDC Interest Rate Oracle

Configured to provide high-precision interest rates for the Compound III USDC market, averaged over 7 days.

Note: Interest rates are stored in the price field of the observation.

- Contract address: 0x4D5881b3DFA882e1b52B64C83d8Dc6c8F2CdF8DA
- Contract version: 4.0.0
- Type: Geometric-mean TWA
- Period: 7 days
- Granularity: 7 (updated daily)

- Update thresholds:
- Interest rate: 2% (relative change) or every 24 hours

#### Aave v3 USDC Interest Rate Oracle

Configured to provide high-precision interest rates for the Aave v3 USDC market, averaged over 7 days.

Note: Interest rates are stored in the price field of the observation.

- Contract address: 0x5ebB1ADA9Df2C39bA65748Cd545499dA1AA26CCf
- Contract version: 4.0.0
- Type: Geometric-mean TWA
- Period: 7 days
- Granularity: 7 (updated daily)

- Update thresholds:
- Interest rate: 2% (relative change) or every 24 hours