-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b789bf7
commit 1595227
Showing
6 changed files
with
71 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.16; | ||
|
||
import {IAggregatorRouter} from "@bisonai/orakl-contracts/src/v0.1/interfaces/IAggregatorRouter.sol"; | ||
|
||
contract DataFeedRouterConsumer { | ||
IAggregatorRouter internal router; | ||
int256 public answer; | ||
uint80 public roundId; | ||
|
||
constructor(address aggregatorRouter) { | ||
router = IAggregatorRouter(aggregatorRouter); | ||
} | ||
|
||
|
||
function getLatestData(string calldata pair) public { | ||
( | ||
uint80 roundId_, | ||
int256 answer_ | ||
, /* uint startedAt */ | ||
, /* uint updatedAt */ | ||
, /* uint80 answeredInRound */ | ||
) = router.latestRoundData(pair); | ||
|
||
answer = answer_; | ||
roundId = roundId_; | ||
} | ||
|
||
function decimals(string calldata pair) public view returns (uint8) { | ||
return router.decimals(pair); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { HardhatRuntimeEnvironment } from 'hardhat/types' | ||
import { DeployFunction } from 'hardhat-deploy/types' | ||
|
||
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { | ||
const { deployments, getNamedAccounts, network } = hre | ||
const { deploy } = deployments | ||
const { deployer, aggregatorRouter: aggregatorRouterAddress } = await getNamedAccounts() | ||
|
||
console.log('1-DataFeedRouterConsumer.ts') | ||
|
||
if (network.name != 'baobab') { | ||
console.log('Skipping') | ||
return | ||
} | ||
|
||
await deploy('DataFeedRouterConsumer', { | ||
args: [aggregatorRouterAddress], | ||
from: deployer, | ||
log: true | ||
}) | ||
} | ||
|
||
export default func | ||
func.id = 'deploy-data-feed-router-consumer' | ||
func.tags = ['data-feed-router-consumer'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters