Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@zetachain/protocol-contracts

Package Overview
Dependencies
Maintainers
0
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@zetachain/protocol-contracts

We are currently developing Version 2 (V2) of our smart contract architecture. This new version will significantly enhance the developer experience for building Universal Apps.

  • 9.0.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
937
increased by2.07%
Maintainers
0
Weekly downloads
 
Created
Source

⚠️ Important Notice: V2 in Development

We are currently developing Version 2 (V2) of our smart contract architecture. This new version will significantly enhance the developer experience for building Universal Apps.

Developers can already begin testing the new interface by referring to the V2 Localnet guide.

ZetaChain Protocol Contracts

This repository contains ZetaChain protocol contracts: Solidity source code, generated Go bindings, deployed contract addresses and helper utilities.

Importing Protocol Contracts

As a dApp developer, you can install the protocol contracts package into your project:

yarn add --dev @zetachain/protocol-contracts

Getting the TSS address on BSC testnet:

import { getAddress } from "@zetachain/protocol-contracts";

getAddress("tss", "zeta_testnet");

Getting a ZRC-20 BSC USDT on ZetaChain Mainnet Beta:

import { getAddress } from "@zetachain/protocol-contracts";

getAddress("zrc20", "zeta_mainnet", "USDT.BSC");

The third argument (symbol) is only used when querying ZRC-20 addresses to specify which token address is needed.

To view a table of all contracts visit the Contract Addresses page in the docs.

Importing ZetaInterfaces and ZetaInteractor for cross-chain messaging:

import "@zetachain/protocol-contracts/contracts/evm/interfaces/ZetaInterfaces.sol";
import "@zetachain/protocol-contracts/contracts/evm/tools/ZetaInteractor.sol";

Importing ZRC20 and the system contract for omni-chain smart contracts:

import "@zetachain/protocol-contracts/contracts/zevm/interfaces/IZRC20.sol";
import "@zetachain/protocol-contracts/contracts/zevm/interfaces/zContract.sol";
import "@zetachain/protocol-contracts/contracts/zevm/SystemContract.sol";

Prerequisites for Development

Before you can contribute to this project, you must have the following installed:

Compiling Contracts

To compile the contracts, run the following command:

yarn compile

This will compile the Solidity contracts and output the resulting JSON artifacts to the artifacts directory.

Test

To run v1 tests (hardhat):

yarn test

To run v2 tests (hardhat):

yarn test:prototypes

To run v2 tests (forge):

forge test -vvvv

Generating Go Bindings and Contract Addresses

To generate Go bindings for the Solidity contracts and fetch, run the following command:

yarn generate

This will use abigen to generate Go bindings for the contracts and output the resulting Go files to the pkg directory.

Generating Contract Docs

To generate the docs from protocol contracts, run the following command:

yarn docs

This script uses forge doc to generate the docs.

Contributing

If you would like to contribute to this project, please fork the repository and submit a pull request. All contributions are welcome!

FAQs

Package last updated on 31 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc