Skip to content

Commit a958088

Browse files
Merge pull request #235 from keep-network/support-sepolia
Support deployment on Sepolia
2 parents 3ee7a56 + 2412024 commit a958088

File tree

7 files changed

+67
-97
lines changed

7 files changed

+67
-97
lines changed

.github/workflows/contracts.yml

Lines changed: 29 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ on:
1010
workflow_dispatch:
1111
inputs:
1212
environment:
13-
description: "Environment for workflow execution"
14-
required: false
15-
default: "dev"
13+
description: "Environment (network) for workflow execution, e.g. `sepolia`"
14+
required: true
1615
upstream_builds:
1716
description: "Upstream builds"
1817
required: false
@@ -25,9 +24,9 @@ jobs:
2524
contracts-build-and-test:
2625
runs-on: ubuntu-latest
2726
steps:
28-
- uses: actions/checkout@v2
27+
- uses: actions/checkout@v3
2928

30-
- uses: actions/setup-node@v2
29+
- uses: actions/setup-node@v3
3130
with:
3231
node-version: "14.x"
3332
cache: "yarn"
@@ -50,9 +49,9 @@ jobs:
5049
runs-on: ubuntu-latest
5150
if: github.event_name != 'schedule'
5251
steps:
53-
- uses: actions/checkout@v2
52+
- uses: actions/checkout@v3
5453

55-
- uses: actions/setup-node@v2
54+
- uses: actions/setup-node@v3
5655
with:
5756
node-version: "14.x"
5857
cache: "yarn"
@@ -77,9 +76,9 @@ jobs:
7776
if: github.event_name == 'workflow_dispatch'
7877
runs-on: ubuntu-latest
7978
steps:
80-
- uses: actions/checkout@v2
79+
- uses: actions/checkout@v3
8180

82-
- uses: actions/setup-node@v2
81+
- uses: actions/setup-node@v3
8382
with:
8483
node-version: "14.x"
8584
cache: "yarn"
@@ -98,30 +97,33 @@ jobs:
9897
run: yarn install --frozen-lockfile
9998

10099
- name: Get upstream packages' versions
101-
uses: keep-network/ci/actions/upstream-builds-query@v1
100+
uses: keep-network/ci/actions/upstream-builds-query@v2
102101
id: upstream-builds-query
103102
with:
104103
upstream-builds: ${{ github.event.inputs.upstream_builds }}
105104
query: |
105+
threshold-contracts-version = github.com/threshold-network/solidity-contracts#version
106106
keep-core-contracts-version = github.com/keep-network/keep-core/solidity-v1#version
107107
tbtc-contracts-version = github.com/keep-network/tbtc/solidity#version
108108
109109
- name: Resolve latest contracts
110110
run: |
111111
yarn upgrade \
112-
@keep-network/keep-core@${{ steps.upstream-builds-query.outputs.keep-core-contracts-version }} \
113-
@keep-network/tbtc@${{ steps.upstream-builds-query.outputs.tbtc-contracts-version }}
114-
115-
- name: Configure tenderly
116-
if: github.event.inputs.environment == 'ropsten'
117-
env:
118-
TENDERLY_TOKEN: ${{ secrets.TENDERLY_TOKEN }}
119-
run: ./config_tenderly.sh
112+
@threshold-network/solidity-contracts@${{ steps.upstream-builds-query.outputs.threshold-contracts-version }} \
113+
@keep-network/keep-core@${{ github.event.inputs.environment }} \
114+
@keep-network/tbtc@${{ github.event.inputs.environment }}
120115
121116
- name: Deploy contracts
122117
env:
123-
CHAIN_API_URL: ${{ secrets.KEEP_TEST_ETH_HOSTNAME_HTTP }}
124-
CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY: ${{ secrets.KEEP_TEST_ETH_CONTRACT_OWNER_PRIVATE_KEY }}
118+
# Using fake ternary expression to decide which credentials to use,
119+
# depending on chosen environment. Note: if `GOERLI_ETH_HOSTNAME_HTTP`
120+
# is empty, the expression will be evaluated to
121+
# `SEPOLIA_ETH_HOSTNAME_HTTP`'s value.
122+
CHAIN_API_URL: |
123+
${{ inputs.github.event.inputs.environment == 'goerli'
124+
&& secrets.GOERLI_ETH_HOSTNAME_HTTP
125+
|| secrets.SEPOLIA_ETH_HOSTNAME_HTTP }}
126+
ACCOUNTS_PRIVATE_KEYS: ${{ secrets.TESTNET_ETH_CONTRACT_OWNER_PRIVATE_KEY }}
125127
run: yarn deploy --network ${{ github.event.inputs.environment }}
126128

127129
- name: Bump up package version
@@ -135,10 +137,10 @@ jobs:
135137
- name: Publish to npm
136138
env:
137139
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
138-
run: npm publish --access=public --network=${{ github.event.inputs.environment }} --tag ${{ github.event.inputs.environment }}
140+
run: npm publish --access=public --tag ${{ github.event.inputs.environment }} --network=${{ github.event.inputs.environment }}
139141

