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

chore: make v2 the root of the directory #449

Merged
merged 7 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
12 changes: 4 additions & 8 deletions .coderabbit.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
reviews:
path_filters:
- "!v1/pkg/**"
- "!v2/pkg/**"
- "!v1/typechain-types/**"
- "!v2/types/**"
- "!v1/docs/**"
- "!v2/docs/**"
- "!v1/data/**"
- "!v2/data/**"
- "!pkg/**"
- "!types/**"
- "!docs/**"
- "!data/**"
path_instructions:
- path: "contracts/**"
instructions: >-
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
name: Generated Files are Updated (V2)
name: Generated Files are Updated

on:
push:
branches:
- main
paths:
- "v2/**"
- "**"
pull_request:
branches:
- "**"
paths:
- "v2/**"
- "**"
types:
- synchronize
- opened
Expand All @@ -19,7 +19,7 @@ on:

defaults:
run:
working-directory: ./v2
working-directory: .

jobs:
generate:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
name: Lint TS/JS/Sol (V2)
name: Lint TS/JS/Sol

on:
push:
branches:
- main
paths:
- 'v2/**'
- '**'
pull_request:
branches:
- "**"
paths:
- 'v2/**'
- '**'
types:
- synchronize
- opened
Expand All @@ -19,7 +19,7 @@ on:

defaults:
run:
working-directory: ./v2
working-directory: .

jobs:
lint:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Publish to NPM (V2)
name: Publish to NPM

on:
workflow_dispatch:
Expand All @@ -9,7 +9,7 @@ on:

defaults:
run:
working-directory: ./v2
working-directory: .

jobs:
publish:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
name: Slither (V2)
name: Slither

on:
push:
branches:
- main
paths:
- 'v2/**'
- '**'
pull_request:
branches:
- "**"
paths:
- 'v2/**'
- '**'
types:
- synchronize
- opened
Expand All @@ -19,7 +19,7 @@ on:

defaults:
run:
working-directory: ./v2
working-directory: .

jobs:
slither:
Expand Down Expand Up @@ -55,10 +55,10 @@ jobs:
with:
sarif: results.sarif
node-version: "21.1.0"
slither-config: "v2/slither.config.json"
slither-config: "slither.config.json"
solc-version: "0.8.26"
fail-on: medium
target: "v2/"
target: "./"

- name: Upload SARIF file
uses: github/codeql-action/upload-sarif@v3
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
name: Test (V2)
name: Test

on:
push:
branches:
- main
paths:
- 'v2/**'
- '**'
pull_request:
branches:
- "**"
paths:
- 'v2/**'
- '**'
types:
- synchronize
- opened
Expand All @@ -19,7 +19,7 @@ on:

defaults:
run:
working-directory: ./v2
working-directory: .

jobs:
test:
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ crytic-export

out
cache_forge
v2/broadcast/*/31337
broadcast/*/31337

dependencies/

