API reference v1.0
Introduction
periphery
tokenomics
IDataStorageOperator

IDataStorageOperator

IDataStorageOperator

Events

FeeConfiguration

FeeConfiguration(struct AdaptiveFee.Configuration)

NameTypeDescription
feeConfigstruct AdaptiveFee.Configuration

Functions

timepoints

timepoints(uint256) view external

Returns data belonging to a certain timepoint

NameTypeDescription
indexuint256The index of timepoint in the array

Returns:

NameTypeDescription
initializedbool
blockTimestampuint32
tickCumulativeint56
secondsPerLiquidityCumulativeuint160
volatilityCumulativeuint88
averageTickint24
volumePerLiquidityCumulativeuint144

initialize

initialize(uint32,int24) external

Initialize the dataStorage array by writing the first slot. Called once for the lifecycle of the timepoints array

NameTypeDescription
timeuint32The time of the dataStorage initialization, via block.timestamp truncated to uint32
tickint24Initial tick

getSingleTimepoint

getSingleTimepoint(uint32,uint32,int24,uint16,uint128) view external

NameTypeDescription
timeuint32The current block timestamp
secondsAgouint32The amount of time to look back, in seconds, at which point to return an timepoint
tickint24The current tick
indexuint16The index of the timepoint that was most recently written to the timepoints array
liquidityuint128The current in-range pool liquidity

Returns:

NameTypeDescription
tickCumulativeint56
secondsPerLiquidityCumulativeuint160
volatilityCumulativeuint112
volumePerAvgLiquidityuint256

getTimepoints

getTimepoints(uint32,uint32[],int24,uint16,uint128) view external

Returns the accumulator values as of each time seconds ago from the given time in the array of `secondsAgos`

NameTypeDescription
timeuint32The current block.timestamp
secondsAgosuint32[]Each amount of time to look back, in seconds, at which point to return an timepoint
tickint24The current tick
indexuint16The index of the timepoint that was most recently written to the timepoints array
liquidityuint128The current in-range pool liquidity

Returns:

NameTypeDescription
tickCumulativesint56[]
secondsPerLiquidityCumulativesuint160[]
volatilityCumulativesuint112[]
volumePerAvgLiquiditysuint256[]

getAverages

getAverages(uint32,int24,uint16,uint128) view external

Returns average volatility in the range from time-WINDOW to time

NameTypeDescription
timeuint32The current block.timestamp
tickint24The current tick
indexuint16The index of the timepoint that was most recently written to the timepoints array
liquidityuint128The current in-range pool liquidity

Returns:

NameTypeDescription
TWVolatilityAverageuint112
TWVolumePerLiqAverageuint256

write

write(uint16,uint32,int24,uint128,uint128) external

Writes an dataStorage timepoint to the array

NameTypeDescription
indexuint16The index of the timepoint that was most recently written to the timepoints array
blockTimestampuint32The timestamp of the new timepoint
tickint24The active tick at the time of the new timepoint
liquidityuint128The total in-range liquidity at the time of the new timepoint
volumePerLiquidityuint128The gmean(volumes)/liquidity at the time of the new timepoint

Returns:

NameTypeDescription
indexUpdateduint16

changeFeeConfiguration

changeFeeConfiguration(struct AdaptiveFee.Configuration) external

Changes fee configuration for the pool

NameTypeDescription
feeConfigstruct AdaptiveFee.Configuration

calculateVolumePerLiquidity

calculateVolumePerLiquidity(uint128,int256,int256) pure external

Calculates gmean(volume/liquidity) for block

NameTypeDescription
liquidityuint128The current in-range pool liquidity
amount0int256Total amount of swapped token0
amount1int256Total amount of swapped token1

Returns:

NameTypeDescription
volumePerLiquidityuint128

window

window() view external

Returns:

NameTypeDescription
windowLengthuint32

getFee

getFee(uint32,int24,uint16,uint128) view external

Calculates fee based on combination of sigmoids

NameTypeDescription
timeuint32The current block.timestamp
tickint24The current tick
indexuint16The index of the timepoint that was most recently written to the timepoints array
liquidityuint128The current in-range pool liquidity

