Arche
Search…
Arche Oracle
ARCHE Network provide multiple oracle solutions and tools to provide a stable and accurate price for Financial Contract. Here are the guides to use those solutions.

Use Chainlink on Arche Network

Chainlink is Arche’s current decentralized oracle service that provides external data for financial contracts. For the price information of the financial contract on the chain, we can provide stable and accurate price by introducing ChainLink predictor.
Chainlink enables smart contracts on any blockchain to leverage extensive off-chain resources, such as tamper-proof price data, verifiable randomness, external APIs, and much more.
We recommend deploying according to official documentation to get the latest price of PAIRS.
Following is a simple building tutorial for users on Arche Network:
We introduce Arche ChainLink and use Chainlink’s official Proxy to get prices out of convenience.
    Step 1, Solidity version bigger than 0.8.xxx
1
pragma solidity ^0.8.4;
Copied!
1
import "https://github.com/Archenetwork/Arche-ChainLink/blob/main/contracts/ArcheChainLink.sol";
Copied!
1
ArcheChainLink public archeChainLinkProxy;
Copied!
    Step 5, Use the oracle method provided by Arche Chainlink;
1
function decimals() external view returns (uint8);
2
3
function description() external view returns (string memory);
4
5
function version() external view returns (uint256);
6
7
......
Copied!
    Step 6, Use the price from Chainlink
1
function latestRoundData() public view virtual override returns (
2
uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound){
3
Phase memory current = currentPhase;
4
(
5
roundId,
6
answer,
7
startedAt,
8
updatedAt,
9
answeredInRound
10
) = current.aggregator.latestRoundData();
11
return addPhaseIds(roundId, answer, startedAt, updatedAt, answeredInRound, current.id);
12
}
Copied!
Last modified 4mo ago