-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdeploy_contract.sh
More file actions
executable file
·72 lines (68 loc) · 2.52 KB
/
Copy pathdeploy_contract.sh
File metadata and controls
executable file
·72 lines (68 loc) · 2.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/usr/bin/env bash
set -euo pipefail
RPC_URL="${RPC_URL:-https://ethereum-sepolia.publicnode.com}"
GAS_LIMIT="${GAS_LIMIT:-6000000}"
usage() {
echo "Usage: $0 <contract>"
echo " contract: GameItems | GameToken | NFTMarketplace | UniswapLiquiditySetup | AddLiquidity | TokenBalance | QueryLiquidity"
exit 1
}
[ $# -eq 1 ] || usage
case "$1" in
GameItems)
echo "=== Deploying GameItems ==="
forge script script/GameItems.s.sol:GameItemsScript \
--rpc-url "$RPC_URL" \
--broadcast --verify --chain sepolia \
--gas-limit "$GAS_LIMIT"
;;
GameToken)
echo "=== Deploying GameToken ==="
forge script script/GameToken.s.sol:GameTokenScript \
--rpc-url "$RPC_URL" \
--broadcast --verify --chain sepolia \
--gas-limit "$GAS_LIMIT"
;;
NFTMarketplace)
echo "=== Deploying NFTMarketplace ==="
[ -z "${PRIVATE_KEY:-}" ] && { echo "PRIVATE_KEY must be set"; exit 1; }
export PRIVATE_KEY
forge script script/NFTMarketplace.s.sol:NFTMarketplaceScript \
--rpc-url "$RPC_URL" \
--broadcast --verify --chain sepolia \
--gas-limit "$GAS_LIMIT"
;;
UniswapLiquiditySetup)
echo "=== Deploying UniswapLiquiditySetup ==="
[ -z "${PRIVATE_KEY:-}" ] && { echo "PRIVATE_KEY must be set"; exit 1; }
export PRIVATE_KEY
forge script script/UniswapLiquiditySetup.s.sol:UniswapLiquiditySetupScript \
--rpc-url "$RPC_URL" \
--broadcast --verify --chain sepolia \
--gas-limit "$GAS_LIMIT"
;;
AddLiquidity)
echo "=== Adding liquidity (GameToken + ETH) ==="
[ -z "${PRIVATE_KEY:-}" ] && { echo "PRIVATE_KEY must be set"; exit 1; }
echo "Prerequisite: deployer must hold enough GameToken (mint first via cast send if owner)."
forge script script/AddLiquidity.s.sol:AddLiquidityScript \
--rpc-url "$RPC_URL" \
--broadcast \
--gas-limit "$GAS_LIMIT"
;;
TokenBalance)
echo "=== Querying token balance ==="
forge script script/TokenBalance.s.sol:TokenBalanceScript \
--rpc-url "$RPC_URL" \
--gas-limit "$GAS_LIMIT"
;;
query-liquidity)
echo "=== Querying liquidity pool reserves ==="
forge script script/QueryLiquidity.s.sol:QueryLiquidityScript \
--rpc-url "$RPC_URL" \
--gas-limit "$GAS_LIMIT"
;;
*)
usage
;;
esac