File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -144,6 +144,20 @@ contract HuffConfig {
144144
145145 /// @notice Get the creation bytecode of a contract
146146 function creation_code (string memory file ) public payable returns (bytes memory bytecode ) {
147+ return get_code ({file: file, is_creation: true });
148+ }
149+
150+ /// @notice Get the runtime bytecode of a contract
151+ function runtime_code (string memory file ) public payable returns (bytes memory bytecode ) {
152+ return get_code ({file: file, is_creation: false });
153+ }
154+
155+ /// @notice Get the bytecode of a contract
156+ function get_code (string memory file , bool is_creation )
157+ public
158+ payable
159+ returns (bytes memory bytecode )
160+ {
147161 binary_check ();
148162
149163 // Split the file into its parts
@@ -201,7 +215,11 @@ contract HuffConfig {
201215
202216 cmds[0 ] = "huffc " ;
203217 cmds[1 ] = string (string .concat ("src/ " , tempFile, ".huff " ));
204- cmds[2 ] = "-b " ;
218+ if (is_creation) {
219+ cmds[2 ] = "-b " ;
220+ } else {
221+ cmds[2 ] = "-r " ;
222+ }
205223 cmds[3 ] = "-e " ;
206224 cmds[4 ] = get_evm_version ();
207225
@@ -216,7 +234,6 @@ contract HuffConfig {
216234 // set `msg.sender` for upcoming create context
217235 vm.prank (deployer);
218236
219-
220237 vm.ffi (cleanup);
221238 }
222239
You can’t perform that action at this time.
0 commit comments