Skip to content

Commit

Permalink
Add Sepolia / Optimism Sepolia support for Optimism cross-chain (#752)
Browse files Browse the repository at this point in the history
The Goerli testnet currently used by Threshold/Keep for development
purposes was planned to become deprecated with the end of year 2023.
Although it's already 2024, the testnet is still live, but it will loose
validators over the time and may become unusable at some point. The
testnet that was created to replace it is called
[Holešky](https://github.com/eth-clients/holesky), however it will take
some time until it gets integrated with by some of the projects we rely
on. As a solution, we decided to switch first to another testnet that is
currently live - Sepolia. This testnet's EOL is planned for 2026, which
gives us plenty of time to move to Holešky before Sepolia gets
deprecated.

The Goerli -> Sepolia migration means that also L2 testnet based on
Goerli (Optimism Goerli) needs to be migrated to Sepolia-based chain
(Optimism Sepolia). In this PR we're adjusting the config used to deploy
testnet contracts in the `@keep-network/tbtc-v2-arbitrum` project. After
the update, both deploy to `optimismGoerli` and `optimismSepolia`
networks will be supported (we may remove `optimismGoerli` support once
we're sure the `optimismSepolia` deployment works as expected).

TODO
- [x] Add `external/optimismSepolia/OptimismWormholeTBTC.json` - in
order to get the address we need to perform attestation of the Ethereum
Sepolia TBTC token on Optimism Sepolia (but atm Optimism Sepolia is not
available on the list of target networks on
https://wormhole-foundation.github.io/example-token-bridge-ui/#/register)

Ref: threshold-network/solidity-contracts#150
  • Loading branch information
lukasz-zimnoch authored Feb 19, 2024
2 parents e3c317e + 7da0957 commit 4c50eb3
Show file tree
Hide file tree
Showing 17 changed files with 1,437 additions and 17 deletions.
1 change: 1 addition & 0 deletions cross-chain/optimism/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
!/deployments/mainnet/
!/deployments/optimism/
!/deployments/optimismGoerli/
!/deployments/optimismSepolia/

# OZ
/.openzeppelin/unknown-*.json
6 changes: 3 additions & 3 deletions cross-chain/optimism/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Wormhole-specific tBTC representation into the canonical `OptimismTBTC` token.

The deployment scripts are responsible for managing updates of the tBTC gateway
addresses across various chains. These addresses are stored in the `external/`
directory for a specific network, such as `optimismGoerli/ArbitrumWormholeGateway.json.`
directory for a specific network, such as `optimismSepolia/ArbitrumWormholeGateway.json.`
It is important to note that these addresses should remain constant for the
mainnet network. However, there may be instances where a new version of a
cross-chain module is deployed to the testing network, which would require a
Expand All @@ -42,7 +42,7 @@ yarn deploy --network <network>

Supported networks:
- `hardhat` - for local development
- `optimismGoerli` - L2 testing network
- `optimismSepolia` - L2 testing network
- `optimism` - L2 mainnet

Currently, this module does not deploy any contracts on L1. All the existing
Expand All @@ -54,6 +54,6 @@ the contracts before running the deployment script. This command produces
an `export.json` file containing contract deployment info. Note that for the
chains other than `hardhat` the following environment variables are needed:

- `L2_CHAIN_API_URL` - URL to access blockchain services, e.g. `https://opt-goerli.g.alchemy.com/v2/<alchemy_api_key>`
- `L2_CHAIN_API_URL` - URL to access blockchain services, e.g. `https://optimism-sepolia.infura.io/v3/<infura_api_key>`
- `L2_ACCOUNTS_PRIVATE_KEYS` - Private keys for the deployer and council `<0xOwnerPrivKey,0xCouncilPrivKey>`
- `OPTIMISM_ETHERSCAN_API_KEY` - Optimism Etherscan API key
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { execute } = deployments
const { deployer } = await getNamedAccounts()

// See https://book.wormhole.com/reference/contracts.html
// This ID is valid for both Optimism Goerli and Mainnet
const wormholeChainID = 24
// See https://docs.wormhole.com/wormhole/blockchain-environments/evm#optimism
// and https://docs.wormhole.com/wormhole/blockchain-environments/evm#optimism-sepolia
// The value `24` is valid for both Optimism Goerli and Optimism Mainnet. The
// value for Optimism Sepolia is `10005`.
const wormholeChainID = hre.network.name === "optimismSepolia" ? 10005 : 24

const optimismWormholeGateway = await deployments.get(
"OptimismWormholeGateway"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const fakeArbitrumWormholeGateway =
"0x1af5DC16568EFF2d480a43A77E6C409e497FcFb9"

// See https://book.wormhole.com/reference/contracts.html
// This ID is valid for both Arbitrum Goerli and Mainnet
const arbitrumWormholeChainID = 23
// See https://docs.wormhole.com/wormhole/blockchain-environments/evm#arbitrum
// and https://docs.wormhole.com/wormhole/blockchain-environments/evm#arbitrum-sepolia
// The value `23` is valid for both Arbitrum Goerli and Arbitrum Mainnet. The
// value for Arbitrum Sepolia is `10003`.
const arbitrumWormholeChainID =
hre.network.name === "optimismSepolia" ? 10003 : 23

const arbitrumWormholeGateway = await deployments.getOrNull(
"ArbitrumWormholeGateway"
Expand All @@ -38,4 +41,4 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
export default func

func.tags = ["SetArbitrumGatewayAddress"]
func.dependencies = ["OptimismWormholeGateway"]
func.dependencies = ["OptimismWormholeGateway", "ArbitrumWormholeGateway"]
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const fakePolygonWormholeGateway =
"0x1af5DC16568EFF2d480a43A77E6C409e497FcFb9"

// See https://book.wormhole.com/reference/contracts.html
// This ID is valid for both Polygon Testnet (Mumbai) and Mainnet
// See https://docs.wormhole.com/wormhole/blockchain-environments/evm#polygon
// This ID is valid for both Polygonn Goerli-based Testnet (Mumbai) and
// Mainnet. Wormhole does not support the Sepolia-based Amoy Testnet yet.
// TODO: Update the ID once the support is added.
const polygonWormholeChainID = 5

const polygonWormholeGateway = await deployments.getOrNull(
Expand All @@ -36,4 +38,4 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
export default func

func.tags = ["SetPolygonGatewayAddress"]
func.dependencies = ["OptimismWormholeGateway"]
func.dependencies = ["OptimismWormholeGateway", "PolygonWormholeGateway"]
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
// Fake BaseWormholeGateway for local development purposes only.
const fakeBaseWormholeGateway = "0x1af5DC16568EFF2d480a43A77E6C409e497FcFb9"

// See https://docs.wormhole.com/wormhole/blockchain-environments/evm#base
// This ID is valid for both Base Testnet and Mainnet
const baseWormholeChainID = 30
// See https://docs.wormhole.com/wormhole/blockchain-environments/evm#base and
// https://docs.wormhole.com/wormhole/blockchain-environments/evm#base-sepolia
// The value `30` is valid for both Base Goerli and Base Mainnet. The value
// for Base Sepolia is `10004`.
const baseWormholeChainID =
hre.network.name === "optimismSepolia" ? 10004 : 30

const baseWormholeGateway = await deployments.getOrNull("BaseWormholeGateway")

Expand All @@ -33,4 +36,4 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
export default func

func.tags = ["SetBaseGatewayAddress"]
func.dependencies = ["BaseWormholeGateway"]
func.dependencies = ["BaseWormholeGateway", "OptimismWormholeGateway"]
1 change: 1 addition & 0 deletions cross-chain/optimism/deployments/optimismSepolia/.chainId
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
11155420
Loading

0 comments on commit 4c50eb3

Please sign in to comment.