-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
197 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
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") | ||
local ETHEREUM=$(cast call "$CONTRACT_ETHEREUM" "balanceOf(address)(uint256)" "$SENDER") | ||
local BNB=$(cast call "$CONTRACT_BNB" "balanceOf(address)(uint256)" "$SENDER") | ||
echo -e "\n🖼️ NFT Balance" | ||
echo "---------------------------------------------" | ||
echo "🟢 ZetaChain: $ZETACHAIN" | ||
echo "🔵 Ethereum: $ETHEREUM" | ||
echo "🟡 BNB Chain: $BNB" | ||
echo "---------------------------------------------" | ||
} | ||
|
||
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_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_BNB=$(jq -r '.addresses[] | select(.type=="gatewayEVM" and .chain=="bnb") | .address' localnet.json) | ||
SENDER=0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 | ||
|
||
CONTRACT_ZETACHAIN=$(npx hardhat deploy --network localhost --gateway 0x5FC8d32690cc91D4c39d9d3abcBD16989F875707 --system-contract 0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9 --json --gas-limit 1000000 | 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') | ||
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') | ||
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 | ||
|
||
npx hardhat localnet-check | ||
balance | ||
|
||
NFT_ID=$(npx hardhat mint --network localhost --json --contract "$CONTRACT_ZETACHAIN" --token-uri https://example.com/nft/metadata/1 | jq -r '.tokenId') | ||
echo -e "\nMinted NFT with ID: $NFT_ID on ZetaChain." | ||
|
||
npx hardhat localnet-check | ||
balance | ||
|
||
echo -e "\nTransferring NFT: ZetaChain → Ethereum..." | ||
npx hardhat transfer --network localhost --json --token-id "$NFT_ID" --from "$CONTRACT_ZETACHAIN" --to "$ZRC20_ETHEREUM" | ||
|
||
npx hardhat localnet-check | ||
balance | ||
|
||
echo -e "\nTransferring NFT: Ethereum → BNB..." | ||
npx hardhat transfer --network localhost --json --token-id "$NFT_ID" --from "$CONTRACT_ETHEREUM" --to "$ZRC20_BNB" --gas-amount 0.1 | ||
|
||
npx hardhat localnet-check | ||
balance | ||
|
||
echo -e "\nTransferring NFT: BNB → ZetaChain..." | ||
npx hardhat transfer --network localhost --json --token-id "$NFT_ID" --from "$CONTRACT_BNB" | ||
|
||
npx hardhat localnet-check | ||
balance | ||
|
||
if [ "$1" = "start" ]; then npx hardhat localnet-stop; fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/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) | ||
SENDER=0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 | ||
|
||
CONTRACT_ZETACHAIN=$(npx hardhat deploy --name Swap --network localhost --gateway "$GATEWAY_ZETACHAIN" --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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
if [ "$1" = "start" ]; then npx hardhat localnet --exit-on-error & sleep 10; fi | ||
|
||
function balance() { | ||
echo -e "\n🖼️ Balance" | ||
echo "---------------------------------------------" | ||
local ZETACHAIN=$(cast call "$CONTRACT_ZETACHAIN" "balanceOf(address)(uint256)" "$SENDER") | ||
local ETHEREUM=$(cast call "$CONTRACT_ETHEREUM" "balanceOf(address)(uint256)" "$SENDER") | ||
local BNB=$(cast call "$CONTRACT_BNB" "balanceOf(address)(uint256)" "$SENDER") | ||
echo "🟢 ZetaChain: $ZETACHAIN" | ||
echo "🔵 EVM Chain: $ETHEREUM" | ||
echo "🟡 BNB Chain: $BNB" | ||
echo "---------------------------------------------" | ||
} | ||
|
||
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_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_BNB=$(jq -r '.addresses[] | select(.type=="gatewayEVM" and .chain=="bnb") | .address' localnet.json) | ||
SENDER=0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 | ||
|
||
|
||
CONTRACT_ZETACHAIN=$(npx hardhat deploy --network localhost --gas-limit 700000 --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 EVM chain: $CONTRACT_ETHEREUM" | ||
|
||
CONTRACT_BNB=$(npx hardhat deploy --name Connected --json --network localhost --gateway "$GATEWAY_BNB" | jq -r '.contractAddress') | ||
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 | ||
|
||
npx hardhat localnet-check | ||
balance | ||
|
||
TOKEN=$(npx hardhat mint --network localhost --json --contract "$CONTRACT_ZETACHAIN" --to "$SENDER" --amount 10 | jq -r '.contractAddress') | ||
echo -e "\nMinted tokens: $TOKEN on ZetaChain." | ||
|
||
npx hardhat localnet-check | ||
balance | ||
|
||
echo -e "\nTransferring token: ZetaChain → Ethereum..." | ||
npx hardhat transfer --network localhost --json --amount 10 --from "$CONTRACT_ZETACHAIN" --to "$ZRC20_ETHEREUM" | ||
|
||
npx hardhat localnet-check | ||
balance | ||
|
||
echo -e "\nTransferring token: Ethereum → BNB..." | ||
npx hardhat transfer --network localhost --json --amount 10 --from "$CONTRACT_ETHEREUM" --to "$ZRC20_BNB" --gas-amount 1 | ||
|
||
npx hardhat localnet-check | ||
balance | ||
|
||
echo -e "\nTransferring token: BNB → ZetaChain..." | ||
npx hardhat transfer --network localhost --json --amount 10 --from "$CONTRACT_BNB" | ||
|
||
npx hardhat localnet-check | ||
balance | ||
|
||
if [ "$1" = "start" ]; then npx hardhat localnet-stop; fi |