Expand Down
66 changes: 63 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,67 @@ Contracts of official protocol contracts deployed by the core ZetaChain team.
* Check our [website](https://www.zetachain.com/).
* Read our [docs](https://docs.zetachain.com/).

## Packages
## Codebase

* [v1 legacy contracts](v1)
* [v2 new contracts (currently in development)](v2)
The protocol contracts codebase is separated into two sections:

- `zevm`: contracts deployed on ZetaChain
- `evm`: contracts deployed on EVM connected chains (Ethereum, Base, etc..)

**ZEVM Contracts**

- `GatewayZEVM`: entrypoints for interaction. The users call the gateway contract to initiate cctx. The gateway contract is also the contract calling the target when a smart contract call is initiated on a connected chain
- `ZRC20`: is a ERC20 compliant contract that represents fungible assets from connected chains
- `WZETA`: wrapped ZETA (fork of WETH)

**EVM Contracts**

- `GatewayEVM`: similar to GatewayZEVM for connected chains. Entrypoint for users.
- `ERC20Custody`: hold ERC20 assets being sent to ZetaChain
- `ZetaConnector`: manage ZETA for connected chains. There are two version of the contract:
- Native: when the ZETA tokens are native to the chain (ZETA where initially deployed as a ERC20 on Ethereum, not emitted fully on ZetaChain). Use lock/unlock model.
- Non-Native: when ZETA tokens where never native to the chains but withdrawn from ZetaChain. Use mint/burn model.
- TSS (EOA): Threshold-signature-scheme wallet, this address holds the gas token sent to ZetaChain (like Ethers)

[Learn more about the Gateway contracts](https://www.zetachain.com/docs/developers/evm/gateway/)

## Usage

**Install dependencies**

```shell
$ yarn
$ forge soldeer update
```

**Build**

```shell
$ forge build
```

**Test**

```shell
$ forge test
```

**Format**

```shell
$ forge fmt
```

**Deploy**

```shell
$ forge script script/<DeployScript>.s.sol:<DeployScript> --rpc-url <your_rpc_url> --private-key <your_private_key>
```

To view detailed instructions on how to deploy the contracts, please refer to the [Deployment Guide](./scripts/deploy/readme.md).

This guide covers all steps required to deploy the contracts, including environment setup, commands, and best practices.

## Community

[X](https://x.com/zetablockchain) | [Discord](https://discord.com/invite/zetachain) | [Telegram](https://t.me/zetachainofficial) | [Website](https://zetachain.com)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
26 changes: 26 additions & 0 deletions v2/data/addresses.mainnet.json → data/addresses.mainnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,19 @@
"symbol": "SOL.SOL",
"type": "zrc20"
},
{
"address": "0x54Bf2B1E91FCb56853097BD2545750d218E245e1",
"asset": "cbbtcf3aa214zXHbiAZQwf4122FBYbraNdFqgw4iMij",
"category": "omnichain",
"chain_id": 7000,
"chain_name": "zeta_mainnet",
"coin_type": "erc20",
"decimals": 8,
"description": "ZetaChain ZRC20 cbBTC on Solana Mainnet",
"foreign_chain_id": "900",
"symbol": "CBBTC.SOL",
"type": "zrc20"
},
{
"address": "0x777915D031d1e8144c90D025C594b3b8Bf07a08d",
"asset": "0x95ad61b0a150d79219dcf64e1e6cc01f0b64c4ce",
Expand Down Expand Up @@ -424,6 +437,19 @@
"symbol": "ULTI.ETH",
"type": "zrc20"
},
{
"address": "0xEe9CC614D03e7Dbe994b514079f4914a605B4719",
"asset": "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",
"category": "omnichain",
"chain_id": 7000,
"chain_name": "zeta_mainnet",
"coin_type": "erc20",
"decimals": 6,
"description": "ZetaChain ZRC20 USDT on Solana Mainnet",
"foreign_chain_id": "900",
"symbol": "USDT.SOL",
"type": "zrc20"
},
{
"address": "0xfC9201f4116aE6b054722E10b98D904829b469c3",
"asset": "0x3c499c542cef5e3811e1192ce70d8cc03d5c3359",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@
},
{
"address": "0xe573a6e11f8506620F123DBF930222163D46BCB6",
"asset": "0x41e94eb019c0762f9bfcf9fb1e58725bfb0e7582",
"asset": "0x41E94Eb019C0762f9Bfcf9Fb1E58725BfB0e7582",
"category": "omnichain",
"chain_id": 7001,
"chain_name": "zeta_testnet",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
73 changes: 73 additions & 0 deletions docs/src/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# ZetaChain Protocol Contracts

Contracts of official protocol contracts deployed by the core ZetaChain team.

### Learn more about ZetaChain

* Check our [website](https://www.zetachain.com/).
* Read our [docs](https://docs.zetachain.com/).

### Codebase

The protocol contracts V2 codebase is separated into two sections:

- `zevm`: contracts deployed on ZetaChain
- `evm`: contracts deployed on EVM connected chains (Ethereum, Base, etc..)

**ZEVM Contracts**

- `GatewayZEVM`: entrypoints for interaction. The users call the gateway contract to initiate cctx. The gateway contract is also the contract calling the target when a smart contract call is initiated on a connected chain
- `ZRC20`: is a ERC20 compliant contract that represents fungible assets from connected chains
- `WZETA`: wrapped ZETA (fork of WETH)

**EVM Contracts**

- `GatewayEVM`: similar to GatewayZEVM for connected chains. Entrypoint for users.
- `ERC20Custody`: hold ERC20 assets being sent to ZetaChain
- `ZetaConnector`: manage ZETA for connected chains. There are two version of the contract:
- Native: when the ZETA tokens are native to the chain (ZETA where initially deployed as a ERC20 on Ethereum, not emitted fully on ZetaChain). Use lock/unlock model.
- Non-Native: when ZETA tokens where never native to the chains but withdrawn from ZetaChain. Use mint/burn model.
- TSS (EOA): Threshold-signature-scheme wallet, this address holds the gas token sent to ZetaChain (like Ethers)

[Learn more about the Gateway contracts](https://www.zetachain.com/docs/developers/evm/gateway/)

### Usage

**Install dependencies**

```shell
$ yarn
$ forge soldeer update
```

**Build**

```shell
$ forge build
```

**Test**

```shell
$ forge test
```

**Format**

```shell
$ forge fmt
```

**Deploy**

```shell
$ forge script script/<DeployScript>.s.sol:<DeployScript> --rpc-url <your_rpc_url> --private-key <your_private_key>
```

To view detailed instructions on how to deploy the contracts, please refer to the [Deployment Guide](./scripts/deploy/readme.md).

This guide covers all steps required to deploy the contracts, including environment setup, commands, and best practices.

### Community

[X](https://x.com/zetablockchain) | [Discord](https://discord.com/invite/zetachain) | [Telegram](https://t.me/zetachainofficial) | [Website](https://zetachain.com)
File renamed without changes.
File renamed without changes.
Loading
Loading