@across-protocol/contracts-v2

中文文档
2.5.10发布于 2024/05/29AGPL-3.0-onlyTypeScriptCommonJS近 30 天下载 3059

The latest contract deployments on Production will always be under the deployed tag.

原始使用文档
文档目录10 节
  1. Deployed Contract Versions
  2. Build
  3. Test
  4. Lint
  5. Deploy and Verify
  6. Tasks
  7. Slither
  8. ZK Sync Adapter
  9. Compile
  10. License

Across-logo

Contains smart contract suite to enable instant token transfers between any two networks. Relays are backstopped by liquidity held in a central HubPool on Ethereum, which also serves as the cross-chain administrator of all contracts in the system. SpokePool contracts are deployed to any network that wants to originate token deposits or be the final destination for token transfers, and they are all governed by the HubPool on Ethereum.

This contract set is the second iteration of the Across smart contracts which facilitate token transfers from any L2 to L1.

These contracts were audited by OpenZeppelin which is a great resource for understanding the contracts.

This video is also useful for understanding the technical architecture.

Deployed Contract Versions

The latest contract deployments on Production will always be under the deployed tag.

Build

yarn
yarn hardhat compile

Test

yarn test # Run unit tests without gas analysis
yarn test:gas-analytics # Run only tests that count gas costs
yarn test:report-gas # Run unit tests with hardhat-gas-reporter enabled

Lint

yarn lint
yarn lint-fix

Deploy and Verify

NODE_URL_1=https://mainnet.infura.com/xxx yarn hardhat deploy --tags HubPool --network mainnet
ETHERSCAN_API_KEY=XXX yarn hardhat etherscan-verify --network mainnet --license AGPL-3.0 --force-license --solc-input

Tasks

Finalize Scroll Claims from L2 -> L1 (Mainnet | Sepolia)
yarn hardhat finalize-scroll-claims --l2-address {operatorAddress}

Slither

Slither is a Solidity static analysis framework written in Python 3. It runs a suite of vulnerability detectors, prints visual information about contract details, and provides an API to easily write custom analyses. Slither enables developers to find vulnerabilities, enhance their code comprehension, and quickly prototype custom analyses.

Spire-Contracts has been analyzed using [email protected] and no major bugs was found. To rerun the analytics, run:

slither contracts/SpokePool.sol
\ --solc-remaps @=node_modules/@
\ --solc-args "--optimize --optimize-runs 1000000"
\ --filter-paths "node_modules"
\ --exclude naming-convention

You can replace SpokePool.sol with the specific contract you want to analyze.

ZK Sync Adapter

These are special instructions for compiling and deploying contracts on zksync. The compile command will create artifacts-zk and cache-zk directories.

Compile

This step requires Docker Desktop to be running, as the solc docker image is fetched as a prerequisite.

yarn compile-zksync

License

All code in this repository is licensed under BUSL-1.1 unless specified differently in the file. Individual exceptions to this license can be made by Risk Labs, which holds the rights to this software and design. If you are interested in using the code or designs in a derivative work, feel free to reach out to [email protected].

版本与发布记录

@across-protocol/contracts-v2 共发布 134 个版本,首次发布于 2022/03/05;过去 12 个月发布了 0 个版本。

版本发布日期距今
2.5.10latest2024/05/292 年前
2.5.92024/05/222 年前
2.5.72024/05/162 年前
2.5.62024/04/202 年前
2.5.52024/03/262 年前
2.5.42024/03/222 年前

其他发布通道:beta → 2.5.0-beta.9。

关于 @across-protocol/contracts-v2 的常见问题

@across-protocol/contracts-v2 是什么?

The latest contract deployments on Production will always be under the deployed tag.

如何安装 @across-protocol/contracts-v2?

在项目目录运行 npm install @across-protocol/contracts-v2,或使用 pnpm add / yarn add / bun add。

@across-protocol/contracts-v2 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@across-protocol/contracts-v2 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@across-protocol/contracts-v2 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=16.18.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@across-protocol/contracts-v2 可以商用吗?

@across-protocol/contracts-v2 使用 AGPL-3.0-only 许可。最严格的 Copyleft:除分发外,通过网络向用户提供基于它的服务也需要开源对应源码。闭源 SaaS 使用前务必评估。以上为概括,不构成法律意见,请以许可原文为准。

@across-protocol/contracts-v2 的下载量有多少?

根据 npm 官方下载统计,@across-protocol/contracts-v2 在 2026/10/05 – 2026/11/03 这 30 天内被下载 3,059 次,日均约 102 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@across-protocol/contracts-v2 还在维护吗?

最新版本 2.5.10 发布于 2024/05/29(2 年前);至今共发布 134 个版本,其中过去 12 个月发布了 0 个;首次发布于 2022/03/05。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。