📝 Whitelisting with Remix

What is Remix?
Remix is an open source, online, integrated development environment (IDE) for developing, debugging and deploying smart contracts.
What is this guide for?
To be able to read data from a deployed Beacon, address of the reader (EOA or another contract) must be whitelisted. This guide will walk you through whitelisting a Metamask account on the Mumbai Testnet and reading the data from a Beacon using RemixIDE.
Step 1
- Go to Remix and clone the airnode-protocol-v1 repository.
https://github.com/api3dao/airnode-protocol-v1.git
- Click on
Clone Git Repositorybutton and enter the repository https link to the popped-up text box.
- Once the repository is cloned, the Remix file explorer should look like below.

Step 2
Now, we will connect the Metamask account to Remix, and then connect to
DapiServer.solto try to read the data from the Beacon.Compile the
/airnode-protocol-v1/contracts/dapis/DapiServer.solcontract from theSolidity compilersection.

- Go to the
Deploy & run transactionssection from sidebar. SelectInjected Provider - MetamaskfromENVIRONMENT, selectDapiServerfromCONTRACTand enterDapiServer.sol's address on the Mumbai Testnet next toAt Addressbutton as in the below image and click theAt Addressbutton.
DapiServer.sol's address on the Mumbai Testnet:
0x71Da7A936fCaEd1Ee364Df106B12deF6D1Bf1f14

- After clicking the
At Addressbutton, the contract should be seen in theDeployed Contractssection. - Click on the contract and find the
readDataFeedWithIdfunction. - Enter the
dataFeedIdparameter and click thecallbutton as in the below image.
dataFeedId:
0x0dc124b07cc935112d87b49c806c5c880659dd7a2ef75b4ea04460cf224ea2c0

- Since we didn't whitelist our account yet, we should see the following error message in the Remix console, which indicates that the sender (our account) cannot read the data.
call to DapiServer.readDataFeedWithId errored: Internal JSON-RPC error.
{
"code": 3,
"message": "execution reverted: Sender cannot read",
"data": "0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001253656e6465722063616e6e6f7420726561640000000000000000000000000000"
}
Step 3
- Now clone utility-contracts repository.
https://github.com/api3dao/utility-contracts.git
- Compile
/utility-contracts/SelfServeDapiServerWhitelister/contracts/SelfServeDapiServerWhitelister.sol - Go to
Deploy & run transactions. SelectInjected Provider - MetamaskfromENVIRONMENT, selectSelfServeDapiServerWhitelister.solfromCONTRACTand enterSelfServeDapiServerWhitelister.sol's address on Mumbai Testnet next toAt Addressbutton as in the below image and click theAt Addressbutton.
SelfServeDapiServerWhitelister.sol's address on Mumbai Testnet:
0x78D95f27B068F36Bd4c3f29e424D7072D149DDF3

- After clicking the
At Addressbutton, theSelfServeDapiServerWhitelistercontract should be seen in theDeployed Contractssection. - Click on the contract and find the
allowToReadDataFeedWithIdFor30Daysfunction. - Enter
dataFeedIdandreaderparameters and click thetransactbutton and confirm transaction from Metamask.readeris your Metamask address.

- After the transaction is confirmed, we should see below message on the Remix Console.

Step 4
- Now go back to the
airnode-protocol-v1workspace from Remix.

Again, compile
DapiServer.sol, select the properENVIRONMENT,CONTRACTand enterDapiServer.sol's address on Mumbai Testnet next toAt Addressbutton in theDeploy & run transactionsection and click theAt Addressbutton and click deployed contract.Find the
readDataFeedWithIdfunction, enter thedataFeedIdparameter and clickcall.Since we whitelisted our account, we should see return values in section where we enter parameters as in the below image.

Each value that is written to chain is multiplied by 1018 in this example. Since floating numbers do not exist in Solidity, this solution is required to handle decimal places.