export default App;
## Deploying to Optimism
### Connecting to the Optimism Network
1. Configure your Hardhat project to connect to the Optimism network.
2. Update your `hardhat.config.js` file with the necessary Optimism-specific settings.
```javascript
// hardhat.config.js
require('@eth-optimism/plugins/hardhat/compiler');
require('@eth-optimism/plugins/hardhat/ethers');
module.exports = {
solidity: '0.8.0',
networks: {
optimism: {
url: 'https://mainnet.optimism.io',
accounts: ['0x...'], // your private key
},
},
};
hardhat run scripts/deploy.js --network optimism.// scripts/deploy.js
const { ethers } = require('ethers');
async function main() {
const [deployer] = await ethers.getSigners();
console.log('Deploying contracts with the account:', deployer.address);
const MyContract = await ethers.getContractFactory('MyContract');
const myContract = await MyContract.deploy();
console.log('MyContract deployed to:', myContract.address);
}
main()
.then(() => process.exit(0))
.catch((error) =>