Skip to content

Commit 2703f2c

Browse files
This works for deployment but not verification
1 parent 269d4e9 commit 2703f2c

File tree

1 file changed

+64
-20
lines changed

1 file changed

+64
-20
lines changed

docs/tutorials/marketpulse/deploy.md

Lines changed: 64 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
---
22
title: Deploy the contract
33
dependencies:
4-
viem: 0
4+
dependencies:
5+
viem: 2.41.2
6+
hardhat: 3.0.17
57
---
68

79
Deploy the contract locally is fine for doing simple tests, but we recommend to target the Etherlink Testnet to run complete scenarios as you may depend on other services like block explorers, oracles, etc.
@@ -11,7 +13,7 @@ Deploy the contract locally is fine for doing simple tests, but we recommend to
1113
1. Prepare a module for the ignition plugin of Hardhat. The module is used as the default script for deployment. Rename the default file first:
1214

1315
```bash
14-
mv ./ignition/modules/Lock.ts ./ignition/modules/Marketpulse.ts
16+
mv ./ignition/modules/Counter.ts ./ignition/modules/Marketpulse.ts
1517
```
1618

1719
1. Replace the contents of the file with this code:
@@ -49,28 +51,75 @@ Deploy the contract locally is fine for doing simple tests, but we recommend to
4951
5052
You can deploy the contract to any local Ethereum node but Etherlink is a good choice because it is persistent and free and most tools and indexers are already deployed on it.
5153
54+
The response looks like this:
55+
56+
```
57+
Hardhat Ignition 🚀
58+
59+
Deploying [ MarketpulseModule ]
60+
61+
Batch #1
62+
Executed MarketpulseModule#Marketpulse
63+
64+
Batch #2
65+
Executed MarketpulseModule#Marketpulse.ping
66+
67+
[ MarketpulseModule ] successfully deployed 🚀
68+
69+
Deployed Addresses
70+
71+
MarketpulseModule#Marketpulse - 0x5FbDB2315678afecb367f032d93F642f64180aa3
72+
```
73+
5274
1. Check that your deployment logs do not contain any error and stop the Hardhat node.
5375
5476
1. Deploy the contract on Etherlink Shadownet Testnet:
5577
56-
1. In the Hardhat configuration file `hardhat.config.ts`, add Etherlink Mainnet and Shadownet Testnet as custom networks:
78+
1. In the Hardhat configuration file `hardhat.config.ts`, add Etherlink Mainnet and Shadownet Testnet as custom networks by replacing the default file with this code:
5779
5880
```TypeScript
59-
import "@nomicfoundation/hardhat-toolbox-viem";
60-
import "@nomicfoundation/hardhat-verify";
61-
import type { HardhatUserConfig } from "hardhat/config";
62-
import { vars } from "hardhat/config";
81+
import hardhatToolboxViemPlugin from "@nomicfoundation/hardhat-toolbox-viem";
82+
import { configVariable, defineConfig } from "hardhat/config";
6383
64-
if (!vars.has("DEPLOYER_PRIVATE_KEY")) {
84+
if (!configVariable("DEPLOYER_PRIVATE_KEY")) {
6585
console.error("Missing env var DEPLOYER_PRIVATE_KEY");
6686
}
6787
68-
const deployerPrivateKey = vars.get("DEPLOYER_PRIVATE_KEY");
69-
70-
const config: HardhatUserConfig = {
71-
solidity: "0.8.24",
88+
const deployerPrivateKey = configVariable("DEPLOYER_PRIVATE_KEY");
7289
90+
export default defineConfig({
91+
plugins: [hardhatToolboxViemPlugin],
92+
solidity: {
93+
profiles: {
94+
default: {
95+
version: "0.8.28",
96+
},
97+
production: {
98+
version: "0.8.28",
99+
settings: {
100+
optimizer: {
101+
enabled: true,
102+
runs: 200,
103+
},
104+
},
105+
},
106+
},
107+
},
73108
networks: {
109+
hardhatMainnet: {
110+
type: "edr-simulated",
111+
chainType: "l1",
112+
},
113+
hardhatOp: {
114+
type: "edr-simulated",
115+
chainType: "op",
116+
},
117+
sepolia: {
118+
type: "http",
119+
chainType: "l1",
120+
url: configVariable("SEPOLIA_RPC_URL"),
121+
accounts: [configVariable("SEPOLIA_PRIVATE_KEY")],
122+
},
74123
etherlinkMainnet: {
75124
url: "https://node.mainnet.etherlink.com",
76125
accounts: [deployerPrivateKey],
@@ -104,23 +153,19 @@ Deploy the contract locally is fine for doing simple tests, but we recommend to
104153
},
105154
],
106155
}
107-
};
108-
109-
export default config;
156+
});
110157
```
111158
112159
1. Set up an Etherlink Shadownet Testnet account with some native tokens to deploy the contract. See [Using your wallet](/get-started/using-your-wallet) connect your wallet to Etherlink. Then use the faucet to get XTZ tokens on Etherlink Shadownet Testnet, as described in [Getting testnet tokens](/get-started/getting-testnet-tokens).
113160
114161
1. Export your account private key from your wallet application.
115162
116-
1. Set the private key as the value of the `DEPLOYER_PRIVATE_KEY` environment variable by running this command:
163+
1. Set the private key (represented in this example as `<YOUR_ETHERLINK_KEY>`) as the value of the `DEPLOYER_PRIVATE_KEY` environment variable by running this command:
117164
118165
```bash
119-
npx hardhat vars set DEPLOYER_PRIVATE_KEY
166+
export DEPLOYER_PRIVATE_KEY=<YOUR_ETHERLINK_KEY>
120167
```
121168
122-
On the prompt, enter or paste the value of your exported private key. Hardhat use its custom env var system for storing keys, we will see later how to override this on a CICD pipeline
123-
124169
1. Deploy the contract to Etherlink Shadownet Testnet network specifying the `--network` option:
125170
126171
```bash
@@ -130,7 +175,6 @@ Deploy the contract locally is fine for doing simple tests, but we recommend to
130175
A successful output should look like this:
131176
132177
```logs
133-
Compiled 5 Solidity files successfully (evm target: paris).
134178
Hardhat Ignition 🚀
135179
136180
Deploying [ MarketpulseModule ]

0 commit comments

Comments
 (0)