@swaptoshi/dex-module
Version:
Klayr decentralized exchange (dex) on-chain module
22 lines (21 loc) • 1.26 kB
TypeScript
import { Observation, Slot0 } from '../../../types';
import { Uint128String, Uint32String, Int56String, Uint160String, Int24String, Uint256String, Int256String } from '../int';
type ObservablePool = {
slot0: Slot0;
observations: Observation[];
liquidity: Uint128String;
};
type Observable = {
observe(secondsAgos: Uint32String[]): [tickCumulatives: Int56String[], secondsPerLiquidityCumulativeX128s: Uint160String[]];
};
interface WeightedTickData {
tick: Int24String;
weight: Uint128String;
}
export declare function consult(pool: Observable, secondsAgo: Uint32String): [arithmeticMeanTick: Int24String, harmonicMeanLiquidity: Uint128String];
export declare function getQuoteAtTick(tick: Int24String, baseAmount: Uint128String, baseToken: Buffer, quoteToken: Buffer): Uint256String;
export declare function getOldestObservationSecondsAgo(pool: ObservablePool, _timestamp: string): Uint32String;
export declare function getBlockStartingTickAndLiquidity(pool: ObservablePool, timestamp: string): [Int24String, Uint128String];
export declare function getWeightedArithmeticMeanTick(weightedTickData: WeightedTickData[]): Int24String;
export declare function getChainedPrice(tokens: Buffer[], ticks: Int24String[]): Int256String;
export {};