Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
fadeev committed Nov 17, 2024
1 parent 01700ef commit 29bb170
Show file tree
Hide file tree
Showing 6 changed files with 119 additions and 10 deletions.
7 changes: 4 additions & 3 deletions examples/nft/scripts/localnet.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/bin/bash

set -e
set -x

if [ "$1" = "start" ]; then npx hardhat localnet --exit-on-error & sleep 10; fi

Expand All @@ -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')
Expand Down
9 changes: 7 additions & 2 deletions examples/nft/tasks/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)",
Expand Down
4 changes: 3 additions & 1 deletion examples/token/contracts/Connected.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
95 changes: 95 additions & 0 deletions examples/token/localnet.json
Original file line number Diff line number Diff line change
@@ -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"
}
]
}
5 changes: 3 additions & 2 deletions examples/token/scripts/localnet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
9 changes: 7 additions & 2 deletions examples/token/tasks/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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)",
Expand Down

0 comments on commit 29bb170

Please sign in to comment.