Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
4cef02e
Change to Shadownet
timothymcmackin Dec 4, 2025
22f6b88
Update Hardhat setup and requirements
timothymcmackin Dec 5, 2025
afe0d9c
Correct default names of .sol files
timothymcmackin Dec 5, 2025
82ba2b6
Fix testing for new version of hardhat and viem
timothymcmackin Dec 5, 2025
61c57f0
This works for deployment but not verification
timothymcmackin Dec 5, 2025
160287f
Adapt frontend for Shadownet
timothymcmackin Dec 5, 2025
6e8cffb
Simplify with some code reuse
timothymcmackin Dec 5, 2025
8e36e45
Clarify
timothymcmackin Dec 5, 2025
b35b1b1
Correct chainID for Shadownet
timothymcmackin Dec 8, 2025
8d67794
Trying to get verification working
timothymcmackin Dec 8, 2025
8e1ed7e
Typo fixes the verification
timothymcmackin Dec 8, 2025
f683718
Only need to do this once
timothymcmackin Dec 8, 2025
38de30b
Correct chainID for Shadownet
timothymcmackin Dec 8, 2025
bd231e9
Node 22 and Shadownet updates
timothymcmackin Dec 8, 2025
c9496da
Use Etherscan, too
timothymcmackin Dec 9, 2025
735a6d4
Dependencies for frontend
timothymcmackin Dec 9, 2025
3f35334
typo
timothymcmackin Dec 9, 2025
b9dbeea
Use local images
timothymcmackin Dec 9, 2025
dec8563
REview comments
timothymcmackin Dec 9, 2025
bf1222f
Clarify
timothymcmackin Dec 12, 2025
ecf8126
Only need Etherscan
timothymcmackin Dec 12, 2025
b7140d4
Don't necessarily need a second account
timothymcmackin Dec 12, 2025
2112811
Better link for Vercel token
timothymcmackin Dec 12, 2025
0a013a5
Unneeded env variable
timothymcmackin Dec 12, 2025
f2d0762
fixes by nic to make it work
NicNomadic Dec 18, 2025
6d0fbd7
rename /DEPLOYER_PRIVATE_KEY
NicNomadic Dec 19, 2025
7360511
suggest to create a fresh directory for the test
NicNomadic Dec 19, 2025
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
10 changes: 2 additions & 8 deletions docs/tutorials/marketpulse/backend.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,9 @@ For more information about Solidity, see https://docs.soliditylang.org.

Follow these steps to set up a Solidity smart contract:

1. Remove the default Solidity smart contract `Lock.sol` in the `./contracts` folder.
1. Remove the default Solidity smart contract files `Counter.sol` and `Counter.t.sol` in the `./contracts` folder.

1. Create a new file named `Marketpulse.sol` in the `./contracts` folder.

```bash
touch ./contracts/Marketpulse.sol
```

1. Put this code in the file:
1. Create a new file named `./contracts/Marketpulse.sol` with the following content:

