👩🔬 Deploying Your Contracts
Once you are ready to deploy your contracts to a testnet or mainnet there are a few things you need to adjust.
You can change the
Scaffold-eth already comes with a preset of networks to choose from but you can also add your own if it's missing from the networks list.
The deployer account is the account that will run the deploy scripts, so it's the one that will actually deploy your contracts and execute any further calls you make in your deployment script. I.E: it will end up being the owner of the contracts you deploy if there's such a construct in your contracts.
If your contract implements
Ownableyou can change the ownership of the contract from your `deployer` to your preferred account by uncommenting and adding your address to
In order to change your deployer account, you can run
yarn generatewhich will create a seed phrase for you. You should see the following output:
And the mnemonic.txt file that contains the seed phrase for the account that was created.
You can run
yarn accountto see details of this account like eth balances across different networks.
Once you have your account loaded up, you will need to fund it to pay for the gas costs associated with deploying the contracts and executing any other deployment functions you have in your scripts.
When you run
yarn deploy, the scripts in
/packages/hardhat/deployare run in alphabetical order (by default - more fine-grained controls in the hardhat-deploy docs). You can deploy contracts, interact with contracts & send ETH - whatever you want!
Deployment metadata is stored in the
/deploymentsfolder, and automatically copied to
--export-allflag in the
yarn deploycommand (see
Crucially, this information is stored by network id, so if you redeploy contracts on a new network (e.g. on testnet, after running locally), your local deployments are still tracked.