Ganache fork polygon doesn't give the right balanceOf result #3837
-
Hello, I tried to fork a polygon mainnet at block number: 34581439. the cmd is as follows: after the local ganache fork is running, i tried to access a aave atoken balance:
Anyone can point me to the right direction why this happens? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 15 replies
-
What version of ganache are you using? |
Beta Was this translation helpful? Give feedback.
-
@lingmicha I think @davidmurdoch and I figured this one out. In our testing, we were both consistently receiving different results. Then we realized, geographically we are in different locations. When we double checked our timestamps, they were the same. However, because we reside in different geographic locations, those timestamps meant different things to our system time. When we passed in a timezone with the date param, our results were consistently the same.
Try to pass the following command to start ganache:
There is one small difference in this command from your previous commands:
The Give this a shot and let us know how it goes. Edit: Oh, I also ran into the error you shared. When I was swapping API keys david pointed out I forgot to include the block number. Starting without the block number after previous testing caused this error. STR: ganache-cli --chain.vmErrorsOnRPCResponse true --server.port 19998 --fork.url https://polygon-mainnet.g.alchemy.com/v2/[YOUR KEY HERE]@34581439 --hardfork london --chain.time 2022-10-20T14:51:49Z --miner.timestampIncrement 1 curl -H "Content-Type: application/json" -X POST --data '{"id":1337,"jsonrpc":"2.0","method":"eth_call","params":[{"from":null, "to":"0x82e64f49ed5ec1bc6e43dad4fc8af9bb3a2312ee","data":"0x70a082310000000000000000000000005b8effbdae5941b938c1a79616d185cc3c79d4ff" }]}' http://localhost:19998
{"id":1337,"jsonrpc":"2.0","result":"0x000000000000000000000000000000000000000000003099077d1b17613b7dcd"}% |
Beta Was this translation helpful? Give feedback.
@lingmicha I think @davidmurdoch and I figured this one out.
In our testing, we were both consistently receiving different results. Then we realized, geographically we are in different locations. When we double checked our timestamps, they were the same. However, because we reside in different geographic locations, those timestamps meant different things to our system time. When we passed in a timezone with the date param, our results were consistently the same.
Try to pass the following command to start ganache: