Skip to content

Commit faf4a93

Browse files
Merge pull request #151 from threshold-network/support-sepolia
Support deployment on Sepolia
2 parents f6996df + 50abb8f commit faf4a93

8 files changed

+56125
-24
lines changed

.github/workflows/contracts.yml

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ on:
2424
workflow_dispatch:
2525
inputs:
2626
environment:
27-
description: "Environment (network) for workflow execution, e.g. `goerli`"
28-
required: false
27+
description: "Environment (network) for workflow execution, e.g. `sepolia`"
28+
required: true
2929
upstream_builds:
3030
description: "Upstream builds"
3131
required: false
@@ -153,9 +153,16 @@ jobs:
153153

154154
- name: Deploy contracts
155155
env:
156-
CHAIN_API_URL: ${{ secrets.GOERLI_ETH_HOSTNAME_HTTP }}
157-
CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY: ${{ secrets.GOERLI_ETH_CONTRACT_OWNER_PRIVATE_KEY }}
158-
KEEP_CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY: ${{ secrets.GOERLI_KEEP_ETH_CONTRACT_OWNER_PRIVATE_KEY }}
156+
# Using fake ternary expressions to decide which credentials to use,
157+
# depending on chosen environment. Note: if `GOERLI_ETH_HOSTNAME_HTTP`
158+
# is empty, the expression will be evaluated to
159+
# `SEPOLIA_ETH_HOSTNAME_HTTP`'s value.
160+
CHAIN_API_URL: |
161+
${{ inputs.github.event.inputs.environment == 'goerli'
162+
&& secrets.GOERLI_ETH_HOSTNAME_HTTP
163+
|| secrets.SEPOLIA_ETH_HOSTNAME_HTTP }}
164+
CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY: secrets.TESTNET_ETH_CONTRACT_OWNER_PRIVATE_KEY
165+
KEEP_CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY: secrets.TESTNET_ETH_CONTRACT_OWNER_PRIVATE_KEY
159166
run: yarn deploy --network ${{ github.event.inputs.environment }}
160167

161168
- name: Bump up package version
@@ -224,7 +231,14 @@ jobs:
224231
- name: Verify contracts on Etherscan
225232
env:
226233
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY }}
227-
CHAIN_API_URL: ${{ secrets.GOERLI_ETH_HOSTNAME_HTTP }}
234+
# Using fake ternary expressions to decide which credentials to use,
235+
# depending on chosen environment. Note: if `GOERLI_ETH_HOSTNAME_HTTP`
236+
# is empty, the expression will be evaluated to
237+
# `SEPOLIA_ETH_HOSTNAME_HTTP`'s value.
238+
CHAIN_API_URL: |
239+
${{ inputs.github.event.inputs.environment == 'goerli'
240+
&& secrets.GOERLI_ETH_HOSTNAME_HTTP
241+
|| secrets.SEPOLIA_ETH_HOSTNAME_HTTP }}
228242
run: |
229243
yarn run hardhat --network ${{ github.event.inputs.environment }} \
230244
etherscan-verify --license GPL-3.0 --force-license
@@ -259,9 +273,16 @@ jobs:
259273

260274
- name: Deploy contracts
261275
env:
262-
CHAIN_API_URL: ${{ secrets.GOERLI_ETH_HOSTNAME_HTTP }}
263-
CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY: ${{ secrets.DAPP_DEV_GOERLI_ETH_CONTRACT_OWNER_PRIVATE_KEY }}
264-
KEEP_CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY: ${{ secrets.GOERLI_KEEP_ETH_CONTRACT_OWNER_PRIVATE_KEY }}
276+
# Using fake ternary expressions to decide which credentials to use,
277+
# depending on chosen environment. Note: if `GOERLI_ETH_HOSTNAME_HTTP`
278+
# is empty, the expression will be evaluated to
279+
# `SEPOLIA_ETH_HOSTNAME_HTTP`'s value.
280+
CHAIN_API_URL: |
281+
${{ inputs.github.event.inputs.environment == 'goerli'
282+
&& secrets.GOERLI_ETH_HOSTNAME_HTTP
283+
|| secrets.SEPOLIA_ETH_HOSTNAME_HTTP }}
284+
CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY: secrets.DAPP_DEV_TESTNET_ETH_CONTRACT_OWNER_PRIVATE_KEY
285+
KEEP_CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY: secrets.TESTNET_ETH_CONTRACT_OWNER_PRIVATE_KEY
265286
run: yarn deploy --network ${{ github.event.inputs.environment }}
266287

267288
- name: Bump up package version

deploy/00_resolve_nucypher_staking_escrow.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
2626
} else if (
2727
// TODO: For testnets currently we deploy a stub contract. We should consider
2828
// switching to an actual contract.
29-
hre.network.name !== "ropsten" &&
29+
hre.network.name !== "sepolia" &&
3030
hre.network.name !== "goerli" &&
3131
(!hre.network.tags.allowStubs ||
3232
(hre.network.config as HardhatNetworkConfig)?.forking?.enabled)

deploy/00_resolve_nucypher_token.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
2121
} else if (
2222
// TODO: For testnets currently we deploy a stub contract. We should consider
2323
// switching to an actual contract.
24-
hre.network.name !== "ropsten" &&
24+
hre.network.name !== "sepolia" &&
2525
hre.network.name !== "goerli" &&
2626
(!hre.network.tags.allowStubs ||
2727
(hre.network.config as HardhatNetworkConfig)?.forking?.enabled)

deploy/07_deploy_token_staking.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
2525
]
2626
const tokenStakingInitializerArgs = []
2727

28-
// TODO: Consider upgradable deployment also for goerli.
28+
// TODO: Consider upgradable deployment also for goerli/sepolia.
2929
let tokenStakingAddress
3030
if (hre.network.name == "mainnet") {
3131
const TokenStaking = await ethers.getContractFactory("TokenStaking")

0 commit comments

Comments
 (0)