-
Notifications
You must be signed in to change notification settings - Fork 195
/
Copy pathCompositePostRebaseBeaconReceiver.sol
50 lines (41 loc) · 1.42 KB
/
CompositePostRebaseBeaconReceiver.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
49
50
// SPDX-FileCopyrightText: 2021 Lido <[email protected]>
// SPDX-License-Identifier: GPL-3.0
/* See contracts/COMPILERS.md */
pragma solidity 0.8.9;
import "./OrderedCallbacksArray.sol";
import "./interfaces/IBeaconReportReceiver.sol";
/**
* @title Contract defining an composite post-rebase beacon receiver for the Lido oracle
*
* Contract adds permission modifiers.
* Only the `ORACLE` address can invoke `processLidoOracleReport` function.
*/
contract CompositePostRebaseBeaconReceiver is OrderedCallbacksArray, IBeaconReportReceiver {
address public immutable ORACLE;
modifier onlyOracle() {
require(msg.sender == ORACLE, "MSG_SENDER_MUST_BE_ORACLE");
_;
}
constructor(
address _voting,
address _oracle
) OrderedCallbacksArray(_voting) {
require(_oracle != address(0), "ORACLE_ZERO_ADDRESS");
ORACLE = _oracle;
}
function processLidoOracleReport(
uint256 _postTotalPooledEther,
uint256 _preTotalPooledEther,
uint256 _timeElapsed
) external override onlyOracle {
uint256 callbacksLen = callbacksLength();
for (uint256 brIndex = 0; brIndex < callbacksLen; brIndex++) {
IBeaconReportReceiver(callbacks[brIndex])
.processLidoOracleReport(
_postTotalPooledEther,
_preTotalPooledEther,
_timeElapsed
);
}
}
}