📂 Functions
# readerCanReadBeacon()
Table of Contents
For on-chain smart contracts, the function
readerCanReadBeacon() (opens new window)
returns true if the reader
parameter can access the beaconId
parameter
meaning that the reader address has been whitelisted. Please contact the
API3 Business Development API Team (opens new window) to be whitelisted.
Calling from off-chain code (using a library such as ether.js
) is not
subject to whitelisting. Off-chain code is beyond the scope of this doc.
# Example Code
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.3;
import "@api3/airnode-protocol/contracts/rrp/requesters/interfaces/IRrpBeaconServer.sol";
contract mySmartContract {
function myVerifyReadable(
address _beaconContractAddress,
bytes32 _beaconId
) external {
bool private canRead;
// Calling the BeaconServer for reader status
// where "this" is the contract address of this contract (myVerifyReadable).
(canRead) =
RrpBeaconServer(_beaconContractAddress).readerCanReadBeacon(_beaconId, address(this));
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# Parameters
readerCanReadBeacon(bytes32 beaconId, address reader)
bytes32 beaconId
- The ID of the beacon.address reader
- The address to verify such as the reader's smart contract address or another address.
# Returns
bool
- Whether the address passed is whitelisted and therefore can read the Beacon ID passed.