You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I'm looking into using QRNG along with OpenZepellin's upgradeable contracts, is the provided RrpRequesterV0 contract able to work with upgradeable contracts?
Hey, RrpRequesterV0.sol has an immutable variable, airnodeRrp, which gets initialized in the constructor. Since your upgradeable proxy contract will be using the bytecode of your implementation contract without running the constructor, airnodeRrp will not be initialized as far as your upgradeable proxy contract is concerned. So your upgradeable contract will think that the Airnode RRP contract's address is address(0), which obviously won't work.
You need an upgradeable version of RrpRequesterV0.sol (similar to how OpenZeppelin has upgradeable versions of all of their contracts in https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable). See below, just add this contract in your repo (assuming you have already run npm install @api3/airnode-protocol) and inherit this instead of RrpRequesterV0.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@api3/airnode-protocol/contracts/rrp/interfaces/IAirnodeRrpV0.sol";
/// @title The upgradeable contract to be inherited to make Airnode RRP requests
contract RrpRequesterV0Upgradeable {
// Inline the correct Airnode RRP contract address for the chain below, refer to
// https://github.com/api3dao/airnode/blob/master/packages/airnode-protocol/deployments/references.json
IAirnodeRrpV0 public constant airnodeRrp = 0xa0AD79D995DdeeB18a14eAef56A549A04e3Aa1Bd;
/// @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");
_;
}
}
The text was updated successfully, but these errors were encountered:
See the Discord discussion below
The text was updated successfully, but these errors were encountered: