How to fetch tokenURI from Polygon smart contract?
How to fetch tokenURI from Polygon smart contract?
Loading saved threads...
Mr. X · External communityPost link
External question — Ethereum Stack Exchange
Author: Mr. X
Original post: https://ethereum.stackexchange.com/questions/122514
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
I am trying to analyse different tokens in terms of the metadata they link to. I found a Polygon-based token project:
https://opensea.io/assets/matic/0x50c2eae4903261b386c27c1733588e867f1a33db/10200
I wanted to check what the metadata of this token looks like and here's the problem. After checking on Polygonscan (
https://polygonscan.com/address/0x50c2eae4903261b386c27c1733588e867f1a33db#code
), the smart contract code needs to be decompiled. However, after decompiling, the tokenURI cannot be found. Somehow OpenSea downloads the image and displays it correctly. How can I then try to manually verify the token metadata and determine e.g. where the graphics are stored? Let's assume we are talking about this token - 10200
Quote
Report
Ismael · External communityPost link
External answer — Ethereum Stack Exchange
Author: Ismael
Original post: https://ethereum.stackexchange.com/a/122724
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
The contract returns true when querying for the ERC721 interface (
EIP 165
"Standard Interface Detection").
Using the standard
EIP-721
you could query the tokenUri for existing events. For example it returns
https://meta.fanadise.com/0x50c2eae4903261b386c27c1733588e867f1a33db/100
for tokenId 100.
Quote
Report
Nikolai Krivenko · External communityPost link
External answer — Ethereum Stack Exchange
Author: Nikolai Krivenko
Original post: https://ethereum.stackexchange.com/a/132022
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
It is not necessary to decompile the smart contract to get the
tokenURI
. You can just load the contract instance in Remix IDE with the correct interface.
Here is one way how to do that:
Create a new workspace from
OpenZeppelin ERC721
template.
Compile the
SampleERC721
contract.
At the
deploy & run transactions
tab
Make sure you connected to the Polygon Mainnet
Select
ERC721
contract
Set
At address
to 0x50c2eae4903261b386c27c1733588e867f1a33db
Then call the
tokenURI
method with needed
tokenId
.
The tokenURI method will return
https://meta.fanadise.com/0x50c2eae4903261b386c27c1733588e867f1a33db/10200
for the tokenId 10200.
Quote
Report
Post Reply
Quoted from Forex.com.bd-Editorial External question — Ethereum Stack Exchange Author: Mr. X Source score (net votes, not local likes): 0 Original post: https://ethereum.stackexchange.com/questions/122514 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. I am trying to analyse different tokens in terms of the metadata they link to. I found a Polygon-based token project: https://opensea.io/assets/matic/0x50c2eae4903261b386c27c1733588e867f1a33db/10200 I wanted to check what the metadata of this token looks like and here's the problem. After checking on Polygonscan ( https://polygonscan.com/address/0x50c2eae4903261b386c27c1733588e867f1a33db#code ), the smart contract code needs to be decompiled. However, after decompiling, the tokenURI cannot be found. Somehow OpenSea downloads the image and displays it correctly. How can I then try to manually verify the token metadata and determine e.g. where the graphics are stored? Let's assume we are talking about this token - 10200
Checking account access…