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

Cross chain arbitrum module #554

Merged
merged 101 commits into from
Mar 31, 2023
Merged

Cross chain arbitrum module #554

merged 101 commits into from
Mar 31, 2023

Conversation

dimpar
Copy link
Contributor

@dimpar dimpar commented Feb 22, 2023

Part of #542

Depends on the issue #544 with PR #570

Refs #545

This PR creates a new cross-chain/arbitrum module to bring tBTC to L2 Arbitrum with a help of Wormhole. Here's a diagram to illustrate the flow

+----------------------------+         +---------------------------------------------------------------------------+
|          Ethereum          |         |                                Arbitrum                                   |
|                            |         |                                                                           |
|  +----------------------+  |         |  +----------------------+  +-------------------------+  +--------------+  |
|  | Wormhole TokenBridge |--|---------|--| Wormhole TokenBridge |--| ArbitrumWormholeGateway |--| ArbitrumTBTC |  |
|  +----------------------+  |         |  +----------------------+  +-------------------------+  +--------------+  |
|                            |         |                                                                           |
+----------------------------+         +---------------------------------------------------------------------------+
  • Wormhole TokenBridge on Ethereum - holds all TBTC bridged to Arbitrum. This is an external contract created by the Wormhole team.
  • Wormhole TokenBridge on Arbitrum - mints Wormhole wrapped TBTC ie. wormholeTBTC. This is an external contract created by the Wormhole team.
  • ArbitrumWormholeGateway on Arbitrum - acts as a vending machine that wraps and unwraps wormholeTBTC to the canonical arbTBTC token. This is an upgradable Gateway behind OZ transparent proxy. The Threshold team creates it.
  • ArbitrumTBTC canonical TBTC on Arbitrum. It is upgradable behind OZ transparent proxy. The Threshold team creates it.

All the ownership of Threshold-created contracts is transferred to the Threshold governance including a proxy admin ownership.

Deploy on Goerli Arbitrum testnet / Arbitrum mainnet

L2_CHAIN_API_URL=<API_URL> \
L2_ACCOUNTS_PRIVATE_KEYS=<0xL2_OWNER_PRIV_KEY,0xL2_COUNCIL_PRIV_KEY> \
ARBISCAN_API_KEY=<API_KEY> \
  yarn deploy --network <network>

External Wormhole contracts

Wormhole TokenBridge on Goerli Arbitrum
Wormhole TokenBridge on Mainnet Arbitrum
WormholeTBTC on Goerli Arbitrum
WormholeTBTC on Mainnet Arbitrum

@dimpar dimpar added the ⛓️ solidity Solidity contracts label Feb 23, 2023
@dimpar dimpar requested a review from pdyraga February 23, 2023 12:55
@dimpar dimpar self-assigned this Feb 23, 2023
.github/workflows/cross-chain-arbitrum.yml Outdated Show resolved Hide resolved
.github/workflows/cross-chain-arbitrum.yml Outdated Show resolved Hide resolved
export default func

func.tags = ["TransferArbitrumTBTCOwnership"]
func.dependencies = ["ArbitrumTBTC"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should add AuthorizeWormholeGateway as a dependency to make sure the transfer is executed after the authorization?

cross-chain/arbitrum/.gitignore Show resolved Hide resolved
cross-chain/arbitrum/README.adoc Outdated Show resolved Hide resolved
cross-chain/arbitrum/README.adoc Outdated Show resolved Hide resolved
cross-chain/arbitrum/README.adoc Show resolved Hide resolved
cross-chain/arbitrum/README.adoc Show resolved Hide resolved
cross-chain/arbitrum/hardhat.config.ts Outdated Show resolved Hide resolved
cross-chain/arbitrum/hardhat.config.ts Outdated Show resolved Hide resolved
cross-chain/arbitrum/hardhat.config.ts Outdated Show resolved Hide resolved
cross-chain/arbitrum/hardhat.config.ts Outdated Show resolved Hide resolved
dimpar added 10 commits March 30, 2023 15:52
Resolved TokenBridge and WormholeTBTC in separate scripts.
- Added L1 and L2 prefixes at the beginning of the env. vars
- Commented out companion network because it is not yet used
- Added deploy_l1 dir to hardhat network
colon is treated as nested mapping which is not allowed. Removing the
colon.
nkuba added 6 commits March 31, 2023 00:37
To reduce confusion we prefix wiht arbitrum contracts that are deployed to
arbitrum.
Before we overwrite the contract address we ensure it's not set.
We don't have the directory yet, so we don't want to block hardhat
network deployment with this entry.
This is consistent with our other projects. The address is resolved
based on the private key provided in L1_ACCOUNTS_PRIVATE_KEYS and L2_ACCOUNTS_PRIVATE_KEYS
@pdyraga pdyraga dismissed michalinacienciala’s stale review March 31, 2023 08:51

@nkuba and @pdyraga took over the review from @michalinacienciala and all her comments were addressed

@pdyraga pdyraga merged commit 2bd07e5 into main Mar 31, 2023
@pdyraga pdyraga deleted the cross-chain-arbitrum-module branch March 31, 2023 09:10
@pdyraga pdyraga added this to the solidity/v1.2.0 milestone Apr 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⛓️ solidity Solidity contracts
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants