@across-protocol/contracts 中文文档教程

发布于 3年前 浏览 11 项目主页 更新于 3年前

@across/contracts

该软件包包含 Across Protocol 的合同。 他们已经过 Open Zeppelin 的审计和测试 在自动化测试和主网上彻底。

Installing and building

安装:

yarn

构建:

yarn build

Running tests

yarn test

Deploying

这个仓库有一组准备好的部署脚本。 由于跨链是一个多链协议,部署过程将 之后涉及多个步骤和一些配置事务。

要进行跨主网的基本部署,您可以运行:

CUSTOM_NODE_URL=YOUR_NODE_URL_HERE MNEMONIC=YOUR_MNEMONIC_HERE yarn hardhat deploy --tags mainnet --network mainnet

这应该会打印出一组地址。 您应该将 networks/1.json 中的地址替换为地址 打印。

现在您应该能够通过使用新节点 url 和运行相同的命令来部署到 Arbitrum、Optimism 或 Boba 新网络名称:

CUSTOM_NODE_URL=ARBITRUM_NODE_HERE MNEMONIC=YOUR_MNEMONIC_HERE yarn hardhat deploy --tags arbitrum --network arbitrum

完成后,您需要调用以下方法来启动和运行:

  • On the ArbitrumMessenger, OptimismMessenger, and Boba_Messenger, call transferOwnership to pass ownership to the BridgeAdmin address.
  • On the BridgeAdmin, call setDepositContract with the appropriate deposit box, chain id, and messenger for the L2 that you want to enable.
  • On the BridgeAdmin, call whitelistToken to add the WETHBridgePool (or others that you deploy for other tokens) and map it to a particular L2 WETH. This will also allow your L2 DepositBox to begin taking deposits in WETH.

@across/contracts

This package contains the contracts for the Across Protocol. They have been audited by Open Zeppelin and tested thoroughly in automated tests and on mainnet.

Installing and building

To install:

yarn

To build:

yarn build

Running tests

yarn test

Deploying

This repo has a prepared set of deployment scripts. Since across is a multi-chain protocol, the deployment process will involve multiple steps and some configuration transactions afterwards.

To do the basic mainnet deployment of across, you can run:

CUSTOM_NODE_URL=YOUR_NODE_URL_HERE MNEMONIC=YOUR_MNEMONIC_HERE yarn hardhat deploy --tags mainnet --network mainnet

This should print out a set of addresses. You should replace the addresses in networks/1.json with the addresses printed.

Now you should be able to deploy to Arbitrum, Optimism, or Boba by running the same command with a new node url and new network name:

CUSTOM_NODE_URL=ARBITRUM_NODE_HERE MNEMONIC=YOUR_MNEMONIC_HERE yarn hardhat deploy --tags arbitrum --network arbitrum

Once this is done, you will need to call the following methods to get things up and running:

  • On the ArbitrumMessenger, OptimismMessenger, and Boba_Messenger, call transferOwnership to pass ownership to the BridgeAdmin address.
  • On the BridgeAdmin, call setDepositContract with the appropriate deposit box, chain id, and messenger for the L2 that you want to enable.
  • On the BridgeAdmin, call whitelistToken to add the WETHBridgePool (or others that you deploy for other tokens) and map it to a particular L2 WETH. This will also allow your L2 DepositBox to begin taking deposits in WETH.
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文