Twap Oracle


Twap is an oracle for Cube Network, which provides a Time Weight Average Price Service base on the Capricorn. User can get prices of the specified tokens. We use the Sliding-Window to calculate the prices.
Twap Address

How to Use

User can call these functions to get the price of token.
1.get single token price
function consult(address tokenIn, uint amountIn, address tokenOut) public view returns (uint, bool)
2.get tokens prices
function consultTokens(address[] calldata tokenIns, uint[] calldata amountIns, address[] calldata tokenOuts) external view returns (uint[] memory, bool)
3.get single token price by multi-paths
function consultPaths(address[] calldata tokenIns, uint amountIn, address[] calldata tokenOuts) external view returns (uint, bool)
4.get the latest update timestamp of tokens
function getLastUpdateTimestamps(address[] calldata tokenAs, address[] calldata tokenBs) external view returns (uint[] memory, bool)

Supported Token Pairs

Now we have supported five pairs, user can get the token price based on them.
['BTC-USDT', '0x040eA5C10e6BA4Badb6c433A365cCC4968697230', '0x79F1520268A20c879EF44d169A4E3812D223C6de'],
['ETH-USDT', '0x57EeA49Ec1087695274A9c4f341e414eb64328c2', '0x79F1520268A20c879EF44d169A4E3812D223C6de'],
['USDC-USDT', '0x00f0D8595797943c12605cD59bc0D9f63D750cCf', '0x79F1520268A20c879EF44d169A4E3812D223C6de'],
['USDT-WCUBE', '0x79F1520268A20c879EF44d169A4E3812D223C6de', '0x9D3F61338d6Eb394e378D28C1Fd17d5909aC6591'],
['USDT-HUSD', '0x79F1520268A20c879EF44d169A4E3812D223C6de', '0x9dB853F46Dd7D541D0FBa1c8B6b7e7B1d8Ff58d3']