-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rename MockAggregator to Aggregator and add scripts
- Loading branch information
Showing
5 changed files
with
82 additions
and
14 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,31 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity ^0.8.13; | ||
|
||
import {Script, console} from "forge-std/Script.sol"; | ||
import {Aggregator} from "../src/Aggregator.sol"; | ||
import {AggregatorV3Interface} from "../src/interfaces/AggregatorV3Interface.sol"; | ||
|
||
contract AggregatorScript is Script { | ||
function setUp() public {} | ||
|
||
function deploy() public { | ||
vm.startBroadcast(vm.envUint("PRIVATE_KEY")); | ||
|
||
address oracleContractAddress = vm.envAddress("ORACLE_CONTRACT_ADDRESS"); | ||
bytes32 currencyPairHash = keccak256(bytes(vm.envString("CURRENCY_PAIR"))); | ||
new Aggregator(oracleContractAddress, currencyPairHash); | ||
|
||
vm.stopBroadcast(); | ||
} | ||
|
||
function getLatestRoundData() public view { | ||
AggregatorV3Interface aggregator = AggregatorV3Interface(vm.envAddress("AGGREGATOR_CONTRACT_ADDRESS")); | ||
(uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) = | ||
aggregator.latestRoundData(); | ||
console.logUint(roundId); | ||
console.logInt(answer); | ||
console.logUint(startedAt); | ||
console.logUint(updatedAt); | ||
console.logUint(answeredInRound); | ||
} | ||
} |
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