Skip to content

Commit

Permalink
chore: setup mainnet deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
0xApotheosis committed Sep 16, 2024
1 parent a75354e commit ffc1687
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
RPC_URL="https://mainnet.infura.io/v3/some-key"
PRIVATE_KEY="super-secret-key"
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,19 @@ Test: `npx hardhat test`

## Deploy with Ignition

`npx hardhat ignition deploy ignition/modules/StakingRewards.ts`
### Mainnet

First configure the .env file with valid RPC_URL and PRIVATE_KEY values.

Visualize the deployment plan: `npx hardhat ignition visualize ignition/modules/StakingRewards.ts --network mainnet`

Deploy the contract: `npx hardhat ignition deploy ignition/modules/StakingRewards.ts --network mainnet`

### Local

Start the local hardhat node: `npx hardhat node`

Deploy the contract: `npx hardhat ignition deploy ignition/modules/StakingRewards.ts --network localhost`

### Deployment notes

Expand Down
18 changes: 18 additions & 0 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,25 @@
import type { HardhatUserConfig } from 'hardhat/config';
import '@nomicfoundation/hardhat-toolbox-viem';
import * as dotenv from 'dotenv';

dotenv.config();

const config: HardhatUserConfig = {
networks: {
localhost: {
url: 'http://127.0.0.1:8545',
},
// Mainnet configuration (only used if INFURA_API_KEY and PRIVATE_KEY are set)
// Let's us still test locally without setting up mainnet
...(process.env.INFURA_API_KEY && process.env.PRIVATE_KEY
? {
mainnet: {
url: `https://mainnet.infura.io/v3/${process.env.INFURA_API_KEY}`,
accounts: [process.env.PRIVATE_KEY],
},
}
: {}),
},
solidity: {
compilers: [
{
Expand Down

0 comments on commit ffc1687

Please sign in to comment.