Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support deployment on Sepolia #151

Merged
merged 7 commits into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
49 changes: 41 additions & 8 deletions .github/workflows/contracts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ on:
workflow_dispatch:
inputs:
environment:
description: "Environment (network) for workflow execution, e.g. `goerli`"
description: "Environment (network) for workflow execution, e.g. `sepolia`"
required: false
upstream_builds:
description: "Upstream builds"
Expand Down Expand Up @@ -153,9 +153,22 @@ jobs:

- name: Deploy contracts
env:
CHAIN_API_URL: ${{ secrets.GOERLI_ETH_HOSTNAME_HTTP }}
CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY: ${{ secrets.GOERLI_ETH_CONTRACT_OWNER_PRIVATE_KEY }}
KEEP_CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY: ${{ secrets.GOERLI_KEEP_ETH_CONTRACT_OWNER_PRIVATE_KEY }}
# Use fake ternary expressions to decide which credentials to use,
# depending on chosen environment. Note: if `GOERLI...` credentials
# are empty, the expressions will be evaluated to the `SEPOLIA...`
# ones.
lukasz-zimnoch marked this conversation as resolved.
Show resolved Hide resolved
CHAIN_API_URL: |
${{ inputs.github.event.inputs.environment == 'goerli'
&& secrets.GOERLI_ETH_HOSTNAME_HTTP
|| secrets.SEPOLIA_ETH_HOSTNAME_HTTP }}
CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY: |
${{ inputs.github.event.inputs.environment == 'goerli'
&& secrets.GOERLI_ETH_CONTRACT_OWNER_PRIVATE_KEY
|| secrets.SEPOLIA_ETH_CONTRACT_OWNER_PRIVATE_KEY }}
KEEP_CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY: |
${{ inputs.github.event.inputs.environment == 'goerli'
&& secrets.GOERLI_KEEP_ETH_CONTRACT_OWNER_PRIVATE_KEY
|| secrets.SEPOLIA_KEEP_ETH_CONTRACT_OWNER_PRIVATE_KEY }}
run: yarn deploy --network ${{ github.event.inputs.environment }}

- name: Bump up package version
Expand Down Expand Up @@ -224,7 +237,14 @@ jobs:
- name: Verify contracts on Etherscan
env:
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY }}
CHAIN_API_URL: ${{ secrets.GOERLI_ETH_HOSTNAME_HTTP }}
# Use fake ternary expression to decide which credentials to use,
# depending on chosen environment. Note: if `GOERLI...` credential
# is empty, the expressions will be evaluated to the `SEPOLIA...`
# one.
CHAIN_API_URL: |
${{ inputs.github.event.inputs.environment == 'goerli'
&& secrets.GOERLI_ETH_HOSTNAME_HTTP
|| secrets.SEPOLIA_ETH_HOSTNAME_HTTP }}
run: |
yarn run hardhat --network ${{ github.event.inputs.environment }} \
etherscan-verify --license GPL-3.0 --force-license
Expand Down Expand Up @@ -259,9 +279,22 @@ jobs:

- name: Deploy contracts
env:
CHAIN_API_URL: ${{ secrets.GOERLI_ETH_HOSTNAME_HTTP }}
CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY: ${{ secrets.DAPP_DEV_GOERLI_ETH_CONTRACT_OWNER_PRIVATE_KEY }}
KEEP_CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY: ${{ secrets.GOERLI_KEEP_ETH_CONTRACT_OWNER_PRIVATE_KEY }}
# Use fake ternary expressions to decide which credentials to use,
# depending on chosen environment. Note: if `GOERLI...` credentials
# are empty, the expressions will be evaluated to the `SEPOLIA...`
# ones.
CHAIN_API_URL: |
${{ inputs.github.event.inputs.environment == 'goerli'
&& secrets.GOERLI_ETH_HOSTNAME_HTTP
|| secrets.SEPOLIA_ETH_HOSTNAME_HTTP }}
CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY: |
${{ inputs.github.event.inputs.environment == 'goerli'
&& secrets.DAPP_DEV_GOERLI_ETH_CONTRACT_OWNER_PRIVATE_KEY
|| secrets.DAPP_DEV_SEPOLIA_ETH_CONTRACT_OWNER_PRIVATE_KEY }}
KEEP_CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY: |
${{ inputs.github.event.inputs.environment == 'goerli'
&& secrets.GOERLI_KEEP_ETH_CONTRACT_OWNER_PRIVATE_KEY
|| secrets.SEPOLIA_KEEP_ETH_CONTRACT_OWNER_PRIVATE_KEY }}
run: yarn deploy --network ${{ github.event.inputs.environment }}

