Skip to content
This repository has been archived by the owner on Sep 19, 2024. It is now read-only.

feat: add Sepolia testnet instead of Goerli and add some features for Hardhat deploy in contracts.mdx #149

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 24 additions & 7 deletions docs/zora-network/contracts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ sidebar_position: 5
---

Deploying contracts can be done with familiar EVM tools like [Hardhat](https://hardhat.org/) and [Foundry](https://book.getfoundry.sh/).
Make sure to configure these tools with the correct chain ID and RPC URL to deploy smart contracts to Zora Network Goerli and Zora Network Mainnet. See the [Network Details](/docs/zora-network/network) section for more information.
Make sure to configure these tools with the correct chain ID and RPC URL to deploy smart contracts to Zora Network Sepolia and Zora Network Mainnet. See the [Network Details](/docs/zora-network/network) section for more information.

## Foundry

Expand All @@ -16,10 +16,10 @@ Make sure to configure these tools with the correct chain ID and RPC URL to depl
See the [Foundry](https://book.getfoundry.sh/) documentation to initialize your project with Foundry.

### Deploying
To deploy smart contracts to Zora Network with Foundry, remember to use the --rpc-url and --chain-id flags with the correct values for the Zora network you are deploying to. For example, to deploy to Zora Goerli:
To deploy smart contracts to Zora Network with Foundry, remember to use the --rpc-url and --chain-id flags with the correct values for the Zora network you are deploying to. For example, to deploy to Zora Sepolia:

```bash
forge create src/MyContract.sol:MyContract --chain-id 999 --rpc-url https://testnet.rpc.zora.energy/ --private-key $PRIVATE_KEY
forge create src/MyContract.sol:MyContract --chain-id 999999999 --rpc-url https://sepolia.rpc.zora.energy/ --private-key $PRIVATE_KEY
```

You can use the same flags for more complicated deploy commands, such as with constructor arguments or a deploy script.
Expand All @@ -28,7 +28,7 @@ You can use the same flags for more complicated deploy commands, such as with co
To deploy and verify your contract in one command, use Foundry's verification flags configured with Blockscout and Zora Network's Blockscout API:

```bash
forge create src/MyContract.sol:MyContract --chain-id 999 --rpc-url https://testnet.rpc.zora.energy/ --private-key $PRIVATE_KEY --verify --verifier blockscout --verifier-url https://testnet.explorer.zora.energy/api\?
forge create src/MyContract.sol:MyContract --chain-id 999999999 --rpc-url https://sepolia.rpc.zora.energy/ --private-key $PRIVATE_KEY --verify --verifier blockscout --verifier-url https://sepolia.explorer.zora.energy/api\?
```

You can also verify a pre-existing contract with the `forge verify-contract` command using the same flags (`--verifier` and `--verifier-url`).
Expand Down Expand Up @@ -56,8 +56,8 @@ const config: HardhatUserConfig = {
},
networks: {
// for testnet
'zora-goerli': {
url: 'https://testnet.rpc.zora.energy/',
'zora-sepolia': {
url: 'https://sepolia.rpc.zora.energy/',
accounts: [process.env.WALLET_KEY as string],
},
// for mainnet
Expand All @@ -73,7 +73,24 @@ export default config;
```

### Deploying
Once you've configured your Hardhat project to work with Zora Network, you can proceed with the Hardhat guide to compile, test, and deploy your contracts.
After you've configured your Hardhat project to work with Zora Network, you can compile, test, and deploy your contracts.
#### Compiling your contracts
```bash
npx hardhat compile
```
#### Testing contracts
```bash
npx hardhat test
```
#### Deploying your contracts
For Zora Mainnet:
```bash
npx hardhat run --network zora-mainnet scripts/deploy.js
```
For Zora Sepolia Testnet:
```bash
npx hardhat run --network zora-sepolia scripts/deploy.js
```

### Verifying
Zora Network uses Blockscout for chain exploration and contract verification. See Blockscout's [Hardhat plugin guide](https://docs.blockscout.com/for-users/verifying-a-smart-contract/hardhat-verification-plugin) to verify contracts with Hardhat and Blockscout.