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 #605

Merged
merged 15 commits into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from 4 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
34 changes: 17 additions & 17 deletions .github/workflows/dashboard-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,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 @@ -87,9 +87,9 @@ jobs:
run: yarn build
env:
PUBLIC_URL: /${{ github.head_ref }}
CHAIN_ID: 5
ETH_HOSTNAME_HTTP: ${{ secrets.GOERLI_ETH_HOSTNAME_HTTP }}
ETH_HOSTNAME_WS: ${{ secrets.GOERLI_ETH_HOSTNAME_WS }}
CHAIN_ID: 11155111
ETH_HOSTNAME_HTTP: ${{ secrets.SEPOLIA_ETH_HOSTNAME_HTTP }}
ETH_HOSTNAME_WS: ${{ secrets.SEPOLIA_ETH_HOSTNAME_WS }}
NODE_OPTIONS: --max_old_space_size=4096
ELECTRUM_PROTOCOL: ${{ secrets.TESTNET_ELECTRUMX_PROTOCOL }}
ELECTRUM_HOST: ${{ secrets.TESTNET_ELECTRUMX_HOST }}
Expand All @@ -101,7 +101,7 @@ jobs:
# run: yarn test

# This job will be triggered for PR updates. It will build the dashboard
# using `dapp-development-goerli`-taggeed packages which contain contracts
# using `dapp-development-sepolia`-taggeed packages which contain contracts
# with values modified to help with the testing of dashboard. The code will be
# published to
# https://preview.dashboard.test.threshold.network/${{ github.head_ref }}/index.html
Expand All @@ -112,18 +112,18 @@ jobs:
if: github.event_name == 'pull_request'
uses: ./.github/workflows/reusable-build-and-publish.yml
with:
environment: goerli
environment: sepolia
useUpstreamBuilds: false
# We use `dapp-development-goerli`-taggeed packages with modified
# We use `dapp-development-sepolia`-taggeed packages with modified
# contracts. They contain modifications that help with the testing of
# dashboard features.
dependentPackagesTag: dapp-development-goerli
dependentPackagesTag: dapp-development-sepolia
gcpBucketName: preview.dashboard.test.threshold.network
gcpBucketPath: ${{ github.head_ref }}
preview: true
secrets:
ethUrlHttp: ${{ secrets.GOERLI_ETH_HOSTNAME_HTTP }}
ethUrlWS: ${{ secrets.GOERLI_ETH_HOSTNAME_WS }}
ethUrlHttp: ${{ secrets.SEPOLIA_ETH_HOSTNAME_HTTP }}
ethUrlWS: ${{ secrets.SEPOLIA_ETH_HOSTNAME_WS }}
gcpServiceKey: ${{ secrets.KEEP_TEST_CI_UPLOAD_DAPP_JSON_KEY_BASE64 }}
electrumProtocol: ${{ secrets.TESTNET_ELECTRUMX_PROTOCOL }}
electrumHost: ${{ secrets.TESTNET_ELECTRUMX_HOST }}
Expand All @@ -147,14 +147,14 @@ jobs:
uses: ./.github/workflows/reusable-build-and-publish.yml
with:
requireApproval: true
environment: goerli
environment: sepolia
useUpstreamBuilds: true
upstreamBuilds: ${{ github.event.inputs.upstream_builds }}
gcpBucketName: dashboard.test.threshold.network
preview: false
secrets:
ethUrlHttp: ${{ secrets.GOERLI_ETH_HOSTNAME_HTTP }}
ethUrlWS: ${{ secrets.GOERLI_ETH_HOSTNAME_WS }}
ethUrlHttp: ${{ secrets.SEPOLIA_ETH_HOSTNAME_HTTP }}
ethUrlWS: ${{ secrets.SEPOLIA_ETH_HOSTNAME_WS }}
gcpServiceKey: ${{ secrets.KEEP_TEST_CI_UPLOAD_DAPP_JSON_KEY_BASE64 }}
electrumProtocol: ${{ secrets.TESTNET_ELECTRUMX_PROTOCOL }}
electrumHost: ${{ secrets.TESTNET_ELECTRUMX_HOST }}
Expand All @@ -173,14 +173,14 @@ jobs:
if: github.event_name == 'push'
uses: ./.github/workflows/reusable-build-and-publish.yml
with:
environment: goerli
environment: sepolia
useUpstreamBuilds: false
dependentPackagesTag: goerli
dependentPackagesTag: sepolia
gcpBucketName: dashboard.test.threshold.network
preview: false
secrets:
ethUrlHttp: ${{ secrets.GOERLI_ETH_HOSTNAME_HTTP }}
ethUrlWS: ${{ secrets.GOERLI_ETH_HOSTNAME_WS }}
ethUrlHttp: ${{ secrets.SEPOLIA_ETH_HOSTNAME_HTTP }}
ethUrlWS: ${{ secrets.SEPOLIA_ETH_HOSTNAME_WS }}
gcpServiceKey: ${{ secrets.KEEP_TEST_CI_UPLOAD_DAPP_JSON_KEY_BASE64 }}
electrumProtocol: ${{ secrets.TESTNET_ELECTRUMX_PROTOCOL }}
electrumHost: ${{ secrets.TESTNET_ELECTRUMX_HOST }}
Expand Down
12 changes: 3 additions & 9 deletions .github/workflows/reusable-build-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ on:
required: false
default: false
type: boolean
# Currently the action only supports `environment` = `goerli`.
environment:
description: >
The environment on which the action should be used. For example `goerli`.
The environment on which the action should be used. For example `sepolia`.
Will be used to deterine environment variables and decide which legacy
packages should be used for building.
required: true
Expand All @@ -28,7 +27,7 @@ on:
description: >
Tag which should be used to pull latest non-legacy `threshold-network` and
`keep-network` packages with contracts (required if
`useUpstreamBuilds==false`). For example `dapp-dev-goerli`.
`useUpstreamBuilds==false`). For example `dapp-dev-sepolia`.
required: false
type: string
gcpBucketName:
Expand Down Expand Up @@ -135,17 +134,12 @@ jobs:
echo "tbtc-v2-ts-version=${{ steps.upstream-builds-query.outputs.tbtc-v2-ts-version }}" >> $GITHUB_OUTPUT
fi