- name: Bump up package version
Expand Down
2 changes: 1 addition & 1 deletion deploy/00_resolve_nucypher_staking_escrow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
} else if (
// TODO: For testnets currently we deploy a stub contract. We should consider
// switching to an actual contract.
hre.network.name !== "ropsten" &&
hre.network.name !== "sepolia" &&
hre.network.name !== "goerli" &&
(!hre.network.tags.allowStubs ||
(hre.network.config as HardhatNetworkConfig)?.forking?.enabled)
Expand Down
2 changes: 1 addition & 1 deletion deploy/00_resolve_nucypher_token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
} else if (
// TODO: For testnets currently we deploy a stub contract. We should consider
// switching to an actual contract.
hre.network.name !== "ropsten" &&
hre.network.name !== "sepolia" &&
hre.network.name !== "goerli" &&
(!hre.network.tags.allowStubs ||
(hre.network.config as HardhatNetworkConfig)?.forking?.enabled)
Expand Down
2 changes: 1 addition & 1 deletion deploy/07_deploy_token_staking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
]
const tokenStakingInitializerArgs = []

// TODO: Consider upgradable deployment also for goerli.
// TODO: Consider upgradable deployment also for goerli/sepolia.
let tokenStakingAddress
if (hre.network.name == "mainnet") {
const TokenStaking = await ethers.getContractFactory("TokenStaking")
Expand Down
17 changes: 6 additions & 11 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,21 +57,13 @@ const config: HardhatUserConfig = {
: undefined,
tags: ["tenderly"],
},
rinkeby: {
sepolia: {
url: process.env.CHAIN_API_URL || "",
chainId: 4,
accounts: process.env.CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY
? [process.env.CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY]
: undefined,
tags: ["tenderly"],
},
ropsten: {
url: process.env.CHAIN_API_URL || "",
chainId: 3,
chainId: 11155111,
accounts: process.env.CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY
? [
process.env.CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY,
process.env.KEEP_CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY,
process.env.KEEP_CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY, // TODO: verify if we have different owner here or can we remove this
]
: undefined,
tags: ["tenderly"],
Expand Down Expand Up @@ -100,13 +92,15 @@ const config: HardhatUserConfig = {
// to the contract artifacts.
hardhat: process.env.FORKING_URL ? ["./external/mainnet"] : [],
goerli: ["./external/goerli"],
sepolia: ["./external/sepolia"],
mainnet: ["./external/mainnet"],
},
},
namedAccounts: {
deployer: {
default: 1, // take the first account as deployer
goerli: 0,
sepolia: 0,
// mainnet: "0x123694886DBf5Ac94DDA07135349534536D14cAf",
},
thresholdCouncil: {
Expand All @@ -116,6 +110,7 @@ const config: HardhatUserConfig = {
default: 1, // same as the deployer
ropsten: "0x923C5Dbf353e99394A21Aa7B67F3327Ca111C67D",
goerli: "0x68ad60CC5e8f3B7cC53beaB321cf0e6036962dBc",
// sepolia: "", TODO: Fill with the address of the deployer
},
},
mocha: {
Expand Down
Loading