140142
- name: Notify CI about completion of the workflow
141-
uses: keep-network/ci/actions/notify-workflow-completed@v1
143+
uses: keep-network/ci/actions/notify-workflow-completed@v2
142144
env:
143145
GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }}
144146
with:
@@ -149,66 +151,15 @@ jobs:
149151
upstream_ref: ${{ github.event.inputs.upstream_ref }}
150152
version: ${{ steps.npm-version-bump.outputs.version }}
151153

152-
- name: Upload files needed for etherscan verification
153-
uses: actions/upload-artifact@v2
154-
with:
155-
name: Artifacts for etherscan verifcation
156-
path: |
157-
./deployments
158-
./package.json
159-
./yarn.lock
160-
161-
contracts-etherscan-verification:
162-
needs: [contracts-deployment-testnet]
163-
runs-on: ubuntu-latest
164-
steps:
165-
- uses: actions/checkout@v2
166-
167-
- name: Download files needed for etherscan verification
168-
uses: actions/download-artifact@v2
169-
with:
170-
name: Artifacts for etherscan verifcation
171-
172-
- uses: actions/setup-node@v2
173-
with:
174-
node-version: "14.x"
175-
cache: "yarn"
176-
177-
# This step forces Git to download dependencies using `https://` protocol,
178-
# even if `yarn.json` refers to some package via `git://`. Using `git://`
179-
# is no longer supported by GH. One of the `coverage-pools` dependencies
180-
# by default uses `git://` and we needed to manually remove it every time
181-
# it re-appeares in the lock file. Now even if it does re-appear, the
182-
# `yarn install --frozen-lockfile` will not fail.
183-
- name: Configure git to don't use unauthenticated protocol
184-
run: git config --global url."https://".insteadOf git://
185-
186-
- name: Install needed dependencies
187-
run: yarn install --frozen-lockfile
188-
189-
# If we don't remove the dependencies' contracts from `node-modules`, the
190-
# `etherscan-verify` plugins tries to verify them, which is not desired.
191-
- name: Prepare for verification on Etherscan
192-
run: |
193-
rm -rf ./node_modules/@keep-network/keep-core
194-
rm -rf ./node_modules/@keep-network/tbtc
195-
rm -rf ./node_modules/@threshold-network/solidity-contracts
196-
197-
- name: Verify contracts on Etherscan
198-
env:
199-
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY }}
200-
CHAIN_API_URL: ${{ secrets.KEEP_TEST_ETH_HOSTNAME_HTTP }}
201-
run: yarn run hardhat --network ${{ github.event.inputs.environment }} etherscan-verify --license MIT
202-
203154
contracts-lint:
204155
runs-on: ubuntu-latest
205156
if: |
206157
github.event_name != 'workflow_dispatch'
207158
&& github.event_name != 'schedule'
208159
steps:
209-
- uses: actions/checkout@v2
160+
- uses: actions/checkout@v3
210161

211-
- uses: actions/setup-node@v2
162+
- uses: actions/setup-node@v3
212163
with:
213164
node-version: "14.x"
214165
cache: "yarn"
@@ -234,14 +185,14 @@ jobs:
234185
github.event_name != 'workflow_dispatch'
235186
&& github.event_name != 'schedule'
236187
steps:
237-
- uses: actions/checkout@v2
188+
- uses: actions/checkout@v3
238189

239-
- uses: actions/setup-node@v2
190+
- uses: actions/setup-node@v3
240191
with:
241192
node-version: "14.x"
242193
cache: "yarn"
243194

244-
- uses: actions/setup-python@v2
195+
- uses: actions/setup-python@v4
245196
with:
246197
python-version: 3.10.8
247198

.github/workflows/format.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ jobs:
1111
code-format:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v2
14+
- uses: actions/checkout@v3
1515

16-
- uses: actions/setup-node@v2
16+
- uses: actions/setup-node@v3
1717
with:
1818
node-version: "14"
1919
cache: "yarn"
@@ -24,6 +24,8 @@ jobs:
2424
# by default uses `git://` and we needed to manually remove it every time
2525
# it re-appeares in the lock file. Now even if it does re-appear, the
2626
# `yarn install --frozen-lockfile` will not fail.
27+
- name: Configure git to don't use unauthenticated protocol
28+
run: git config --global url."https://".insteadOf git://
2729

2830
- name: Install dependencies
2931
run: yarn install

.github/workflows/npm.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ jobs:
1616
npm-compile-publish-contracts:
1717
runs-on: ubuntu-latest
1818
steps:
19-
- uses: actions/checkout@v2
19+
- uses: actions/checkout@v3
2020

21-
- uses: actions/setup-node@v2
21+
- uses: actions/setup-node@v3
2222
with:
2323
node-version: "14.x"
2424
registry-url: "https://registry.npmjs.org"

.hardhat/networks_TEMPLATE.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { LocalNetworksConfig } from "@keep-network/hardhat-local-networks-config
77

