Oracle

Oracle

network name:kovan chain id: 42

Interface

pragma solidity ^0.6.7;
interface Oracle {
    function getBandPrice(string symbol) external view returns (uint256);
    function getChainLinkPrice(string symbol) external view returns (uint256);
    function getTokenPrice(string symbol) external view returns (uint256);
    function getCirculSupplys(string symbol) external view returns (uint256);
}

The Oracle contract connects to two oracle platforms, BandProcotal, ChainLink. GetTokenPrice takes the average price of the three platforms in a 1:2 ratio.

Events

const { ethers } = require('ethers');
const provider = new ethers.providers.InfuraProvider('kovan');
let contract = new ethers.Contract(contract_address, abi, provider);

Methods(Read Contract)

1. Get Band Price

function getBandPrice(string sybmol) public view returns (uint256);

Get bandprotocol price

function getChainLinkPrice(string sybmol) public view returns (uint256)

Get ChainLink Price

3. Get Token Price

function getTokenPrice(string sybmol) external view returns (uint256 _price, uint8 _decimals)

Get two oracle prices at the same time and calculate the final price

4. Get Circul Supplys

function getCirculSupplys(string sybmol) external view returns (uint256)

**Get the number of token issues, and the number of issues for contract record, which is not real-time **

Methods(Write Contract)

1. Set Weight

function setWeight( uint8 _chainLinkWeight, uint8 _bandWeight, uint8 _uniswapv3Weight) external;

Set oracle weight

Last updated