/
RrpRequesterV0.sol
27 lines (23 loc) · 1.04 KB
/
RrpRequesterV0.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
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../interfaces/IAirnodeRrpV0.sol";
/// @title The contract to be inherited to make Airnode RRP requests
contract RrpRequesterV0 {
IAirnodeRrpV0 public immutable airnodeRrp;
/// @dev Reverts if the caller is not the Airnode RRP contract.
/// Use it as a modifier for fulfill and error callback methods, but also
/// check `requestId`.
modifier onlyAirnodeRrp() {
require(msg.sender == address(airnodeRrp), "Caller not Airnode RRP");
_;
}
/// @dev Airnode RRP address is set at deployment and is immutable.
/// RrpRequester is made its own sponsor by default. RrpRequester can also
/// be sponsored by others and use these sponsorships while making
/// requests, i.e., using this default sponsorship is optional.
/// @param _airnodeRrp Airnode RRP contract address
constructor(address _airnodeRrp) {
airnodeRrp = IAirnodeRrpV0(_airnodeRrp);
IAirnodeRrpV0(_airnodeRrp).setSponsorshipStatus(address(this), true);
}
}