0

Let's say I'm writing an escrow contract. The conditions of this escrow are based on the properties of a second already-deployed contract on Kovan and mainnet. Should I skip testing my escrow contract on Ganache and deploy to Kovan every time I need to test to access the other contract? Or should I somehow find a way to replicate the conditional logic into a contract that I can deploy to Ganache and test against that?

It would be great if I could clone a deployed contract with its current state to my Ganache chain. Is there anything like this?

slider
  • 264
  • 1
  • 5
  • 16

1 Answers1

1

Yes, ganache-cli supports forking public chains. I have never tried this, by it should be possible, see also Want to run a local fork of Ropsten.

Copying only the contract state is also possible in theory. You could try follow the instructions here: https://ethereum.stackexchange.com/a/40280/33305. Forking would be a less error-prone method though I guess.