diff --git a/examples/nft/scripts/localnet.sh b/examples/nft/scripts/localnet.sh index 2da2baf..c9d0393 100755 --- a/examples/nft/scripts/localnet.sh +++ b/examples/nft/scripts/localnet.sh @@ -1,7 +1,6 @@ #!/bin/bash set -e -set -x if [ "$1" = "start" ]; then npx hardhat localnet --exit-on-error & sleep 10; fi @@ -22,14 +21,16 @@ 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) +SYSTEM_CONTRACT=$(jq -r '.addresses[] | select(.type=="systemContract" and .chain=="zetachain") | .address' localnet.json) SENDER=0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 -CONTRACT_ZETACHAIN=$(npx hardhat deploy --network localhost --gateway 0x5FC8d32690cc91D4c39d9d3abcBD16989F875707 --system-contract 0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9 --json --gas-limit 1000000 | jq -r '.contractAddress') +CONTRACT_ZETACHAIN=$(npx hardhat deploy --network localhost --gateway "$GATEWAY_ZETACHAIN" --system-contract "$SYSTEM_CONTRACT" --json | jq -r '.contractAddress') echo -e "\nšŸš€ Deployed NFT contract on ZetaChain: $CONTRACT_ZETACHAIN" -CONTRACT_ETHEREUM=$(npx hardhat deploy --name Connected --json --network localhost --gas-limit 1000000 --gateway "$GATEWAY_ETHEREUM" | jq -r '.contractAddress') +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 --gas-limit 1000000 --gateway "$GATEWAY_BNB" | jq -r '.contractAddress') diff --git a/examples/nft/tasks/deploy.ts b/examples/nft/tasks/deploy.ts index 1b861f4..d5927eb 100644 --- a/examples/nft/tasks/deploy.ts +++ b/examples/nft/tasks/deploy.ts @@ -18,7 +18,7 @@ const main = async (args: any, hre: HardhatRuntimeEnvironment) => { signer.address, args.tokenName, args.tokenSymbol, - ...(args.gasLimit ? [args.gasLimit] : []), + args.gasLimit, ...(args.systemContract ? [args.systemContract] : []), { gasPrice: args.deployGasPrice, @@ -48,7 +48,12 @@ task("deploy", "Deploy the NFT contract", main) .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)", diff --git a/examples/token/contracts/Connected.sol b/examples/token/contracts/Connected.sol index 0f292d2..909e4df 100644 --- a/examples/token/contracts/Connected.sol +++ b/examples/token/contracts/Connected.sol @@ -30,10 +30,12 @@ contract Connected is ERC20, Ownable2Step, Events { 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); } diff --git a/examples/token/localnet.json b/examples/token/localnet.json new file mode 100644 index 0000000..3f6fcc0 --- /dev/null +++ b/examples/token/localnet.json @@ -0,0 +1,95 @@ +{ + "pid": 62617, + "addresses": [ + { + "chain": "zetachain", + "type": "gatewayZEVM", + "address": "0x5FC8d32690cc91D4c39d9d3abcBD16989F875707" + }, + { + "chain": "zetachain", + "type": "systemContract", + "address": "0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9" + }, + { + "chain": "zetachain", + "type": "wzeta", + "address": "0x5FbDB2315678afecb367f032d93F642f64180aa3" + }, + { + "chain": "zetachain", + "type": "uniswapFactoryInstance", + "address": "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512" + }, + { + "chain": "zetachain", + "type": "uniswapRouterInstance", + "address": "0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0" + }, + { + "chain": "zetachain", + "type": "ZRC-20 ETH on 5", + "address": "0x2ca7d64A7EFE2D62A725E2B35Cf7230D6677FfEe" + }, + { + "chain": "zetachain", + "type": "ZRC-20 USDC on 5", + "address": "0xd97B1de3619ed2c6BEb3860147E30cA8A7dC9891" + }, + { + "chain": "zetachain", + "type": "ZRC-20 BNB on 97", + "address": "0x65a45c57636f9BcCeD4fe193A602008578BcA90b" + }, + { + "chain": "zetachain", + "type": "ZRC-20 USDC on 97", + "address": "0x05BA149A7bd6dC1F937fA9046A9e05C05f3b18b0" + }, + { + "chain": "zetachain", + "type": "tss", + "address": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" + }, + { + "chain": "ethereum", + "type": "zetaConnector", + "address": "0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e" + }, + { + "chain": "ethereum", + "type": "gatewayEVM", + "address": "0x610178dA211FEF7D417bC0e6FeD39F05609AD788" + }, + { + "chain": "ethereum", + "type": "custody", + "address": "0xA51c1fc2f0D1a1b8494Ed1FE312d7C3a78Ed91C0" + }, + { + "chain": "ethereum", + "type": "testEVMZeta", + "address": "0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6" + }, + { + "chain": "bnb", + "type": "zetaConnector", + "address": "0xc6e7DF5E7b4f2A278906862b61205850344D4e7d" + }, + { + "chain": "bnb", + "type": "gatewayEVM", + "address": "0x3Aa5ebB10DC797CAC828524e59A333d0A371443c" + }, + { + "chain": "bnb", + "type": "custody", + "address": "0x59b670e9fA9D0A427751Af201D676719a970857b" + }, + { + "chain": "bnb", + "type": "testEVMZeta", + "address": "0x9A9f2CCfdE556A7E9Ff0848998Aa4a0CFD8863AE" + } + ] +} \ No newline at end of file diff --git a/examples/token/scripts/localnet.sh b/examples/token/scripts/localnet.sh index 36ee1c2..7446e19 100755 --- a/examples/token/scripts/localnet.sh +++ b/examples/token/scripts/localnet.sh @@ -21,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) +SYSTEM_CONTRACT=$(jq -r '.addresses[] | select(.type=="systemContract" 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" --system-contract "$SYSTEM_CONTRACT" --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') diff --git a/examples/token/tasks/deploy.ts b/examples/token/tasks/deploy.ts index 7f2cb0b..1241280 100644 --- a/examples/token/tasks/deploy.ts +++ b/examples/token/tasks/deploy.ts @@ -17,7 +17,7 @@ const main = async (args: any, hre: HardhatRuntimeEnvironment) => { signer.address, args.tokenName, args.tokenSymbol, - ...(args.gasLimit ? [args.gasLimit] : []), + args.gasLimit, ...(args.systemContract ? [args.systemContract] : []) ); await contract.deployed(); @@ -43,7 +43,12 @@ 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)",