@@ -115,31 +115,22 @@ def deploy_no_impersonate(
115
115
deploy_script : str = "script/Deploy.s.sol:Deploy" ,
116
116
env : Dict = {}
117
117
) -> str :
118
- rfd , wfd = os .pipe2 (os .O_NONBLOCK )
119
-
120
118
proc = subprocess .Popen (
121
119
args = [
122
120
"/opt/foundry/bin/forge" ,
123
- "script" ,
121
+ "create" ,
122
+ "src/Challenge.sol:Challenge" ,
123
+ "--constructor-args" ,
124
+ token ,
124
125
"--rpc-url" ,
125
126
web3 .provider .endpoint_uri ,
126
- "--out" ,
127
- "/artifacts/out" ,
128
- "--cache-path" ,
129
- "/artifacts/cache" ,
130
- "--broadcast" ,
131
- "--unlocked" ,
132
- "--sender" ,
133
- "0x0000000000000000000000000000000000000000" ,
134
- deploy_script ,
127
+ "--private-key" ,
128
+ "0xb6b15c8cb491557369f3c7d2c287b053eb229daa9c22138887752191c9520659"
135
129
],
136
130
env = {
137
131
"PATH" : "/opt/huff/bin:/opt/foundry/bin:/usr/bin:" + os .getenv ("PATH" , "/fake" ),
138
- "MNEMONIC" : mnemonic ,
139
- "OUTPUT_FILE" : f"/proc/self/fd/{ wfd } " ,
140
132
}
141
133
| env ,
142
- pass_fds = [wfd ],
143
134
cwd = project_location ,
144
135
text = True ,
145
136
encoding = "utf8" ,
@@ -154,14 +145,12 @@ def deploy_no_impersonate(
154
145
print (stderr )
155
146
raise Exception ("forge failed to run" )
156
147
157
- result = os .read (rfd , 256 ).decode ("utf8" )
148
+ address = stdout .split ('Deployed to: ' )[
149
+ 1 ].replace ("\\ n" , "" )[:42 ]
158
150
159
- os .close (rfd )
160
- os .close (wfd )
151
+ cast_initialize (web3 , project_location , token , address )
161
152
162
- # cast_initialize(web3, project_location, token, result)
163
-
164
- return result
153
+ return address
165
154
166
155
167
156
def cast_initialize (
@@ -170,45 +159,32 @@ def cast_initialize(
170
159
token : str ,
171
160
entrypoint : str
172
161
) -> str :
173
- rfd , wfd = os .pipe2 (os .O_NONBLOCK )
174
-
175
162
proc = subprocess .Popen (
176
163
args = [
177
164
"/opt/foundry/bin/cast" ,
178
165
"send" ,
179
166
token ,
180
- '"initialize(address)"' ,
181
- entrypoint ,
167
+ "0xc4d66de8000000000000000000000000" + entrypoint [2 :],
182
168
"--rpc-url" ,
183
169
web3 .provider .endpoint_uri ,
184
170
"--private-key" ,
185
171
"0xb6b15c8cb491557369f3c7d2c287b053eb229daa9c22138887752191c9520659"
186
172
],
187
- pass_fds = [wfd ],
188
173
cwd = project_location ,
189
174
text = True ,
190
175
encoding = "utf8" ,
191
176
stdin = subprocess .DEVNULL ,
192
177
stdout = subprocess .PIPE ,
193
178
stderr = subprocess .PIPE ,
194
179
)
180
+
195
181
stdout , stderr = proc .communicate ()
196
182
197
183
if proc .returncode != 0 :
198
184
print (stdout )
199
185
print (stderr )
200
186
raise Exception ("cast failed to run" )
201
187
202
- result = os .read (rfd , 256 ).decode ("utf8" )
203
-
204
- os .close (rfd )
205
- os .close (wfd )
206
-
207
- return result
208
-
209
-
210
-
211
-
212
188
213
189
def deploy_nitro (
214
190
web3 : Web3 ,
0 commit comments