```Solidity
// SPDX-License-Identifier: MIT
Expand Down
20 changes: 9 additions & 11 deletions docs/tutorials/marketpulse/cicd.md
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the very last step (pushing a commit to check the CI), I first had a failed deploy_contract with: unknown variable DEPLOYER_PRIVATE_KEY.
For fixing that, I edited .github/workflow/marketpulse.yml:
to set
DEPLOYER_PRIVATE_KEY: ${{ secrets.DEPLOYER_PRIVATE_KEY }}
and it worked fine.

Copy link
Collaborator

@NicNomadic NicNomadic Dec 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tim changed the file .github/workflow/marketpulse.yml and after that the CI test still didn't work for me. I managed to executed only one time correctly after renaming the variable used by Tim HARDHAT_VAR_DEPLOYER_PRIVATE_KEY to DEPLOYER_PRIVATE_KEY

But after that one successful shot, it fails again with:

Error: Futures timed out with transactions unconfirmed after maximum fee bumps

IDK what to do...

Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,13 @@ Here is an example of one using the Github configuration files and [Vercel](http
- name: Check out repository code
uses: actions/checkout@v3
- name: Use node
env:
DEPLOYER_PRIVATE_KEY:
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 22
cache: 'npm'
- run: npm ci
- run: HARDHAT_VAR_DEPLOYER_PRIVATE_KEY=${{ secrets.DEPLOYER_PRIVATE_KEY }} npx hardhat compile
- run: HARDHAT_VAR_DEPLOYER_PRIVATE_KEY=${{ secrets.DEPLOYER_PRIVATE_KEY }} npx hardhat test
- run: DEPLOYER_PRIVATE_KEY=${{ secrets.DEPLOYER_PRIVATE_KEY }} npx hardhat compile
- run: DEPLOYER_PRIVATE_KEY=${{ secrets.DEPLOYER_PRIVATE_KEY }} npx hardhat test
- name: Cache build-hardhat-artifacts
uses: actions/upload-artifact@v4
with:
Expand All @@ -59,10 +57,10 @@ Here is an example of one using the Github configuration files and [Vercel](http
- name: Use node
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 22
cache: 'npm'
- run: npm ci
- run: yes | HARDHAT_VAR_DEPLOYER_PRIVATE_KEY=${{ secrets.DEPLOYER_PRIVATE_KEY }} npx hardhat ignition deploy ignition/modules/Marketpulse.ts --verify --reset --network etherlinkTestnet
- run: yes | DEPLOYER_PRIVATE_KEY=${{ secrets.DEPLOYER_PRIVATE_KEY }} npx hardhat ignition deploy ignition/modules/Marketpulse.ts --verify --reset --network etherlinkShadownet
- name: Cache hardhat-ignition
uses: actions/upload-artifact@v4
with:
Expand All @@ -88,11 +86,11 @@ Here is an example of one using the Github configuration files and [Vercel](http
- name: Use node
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 22
cache: 'npm'
- run: npm ci
working-directory: ./app
- run: more ./ignition/deployments/chain-128123/deployed_addresses.json
- run: more ./ignition/deployments/chain-127823/deployed_addresses.json
- run: npm run build
working-directory: ./app
- name: Cache app build
Expand All @@ -110,7 +108,7 @@ Here is an example of one using the Github configuration files and [Vercel](http
- name: Use node
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 22
cache: 'npm'
- name: Install Vercel CLI
run: npm install -g vercel
Expand Down Expand Up @@ -150,7 +148,7 @@ Here is an example of one using the Github configuration files and [Vercel](http
1. Set these variables in the GitHub pipeline configuration:

- `DEPLOYER_PRIVATE_KEY`: The Etherlink account secret `private key` you need to use to deploy with Hardhat. This variable overrides the default environment variable mechanism of HardHat.
- `VERCEL_TOKEN`: Your personal Vercel token that you need to create on your Vercel account. For more information about configuring Vercel, see https://vercel.com/guides/how-can-i-use-github-actions-with-vercel.
- `VERCEL_TOKEN`: Your personal Vercel token that you need to create on your Vercel account. For more information about configuring Vercel, see https://vercel.com/kb/guide/how-do-i-use-a-vercel-api-access-token.

You can set these variables in two ways:

Expand Down
146 changes: 95 additions & 51 deletions docs/tutorials/marketpulse/deploy.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
---
title: Deploy the contract
dependencies:
viem: 0
viem: 2.41.2
hardhat: 3.0.17
---

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.

1. Deploy the contract locally with Hardhat:

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:
1. Remove the default module for the ignition plugin of Hardhat.
This module is used as the default script for deployment:

```bash
mv ./ignition/modules/Lock.ts ./ignition/modules/Marketpulse.ts
rm ./ignition/modules/Counter.ts
```

1. Replace the contents of the file with this code:
1. Create a module to deploy your contract named `./ignition/modules/Marketpulse.ts` with the following content:

```TypeScript
// This setup uses Hardhat Ignition to manage smart contract deployments.
Expand All @@ -41,96 +43,138 @@ Deploy the contract locally is fine for doing simple tests, but we recommend to
npx hardhat node
```

1. In a different terminal window, deploy the contract using Hardhat ignition:
1. In a different terminal window, within the same directory, deploy the contract using Hardhat ignition:

```bash
npx hardhat ignition deploy ignition/modules/Marketpulse.ts --reset --network localhost
```

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.

The response looks like this:

```
Hardhat Ignition 🚀

Deploying [ MarketpulseModule ]

Batch #1
Executed MarketpulseModule#Marketpulse

Batch #2
Executed MarketpulseModule#Marketpulse.ping

[ MarketpulseModule ] successfully deployed 🚀

Deployed Addresses

