DigiOracle is built with the simplicity of integration as a core principle. Embed price feeds and other real-world data into your decentralized applications today.
With DigiOracle's intuitive APIs and developer-friendly documentation, integrating our oracle into your projects is straightforward and hassle-free. Access price feeds, verifiable random numbers, and other valuable off-chain datasets with DigiOracle.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.16;
import "https://github.com/KlayOracle/klayoracle-monorepo/blob/development/oracle-contract/contracts/KlayOracleInterface.sol";
contract OracleConsumerSample {
address public immutable oracleAddress;
uint256 public klayOutput;
constructor(address _oracleAddress) {
require(_oracleAddress != address(0));
oracleAddress = _oracleAddress;
}
function swapUsdtoKlay() public returns (bool) {
KlayOracleInterface oracle = KlayOracleInterface(oracleAddress);
bool replied = oracle.newOracleRequest(
this.swap.selector,
address(this)
);
return replied;
}
function swap(uint256 _klayOutput) external {
require(msg.sender == oracleAddress, "not allowed"); //ensure only Oracle contract can set price
klayOutput = _klayOutput;
//Swap usd to klay
}
}
Dive into the docs
Frequently asked questions
For questions, issues and help
Explore the current status of the network
Explore the codebase
Learn more about how DigiOracle works
Tell us about your custom use cases & integration needs