Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solana and Sui support #232

Merged
merged 25 commits into from
Feb 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ jobs:
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1

- name: Install Anchor (Solana)
uses: metadaoproject/[email protected]

- name: Run Test Script
run: |
cd "${{ matrix.example-dir }}"
Expand Down
2 changes: 2 additions & 0 deletions examples/call/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ cache_forge
access_token

localnet.json

test-ledger
6 changes: 3 additions & 3 deletions examples/call/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
"@types/node": ">=12.0.0",
"@typescript-eslint/eslint-plugin": "^5.59.9",
"@typescript-eslint/parser": "^5.59.9",
"@zetachain/localnet": "4.0.0-rc6",
"@zetachain/toolkit": "13.0.0-rc15",
"@zetachain/localnet": "6.0.0-rc8",
"@zetachain/toolkit": "13.0.0-rc17",
"axios": "^1.3.6",
"chai": "^4.2.0",
"dotenv": "^16.0.3",
Expand Down Expand Up @@ -61,4 +61,4 @@
"@zetachain/protocol-contracts": "11.0.0-rc3",
"@zetachain/protocol-contracts-solana": "2.0.0-rc1"
}
}
}
99 changes: 98 additions & 1 deletion examples/call/scripts/localnet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ set -e
set -x
set -o pipefail

if [ "$1" = "start" ]; then npx hardhat localnet --exit-on-error & sleep 10; fi
if [ "$1" = "start" ]; then npx hardhat localnet & sleep 15; 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)
ZRC20_SOL=$(jq -r '.addresses[] | select(.type=="ZRC-20 SOL on 901") | .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
Expand Down Expand Up @@ -107,4 +108,100 @@ npx hardhat universal-withdraw-and-call \

npx hardhat localnet-check

# Testing toolkit methods

npx hardhat evm-deposit \
--receiver "$CONTRACT_ZETACHAIN" \
--gateway-evm "$GATEWAY_ETHEREUM" \
--network localhost \
--amount 1

npx hardhat localnet-check

npx hardhat evm-deposit \
--receiver "$CONTRACT_ZETACHAIN" \
--gateway-evm "$GATEWAY_ETHEREUM" \
--network localhost \
--erc20 "$ERC20_ETHEREUM" \
--amount 1

npx hardhat localnet-check

npx hardhat evm-call \
--receiver "$CONTRACT_ZETACHAIN" \
--gateway-evm "$GATEWAY_ETHEREUM" \
--network localhost \
--types '["string"]' alice

npx hardhat localnet-check

npx hardhat evm-deposit-and-call \
--receiver "$CONTRACT_ZETACHAIN" \
--gateway-evm "$GATEWAY_ETHEREUM" \
--network localhost \
--amount 1 \
--types '["string"]' alice

npx hardhat localnet-check

npx hardhat evm-deposit-and-call \
--receiver "$CONTRACT_ZETACHAIN" \
--gateway-evm "$GATEWAY_ETHEREUM" \
--network localhost \
--amount 1 \
--erc20 "$ERC20_ETHEREUM" \
--types '["string"]' alice

npx hardhat localnet-check

npx hardhat zetachain-withdraw \
--receiver "$CONTRACT_ETHEREUM" \
--gateway-zeta-chain "$GATEWAY_ZETACHAIN" \
--zrc20 "$ZRC20_ETHEREUM" \
--network localhost \
--amount 1

npx hardhat localnet-check

npx hardhat zetachain-withdraw \
--receiver "DrexsvCMH9WWjgnjVbx1iFf3YZcKadupFmxnZLfSyotd" \
--gateway-zeta-chain "$GATEWAY_ZETACHAIN" \
--zrc20 "$ZRC20_SOL" \
--network localhost \
--amount 1

npx hardhat localnet-check

npx hardhat zetachain-call \
--receiver "$CONTRACT_ETHEREUM" \
--gateway-zeta-chain "$GATEWAY_ZETACHAIN" \
--zrc20 "$ZRC20_ETHEREUM" \
--function "hello(string)" \
--network localhost \
--types '["string"]' alice

npx hardhat localnet-check

npx hardhat zetachain-withdraw-and-call \
--receiver "$CONTRACT_ETHEREUM" \
--gateway-zeta-chain "$GATEWAY_ZETACHAIN" \
--zrc20 "$ZRC20_ETHEREUM" \
--function "hello(string)" \
--amount 1 \
--network localhost \
--call-options-is-arbitrary-call \
--types '["string"]' hello

npx hardhat localnet-check

npx hardhat zetachain-withdraw-and-call \
--receiver "$CONTRACT_ETHEREUM" \
--gateway-zeta-chain "$GATEWAY_ZETACHAIN" \
--zrc20 "$ZRC20_ETHEREUM" \
--amount 1 \
--network localhost \
--types '["string"]' hello

npx hardhat localnet-check

if [ "$1" = "start" ]; then npx hardhat localnet-stop; fi
Loading
Loading