-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfirstArbitrum.sol
More file actions
54 lines (42 loc) · 1.55 KB
/
firstArbitrum.sol
File metadata and controls
54 lines (42 loc) · 1.55 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.9;
import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";
import "@chainlink/contracts/src/v0.8/interfaces/FlagsInterface.sol";
// Uncomment this line to use console.log
// import "hardhat/console.sol";
contract firstArbitrum {
/*Price Feed Address For Arbitrum Georli DAI/USD:0x103b53E977DA6E4Fa92f76369c8b7e20E7fb7fe1
*/
AggregatorV3Interface private constant priceFeed =
AggregatorV3Interface(0x103b53E977DA6E4Fa92f76369c8b7e20E7fb7fe1);
address private constant FLAG_ARBITRUM_SEQ_OFFLINE =
address(
bytes20(
bytes32(
uint256(keccak256("chainlink.flags.arbitrum-seq-offline")) -
1
)
)
);
FlagsInterface internal chainlinkFlags;
constructor() {
chainlinkFlags = FlagsInterface(
0x491B1dDA0A8fa069bbC1125133A975BF4e85a91b
);
}
function getThePrice() public view returns (int) {
bool isRaised = chainlinkFlags.getFlag(FLAG_ARBITRUM_SEQ_OFFLINE);
if (isRaised) {
// If flag is raised we shouldn't perform any critical operations
revert("Chainlink feeds are not being updated");
}
(
uint80 roundID,
int price,
uint startedAt,
uint updatedAt,
uint80 answeredInRound
) = priceFeed.latestRoundData();
return price;
}
}