Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions src/HuffConfig.sol
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,20 @@ contract HuffConfig {

/// @notice Get the creation bytecode of a contract
function creation_code(string memory file) public payable returns (bytes memory bytecode) {
return get_code({file: file, is_creation: true});
}

/// @notice Get the runtime bytecode of a contract
function runtime_code(string memory file) public payable returns (bytes memory bytecode) {
return get_code({file: file, is_creation: false});
}

/// @notice Get the bytecode of a contract
function get_code(string memory file, bool is_creation)
public
payable
returns (bytes memory bytecode)
{
binary_check();

// Split the file into its parts
Expand Down Expand Up @@ -201,7 +215,11 @@ contract HuffConfig {

cmds[0] = "huffc";
cmds[1] = string(string.concat("src/", tempFile, ".huff"));
cmds[2] = "-b";
if (is_creation) {
cmds[2] = "-b";
} else {
cmds[2] = "-r";
}
cmds[3] = "-e";
cmds[4] = get_evm_version();

Expand All @@ -216,7 +234,6 @@ contract HuffConfig {
// set `msg.sender` for upcoming create context
vm.prank(deployer);


vm.ffi(cleanup);
}

Expand Down