Skip to content
Draft
Show file tree
Hide file tree
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
18 changes: 16 additions & 2 deletions data-streams/getting-started/hardhat/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ This guide uses the [Hardhat](https://hardhat.org/) development environment to d
### Requirements

- **Git**: Make sure you have Git installed. You can check your current version by running <CopyText text="git --version" code/> in your terminal and download the latest version from the official [Git website](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) if necessary.
- **Nodejs** and **npm**: [Install the latest release of Node.js 20](https://nodejs.org/en/download/). Optionally, you can use the nvm package to switch between Node.js versions with <CopyText text="nvm use 20" code/>. To ensure you are running the correct version in a terminal, type <CopyText text="node -v" code/>.
- **Nodejs** and **npm**: [Install the latest release of Node.js 22](https://nodejs.org/en/download/). **This project uses Hardhat 3, which requires Node.js 22 or higher.** Optionally, you can use the nvm package to switch between Node.js versions with <CopyText text="nvm use 22" code/>. To ensure you are running the correct version in a terminal, type <CopyText text="node -v" code/>.
```bash
$ node -v
v20.11.0
v22.0.0
```
- **RPC URL**: You need a Remote Procedure Call (RPC) URL for the Arbitrum Sepolia network. You can obtain one by creating an account on [Alchemy](https://www.alchemy.com/) or [Infura](https://www.infura.io/) and setting up an Arbitrum Sepolia project.
- **Private key**: You need the private key of the account that will deploy and interact with the contracts. You can use the private key of your [MetaMask wallet](https://metamask.io/).
Expand All @@ -41,6 +41,20 @@ This guide uses the [Hardhat](https://hardhat.org/) development environment to d
npm install
```

1. Compile the contracts to verify your setup:

```bash
npx hardhat compile
```

You should see output similar to:

```bash
Compiled 2 Solidity files with solc 0.8.20 (evm target: shanghai)
```

Note: You don't need to set environment variables to compile the contracts.

1. Set an encryption password for your environment variables. This password needs to be set each time you create or restart a terminal shell session.

```bash
Expand Down
18 changes: 9 additions & 9 deletions data-streams/getting-started/hardhat/contracts/LogEmitter.sol
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;
pragma solidity ^0.8.20;

/**
* @title Log Emitter Contract
* @dev This contract is designed to emit an event whenever the `emitLog` function is called.
*/
contract LogEmitter {
// Define an event that logs the address of the sender who triggered the event.
event Log(address indexed msgSender);
// Define an event that logs the address of the sender who triggered the event.
event Log(address indexed msgSender);

/**
* @dev Emits a `Log` event with the sender's address.
*/
function emitLog() public {
emit Log(msg.sender);
}
/**
* @dev Emits a `Log` event with the sender's address.
*/
function emitLog() public {
emit Log(msg.sender);
}
}

Large diffs are not rendered by default.

23 changes: 15 additions & 8 deletions data-streams/getting-started/hardhat/hardhat.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
require("@chainlink/env-enc").config()
require("@nomicfoundation/hardhat-toolbox")
require("./tasks")
import { config as envEncConfig } from "@chainlink/env-enc"
import "@nomicfoundation/hardhat-toolbox-mocha-ethers"
// Note: Tasks are temporarily disabled due to ESM loading issues in Hardhat 3
// import "./tasks/index.js"

// Set EVM private keys (required)
// Load environment variables
envEncConfig()

// Set EVM private keys (required for deployment)
const PRIVATE_KEY = process.env.PRIVATE_KEY
const ARBITRUM_SEPOLIA_RPC_URL = process.env.ARBITRUM_SEPOLIA_RPC_URL

const COMPILER_SETTINGS = {
optimizer: {
Expand All @@ -15,19 +20,21 @@ const COMPILER_SETTINGS = {
},
}

module.exports = {
export default {
solidity: {
compilers: [
{
version: "0.8.19",
version: "0.8.20",
settings: COMPILER_SETTINGS,
},
],
},
networks: {
arbitrumSepolia: {
url: process.env.ARBITRUM_SEPOLIA_RPC_URL || "UNSET",
accounts: [PRIVATE_KEY],
type: "http",
// This is a placeholder URL for compilation. Set ARBITRUM_SEPOLIA_RPC_URL in your environment to deploy.
url: ARBITRUM_SEPOLIA_RPC_URL || "http://localhost:8545",
accounts: PRIVATE_KEY ? [PRIVATE_KEY] : [],
chainId: 421614,
},
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
const networkConfig = {
export const networkConfig = {
421614: {
name: "arbitrumSepolia",
linkToken: "0xb1D4538B4571d411F07960EF2838Ce337FE1E80E",
verifierProxyAddress: "0x2ff010DEbC1297f19579B4246cad07bd24F2488A",
automationRegistrarAddress: "0x881918E24290084409DaA91979A30e6f0dB52eBe",
},
}

module.exports = {
networkConfig,
}
Loading
Loading