forked from kelymer/vibc-app
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Justfile
97 lines (86 loc) · 3.95 KB
/
Justfile
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# Install dependencies
install:
echo "Installing dependencies"
npm install
forge install --shallow
# Compile contracts using the specified compiler or default to Hardhat
# The compiler argument is optional; if not provided, it defaults to "hardhat".
# Usage: just compile [compiler]
compile COMPILER='hardhat':
#!/usr/bin/env sh
if test "{{COMPILER}}" = "hardhat"; then
echo "Compiling contracts with Hardhat..."
npx hardhat compile
elif test "{{COMPILER}}" = "foundry"; then
echo "Compiling contracts with Foundry..."
forge build
else
echo "Unknown compiler: {{COMPILER}}"
exit 1
fi
# Update the config.json file with the contract type for a specified chain/rollup
# The chain and contract-type arguments are REQUIRED;
# The universal argument is optional; if not provided, it defaults to "true".
# It indicates whether the contracts to deploy are using custom or universal IBC channels to send packets.
# Usage: just set-contracts [chain] [contract-type] [universal]
set-contracts CHAIN CONTRACT_TYPE UNIVERSAL='true':
echo "Updating config.json with contract type..."
node scripts/private/_set-contracts-config.js {{CHAIN}} {{CONTRACT_TYPE}} {{UNIVERSAL}}
# Deploy the contracts in the /contracts folder using Hardhat and updating the config.json file
# The source and destination arguments are REQUIRED;
# Usage: just deploy [source] [destination]
deploy SOURCE DESTINATION:
echo "Deploying contracts with Hardhat..."
node scripts/private/_deploy-config.js {{SOURCE}} {{DESTINATION}}
# Run the sanity check script to verify that configuration (.env) files match with deployed contracts' stored values
# Usage: just sanity-check
sanity-check:
echo "Running sanity check..."
node scripts/private/_sanity-check.js
# Update the dispatcher or universal channel handler address on the IBC application, with that from the .env file
# The chain argument is REQUIRED;
# Usage: just update-vibc [chain]
update-vibc CHAIN:
echo "Updating the dispatcher or universal channel handler address..."
npx hardhat run scripts/private/_update-vibc-address.js --network {{CHAIN}}
# Create a channel by triggering a channel handshake from the source and with parameters found in the config.json file
# Usage: just create-channel
create-channel:
echo "Attempting to create a channel with the values from the config..."
node scripts/private/_create-channel-config.js
# Send a packet over the universal channel or a custom channel as defined in the config.json file
# The source argument is REQUIRED;
# Usage: just send-packet [source]
send-packet SOURCE:
echo "Sending a packet with the values from the config..."
node scripts/private/_send-packet-config.js {{SOURCE}}
# Switch between the sim client and the client with proofs
# Usage: just switch-client
switch-client:
echo "Switching between sim client and client with proofs..."
npx hardhat run scripts/private/_update-vibc-address.js --network optimism
npx hardhat run scripts/private/_update-vibc-address.js --network base
node scripts/private/_switch-clients.js
# Run the full E2E flow by setting the contracts, deploying them, creating a channel, and sending a packet
# Usage: just do-it
do-it:
echo "Running the full E2E flow..."
just set-contracts optimism XCounter false && just set-contracts base XCounter false
just deploy optimism base
just sanity-check
just create-channel
just send-packet optimism
echo "You've done it!"
# Clean up the environment by removing the artifacts and cache folders and running the forge clean command
# Usage: just clean
clean:
echo "Cleaning up environment..."
rm -rf artifacts cache
forge clean
# Fully clean the environment by removing the artifacts, the dependencies, and cache folders and running the forge clean-all command
# Usage: just clean-all
clean-all:
echo "Cleaning up environment..."
rm -rf artifacts cache
forge clean
rm -rf node_modules