forked from aave-dao/aave-v3-origin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSequencerOracle.sol
48 lines (43 loc) · 1.18 KB
/
SequencerOracle.sol
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
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
import {Ownable} from '../../dependencies/openzeppelin/contracts/Ownable.sol';
import {ISequencerOracle} from '../../interfaces/ISequencerOracle.sol';
contract SequencerOracle is ISequencerOracle, Ownable {
bool internal _isDown;
uint256 internal _timestampChangedStatus;
/**
* @dev Constructor.
* @param owner The owner address of this contract
*/
constructor(address owner) {
transferOwnership(owner);
}
/**
* @notice Updates the health status of the sequencer.
* @param isDown True if the sequencer is down, false otherwise
* @param timestamp The timestamp when the sequencer changed status
*/
function setAnswer(bool isDown, uint256 timestamp) external onlyOwner {
_isDown = isDown;
_timestampChangedStatus = timestamp;
}
/// @inheritdoc ISequencerOracle
function latestRoundData()
external
view
override
returns (
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
)
{
int256 isDown;
if (_isDown) {
isDown = 1;
}
return (0, isDown, _timestampChangedStatus, 0, 0);
}
}