Closed jahvi closed 1 year ago
I think the issue is that npx hardhat node --fork MY_MUMBAI_RPC
you are using different accounts and so deployer
has a different value, which result in different bytes when deploying, which in turn result in a different contract address
@wighawag I see, I added a console.log to my deployments and I can confirm the local deployment is using the first node address and my manual deployments are using the one I set the private key of.
I tried adding this to my hardhat config:
networks: {
localhost: {
accounts: [PRIVATE_KEY!],
},
//...
},
But my localhost deployments still didn't pick it up. What's the correct way to do it?
I managed to make it work like this, thanks for pointing me in the right direction:
hardhat: {
accounts: [
{
privateKey: PRIVATE_KEY!,
balance: '10000000000000000000000',
},
],
},
// ...
Describe the bug When I use the
deterministicDeployment
option to deploy my contract using a custom salt it creates the contract in my local node with the expected address, however when I deploy to a real network (mumbai, homestead, matic, etc) it creates it with a different address.To Reproduce
Consider this contract:
And the following deploy script:
hardhat.config:
When running
npx hardhat node --fork MY_MUMBAI_RPC
it auto-deploys and logs the following:Which is the expected address.
However when running
npx hardhat deploy --network mumbai
, it shows:Which is incorrect.
Expected behavior The contract address should be the same in both localhost and mumbai.
versions