MarketpulseModule#Marketpulse - 0x5FbDB2315678afecb367f032d93F642f64180aa3
```

1. Check that your deployment logs do not contain any error and stop the Hardhat node.

1. Deploy the contract on Etherlink Ghostnet Testnet:
1. Deploy the contract on Etherlink Shadownet Testnet:

1. In the Hardhat configuration file `hardhat.config.ts`, add Etherlink Mainnet and Ghostnet Testnet as custom networks:
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:

```TypeScript
import "@nomicfoundation/hardhat-toolbox-viem";
import "@nomicfoundation/hardhat-verify";
import type { HardhatUserConfig } from "hardhat/config";
import { vars } from "hardhat/config";
import hardhatToolboxViemPlugin from "@nomicfoundation/hardhat-toolbox-viem";
import { configVariable, defineConfig } from "hardhat/config";

if (!vars.has("DEPLOYER_PRIVATE_KEY")) {
if (!configVariable("DEPLOYER_PRIVATE_KEY")) {
console.error("Missing env var DEPLOYER_PRIVATE_KEY");
}

const deployerPrivateKey = vars.get("DEPLOYER_PRIVATE_KEY");

const config: HardhatUserConfig = {
solidity: "0.8.24",
const deployerPrivateKey = configVariable("DEPLOYER_PRIVATE_KEY");

export default defineConfig({
plugins: [hardhatToolboxViemPlugin],
solidity: {
profiles: {
default: {
version: "0.8.28",
},
production: {
version: "0.8.28",
settings: {
optimizer: {
enabled: true,
runs: 200,
},
},
},
},
},
networks: {
hardhatMainnet: {
type: "edr-simulated",
chainType: "l1",
},
hardhatOp: {
type: "edr-simulated",
chainType: "op",
},
etherlinkMainnet: {
type: "http",
url: "https://node.mainnet.etherlink.com",
accounts: [deployerPrivateKey],
},
etherlinkTestnet: {
url: "https://node.ghostnet.etherlink.com",
etherlinkShadownet: {
type: "http",
url: "https://node.shadownet.etherlink.com",
accounts: [deployerPrivateKey],
},
},
etherscan: {
apiKey: {
etherlinkMainnet: "DUMMY",
etherlinkTestnet: "DUMMY",
},
customChains: [
{
network: "etherlinkMainnet",
chainId: 42793,
urls: {
apiURL: "https://explorer.etherlink.com/api",
browserURL: "https://explorer.etherlink.com",
chainDescriptors: {
127823: {
chainType: "generic",
name: "etherlinkShadownet",
blockExplorers: {
etherscan: {
name: "EtherlinkExplorer",
apiUrl: "https://shadownet.explorer.etherlink.com/api",
url: "https://shadownet.explorer.etherlink.com",
},
},
{
network: "etherlinkTestnet",
chainId: 128123,
urls: {
apiURL: "https://testnet.explorer.etherlink.com/api",
browserURL: "https://testnet.explorer.etherlink.com",
},
},
],
},
42793: {
name: "EtherlinkMainnet",
}
},
verify: {
blockscout: {
enabled: false,
},
etherscan: {
apiKey: "DUMMY",
enabled: true,
},
sourcify: {
enabled: false,
}
}
};

export default config;
});
```

1. Set up an Etherlink Ghostnet 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 Ghostnet Testnet, as described in [Getting testnet tokens](/get-started/getting-testnet-tokens).
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).

1. Export your account private key from your wallet application.

1. Set the private key as the value of the `DEPLOYER_PRIVATE_KEY` environment variable by running this command:
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:

```bash
npx hardhat vars set DEPLOYER_PRIVATE_KEY
export DEPLOYER_PRIVATE_KEY=<YOUR_ETHERLINK_KEY>
```

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

1. Deploy the contract to Etherlink Ghostnet Testnet network specifying the `--network` option:
1. Deploy the contract to Etherlink Shadownet Testnet network specifying the `--network` option:

```bash
npx hardhat ignition deploy ignition/modules/Marketpulse.ts --network etherlinkTestnet
npx hardhat ignition deploy ignition/modules/Marketpulse.ts --network etherlinkShadownet
```

A successful output should look like this:

```logs
Compiled 5 Solidity files successfully (evm target: paris).
Hardhat Ignition 🚀

Deploying [ MarketpulseModule ]
Expand All @@ -151,7 +195,7 @@ Deploy the contract locally is fine for doing simple tests, but we recommend to
1. Run this command to verify your deployed contract, using the contract address as the value of `<CONTRACT_ADDRESS>`:

```bash
npx hardhat verify --network etherlinkTestnet <CONTRACT_ADDRESS>
npx hardhat verify --network etherlinkShadownet <CONTRACT_ADDRESS>
```

The response should include the message "Successfully verified contract Marketpulse on the block explorer" and a link to the block explorer.
Expand Down
Loading