Trying to read token (or data) URI on-chain - but execution reverted (out of gas?) #689
-
Hi, I'm having fun getting my head around the Nouns codebase, great project! But running into an issue when I try and query token URIs to see the raw base64 data URI. I'm using the tokenURI and dataURI read functions from the NounsToken contract, with any valid tokenID (https://etherscan.io/address/0x9C8fF314C9Bc7F6e59A9d9225Fb22946427eDC03#readContract) However, I get an Let me know if I can provide more info! The reason I'm trying to get at this, is that I want to fork Nouns but substantially change the art, which I'll do in the NounsDescriptor.sol and V2 contracts. However, I want to actually see if my art renders correctly - hence why I want to get a simple system to query token URIs for testing purposes. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Any dev here? while every bluechips PFP support get image url from tokenURI in ERC721, nouns does not, would be happy to help to fix it. |
Beta Was this translation helpful? Give feedback.
-
Etherscan reverts because it limits the amount of gas it allows a read function to consume. You can also run it in your terminal by running: Running locally on hardhat you need to make sure to set |
Beta Was this translation helpful? Give feedback.
Etherscan reverts because it limits the amount of gas it allows a read function to consume.
You can use abi.ninja for example, I just tried it and it works for me.
You can also run it in your terminal by running:
cast call 0x9C8fF314C9Bc7F6e59A9d9225Fb22946427eDC03 'tokenURI(uint) returns (string)' 0 --rpc-url $RPC_MAINNET
Running locally on hardhat you need to make sure to set
blockGasLimit
to a high enough value. But running this in hardhat will anyway be very slow because hardhat is very slow at running the decompression code.When testing locally I suggest deploying to contracts to an anvil node.