diff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.yml deleted file mode 100644 index a1b8d6a3..00000000 --- a/.github/workflows/publish-npm.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: Publish to NPM - -on: - release: - types: [published] - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - name: Checkout Repository - uses: actions/checkout@v3 - - - name: Setup Node.js - uses: actions/setup-node@v3 - with: - node-version: "16" - registry-url: "https://registry.npmjs.org" - - - name: Install Dependencies - run: yarn install - - - name: Build - run: yarn build - - - name: Determine NPM Tag - id: determine-npm-tag - run: | - VERSION_TAG=${GITHUB_REF#refs/tags/v} - if [[ $VERSION_TAG == *"-"* ]]; then - echo ::set-output name=NPM_TAG::${VERSION_TAG#*-} - else - echo ::set-output name=NPM_TAG::latest - fi - env: - GITHUB_REF: ${{ github.ref }} - - - name: Publish to NPM - run: yarn publish --new-version ${GITHUB_REF#refs/tags/v} --tag ${{ steps.determine-npm-tag.outputs.NPM_TAG }} --no-git-tag-version - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - GITHUB_REF: ${{ github.ref }} \ No newline at end of file diff --git a/.github/workflows/slither.yaml b/.github/workflows/slither.yaml index 236d1a70..0333b131 100644 --- a/.github/workflows/slither.yaml +++ b/.github/workflows/slither.yaml @@ -21,10 +21,14 @@ jobs: include: - project: "examples/hello" file: "hello.sarif" + - project: "examples/call" + file: "call.sarif" - project: "examples/swap" file: "swap.sarif" - - project: "omnichain/swap" - file: "omnichain-swap.sarif" + - project: "examples/nft" + file: "nft.sarif" + - project: "examples/token" + file: "token.sarif" permissions: contents: read security-events: write diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 1fdd0546..43249c83 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -16,7 +16,7 @@ jobs: - name: Set up Test Matrix id: set-matrix run: | - test_dirs=$(find examples/*/scripts -type f -name 'test.sh' -exec dirname {} \; | xargs dirname) + test_dirs=$(find examples/*/scripts -type f -name 'localnet.sh' -exec dirname {} \; | xargs dirname) matrix_json=$(echo "$test_dirs" | jq -R '{"example-dir": .}' | jq -s . | jq -c .) echo "matrix=$matrix_json" >> $GITHUB_OUTPUT @@ -39,5 +39,5 @@ jobs: run: | cd "${{ matrix.example-dir }}" yarn - chmod +x ./scripts/test.sh - ./scripts/test.sh localnet + chmod +x ./scripts/localnet.sh + ./scripts/localnet.sh start diff --git a/omnichain/swap/.eslintignore b/examples/call/.eslintignore similarity index 100% rename from omnichain/swap/.eslintignore rename to examples/call/.eslintignore diff --git a/omnichain/swap/.eslintrc.js b/examples/call/.eslintrc.js similarity index 100% rename from omnichain/swap/.eslintrc.js rename to examples/call/.eslintrc.js diff --git a/omnichain/swap/.gitignore b/examples/call/.gitignore similarity index 84% rename from omnichain/swap/.gitignore rename to examples/call/.gitignore index 4487fa3c..34db758f 100644 --- a/omnichain/swap/.gitignore +++ b/examples/call/.gitignore @@ -14,4 +14,6 @@ artifacts out cache_forge -access_token \ No newline at end of file +access_token + +localnet.json diff --git a/omnichain/swap/LICENSE b/examples/call/LICENSE similarity index 100% rename from omnichain/swap/LICENSE rename to examples/call/LICENSE diff --git a/examples/call/README.md b/examples/call/README.md new file mode 100644 index 00000000..113c5e1d --- /dev/null +++ b/examples/call/README.md @@ -0,0 +1,3 @@ +# Hello Example + +Tutorial: https://www.zetachain.com/docs/developers/tutorials/call/ diff --git a/examples/call/contracts/Connected.sol b/examples/call/contracts/Connected.sol new file mode 100644 index 00000000..5cd333c3 --- /dev/null +++ b/examples/call/contracts/Connected.sol @@ -0,0 +1,98 @@ +// SPDX-License-Identifier: MIT +pragma solidity 0.8.26; + +import {RevertContext} from "@zetachain/protocol-contracts/contracts/Revert.sol"; +import "@zetachain/protocol-contracts/contracts/evm/GatewayEVM.sol"; +import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; + +contract Connected { + using SafeERC20 for IERC20; // Use SafeERC20 for IERC20 operations + + GatewayEVM public immutable gateway; + + event RevertEvent(string, RevertContext); + event HelloEvent(string, string); + + error Unauthorized(); + + modifier onlyGateway() { + if (msg.sender != address(gateway)) revert Unauthorized(); + _; + } + + constructor(address payable gatewayAddress) { + gateway = GatewayEVM(gatewayAddress); + } + + function call( + address receiver, + bytes calldata message, + RevertOptions memory revertOptions + ) external { + gateway.call(receiver, message, revertOptions); + } + + function deposit( + address receiver, + RevertOptions memory revertOptions + ) external payable { + gateway.deposit{value: msg.value}(receiver, revertOptions); + } + + function deposit( + address receiver, + uint256 amount, + address asset, + RevertOptions memory revertOptions + ) external { + IERC20(asset).safeTransferFrom(msg.sender, address(this), amount); + IERC20(asset).approve(address(gateway), amount); + gateway.deposit(receiver, amount, asset, revertOptions); + } + + function depositAndCall( + address receiver, + uint256 amount, + address asset, + bytes calldata message, + RevertOptions memory revertOptions + ) external { + IERC20(asset).safeTransferFrom(msg.sender, address(this), amount); + IERC20(asset).approve(address(gateway), amount); + gateway.depositAndCall(receiver, amount, asset, message, revertOptions); + } + + function depositAndCall( + address receiver, + bytes calldata message, + RevertOptions memory revertOptions + ) external payable { + gateway.depositAndCall{value: msg.value}( + receiver, + message, + revertOptions + ); + } + + function hello(string memory message) external payable { + emit HelloEvent("Hello on EVM", message); + } + + function onCall( + MessageContext calldata context, + bytes calldata message + ) external payable onlyGateway returns (bytes4) { + emit HelloEvent("Hello on EVM from onCall()", "hey"); + return ""; + } + + function onRevert( + RevertContext calldata revertContext + ) external onlyGateway { + emit RevertEvent("Revert on EVM", revertContext); + } + + receive() external payable {} + + fallback() external payable {} +} diff --git a/examples/hello/contracts/Hello.sol b/examples/call/contracts/Universal.sol similarity index 62% rename from examples/hello/contracts/Hello.sol rename to examples/call/contracts/Universal.sol index 41f8b49c..ca8f8402 100644 --- a/examples/hello/contracts/Hello.sol +++ b/examples/call/contracts/Universal.sol @@ -6,15 +6,17 @@ import "@zetachain/protocol-contracts/contracts/zevm/interfaces/UniversalContrac import "@zetachain/protocol-contracts/contracts/zevm/interfaces/IGatewayZEVM.sol"; import "@zetachain/protocol-contracts/contracts/zevm/GatewayZEVM.sol"; -contract Hello is UniversalContract { +contract Universal is UniversalContract { GatewayZEVM public immutable gateway; event HelloEvent(string, string); event RevertEvent(string, RevertContext); + error TransferFailed(); + error Unauthorized(); modifier onlyGateway() { - require(msg.sender == address(gateway), "Caller is not the gateway"); + if (msg.sender != address(gateway)) revert Unauthorized(); _; } @@ -22,34 +24,48 @@ contract Hello is UniversalContract { gateway = GatewayZEVM(gatewayAddress); } - function onCall( - MessageContext calldata context, - address zrc20, - uint256 amount, - bytes calldata message - ) external override onlyGateway { - string memory name = abi.decode(message, (string)); - emit HelloEvent("Hello on ZetaChain", name); - } - - function onRevert( - RevertContext calldata revertContext - ) external override onlyGateway { - emit RevertEvent("Revert on ZetaChain", revertContext); - } - function call( bytes memory receiver, address zrc20, bytes calldata message, - uint256 gasLimit, + CallOptions memory callOptions, RevertOptions memory revertOptions ) external { - (, uint256 gasFee) = IZRC20(zrc20).withdrawGasFeeWithGasLimit(gasLimit); - if (!IZRC20(zrc20).transferFrom(msg.sender, address(this), gasFee)) + (, uint256 gasFee) = IZRC20(zrc20).withdrawGasFeeWithGasLimit( + callOptions.gasLimit + ); + if (!IZRC20(zrc20).transferFrom(msg.sender, address(this), gasFee)) { revert TransferFailed(); + } IZRC20(zrc20).approve(address(gateway), gasFee); - gateway.call(receiver, zrc20, message, gasLimit, revertOptions); + gateway.call(receiver, zrc20, message, callOptions, revertOptions); + } + + function withdraw( + bytes memory receiver, + uint256 amount, + address zrc20, + RevertOptions memory revertOptions + ) external { + (address gasZRC20, uint256 gasFee) = IZRC20(zrc20).withdrawGasFee(); + uint256 target = zrc20 == gasZRC20 ? amount + gasFee : amount; + if (!IZRC20(zrc20).transferFrom(msg.sender, address(this), target)) { + revert TransferFailed(); + } + IZRC20(zrc20).approve(address(gateway), target); + if (zrc20 != gasZRC20) { + if ( + !IZRC20(gasZRC20).transferFrom( + msg.sender, + address(this), + gasFee + ) + ) { + revert TransferFailed(); + } + IZRC20(gasZRC20).approve(address(gateway), gasFee); + } + gateway.withdraw(receiver, amount, zrc20, revertOptions); } function withdrawAndCall( @@ -57,11 +73,11 @@ contract Hello is UniversalContract { uint256 amount, address zrc20, bytes calldata message, - uint256 gasLimit, + CallOptions memory callOptions, RevertOptions memory revertOptions ) external { (address gasZRC20, uint256 gasFee) = IZRC20(zrc20) - .withdrawGasFeeWithGasLimit(gasLimit); + .withdrawGasFeeWithGasLimit(callOptions.gasLimit); uint256 target = zrc20 == gasZRC20 ? amount + gasFee : amount; if (!IZRC20(zrc20).transferFrom(msg.sender, address(this), target)) revert TransferFailed(); @@ -73,7 +89,9 @@ contract Hello is UniversalContract { address(this), gasFee ) - ) revert TransferFailed(); + ) { + revert TransferFailed(); + } IZRC20(gasZRC20).approve(address(gateway), gasFee); } gateway.withdrawAndCall( @@ -81,8 +99,24 @@ contract Hello is UniversalContract { amount, zrc20, message, - gasLimit, + callOptions, revertOptions ); } + + function onCall( + MessageContext calldata context, + address zrc20, + uint256 amount, + bytes calldata message + ) external override onlyGateway { + string memory name = abi.decode(message, (string)); + emit HelloEvent("Hello on ZetaChain", name); + } + + function onRevert( + RevertContext calldata revertContext + ) external onlyGateway { + emit RevertEvent("Revert on ZetaChain", revertContext); + } } diff --git a/omnichain/swap/foundry.toml b/examples/call/foundry.toml similarity index 100% rename from omnichain/swap/foundry.toml rename to examples/call/foundry.toml diff --git a/omnichain/swap/hardhat.config.ts b/examples/call/hardhat.config.ts similarity index 50% rename from omnichain/swap/hardhat.config.ts rename to examples/call/hardhat.config.ts index a6e3c299..ada81896 100644 --- a/omnichain/swap/hardhat.config.ts +++ b/examples/call/hardhat.config.ts @@ -1,7 +1,10 @@ import "./tasks/deploy"; -import "./tasks/solana/interact"; -import "./tasks/interact"; -import "./tasks/swap"; +import "./tasks/universalCall"; +import "./tasks/connectedCall"; +import "./tasks/connectedDeposit"; +import "./tasks/connectedDepositAndCall"; +import "./tasks/universalWithdraw"; +import "./tasks/universalWithdrawAndCall"; import "@zetachain/localnet/tasks"; import "@nomicfoundation/hardhat-toolbox"; import "@zetachain/toolkit/tasks"; @@ -13,15 +16,7 @@ const config: HardhatUserConfig = { networks: { ...getHardhatConfigNetworks(), }, - solidity: { - compilers: [ - { version: "0.5.10" /** For create2 factory */ }, - { version: "0.6.6" /** For uniswap v2 router*/ }, - { version: "0.5.16" /** For uniswap v2 core*/ }, - { version: "0.4.19" /** For weth*/ }, - { version: "0.8.7" }, - ], - }, + solidity: "0.8.26", }; export default config; diff --git a/omnichain/swap/package.json b/examples/call/package.json similarity index 81% rename from omnichain/swap/package.json rename to examples/call/package.json index b20833b7..75baa2ce 100644 --- a/omnichain/swap/package.json +++ b/examples/call/package.json @@ -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 --name Hello && npx hardhat deploy --network localhost --name ReceiverContract" + "deploy:localnet": "npx hardhat compile --force && npx hardhat deploy --network localhost --gateway 0x9A676e781A523b5d0C0e43731313A708CB607508 && npx hardhat deploy --name Echo --network localhost --gateway 0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0" }, "keywords": [], "author": "", @@ -28,9 +28,8 @@ "@types/node": ">=12.0.0", "@typescript-eslint/eslint-plugin": "^5.59.9", "@typescript-eslint/parser": "^5.59.9", - "@zetachain/localnet": "^1.0.1", - "@zetachain/protocol-contracts": "9.0.0", - "@zetachain/toolkit": "^10.0.0", + "@zetachain/localnet": "4.0.0-rc6", + "@zetachain/toolkit": "13.0.0-rc7", "axios": "^1.3.6", "chai": "^4.2.0", "dotenv": "^16.0.3", @@ -55,9 +54,9 @@ "packageManager": "yarn@1.22.21+sha1.1959a18351b811cdeedbd484a8f86c3cc3bbaf72", "dependencies": { "@coral-xyz/anchor": "0.30.0", - "@openzeppelin/contracts": "^4.9.6", "@solana-developers/helpers": "^2.4.0", "@solana/spl-memo": "^0.2.5", - "@solana/web3.js": "^1.95.2" + "@solana/web3.js": "^1.95.2", + "@zetachain/protocol-contracts": "11.0.0-rc3" } } \ No newline at end of file diff --git a/examples/call/scripts/localnet.sh b/examples/call/scripts/localnet.sh new file mode 100755 index 00000000..bc49c87b --- /dev/null +++ b/examples/call/scripts/localnet.sh @@ -0,0 +1,108 @@ +#!/bin/bash + +set -e + +if [ "$1" = "start" ]; then npx hardhat localnet --exit-on-error & sleep 10; fi + +echo -e "\nšŸš€ Compiling contracts..." +npx hardhat compile --force --quiet + +ZRC20_ETHEREUM=$(jq -r '.addresses[] | select(.type=="ZRC-20 ETH on 5") | .address' localnet.json) +ERC20_ETHEREUM=$(jq -r '.addresses[] | select(.type=="ERC-20 USDC" and .chain=="ethereum") | .address' localnet.json) +ZRC20_BNB=$(jq -r '.addresses[] | select(.type=="ZRC-20 BNB on 97") | .address' localnet.json) +GATEWAY_ETHEREUM=$(jq -r '.addresses[] | select(.type=="gatewayEVM" and .chain=="ethereum") | .address' localnet.json) +GATEWAY_ZETACHAIN=$(jq -r '.addresses[] | select(.type=="gatewayZEVM" and .chain=="zetachain") | .address' localnet.json) +SENDER=0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 + +CONTRACT_ZETACHAIN=$(npx hardhat deploy --name Universal --network localhost --gateway "$GATEWAY_ZETACHAIN" --json | jq -r '.contractAddress') +echo -e "\nšŸš€ Deployed contract on ZetaChain: $CONTRACT_ZETACHAIN" + +CONTRACT_ETHEREUM=$(npx hardhat deploy --name Connected --json --network localhost --gateway "$GATEWAY_ETHEREUM" | jq -r '.contractAddress') +echo -e "šŸš€ Deployed contract on Ethereum: $CONTRACT_ETHEREUM" + +npx hardhat connected-deposit \ + --contract "$CONTRACT_ETHEREUM" \ + --receiver "$CONTRACT_ZETACHAIN" \ + --network localhost \ + --amount 1 + +npx hardhat localnet-check + +npx hardhat connected-deposit \ + --contract "$CONTRACT_ETHEREUM" \ + --receiver "$CONTRACT_ZETACHAIN" \ + --network localhost \ + --erc20 "$ERC20_ETHEREUM" \ + --amount 1 + +npx hardhat localnet-check + +npx hardhat connected-call \ + --contract "$CONTRACT_ETHEREUM" \ + --receiver "$CONTRACT_ZETACHAIN" \ + --network localhost \ + --types '["string"]' alice + +npx hardhat localnet-check + +npx hardhat connected-deposit-and-call \ + --contract "$CONTRACT_ETHEREUM" \ + --receiver "$CONTRACT_ZETACHAIN" \ + --network localhost \ + --amount 1 \ + --types '["string"]' alice + +npx hardhat localnet-check + +npx hardhat connected-deposit-and-call \ + --contract "$CONTRACT_ETHEREUM" \ + --receiver "$CONTRACT_ZETACHAIN" \ + --network localhost \ + --amount 1 \ + --erc20 "$ERC20_ETHEREUM" \ + --types '["string"]' alice + +npx hardhat localnet-check + +npx hardhat universal-withdraw \ + --contract "$CONTRACT_ZETACHAIN" \ + --receiver "$CONTRACT_ETHEREUM" \ + --zrc20 "$ZRC20_ETHEREUM" \ + --network localhost \ + --amount 1 + +npx hardhat localnet-check + +npx hardhat universal-call \ + --contract "$CONTRACT_ZETACHAIN" \ + --receiver "$CONTRACT_ETHEREUM" \ + --zrc20 "$ZRC20_ETHEREUM" \ + --function "hello(string)" \ + --network localhost \ + --types '["string"]' alice + +npx hardhat localnet-check + +npx hardhat universal-withdraw-and-call \ + --contract "$CONTRACT_ZETACHAIN" \ + --receiver "$CONTRACT_ETHEREUM" \ + --zrc20 "$ZRC20_ETHEREUM" \ + --function "hello(string)" \ + --amount 1 \ + --network localhost \ + --call-options-is-arbitrary-call \ + --types '["string"]' hello + +npx hardhat localnet-check + +npx hardhat universal-withdraw-and-call \ + --contract "$CONTRACT_ZETACHAIN" \ + --receiver "$CONTRACT_ETHEREUM" \ + --zrc20 "$ZRC20_ETHEREUM" \ + --amount 1 \ + --network localhost \ + --types '["string"]' hello + +npx hardhat localnet-check + +if [ "$1" = "start" ]; then npx hardhat localnet-stop; fi \ No newline at end of file diff --git a/examples/hello/tasks/echoCall.ts b/examples/call/tasks/connectedCall.ts similarity index 93% rename from examples/hello/tasks/echoCall.ts rename to examples/call/tasks/connectedCall.ts index ee8c46f0..236b8d4b 100644 --- a/examples/hello/tasks/echoCall.ts +++ b/examples/call/tasks/connectedCall.ts @@ -58,12 +58,15 @@ const main = async (args: any, hre: HardhatRuntimeEnvironment) => { txOptions ); - console.log(`Transaction hash: ${tx.hash}`); await tx.wait(); - console.log("gatewayCall executed successfully"); + console.log(`Transaction hash: ${tx.hash}`); }; -task("echo-call", "Calls the gateway on a contract on EVM", main) +task( + "connected-call", + "Make a call from a connected chain to a universal app on ZetaChain", + main +) .addParam("contract", "The address of the deployed contract") .addOptionalParam( "txOptionsGasPrice", @@ -94,6 +97,6 @@ task("echo-call", "Calls the gateway on a contract on EVM", main) 7000000, types.int ) - .addParam("name", "The name of the contract", "Echo") + .addParam("name", "The name of the contract", "Connected") .addParam("types", `The types of the parameters (example: '["string"]')`) .addVariadicPositionalParam("values", "The values of the parameters"); diff --git a/examples/call/tasks/connectedDeposit.ts b/examples/call/tasks/connectedDeposit.ts new file mode 100644 index 00000000..4b411a71 --- /dev/null +++ b/examples/call/tasks/connectedDeposit.ts @@ -0,0 +1,94 @@ +import ERC20_ABI from "@openzeppelin/contracts/build/contracts/ERC20.json"; +import { task, types } from "hardhat/config"; +import type { HardhatRuntimeEnvironment } from "hardhat/types"; + +const main = async (args: any, hre: HardhatRuntimeEnvironment) => { + const { ethers } = hre; + const [signer] = await ethers.getSigners(); + + const txOptions = { + gasPrice: args.txOptionsGasPrice, + gasLimit: args.txOptionsGasLimit, + }; + + const revertOptions = { + abortAddress: "0x0000000000000000000000000000000000000000", // not used + callOnRevert: args.callOnRevert, + onRevertGasLimit: args.onRevertGasLimit, + revertAddress: args.revertAddress, + revertMessage: ethers.utils.hexlify( + ethers.utils.toUtf8Bytes(args.revertMessage) + ), + }; + + const factory = (await hre.ethers.getContractFactory("Connected")) as any; + const contract = factory.attach(args.contract).connect(signer); + + let tx; + if (args.erc20) { + const erc20Contract = new ethers.Contract( + args.erc20, + ERC20_ABI.abi, + signer + ); + const decimals = await erc20Contract.decimals(); + const value = hre.ethers.utils.parseUnits(args.amount, decimals); + const approveTx = await erc20Contract + .connect(signer) + .approve(args.contract, value); + await approveTx.wait(); + const method = + "deposit(address,uint256,address,(address,bool,address,bytes,uint256))"; + tx = await contract[method]( + args.receiver, + value, + args.erc20, + revertOptions, + txOptions + ); + } else { + const value = hre.ethers.utils.parseEther(args.amount); + const method = "deposit(address,(address,bool,address,bytes,uint256))"; + tx = await contract[method](args.receiver, revertOptions, { + ...txOptions, + value, + }); + } + + await tx.wait(); + console.log(`Transaction hash: ${tx.hash}`); +}; + +task("connected-deposit", "Deposit tokens to ZetaChain", main) + .addParam("contract", "The address of the deployed contract") + .addOptionalParam( + "txOptionsGasPrice", + "The gas price for the transaction", + 10000000000, + types.int + ) + .addOptionalParam( + "txOptionsGasLimit", + "The gas limit for the transaction", + 7000000, + types.int + ) + .addFlag("callOnRevert", "Whether to call on revert") + .addOptionalParam( + "revertAddress", + "Revert address", + "0x0000000000000000000000000000000000000000" + ) + .addOptionalParam("revertMessage", "Revert message", "") + .addParam( + "receiver", + "The address of the receiver contract on a connected chain" + ) + .addOptionalParam( + "onRevertGasLimit", + "The gas limit for the revert transaction", + 7000000, + types.int + ) + .addOptionalParam("erc20", "The address of the ERC20 token to deposit") + .addParam("amount", "The amount of tokens to deposit"); diff --git a/examples/call/tasks/connectedDepositAndCall.ts b/examples/call/tasks/connectedDepositAndCall.ts new file mode 100644 index 00000000..bbafa57b --- /dev/null +++ b/examples/call/tasks/connectedDepositAndCall.ts @@ -0,0 +1,136 @@ +import ERC20_ABI from "@openzeppelin/contracts/build/contracts/ERC20.json"; +import { task, types } from "hardhat/config"; +import type { HardhatRuntimeEnvironment } from "hardhat/types"; + +const main = async (args: any, hre: HardhatRuntimeEnvironment) => { + const { ethers } = hre; + const [signer] = await ethers.getSigners(); + + const txOptions = { + gasPrice: args.txOptionsGasPrice, + gasLimit: args.txOptionsGasLimit, + }; + + const revertOptions = { + abortAddress: "0x0000000000000000000000000000000000000000", // not used + callOnRevert: args.callOnRevert, + onRevertGasLimit: args.onRevertGasLimit, + revertAddress: args.revertAddress, + revertMessage: ethers.utils.hexlify( + ethers.utils.toUtf8Bytes(args.revertMessage) + ), + }; + + const types = JSON.parse(args.types); + + if (types.length !== args.values.length) { + throw new Error( + `The number of types (${types.length}) does not match the number of values (${args.values.length}).` + ); + } + + const valuesArray = args.values.map((value: any, index: number) => { + const type = types[index]; + + if (type === "bool") { + try { + return JSON.parse(value.toLowerCase()); + } catch (e) { + throw new Error(`Invalid boolean value: ${value}`); + } + } else if (type.startsWith("uint") || type.startsWith("int")) { + return ethers.BigNumber.from(value); + } else { + return value; + } + }); + const encodedParameters = ethers.utils.defaultAbiCoder.encode( + types, + valuesArray + ); + + const factory = (await hre.ethers.getContractFactory(args.name)) as any; + const contract = factory.attach(args.contract).connect(signer); + + let tx; + if (args.erc20) { + const erc20Contract = new ethers.Contract( + args.erc20, + ERC20_ABI.abi, + signer + ); + const decimals = await erc20Contract.decimals(); + const value = hre.ethers.utils.parseUnits(args.amount, decimals); + const approveTx = await erc20Contract + .connect(signer) + .approve(args.contract, value); + await approveTx.wait(); + const method = + "depositAndCall(address,uint256,address,bytes,(address,bool,address,bytes,uint256))"; + tx = await contract[method]( + args.receiver, + value, + args.erc20, + encodedParameters, + revertOptions, + txOptions + ); + } else { + const value = hre.ethers.utils.parseEther(args.amount); + const method = + "depositAndCall(address,bytes,(address,bool,address,bytes,uint256))"; + tx = await contract[method]( + args.receiver, + encodedParameters, + revertOptions, + { + ...txOptions, + value, + } + ); + } + + await tx.wait(); + console.log(`Transaction hash: ${tx.hash}`); +}; + +task( + "connected-deposit-and-call", + "Deposit tokens and make a call from a connected chain to a universal app on ZetaChain", + main +) + .addParam("contract", "The address of the deployed contract") + .addOptionalParam( + "txOptionsGasPrice", + "The gas price for the transaction", + 10000000000, + types.int + ) + .addOptionalParam( + "txOptionsGasLimit", + "The gas limit for the transaction", + 7000000, + types.int + ) + .addFlag("callOnRevert", "Whether to call on revert") + .addOptionalParam( + "revertAddress", + "Revert address", + "0x0000000000000000000000000000000000000000" + ) + .addOptionalParam("revertMessage", "Revert message", "0x") + .addParam( + "receiver", + "The address of the receiver contract on a connected chain" + ) + .addOptionalParam( + "onRevertGasLimit", + "The gas limit for the revert transaction", + 7000000, + types.int + ) + .addParam("amount", "The amount of tokens to deposit") + .addParam("name", "The name of the contract", "Connected") + .addOptionalParam("erc20", "The address of the ERC20 token to deposit") + .addParam("types", `The types of the parameters (example: '["string"]')`) + .addVariadicPositionalParam("values", "The values of the parameters"); diff --git a/examples/call/tasks/deploy.ts b/examples/call/tasks/deploy.ts new file mode 100644 index 00000000..05fb8838 --- /dev/null +++ b/examples/call/tasks/deploy.ts @@ -0,0 +1,43 @@ +import { task, types } from "hardhat/config"; +import { HardhatRuntimeEnvironment } from "hardhat/types"; + +const main = async (args: any, hre: HardhatRuntimeEnvironment) => { + const network = hre.network.name; + + const [signer] = await hre.ethers.getSigners(); + if (signer === undefined) { + throw new Error( + `Wallet not found. Please, run "npx hardhat account --save" or set PRIVATE_KEY env variable (for example, in a .env file)` + ); + } + + const factory = await hre.ethers.getContractFactory(args.name); + const contract = await (factory as any).deploy(args.gateway); + await contract.deployed(); + + if (args.json) { + console.log( + JSON.stringify({ + contractAddress: contract.address, + deployer: signer.address, + network: network, + transactionHash: contract.deployTransaction.hash, + }) + ); + } else { + console.log(`šŸ”‘ Using account: ${signer.address} + +šŸš€ Successfully deployed "${args.name}" contract on ${network}. +šŸ“œ Contract address: ${contract.address} +`); + } +}; + +task("deploy", "Deploy the contract", main) + .addFlag("json", "Output in JSON") + .addOptionalParam("name", "Contract to deploy", "Universal") + .addOptionalParam( + "gateway", + "Gateway address (default: ZetaChain Gateway on testnet)", + "0x6c533f7fe93fae114d0954697069df33c9b74fd7" + ); diff --git a/examples/hello/tasks/helloCall.ts b/examples/call/tasks/universalCall.ts similarity index 86% rename from examples/hello/tasks/helloCall.ts rename to examples/call/tasks/universalCall.ts index ef977e98..315c7919 100644 --- a/examples/hello/tasks/helloCall.ts +++ b/examples/call/tasks/universalCall.ts @@ -11,6 +11,11 @@ const main = async (args: any, hre: HardhatRuntimeEnvironment) => { gasLimit: args.txOptionsGasLimit, }; + const callOptions = { + isArbitraryCall: args.callOptionsIsArbitraryCall, + gasLimit: args.callOptionsGasLimit, + }; + const revertOptions = { abortAddress: "0x0000000000000000000000000000000000000000", // not used callOnRevert: args.callOnRevert, @@ -69,22 +74,21 @@ const main = async (args: any, hre: HardhatRuntimeEnvironment) => { ethers.utils.hexlify(args.receiver), args.zrc20, message, - gasLimit, + callOptions, revertOptions, txOptions ); - console.log(`Transaction hash: ${tx.hash}`); await tx.wait(); - console.log("gatewayCall executed successfully"); + console.log(`Transaction hash: ${tx.hash}`); }; task( - "hello-call", - "Calls the gatewayCall function on a contract on ZetaChain", + "universal-call", + "Make a call from a universal app to a contract on a connected chain", main ) - .addParam("contract", "The address of the deployed Hello contract") + .addParam("contract", "The address of the deployed universal contract") .addParam("zrc20", "The address of ZRC-20 to pay fees") .addOptionalParam( "txOptionsGasPrice", @@ -115,7 +119,14 @@ task( 7000000, types.int ) + .addFlag("callOptionsIsArbitraryCall", "Call any function") + .addOptionalParam( + "callOptionsGasLimit", + "The gas limit for the call", + 7000000, + types.int + ) .addParam("function", `Function to call (example: "hello(string)")`) - .addParam("name", "The name of the contract", "Hello") + .addParam("name", "The name of the contract", "Universal") .addParam("types", `The types of the parameters (example: '["string"]')`) .addVariadicPositionalParam("values", "The values of the parameters"); diff --git a/examples/call/tasks/universalWithdraw.ts b/examples/call/tasks/universalWithdraw.ts new file mode 100644 index 00000000..87427eca --- /dev/null +++ b/examples/call/tasks/universalWithdraw.ts @@ -0,0 +1,93 @@ +import { task, types } from "hardhat/config"; +import type { HardhatRuntimeEnvironment } from "hardhat/types"; +import ZRC20ABI from "@zetachain/protocol-contracts/abi/ZRC20.sol/ZRC20.json"; + +const main = async (args: any, hre: HardhatRuntimeEnvironment) => { + const { ethers } = hre; + const [signer] = await ethers.getSigners(); + + const txOptions = { + gasPrice: args.txOptionsGasPrice, + gasLimit: args.txOptionsGasLimit, + }; + + const revertOptions = { + abortAddress: "0x0000000000000000000000000000000000000000", // not used + callOnRevert: args.callOnRevert, + onRevertGasLimit: args.onRevertGasLimit, + revertAddress: args.revertAddress, + revertMessage: ethers.utils.hexlify( + ethers.utils.toUtf8Bytes(args.revertMessage) + ), + }; + + const amount = hre.ethers.utils.parseUnits(args.amount, 18); + + const zrc20 = new ethers.Contract(args.zrc20, ZRC20ABI.abi, signer); + const [gasZRC20, gasFee] = await zrc20.withdrawGasFee(); + const gasZRC20Contract = new ethers.Contract(gasZRC20, ZRC20ABI.abi, signer); + const gasFeeApprove = await gasZRC20Contract.approve( + args.contract, + gasZRC20 == args.zrc20 ? gasFee.add(amount) : gasFee, + txOptions + ); + await gasFeeApprove.wait(); + + if (gasZRC20 !== args.zrc20) { + const targetTokenApprove = await zrc20.approve( + args.contract, + gasFee.add(amount), + txOptions + ); + await targetTokenApprove.wait(); + } + + const factory = (await hre.ethers.getContractFactory(args.name)) as any; + const contract = factory.attach(args.contract); + + const tx = await contract.withdraw( + ethers.utils.hexlify(args.receiver), + amount, + args.zrc20, + revertOptions, + txOptions + ); + + await tx.wait(); + console.log(`Transaction hash: ${tx.hash}`); +}; + +task("universal-withdraw", "Withdraw ZRC-20", main) + .addParam("contract", "The address of the deployed Hello contract") + .addParam("zrc20", "The address of ZRC-20 to pay fees") + .addOptionalParam( + "txOptionsGasPrice", + "The gas price for the transaction", + 10000000000, + types.int + ) + .addOptionalParam( + "txOptionsGasLimit", + "The gas limit for the transaction", + 7000000, + types.int + ) + .addFlag("callOnRevert", "Whether to call on revert") + .addOptionalParam( + "revertAddress", + "Revert address", + "0x0000000000000000000000000000000000000000" + ) + .addOptionalParam("revertMessage", "Revert message", "0x") + .addParam( + "receiver", + "The address of the receiver contract on a connected chain" + ) + .addOptionalParam( + "onRevertGasLimit", + "The gas limit for the revert transaction", + 7000000, + types.int + ) + .addParam("name", "The name of the contract", "Universal") + .addParam("amount", "Amount of ZRC-20 to withdraw"); diff --git a/examples/hello/tasks/helloWithdrawAndCall.ts b/examples/call/tasks/universalWithdrawAndCall.ts similarity index 77% rename from examples/hello/tasks/helloWithdrawAndCall.ts rename to examples/call/tasks/universalWithdrawAndCall.ts index 43818bd5..8dbb886b 100644 --- a/examples/hello/tasks/helloWithdrawAndCall.ts +++ b/examples/call/tasks/universalWithdrawAndCall.ts @@ -6,11 +6,24 @@ const main = async (args: any, hre: HardhatRuntimeEnvironment) => { const { ethers } = hre; const [signer] = await ethers.getSigners(); + if (args.callOptionsIsArbitraryCall && !args.function) { + throw new Error("Function is required for arbitrary calls"); + } + + if (!args.callOptionsIsArbitraryCall && args.function) { + throw new Error("Function is not allowed for non-arbitrary calls"); + } + const txOptions = { gasPrice: args.txOptionsGasPrice, gasLimit: args.txOptionsGasLimit, }; + const callOptions = { + isArbitraryCall: args.callOptionsIsArbitraryCall, + gasLimit: args.callOptionsGasLimit, + }; + const revertOptions = { abortAddress: "0x0000000000000000000000000000000000000000", // not used callOnRevert: args.callOnRevert, @@ -21,8 +34,6 @@ const main = async (args: any, hre: HardhatRuntimeEnvironment) => { ), }; - const functionSignature = ethers.utils.id(args.function).slice(0, 10); - const types = JSON.parse(args.types); if (types.length !== args.values.length) { @@ -51,9 +62,16 @@ const main = async (args: any, hre: HardhatRuntimeEnvironment) => { valuesArray ); - const message = ethers.utils.hexlify( - ethers.utils.concat([functionSignature, encodedParameters]) - ); + let message; + + if (args.callOptionsIsArbitraryCall) { + let functionSignature = ethers.utils.id(args.function).slice(0, 10); + message = ethers.utils.hexlify( + ethers.utils.concat([functionSignature, encodedParameters]) + ); + } else { + message = encodedParameters; + } const gasLimit = hre.ethers.BigNumber.from(args.txOptionsGasLimit); @@ -86,7 +104,7 @@ const main = async (args: any, hre: HardhatRuntimeEnvironment) => { amount, args.zrc20, message, - gasLimit, + callOptions, revertOptions, txOptions ); @@ -97,8 +115,8 @@ const main = async (args: any, hre: HardhatRuntimeEnvironment) => { }; task( - "hello-withdraw-and-call", - "Calls the gatewayWithdrawAndCall function on a contract on ZetaChain", + "universal-withdraw-and-call", + "Withdraw ZRC-20 and call a function on a connected chain", main ) .addParam("contract", "The address of the deployed Hello contract") @@ -132,8 +150,15 @@ task( 7000000, types.int ) - .addParam("function", `Function to call (example: "hello(string)")`) - .addParam("name", "The name of the contract", "Hello") + .addFlag("callOptionsIsArbitraryCall", "Call any function") + .addOptionalParam( + "callOptionsGasLimit", + "The gas limit for the call", + 7000000, + types.int + ) + .addOptionalParam("function", `Function to call (example: "hello(string)")`) + .addParam("name", "The name of the contract", "Universal") .addParam("amount", "Amount of ZRC-20 to withdraw") .addParam("types", `The types of the parameters (example: '["string"]')`) .addVariadicPositionalParam("values", "The values of the parameters"); diff --git a/omnichain/swap/tsconfig.json b/examples/call/tsconfig.json similarity index 100% rename from omnichain/swap/tsconfig.json rename to examples/call/tsconfig.json diff --git a/omnichain/swap/yarn.lock b/examples/call/yarn.lock similarity index 91% rename from omnichain/swap/yarn.lock rename to examples/call/yarn.lock index dcfb110e..65dd7967 100644 --- a/omnichain/swap/yarn.lock +++ b/examples/call/yarn.lock @@ -19,6 +19,13 @@ dependencies: regenerator-runtime "^0.14.0" +"@babel/runtime@^7.25.0": + version "7.25.6" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.25.6.tgz#9afc3289f7184d8d7f98b099884c26317b9264d2" + integrity sha512-VBj9MYyDb9tuLq7yzqjgzt6Q+IBQLrGZfdjOekyEirZPHxXWoTSGUTMrpsfi58Up73d13NfYLv8HT9vmznjzhQ== + dependencies: + regenerator-runtime "^0.14.0" + "@chainsafe/as-sha256@^0.3.1": version "0.3.1" resolved "https://registry.yarnpkg.com/@chainsafe/as-sha256/-/as-sha256-0.3.1.tgz#3639df0e1435cab03f4d9870cc3ac079e57a6fc9" @@ -55,6 +62,11 @@ "@chainsafe/persistent-merkle-tree" "^0.4.2" case "^1.6.3" +"@coral-xyz/anchor-errors@^0.30.1": + version "0.30.1" + resolved "https://registry.yarnpkg.com/@coral-xyz/anchor-errors/-/anchor-errors-0.30.1.tgz#bdfd3a353131345244546876eb4afc0e125bec30" + integrity sha512-9Mkradf5yS5xiLWrl9WrpjqOrAV+/W2RQHDlbnAZBivoGpOs1ECjoDCkVk4aRG8ZdiFiB8zQEVlxf+8fKkmSfQ== + "@coral-xyz/anchor@0.30.0": version "0.30.0" resolved "https://registry.yarnpkg.com/@coral-xyz/anchor/-/anchor-0.30.0.tgz#52acdba504b0008f1026d3a4bbbcb2d4feb5c69e" @@ -75,7 +87,28 @@ superstruct "^0.15.4" toml "^3.0.0" -"@coral-xyz/borsh@^0.30.0": +"@coral-xyz/anchor@^0.30.1": + version "0.30.1" + resolved "https://registry.yarnpkg.com/@coral-xyz/anchor/-/anchor-0.30.1.tgz#17f3e9134c28cd0ea83574c6bab4e410bcecec5d" + integrity sha512-gDXFoF5oHgpriXAaLpxyWBHdCs8Awgf/gLHIo6crv7Aqm937CNdY+x+6hoj7QR5vaJV7MxWSQ0NGFzL3kPbWEQ== + dependencies: + "@coral-xyz/anchor-errors" "^0.30.1" + "@coral-xyz/borsh" "^0.30.1" + "@noble/hashes" "^1.3.1" + "@solana/web3.js" "^1.68.0" + bn.js "^5.1.2" + bs58 "^4.0.1" + buffer-layout "^1.2.2" + camelcase "^6.3.0" + cross-fetch "^3.1.5" + crypto-hash "^1.3.0" + eventemitter3 "^4.0.7" + pako "^2.0.3" + snake-case "^3.0.4" + superstruct "^0.15.4" + toml "^3.0.0" + +"@coral-xyz/borsh@^0.30.0", "@coral-xyz/borsh@^0.30.1": version "0.30.1" resolved "https://registry.yarnpkg.com/@coral-xyz/borsh/-/borsh-0.30.1.tgz#869d8833abe65685c72e9199b8688477a4f6b0e3" integrity sha512-aaxswpPrCFKl8vZTbxLssA2RvwX2zmKLlRCIktJOwW+VpVwYtXRtlWiIP+c2pPRKneiTiWCN2GEMSH9j1zTlWQ== @@ -151,7 +184,22 @@ "@ethersproject/properties" "^5.4.0" "@ethersproject/strings" "^5.4.0" -"@ethersproject/abi@5.7.0", "@ethersproject/abi@^5.0.0-beta.146", "@ethersproject/abi@^5.0.9", "@ethersproject/abi@^5.1.2", "@ethersproject/abi@^5.4.0", "@ethersproject/abi@^5.4.7", "@ethersproject/abi@^5.7.0": +"@ethersproject/abi@5.6.3": + version "5.6.3" + resolved "https://registry.yarnpkg.com/@ethersproject/abi/-/abi-5.6.3.tgz#2d643544abadf6e6b63150508af43475985c23db" + integrity sha512-CxKTdoZY4zDJLWXG6HzNH6znWK0M79WzzxHegDoecE3+K32pzfHOzuXg2/oGSTecZynFgpkjYXNPOqXVJlqClw== + dependencies: + "@ethersproject/address" "^5.6.1" + "@ethersproject/bignumber" "^5.6.2" + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/constants" "^5.6.1" + "@ethersproject/hash" "^5.6.1" + "@ethersproject/keccak256" "^5.6.1" + "@ethersproject/logger" "^5.6.0" + "@ethersproject/properties" "^5.6.0" + "@ethersproject/strings" "^5.6.1" + +"@ethersproject/abi@5.7.0", "@ethersproject/abi@^5.0.0-beta.146", "@ethersproject/abi@^5.0.9", "@ethersproject/abi@^5.1.2", "@ethersproject/abi@^5.4.0", "@ethersproject/abi@^5.4.7", "@ethersproject/abi@^5.6.3", "@ethersproject/abi@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/abi/-/abi-5.7.0.tgz#b3f3e045bbbeed1af3947335c247ad625a44e449" integrity sha512-351ktp42TiRcYB3H1OP8yajPeAQstMW/yCFokj/AthP9bLHzQFPlOrxOcwYEDkUAICmOHljvN4K39OMTMUa9RA== @@ -179,7 +227,20 @@ "@ethersproject/transactions" "^5.4.0" "@ethersproject/web" "^5.4.0" -"@ethersproject/abstract-provider@5.7.0", "@ethersproject/abstract-provider@^5.4.0", "@ethersproject/abstract-provider@^5.7.0": +"@ethersproject/abstract-provider@5.6.1": + version "5.6.1" + resolved "https://registry.yarnpkg.com/@ethersproject/abstract-provider/-/abstract-provider-5.6.1.tgz#02ddce150785caf0c77fe036a0ebfcee61878c59" + integrity sha512-BxlIgogYJtp1FS8Muvj8YfdClk3unZH0vRMVX791Z9INBNT/kuACZ9GzaY1Y4yFq+YSy6/w4gzj3HCRKrK9hsQ== + dependencies: + "@ethersproject/bignumber" "^5.6.2" + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/logger" "^5.6.0" + "@ethersproject/networks" "^5.6.3" + "@ethersproject/properties" "^5.6.0" + "@ethersproject/transactions" "^5.6.2" + "@ethersproject/web" "^5.6.1" + +"@ethersproject/abstract-provider@5.7.0", "@ethersproject/abstract-provider@^5.4.0", "@ethersproject/abstract-provider@^5.6.1", "@ethersproject/abstract-provider@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/abstract-provider/-/abstract-provider-5.7.0.tgz#b0a8550f88b6bf9d51f90e4795d48294630cb9ef" integrity sha512-R41c9UkchKCpAqStMYUpdunjo3pkEvZC3FAwZn5S5MGbXoMQOHIdHItezTETxAO5bevtMApSyEhn9+CHcDsWBw== @@ -203,7 +264,18 @@ "@ethersproject/logger" "^5.4.0" "@ethersproject/properties" "^5.4.0" -"@ethersproject/abstract-signer@5.7.0", "@ethersproject/abstract-signer@^5.4.0", "@ethersproject/abstract-signer@^5.7.0": +"@ethersproject/abstract-signer@5.6.2": + version "5.6.2" + resolved "https://registry.yarnpkg.com/@ethersproject/abstract-signer/-/abstract-signer-5.6.2.tgz#491f07fc2cbd5da258f46ec539664713950b0b33" + integrity sha512-n1r6lttFBG0t2vNiI3HoWaS/KdOt8xyDjzlP2cuevlWLG6EX0OwcKLyG/Kp/cuwNxdy/ous+R/DEMdTUwWQIjQ== + dependencies: + "@ethersproject/abstract-provider" "^5.6.1" + "@ethersproject/bignumber" "^5.6.2" + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/logger" "^5.6.0" + "@ethersproject/properties" "^5.6.0" + +"@ethersproject/abstract-signer@5.7.0", "@ethersproject/abstract-signer@^5.4.0", "@ethersproject/abstract-signer@^5.6.2", "@ethersproject/abstract-signer@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/abstract-signer/-/abstract-signer-5.7.0.tgz#13f4f32117868452191a4649723cb086d2b596b2" integrity sha512-a16V8bq1/Cz+TGCkE2OPMTOUDLS3grCpdjoJCYNnVBbdYEMSgKrU0+B90s8b6H+ByYTBZN7a3g76jdIJi7UfKQ== @@ -225,7 +297,18 @@ "@ethersproject/logger" "^5.4.0" "@ethersproject/rlp" "^5.4.0" -"@ethersproject/address@5.7.0", "@ethersproject/address@^5.0.2", "@ethersproject/address@^5.4.0", "@ethersproject/address@^5.7.0": +"@ethersproject/address@5.6.1": + version "5.6.1" + resolved "https://registry.yarnpkg.com/@ethersproject/address/-/address-5.6.1.tgz#ab57818d9aefee919c5721d28cd31fd95eff413d" + integrity sha512-uOgF0kS5MJv9ZvCz7x6T2EXJSzotiybApn4XlOgoTX0xdtyVIJ7pF+6cGPxiEq/dpBiTfMiw7Yc81JcwhSYA0Q== + dependencies: + "@ethersproject/bignumber" "^5.6.2" + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/keccak256" "^5.6.1" + "@ethersproject/logger" "^5.6.0" + "@ethersproject/rlp" "^5.6.1" + +"@ethersproject/address@5.7.0", "@ethersproject/address@^5.0.2", "@ethersproject/address@^5.4.0", "@ethersproject/address@^5.6.1", "@ethersproject/address@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/address/-/address-5.7.0.tgz#19b56c4d74a3b0a46bfdbb6cfcc0a153fc697f37" integrity sha512-9wYhYt7aghVGo758POM5nqcOMaE168Q6aRLJZwUmiqSrAungkG74gSSeKEIR7ukixesdRZGPgVqme6vmxs1fkA== @@ -243,7 +326,14 @@ dependencies: "@ethersproject/bytes" "^5.4.0" -"@ethersproject/base64@5.7.0", "@ethersproject/base64@^5.4.0", "@ethersproject/base64@^5.7.0": +"@ethersproject/base64@5.6.1": + version "5.6.1" + resolved "https://registry.yarnpkg.com/@ethersproject/base64/-/base64-5.6.1.tgz#2c40d8a0310c9d1606c2c37ae3092634b41d87cb" + integrity sha512-qB76rjop6a0RIYYMiB4Eh/8n+Hxu2NIZm8S/Q7kNo5pmZfXhHGHmS4MinUainiBC54SCyRnwzL+KZjj8zbsSsw== + dependencies: + "@ethersproject/bytes" "^5.6.1" + +"@ethersproject/base64@5.7.0", "@ethersproject/base64@^5.4.0", "@ethersproject/base64@^5.6.1", "@ethersproject/base64@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/base64/-/base64-5.7.0.tgz#ac4ee92aa36c1628173e221d0d01f53692059e1c" integrity sha512-Dr8tcHt2mEbsZr/mwTPIQAf3Ai0Bks/7gTw9dSqk1mQvhW3XvRlmDJr/4n+wg1JmCl16NZue17CDh8xb/vZ0sQ== @@ -258,7 +348,15 @@ "@ethersproject/bytes" "^5.4.0" "@ethersproject/properties" "^5.4.0" -"@ethersproject/basex@5.7.0", "@ethersproject/basex@^5.4.0", "@ethersproject/basex@^5.7.0": +"@ethersproject/basex@5.6.1": + version "5.6.1" + resolved "https://registry.yarnpkg.com/@ethersproject/basex/-/basex-5.6.1.tgz#badbb2f1d4a6f52ce41c9064f01eab19cc4c5305" + integrity sha512-a52MkVz4vuBXR06nvflPMotld1FJWSj2QT0985v7P/emPZO00PucFAkbcmq2vpVU7Ts7umKiSI6SppiLykVWsA== + dependencies: + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/properties" "^5.6.0" + +"@ethersproject/basex@5.7.0", "@ethersproject/basex@^5.4.0", "@ethersproject/basex@^5.6.1", "@ethersproject/basex@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/basex/-/basex-5.7.0.tgz#97034dc7e8938a8ca943ab20f8a5e492ece4020b" integrity sha512-ywlh43GwZLv2Voc2gQVTKBoVQ1mti3d8HK5aMxsfu/nRDnMmNqaSJ3r3n85HBByT8OpoY96SXM1FogC533T4zw== @@ -275,7 +373,16 @@ "@ethersproject/logger" "^5.4.0" bn.js "^4.11.9" -"@ethersproject/bignumber@5.7.0", "@ethersproject/bignumber@^5.4.0", "@ethersproject/bignumber@^5.7.0": +"@ethersproject/bignumber@5.6.2": + version "5.6.2" + resolved "https://registry.yarnpkg.com/@ethersproject/bignumber/-/bignumber-5.6.2.tgz#72a0717d6163fab44c47bcc82e0c550ac0315d66" + integrity sha512-v7+EEUbhGqT3XJ9LMPsKvXYHFc8eHxTowFCG/HgJErmq4XHJ2WR7aeyICg3uTOAQ7Icn0GFHAohXEhxQHq4Ubw== + dependencies: + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/logger" "^5.6.0" + bn.js "^5.2.1" + +"@ethersproject/bignumber@5.7.0", "@ethersproject/bignumber@^5.4.0", "@ethersproject/bignumber@^5.6.2", "@ethersproject/bignumber@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/bignumber/-/bignumber-5.7.0.tgz#e2f03837f268ba655ffba03a57853e18a18dc9c2" integrity sha512-n1CAdIHRWjSucQO3MC1zPSVgV/6dy/fjL9pMrPP9peL+QxEg9wOsVqwD4+818B6LUEtaXzVHQiuivzRoxPxUGw== @@ -291,7 +398,14 @@ dependencies: "@ethersproject/logger" "^5.4.0" -"@ethersproject/bytes@5.7.0", "@ethersproject/bytes@^5.4.0", "@ethersproject/bytes@^5.7.0": +"@ethersproject/bytes@5.6.1": + version "5.6.1" + resolved "https://registry.yarnpkg.com/@ethersproject/bytes/-/bytes-5.6.1.tgz#24f916e411f82a8a60412344bf4a813b917eefe7" + integrity sha512-NwQt7cKn5+ZE4uDn+X5RAXLp46E1chXoaMmrxAyA0rblpxz8t58lVkrHXoRIn0lz1joQElQ8410GqhTqMOwc6g== + dependencies: + "@ethersproject/logger" "^5.6.0" + +"@ethersproject/bytes@5.7.0", "@ethersproject/bytes@^5.4.0", "@ethersproject/bytes@^5.6.1", "@ethersproject/bytes@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/bytes/-/bytes-5.7.0.tgz#a00f6ea8d7e7534d6d87f47188af1148d71f155d" integrity sha512-nsbxwgFXWh9NyYWo+U8atvmMsSdKJprTcICAkvbBffT75qDocbuggBU0SJiVK2MuTrp0q+xvLkTnGMPK1+uA9A== @@ -305,7 +419,14 @@ dependencies: "@ethersproject/bignumber" "^5.4.0" -"@ethersproject/constants@5.7.0", "@ethersproject/constants@^5.4.0", "@ethersproject/constants@^5.7.0": +"@ethersproject/constants@5.6.1": + version "5.6.1" + resolved "https://registry.yarnpkg.com/@ethersproject/constants/-/constants-5.6.1.tgz#e2e974cac160dd101cf79fdf879d7d18e8cb1370" + integrity sha512-QSq9WVnZbxXYFftrjSjZDUshp6/eKp6qrtdBtUCm0QxCV5z1fG/w3kdlcsjMCQuQHUnAclKoK7XpXMezhRDOLg== + dependencies: + "@ethersproject/bignumber" "^5.6.2" + +"@ethersproject/constants@5.7.0", "@ethersproject/constants@^5.4.0", "@ethersproject/constants@^5.6.1", "@ethersproject/constants@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/constants/-/constants-5.7.0.tgz#df80a9705a7e08984161f09014ea012d1c75295e" integrity sha512-DHI+y5dBNvkpYUMiRQyxRBYBefZkJfo70VUkUAsRjcPs47muV9evftfZ0PJVCXYbAiCgght0DtcF9srFQmIgWA== @@ -328,6 +449,22 @@ "@ethersproject/properties" "^5.4.0" "@ethersproject/transactions" "^5.4.0" +"@ethersproject/contracts@5.6.2": + version "5.6.2" + resolved "https://registry.yarnpkg.com/@ethersproject/contracts/-/contracts-5.6.2.tgz#20b52e69ebc1b74274ff8e3d4e508de971c287bc" + integrity sha512-hguUA57BIKi6WY0kHvZp6PwPlWF87MCeB4B7Z7AbUpTxfFXFdn/3b0GmjZPagIHS+3yhcBJDnuEfU4Xz+Ks/8g== + dependencies: + "@ethersproject/abi" "^5.6.3" + "@ethersproject/abstract-provider" "^5.6.1" + "@ethersproject/abstract-signer" "^5.6.2" + "@ethersproject/address" "^5.6.1" + "@ethersproject/bignumber" "^5.6.2" + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/constants" "^5.6.1" + "@ethersproject/logger" "^5.6.0" + "@ethersproject/properties" "^5.6.0" + "@ethersproject/transactions" "^5.6.2" + "@ethersproject/contracts@5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/contracts/-/contracts-5.7.0.tgz#c305e775abd07e48aa590e1a877ed5c316f8bd1e" @@ -358,7 +495,21 @@ "@ethersproject/properties" "^5.4.0" "@ethersproject/strings" "^5.4.0" -"@ethersproject/hash@5.7.0", "@ethersproject/hash@^5.4.0", "@ethersproject/hash@^5.7.0": +"@ethersproject/hash@5.6.1": + version "5.6.1" + resolved "https://registry.yarnpkg.com/@ethersproject/hash/-/hash-5.6.1.tgz#224572ea4de257f05b4abf8ae58b03a67e99b0f4" + integrity sha512-L1xAHurbaxG8VVul4ankNX5HgQ8PNCTrnVXEiFnE9xoRnaUcgfD12tZINtDinSllxPLCtGwguQxJ5E6keE84pA== + dependencies: + "@ethersproject/abstract-signer" "^5.6.2" + "@ethersproject/address" "^5.6.1" + "@ethersproject/bignumber" "^5.6.2" + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/keccak256" "^5.6.1" + "@ethersproject/logger" "^5.6.0" + "@ethersproject/properties" "^5.6.0" + "@ethersproject/strings" "^5.6.1" + +"@ethersproject/hash@5.7.0", "@ethersproject/hash@^5.4.0", "@ethersproject/hash@^5.6.1", "@ethersproject/hash@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/hash/-/hash-5.7.0.tgz#eb7aca84a588508369562e16e514b539ba5240a7" integrity sha512-qX5WrQfnah1EFnO5zJv1v46a8HW0+E5xuBBDTwMFZLuVTx0tbU2kkx15NqdjxecrLGatQN9FGQKpb1FKdHCt+g== @@ -391,7 +542,25 @@ "@ethersproject/transactions" "^5.4.0" "@ethersproject/wordlists" "^5.4.0" -"@ethersproject/hdnode@5.7.0", "@ethersproject/hdnode@^5.4.0", "@ethersproject/hdnode@^5.7.0": +"@ethersproject/hdnode@5.6.2": + version "5.6.2" + resolved "https://registry.yarnpkg.com/@ethersproject/hdnode/-/hdnode-5.6.2.tgz#26f3c83a3e8f1b7985c15d1db50dc2903418b2d2" + integrity sha512-tERxW8Ccf9CxW2db3WsN01Qao3wFeRsfYY9TCuhmG0xNpl2IO8wgXU3HtWIZ49gUWPggRy4Yg5axU0ACaEKf1Q== + dependencies: + "@ethersproject/abstract-signer" "^5.6.2" + "@ethersproject/basex" "^5.6.1" + "@ethersproject/bignumber" "^5.6.2" + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/logger" "^5.6.0" + "@ethersproject/pbkdf2" "^5.6.1" + "@ethersproject/properties" "^5.6.0" + "@ethersproject/sha2" "^5.6.1" + "@ethersproject/signing-key" "^5.6.2" + "@ethersproject/strings" "^5.6.1" + "@ethersproject/transactions" "^5.6.2" + "@ethersproject/wordlists" "^5.6.1" + +"@ethersproject/hdnode@5.7.0", "@ethersproject/hdnode@^5.4.0", "@ethersproject/hdnode@^5.6.2", "@ethersproject/hdnode@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/hdnode/-/hdnode-5.7.0.tgz#e627ddc6b466bc77aebf1a6b9e47405ca5aef9cf" integrity sha512-OmyYo9EENBPPf4ERhR7oj6uAtUAhYGqOnIS+jE5pTXvdKBS99ikzq1E7Iv0ZQZ5V36Lqx1qZLeak0Ra16qpeOg== @@ -428,7 +597,26 @@ aes-js "3.0.0" scrypt-js "3.0.1" -"@ethersproject/json-wallets@5.7.0", "@ethersproject/json-wallets@^5.4.0", "@ethersproject/json-wallets@^5.7.0": +"@ethersproject/json-wallets@5.6.1": + version "5.6.1" + resolved "https://registry.yarnpkg.com/@ethersproject/json-wallets/-/json-wallets-5.6.1.tgz#3f06ba555c9c0d7da46756a12ac53483fe18dd91" + integrity sha512-KfyJ6Zwz3kGeX25nLihPwZYlDqamO6pfGKNnVMWWfEVVp42lTfCZVXXy5Ie8IZTN0HKwAngpIPi7gk4IJzgmqQ== + dependencies: + "@ethersproject/abstract-signer" "^5.6.2" + "@ethersproject/address" "^5.6.1" + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/hdnode" "^5.6.2" + "@ethersproject/keccak256" "^5.6.1" + "@ethersproject/logger" "^5.6.0" + "@ethersproject/pbkdf2" "^5.6.1" + "@ethersproject/properties" "^5.6.0" + "@ethersproject/random" "^5.6.1" + "@ethersproject/strings" "^5.6.1" + "@ethersproject/transactions" "^5.6.2" + aes-js "3.0.0" + scrypt-js "3.0.1" + +"@ethersproject/json-wallets@5.7.0", "@ethersproject/json-wallets@^5.4.0", "@ethersproject/json-wallets@^5.6.1", "@ethersproject/json-wallets@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/json-wallets/-/json-wallets-5.7.0.tgz#5e3355287b548c32b368d91014919ebebddd5360" integrity sha512-8oee5Xgu6+RKgJTkvEMl2wDgSPSAQ9MB/3JYjFV9jlKvcYHUXZC+cQp0njgmxdHkYWn8s6/IqIZYm0YWCjO/0g== @@ -455,7 +643,15 @@ "@ethersproject/bytes" "^5.4.0" js-sha3 "0.5.7" -"@ethersproject/keccak256@5.7.0", "@ethersproject/keccak256@^5.4.0", "@ethersproject/keccak256@^5.7.0": +"@ethersproject/keccak256@5.6.1": + version "5.6.1" + resolved "https://registry.yarnpkg.com/@ethersproject/keccak256/-/keccak256-5.6.1.tgz#b867167c9b50ba1b1a92bccdd4f2d6bd168a91cc" + integrity sha512-bB7DQHCTRDooZZdL3lk9wpL0+XuG3XLGHLh3cePnybsO3V0rdCAOQGpn/0R3aODmnTOOkCATJiD2hnL+5bwthA== + dependencies: + "@ethersproject/bytes" "^5.6.1" + js-sha3 "0.8.0" + +"@ethersproject/keccak256@5.7.0", "@ethersproject/keccak256@^5.4.0", "@ethersproject/keccak256@^5.6.1", "@ethersproject/keccak256@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/keccak256/-/keccak256-5.7.0.tgz#3186350c6e1cd6aba7940384ec7d6d9db01f335a" integrity sha512-2UcPboeL/iW+pSg6vZ6ydF8tCnv3Iu/8tUmLLzWWGzxWKFFqOBQFLo6uLUv6BDrLgCDfN28RJ/wtByx+jZ4KBg== @@ -468,7 +664,12 @@ resolved "https://registry.yarnpkg.com/@ethersproject/logger/-/logger-5.4.1.tgz#503bd33683538b923c578c07d1c2c0dd18672054" integrity sha512-DZ+bRinnYLPw1yAC64oRl0QyVZj43QeHIhVKfD/+YwSz4wsv1pfwb5SOFjz+r710YEWzU6LrhuSjpSO+6PeE4A== -"@ethersproject/logger@5.7.0", "@ethersproject/logger@^5.4.0", "@ethersproject/logger@^5.7.0": +"@ethersproject/logger@5.6.0": + version "5.6.0" + resolved "https://registry.yarnpkg.com/@ethersproject/logger/-/logger-5.6.0.tgz#d7db1bfcc22fd2e4ab574cba0bb6ad779a9a3e7a" + integrity sha512-BiBWllUROH9w+P21RzoxJKzqoqpkyM1pRnEKG69bulE9TSQD8SAIvTQqIMZmmCO8pUNkgLP1wndX1gKghSpBmg== + +"@ethersproject/logger@5.7.0", "@ethersproject/logger@^5.4.0", "@ethersproject/logger@^5.6.0", "@ethersproject/logger@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/logger/-/logger-5.7.0.tgz#6ce9ae168e74fecf287be17062b590852c311892" integrity sha512-0odtFdXu/XHtjQXJYA3u9G0G8btm0ND5Cu8M7i5vhEcE8/HmF4Lbdqanwyv4uQTr2tx6b7fQRmgLrsnpQlmnig== @@ -480,7 +681,14 @@ dependencies: "@ethersproject/logger" "^5.4.0" -"@ethersproject/networks@5.7.1", "@ethersproject/networks@^5.4.0", "@ethersproject/networks@^5.7.0": +"@ethersproject/networks@5.6.3": + version "5.6.3" + resolved "https://registry.yarnpkg.com/@ethersproject/networks/-/networks-5.6.3.tgz#3ee3ab08f315b433b50c99702eb32e0cf31f899f" + integrity sha512-QZxRH7cA5Ut9TbXwZFiCyuPchdWi87ZtVNHWZd0R6YFgYtes2jQ3+bsslJ0WdyDe0i6QumqtoYqvY3rrQFRZOQ== + dependencies: + "@ethersproject/logger" "^5.6.0" + +"@ethersproject/networks@5.7.1", "@ethersproject/networks@^5.4.0", "@ethersproject/networks@^5.6.3", "@ethersproject/networks@^5.7.0": version "5.7.1" resolved "https://registry.yarnpkg.com/@ethersproject/networks/-/networks-5.7.1.tgz#118e1a981d757d45ccea6bb58d9fd3d9db14ead6" integrity sha512-n/MufjFYv3yFcUyfhnXotyDlNdFb7onmkSy8aQERi2PjNcnWQ66xXxa3XlS8nCcA8aJKJjIIMNJTC7tu80GwpQ== @@ -495,7 +703,15 @@ "@ethersproject/bytes" "^5.4.0" "@ethersproject/sha2" "^5.4.0" -"@ethersproject/pbkdf2@5.7.0", "@ethersproject/pbkdf2@^5.4.0", "@ethersproject/pbkdf2@^5.7.0": +"@ethersproject/pbkdf2@5.6.1": + version "5.6.1" + resolved "https://registry.yarnpkg.com/@ethersproject/pbkdf2/-/pbkdf2-5.6.1.tgz#f462fe320b22c0d6b1d72a9920a3963b09eb82d1" + integrity sha512-k4gRQ+D93zDRPNUfmduNKq065uadC2YjMP/CqwwX5qG6R05f47boq6pLZtV/RnC4NZAYOPH1Cyo54q0c9sshRQ== + dependencies: + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/sha2" "^5.6.1" + +"@ethersproject/pbkdf2@5.7.0", "@ethersproject/pbkdf2@^5.4.0", "@ethersproject/pbkdf2@^5.6.1", "@ethersproject/pbkdf2@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/pbkdf2/-/pbkdf2-5.7.0.tgz#d2267d0a1f6e123f3771007338c47cccd83d3102" integrity sha512-oR/dBRZR6GTyaofd86DehG72hY6NpAjhabkhxgr3X2FpJtJuodEl2auADWBZfhDHgVCbu3/H/Ocq2uC6dpNjjw== @@ -510,7 +726,14 @@ dependencies: "@ethersproject/logger" "^5.4.0" -"@ethersproject/properties@5.7.0", "@ethersproject/properties@^5.4.0", "@ethersproject/properties@^5.7.0": +"@ethersproject/properties@5.6.0": + version "5.6.0" + resolved "https://registry.yarnpkg.com/@ethersproject/properties/-/properties-5.6.0.tgz#38904651713bc6bdd5bdd1b0a4287ecda920fa04" + integrity sha512-szoOkHskajKePTJSZ46uHUWWkbv7TzP2ypdEK6jGMqJaEt2sb0jCgfBo0gH0m2HBpRixMuJ6TBRaQCF7a9DoCg== + dependencies: + "@ethersproject/logger" "^5.6.0" + +"@ethersproject/properties@5.7.0", "@ethersproject/properties@^5.4.0", "@ethersproject/properties@^5.6.0", "@ethersproject/properties@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/properties/-/properties-5.7.0.tgz#a6e12cb0439b878aaf470f1902a176033067ed30" integrity sha512-J87jy8suntrAkIZtecpxEPxY//szqr1mlBaYlQ0r4RCaiD2hjheqF9s1LVE8vVuJCXisjIP+JgtK/Do54ej4Sw== @@ -542,6 +765,32 @@ bech32 "1.1.4" ws "7.4.6" +"@ethersproject/providers@5.6.8": + version "5.6.8" + resolved "https://registry.yarnpkg.com/@ethersproject/providers/-/providers-5.6.8.tgz#22e6c57be215ba5545d3a46cf759d265bb4e879d" + integrity sha512-Wf+CseT/iOJjrGtAOf3ck9zS7AgPmr2fZ3N97r4+YXN3mBePTG2/bJ8DApl9mVwYL+RpYbNxMEkEp4mPGdwG/w== + dependencies: + "@ethersproject/abstract-provider" "^5.6.1" + "@ethersproject/abstract-signer" "^5.6.2" + "@ethersproject/address" "^5.6.1" + "@ethersproject/base64" "^5.6.1" + "@ethersproject/basex" "^5.6.1" + "@ethersproject/bignumber" "^5.6.2" + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/constants" "^5.6.1" + "@ethersproject/hash" "^5.6.1" + "@ethersproject/logger" "^5.6.0" + "@ethersproject/networks" "^5.6.3" + "@ethersproject/properties" "^5.6.0" + "@ethersproject/random" "^5.6.1" + "@ethersproject/rlp" "^5.6.1" + "@ethersproject/sha2" "^5.6.1" + "@ethersproject/strings" "^5.6.1" + "@ethersproject/transactions" "^5.6.2" + "@ethersproject/web" "^5.6.1" + bech32 "1.1.4" + ws "7.4.6" + "@ethersproject/providers@5.7.2", "@ethersproject/providers@^5.4.7", "@ethersproject/providers@^5.7.1", "@ethersproject/providers@^5.7.2": version "5.7.2" resolved "https://registry.yarnpkg.com/@ethersproject/providers/-/providers-5.7.2.tgz#f8b1a4f275d7ce58cf0a2eec222269a08beb18cb" @@ -576,7 +825,15 @@ "@ethersproject/bytes" "^5.4.0" "@ethersproject/logger" "^5.4.0" -"@ethersproject/random@5.7.0", "@ethersproject/random@^5.4.0", "@ethersproject/random@^5.7.0": +"@ethersproject/random@5.6.1": + version "5.6.1" + resolved "https://registry.yarnpkg.com/@ethersproject/random/-/random-5.6.1.tgz#66915943981bcd3e11bbd43733f5c3ba5a790255" + integrity sha512-/wtPNHwbmng+5yi3fkipA8YBT59DdkGRoC2vWk09Dci/q5DlgnMkhIycjHlavrvrjJBkFjO/ueLyT+aUDfc4lA== + dependencies: + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/logger" "^5.6.0" + +"@ethersproject/random@5.7.0", "@ethersproject/random@^5.4.0", "@ethersproject/random@^5.6.1", "@ethersproject/random@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/random/-/random-5.7.0.tgz#af19dcbc2484aae078bb03656ec05df66253280c" integrity sha512-19WjScqRA8IIeWclFme75VMXSBvi4e6InrUNuaR4s5pTF2qNhcGdCUwdxUVGtDDqC00sDLCO93jPQoDUH4HVmQ== @@ -592,7 +849,15 @@ "@ethersproject/bytes" "^5.4.0" "@ethersproject/logger" "^5.4.0" -"@ethersproject/rlp@5.7.0", "@ethersproject/rlp@^5.4.0", "@ethersproject/rlp@^5.7.0": +"@ethersproject/rlp@5.6.1": + version "5.6.1" + resolved "https://registry.yarnpkg.com/@ethersproject/rlp/-/rlp-5.6.1.tgz#df8311e6f9f24dcb03d59a2bac457a28a4fe2bd8" + integrity sha512-uYjmcZx+DKlFUk7a5/W9aQVaoEC7+1MOBgNtvNg13+RnuUwT4F0zTovC0tmay5SmRslb29V1B7Y5KCri46WhuQ== + dependencies: + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/logger" "^5.6.0" + +"@ethersproject/rlp@5.7.0", "@ethersproject/rlp@^5.4.0", "@ethersproject/rlp@^5.6.1", "@ethersproject/rlp@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/rlp/-/rlp-5.7.0.tgz#de39e4d5918b9d74d46de93af80b7685a9c21304" integrity sha512-rBxzX2vK8mVF7b0Tol44t5Tb8gomOHkj5guL+HhzQ1yBh/ydjGnpw6at+X6Iw0Kp3OzzzkcKp8N9r0W4kYSs9w== @@ -609,7 +874,16 @@ "@ethersproject/logger" "^5.4.0" hash.js "1.1.7" -"@ethersproject/sha2@5.7.0", "@ethersproject/sha2@^5.4.0", "@ethersproject/sha2@^5.7.0": +"@ethersproject/sha2@5.6.1": + version "5.6.1" + resolved "https://registry.yarnpkg.com/@ethersproject/sha2/-/sha2-5.6.1.tgz#211f14d3f5da5301c8972a8827770b6fd3e51656" + integrity sha512-5K2GyqcW7G4Yo3uenHegbXRPDgARpWUiXc6RiF7b6i/HXUoWlb7uCARh7BAHg7/qT/Q5ydofNwiZcim9qpjB6g== + dependencies: + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/logger" "^5.6.0" + hash.js "1.1.7" + +"@ethersproject/sha2@5.7.0", "@ethersproject/sha2@^5.4.0", "@ethersproject/sha2@^5.6.1", "@ethersproject/sha2@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/sha2/-/sha2-5.7.0.tgz#9a5f7a7824ef784f7f7680984e593a800480c9fb" integrity sha512-gKlH42riwb3KYp0reLsFTokByAKoJdgFCwI+CCiX/k+Jm2mbNs6oOaCjYQSlI1+XBVejwH2KrmCbMAT/GnRDQw== @@ -630,7 +904,19 @@ elliptic "6.5.4" hash.js "1.1.7" -"@ethersproject/signing-key@5.7.0", "@ethersproject/signing-key@^5.4.0", "@ethersproject/signing-key@^5.7.0": +"@ethersproject/signing-key@5.6.2": + version "5.6.2" + resolved "https://registry.yarnpkg.com/@ethersproject/signing-key/-/signing-key-5.6.2.tgz#8a51b111e4d62e5a62aee1da1e088d12de0614a3" + integrity sha512-jVbu0RuP7EFpw82vHcL+GP35+KaNruVAZM90GxgQnGqB6crhBqW/ozBfFvdeImtmb4qPko0uxXjn8l9jpn0cwQ== + dependencies: + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/logger" "^5.6.0" + "@ethersproject/properties" "^5.6.0" + bn.js "^5.2.1" + elliptic "6.5.4" + hash.js "1.1.7" + +"@ethersproject/signing-key@5.7.0", "@ethersproject/signing-key@^5.4.0", "@ethersproject/signing-key@^5.6.2", "@ethersproject/signing-key@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/signing-key/-/signing-key-5.7.0.tgz#06b2df39411b00bc57c7c09b01d1e41cf1b16ab3" integrity sha512-MZdy2nL3wO0u7gkB4nA/pEf8lu1TlFswPNmy8AiYkfKTdO6eXBJyUdmHO/ehm/htHw9K/qF8ujnTyUAD+Ry54Q== @@ -653,6 +939,18 @@ "@ethersproject/sha2" "^5.4.0" "@ethersproject/strings" "^5.4.0" +"@ethersproject/solidity@5.6.1": + version "5.6.1" + resolved "https://registry.yarnpkg.com/@ethersproject/solidity/-/solidity-5.6.1.tgz#5845e71182c66d32e6ec5eefd041fca091a473e2" + integrity sha512-KWqVLkUUoLBfL1iwdzUVlkNqAUIFMpbbeH0rgCfKmJp0vFtY4AsaN91gHKo9ZZLkC4UOm3cI3BmMV4N53BOq4g== + dependencies: + "@ethersproject/bignumber" "^5.6.2" + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/keccak256" "^5.6.1" + "@ethersproject/logger" "^5.6.0" + "@ethersproject/sha2" "^5.6.1" + "@ethersproject/strings" "^5.6.1" + "@ethersproject/solidity@5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/solidity/-/solidity-5.7.0.tgz#5e9c911d8a2acce2a5ebb48a5e2e0af20b631cb8" @@ -674,7 +972,16 @@ "@ethersproject/constants" "^5.4.0" "@ethersproject/logger" "^5.4.0" -"@ethersproject/strings@5.7.0", "@ethersproject/strings@^5.4.0", "@ethersproject/strings@^5.7.0": +"@ethersproject/strings@5.6.1": + version "5.6.1" + resolved "https://registry.yarnpkg.com/@ethersproject/strings/-/strings-5.6.1.tgz#dbc1b7f901db822b5cafd4ebf01ca93c373f8952" + integrity sha512-2X1Lgk6Jyfg26MUnsHiT456U9ijxKUybz8IM1Vih+NJxYtXhmvKBcHOmvGqpFSVJ0nQ4ZCoIViR8XlRw1v/+Cw== + dependencies: + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/constants" "^5.6.1" + "@ethersproject/logger" "^5.6.0" + +"@ethersproject/strings@5.7.0", "@ethersproject/strings@^5.4.0", "@ethersproject/strings@^5.6.1", "@ethersproject/strings@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/strings/-/strings-5.7.0.tgz#54c9d2a7c57ae8f1205c88a9d3a56471e14d5ed2" integrity sha512-/9nu+lj0YswRNSH0NXYqrh8775XNyEdUQAuf3f+SmOrnVewcJ5SBNAjF7lpgehKi4abvNNXyf+HX86czCdJ8Mg== @@ -698,7 +1005,22 @@ "@ethersproject/rlp" "^5.4.0" "@ethersproject/signing-key" "^5.4.0" -"@ethersproject/transactions@5.7.0", "@ethersproject/transactions@^5.4.0", "@ethersproject/transactions@^5.7.0": +"@ethersproject/transactions@5.6.2": + version "5.6.2" + resolved "https://registry.yarnpkg.com/@ethersproject/transactions/-/transactions-5.6.2.tgz#793a774c01ced9fe7073985bb95a4b4e57a6370b" + integrity sha512-BuV63IRPHmJvthNkkt9G70Ullx6AcM+SDc+a8Aw/8Yew6YwT51TcBKEp1P4oOQ/bP25I18JJr7rcFRgFtU9B2Q== + dependencies: + "@ethersproject/address" "^5.6.1" + "@ethersproject/bignumber" "^5.6.2" + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/constants" "^5.6.1" + "@ethersproject/keccak256" "^5.6.1" + "@ethersproject/logger" "^5.6.0" + "@ethersproject/properties" "^5.6.0" + "@ethersproject/rlp" "^5.6.1" + "@ethersproject/signing-key" "^5.6.2" + +"@ethersproject/transactions@5.7.0", "@ethersproject/transactions@^5.4.0", "@ethersproject/transactions@^5.6.2", "@ethersproject/transactions@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/transactions/-/transactions-5.7.0.tgz#91318fc24063e057885a6af13fdb703e1f993d3b" integrity sha512-kmcNicCp1lp8qanMTC3RIikGgoJ80ztTyvtsFvCYpSCfkjhD0jZ2LOrnbcuxuToLIUYYf+4XwD1rP+B/erDIhQ== @@ -722,6 +1044,15 @@ "@ethersproject/constants" "^5.4.0" "@ethersproject/logger" "^5.4.0" +"@ethersproject/units@5.6.1": + version "5.6.1" + resolved "https://registry.yarnpkg.com/@ethersproject/units/-/units-5.6.1.tgz#ecc590d16d37c8f9ef4e89e2005bda7ddc6a4e6f" + integrity sha512-rEfSEvMQ7obcx3KWD5EWWx77gqv54K6BKiZzKxkQJqtpriVsICrktIQmKl8ReNToPeIYPnFHpXvKpi068YFZXw== + dependencies: + "@ethersproject/bignumber" "^5.6.2" + "@ethersproject/constants" "^5.6.1" + "@ethersproject/logger" "^5.6.0" + "@ethersproject/units@5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/units/-/units-5.7.0.tgz#637b563d7e14f42deeee39245275d477aae1d8b1" @@ -752,6 +1083,27 @@ "@ethersproject/transactions" "^5.4.0" "@ethersproject/wordlists" "^5.4.0" +"@ethersproject/wallet@5.6.2": + version "5.6.2" + resolved "https://registry.yarnpkg.com/@ethersproject/wallet/-/wallet-5.6.2.tgz#cd61429d1e934681e413f4bc847a5f2f87e3a03c" + integrity sha512-lrgh0FDQPuOnHcF80Q3gHYsSUODp6aJLAdDmDV0xKCN/T7D99ta1jGVhulg3PY8wiXEngD0DfM0I2XKXlrqJfg== + dependencies: + "@ethersproject/abstract-provider" "^5.6.1" + "@ethersproject/abstract-signer" "^5.6.2" + "@ethersproject/address" "^5.6.1" + "@ethersproject/bignumber" "^5.6.2" + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/hash" "^5.6.1" + "@ethersproject/hdnode" "^5.6.2" + "@ethersproject/json-wallets" "^5.6.1" + "@ethersproject/keccak256" "^5.6.1" + "@ethersproject/logger" "^5.6.0" + "@ethersproject/properties" "^5.6.0" + "@ethersproject/random" "^5.6.1" + "@ethersproject/signing-key" "^5.6.2" + "@ethersproject/transactions" "^5.6.2" + "@ethersproject/wordlists" "^5.6.1" + "@ethersproject/wallet@5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/wallet/-/wallet-5.7.0.tgz#4e5d0790d96fe21d61d38fb40324e6c7ef350b2d" @@ -784,7 +1136,18 @@ "@ethersproject/properties" "^5.4.0" "@ethersproject/strings" "^5.4.0" -"@ethersproject/web@5.7.1", "@ethersproject/web@^5.4.0", "@ethersproject/web@^5.7.0": +"@ethersproject/web@5.6.1": + version "5.6.1" + resolved "https://registry.yarnpkg.com/@ethersproject/web/-/web-5.6.1.tgz#6e2bd3ebadd033e6fe57d072db2b69ad2c9bdf5d" + integrity sha512-/vSyzaQlNXkO1WV+RneYKqCJwualcUdx/Z3gseVovZP0wIlOFcCE1hkRhKBH8ImKbGQbMl9EAAyJFrJu7V0aqA== + dependencies: + "@ethersproject/base64" "^5.6.1" + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/logger" "^5.6.0" + "@ethersproject/properties" "^5.6.0" + "@ethersproject/strings" "^5.6.1" + +"@ethersproject/web@5.7.1", "@ethersproject/web@^5.4.0", "@ethersproject/web@^5.6.1", "@ethersproject/web@^5.7.0": version "5.7.1" resolved "https://registry.yarnpkg.com/@ethersproject/web/-/web-5.7.1.tgz#de1f285b373149bee5928f4eb7bcb87ee5fbb4ae" integrity sha512-Gueu8lSvyjBWL4cYsWsjh6MtMwM0+H4HvqFPZfB6dV8ctbP9zFAO73VG1cMWae0FLPCtz0peKPpZY8/ugJJX2w== @@ -806,7 +1169,18 @@ "@ethersproject/properties" "^5.4.0" "@ethersproject/strings" "^5.4.0" -"@ethersproject/wordlists@5.7.0", "@ethersproject/wordlists@^5.4.0", "@ethersproject/wordlists@^5.7.0": +"@ethersproject/wordlists@5.6.1": + version "5.6.1" + resolved "https://registry.yarnpkg.com/@ethersproject/wordlists/-/wordlists-5.6.1.tgz#1e78e2740a8a21e9e99947e47979d72e130aeda1" + integrity sha512-wiPRgBpNbNwCQFoCr8bcWO8o5I810cqO6mkdtKfLKFlLxeCWcnzDi4Alu8iyNzlhYuS9npCwivMbRWF19dyblw== + dependencies: + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/hash" "^5.6.1" + "@ethersproject/logger" "^5.6.0" + "@ethersproject/properties" "^5.6.0" + "@ethersproject/strings" "^5.6.1" + +"@ethersproject/wordlists@5.7.0", "@ethersproject/wordlists@^5.4.0", "@ethersproject/wordlists@^5.6.1", "@ethersproject/wordlists@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/wordlists/-/wordlists-5.7.0.tgz#8fb2c07185d68c3e09eb3bfd6e779ba2774627f5" integrity sha512-S2TFNJNfHWVHNE6cNDjbVlZ6MgE17MIxMbMg2zv3wn+3XSJGosL1m9ZVv3GXCf/2ymSsQ+hRI5IzoMJTG6aoVA== @@ -864,6 +1238,17 @@ chalk "^4.1.2" figures "^3.2.0" +"@inquirer/checkbox@^2.5.0": + version "2.5.0" + resolved "https://registry.yarnpkg.com/@inquirer/checkbox/-/checkbox-2.5.0.tgz#41c5c9dd332c0a8fa159be23982ce080d0b199d4" + integrity sha512-sMgdETOfi2dUHT8r7TT1BTKOwNvdDGFDXYWtQ2J69SvlYNntk9I/gJe7r5yvMwwsuKnYbuRs3pNhx4tgNck5aA== + dependencies: + "@inquirer/core" "^9.1.0" + "@inquirer/figures" "^1.0.5" + "@inquirer/type" "^1.5.3" + ansi-escapes "^4.3.2" + yoctocolors-cjs "^2.1.2" + "@inquirer/confirm@^2.0.5": version "2.0.9" resolved "https://registry.yarnpkg.com/@inquirer/confirm/-/confirm-2.0.9.tgz#1b3716a95829eda21cfb5a0166773c3f1e0c3721" @@ -873,6 +1258,14 @@ "@inquirer/type" "^1.1.2" chalk "^4.1.2" +"@inquirer/confirm@^3.2.0": + version "3.2.0" + resolved "https://registry.yarnpkg.com/@inquirer/confirm/-/confirm-3.2.0.tgz#6af1284670ea7c7d95e3f1253684cfbd7228ad6a" + integrity sha512-oOIwPs0Dvq5220Z8lGL/6LHRTEr9TgLHmiI99Rj1PJ1p1czTys+olrgBqZk4E2qC0YTzeHprxSQmoHioVdJ7Lw== + dependencies: + "@inquirer/core" "^9.1.0" + "@inquirer/type" "^1.5.3" + "@inquirer/core@^1.1.3": version "1.3.0" resolved "https://registry.yarnpkg.com/@inquirer/core/-/core-1.3.0.tgz#469427e51daa519f2b1332745a2222629c03c701" @@ -929,6 +1322,25 @@ strip-ansi "^6.0.1" wrap-ansi "^6.2.0" +"@inquirer/core@^9.1.0": + version "9.1.0" + resolved "https://registry.yarnpkg.com/@inquirer/core/-/core-9.1.0.tgz#158b82dc44564a1abd0ce14723d50c3efa0634a2" + integrity sha512-RZVfH//2ytTjmaBIzeKT1zefcQZzuruwkpTwwbe/i2jTl4o9M+iML5ChULzz6iw1Ok8iUBBsRCjY2IEbD8Ft4w== + dependencies: + "@inquirer/figures" "^1.0.5" + "@inquirer/type" "^1.5.3" + "@types/mute-stream" "^0.0.4" + "@types/node" "^22.5.2" + "@types/wrap-ansi" "^3.0.0" + ansi-escapes "^4.3.2" + cli-spinners "^2.9.2" + cli-width "^4.1.0" + mute-stream "^1.0.0" + signal-exit "^4.1.0" + strip-ansi "^6.0.1" + wrap-ansi "^6.2.0" + yoctocolors-cjs "^2.1.2" + "@inquirer/editor@^1.2.3": version "1.2.7" resolved "https://registry.yarnpkg.com/@inquirer/editor/-/editor-1.2.7.tgz#c2c5c4ecac465dc76656ec4454c749885e4df927" @@ -939,6 +1351,15 @@ chalk "^4.1.2" external-editor "^3.1.0" +"@inquirer/editor@^2.2.0": + version "2.2.0" + resolved "https://registry.yarnpkg.com/@inquirer/editor/-/editor-2.2.0.tgz#a41eb7b151bd9a6bc3c0b69219d02d82547bc387" + integrity sha512-9KHOpJ+dIL5SZli8lJ6xdaYLPPzB8xB9GZItg39MBybzhxA16vxmszmQFrRwbOA918WA2rvu8xhDEg/p6LXKbw== + dependencies: + "@inquirer/core" "^9.1.0" + "@inquirer/type" "^1.5.3" + external-editor "^3.1.0" + "@inquirer/expand@^1.1.4": version "1.1.8" resolved "https://registry.yarnpkg.com/@inquirer/expand/-/expand-1.1.8.tgz#1d1b907303b44fefc6ad324b9c90fa3d60302fa3" @@ -949,6 +1370,20 @@ chalk "^4.1.2" figures "^3.2.0" +"@inquirer/expand@^2.3.0": + version "2.3.0" + resolved "https://registry.yarnpkg.com/@inquirer/expand/-/expand-2.3.0.tgz#afc44aee303315a85563e9d0275e658f0ee0e701" + integrity sha512-qnJsUcOGCSG1e5DTOErmv2BPQqrtT6uzqn1vI/aYGiPKq+FgslGZmtdnXbhuI7IlT7OByDoEEqdnhUnVR2hhLw== + dependencies: + "@inquirer/core" "^9.1.0" + "@inquirer/type" "^1.5.3" + yoctocolors-cjs "^2.1.2" + +"@inquirer/figures@^1.0.5": + version "1.0.5" + resolved "https://registry.yarnpkg.com/@inquirer/figures/-/figures-1.0.5.tgz#57f9a996d64d3e3345d2a3ca04d36912e94f8790" + integrity sha512-79hP/VWdZ2UVc9bFGJnoQ/lQMpL74mGgzSYX1xUqCVk7/v73vJCMw1VuyWN1jGkZ9B3z7THAbySqGbCNefcjfA== + "@inquirer/input@^1.2.4", "@inquirer/input@^1.2.8": version "1.2.8" resolved "https://registry.yarnpkg.com/@inquirer/input/-/input-1.2.8.tgz#a803cd7a365ed52c706fde4789d8768278dc09b8" @@ -958,6 +1393,22 @@ "@inquirer/type" "^1.1.2" chalk "^4.1.2" +"@inquirer/input@^2.3.0": + version "2.3.0" + resolved "https://registry.yarnpkg.com/@inquirer/input/-/input-2.3.0.tgz#9b99022f53780fecc842908f3f319b52a5a16865" + integrity sha512-XfnpCStx2xgh1LIRqPXrTNEEByqQWoxsWYzNRSEUxJ5c6EQlhMogJ3vHKu8aXuTacebtaZzMAHwEL0kAflKOBw== + dependencies: + "@inquirer/core" "^9.1.0" + "@inquirer/type" "^1.5.3" + +"@inquirer/number@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@inquirer/number/-/number-1.1.0.tgz#4dac004021ea67c89552a261564f103a494cac96" + integrity sha512-ilUnia/GZUtfSZy3YEErXLJ2Sljo/mf9fiKc08n18DdwdmDbOzRcTv65H1jjDvlsAuvdFXf4Sa/aL7iw/NanVA== + dependencies: + "@inquirer/core" "^9.1.0" + "@inquirer/type" "^1.5.3" + "@inquirer/password@^1.1.4": version "1.1.8" resolved "https://registry.yarnpkg.com/@inquirer/password/-/password-1.1.8.tgz#73d6e98611c411ea08a8ae21ec787d6672abf6b5" @@ -968,6 +1419,15 @@ ansi-escapes "^4.3.2" chalk "^4.1.2" +"@inquirer/password@^2.2.0": + version "2.2.0" + resolved "https://registry.yarnpkg.com/@inquirer/password/-/password-2.2.0.tgz#0b6f26336c259c8a9e5f5a3f2e1a761564f764ba" + integrity sha512-5otqIpgsPYIshqhgtEwSspBQE40etouR8VIxzpJkv9i0dVHIpyhiivbkH9/dGiMLdyamT54YRdGJLfl8TFnLHg== + dependencies: + "@inquirer/core" "^9.1.0" + "@inquirer/type" "^1.5.3" + ansi-escapes "^4.3.2" + "@inquirer/prompts@^2.1.1": version "2.3.1" resolved "https://registry.yarnpkg.com/@inquirer/prompts/-/prompts-2.3.1.tgz#fe430f96e510cf352efeb77af2dbd6d3049e677c" @@ -983,6 +1443,22 @@ "@inquirer/rawlist" "^1.2.4" "@inquirer/select" "^1.2.4" +"@inquirer/prompts@^5.5.0": + version "5.5.0" + resolved "https://registry.yarnpkg.com/@inquirer/prompts/-/prompts-5.5.0.tgz#5805aa15a13180017829aa31d071fd37a43b735d" + integrity sha512-BHDeL0catgHdcHbSFFUddNzvx/imzJMft+tWDPwTm3hfu8/tApk1HrooNngB2Mb4qY+KaRWF+iZqoVUPeslEog== + dependencies: + "@inquirer/checkbox" "^2.5.0" + "@inquirer/confirm" "^3.2.0" + "@inquirer/editor" "^2.2.0" + "@inquirer/expand" "^2.3.0" + "@inquirer/input" "^2.3.0" + "@inquirer/number" "^1.1.0" + "@inquirer/password" "^2.2.0" + "@inquirer/rawlist" "^2.3.0" + "@inquirer/search" "^1.1.0" + "@inquirer/select" "^2.5.0" + "@inquirer/rawlist@^1.2.4": version "1.2.8" resolved "https://registry.yarnpkg.com/@inquirer/rawlist/-/rawlist-1.2.8.tgz#e3dfdf49539ce08e47b759702f847f0cc55d4bd7" @@ -992,6 +1468,25 @@ "@inquirer/type" "^1.1.2" chalk "^4.1.2" +"@inquirer/rawlist@^2.3.0": + version "2.3.0" + resolved "https://registry.yarnpkg.com/@inquirer/rawlist/-/rawlist-2.3.0.tgz#6b2c0da39c1cd855af5608b2d627681cdac7277d" + integrity sha512-zzfNuINhFF7OLAtGHfhwOW2TlYJyli7lOUoJUXw/uyklcwalV6WRXBXtFIicN8rTRK1XTiPWB4UY+YuW8dsnLQ== + dependencies: + "@inquirer/core" "^9.1.0" + "@inquirer/type" "^1.5.3" + yoctocolors-cjs "^2.1.2" + +"@inquirer/search@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@inquirer/search/-/search-1.1.0.tgz#665928cac2326b9501ddafbb8606ce4823b3106b" + integrity sha512-h+/5LSj51dx7hp5xOn4QFnUaKeARwUCLs6mIhtkJ0JYPBLmEYjdHSYh7I6GrLg9LwpJ3xeX0FZgAG1q0QdCpVQ== + dependencies: + "@inquirer/core" "^9.1.0" + "@inquirer/figures" "^1.0.5" + "@inquirer/type" "^1.5.3" + yoctocolors-cjs "^2.1.2" + "@inquirer/select@1.1.3": version "1.1.3" resolved "https://registry.yarnpkg.com/@inquirer/select/-/select-1.1.3.tgz#7974d1beff6b87c981a9e25e1ef4cb237f03c1b2" @@ -1014,11 +1509,29 @@ chalk "^4.1.2" figures "^3.2.0" +"@inquirer/select@^2.5.0": + version "2.5.0" + resolved "https://registry.yarnpkg.com/@inquirer/select/-/select-2.5.0.tgz#345c6908ecfaeef3d84ddd2f9feb2f487c558efb" + integrity sha512-YmDobTItPP3WcEI86GvPo+T2sRHkxxOq/kXmsBjHS5BVXUgvgZ5AfJjkvQvZr03T81NnI3KrrRuMzeuYUQRFOA== + dependencies: + "@inquirer/core" "^9.1.0" + "@inquirer/figures" "^1.0.5" + "@inquirer/type" "^1.5.3" + ansi-escapes "^4.3.2" + yoctocolors-cjs "^2.1.2" + "@inquirer/type@^1.0.3", "@inquirer/type@^1.0.5", "@inquirer/type@^1.1.1", "@inquirer/type@^1.1.2": version "1.1.2" resolved "https://registry.yarnpkg.com/@inquirer/type/-/type-1.1.2.tgz#5c576904707cec5f6ee0097b0a3f355e617ae7c8" integrity sha512-lowHTIBAE/bltg7/EchMDLfKUdT0BCyS2xzqgjsyKADybz2QZ0cLWtDXzjT1C6rdZI07Ng9jU4d2R9rDoU+6Hw== +"@inquirer/type@^1.5.3": + version "1.5.3" + resolved "https://registry.yarnpkg.com/@inquirer/type/-/type-1.5.3.tgz#220ae9f3d5ae17dd3b2ce5ffd6b48c4a30c73181" + integrity sha512-xUQ14WQGR/HK5ei+2CvgcwoH9fQ4PgPGmVFSN0pc1+fVyDL3MREhyAY7nxEErSu6CkllBM3D7e3e+kOvtu+eIg== + dependencies: + mute-stream "^1.0.0" + "@jridgewell/resolve-uri@^3.0.3": version "3.1.1" resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz#c08679063f279615a3326583ba3a90d1d82cc721" @@ -1497,11 +2010,6 @@ resolved "https://registry.yarnpkg.com/@openzeppelin/contracts-upgradeable/-/contracts-upgradeable-5.0.2.tgz#3e5321a2ecdd0b206064356798c21225b6ec7105" integrity sha512-0MmkHSHiW2NRFiT9/r5Lu4eJq5UJ4/tzlOgYXNAIj/ONkQTVnz22pLxDvp4C4uZ9he7ZFvGn3Driptn1/iU7tQ== -"@openzeppelin/contracts@^4.9.6": - version "4.9.6" - resolved "https://registry.yarnpkg.com/@openzeppelin/contracts/-/contracts-4.9.6.tgz#2a880a24eb19b4f8b25adc2a5095f2aa27f39677" - integrity sha512-xSmezSupL+y9VkHZJGDoCBpmnB2ogM13ccaYDWqJTfS3dbuHkgjuwDFUmaFauBCboQMGB/S5UqUl2y54X99BmA== - "@openzeppelin/contracts@^5.0.2": version "5.0.2" resolved "https://registry.yarnpkg.com/@openzeppelin/contracts/-/contracts-5.0.2.tgz#b1d03075e49290d06570b2fd42154d76c2a5d210" @@ -1843,6 +2351,27 @@ rpc-websockets "^9.0.2" superstruct "^2.0.2" +"@solana/web3.js@^1.95.3": + version "1.95.3" + resolved "https://registry.yarnpkg.com/@solana/web3.js/-/web3.js-1.95.3.tgz#70b5f4d76823f56b5af6403da51125fffeb65ff3" + integrity sha512-O6rPUN0w2fkNqx/Z3QJMB9L225Ex10PRDH8bTaIUPZXMPV0QP8ZpPvjQnXK+upUczlRgzHzd6SjKIha1p+I6og== + dependencies: + "@babel/runtime" "^7.25.0" + "@noble/curves" "^1.4.2" + "@noble/hashes" "^1.4.0" + "@solana/buffer-layout" "^4.0.1" + agentkeepalive "^4.5.0" + bigint-buffer "^1.1.5" + bn.js "^5.2.1" + borsh "^0.7.0" + bs58 "^4.0.1" + buffer "6.0.3" + fast-stable-stringify "^1.0.0" + jayson "^4.1.1" + node-fetch "^2.7.0" + rpc-websockets "^9.0.2" + superstruct "^2.0.2" + "@solidity-parser/parser@^0.14.0": version "0.14.5" resolved "https://registry.yarnpkg.com/@solidity-parser/parser/-/parser-0.14.5.tgz#87bc3cc7b068e08195c219c91cd8ddff5ef1a804" @@ -1986,6 +2515,13 @@ dependencies: "@types/node" "*" +"@types/mute-stream@^0.0.4": + version "0.0.4" + resolved "https://registry.yarnpkg.com/@types/mute-stream/-/mute-stream-0.0.4.tgz#77208e56a08767af6c5e1237be8888e2f255c478" + integrity sha512-CPM9nzrCPPJHQNA9keH9CVkVI+WR5kMa+7XEs5jcGQ0VoAGnLv242w8lIVgwAEfmE4oufJRaTc9PNLQl0ioAow== + dependencies: + "@types/node" "*" + "@types/node@*", "@types/node@>=12.0.0", "@types/node@^20.4.2", "@types/node@^20.4.8": version "20.5.0" resolved "https://registry.yarnpkg.com/@types/node/-/node-20.5.0.tgz#7fc8636d5f1aaa3b21e6245e97d56b7f56702313" @@ -2006,6 +2542,13 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-12.20.55.tgz#c329cbd434c42164f846b909bd6f85b5537f6240" integrity sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ== +"@types/node@^22.5.2": + version "22.5.4" + resolved "https://registry.yarnpkg.com/@types/node/-/node-22.5.4.tgz#83f7d1f65bc2ed223bdbf57c7884f1d5a4fa84e8" + integrity sha512-FDuKUJQm/ju9fT/SeX/6+gBzoPzlVCzfzmGkwKvRHQVxi4BntVbyIwf6a4Xn62mrvndLiml6z/UBXIdEVjQLXg== + dependencies: + undici-types "~6.19.2" + "@types/node@^8.0.0": version "8.10.66" resolved "https://registry.yarnpkg.com/@types/node/-/node-8.10.66.tgz#dd035d409df322acc83dff62a602f12a5783bbb3" @@ -2173,6 +2716,11 @@ resolved "https://registry.yarnpkg.com/@uniswap/v2-core/-/v2-core-1.0.0.tgz#e0fab91a7d53e8cafb5326ae4ca18351116b0844" integrity sha512-BJiXrBGnN8mti7saW49MXwxDBRFiWemGetE58q8zgfnPPzQKq55ADltEILqOt6VFZ22kVeVKbF8gVd8aY3l7pA== +"@uniswap/v2-core@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@uniswap/v2-core/-/v2-core-1.0.1.tgz#af8f508bf183204779938969e2e54043e147d425" + integrity sha512-MtybtkUPSyysqLY2U210NBDeCHX+ltHt3oADGdjqoThZaFRDKwM6k1Nb3F0A3hk5hwuQvytFWhrWHOEq6nVJ8Q== + "@uniswap/v2-periphery@^1.1.0-beta.0": version "1.1.0-beta.0" resolved "https://registry.yarnpkg.com/@uniswap/v2-periphery/-/v2-periphery-1.1.0-beta.0.tgz#20a4ccfca22f1a45402303aedb5717b6918ebe6d" @@ -2181,75 +2729,78 @@ "@uniswap/lib" "1.1.1" "@uniswap/v2-core" "1.0.0" -"@zetachain/faucet-cli@^4.0.1": - version "4.0.1" - resolved "https://registry.yarnpkg.com/@zetachain/faucet-cli/-/faucet-cli-4.0.1.tgz#1201b2c775fcf7dd4c368c24dfbcc8eb7743a23d" - integrity sha512-7EjrqNZtaM+C26KHWbSqTSEUaDbgMG3yxDJFkY/740UB12/OtDHuFL/yd9Y93grAaMfgzs9I4kKk3onqABcMqQ== +"@zetachain/faucet-cli@^4.1.1": + version "4.1.1" + resolved "https://registry.yarnpkg.com/@zetachain/faucet-cli/-/faucet-cli-4.1.1.tgz#57645e9b7f7bb8483d25605053383c531ab04961" + integrity sha512-tvpw/oHYVj+FliBX1MhqCIpvE3n/vNVUmncN4V1xUaeeLcCZcSH8MAtp4PeMPzYI1ym/ecDAWPl8QqelIGaQAw== dependencies: - axios "1.2.3" + axios "1.7.4" commander "10.0.1" - dayjs "1.11.3" + dayjs "1.11.10" ethers "5.7.2" - figlet "1.6.0" + figlet "1.7.0" launchdarkly-node-client-sdk "3.0.2" - typescript "5.0.4" - zod "3.19.1" + typescript "5.5.4" + zod "3.22.4" -"@zetachain/localnet@^1.0.1": - version "1.0.1" - resolved "https://registry.yarnpkg.com/@zetachain/localnet/-/localnet-1.0.1.tgz#f89fd0e930a4378279831d4f66472a6d01eb9d99" - integrity sha512-bP+///fWudDfuSJrciXDwP2UxnwdcEODwxD60ugiyfdOguDClZYQ1r4AybW10CYn9sSkieLzlmSidryQDksYCA== +"@zetachain/localnet@4.0.0-rc6": + version "4.0.0-rc6" + resolved "https://registry.yarnpkg.com/@zetachain/localnet/-/localnet-4.0.0-rc6.tgz#9b36f5ab0e8fac766d63cfca4b1cab6a263bdd5d" + integrity sha512-DGKspMAJZLUrgNirc3NzFYg9jRfaOyuF5ePj85D93qAA//f8lOsXpmh/6Bvq/MrEscCLpVavgVP7+ePy4KJ2Fw== dependencies: - "@zetachain/protocol-contracts" "10.0.0-rc8" + "@inquirer/prompts" "^5.5.0" + "@uniswap/v2-core" "^1.0.1" + "@uniswap/v2-periphery" "^1.1.0-beta.0" + "@zetachain/protocol-contracts" "11.0.0-rc3" ansis "^3.3.2" concurrently "^8.2.2" ethers "^6.13.2" hardhat "^2.22.8" wait-on "^7.2.0" -"@zetachain/networks@7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@zetachain/networks/-/networks-7.0.0.tgz#a5f8a188d633e2064ee7c77499351381ba891441" - integrity sha512-/amSq+KNJe+EGj0ioZS+DZJtsnbPSDotp9LsrAbaEVMAxKvBK/XkvggH73sJyRWWeMpfhHrNPlrKTLrN+mRkIg== +"@zetachain/networks@10.0.0", "@zetachain/networks@^10.0.0": + version "10.0.0" + resolved "https://registry.yarnpkg.com/@zetachain/networks/-/networks-10.0.0.tgz#dd5d14a0870f6b658644aded8c96859f15531089" + integrity sha512-FPolaO19oVkSLSPDUA/Hu+8AhG3lDEslRDpLnMzbMbnNSC669Fkah0/TEf+6egrQbAifBRfFLzwWidAGs8oxtA== dependencies: dotenv "^16.1.4" -"@zetachain/protocol-contracts@10.0.0-rc8": - version "10.0.0-rc8" - resolved "https://registry.yarnpkg.com/@zetachain/protocol-contracts/-/protocol-contracts-10.0.0-rc8.tgz#3ca4385c87daf7978cff01366f64beecba5bb3b6" - integrity sha512-RWFxwmLDMJfSh8IOxrCoJTVrlJcfCBiEMULVrBRQJk7cg7J/X10YEqdoglYZCrmkSrWoHEd0s6zbckXKjUA1FQ== +"@zetachain/protocol-contracts@11.0.0-rc3": + version "11.0.0-rc3" + resolved "https://registry.yarnpkg.com/@zetachain/protocol-contracts/-/protocol-contracts-11.0.0-rc3.tgz#9b719391d0728fd1b4e046c5f496180a45ecf0d5" + integrity sha512-Q8lOFOi7S1wdOfOBZPTxsOoyV6kyWwYEhg4vk+HmB36n0Q6A2VvTI7qmw8rxCvq0a5BUASC8IYx0+HzsOPvNOw== dependencies: "@openzeppelin/contracts" "^5.0.2" "@openzeppelin/contracts-upgradeable" "^5.0.2" - ethers "^6.13.1" - -"@zetachain/protocol-contracts@7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@zetachain/protocol-contracts/-/protocol-contracts-7.0.0.tgz#20eb6c62d805d7470408ccdff0e3614684bca174" - integrity sha512-8JTNFZxVZYmDtAXJIEr+tkakuML12X42Fya4bJ1NkfWiVMkcSej92BSTl/35qYtHdjY7vXy9uMrfXEqfw5rsPw== + "@zetachain/networks" "^10.0.0" + ethers "5.6.8" "@zetachain/protocol-contracts@9.0.0": version "9.0.0" resolved "https://registry.yarnpkg.com/@zetachain/protocol-contracts/-/protocol-contracts-9.0.0.tgz#c20ad5da43f6f3676f31556b303d1cb4ea17357e" integrity sha512-L4A8bddlyhjaBAsIv/x1Bvxc38RJz8U8rbbBtxK5oVyOAd5Zz04ZiT3HqzO4FuKq6RGGM1uiA8jvUfmRkKchXw== -"@zetachain/toolkit@^10.0.0": - version "10.0.0" - resolved "https://registry.yarnpkg.com/@zetachain/toolkit/-/toolkit-10.0.0.tgz#aceb196d139d7c697e20a48012e0674130e1c0b9" - integrity sha512-+Gk5lokCWfqK4Nhm3+TjQb9EgrEyuHcezzxDwvvfjohB0dBor+aRnRyNO1/9+eTqX45M0Cvx4tS51yJCGm0G/g== +"@zetachain/toolkit@13.0.0-rc7": + version "13.0.0-rc7" + resolved "https://registry.yarnpkg.com/@zetachain/toolkit/-/toolkit-13.0.0-rc7.tgz#d8710dfeed6c84d7d5808de253887da3e67bf050" + integrity sha512-rh9q66iipRF3XJ4jlkawYqc10eA2mYgIS2rl1PiWvcqi39R1PgUzperKVwwoVmRuJi0FxE5fetP4SmqzfkfBXw== dependencies: + "@coral-xyz/anchor" "^0.30.1" "@inquirer/prompts" "^2.1.1" "@inquirer/select" "1.1.3" "@nomiclabs/hardhat-ethers" "^2.2.3" - "@openzeppelin/contracts" "^4.9.6" + "@openzeppelin/contracts" "^5.0.2" + "@openzeppelin/contracts-upgradeable" "^5.0.2" + "@solana/web3.js" "^1.95.3" "@uniswap/v2-periphery" "^1.1.0-beta.0" - "@zetachain/faucet-cli" "^4.0.1" - "@zetachain/networks" "7.0.0" - "@zetachain/protocol-contracts" "7.0.0" + "@zetachain/faucet-cli" "^4.1.1" + "@zetachain/networks" "10.0.0" + "@zetachain/protocol-contracts" "9.0.0" axios "^1.4.0" bech32 "^2.0.0" bip39 "^3.1.0" bitcoinjs-lib "^6.1.3" + bs58 "^6.0.0" dotenv "16.0.3" ecpair "^2.1.0" envfile "^6.18.0" @@ -2264,7 +2815,7 @@ ora "5.4.1" spinnies "^0.5.1" tiny-secp256k1 "^2.2.3" - ws "^8.13.0" + ws "^8.17.1" JSONStream@^1.3.5: version "1.3.5" @@ -2627,12 +3178,12 @@ aws4@^1.8.0: resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.12.0.tgz#ce1c9d143389679e253b314241ea9aa5cec980d3" integrity sha512-NmWvPnx0F1SfrQbYwOi7OeaNGokp9XhzNioJ/CSBs8Qa4vxug81mhJEAVZwxXuBmYB5KDRfMq/F3RR0BIU7sWg== -axios@1.2.3: - version "1.2.3" - resolved "https://registry.yarnpkg.com/axios/-/axios-1.2.3.tgz#31a3d824c0ebf754a004b585e5f04a5f87e6c4ff" - integrity sha512-pdDkMYJeuXLZ6Xj/Q5J3Phpe+jbGdsSzlQaFVkMQzRUL05+6+tetX8TV3p4HrU4kzuO9bt+io/yGQxuyxA/xcw== +axios@1.7.4: + version "1.7.4" + resolved "https://registry.yarnpkg.com/axios/-/axios-1.7.4.tgz#4c8ded1b43683c8dd362973c393f3ede24052aa2" + integrity sha512-DukmaFRnY6AzAALSH4J2M3k6PkaC+MfaAGdEERRWcC9q3/TWQwLpHR8ZRLKTdQ3aBDL64EdluRDjJqKw+BPZEw== dependencies: - follow-redirects "^1.15.0" + follow-redirects "^1.15.6" form-data "^4.0.0" proxy-from-env "^1.1.0" @@ -3116,6 +3667,11 @@ cli-spinners@^2.5.0, cli-spinners@^2.8.0, cli-spinners@^2.9.0: resolved "https://registry.yarnpkg.com/cli-spinners/-/cli-spinners-2.9.0.tgz#5881d0ad96381e117bbe07ad91f2008fe6ffd8db" integrity sha512-4/aL9X3Wh0yiMQlE+eeRhWP6vclO3QRtw1JHKIT0FFUs5FjpFmESqtMvYZ0+lbzBw900b95mS0hohy+qn2VK/g== +cli-spinners@^2.9.2: + version "2.9.2" + resolved "https://registry.yarnpkg.com/cli-spinners/-/cli-spinners-2.9.2.tgz#1773a8f4b9c4d6ac31563df53b3fc1d79462fe41" + integrity sha512-ywqV+5MmyL4E7ybXgKys4DugZbX0FC6LnwrhjuykIjnK9k8OQacQ7axGKnjDXWNhns0xot3bZI5h55H8yo9cJg== + cli-table3@^0.5.0: version "0.5.1" resolved "https://registry.yarnpkg.com/cli-table3/-/cli-table3-0.5.1.tgz#0252372d94dfc40dbd8df06005f48f31f656f202" @@ -3367,10 +3923,10 @@ date-fns@^2.30.0: dependencies: "@babel/runtime" "^7.21.0" -dayjs@1.11.3: - version "1.11.3" - resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.11.3.tgz#4754eb694a624057b9ad2224b67b15d552589258" - integrity sha512-xxwlswWOlGhzgQ4TKzASQkUhqERI3egRNqgV4ScR8wlANA/A9tZ7miXa44vTTKEq5l7vWoL5G57bG3zA+Kow0A== +dayjs@1.11.10: + version "1.11.10" + resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.11.10.tgz#68acea85317a6e164457d6d6947564029a6a16a0" + integrity sha512-vjAczensTgRcqDERK0SR2XMwsF/tSvnvlv6VcF2GIhg6Sx4yOIt/irsr1RDJsKiIyBzJDpCoXiWWq28MqH2cnQ== death@^1.1.0: version "1.1.0" @@ -4066,6 +4622,42 @@ ethers@5.4.7: "@ethersproject/web" "5.4.0" "@ethersproject/wordlists" "5.4.0" +ethers@5.6.8: + version "5.6.8" + resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.6.8.tgz#d36b816b4896341a80a8bbd2a44e8cb6e9b98dd4" + integrity sha512-YxIGaltAOdvBFPZwIkyHnXbW40f1r8mHUgapW6dxkO+6t7H6wY8POUn0Kbxrd/N7I4hHxyi7YCddMAH/wmho2w== + dependencies: + "@ethersproject/abi" "5.6.3" + "@ethersproject/abstract-provider" "5.6.1" + "@ethersproject/abstract-signer" "5.6.2" + "@ethersproject/address" "5.6.1" + "@ethersproject/base64" "5.6.1" + "@ethersproject/basex" "5.6.1" + "@ethersproject/bignumber" "5.6.2" + "@ethersproject/bytes" "5.6.1" + "@ethersproject/constants" "5.6.1" + "@ethersproject/contracts" "5.6.2" + "@ethersproject/hash" "5.6.1" + "@ethersproject/hdnode" "5.6.2" + "@ethersproject/json-wallets" "5.6.1" + "@ethersproject/keccak256" "5.6.1" + "@ethersproject/logger" "5.6.0" + "@ethersproject/networks" "5.6.3" + "@ethersproject/pbkdf2" "5.6.1" + "@ethersproject/properties" "5.6.0" + "@ethersproject/providers" "5.6.8" + "@ethersproject/random" "5.6.1" + "@ethersproject/rlp" "5.6.1" + "@ethersproject/sha2" "5.6.1" + "@ethersproject/signing-key" "5.6.2" + "@ethersproject/solidity" "5.6.1" + "@ethersproject/strings" "5.6.1" + "@ethersproject/transactions" "5.6.2" + "@ethersproject/units" "5.6.1" + "@ethersproject/wallet" "5.6.2" + "@ethersproject/web" "5.6.1" + "@ethersproject/wordlists" "5.6.1" + ethers@5.7.2, ethers@^5.4.7, ethers@^5.7.1: version "5.7.2" resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.7.2.tgz#3a7deeabbb8c030d4126b24f84e525466145872e" @@ -4117,7 +4709,7 @@ ethers@^4.0.40: uuid "2.0.1" xmlhttprequest "1.8.0" -ethers@^6.13.1, ethers@^6.13.2: +ethers@^6.13.2: version "6.13.2" resolved "https://registry.yarnpkg.com/ethers/-/ethers-6.13.2.tgz#4b67d4b49e69b59893931a032560999e5e4419fe" integrity sha512-9VkriTTed+/27BGuY1s0hf441kqwHJ1wtN2edksEtiRvXx+soxRX3iSXTfFqq2+YwrOqbDoTHjIhQnjJRlzKmg== @@ -4241,10 +4833,10 @@ fastq@^1.6.0: dependencies: reusify "^1.0.4" -figlet@1.6.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/figlet/-/figlet-1.6.0.tgz#812050fa9f01043b4d44ddeb11f20fb268fa4b93" - integrity sha512-31EQGhCEITv6+hi2ORRPyn3bulaV9Fl4xOdR169cBzH/n1UqcxsiSB/noo6SJdD7Kfb1Ljit+IgR1USvF/XbdA== +figlet@1.7.0: + version "1.7.0" + resolved "https://registry.yarnpkg.com/figlet/-/figlet-1.7.0.tgz#46903a04603fd19c3e380358418bb2703587a72e" + integrity sha512-gO8l3wvqo0V7wEFLXPbkX83b7MVjRrk1oRLfYlZXol8nEpb/ON9pcKLI4qpBv5YtOTfrINtqb7b40iYY2FTWFg== figures@^3.2.0: version "3.2.0" @@ -6791,6 +7383,11 @@ signal-exit@^3.0.2: resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== +signal-exit@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-4.1.0.tgz#952188c1cbd546070e2dd20d0f41c0ae0530cb04" + integrity sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw== + slash@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" @@ -7423,10 +8020,10 @@ typeforce@^1.11.3, typeforce@^1.18.0: resolved "https://registry.yarnpkg.com/typeforce/-/typeforce-1.18.0.tgz#d7416a2c5845e085034d70fcc5b6cc4a90edbfdc" integrity sha512-7uc1O8h1M1g0rArakJdf0uLRSSgFcYexrVoKo+bzJd32gd4gDy2L/Z+8/FjPnU9ydY3pEnVPtr9FyscYY60K1g== -typescript@5.0.4: - version "5.0.4" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.0.4.tgz#b217fd20119bd61a94d4011274e0ab369058da3b" - integrity sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw== +typescript@5.5.4: + version "5.5.4" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.5.4.tgz#d9852d6c82bad2d2eda4fd74a5762a8f5909e9ba" + integrity sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q== typescript@>=4.5.0: version "5.1.6" @@ -7463,6 +8060,11 @@ unbox-primitive@^1.0.2: has-symbols "^1.0.3" which-boxed-primitive "^1.0.2" +undici-types@~6.19.2: + version "6.19.8" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.19.8.tgz#35111c9d1437ab83a7cdc0abae2f26d88eda0a02" + integrity sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw== + undici@^5.14.0: version "5.28.4" resolved "https://registry.yarnpkg.com/undici/-/undici-5.28.4.tgz#6b280408edb6a1a604a9b20340f45b422e373068" @@ -7749,12 +8351,7 @@ ws@^7.5.10: resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.10.tgz#58b5c20dc281633f6c19113f39b349bd8bd558d9" integrity sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ== -ws@^8.13.0: - version "8.13.0" - resolved "https://registry.yarnpkg.com/ws/-/ws-8.13.0.tgz#9a9fb92f93cf41512a0735c8f4dd09b8a1211cd0" - integrity sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA== - -ws@^8.5.0: +ws@^8.17.1, ws@^8.5.0: version "8.18.0" resolved "https://registry.yarnpkg.com/ws/-/ws-8.18.0.tgz#0d7505a6eafe2b0e712d232b42279f53bc289bbc" integrity sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw== @@ -7878,7 +8475,12 @@ yocto-queue@^0.1.0: resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q== -zod@3.19.1: - version "3.19.1" - resolved "https://registry.yarnpkg.com/zod/-/zod-3.19.1.tgz#112f074a97b50bfc4772d4ad1576814bd8ac4473" - integrity sha512-LYjZsEDhCdYET9ikFu6dVPGp2YH9DegXjdJToSzD9rO6fy4qiRYFoyEYwps88OseJlPyl2NOe2iJuhEhL7IpEA== +yoctocolors-cjs@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/yoctocolors-cjs/-/yoctocolors-cjs-2.1.2.tgz#f4b905a840a37506813a7acaa28febe97767a242" + integrity sha512-cYVsTjKl8b+FrnidjibDWskAv7UKOfcwaVZdp/it9n1s9fU3IkgDbhdIRKCW4JDsAlECJY0ytoVPT3sK6kideA== + +zod@3.22.4: + version "3.22.4" + resolved "https://registry.yarnpkg.com/zod/-/zod-3.22.4.tgz#f31c3a9386f61b1f228af56faa9255e845cf3fff" + integrity sha512-iC+8Io04lddc+mVqQ9AZ7OQ2MrUKGN+oIQyq1vemgt46jwCwLfhq7/pwnBnNXXXZb8VTVLKwp9EDkx+ryxIWmg== diff --git a/examples/hello/.gitignore b/examples/hello/.gitignore index 4487fa3c..34db758f 100644 --- a/examples/hello/.gitignore +++ b/examples/hello/.gitignore @@ -14,4 +14,6 @@ artifacts out cache_forge -access_token \ No newline at end of file +access_token + +localnet.json diff --git a/examples/hello/README.md b/examples/hello/README.md index 52ea5607..7cb47db7 100644 --- a/examples/hello/README.md +++ b/examples/hello/README.md @@ -1,45 +1,3 @@ # Hello Example -``` -yarn deploy -``` - -## EVM - -Successful call: - -``` -npx hardhat echo-call --contract 0xc3e53F4d16Ae77Db1c982e75a937B9f60FE63690 --receiver 0xE6E340D132b5f46d1e472DebcD681B2aBc16e57E --network localhost --types '["string"]' hello -``` - -Failed call: - -``` -npx hardhat echo-call --contract 0xc3e53F4d16Ae77Db1c982e75a937B9f60FE63690 --receiver 0xE6E340D132b5f46d1e472DebcD681B2aBc16e57E --network localhost --types '["uint256"]' 42 -``` - -Failed call with handled revert: - -``` -npx hardhat echo-call --contract 0xc3e53F4d16Ae77Db1c982e75a937B9f60FE63690 --receiver 0xE6E340D132b5f46d1e472DebcD681B2aBc16e57E --network localhost --revert-address 0xc3e53F4d16Ae77Db1c982e75a937B9f60FE63690 --revert-message 0x --call-on-revert --types '["uint256"]' 42 -``` - -## ZetaChain - -Successful call: - -``` -npx hardhat hello-call --contract 0xE6E340D132b5f46d1e472DebcD681B2aBc16e57E --receiver 0xc3e53F4d16Ae77Db1c982e75a937B9f60FE63690 --zrc20 0x2ca7d64A7EFE2D62A725E2B35Cf7230D6677FfEe --function "hello(string)" --network localhost --types '["string"]' hello -``` - -Failed call: - -``` -npx hardhat hello-call --contract 0xE6E340D132b5f46d1e472DebcD681B2aBc16e57E --receiver 0xc3e53F4d16Ae77Db1c982e75a937B9f60FE63690 --zrc20 0x2ca7d64A7EFE2D62A725E2B35Cf7230D6677FfEe --function "hello(string)" --network localhost --types '["uint256"]' 42 -``` - -Failed call with handled revert: - -``` -npx hardhat hello-call --contract 0xE6E340D132b5f46d1e472DebcD681B2aBc16e57E --receiver 0xc3e53F4d16Ae77Db1c982e75a937B9f60FE63690 --zrc20 0x2ca7d64A7EFE2D62A725E2B35Cf7230D6677FfEe --function "hello(string)" --network localhost --revert-address 0xE6E340D132b5f46d1e472DebcD681B2aBc16e57E --revert-message 0x --call-on-revert --types '["uint256"]' 42 -``` +Tutorial: https://www.zetachain.com/docs/developers/tutorials/hello/ diff --git a/examples/hello/contracts/Echo.sol b/examples/hello/contracts/Echo.sol deleted file mode 100644 index 6ac4725b..00000000 --- a/examples/hello/contracts/Echo.sol +++ /dev/null @@ -1,43 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity 0.8.26; - -import {RevertContext} from "@zetachain/protocol-contracts/contracts/Revert.sol"; -import "@zetachain/protocol-contracts/contracts/evm/GatewayEVM.sol"; - -contract Echo { - GatewayEVM public immutable gateway; - - event RevertEvent(string, RevertContext); - event HelloEvent(string, string); - - modifier onlyGateway() { - require(msg.sender == address(gateway), "Caller is not the gateway"); - _; - } - - constructor(address payable gatewayAddress) { - gateway = GatewayEVM(gatewayAddress); - } - - function hello(string memory message) external payable { - emit HelloEvent("Hello on EVM", message); - } - - function onRevert( - RevertContext calldata revertContext - ) external onlyGateway { - emit RevertEvent("Revert on EVM", revertContext); - } - - function call( - address receiver, - bytes calldata message, - RevertOptions memory revertOptions - ) external { - gateway.call(receiver, message, revertOptions); - } - - receive() external payable {} - - fallback() external payable {} -} diff --git a/examples/hello/contracts/Universal.sol b/examples/hello/contracts/Universal.sol new file mode 100644 index 00000000..fa4920e9 --- /dev/null +++ b/examples/hello/contracts/Universal.sol @@ -0,0 +1,30 @@ +// SPDX-License-Identifier: MIT +pragma solidity 0.8.26; + +import "@zetachain/protocol-contracts/contracts/zevm/GatewayZEVM.sol"; + +contract Universal is UniversalContract { + GatewayZEVM public immutable gateway; + + event HelloEvent(string, string); + error Unauthorized(); + + modifier onlyGateway() { + if (msg.sender != address(gateway)) revert Unauthorized(); + _; + } + + constructor(address payable gatewayAddress) { + gateway = GatewayZEVM(gatewayAddress); + } + + function onCall( + MessageContext calldata context, + address zrc20, + uint256 amount, + bytes calldata message + ) external override onlyGateway { + string memory name = abi.decode(message, (string)); + emit HelloEvent("Hello: ", name); + } +} diff --git a/examples/hello/hardhat.config.ts b/examples/hello/hardhat.config.ts index c41f9d0b..7e1476e2 100644 --- a/examples/hello/hardhat.config.ts +++ b/examples/hello/hardhat.config.ts @@ -1,7 +1,4 @@ import "./tasks/deploy"; -import "./tasks/helloCall"; -import "./tasks/echoCall"; -import "./tasks/helloWithdrawAndCall"; import "@zetachain/localnet/tasks"; import "@nomicfoundation/hardhat-toolbox"; import "@zetachain/toolkit/tasks"; diff --git a/examples/hello/package.json b/examples/hello/package.json index bcade850..75baa2ce 100644 --- a/examples/hello/package.json +++ b/examples/hello/package.json @@ -28,8 +28,8 @@ "@types/node": ">=12.0.0", "@typescript-eslint/eslint-plugin": "^5.59.9", "@typescript-eslint/parser": "^5.59.9", - "@zetachain/localnet": "^3.5.0", - "@zetachain/toolkit": "13.0.0-rc4", + "@zetachain/localnet": "4.0.0-rc6", + "@zetachain/toolkit": "13.0.0-rc7", "axios": "^1.3.6", "chai": "^4.2.0", "dotenv": "^16.0.3", @@ -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-rc11" + "@zetachain/protocol-contracts": "11.0.0-rc3" } } \ No newline at end of file diff --git a/examples/hello/scripts/localnet.sh b/examples/hello/scripts/localnet.sh new file mode 100755 index 00000000..62190af6 --- /dev/null +++ b/examples/hello/scripts/localnet.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +set -e +set -x + +if [ "$1" = "start" ]; then npx hardhat localnet --exit-on-error & sleep 10; fi + +echo -e "\nšŸš€ Compiling contracts..." +npx hardhat compile --force --quiet + +GATEWAY_ETHEREUM=$(jq -r '.addresses[] | select(.type=="gatewayEVM" and .chain=="ethereum") | .address' localnet.json) +GATEWAY_ZETACHAIN=$(jq -r '.addresses[] | select(.type=="gatewayZEVM" and .chain=="zetachain") | .address' localnet.json) + +CONTRACT_ZETACHAIN=$(npx hardhat deploy --name Universal --network localhost --gateway "$GATEWAY_ZETACHAIN" --json | jq -r '.contractAddress') +echo -e "\nšŸš€ Deployed contract on ZetaChain: $CONTRACT_ZETACHAIN" + +npx hardhat evm-call \ + --gateway-evm "$GATEWAY_ETHEREUM" \ + --receiver "$CONTRACT_ZETACHAIN" \ + --network localhost \ + --types '["string"]' alice + +npx hardhat localnet-check + +if [ "$1" = "start" ]; then npx hardhat localnet-stop; fi \ No newline at end of file diff --git a/examples/hello/scripts/test.sh b/examples/hello/scripts/test.sh deleted file mode 100755 index 0d1d1512..00000000 --- a/examples/hello/scripts/test.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/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 \ No newline at end of file diff --git a/examples/hello/tasks/deploy.ts b/examples/hello/tasks/deploy.ts index b41c2c5d..05fb8838 100644 --- a/examples/hello/tasks/deploy.ts +++ b/examples/hello/tasks/deploy.ts @@ -16,7 +16,14 @@ const main = async (args: any, hre: HardhatRuntimeEnvironment) => { await contract.deployed(); if (args.json) { - console.log(JSON.stringify(contract)); + console.log( + JSON.stringify({ + contractAddress: contract.address, + deployer: signer.address, + network: network, + transactionHash: contract.deployTransaction.hash, + }) + ); } else { console.log(`šŸ”‘ Using account: ${signer.address} @@ -28,7 +35,7 @@ const main = async (args: any, hre: HardhatRuntimeEnvironment) => { task("deploy", "Deploy the contract", main) .addFlag("json", "Output in JSON") - .addOptionalParam("name", "Contract to deploy", "Hello") + .addOptionalParam("name", "Contract to deploy", "Universal") .addOptionalParam( "gateway", "Gateway address (default: ZetaChain Gateway on testnet)", diff --git a/examples/hello/yarn.lock b/examples/hello/yarn.lock index 70b9f7ac..65dd7967 100644 --- a/examples/hello/yarn.lock +++ b/examples/hello/yarn.lock @@ -184,7 +184,22 @@ "@ethersproject/properties" "^5.4.0" "@ethersproject/strings" "^5.4.0" -"@ethersproject/abi@5.7.0", "@ethersproject/abi@^5.0.0-beta.146", "@ethersproject/abi@^5.0.9", "@ethersproject/abi@^5.1.2", "@ethersproject/abi@^5.4.0", "@ethersproject/abi@^5.4.7", "@ethersproject/abi@^5.7.0": +"@ethersproject/abi@5.6.3": + version "5.6.3" + resolved "https://registry.yarnpkg.com/@ethersproject/abi/-/abi-5.6.3.tgz#2d643544abadf6e6b63150508af43475985c23db" + integrity sha512-CxKTdoZY4zDJLWXG6HzNH6znWK0M79WzzxHegDoecE3+K32pzfHOzuXg2/oGSTecZynFgpkjYXNPOqXVJlqClw== + dependencies: + "@ethersproject/address" "^5.6.1" + "@ethersproject/bignumber" "^5.6.2" + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/constants" "^5.6.1" + "@ethersproject/hash" "^5.6.1" + "@ethersproject/keccak256" "^5.6.1" + "@ethersproject/logger" "^5.6.0" + "@ethersproject/properties" "^5.6.0" + "@ethersproject/strings" "^5.6.1" + +"@ethersproject/abi@5.7.0", "@ethersproject/abi@^5.0.0-beta.146", "@ethersproject/abi@^5.0.9", "@ethersproject/abi@^5.1.2", "@ethersproject/abi@^5.4.0", "@ethersproject/abi@^5.4.7", "@ethersproject/abi@^5.6.3", "@ethersproject/abi@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/abi/-/abi-5.7.0.tgz#b3f3e045bbbeed1af3947335c247ad625a44e449" integrity sha512-351ktp42TiRcYB3H1OP8yajPeAQstMW/yCFokj/AthP9bLHzQFPlOrxOcwYEDkUAICmOHljvN4K39OMTMUa9RA== @@ -212,7 +227,20 @@ "@ethersproject/transactions" "^5.4.0" "@ethersproject/web" "^5.4.0" -"@ethersproject/abstract-provider@5.7.0", "@ethersproject/abstract-provider@^5.4.0", "@ethersproject/abstract-provider@^5.7.0": +"@ethersproject/abstract-provider@5.6.1": + version "5.6.1" + resolved "https://registry.yarnpkg.com/@ethersproject/abstract-provider/-/abstract-provider-5.6.1.tgz#02ddce150785caf0c77fe036a0ebfcee61878c59" + integrity sha512-BxlIgogYJtp1FS8Muvj8YfdClk3unZH0vRMVX791Z9INBNT/kuACZ9GzaY1Y4yFq+YSy6/w4gzj3HCRKrK9hsQ== + dependencies: + "@ethersproject/bignumber" "^5.6.2" + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/logger" "^5.6.0" + "@ethersproject/networks" "^5.6.3" + "@ethersproject/properties" "^5.6.0" + "@ethersproject/transactions" "^5.6.2" + "@ethersproject/web" "^5.6.1" + +"@ethersproject/abstract-provider@5.7.0", "@ethersproject/abstract-provider@^5.4.0", "@ethersproject/abstract-provider@^5.6.1", "@ethersproject/abstract-provider@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/abstract-provider/-/abstract-provider-5.7.0.tgz#b0a8550f88b6bf9d51f90e4795d48294630cb9ef" integrity sha512-R41c9UkchKCpAqStMYUpdunjo3pkEvZC3FAwZn5S5MGbXoMQOHIdHItezTETxAO5bevtMApSyEhn9+CHcDsWBw== @@ -236,7 +264,18 @@ "@ethersproject/logger" "^5.4.0" "@ethersproject/properties" "^5.4.0" -"@ethersproject/abstract-signer@5.7.0", "@ethersproject/abstract-signer@^5.4.0", "@ethersproject/abstract-signer@^5.7.0": +"@ethersproject/abstract-signer@5.6.2": + version "5.6.2" + resolved "https://registry.yarnpkg.com/@ethersproject/abstract-signer/-/abstract-signer-5.6.2.tgz#491f07fc2cbd5da258f46ec539664713950b0b33" + integrity sha512-n1r6lttFBG0t2vNiI3HoWaS/KdOt8xyDjzlP2cuevlWLG6EX0OwcKLyG/Kp/cuwNxdy/ous+R/DEMdTUwWQIjQ== + dependencies: + "@ethersproject/abstract-provider" "^5.6.1" + "@ethersproject/bignumber" "^5.6.2" + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/logger" "^5.6.0" + "@ethersproject/properties" "^5.6.0" + +"@ethersproject/abstract-signer@5.7.0", "@ethersproject/abstract-signer@^5.4.0", "@ethersproject/abstract-signer@^5.6.2", "@ethersproject/abstract-signer@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/abstract-signer/-/abstract-signer-5.7.0.tgz#13f4f32117868452191a4649723cb086d2b596b2" integrity sha512-a16V8bq1/Cz+TGCkE2OPMTOUDLS3grCpdjoJCYNnVBbdYEMSgKrU0+B90s8b6H+ByYTBZN7a3g76jdIJi7UfKQ== @@ -258,7 +297,18 @@ "@ethersproject/logger" "^5.4.0" "@ethersproject/rlp" "^5.4.0" -"@ethersproject/address@5.7.0", "@ethersproject/address@^5.0.2", "@ethersproject/address@^5.4.0", "@ethersproject/address@^5.7.0": +"@ethersproject/address@5.6.1": + version "5.6.1" + resolved "https://registry.yarnpkg.com/@ethersproject/address/-/address-5.6.1.tgz#ab57818d9aefee919c5721d28cd31fd95eff413d" + integrity sha512-uOgF0kS5MJv9ZvCz7x6T2EXJSzotiybApn4XlOgoTX0xdtyVIJ7pF+6cGPxiEq/dpBiTfMiw7Yc81JcwhSYA0Q== + dependencies: + "@ethersproject/bignumber" "^5.6.2" + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/keccak256" "^5.6.1" + "@ethersproject/logger" "^5.6.0" + "@ethersproject/rlp" "^5.6.1" + +"@ethersproject/address@5.7.0", "@ethersproject/address@^5.0.2", "@ethersproject/address@^5.4.0", "@ethersproject/address@^5.6.1", "@ethersproject/address@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/address/-/address-5.7.0.tgz#19b56c4d74a3b0a46bfdbb6cfcc0a153fc697f37" integrity sha512-9wYhYt7aghVGo758POM5nqcOMaE168Q6aRLJZwUmiqSrAungkG74gSSeKEIR7ukixesdRZGPgVqme6vmxs1fkA== @@ -276,7 +326,14 @@ dependencies: "@ethersproject/bytes" "^5.4.0" -"@ethersproject/base64@5.7.0", "@ethersproject/base64@^5.4.0", "@ethersproject/base64@^5.7.0": +"@ethersproject/base64@5.6.1": + version "5.6.1" + resolved "https://registry.yarnpkg.com/@ethersproject/base64/-/base64-5.6.1.tgz#2c40d8a0310c9d1606c2c37ae3092634b41d87cb" + integrity sha512-qB76rjop6a0RIYYMiB4Eh/8n+Hxu2NIZm8S/Q7kNo5pmZfXhHGHmS4MinUainiBC54SCyRnwzL+KZjj8zbsSsw== + dependencies: + "@ethersproject/bytes" "^5.6.1" + +"@ethersproject/base64@5.7.0", "@ethersproject/base64@^5.4.0", "@ethersproject/base64@^5.6.1", "@ethersproject/base64@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/base64/-/base64-5.7.0.tgz#ac4ee92aa36c1628173e221d0d01f53692059e1c" integrity sha512-Dr8tcHt2mEbsZr/mwTPIQAf3Ai0Bks/7gTw9dSqk1mQvhW3XvRlmDJr/4n+wg1JmCl16NZue17CDh8xb/vZ0sQ== @@ -291,7 +348,15 @@ "@ethersproject/bytes" "^5.4.0" "@ethersproject/properties" "^5.4.0" -"@ethersproject/basex@5.7.0", "@ethersproject/basex@^5.4.0", "@ethersproject/basex@^5.7.0": +"@ethersproject/basex@5.6.1": + version "5.6.1" + resolved "https://registry.yarnpkg.com/@ethersproject/basex/-/basex-5.6.1.tgz#badbb2f1d4a6f52ce41c9064f01eab19cc4c5305" + integrity sha512-a52MkVz4vuBXR06nvflPMotld1FJWSj2QT0985v7P/emPZO00PucFAkbcmq2vpVU7Ts7umKiSI6SppiLykVWsA== + dependencies: + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/properties" "^5.6.0" + +"@ethersproject/basex@5.7.0", "@ethersproject/basex@^5.4.0", "@ethersproject/basex@^5.6.1", "@ethersproject/basex@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/basex/-/basex-5.7.0.tgz#97034dc7e8938a8ca943ab20f8a5e492ece4020b" integrity sha512-ywlh43GwZLv2Voc2gQVTKBoVQ1mti3d8HK5aMxsfu/nRDnMmNqaSJ3r3n85HBByT8OpoY96SXM1FogC533T4zw== @@ -308,7 +373,16 @@ "@ethersproject/logger" "^5.4.0" bn.js "^4.11.9" -"@ethersproject/bignumber@5.7.0", "@ethersproject/bignumber@^5.4.0", "@ethersproject/bignumber@^5.7.0": +"@ethersproject/bignumber@5.6.2": + version "5.6.2" + resolved "https://registry.yarnpkg.com/@ethersproject/bignumber/-/bignumber-5.6.2.tgz#72a0717d6163fab44c47bcc82e0c550ac0315d66" + integrity sha512-v7+EEUbhGqT3XJ9LMPsKvXYHFc8eHxTowFCG/HgJErmq4XHJ2WR7aeyICg3uTOAQ7Icn0GFHAohXEhxQHq4Ubw== + dependencies: + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/logger" "^5.6.0" + bn.js "^5.2.1" + +"@ethersproject/bignumber@5.7.0", "@ethersproject/bignumber@^5.4.0", "@ethersproject/bignumber@^5.6.2", "@ethersproject/bignumber@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/bignumber/-/bignumber-5.7.0.tgz#e2f03837f268ba655ffba03a57853e18a18dc9c2" integrity sha512-n1CAdIHRWjSucQO3MC1zPSVgV/6dy/fjL9pMrPP9peL+QxEg9wOsVqwD4+818B6LUEtaXzVHQiuivzRoxPxUGw== @@ -324,7 +398,14 @@ dependencies: "@ethersproject/logger" "^5.4.0" -"@ethersproject/bytes@5.7.0", "@ethersproject/bytes@^5.4.0", "@ethersproject/bytes@^5.7.0": +"@ethersproject/bytes@5.6.1": + version "5.6.1" + resolved "https://registry.yarnpkg.com/@ethersproject/bytes/-/bytes-5.6.1.tgz#24f916e411f82a8a60412344bf4a813b917eefe7" + integrity sha512-NwQt7cKn5+ZE4uDn+X5RAXLp46E1chXoaMmrxAyA0rblpxz8t58lVkrHXoRIn0lz1joQElQ8410GqhTqMOwc6g== + dependencies: + "@ethersproject/logger" "^5.6.0" + +"@ethersproject/bytes@5.7.0", "@ethersproject/bytes@^5.4.0", "@ethersproject/bytes@^5.6.1", "@ethersproject/bytes@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/bytes/-/bytes-5.7.0.tgz#a00f6ea8d7e7534d6d87f47188af1148d71f155d" integrity sha512-nsbxwgFXWh9NyYWo+U8atvmMsSdKJprTcICAkvbBffT75qDocbuggBU0SJiVK2MuTrp0q+xvLkTnGMPK1+uA9A== @@ -338,7 +419,14 @@ dependencies: "@ethersproject/bignumber" "^5.4.0" -"@ethersproject/constants@5.7.0", "@ethersproject/constants@^5.4.0", "@ethersproject/constants@^5.7.0": +"@ethersproject/constants@5.6.1": + version "5.6.1" + resolved "https://registry.yarnpkg.com/@ethersproject/constants/-/constants-5.6.1.tgz#e2e974cac160dd101cf79fdf879d7d18e8cb1370" + integrity sha512-QSq9WVnZbxXYFftrjSjZDUshp6/eKp6qrtdBtUCm0QxCV5z1fG/w3kdlcsjMCQuQHUnAclKoK7XpXMezhRDOLg== + dependencies: + "@ethersproject/bignumber" "^5.6.2" + +"@ethersproject/constants@5.7.0", "@ethersproject/constants@^5.4.0", "@ethersproject/constants@^5.6.1", "@ethersproject/constants@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/constants/-/constants-5.7.0.tgz#df80a9705a7e08984161f09014ea012d1c75295e" integrity sha512-DHI+y5dBNvkpYUMiRQyxRBYBefZkJfo70VUkUAsRjcPs47muV9evftfZ0PJVCXYbAiCgght0DtcF9srFQmIgWA== @@ -361,6 +449,22 @@ "@ethersproject/properties" "^5.4.0" "@ethersproject/transactions" "^5.4.0" +"@ethersproject/contracts@5.6.2": + version "5.6.2" + resolved "https://registry.yarnpkg.com/@ethersproject/contracts/-/contracts-5.6.2.tgz#20b52e69ebc1b74274ff8e3d4e508de971c287bc" + integrity sha512-hguUA57BIKi6WY0kHvZp6PwPlWF87MCeB4B7Z7AbUpTxfFXFdn/3b0GmjZPagIHS+3yhcBJDnuEfU4Xz+Ks/8g== + dependencies: + "@ethersproject/abi" "^5.6.3" + "@ethersproject/abstract-provider" "^5.6.1" + "@ethersproject/abstract-signer" "^5.6.2" + "@ethersproject/address" "^5.6.1" + "@ethersproject/bignumber" "^5.6.2" + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/constants" "^5.6.1" + "@ethersproject/logger" "^5.6.0" + "@ethersproject/properties" "^5.6.0" + "@ethersproject/transactions" "^5.6.2" + "@ethersproject/contracts@5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/contracts/-/contracts-5.7.0.tgz#c305e775abd07e48aa590e1a877ed5c316f8bd1e" @@ -391,7 +495,21 @@ "@ethersproject/properties" "^5.4.0" "@ethersproject/strings" "^5.4.0" -"@ethersproject/hash@5.7.0", "@ethersproject/hash@^5.4.0", "@ethersproject/hash@^5.7.0": +"@ethersproject/hash@5.6.1": + version "5.6.1" + resolved "https://registry.yarnpkg.com/@ethersproject/hash/-/hash-5.6.1.tgz#224572ea4de257f05b4abf8ae58b03a67e99b0f4" + integrity sha512-L1xAHurbaxG8VVul4ankNX5HgQ8PNCTrnVXEiFnE9xoRnaUcgfD12tZINtDinSllxPLCtGwguQxJ5E6keE84pA== + dependencies: + "@ethersproject/abstract-signer" "^5.6.2" + "@ethersproject/address" "^5.6.1" + "@ethersproject/bignumber" "^5.6.2" + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/keccak256" "^5.6.1" + "@ethersproject/logger" "^5.6.0" + "@ethersproject/properties" "^5.6.0" + "@ethersproject/strings" "^5.6.1" + +"@ethersproject/hash@5.7.0", "@ethersproject/hash@^5.4.0", "@ethersproject/hash@^5.6.1", "@ethersproject/hash@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/hash/-/hash-5.7.0.tgz#eb7aca84a588508369562e16e514b539ba5240a7" integrity sha512-qX5WrQfnah1EFnO5zJv1v46a8HW0+E5xuBBDTwMFZLuVTx0tbU2kkx15NqdjxecrLGatQN9FGQKpb1FKdHCt+g== @@ -424,7 +542,25 @@ "@ethersproject/transactions" "^5.4.0" "@ethersproject/wordlists" "^5.4.0" -"@ethersproject/hdnode@5.7.0", "@ethersproject/hdnode@^5.4.0", "@ethersproject/hdnode@^5.7.0": +"@ethersproject/hdnode@5.6.2": + version "5.6.2" + resolved "https://registry.yarnpkg.com/@ethersproject/hdnode/-/hdnode-5.6.2.tgz#26f3c83a3e8f1b7985c15d1db50dc2903418b2d2" + integrity sha512-tERxW8Ccf9CxW2db3WsN01Qao3wFeRsfYY9TCuhmG0xNpl2IO8wgXU3HtWIZ49gUWPggRy4Yg5axU0ACaEKf1Q== + dependencies: + "@ethersproject/abstract-signer" "^5.6.2" + "@ethersproject/basex" "^5.6.1" + "@ethersproject/bignumber" "^5.6.2" + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/logger" "^5.6.0" + "@ethersproject/pbkdf2" "^5.6.1" + "@ethersproject/properties" "^5.6.0" + "@ethersproject/sha2" "^5.6.1" + "@ethersproject/signing-key" "^5.6.2" + "@ethersproject/strings" "^5.6.1" + "@ethersproject/transactions" "^5.6.2" + "@ethersproject/wordlists" "^5.6.1" + +"@ethersproject/hdnode@5.7.0", "@ethersproject/hdnode@^5.4.0", "@ethersproject/hdnode@^5.6.2", "@ethersproject/hdnode@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/hdnode/-/hdnode-5.7.0.tgz#e627ddc6b466bc77aebf1a6b9e47405ca5aef9cf" integrity sha512-OmyYo9EENBPPf4ERhR7oj6uAtUAhYGqOnIS+jE5pTXvdKBS99ikzq1E7Iv0ZQZ5V36Lqx1qZLeak0Ra16qpeOg== @@ -461,7 +597,26 @@ aes-js "3.0.0" scrypt-js "3.0.1" -"@ethersproject/json-wallets@5.7.0", "@ethersproject/json-wallets@^5.4.0", "@ethersproject/json-wallets@^5.7.0": +"@ethersproject/json-wallets@5.6.1": + version "5.6.1" + resolved "https://registry.yarnpkg.com/@ethersproject/json-wallets/-/json-wallets-5.6.1.tgz#3f06ba555c9c0d7da46756a12ac53483fe18dd91" + integrity sha512-KfyJ6Zwz3kGeX25nLihPwZYlDqamO6pfGKNnVMWWfEVVp42lTfCZVXXy5Ie8IZTN0HKwAngpIPi7gk4IJzgmqQ== + dependencies: + "@ethersproject/abstract-signer" "^5.6.2" + "@ethersproject/address" "^5.6.1" + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/hdnode" "^5.6.2" + "@ethersproject/keccak256" "^5.6.1" + "@ethersproject/logger" "^5.6.0" + "@ethersproject/pbkdf2" "^5.6.1" + "@ethersproject/properties" "^5.6.0" + "@ethersproject/random" "^5.6.1" + "@ethersproject/strings" "^5.6.1" + "@ethersproject/transactions" "^5.6.2" + aes-js "3.0.0" + scrypt-js "3.0.1" + +"@ethersproject/json-wallets@5.7.0", "@ethersproject/json-wallets@^5.4.0", "@ethersproject/json-wallets@^5.6.1", "@ethersproject/json-wallets@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/json-wallets/-/json-wallets-5.7.0.tgz#5e3355287b548c32b368d91014919ebebddd5360" integrity sha512-8oee5Xgu6+RKgJTkvEMl2wDgSPSAQ9MB/3JYjFV9jlKvcYHUXZC+cQp0njgmxdHkYWn8s6/IqIZYm0YWCjO/0g== @@ -488,7 +643,15 @@ "@ethersproject/bytes" "^5.4.0" js-sha3 "0.5.7" -"@ethersproject/keccak256@5.7.0", "@ethersproject/keccak256@^5.4.0", "@ethersproject/keccak256@^5.7.0": +"@ethersproject/keccak256@5.6.1": + version "5.6.1" + resolved "https://registry.yarnpkg.com/@ethersproject/keccak256/-/keccak256-5.6.1.tgz#b867167c9b50ba1b1a92bccdd4f2d6bd168a91cc" + integrity sha512-bB7DQHCTRDooZZdL3lk9wpL0+XuG3XLGHLh3cePnybsO3V0rdCAOQGpn/0R3aODmnTOOkCATJiD2hnL+5bwthA== + dependencies: + "@ethersproject/bytes" "^5.6.1" + js-sha3 "0.8.0" + +"@ethersproject/keccak256@5.7.0", "@ethersproject/keccak256@^5.4.0", "@ethersproject/keccak256@^5.6.1", "@ethersproject/keccak256@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/keccak256/-/keccak256-5.7.0.tgz#3186350c6e1cd6aba7940384ec7d6d9db01f335a" integrity sha512-2UcPboeL/iW+pSg6vZ6ydF8tCnv3Iu/8tUmLLzWWGzxWKFFqOBQFLo6uLUv6BDrLgCDfN28RJ/wtByx+jZ4KBg== @@ -501,7 +664,12 @@ resolved "https://registry.yarnpkg.com/@ethersproject/logger/-/logger-5.4.1.tgz#503bd33683538b923c578c07d1c2c0dd18672054" integrity sha512-DZ+bRinnYLPw1yAC64oRl0QyVZj43QeHIhVKfD/+YwSz4wsv1pfwb5SOFjz+r710YEWzU6LrhuSjpSO+6PeE4A== -"@ethersproject/logger@5.7.0", "@ethersproject/logger@^5.4.0", "@ethersproject/logger@^5.7.0": +"@ethersproject/logger@5.6.0": + version "5.6.0" + resolved "https://registry.yarnpkg.com/@ethersproject/logger/-/logger-5.6.0.tgz#d7db1bfcc22fd2e4ab574cba0bb6ad779a9a3e7a" + integrity sha512-BiBWllUROH9w+P21RzoxJKzqoqpkyM1pRnEKG69bulE9TSQD8SAIvTQqIMZmmCO8pUNkgLP1wndX1gKghSpBmg== + +"@ethersproject/logger@5.7.0", "@ethersproject/logger@^5.4.0", "@ethersproject/logger@^5.6.0", "@ethersproject/logger@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/logger/-/logger-5.7.0.tgz#6ce9ae168e74fecf287be17062b590852c311892" integrity sha512-0odtFdXu/XHtjQXJYA3u9G0G8btm0ND5Cu8M7i5vhEcE8/HmF4Lbdqanwyv4uQTr2tx6b7fQRmgLrsnpQlmnig== @@ -513,7 +681,14 @@ dependencies: "@ethersproject/logger" "^5.4.0" -"@ethersproject/networks@5.7.1", "@ethersproject/networks@^5.4.0", "@ethersproject/networks@^5.7.0": +"@ethersproject/networks@5.6.3": + version "5.6.3" + resolved "https://registry.yarnpkg.com/@ethersproject/networks/-/networks-5.6.3.tgz#3ee3ab08f315b433b50c99702eb32e0cf31f899f" + integrity sha512-QZxRH7cA5Ut9TbXwZFiCyuPchdWi87ZtVNHWZd0R6YFgYtes2jQ3+bsslJ0WdyDe0i6QumqtoYqvY3rrQFRZOQ== + dependencies: + "@ethersproject/logger" "^5.6.0" + +"@ethersproject/networks@5.7.1", "@ethersproject/networks@^5.4.0", "@ethersproject/networks@^5.6.3", "@ethersproject/networks@^5.7.0": version "5.7.1" resolved "https://registry.yarnpkg.com/@ethersproject/networks/-/networks-5.7.1.tgz#118e1a981d757d45ccea6bb58d9fd3d9db14ead6" integrity sha512-n/MufjFYv3yFcUyfhnXotyDlNdFb7onmkSy8aQERi2PjNcnWQ66xXxa3XlS8nCcA8aJKJjIIMNJTC7tu80GwpQ== @@ -528,7 +703,15 @@ "@ethersproject/bytes" "^5.4.0" "@ethersproject/sha2" "^5.4.0" -"@ethersproject/pbkdf2@5.7.0", "@ethersproject/pbkdf2@^5.4.0", "@ethersproject/pbkdf2@^5.7.0": +"@ethersproject/pbkdf2@5.6.1": + version "5.6.1" + resolved "https://registry.yarnpkg.com/@ethersproject/pbkdf2/-/pbkdf2-5.6.1.tgz#f462fe320b22c0d6b1d72a9920a3963b09eb82d1" + integrity sha512-k4gRQ+D93zDRPNUfmduNKq065uadC2YjMP/CqwwX5qG6R05f47boq6pLZtV/RnC4NZAYOPH1Cyo54q0c9sshRQ== + dependencies: + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/sha2" "^5.6.1" + +"@ethersproject/pbkdf2@5.7.0", "@ethersproject/pbkdf2@^5.4.0", "@ethersproject/pbkdf2@^5.6.1", "@ethersproject/pbkdf2@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/pbkdf2/-/pbkdf2-5.7.0.tgz#d2267d0a1f6e123f3771007338c47cccd83d3102" integrity sha512-oR/dBRZR6GTyaofd86DehG72hY6NpAjhabkhxgr3X2FpJtJuodEl2auADWBZfhDHgVCbu3/H/Ocq2uC6dpNjjw== @@ -543,7 +726,14 @@ dependencies: "@ethersproject/logger" "^5.4.0" -"@ethersproject/properties@5.7.0", "@ethersproject/properties@^5.4.0", "@ethersproject/properties@^5.7.0": +"@ethersproject/properties@5.6.0": + version "5.6.0" + resolved "https://registry.yarnpkg.com/@ethersproject/properties/-/properties-5.6.0.tgz#38904651713bc6bdd5bdd1b0a4287ecda920fa04" + integrity sha512-szoOkHskajKePTJSZ46uHUWWkbv7TzP2ypdEK6jGMqJaEt2sb0jCgfBo0gH0m2HBpRixMuJ6TBRaQCF7a9DoCg== + dependencies: + "@ethersproject/logger" "^5.6.0" + +"@ethersproject/properties@5.7.0", "@ethersproject/properties@^5.4.0", "@ethersproject/properties@^5.6.0", "@ethersproject/properties@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/properties/-/properties-5.7.0.tgz#a6e12cb0439b878aaf470f1902a176033067ed30" integrity sha512-J87jy8suntrAkIZtecpxEPxY//szqr1mlBaYlQ0r4RCaiD2hjheqF9s1LVE8vVuJCXisjIP+JgtK/Do54ej4Sw== @@ -575,6 +765,32 @@ bech32 "1.1.4" ws "7.4.6" +"@ethersproject/providers@5.6.8": + version "5.6.8" + resolved "https://registry.yarnpkg.com/@ethersproject/providers/-/providers-5.6.8.tgz#22e6c57be215ba5545d3a46cf759d265bb4e879d" + integrity sha512-Wf+CseT/iOJjrGtAOf3ck9zS7AgPmr2fZ3N97r4+YXN3mBePTG2/bJ8DApl9mVwYL+RpYbNxMEkEp4mPGdwG/w== + dependencies: + "@ethersproject/abstract-provider" "^5.6.1" + "@ethersproject/abstract-signer" "^5.6.2" + "@ethersproject/address" "^5.6.1" + "@ethersproject/base64" "^5.6.1" + "@ethersproject/basex" "^5.6.1" + "@ethersproject/bignumber" "^5.6.2" + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/constants" "^5.6.1" + "@ethersproject/hash" "^5.6.1" + "@ethersproject/logger" "^5.6.0" + "@ethersproject/networks" "^5.6.3" + "@ethersproject/properties" "^5.6.0" + "@ethersproject/random" "^5.6.1" + "@ethersproject/rlp" "^5.6.1" + "@ethersproject/sha2" "^5.6.1" + "@ethersproject/strings" "^5.6.1" + "@ethersproject/transactions" "^5.6.2" + "@ethersproject/web" "^5.6.1" + bech32 "1.1.4" + ws "7.4.6" + "@ethersproject/providers@5.7.2", "@ethersproject/providers@^5.4.7", "@ethersproject/providers@^5.7.1", "@ethersproject/providers@^5.7.2": version "5.7.2" resolved "https://registry.yarnpkg.com/@ethersproject/providers/-/providers-5.7.2.tgz#f8b1a4f275d7ce58cf0a2eec222269a08beb18cb" @@ -609,7 +825,15 @@ "@ethersproject/bytes" "^5.4.0" "@ethersproject/logger" "^5.4.0" -"@ethersproject/random@5.7.0", "@ethersproject/random@^5.4.0", "@ethersproject/random@^5.7.0": +"@ethersproject/random@5.6.1": + version "5.6.1" + resolved "https://registry.yarnpkg.com/@ethersproject/random/-/random-5.6.1.tgz#66915943981bcd3e11bbd43733f5c3ba5a790255" + integrity sha512-/wtPNHwbmng+5yi3fkipA8YBT59DdkGRoC2vWk09Dci/q5DlgnMkhIycjHlavrvrjJBkFjO/ueLyT+aUDfc4lA== + dependencies: + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/logger" "^5.6.0" + +"@ethersproject/random@5.7.0", "@ethersproject/random@^5.4.0", "@ethersproject/random@^5.6.1", "@ethersproject/random@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/random/-/random-5.7.0.tgz#af19dcbc2484aae078bb03656ec05df66253280c" integrity sha512-19WjScqRA8IIeWclFme75VMXSBvi4e6InrUNuaR4s5pTF2qNhcGdCUwdxUVGtDDqC00sDLCO93jPQoDUH4HVmQ== @@ -625,7 +849,15 @@ "@ethersproject/bytes" "^5.4.0" "@ethersproject/logger" "^5.4.0" -"@ethersproject/rlp@5.7.0", "@ethersproject/rlp@^5.4.0", "@ethersproject/rlp@^5.7.0": +"@ethersproject/rlp@5.6.1": + version "5.6.1" + resolved "https://registry.yarnpkg.com/@ethersproject/rlp/-/rlp-5.6.1.tgz#df8311e6f9f24dcb03d59a2bac457a28a4fe2bd8" + integrity sha512-uYjmcZx+DKlFUk7a5/W9aQVaoEC7+1MOBgNtvNg13+RnuUwT4F0zTovC0tmay5SmRslb29V1B7Y5KCri46WhuQ== + dependencies: + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/logger" "^5.6.0" + +"@ethersproject/rlp@5.7.0", "@ethersproject/rlp@^5.4.0", "@ethersproject/rlp@^5.6.1", "@ethersproject/rlp@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/rlp/-/rlp-5.7.0.tgz#de39e4d5918b9d74d46de93af80b7685a9c21304" integrity sha512-rBxzX2vK8mVF7b0Tol44t5Tb8gomOHkj5guL+HhzQ1yBh/ydjGnpw6at+X6Iw0Kp3OzzzkcKp8N9r0W4kYSs9w== @@ -642,7 +874,16 @@ "@ethersproject/logger" "^5.4.0" hash.js "1.1.7" -"@ethersproject/sha2@5.7.0", "@ethersproject/sha2@^5.4.0", "@ethersproject/sha2@^5.7.0": +"@ethersproject/sha2@5.6.1": + version "5.6.1" + resolved "https://registry.yarnpkg.com/@ethersproject/sha2/-/sha2-5.6.1.tgz#211f14d3f5da5301c8972a8827770b6fd3e51656" + integrity sha512-5K2GyqcW7G4Yo3uenHegbXRPDgARpWUiXc6RiF7b6i/HXUoWlb7uCARh7BAHg7/qT/Q5ydofNwiZcim9qpjB6g== + dependencies: + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/logger" "^5.6.0" + hash.js "1.1.7" + +"@ethersproject/sha2@5.7.0", "@ethersproject/sha2@^5.4.0", "@ethersproject/sha2@^5.6.1", "@ethersproject/sha2@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/sha2/-/sha2-5.7.0.tgz#9a5f7a7824ef784f7f7680984e593a800480c9fb" integrity sha512-gKlH42riwb3KYp0reLsFTokByAKoJdgFCwI+CCiX/k+Jm2mbNs6oOaCjYQSlI1+XBVejwH2KrmCbMAT/GnRDQw== @@ -663,7 +904,19 @@ elliptic "6.5.4" hash.js "1.1.7" -"@ethersproject/signing-key@5.7.0", "@ethersproject/signing-key@^5.4.0", "@ethersproject/signing-key@^5.7.0": +"@ethersproject/signing-key@5.6.2": + version "5.6.2" + resolved "https://registry.yarnpkg.com/@ethersproject/signing-key/-/signing-key-5.6.2.tgz#8a51b111e4d62e5a62aee1da1e088d12de0614a3" + integrity sha512-jVbu0RuP7EFpw82vHcL+GP35+KaNruVAZM90GxgQnGqB6crhBqW/ozBfFvdeImtmb4qPko0uxXjn8l9jpn0cwQ== + dependencies: + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/logger" "^5.6.0" + "@ethersproject/properties" "^5.6.0" + bn.js "^5.2.1" + elliptic "6.5.4" + hash.js "1.1.7" + +"@ethersproject/signing-key@5.7.0", "@ethersproject/signing-key@^5.4.0", "@ethersproject/signing-key@^5.6.2", "@ethersproject/signing-key@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/signing-key/-/signing-key-5.7.0.tgz#06b2df39411b00bc57c7c09b01d1e41cf1b16ab3" integrity sha512-MZdy2nL3wO0u7gkB4nA/pEf8lu1TlFswPNmy8AiYkfKTdO6eXBJyUdmHO/ehm/htHw9K/qF8ujnTyUAD+Ry54Q== @@ -686,6 +939,18 @@ "@ethersproject/sha2" "^5.4.0" "@ethersproject/strings" "^5.4.0" +"@ethersproject/solidity@5.6.1": + version "5.6.1" + resolved "https://registry.yarnpkg.com/@ethersproject/solidity/-/solidity-5.6.1.tgz#5845e71182c66d32e6ec5eefd041fca091a473e2" + integrity sha512-KWqVLkUUoLBfL1iwdzUVlkNqAUIFMpbbeH0rgCfKmJp0vFtY4AsaN91gHKo9ZZLkC4UOm3cI3BmMV4N53BOq4g== + dependencies: + "@ethersproject/bignumber" "^5.6.2" + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/keccak256" "^5.6.1" + "@ethersproject/logger" "^5.6.0" + "@ethersproject/sha2" "^5.6.1" + "@ethersproject/strings" "^5.6.1" + "@ethersproject/solidity@5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/solidity/-/solidity-5.7.0.tgz#5e9c911d8a2acce2a5ebb48a5e2e0af20b631cb8" @@ -707,7 +972,16 @@ "@ethersproject/constants" "^5.4.0" "@ethersproject/logger" "^5.4.0" -"@ethersproject/strings@5.7.0", "@ethersproject/strings@^5.4.0", "@ethersproject/strings@^5.7.0": +"@ethersproject/strings@5.6.1": + version "5.6.1" + resolved "https://registry.yarnpkg.com/@ethersproject/strings/-/strings-5.6.1.tgz#dbc1b7f901db822b5cafd4ebf01ca93c373f8952" + integrity sha512-2X1Lgk6Jyfg26MUnsHiT456U9ijxKUybz8IM1Vih+NJxYtXhmvKBcHOmvGqpFSVJ0nQ4ZCoIViR8XlRw1v/+Cw== + dependencies: + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/constants" "^5.6.1" + "@ethersproject/logger" "^5.6.0" + +"@ethersproject/strings@5.7.0", "@ethersproject/strings@^5.4.0", "@ethersproject/strings@^5.6.1", "@ethersproject/strings@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/strings/-/strings-5.7.0.tgz#54c9d2a7c57ae8f1205c88a9d3a56471e14d5ed2" integrity sha512-/9nu+lj0YswRNSH0NXYqrh8775XNyEdUQAuf3f+SmOrnVewcJ5SBNAjF7lpgehKi4abvNNXyf+HX86czCdJ8Mg== @@ -731,7 +1005,22 @@ "@ethersproject/rlp" "^5.4.0" "@ethersproject/signing-key" "^5.4.0" -"@ethersproject/transactions@5.7.0", "@ethersproject/transactions@^5.4.0", "@ethersproject/transactions@^5.7.0": +"@ethersproject/transactions@5.6.2": + version "5.6.2" + resolved "https://registry.yarnpkg.com/@ethersproject/transactions/-/transactions-5.6.2.tgz#793a774c01ced9fe7073985bb95a4b4e57a6370b" + integrity sha512-BuV63IRPHmJvthNkkt9G70Ullx6AcM+SDc+a8Aw/8Yew6YwT51TcBKEp1P4oOQ/bP25I18JJr7rcFRgFtU9B2Q== + dependencies: + "@ethersproject/address" "^5.6.1" + "@ethersproject/bignumber" "^5.6.2" + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/constants" "^5.6.1" + "@ethersproject/keccak256" "^5.6.1" + "@ethersproject/logger" "^5.6.0" + "@ethersproject/properties" "^5.6.0" + "@ethersproject/rlp" "^5.6.1" + "@ethersproject/signing-key" "^5.6.2" + +"@ethersproject/transactions@5.7.0", "@ethersproject/transactions@^5.4.0", "@ethersproject/transactions@^5.6.2", "@ethersproject/transactions@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/transactions/-/transactions-5.7.0.tgz#91318fc24063e057885a6af13fdb703e1f993d3b" integrity sha512-kmcNicCp1lp8qanMTC3RIikGgoJ80ztTyvtsFvCYpSCfkjhD0jZ2LOrnbcuxuToLIUYYf+4XwD1rP+B/erDIhQ== @@ -755,6 +1044,15 @@ "@ethersproject/constants" "^5.4.0" "@ethersproject/logger" "^5.4.0" +"@ethersproject/units@5.6.1": + version "5.6.1" + resolved "https://registry.yarnpkg.com/@ethersproject/units/-/units-5.6.1.tgz#ecc590d16d37c8f9ef4e89e2005bda7ddc6a4e6f" + integrity sha512-rEfSEvMQ7obcx3KWD5EWWx77gqv54K6BKiZzKxkQJqtpriVsICrktIQmKl8ReNToPeIYPnFHpXvKpi068YFZXw== + dependencies: + "@ethersproject/bignumber" "^5.6.2" + "@ethersproject/constants" "^5.6.1" + "@ethersproject/logger" "^5.6.0" + "@ethersproject/units@5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/units/-/units-5.7.0.tgz#637b563d7e14f42deeee39245275d477aae1d8b1" @@ -785,6 +1083,27 @@ "@ethersproject/transactions" "^5.4.0" "@ethersproject/wordlists" "^5.4.0" +"@ethersproject/wallet@5.6.2": + version "5.6.2" + resolved "https://registry.yarnpkg.com/@ethersproject/wallet/-/wallet-5.6.2.tgz#cd61429d1e934681e413f4bc847a5f2f87e3a03c" + integrity sha512-lrgh0FDQPuOnHcF80Q3gHYsSUODp6aJLAdDmDV0xKCN/T7D99ta1jGVhulg3PY8wiXEngD0DfM0I2XKXlrqJfg== + dependencies: + "@ethersproject/abstract-provider" "^5.6.1" + "@ethersproject/abstract-signer" "^5.6.2" + "@ethersproject/address" "^5.6.1" + "@ethersproject/bignumber" "^5.6.2" + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/hash" "^5.6.1" + "@ethersproject/hdnode" "^5.6.2" + "@ethersproject/json-wallets" "^5.6.1" + "@ethersproject/keccak256" "^5.6.1" + "@ethersproject/logger" "^5.6.0" + "@ethersproject/properties" "^5.6.0" + "@ethersproject/random" "^5.6.1" + "@ethersproject/signing-key" "^5.6.2" + "@ethersproject/transactions" "^5.6.2" + "@ethersproject/wordlists" "^5.6.1" + "@ethersproject/wallet@5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/wallet/-/wallet-5.7.0.tgz#4e5d0790d96fe21d61d38fb40324e6c7ef350b2d" @@ -817,7 +1136,18 @@ "@ethersproject/properties" "^5.4.0" "@ethersproject/strings" "^5.4.0" -"@ethersproject/web@5.7.1", "@ethersproject/web@^5.4.0", "@ethersproject/web@^5.7.0": +"@ethersproject/web@5.6.1": + version "5.6.1" + resolved "https://registry.yarnpkg.com/@ethersproject/web/-/web-5.6.1.tgz#6e2bd3ebadd033e6fe57d072db2b69ad2c9bdf5d" + integrity sha512-/vSyzaQlNXkO1WV+RneYKqCJwualcUdx/Z3gseVovZP0wIlOFcCE1hkRhKBH8ImKbGQbMl9EAAyJFrJu7V0aqA== + dependencies: + "@ethersproject/base64" "^5.6.1" + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/logger" "^5.6.0" + "@ethersproject/properties" "^5.6.0" + "@ethersproject/strings" "^5.6.1" + +"@ethersproject/web@5.7.1", "@ethersproject/web@^5.4.0", "@ethersproject/web@^5.6.1", "@ethersproject/web@^5.7.0": version "5.7.1" resolved "https://registry.yarnpkg.com/@ethersproject/web/-/web-5.7.1.tgz#de1f285b373149bee5928f4eb7bcb87ee5fbb4ae" integrity sha512-Gueu8lSvyjBWL4cYsWsjh6MtMwM0+H4HvqFPZfB6dV8ctbP9zFAO73VG1cMWae0FLPCtz0peKPpZY8/ugJJX2w== @@ -839,7 +1169,18 @@ "@ethersproject/properties" "^5.4.0" "@ethersproject/strings" "^5.4.0" -"@ethersproject/wordlists@5.7.0", "@ethersproject/wordlists@^5.4.0", "@ethersproject/wordlists@^5.7.0": +"@ethersproject/wordlists@5.6.1": + version "5.6.1" + resolved "https://registry.yarnpkg.com/@ethersproject/wordlists/-/wordlists-5.6.1.tgz#1e78e2740a8a21e9e99947e47979d72e130aeda1" + integrity sha512-wiPRgBpNbNwCQFoCr8bcWO8o5I810cqO6mkdtKfLKFlLxeCWcnzDi4Alu8iyNzlhYuS9npCwivMbRWF19dyblw== + dependencies: + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/hash" "^5.6.1" + "@ethersproject/logger" "^5.6.0" + "@ethersproject/properties" "^5.6.0" + "@ethersproject/strings" "^5.6.1" + +"@ethersproject/wordlists@5.7.0", "@ethersproject/wordlists@^5.4.0", "@ethersproject/wordlists@^5.6.1", "@ethersproject/wordlists@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/wordlists/-/wordlists-5.7.0.tgz#8fb2c07185d68c3e09eb3bfd6e779ba2774627f5" integrity sha512-S2TFNJNfHWVHNE6cNDjbVlZ6MgE17MIxMbMg2zv3wn+3XSJGosL1m9ZVv3GXCf/2ymSsQ+hRI5IzoMJTG6aoVA== @@ -2402,57 +2743,47 @@ typescript "5.5.4" zod "3.22.4" -"@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== +"@zetachain/localnet@4.0.0-rc6": + version "4.0.0-rc6" + resolved "https://registry.yarnpkg.com/@zetachain/localnet/-/localnet-4.0.0-rc6.tgz#9b36f5ab0e8fac766d63cfca4b1cab6a263bdd5d" + integrity sha512-DGKspMAJZLUrgNirc3NzFYg9jRfaOyuF5ePj85D93qAA//f8lOsXpmh/6Bvq/MrEscCLpVavgVP7+ePy4KJ2Fw== 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-rc11" + "@zetachain/protocol-contracts" "11.0.0-rc3" ansis "^3.3.2" concurrently "^8.2.2" ethers "^6.13.2" hardhat "^2.22.8" wait-on "^7.2.0" -"@zetachain/networks@^10.0.0": +"@zetachain/networks@10.0.0", "@zetachain/networks@^10.0.0": version "10.0.0" resolved "https://registry.yarnpkg.com/@zetachain/networks/-/networks-10.0.0.tgz#dd5d14a0870f6b658644aded8c96859f15531089" integrity sha512-FPolaO19oVkSLSPDUA/Hu+8AhG3lDEslRDpLnMzbMbnNSC669Fkah0/TEf+6egrQbAifBRfFLzwWidAGs8oxtA== dependencies: dotenv "^16.1.4" -"@zetachain/protocol-contracts@10.0.0-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== +"@zetachain/protocol-contracts@11.0.0-rc3": + version "11.0.0-rc3" + resolved "https://registry.yarnpkg.com/@zetachain/protocol-contracts/-/protocol-contracts-11.0.0-rc3.tgz#9b719391d0728fd1b4e046c5f496180a45ecf0d5" + integrity sha512-Q8lOFOi7S1wdOfOBZPTxsOoyV6kyWwYEhg4vk+HmB36n0Q6A2VvTI7qmw8rxCvq0a5BUASC8IYx0+HzsOPvNOw== dependencies: "@openzeppelin/contracts" "^5.0.2" "@openzeppelin/contracts-upgradeable" "^5.0.2" "@zetachain/networks" "^10.0.0" - ethers "^6.13.1" - -"@zetachain/protocol-contracts@10.0.0-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" + ethers "5.6.8" "@zetachain/protocol-contracts@9.0.0": version "9.0.0" resolved "https://registry.yarnpkg.com/@zetachain/protocol-contracts/-/protocol-contracts-9.0.0.tgz#c20ad5da43f6f3676f31556b303d1cb4ea17357e" integrity sha512-L4A8bddlyhjaBAsIv/x1Bvxc38RJz8U8rbbBtxK5oVyOAd5Zz04ZiT3HqzO4FuKq6RGGM1uiA8jvUfmRkKchXw== -"@zetachain/toolkit@13.0.0-rc4": - version "13.0.0-rc4" - resolved "https://registry.yarnpkg.com/@zetachain/toolkit/-/toolkit-13.0.0-rc4.tgz#e137fc16043f1416469f709c48808cfa301d9299" - integrity sha512-4z4MKbQKjRIeNruUyDBjZDRO5oTLa1w/7wVn+PfMsXn++mFFGkiawkLcitnkH9dadBJiERzmo89MRJxsLQ3U6w== +"@zetachain/toolkit@13.0.0-rc7": + version "13.0.0-rc7" + resolved "https://registry.yarnpkg.com/@zetachain/toolkit/-/toolkit-13.0.0-rc7.tgz#d8710dfeed6c84d7d5808de253887da3e67bf050" + integrity sha512-rh9q66iipRF3XJ4jlkawYqc10eA2mYgIS2rl1PiWvcqi39R1PgUzperKVwwoVmRuJi0FxE5fetP4SmqzfkfBXw== dependencies: "@coral-xyz/anchor" "^0.30.1" "@inquirer/prompts" "^2.1.1" @@ -2463,12 +2794,13 @@ "@solana/web3.js" "^1.95.3" "@uniswap/v2-periphery" "^1.1.0-beta.0" "@zetachain/faucet-cli" "^4.1.1" - "@zetachain/networks" "^10.0.0" + "@zetachain/networks" "10.0.0" "@zetachain/protocol-contracts" "9.0.0" axios "^1.4.0" bech32 "^2.0.0" bip39 "^3.1.0" bitcoinjs-lib "^6.1.3" + bs58 "^6.0.0" dotenv "16.0.3" ecpair "^2.1.0" envfile "^6.18.0" @@ -4290,6 +4622,42 @@ ethers@5.4.7: "@ethersproject/web" "5.4.0" "@ethersproject/wordlists" "5.4.0" +ethers@5.6.8: + version "5.6.8" + resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.6.8.tgz#d36b816b4896341a80a8bbd2a44e8cb6e9b98dd4" + integrity sha512-YxIGaltAOdvBFPZwIkyHnXbW40f1r8mHUgapW6dxkO+6t7H6wY8POUn0Kbxrd/N7I4hHxyi7YCddMAH/wmho2w== + dependencies: + "@ethersproject/abi" "5.6.3" + "@ethersproject/abstract-provider" "5.6.1" + "@ethersproject/abstract-signer" "5.6.2" + "@ethersproject/address" "5.6.1" + "@ethersproject/base64" "5.6.1" + "@ethersproject/basex" "5.6.1" + "@ethersproject/bignumber" "5.6.2" + "@ethersproject/bytes" "5.6.1" + "@ethersproject/constants" "5.6.1" + "@ethersproject/contracts" "5.6.2" + "@ethersproject/hash" "5.6.1" + "@ethersproject/hdnode" "5.6.2" + "@ethersproject/json-wallets" "5.6.1" + "@ethersproject/keccak256" "5.6.1" + "@ethersproject/logger" "5.6.0" + "@ethersproject/networks" "5.6.3" + "@ethersproject/pbkdf2" "5.6.1" + "@ethersproject/properties" "5.6.0" + "@ethersproject/providers" "5.6.8" + "@ethersproject/random" "5.6.1" + "@ethersproject/rlp" "5.6.1" + "@ethersproject/sha2" "5.6.1" + "@ethersproject/signing-key" "5.6.2" + "@ethersproject/solidity" "5.6.1" + "@ethersproject/strings" "5.6.1" + "@ethersproject/transactions" "5.6.2" + "@ethersproject/units" "5.6.1" + "@ethersproject/wallet" "5.6.2" + "@ethersproject/web" "5.6.1" + "@ethersproject/wordlists" "5.6.1" + ethers@5.7.2, ethers@^5.4.7, ethers@^5.7.1: version "5.7.2" resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.7.2.tgz#3a7deeabbb8c030d4126b24f84e525466145872e" @@ -4341,7 +4709,7 @@ ethers@^4.0.40: uuid "2.0.1" xmlhttprequest "1.8.0" -ethers@^6.13.1, ethers@^6.13.2: +ethers@^6.13.2: version "6.13.2" resolved "https://registry.yarnpkg.com/ethers/-/ethers-6.13.2.tgz#4b67d4b49e69b59893931a032560999e5e4419fe" integrity sha512-9VkriTTed+/27BGuY1s0hf441kqwHJ1wtN2edksEtiRvXx+soxRX3iSXTfFqq2+YwrOqbDoTHjIhQnjJRlzKmg== diff --git a/examples/nft/.gitignore b/examples/nft/.gitignore index 4487fa3c..34db758f 100644 --- a/examples/nft/.gitignore +++ b/examples/nft/.gitignore @@ -14,4 +14,6 @@ artifacts out cache_forge -access_token \ No newline at end of file +access_token + +localnet.json diff --git a/examples/nft/contracts/Connected.sol b/examples/nft/contracts/Connected.sol index b756a745..5f9ff393 100644 --- a/examples/nft/contracts/Connected.sol +++ b/examples/nft/contracts/Connected.sol @@ -19,15 +19,18 @@ contract Connected is { GatewayEVM public immutable gateway; uint256 private _nextTokenId; - address public counterparty; + address public universal; + uint256 public immutable gasLimit; error InvalidAddress(); error Unauthorized(); + error InvalidGasLimit(); + error GasTokenTransferFailed(); - function setCounterparty(address contractAddress) external onlyOwner { + function setUniversal(address contractAddress) external onlyOwner { if (contractAddress == address(0)) revert InvalidAddress(); - counterparty = contractAddress; - emit SetCounterparty(contractAddress); + universal = contractAddress; + emit SetUniversal(contractAddress); } modifier onlyGateway() { @@ -39,17 +42,24 @@ contract Connected is address payable gatewayAddress, address owner, string memory name, - string memory symbol + string memory symbol, + uint256 gas ) ERC721(name, symbol) Ownable(owner) { if (gatewayAddress == address(0) || owner == address(0)) revert InvalidAddress(); + if (gas == 0) revert InvalidGasLimit(); + gasLimit = gas; gateway = GatewayEVM(gatewayAddress); } function safeMint(address to, string memory uri) public onlyOwner { - if (to == address(0)) revert InvalidAddress(); + uint256 hash = uint256( + keccak256( + abi.encodePacked(address(this), block.number, _nextTokenId++) + ) + ); - uint256 tokenId = _nextTokenId++; + uint256 tokenId = hash & 0x00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF; _safeMint(to, tokenId); _setTokenURI(tokenId, uri); @@ -65,23 +75,30 @@ contract Connected is string memory uri = tokenURI(tokenId); _burn(tokenId); - bytes memory message = abi.encode(destination, receiver, tokenId, uri); - - RevertOptions memory revertOptions = RevertOptions( - address(this), - true, - address(0), - message, - 0 + bytes memory message = abi.encode( + destination, + receiver, + tokenId, + uri, + msg.sender ); - if (destination == address(0)) { - gateway.call(counterparty, message, revertOptions); + gateway.call( + universal, + message, + RevertOptions(address(this), false, address(0), message, 0) + ); } else { gateway.depositAndCall{value: msg.value}( - counterparty, + universal, message, - revertOptions + RevertOptions( + address(this), + true, + address(0), + abi.encode(receiver, tokenId, uri, msg.sender), + gasLimit + ) ); } @@ -92,23 +109,30 @@ contract Connected is MessageContext calldata context, bytes calldata message ) external payable onlyGateway returns (bytes4) { - if (context.sender != counterparty) revert Unauthorized(); + if (context.sender != universal) revert Unauthorized(); - (address receiver, uint256 tokenId, string memory uri) = abi.decode( - message, - (address, uint256, string) - ); + ( + address receiver, + uint256 tokenId, + string memory uri, + uint256 gasAmount, + address sender + ) = abi.decode(message, (address, uint256, string, uint256, address)); _safeMint(receiver, tokenId); _setTokenURI(tokenId, uri); + if (gasAmount > 0) { + (bool success, ) = sender.call{value: gasAmount}(""); + if (!success) revert GasTokenTransferFailed(); + } emit TokenTransferReceived(receiver, tokenId, uri); return ""; } function onRevert(RevertContext calldata context) external onlyGateway { - (address sender, uint256 tokenId, string memory uri) = abi.decode( + (, uint256 tokenId, string memory uri, address sender) = abi.decode( context.revertMessage, - (address, uint256, string) + (address, uint256, string, address) ); _safeMint(sender, tokenId); diff --git a/examples/nft/contracts/Universal.sol b/examples/nft/contracts/Universal.sol index c31ffdad..54909acc 100644 --- a/examples/nft/contracts/Universal.sol +++ b/examples/nft/contracts/Universal.sol @@ -23,18 +23,17 @@ contract Universal is Events { GatewayZEVM public immutable gateway; - SystemContract public immutable systemContract = - SystemContract(0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9); + address public immutable uniswapRouter; uint256 private _nextTokenId; bool public isUniversal = true; - uint256 public gasLimit; + uint256 public immutable gasLimit; error TransferFailed(); error Unauthorized(); error InvalidAddress(); error InvalidGasLimit(); - mapping(address => bytes) public counterparty; + mapping(address => address) public connected; modifier onlyGateway() { if (msg.sender != address(gateway)) revert Unauthorized(); @@ -46,21 +45,26 @@ contract Universal is address owner, string memory name, string memory symbol, - uint256 gas + uint256 gas, + address uniswapRouterAddress ) ERC721(name, symbol) Ownable(owner) { - if (gatewayAddress == address(0) || owner == address(0)) - revert InvalidAddress(); + if ( + gatewayAddress == address(0) || + owner == address(0) || + uniswapRouterAddress == address(0) + ) revert InvalidAddress(); if (gas == 0) revert InvalidGasLimit(); gateway = GatewayZEVM(gatewayAddress); + uniswapRouter = uniswapRouterAddress; gasLimit = gas; } - function setCounterparty( + function setConnected( address zrc20, - bytes memory contractAddress + address contractAddress ) external onlyOwner { - counterparty[zrc20] = contractAddress; - emit CounterpartySet(zrc20, contractAddress); + connected[zrc20] = contractAddress; + emit SetConnected(zrc20, contractAddress); } function transferCrossChain( @@ -79,7 +83,13 @@ contract Universal is !IZRC20(destination).transferFrom(msg.sender, address(this), gasFee) ) revert TransferFailed(); IZRC20(destination).approve(address(gateway), gasFee); - bytes memory message = abi.encode(receiver, tokenId, uri); + bytes memory message = abi.encode( + receiver, + tokenId, + uri, + 0, + msg.sender + ); CallOptions memory callOptions = CallOptions(gasLimit, false); @@ -87,12 +97,12 @@ contract Universal is address(this), true, address(0), - message, + abi.encode(tokenId, uri, msg.sender), gasLimit ); gateway.call( - counterparty[destination], + abi.encodePacked(connected[destination]), destination, message, callOptions, @@ -121,49 +131,56 @@ contract Universal is uint256 amount, bytes calldata message ) external override onlyGateway { - if (keccak256(context.origin) != keccak256(counterparty[zrc20])) - revert("Unauthorized"); + if (context.sender != connected[zrc20]) revert Unauthorized(); ( address destination, - address sender, + address receiver, uint256 tokenId, - string memory uri - ) = abi.decode(message, (address, address, uint256, string)); + string memory uri, + address sender + ) = abi.decode(message, (address, address, uint256, string, address)); if (destination == address(0)) { - _safeMint(sender, tokenId); + _safeMint(receiver, tokenId); _setTokenURI(tokenId, uri); - emit TokenTransferReceived(sender, tokenId, uri); + emit TokenTransferReceived(receiver, tokenId, uri); } else { (, uint256 gasFee) = IZRC20(destination).withdrawGasFeeWithGasLimit( gasLimit ); - SwapHelperLib.swapExactTokensForTokens( - systemContract, + uint256 out = SwapHelperLib.swapExactTokensForTokens( + uniswapRouter, zrc20, amount, destination, 0 ); - IZRC20(destination).approve(address(gateway), gasFee); - gateway.call( - counterparty[destination], + IZRC20(destination).approve(address(gateway), out); + gateway.withdrawAndCall( + abi.encodePacked(connected[destination]), + out - gasFee, destination, - abi.encode(sender, tokenId, uri), + abi.encode(receiver, tokenId, uri, out - gasFee, sender), CallOptions(gasLimit, false), - RevertOptions(address(0), false, address(0), "", 0) + RevertOptions( + address(this), + true, + address(0), + abi.encode(tokenId, uri, sender), + 0 + ) ); - emit TokenTransferToDestination(sender, destination, tokenId, uri); } + emit TokenTransferToDestination(receiver, destination, tokenId, uri); } function onRevert(RevertContext calldata context) external onlyGateway { - (address sender, uint256 tokenId, string memory uri) = abi.decode( + (uint256 tokenId, string memory uri, address sender) = abi.decode( context.revertMessage, - (address, uint256, string) + (uint256, string, address) ); _safeMint(sender, tokenId); diff --git a/examples/nft/contracts/shared/Events.sol b/examples/nft/contracts/shared/Events.sol index 01711d55..eff15810 100644 --- a/examples/nft/contracts/shared/Events.sol +++ b/examples/nft/contracts/shared/Events.sol @@ -2,7 +2,8 @@ pragma solidity ^0.8.26; contract Events { - event SetCounterparty(address indexed newCounterparty); + event SetUniversal(address indexed universalAddress); + event SetConnected(address indexed zrc20, address contractAddress); event TokenMinted(address indexed to, uint256 indexed tokenId, string uri); event TokenTransfer( address indexed destination, @@ -20,7 +21,6 @@ contract Events { uint256 indexed tokenId, string uri ); - event CounterpartySet(address indexed zrc20, bytes indexed contractAddress); event TokenTransferToDestination( address indexed destination, address indexed sender, diff --git a/examples/nft/hardhat.config.ts b/examples/nft/hardhat.config.ts index 918e279b..38cc713f 100644 --- a/examples/nft/hardhat.config.ts +++ b/examples/nft/hardhat.config.ts @@ -2,8 +2,8 @@ import "./tasks/deploy"; import "./tasks/deploy"; import "./tasks/mint"; import "./tasks/transfer"; -import "./tasks/universalSetCounterparty"; -import "./tasks/connectedSetCounterparty"; +import "./tasks/universalSetConnected"; +import "./tasks/connectedSetUniversal"; import "@zetachain/localnet/tasks"; import "@nomicfoundation/hardhat-toolbox"; import "@zetachain/toolkit/tasks"; diff --git a/examples/nft/package.json b/examples/nft/package.json index 1e04fba6..84fec511 100644 --- a/examples/nft/package.json +++ b/examples/nft/package.json @@ -27,8 +27,8 @@ "@types/node": ">=12.0.0", "@typescript-eslint/eslint-plugin": "^5.59.9", "@typescript-eslint/parser": "^5.59.9", - "@zetachain/localnet": "4.0.0-rc4", - "@zetachain/toolkit": "13.0.0-rc4", + "@zetachain/localnet": "4.0.0-rc6", + "@zetachain/toolkit": "13.0.0-rc8", "axios": "^1.3.6", "chai": "^4.2.0", "dotenv": "^16.0.3", diff --git a/examples/nft/scripts/test.sh b/examples/nft/scripts/localnet.sh similarity index 65% rename from examples/nft/scripts/test.sh rename to examples/nft/scripts/localnet.sh index 4b357c5b..e546d973 100755 --- a/examples/nft/scripts/test.sh +++ b/examples/nft/scripts/localnet.sh @@ -1,8 +1,8 @@ #!/bin/bash set -e - -if [ "$1" = "localnet" ]; then npx hardhat localnet --exit-on-error & sleep 10; fi +set -x +if [ "$1" = "start" ]; then npx hardhat localnet --exit-on-error & sleep 10; fi function balance() { local ZETACHAIN=$(cast call "$CONTRACT_ZETACHAIN" "balanceOf(address)(uint256)" "$SENDER") @@ -21,26 +21,28 @@ npx hardhat compile --force --quiet ZRC20_ETHEREUM=$(jq -r '.addresses[] | select(.type=="ZRC-20 ETH on 5") | .address' localnet.json) ZRC20_BNB=$(jq -r '.addresses[] | select(.type=="ZRC-20 BNB on 97") | .address' localnet.json) +GATEWAY_ZETACHAIN=$(jq -r '.addresses[] | select(.type=="gatewayZEVM" and .chain=="zetachain") | .address' localnet.json) GATEWAY_ETHEREUM=$(jq -r '.addresses[] | select(.type=="gatewayEVM" and .chain=="ethereum") | .address' localnet.json) GATEWAY_BNB=$(jq -r '.addresses[] | select(.type=="gatewayEVM" and .chain=="bnb") | .address' localnet.json) +UNISWAP_ROUTER=$(jq -r '.addresses[] | select(.type=="uniswapRouterInstance" and .chain=="zetachain") | .address' localnet.json) SENDER=0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 -CONTRACT_ZETACHAIN=$(npx hardhat deploy --network localhost --json --gas-limit 1000000 | jq -r '.contractAddress') +CONTRACT_ZETACHAIN=$(npx hardhat deploy --network localhost --gateway "$GATEWAY_ZETACHAIN" --uniswap-router "$UNISWAP_ROUTER" --json | jq -r '.contractAddress') echo -e "\nšŸš€ Deployed NFT contract on ZetaChain: $CONTRACT_ZETACHAIN" CONTRACT_ETHEREUM=$(npx hardhat deploy --name Connected --json --network localhost --gateway "$GATEWAY_ETHEREUM" | jq -r '.contractAddress') echo -e "šŸš€ Deployed NFT contract on Ethereum: $CONTRACT_ETHEREUM" -CONTRACT_BNB=$(npx hardhat deploy --name Connected --json --network localhost --gateway "$GATEWAY_BNB" | jq -r '.contractAddress') +CONTRACT_BNB=$(npx hardhat deploy --name Connected --json --network localhost --gas-limit 1000000 --gateway "$GATEWAY_BNB" | jq -r '.contractAddress') echo -e "šŸš€ Deployed NFT contract on BNB chain: $CONTRACT_BNB" echo -e "\nšŸ“® User Address: $SENDER" -echo -e "\nšŸ”— Setting counterparty contracts..." -npx hardhat connected-set-counterparty --network localhost --contract "$CONTRACT_ETHEREUM" --counterparty "$CONTRACT_ZETACHAIN" --json &>/dev/null -npx hardhat connected-set-counterparty --network localhost --contract "$CONTRACT_BNB" --counterparty "$CONTRACT_ZETACHAIN" --json &>/dev/null -npx hardhat universal-set-counterparty --network localhost --contract "$CONTRACT_ZETACHAIN" --counterparty "$CONTRACT_ETHEREUM" --zrc20 "$ZRC20_ETHEREUM" --json &>/dev/null -npx hardhat universal-set-counterparty --network localhost --contract "$CONTRACT_ZETACHAIN" --counterparty "$CONTRACT_BNB" --zrc20 "$ZRC20_BNB" --json &>/dev/null +echo -e "\nšŸ”— Setting universal and connected contracts..." +npx hardhat connected-set-universal --network localhost --contract "$CONTRACT_ETHEREUM" --universal "$CONTRACT_ZETACHAIN" --json &>/dev/null +npx hardhat connected-set-universal --network localhost --contract "$CONTRACT_BNB" --universal "$CONTRACT_ZETACHAIN" --json &>/dev/null +npx hardhat universal-set-connected --network localhost --contract "$CONTRACT_ZETACHAIN" --connected "$CONTRACT_ETHEREUM" --zrc20 "$ZRC20_ETHEREUM" --json &>/dev/null +npx hardhat universal-set-connected --network localhost --contract "$CONTRACT_ZETACHAIN" --connected "$CONTRACT_BNB" --zrc20 "$ZRC20_BNB" --json &>/dev/null npx hardhat localnet-check balance @@ -69,4 +71,4 @@ npx hardhat transfer --network localhost --json --token-id "$NFT_ID" --from "$CO npx hardhat localnet-check balance -if [ "$1" = "localnet" ]; then npx hardhat localnet-stop; fi \ No newline at end of file +if [ "$1" = "start" ]; then npx hardhat localnet-stop; fi \ No newline at end of file diff --git a/examples/nft/scripts/testnet.sh b/examples/nft/scripts/testnet.sh new file mode 100755 index 00000000..efea4097 --- /dev/null +++ b/examples/nft/scripts/testnet.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +set -e +set -x + +npx hardhat compile --force --quiet + +UNIVERSAL=$(npx hardhat deploy --name Universal --network zeta_testnet --gateway 0x6c533f7fe93fae114d0954697069df33c9b74fd7 --uniswap-router 0x2ca7d64A7EFE2D62A725E2B35Cf7230D6677FfEe --gas-limit 500000 --json | jq -r '.contractAddress') +CONNECTED_BASE=$(npx hardhat deploy --name Connected --network base_sepolia --gateway 0x0c487a766110c85d301d96e33579c5b317fa4995 --gas-limit 500000 --json | jq -r '.contractAddress') +CONNECTED_BNB=$(npx hardhat deploy --name Connected --network bsc_testnet --gateway 0x0c487a766110c85d301d96e33579c5b317fa4995 --gas-limit 500000 --json | jq -r '.contractAddress') + +ZRC20_BASE=0x236b0DE675cC8F46AE186897fCCeFe3370C9eDeD +ZRC20_BNB=0xd97B1de3619ed2c6BEb3860147E30cA8A7dC9891 + +npx hardhat connected-set-counterparty --network base_sepolia --contract "$CONNECTED_BASE" --counterparty "$UNIVERSAL" --json + +npx hardhat connected-set-counterparty --network bsc_testnet --contract "$CONNECTED_BNB" --counterparty "$UNIVERSAL" --json + +npx hardhat universal-set-counterparty --network zeta_testnet --contract "$UNIVERSAL" --counterparty "$CONNECTED_BASE" --zrc20 "$ZRC20_BASE" --json + +npx hardhat universal-set-counterparty --network zeta_testnet --contract "$UNIVERSAL" --counterparty "$CONNECTED_BNB" --zrc20 "$ZRC20_BNB" --json \ No newline at end of file diff --git a/examples/nft/tasks/connectedSetCounterparty.ts b/examples/nft/tasks/connectedSetUniversal.ts similarity index 80% rename from examples/nft/tasks/connectedSetCounterparty.ts rename to examples/nft/tasks/connectedSetUniversal.ts index 92281b4d..fb287836 100644 --- a/examples/nft/tasks/connectedSetCounterparty.ts +++ b/examples/nft/tasks/connectedSetUniversal.ts @@ -15,14 +15,14 @@ const main = async (args: any, hre: HardhatRuntimeEnvironment) => { args.contract ); - const tx = await contract.setCounterparty(args.counterparty); + const tx = await contract.setUniversal(args.universal); const receipt = await tx.wait(); if (args.json) { console.log( JSON.stringify({ contractAddress: args.contract, - universalContract: args.counterparty, + universalContract: args.universal, transactionHash: tx.hash, }) ); @@ -34,7 +34,7 @@ const main = async (args: any, hre: HardhatRuntimeEnvironment) => { } }; -task("connected-set-counterparty", "Sets the universal contract address", main) +task("connected-set-universal", "Sets the universal contract address", main) .addParam("contract", "The address of the deployed contract") - .addParam("counterparty", "The address of the universal contract to set") + .addParam("universal", "The address of the universal contract to set") .addFlag("json", "Output the result in JSON format"); diff --git a/examples/nft/tasks/deploy.ts b/examples/nft/tasks/deploy.ts index 895512b0..845098d3 100644 --- a/examples/nft/tasks/deploy.ts +++ b/examples/nft/tasks/deploy.ts @@ -1,4 +1,4 @@ -import { task } from "hardhat/config"; +import { task, types } from "hardhat/config"; import { HardhatRuntimeEnvironment } from "hardhat/types"; const main = async (args: any, hre: HardhatRuntimeEnvironment) => { @@ -12,13 +12,19 @@ const main = async (args: any, hre: HardhatRuntimeEnvironment) => { } const factory: any = await hre.ethers.getContractFactory(args.name); + const contract = await factory.deploy( args.gateway, signer.address, - args.nftName, - args.nftSymbol, - ...(args.gasLimit ? [args.gasLimit] : []) + args.tokenName, + args.tokenSymbol, + args.gasLimit, + ...(args.uniswapRouter ? [args.uniswapRouter] : []), + { + gasPrice: args.deployGasPrice, + } ); + await contract.deployed(); if (args.json) { @@ -39,12 +45,23 @@ const main = async (args: any, hre: HardhatRuntimeEnvironment) => { task("deploy", "Deploy the NFT contract", main) .addFlag("json", "Output the result in JSON format") - .addOptionalParam("nftName", "NFT name", "Universal NFT") - .addOptionalParam("nftSymbol", "NFT symbol", "UNFT") + .addOptionalParam("tokenName", "NFT name", "Universal NFT") + .addOptionalParam("tokenSymbol", "NFT symbol", "UNFT") .addOptionalParam("name", "The contract name to deploy", "Universal") - .addOptionalParam("gasLimit", "Gas limit for the transaction") + .addOptionalParam( + "gasLimit", + "Gas limit for the transaction", + 1000000, + types.int + ) .addOptionalParam( "gateway", "Gateway address (default: ZetaChain Gateway)", - "0x5FC8d32690cc91D4c39d9d3abcBD16989F875707" - ); + "0x6c533f7fe93fae114d0954697069df33c9b74fd7" + ) + .addOptionalParam( + "deployGasPrice", + "Gas price for deploy transaction", + "10000000000" + ) + .addOptionalParam("uniswapRouter", "Uniswap v2 Router address"); diff --git a/examples/nft/tasks/transfer.ts b/examples/nft/tasks/transfer.ts index e0e47abe..1ecb9b50 100644 --- a/examples/nft/tasks/transfer.ts +++ b/examples/nft/tasks/transfer.ts @@ -34,12 +34,9 @@ const main = async (args: any, hre: HardhatRuntimeEnvironment) => { const receiver = args.receiver || signer.address; - tx = await (contract as any).transferCrossChain( - args.tokenId, - receiver, - args.to, - { ...txOptions, value: gasAmount } - ); + tx = await contract.transferCrossChain(args.tokenId, receiver, args.to, { + value: gasAmount, + }); await tx.wait(); if (args.json) { @@ -53,10 +50,10 @@ const main = async (args: any, hre: HardhatRuntimeEnvironment) => { ); } else { console.log(`šŸš€ Successfully transferred NFT to the contract. -šŸ“œ Contract address: ${args.from} -šŸ–¼ NFT Contract address: ${args.nftContract} -šŸ†” Token ID: ${args.tokenId} -šŸ”— Transaction hash: ${tx.hash}`); + šŸ“œ Contract address: ${args.from} + šŸ–¼ NFT Contract address: ${args.nftContract} + šŸ†” Token ID: ${args.tokenId} + šŸ”— Transaction hash: ${tx.hash}`); } }; diff --git a/examples/nft/tasks/universalSetCounterparty.ts b/examples/nft/tasks/universalSetConnected.ts similarity index 80% rename from examples/nft/tasks/universalSetCounterparty.ts rename to examples/nft/tasks/universalSetConnected.ts index 9fd2e13e..249bdb03 100644 --- a/examples/nft/tasks/universalSetCounterparty.ts +++ b/examples/nft/tasks/universalSetConnected.ts @@ -15,14 +15,14 @@ const main = async (args: any, hre: HardhatRuntimeEnvironment) => { args.contract ); - const tx = await contract.setCounterparty(args.zrc20, args.counterparty); + const tx = await contract.setConnected(args.zrc20, args.connected); if (args.json) { console.log( JSON.stringify({ contractAddress: args.contract, zrc20: args.zrc20, - connectedContractAddress: args.counterparty, + connectedContractAddress: args.connected, transactionHash: tx.hash, }) ); @@ -35,8 +35,8 @@ const main = async (args: any, hre: HardhatRuntimeEnvironment) => { } }; -task("universal-set-counterparty", "Sets the connected contract address", main) +task("universal-set-connected", "Sets the connected contract address", main) .addParam("contract", "The address of the deployed contract") .addParam("zrc20", "The ZRC20 address to link to the connected contract") - .addParam("counterparty", "The address of the connected contract to set") + .addParam("connected", "The address of the connected contract to set") .addFlag("json", "Output the result in JSON format"); diff --git a/examples/nft/yarn.lock b/examples/nft/yarn.lock index e897e2e7..14f87151 100644 --- a/examples/nft/yarn.lock +++ b/examples/nft/yarn.lock @@ -2743,10 +2743,10 @@ typescript "5.5.4" zod "3.22.4" -"@zetachain/localnet@4.0.0-rc4": - version "4.0.0-rc4" - resolved "https://registry.yarnpkg.com/@zetachain/localnet/-/localnet-4.0.0-rc4.tgz#916c58f83dd4901691fbc1216aec2ee88e7f531e" - integrity sha512-yNlA6qaQZiuHXRx4pgNLLHlJ+2ENet9WTIWxoslnLzzDljWwYTJHkErlTQcWa5oL9jjyn2/hQB/laoqXzlX1gQ== +"@zetachain/localnet@4.0.0-rc6": + version "4.0.0-rc6" + resolved "https://registry.yarnpkg.com/@zetachain/localnet/-/localnet-4.0.0-rc6.tgz#9b36f5ab0e8fac766d63cfca4b1cab6a263bdd5d" + integrity sha512-DGKspMAJZLUrgNirc3NzFYg9jRfaOyuF5ePj85D93qAA//f8lOsXpmh/6Bvq/MrEscCLpVavgVP7+ePy4KJ2Fw== dependencies: "@inquirer/prompts" "^5.5.0" "@uniswap/v2-core" "^1.0.1" @@ -2758,7 +2758,7 @@ hardhat "^2.22.8" wait-on "^7.2.0" -"@zetachain/networks@^10.0.0": +"@zetachain/networks@10.0.0", "@zetachain/networks@^10.0.0": version "10.0.0" resolved "https://registry.yarnpkg.com/@zetachain/networks/-/networks-10.0.0.tgz#dd5d14a0870f6b658644aded8c96859f15531089" integrity sha512-FPolaO19oVkSLSPDUA/Hu+8AhG3lDEslRDpLnMzbMbnNSC669Fkah0/TEf+6egrQbAifBRfFLzwWidAGs8oxtA== @@ -2780,10 +2780,10 @@ resolved "https://registry.yarnpkg.com/@zetachain/protocol-contracts/-/protocol-contracts-9.0.0.tgz#c20ad5da43f6f3676f31556b303d1cb4ea17357e" integrity sha512-L4A8bddlyhjaBAsIv/x1Bvxc38RJz8U8rbbBtxK5oVyOAd5Zz04ZiT3HqzO4FuKq6RGGM1uiA8jvUfmRkKchXw== -"@zetachain/toolkit@13.0.0-rc4": - version "13.0.0-rc4" - resolved "https://registry.yarnpkg.com/@zetachain/toolkit/-/toolkit-13.0.0-rc4.tgz#e137fc16043f1416469f709c48808cfa301d9299" - integrity sha512-4z4MKbQKjRIeNruUyDBjZDRO5oTLa1w/7wVn+PfMsXn++mFFGkiawkLcitnkH9dadBJiERzmo89MRJxsLQ3U6w== +"@zetachain/toolkit@13.0.0-rc8": + version "13.0.0-rc8" + resolved "https://registry.yarnpkg.com/@zetachain/toolkit/-/toolkit-13.0.0-rc8.tgz#1f8b975428f6f1b7bdef4ccc0a1312de81f90e7d" + integrity sha512-lXAyyMpgN/dsGIUTR/hi5M+6/tsnzONLAaisAnJzsrEUB4nYkoZtQCR4lwP4oWhNl4i3SK5k+bFjAfBo1DU3iw== dependencies: "@coral-xyz/anchor" "^0.30.1" "@inquirer/prompts" "^2.1.1" @@ -2794,12 +2794,13 @@ "@solana/web3.js" "^1.95.3" "@uniswap/v2-periphery" "^1.1.0-beta.0" "@zetachain/faucet-cli" "^4.1.1" - "@zetachain/networks" "^10.0.0" + "@zetachain/networks" "10.0.0" "@zetachain/protocol-contracts" "9.0.0" axios "^1.4.0" bech32 "^2.0.0" bip39 "^3.1.0" bitcoinjs-lib "^6.1.3" + bs58 "^6.0.0" dotenv "16.0.3" ecpair "^2.1.0" envfile "^6.18.0" diff --git a/examples/swap/.gitignore b/examples/swap/.gitignore index 4487fa3c..34db758f 100644 --- a/examples/swap/.gitignore +++ b/examples/swap/.gitignore @@ -14,4 +14,6 @@ artifacts out cache_forge -access_token \ No newline at end of file +access_token + +localnet.json diff --git a/examples/swap/contracts/Swap.sol b/examples/swap/contracts/Swap.sol index 2515da74..d6c8ade1 100644 --- a/examples/swap/contracts/Swap.sol +++ b/examples/swap/contracts/Swap.sol @@ -12,17 +12,22 @@ import "@zetachain/protocol-contracts/contracts/zevm/interfaces/IGatewayZEVM.sol import {GatewayZEVM} from "@zetachain/protocol-contracts/contracts/zevm/GatewayZEVM.sol"; contract Swap is UniversalContract { - SystemContract public systemContract; + address public immutable uniswapRouter; GatewayZEVM public gateway; uint256 constant BITCOIN = 18332; + error InvalidAddress(); + error Unauthorized(); + modifier onlyGateway() { - require(msg.sender == address(gateway), "Caller is not the gateway"); + if (msg.sender != address(gateway)) revert Unauthorized(); _; } - constructor(address systemContractAddress, address payable gatewayAddress) { - systemContract = SystemContract(systemContractAddress); + constructor(address payable gatewayAddress, address uniswapRouterAddress) { + if (gatewayAddress == address(0) || uniswapRouterAddress == address(0)) + revert InvalidAddress(); + uniswapRouter = uniswapRouterAddress; gateway = GatewayZEVM(gatewayAddress); } @@ -36,7 +41,7 @@ contract Swap is UniversalContract { address zrc20, uint256 amount, bytes calldata message - ) external override onlyGateway { + ) external onlyGateway { Params memory params = Params({target: address(0), to: bytes("")}); if (context.chainID == BITCOIN) { params.target = BytesHelperLib.bytesToAddress(message, 0); @@ -72,7 +77,7 @@ contract Swap is UniversalContract { swapAmount = amount - gasFee; } else { inputForGas = SwapHelperLib.swapTokensForExactTokens( - systemContract, + uniswapRouter, inputToken, gasFee, gasZRC20, @@ -82,7 +87,7 @@ contract Swap is UniversalContract { } uint256 outputAmount = SwapHelperLib.swapExactTokensForTokens( - systemContract, + uniswapRouter, inputToken, swapAmount, targetToken, @@ -112,5 +117,5 @@ contract Swap is UniversalContract { function onRevert( RevertContext calldata revertContext - ) external override onlyGateway {} + ) external onlyGateway {} } diff --git a/examples/swap/contracts/SwapToAnyToken.sol b/examples/swap/contracts/SwapToAnyToken.sol index 36377766..d3022c99 100644 --- a/examples/swap/contracts/SwapToAnyToken.sol +++ b/examples/swap/contracts/SwapToAnyToken.sol @@ -13,17 +13,22 @@ import "@zetachain/protocol-contracts/contracts/zevm/interfaces/IWZETA.sol"; import {GatewayZEVM} from "@zetachain/protocol-contracts/contracts/zevm/GatewayZEVM.sol"; contract SwapToAnyToken is UniversalContract { - SystemContract public systemContract; + address public immutable uniswapRouter; GatewayZEVM public gateway; uint256 constant BITCOIN = 18332; + error InvalidAddress(); + error Unauthorized(); + modifier onlyGateway() { - require(msg.sender == address(gateway), "Caller is not the gateway"); + if (msg.sender != address(gateway)) revert Unauthorized(); _; } - constructor(address systemContractAddress, address payable gatewayAddress) { - systemContract = SystemContract(systemContractAddress); + constructor(address payable gatewayAddress, address uniswapRouterAddress) { + if (gatewayAddress == address(0) || uniswapRouterAddress == address(0)) + revert InvalidAddress(); + uniswapRouter = uniswapRouterAddress; gateway = GatewayZEVM(gatewayAddress); } @@ -38,7 +43,7 @@ contract SwapToAnyToken is UniversalContract { address zrc20, uint256 amount, bytes calldata message - ) external virtual override onlyGateway { + ) external onlyGateway { Params memory params = Params({ target: address(0), to: bytes(""), @@ -92,7 +97,7 @@ contract SwapToAnyToken is UniversalContract { swapAmount = amount - gasFee; } else { inputForGas = SwapHelperLib.swapTokensForExactTokens( - systemContract, + uniswapRouter, inputToken, gasFee, gasZRC20, @@ -103,7 +108,7 @@ contract SwapToAnyToken is UniversalContract { } uint256 outputAmount = SwapHelperLib.swapExactTokensForTokens( - systemContract, + uniswapRouter, inputToken, swapAmount, targetToken, @@ -154,5 +159,5 @@ contract SwapToAnyToken is UniversalContract { function onRevert( RevertContext calldata revertContext - ) external override onlyGateway {} + ) external onlyGateway {} } diff --git a/examples/swap/package.json b/examples/swap/package.json index c43d9371..221f9067 100644 --- a/examples/swap/package.json +++ b/examples/swap/package.json @@ -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:localnet": "npx hardhat compile --force && npx hardhat deploy --network localhost --gateway 0x9A676e781A523b5d0C0e43731313A708CB607508", + "deploy:localnet": "npx hardhat compile --force && npx hardhat deploy --network localhost --gateway 0x5FC8d32690cc91D4c39d9d3abcBD16989F875707", "deploy-any:localnet": "npx hardhat compile --force && npx hardhat deploy --name SwapToAnyToken --network localhost --gateway 0x9A676e781A523b5d0C0e43731313A708CB607508" }, "keywords": [], @@ -29,7 +29,7 @@ "@types/node": ">=12.0.0", "@typescript-eslint/eslint-plugin": "^5.59.9", "@typescript-eslint/parser": "^5.59.9", - "@zetachain/localnet": "^3.5.0", + "@zetachain/localnet": "4.0.0-rc6", "axios": "^1.3.6", "chai": "^4.2.0", "dotenv": "^16.0.3", @@ -57,7 +57,7 @@ "@solana-developers/helpers": "^2.4.0", "@solana/spl-memo": "^0.2.5", "@solana/web3.js": "^1.95.2", - "@zetachain/protocol-contracts": "10.0.0-rc11", - "@zetachain/toolkit": "13.0.0-rc5" + "@zetachain/protocol-contracts": "11.0.0-rc3", + "@zetachain/toolkit": "13.0.0-rc8" } } diff --git a/examples/swap/scripts/localnet.sh b/examples/swap/scripts/localnet.sh new file mode 100755 index 00000000..9867ddef --- /dev/null +++ b/examples/swap/scripts/localnet.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +set -e + +if [ "$1" = "start" ]; then npx hardhat localnet --exit-on-error & sleep 10; fi + +echo -e "\nšŸš€ Compiling contracts..." +npx hardhat compile --force --quiet + +ZRC20_ETHEREUM=$(jq -r '.addresses[] | select(.type=="ZRC-20 ETH on 5") | .address' localnet.json) +ZRC20_USDC=$(jq -r '.addresses[] | select(.type=="ZRC-20 USDC on 97") | .address' localnet.json) +GATEWAY_ETHEREUM=$(jq -r '.addresses[] | select(.type=="gatewayEVM" and .chain=="ethereum") | .address' localnet.json) +GATEWAY_ZETACHAIN=$(jq -r '.addresses[] | select(.type=="gatewayZEVM" and .chain=="zetachain") | .address' localnet.json) +UNISWAP_ROUTER=$(jq -r '.addresses[] | select(.type=="uniswapRouterInstance" and .chain=="zetachain") | .address' localnet.json) +SENDER=0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 + +CONTRACT_ZETACHAIN=$(npx hardhat deploy --name Swap --network localhost --gateway "$GATEWAY_ZETACHAIN" --uniswap-router "$UNISWAP_ROUTER" --json | jq -r '.contractAddress') +echo -e "\nšŸš€ Deployed contract on ZetaChain: $CONTRACT_ZETACHAIN" + +npx hardhat swap-from-evm \ + --network localhost \ + --receiver "$CONTRACT_ZETACHAIN" \ + --amount 1 \ + --target "$ZRC20_USDC" \ + --recipient "$SENDER" + +if [ "$1" = "start" ]; then npx hardhat localnet-stop; fi \ No newline at end of file diff --git a/examples/swap/scripts/test.sh b/examples/swap/scripts/test.sh deleted file mode 100755 index c61c80c0..00000000 --- a/examples/swap/scripts/test.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -set -e - -if [ "$1" = "localnet" ]; then - npx hardhat localnet --exit-on-error & sleep 10 -fi - -yarn deploy:localnet - -npx hardhat swap-from-evm --network localhost --receiver 0x84eA74d481Ee0A5332c457a4d796187F6Ba67fEB --amount 1 --target 0x9fd96203f7b22bCF72d9DCb40ff98302376cE09c --recipient 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 - -npx hardhat localnet-check - -npx hardhat swap-from-evm --network localhost --receiver 0x84eA74d481Ee0A5332c457a4d796187F6Ba67fEB --amount 1 --target 0x2ca7d64A7EFE2D62A725E2B35Cf7230D6677FfEe --recipient 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 --erc20 0x0B306BF915C4d645ff596e518fAf3F9669b97016 - -npx hardhat localnet-stop \ No newline at end of file diff --git a/examples/swap/tasks/deploy.ts b/examples/swap/tasks/deploy.ts index 7d6b5bc6..8475d31e 100644 --- a/examples/swap/tasks/deploy.ts +++ b/examples/swap/tasks/deploy.ts @@ -13,13 +13,20 @@ const main = async (args: any, hre: HardhatRuntimeEnvironment) => { const factory = await hre.ethers.getContractFactory(args.name); const contract = await (factory as any).deploy( - args.systemContract, - args.gateway + args.gateway, + args.uniswapRouter ); await contract.deployed(); if (args.json) { - console.log(JSON.stringify(contract)); + console.log( + JSON.stringify({ + contractAddress: contract.address, + deployer: signer.address, + network: network, + transactionHash: contract.deployTransaction.hash, + }) + ); } else { console.log(`šŸ”‘ Using account: ${signer.address} @@ -32,13 +39,9 @@ const main = async (args: any, hre: HardhatRuntimeEnvironment) => { task("deploy", "Deploy the contract", main) .addFlag("json", "Output in JSON") .addOptionalParam("name", "Contract to deploy", "Swap") - .addOptionalParam( - "systemContract", - "System contract", - "0xA51c1fc2f0D1a1b8494Ed1FE312d7C3a78Ed91C0" - ) + .addOptionalParam("uniswapRouter", "Uniswap v2 Router address") .addOptionalParam( "gateway", "Gateway address (default: ZetaChain Gateway)", - "0x9A676e781A523b5d0C0e43731313A708CB607508" + "0x6c533f7fe93fae114d0954697069df33c9b74fd7" ); diff --git a/examples/swap/tasks/swapFromEVM.ts b/examples/swap/tasks/swapFromEVM.ts index 6aae193b..2c5f745f 100644 --- a/examples/swap/tasks/swapFromEVM.ts +++ b/examples/swap/tasks/swapFromEVM.ts @@ -42,7 +42,7 @@ task("swap-from-evm", "Swap tokens from EVM", evmDepositAndCall) .addOptionalParam( "gatewayEvm", "contract address of gateway on EVM", - "0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0" + "0x610178dA211FEF7D417bC0e6FeD39F05609AD788" ) .addFlag("callOnRevert", "Whether to call on revert") .addOptionalParam( diff --git a/examples/swap/yarn.lock b/examples/swap/yarn.lock index 07a925f2..03c511d8 100644 --- a/examples/swap/yarn.lock +++ b/examples/swap/yarn.lock @@ -136,7 +136,22 @@ "@ethersproject/properties" "^5.4.0" "@ethersproject/strings" "^5.4.0" -"@ethersproject/abi@5.7.0", "@ethersproject/abi@^5.0.9", "@ethersproject/abi@^5.1.2", "@ethersproject/abi@^5.4.0", "@ethersproject/abi@^5.4.7", "@ethersproject/abi@^5.7.0": +"@ethersproject/abi@5.6.3": + version "5.6.3" + resolved "https://registry.yarnpkg.com/@ethersproject/abi/-/abi-5.6.3.tgz#2d643544abadf6e6b63150508af43475985c23db" + integrity sha512-CxKTdoZY4zDJLWXG6HzNH6znWK0M79WzzxHegDoecE3+K32pzfHOzuXg2/oGSTecZynFgpkjYXNPOqXVJlqClw== + dependencies: + "@ethersproject/address" "^5.6.1" + "@ethersproject/bignumber" "^5.6.2" + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/constants" "^5.6.1" + "@ethersproject/hash" "^5.6.1" + "@ethersproject/keccak256" "^5.6.1" + "@ethersproject/logger" "^5.6.0" + "@ethersproject/properties" "^5.6.0" + "@ethersproject/strings" "^5.6.1" + +"@ethersproject/abi@5.7.0", "@ethersproject/abi@^5.0.9", "@ethersproject/abi@^5.1.2", "@ethersproject/abi@^5.4.0", "@ethersproject/abi@^5.4.7", "@ethersproject/abi@^5.6.3", "@ethersproject/abi@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/abi/-/abi-5.7.0.tgz#b3f3e045bbbeed1af3947335c247ad625a44e449" integrity sha512-351ktp42TiRcYB3H1OP8yajPeAQstMW/yCFokj/AthP9bLHzQFPlOrxOcwYEDkUAICmOHljvN4K39OMTMUa9RA== @@ -164,7 +179,20 @@ "@ethersproject/transactions" "^5.4.0" "@ethersproject/web" "^5.4.0" -"@ethersproject/abstract-provider@5.7.0", "@ethersproject/abstract-provider@^5.4.0", "@ethersproject/abstract-provider@^5.7.0": +"@ethersproject/abstract-provider@5.6.1": + version "5.6.1" + resolved "https://registry.yarnpkg.com/@ethersproject/abstract-provider/-/abstract-provider-5.6.1.tgz#02ddce150785caf0c77fe036a0ebfcee61878c59" + integrity sha512-BxlIgogYJtp1FS8Muvj8YfdClk3unZH0vRMVX791Z9INBNT/kuACZ9GzaY1Y4yFq+YSy6/w4gzj3HCRKrK9hsQ== + dependencies: + "@ethersproject/bignumber" "^5.6.2" + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/logger" "^5.6.0" + "@ethersproject/networks" "^5.6.3" + "@ethersproject/properties" "^5.6.0" + "@ethersproject/transactions" "^5.6.2" + "@ethersproject/web" "^5.6.1" + +"@ethersproject/abstract-provider@5.7.0", "@ethersproject/abstract-provider@^5.4.0", "@ethersproject/abstract-provider@^5.6.1", "@ethersproject/abstract-provider@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/abstract-provider/-/abstract-provider-5.7.0.tgz#b0a8550f88b6bf9d51f90e4795d48294630cb9ef" integrity sha512-R41c9UkchKCpAqStMYUpdunjo3pkEvZC3FAwZn5S5MGbXoMQOHIdHItezTETxAO5bevtMApSyEhn9+CHcDsWBw== @@ -188,7 +216,18 @@ "@ethersproject/logger" "^5.4.0" "@ethersproject/properties" "^5.4.0" -"@ethersproject/abstract-signer@5.7.0", "@ethersproject/abstract-signer@^5.4.0", "@ethersproject/abstract-signer@^5.7.0": +"@ethersproject/abstract-signer@5.6.2": + version "5.6.2" + resolved "https://registry.yarnpkg.com/@ethersproject/abstract-signer/-/abstract-signer-5.6.2.tgz#491f07fc2cbd5da258f46ec539664713950b0b33" + integrity sha512-n1r6lttFBG0t2vNiI3HoWaS/KdOt8xyDjzlP2cuevlWLG6EX0OwcKLyG/Kp/cuwNxdy/ous+R/DEMdTUwWQIjQ== + dependencies: + "@ethersproject/abstract-provider" "^5.6.1" + "@ethersproject/bignumber" "^5.6.2" + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/logger" "^5.6.0" + "@ethersproject/properties" "^5.6.0" + +"@ethersproject/abstract-signer@5.7.0", "@ethersproject/abstract-signer@^5.4.0", "@ethersproject/abstract-signer@^5.6.2", "@ethersproject/abstract-signer@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/abstract-signer/-/abstract-signer-5.7.0.tgz#13f4f32117868452191a4649723cb086d2b596b2" integrity sha512-a16V8bq1/Cz+TGCkE2OPMTOUDLS3grCpdjoJCYNnVBbdYEMSgKrU0+B90s8b6H+ByYTBZN7a3g76jdIJi7UfKQ== @@ -210,7 +249,18 @@ "@ethersproject/logger" "^5.4.0" "@ethersproject/rlp" "^5.4.0" -"@ethersproject/address@5.7.0", "@ethersproject/address@^5.0.2", "@ethersproject/address@^5.4.0", "@ethersproject/address@^5.7.0": +"@ethersproject/address@5.6.1": + version "5.6.1" + resolved "https://registry.yarnpkg.com/@ethersproject/address/-/address-5.6.1.tgz#ab57818d9aefee919c5721d28cd31fd95eff413d" + integrity sha512-uOgF0kS5MJv9ZvCz7x6T2EXJSzotiybApn4XlOgoTX0xdtyVIJ7pF+6cGPxiEq/dpBiTfMiw7Yc81JcwhSYA0Q== + dependencies: + "@ethersproject/bignumber" "^5.6.2" + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/keccak256" "^5.6.1" + "@ethersproject/logger" "^5.6.0" + "@ethersproject/rlp" "^5.6.1" + +"@ethersproject/address@5.7.0", "@ethersproject/address@^5.0.2", "@ethersproject/address@^5.4.0", "@ethersproject/address@^5.6.1", "@ethersproject/address@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/address/-/address-5.7.0.tgz#19b56c4d74a3b0a46bfdbb6cfcc0a153fc697f37" integrity sha512-9wYhYt7aghVGo758POM5nqcOMaE168Q6aRLJZwUmiqSrAungkG74gSSeKEIR7ukixesdRZGPgVqme6vmxs1fkA== @@ -228,7 +278,14 @@ dependencies: "@ethersproject/bytes" "^5.4.0" -"@ethersproject/base64@5.7.0", "@ethersproject/base64@^5.4.0", "@ethersproject/base64@^5.7.0": +"@ethersproject/base64@5.6.1": + version "5.6.1" + resolved "https://registry.yarnpkg.com/@ethersproject/base64/-/base64-5.6.1.tgz#2c40d8a0310c9d1606c2c37ae3092634b41d87cb" + integrity sha512-qB76rjop6a0RIYYMiB4Eh/8n+Hxu2NIZm8S/Q7kNo5pmZfXhHGHmS4MinUainiBC54SCyRnwzL+KZjj8zbsSsw== + dependencies: + "@ethersproject/bytes" "^5.6.1" + +"@ethersproject/base64@5.7.0", "@ethersproject/base64@^5.4.0", "@ethersproject/base64@^5.6.1", "@ethersproject/base64@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/base64/-/base64-5.7.0.tgz#ac4ee92aa36c1628173e221d0d01f53692059e1c" integrity sha512-Dr8tcHt2mEbsZr/mwTPIQAf3Ai0Bks/7gTw9dSqk1mQvhW3XvRlmDJr/4n+wg1JmCl16NZue17CDh8xb/vZ0sQ== @@ -243,7 +300,15 @@ "@ethersproject/bytes" "^5.4.0" "@ethersproject/properties" "^5.4.0" -"@ethersproject/basex@5.7.0", "@ethersproject/basex@^5.4.0", "@ethersproject/basex@^5.7.0": +"@ethersproject/basex@5.6.1": + version "5.6.1" + resolved "https://registry.yarnpkg.com/@ethersproject/basex/-/basex-5.6.1.tgz#badbb2f1d4a6f52ce41c9064f01eab19cc4c5305" + integrity sha512-a52MkVz4vuBXR06nvflPMotld1FJWSj2QT0985v7P/emPZO00PucFAkbcmq2vpVU7Ts7umKiSI6SppiLykVWsA== + dependencies: + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/properties" "^5.6.0" + +"@ethersproject/basex@5.7.0", "@ethersproject/basex@^5.4.0", "@ethersproject/basex@^5.6.1", "@ethersproject/basex@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/basex/-/basex-5.7.0.tgz#97034dc7e8938a8ca943ab20f8a5e492ece4020b" integrity sha512-ywlh43GwZLv2Voc2gQVTKBoVQ1mti3d8HK5aMxsfu/nRDnMmNqaSJ3r3n85HBByT8OpoY96SXM1FogC533T4zw== @@ -260,7 +325,16 @@ "@ethersproject/logger" "^5.4.0" bn.js "^4.11.9" -"@ethersproject/bignumber@5.7.0", "@ethersproject/bignumber@^5.4.0", "@ethersproject/bignumber@^5.7.0": +"@ethersproject/bignumber@5.6.2": + version "5.6.2" + resolved "https://registry.yarnpkg.com/@ethersproject/bignumber/-/bignumber-5.6.2.tgz#72a0717d6163fab44c47bcc82e0c550ac0315d66" + integrity sha512-v7+EEUbhGqT3XJ9LMPsKvXYHFc8eHxTowFCG/HgJErmq4XHJ2WR7aeyICg3uTOAQ7Icn0GFHAohXEhxQHq4Ubw== + dependencies: + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/logger" "^5.6.0" + bn.js "^5.2.1" + +"@ethersproject/bignumber@5.7.0", "@ethersproject/bignumber@^5.4.0", "@ethersproject/bignumber@^5.6.2", "@ethersproject/bignumber@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/bignumber/-/bignumber-5.7.0.tgz#e2f03837f268ba655ffba03a57853e18a18dc9c2" integrity sha512-n1CAdIHRWjSucQO3MC1zPSVgV/6dy/fjL9pMrPP9peL+QxEg9wOsVqwD4+818B6LUEtaXzVHQiuivzRoxPxUGw== @@ -276,7 +350,14 @@ dependencies: "@ethersproject/logger" "^5.4.0" -"@ethersproject/bytes@5.7.0", "@ethersproject/bytes@^5.4.0", "@ethersproject/bytes@^5.7.0": +"@ethersproject/bytes@5.6.1": + version "5.6.1" + resolved "https://registry.yarnpkg.com/@ethersproject/bytes/-/bytes-5.6.1.tgz#24f916e411f82a8a60412344bf4a813b917eefe7" + integrity sha512-NwQt7cKn5+ZE4uDn+X5RAXLp46E1chXoaMmrxAyA0rblpxz8t58lVkrHXoRIn0lz1joQElQ8410GqhTqMOwc6g== + dependencies: + "@ethersproject/logger" "^5.6.0" + +"@ethersproject/bytes@5.7.0", "@ethersproject/bytes@^5.4.0", "@ethersproject/bytes@^5.6.1", "@ethersproject/bytes@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/bytes/-/bytes-5.7.0.tgz#a00f6ea8d7e7534d6d87f47188af1148d71f155d" integrity sha512-nsbxwgFXWh9NyYWo+U8atvmMsSdKJprTcICAkvbBffT75qDocbuggBU0SJiVK2MuTrp0q+xvLkTnGMPK1+uA9A== @@ -290,7 +371,14 @@ dependencies: "@ethersproject/bignumber" "^5.4.0" -"@ethersproject/constants@5.7.0", "@ethersproject/constants@^5.4.0", "@ethersproject/constants@^5.7.0": +"@ethersproject/constants@5.6.1": + version "5.6.1" + resolved "https://registry.yarnpkg.com/@ethersproject/constants/-/constants-5.6.1.tgz#e2e974cac160dd101cf79fdf879d7d18e8cb1370" + integrity sha512-QSq9WVnZbxXYFftrjSjZDUshp6/eKp6qrtdBtUCm0QxCV5z1fG/w3kdlcsjMCQuQHUnAclKoK7XpXMezhRDOLg== + dependencies: + "@ethersproject/bignumber" "^5.6.2" + +"@ethersproject/constants@5.7.0", "@ethersproject/constants@^5.4.0", "@ethersproject/constants@^5.6.1", "@ethersproject/constants@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/constants/-/constants-5.7.0.tgz#df80a9705a7e08984161f09014ea012d1c75295e" integrity sha512-DHI+y5dBNvkpYUMiRQyxRBYBefZkJfo70VUkUAsRjcPs47muV9evftfZ0PJVCXYbAiCgght0DtcF9srFQmIgWA== @@ -313,6 +401,22 @@ "@ethersproject/properties" "^5.4.0" "@ethersproject/transactions" "^5.4.0" +"@ethersproject/contracts@5.6.2": + version "5.6.2" + resolved "https://registry.yarnpkg.com/@ethersproject/contracts/-/contracts-5.6.2.tgz#20b52e69ebc1b74274ff8e3d4e508de971c287bc" + integrity sha512-hguUA57BIKi6WY0kHvZp6PwPlWF87MCeB4B7Z7AbUpTxfFXFdn/3b0GmjZPagIHS+3yhcBJDnuEfU4Xz+Ks/8g== + dependencies: + "@ethersproject/abi" "^5.6.3" + "@ethersproject/abstract-provider" "^5.6.1" + "@ethersproject/abstract-signer" "^5.6.2" + "@ethersproject/address" "^5.6.1" + "@ethersproject/bignumber" "^5.6.2" + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/constants" "^5.6.1" + "@ethersproject/logger" "^5.6.0" + "@ethersproject/properties" "^5.6.0" + "@ethersproject/transactions" "^5.6.2" + "@ethersproject/contracts@5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/contracts/-/contracts-5.7.0.tgz#c305e775abd07e48aa590e1a877ed5c316f8bd1e" @@ -343,7 +447,21 @@ "@ethersproject/properties" "^5.4.0" "@ethersproject/strings" "^5.4.0" -"@ethersproject/hash@5.7.0", "@ethersproject/hash@^5.4.0", "@ethersproject/hash@^5.7.0": +"@ethersproject/hash@5.6.1": + version "5.6.1" + resolved "https://registry.yarnpkg.com/@ethersproject/hash/-/hash-5.6.1.tgz#224572ea4de257f05b4abf8ae58b03a67e99b0f4" + integrity sha512-L1xAHurbaxG8VVul4ankNX5HgQ8PNCTrnVXEiFnE9xoRnaUcgfD12tZINtDinSllxPLCtGwguQxJ5E6keE84pA== + dependencies: + "@ethersproject/abstract-signer" "^5.6.2" + "@ethersproject/address" "^5.6.1" + "@ethersproject/bignumber" "^5.6.2" + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/keccak256" "^5.6.1" + "@ethersproject/logger" "^5.6.0" + "@ethersproject/properties" "^5.6.0" + "@ethersproject/strings" "^5.6.1" + +"@ethersproject/hash@5.7.0", "@ethersproject/hash@^5.4.0", "@ethersproject/hash@^5.6.1", "@ethersproject/hash@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/hash/-/hash-5.7.0.tgz#eb7aca84a588508369562e16e514b539ba5240a7" integrity sha512-qX5WrQfnah1EFnO5zJv1v46a8HW0+E5xuBBDTwMFZLuVTx0tbU2kkx15NqdjxecrLGatQN9FGQKpb1FKdHCt+g== @@ -376,7 +494,25 @@ "@ethersproject/transactions" "^5.4.0" "@ethersproject/wordlists" "^5.4.0" -"@ethersproject/hdnode@5.7.0", "@ethersproject/hdnode@^5.4.0", "@ethersproject/hdnode@^5.7.0": +"@ethersproject/hdnode@5.6.2": + version "5.6.2" + resolved "https://registry.yarnpkg.com/@ethersproject/hdnode/-/hdnode-5.6.2.tgz#26f3c83a3e8f1b7985c15d1db50dc2903418b2d2" + integrity sha512-tERxW8Ccf9CxW2db3WsN01Qao3wFeRsfYY9TCuhmG0xNpl2IO8wgXU3HtWIZ49gUWPggRy4Yg5axU0ACaEKf1Q== + dependencies: + "@ethersproject/abstract-signer" "^5.6.2" + "@ethersproject/basex" "^5.6.1" + "@ethersproject/bignumber" "^5.6.2" + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/logger" "^5.6.0" + "@ethersproject/pbkdf2" "^5.6.1" + "@ethersproject/properties" "^5.6.0" + "@ethersproject/sha2" "^5.6.1" + "@ethersproject/signing-key" "^5.6.2" + "@ethersproject/strings" "^5.6.1" + "@ethersproject/transactions" "^5.6.2" + "@ethersproject/wordlists" "^5.6.1" + +"@ethersproject/hdnode@5.7.0", "@ethersproject/hdnode@^5.4.0", "@ethersproject/hdnode@^5.6.2", "@ethersproject/hdnode@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/hdnode/-/hdnode-5.7.0.tgz#e627ddc6b466bc77aebf1a6b9e47405ca5aef9cf" integrity sha512-OmyYo9EENBPPf4ERhR7oj6uAtUAhYGqOnIS+jE5pTXvdKBS99ikzq1E7Iv0ZQZ5V36Lqx1qZLeak0Ra16qpeOg== @@ -413,7 +549,26 @@ aes-js "3.0.0" scrypt-js "3.0.1" -"@ethersproject/json-wallets@5.7.0", "@ethersproject/json-wallets@^5.4.0", "@ethersproject/json-wallets@^5.7.0": +"@ethersproject/json-wallets@5.6.1": + version "5.6.1" + resolved "https://registry.yarnpkg.com/@ethersproject/json-wallets/-/json-wallets-5.6.1.tgz#3f06ba555c9c0d7da46756a12ac53483fe18dd91" + integrity sha512-KfyJ6Zwz3kGeX25nLihPwZYlDqamO6pfGKNnVMWWfEVVp42lTfCZVXXy5Ie8IZTN0HKwAngpIPi7gk4IJzgmqQ== + dependencies: + "@ethersproject/abstract-signer" "^5.6.2" + "@ethersproject/address" "^5.6.1" + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/hdnode" "^5.6.2" + "@ethersproject/keccak256" "^5.6.1" + "@ethersproject/logger" "^5.6.0" + "@ethersproject/pbkdf2" "^5.6.1" + "@ethersproject/properties" "^5.6.0" + "@ethersproject/random" "^5.6.1" + "@ethersproject/strings" "^5.6.1" + "@ethersproject/transactions" "^5.6.2" + aes-js "3.0.0" + scrypt-js "3.0.1" + +"@ethersproject/json-wallets@5.7.0", "@ethersproject/json-wallets@^5.4.0", "@ethersproject/json-wallets@^5.6.1", "@ethersproject/json-wallets@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/json-wallets/-/json-wallets-5.7.0.tgz#5e3355287b548c32b368d91014919ebebddd5360" integrity sha512-8oee5Xgu6+RKgJTkvEMl2wDgSPSAQ9MB/3JYjFV9jlKvcYHUXZC+cQp0njgmxdHkYWn8s6/IqIZYm0YWCjO/0g== @@ -440,7 +595,15 @@ "@ethersproject/bytes" "^5.4.0" js-sha3 "0.5.7" -"@ethersproject/keccak256@5.7.0", "@ethersproject/keccak256@^5.4.0", "@ethersproject/keccak256@^5.7.0": +"@ethersproject/keccak256@5.6.1": + version "5.6.1" + resolved "https://registry.yarnpkg.com/@ethersproject/keccak256/-/keccak256-5.6.1.tgz#b867167c9b50ba1b1a92bccdd4f2d6bd168a91cc" + integrity sha512-bB7DQHCTRDooZZdL3lk9wpL0+XuG3XLGHLh3cePnybsO3V0rdCAOQGpn/0R3aODmnTOOkCATJiD2hnL+5bwthA== + dependencies: + "@ethersproject/bytes" "^5.6.1" + js-sha3 "0.8.0" + +"@ethersproject/keccak256@5.7.0", "@ethersproject/keccak256@^5.4.0", "@ethersproject/keccak256@^5.6.1", "@ethersproject/keccak256@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/keccak256/-/keccak256-5.7.0.tgz#3186350c6e1cd6aba7940384ec7d6d9db01f335a" integrity sha512-2UcPboeL/iW+pSg6vZ6ydF8tCnv3Iu/8tUmLLzWWGzxWKFFqOBQFLo6uLUv6BDrLgCDfN28RJ/wtByx+jZ4KBg== @@ -453,7 +616,12 @@ resolved "https://registry.yarnpkg.com/@ethersproject/logger/-/logger-5.4.1.tgz#503bd33683538b923c578c07d1c2c0dd18672054" integrity sha512-DZ+bRinnYLPw1yAC64oRl0QyVZj43QeHIhVKfD/+YwSz4wsv1pfwb5SOFjz+r710YEWzU6LrhuSjpSO+6PeE4A== -"@ethersproject/logger@5.7.0", "@ethersproject/logger@^5.4.0", "@ethersproject/logger@^5.7.0": +"@ethersproject/logger@5.6.0": + version "5.6.0" + resolved "https://registry.yarnpkg.com/@ethersproject/logger/-/logger-5.6.0.tgz#d7db1bfcc22fd2e4ab574cba0bb6ad779a9a3e7a" + integrity sha512-BiBWllUROH9w+P21RzoxJKzqoqpkyM1pRnEKG69bulE9TSQD8SAIvTQqIMZmmCO8pUNkgLP1wndX1gKghSpBmg== + +"@ethersproject/logger@5.7.0", "@ethersproject/logger@^5.4.0", "@ethersproject/logger@^5.6.0", "@ethersproject/logger@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/logger/-/logger-5.7.0.tgz#6ce9ae168e74fecf287be17062b590852c311892" integrity sha512-0odtFdXu/XHtjQXJYA3u9G0G8btm0ND5Cu8M7i5vhEcE8/HmF4Lbdqanwyv4uQTr2tx6b7fQRmgLrsnpQlmnig== @@ -465,7 +633,14 @@ dependencies: "@ethersproject/logger" "^5.4.0" -"@ethersproject/networks@5.7.1", "@ethersproject/networks@^5.4.0", "@ethersproject/networks@^5.7.0": +"@ethersproject/networks@5.6.3": + version "5.6.3" + resolved "https://registry.yarnpkg.com/@ethersproject/networks/-/networks-5.6.3.tgz#3ee3ab08f315b433b50c99702eb32e0cf31f899f" + integrity sha512-QZxRH7cA5Ut9TbXwZFiCyuPchdWi87ZtVNHWZd0R6YFgYtes2jQ3+bsslJ0WdyDe0i6QumqtoYqvY3rrQFRZOQ== + dependencies: + "@ethersproject/logger" "^5.6.0" + +"@ethersproject/networks@5.7.1", "@ethersproject/networks@^5.4.0", "@ethersproject/networks@^5.6.3", "@ethersproject/networks@^5.7.0": version "5.7.1" resolved "https://registry.yarnpkg.com/@ethersproject/networks/-/networks-5.7.1.tgz#118e1a981d757d45ccea6bb58d9fd3d9db14ead6" integrity sha512-n/MufjFYv3yFcUyfhnXotyDlNdFb7onmkSy8aQERi2PjNcnWQ66xXxa3XlS8nCcA8aJKJjIIMNJTC7tu80GwpQ== @@ -480,7 +655,15 @@ "@ethersproject/bytes" "^5.4.0" "@ethersproject/sha2" "^5.4.0" -"@ethersproject/pbkdf2@5.7.0", "@ethersproject/pbkdf2@^5.4.0", "@ethersproject/pbkdf2@^5.7.0": +"@ethersproject/pbkdf2@5.6.1": + version "5.6.1" + resolved "https://registry.yarnpkg.com/@ethersproject/pbkdf2/-/pbkdf2-5.6.1.tgz#f462fe320b22c0d6b1d72a9920a3963b09eb82d1" + integrity sha512-k4gRQ+D93zDRPNUfmduNKq065uadC2YjMP/CqwwX5qG6R05f47boq6pLZtV/RnC4NZAYOPH1Cyo54q0c9sshRQ== + dependencies: + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/sha2" "^5.6.1" + +"@ethersproject/pbkdf2@5.7.0", "@ethersproject/pbkdf2@^5.4.0", "@ethersproject/pbkdf2@^5.6.1", "@ethersproject/pbkdf2@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/pbkdf2/-/pbkdf2-5.7.0.tgz#d2267d0a1f6e123f3771007338c47cccd83d3102" integrity sha512-oR/dBRZR6GTyaofd86DehG72hY6NpAjhabkhxgr3X2FpJtJuodEl2auADWBZfhDHgVCbu3/H/Ocq2uC6dpNjjw== @@ -495,7 +678,14 @@ dependencies: "@ethersproject/logger" "^5.4.0" -"@ethersproject/properties@5.7.0", "@ethersproject/properties@^5.4.0", "@ethersproject/properties@^5.7.0": +"@ethersproject/properties@5.6.0": + version "5.6.0" + resolved "https://registry.yarnpkg.com/@ethersproject/properties/-/properties-5.6.0.tgz#38904651713bc6bdd5bdd1b0a4287ecda920fa04" + integrity sha512-szoOkHskajKePTJSZ46uHUWWkbv7TzP2ypdEK6jGMqJaEt2sb0jCgfBo0gH0m2HBpRixMuJ6TBRaQCF7a9DoCg== + dependencies: + "@ethersproject/logger" "^5.6.0" + +"@ethersproject/properties@5.7.0", "@ethersproject/properties@^5.4.0", "@ethersproject/properties@^5.6.0", "@ethersproject/properties@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/properties/-/properties-5.7.0.tgz#a6e12cb0439b878aaf470f1902a176033067ed30" integrity sha512-J87jy8suntrAkIZtecpxEPxY//szqr1mlBaYlQ0r4RCaiD2hjheqF9s1LVE8vVuJCXisjIP+JgtK/Do54ej4Sw== @@ -527,6 +717,32 @@ bech32 "1.1.4" ws "7.4.6" +"@ethersproject/providers@5.6.8": + version "5.6.8" + resolved "https://registry.yarnpkg.com/@ethersproject/providers/-/providers-5.6.8.tgz#22e6c57be215ba5545d3a46cf759d265bb4e879d" + integrity sha512-Wf+CseT/iOJjrGtAOf3ck9zS7AgPmr2fZ3N97r4+YXN3mBePTG2/bJ8DApl9mVwYL+RpYbNxMEkEp4mPGdwG/w== + dependencies: + "@ethersproject/abstract-provider" "^5.6.1" + "@ethersproject/abstract-signer" "^5.6.2" + "@ethersproject/address" "^5.6.1" + "@ethersproject/base64" "^5.6.1" + "@ethersproject/basex" "^5.6.1" + "@ethersproject/bignumber" "^5.6.2" + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/constants" "^5.6.1" + "@ethersproject/hash" "^5.6.1" + "@ethersproject/logger" "^5.6.0" + "@ethersproject/networks" "^5.6.3" + "@ethersproject/properties" "^5.6.0" + "@ethersproject/random" "^5.6.1" + "@ethersproject/rlp" "^5.6.1" + "@ethersproject/sha2" "^5.6.1" + "@ethersproject/strings" "^5.6.1" + "@ethersproject/transactions" "^5.6.2" + "@ethersproject/web" "^5.6.1" + bech32 "1.1.4" + ws "7.4.6" + "@ethersproject/providers@5.7.2", "@ethersproject/providers@^5.4.7": version "5.7.2" resolved "https://registry.yarnpkg.com/@ethersproject/providers/-/providers-5.7.2.tgz#f8b1a4f275d7ce58cf0a2eec222269a08beb18cb" @@ -561,7 +777,15 @@ "@ethersproject/bytes" "^5.4.0" "@ethersproject/logger" "^5.4.0" -"@ethersproject/random@5.7.0", "@ethersproject/random@^5.4.0", "@ethersproject/random@^5.7.0": +"@ethersproject/random@5.6.1": + version "5.6.1" + resolved "https://registry.yarnpkg.com/@ethersproject/random/-/random-5.6.1.tgz#66915943981bcd3e11bbd43733f5c3ba5a790255" + integrity sha512-/wtPNHwbmng+5yi3fkipA8YBT59DdkGRoC2vWk09Dci/q5DlgnMkhIycjHlavrvrjJBkFjO/ueLyT+aUDfc4lA== + dependencies: + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/logger" "^5.6.0" + +"@ethersproject/random@5.7.0", "@ethersproject/random@^5.4.0", "@ethersproject/random@^5.6.1", "@ethersproject/random@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/random/-/random-5.7.0.tgz#af19dcbc2484aae078bb03656ec05df66253280c" integrity sha512-19WjScqRA8IIeWclFme75VMXSBvi4e6InrUNuaR4s5pTF2qNhcGdCUwdxUVGtDDqC00sDLCO93jPQoDUH4HVmQ== @@ -577,7 +801,15 @@ "@ethersproject/bytes" "^5.4.0" "@ethersproject/logger" "^5.4.0" -"@ethersproject/rlp@5.7.0", "@ethersproject/rlp@^5.4.0", "@ethersproject/rlp@^5.7.0": +"@ethersproject/rlp@5.6.1": + version "5.6.1" + resolved "https://registry.yarnpkg.com/@ethersproject/rlp/-/rlp-5.6.1.tgz#df8311e6f9f24dcb03d59a2bac457a28a4fe2bd8" + integrity sha512-uYjmcZx+DKlFUk7a5/W9aQVaoEC7+1MOBgNtvNg13+RnuUwT4F0zTovC0tmay5SmRslb29V1B7Y5KCri46WhuQ== + dependencies: + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/logger" "^5.6.0" + +"@ethersproject/rlp@5.7.0", "@ethersproject/rlp@^5.4.0", "@ethersproject/rlp@^5.6.1", "@ethersproject/rlp@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/rlp/-/rlp-5.7.0.tgz#de39e4d5918b9d74d46de93af80b7685a9c21304" integrity sha512-rBxzX2vK8mVF7b0Tol44t5Tb8gomOHkj5guL+HhzQ1yBh/ydjGnpw6at+X6Iw0Kp3OzzzkcKp8N9r0W4kYSs9w== @@ -594,7 +826,16 @@ "@ethersproject/logger" "^5.4.0" hash.js "1.1.7" -"@ethersproject/sha2@5.7.0", "@ethersproject/sha2@^5.4.0", "@ethersproject/sha2@^5.7.0": +"@ethersproject/sha2@5.6.1": + version "5.6.1" + resolved "https://registry.yarnpkg.com/@ethersproject/sha2/-/sha2-5.6.1.tgz#211f14d3f5da5301c8972a8827770b6fd3e51656" + integrity sha512-5K2GyqcW7G4Yo3uenHegbXRPDgARpWUiXc6RiF7b6i/HXUoWlb7uCARh7BAHg7/qT/Q5ydofNwiZcim9qpjB6g== + dependencies: + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/logger" "^5.6.0" + hash.js "1.1.7" + +"@ethersproject/sha2@5.7.0", "@ethersproject/sha2@^5.4.0", "@ethersproject/sha2@^5.6.1", "@ethersproject/sha2@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/sha2/-/sha2-5.7.0.tgz#9a5f7a7824ef784f7f7680984e593a800480c9fb" integrity sha512-gKlH42riwb3KYp0reLsFTokByAKoJdgFCwI+CCiX/k+Jm2mbNs6oOaCjYQSlI1+XBVejwH2KrmCbMAT/GnRDQw== @@ -615,7 +856,19 @@ elliptic "6.5.4" hash.js "1.1.7" -"@ethersproject/signing-key@5.7.0", "@ethersproject/signing-key@^5.4.0", "@ethersproject/signing-key@^5.7.0": +"@ethersproject/signing-key@5.6.2": + version "5.6.2" + resolved "https://registry.yarnpkg.com/@ethersproject/signing-key/-/signing-key-5.6.2.tgz#8a51b111e4d62e5a62aee1da1e088d12de0614a3" + integrity sha512-jVbu0RuP7EFpw82vHcL+GP35+KaNruVAZM90GxgQnGqB6crhBqW/ozBfFvdeImtmb4qPko0uxXjn8l9jpn0cwQ== + dependencies: + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/logger" "^5.6.0" + "@ethersproject/properties" "^5.6.0" + bn.js "^5.2.1" + elliptic "6.5.4" + hash.js "1.1.7" + +"@ethersproject/signing-key@5.7.0", "@ethersproject/signing-key@^5.4.0", "@ethersproject/signing-key@^5.6.2", "@ethersproject/signing-key@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/signing-key/-/signing-key-5.7.0.tgz#06b2df39411b00bc57c7c09b01d1e41cf1b16ab3" integrity sha512-MZdy2nL3wO0u7gkB4nA/pEf8lu1TlFswPNmy8AiYkfKTdO6eXBJyUdmHO/ehm/htHw9K/qF8ujnTyUAD+Ry54Q== @@ -638,6 +891,18 @@ "@ethersproject/sha2" "^5.4.0" "@ethersproject/strings" "^5.4.0" +"@ethersproject/solidity@5.6.1": + version "5.6.1" + resolved "https://registry.yarnpkg.com/@ethersproject/solidity/-/solidity-5.6.1.tgz#5845e71182c66d32e6ec5eefd041fca091a473e2" + integrity sha512-KWqVLkUUoLBfL1iwdzUVlkNqAUIFMpbbeH0rgCfKmJp0vFtY4AsaN91gHKo9ZZLkC4UOm3cI3BmMV4N53BOq4g== + dependencies: + "@ethersproject/bignumber" "^5.6.2" + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/keccak256" "^5.6.1" + "@ethersproject/logger" "^5.6.0" + "@ethersproject/sha2" "^5.6.1" + "@ethersproject/strings" "^5.6.1" + "@ethersproject/solidity@5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/solidity/-/solidity-5.7.0.tgz#5e9c911d8a2acce2a5ebb48a5e2e0af20b631cb8" @@ -659,7 +924,16 @@ "@ethersproject/constants" "^5.4.0" "@ethersproject/logger" "^5.4.0" -"@ethersproject/strings@5.7.0", "@ethersproject/strings@^5.4.0", "@ethersproject/strings@^5.7.0": +"@ethersproject/strings@5.6.1": + version "5.6.1" + resolved "https://registry.yarnpkg.com/@ethersproject/strings/-/strings-5.6.1.tgz#dbc1b7f901db822b5cafd4ebf01ca93c373f8952" + integrity sha512-2X1Lgk6Jyfg26MUnsHiT456U9ijxKUybz8IM1Vih+NJxYtXhmvKBcHOmvGqpFSVJ0nQ4ZCoIViR8XlRw1v/+Cw== + dependencies: + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/constants" "^5.6.1" + "@ethersproject/logger" "^5.6.0" + +"@ethersproject/strings@5.7.0", "@ethersproject/strings@^5.4.0", "@ethersproject/strings@^5.6.1", "@ethersproject/strings@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/strings/-/strings-5.7.0.tgz#54c9d2a7c57ae8f1205c88a9d3a56471e14d5ed2" integrity sha512-/9nu+lj0YswRNSH0NXYqrh8775XNyEdUQAuf3f+SmOrnVewcJ5SBNAjF7lpgehKi4abvNNXyf+HX86czCdJ8Mg== @@ -683,7 +957,22 @@ "@ethersproject/rlp" "^5.4.0" "@ethersproject/signing-key" "^5.4.0" -"@ethersproject/transactions@5.7.0", "@ethersproject/transactions@^5.4.0", "@ethersproject/transactions@^5.7.0": +"@ethersproject/transactions@5.6.2": + version "5.6.2" + resolved "https://registry.yarnpkg.com/@ethersproject/transactions/-/transactions-5.6.2.tgz#793a774c01ced9fe7073985bb95a4b4e57a6370b" + integrity sha512-BuV63IRPHmJvthNkkt9G70Ullx6AcM+SDc+a8Aw/8Yew6YwT51TcBKEp1P4oOQ/bP25I18JJr7rcFRgFtU9B2Q== + dependencies: + "@ethersproject/address" "^5.6.1" + "@ethersproject/bignumber" "^5.6.2" + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/constants" "^5.6.1" + "@ethersproject/keccak256" "^5.6.1" + "@ethersproject/logger" "^5.6.0" + "@ethersproject/properties" "^5.6.0" + "@ethersproject/rlp" "^5.6.1" + "@ethersproject/signing-key" "^5.6.2" + +"@ethersproject/transactions@5.7.0", "@ethersproject/transactions@^5.4.0", "@ethersproject/transactions@^5.6.2", "@ethersproject/transactions@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/transactions/-/transactions-5.7.0.tgz#91318fc24063e057885a6af13fdb703e1f993d3b" integrity sha512-kmcNicCp1lp8qanMTC3RIikGgoJ80ztTyvtsFvCYpSCfkjhD0jZ2LOrnbcuxuToLIUYYf+4XwD1rP+B/erDIhQ== @@ -707,6 +996,15 @@ "@ethersproject/constants" "^5.4.0" "@ethersproject/logger" "^5.4.0" +"@ethersproject/units@5.6.1": + version "5.6.1" + resolved "https://registry.yarnpkg.com/@ethersproject/units/-/units-5.6.1.tgz#ecc590d16d37c8f9ef4e89e2005bda7ddc6a4e6f" + integrity sha512-rEfSEvMQ7obcx3KWD5EWWx77gqv54K6BKiZzKxkQJqtpriVsICrktIQmKl8ReNToPeIYPnFHpXvKpi068YFZXw== + dependencies: + "@ethersproject/bignumber" "^5.6.2" + "@ethersproject/constants" "^5.6.1" + "@ethersproject/logger" "^5.6.0" + "@ethersproject/units@5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/units/-/units-5.7.0.tgz#637b563d7e14f42deeee39245275d477aae1d8b1" @@ -737,6 +1035,27 @@ "@ethersproject/transactions" "^5.4.0" "@ethersproject/wordlists" "^5.4.0" +"@ethersproject/wallet@5.6.2": + version "5.6.2" + resolved "https://registry.yarnpkg.com/@ethersproject/wallet/-/wallet-5.6.2.tgz#cd61429d1e934681e413f4bc847a5f2f87e3a03c" + integrity sha512-lrgh0FDQPuOnHcF80Q3gHYsSUODp6aJLAdDmDV0xKCN/T7D99ta1jGVhulg3PY8wiXEngD0DfM0I2XKXlrqJfg== + dependencies: + "@ethersproject/abstract-provider" "^5.6.1" + "@ethersproject/abstract-signer" "^5.6.2" + "@ethersproject/address" "^5.6.1" + "@ethersproject/bignumber" "^5.6.2" + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/hash" "^5.6.1" + "@ethersproject/hdnode" "^5.6.2" + "@ethersproject/json-wallets" "^5.6.1" + "@ethersproject/keccak256" "^5.6.1" + "@ethersproject/logger" "^5.6.0" + "@ethersproject/properties" "^5.6.0" + "@ethersproject/random" "^5.6.1" + "@ethersproject/signing-key" "^5.6.2" + "@ethersproject/transactions" "^5.6.2" + "@ethersproject/wordlists" "^5.6.1" + "@ethersproject/wallet@5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/wallet/-/wallet-5.7.0.tgz#4e5d0790d96fe21d61d38fb40324e6c7ef350b2d" @@ -769,7 +1088,18 @@ "@ethersproject/properties" "^5.4.0" "@ethersproject/strings" "^5.4.0" -"@ethersproject/web@5.7.1", "@ethersproject/web@^5.4.0", "@ethersproject/web@^5.7.0": +"@ethersproject/web@5.6.1": + version "5.6.1" + resolved "https://registry.yarnpkg.com/@ethersproject/web/-/web-5.6.1.tgz#6e2bd3ebadd033e6fe57d072db2b69ad2c9bdf5d" + integrity sha512-/vSyzaQlNXkO1WV+RneYKqCJwualcUdx/Z3gseVovZP0wIlOFcCE1hkRhKBH8ImKbGQbMl9EAAyJFrJu7V0aqA== + dependencies: + "@ethersproject/base64" "^5.6.1" + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/logger" "^5.6.0" + "@ethersproject/properties" "^5.6.0" + "@ethersproject/strings" "^5.6.1" + +"@ethersproject/web@5.7.1", "@ethersproject/web@^5.4.0", "@ethersproject/web@^5.6.1", "@ethersproject/web@^5.7.0": version "5.7.1" resolved "https://registry.yarnpkg.com/@ethersproject/web/-/web-5.7.1.tgz#de1f285b373149bee5928f4eb7bcb87ee5fbb4ae" integrity sha512-Gueu8lSvyjBWL4cYsWsjh6MtMwM0+H4HvqFPZfB6dV8ctbP9zFAO73VG1cMWae0FLPCtz0peKPpZY8/ugJJX2w== @@ -791,7 +1121,18 @@ "@ethersproject/properties" "^5.4.0" "@ethersproject/strings" "^5.4.0" -"@ethersproject/wordlists@5.7.0", "@ethersproject/wordlists@^5.4.0", "@ethersproject/wordlists@^5.7.0": +"@ethersproject/wordlists@5.6.1": + version "5.6.1" + resolved "https://registry.yarnpkg.com/@ethersproject/wordlists/-/wordlists-5.6.1.tgz#1e78e2740a8a21e9e99947e47979d72e130aeda1" + integrity sha512-wiPRgBpNbNwCQFoCr8bcWO8o5I810cqO6mkdtKfLKFlLxeCWcnzDi4Alu8iyNzlhYuS9npCwivMbRWF19dyblw== + dependencies: + "@ethersproject/bytes" "^5.6.1" + "@ethersproject/hash" "^5.6.1" + "@ethersproject/logger" "^5.6.0" + "@ethersproject/properties" "^5.6.0" + "@ethersproject/strings" "^5.6.1" + +"@ethersproject/wordlists@5.7.0", "@ethersproject/wordlists@^5.4.0", "@ethersproject/wordlists@^5.6.1", "@ethersproject/wordlists@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/wordlists/-/wordlists-5.7.0.tgz#8fb2c07185d68c3e09eb3bfd6e779ba2774627f5" integrity sha512-S2TFNJNfHWVHNE6cNDjbVlZ6MgE17MIxMbMg2zv3wn+3XSJGosL1m9ZVv3GXCf/2ymSsQ+hRI5IzoMJTG6aoVA== @@ -2140,57 +2481,47 @@ typescript "5.5.4" zod "3.22.4" -"@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== +"@zetachain/localnet@4.0.0-rc6": + version "4.0.0-rc6" + resolved "https://registry.yarnpkg.com/@zetachain/localnet/-/localnet-4.0.0-rc6.tgz#9b36f5ab0e8fac766d63cfca4b1cab6a263bdd5d" + integrity sha512-DGKspMAJZLUrgNirc3NzFYg9jRfaOyuF5ePj85D93qAA//f8lOsXpmh/6Bvq/MrEscCLpVavgVP7+ePy4KJ2Fw== 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-rc11" + "@zetachain/protocol-contracts" "11.0.0-rc3" ansis "^3.3.2" concurrently "^8.2.2" ethers "^6.13.2" hardhat "^2.22.8" wait-on "^7.2.0" -"@zetachain/networks@^10.0.0": +"@zetachain/networks@10.0.0", "@zetachain/networks@^10.0.0": version "10.0.0" resolved "https://registry.yarnpkg.com/@zetachain/networks/-/networks-10.0.0.tgz#dd5d14a0870f6b658644aded8c96859f15531089" integrity sha512-FPolaO19oVkSLSPDUA/Hu+8AhG3lDEslRDpLnMzbMbnNSC669Fkah0/TEf+6egrQbAifBRfFLzwWidAGs8oxtA== dependencies: dotenv "^16.1.4" -"@zetachain/protocol-contracts@10.0.0-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== +"@zetachain/protocol-contracts@11.0.0-rc3": + version "11.0.0-rc3" + resolved "https://registry.yarnpkg.com/@zetachain/protocol-contracts/-/protocol-contracts-11.0.0-rc3.tgz#9b719391d0728fd1b4e046c5f496180a45ecf0d5" + integrity sha512-Q8lOFOi7S1wdOfOBZPTxsOoyV6kyWwYEhg4vk+HmB36n0Q6A2VvTI7qmw8rxCvq0a5BUASC8IYx0+HzsOPvNOw== dependencies: "@openzeppelin/contracts" "^5.0.2" "@openzeppelin/contracts-upgradeable" "^5.0.2" "@zetachain/networks" "^10.0.0" - ethers "^6.13.1" - -"@zetachain/protocol-contracts@10.0.0-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" + ethers "5.6.8" "@zetachain/protocol-contracts@9.0.0": version "9.0.0" resolved "https://registry.yarnpkg.com/@zetachain/protocol-contracts/-/protocol-contracts-9.0.0.tgz#c20ad5da43f6f3676f31556b303d1cb4ea17357e" integrity sha512-L4A8bddlyhjaBAsIv/x1Bvxc38RJz8U8rbbBtxK5oVyOAd5Zz04ZiT3HqzO4FuKq6RGGM1uiA8jvUfmRkKchXw== -"@zetachain/toolkit@13.0.0-rc5": - version "13.0.0-rc5" - resolved "https://registry.yarnpkg.com/@zetachain/toolkit/-/toolkit-13.0.0-rc5.tgz#56b2603c8367819a5265fcc7354e93ffdfbc3ea3" - integrity sha512-/97eSf3ALdrLHc9vyaO/xcjuAI9wa4JUNkB8NtnNT6dMeSBPI2ME9lmG+Qk2YDoZkrYlzmEzeru+zcZI9v7cog== +"@zetachain/toolkit@13.0.0-rc8": + version "13.0.0-rc8" + resolved "https://registry.yarnpkg.com/@zetachain/toolkit/-/toolkit-13.0.0-rc8.tgz#1f8b975428f6f1b7bdef4ccc0a1312de81f90e7d" + integrity sha512-lXAyyMpgN/dsGIUTR/hi5M+6/tsnzONLAaisAnJzsrEUB4nYkoZtQCR4lwP4oWhNl4i3SK5k+bFjAfBo1DU3iw== dependencies: "@coral-xyz/anchor" "^0.30.1" "@inquirer/prompts" "^2.1.1" @@ -2201,12 +2532,13 @@ "@solana/web3.js" "^1.95.3" "@uniswap/v2-periphery" "^1.1.0-beta.0" "@zetachain/faucet-cli" "^4.1.1" - "@zetachain/networks" "^10.0.0" + "@zetachain/networks" "10.0.0" "@zetachain/protocol-contracts" "9.0.0" axios "^1.4.0" bech32 "^2.0.0" bip39 "^3.1.0" bitcoinjs-lib "^6.1.3" + bs58 "^6.0.0" dotenv "16.0.3" ecpair "^2.1.0" envfile "^6.18.0" @@ -3900,6 +4232,42 @@ ethers@5.4.7: "@ethersproject/web" "5.4.0" "@ethersproject/wordlists" "5.4.0" +ethers@5.6.8: + version "5.6.8" + resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.6.8.tgz#d36b816b4896341a80a8bbd2a44e8cb6e9b98dd4" + integrity sha512-YxIGaltAOdvBFPZwIkyHnXbW40f1r8mHUgapW6dxkO+6t7H6wY8POUn0Kbxrd/N7I4hHxyi7YCddMAH/wmho2w== + dependencies: + "@ethersproject/abi" "5.6.3" + "@ethersproject/abstract-provider" "5.6.1" + "@ethersproject/abstract-signer" "5.6.2" + "@ethersproject/address" "5.6.1" + "@ethersproject/base64" "5.6.1" + "@ethersproject/basex" "5.6.1" + "@ethersproject/bignumber" "5.6.2" + "@ethersproject/bytes" "5.6.1" + "@ethersproject/constants" "5.6.1" + "@ethersproject/contracts" "5.6.2" + "@ethersproject/hash" "5.6.1" + "@ethersproject/hdnode" "5.6.2" + "@ethersproject/json-wallets" "5.6.1" + "@ethersproject/keccak256" "5.6.1" + "@ethersproject/logger" "5.6.0" + "@ethersproject/networks" "5.6.3" + "@ethersproject/pbkdf2" "5.6.1" + "@ethersproject/properties" "5.6.0" + "@ethersproject/providers" "5.6.8" + "@ethersproject/random" "5.6.1" + "@ethersproject/rlp" "5.6.1" + "@ethersproject/sha2" "5.6.1" + "@ethersproject/signing-key" "5.6.2" + "@ethersproject/solidity" "5.6.1" + "@ethersproject/strings" "5.6.1" + "@ethersproject/transactions" "5.6.2" + "@ethersproject/units" "5.6.1" + "@ethersproject/wallet" "5.6.2" + "@ethersproject/web" "5.6.1" + "@ethersproject/wordlists" "5.6.1" + ethers@5.7.2, ethers@^5.4.7, ethers@^5.7.2: version "5.7.2" resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.7.2.tgz#3a7deeabbb8c030d4126b24f84e525466145872e" @@ -3936,7 +4304,7 @@ ethers@5.7.2, ethers@^5.4.7, ethers@^5.7.2: "@ethersproject/web" "5.7.1" "@ethersproject/wordlists" "5.7.0" -ethers@^6.13.1, ethers@^6.13.2: +ethers@^6.13.2: version "6.13.2" resolved "https://registry.yarnpkg.com/ethers/-/ethers-6.13.2.tgz#4b67d4b49e69b59893931a032560999e5e4419fe" integrity sha512-9VkriTTed+/27BGuY1s0hf441kqwHJ1wtN2edksEtiRvXx+soxRX3iSXTfFqq2+YwrOqbDoTHjIhQnjJRlzKmg== diff --git a/examples/token/.gitignore b/examples/token/.gitignore index 4487fa3c..34db758f 100644 --- a/examples/token/.gitignore +++ b/examples/token/.gitignore @@ -14,4 +14,6 @@ artifacts out cache_forge -access_token \ No newline at end of file +access_token + +localnet.json diff --git a/examples/token/contracts/Connected.sol b/examples/token/contracts/Connected.sol index 9f066163..5f3d144c 100644 --- a/examples/token/contracts/Connected.sol +++ b/examples/token/contracts/Connected.sol @@ -9,29 +9,35 @@ import "./shared/Events.sol"; contract Connected is ERC20, Ownable2Step, Events { GatewayEVM public immutable gateway; - address public counterparty; + address public universal; + uint256 public immutable gasLimit; error InvalidAddress(); error Unauthorized(); + error InvalidGasLimit(); + error GasTokenTransferFailed(); modifier onlyGateway() { - require(msg.sender == address(gateway), "Caller is not the gateway"); + if (msg.sender != address(gateway)) revert Unauthorized(); _; } - function setCounterparty(address contractAddress) external onlyOwner { - counterparty = contractAddress; - emit CounterpartySet(contractAddress); + function setUniversal(address contractAddress) external onlyOwner { + if (contractAddress == address(0)) revert InvalidAddress(); + universal = contractAddress; + emit SetUniversal(contractAddress); } constructor( address payable gatewayAddress, address owner, string memory name, - string memory symbol + string memory symbol, + uint256 gas ) ERC20(name, symbol) Ownable(owner) { if (gatewayAddress == address(0) || owner == address(0)) revert InvalidAddress(); + gasLimit = gas; gateway = GatewayEVM(gatewayAddress); } @@ -44,26 +50,35 @@ contract Connected is ERC20, Ownable2Step, Events { address receiver, uint256 amount ) external payable { + if (receiver == address(0)) revert InvalidAddress(); _burn(msg.sender, amount); - bytes memory message = abi.encode(destination, receiver, amount); - RevertOptions memory revertOptions = RevertOptions( - address(this), - true, - address(0), - message, - 0 + bytes memory message = abi.encode( + destination, + receiver, + amount, + msg.sender ); - if (destination == address(0)) { - gateway.call(counterparty, message, revertOptions); + gateway.call( + universal, + message, + RevertOptions(address(this), false, address(0), message, 0) + ); } else { gateway.depositAndCall{value: msg.value}( - counterparty, + universal, message, - revertOptions + RevertOptions( + address(this), + true, + address(0), + abi.encode(amount, msg.sender), + gasLimit + ) ); } + emit TokenTransfer(destination, receiver, amount); } @@ -71,17 +86,30 @@ contract Connected is ERC20, Ownable2Step, Events { MessageContext calldata context, bytes calldata message ) external payable onlyGateway returns (bytes4) { - if (context.sender != counterparty) revert Unauthorized(); - (address receiver, uint256 amount) = abi.decode( - message, - (address, uint256) - ); + if (context.sender != universal) revert Unauthorized(); + ( + address receiver, + uint256 amount, + uint256 gasAmount, + address sender + ) = abi.decode(message, (address, uint256, uint256, address)); _mint(receiver, amount); + if (gasAmount > 0) { + (bool success, ) = sender.call{value: amount}(""); + if (!success) revert GasTokenTransferFailed(); + } emit TokenTransferReceived(receiver, amount); return ""; } - function onRevert(RevertContext calldata context) external onlyGateway {} + function onRevert(RevertContext calldata context) external onlyGateway { + (uint256 amount, address receiver) = abi.decode( + context.revertMessage, + (uint256, address) + ); + _mint(receiver, amount); + emit TokenTransferReverted(receiver, amount); + } receive() external payable {} diff --git a/examples/token/contracts/Universal.sol b/examples/token/contracts/Universal.sol index 5e0a59db..18fec795 100644 --- a/examples/token/contracts/Universal.sol +++ b/examples/token/contracts/Universal.sol @@ -13,21 +13,20 @@ import "./shared/Events.sol"; contract Universal is ERC20, Ownable2Step, UniversalContract, Events { GatewayZEVM public immutable gateway; - SystemContract public immutable systemContract = - SystemContract(0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9); + address public immutable uniswapRouter; uint256 private _nextTokenId; bool public isUniversal = true; - uint256 public gasLimit; + uint256 public immutable gasLimit; error TransferFailed(); error Unauthorized(); error InvalidAddress(); error InvalidGasLimit(); - mapping(address => bytes) public counterparty; + mapping(address => address) public connected; modifier onlyGateway() { - require(msg.sender == address(gateway), "Caller is not the gateway"); + if (msg.sender != address(gateway)) revert Unauthorized(); _; } @@ -36,21 +35,26 @@ contract Universal is ERC20, Ownable2Step, UniversalContract, Events { address owner, string memory name, string memory symbol, - uint256 gas + uint256 gas, + address uniswapRouterAddress ) ERC20(name, symbol) Ownable(owner) { - if (gatewayAddress == address(0) || owner == address(0)) - revert InvalidAddress(); + if ( + gatewayAddress == address(0) || + owner == address(0) || + uniswapRouterAddress == address(0) + ) revert InvalidAddress(); if (gas == 0) revert InvalidGasLimit(); gateway = GatewayZEVM(gatewayAddress); + uniswapRouter = uniswapRouterAddress; gasLimit = gas; } - function setCounterparty( + function setConnected( address zrc20, - bytes memory contractAddress + address contractAddress ) external onlyOwner { - counterparty[zrc20] = contractAddress; - emit CounterpartyMappingSet(zrc20, contractAddress); + connected[zrc20] = contractAddress; + emit SetConnected(zrc20, contractAddress); } function transferCrossChain( @@ -68,7 +72,7 @@ contract Universal is ERC20, Ownable2Step, UniversalContract, Events { !IZRC20(destination).transferFrom(msg.sender, address(this), gasFee) ) revert TransferFailed(); IZRC20(destination).approve(address(gateway), gasFee); - bytes memory message = abi.encode(receiver, amount); + bytes memory message = abi.encode(receiver, amount, 0, msg.sender); CallOptions memory callOptions = CallOptions(gasLimit, false); @@ -76,12 +80,12 @@ contract Universal is ERC20, Ownable2Step, UniversalContract, Events { address(this), true, address(0), - message, + abi.encode(amount, msg.sender), gasLimit ); gateway.call( - counterparty[destination], + abi.encodePacked(connected[destination]), destination, message, callOptions, @@ -100,39 +104,49 @@ contract Universal is ERC20, Ownable2Step, UniversalContract, Events { uint256 amount, bytes calldata message ) external override onlyGateway { - if (keccak256(context.origin) != keccak256(counterparty[zrc20])) - revert Unauthorized(); - (address destination, address receiver, uint256 tokenAmount) = abi - .decode(message, (address, address, uint256)); + if (context.sender != connected[zrc20]) revert Unauthorized(); + ( + address destination, + address receiver, + uint256 tokenAmount, + address sender + ) = abi.decode(message, (address, address, uint256, address)); if (destination == address(0)) { _mint(receiver, tokenAmount); } else { (, uint256 gasFee) = IZRC20(destination).withdrawGasFeeWithGasLimit( gasLimit ); - SwapHelperLib.swapExactTokensForTokens( - systemContract, + uint256 out = SwapHelperLib.swapExactTokensForTokens( + uniswapRouter, zrc20, amount, destination, 0 ); - IZRC20(destination).approve(address(gateway), gasFee); - gateway.call( - counterparty[destination], + IZRC20(destination).approve(address(gateway), out); + gateway.withdrawAndCall( + abi.encodePacked(connected[destination]), + out - gasFee, destination, - abi.encode(receiver, tokenAmount), + abi.encode(receiver, tokenAmount, out - gasFee, sender), CallOptions(gasLimit, false), - RevertOptions(address(0), false, address(0), "", 0) + RevertOptions( + address(this), + true, + address(0), + abi.encode(tokenAmount, sender), + 0 + ) ); } emit TokenTransferToDestination(destination, receiver, amount); } function onRevert(RevertContext calldata context) external onlyGateway { - (address sender, uint256 amount) = abi.decode( + (uint256 amount, address sender) = abi.decode( context.revertMessage, - (address, uint256) + (uint256, address) ); _mint(sender, amount); emit TokenTransferReverted(sender, amount); diff --git a/examples/token/contracts/shared/Events.sol b/examples/token/contracts/shared/Events.sol index 26fa43ed..cebb4adc 100644 --- a/examples/token/contracts/shared/Events.sol +++ b/examples/token/contracts/shared/Events.sol @@ -2,12 +2,8 @@ pragma solidity ^0.8.26; contract Events { - event CounterpartyMappingSet( - address indexed zrc20, - bytes indexed contractAddress - ); - event CounterpartySet(address indexed contractAddress); - + event SetUniversal(address indexed universalAddress); + event SetConnected(address indexed zrc20, address contractAddress); event TokenMinted(address indexed to, uint256 amount); event TokenTransfer( address indexed destination, diff --git a/examples/token/hardhat.config.ts b/examples/token/hardhat.config.ts index eef5c50d..cb202293 100644 --- a/examples/token/hardhat.config.ts +++ b/examples/token/hardhat.config.ts @@ -1,8 +1,8 @@ import "./tasks/deploy"; import "./tasks/mint"; import "./tasks/transfer"; -import "./tasks/universalSetCounterparty"; -import "./tasks/connectedSetCounterparty"; +import "./tasks/universalSetConnected"; +import "./tasks/connectedSetUniversal"; import "@zetachain/localnet/tasks"; import "@nomicfoundation/hardhat-toolbox"; import "@zetachain/toolkit/tasks"; diff --git a/examples/token/package.json b/examples/token/package.json index 1e04fba6..84fec511 100644 --- a/examples/token/package.json +++ b/examples/token/package.json @@ -27,8 +27,8 @@ "@types/node": ">=12.0.0", "@typescript-eslint/eslint-plugin": "^5.59.9", "@typescript-eslint/parser": "^5.59.9", - "@zetachain/localnet": "4.0.0-rc4", - "@zetachain/toolkit": "13.0.0-rc4", + "@zetachain/localnet": "4.0.0-rc6", + "@zetachain/toolkit": "13.0.0-rc8", "axios": "^1.3.6", "chai": "^4.2.0", "dotenv": "^16.0.3", diff --git a/examples/token/scripts/test.sh b/examples/token/scripts/localnet.sh similarity index 68% rename from examples/token/scripts/test.sh rename to examples/token/scripts/localnet.sh index 737b5031..dc825541 100755 --- a/examples/token/scripts/test.sh +++ b/examples/token/scripts/localnet.sh @@ -2,9 +2,7 @@ set -e -if [ "$1" = "localnet" ]; then - npx hardhat localnet --exit-on-error & sleep 10 -fi +if [ "$1" = "start" ]; then npx hardhat localnet --exit-on-error & sleep 10; fi function balance() { echo -e "\nšŸ–¼ļø Balance" @@ -23,12 +21,13 @@ npx hardhat compile --force --quiet ZRC20_ETHEREUM=$(jq -r '.addresses[] | select(.type=="ZRC-20 ETH on 5") | .address' localnet.json) ZRC20_BNB=$(jq -r '.addresses[] | select(.type=="ZRC-20 BNB on 97") | .address' localnet.json) +GATEWAY_ZETACHAIN=$(jq -r '.addresses[] | select(.type=="gatewayZEVM" and .chain=="zetachain") | .address' localnet.json) GATEWAY_ETHEREUM=$(jq -r '.addresses[] | select(.type=="gatewayEVM" and .chain=="ethereum") | .address' localnet.json) GATEWAY_BNB=$(jq -r '.addresses[] | select(.type=="gatewayEVM" and .chain=="bnb") | .address' localnet.json) +UNISWAP_ROUTER=$(jq -r '.addresses[] | select(.type=="uniswapRouterInstance" and .chain=="zetachain") | .address' localnet.json) SENDER=0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 - -CONTRACT_ZETACHAIN=$(npx hardhat deploy --network localhost --gas-limit 700000 --json | jq -r '.contractAddress') +CONTRACT_ZETACHAIN=$(npx hardhat deploy --network localhost --gateway "$GATEWAY_ZETACHAIN" --uniswap-router "$UNISWAP_ROUTER" --json | jq -r '.contractAddress') echo -e "\nšŸš€ Deployed contract on ZetaChain: $CONTRACT_ZETACHAIN" CONTRACT_ETHEREUM=$(npx hardhat deploy --name Connected --json --network localhost --gateway "$GATEWAY_ETHEREUM" | jq -r '.contractAddress') @@ -39,11 +38,11 @@ echo -e "šŸš€ Deployed contract on BNB chain: $CONTRACT_BNB" echo -e "\nšŸ“® User Address: $SENDER" -echo -e "\nšŸ”— Setting counterparty contracts..." -npx hardhat connected-set-counterparty --network localhost --contract "$CONTRACT_ETHEREUM" --counterparty "$CONTRACT_ZETACHAIN" --json &>/dev/null -npx hardhat connected-set-counterparty --network localhost --contract "$CONTRACT_BNB" --counterparty "$CONTRACT_ZETACHAIN" --json &>/dev/null -npx hardhat universal-set-counterparty --network localhost --contract "$CONTRACT_ZETACHAIN" --counterparty "$CONTRACT_ETHEREUM" --zrc20 "$ZRC20_ETHEREUM" --json &>/dev/null -npx hardhat universal-set-counterparty --network localhost --contract "$CONTRACT_ZETACHAIN" --counterparty "$CONTRACT_BNB" --zrc20 "$ZRC20_BNB" --json &>/dev/null +echo -e "\nšŸ”— Setting universal and connected contracts..." +npx hardhat connected-set-universal --network localhost --contract "$CONTRACT_ETHEREUM" --universal "$CONTRACT_ZETACHAIN" --json &>/dev/null +npx hardhat connected-set-universal --network localhost --contract "$CONTRACT_BNB" --universal "$CONTRACT_ZETACHAIN" --json &>/dev/null +npx hardhat universal-set-connected --network localhost --contract "$CONTRACT_ZETACHAIN" --connected "$CONTRACT_ETHEREUM" --zrc20 "$ZRC20_ETHEREUM" --json &>/dev/null +npx hardhat universal-set-connected --network localhost --contract "$CONTRACT_ZETACHAIN" --connected "$CONTRACT_BNB" --zrc20 "$ZRC20_BNB" --json &>/dev/null npx hardhat localnet-check balance @@ -72,4 +71,4 @@ npx hardhat transfer --network localhost --json --amount 10 --from "$CONTRACT_BN npx hardhat localnet-check balance -npx hardhat localnet-stop \ No newline at end of file +if [ "$1" = "start" ]; then npx hardhat localnet-stop; fi \ No newline at end of file diff --git a/examples/token/tasks/connectedSetCounterparty.ts b/examples/token/tasks/connectedSetUniversal.ts similarity index 78% rename from examples/token/tasks/connectedSetCounterparty.ts rename to examples/token/tasks/connectedSetUniversal.ts index 3535d52e..0e5a2c41 100644 --- a/examples/token/tasks/connectedSetCounterparty.ts +++ b/examples/token/tasks/connectedSetUniversal.ts @@ -15,13 +15,13 @@ const main = async (args: any, hre: HardhatRuntimeEnvironment) => { args.contract ); - const tx = await contract.setCounterparty(args.counterparty); + const tx = await contract.setUniversal(args.universal); if (args.json) { console.log( JSON.stringify({ contractAddress: args.contract, - universalContract: args.counterparty, + universalContract: args.universal, transactionHash: tx.hash, }) ); @@ -32,7 +32,7 @@ const main = async (args: any, hre: HardhatRuntimeEnvironment) => { } }; -task("connected-set-counterparty", "Sets the universal contract address", main) +task("connected-set-universal", "Sets the universal contract address", main) .addParam("contract", "The address of the deployed contract") - .addParam("counterparty", "The address of the universal contract to set") + .addParam("universal", "The address of the universal contract to set") .addFlag("json", "Output the result in JSON format"); diff --git a/examples/token/tasks/deploy.ts b/examples/token/tasks/deploy.ts index 534cced7..28db1d88 100644 --- a/examples/token/tasks/deploy.ts +++ b/examples/token/tasks/deploy.ts @@ -17,7 +17,8 @@ const main = async (args: any, hre: HardhatRuntimeEnvironment) => { signer.address, args.tokenName, args.tokenSymbol, - ...(args.gasLimit ? [args.gasLimit] : []) + args.gasLimit, + ...(args.uniswapRouter ? [args.uniswapRouter] : []) ); await contract.deployed(); @@ -42,9 +43,15 @@ task("deploy", "Deploy the NFT contract", main) .addOptionalParam("tokenName", "Token name", "Universal Token") .addOptionalParam("tokenSymbol", "Token symbol", "UFT") .addOptionalParam("name", "The contract name to deploy", "Universal") - .addOptionalParam("gasLimit", "Gas limit for the transaction") + .addOptionalParam( + "gasLimit", + "Gas limit for the transaction", + 1000000, + types.int + ) .addOptionalParam( "gateway", "Gateway address (default: ZetaChain Gateway)", - "0x5FC8d32690cc91D4c39d9d3abcBD16989F875707" - ); + "0x6c533f7fe93fae114d0954697069df33c9b74fd7" + ) + .addOptionalParam("uniswapRouter", "Uniswap v2 Router address"); diff --git a/examples/token/tasks/universalSetCounterparty.ts b/examples/token/tasks/universalSetConnected.ts similarity index 76% rename from examples/token/tasks/universalSetCounterparty.ts rename to examples/token/tasks/universalSetConnected.ts index 05ce0dce..b8de726c 100644 --- a/examples/token/tasks/universalSetCounterparty.ts +++ b/examples/token/tasks/universalSetConnected.ts @@ -15,14 +15,14 @@ const main = async (args: any, hre: HardhatRuntimeEnvironment) => { args.contract ); - const tx = await contract.setCounterparty(args.zrc20, args.counterparty); + const tx = await contract.setConnected(args.zrc20, args.connected); if (args.json) { console.log( JSON.stringify({ contractAddress: args.contract, zrc20: args.zrc20, - connectedContractAddress: args.counterparty, + connectedContractAddress: args.connected, transactionHash: tx.hash, }) ); @@ -30,13 +30,13 @@ const main = async (args: any, hre: HardhatRuntimeEnvironment) => { console.log(`šŸš€ Successfully set the connected contract. šŸ“œ Contract address: ${args.contract} šŸ”— ZRC20 address: ${args.zrc20} -šŸ”— Connected contract address: ${args.counterparty} +šŸ”— Connected contract address: ${args.connected} šŸ”— Transaction hash: ${tx.hash}`); } }; -task("universal-set-counterparty", "Sets the connected contract address", main) +task("universal-set-connected", "Sets the connected contract address", main) .addParam("contract", "The address of the deployed contract") .addParam("zrc20", "The ZRC20 address to link to the connected contract") - .addParam("counterparty", "The address of the connected contract to set") + .addParam("connected", "The address of the connected contract to set") .addFlag("json", "Output the result in JSON format"); diff --git a/examples/token/yarn.lock b/examples/token/yarn.lock index e897e2e7..14f87151 100644 --- a/examples/token/yarn.lock +++ b/examples/token/yarn.lock @@ -2743,10 +2743,10 @@ typescript "5.5.4" zod "3.22.4" -"@zetachain/localnet@4.0.0-rc4": - version "4.0.0-rc4" - resolved "https://registry.yarnpkg.com/@zetachain/localnet/-/localnet-4.0.0-rc4.tgz#916c58f83dd4901691fbc1216aec2ee88e7f531e" - integrity sha512-yNlA6qaQZiuHXRx4pgNLLHlJ+2ENet9WTIWxoslnLzzDljWwYTJHkErlTQcWa5oL9jjyn2/hQB/laoqXzlX1gQ== +"@zetachain/localnet@4.0.0-rc6": + version "4.0.0-rc6" + resolved "https://registry.yarnpkg.com/@zetachain/localnet/-/localnet-4.0.0-rc6.tgz#9b36f5ab0e8fac766d63cfca4b1cab6a263bdd5d" + integrity sha512-DGKspMAJZLUrgNirc3NzFYg9jRfaOyuF5ePj85D93qAA//f8lOsXpmh/6Bvq/MrEscCLpVavgVP7+ePy4KJ2Fw== dependencies: "@inquirer/prompts" "^5.5.0" "@uniswap/v2-core" "^1.0.1" @@ -2758,7 +2758,7 @@ hardhat "^2.22.8" wait-on "^7.2.0" -"@zetachain/networks@^10.0.0": +"@zetachain/networks@10.0.0", "@zetachain/networks@^10.0.0": version "10.0.0" resolved "https://registry.yarnpkg.com/@zetachain/networks/-/networks-10.0.0.tgz#dd5d14a0870f6b658644aded8c96859f15531089" integrity sha512-FPolaO19oVkSLSPDUA/Hu+8AhG3lDEslRDpLnMzbMbnNSC669Fkah0/TEf+6egrQbAifBRfFLzwWidAGs8oxtA== @@ -2780,10 +2780,10 @@ resolved "https://registry.yarnpkg.com/@zetachain/protocol-contracts/-/protocol-contracts-9.0.0.tgz#c20ad5da43f6f3676f31556b303d1cb4ea17357e" integrity sha512-L4A8bddlyhjaBAsIv/x1Bvxc38RJz8U8rbbBtxK5oVyOAd5Zz04ZiT3HqzO4FuKq6RGGM1uiA8jvUfmRkKchXw== -"@zetachain/toolkit@13.0.0-rc4": - version "13.0.0-rc4" - resolved "https://registry.yarnpkg.com/@zetachain/toolkit/-/toolkit-13.0.0-rc4.tgz#e137fc16043f1416469f709c48808cfa301d9299" - integrity sha512-4z4MKbQKjRIeNruUyDBjZDRO5oTLa1w/7wVn+PfMsXn++mFFGkiawkLcitnkH9dadBJiERzmo89MRJxsLQ3U6w== +"@zetachain/toolkit@13.0.0-rc8": + version "13.0.0-rc8" + resolved "https://registry.yarnpkg.com/@zetachain/toolkit/-/toolkit-13.0.0-rc8.tgz#1f8b975428f6f1b7bdef4ccc0a1312de81f90e7d" + integrity sha512-lXAyyMpgN/dsGIUTR/hi5M+6/tsnzONLAaisAnJzsrEUB4nYkoZtQCR4lwP4oWhNl4i3SK5k+bFjAfBo1DU3iw== dependencies: "@coral-xyz/anchor" "^0.30.1" "@inquirer/prompts" "^2.1.1" @@ -2794,12 +2794,13 @@ "@solana/web3.js" "^1.95.3" "@uniswap/v2-periphery" "^1.1.0-beta.0" "@zetachain/faucet-cli" "^4.1.1" - "@zetachain/networks" "^10.0.0" + "@zetachain/networks" "10.0.0" "@zetachain/protocol-contracts" "9.0.0" axios "^1.4.0" bech32 "^2.0.0" bip39 "^3.1.0" bitcoinjs-lib "^6.1.3" + bs58 "^6.0.0" dotenv "16.0.3" ecpair "^2.1.0" envfile "^6.18.0" diff --git a/omnichain/swap/README.md b/omnichain/swap/README.md deleted file mode 100644 index 62730f9d..00000000 --- a/omnichain/swap/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# ZetaChain Contracts Template - -## Getting Started - -Install dependencies: - -``` -yarn -``` - -## Next Steps - -Ready to dive in? Follow our [**šŸš€ smart contract -tutorials**](https://www.zetachain.com/docs/developers/tutorials/intro/) to -start building universal app contracts. diff --git a/omnichain/swap/contracts/Swap.sol b/omnichain/swap/contracts/Swap.sol deleted file mode 100644 index fa36a853..00000000 --- a/omnichain/swap/contracts/Swap.sol +++ /dev/null @@ -1,70 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity 0.8.7; - -import "@zetachain/protocol-contracts/contracts/zevm/SystemContract.sol"; -import "@zetachain/protocol-contracts/contracts/zevm/interfaces/zContract.sol"; -import "@zetachain/toolkit/contracts/SwapHelperLib.sol"; -import "@zetachain/toolkit/contracts/BytesHelperLib.sol"; -import "@zetachain/toolkit/contracts/OnlySystem.sol"; - -contract Swap is zContract, OnlySystem { - SystemContract public systemContract; - uint256 constant BITCOIN = 18332; - - constructor(address systemContractAddress) { - systemContract = SystemContract(systemContractAddress); - } - - struct Params { - address target; - bytes to; - } - - function onCrossChainCall( - zContext calldata context, - address zrc20, - uint256 amount, - bytes calldata message - ) external virtual override onlySystem(systemContract) { - Params memory params = Params({target: address(0), to: bytes("")}); - - if (context.chainID == BITCOIN) { - params.target = BytesHelperLib.bytesToAddress(message, 0); - params.to = abi.encodePacked( - BytesHelperLib.bytesToAddress(message, 20) - ); - } else { - (address targetToken, bytes memory recipient) = abi.decode( - message, - (address, bytes) - ); - params.target = targetToken; - params.to = recipient; - } - - uint256 inputForGas; - address gasZRC20; - uint256 gasFee; - - (gasZRC20, gasFee) = IZRC20(params.target).withdrawGasFee(); - - inputForGas = SwapHelperLib.swapTokensForExactTokens( - systemContract, - zrc20, - gasFee, - gasZRC20, - amount - ); - - uint256 outputAmount = SwapHelperLib.swapExactTokensForTokens( - systemContract, - zrc20, - amount - inputForGas, - params.target, - 0 - ); - - IZRC20(gasZRC20).approve(params.target, gasFee); - IZRC20(params.target).withdraw(params.to, outputAmount); - } -} diff --git a/omnichain/swap/contracts/SwapToAnyToken.sol b/omnichain/swap/contracts/SwapToAnyToken.sol deleted file mode 100644 index 9cd4f386..00000000 --- a/omnichain/swap/contracts/SwapToAnyToken.sol +++ /dev/null @@ -1,91 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity 0.8.7; - -import "@zetachain/protocol-contracts/contracts/zevm/SystemContract.sol"; -import "@zetachain/protocol-contracts/contracts/zevm/interfaces/zContract.sol"; -import "@zetachain/toolkit/contracts/SwapHelperLib.sol"; -import "@zetachain/toolkit/contracts/BytesHelperLib.sol"; -import "@zetachain/protocol-contracts/contracts/zevm/interfaces/IWZETA.sol"; -import "@zetachain/toolkit/contracts/OnlySystem.sol"; - -contract SwapToAnyToken is zContract, OnlySystem { - SystemContract public systemContract; - - uint256 constant BITCOIN = 18332; - - constructor(address systemContractAddress) { - systemContract = SystemContract(systemContractAddress); - } - - struct Params { - address target; - bytes to; - bool withdraw; - } - - function onCrossChainCall( - zContext calldata context, - address zrc20, - uint256 amount, - bytes calldata message - ) external virtual override onlySystem(systemContract) { - Params memory params = Params({ - target: address(0), - to: bytes(""), - withdraw: true - }); - - if (context.chainID == BITCOIN) { - params.target = BytesHelperLib.bytesToAddress(message, 0); - params.to = abi.encodePacked( - BytesHelperLib.bytesToAddress(message, 20) - ); - if (message.length >= 41) { - params.withdraw = BytesHelperLib.bytesToBool(message, 40); - } - } else { - ( - address targetToken, - bytes memory recipient, - bool withdrawFlag - ) = abi.decode(message, (address, bytes, bool)); - params.target = targetToken; - params.to = recipient; - params.withdraw = withdrawFlag; - } - - uint256 inputForGas; - address gasZRC20; - uint256 gasFee; - - if (params.withdraw) { - (gasZRC20, gasFee) = IZRC20(params.target).withdrawGasFee(); - - inputForGas = SwapHelperLib.swapTokensForExactTokens( - systemContract, - zrc20, - gasFee, - gasZRC20, - amount - ); - } - - uint256 outputAmount = SwapHelperLib.swapExactTokensForTokens( - systemContract, - zrc20, - params.withdraw ? amount - inputForGas : amount, - params.target, - 0 - ); - - if (params.withdraw) { - IZRC20(gasZRC20).approve(params.target, gasFee); - IZRC20(params.target).withdraw(params.to, outputAmount); - } else { - IWETH9(params.target).transfer( - address(uint160(bytes20(params.to))), - outputAmount - ); - } - } -} diff --git a/omnichain/swap/contracts/shared/MockContract.sol b/omnichain/swap/contracts/shared/MockContract.sol deleted file mode 100644 index 4f791da1..00000000 --- a/omnichain/swap/contracts/shared/MockContract.sol +++ /dev/null @@ -1,6 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity 0.8.7; - -import "@zetachain/toolkit/contracts/shared/MockSystemContract.sol"; -import "@zetachain/toolkit/contracts/shared/MockZRC20.sol"; -import "@zetachain/toolkit/contracts/shared/WZETA.sol"; diff --git a/omnichain/swap/contracts/shared/TestUniswapCore.sol b/omnichain/swap/contracts/shared/TestUniswapCore.sol deleted file mode 100644 index 069fc6ed..00000000 --- a/omnichain/swap/contracts/shared/TestUniswapCore.sol +++ /dev/null @@ -1,4 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity 0.5.16; - -import "@zetachain/toolkit/contracts/shared/TestUniswapCore.sol"; diff --git a/omnichain/swap/contracts/shared/TestUniswapRouter.sol b/omnichain/swap/contracts/shared/TestUniswapRouter.sol deleted file mode 100644 index 27e8c2dc..00000000 --- a/omnichain/swap/contracts/shared/TestUniswapRouter.sol +++ /dev/null @@ -1,4 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity 0.8.7; - -import "@zetachain/toolkit/contracts/shared/TestUniswapRouter.sol"; diff --git a/omnichain/swap/tasks/deploy.ts b/omnichain/swap/tasks/deploy.ts deleted file mode 100644 index bed8710c..00000000 --- a/omnichain/swap/tasks/deploy.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { getAddress, ParamChainName } from "@zetachain/protocol-contracts"; -import { task } from "hardhat/config"; -import { HardhatRuntimeEnvironment } from "hardhat/types"; - -const main = async (args: any, hre: HardhatRuntimeEnvironment) => { - const network = hre.network.name as ParamChainName; - - if (!/zeta_(testnet|mainnet|localhost)/.test(network)) { - throw new Error( - 'šŸšØ Please use either "zeta_testnet", "zeta_mainnet" or "localhost" network to deploy to ZetaChain.' - ); - } - - const [signer] = await hre.ethers.getSigners(); - if (signer === undefined) { - throw new Error( - `Wallet not found. Please, run "npx hardhat account --save" or set PRIVATE_KEY env variable (for example, in a .env file)` - ); - } - - const systemContract = getAddress("systemContract", network); - - const factory = await hre.ethers.getContractFactory(args.name); - const contract = await factory.deploy(systemContract); - await contract.deployed(); - - const isTestnet = network === "zeta_testnet"; - const zetascan = isTestnet ? "athens.explorer" : "explorer"; - const blockscout = isTestnet ? "zetachain-athens-3" : "zetachain"; - - if (args.json) { - console.log(JSON.stringify(contract)); - } else { - console.log(`šŸ”‘ Using account: ${signer.address} - -šŸš€ Successfully deployed contract on ${network}. -šŸ“œ Contract address: ${contract.address} -šŸŒ ZetaScan: https://${zetascan}.zetachain.com/address/${contract.address} -šŸŒ Blockcsout: https://${blockscout}.blockscout.com/address/${contract.address} -`); - } -}; - -task("deploy", "Deploy the contract", main) - .addFlag("json", "Output in JSON") - .addOptionalParam("name", "Contract to deploy", "Swap"); diff --git a/omnichain/swap/tasks/interact.ts b/omnichain/swap/tasks/interact.ts deleted file mode 100644 index a3bde0b1..00000000 --- a/omnichain/swap/tasks/interact.ts +++ /dev/null @@ -1,84 +0,0 @@ -import { parseUnits } from "@ethersproject/units"; -import ERC20 from "@openzeppelin/contracts/build/contracts/ERC20.json"; -import { getAddress } from "@zetachain/protocol-contracts"; -import ERC20Custody from "@zetachain/protocol-contracts/abi/evm/ERC20Custody.sol/ERC20Custody.json"; -import { prepareData } from "@zetachain/toolkit/client"; -import bech32 from "bech32"; -import { ethers, utils } from "ethers"; -import { task } from "hardhat/config"; -import { HardhatRuntimeEnvironment } from "hardhat/types"; - -const main = async (args: any, hre: HardhatRuntimeEnvironment) => { - const [signer] = await hre.ethers.getSigners(); - - let recipient; - try { - if (bech32.decode(args.recipient)) { - recipient = utils.solidityPack( - ["bytes"], - [utils.toUtf8Bytes(args.recipient)] - ); - } - } catch (e) { - recipient = args.recipient; - } - - let withdraw = true; - if (args.withdraw != undefined) { - withdraw = JSON.parse(args.withdraw); - } - - const data = prepareData( - args.contract, - ["address", "bytes", "bool"], - [args.targetToken, recipient, withdraw] - ); - - let tx; - - if (args.token) { - const custodyAddress = getAddress("erc20Custody", hre.network.name as any); - if (!custodyAddress) { - throw new Error( - `No ERC20 Custody contract found for ${hre.network.name} network` - ); - } - - const custodyContract = new ethers.Contract( - custodyAddress, - ERC20Custody.abi, - signer - ); - const tokenContract = new ethers.Contract(args.token, ERC20.abi, signer); - const decimals = await tokenContract.decimals(); - const value = parseUnits(args.amount, decimals); - const approve = await tokenContract.approve(custodyAddress, value); - await approve.wait(); - - tx = await custodyContract.deposit(signer.address, args.token, value, data); - tx.wait(); - } else { - const value = parseUnits(args.amount, 18); - const to = getAddress("tss", hre.network.name as any); - tx = await signer.sendTransaction({ data, to, value }); - } - - if (args.json) { - console.log(JSON.stringify(tx, null, 2)); - } else { - console.log(`šŸ”‘ Using account: ${signer.address}\n`); - - console.log(`šŸš€ Successfully broadcasted a token transfer transaction on ${hre.network.name} network. -šŸ“ Transaction hash: ${tx.hash} - `); - } -}; - -task("interact", "Interact with the contract", main) - .addParam("contract", "The address of the withdraw contract on ZetaChain") - .addParam("amount", "Amount of tokens to send") - .addOptionalParam("token", "The address of the token to send") - .addFlag("json", "Output in JSON") - .addParam("targetToken") - .addParam("recipient") - .addOptionalParam("withdraw"); diff --git a/omnichain/swap/tasks/solana/deposit.ts b/omnichain/swap/tasks/solana/deposit.ts deleted file mode 100644 index 4794e7f1..00000000 --- a/omnichain/swap/tasks/solana/deposit.ts +++ /dev/null @@ -1,66 +0,0 @@ -import * as anchor from "@coral-xyz/anchor"; -import { BN, Program, web3 } from "@coral-xyz/anchor"; -import { getKeypairFromFile } from "@solana-developers/helpers"; -import { ethers } from "ethers"; - -import Gateway_IDL from "./gateway.json"; - -const SEED = "meta"; - -export const deposit = async (args: { - amount: number; - api: string; - contract: string; - idPath: string; - params: any[]; -}) => { - const keypair = await getKeypairFromFile(args.idPath); - const wallet = new anchor.Wallet(keypair); - - const connection = new anchor.web3.Connection(args.api); - const provider = new anchor.AnchorProvider( - connection, - wallet, - anchor.AnchorProvider.defaultOptions() - ); - anchor.setProvider(provider); - - const programId = new web3.PublicKey(Gateway_IDL.address); - const gatewayProgram = new Program(Gateway_IDL as anchor.Idl, provider); - - const seeds = [Buffer.from(SEED, "utf-8")]; - const [pdaAccount] = web3.PublicKey.findProgramAddressSync(seeds, programId); - - const depositAmount = new BN(web3.LAMPORTS_PER_SOL * args.amount); - - try { - const tx = new web3.Transaction(); - const m = Buffer.from( - ethers.utils.arrayify( - args.contract + - ethers.utils.defaultAbiCoder - .encode(args.params[0], args.params[1]) - .slice(2) - ) - ); - const depositInstruction = await gatewayProgram.methods - .deposit(depositAmount, m) - .accounts({ - pda: pdaAccount, - signer: wallet.publicKey, - systemProgram: web3.SystemProgram.programId, - }) - .instruction(); - - tx.add(depositInstruction); - - // Send the transaction - const txSignature = await web3.sendAndConfirmTransaction(connection, tx, [ - keypair, - ]); - - console.log("Transaction signature:", txSignature); - } catch (error) { - console.error("Transaction failed:", error); - } -}; diff --git a/omnichain/swap/tasks/solana/gateway.json b/omnichain/swap/tasks/solana/gateway.json deleted file mode 100644 index d5f677ae..00000000 --- a/omnichain/swap/tasks/solana/gateway.json +++ /dev/null @@ -1,497 +0,0 @@ -{ - "address": "ZETAjseVjuFsxdRxo6MmTCvqFwb3ZHUx56Co3vCmGis", - "metadata": { - "name": "gateway", - "version": "0.1.0", - "spec": "0.1.0", - "description": "Created with Anchor" - }, - "instructions": [ - { - "name": "deposit", - "discriminator": [ - 242, - 35, - 198, - 137, - 82, - 225, - 242, - 182 - ], - "accounts": [ - { - "name": "signer", - "writable": true, - "signer": true - }, - { - "name": "pda", - "writable": true - }, - { - "name": "system_program", - "address": "11111111111111111111111111111111" - } - ], - "args": [ - { - "name": "amount", - "type": "u64" - }, - { - "name": "memo", - "type": "bytes" - } - ] - }, - { - "name": "deposit_spl_token", - "discriminator": [ - 86, - 172, - 212, - 121, - 63, - 233, - 96, - 144 - ], - "accounts": [ - { - "name": "signer", - "writable": true, - "signer": true - }, - { - "name": "pda", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 109, - 101, - 116, - 97 - ] - } - ] - } - }, - { - "name": "token_program", - "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" - }, - { - "name": "from", - "writable": true - }, - { - "name": "to", - "writable": true - } - ], - "args": [ - { - "name": "amount", - "type": "u64" - }, - { - "name": "memo", - "type": "bytes" - } - ] - }, - { - "name": "initialize", - "discriminator": [ - 175, - 175, - 109, - 31, - 13, - 152, - 155, - 237 - ], - "accounts": [ - { - "name": "signer", - "writable": true, - "signer": true - }, - { - "name": "pda", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 109, - 101, - 116, - 97 - ] - } - ] - } - }, - { - "name": "system_program", - "address": "11111111111111111111111111111111" - } - ], - "args": [ - { - "name": "tss_address", - "type": { - "array": [ - "u8", - 20 - ] - } - }, - { - "name": "chain_id", - "type": "u64" - } - ] - }, - { - "name": "set_deposit_paused", - "discriminator": [ - 98, - 179, - 141, - 24, - 246, - 120, - 164, - 143 - ], - "accounts": [ - { - "name": "pda", - "writable": true - }, - { - "name": "signer", - "writable": true, - "signer": true - } - ], - "args": [ - { - "name": "deposit_paused", - "type": "bool" - } - ] - }, - { - "name": "update_authority", - "discriminator": [ - 32, - 46, - 64, - 28, - 149, - 75, - 243, - 88 - ], - "accounts": [ - { - "name": "pda", - "writable": true - }, - { - "name": "signer", - "writable": true, - "signer": true - } - ], - "args": [ - { - "name": "new_authority_address", - "type": "pubkey" - } - ] - }, - { - "name": "update_tss", - "discriminator": [ - 227, - 136, - 3, - 242, - 177, - 168, - 10, - 160 - ], - "accounts": [ - { - "name": "pda", - "writable": true - }, - { - "name": "signer", - "writable": true, - "signer": true - } - ], - "args": [ - { - "name": "tss_address", - "type": { - "array": [ - "u8", - 20 - ] - } - } - ] - }, - { - "name": "withdraw", - "discriminator": [ - 183, - 18, - 70, - 156, - 148, - 109, - 161, - 34 - ], - "accounts": [ - { - "name": "signer", - "writable": true, - "signer": true - }, - { - "name": "pda", - "writable": true - }, - { - "name": "to", - "writable": true - } - ], - "args": [ - { - "name": "amount", - "type": "u64" - }, - { - "name": "signature", - "type": { - "array": [ - "u8", - 64 - ] - } - }, - { - "name": "recovery_id", - "type": "u8" - }, - { - "name": "message_hash", - "type": { - "array": [ - "u8", - 32 - ] - } - }, - { - "name": "nonce", - "type": "u64" - } - ] - }, - { - "name": "withdraw_spl_token", - "discriminator": [ - 219, - 156, - 234, - 11, - 89, - 235, - 246, - 32 - ], - "accounts": [ - { - "name": "signer", - "writable": true, - "signer": true - }, - { - "name": "pda", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 109, - 101, - 116, - 97 - ] - } - ] - } - }, - { - "name": "from", - "writable": true - }, - { - "name": "to", - "writable": true - }, - { - "name": "token_program", - "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" - } - ], - "args": [ - { - "name": "amount", - "type": "u64" - }, - { - "name": "signature", - "type": { - "array": [ - "u8", - 64 - ] - } - }, - { - "name": "recovery_id", - "type": "u8" - }, - { - "name": "message_hash", - "type": { - "array": [ - "u8", - 32 - ] - } - }, - { - "name": "nonce", - "type": "u64" - } - ] - } - ], - "accounts": [ - { - "name": "Pda", - "discriminator": [ - 169, - 245, - 0, - 205, - 225, - 36, - 43, - 94 - ] - } - ], - "errors": [ - { - "code": 6000, - "name": "SignerIsNotAuthority", - "msg": "SignerIsNotAuthority" - }, - { - "code": 6001, - "name": "InsufficientPoints", - "msg": "InsufficientPoints" - }, - { - "code": 6002, - "name": "NonceMismatch", - "msg": "NonceMismatch" - }, - { - "code": 6003, - "name": "TSSAuthenticationFailed", - "msg": "TSSAuthenticationFailed" - }, - { - "code": 6004, - "name": "DepositToAddressMismatch", - "msg": "DepositToAddressMismatch" - }, - { - "code": 6005, - "name": "MessageHashMismatch", - "msg": "MessageHashMismatch" - }, - { - "code": 6006, - "name": "MemoLengthExceeded", - "msg": "MemoLengthExceeded" - }, - { - "code": 6007, - "name": "MemoLengthTooShort", - "msg": "MemoLengthTooShort" - }, - { - "code": 6008, - "name": "DepositPaused", - "msg": "DepositPaused" - } - ], - "types": [ - { - "name": "Pda", - "type": { - "kind": "struct", - "fields": [ - { - "name": "nonce", - "type": "u64" - }, - { - "name": "tss_address", - "type": { - "array": [ - "u8", - 20 - ] - } - }, - { - "name": "authority", - "type": "pubkey" - }, - { - "name": "chain_id", - "type": "u64" - }, - { - "name": "deposit_paused", - "type": "bool" - } - ] - } - } - ] -} \ No newline at end of file diff --git a/omnichain/swap/tasks/solana/interact.ts b/omnichain/swap/tasks/solana/interact.ts deleted file mode 100644 index 741cdca6..00000000 --- a/omnichain/swap/tasks/solana/interact.ts +++ /dev/null @@ -1,35 +0,0 @@ -import bech32 from "bech32"; -import { utils } from "ethers"; -import { task } from "hardhat/config"; -import type { HardhatRuntimeEnvironment } from "hardhat/types"; - -import { deposit } from "./deposit"; - -const main = async (args: any, hre: HardhatRuntimeEnvironment) => { - let recipient; - try { - if (bech32.decode(args.recipient)) { - recipient = utils.solidityPack( - ["bytes"], - [utils.toUtf8Bytes(args.recipient)] - ); - } - } catch (e) { - recipient = args.recipient; - } - const { amount, contract, targetToken, withdraw, api, idPath } = args; - const params = [ - ["address", "bytes", "bool"], - [targetToken, recipient, withdraw], - ]; - await deposit({ amount, api, contract, idPath, params }); -}; - -task("interact-solana", "", main) - .addParam("amount", "Amount of SOL to deposit") - .addParam("contract", "Universal contract address") - .addParam("targetToken") - .addParam("recipient") - .addOptionalParam("withdraw") - .addOptionalParam("api", "Solana API", "https://api.devnet.solana.com") - .addOptionalParam("idPath", "Path to id.json", "~/.config/solana/id.json"); diff --git a/omnichain/swap/tasks/swap.ts b/omnichain/swap/tasks/swap.ts deleted file mode 100644 index ff88f588..00000000 --- a/omnichain/swap/tasks/swap.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { task } from "hardhat/config"; -import { HardhatRuntimeEnvironment } from "hardhat/types"; -import { parseEther } from "@ethersproject/units"; -import { ethers } from "ethers"; - -const main = async (args: any, hre: HardhatRuntimeEnvironment) => { - const [signer] = await hre.ethers.getSigners(); - - if (!/zeta_(testnet|mainnet)/.test(hre.network.name)) { - throw new Error('šŸšØ Please use either "zeta_testnet" or "zeta_mainnet".'); - } - - const factory = await hre.ethers.getContractFactory("SwapToAnyToken"); - const contract = factory.attach(args.contract); - - const amount = parseEther(args.amount); - const inputToken = args.inputToken; - const targetToken = args.targetToken; - const recipient = ethers.utils.arrayify(args.recipient); - const withdraw = JSON.parse(args.withdraw); - - const erc20Factory = await hre.ethers.getContractFactory("ERC20"); - const inputTokenContract = erc20Factory.attach(args.inputToken); - - const approval = await inputTokenContract.approve(args.contract, amount); - await approval.wait(); - - const tx = await contract.swap( - inputToken, - amount, - targetToken, - recipient, - withdraw - ); - - await tx.wait(); - console.log(`Transaction hash: ${tx.hash}`); -}; - -task("swap", "Interact with the Swap contract from ZetaChain", main) - .addFlag("json", "Output JSON") - .addParam("contract", "Contract address") - .addParam("amount", "Token amount to send") - .addParam("inputToken", "Input token address") - .addParam("targetToken", "Target token address") - .addParam("recipient", "Recipient address") - .addParam("withdraw", "Withdraw flag (true/false)"); diff --git a/omnichain/swap/test/Swap.spec.ts b/omnichain/swap/test/Swap.spec.ts deleted file mode 100644 index 8a198599..00000000 --- a/omnichain/swap/test/Swap.spec.ts +++ /dev/null @@ -1,111 +0,0 @@ -import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers"; -import { deployUniswap, deployWZETA, evmSetup } from "@zetachain/toolkit/test"; -import { expect } from "chai"; -import { defaultAbiCoder, parseEther, parseUnits } from "ethers/lib/utils"; -import { ethers, network } from "hardhat"; - -import { - MockSystemContract, - MockZRC20, - Swap, - Swap__factory, - TestUniswapRouter, - UniswapV2Factory, - WZETA, -} from "../typechain-types"; - -describe("Swap", function () { - let uniswapFactory: UniswapV2Factory; - let uniswapRouter: TestUniswapRouter; - let swap: Swap; - let accounts: SignerWithAddress[]; - let deployer: SignerWithAddress; - let systemContract: MockSystemContract; - let ZRC20Contracts: MockZRC20[]; - let wGasToken: WZETA; - - beforeEach(async function () { - accounts = await ethers.getSigners(); - [deployer] = accounts; - - const wZETA = await deployWZETA(deployer); - wGasToken = wZETA; - - const deployResult = await deployUniswap(deployer, wGasToken.address); - uniswapFactory = deployResult.uniswapFactory; - uniswapRouter = deployResult.uniswapRouter; - - const evmSetupResult = await evmSetup( - wGasToken.address, - uniswapFactory.address, - uniswapRouter.address - ); - ZRC20Contracts = evmSetupResult.ZRC20Contracts; - systemContract = evmSetupResult.systemContract; - - const SwapFactory = (await ethers.getContractFactory( - "Swap" - )) as Swap__factory; - - swap = (await SwapFactory.deploy(systemContract.address)) as Swap; - await swap.deployed(); - }); - - describe("Swap", function () { - it("Should do swap from EVM Chain", async function () { - const amount = parseEther("1"); - await ZRC20Contracts[0].transfer(systemContract.address, amount); - - const initBalance = await ZRC20Contracts[1].balanceOf(deployer.address); - - const recipient = ethers.utils.hexlify( - ethers.utils.zeroPad(deployer.address, 32) - ); - - const params = defaultAbiCoder.encode( - ["address", "bytes"], - [ZRC20Contracts[1].address, recipient] - ); - - await systemContract.onCrossChainCall( - 1, // ETH chain id - swap.address, - ZRC20Contracts[0].address, - amount, - params, - { gasLimit: 10_000_000 } - ); - - const endBalance = await ZRC20Contracts[1].balanceOf(deployer.address); - - expect(endBalance).to.be.gt(initBalance); - }); - - it("Should do swap from Bitcoin Chain", async function () { - const amount = parseEther("1"); - await ZRC20Contracts[0].transfer(systemContract.address, amount); - - const initBalance = await ZRC20Contracts[1].balanceOf(deployer.address); - - const rawMemo = `${ZRC20Contracts[1].address}${deployer.address.slice( - 2 - )}`; - const rawMemoBytes = ethers.utils.arrayify(rawMemo); - - const params = ethers.utils.solidityPack(["bytes"], [rawMemoBytes]); - - await systemContract.onCrossChainCall( - 18332, // Bitcoin chain id - swap.address, - ZRC20Contracts[0].address, - amount, - params, - { gasLimit: 10_000_000 } - ); - - const endBalance = await ZRC20Contracts[1].balanceOf(deployer.address); - - expect(endBalance).to.be.gt(initBalance); - }); - }); -}); diff --git a/omnichain/swap/test/SwapToAnyToken.spec.ts b/omnichain/swap/test/SwapToAnyToken.spec.ts deleted file mode 100644 index d4e7a7a8..00000000 --- a/omnichain/swap/test/SwapToAnyToken.spec.ts +++ /dev/null @@ -1,170 +0,0 @@ -import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers"; -import { deployUniswap, deployWZETA, evmSetup } from "@zetachain/toolkit/test"; -import { expect } from "chai"; -import { defaultAbiCoder, parseEther } from "ethers/lib/utils"; -import { ethers } from "hardhat"; - -import { - MockSystemContract, - MockZRC20, - SwapToAnyToken, - SwapToAnyToken__factory, - TestUniswapRouter, - UniswapV2Factory, - WZETA, -} from "../typechain-types"; - -describe("SwapToAnyToken", function () { - let uniswapFactory: UniswapV2Factory; - let uniswapRouter: TestUniswapRouter; - let swapToAnyToken: SwapToAnyToken; - let accounts: SignerWithAddress[]; - let deployer: SignerWithAddress; - let systemContract: MockSystemContract; - let ZRC20Contracts: MockZRC20[]; - let wGasToken: WZETA; - - beforeEach(async function () { - accounts = await ethers.getSigners(); - [deployer] = accounts; - - const wZETA = await deployWZETA(deployer); - wGasToken = wZETA; - - const deployResult = await deployUniswap(deployer, wGasToken.address); - uniswapFactory = deployResult.uniswapFactory; - uniswapRouter = deployResult.uniswapRouter; - - const evmSetupResult = await evmSetup( - wGasToken.address, - uniswapFactory.address, - uniswapRouter.address - ); - ZRC20Contracts = evmSetupResult.ZRC20Contracts; - systemContract = evmSetupResult.systemContract; - - const SwapToAnyTokenFactory = (await ethers.getContractFactory( - "SwapToAnyToken" - )) as SwapToAnyToken__factory; - - swapToAnyToken = (await SwapToAnyTokenFactory.deploy( - systemContract.address - )) as SwapToAnyToken; - await swapToAnyToken.deployed(); - }); - - describe("SwapToAnyToken", function () { - it("Should do swap from EVM Chain and withdraw", async function () { - const amount = parseEther("1"); - await ZRC20Contracts[0].transfer(systemContract.address, amount); - - const initBalance = await ZRC20Contracts[1].balanceOf(deployer.address); - - const recipient = ethers.utils.arrayify(deployer.address); - - const withdraw = true; - - const params = defaultAbiCoder.encode( - ["address", "bytes", "bool"], - [ZRC20Contracts[1].address, recipient, withdraw] - ); - - await systemContract.onCrossChainCall( - 1, // ETH chain id - swapToAnyToken.address, - ZRC20Contracts[0].address, - amount, - params, - { gasLimit: 10_000_000 } - ); - - const endBalance = await ZRC20Contracts[1].balanceOf(deployer.address); - - expect(endBalance).to.be.gt(initBalance); - }); - - it("Should do swap from EVM Chain and no withdraw", async function () { - const amount = parseEther("1"); - await ZRC20Contracts[0].transfer(systemContract.address, amount); - - const initBalance = await ZRC20Contracts[1].balanceOf(deployer.address); - - const recipient = ethers.utils.arrayify(deployer.address); - - const withdraw = false; - - const params = defaultAbiCoder.encode( - ["address", "bytes", "bool"], - [ZRC20Contracts[1].address, recipient, withdraw] - ); - - await systemContract.onCrossChainCall( - 1, // ETH chain id - swapToAnyToken.address, - ZRC20Contracts[0].address, - amount, - params, - { gasLimit: 10_000_000 } - ); - - const endBalance = await ZRC20Contracts[1].balanceOf(deployer.address); - expect(endBalance).to.be.gt(initBalance); - }); - - it("Should do swap from Bitcoin Chain with withdraw", async function () { - const amount = parseEther("1"); - await ZRC20Contracts[0].transfer(systemContract.address, amount); - - const initBalance = await ZRC20Contracts[1].balanceOf(deployer.address); - const withdraw = "0x01".slice(2); - - const rawMemo = `${ZRC20Contracts[1].address}${deployer.address.slice( - 2 - )}${withdraw}`; - const rawMemoBytes = ethers.utils.arrayify(rawMemo); - - const params = ethers.utils.solidityPack(["bytes"], [rawMemoBytes]); - - await systemContract.onCrossChainCall( - 18332, // Bitcoin chain id - swapToAnyToken.address, - ZRC20Contracts[0].address, - amount, - params, - { gasLimit: 10_000_000 } - ); - - const endBalance = await ZRC20Contracts[1].balanceOf(deployer.address); - - expect(endBalance).to.be.gt(initBalance); - }); - - it("Should do swap from Bitcoin Chain with no withdraw", async function () { - const amount = parseEther("1"); - await ZRC20Contracts[0].transfer(systemContract.address, amount); - - const initBalance = await ZRC20Contracts[1].balanceOf(deployer.address); - const withdraw = "0x00".slice(2); - - const rawMemo = `${ZRC20Contracts[1].address}${deployer.address.slice( - 2 - )}${withdraw}`; - const rawMemoBytes = ethers.utils.arrayify(rawMemo); - - const params = ethers.utils.solidityPack(["bytes"], [rawMemoBytes]); - - await systemContract.onCrossChainCall( - 18332, // Bitcoin chain id - swapToAnyToken.address, - ZRC20Contracts[0].address, - amount, - params, - { gasLimit: 10_000_000 } - ); - - const endBalance = await ZRC20Contracts[1].balanceOf(deployer.address); - - expect(endBalance).to.be.gt(initBalance); - }); - }); -}); diff --git a/scripts/build.sh b/scripts/build.sh index 56f30889..f3862201 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -1,9 +1,9 @@ #!/bin/bash -rm -rf abi && mkdir -p abi/examples abi/omnichain +rm -rf abi && mkdir -p abi/examples rm -rf typescript-types && mkdir typescript-types -for dir in ./examples/*/ ./omnichain/*/; do +for dir in ./examples/*/; do subdir=$(echo $dir | cut -d'/' -f2) cd $dir && yarn && npx hardhat compile --force && cp -r artifacts/contracts/* ../../abi/$subdir/ && cd ../../;