Skip to content

Commit

Permalink
merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
fadeev committed Sep 20, 2023
2 parents ff6eeeb + b92d76f commit 626e970
Show file tree
Hide file tree
Showing 26 changed files with 6,547 additions and 1,541 deletions.
8 changes: 1 addition & 7 deletions messaging/counter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,7 @@
"@types/node": ">=12.0.0",
"@typescript-eslint/eslint-plugin": "^5.59.9",
"@typescript-eslint/parser": "^5.59.9",
"@zetachain/addresses": "^0.0.9",
"@zetachain/addresses-tools": "^0.0.7",
"@zetachain/faucet-cli": "^2.0.2",
"@zetachain/interfaces": "^0.0.1",
"@zetachain/networks": "^2.3.0",
"@zetachain/protocol-contracts": "^2.1.0",
"@zetachain/toolkit": "^2.1.0",
"@zetachain/toolkit": "^2.1.2",
"axios": "^1.3.6",
"chai": "^4.2.0",
"dotenv": "^16.0.3",
Expand Down
615 changes: 548 additions & 67 deletions messaging/counter/yarn.lock

Large diffs are not rendered by default.

10 changes: 2 additions & 8 deletions messaging/message/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,7 @@
"@types/mocha": ">=9.1.0",
"@types/node": ">=12.0.0",
"@uniswap/v2-periphery": "^1.1.0-beta.0",
"@zetachain/addresses": "^0.0.10",
"@zetachain/addresses-tools": "^0.0.8",
"@zetachain/faucet-cli": "^2.0.2",
"@zetachain/interfaces": "^0.0.1",
"@zetachain/networks": "^2.3.0",
"@zetachain/protocol-contracts": "^2.1.0",
"@zetachain/toolkit": "^2.1.0",
"@zetachain/toolkit": "^2.1.2",
"axios": "^1.3.6",
"chai": "^4.2.0",
"dotenv": "^16.0.3",
Expand All @@ -53,4 +47,4 @@
"typechain": "^8.1.0",
"typescript": ">=4.5.0"
}
}
}
658 changes: 592 additions & 66 deletions messaging/message/yarn.lock

Large diffs are not rendered by default.

8 changes: 1 addition & 7 deletions messaging/value/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,7 @@
"@types/chai": "^4.2.0",
"@types/mocha": ">=9.1.0",
"@types/node": ">=12.0.0",
"@zetachain/addresses": "^0.0.10",
"@zetachain/addresses-tools": "^0.0.8",
"@zetachain/faucet-cli": "^2.0.2",
"@zetachain/interfaces": "^0.0.1",
"@zetachain/networks": "^2.3.0",
"@zetachain/protocol-contracts": "^2.1.0",
"@zetachain/toolkit": "^2.1.0",
"@zetachain/toolkit": "^2.1.2",
"axios": "^1.3.6",
"chai": "^4.3.7",
"dotenv": "^16.0.3",
Expand Down
617 changes: 549 additions & 68 deletions messaging/value/yarn.lock

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions messaging/warriors/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.yarn
artifacts
cache
coverage
node_modules
typechain-types
47 changes: 47 additions & 0 deletions messaging/warriors/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
const path = require("path");

/**
* @type {import("eslint").Linter.Config}
*/
module.exports = {
env: {
browser: false,
es2021: true,
mocha: true,
node: true,
},
extends: ["plugin:prettier/recommended"],
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: 12,
},
plugins: [
"@typescript-eslint",
"prettier",
"simple-import-sort",
"sort-keys-fix",
"typescript-sort-keys",
],
rules: {
"@typescript-eslint/sort-type-union-intersection-members": "error",
camelcase: "off",
"simple-import-sort/exports": "error",
"simple-import-sort/imports": "error",
"sort-keys-fix/sort-keys-fix": "error",
"typescript-sort-keys/interface": "error",
"typescript-sort-keys/string-enum": "error",
},
settings: {
"import/parsers": {
"@typescript-eslint/parser": [".js", ".jsx", ".ts", ".tsx", ".d.ts"],
},
"import/resolver": {
node: {
extensions: [".js", ".jsx", ".ts", ".tsx", ".d.ts"],
},
typescript: {
project: path.join(__dirname, "tsconfig.json"),
},
},
},
};
118 changes: 100 additions & 18 deletions messaging/warriors/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,62 +11,75 @@ installed on your system.

## Getting Started

To get started, install the necessary dependencies by running the following
command in your terminal:
To get started, install the necessary dependencies:

```
yarn
```

## Hardhat Tasks

