-
Notifications
You must be signed in to change notification settings - Fork 49
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
Gateway testnet #207
Gateway testnet #207
Changes from all commits
55c7031
012c5e6
72ff65b
2715a72
b4f8749
e360b47
95914a5
ee7ad2f
7d73ae0
0f5ad41
ca90755
6751cc2
1ed0d9e
4d7f25c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+20
to
+22
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. might be cleaner to just write this in actions/github-script in javascript: https://github.com/actions/github-script
Comment on lines
+17
to
+22
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. π οΈ Refactor suggestion Enhance matrix setup using github-script. Replace the shell script with a more robust JavaScript implementation using the - - 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
+ - name: Set up Test Matrix
+ id: set-matrix
+ uses: actions/github-script@v7
+ with:
+ script: |
+ const { execSync } = require('child_process');
+ try {
+ const testDirs = execSync('find examples/*/scripts -type f -name "test.sh"')
+ .toString()
+ .trim()
+ .split('\n')
+ .map(path => path.replace(/\/scripts\/test\.sh$/, ''))
+ .filter(Boolean);
+
+ if (!testDirs.length) {
+ throw new Error('No test directories found');
+ }
+
+ const matrix = {
+ 'example-dir': testDirs
+ };
+
+ core.setOutput('matrix', JSON.stringify(matrix));
+ } catch (error) {
+ core.setFailed(`Matrix setup failed: ${error.message}`);
+ } π Committable suggestion
Suggested change
π§° Toolsπͺ actionlint18-18: shellcheck reported issue in this script: SC2038:warning:1:13: Use -print0/-0 or -exec + to allow for non-alphanumeric filenames (shellcheck) 18-18: shellcheck reported issue in this script: SC2086:info:3:31: Double quote to prevent globbing and word splitting (shellcheck) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,8 +17,8 @@ contract Hello is UniversalContract { | |
gateway = GatewayZEVM(gatewayAddress); | ||
} | ||
|
||
function onCrossChainCall( | ||
zContext calldata context, | ||
function onCall( | ||
MessageContext calldata context, | ||
Comment on lines
+20
to
+21
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. π‘ Codebase verification API Evolution Requires Attention: Legacy Contracts Found The verification reveals that legacy contracts in the
This indicates a breaking change in the contract interface from
π Analysis chainVerify migration steps for onCall function signature change. The function signature change from
π Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Search for other contracts that might need similar updates
rg -l "onCrossChainCall" --type sol
# Check if there are any remaining references to zContext
rg -l "zContext" --type sol
Length of output: 119 Script: #!/bin/bash
# Search for Solidity files first
fd -e sol
# Then search for function and type references without file type filter
rg "onCrossChainCall"
rg "zContext"
# Look for any interface definitions that might show the evolution of the API
rg "interface.*Contract" -A 5
Length of output: 4767 |
||
address zrc20, | ||
uint256 amount, | ||
bytes calldata message | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
"test": "echo \"Error: no test specified\" && exit 1", | ||
"lint:fix": "npx eslint . --ext .js,.ts --fix", | ||
"lint": "npx eslint . --ext .js,.ts", | ||
"deploy": "npx hardhat compile --force && npx hardhat deploy --network localhost && npx hardhat deploy --name Echo --network localhost --gateway 0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0" | ||
"deploy:localnet": "npx hardhat compile --force && npx hardhat deploy --network localhost --gateway 0x9A676e781A523b5d0C0e43731313A708CB607508 && npx hardhat deploy --name Echo --network localhost --gateway 0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. π οΈ Refactor suggestion Add deployment scripts for testnets mentioned in PR objectives. The current script only handles localhost deployment. Consider adding separate scripts for Base Sepolia, Polygon Amoy, and ZetaChain testnet deployments to align with the PR objectives. "scripts": {
"deploy:localnet": "npx hardhat compile --force && npx hardhat deploy --network localhost --gateway 0x9A676e781A523b5d0C0e43731313A708CB607508 && npx hardhat deploy --name Echo --network localhost --gateway 0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0",
+ "deploy:base-sepolia": "npx hardhat compile --force && npx hardhat deploy --network base-sepolia",
+ "deploy:polygon-amoy": "npx hardhat compile --force && npx hardhat deploy --network polygon-amoy",
+ "deploy:zeta-testnet": "npx hardhat compile --force && npx hardhat deploy --network zeta-testnet"
}
|
||
}, | ||
"keywords": [], | ||
"author": "", | ||
|
@@ -28,7 +28,7 @@ | |
"@types/node": ">=12.0.0", | ||
"@typescript-eslint/eslint-plugin": "^5.59.9", | ||
"@typescript-eslint/parser": "^5.59.9", | ||
"@zetachain/localnet": "^3.3.0", | ||
"@zetachain/localnet": "^3.5.0", | ||
"@zetachain/toolkit": "13.0.0-rc4", | ||
"axios": "^1.3.6", | ||
"chai": "^4.2.0", | ||
|
@@ -57,6 +57,6 @@ | |
"@solana-developers/helpers": "^2.4.0", | ||
"@solana/spl-memo": "^0.2.5", | ||
"@solana/web3.js": "^1.95.2", | ||
"@zetachain/protocol-contracts": "10.0.0-rc10" | ||
"@zetachain/protocol-contracts": "10.0.0-rc11" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,40 @@ | ||||||||||||||||||||||||||||||||||||||||||||||
#!/bin/bash | ||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||
set -e | ||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+1
to
+4
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. π οΈ Refactor suggestion Enhance script robustness with additional safety measures. While #!/bin/bash
-set -e
+set -euo pipefail
+
+# Cleanup function to ensure the local network is stopped
+cleanup() {
+ if [ "${1:-}" = "localnet" ]; then
+ npx hardhat localnet-stop || true
+ fi
+}
+
+# Set up trap for script interruption
+trap 'cleanup "$1"' EXIT π Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||
if [ "$1" = "localnet" ]; then | ||||||||||||||||||||||||||||||||||||||||||||||
npx hardhat localnet --exit-on-error & sleep 10 | ||||||||||||||||||||||||||||||||||||||||||||||
fi | ||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+5
to
+7
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Implement proper network readiness check. Replace the fixed sleep with a proper health check loop: if [ "$1" = "localnet" ]; then
- npx hardhat localnet --exit-on-error & sleep 10
+ npx hardhat localnet --exit-on-error &
+ network_pid=$!
+
+ # Wait for network to be ready with timeout
+ max_attempts=30
+ attempt=1
+ echo "Waiting for local network to be ready..."
+ while ! npx hardhat localnet-check &>/dev/null; do
+ if [ $attempt -gt $max_attempts ]; then
+ echo "Network failed to start within timeout"
+ kill $network_pid
+ exit 1
+ fi
+ sleep 1
+ ((attempt++))
+ done
+ echo "Local network is ready"
fi π Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||
yarn deploy:localnet | ||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||
npx hardhat echo-call \ | ||||||||||||||||||||||||||||||||||||||||||||||
--contract 0x9E545E3C0baAB3E08CdfD552C960A1050f373042 \ | ||||||||||||||||||||||||||||||||||||||||||||||
--receiver 0x84eA74d481Ee0A5332c457a4d796187F6Ba67fEB \ | ||||||||||||||||||||||||||||||||||||||||||||||
--network localhost \ | ||||||||||||||||||||||||||||||||||||||||||||||
--types '["string"]' alice | ||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+9
to
+15
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. π οΈ Refactor suggestion Refactor contract interactions for maintainability and safety. The script contains several issues:
+# Load contract addresses from configuration
+source ./config/addresses.sh
+
+# Helper function for contract calls
+do_contract_call() {
+ local cmd=$1
+ shift
+ if ! npx hardhat "$cmd" "$@"; then
+ echo "Contract call failed: $cmd"
+ exit 1
+ fi
+}
+
yarn deploy:localnet
+# Verify deployment success
+if [ $? -ne 0 ]; then
+ echo "Deployment failed"
+ exit 1
+fi
-npx hardhat echo-call \
- --contract 0x9E545E3C0baAB3E08CdfD552C960A1050f373042 \
- --receiver 0x84eA74d481Ee0A5332c457a4d796187F6Ba67fEB \
+do_contract_call echo-call \
+ --contract "$ECHO_CONTRACT" \
+ --receiver "$HELLO_CONTRACT" \
--network localhost \
--types '["string"]' alice Also applies to: 19-26, 29-37 |
||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||
npx hardhat localnet-check | ||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Enhance network monitoring reliability. The network checks lack proper error handling and timeout mechanisms: +# Helper function for network checks
+check_network() {
+ local max_attempts=5
+ local attempt=1
+ while [ $attempt -le $max_attempts ]; do
+ if npx hardhat localnet-check; then
+ return 0
+ fi
+ echo "Network check attempt $attempt failed, retrying..."
+ sleep 2
+ ((attempt++))
+ done
+ echo "Network check failed after $max_attempts attempts"
+ return 1
+}
+
-npx hardhat localnet-check
+check_network || exit 1 Also applies to: 27-27, 38-38, 40-40 |
||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||
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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,6 @@ task("deploy", "Deploy the contract", main) | |
.addOptionalParam("name", "Contract to deploy", "Hello") | ||
.addOptionalParam( | ||
"gateway", | ||
"Gateway address (default: ZetaChain Gateway)", | ||
"0xA51c1fc2f0D1a1b8494Ed1FE312d7C3a78Ed91C0" | ||
"Gateway address (default: ZetaChain Gateway on testnet)", | ||
"0x6c533f7fe93fae114d0954697069df33c9b74fd7" | ||
Comment on lines
+34
to
+35
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. π οΈ Refactor suggestion Consider using environment-specific gateway addresses While the updated gateway address is correct for the testnet, hardcoding it directly in the task definition might cause issues when deploying to different environments. Consider implementing a more flexible configuration approach. Here's a suggested implementation using network-specific configuration: + const GATEWAY_ADDRESSES = {
+ baseSepolia: "0x6c533f7fe93fae114d0954697069df33c9b74fd7",
+ polygonAmoy: "0x...", // Add Polygon Amoy gateway address
+ zetaChainTestnet: "0x...", // Add ZetaChain testnet gateway address
+ };
task("deploy", "Deploy the contract", main)
.addFlag("json", "Output in JSON")
.addOptionalParam("name", "Contract to deploy", "Hello")
.addOptionalParam(
"gateway",
- "Gateway address (default: ZetaChain Gateway on testnet)",
- "0x6c533f7fe93fae114d0954697069df33c9b74fd7"
+ "Gateway address (defaults to network-specific gateway address)",
+ undefined,
types.string
); Then update the main function to use network-specific addresses: const main = async (args: any, hre: HardhatRuntimeEnvironment) => {
const network = hre.network.name;
const gatewayAddress = args.gateway || GATEWAY_ADDRESSES[network];
if (!gatewayAddress) {
throw new Error(`No gateway address configured for network: ${network}`);
}
// ... rest of the deployment logic
const contract = await (factory as any).deploy(gatewayAddress); π‘ Codebase verification Different gateway addresses detected across examples The hello and NFT examples are using different gateway addresses:
This inconsistency in gateway addresses between examples should be addressed to prevent confusion. Consider:
π Analysis chainVerify gateway address usage across networks Let's verify how this gateway address is being used across different networks to ensure consistency. Let me check the gateway address configuration in the NFT example to get a complete picture. π Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Search for gateway address usage across the codebase
echo "Searching for gateway address references..."
rg -i "0x6c533f7fe93fae114d0954697069df33c9b74fd7"
echo "\nSearching for potential gateway configurations..."
rg -l "gateway.*address" --type ts
Length of output: 406 Script: #!/bin/bash
# Check the gateway address configuration in the NFT example
echo "Content of examples/nft/tasks/deploy.ts:"
cat examples/nft/tasks/deploy.ts
Length of output: 1498 |
||
); |
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]": | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.yarn | ||
artifacts | ||
cache | ||
coverage | ||
node_modules | ||
typechain-types |
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", | ||||||||||||||||||||||||||||||||||||||||||||
], | ||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+18
to
+24
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. π οΈ Refactor suggestion Consider adding error prevention plugins While the current plugins focus on code organization and formatting, consider adding plugins for error prevention: plugins: [
"@typescript-eslint",
"prettier",
"simple-import-sort",
"sort-keys-fix",
"typescript-sort-keys",
+ "eslint-plugin-import",
+ "eslint-plugin-promise",
+ "eslint-plugin-security"
], π Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||
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", | ||||||||||||||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+25
to
+33
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. π οΈ Refactor suggestion Consider strengthening TypeScript-specific rules The current rules focus on sorting and formatting. Consider adding stricter TypeScript-specific rules for better type safety. rules: {
"@typescript-eslint/sort-type-union-intersection-members": "error",
+ "@typescript-eslint/explicit-function-return-type": "error",
+ "@typescript-eslint/no-explicit-any": "error",
+ "@typescript-eslint/strict-boolean-expressions": "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",
}, π Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||
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"), | ||||||||||||||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||||||||||||||
}; |
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 |
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. |
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1ed0d9e