Index Contract
Index contract
code
abi
Interface
pragma solidity ^0.6.7;
interface Index {
event AddIndex(uint256 _indexNo, bool _isOpen, uint256 _initIndexPrice);
event UpdateIndex(uint256 _indexNo, bool _isOpen);
event ExecuteOracleTimeClock(address new_oracle);
event SetOracleTimeClock(address _newOracleAddr, uint256 oracleUpdateAt);
function batchIndexPrice(uint256[] calldata _indexNoArr) external view returns (uint256[] memory _prices);
function getIndexPrice(uint256 _indexNo) public view returns (uint256 _indexPrice);
function indexLength() external view returns (uint256);
function getIndex(uint256 _indexNo) external view
returns (address[] memory tokens,uint8[] memory weights,uint256[] memory circleSupply,uint256 k,bool isOpen);
function isIndexOpen(uint256 _indexNo) external view returns (bool);
}
Events
UpdateIndex(uint256 _indexNo, bool _isOpen)
The index status is on or off.AddIndex(uint256 _indexNo, bool _isOpen,uint256 _initIndexPrice)
add new index.SetOracleTimeClock(address _newOracleAddr, uint256 oracleUpdateAt)
Execute the new orcale,and it can be enabled after 7 days.ExecuteOracleTimeClock(address new_oracle)
Switch to the new oracle.
Methods(Read Contract)
1. Batch Index Price
function batchIndexPrice(uint256[] calldata _indexNoArr) external view returns (uint256[] memory _prices)
batch get index price
_indexNoArr
uint256[]
indexNo array
_prices
uint256[]
price array
2. Get Index Price
function getIndexPrice(uint256 _indexNo) public view returns (uint256 _indexPrice)
Get index price
_price
uint256
price
3. Index Length
function indexLength() external view returns (uint256)
Get index array length
length
uint256
index length
4. Is Index Open
function isIndexOpen(uint256 _indexNo) external view returns (bool)
isset index is open
indexNo
uint256
indexNo
isOpen
bool
index is open
5. getIndex
function getIndex(uint256 _indexNo) external view returns ( address[] memory tokens, uint8[] memory weights, uint256[] memory circleSupply, uint256 k, bool isOpen )
get Index tokens and weight,circleSupply
indexNo
uint256
indexNo
tokens
address[]
index tokens
weights
uint256[]
weight of tokens
circleSupply
uint256[]
circly supply of tokens
isOpen
bool
index open status
Last updated