0

I am writing a smart contract that uses the CryptoPunks data smart contract.

This contract has a public read function punkImageSvg() that returns a string with the SVG of the punk in question. The data to generate these SVGs is not stored in the contract source, but was rather added to storage post-deploy.

My question is how I can call punkImageSvg() in a testing environment. On my local machine this is easy as I just fork mainnet with Hardhat. However, I cannot fork mainnet when I deploy to Rinkeby.

I could create my own CryptoPunkData contract on Rinkeby, but then I would have to populate it with Punk Data. However, I don’t know how to extract the data on the mainnet version and run it programmatically on the Rinkeby version. This approach would also take a lot of time as there are 10,000 Punks.

Of course the ideal solution would be if there is already a fully-populated Punk Data contract deployed to Rinkeby but if there is I cannot find one.

Overall looking for the best approach to using mainnet data on Rinkeby in a similar way that I use mainnet data locally via forking.

2 Answers 2

1

You can't do it via rinkeby, but you can do it on your own local chain using the mainnet forking tools like hardhat has: https://hardhat.org/hardhat-network/guides/mainnet-forking.html

2
  • The Hardhat forking works great, but some things are impossible to test locally like whether OpenSea correctly displays my NFT so I am not sure I can go straight from local development to mainnet deployment. Do you know of any way to download all the transactions to a contract and then "play them back" on another? That would solve this problem. I can use Etherscan but it won't give me transaction payloads in bulk.
    – Tom
    Feb 9, 2022 at 17:30
  • I think for that, you might be better off just spinning up openSea locally and pointing it to your localhost if you can...(I'd at least ask them if you can do that)
    – thefett
    Feb 10, 2022 at 18:50
0

For CryptoPunks Data specifically, I have created a Rinkeby contract mirror here: https://rinkeby.etherscan.io/address/0xE1D8e86D222b8C0E479Eb9ee3d89415123Ac6387

1
  • As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Mar 21, 2022 at 10:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.