476 lines
16 KiB
Plaintext
476 lines
16 KiB
Plaintext
// https://gist.github.com/Philogy/04e5883c65b51f8a17ceb51828ea7fe3
|
|
|
|
/// @use-src 0:"src/ERC20.sol"
|
|
object "ERC20_39" {
|
|
code {
|
|
/// @src 0:106:384 "contract ERC20 {..."
|
|
mstore(64, memoryguard(128))
|
|
if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() }
|
|
|
|
constructor_ERC20_39()
|
|
|
|
let _1 := allocate_unbounded()
|
|
codecopy(_1, dataoffset("ERC20_39_deployed"), datasize("ERC20_39_deployed"))
|
|
|
|
return(_1, datasize("ERC20_39_deployed"))
|
|
|
|
function allocate_unbounded() -> memPtr {
|
|
memPtr := mload(64)
|
|
}
|
|
|
|
function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() {
|
|
revert(0, 0)
|
|
}
|
|
|
|
function cleanup_t_rational_100000000000000000000_by_1(value) -> cleaned {
|
|
cleaned := value
|
|
}
|
|
|
|
function cleanup_t_uint256(value) -> cleaned {
|
|
cleaned := value
|
|
}
|
|
|
|
function identity(value) -> ret {
|
|
ret := value
|
|
}
|
|
|
|
function convert_t_rational_100000000000000000000_by_1_to_t_uint256(value) -> converted {
|
|
converted := cleanup_t_uint256(identity(cleanup_t_rational_100000000000000000000_by_1(value)))
|
|
}
|
|
|
|
function cleanup_t_uint160(value) -> cleaned {
|
|
cleaned := and(value, 0xffffffffffffffffffffffffffffffffffffffff)
|
|
}
|
|
|
|
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_0_unsigned(value) -> newValue {
|
|
newValue :=
|
|
|
|
shr(0, value)
|
|
|
|
}
|
|
|
|
function cleanup_from_storage_t_uint256(value) -> cleaned {
|
|
cleaned := 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))
|
|
|
|
}
|
|
|
|
function panic_error_0x11() {
|
|
mstore(0, 35408467139433450592217433187231851964531694900788300625387963629091585785856)
|
|
mstore(4, 0x11)
|
|
revert(0, 0x24)
|
|
}
|
|
|
|
function checked_add_t_uint256(x, y) -> sum {
|
|
x := cleanup_t_uint256(x)
|
|
y := cleanup_t_uint256(y)
|
|
sum := add(x, y)
|
|
|
|
if gt(x, sum) { panic_error_0x11() }
|
|
|
|
}
|
|
|
|
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 17
|
|
/// @src 0:178:240 "constructor() {..."
|
|
function constructor_ERC20_39() {
|
|
|
|
/// @src 0:178:240 "constructor() {..."
|
|
|
|
/// @src 0:227:233 "100e18"
|
|
let expr_13 := 0x056bc75e2d63100000
|
|
/// @src 0:202:233 "balanceOf[msg.sender] += 100e18"
|
|
let _2 := convert_t_rational_100000000000000000000_by_1_to_t_uint256(expr_13)
|
|
/// @src 0:202:211 "balanceOf"
|
|
let _3_slot := 0x00
|
|
let expr_9_slot := _3_slot
|
|
/// @src 0:212:222 "msg.sender"
|
|
let expr_11 := caller()
|
|
/// @src 0:202:223 "balanceOf[msg.sender]"
|
|
let _4 := mapping_index_access_t_mapping$_t_address_$_t_uint256_$_of_t_address(expr_9_slot,expr_11)
|
|
/// @src 0:202:233 "balanceOf[msg.sender] += 100e18"
|
|
let _5 := read_from_storage_split_offset_0_t_uint256(_4)
|
|
let expr_14 := checked_add_t_uint256(_5, _2)
|
|
|
|
update_storage_value_offset_0t_uint256_to_t_uint256(_4, expr_14)
|
|
|
|
}
|
|
/// @src 0:106:384 "contract ERC20 {..."
|
|
|
|
}
|
|
/// @use-src 0:"src/ERC20.sol"
|
|
object "ERC20_39_deployed" {
|
|
code {
|
|
/// @src 0:106:384 "contract ERC20 {..."
|
|
mstore(64, memoryguard(128))
|
|
|
|
if iszero(lt(calldatasize(), 4))
|
|
{
|
|
let selector := shift_right_224_unsigned(calldataload(0))
|
|
switch selector
|
|
|
|
case 0x70a08231
|
|
{
|
|
// balanceOf(address)
|
|
|
|
external_fun_balanceOf_6()
|
|
}
|
|
|
|
case 0xa9059cbb
|
|
{
|
|
// transfer(address,uint256)
|
|
|
|
external_fun_transfer_38()
|
|
}
|
|
|
|
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 6
|
|
/// @src 0:127:171 "mapping(address => uint256) public balanceOf"
|
|
function getter_fun_balanceOf_6(key_0) -> ret {
|
|
|
|
let slot := 0
|
|
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:106:384 "contract ERC20 {..."
|
|
|
|
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_balanceOf_6() {
|
|
|
|
if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() }
|
|
let param_0 := abi_decode_tuple_t_address(4, calldatasize())
|
|
let ret_0 := getter_fun_balanceOf_6(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 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_addresst_uint256(headStart, dataEnd) -> value0, value1 {
|
|
if slt(sub(dataEnd, headStart), 64) { revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() }
|
|
|
|
{
|
|
|
|
let offset := 0
|
|
|
|
value0 := abi_decode_t_address(add(headStart, offset), dataEnd)
|
|
}
|
|
|
|
{
|
|
|
|
let offset := 32
|
|
|
|
value1 := abi_decode_t_uint256(add(headStart, offset), dataEnd)
|
|
}
|
|
|
|
}
|
|
|
|
function abi_encode_tuple__to__fromStack(headStart ) -> tail {
|
|
tail := add(headStart, 0)
|
|
|
|
}
|
|
|
|
function external_fun_transfer_38() {
|
|
|
|
if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() }
|
|
let param_0, param_1 := abi_decode_tuple_t_addresst_uint256(4, calldatasize())
|
|
fun_transfer_38(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)
|
|
}
|
|
|
|
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))
|
|
|
|
}
|
|
|
|
function panic_error_0x11() {
|
|
mstore(0, 35408467139433450592217433187231851964531694900788300625387963629091585785856)
|
|
mstore(4, 0x11)
|
|
revert(0, 0x24)
|
|
}
|
|
|
|
function checked_sub_t_uint256(x, y) -> diff {
|
|
x := cleanup_t_uint256(x)
|
|
y := cleanup_t_uint256(y)
|
|
diff := sub(x, y)
|
|
|
|
if gt(diff, x) { panic_error_0x11() }
|
|
|
|
}
|
|
|
|
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)))
|
|
}
|
|
|
|
function checked_add_t_uint256(x, y) -> sum {
|
|
x := cleanup_t_uint256(x)
|
|
y := cleanup_t_uint256(y)
|
|
sum := add(x, y)
|
|
|
|
if gt(x, sum) { panic_error_0x11() }
|
|
|
|
}
|
|
|
|
/// @ast-id 38
|
|
/// @src 0:246:382 "function transfer(address to, uint256 amount) external {..."
|
|
function fun_transfer_38(var_to_19, var_amount_21) {
|
|
|
|
/// @src 0:336:342 "amount"
|
|
let _1 := var_amount_21
|
|
let expr_28 := _1
|
|
/// @src 0:311:320 "balanceOf"
|
|
let _2_slot := 0x00
|
|
let expr_24_slot := _2_slot
|
|
/// @src 0:321:331 "msg.sender"
|
|
let expr_26 := caller()
|
|
/// @src 0:311:332 "balanceOf[msg.sender]"
|
|
let _3 := mapping_index_access_t_mapping$_t_address_$_t_uint256_$_of_t_address(expr_24_slot,expr_26)
|
|
/// @src 0:311:342 "balanceOf[msg.sender] -= amount"
|
|
let _4 := read_from_storage_split_offset_0_t_uint256(_3)
|
|
let expr_29 := checked_sub_t_uint256(_4, expr_28)
|
|
|
|
update_storage_value_offset_0t_uint256_to_t_uint256(_3, expr_29)
|
|
/// @src 0:369:375 "amount"
|
|
let _5 := var_amount_21
|
|
let expr_34 := _5
|
|
/// @src 0:352:361 "balanceOf"
|
|
let _6_slot := 0x00
|
|
let expr_31_slot := _6_slot
|
|
/// @src 0:362:364 "to"
|
|
let _7 := var_to_19
|
|
let expr_32 := _7
|
|
/// @src 0:352:365 "balanceOf[to]"
|
|
let _8 := mapping_index_access_t_mapping$_t_address_$_t_uint256_$_of_t_address(expr_31_slot,expr_32)
|
|
/// @src 0:352:375 "balanceOf[to] += amount"
|
|
let _9 := read_from_storage_split_offset_0_t_uint256(_8)
|
|
let expr_35 := checked_add_t_uint256(_9, expr_34)
|
|
|
|
update_storage_value_offset_0t_uint256_to_t_uint256(_8, expr_35)
|
|
|
|
}
|
|
/// @src 0:106:384 "contract ERC20 {..."
|
|
|
|
}
|
|
|
|
data ".metadata" hex"a2646970667358221220d80e5f4a9fbcbfa7e494c0820a02c53808ddf039ca6cce958babbcc80d42dcb164736f6c634300081a0033"
|
|
}
|
|
|
|
}
|