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

fix: nft testnet script #221

Merged
merged 2 commits into from
Dec 2, 2024
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
6 changes: 3 additions & 3 deletions examples/nft/scripts/localnet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ GATEWAY_BNB=$(jq -r '.addresses[] | select(.type=="gatewayEVM" and .chain=="bnb"
UNISWAP_ROUTER=$(jq -r '.addresses[] | select(.type=="uniswapRouterInstance" and .chain=="zetachain") | .address' localnet.json)
SENDER=0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266

CONTRACT_ZETACHAIN=$(npx hardhat deploy --network localhost --gateway "$GATEWAY_ZETACHAIN" --uniswap-router "$UNISWAP_ROUTER" --json | jq -r '.contractAddress')
CONTRACT_ZETACHAIN=$(npx hardhat deploy --network localhost --gateway "$GATEWAY_ZETACHAIN" --deploy-gas-limit 10000000 --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')
CONTRACT_ETHEREUM=$(npx hardhat deploy --name Connected --json --network localhost --deploy-gas-limit 10000000 --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')
CONTRACT_BNB=$(npx hardhat deploy --name Connected --json --network localhost --deploy-gas-limit 10000000 --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"
Expand Down
10 changes: 5 additions & 5 deletions examples/nft/scripts/testnet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ 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')
UNIVERSAL=$(npx hardhat deploy --name Universal --network zeta_testnet --deploy-gas-limit 10000000 --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-universal --network base_sepolia --contract "$CONNECTED_BASE" --universal "$UNIVERSAL" --json

npx hardhat connected-set-counterparty --network bsc_testnet --contract "$CONNECTED_BNB" --counterparty "$UNIVERSAL" --json
npx hardhat connected-set-universal --network bsc_testnet --contract "$CONNECTED_BNB" --universal "$UNIVERSAL" --json

npx hardhat universal-set-counterparty --network zeta_testnet --contract "$UNIVERSAL" --counterparty "$CONNECTED_BASE" --zrc20 "$ZRC20_BASE" --json
npx hardhat universal-set-connected --network zeta_testnet --contract "$UNIVERSAL" --connected "$CONNECTED_BASE" --zrc20 "$ZRC20_BASE" --json

npx hardhat universal-set-counterparty --network zeta_testnet --contract "$UNIVERSAL" --counterparty "$CONNECTED_BNB" --zrc20 "$ZRC20_BNB" --json
npx hardhat universal-set-connected --network zeta_testnet --contract "$UNIVERSAL" --connected "$CONNECTED_BNB" --zrc20 "$ZRC20_BNB" --json
6 changes: 6 additions & 0 deletions examples/nft/tasks/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const main = async (args: any, hre: HardhatRuntimeEnvironment) => {
...(args.uniswapRouter ? [args.uniswapRouter] : []),
{
gasPrice: args.deployGasPrice,
gasLimit: args.deployGasLimit,
}
);

Expand Down Expand Up @@ -64,4 +65,9 @@ task("deploy", "Deploy the NFT contract", main)
"Gas price for deploy transaction",
"10000000000"
)
.addOptionalParam(
"deployGasLimit",
"Gas limit for deploy transaction",
"5000000"
)
Comment on lines +68 to +72
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Convert deployGasLimit default value to number type

The default value for deployGasLimit is defined as a string "5000000", but should be a number for consistency with other gas-related parameters and to prevent potential type coercion issues.

Apply this change:

  .addOptionalParam(
    "deployGasLimit",
    "Gas limit for deploy transaction",
-   "5000000"
+   5000000,
+   types.int
  )
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
.addOptionalParam(
"deployGasLimit",
"Gas limit for deploy transaction",
"5000000"
)
.addOptionalParam(
"deployGasLimit",
"Gas limit for deploy transaction",
5000000,
types.int
)

.addOptionalParam("uniswapRouter", "Uniswap v2 Router address");