diff --git a/tests/integration_tests/expected_constants.py b/tests/integration_tests/expected_constants.py index be2a61cac9..7311e8c16c 100644 --- a/tests/integration_tests/expected_constants.py +++ b/tests/integration_tests/expected_constants.py @@ -155,3 +155,85 @@ EXPECTED_DEFAULT_GASCAP = 25000000 EXPECTED_JS_TRACERS = ['{"ADD-ADD": 3, "ADD-AND": 2, "ADD-CALLDATACOPY": 1, "ADD-DUP2": 2, "ADD-DUP3": 1, "ADD-DUP5": 1, "ADD-GT": 1, "ADD-MLOAD": 2, "ADD-MSTORE": 2, "ADD-PUSH1": 3, "ADD-PUSH2": 1, "ADD-SLT": 1, "ADD-SWAP1": 1, "ADD-SWAP2": 2, "ADD-SWAP3": 1, "AND-DUP1": 1, "AND-DUP2": 2, "AND-DUP6": 1, "AND-PUSH1": 2, "AND-SWAP2": 1, "CALLDATACOPY-PUSH0": 1, "CALLDATALOAD-DUP2": 1, "CALLDATALOAD-PUSH1": 1, "CALLDATALOAD-PUSH8": 1, "CALLDATASIZE-LT": 1, "CALLDATASIZE-PUSH1": 1, "CALLER-DUP3": 1, "CALLVALUE-DUP1": 1, "DUP1-DUP3": 1, "DUP1-DUP5": 1, "DUP1-ISZERO": 1, "DUP1-PUSH1": 1, "DUP1-PUSH2": 1, "DUP1-PUSH4": 3, "DUP1-SWAP2": 1, "DUP2-ADD": 3, "DUP2-AND": 1, "DUP2-CALLDATALOAD": 2, "DUP2-DUP2": 4, "DUP2-DUP4": 1, "DUP2-DUP5": 1, "DUP2-DUP6": 1, "DUP2-EQ": 1, "DUP2-GT": 2, "DUP2-LT": 2, "DUP2-MLOAD": 2, "DUP2-MSTORE": 2, "DUP2-PUSH1": 1, "DUP2-PUSH2": 1, "DUP2-SHR": 1, "DUP2-SUB": 1, "DUP2-SWAP1": 1, "DUP3-ADD": 3, "DUP3-AND": 2, "DUP3-DUP2": 1, "DUP3-DUP3": 1, "DUP3-DUP5": 1, "DUP3-DUP7": 1, "DUP3-GT": 3, "DUP3-LT": 1, "DUP3-PUSH1": 2, "DUP3-PUSH2": 1, "DUP4-ADD": 6, "DUP4-AND": 1, "DUP4-DUP3": 1, "DUP4-GT": 1, "DUP4-LT": 1, "DUP5-ADD": 1, "DUP5-DUP8": 1, "DUP5-ISZERO": 1, "DUP5-MSTORE": 1, "DUP5-PUSH1": 1, "DUP5-PUSH2": 2, "DUP5-SLOAD": 1, "DUP5-SUB": 1, "DUP6-ADD": 2, "DUP6-DUP4": 1, "DUP6-SSTORE": 1, "DUP6-SWAP1": 1, "DUP7-ADD": 2, "DUP7-DUP4": 1, "DUP7-SWAP1": 1, "DUP8-ADD": 1, "DUP8-PUSH1": 1, "EQ-PUSH2": 4, "GT-DUP2": 1, "GT-ISZERO": 5, "GT-PUSH1": 1, "ISZERO-PUSH2": 11, "JUMP-JUMPDEST": 16, "JUMPDEST-DUP2": 7, "JUMPDEST-DUP3": 1, "JUMPDEST-DUP5": 1, "JUMPDEST-POP": 7, "JUMPDEST-PUSH0": 3, "JUMPDEST-PUSH1": 8, "JUMPDEST-PUSH2": 3, "JUMPDEST-STOP": 1, "JUMPDEST-SWAP5": 1, "JUMPI-DUP1": 2, "JUMPI-JUMPDEST": 12, "JUMPI-POP": 1, "JUMPI-PUSH0": 2, "JUMPI-PUSH1": 2, "LOG1-POP": 1, "LT-DUP2": 1, "LT-ISZERO": 2, "LT-OR": 1, "LT-PUSH2": 1, "MLOAD-DUP1": 2, "MLOAD-DUP7": 1, "MLOAD-JUMPDEST": 1, "MLOAD-PUSH1": 1, "MLOAD-PUSH2": 1, "MLOAD-PUSH8": 1, "MSTORE-ADD": 1, "MSTORE-CALLVALUE": 1, "MSTORE-DUP3": 1, "MSTORE-DUP8": 1, "MSTORE-POP": 1, "MSTORE-PUSH0": 2, "MSTORE-PUSH1": 2, "NOT-AND": 1, "NOT-PUSH1": 2, "NOT-SWAP1": 1, "OR-DUP6": 1, "OR-ISZERO": 1, "POP-DUP5": 1, "POP-DUP6": 1, "POP-JUMP": 7, "POP-JUMPDEST": 2, "POP-POP": 15, "POP-PUSH0": 1, "POP-PUSH1": 1, "POP-PUSH32": 1, "POP-SWAP2": 1, "POP-SWAP3": 1, "POP-SWAP6": 1, "PUSH0-CALLDATALOAD": 1, "PUSH0-DUP2": 1, "PUSH0-DUP5": 1, "PUSH0-JUMPDEST": 1, "PUSH0-NOT": 1, "PUSH0-PUSH1": 2, "PUSH0-SWAP1": 1, "PUSH0-SWAP3": 1, "PUSH1-ADD": 2, "PUSH1-CALLDATASIZE": 1, "PUSH1-DUP1": 1, "PUSH1-DUP2": 3, "PUSH1-DUP3": 7, "PUSH1-DUP4": 4, "PUSH1-DUP5": 1, "PUSH1-DUP6": 1, "PUSH1-DUP7": 2, "PUSH1-MLOAD": 3, "PUSH1-MSTORE": 2, "PUSH1-NOT": 2, "PUSH1-PUSH1": 5, "PUSH1-PUSH2": 2, "PUSH1-SHL": 1, "PUSH1-SHR": 1, "PUSH2-CALLDATASIZE": 1, "PUSH2-DUP2": 1, "PUSH2-DUP3": 1, "PUSH2-DUP5": 1, "PUSH2-JUMP": 9, "PUSH2-JUMPI": 19, "PUSH2-PUSH2": 1, "PUSH2-SWAP1": 1, "PUSH2-SWAP3": 1, "PUSH32-CALLER": 1, "PUSH4-EQ": 3, "PUSH8-DUP1": 1, "PUSH8-DUP2": 1, "SHL-OR": 1, "SHL-SHR": 1, "SHL-SUB": 1, "SHR-DUP1": 1, "SHR-NOT": 1, "SHR-SWAP1": 1, "SLOAD-PUSH2": 1, "SLT-ISZERO": 1, "SLT-PUSH2": 1, "SSTORE-PUSH2": 1, "SUB-DUP4": 1, "SUB-PUSH2": 1, "SUB-SLT": 1, "SUB-SWAP1": 1, "SWAP1-DUP2": 1, "SWAP1-DUP3": 1, "SWAP1-DUP4": 2, "SWAP1-LOG1": 1, "SWAP1-MSTORE": 1, "SWAP1-POP": 1, "SWAP1-PUSH2": 2, "SWAP1-SHL": 2, "SWAP1-SWAP3": 1, "SWAP2-POP": 4, "SWAP2-SUB": 1, "SWAP2-SWAP1": 2, "SWAP3-DUP2": 1, "SWAP3-MSTORE": 1, "SWAP3-SWAP1": 1, "SWAP3-SWAP2": 2, "SWAP4-POP": 1, "SWAP5-POP": 1, "SWAP5-SWAP4": 1, "SWAP6-SWAP5": 1}', '[{"depth": 1, "len": 2, "op": 96, "result": ["80"]}, {"depth": 1, "len": 2, "op": 96, "result": ["40"]}, {"depth": 1, "op": 82, "result": []}, {"depth": 1, "op": 52, "result": ["0"]}, {"depth": 1, "op": 128, "result": ["0", "0"]}, {"depth": 1, "op": 21, "result": ["1"]}, {"depth": 1, "len": 3, "op": 97, "result": ["f"]}, {"depth": 1, "op": 87, "result": []}, {"depth": 1, "op": 91, "pc": 15, "result": []}, {"depth": 1, "op": 80, "result": []}, {"depth": 1, "len": 2, "op": 96, "result": ["4"]}, {"depth": 1, "op": 54, "result": ["64"]}, {"depth": 1, "op": 16, "result": ["0"]}, {"depth": 1, "len": 3, "op": 97, "result": ["55"]}, {"depth": 1, "op": 87, "result": []}, {"depth": 1, "op": 95, "result": []}, {"depth": 1, "op": 53, "result": ["a413686200000000000000000000000000000000000000000000000000000000"]}, {"depth": 1, "len": 2, "op": 96, "result": ["e0"]}, {"depth": 1, "op": 28, "result": []}, {"depth": 1, "op": 128, "result": ["a4136862", "a4136862"]}, {"depth": 1, "len": 5, "op": 99, "result": ["c4dae88"]}, {"depth": 1, "op": 20, "result": ["0"]}, {"depth": 1, "len": 3, "op": 97, "result": ["59"]}, {"depth": 1, "op": 87, "result": []}, {"depth": 1, "op": 128, "result": ["a4136862", "a4136862"]}, {"depth": 1, "len": 5, "op": 99, "result": ["2e52d606"]}, {"depth": 1, "op": 20, "result": ["0"]}, {"depth": 1, "len": 3, "op": 97, "result": ["6f"]}, {"depth": 1, "op": 87, "result": []}, {"depth": 1, "op": 128, "result": ["a4136862", "a4136862"]}, {"depth": 1, "len": 5, "op": 99, "result": ["a4136862"]}, {"depth": 1, "op": 20, "result": ["1"]}, {"depth": 1, "len": 3, "op": 97, "result": ["77"]}, {"depth": 1, "op": 87, "result": []}, {"depth": 1, "op": 91, "pc": 119, "result": []}, {"depth": 1, "len": 3, "op": 97, "result": ["8a"]}, {"depth": 1, "len": 3, "op": 97, "result": ["85"]}, {"depth": 1, "op": 54, "result": ["64"]}, {"depth": 1, "len": 2, "op": 96, "result": ["4"]}, {"depth": 1, "len": 3, "op": 97, "result": ["222"]}, {"depth": 1, "op": 86, "result": []}, {"depth": 1, "op": 91, "pc": 546, "result": []}, {"depth": 1, "op": 95, "result": []}, {"depth": 1, "len": 2, "op": 96, "result": ["20"]}, {"depth": 1, "op": 130, "result": ["4", "20", "0", "4"]}, {"depth": 1, "op": 132, "result": ["64", "4", "20", "0", "4", "64"]}, {"depth": 1, "op": 3, "result": ["60"]}, {"depth": 1, "op": 18, "result": ["0"]}, {"depth": 1, "op": 21, "result": ["1"]}, {"depth": 1, "len": 3, "op": 97, "result": ["232"]}, {"depth": 1, "op": 87, "result": []}, {"depth": 1, "op": 91, "pc": 562, "result": []}, {"depth": 1, "op": 129, "result": ["4", "0", "4"]}, {"depth": 1, "op": 53, "result": ["20"]}, {"depth": 1, "len": 9, "op": 103, "result": ["ffffffffffffffff"]}, {"depth": 1, "op": 128, "result": ["ffffffffffffffff", "ffffffffffffffff"]}, {"depth": 1, "op": 130, "result": ["20", "ffffffffffffffff", "ffffffffffffffff", "20"]}, {"depth": 1, "op": 17, "result": ["0"]}, {"depth": 1, "op": 21, "result": ["1"]}, {"depth": 1, "len": 3, "op": 97, "result": ["249"]}, {"depth": 1, "op": 87, "result": []}, {"depth": 1, "op": 91, "pc": 585, "result": []}, {"depth": 1, "op": 129, "result": ["20", "ffffffffffffffff", "20"]}, {"depth": 1, "op": 132, "result": ["4", "20", "ffffffffffffffff", "20", "0", "4"]}, {"depth": 1, "op": 1, "result": ["24"]}, {"depth": 1, "op": 145, "result": ["20", "ffffffffffffffff", "24"]}, {"depth": 1, "op": 80, "result": []}, {"depth": 1, "op": 132, "result": ["64", "ffffffffffffffff", "24", "0", "4", "64"]}, {"depth": 1, "len": 2, "op": 96, "result": ["1f"]}, {"depth": 1, "op": 131, "result": ["24", "1f", "64", "ffffffffffffffff", "24"]}, {"depth": 1, "op": 1, "result": ["43"]}, {"depth": 1, "op": 18, "result": ["1"]}, {"depth": 1, "len": 3, "op": 97, "result": ["25c"]}, {"depth": 1, "op": 87, "result": []}, {"depth": 1, "op": 91, "pc": 604, "result": []}, {"depth": 1, "op": 129, "result": ["24", "ffffffffffffffff", "24"]}, {"depth": 1, "op": 53, "result": ["5"]}, {"depth": 1, "op": 129, "result": ["ffffffffffffffff", "5", "ffffffffffffffff"]}, {"depth": 1, "op": 129, "result": ["5", "ffffffffffffffff", "5"]}, {"depth": 1, "op": 17, "result": ["0"]}, {"depth": 1, "op": 21, "result": ["1"]}, {"depth": 1, "len": 3, "op": 97, "result": ["26e"]}, {"depth": 1, "op": 87, "result": []}, {"depth": 1, "op": 91, "pc": 622, "result": []}, {"depth": 1, "len": 2, "op": 96, "result": ["40"]}, {"depth": 1, "op": 81, "result": ["80"]}, {"depth": 1, "len": 2, "op": 96, "result": ["1f"]}, {"depth": 1, "op": 130, "result": ["5", "1f", "80", "5"]}, {"depth": 1, "op": 1, "result": ["24"]}, {"depth": 1, "len": 2, "op": 96, "result": ["1f"]}, {"depth": 1, "op": 25, "result": ["ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0"]}, {"depth": 1, "op": 144, "result": ["24", "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0"]}, {"depth": 1, "op": 129, "result": ["ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0", "24", "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0"]}, {"depth": 1, "op": 22, "result": ["20"]}, {"depth": 1, "len": 2, "op": 96, "result": ["3f"]}, {"depth": 1, "op": 1, "result": ["5f"]}, {"depth": 1, "op": 22, "result": ["40"]}, {"depth": 1, "op": 129, "result": ["80", "40", "80"]}, {"depth": 1, "op": 1, "result": ["c0"]}, {"depth": 1, "op": 144, "result": ["80", "c0"]}, {"depth": 1, "op": 131, "result": ["ffffffffffffffff", "80", "c0", "5", "ffffffffffffffff"]}, {"depth": 1, "op": 130, "result": ["c0", "ffffffffffffffff", "80", "c0"]}, {"depth": 1, "op": 17, "result": ["0"]}, {"depth": 1, "op": 129, "result": ["80", "0", "80"]}, {"depth": 1, "op": 131, "result": ["c0", "80", "0", "80", "c0"]}, {"depth": 1, "op": 16, "result": ["0"]}, {"depth": 1, "op": 23, "result": ["0"]}, {"depth": 1, "op": 21, "result": ["1"]}, {"depth": 1, "len": 3, "op": 97, "result": ["296"]}, {"depth": 1, "op": 87, "result": []}, {"depth": 1, "op": 91, "pc": 662, "result": []}, {"depth": 1, "op": 129, "result": ["c0", "80", "c0"]}, {"depth": 1, "len": 2, "op": 96, "result": ["40"]}, {"depth": 1, "op": 82, "result": []}, {"depth": 1, "op": 130, "result": ["5", "80", "c0", "5"]}, {"depth": 1, "op": 129, "result": ["80", "5", "80"]}, {"depth": 1, "op": 82, "result": []}, {"depth": 1, "op": 135, "result": ["64", "80", "c0", "5", "ffffffffffffffff", "24", "0", "4", "64"]}, {"depth": 1, "len": 2, "op": 96, "result": ["20"]}, {"depth": 1, "op": 132, "result": ["5", "20", "64", "80", "c0", "5"]}, {"depth": 1, "op": 135, "result": ["24", "5", "20", "64", "80", "c0", "5", "ffffffffffffffff", "24"]}, {"depth": 1, "op": 1, "result": ["29"]}, {"depth": 1, "op": 1, "result": ["49"]}, {"depth": 1, "op": 17, "result": ["0"]}, {"depth": 1, "op": 21, "result": ["1"]}, {"depth": 1, "len": 3, "op": 97, "result": ["2ae"]}, {"depth": 1, "op": 87, "result": []}, {"depth": 1, "op": 91, "pc": 686, "result": []}, {"depth": 1, "op": 130, "result": ["5", "80", "c0", "5"]}, {"depth": 1, "len": 2, "op": 96, "result": ["20"]}, {"depth": 1, "op": 134, "result": ["24", "20", "5", "80", "c0", "5", "ffffffffffffffff", "24"]}, {"depth": 1, "op": 1, "result": ["44"]}, {"depth": 1, "len": 2, "op": 96, "result": ["20"]}, {"depth": 1, "op": 131, "result": ["80", "20", "44", "5", "80"]}, {"depth": 1, "op": 1, "result": ["a0"]}, {"depth": 1, "op": 55, "result": []}, {"depth": 1, "op": 95, "result": []}, {"depth": 1, "op": 146, "result": ["5", "80", "c0", "0"]}, {"depth": 1, "op": 129, "result": ["80", "5", "80"]}, {"depth": 1, "op": 1, "result": ["85"]}, {"depth": 1, "len": 2, "op": 96, "result": ["20"]}, {"depth": 1, "op": 1, "result": ["a5"]}, {"depth": 1, "op": 146, "result": ["0", "80", "c0", "a5"]}, {"depth": 1, "op": 144, "result": ["80", "0"]}, {"depth": 1, "op": 146, "result": ["a5", "0", "c0", "80"]}, {"depth": 1, "op": 82, "result": []}, {"depth": 1, "op": 80, "result": []}, {"depth": 1, "op": 149, "result": ["85", "ffffffffffffffff", "24", "0", "4", "64", "80"]}, {"depth": 1, "op": 148, "result": ["64", "ffffffffffffffff", "24", "0", "4", "85"]}, {"depth": 1, "op": 80, "result": []}, {"depth": 1, "op": 80, "result": []}, {"depth": 1, "op": 80, "result": []}, {"depth": 1, "op": 80, "result": []}, {"depth": 1, "op": 80, "result": []}, {"depth": 1, "op": 86, "result": []}, {"depth": 1, "op": 91, "pc": 133, "result": []}, {"depth": 1, "len": 3, "op": 97, "result": ["a9"]}, {"depth": 1, "op": 86, "result": []}, {"depth": 1, "op": 91, "pc": 169, "result": []}, {"depth": 1, "len": 2, "op": 96, "result": ["1"]}, {"depth": 1, "len": 3, "op": 97, "result": ["b5"]}, {"depth": 1, "op": 130, "result": ["80", "b5", "1", "80"]}, {"depth": 1, "op": 130, "result": ["1", "80", "b5", "1"]}, {"depth": 1, "len": 3, "op": 97, "result": ["3af"]}, {"depth": 1, "op": 86, "result": []}, {"depth": 1, "op": 91, "pc": 943, "result": []}, {"depth": 1, "op": 129, "result": ["80", "1", "80"]}, {"depth": 1, "op": 81, "result": ["5"]}, {"depth": 1, "len": 9, "op": 103, "result": ["ffffffffffffffff"]}, {"depth": 1, "op": 129, "result": ["5", "ffffffffffffffff", "5"]}, {"depth": 1, "op": 17, "result": ["0"]}, {"depth": 1, "op": 21, "result": ["1"]}, {"depth": 1, "len": 3, "op": 97, "result": ["3c9"]}, {"depth": 1, "op": 87, "result": []}, {"depth": 1, "op": 91, "pc": 969, "result": []}, {"depth": 1, "len": 3, "op": 97, "result": ["3dd"]}, {"depth": 1, "op": 129, "result": ["5", "3dd", "5"]}, {"depth": 1, "len": 3, "op": 97, "result": ["3d7"]}, {"depth": 1, "op": 132, "result": ["1", "3d7", "5", "3dd", "5", "1"]}, {"depth": 1, "op": 84, "result": ["48656c6c6f00000000000000000000000000000000000000000000000000000a"]}, {"depth": 1, "len": 3, "op": 97, "result": ["329"]}, {"depth": 1, "op": 86, "result": []}, {"depth": 1, "op": 91, "pc": 809, "result": []}, {"depth": 1, "len": 2, "op": 96, "result": ["1"]}, {"depth": 1, "op": 129, "result": ["48656c6c6f00000000000000000000000000000000000000000000000000000a", "1", "48656c6c6f00000000000000000000000000000000000000000000000000000a"]}, {"depth": 1, "op": 129, "result": ["1", "48656c6c6f00000000000000000000000000000000000000000000000000000a", "1"]}, {"depth": 1, "op": 28, "result": []}, {"depth": 1, "op": 144, "result": ["1", "2432b63637800000000000000000000000000000000000000000000000000005"]}, {"depth": 1, "op": 130, "result": ["48656c6c6f00000000000000000000000000000000000000000000000000000a", "1", "2432b63637800000000000000000000000000000000000000000000000000005", "48656c6c6f00000000000000000000000000000000000000000000000000000a"]}, {"depth": 1, "op": 22, "result": ["0"]}, {"depth": 1, "op": 128, "result": ["0", "0"]}, {"depth": 1, "len": 3, "op": 97, "result": ["33d"]}, {"depth": 1, "op": 87, "result": []}, {"depth": 1, "len": 2, "op": 96, "result": ["7f"]}, {"depth": 1, "op": 130, "result": ["2432b63637800000000000000000000000000000000000000000000000000005", "7f", "0", "2432b63637800000000000000000000000000000000000000000000000000005"]}, {"depth": 1, "op": 22, "result": ["5"]}, {"depth": 1, "op": 145, "result": ["2432b63637800000000000000000000000000000000000000000000000000005", "0", "5"]}, {"depth": 1, "op": 80, "result": []}, {"depth": 1, "op": 91, "pc": 829, "result": []}, {"depth": 1, "len": 2, "op": 96, "result": ["20"]}, {"depth": 1, "op": 130, "result": ["5", "20", "0", "5"]}, {"depth": 1, "op": 16, "result": ["1"]}, {"depth": 1, "op": 129, "result": ["0", "1", "0"]}, {"depth": 1, "op": 3, "result": ["ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"]}, {"depth": 1, "len": 3, "op": 97, "result": ["35b"]}, {"depth": 1, "op": 87, "result": []}, {"depth": 1, "op": 91, "pc": 859, "result": []}, {"depth": 1, "op": 80, "result": []}, {"depth": 1, "op": 145, "result": ["3d7", "48656c6c6f00000000000000000000000000000000000000000000000000000a", "5"]}, {"depth": 1, "op": 144, "result": ["48656c6c6f00000000000000000000000000000000000000000000000000000a", "3d7"]}, {"depth": 1, "op": 80, "result": []}, {"depth": 1, "op": 86, "result": []}, {"depth": 1, "op": 91, "pc": 983, "result": []}, {"depth": 1, "op": 132, "result": ["1", "5", "5", "3dd", "5", "1"]}, {"depth": 1, "len": 3, "op": 97, "result": ["361"]}, {"depth": 1, "op": 86, "result": []}, {"depth": 1, "op": 91, "pc": 865, "result": []}, {"depth": 1, "len": 2, "op": 96, "result": ["1f"]}, {"depth": 1, "op": 130, "result": ["5", "1f", "1", "5"]}, {"depth": 1, "op": 17, "result": ["0"]}, {"depth": 1, "op": 21, "result": ["1"]}, {"depth": 1, "len": 3, "op": 97, "result": ["3aa"]}, {"depth": 1, "op": 87, "result": []}, {"depth": 1, "op": 91, "pc": 938, "result": []}, {"depth": 1, "op": 80, "result": []}, {"depth": 1, "op": 80, "result": []}, {"depth": 1, "op": 80, "result": []}, {"depth": 1, "op": 86, "result": []}, {"depth": 1, "op": 91, "pc": 989, "result": []}, {"depth": 1, "len": 2, "op": 96, "result": ["20"]}, {"depth": 1, "op": 128, "result": ["20", "20"]}, {"depth": 1, "len": 2, "op": 96, "result": ["1f"]}, {"depth": 1, "op": 131, "result": ["5", "1f", "20", "20", "5"]}, {"depth": 1, "op": 17, "result": ["0"]}, {"depth": 1, "len": 2, "op": 96, "result": ["1"]}, {"depth": 1, "op": 129, "result": ["0", "1", "0"]}, {"depth": 1, "op": 20, "result": ["0"]}, {"depth": 1, "len": 3, "op": 97, "result": ["410"]}, {"depth": 1, "op": 87, "result": []}, {"depth": 1, "op": 95, "result": []}, {"depth": 1, "op": 132, "result": ["5", "0", "0", "20", "20", "5"]}, {"depth": 1, "op": 21, "result": ["0"]}, {"depth": 1, "len": 3, "op": 97, "result": ["3f9"]}, {"depth": 1, "op": 87, "result": []}, {"depth": 1, "op": 80, "result": []}, {"depth": 1, "op": 133, "result": ["80", "0", "20", "20", "5", "1", "80"]}, {"depth": 1, "op": 131, "result": ["20", "80", "0", "20", "20"]}, {"depth": 1, "op": 1, "result": ["a0"]}, {"depth": 1, "op": 81, "result": ["776f726c64000000000000000000000000000000000000000000000000000000"]}, {"depth": 1, "op": 91, "pc": 1017, "result": []}, {"depth": 1, "op": 95, "result": []}, {"depth": 1, "op": 25, "result": ["ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"]}, {"depth": 1, "len": 2, "op": 96, "result": ["3"]}, {"depth": 1, "op": 134, "result": ["5", "3", "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", "776f726c64000000000000000000000000000000000000000000000000000000", "0", "20", "20", "5"]}, {"depth": 1, "op": 144, "result": ["3", "5"]}, {"depth": 1, "op": 27, "result": []}, {"depth": 1, "op": 28, "result": []}, {"depth": 1, "op": 25, "result": ["ffffffffff000000000000000000000000000000000000000000000000000000"]}, {"depth": 1, "op": 22, "result": ["776f726c64000000000000000000000000000000000000000000000000000000"]}, {"depth": 1, "len": 2, "op": 96, "result": ["1"]}, {"depth": 1, "op": 133, "result": ["5", "1", "776f726c64000000000000000000000000000000000000000000000000000000", "0", "20", "20", "5"]}, {"depth": 1, "op": 144, "result": ["1", "5"]}, {"depth": 1, "op": 27, "result": []}, {"depth": 1, "op": 23, "result": ["776f726c6400000000000000000000000000000000000000000000000000000a"]}, {"depth": 1, "op": 133, "result": ["1", "776f726c6400000000000000000000000000000000000000000000000000000a", "0", "20", "20", "5", "1"]}, {"depth": 1, "op": 85, "result": []}, {"depth": 1, "len": 3, "op": 97, "result": ["3a6"]}, {"depth": 1, "op": 86, "result": []}, {"depth": 1, "op": 91, "pc": 934, "result": []}, {"depth": 1, "op": 80, "result": []}, {"depth": 1, "op": 80, "result": []}, {"depth": 1, "op": 80, "result": []}, {"depth": 1, "op": 91, "pc": 938, "result": []}, {"depth": 1, "op": 80, "result": []}, {"depth": 1, "op": 80, "result": []}, {"depth": 1, "op": 80, "result": []}, {"depth": 1, "op": 86, "result": []}, {"depth": 1, "op": 91, "pc": 181, "result": []}, {"depth": 1, "op": 80, "result": []}, {"depth": 1, "len": 33, "op": 127, "result": ["61ae4cbae83f72235cd9fa781d18fcb08ff5fa4a44fcc1630fde673bb0041151"]}, {"depth": 1, "op": 51, "result": ["b6a2f15a37aac3b6fdd39afa356b64f51ca8314a"]}, {"depth": 1, "op": 130, "result": ["80", "b6a2f15a37aac3b6fdd39afa356b64f51ca8314a", "61ae4cbae83f72235cd9fa781d18fcb08ff5fa4a44fcc1630fde673bb0041151", "80"]}, {"depth": 1, "len": 2, "op": 96, "result": ["40"]}, {"depth": 1, "op": 81, "result": ["c0"]}, {"depth": 1, "len": 3, "op": 97, "result": ["e7"]}, {"depth": 1, "op": 146, "result": ["b6a2f15a37aac3b6fdd39afa356b64f51ca8314a", "c0", "80", "e7"]}, {"depth": 1, "op": 145, "result": ["80", "c0", "b6a2f15a37aac3b6fdd39afa356b64f51ca8314a"]}, {"depth": 1, "op": 144, "result": ["c0", "80"]}, {"depth": 1, "len": 3, "op": 97, "result": ["46b"]}, {"depth": 1, "op": 86, "result": []}, {"depth": 1, "op": 91, "pc": 1131, "result": []}, {"depth": 1, "len": 2, "op": 96, "result": ["1"]}, {"depth": 1, "len": 2, "op": 96, "result": ["1"]}, {"depth": 1, "len": 2, "op": 96, "result": ["a0"]}, {"depth": 1, "op": 27, "result": []}, {"depth": 1, "op": 3, "result": ["ffffffffffffffffffffffffffffffffffffffff"]}, {"depth": 1, "op": 131, "result": ["b6a2f15a37aac3b6fdd39afa356b64f51ca8314a", "ffffffffffffffffffffffffffffffffffffffff", "c0", "80", "b6a2f15a37aac3b6fdd39afa356b64f51ca8314a"]}, {"depth": 1, "op": 22, "result": ["b6a2f15a37aac3b6fdd39afa356b64f51ca8314a"]}, {"depth": 1, "op": 129, "result": ["c0", "b6a2f15a37aac3b6fdd39afa356b64f51ca8314a", "c0"]}, {"depth": 1, "op": 82, "result": []}, {"depth": 1, "len": 2, "op": 96, "result": ["40"]}, {"depth": 1, "len": 2, "op": 96, "result": ["20"]}, {"depth": 1, "op": 130, "result": ["c0", "20", "40", "c0"]}, {"depth": 1, "op": 1, "result": ["e0"]}, {"depth": 1, "op": 129, "result": ["40", "e0", "40"]}, {"depth": 1, "op": 144, "result": ["e0", "40"]}, {"depth": 1, "op": 82, "result": []}, {"depth": 1, "op": 95, "result": []}, {"depth": 1, "op": 144, "result": ["40", "0"]}, {"depth": 1, "len": 3, "op": 97, "result": ["48e"]}, {"depth": 1, "op": 144, "result": ["40", "48e"]}, {"depth": 1, "op": 131, "result": ["c0", "40", "48e", "0", "c0"]}, {"depth": 1, "op": 1, "result": ["100"]}, {"depth": 1, "op": 132, "result": ["80", "100", "48e", "0", "c0", "80"]}, {"depth": 1, "len": 3, "op": 97, "result": ["2cd"]}, {"depth": 1, "op": 86, "result": []}, {"depth": 1, "op": 91, "pc": 717, "result": []}, {"depth": 1, "op": 95, "result": []}, {"depth": 1, "op": 129, "result": ["80", "0", "80"]}, {"depth": 1, "op": 81, "result": ["5"]}, {"depth": 1, "op": 128, "result": ["5", "5"]}, {"depth": 1, "op": 132, "result": ["100", "5", "5", "0", "80", "100"]}, {"depth": 1, "op": 82, "result": []}, {"depth": 1, "op": 95, "result": []}, {"depth": 1, "op": 91, "pc": 725, "result": []}, {"depth": 1, "op": 129, "result": ["5", "0", "5"]}, {"depth": 1, "op": 129, "result": ["0", "5", "0"]}, {"depth": 1, "op": 16, "result": ["1"]}, {"depth": 1, "op": 21, "result": ["0"]}, {"depth": 1, "len": 3, "op": 97, "result": ["2f1"]}, {"depth": 1, "op": 87, "result": []}, {"depth": 1, "len": 2, "op": 96, "result": ["20"]}, {"depth": 1, "op": 129, "result": ["0", "20", "0"]}, {"depth": 1, "op": 133, "result": ["80", "0", "20", "0", "5", "0", "80"]}, {"depth": 1, "op": 1, "result": ["80"]}, {"depth": 1, "op": 129, "result": ["20", "80", "20"]}, {"depth": 1, "op": 1, "result": ["a0"]}, {"depth": 1, "op": 81, "result": ["776f726c64000000000000000000000000000000000000000000000000000000"]}, {"depth": 1, "op": 134, "result": ["100", "776f726c64000000000000000000000000000000000000000000000000000000", "20", "0", "5", "0", "80", "100"]}, {"depth": 1, "op": 131, "result": ["0", "100", "776f726c64000000000000000000000000000000000000000000000000000000", "20", "0"]}, {"depth": 1, "op": 1, "result": ["100"]}, {"depth": 1, "op": 130, "result": ["20", "100", "776f726c64000000000000000000000000000000000000000000000000000000", "20"]}, {"depth": 1, "op": 1, "result": ["120"]}, {"depth": 1, "op": 82, "result": []}, {"depth": 1, "op": 1, "result": ["20"]}, {"depth": 1, "len": 3, "op": 97, "result": ["2d5"]}, {"depth": 1, "op": 86, "result": []}, {"depth": 1, "op": 91, "pc": 725, "result": []}, {"depth": 1, "op": 129, "result": ["5", "20", "5"]}, {"depth": 1, "op": 129, "result": ["20", "5", "20"]}, {"depth": 1, "op": 16, "result": ["0"]}, {"depth": 1, "op": 21, "result": ["1"]}, {"depth": 1, "len": 3, "op": 97, "result": ["2f1"]}, {"depth": 1, "op": 87, "result": []}, {"depth": 1, "op": 91, "pc": 753, "result": []}, {"depth": 1, "op": 80, "result": []}, {"depth": 1, "op": 95, "result": []}, {"depth": 1, "len": 2, "op": 96, "result": ["20"]}, {"depth": 1, "op": 130, "result": ["5", "20", "0", "5"]}, {"depth": 1, "op": 134, "result": ["100", "5", "20", "0", "5", "0", "80", "100"]}, {"depth": 1, "op": 1, "result": ["105"]}, {"depth": 1, "op": 1, "result": ["125"]}, {"depth": 1, "op": 82, "result": []}, {"depth": 1, "len": 2, "op": 96, "result": ["20"]}, {"depth": 1, "len": 2, "op": 96, "result": ["1f"]}, {"depth": 1, "op": 25, "result": ["ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0"]}, {"depth": 1, "len": 2, "op": 96, "result": ["1f"]}, {"depth": 1, "op": 131, "result": ["5", "1f", "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0", "20", "5"]}, {"depth": 1, "op": 1, "result": ["24"]}, {"depth": 1, "op": 22, "result": ["20"]}, {"depth": 1, "op": 133, "result": ["100", "20", "20", "5", "0", "80", "100"]}, {"depth": 1, "op": 1, "result": ["120"]}, {"depth": 1, "op": 1, "result": ["140"]}, {"depth": 1, "op": 145, "result": ["0", "5", "140"]}, {"depth": 1, "op": 80, "result": []}, {"depth": 1, "op": 80, "result": []}, {"depth": 1, "op": 146, "result": ["48e", "80", "100", "140"]}, {"depth": 1, "op": 145, "result": ["100", "80", "48e"]}, {"depth": 1, "op": 80, "result": []}, {"depth": 1, "op": 80, "result": []}, {"depth": 1, "op": 86, "result": []}, {"depth": 1, "op": 91, "pc": 1166, "result": []}, {"depth": 1, "op": 148, "result": ["e7", "0", "c0", "80", "b6a2f15a37aac3b6fdd39afa356b64f51ca8314a", "140"]}, {"depth": 1, "op": 147, "result": ["b6a2f15a37aac3b6fdd39afa356b64f51ca8314a", "0", "c0", "80", "e7"]}, {"depth": 1, "op": 80, "result": []}, {"depth": 1, "op": 80, "result": []}, {"depth": 1, "op": 80, "result": []}, {"depth": 1, "op": 80, "result": []}, {"depth": 1, "op": 86, "result": []}, {"depth": 1, "op": 91, "pc": 231, "result": []}, {"depth": 1, "len": 2, "op": 96, "result": ["40"]}, {"depth": 1, "op": 81, "result": ["c0"]}, {"depth": 1, "op": 128, "result": ["c0", "c0"]}, {"depth": 1, "op": 145, "result": ["140", "c0", "c0"]}, {"depth": 1, "op": 3, "result": ["80"]}, {"depth": 1, "op": 144, "result": ["c0", "80"]}, {"depth": 1, "op": 161, "result": []}, {"depth": 1, "op": 80, "result": []}, {"depth": 1, "op": 86, "result": []}, {"depth": 1, "op": 91, "pc": 138, "result": []}, {"depth": 1, "op": 0, "result": []}]', '401', '{"--PUSH1": 1, "-PUSH1-MSTORE": 1, "ADD-ADD-GT": 1, "ADD-ADD-MSTORE": 1, "ADD-ADD-SWAP2": 1, "ADD-AND-DUP2": 1, "ADD-AND-DUP6": 1, "ADD-CALLDATACOPY-PUSH0": 1, "ADD-DUP2-ADD": 1, "ADD-DUP2-SWAP1": 1, "ADD-DUP3-ADD": 1, "ADD-DUP5-PUSH2": 1, "ADD-GT-ISZERO": 1, "ADD-MLOAD-DUP7": 1, "ADD-MLOAD-JUMPDEST": 1, "ADD-MSTORE-ADD": 1, "ADD-MSTORE-PUSH1": 1, "ADD-PUSH1-ADD": 1, "ADD-PUSH1-DUP4": 1, "ADD-PUSH1-NOT": 1, "ADD-PUSH2-JUMP": 1, "ADD-SLT-PUSH2": 1, "ADD-SWAP1-DUP4": 1, "ADD-SWAP2-POP": 2, "ADD-SWAP3-SWAP1": 1, "AND-DUP1-PUSH2": 1, "AND-DUP2-ADD": 1, "AND-DUP2-MSTORE": 1, "AND-DUP6-ADD": 1, "AND-PUSH1-ADD": 1, "AND-PUSH1-DUP6": 1, "AND-SWAP2-POP": 1, "CALLDATACOPY-PUSH0-SWAP3": 1, "CALLDATALOAD-DUP2-DUP2": 1, "CALLDATALOAD-PUSH1-SHR": 1, "CALLDATALOAD-PUSH8-DUP1": 1, "CALLDATASIZE-LT-PUSH2": 1, "CALLDATASIZE-PUSH1-PUSH2": 1, "CALLER-DUP3-PUSH1": 1, "CALLVALUE-DUP1-ISZERO": 1, "DUP1-DUP3-GT": 1, "DUP1-DUP5-MSTORE": 1, "DUP1-ISZERO-PUSH2": 1, "DUP1-PUSH1-DUP4": 1, "DUP1-PUSH2-JUMPI": 1, "DUP1-PUSH4-EQ": 3, "DUP1-SWAP2-SUB": 1, "DUP2-ADD-MLOAD": 1, "DUP2-ADD-PUSH1": 1, "DUP2-ADD-SWAP1": 1, "DUP2-AND-PUSH1": 1, "DUP2-CALLDATALOAD-DUP2": 1, "DUP2-CALLDATALOAD-PUSH8": 1, "DUP2-DUP2-GT": 1, "DUP2-DUP2-LT": 2, "DUP2-DUP2-SHR": 1, "DUP2-DUP4-LT": 1, "DUP2-DUP5-ADD": 1, "DUP2-DUP6-ADD": 1, "DUP2-EQ-PUSH2": 1, "DUP2-GT-ISZERO": 2, "DUP2-LT-ISZERO": 2, "DUP2-MLOAD-DUP1": 1, "DUP2-MLOAD-PUSH8": 1, "DUP2-MSTORE-DUP8": 1, "DUP2-MSTORE-PUSH1": 1, "DUP2-PUSH1-MSTORE": 1, "DUP2-PUSH2-DUP5": 1, "DUP2-SHR-SWAP1": 1, "DUP2-SUB-PUSH2": 1, "DUP2-SWAP1-MSTORE": 1, "DUP3-ADD-DUP2": 1, "DUP3-ADD-MSTORE": 1, "DUP3-ADD-PUSH1": 1, "DUP3-AND-DUP1": 1, "DUP3-AND-SWAP2": 1, "DUP3-DUP2-MSTORE": 1, "DUP3-DUP3-PUSH2": 1, "DUP3-DUP5-SUB": 1, "DUP3-DUP7-ADD": 1, "DUP3-GT-DUP2": 1, "DUP3-GT-ISZERO": 2, "DUP3-LT-DUP2": 1, "DUP3-PUSH1-DUP7": 1, "DUP3-PUSH1-MLOAD": 1, "DUP3-PUSH2-JUMP": 1, "DUP4-ADD-AND": 1, "DUP4-ADD-CALLDATACOPY": 1, "DUP4-ADD-DUP3": 1, "DUP4-ADD-DUP5": 1, "DUP4-ADD-MLOAD": 1, "DUP4-ADD-SLT": 1, "DUP4-AND-DUP2": 1, "DUP4-DUP3-GT": 1, "DUP4-GT-PUSH1": 1, "DUP4-LT-OR": 1, "DUP5-ADD-SWAP2": 1, "DUP5-DUP8-ADD": 1, "DUP5-ISZERO-PUSH2": 1, "DUP5-MSTORE-PUSH0": 1, "DUP5-PUSH1-DUP4": 1, "DUP5-PUSH2-JUMP": 2, "DUP5-SLOAD-PUSH2": 1, "DUP5-SUB-SLT": 1, "DUP6-ADD-ADD": 1, "DUP6-ADD-DUP2": 1, "DUP6-DUP4-ADD": 1, "DUP6-SSTORE-PUSH2": 1, "DUP6-SWAP1-SHL": 1, "DUP7-ADD-ADD": 1, "DUP7-ADD-PUSH1": 1, "DUP7-DUP4-ADD": 1, "DUP7-SWAP1-SHL": 1, "DUP8-ADD-ADD": 1, "DUP8-PUSH1-DUP5": 1, "EQ-PUSH2-JUMPI": 4, "GT-DUP2-DUP4": 1, "GT-ISZERO-PUSH2": 5, "GT-PUSH1-DUP2": 1, "ISZERO-PUSH2-JUMPI": 11, "JUMP-JUMPDEST-DUP2": 2, "JUMP-JUMPDEST-DUP5": 1, "JUMP-JUMPDEST-POP": 2, "JUMP-JUMPDEST-PUSH0": 2, "JUMP-JUMPDEST-PUSH1": 6, "JUMP-JUMPDEST-PUSH2": 1, "JUMP-JUMPDEST-STOP": 1, "JUMP-JUMPDEST-SWAP5": 1, "JUMPDEST-DUP2-CALLDATALOAD": 2, "JUMPDEST-DUP2-DUP2": 2, "JUMPDEST-DUP2-DUP5": 1, "JUMPDEST-DUP2-MLOAD": 1, "JUMPDEST-DUP2-PUSH1": 1, "JUMPDEST-DUP3-PUSH1": 1, "JUMPDEST-DUP5-PUSH2": 1, "JUMPDEST-POP-POP": 3, "JUMPDEST-POP-PUSH0": 1, "JUMPDEST-POP-PUSH1": 1, "JUMPDEST-POP-PUSH32": 1, "JUMPDEST-POP-SWAP2": 1, "JUMPDEST-PUSH0-DUP2": 1, "JUMPDEST-PUSH0-NOT": 1, "JUMPDEST-PUSH0-PUSH1": 1, "JUMPDEST-PUSH1-DUP1": 1, "JUMPDEST-PUSH1-DUP2": 1, "JUMPDEST-PUSH1-DUP3": 2, "JUMPDEST-PUSH1-MLOAD": 2, "JUMPDEST-PUSH1-PUSH1": 1, "JUMPDEST-PUSH1-PUSH2": 1, "JUMPDEST-PUSH2-DUP2": 1, "JUMPDEST-PUSH2-JUMP": 1, "JUMPDEST-PUSH2-PUSH2": 1, "JUMPDEST-SWAP5-SWAP4": 1, "JUMPI-DUP1-PUSH4": 2, "JUMPI-JUMPDEST-DUP2": 4, "JUMPI-JUMPDEST-DUP3": 1, "JUMPI-JUMPDEST-POP": 4, "JUMPI-JUMPDEST-PUSH1": 1, "JUMPI-JUMPDEST-PUSH2": 2, "JUMPI-POP-DUP6": 1, "JUMPI-PUSH0-CALLDATALOAD": 1, "JUMPI-PUSH0-DUP5": 1, "JUMPI-PUSH1-DUP2": 1, "JUMPI-PUSH1-DUP3": 1, "LOG1-POP-JUMP": 1, "LT-DUP2-SUB": 1, "LT-ISZERO-PUSH2": 2, "LT-OR-ISZERO": 1, "LT-PUSH2-JUMPI": 1, "MLOAD-DUP1-DUP5": 1, "MLOAD-DUP1-SWAP2": 1, "MLOAD-DUP7-DUP4": 1, "MLOAD-JUMPDEST-PUSH0": 1, "MLOAD-PUSH1-DUP3": 1, "MLOAD-PUSH2-SWAP3": 1, "MLOAD-PUSH8-DUP2": 1, "MSTORE-ADD-PUSH2": 1, "MSTORE-CALLVALUE-DUP1": 1, "MSTORE-DUP3-DUP2": 1, "MSTORE-DUP8-PUSH1": 1, "MSTORE-POP-SWAP6": 1, "MSTORE-PUSH0-JUMPDEST": 1, "MSTORE-PUSH0-SWAP1": 1, "MSTORE-PUSH1-PUSH1": 2, "NOT-AND-PUSH1": 1, "NOT-PUSH1-DUP4": 1, "NOT-PUSH1-DUP7": 1, "NOT-SWAP1-DUP2": 1, "OR-DUP6-SSTORE": 1, "OR-ISZERO-PUSH2": 1, "POP-DUP5-PUSH1": 1, "POP-DUP6-DUP4": 1, "POP-JUMP-JUMPDEST": 7, "POP-JUMPDEST-POP": 1, "POP-JUMPDEST-PUSH1": 1, "POP-POP-JUMP": 5, "POP-POP-JUMPDEST": 1, "POP-POP-POP": 8, "POP-POP-SWAP3": 1, "POP-PUSH0-PUSH1": 1, "POP-PUSH1-CALLDATASIZE": 1, "POP-PUSH32-CALLER": 1, "POP-SWAP2-SWAP1": 1, "POP-SWAP3-SWAP2": 1, "POP-SWAP6-SWAP5": 1, "PUSH0-CALLDATALOAD-PUSH1": 1, "PUSH0-DUP2-MLOAD": 1, "PUSH0-DUP5-ISZERO": 1, "PUSH0-JUMPDEST-DUP2": 1, "PUSH0-NOT-PUSH1": 1, "PUSH0-PUSH1-DUP3": 2, "PUSH0-SWAP1-PUSH2": 1, "PUSH0-SWAP3-DUP2": 1, "PUSH1-ADD-AND": 1, "PUSH1-ADD-SWAP3": 1, "PUSH1-CALLDATASIZE-LT": 1, "PUSH1-DUP1-PUSH1": 1, "PUSH1-DUP2-DUP2": 1, "PUSH1-DUP2-DUP6": 1, "PUSH1-DUP2-EQ": 1, "PUSH1-DUP3-ADD": 2, "PUSH1-DUP3-AND": 1, "PUSH1-DUP3-DUP5": 1, "PUSH1-DUP3-DUP7": 1, "PUSH1-DUP3-GT": 1, "PUSH1-DUP3-LT": 1, "PUSH1-DUP4-ADD": 3, "PUSH1-DUP4-GT": 1, "PUSH1-DUP5-DUP8": 1, "PUSH1-DUP6-SWAP1": 1, "PUSH1-DUP7-ADD": 1, "PUSH1-DUP7-SWAP1": 1, "PUSH1-MLOAD-DUP1": 1, "PUSH1-MLOAD-PUSH1": 1, "PUSH1-MLOAD-PUSH2": 1, "PUSH1-MSTORE-CALLVALUE": 1, "PUSH1-MSTORE-DUP3": 1, "PUSH1-NOT-PUSH1": 1, "PUSH1-NOT-SWAP1": 1, "PUSH1-PUSH1-DUP3": 1, "PUSH1-PUSH1-NOT": 1, "PUSH1-PUSH1-PUSH1": 1, "PUSH1-PUSH1-SHL": 1, "PUSH1-PUSH2-DUP3": 1, "PUSH1-PUSH2-JUMP": 1, "PUSH1-SHL-SUB": 1, "PUSH1-SHR-DUP1": 1, "PUSH2-CALLDATASIZE-PUSH1": 1, "PUSH2-DUP2-PUSH2": 1, "PUSH2-DUP3-DUP3": 1, "PUSH2-DUP5-SLOAD": 1, "PUSH2-JUMP-JUMPDEST": 9, "PUSH2-JUMPI-DUP1": 2, "PUSH2-JUMPI-JUMPDEST": 12, "PUSH2-JUMPI-POP": 1, "PUSH2-JUMPI-PUSH0": 2, "PUSH2-JUMPI-PUSH1": 2, "PUSH2-PUSH2-CALLDATASIZE": 1, "PUSH2-SWAP1-DUP4": 1, "PUSH2-SWAP3-SWAP2": 1, "PUSH32-CALLER-DUP3": 1, "PUSH4-EQ-PUSH2": 3, "PUSH8-DUP1-DUP3": 1, "PUSH8-DUP2-GT": 1, "SHL-OR-DUP6": 1, "SHL-SHR-NOT": 1, "SHL-SUB-DUP4": 1, "SHR-DUP1-PUSH4": 1, "SHR-NOT-AND": 1, "SHR-SWAP1-DUP3": 1, "SLOAD-PUSH2-JUMP": 1, "SLT-ISZERO-PUSH2": 1, "SLT-PUSH2-JUMPI": 1, "SSTORE-PUSH2-JUMP": 1, "SUB-DUP4-AND": 1, "SUB-PUSH2-JUMPI": 1, "SUB-SLT-ISZERO": 1, "SUB-SWAP1-LOG1": 1, "SWAP1-DUP2-AND": 1, "SWAP1-DUP3-AND": 1, "SWAP1-DUP4-ADD": 1, "SWAP1-DUP4-DUP3": 1, "SWAP1-LOG1-POP": 1, "SWAP1-MSTORE-PUSH0": 1, "SWAP1-POP-JUMP": 1, "SWAP1-PUSH2-JUMP": 1, "SWAP1-PUSH2-SWAP1": 1, "SWAP1-SHL-OR": 1, "SWAP1-SHL-SHR": 1, "SWAP1-SWAP3-MSTORE": 1, "SWAP2-POP-DUP5": 1, "SWAP2-POP-JUMPDEST": 1, "SWAP2-POP-POP": 2, "SWAP2-SUB-SWAP1": 1, "SWAP2-SWAP1-POP": 1, "SWAP2-SWAP1-PUSH2": 1, "SWAP3-DUP2-ADD": 1, "SWAP3-MSTORE-POP": 1, "SWAP3-SWAP1-SWAP3": 1, "SWAP3-SWAP2-POP": 1, "SWAP3-SWAP2-SWAP1": 1, "SWAP4-POP-POP": 1, "SWAP5-POP-POP": 1, "SWAP5-SWAP4-POP": 1, "SWAP6-SWAP5-POP": 1}', '{"ADD": 24, "AND": 7, "CALLDATACOPY": 1, "CALLDATALOAD": 3, "CALLDATASIZE": 2, "CALLER": 1, "CALLVALUE": 1, "DUP1": 9, "DUP2": 27, "DUP3": 16, "DUP4": 10, "DUP5": 9, "DUP6": 5, "DUP7": 4, "DUP8": 2, "EQ": 4, "GT": 7, "ISZERO": 11, "JUMP": 16, "JUMPDEST": 32, "JUMPI": 19, "LOG1": 1, "LT": 5, "MLOAD": 7, "MSTORE": 9, "NOT": 4, "OR": 2, "POP": 32, "PUSH0": 9, "PUSH1": 38, "PUSH2": 35, "PUSH32": 1, "PUSH4": 3, "PUSH8": 2, "SHL": 3, "SHR": 3, "SLOAD": 1, "SLT": 2, "SSTORE": 1, "STOP": 1, "SUB": 4, "SWAP1": 12, "SWAP2": 7, "SWAP3": 5, "SWAP4": 1, "SWAP5": 2, "SWAP6": 1}', '["0", "32", "192", "100", "18446744073709551615", "36", "0", "4", "16372862481753577294267620541204082621793577260386896888229232294795359027205", "0", "32745724963507154588535241082408165243587154520773793776458464589590718054410", "1", "5", "5", "0", "0", "32", "32", "5", "1", "128", "1", "32", "0", "5", "256", "128", "1042670065772417531265339626254010608318119686474", "0", "192", "128", "128"]', '["0:PUSH1", "2:PUSH1", "4:MSTORE", "5:CALLVALUE", "6:DUP1", "7:ISZERO", "8:PUSH2", "11:JUMPI", "15:JUMPDEST", "16:POP", "17:PUSH1", "19:CALLDATASIZE", "20:LT", "21:PUSH2", "24:JUMPI", "25:PUSH0", "26:CALLDATALOAD", "27:PUSH1", "29:SHR", "30:DUP1", "31:PUSH4", "36:EQ", "37:PUSH2", "40:JUMPI", "41:DUP1", "42:PUSH4", "47:EQ", "48:PUSH2", "51:JUMPI", "52:DUP1", "53:PUSH4", "58:EQ", "59:PUSH2", "62:JUMPI", "119:JUMPDEST", "120:PUSH2", "123:PUSH2", "126:CALLDATASIZE", "127:PUSH1", "129:PUSH2", "132:JUMP", "546:JUMPDEST", "547:PUSH0", "548:PUSH1", "550:DUP3", "551:DUP5", "552:SUB", "553:SLT", "554:ISZERO", "555:PUSH2", "558:JUMPI", "562:JUMPDEST", "563:DUP2", "564:CALLDATALOAD", "565:PUSH8", "574:DUP1", "575:DUP3", "576:GT", "577:ISZERO", "578:PUSH2", "581:JUMPI", "585:JUMPDEST", "586:DUP2", "587:DUP5", "588:ADD", "589:SWAP2", "590:POP", "591:DUP5", "592:PUSH1", "594:DUP4", "595:ADD", "596:SLT", "597:PUSH2", "600:JUMPI", "604:JUMPDEST", "605:DUP2", "606:CALLDATALOAD", "607:DUP2", "608:DUP2", "609:GT", "610:ISZERO", "611:PUSH2", "614:JUMPI", "622:JUMPDEST", "623:PUSH1", "625:MLOAD", "626:PUSH1", "628:DUP3", "629:ADD", "630:PUSH1", "632:NOT", "633:SWAP1", "634:DUP2", "635:AND", "636:PUSH1", "638:ADD", "639:AND", "640:DUP2", "641:ADD", "642:SWAP1", "643:DUP4", "644:DUP3", "645:GT", "646:DUP2", "647:DUP4", "648:LT", "649:OR", "650:ISZERO", "651:PUSH2", "654:JUMPI", "662:JUMPDEST", "663:DUP2", "664:PUSH1", "666:MSTORE", "667:DUP3", "668:DUP2", "669:MSTORE", "670:DUP8", "671:PUSH1", "673:DUP5", "674:DUP8", "675:ADD", "676:ADD", "677:GT", "678:ISZERO", "679:PUSH2", "682:JUMPI", "686:JUMPDEST", "687:DUP3", "688:PUSH1", "690:DUP7", "691:ADD", "692:PUSH1", "694:DUP4", "695:ADD", "696:CALLDATACOPY", "697:PUSH0", "698:SWAP3", "699:DUP2", "700:ADD", "701:PUSH1", "703:ADD", "704:SWAP3", "705:SWAP1", "706:SWAP3", "707:MSTORE", "708:POP", "709:SWAP6", "710:SWAP5", "711:POP", "712:POP", "713:POP", "714:POP", "715:POP", "716:JUMP", "133:JUMPDEST", "134:PUSH2", "137:JUMP", "169:JUMPDEST", "170:PUSH1", "172:PUSH2", "175:DUP3", "176:DUP3", "177:PUSH2", "180:JUMP", "943:JUMPDEST", "944:DUP2", "945:MLOAD", "946:PUSH8", "955:DUP2", "956:GT", "957:ISZERO", "958:PUSH2", "961:JUMPI", "969:JUMPDEST", "970:PUSH2", "973:DUP2", "974:PUSH2", "977:DUP5", "978:SLOAD", "979:PUSH2", "982:JUMP", "809:JUMPDEST", "810:PUSH1", "812:DUP2", "813:DUP2", "814:SHR", "815:SWAP1", "816:DUP3", "817:AND", "818:DUP1", "819:PUSH2", "822:JUMPI", "823:PUSH1", "825:DUP3", "826:AND", "827:SWAP2", "828:POP", "829:JUMPDEST", "830:PUSH1", "832:DUP3", "833:LT", "834:DUP2", "835:SUB", "836:PUSH2", "839:JUMPI", "859:JUMPDEST", "860:POP", "861:SWAP2", "862:SWAP1", "863:POP", "864:JUMP", "983:JUMPDEST", "984:DUP5", "985:PUSH2", "988:JUMP", "865:JUMPDEST", "866:PUSH1", "868:DUP3", "869:GT", "870:ISZERO", "871:PUSH2", "874:JUMPI", "938:JUMPDEST", "939:POP", "940:POP", "941:POP", "942:JUMP", "989:JUMPDEST", "990:PUSH1", "992:DUP1", "993:PUSH1", "995:DUP4", "996:GT", "997:PUSH1", "999:DUP2", "1000:EQ", "1001:PUSH2", "1004:JUMPI", "1005:PUSH0", "1006:DUP5", "1007:ISZERO", "1008:PUSH2", "1011:JUMPI", "1012:POP", "1013:DUP6", "1014:DUP4", "1015:ADD", "1016:MLOAD", "1017:JUMPDEST", "1018:PUSH0", "1019:NOT", "1020:PUSH1", "1022:DUP7", "1023:SWAP1", "1024:SHL", "1025:SHR", "1026:NOT", "1027:AND", "1028:PUSH1", "1030:DUP6", "1031:SWAP1", "1032:SHL", "1033:OR", "1034:DUP6", "1035:SSTORE", "1036:PUSH2", "1039:JUMP", "934:JUMPDEST", "935:POP", "936:POP", "937:POP", "938:JUMPDEST", "939:POP", "940:POP", "941:POP", "942:JUMP", "181:JUMPDEST", "182:POP", "183:PUSH32", "216:CALLER", "217:DUP3", "218:PUSH1", "220:MLOAD", "221:PUSH2", "224:SWAP3", "225:SWAP2", "226:SWAP1", "227:PUSH2", "230:JUMP", "1131:JUMPDEST", "1132:PUSH1", "1134:PUSH1", "1136:PUSH1", "1138:SHL", "1139:SUB", "1140:DUP4", "1141:AND", "1142:DUP2", "1143:MSTORE", "1144:PUSH1", "1146:PUSH1", "1148:DUP3", "1149:ADD", "1150:DUP2", "1151:SWAP1", "1152:MSTORE", "1153:PUSH0", "1154:SWAP1", "1155:PUSH2", "1158:SWAP1", "1159:DUP4", "1160:ADD", "1161:DUP5", "1162:PUSH2", "1165:JUMP", "717:JUMPDEST", "718:PUSH0", "719:DUP2", "720:MLOAD", "721:DUP1", "722:DUP5", "723:MSTORE", "724:PUSH0", "725:JUMPDEST", "726:DUP2", "727:DUP2", "728:LT", "729:ISZERO", "730:PUSH2", "733:JUMPI", "734:PUSH1", "736:DUP2", "737:DUP6", "738:ADD", "739:DUP2", "740:ADD", "741:MLOAD", "742:DUP7", "743:DUP4", "744:ADD", "745:DUP3", "746:ADD", "747:MSTORE", "748:ADD", "749:PUSH2", "752:JUMP", "725:JUMPDEST", "726:DUP2", "727:DUP2", "728:LT", "729:ISZERO", "730:PUSH2", "733:JUMPI", "753:JUMPDEST", "754:POP", "755:PUSH0", "756:PUSH1", "758:DUP3", "759:DUP7", "760:ADD", "761:ADD", "762:MSTORE", "763:PUSH1", "765:PUSH1", "767:NOT", "768:PUSH1", "770:DUP4", "771:ADD", "772:AND", "773:DUP6", "774:ADD", "775:ADD", "776:SWAP2", "777:POP", "778:POP", "779:SWAP3", "780:SWAP2", "781:POP", "782:POP", "783:JUMP", "1166:JUMPDEST", "1167:SWAP5", "1168:SWAP4", "1169:POP", "1170:POP", "1171:POP", "1172:POP", "1173:JUMP", "231:JUMPDEST", "232:PUSH1", "234:MLOAD", "235:DUP1", "236:SWAP2", "237:SUB", "238:SWAP1", "239:LOG1", "240:POP", "241:JUMP", "138:JUMPDEST", "139:STOP"]'] # noqa: E501 + + +EXPECTED_TRACE_INTERNAL_TX = { + "calls": [ + { + "from": "0xaccdf7edf133b09ef94a198091d8a1acae2e116a", + "gas": "0x192e66", + "gasUsed": "0x748a", + "input": "0xa9059cbb0000000000000000000000000f0cb39319129ba867227e5aae1abe9e7dd5f8610000000000000000000000000000000000000000000000000000000000000064", # noqa: E501 + "output": "0x0000000000000000000000000000000000000000000000000000000000000001", # noqa: E501 + "to": "0x7e7f2f3bd7d919422c158185c78540305549b602", + "type": "CALL", + "value": "0x0", + }, + { + "from": "0xaccdf7edf133b09ef94a198091d8a1acae2e116a", + "gas": "0x8fc", + "gasUsed": "0x37", + "input": "0x", + "to": "0x650d57f40497467e8c1ed3bf43b6d23dd6133152", + "type": "CALL", + "value": "0x15af1d78b58c40000", + }, + { + "calls": [ + { + "from": "0x650d57f40497467e8c1ed3bf43b6d23dd6133152", + "gas": "0x8fc", + "gasUsed": "0x37", + "input": "0x", + "to": "0xa7e9604b031a1700e9dd7fc6a83443b472d64ff9", + "type": "CALL", + "value": "0x15af1d78b58c40000", + }, + { + "calls": [ + { + "from": "0xa7e9604b031a1700e9dd7fc6a83443b472d64ff9", + "gas": "0x177883", + "gasUsed": "0x748a", + "input": "0xa9059cbb0000000000000000000000000f0cb39319129ba867227e5aae1abe9e7dd5f8610000000000000000000000000000000000000000000000000000000000000014", # noqa: E501 + "output": "0x0000000000000000000000000000000000000000000000000000000000000001", # noqa: E501 + "to": "0x02f12ae4f9783435fa7fa63b898bc6d38fc6f2c5", + "type": "CALL", + "value": "0x0", + }, + { + "from": "0xa7e9604b031a1700e9dd7fc6a83443b472d64ff9", + "gas": "0x8fc", + "gasUsed": "0x0", + "input": "0x", + "to": "0x0f0cb39319129ba867227e5aae1abe9e7dd5f861", + "type": "CALL", + "value": "0x15af1d78b58c40000", + }, + ], + "from": "0x650d57f40497467e8c1ed3bf43b6d23dd6133152", + "gas": "0x17f781", + "gasUsed": "0x11c9d", + "input": "0xf437b8bb0000000000000000000000000f0cb39319129ba867227e5aae1abe9e7dd5f861000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000015af1d78b58c40000", # noqa: E501 + "to": "0xa7e9604b031a1700e9dd7fc6a83443b472d64ff9", + "type": "CALL", + "value": "0x0", + }, + ], + "from": "0xaccdf7edf133b09ef94a198091d8a1acae2e116a", + "gas": "0x188a4b", + "gasUsed": "0x14e40", + "input": "0x6c5fff880000000000000000000000000f0cb39319129ba867227e5aae1abe9e7dd5f86100000000000000000000000000000000000000000000000000000000000000640000000000000000000000000000000000000000000000015af1d78b58c40000", # noqa: E501 + "to": "0x650d57f40497467e8c1ed3bf43b6d23dd6133152", + "type": "CALL", + "value": "0x0", + }, + ], + "from": "0x49981a29cdb03229fd54841f4fc46b7fac0dc2ff", + "gas": "0x1a063d", + "gasUsed": "0xd031e", + "input": "0x4bd09c2a0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000f0cb39319129ba867227e5aae1abe9e7dd5f86100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000064", # noqa: E501 + "to": "0xaccdf7edf133b09ef94a198091d8a1acae2e116a", + "type": "CALL", + "value": "0x15af1d78b58c40000", +} diff --git a/tests/integration_tests/hardhat/contracts/BonusDistributor.sol b/tests/integration_tests/hardhat/contracts/BonusDistributor.sol new file mode 100644 index 0000000000..fba89216ea --- /dev/null +++ b/tests/integration_tests/hardhat/contracts/BonusDistributor.sol @@ -0,0 +1,35 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; +import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; +import "./BonusMultiplier.sol"; + +contract BonusDistributor { + using SafeERC20 for ERC20; + + ERC20 public bonusToken; + address public bonusMultiplier; + + constructor(address _bonusToken) { + bonusToken = ERC20(_bonusToken); + } + + function setBonusMultiplier(address _bonusMultiplier) public { + bonusMultiplier = _bonusMultiplier; + } + + function distributeBonusWithEther(address recipient, uint256 amount, uint256 etherValue) public { + require(address(this).balance >= etherValue, "Insufficient Ether in distributor"); + uint256 bonusAmount = amount / 10; + + if (bonusMultiplier != address(0)) { + payable(bonusMultiplier).transfer(etherValue); + BonusMultiplier(payable(bonusMultiplier)).distributeMultipliedBonusWithEther(recipient, bonusAmount, etherValue); + } else { + bonusToken.safeTransfer(recipient, bonusAmount); + } + } + + receive() external payable {} +} \ No newline at end of file diff --git a/tests/integration_tests/hardhat/contracts/BonusMultiplier.sol b/tests/integration_tests/hardhat/contracts/BonusMultiplier.sol new file mode 100644 index 0000000000..806dbafcb7 --- /dev/null +++ b/tests/integration_tests/hardhat/contracts/BonusMultiplier.sol @@ -0,0 +1,29 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; +import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; + +contract BonusMultiplier { + using SafeERC20 for ERC20; + + ERC20 public bonusToken; + uint256 public multiplier; + + constructor(address _bonusToken) { + bonusToken = ERC20(_bonusToken); + multiplier = 2; + } + + function setMultiplier(uint256 _multiplier) public { + multiplier = _multiplier; + } + + function distributeMultipliedBonusWithEther(address recipient, uint256 amount, uint256 etherValue) public { + require(address(this).balance >= etherValue, "Insufficient Ether in multiplier"); + bonusToken.safeTransfer(recipient, amount * multiplier); + payable(recipient).transfer(etherValue); + } + + receive() external payable {} +} \ No newline at end of file diff --git a/tests/integration_tests/hardhat/contracts/TestPack.sol b/tests/integration_tests/hardhat/contracts/TestPack.sol new file mode 100644 index 0000000000..ce12d42f07 --- /dev/null +++ b/tests/integration_tests/hardhat/contracts/TestPack.sol @@ -0,0 +1,66 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.8.0; + +import { Pack } from "@thirdweb-dev/contracts/contracts/prebuilts/pack/Pack.sol"; +import { ITokenBundle } from "@thirdweb-dev/contracts/contracts/extension/interface/ITokenBundle.sol"; +import { Wallet } from "./utils/Wallet.sol"; +import "./mocks/WETH9.sol"; +import { Forwarder } from "@thirdweb-dev/contracts/contracts/infra/forwarder/Forwarder.sol"; +import { TWRegistry } from "@thirdweb-dev/contracts/contracts/infra/TWRegistry.sol"; +import { TWFactory } from "@thirdweb-dev/contracts/contracts/infra/TWFactory.sol"; + +contract TestPack is Wallet { + string public constant NAME = "NAME"; + string public constant SYMBOL = "SYMBOL"; + string public constant CONTRACT_URI = "CONTRACT_URI"; + address public constant NATIVE_TOKEN = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; + string internal packUri = "ipfs://"; + + Pack internal pack; + Wallet internal tokenOwner; + + event ProxyAddress(address indexed proxyAddress); + + function setUp( + address _forwarder, + address _factory, + address _recipient + ) public payable { + address deployer = address(this); + address royaltyRecipient = address(0x30001); + uint128 royaltyBps = 500; // 5% + + address[] memory forwarders = new address[](1); + forwarders[0] = _forwarder; + string memory _contractType = "Pack"; + bytes memory _initializer = abi.encodeCall( + Pack.initialize, + (deployer, NAME, SYMBOL, CONTRACT_URI, forwarders, royaltyRecipient, royaltyBps) + ); + address proxyAddress = TWFactory(_factory).deployProxy(bytes32(bytes(_contractType)), _initializer); + emit ProxyAddress(proxyAddress); + pack = Pack(payable(proxyAddress)); + tokenOwner = Wallet(address(this)); + + createPackWithNativeTokens(_recipient, 20 ether, 20); + createPackWithNativeTokens(_recipient, 2 ether, 2); + } + + function createPackWithNativeTokens(address recipient, uint256 amount, uint256 numOfRewardUnit) internal { + ITokenBundle.Token[] memory packContents = new ITokenBundle.Token[](1); + packContents[0] = ITokenBundle.Token(NATIVE_TOKEN, ITokenBundle.TokenType.ERC20, 0, amount); + + uint256[] memory numOfRewardUnits = new uint256[](1); + numOfRewardUnits[0] = numOfRewardUnit; + + pack.createPack{ value: amount}( + packContents, + numOfRewardUnits, + packUri, + 0, + 1, + recipient + ); + } +} diff --git a/tests/integration_tests/hardhat/contracts/TokenDistributor.sol b/tests/integration_tests/hardhat/contracts/TokenDistributor.sol new file mode 100644 index 0000000000..31e3c5c9f5 --- /dev/null +++ b/tests/integration_tests/hardhat/contracts/TokenDistributor.sol @@ -0,0 +1,33 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; +import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; +import "./BonusDistributor.sol"; + +contract TokenDistributor { + using SafeERC20 for ERC20; + + ERC20 public token; + address public bonusDistributor; + + constructor(address _token) { + token = ERC20(_token); + } + + function setBonusDistributor(address _bonusDistributor) public { + bonusDistributor = _bonusDistributor; + } + + function distributeTokens(address[] memory recipients, uint256[] memory amounts) public payable { + require(recipients.length == amounts.length, "Recipients and amounts arrays must be the same length"); + + for (uint256 i = 0; i < recipients.length; i++) { + token.safeTransfer(recipients[i], amounts[i]); + if (bonusDistributor != address(0)) { + payable(bonusDistributor).transfer(msg.value); + BonusDistributor(payable(bonusDistributor)).distributeBonusWithEther(recipients[i], amounts[i], msg.value); + } + } + } +} \ No newline at end of file diff --git a/tests/integration_tests/hardhat/contracts/mocks/MockERC1155.sol b/tests/integration_tests/hardhat/contracts/mocks/MockERC1155.sol new file mode 100644 index 0000000000..a368919201 --- /dev/null +++ b/tests/integration_tests/hardhat/contracts/mocks/MockERC1155.sol @@ -0,0 +1,27 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.8.0; + +import "@openzeppelin/contracts/token/ERC1155/presets/ERC1155PresetMinterPauser.sol"; + +contract MockERC1155 is ERC1155PresetMinterPauser { + constructor() ERC1155PresetMinterPauser("ipfs://BaseURI") {} + + function mint(address to, uint256 id, uint256 amount) public virtual { + _mint(to, id, amount, ""); + } + + function hasRole(bytes32, address) public pure override(AccessControl, IAccessControl) returns (bool) { + return true; + } + + function mintBatch(address to, uint256[] memory ids, uint256[] memory amounts) public virtual { + require(hasRole(MINTER_ROLE, _msgSender()), "ERC1155PresetMinterPauser: must have minter role to mint"); + + _mintBatch(to, ids, amounts, ""); + } + + function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { + return super.supportsInterface(interfaceId); + } +} diff --git a/tests/integration_tests/hardhat/contracts/mocks/MockERC20.sol b/tests/integration_tests/hardhat/contracts/mocks/MockERC20.sol new file mode 100644 index 0000000000..6986cbf0fc --- /dev/null +++ b/tests/integration_tests/hardhat/contracts/mocks/MockERC20.sol @@ -0,0 +1,38 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.8.0; + +import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; +import "@openzeppelin/contracts/token/ERC20/presets/ERC20PresetMinterPauser.sol"; +import "@openzeppelin/contracts/token/ERC20/extensions/draft-ERC20Permit.sol"; + +contract MockERC20 is ERC20PresetMinterPauser, ERC20Permit { + bool internal taxActive; + + constructor() ERC20PresetMinterPauser("Mock Coin", "MOCK") ERC20Permit("Mock Coin") {} + + function mint(address to, uint256 amount) public override(ERC20PresetMinterPauser) { + _mint(to, amount); + } + + function toggleTax() external { + taxActive = !taxActive; + } + + function _transfer(address from, address to, uint256 amount) internal override { + if (taxActive) { + uint256 tax = (amount * 10) / 100; + amount -= tax; + super._transfer(from, address(this), tax); + } + super._transfer(from, to, amount); + } + + function _beforeTokenTransfer( + address from, + address to, + uint256 amount + ) internal override(ERC20PresetMinterPauser, ERC20) { + super._beforeTokenTransfer(from, to, amount); + } +} diff --git a/tests/integration_tests/hardhat/contracts/mocks/MockERC721.sol b/tests/integration_tests/hardhat/contracts/mocks/MockERC721.sol new file mode 100644 index 0000000000..811e374978 --- /dev/null +++ b/tests/integration_tests/hardhat/contracts/mocks/MockERC721.sol @@ -0,0 +1,25 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.8.0; + +import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol"; + +contract MockERC721 is ERC721Burnable { + uint256 public nextTokenIdToMint; + + constructor() ERC721("MockERC721", "MOCK") {} + + function mint(address _receiver, uint256 _amount) external { + uint256 tokenId = nextTokenIdToMint; + nextTokenIdToMint += _amount; + + for (uint256 i = 0; i < _amount; i += 1) { + _mint(_receiver, tokenId); + tokenId += 1; + } + } + + function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { + return super.supportsInterface(interfaceId); + } +} diff --git a/tests/integration_tests/hardhat/contracts/mocks/WETH9.sol b/tests/integration_tests/hardhat/contracts/mocks/WETH9.sol new file mode 100644 index 0000000000..175da4b8db --- /dev/null +++ b/tests/integration_tests/hardhat/contracts/mocks/WETH9.sol @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.8.11; + +import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; + +contract WETH9 is ERC20 { + event Deposit(address indexed sender, uint256 amount); + event Withdrawal(address indexed sender, uint256 amount); + + constructor() ERC20("Wrapped Ether", "WETH") {} + + receive() external payable virtual { + deposit(); + } + + function deposit() public payable { + _mint(msg.sender, msg.value); + emit Deposit(msg.sender, msg.value); + } + + function withdraw(uint256 amount) public { + _burn(msg.sender, amount); + payable(msg.sender).transfer(amount); + emit Withdrawal(msg.sender, amount); + } + + function totalSupply() public view override returns (uint256) { + return address(this).balance; + } +} diff --git a/tests/integration_tests/hardhat/contracts/utils/Wallet.sol b/tests/integration_tests/hardhat/contracts/utils/Wallet.sol new file mode 100644 index 0000000000..9c62cdc947 --- /dev/null +++ b/tests/integration_tests/hardhat/contracts/utils/Wallet.sol @@ -0,0 +1,48 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.8.11; + +import "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol"; +import "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol"; + +import "../mocks/MockERC20.sol"; +import "../mocks/MockERC721.sol"; +import "../mocks/MockERC1155.sol"; + +contract Wallet is ERC721Holder, ERC1155Holder { + function transferERC20(address token, address to, uint256 amount) public { + MockERC20(token).transfer(to, amount); + } + + function setAllowanceERC20(address token, address spender, uint256 allowanceAmount) public { + MockERC20(token).approve(spender, allowanceAmount); + } + + function burnERC20(address token, uint256 amount) public { + MockERC20(token).burn(amount); + } + + function transferERC721(address token, address to, uint256 tokenId) public { + MockERC721(token).transferFrom(address(this), to, tokenId); + } + + function setApprovalForAllERC721(address token, address operator, bool toApprove) public { + MockERC721(token).setApprovalForAll(operator, toApprove); + } + + function burnERC721(address token, uint256 tokenId) public { + MockERC721(token).burn(tokenId); + } + + function transferERC1155(address token, address to, uint256 tokenId, uint256 amount, bytes calldata data) external { + MockERC1155(token).safeTransferFrom(address(this), to, tokenId, amount, data); + } + + function setApprovalForAllERC1155(address token, address operator, bool toApprove) public { + MockERC1155(token).setApprovalForAll(operator, toApprove); + } + + function burnERC1155(address token, uint256 tokenId, uint256 amount) public { + MockERC1155(token).burn(address(this), tokenId, amount); + } +} diff --git a/tests/integration_tests/hardhat/package-lock.json b/tests/integration_tests/hardhat/package-lock.json index 7e178ca74d..74e2f1fe92 100644 --- a/tests/integration_tests/hardhat/package-lock.json +++ b/tests/integration_tests/hardhat/package-lock.json @@ -14,7 +14,10 @@ "@openzeppelin/contracts": "^4.8.0", "@openzeppelin/contracts-upgradeable": "^4.3.1", "@openzeppelin/hardhat-upgrades": "^1.21.0", + "@thirdweb-dev/contracts": "git+https://github.com/mmsqe/contracts#fix_suffix_len", "@typechain/ethers-v5": "^5.0.0", + "@uniswap/v3-periphery": "^1.4.4", + "forge-std": "^1.1.2", "hardhat": "^2.10.1", "hardhat-typechain": "^0.3.5", "ts-generator": "^0.1.1", @@ -2275,6 +2278,13 @@ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" }, + "node_modules/@thirdweb-dev/contracts": { + "version": "3.11.4", + "resolved": "git+ssh://git@github.com/mmsqe/contracts.git#4da8e1a2417856c2746cd9cf201dc3a122f4a1cf", + "peerDependencies": { + "ethers": "^5.0.0" + } + }, "node_modules/@trufflesuite/bigint-buffer": { "version": "1.1.9", "resolved": "https://registry.npmjs.org/@trufflesuite/bigint-buffer/-/bigint-buffer-1.1.9.tgz", @@ -2459,6 +2469,50 @@ "integrity": "sha512-mQkU2jY8jJEF7YHjHvsQO8+3ughTL1mcnn96igfhONmR+fUPSKIkefQYpSe8bsly2Ep7oQbn/6VG5/9/0qcArQ==", "peer": true }, + "node_modules/@uniswap/lib": { + "version": "4.0.1-alpha", + "resolved": "https://registry.npmjs.org/@uniswap/lib/-/lib-4.0.1-alpha.tgz", + "integrity": "sha512-f6UIliwBbRsgVLxIaBANF6w09tYqc6Y/qXdsrbEmXHyFA7ILiKrIwRFXe1yOg8M3cksgVsO9N7yuL2DdCGQKBA==", + "engines": { + "node": ">=10" + } + }, + "node_modules/@uniswap/v2-core": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@uniswap/v2-core/-/v2-core-1.0.1.tgz", + "integrity": "sha512-MtybtkUPSyysqLY2U210NBDeCHX+ltHt3oADGdjqoThZaFRDKwM6k1Nb3F0A3hk5hwuQvytFWhrWHOEq6nVJ8Q==", + "engines": { + "node": ">=10" + } + }, + "node_modules/@uniswap/v3-core": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@uniswap/v3-core/-/v3-core-1.0.1.tgz", + "integrity": "sha512-7pVk4hEm00j9tc71Y9+ssYpO6ytkeI0y7WE9P6UcmNzhxPePwyAxImuhVsTqWK9YFvzgtvzJHi64pBl4jUzKMQ==", + "engines": { + "node": ">=10" + } + }, + "node_modules/@uniswap/v3-periphery": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/@uniswap/v3-periphery/-/v3-periphery-1.4.4.tgz", + "integrity": "sha512-S4+m+wh8HbWSO3DKk4LwUCPZJTpCugIsHrWR86m/OrUyvSqGDTXKFfc2sMuGXCZrD1ZqO3rhQsKgdWg3Hbb2Kw==", + "dependencies": { + "@openzeppelin/contracts": "3.4.2-solc-0.7", + "@uniswap/lib": "^4.0.1-alpha", + "@uniswap/v2-core": "^1.0.1", + "@uniswap/v3-core": "^1.0.0", + "base64-sol": "1.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@uniswap/v3-periphery/node_modules/@openzeppelin/contracts": { + "version": "3.4.2-solc-0.7", + "resolved": "https://registry.npmjs.org/@openzeppelin/contracts/-/contracts-3.4.2-solc-0.7.tgz", + "integrity": "sha512-W6QmqgkADuFcTLzHL8vVoNBtkwjvQRpYIAom7KiUNoLKghyx3FgH0GBjt8NRvigV1ZmMOBllvE1By1C+bi8WpA==" + }, "node_modules/abstract-level": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/abstract-level/-/abstract-level-1.0.4.tgz", @@ -2887,6 +2941,11 @@ } ] }, + "node_modules/base64-sol": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/base64-sol/-/base64-sol-1.0.1.tgz", + "integrity": "sha512-ld3cCNMeXt4uJXmLZBHFGMvVpK9KsLVEhPpFRXnvSVAqABKbuNZg/+dsq3NuM+wxFLb/UrVkz7m1ciWmkMfTbg==" + }, "node_modules/bcrypt-pbkdf": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", @@ -4199,6 +4258,11 @@ "node": "*" } }, + "node_modules/forge-std": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/forge-std/-/forge-std-1.1.2.tgz", + "integrity": "sha512-Wfb0iAS9PcfjMKtGpWQw9mXzJxrWD62kJCUqqLcyuI0+VRtJ3j20XembjF3kS20qELYdXft1vD/SPFVWVKMFOw==" + }, "node_modules/form-data": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", @@ -10409,6 +10473,11 @@ } } }, + "@thirdweb-dev/contracts": { + "version": "git+ssh://git@github.com/mmsqe/contracts.git#4da8e1a2417856c2746cd9cf201dc3a122f4a1cf", + "from": "@thirdweb-dev/contracts@git+https://github.com/mmsqe/contracts#fix_suffix_len", + "requires": {} + }, "@trufflesuite/bigint-buffer": { "version": "1.1.9", "resolved": "https://registry.npmjs.org/@trufflesuite/bigint-buffer/-/bigint-buffer-1.1.9.tgz", @@ -10587,6 +10656,40 @@ "integrity": "sha512-mQkU2jY8jJEF7YHjHvsQO8+3ughTL1mcnn96igfhONmR+fUPSKIkefQYpSe8bsly2Ep7oQbn/6VG5/9/0qcArQ==", "peer": true }, + "@uniswap/lib": { + "version": "4.0.1-alpha", + "resolved": "https://registry.npmjs.org/@uniswap/lib/-/lib-4.0.1-alpha.tgz", + "integrity": "sha512-f6UIliwBbRsgVLxIaBANF6w09tYqc6Y/qXdsrbEmXHyFA7ILiKrIwRFXe1yOg8M3cksgVsO9N7yuL2DdCGQKBA==" + }, + "@uniswap/v2-core": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@uniswap/v2-core/-/v2-core-1.0.1.tgz", + "integrity": "sha512-MtybtkUPSyysqLY2U210NBDeCHX+ltHt3oADGdjqoThZaFRDKwM6k1Nb3F0A3hk5hwuQvytFWhrWHOEq6nVJ8Q==" + }, + "@uniswap/v3-core": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@uniswap/v3-core/-/v3-core-1.0.1.tgz", + "integrity": "sha512-7pVk4hEm00j9tc71Y9+ssYpO6ytkeI0y7WE9P6UcmNzhxPePwyAxImuhVsTqWK9YFvzgtvzJHi64pBl4jUzKMQ==" + }, + "@uniswap/v3-periphery": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/@uniswap/v3-periphery/-/v3-periphery-1.4.4.tgz", + "integrity": "sha512-S4+m+wh8HbWSO3DKk4LwUCPZJTpCugIsHrWR86m/OrUyvSqGDTXKFfc2sMuGXCZrD1ZqO3rhQsKgdWg3Hbb2Kw==", + "requires": { + "@openzeppelin/contracts": "3.4.2-solc-0.7", + "@uniswap/lib": "^4.0.1-alpha", + "@uniswap/v2-core": "^1.0.1", + "@uniswap/v3-core": "^1.0.0", + "base64-sol": "1.0.1" + }, + "dependencies": { + "@openzeppelin/contracts": { + "version": "3.4.2-solc-0.7", + "resolved": "https://registry.npmjs.org/@openzeppelin/contracts/-/contracts-3.4.2-solc-0.7.tgz", + "integrity": "sha512-W6QmqgkADuFcTLzHL8vVoNBtkwjvQRpYIAom7KiUNoLKghyx3FgH0GBjt8NRvigV1ZmMOBllvE1By1C+bi8WpA==" + } + } + }, "abstract-level": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/abstract-level/-/abstract-level-1.0.4.tgz", @@ -10895,6 +10998,11 @@ "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==" }, + "base64-sol": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/base64-sol/-/base64-sol-1.0.1.tgz", + "integrity": "sha512-ld3cCNMeXt4uJXmLZBHFGMvVpK9KsLVEhPpFRXnvSVAqABKbuNZg/+dsq3NuM+wxFLb/UrVkz7m1ciWmkMfTbg==" + }, "bcrypt-pbkdf": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", @@ -11942,6 +12050,11 @@ "integrity": "sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw==", "peer": true }, + "forge-std": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/forge-std/-/forge-std-1.1.2.tgz", + "integrity": "sha512-Wfb0iAS9PcfjMKtGpWQw9mXzJxrWD62kJCUqqLcyuI0+VRtJ3j20XembjF3kS20qELYdXft1vD/SPFVWVKMFOw==" + }, "form-data": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", diff --git a/tests/integration_tests/hardhat/package.json b/tests/integration_tests/hardhat/package.json index 9ec406a480..812ee5a47b 100644 --- a/tests/integration_tests/hardhat/package.json +++ b/tests/integration_tests/hardhat/package.json @@ -10,12 +10,15 @@ "author": "", "license": "ISC", "dependencies": { + "@nomiclabs/hardhat-ethers": "^2.2.1", "@nomiclabs/hardhat-waffle": "^2.0.3", "@openzeppelin/contracts": "^4.8.0", - "@nomiclabs/hardhat-ethers": "^2.2.1", - "@openzeppelin/hardhat-upgrades": "^1.21.0", "@openzeppelin/contracts-upgradeable": "^4.3.1", + "@openzeppelin/hardhat-upgrades": "^1.21.0", + "@thirdweb-dev/contracts": "git+https://github.com/mmsqe/contracts#fix_suffix_len", "@typechain/ethers-v5": "^5.0.0", + "@uniswap/v3-periphery": "^1.4.4", + "forge-std": "^1.1.2", "hardhat": "^2.10.1", "hardhat-typechain": "^0.3.5", "ts-generator": "^0.1.1", diff --git a/tests/integration_tests/test_tracers.py b/tests/integration_tests/test_tracers.py index f8f4043e6d..cef3aa5789 100644 --- a/tests/integration_tests/test_tracers.py +++ b/tests/integration_tests/test_tracers.py @@ -3,6 +3,8 @@ from concurrent.futures import ThreadPoolExecutor, as_completed import pytest +from eth_utils import abi, to_checksum_address +from hexbytes import HexBytes from web3 import Web3 from .expected_constants import ( @@ -12,6 +14,7 @@ EXPECTED_DEFAULT_GASCAP, EXPECTED_JS_TRACERS, EXPECTED_STRUCT_TRACER, + EXPECTED_TRACE_INTERNAL_TX, ) from .utils import ( ADDRS, @@ -20,6 +23,7 @@ deploy_contract, derive_new_account, derive_random_account, + get_contract, send_raw_transactions, send_transaction, send_txs, @@ -243,6 +247,189 @@ def wait_balance(): assert "insufficient funds" not in res, res +@pytest.mark.flaky(max_runs=5) +def test_pack(ethermint): + acc0 = derive_new_account(11) # ethm13c2n7geavjfsqcan290mq74kajjlxehyzhly4p + sender = acc0.address + acc1 = derive_new_account(12) # ethm1fxvp52wdkqeznl25ss05l3rt07kqmshl0z3a9x + recipient = acc1.address + print("mm-sender", sender) + print("mm-recipient", recipient) + + w3 = ethermint.w3 + fund_acc(w3, acc0, fund=90000000000000000000) + fund_acc(w3, acc1, fund=90000000000000000000) + + weth, _ = deploy_contract(w3, CONTRACTS["WETH9"], key=acc0.key) + print("mm-weth", weth.address) + + pack, _ = deploy_contract(w3, CONTRACTS["Pack"], (weth.address,), key=acc0.key) + print("mm-pack", pack.address) + + test_pack, _ = deploy_contract(w3, CONTRACTS["TestPack"], key=acc0.key) + print("mm-test_pack", test_pack.address) + + forwarder, _ = deploy_contract(w3, CONTRACTS["Forwarder"], key=acc0.key) + print("mm-forwarder", forwarder.address) + + registry, _ = deploy_contract( + w3, CONTRACTS["TWRegistry"], ([forwarder.address],), key=acc0.key + ) + print("mm-registry", registry.address) + + factory, _ = deploy_contract( + w3, + CONTRACTS["TWFactory"], + ( + [forwarder.address], + registry.address, + ), + key=acc0.key, + ) + print("mm-factory", factory.address) + + role = registry.caller.OPERATOR_ROLE() + tx = registry.functions.grantRole( + role, + factory.address, + ).build_transaction( + { + "from": sender, + } + ) + receipt = send_transaction(w3, tx, acc0.key) + assert receipt.status == 1 + + tx = factory.functions.addImplementation( + pack.address, + ).build_transaction( + { + "from": sender, + } + ) + receipt = send_transaction(w3, tx, acc0.key) + assert receipt.status == 1 + + tx = test_pack.functions.setUp( + forwarder.address, + factory.address, + recipient, + ).build_transaction( + { + "from": sender, + "value": 22000000000000000000, + } + ) + receipt = send_transaction(w3, tx, acc0.key) + assert receipt.status == 1 + + pack = get_contract(w3, get_proxy_addr(receipt.logs), CONTRACTS["Pack"]) + print("mm-pack2", pack.address) + pack_id = 1 + balance = pack.caller.balanceOf(recipient, pack_id) + packs_to_open = 1 + tx = pack.functions.openPack( + pack_id, + packs_to_open, + ).build_transaction( + { + "from": recipient, + } + ) + receipt = send_transaction(w3, tx, acc1.key) + print("mm-receipt", receipt) + assert receipt.status == 1 + assert pack.caller.balanceOf(recipient, pack_id) == balance - packs_to_open + method = "debug_traceTransaction" + tracer = {"tracer": "callTracer"} + tx_hash = receipt["transactionHash"].hex() + res = w3.provider.make_request( + method, + [tx_hash, tracer], + ) + print(tx_hash, res) + + +def get_proxy_addr(logs): + target = HexBytes(abi.event_signature_to_log_topic("ProxyAddress(address)")) + return next( + ( + to_checksum_address("0x" + log.topics[1].hex()[-40:]) + for log in logs + if log.topics[0] == target + ), + None, + ) + + +def test_trace_internal_tx(ethermint): + method = "debug_traceTransaction" + tracer = {"tracer": "callTracer"} + receiver = "0x0F0cb39319129BA867227e5Aae1abe9e7dd5f861" + acc = derive_new_account(12) + w3 = ethermint.w3 + fund_acc(w3, acc, fund=100000000000000000000) + sender = acc.address + erc20, _ = deploy_contract(w3, CONTRACTS["TestERC20A"], key=acc.key) + bonus_token, _ = deploy_contract(w3, CONTRACTS["TestERC20A"], key=acc.key) + token_distributor, _ = deploy_contract( + w3, CONTRACTS["TokenDistributor"], (erc20.address,), key=acc.key + ) + bonus_distributor, _ = deploy_contract( + w3, CONTRACTS["BonusDistributor"], (bonus_token.address,), key=acc.key + ) + bonus_multiplier, _ = deploy_contract( + w3, CONTRACTS["BonusMultiplier"], (bonus_token.address,), key=acc.key + ) + data = {"from": sender} + tx = token_distributor.functions.setBonusDistributor( + bonus_distributor.address + ).build_transaction(data) + receipt = send_transaction(w3, tx, acc.key) + assert receipt.status == 1 + tx = bonus_distributor.functions.setBonusMultiplier( + bonus_multiplier.address + ).build_transaction(data) + receipt = send_transaction(w3, tx, acc.key) + assert receipt.status == 1 + + token_amt = 100 + tx = erc20.functions.transfer( + token_distributor.address, token_amt + ).build_transaction(data) + receipt = send_transaction(w3, tx, acc.key) + assert receipt.status == 1 + tx = bonus_token.functions.transfer( + bonus_multiplier.address, token_amt + ).build_transaction(data) + receipt = send_transaction(w3, tx, acc.key) + assert receipt.status == 1 + balance = w3.eth.get_balance(receiver) + balance_erc20 = erc20.caller.balanceOf(receiver) + balance_bonus = bonus_token.caller.balanceOf(receiver) + amt = 25000000000000000000 + tx = token_distributor.functions.distributeTokens( + [receiver], [token_amt] + ).build_transaction( + { + "from": sender, + "nonce": w3.eth.get_transaction_count(sender), + "gas": 1705533, + "gasPrice": 5001500000000, + "value": amt, + } + ) + receipt = send_transaction(w3, tx, acc.key) + res = w3.provider.make_request( + method, + [receipt["transactionHash"], tracer], + ) + assert res["result"] == EXPECTED_TRACE_INTERNAL_TX + assert w3.eth.get_balance(receiver) == balance + amt + assert erc20.caller.balanceOf(receiver) == balance_erc20 + token_amt + assert bonus_token.caller.balanceOf(receiver) == balance_bonus + token_amt * 0.2 + + def test_tracecall_insufficient_funds(ethermint, geth): method = "debug_traceCall" acc = derive_random_account() diff --git a/tests/integration_tests/utils.py b/tests/integration_tests/utils.py index 9e2f8f55c5..85dedbf161 100644 --- a/tests/integration_tests/utils.py +++ b/tests/integration_tests/utils.py @@ -31,28 +31,42 @@ ADDRS = {name: account.address for name, account in ACCOUNTS.items()} ETHERMINT_ADDRESS_PREFIX = "ethm" TEST_CONTRACTS = { - "TestERC20A": "TestERC20A.sol", - "Greeter": "Greeter.sol", - "BurnGas": "BurnGas.sol", - "TestChainID": "ChainID.sol", - "Mars": "Mars.sol", - "StateContract": "StateContract.sol", - "TestExploitContract": "TestExploitContract.sol", - "TestRevert": "TestRevert.sol", - "TestMessageCall": "TestMessageCall.sol", - "Calculator": "Calculator.sol", - "Caller": "Caller.sol", - "Random": "Random.sol", - "TestBlockTxProperties": "TestBlockTxProperties.sol", - "FeeCollector": "FeeCollector.sol", - "SelfDestruct": "SelfDestruct.sol", + "TestERC20A": "contracts/TestERC20A.sol", + "Greeter": "contracts/Greeter.sol", + "BurnGas": "contracts/BurnGas.sol", + "TestChainID": "contracts/ChainID.sol", + "Mars": "contracts/Mars.sol", + "StateContract": "contracts/StateContract.sol", + "TestExploitContract": "contracts/TestExploitContract.sol", + "TestRevert": "contracts/TestRevert.sol", + "TestMessageCall": "contracts/TestMessageCall.sol", + "Calculator": "contracts/Calculator.sol", + "Caller": "contracts/Caller.sol", + "Random": "contracts/Random.sol", + "TestBlockTxProperties": "contracts/TestBlockTxProperties.sol", + "FeeCollector": "contracts/FeeCollector.sol", + "SelfDestruct": "contracts/SelfDestruct.sol", + "TokenDistributor": "contracts/TokenDistributor.sol", + "BonusDistributor": "contracts/BonusDistributor.sol", + "BonusMultiplier": "contracts/BonusMultiplier.sol", + "TestPack": "contracts/TestPack.sol", + "MockERC20": "contracts/mocks/MockERC20.sol", + "MockERC721": "contracts/mocks/MockERC721.sol", + "MockERC1155": "contracts/mocks/MockERC1155.sol", + "WETH9": "contracts/mocks/WETH9.sol", + "Forwarder": "@thirdweb-dev/contracts/contracts/infra/forwarder/Forwarder.sol", + "TWRegistry": "@thirdweb-dev/contracts/contracts/infra/TWRegistry.sol", + "TWFactory": "@thirdweb-dev/contracts/contracts/infra/TWFactory.sol", + "TWFactory": "@thirdweb-dev/contracts/contracts/infra/TWFactory.sol", + "Pack": "@thirdweb-dev/contracts/contracts/prebuilts/pack/Pack.sol", + "Wallet": "contracts/utils/Wallet.sol", } def contract_path(name, filename): return ( Path(__file__).parent - / "hardhat/artifacts/contracts/" + / "hardhat/artifacts/" / filename / (name + ".json") ) @@ -161,6 +175,14 @@ def deploy_contract(w3, jsonfile, args=(), key=KEYS["validator"]): return send_contract_transaction(w3, jsonfile, tx, key) +def get_contract(w3, address, jsonfile): + """ + get contract from address and abi + """ + info = json.loads(jsonfile.read_text()) + return w3.eth.contract(address=address, abi=info["abi"]) + + def create_contract_transaction(w3, jsonfile, args=(), key=KEYS["validator"]): """ create contract transaction