This repository was archived by the owner on Jun 5, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathTaskfile.yml
More file actions
261 lines (243 loc) · 7.85 KB
/
Copy pathTaskfile.yml
File metadata and controls
261 lines (243 loc) · 7.85 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
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
version: '3'
vars:
SOLC: ./bin/solc
ABIGEN: ./bin/abigen
CONTRACT_ROOT: ./external/arbius
BUILD_DIR: ./build
BINDINGS_DIR: ./bindings
INTERFACES_DIR: "{{.CONTRACT_ROOT}}/contract/contracts/interfaces"
CONTRACTS_DIR: "{{.CONTRACT_ROOT}}/contract/contracts"
NODE_MODULES: "{{.CONTRACT_ROOT}}/contract/node_modules"
LOCAL_CONTRACTS: ./contracts/src
tasks:
_mkdir:
internal: true
cmds:
- cmd: powershell -Command "New-Item -ItemType Directory -Force -Path '{{.DIR}}' | Out-Null"
platforms: [windows]
silent: true
- cmd: mkdir -p "{{.DIR}}"
platforms: [linux, darwin]
silent: true
# --- Public Tasks ---
_build:interface:
internal: true
vars:
NAME: '{{.NAME}}'
PKG: '{{.PKG}}'
TYPE: '{{.TYPE}}'
OUT_DIR: '{{.OUT_DIR}}'
SRC_DIR: '{{.SRC_DIR | default .INTERFACES_DIR}}'
BASE_PATH: '{{.BASE_PATH | default .CONTRACT_ROOT}}/contract'
cmds:
- task: _mkdir
vars: { DIR: '{{.OUT_DIR}}' }
- |
{{.SOLC}} --base-path '{{.BASE_PATH}}' \
--include-path '{{.NODE_MODULES}}' \
--bin --abi {{.SRC_DIR}}/I{{.NAME}}.sol \
-o {{.BUILD_DIR}} --overwrite \
--evm-version london --via-ir --optimize --optimize-runs 10
- |
{{.ABIGEN}} \
--bin={{.BUILD_DIR}}/I{{.NAME}}.bin \
--abi={{.BUILD_DIR}}/I{{.NAME}}.abi \
--pkg={{.PKG}} --type={{.TYPE}} \
--out={{.OUT_DIR}}/{{.PKG}}.go
sources:
- "{{.SRC_DIR}}/I{{.NAME}}.sol"
generates:
- "{{.BUILD_DIR}}/I{{.NAME}}.abi"
- "{{.BUILD_DIR}}/I{{.NAME}}.bin"
- "{{.OUT_DIR}}/{{.PKG}}.go"
_build:contract:
internal: true
vars:
NAME: '{{.NAME}}'
PKG: '{{.PKG}}'
TYPE: '{{.TYPE}}'
OUT_DIR: '{{.OUT_DIR}}'
SRC_DIR: '{{.SRC_DIR | default .CONTRACTS_DIR}}'
BASE_PATH: '{{.BASE_PATH | default .CONTRACTS_DIR}}'
CONTRACT_NAME: '{{.CONTRACT_NAME | default .NAME}}'
cmds:
- task: _mkdir
vars: { DIR: '{{.OUT_DIR}}' }
- |
{{.SOLC}} --base-path '{{.BASE_PATH}}' \
--include-path '{{.NODE_MODULES}}' \
--bin --abi {{.SRC_DIR}}/{{.NAME}}.sol \
-o {{.BUILD_DIR}} --overwrite \
--evm-version london --via-ir --optimize --optimize-runs 10
- |
{{.ABIGEN}} \
--bin={{.BUILD_DIR}}/{{.CONTRACT_NAME}}.bin \
--abi={{.BUILD_DIR}}/{{.CONTRACT_NAME}}.abi \
--pkg={{.PKG}} --type={{.TYPE}} \
--out={{.OUT_DIR}}/{{.PKG}}.go
sources:
- "{{.SRC_DIR}}/{{.NAME}}.sol"
generates:
- "{{.BUILD_DIR}}/{{.CONTRACT_NAME}}.abi"
- "{{.BUILD_DIR}}/{{.CONTRACT_NAME}}.bin"
- "{{.OUT_DIR}}/{{.PKG}}.go"
_build:abi_only:
internal: true
vars:
NAME: '{{.NAME}}'
PKG: '{{.PKG}}'
TYPE: '{{.TYPE}}'
OUT_DIR: '{{.OUT_DIR}}'
SRC_DIR: '{{.SRC_DIR | default .CONTRACTS_DIR}}'
BASE_PATH: '{{.BASE_PATH | default .CONTRACT_ROOT}}/contract'
cmds:
- task: _mkdir
vars: { DIR: '{{.OUT_DIR}}' }
- |
{{.SOLC}} --base-path '{{.BASE_PATH}}' \
--include-path '{{.NODE_MODULES}}' \
--abi {{.SRC_DIR}}/{{.NAME}}.sol \
-o {{.BUILD_DIR}} --overwrite \
--evm-version london --via-ir --optimize --optimize-runs 10
- |
{{.ABIGEN}} \
--abi={{.BUILD_DIR}}/{{.NAME}}.abi \
--pkg={{.PKG}} --type={{.TYPE}} \
--out={{.OUT_DIR}}/{{.PKG}}.go
sources:
- "{{.SRC_DIR}}/{{.NAME}}.sol"
generates:
- "{{.BUILD_DIR}}/{{.NAME}}.abi"
- "{{.OUT_DIR}}/{{.PKG}}.go"
build:voter:
desc: Build Voter interface
cmds:
- task: _build:interface
vars:
NAME: Voter
PKG: voter
TYPE: Voter
OUT_DIR: "{{.BINDINGS_DIR}}/voter"
build:arbiusrouterv1:
desc: Build ArbiusRouterV1 contract
cmds:
- task: _build:contract
vars:
NAME: ArbiusRouterV1
PKG: arbiusrouterv1
TYPE: ArbiusRouterV1
OUT_DIR: "{{.BINDINGS_DIR}}/arbiusrouterv1"
SRC_DIR: "{{.CONTRACTS_DIR}}"
CONTRACT_NAME: ArbiusRouterV1
build:vestaking:
desc: Build VeStaking interface
cmds:
- task: _build:interface
vars:
NAME: VeStaking
PKG: vestaking
TYPE: VeStaking
OUT_DIR: "{{.BINDINGS_DIR}}/vestaking"
build:votingescrow:
desc: Build VotingEscrow interface
cmds:
- task: _build:interface
vars:
NAME: VotingEscrow
PKG: votingescrow
TYPE: VotingEscrow
OUT_DIR: "{{.BINDINGS_DIR}}/votingescrow"
build:enginev5:
desc: Build V2_EngineV5 contract (ABI only)
cmds:
- task: _build:abi_only
vars:
NAME: V2_EngineV5
PKG: engine
TYPE: Engine
OUT_DIR: "{{.BINDINGS_DIR}}/engine"
build:bulktasks:
desc: Build BulkTasks contract using Forge, inspect ABI+BIN, and generate Go bindings
vars:
PKG: bulktasks
TYPE: BulkTasks
CONTRACT_NAME: BulkTasks
OUT_DIR: "{{.BINDINGS_DIR}}/bulktasks"
# Path to Forge's compiled artifact output directory (from root foundry.toml)
FORGE_ARTIFACTS_DIR: "./contracts/artifacts"
# Path for the extracted ABI file
EXTRACTED_ABI_PATH: "{{.FORGE_ARTIFACTS_DIR}}/BulkTasks.abi.json"
# Path to the combined JSON (still useful for dependency check)
FORGE_COMBINED_JSON_PATH: "{{.FORGE_ARTIFACTS_DIR}}/BulkTasks.sol/BulkTasks.json"
# Path to the generated bytecode file (relative to root)
FORGE_BIN_PATH: "{{.FORGE_ARTIFACTS_DIR}}/BulkTasks.sol/BulkTasks.bin" # Adjusted path for .bin
cmds:
- task: _mkdir
vars: { DIR: '{{.OUT_DIR}}' }
# 1. Compile using Forge (run from project root), outputting BIN file
- cmd: forge build --extra-output bin # Added --extra-output bin
# This reads root foundry.toml and outputs to ./contracts/artifacts/
# 2. Extract ABI using forge inspect
- cmd: forge inspect {{.CONTRACT_NAME}} abi > {{.EXTRACTED_ABI_PATH}} # Removed --artifacts flag
ignore_error: false
# 3. Generate Go bindings using the extracted ABI file and BIN file
- |
{{.ABIGEN}} \
--abi={{.EXTRACTED_ABI_PATH}} \
--bin={{.FORGE_BIN_PATH}} \
--pkg={{.PKG}} --type={{.TYPE}} \
--out={{.OUT_DIR}}/{{.PKG}}.go
sources:
- "./contracts/src/BulkTasks.sol"
- "./foundry.toml"
- "./external/arbius/contract/contracts/interfaces/IArbius.sol"
generates:
- "{{.OUT_DIR}}/{{.PKG}}.go"
- "{{.FORGE_COMBINED_JSON_PATH}}" # Still generated by build
- "{{.EXTRACTED_ABI_PATH}}"
- "{{.FORGE_BIN_PATH}}" # Mark the BIN file as generated
build:basetoken:
desc: Build BaseToken interface
cmds:
- task: _build:interface
vars:
NAME: BaseToken
PKG: basetoken
TYPE: BaseToken
OUT_DIR: "{{.BINDINGS_DIR}}/basetoken"
build:quoter:
desc: Build Quoter interface
cmds:
- task: _build:contract
vars:
NAME: IQuoter
PKG: quoter
TYPE: Quoter
OUT_DIR: "{{.BINDINGS_DIR}}/quoter"
SRC_DIR: "{{.LOCAL_CONTRACTS}}"
BASE_PATH: "."
CONTRACT_NAME: IQuoter
build:sqlc:
desc: Generate Go code from SQL schema
cmds:
- cd sql && sqlc generate
build:all:
desc: Build all contract interfaces
cmds:
- task: build:voter
- task: build:vestaking
- task: build:votingescrow
- task: build:enginev5
- task: build:bulktasks
- task: build:sqlc
- task: build:arbiusrouterv1
- task: build:quoter
clean:
desc: Clean build artifacts
cmds:
- rm -rf {{.BUILD_DIR}}
- rm -rf {{.BINDINGS_DIR}}
default:
desc: Default task builds all interfaces
cmds:
- task: build:all