forked from ethereum-optimism/superchain-ops
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nested.just
147 lines (133 loc) · 4.61 KB
/
nested.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
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
set dotenv-load
export rpcUrl := env_var_or_default('ETH_RPC_URL', 'https://ethereum.publicnode.com')
export signatures := env_var_or_default('SIGNATURES', '')
export bundleName := env_var_or_default('BUNDLE_NAME', 'input')
export taskPath := invocation_directory()
# Accounts
export councilSafe := env_var("COUNCIL_SAFE")
export foundationSafe := env_var("FOUNDATION_SAFE")
export ownerSafe := env_var('OWNER_SAFE')
export randomPersonEoa := "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
simulate whichSafe hdPath='0':
#!/usr/bin/env bash
bundlePath=${taskPath}/${bundleName}.json
script=NestedSignFromJson
if [ -f "${taskPath}/NestedSignFromJson.s.sol" ]; then
script="${taskPath}/NestedSignFromJson.s.sol"
echo "Running script with assertions"
fi
echo "Using script ${script}"
echo "getting signer address for {{whichSafe}}..."
if [ "{{whichSafe}}" == "foundation" ]; then
safe="{{foundationSafe}}"
fi
if [ "{{whichSafe}}" == "council" ]; then
safe="{{councilSafe}}"
fi
signer=$(cast call ${safe} "getOwners()(address[])" -r ${rpcUrl} | grep -oE '0x[a-fA-F0-9]{40}' | head -n1)
echo "safe: $safe"
echo "Simulating call to {{whichSafe}} at ${safe}"
if [ -z "$SIMULATE_WITHOUT_LEDGER" ]; then
signer=$(cast wallet address --ledger --mnemonic-derivation-path "m/44'/60'/{{hdPath}}'/0/0")
echo "Simulating with ledger account: ${signer}"
else
echo "Simulating without ledger using the first owner account: ${signer}"
fi
echo ""
forge build
forge script ${script} \
--rpc-url ${rpcUrl} \
--sender ${signer} \
--sig "signJson(string,address)" \
${bundlePath} \
"${safe}"
sign whichSafe hdPath='0':
#!/usr/bin/env bash
bundlePath=${taskPath}/${bundleName}.json
script=NestedSignFromJson
if [ -f "${taskPath}/NestedSignFromJson.s.sol" ]; then
script="${taskPath}/NestedSignFromJson.s.sol"
echo "Running script with assertions"
fi
echo "Using script ${script}"
if [ "{{whichSafe}}" == "foundation" ]; then
safe="{{foundationSafe}}"
echo "Using foundation safe at ${safe}"
fi
if [ "{{whichSafe}}" == "council" ]; then
safe="{{councilSafe}}"
echo "Using council safe at ${safe}"
fi
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,address)" \
${bundlePath} \
"${safe}"
approve whichSafe hdPath='0':
#!/usr/bin/env bash
bundlePath=${taskPath}/${bundleName}.json
script=NestedSignFromJson
if [ -f "${taskPath}/NestedSignFromJson.s.sol" ]; then
script="${taskPath}/NestedSignFromJson.s.sol"
echo "Running script with assertions"
fi
echo "Using script ${script}"
if [ "{{whichSafe}}" == "foundation" ]; then
safe="{{foundationSafe}}"
echo "Using foundation safe at ${safe}"
fi
if [ "{{whichSafe}}" == "council" ]; then
safe="{{councilSafe}}"
echo "Using council safe at ${safe}"
fi
sender=$(cast wallet address --ledger --mnemonic-derivation-path "m/44'/60'/{{hdPath}}'/0/0")
forge build
forge script ${script} \
--fork-url ${rpcUrl} \
--ledger --hd-paths "m/44'/60'/{{hdPath}}'/0/0" \
--broadcast \
--sender ${sender} \
--sig "approveJson(string,address,bytes)" \
${bundlePath} \
${safe} \
${signatures}
execute hdPath='0':
#!/usr/bin/env bash
bundlePath=${taskPath}/${bundleName}.json
script=NestedSignFromJson
if [ -f "${taskPath}/NestedSignFromJson.s.sol" ]; then
script="${taskPath}/NestedSignFromJson.s.sol"
echo "Running script with assertions"
fi
echo "Using script ${script}"
sender=$(cast wallet address --ledger --mnemonic-derivation-path "m/44'/60'/{{hdPath}}'/0/0")
forge build
forge script ${script} \
--fork-url ${rpcUrl} \
--ledger --hd-paths "m/44'/60'/{{hdPath}}'/0/0" \
--broadcast \
--sender ${sender} \
--sig "runJson(string)" \
${bundlePath}
simulated-run hdPath='0':
#!/usr/bin/env bash
bundlePath=${taskPath}/${bundleName}.json
script=NestedSignFromJson
if [ -f "${taskPath}/NestedSignFromJson.s.sol" ]; then
script="${taskPath}/NestedSignFromJson.s.sol"
echo "Running script with assertions"
fi
echo "Using script ${script}"
forge build
forge script ${script} \
--fork-url ${rpcUrl} \
--sender ${randomPersonEoa} \
--sig "runJson(string)" \
${bundlePath}