# Currently we only support `environment` = `goerli`. We provide explicit
# version of the `keep-core` package, because using `goerli` tag results
# in `expected manifest` error - probably caused by bug in Yarn:
# https://github.com/yarnpkg/yarn/issues/4731.

- name: Resolve contracts
shell: bash
run: |
yarn upgrade \
@threshold-network/solidity-contracts@${{ steps.set-packages-versions.outputs.threshold-contracts-version }} \
@keep-network/keep-core@1.8.1-goerli.0 \
@keep-network/keep-core@${{ inputs.environment }} \
@keep-network/keep-ecdsa@${{ inputs.environment }} \
@keep-network/tbtc@${{ inputs.environment }} \
@keep-network/coverage-pools@${{ inputs.environment }} \
Expand Down
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,29 +58,29 @@ REACT_APP_MULTICALL_ADDRESS=$MULTICALL_ADDRESS

`yarn`

## Install Görli contracts
## Install Sepolia contracts

```
yarn upgrade @keep-network/coverage-pools@goerli \
@keep-network/ecdsa@goerli \
@keep-network/keep-core@goerli \
@keep-network/keep-ecdsa@goerli \
@keep-network/random-beacon@goerli \
@keep-network/tbtc@goerli \
@keep-network/tbtc-v2@goerli \
@keep-network/tbtc-v2.ts@goerli \
@threshold-network/coverage-pools@npm:@keep-network/coverage-pools@goerli \
@threshold-network/solidity-contracts@goerli
yarn upgrade @keep-network/coverage-pools@sepolia \
@keep-network/ecdsa@sepolia \
@keep-network/keep-core@sepolia \
@keep-network/keep-ecdsa@sepolia \
@keep-network/random-beacon@sepolia \
@keep-network/tbtc@sepolia \
@keep-network/tbtc-v2@sepolia \
@keep-network/tbtc-v2.ts@sepolia \
@threshold-network/coverage-pools@npm:@keep-network/coverage-pools@sepolia \
@threshold-network/solidity-contracts@sepolia
```

**NOTE 1:** We use the same Goerli versions for both
**NOTE 1:** We use the same Sepolia versions for both
`@keep-network/coverage-pools` and `@threshold-network/coverage-pools`, because
we don't have the newest version of the package on Goerli network, only on the
we don't have the v1 version of the package on Sepolia network, only on the
Mainnet.

**NOTE 2:** If you encounter an `expected manifest` error while executing this,
then try providing an explicit version of the `keep-core` package:
`@keep-network/[email protected]goerli.0`
`@keep-network/[email protected]sepolia.0`
The error is probably caused by a bug in Yarn:
https://github.com/yarnpkg/yarn/issues/4731.

