-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
9,489 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Run Tests | ||
|
||
on: | ||
push: | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
setup-matrix: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
matrix: ${{ steps.set-matrix.outputs.matrix }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Test Matrix | ||
id: set-matrix | ||
run: | | ||
test_dirs=$(find examples/*/scripts -type f -name 'test.sh' -exec dirname {} \; | xargs dirname) | ||
matrix_json=$(echo "$test_dirs" | jq -R '{"example-dir": .}' | jq -s . | jq -c .) | ||
echo "matrix=$matrix_json" >> $GITHUB_OUTPUT | ||
test: | ||
needs: setup-matrix | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
include: ${{ fromJSON(needs.setup-matrix.outputs.matrix) }} | ||
fail-fast: false | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Foundry | ||
uses: foundry-rs/foundry-toolchain@v1 | ||
|
||
- name: Run Test Script | ||
run: | | ||
cd "${{ matrix.example-dir }}" | ||
yarn | ||
chmod +x ./scripts/test.sh | ||
./scripts/test.sh localnet |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
if [ "$1" = "localnet" ]; then | ||
npx hardhat localnet --exit-on-error & sleep 10 | ||
fi | ||
|
||
yarn deploy:localnet | ||
|
||
npx hardhat echo-call \ | ||
--contract 0x9E545E3C0baAB3E08CdfD552C960A1050f373042 \ | ||
--receiver 0x84eA74d481Ee0A5332c457a4d796187F6Ba67fEB \ | ||
--network localhost \ | ||
--types '["string"]' alice | ||
|
||
npx hardhat localnet-check | ||
|
||
npx hardhat hello-call \ | ||
--contract 0x84eA74d481Ee0A5332c457a4d796187F6Ba67fEB \ | ||
--receiver 0x9E545E3C0baAB3E08CdfD552C960A1050f373042 \ | ||
--zrc20 0x2ca7d64A7EFE2D62A725E2B35Cf7230D6677FfEe \ | ||
--function "hello(string)" \ | ||
--network localhost \ | ||
--types '["string"]' alice | ||
|
||
npx hardhat localnet-check | ||
|
||
npx hardhat hello-withdraw-and-call \ | ||
--contract 0x84eA74d481Ee0A5332c457a4d796187F6Ba67fEB \ | ||
--receiver 0x9E545E3C0baAB3E08CdfD552C960A1050f373042 \ | ||
--zrc20 0x9fd96203f7b22bCF72d9DCb40ff98302376cE09c \ | ||
--function "hello(string)" \ | ||
--amount 1 \ | ||
--network localhost \ | ||
--types '["string"]' hello | ||
|
||
npx hardhat localnet-check | ||
|
||
npx hardhat localnet-stop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2402,15 +2402,15 @@ | |
typescript "5.5.4" | ||
zod "3.22.4" | ||
|
||
"@zetachain/localnet@^3.3.0": | ||
version "3.3.0" | ||
resolved "https://registry.yarnpkg.com/@zetachain/localnet/-/localnet-3.3.0.tgz#eb026e1e56ef4ea78fd5efb15df2f931daeba884" | ||
integrity sha512-8PbS6GQrROYicyEHk3QGhspwKnm3Nn8tmgISbtVw2ca4I+9lIAnuo4WstBPXhV3/kR9zPxgxErWnBWNSE78BuA== | ||
"@zetachain/localnet@^3.5.0": | ||
version "3.5.0" | ||
resolved "https://registry.yarnpkg.com/@zetachain/localnet/-/localnet-3.5.0.tgz#a4d1509a154a736b868d7a89eb6a920f8047083e" | ||
integrity sha512-awZMdQE/inTGmR4dBa+yrMwoedZGSjU+QPOx91gBgRAWcWOx6BYX+MJxcrfpmdu/oMPbMWUK262o2HD19Kfrkw== | ||
dependencies: | ||
"@inquirer/prompts" "^5.5.0" | ||
"@uniswap/v2-core" "^1.0.1" | ||
"@uniswap/v2-periphery" "^1.1.0-beta.0" | ||
"@zetachain/protocol-contracts" "10.0.0-rc10" | ||
"@zetachain/protocol-contracts" "10.0.0-rc11" | ||
ansis "^3.3.2" | ||
concurrently "^8.2.2" | ||
ethers "^6.13.2" | ||
|
@@ -2424,13 +2424,14 @@ | |
dependencies: | ||
dotenv "^16.1.4" | ||
|
||
"@zetachain/[email protected]rc10": | ||
version "10.0.0-rc10" | ||
resolved "https://registry.yarnpkg.com/@zetachain/protocol-contracts/-/protocol-contracts-10.0.0-rc10.tgz#e3c21b493904ec743c9026627b2f809009fec7a2" | ||
integrity sha512-kOH7Lk0os3xt9N/FCdeaLUMyonfez97q69Jy2YFwddjv9jpqaxwLXWj2hvdIFc21inKZ7HIjmDDcj9/n8gITKg== | ||
"@zetachain/[email protected]rc11": | ||
version "10.0.0-rc11" | ||
resolved "https://registry.yarnpkg.com/@zetachain/protocol-contracts/-/protocol-contracts-10.0.0-rc11.tgz#53f55ead492f7b5802b1feae4e51abc75730af33" | ||
integrity sha512-qWazjqnIGRngf4OmyeSIv7sHICQRdMQ1CKPIQIqxA8qFR+gHhDHSfvMdRAvgWbsfkimXOIFiHVIATypyWhviJw== | ||
dependencies: | ||
"@openzeppelin/contracts" "^5.0.2" | ||
"@openzeppelin/contracts-upgradeable" "^5.0.2" | ||
"@zetachain/networks" "^10.0.0" | ||
ethers "^6.13.1" | ||
|
||
"@zetachain/[email protected]": | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.yarn | ||
artifacts | ||
cache | ||
coverage | ||
node_modules | ||
typechain-types |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"), | ||
}, | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
node_modules | ||
.env | ||
coverage | ||
coverage.json | ||
typechain | ||
typechain-types | ||
dependencies | ||
|
||
# Hardhat files | ||
cache | ||
artifacts | ||
|
||
# Foundry files | ||
out | ||
cache_forge | ||
|
||
access_token |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 ZetaChain | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# NFT Example | ||
|
||
This example currently only works with localnet `v4.0.0-rc*`, which supports | ||
authenticated calls and multiple EVM chains. |
Oops, something went wrong.