88
const config: LocalNetworksConfig = {
99
networks: {
10-
ropsten: {
10+
sepolia: {
1111
url: "url not set",
1212
from: "address not set",
1313
accounts: ["private key not set"],

README.adoc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ code as it contains deployment details like chain ID, transaction hash, ABI or
130130
address for each contract.
131131

132132
The `deployments/` directory contains a separate sub-directory for each network, e.g.
133-
`deployments/ropsten/`, `deployments/mainnet/`. For a convenient usage of the
133+
`deployments/sepolia/`, `deployments/mainnet/`. For a convenient usage of the
134134
package we publish the deployment artifacts in a separate package for every
135135
network. The package contains deployment artifacts under `artifacts/` directory,
136136
which is a a copy of `deployments/<network>/` directory.
@@ -229,7 +229,7 @@ Example:
229229
],
230230
deployments: {
231231
// ...
232-
ropsten: [
232+
sepolia: [
233233
// ...
234234
"node_modules/@keep-network/keep-core/artifacts",
235235
],
@@ -246,7 +246,7 @@ To add a predefined single contract dependency for a given network:
246246

247247
1. Create a file under `external/<network>/<contract_name>.json`.
248248
+
249-
Example: `external/ropsten/UniswapV2Router.json`
249+
Example: `external/sepolia/UniswapV2Router.json`
250250

251251
2. Save an address and optionally an ABI for the contract in the file.
252252
+
@@ -270,9 +270,9 @@ Example:
270270
external: {
271271
deployments: {
272272
// ...
273-
ropsten: [
273+
sepolia: [
274274
// ...
275-
"./external/ropsten",
275+
"./external/sepolia",
276276
],
277277
},
278278
},

hardhat.config.ts

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ const config: HardhatUserConfig = {
5252
: undefined,
5353
tags: ["etherscan", "tenderly"],
5454
},
55-
ropsten: {
55+
sepolia: {
5656
url: process.env.CHAIN_API_URL || "",
57-
chainId: 3,
58-
accounts: process.env.CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY
59-
? [process.env.CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY]
57+
chainId: 11155111,
58+
accounts: process.env.ACCOUNTS_PRIVATE_KEYS
59+
? process.env.ACCOUNTS_PRIVATE_KEYS.split(",")
6060
: undefined,
61-
tags: ["tenderly"],
61+
tags: ["etherscan", "tenderly"],
6262
},
6363
mainnet: {
6464
url: process.env.CHAIN_API_URL || "",
@@ -78,6 +78,10 @@ const config: HardhatUserConfig = {
7878
},
7979
external: {
8080
contracts: [
81+
{
82+
artifacts:
83+
"node_modules/@threshold-network/solidity-contracts/artifacts",
84+
},
8185
{
8286
artifacts: "node_modules/@keep-network/keep-core/artifacts",
8387
// Example if we want to use deployment scripts from external package:
@@ -94,13 +98,21 @@ const config: HardhatUserConfig = {
9498
// For development environment we expect the local dependencies to be linked
9599
// with `yarn link` command.
96100
development: [
101+
"node_modules/@threshold-network/solidity-contracts/artifacts",
102+
"node_modules/@keep-network/keep-core/artifacts",
103+
"node_modules/@keep-network/tbtc/artifacts",
104+
],
105+
goerli: [
106+
"node_modules/@threshold-network/solidity-contracts/artifacts",
97107
"node_modules/@keep-network/keep-core/artifacts",
98108
"node_modules/@keep-network/tbtc/artifacts",
109+
"./external/goerli",
99110
],
100-
ropsten: [
111+
sepolia: [
112+
"node_modules/@threshold-network/solidity-contracts/artifacts",
101113
"node_modules/@keep-network/keep-core/artifacts",
102114
"node_modules/@keep-network/tbtc/artifacts",
103-
"./external/ropsten",
115+
"./external/sepolia",
104116
],
105117
mainnet: ["./external/mainnet-v2"],
106118
},
@@ -112,17 +124,19 @@ const config: HardhatUserConfig = {
112124
rewardManager: {
113125
default: 1,
114126
goerli: 0, // use deployer account
115-
ropsten: 0, // use deployer account
127+
sepolia: 0, // use deployer account
116128
mainnet: 0, // use deployer account
117129
},
118130
thresholdCouncil: {
119131
default: 2,
120132
goerli: 0, // use deployer account
133+
sepolia: 0, // use deployer account
121134
mainnet: "0x9f6e831c8f8939dc0c830c6e492e7cef4f9c2f5f",
122135
},
123136
treasuryGuild: {
124137
default: 3,
125138
goerli: 0, // use deployer account
139+
sepolia: 0, // use deployer account
126140
mainnet: "0x71E47a4429d35827e0312AA13162197C23287546",
127141
},
128142
},

tenderly.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1+
# This file is currently being ignored by the `hardhat-tenderly` plugin. There
2+
# is an open feature request to make it supported:
3+
# https://github.com/Tenderly/hardhat-tenderly/issues/17.
14
account_id: d9a948cf-8667-43df-acb0-ce194f6dda7a
25
projects:
36
thesis/keep:
47
networks:
58
- "1" # mainnet
69
thesis/keep-test:
710
networks:
8-
- "3" # ropsten
11+
- "11155111" # sepolia

0 commit comments

Comments
 (0)