Expand Down Expand Up @@ -111,7 +111,7 @@ The following procedure allows to deploy T token dashboard to production:
`releases/mainnet/<version>`. Release branch should never be merged to `main`
and creating a PR with a release branch is not required.
Dependencies and project version needs to be updated on the release branch.
All `-dev`, `-goerli` dependencies need to be updated to mainnet versions.
All `-dev`, `-sepolia` dependencies need to be updated to mainnet versions.
See [this commit](https://github.com/threshold-network/token-dashboard/commit/5452b68886ebc514d941a087973dfa9ac3802a7e)
for `v1.0.0` release as a good example.
2. Preview of the release branch will be uploaded to `preview.dashboard.threshold.network`
Expand Down
2 changes: 1 addition & 1 deletion src/components/Navbar/NetworkButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const NetworkButton: FC<{ chainId?: number }> = ({ chainId }) => {
icon: <Icon as={ethereumLogo} />,
bg: "gray.700",
},
[ChainID.Goerli]: {
[ChainID.Sepolia]: {
icon: (
<Icon
as={MdOutlineTrain}
Expand Down
1 change: 1 addition & 0 deletions src/enums/web3.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export enum ChainID {
Ethereum = 1,
Goerli = 5,
Sepolia = 11155111,
Localhost = 1337,
}

Expand Down
1 change: 1 addition & 0 deletions src/threshold-ts/multicall/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export const MULTICALL_ABI = [
export const MULTICALL_ADDRESSESS = {
1: "0xeefba1e63905ef1d7acba5a8513c70307c1ce441",
5: "0x77dca2c955b15e9de4dbbcf1246b4b85b651e50e",
11155111: "0xcA11bde05977b3631167028862bE2a173976CA11",
1337: process.env.REACT_APP_MULTICALL_ADDRESS || AddressZero,
} as Record<number | string, string>

Expand Down
4 changes: 1 addition & 3 deletions src/utils/chainIdToNetworkName.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ type NetworkMap = {

const networkMap: NetworkMap = {
[ChainID.Ethereum]: "Ethereum",
// [ChainID.Ropsten]: "Ropsten Test",
// 4: "Rinkeby",
[ChainID.Goerli]: "Goerli Test",
// 42: "Kovan",
[ChainID.Sepolia]: "Sepolia Test",
[ChainID.Localhost]: "Localhost",
}

Expand Down
4 changes: 1 addition & 3 deletions src/utils/createEtherscanLink.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
const ETHERSCAN_PREFIXES: { [chainId: number]: string } = {
1: "",
3: "ropsten.",
4: "rinkeby.",
5: "goerli.",
42: "kovan.",
11155111: "sepolia.",
}

export enum ExplorerDataType {
Expand Down
3 changes: 3 additions & 0 deletions src/web3/hooks/useMerkleDropContract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ const CONTRACT_ADDRESSESS = {
// https://goerli.etherscan.io/address/0x55F836777302CE096CC7770142a8262A2627E2e9
[ChainID.Goerli.valueOf().toString()]:
"0x55F836777302CE096CC7770142a8262A2627E2e9",
// TODO: Set the merkle drop address for Sepolia
// [ChainID.Sepolia.valueOf().toString()]:
// "",
michalinacienciala marked this conversation as resolved.
Show resolved Hide resolved
// TODO: Set local address- how to resolve it in local network?
[ChainID.Localhost.valueOf().toString()]: AddressZero,
} as Record<string, string>
Expand Down
4 changes: 4 additions & 0 deletions src/web3/hooks/useMulticallContract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ const MULTICALL_ABI = [
const MULTICALL_ADDRESSESS = {
[ChainID.Ethereum.valueOf()]: "0xeefba1e63905ef1d7acba5a8513c70307c1ce441",
[ChainID.Goerli.valueOf()]: "0x77dca2c955b15e9de4dbbcf1246b4b85b651e50e",
// The `makerdao/multicall` repo is deprecated and there is a third-party
// fork that deployed Multicall3:
// https://github.com/mds1/multicall#existing-deployments.
[ChainID.Sepolia.valueOf()]: "0xcA11bde05977b3631167028862bE2a173976CA11",
[ChainID.Localhost.valueOf()]:
process.env.REACT_APP_MULTICALL_ADDRESS || AddressZero,
} as Record<number, string>
Expand Down
4 changes: 4 additions & 0 deletions src/web3/hooks/usePREContract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ const PRE_ADDRESSESS = {
// we're using a stub contract.
[ChainID.Goerli.valueOf().toString()]:
"0x829fdCDf6Be747FEA37518fBd83dF70EE371fCf2",
// TODO: deploy the `SimplePreApplication` stub contract on Sepolia and fill
// the address below.
// [ChainID.Sepolia.valueOf().toString()]:
// "",
michalinacienciala marked this conversation as resolved.
Show resolved Hide resolved
// Set the correct `SimplePREApplication` contract address. If you deployed
// the `@threshold-network/solidity-contracts` to your local chain and linked
// package using `yarn link @threshold-network/solidity-contracts` you can
Expand Down