Row 8644
Content Data
This page contains data entry 8644 from the Axioma AXP content repository. The structured data below represents the complete record for this entry.
this question is old but still totally relevant and since none of these comments give a good answer, i will give you one:
You have several avenues you can pursue and it depends on if you're trying to find a price through code of doing it manually. If you're not trying to do it through code, you can go to the chainlink website and see if they have a deployed price feed for the token you want to price. If they do, call that contract directly with the function latestAnswer() at whatever block you want. For example, you can send an HTTP POST request to your full node with data like this:
{"id":1,"jsonrpc":"2.0","method":"eth\_call","params":\[{"data":"0x50d25bcd","to":"0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419"},"0x1223140"\]}
That represents calling the chainlink ETH/USD contract (0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419) and invoking method "latestAnswer()" (0x50d25bcd) at block 19018047 (0x1223140).
The problem is more difficult if you're doing it through code and therefore don't know what coins you'll have to price and can't go searching chainlink for oracles. In that case, the easiest is to find a deployed price oracle that will give a price feed on any coin. For example, the YFI oracle is deployed at address
0x83d95e0d5f402511db06817aff3f9ea88224b030
and to get a price back you encode your function call as
"0x482ba306000000000000000000000000" + coinOfInterestContractAddress
(don't forget to strip the "0x" from the address of the coin before concatenating into the function encoding)
Another example, the 1inch spot price aggregators:
0x07d91f5fb9bf7798734c3f606db065549f6893bb
0x52cbe0f49ccdd4dc6e9c13bab024eabd2842045b
0x0addd25a91563696d8567df78d5a01c9a991f9b8
1 inch has deployed 3 and you should use whichever one was most recently deployed before the block at which you need to know a token value. The function encoding for the 1 inch SPAs is
"0x7de4fd10000000000000000000000000" + coinOfInterestContractAddress + "0000000000000000000000000000000000000000000000000000000000000001"
Look at the documentation for both of these if you want to use them because one returns price in eth and one returns price in USD. There are also many other price oracles already deployed on the blockchain, but you'll have to google around to find them.
| Field | Value |
|---|---|
| text | this question is old but still totally relevant and since none of these comments give a good answer, i will give you one: You have several avenues you can pursue and it depends on if you're trying to find a price through code of doing it manually. If you're not trying to do it through code, you can go to the chainlink website and see if they have a deployed price feed for the token you want to price. If they do, call that contract directly with the function latestAnswer() at whatever block you … |
| label | r/ethereum |
| dataType | comment |
| communityName | r/ethereum |
| datetime | 2024-05-19 |
| username_encoded | Z0FBQUFBQm5Lakw0TDhMbXEyZFNxSHpKamFYV1oyQXdwNk0zZkI4bjN3RGg5UEFYQUotVUxGU2VnWGdINVZXYWZJTVJlRjROVlgzWXF1SDBzZTlWYmtmMEl2aV8xbjFGUk1sbmM1RUNKOG9mVG1GRGV3dGtLeUU9 |
| url_encoded | Z0FBQUFBQm5Lak9Ibno4SW9qczVGSURRSm9kTGJ0S3VhNXFOUEFxTlRKNWtLb1JPdXRiajRTa0pfejBSMFBLeW82bjdtMXA5TnI3SHBTdjVrWnZNT0FPa0V4QmhDa0oteng0MU5NZlg1Q2FabFJGM0F4N1NFeDRQb0ctM09oYjdkbV9adkluaVRGU1NPTHcxTk9oTlV1dDJjaDhFTWVVQ0d3UTcxUmtzanBHOVdtOVBWcGZwNGEzSjNZOTBtXzdKWWtHdkpTc0VneDFGZDkyUWNsNC1LZmFFd0ZUZ3pJOEt0dz09 |
Raw Record
{
"text": "this question is old but still totally relevant and since none of these comments give a good answer, i will give you one:\n\nYou have several avenues you can pursue and it depends on if you're trying to find a price through code of doing it manually. If you're not trying to do it through code, you can go to the chainlink website and see if they have a deployed price feed for the token you want to price. If they do, call that contract directly with the function latestAnswer() at whatever block you want. For example, you can send an HTTP POST request to your full node with data like this: \n\n{\"id\":1,\"jsonrpc\":\"2.0\",\"method\":\"eth\\_call\",\"params\":\\[{\"data\":\"0x50d25bcd\",\"to\":\"0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419\"},\"0x1223140\"\\]}\n\nThat represents calling the chainlink ETH/USD contract (0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419) and invoking method \"latestAnswer()\" (0x50d25bcd) at block 19018047 (0x1223140). \n\n \nThe problem is more difficult if you're doing it through code and therefore don't know what coins you'll have to price and can't go searching chainlink for oracles. In that case, the easiest is to find a deployed price oracle that will give a price feed on any coin. For example, the YFI oracle is deployed at address\n\n 0x83d95e0d5f402511db06817aff3f9ea88224b030\n\nand to get a price back you encode your function call as \n\n \"0x482ba306000000000000000000000000\" + coinOfInterestContractAddress\n\n(don't forget to strip the \"0x\" from the address of the coin before concatenating into the function encoding)\n\n\n\nAnother example, the 1inch spot price aggregators:\n\n 0x07d91f5fb9bf7798734c3f606db065549f6893bb\n\n 0x52cbe0f49ccdd4dc6e9c13bab024eabd2842045b\n\n 0x0addd25a91563696d8567df78d5a01c9a991f9b8\n\n \n1 inch has deployed 3 and you should use whichever one was most recently deployed before the block at which you need to know a token value. The function encoding for the 1 inch SPAs is \n\n \"0x7de4fd10000000000000000000000000\" + coinOfInterestContractAddress +\n \"0000000000000000000000000000000000000000000000000000000000000001\"\n\nLook at the documentation for both of these if you want to use them because one returns price in eth and one returns price in USD. There are also many other price oracles already deployed on the blockchain, but you'll have to google around to find them.",
"label": "r/ethereum",
"dataType": "comment",
"communityName": "r/ethereum",
"datetime": "2024-05-19",
"username_encoded": "Z0FBQUFBQm5Lakw0TDhMbXEyZFNxSHpKamFYV1oyQXdwNk0zZkI4bjN3RGg5UEFYQUotVUxGU2VnWGdINVZXYWZJTVJlRjROVlgzWXF1SDBzZTlWYmtmMEl2aV8xbjFGUk1sbmM1RUNKOG9mVG1GRGV3dGtLeUU9",
"url_encoded": "Z0FBQUFBQm5Lak9Ibno4SW9qczVGSURRSm9kTGJ0S3VhNXFOUEFxTlRKNWtLb1JPdXRiajRTa0pfejBSMFBLeW82bjdtMXA5TnI3SHBTdjVrWnZNT0FPa0V4QmhDa0oteng0MU5NZlg1Q2FabFJGM0F4N1NFeDRQb0ctM09oYjdkbV9adkluaVRGU1NPTHcxTk9oTlV1dDJjaDhFTWVVQ0d3UTcxUmtzanBHOVdtOVBWcGZwNGEzSjNZOTBtXzdKWWtHdkpTc0VneDFGZDkyUWNsNC1LZmFFd0ZUZ3pJOEt0dz09"
}
Entry Information
- Entry ID: 8644
- Repository: Axioma AXP
- Dataset: arrmlet/reddit_dataset_36
- Total Entries: 100,000