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-contractsGetting 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 (opens in a new tab) page in the docs.
Importing
ZetaInterfaces (opens in a new tab)
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 (opens in a new tab) and the system contract (opens in a new tab) 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:
- Node.js (opens in a new tab)
- Yarn (opens in a new tab)
- jq (opens in a new tab)
- abigen (opens in a new tab)
Compiling Contracts
To compile the contracts, run the following command:
yarn compileThis will compile the Solidity contracts and output the resulting JSON artifacts
to the artifacts directory.
Generating Go Bindings and Contract Addresses
To generate Go bindings for the Solidity contracts and fetch, run the following command:
yarn generateThis will use abigen to generate Go bindings for the contracts and output the
resulting Go files to the pkg directory.
Contributing
If you would like to contribute to this project, please fork the repository and submit a pull request. All contributions are welcome!