Open eugenioclrc opened 1 year ago
Perhaps this is even better, (ERROR_SIGNATURE = PUSH4 SIG
):
/// @notice Reverts with a Custom error
#define macro ERR_CUSTOM() = takes (1) returns (0) {
// ERROR SIGNATURE
0x00 mstore
0x04 0x1c revert
}
#define macro REQUIRE_CUSTOM_ERROR(ERROR_SIGNATURE) = takes(2) returns(0) {
// [condition, customErrorSig]
do_not_throwErr jumpi
<ERROR_SIGNATURE>
ERR_CUSTOM()
do_not_throwErr:
}
Currently there is the
REQUIRE
that lets you mimic solidityrequire(condition, "message")
I want to propose a
REQUIRE_CUSTOM_ERROR
: