Skip to content

Commit 9d0ba43

Browse files
This works for deployment but not verification
1 parent 269d4e9 commit 9d0ba43

File tree

1 file changed

+63
-20
lines changed

1 file changed

+63
-20
lines changed

docs/tutorials/marketpulse/deploy.md

Lines changed: 63 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
---
22
title: Deploy the contract
33
dependencies:
4-
viem: 0
4+
viem: 2.41.2
5+
hardhat: 3.0.17
56
---
67

78
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 +12,7 @@ Deploy the contract locally is fine for doing simple tests, but we recommend to
1112
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:
1213

1314
```bash
14-
mv ./ignition/modules/Lock.ts ./ignition/modules/Marketpulse.ts
15+
mv ./ignition/modules/Counter.ts ./ignition/modules/Marketpulse.ts
1516
```
1617

1718
1. Replace the contents of the file with this code:
@@ -49,28 +50,75 @@ Deploy the contract locally is fine for doing simple tests, but we recommend to
4950
5051
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.
5152
53+
The response looks like this:
54+
55+
```
56+
Hardhat Ignition 🚀
57+
58+
Deploying [ MarketpulseModule ]
59+
60+
Batch #1
61+
Executed MarketpulseModule#Marketpulse
62+
63+
Batch #2
64+
Executed MarketpulseModule#Marketpulse.ping
65+
66+
[ MarketpulseModule ] successfully deployed 🚀
67+
68+
Deployed Addresses
69+
70+
MarketpulseModule#Marketpulse - 0x5FbDB2315678afecb367f032d93F642f64180aa3
71+
```
72+
5273
1. Check that your deployment logs do not contain any error and stop the Hardhat node.
5374
5475
1. Deploy the contract on Etherlink Shadownet Testnet:
5576
56-
1. In the Hardhat configuration file `hardhat.config.ts`, add Etherlink Mainnet and Shadownet Testnet as custom networks:
77+
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:
5778
5879
```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";
80+
import hardhatToolboxViemPlugin from "@nomicfoundation/hardhat-toolbox-viem";
81+
import { configVariable, defineConfig } from "hardhat/config";
6382
64-
if (!vars.has("DEPLOYER_PRIVATE_KEY")) {
83+
if (!configVariable("DEPLOYER_PRIVATE_KEY")) {
6584
console.error("Missing env var DEPLOYER_PRIVATE_KEY");
6685
}
6786
68-
const deployerPrivateKey = vars.get("DEPLOYER_PRIVATE_KEY");
69-
70-
const config: HardhatUserConfig = {
71-
solidity: "0.8.24",
87+
const deployerPrivateKey = configVariable("DEPLOYER_PRIVATE_KEY");
7288
89+
export default defineConfig({
90+
plugins: [hardhatToolboxViemPlugin],
91+
solidity: {
92+
profiles: {
93+
default: {
94+
version: "0.8.28",
95+
},
96+
production: {
97+
version: "0.8.28",
98+
settings: {
99+
optimizer: {
100+
enabled: true,
101+
runs: 200,
102+
},
103+
},
104+
},
105+
},
106+
},
73107
networks: {
108+
hardhatMainnet: {
109+
type: "edr-simulated",
110+
chainType: "l1",
111+
},
112+
hardhatOp: {
113+
type: "edr-simulated",
114+
chainType: "op",
115+
},
116+
sepolia: {
117+
type: "http",
118+
chainType: "l1",
119+
url: configVariable("SEPOLIA_RPC_URL"),
120+
accounts: [configVariable("SEPOLIA_PRIVATE_KEY")],
121+
},
74122
etherlinkMainnet: {
75123
url: "https://node.mainnet.etherlink.com",
76124
accounts: [deployerPrivateKey],
@@ -104,23 +152,19 @@ Deploy the contract locally is fine for doing simple tests, but we recommend to
104152
},
105153
],
106154
}
107-
};
108-
109-
export default config;
155+
});
110156
```
111157
112158
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).
113159
114160
1. Export your account private key from your wallet application.
115161
116-
1. Set the private key as the value of the `DEPLOYER_PRIVATE_KEY` environment variable by running this command:
162+
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:
117163
118164
```bash
119-
npx hardhat vars set DEPLOYER_PRIVATE_KEY
165+
export DEPLOYER_PRIVATE_KEY=<YOUR_ETHERLINK_KEY>
120166
```
121167
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-
124168
1. Deploy the contract to Etherlink Shadownet Testnet network specifying the `--network` option:
125169
126170
```bash
@@ -130,7 +174,6 @@ Deploy the contract locally is fine for doing simple tests, but we recommend to
130174
A successful output should look like this:
131175
132176
```logs
133-
Compiled 5 Solidity files successfully (evm target: paris).
134177
Hardhat Ignition 🚀
135178
136179
Deploying [ MarketpulseModule ]

0 commit comments

Comments
 (0)