Returns:

NameTypeDescription
feeuint16

IDataStorageOperator

Events

FeeConfiguration

FeeConfiguration(struct AdaptiveFee.Configuration)

NameTypeDescription
feeConfigstruct AdaptiveFee.Configuration

Functions

timepoints

timepoints(uint256) view external

Returns data belonging to a certain timepoint

NameTypeDescription
indexuint256The index of timepoint in the array

Returns:

NameTypeDescription
initializedbool
blockTimestampuint32
tickCumulativeint56
secondsPerLiquidityCumulativeuint160
volatilityCumulativeuint88
averageTickint24
volumePerLiquidityCumulativeuint144

initialize

initialize(uint32,int24) external

Initialize the dataStorage array by writing the first slot. Called once for the lifecycle of the timepoints array

NameTypeDescription
timeuint32The time of the dataStorage initialization, via block.timestamp truncated to uint32
tickint24Initial tick

getSingleTimepoint

getSingleTimepoint(uint32,uint32,int24,uint16,uint128) view external

NameTypeDescription
timeuint32The current block timestamp
secondsAgouint32The amount of time to look back, in seconds, at which point to return an timepoint
tickint24The current tick
indexuint16The index of the timepoint that was most recently written to the timepoints array
liquidityuint128The current in-range pool liquidity

Returns:

NameTypeDescription
tickCumulativeint56
secondsPerLiquidityCumulativeuint160
volatilityCumulativeuint112
volumePerAvgLiquidityuint256

getTimepoints

getTimepoints(uint32,uint32[],int24,uint16,uint128) view external

Returns the accumulator values as of each time seconds ago from the given time in the array of `secondsAgos`

NameTypeDescription
timeuint32The current block.timestamp
secondsAgosuint32[]Each amount of time to look back, in seconds, at which point to return an timepoint
tickint24The current tick
indexuint16The index of the timepoint that was most recently written to the timepoints array
liquidityuint128The current in-range pool liquidity

Returns:

NameTypeDescription
tickCumulativesint56[]
secondsPerLiquidityCumulativesuint160[]
volatilityCumulativesuint112[]
volumePerAvgLiquiditysuint256[]

getAverages

getAverages(uint32,int24,uint16,uint128) view external

Returns average volatility in the range from time-WINDOW to time

NameTypeDescription
timeuint32The current block.timestamp
tickint24The current tick
indexuint16The index of the timepoint that was most recently written to the timepoints array
liquidityuint128The current in-range pool liquidity

Returns:

NameTypeDescription
TWVolatilityAverageuint112
TWVolumePerLiqAverageuint256

write

write(uint16,uint32,int24,uint128,uint128) external

Writes an dataStorage timepoint to the array

NameTypeDescription
indexuint16The index of the timepoint that was most recently written to the timepoints array
blockTimestampuint32The timestamp of the new timepoint
tickint24The active tick at the time of the new timepoint
liquidityuint128The total in-range liquidity at the time of the new timepoint
volumePerLiquidityuint128The gmean(volumes)/liquidity at the time of the new timepoint

Returns:

NameTypeDescription
indexUpdateduint16

changeFeeConfiguration

changeFeeConfiguration(struct AdaptiveFee.Configuration) external

Changes fee configuration for the pool

NameTypeDescription
feeConfigstruct AdaptiveFee.Configuration

calculateVolumePerLiquidity

calculateVolumePerLiquidity(uint128,int256,int256) pure external

Calculates gmean(volume/liquidity) for block

NameTypeDescription
liquidityuint128The current in-range pool liquidity
amount0int256Total amount of swapped token0
amount1int256Total amount of swapped token1

Returns:

NameTypeDescription
volumePerLiquidityuint128

window

window() view external

Returns:

NameTypeDescription
windowLengthuint32

getFee

getFee(uint32,int24,uint16,uint128) view external

Calculates fee based on combination of sigmoids

NameTypeDescription
timeuint32The current block.timestamp
tickint24The current tick
indexuint16The index of the timepoint that was most recently written to the timepoints array
liquidityuint128The current in-range pool liquidity