This template includes two Hardhat tasks that can be used to generate a random
wallet and request tokens from ZetaChain's faucet.
This template includes Hardhat tasks that can be used make it easier to build
with ZetaChain.

### Generating a Random Wallet

To generate a random wallet, run the following command in your terminal:
To generate a random wallet:

```
npx hardhat account --save
```

This will generate a random wallet, print information about the wallet to the
terminal, and save the private key to a `.env` file to make it accessible to
Hardhat. If you don't want to save the wallet (for example, if you just need an
address to send tokens to), you can run the command without the `--save` flag.
This command generates a random wallet, prints information about the wallet to
the terminal, and saves the private key to a `.env` file to make it accessible
to Hardhat. If you don't want to save the wallet (for example, if you just need
an address to send tokens to for testing purposes), you can run the command
without the `--save` flag.

### Querying for Token Balances

To query for token balances, run the following command in your terminal:
To query for token balances:

```
npx hardhat balances
```

This command will query token balances for the account address derived from the
This command queries token balances for the account address derived from the
private key specified in the `.env`.

If you want to query for token balances for a different account, you can use the
`--address` flag:

```
npx hardhat balances --address <address>
npx hardhat balances --address ADDRESS
```

### Requesting Tokens from the Faucet

To request tokens from ZetaChain's faucet using the account from the `.env`
file, run the following command in your terminal:
To request ZETA tokens from the faucet:

```
npx hardhat faucet
```

To install a standalone faucet, run the following command in your terminal:
This command requests tokens from the faucet for the account address derived
from the private key specified in the `.env`. Tokens sent to the address on
ZetaChain. To specify a different chain use a flag:

```
npm install -g @zetachain/faucet-cli
npx hardhat faucet --chain goerli_testnet
```

You can also specify a different address to send the tokens to:

```
npx hardhat faucet --address ADDRESS
```

Alternatively, you can install a standalone faucet CLI:

```
yarn global add @zetachain/faucet-cli@athens3
```

You can then use it with the following command:
Expand All @@ -75,12 +88,49 @@ You can then use it with the following command:
zetafaucet -h
```

### Creating an Omnichain Contract

To create a new omnichain contract:

```
npx hardhat omnichain MyContract
```

This command creates a new omnichain contract in `contracts/MyContract.sol`, a
task to deploy the contract in `tasks/deploy.ts`, and a task to interact with
the contract in `tasks/interact.ts`.

When an omnichain contract is called, it can receive data in the `data` field of
a transaction. This data is passed to the `message` parameter of the contract's
`onCrossChainCall` function. To specify the fields of the `message` parameter,
use positional arguments:

```
npx hardhat omnichain MyContract recepient:address description quantity:uint256
```

A field may have a type specified after the field name, separated by a colon. If
no type is specified, the type defaults to `bytes32`.

Learn more about omnichain contracts by following the
[tutorials](https://www.zetachain.com/docs/developers/omnichain/tutorials/hello/).

### Tracking a Cross-Chain Transaction

After broadcasting a cross-chain transaction on a connected chain either to a
cross-chain messaging contract or to trigger an omnichain contract, you can
track its status:

```
npx hardhat cctx --tx TX_HASH
```

### Verifying a Contract

You can verify a deployed contract with the following command:
To verify a contract deployed on ZetaChain:

```
npx hardhat verify:zeta --contract <address>
npx hardhat verify:zeta --contract ADDRESS
```

Select the contract to verify:
Expand All @@ -94,6 +144,38 @@ Select the contract to verify:

After the confirmation the contract will be verified.

### Sending Tokens

Sending ZETA from ZetaChain to Goerli:

```
npx hardhat send-zeta --amount 1 --network zeta_testnet --destination goerli_testnet
```

Sending ZETA from Goerli to ZetaChain:

```
npx hardhat send-zeta --amount 1 --network goerli_testnet --destination zeta_testnet
```

Depositing gETH to ZetaChain as ZRC-20:

```
npx hardhat send-zrc20 --amount 1 --network goerli_testnet --destination zeta_testnet
```

Withdrawing ZRC-20 from ZetaChain go Goerli as gETH:

```
npx hardhat send-zrc20 --amount 1 --network zeta_testnet --destination goerli_testnet
```

Depositing tBTC from the Bitcoin testnet to ZetaChain:

```
npx hardhat send-btc --amount 1 --recipient TSS_ADDRESS --memo RECIPIENT_ADDRESS_WITHOUT_0x
```

## Next Steps

To learn more about building decentralized apps on ZetaChain, follow the
Expand Down
Loading

0 comments on commit 626e970

Please sign in to comment.