Skip to content

Trying to read token (or data) URI on-chain - but execution reverted (out of gas?) #689

Discussion options

You must be logged in to vote

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.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@kokako-loon
Comment options

Answer selected by davidbrai
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants