mirror of
https://github.com/0xShay/ticketchain.git
synced 2026-01-11 21:23:24 +00:00
added flare flare oracle code
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
// SPDX-License-Identifier: GPL-3.0
|
// SPDX-License-Identifier: GPL-3.0
|
||||||
|
import {TestFtsoV2Interface} from "@flarenetwork/flare-periphery-contracts/coston2/TestFtsoV2Interface.sol";
|
||||||
|
|
||||||
pragma solidity >=0.8.2 <0.9.0;
|
pragma solidity >=0.8.2 <0.9.0;
|
||||||
|
|
||||||
|
|||||||
44
contracts/FlareOracle.sol
Normal file
44
contracts/FlareOracle.sol
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
pragma solidity >=0.8.0 <0.9.0;
|
||||||
|
|
||||||
|
import {ContractRegistry} from "@flarenetwork/flare-periphery-contracts/coston2/ContractRegistry.sol";
|
||||||
|
/* THIS IS A TEST IMPORT, in production use: import {FtsoV2Interface} from "@flarenetwork/flare-periphery-contracts/coston2/FtsoV2Interface.sol"; */
|
||||||
|
import {TestFtsoV2Interface} from "@flarenetwork/flare-periphery-contracts/coston2/TestFtsoV2Interface.sol";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* THIS IS AN EXAMPLE CONTRACT.
|
||||||
|
* DO NOT USE THIS CODE IN PRODUCTION.
|
||||||
|
*/
|
||||||
|
contract FtsoV2FeedConsumer {
|
||||||
|
TestFtsoV2Interface internal ftsoV2;
|
||||||
|
// Feed IDs, see https://dev.flare.network/ftso/feeds for full list
|
||||||
|
bytes21[] public feedIds = [
|
||||||
|
bytes21(0x01464c522f55534400000000000000000000000000) // FLR/USD
|
||||||
|
// bytes21(0x014254432f55534400000000000000000000000000), // BTC/USD
|
||||||
|
// bytes21(0x014554482f55534400000000000000000000000000) // ETH/USD
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor initializes the FTSOv2 contract.
|
||||||
|
* The contract registry is used to fetch the FtsoV2 contract address.
|
||||||
|
*/
|
||||||
|
constructor() {
|
||||||
|
/* THIS IS A TEST METHOD, in production use: ftsoV2 = ContractRegistry.getFtsoV2(); */
|
||||||
|
ftsoV2 = ContractRegistry.getTestFtsoV2();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current value of the feeds.
|
||||||
|
*/
|
||||||
|
function getFtsoV2CurrentFeedValues()
|
||||||
|
external
|
||||||
|
view
|
||||||
|
returns (
|
||||||
|
uint256[] memory _feedValues,
|
||||||
|
int8[] memory _decimals,
|
||||||
|
uint64 _timestamp
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return ftsoV2.getFeedsById(feedIds);
|
||||||
|
}
|
||||||
|
}
|
||||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,11 +1,11 @@
|
|||||||
{
|
{
|
||||||
"name": "encode",
|
"name": "event-chain",
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "encode",
|
"name": "event-chain",
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@radix-ui/react-icons": "^1.3.0",
|
"@radix-ui/react-icons": "^1.3.0",
|
||||||
|
|||||||
Reference in New Issue
Block a user