forked from ethereum-optimism/superchain-ops
-
Notifications
You must be signed in to change notification settings - Fork 0
/
single.just
70 lines (61 loc) · 2.27 KB
/
single.just
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
set dotenv-load
export rpcUrl := env_var('ETH_RPC_URL')
export signatures := env_var_or_default('SIGNATURES', '')
export bundleName := env_var_or_default('BUNDLE_NAME', 'input')
export taskPath := invocation_directory()
export ownerSafe := env_var('OWNER_SAFE')
simulate hdPath='0':
#!/usr/bin/env bash
bundlePath=${taskPath}/${bundleName}.json
script=SignFromJson
if [ -f "${taskPath}/SignFromJson.s.sol" ]; then
script="${taskPath}/SignFromJson.s.sol"
fi
echo "Using script ${script}"
echo "Safe address: ${ownerSafe}"
echo "Getting signer address..."
if [ ! -z "$SIMULATE_WITHOUT_LEDGER" ]; then
signer=$(cast call ${ownerSafe} "getOwners()(address[])" -r ${rpcUrl} | grep -oE '0x[a-fA-F0-9]{40}' | head -n1)
else
signer=$(cast wallet address --ledger --mnemonic-derivation-path "m/44'/60'/{{hdPath}}'/0/0")
fi
echo "Simulating with: ${signer}"
echo ""
forge build
forge script ${script} \
--rpc-url ${rpcUrl} \
--sig "signJson(string)" ${bundlePath} \
--sender ${signer}
sign hdPath='0':
#!/usr/bin/env bash
bundlePath=${taskPath}/${bundleName}.json
script=SignFromJson
if [ -f "${taskPath}/SignFromJson.s.sol" ]; then
script="${taskPath}/SignFromJson.s.sol"
fi
echo "Using script ${script}"
echo "getting signer address..."
signer=$(cast wallet address --ledger --mnemonic-derivation-path "m/44'/60'/{{hdPath}}'/0/0")
echo "Signing with: ${signer}"
echo ""
forge build
# Using the eip712sign within the repo folder since eip712sign was installed there in ./justfile.
$(git rev-parse --show-toplevel)/bin/eip712sign --ledger --hd-paths "m/44'/60'/{{hdPath}}'/0/0" -- \
forge script ${script} \
--rpc-url ${rpcUrl} \
--sig "signJson(string)" \
${bundlePath}
execute hdPath='0':
#!/usr/bin/env bash
bundlePath=${taskPath}/${bundleName}.json
script=SignFromJson
if [ -f "${taskPath}/SignFromJson.s.sol" ]; then
script="${taskPath}/SignFromJson.s.sol"
fi
echo "Using script ${script}"
sender=$(cast wallet address --ledger --mnemonic-derivation-path "m/44'/60'/{{hdPath}}'/0/0")
forge build
forge script --fork-url ${ETH_RPC_URL} ${script} \
--sig "runJson(string,bytes)" ${bundlePath} ${SIGNATURES} \
--ledger --hd-paths "m/44'/60'/{{hdPath}}'/0/0" --broadcast \
--sender ${sender}