Skip to content

Instantly share code, notes, and snippets.

@tinchoabbate
Created September 10, 2023 17:49
Show Gist options
  • Save tinchoabbate/6693719df90150bbe3f2aac66ee30ec0 to your computer and use it in GitHub Desktop.
Save tinchoabbate/6693719df90150bbe3f2aac66ee30ec0 to your computer and use it in GitHub Desktop.
/// @use-src 0:"Exam.sol"
object "Example_10" {
code {
/// @src 0:25:116 "contract Example {..."
mstore(64, memoryguard(128))
if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() } //QUIZZ: Panics if the call has value greater than zero
constructor_Example_10()
let _1 := allocate_unbounded()
codecopy(_1, dataoffset("Example_10_deployed"), datasize("Example_10_deployed"))
return(_1, datasize("Example_10_deployed"))
function allocate_unbounded() -> memPtr {
memPtr := mload(64)
}
function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() {
revert(0, 0)
}
/// @src 0:25:116 "contract Example {..."
function constructor_Example_10() {
/// @src 0:25:116 "contract Example {..."
}
/// @src 0:25:116 "contract Example {..."
}
/// @use-src 0:"Exam.sol"
object "Example_10_deployed" {
code {
/// @src 0:25:116 "contract Example {..."
mstore(64, memoryguard(128))
if iszero(lt(calldatasize(), 4))
{
let selector := shift_right_224_unsigned(calldataload(0))
switch selector
case 0xf2a343b5
{
// foo(uint8,uint64)
external_fun_foo_9()
}
default {}
}
revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() //QUIZZ: Panics if the calldata size is not larger than 4 bytes
function shift_right_224_unsigned(value) -> newValue {
newValue :=
shr(224, value)
}
function allocate_unbounded() -> memPtr {
memPtr := mload(64)
}
function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() {
revert(0, 0)
}
function revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() {
revert(0, 0)
}
function revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db() {
revert(0, 0)
}
function cleanup_t_uint8(value) -> cleaned {
cleaned := and(value, 0xff)
}
function validator_revert_t_uint8(value) {
if iszero(eq(value, cleanup_t_uint8(value))) { revert(0, 0) } //QUIZZ: Panics if cannot decode to uint8
}
function abi_decode_t_uint8(offset, end) -> value {
value := calldataload(offset)
validator_revert_t_uint8(value)
}
function cleanup_t_uint64(value) -> cleaned {
cleaned := and(value, 0xffffffffffffffff)
}
function validator_revert_t_uint64(value) {
if iszero(eq(value, cleanup_t_uint64(value))) { revert(0, 0) } //QUIZZ: Panics if cannot decode to uint64
}
function abi_decode_t_uint64(offset, end) -> value {
value := calldataload(offset)
validator_revert_t_uint64(value)
}
function abi_decode_tuple_t_uint8t_uint64(headStart, dataEnd) -> value0, value1 {
if slt(sub(dataEnd, headStart), 64) { revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() }
{
let offset := 0
value0 := abi_decode_t_uint8(add(headStart, offset), dataEnd)
}
{
let offset := 32
value1 := abi_decode_t_uint64(add(headStart, offset), dataEnd)
}
}
function abi_encode_tuple__to__fromStack(headStart ) -> tail {
tail := add(headStart, 0)
}
function external_fun_foo_9() {
if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() }
let param_0, param_1 := abi_decode_tuple_t_uint8t_uint64(4, calldatasize())
fun_foo_9(param_0, param_1)
let memPos := allocate_unbounded()
let memEnd := abi_encode_tuple__to__fromStack(memPos )
return(memPos, sub(memEnd, memPos))
}
function revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() {
revert(0, 0)
}
/// @ast-id 9
/// @src 0:45:114 "function foo(uint8 data, uint64 length) external {..."
function fun_foo_9(var_data_3, var_length_5) {
}
/// @src 0:25:116 "contract Example {..."
}
data ".metadata" hex"a2646970667358221220802950455f71cfa7e452f40c71a98fbae803c10b7bc2e866322616d2198dbc3864736f6c63430008110033"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment