Skip to content
Merged
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
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
shell: bash
- run: CURRENT_BRANCH=${{ github.head_ref || github.ref_name }} PUSH_DOCKER_IMAGE=true ./scripts/build_image.sh
shell: bash

e2e_test:
name: e2e tests
runs-on: ubuntu-latest
Expand All @@ -68,9 +68,9 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: "14.x"
- name: Yarn install
run: yarn
node-version: "18.x"
- name: NPM Clean Install
run: npm ci
working-directory: ./contract-examples
- name: Install AvalancheGo Release
shell: bash
Expand Down
1 change: 1 addition & 0 deletions contract-examples/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
engine-strict=true
28 changes: 11 additions & 17 deletions contract-examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,9 @@ The goal of this guide is to lay out best practices regarding writing, testing a

## Prerequisites

### NodeJS and Yarn
### NodeJS and NPM

First, install the LTS (long-term support) version of [nodejs](https://nodejs.org/en). This is `16.2.0` at the time of writing. NodeJS bundles `npm`.

Next, install [yarn](https://yarnpkg.com):

```zsh
npm install -g yarn
```
First, install the LTS (long-term support) version of [nodejs](https://nodejs.org/en). This is `18.16.0` at the time of writing. NodeJS bundles `npm`.

### Solidity and Avalanche

Expand All @@ -33,7 +27,7 @@ Clone the repo and install the necessary packages via `yarn`.
```zsh
$ git clone https://github.com/ava-labs/subnet-evm.git
$ cd contract-examples
$ yarn
$ npm install
```

## Write Contracts
Expand All @@ -54,7 +48,7 @@ For more information about precompiles see [subnet-evm precompiles](https://gith

Hardhat uses `hardhat.config.js` as the configuration file. You can define tasks, networks, compilers and more in that file. For more information see [here](https://hardhat.org/config/).

In Subnet-EVM, we provide a pre-configured file [hardhat.config.ts](https://github.com/ava-labs/avalanche-smart-contract-quickstart/blob/main/hardhat.config.ts).
In Subnet-EVM, we provide a pre-configured file [hardhat.config.ts](https://github.com/ava-labs/subnet-evm/blob/master/contract-examples/hardhat.config.ts).

The HardHat config file includes a single network configuration: `local`. `local` defaults to using the following values for the RPC URL and the Chain ID:

Expand All @@ -73,11 +67,11 @@ Alternatively, you can copy and paste the `local` network configuration to creat

```json
{
networks: {
mynetwork: {
url: "http://127.0.0.1:9650/ext/bc/28N1Tv5CZziQ3FKCaXmo8xtxoFtuoVA6NvZykAT5MtGjF4JkGs/rpc",
chainId: 33333,
accounts: [
"networks": {
"mynetwork": {
"url": "http://127.0.0.1:9650/ext/bc/28N1Tv5CZziQ3FKCaXmo8xtxoFtuoVA6NvZykAT5MtGjF4JkGs/rpc",
"chainId": 33333,
"accounts": [
"0x56289e99c94b6912bfc12adc093c9b51124f0dc54ac7a766b2bc5ccf558d8027",
"0x7b4198529994b0dc604278c99d153cfd069d594753d471171a1d102a10438e07",
"0x15614556be13730e9e8d6eacc1603143e7b96987429df8726384c2ec4502ef6e",
Expand All @@ -89,8 +83,8 @@ Alternatively, you can copy and paste the `local` network configuration to creat
"0x86f78c5416151fe3546dece84fda4b4b1e36089f2dbc48496faf3a950f16157c",
"0x750839e9dbbd2a0910efe40f50b2f3b2f2f59f5580bb4b83bd8c1201cf9a010a"
],
pollingInterval: "1s"
},
"pollingInterval": "1s"
Copy link
Contributor

Choose a reason for hiding this comment

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

🤔 The hardhat config is usually a js file isn't it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

TS is officially supported as well

}
}
}
```
Expand Down
5 changes: 3 additions & 2 deletions contract-examples/hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import "@nomiclabs/hardhat-waffle"
import "./tasks.ts"
import "@nomiclabs/hardhat-ethers"
import "./tasks"

// HardHat users must populate these environment variables in order to connect to their subnet-evm instance
// Since the blockchainID is not known in advance, there's no good default to use and we use the C-Chain here.
var local_rpc_uri = process.env.RPC_URI || "http://127.0.0.1:9650/ext/bc/C/rpc"
var local_chain_id = parseInt(process.env.CHAIN_ID,10) || 99999
var local_chain_id = parseInt(process.env.CHAIN_ID, 10) || 99999

export default {
solidity: {
Expand Down
Loading