EACAggregatorProxy Reads: Difference between revisions
From Chainlink Community Wiki
No edit summary |
No edit summary |
||
Line 32: | Line 32: | ||
For example, if the <code>LINK / USD</code> price feed has a decimlas value of <code>8</code>, and the latest round shows a response of <code>726792272</code>, then we would shift the decimal 8 places to end with a value of <code>7.26792272</code>. | For example, if the <code>LINK / USD</code> price feed has a decimlas value of <code>8</code>, and the latest round shows a response of <code>726792272</code>, then we would shift the decimal 8 places to end with a value of <code>7.26792272</code>. | ||
*Example | *Example Request: | ||
**<code>DECIMALS=$(curl -s -H "Content-Type: application/json" https://'''$YOUR_RPC_ENDPOINT''' -d '{"jsonrpc": "2.0", "id": 123, "method": "eth_call", "params":[{"from":null,"to":"0x2c1d072e956AFFC0D435Cb7AC38EF18d24d9127c","data":"0x313ce567"}, "latest"]}' | jq -r .result) && echo "$((DECIMALS))"</code> | **<code>DECIMALS=$(curl -s -H "Content-Type: application/json" https://'''$YOUR_RPC_ENDPOINT''' -d '{"jsonrpc": "2.0", "id": 123, "method": "eth_call", "params":[{"from":null,"to":"0x2c1d072e956AFFC0D435Cb7AC38EF18d24d9127c","data":"0x313ce567"}, "latest"]}' | jq -r .result) && echo "$((DECIMALS))"</code> | ||
*Example Response: | *Example Response: | ||
Line 39: | Line 39: | ||
====='''description'''===== | ====='''description'''===== | ||
The <code>desctiption</code> of the Proxy is just a friendly name, in this case displaying LINK / USD*Example Query: | The <code>desctiption</code> of the Proxy is just a friendly name, in this case displaying LINK / USD*Example Query: | ||
*Example Request: | |||
**<code>DESCRIPTION=$(curl -s -H "Content-Type: application/json" https://'''$YOUR_RPC_ENDPOINT''' -d '{"jsonrpc": "2.0", "id": 123, "method": "eth_call", "params":[{"from":null,"to":"0x2c1d072e956AFFC0D435Cb7AC38EF18d24d9127c","data":"0x7284e416"}, "latest"]}' | jq -r .result) && echo $DESCRIPTION | xxd -r -p</code> | **<code>DESCRIPTION=$(curl -s -H "Content-Type: application/json" https://'''$YOUR_RPC_ENDPOINT''' -d '{"jsonrpc": "2.0", "id": 123, "method": "eth_call", "params":[{"from":null,"to":"0x2c1d072e956AFFC0D435Cb7AC38EF18d24d9127c","data":"0x7284e416"}, "latest"]}' | jq -r .result) && echo $DESCRIPTION | xxd -r -p</code> | ||
Line 46: | Line 47: | ||
===== '''getAnswer'''===== | ===== '''getAnswer'''===== | ||
This call will provide you with the data for the round you have specified. | This call will provide you with the data for the round you have specified. | ||
*Example | *Example Request: | ||
**<code>GET_ANSWER=$(curl -s -H "Content-Type: application/json" https://'''$YOUR_RPC_ENDPOINT''' -d '{"jsonrpc": "2.0", "id": 123, "method": "eth_call", "params":[{"from":null,"to":"0x2c1d072e956AFFC0D435Cb7AC38EF18d24d9127c","data":"0xb5ab58dc000000000000000000000000000000000000000000000005000000000000347a"}, "latest"]}' | jq -r .result) && echo "$((GET_ANSWER))"</code> | **<code>GET_ANSWER=$(curl -s -H "Content-Type: application/json" https://'''$YOUR_RPC_ENDPOINT''' -d '{"jsonrpc": "2.0", "id": 123, "method": "eth_call", "params":[{"from":null,"to":"0x2c1d072e956AFFC0D435Cb7AC38EF18d24d9127c","data":"0xb5ab58dc000000000000000000000000000000000000000000000005000000000000347a"}, "latest"]}' | jq -r .result) && echo "$((GET_ANSWER))"</code> | ||
*Example Response | *Example Response | ||
Line 53: | Line 54: | ||
====='''getRoundData'''===== | ====='''getRoundData'''===== | ||
Similar to the above <code>getAnswer</code> call, this call will get additional information from the round you have specified.*Example Query: | Similar to the above <code>getAnswer</code> call, this call will get additional information from the round you have specified.*Example Query: | ||
*Example Request | |||
**<code>curl</code> | **<code>curl</code> | ||
*Example Response | *Example Response | ||
Line 59: | Line 61: | ||
====='''getTimestamp'''===== | ====='''getTimestamp'''===== | ||
This <code>getTimestamp</code> call will provide you with the timestamp of the block containing the data from the round you have specified. | This <code>getTimestamp</code> call will provide you with the timestamp of the block containing the data from the round you have specified. | ||
*Example | *Example Request: | ||
**<code>curl</code> | **<code>curl</code> | ||
*Example Response | *Example Response | ||
Line 65: | Line 67: | ||
====='''latestAnswer'''===== | ====='''latestAnswer'''===== | ||
The <code>latestAnswer</code> call provides you with the value that was written to chain during the most recent completed round | The <code>latestAnswer</code> call provides you with the value that was written to chain during the most recent completed round | ||
*Example | *Example Request: | ||
**<code>curl</code> | |||
*Example Response | *Example Response | ||
**asdf | **asdf | ||
====='''latestRound''' ===== | ====='''latestRound''' ===== | ||
This call will provide you with the most recent completed round number. | This call will provide you with the most recent completed round number. | ||
*Example | *Example Request: | ||
**<code>curl</code> | **<code>curl</code> | ||
*Example Response | *Example Response | ||
Line 76: | Line 79: | ||
====='''latestRoundData'''===== | ====='''latestRoundData'''===== | ||
This call is similar to <code>getRoundData</code>, but it will automatically get the round data for the most recently completed round. | This call is similar to <code>getRoundData</code>, but it will automatically get the round data for the most recently completed round. | ||
*Example | *Example Request: | ||
**<code>curl</code> | **<code>curl</code> | ||
*Example Response | *Example Response | ||
Line 82: | Line 85: | ||
====='''latestTimestamp'''===== | ====='''latestTimestamp'''===== | ||
Similar to <code>latestRoundData</code> and <code>getTimestamp</code>, the <code>latestTimestamp</code> call will provide you with the timestamp of the block containing the response from the latest completed round. | Similar to <code>latestRoundData</code> and <code>getTimestamp</code>, the <code>latestTimestamp</code> call will provide you with the timestamp of the block containing the response from the latest completed round. | ||
*Example | *Example Request: | ||
**<code>curl</code> | **<code>curl</code> | ||
*Example Response | *Example Response | ||
Line 88: | Line 91: | ||
====='''owner'''===== | ====='''owner'''===== | ||
The owner query will respond with the address that has ownership of the contract you query. | The owner query will respond with the address that has ownership of the contract you query. | ||
*Example | *Example Request: | ||
**<code>curl</code> | **<code>curl</code> | ||
*Example Response | *Example Response | ||
Line 96: | Line 99: | ||
====='''proposedAggregator'''===== | ====='''proposedAggregator'''===== | ||
The <code>proposedAggregator</code> query will give you the address of the proposed aggregator, if there is one. | The <code>proposedAggregator</code> query will give you the address of the proposed aggregator, if there is one. | ||
*Example | *Example Request: | ||
**<code>curl</code> | **<code>curl</code> | ||
*Example Response | *Example Response | ||
Line 102: | Line 105: | ||
====='''proposedGetRoundData'''===== | ====='''proposedGetRoundData'''===== | ||
This call provides you with the round data for the requested round from the proposed aggregator, if there is one. | This call provides you with the round data for the requested round from the proposed aggregator, if there is one. | ||
*Example | *Example Request: | ||
**<code>curl</code> | **<code>curl</code> | ||
*Example Response | *Example Response | ||
Line 108: | Line 111: | ||
====='''proposedLatestRoundData'''===== | ====='''proposedLatestRoundData'''===== | ||
Similar to the above, this call will get you the data from the latest round of the proposed aggregator. | Similar to the above, this call will get you the data from the latest round of the proposed aggregator. | ||
*Example | *Example Request: | ||
**<code>curl</code> | **<code>curl</code> | ||
*Example Response | *Example Response | ||
Line 114: | Line 117: | ||
====='''version'''===== | ====='''version'''===== | ||
This gets you the version of the contract you're querying. | This gets you the version of the contract you're querying. | ||
*Example | *Example Request: | ||
**<code>curl</code> | **<code>curl</code> | ||
*Example Response | *Example Response | ||
**asdf | **asdf |
Revision as of 14:16, 24 May 2022
EACAggregatorProxy
LINK / USD EAC AggregatorProxy contract address: 0x2c1d072e956affc0d435cb7ac38ef18d24d9127c
The Access Controlled Aggregator Proxy is a proxy contract that enables the owner to point it to other contracts as needed/desired.
This prevents the users from having to update anything if they wanted to move to a new contract version/release
Read Calls
This page contains all of the read calls you can make to the EACAggregatorProxy contracts.
If you'd like to check out the write calls, please check the EACAggregatorProxy_Writes page.
accessController
The accessController
is a smart contract that acts as a whitelist for which addresses are able to call the contract. For the LINK / USD price feed, the referenced accessController
smart contract is a null value set to 0x0000000000000000000000000000000000000000
- Example Query:
ACCESS_CONTROLLER=$(curl -s -H "Content-Type: application/json" https://$YOUR_RPC_ENDPOINT -d '{"jsonrpc": "2.0", "id": 123, "method": "eth_call", "params":[{"from":null,"to":"0x2c1d072e956AFFC0D435Cb7AC38EF18d24d9127c","data":"0xbc43cbaf"}, "latest"]}' | jq -r .result) && echo "$ACCESS_CONTROLLER"
- Example Response:
0x0000000000000000000000000000000000000000000000000000000000000000
- (remove leading 24
0
's)
- (remove leading 24
aggregator
The aggregator
is the on-chain contract that each of the Chainlink Nodes responds to. The AggregatorProxy
contract points to the configured Aggregator as it's primary source of information
- Example Query:
AGGREGATOR=$(curl -s -H "Content-Type: application/json" https://$YOUR_RPC_ENDPOINT -d '{"jsonrpc": "2.0", "id": 123, "method": "eth_call", "params":[{"from":null,"to":"0x2c1d072e956AFFC0D435Cb7AC38EF18d24d9127c","data":"0x245a7bfc"}, "latest"]}' | jq -r .result) && echo "$AGGREGATOR"
- Example Response:
0x000000000000000000000000dfd03bfc3465107ce570a0397b247f546a42d0fa
- (remove leading 24
0
's)
- (remove leading 24
decimals
The decimals
value tells the reader of the contract how many decimal places they need to adjust to get the proper value.
For example, if the LINK / USD
price feed has a decimlas value of 8
, and the latest round shows a response of 726792272
, then we would shift the decimal 8 places to end with a value of 7.26792272
.
- Example Request:
DECIMALS=$(curl -s -H "Content-Type: application/json" https://$YOUR_RPC_ENDPOINT -d '{"jsonrpc": "2.0", "id": 123, "method": "eth_call", "params":[{"from":null,"to":"0x2c1d072e956AFFC0D435Cb7AC38EF18d24d9127c","data":"0x313ce567"}, "latest"]}' | jq -r .result) && echo "$((DECIMALS))"
- Example Response:
8
description
The desctiption
of the Proxy is just a friendly name, in this case displaying LINK / USD*Example Query:
- Example Request:
DESCRIPTION=$(curl -s -H "Content-Type: application/json" https://$YOUR_RPC_ENDPOINT -d '{"jsonrpc": "2.0", "id": 123, "method": "eth_call", "params":[{"from":null,"to":"0x2c1d072e956AFFC0D435Cb7AC38EF18d24d9127c","data":"0x7284e416"}, "latest"]}' | jq -r .result) && echo $DESCRIPTION | xxd -r -p
- Example Response:
LINK / USD
getAnswer
This call will provide you with the data for the round you have specified.
- Example Request:
GET_ANSWER=$(curl -s -H "Content-Type: application/json" https://$YOUR_RPC_ENDPOINT -d '{"jsonrpc": "2.0", "id": 123, "method": "eth_call", "params":[{"from":null,"to":"0x2c1d072e956AFFC0D435Cb7AC38EF18d24d9127c","data":"0xb5ab58dc000000000000000000000000000000000000000000000005000000000000347a"}, "latest"]}' | jq -r .result) && echo "$((GET_ANSWER))"
- Example Response
726792272
getRoundData
Similar to the above getAnswer
call, this call will get additional information from the round you have specified.*Example Query:
- Example Request
curl
- Example Response
- asdf
getTimestamp
This getTimestamp
call will provide you with the timestamp of the block containing the data from the round you have specified.
- Example Request:
curl
- Example Response
- asdf
latestAnswer
The latestAnswer
call provides you with the value that was written to chain during the most recent completed round
- Example Request:
curl
- Example Response
- asdf
latestRound
This call will provide you with the most recent completed round number.
- Example Request:
curl
- Example Response
- asdf
latestRoundData
This call is similar to getRoundData
, but it will automatically get the round data for the most recently completed round.
- Example Request:
curl
- Example Response
- asdf
latestTimestamp
Similar to latestRoundData
and getTimestamp
, the latestTimestamp
call will provide you with the timestamp of the block containing the response from the latest completed round.
- Example Request:
curl
- Example Response
- asdf
owner
The owner query will respond with the address that has ownership of the contract you query.
- Example Request:
curl
- Example Response
- asdf
phaseAggregators
phaseId
proposedAggregator
The proposedAggregator
query will give you the address of the proposed aggregator, if there is one.
- Example Request:
curl
- Example Response
- asdf
proposedGetRoundData
This call provides you with the round data for the requested round from the proposed aggregator, if there is one.
- Example Request:
curl
- Example Response
- asdf
proposedLatestRoundData
Similar to the above, this call will get you the data from the latest round of the proposed aggregator.
- Example Request:
curl
- Example Response
- asdf
version
This gets you the version of the contract you're querying.
- Example Request:
curl
- Example Response
- asdf