Returns:

NameTypeDescription
feeuint16

IDataStorageOperator

Events

FeeConfiguration

FeeConfiguration(struct AdaptiveFee.Configuration)

NameTypeDescription
feeConfigstruct AdaptiveFee.Configuration

Functions

timepoints

timepoints(uint256) view external

Returns data belonging to a certain timepoint

NameTypeDescription
indexuint256The index of timepoint in the array

Returns:

NameTypeDescription
initializedbool
blockTimestampuint32
tickCumulativeint56
secondsPerLiquidityCumulativeuint160
volatilityCumulativeuint88
averageTickint24
volumePerLiquidityCumulativeuint144

initialize

initialize(uint32,int24) external

Initialize the dataStorage array by writing the first slot. Called once for the lifecycle of the timepoints array

NameTypeDescription
timeuint32The time of the dataStorage initialization, via block.timestamp truncated to uint32
tickint24Initial tick

getSingleTimepoint

getSingleTimepoint(uint32,uint32,int24,uint16,uint128) view external

NameTypeDescription
timeuint32The current block timestamp
secondsAgouint32The amount of time to look back, in seconds, at which point to return an timepoint
tickint24The current tick
indexuint16The index of the timepoint that was most recently written to the timepoints array
liquidityuint128The current in-range pool liquidity

Returns:

NameTypeDescription
tickCumulativeint56
secondsPerLiquidityCumulativeuint160
volatilityCumulativeuint112
volumePerAvgLiquidityuint256

getTimepoints

getTimepoints(uint32,uint32[],int24,uint16,uint128) view external

Returns the accumulator values as of each time seconds ago from the given time in the array of `secondsAgos`

NameTypeDescription
timeuint32The current block.timestamp
secondsAgosuint32[]Each amount of time to look back, in seconds, at which point to return an timepoint
tickint24The current tick
indexuint16The index of the timepoint that was most recently written to the timepoints array
liquidityuint128The current in-range pool liquidity

Returns:

NameTypeDescription
tickCumulativesint56[]
secondsPerLiquidityCumulativesuint160[]
volatilityCumulativesuint112[]
volumePerAvgLiquiditysuint256[]

getAverages

getAverages(uint32,int24,uint16,uint128) view external

Returns average volatility in the range from time-WINDOW to time

NameTypeDescription
timeuint32The current block.timestamp
tickint24The current tick
indexuint16The index of the timepoint that was most recently written to the timepoints array
liquidityuint128The current in-range pool liquidity

Returns:

NameTypeDescription
TWVolatilityAverageuint112
TWVolumePerLiqAverageuint256

write

write(uint16,uint32,int24,uint128,uint128) external

Writes an dataStorage timepoint to the array

NameTypeDescription
indexuint16The index of the timepoint that was most recently written to the timepoints array
blockTimestampuint32The timestamp of the new timepoint
tickint24The active tick at the time of the new timepoint
liquidityuint128The total in-range liquidity at the time of the new timepoint
volumePerLiquidityuint128The gmean(volumes)/liquidity at the time of the new timepoint

Returns:

NameTypeDescription
indexUpdateduint16

changeFeeConfiguration

changeFeeConfiguration(struct AdaptiveFee.Configuration) external

Changes fee configuration for the pool

NameTypeDescription
feeConfigstruct AdaptiveFee.Configuration

calculateVolumePerLiquidity

calculateVolumePerLiquidity(uint128,int256,int256) pure external

Calculates gmean(volume/liquidity) for block

NameTypeDescription
liquidityuint128The current in-range pool liquidity
amount0int256Total amount of swapped token0
amount1int256Total amount of swapped token1

Returns:

NameTypeDescription
volumePerLiquidityuint128

window

window() view external

Returns:

NameTypeDescription
windowLengthuint32

getFee

getFee(uint32,int24,uint16,uint128) view external

Calculates fee based on combination of sigmoids

NameTypeDescription
timeuint32The current block.timestamp
tickint24The current tick
indexuint16The index of the timepoint that was most recently written to the timepoints array
liquidityuint128The current in-range pool liquidity

Returns:

NameTypeDescription
feeuint16

IDataStorageOperator

Events

FeeConfiguration

FeeConfiguration(struct AdaptiveFee.Configuration)

NameTypeDescription
feeConfigstruct AdaptiveFee.Configuration

Functions

timepoints

timepoints(uint256) view external

Returns data belonging to a certain timepoint

NameTypeDescription
indexuint256The index of timepoint in the array

Returns:

NameTypeDescription
initializedbool
blockTimestampuint32
tickCumulativeint56
secondsPerLiquidityCumulativeuint160
volatilityCumulativeuint88
averageTickint24
volumePerLiquidityCumulativeuint144

initialize

initialize(uint32,int24) external

Initialize the dataStorage array by writing the first slot. Called once for the lifecycle of the timepoints array

NameTypeDescription
timeuint32The time of the dataStorage initialization, via block.timestamp truncated to uint32
tickint24Initial tick

getSingleTimepoint

getSingleTimepoint(uint32,uint32,int24,uint16,uint128) view external

NameTypeDescription
timeuint32The current block timestamp
secondsAgouint32The amount of time to look back, in seconds, at which point to return an timepoint
tickint24The current tick
indexuint16The index of the timepoint that was most recently written to the timepoints array
liquidityuint128The current in-range pool liquidity

Returns:

NameTypeDescription
tickCumulativeint56
secondsPerLiquidityCumulativeuint160
volatilityCumulativeuint112
volumePerAvgLiquidityuint256

getTimepoints

getTimepoints(uint32,uint32[],int24,uint16,uint128) view external

Returns the accumulator values as of each time seconds ago from the given time in the array of `secondsAgos`

NameTypeDescription
timeuint32The current block.timestamp
secondsAgosuint32[]Each amount of time to look back, in seconds, at which point to return an timepoint
tickint24The current tick
indexuint16The index of the timepoint that was most recently written to the timepoints array
liquidityuint128The current in-range pool liquidity

Returns:

NameTypeDescription
tickCumulativesint56[]
secondsPerLiquidityCumulativesuint160[]
volatilityCumulativesuint112[]
volumePerAvgLiquiditysuint256[]

getAverages

getAverages(uint32,int24,uint16,uint128) view external

Returns average volatility in the range from time-WINDOW to time

NameTypeDescription
timeuint32The current block.timestamp
tickint24The current tick
indexuint16The index of the timepoint that was most recently written to the timepoints array
liquidityuint128The current in-range pool liquidity

Returns:

NameTypeDescription
TWVolatilityAverageuint112
TWVolumePerLiqAverageuint256

write

write(uint16,uint32,int24,uint128,uint128) external

Writes an dataStorage timepoint to the array

NameTypeDescription
indexuint16The index of the timepoint that was most recently written to the timepoints array
blockTimestampuint32The timestamp of the new timepoint
tickint24The active tick at the time of the new timepoint
liquidityuint128The total in-range liquidity at the time of the new timepoint
volumePerLiquidityuint128The gmean(volumes)/liquidity at the time of the new timepoint

Returns:

NameTypeDescription
indexUpdateduint16

changeFeeConfiguration

changeFeeConfiguration(struct AdaptiveFee.Configuration) external

Changes fee configuration for the pool

NameTypeDescription
feeConfigstruct AdaptiveFee.Configuration

calculateVolumePerLiquidity

calculateVolumePerLiquidity(uint128,int256,int256) pure external

Calculates gmean(volume/liquidity) for block

NameTypeDescription
liquidityuint128The current in-range pool liquidity
amount0int256Total amount of swapped token0
amount1int256Total amount of swapped token1

Returns:

NameTypeDescription
volumePerLiquidityuint128

window

window() view external

Returns:

NameTypeDescription
windowLengthuint32

getFee

getFee(uint32,int24,uint16,uint128) view external

Calculates fee based on combination of sigmoids

NameTypeDescription
timeuint32The current block.timestamp
tickint24The current tick
indexuint16The index of the timepoint that was most recently written to the timepoints array
liquidityuint128The current in-range pool liquidity

Returns:

NameTypeDescription
feeuint16