-
-
Save zeroknots/e5c718ff043982703582ab0431ef0279 to your computer and use it in GitHub Desktop.
SimpleStorage.yul
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// @use-src 0:"src/SimpleStorage.sol" | |
object "Counter_1337" { | |
code { | |
/// @src 0:75:394 "contract SimpleStorage {..." | |
mstore(64, memoryguard(128)) | |
if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() } | |
constructor_Counter_1337() | |
let _1 := allocate_unbounded() | |
codecopy(_1, dataoffset("Counter_1337_deployed"), datasize("Counter_1337_deployed")) | |
return(_1, datasize("Counter_1337_deployed")) | |
function allocate_unbounded() -> memPtr { | |
memPtr := mload(64) | |
} | |
function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() { | |
revert(0, 0) | |
} | |
/// @src 0:75:394 "contract SimpleStorage {..." | |
function constructor_Counter_1337() { | |
/// @src 0:75:394 "contract SimpleStorage {..." | |
} | |
/// @src 0:75:394 "contract SimpleStorage {..." | |
} | |
/// @use-src 0:"src/SimpleStorage.sol" | |
object "Counter_1337_deployed" { | |
code { | |
/// @src 0:75:394 "contract SimpleStorage {..." | |
mstore(64, memoryguard(128)) | |
if iszero(lt(calldatasize(), 4)) | |
{ | |
let selector := shift_right_224_unsigned(calldataload(0)) | |
switch selector | |
case 0x27e235e3 | |
{ | |
// balances(address) | |
external_fun_balances_7() | |
} | |
case 0x2a1afcd9 | |
{ | |
// storedData() | |
external_fun_storedData_3() | |
} | |
case 0x60fe47b1 | |
{ | |
// set(uint256) | |
external_fun_set_24() | |
} | |
case 0x6d4ce63c | |
{ | |
// get() | |
external_fun_get_32() | |
} | |
default {} | |
} | |
revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() | |
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_uint160(value) -> cleaned { | |
cleaned := and(value, 0xffffffffffffffffffffffffffffffffffffffff) | |
} | |
function cleanup_t_address(value) -> cleaned { | |
cleaned := cleanup_t_uint160(value) | |
} | |
function validator_revert_t_address(value) { | |
if iszero(eq(value, cleanup_t_address(value))) { revert(0, 0) } | |
} | |
function abi_decode_t_address(offset, end) -> value { | |
value := calldataload(offset) | |
validator_revert_t_address(value) | |
} | |
function abi_decode_tuple_t_address(headStart, dataEnd) -> value0 { | |
if slt(sub(dataEnd, headStart), 32) { revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() } | |
{ | |
let offset := 0 | |
value0 := abi_decode_t_address(add(headStart, offset), dataEnd) | |
} | |
} | |
function identity(value) -> ret { | |
ret := value | |
} | |
function convert_t_uint160_to_t_uint160(value) -> converted { | |
converted := cleanup_t_uint160(identity(cleanup_t_uint160(value))) | |
} | |
function convert_t_uint160_to_t_address(value) -> converted { | |
converted := convert_t_uint160_to_t_uint160(value) | |
} | |
function convert_t_address_to_t_address(value) -> converted { | |
converted := convert_t_uint160_to_t_address(value) | |
} | |
function mapping_index_access_t_mapping$_t_address_$_t_uint256_$_of_t_address(slot , key) -> dataSlot { | |
mstore(0, convert_t_address_to_t_address(key)) | |
mstore(0x20, slot) | |
dataSlot := keccak256(0, 0x40) | |
} | |
function shift_right_unsigned_dynamic(bits, value) -> newValue { | |
newValue := | |
shr(bits, value) | |
} | |
function cleanup_from_storage_t_uint256(value) -> cleaned { | |
cleaned := value | |
} | |
function extract_from_storage_value_dynamict_uint256(slot_value, offset) -> value { | |
value := cleanup_from_storage_t_uint256(shift_right_unsigned_dynamic(mul(offset, 8), slot_value)) | |
} | |
function read_from_storage_split_dynamic_t_uint256(slot, offset) -> value { | |
value := extract_from_storage_value_dynamict_uint256(sload(slot), offset) | |
} | |
/// @ast-id 7 | |
/// @src 0:145:194 "mapping(address owner => uint256) public balances" | |
function getter_fun_balances_7(key_0) -> ret { | |
let slot := 1 | |
let offset := 0 | |
slot := mapping_index_access_t_mapping$_t_address_$_t_uint256_$_of_t_address(slot, key_0) | |
ret := read_from_storage_split_dynamic_t_uint256(slot, offset) | |
} | |
/// @src 0:75:394 "contract SimpleStorage {..." | |
function cleanup_t_uint256(value) -> cleaned { | |
cleaned := value | |
} | |
function abi_encode_t_uint256_to_t_uint256_fromStack(value, pos) { | |
mstore(pos, cleanup_t_uint256(value)) | |
} | |
function abi_encode_tuple_t_uint256__to_t_uint256__fromStack(headStart , value0) -> tail { | |
tail := add(headStart, 32) | |
abi_encode_t_uint256_to_t_uint256_fromStack(value0, add(headStart, 0)) | |
} | |
function external_fun_balances_7() { | |
if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() } | |
let param_0 := abi_decode_tuple_t_address(4, calldatasize()) | |
let ret_0 := getter_fun_balances_7(param_0) | |
let memPos := allocate_unbounded() | |
let memEnd := abi_encode_tuple_t_uint256__to_t_uint256__fromStack(memPos , ret_0) | |
return(memPos, sub(memEnd, memPos)) | |
} | |
function abi_decode_tuple_(headStart, dataEnd) { | |
if slt(sub(dataEnd, headStart), 0) { revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() } | |
} | |
/// @ast-id 3 | |
/// @src 0:104:129 "uint256 public storedData" | |
function getter_fun_storedData_3() -> ret { | |
let slot := 0 | |
let offset := 0 | |
ret := read_from_storage_split_dynamic_t_uint256(slot, offset) | |
} | |
/// @src 0:75:394 "contract SimpleStorage {..." | |
function external_fun_storedData_3() { | |
if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() } | |
abi_decode_tuple_(4, calldatasize()) | |
let ret_0 := getter_fun_storedData_3() | |
let memPos := allocate_unbounded() | |
let memEnd := abi_encode_tuple_t_uint256__to_t_uint256__fromStack(memPos , ret_0) | |
return(memPos, sub(memEnd, memPos)) | |
} | |
function validator_revert_t_uint256(value) { | |
if iszero(eq(value, cleanup_t_uint256(value))) { revert(0, 0) } | |
} | |
function abi_decode_t_uint256(offset, end) -> value { | |
value := calldataload(offset) | |
validator_revert_t_uint256(value) | |
} | |
function abi_decode_tuple_t_uint256(headStart, dataEnd) -> value0 { | |
if slt(sub(dataEnd, headStart), 32) { revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() } | |
{ | |
let offset := 0 | |
value0 := abi_decode_t_uint256(add(headStart, offset), dataEnd) | |
} | |
} | |
function abi_encode_tuple__to__fromStack(headStart ) -> tail { | |
tail := add(headStart, 0) | |
} | |
function external_fun_set_24() { | |
if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() } | |
let param_0 := abi_decode_tuple_t_uint256(4, calldatasize()) | |
fun_set_24(param_0) | |
let memPos := allocate_unbounded() | |
let memEnd := abi_encode_tuple__to__fromStack(memPos ) | |
return(memPos, sub(memEnd, memPos)) | |
} | |
function external_fun_get_32() { | |
if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() } | |
abi_decode_tuple_(4, calldatasize()) | |
let ret_0 := fun_get_32() | |
let memPos := allocate_unbounded() | |
let memEnd := abi_encode_tuple_t_uint256__to_t_uint256__fromStack(memPos , ret_0) | |
return(memPos, sub(memEnd, memPos)) | |
} | |
function revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() { | |
revert(0, 0) | |
} | |
function shift_left_0(value) -> newValue { | |
newValue := | |
shl(0, value) | |
} | |
function update_byte_slice_32_shift_0(value, toInsert) -> result { | |
let mask := 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff | |
toInsert := shift_left_0(toInsert) | |
value := and(value, not(mask)) | |
result := or(value, and(toInsert, mask)) | |
} | |
function convert_t_uint256_to_t_uint256(value) -> converted { | |
converted := cleanup_t_uint256(identity(cleanup_t_uint256(value))) | |
} | |
function prepare_store_t_uint256(value) -> ret { | |
ret := value | |
} | |
function update_storage_value_offset_0t_uint256_to_t_uint256(slot, value_0) { | |
let convertedValue_0 := convert_t_uint256_to_t_uint256(value_0) | |
sstore(slot, update_byte_slice_32_shift_0(sload(slot), prepare_store_t_uint256(convertedValue_0))) | |
} | |
/// @ast-id 24 | |
/// @src 0:211:307 "function set(uint256 x) public {..." | |
function fun_set_24(var_x_9) { | |
/// @src 0:265:266 "x" | |
let _1 := var_x_9 | |
let expr_13 := _1 | |
/// @src 0:252:266 "storedData = x" | |
update_storage_value_offset_0t_uint256_to_t_uint256(0x00, expr_13) | |
let expr_14 := expr_13 | |
/// @src 0:299:300 "x" | |
let _2 := var_x_9 | |
let expr_20 := _2 | |
/// @src 0:276:284 "balances" | |
let _3_slot := 0x01 | |
let expr_16_slot := _3_slot | |
/// @src 0:285:295 "msg.sender" | |
let expr_18 := caller() | |
/// @src 0:276:296 "balances[msg.sender]" | |
let _4 := mapping_index_access_t_mapping$_t_address_$_t_uint256_$_of_t_address(expr_16_slot,expr_18) | |
/// @src 0:276:300 "balances[msg.sender] = x" | |
update_storage_value_offset_0t_uint256_to_t_uint256(_4, expr_20) | |
let expr_21 := expr_20 | |
} | |
/// @src 0:75:394 "contract SimpleStorage {..." | |
function zero_value_for_split_t_uint256() -> ret { | |
ret := 0 | |
} | |
function shift_right_0_unsigned(value) -> newValue { | |
newValue := | |
shr(0, value) | |
} | |
function extract_from_storage_value_offset_0t_uint256(slot_value) -> value { | |
value := cleanup_from_storage_t_uint256(shift_right_0_unsigned(slot_value)) | |
} | |
function read_from_storage_split_offset_0_t_uint256(slot) -> value { | |
value := extract_from_storage_value_offset_0t_uint256(sload(slot)) | |
} | |
/// @ast-id 32 | |
/// @src 0:313:392 "function get() public view returns (uint256) {..." | |
function fun_get_32() -> var__27 { | |
/// @src 0:349:356 "uint256" | |
let zero_t_uint256_5 := zero_value_for_split_t_uint256() | |
var__27 := zero_t_uint256_5 | |
/// @src 0:375:385 "storedData" | |
let _6 := read_from_storage_split_offset_0_t_uint256(0x00) | |
let expr_29 := _6 | |
/// @src 0:368:385 "return storedData" | |
var__27 := expr_29 | |
leave | |
} | |
/// @src 0:75:394 "contract SimpleStorage {..." | |
} | |
data ".metadata" hex"a2646970667358221220769c65dc31488ba9adf6c0417702f4e23e2cdb5b7a76dd25cb6d69e16e8225d564736f6c63430008130033" | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment