Skip to content

Instantly share code, notes, and snippets.

@mverzilli
Created August 24, 2022 11:41
Show Gist options
  • Save mverzilli/4dbc8cb9165a1374dc851819e655d090 to your computer and use it in GitHub Desktop.
Save mverzilli/4dbc8cb9165a1374dc851819e655d090 to your computer and use it in GitHub Desktop.
{
"id": "f46b40d4bd8359107c27982f890faa9b",
"_format": "hh-sol-build-info-1",
"solcVersion": "0.8.2",
"solcLongVersion": "0.8.2+commit.661d1103",
"input": {
"language": "Solidity",
"sources": {
"contracts/WithRevert.sol": {
"content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ncontract WithRevert {\n uint256 public value;\n constructor(uint256 initialValue) {\n require(initialValue > 0, \"initial value must be positive\");\n value = initialValue;\n }\n\n function greet() public returns(uint256) {\n return value;\n }\n}\n"
}
},
"settings": {
"optimizer": {
"enabled": false,
"runs": 200
},
"outputSelection": {
"*": {
"*": [
"abi",
"evm.bytecode",
"evm.deployedBytecode",
"evm.methodIdentifiers"
],
"": [
"ast"
]
}
}
}
},
"output": {
"contracts": {
"contracts/WithRevert.sol": {
"WithRevert": {
"abi": [
{
"inputs": [
{
"internalType": "uint256",
"name": "initialValue",
"type": "uint256"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"inputs": [],
"name": "greet",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "value",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
}
],
"evm": {
"bytecode": {
"generatedSources": [
{
"ast": {
"nodeType": "YulBlock",
"src": "0:1812:1",
"statements": [
{
"body": {
"nodeType": "YulBlock",
"src": "70:80:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "80:22:1",
"value": {
"arguments": [
{
"name": "offset",
"nodeType": "YulIdentifier",
"src": "95:6:1"
}
],
"functionName": {
"name": "mload",
"nodeType": "YulIdentifier",
"src": "89:5:1"
},
"nodeType": "YulFunctionCall",
"src": "89:13:1"
},
"variableNames": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "80:5:1"
}
]
},
{
"expression": {
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "138:5:1"
}
],
"functionName": {
"name": "validator_revert_t_uint256",
"nodeType": "YulIdentifier",
"src": "111:26:1"
},
"nodeType": "YulFunctionCall",
"src": "111:33:1"
},
"nodeType": "YulExpressionStatement",
"src": "111:33:1"
}
]
},
"name": "abi_decode_t_uint256_fromMemory",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "offset",
"nodeType": "YulTypedName",
"src": "48:6:1",
"type": ""
},
{
"name": "end",
"nodeType": "YulTypedName",
"src": "56:3:1",
"type": ""
}
],
"returnVariables": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "64:5:1",
"type": ""
}
],
"src": "7:143:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "233:207:1",
"statements": [
{
"body": {
"nodeType": "YulBlock",
"src": "279:16:1",
"statements": [
{
"expression": {
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "288:1:1",
"type": "",
"value": "0"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "291:1:1",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "revert",
"nodeType": "YulIdentifier",
"src": "281:6:1"
},
"nodeType": "YulFunctionCall",
"src": "281:12:1"
},
"nodeType": "YulExpressionStatement",
"src": "281:12:1"
}
]
},
"condition": {
"arguments": [
{
"arguments": [
{
"name": "dataEnd",
"nodeType": "YulIdentifier",
"src": "254:7:1"
},
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "263:9:1"
}
],
"functionName": {
"name": "sub",
"nodeType": "YulIdentifier",
"src": "250:3:1"
},
"nodeType": "YulFunctionCall",
"src": "250:23:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "275:2:1",
"type": "",
"value": "32"
}
],
"functionName": {
"name": "slt",
"nodeType": "YulIdentifier",
"src": "246:3:1"
},
"nodeType": "YulFunctionCall",
"src": "246:32:1"
},
"nodeType": "YulIf",
"src": "243:2:1"
},
{
"nodeType": "YulBlock",
"src": "305:128:1",
"statements": [
{
"nodeType": "YulVariableDeclaration",
"src": "320:15:1",
"value": {
"kind": "number",
"nodeType": "YulLiteral",
"src": "334:1:1",
"type": "",
"value": "0"
},
"variables": [
{
"name": "offset",
"nodeType": "YulTypedName",
"src": "324:6:1",
"type": ""
}
]
},
{
"nodeType": "YulAssignment",
"src": "349:74:1",
"value": {
"arguments": [
{
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "395:9:1"
},
{
"name": "offset",
"nodeType": "YulIdentifier",
"src": "406:6:1"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "391:3:1"
},
"nodeType": "YulFunctionCall",
"src": "391:22:1"
},
{
"name": "dataEnd",
"nodeType": "YulIdentifier",
"src": "415:7:1"
}
],
"functionName": {
"name": "abi_decode_t_uint256_fromMemory",
"nodeType": "YulIdentifier",
"src": "359:31:1"
},
"nodeType": "YulFunctionCall",
"src": "359:64:1"
},
"variableNames": [
{
"name": "value0",
"nodeType": "YulIdentifier",
"src": "349:6:1"
}
]
}
]
}
]
},
"name": "abi_decode_tuple_t_uint256_fromMemory",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "headStart",
"nodeType": "YulTypedName",
"src": "203:9:1",
"type": ""
},
{
"name": "dataEnd",
"nodeType": "YulTypedName",
"src": "214:7:1",
"type": ""
}
],
"returnVariables": [
{
"name": "value0",
"nodeType": "YulTypedName",
"src": "226:6:1",
"type": ""
}
],
"src": "156:284:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "592:220:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "602:74:1",
"value": {
"arguments": [
{
"name": "pos",
"nodeType": "YulIdentifier",
"src": "668:3:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "673:2:1",
"type": "",
"value": "30"
}
],
"functionName": {
"name": "array_storeLengthForEncoding_t_string_memory_ptr_fromStack",
"nodeType": "YulIdentifier",
"src": "609:58:1"
},
"nodeType": "YulFunctionCall",
"src": "609:67:1"
},
"variableNames": [
{
"name": "pos",
"nodeType": "YulIdentifier",
"src": "602:3:1"
}
]
},
{
"expression": {
"arguments": [
{
"name": "pos",
"nodeType": "YulIdentifier",
"src": "774:3:1"
}
],
"functionName": {
"name": "store_literal_in_memory_3d7c41d6c8865cb65461f42d9163483a355c37658f2fbd90d39f5ba85a479a7b",
"nodeType": "YulIdentifier",
"src": "685:88:1"
},
"nodeType": "YulFunctionCall",
"src": "685:93:1"
},
"nodeType": "YulExpressionStatement",
"src": "685:93:1"
},
{
"nodeType": "YulAssignment",
"src": "787:19:1",
"value": {
"arguments": [
{
"name": "pos",
"nodeType": "YulIdentifier",
"src": "798:3:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "803:2:1",
"type": "",
"value": "32"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "794:3:1"
},
"nodeType": "YulFunctionCall",
"src": "794:12:1"
},
"variableNames": [
{
"name": "end",
"nodeType": "YulIdentifier",
"src": "787:3:1"
}
]
}
]
},
"name": "abi_encode_t_stringliteral_3d7c41d6c8865cb65461f42d9163483a355c37658f2fbd90d39f5ba85a479a7b_to_t_string_memory_ptr_fromStack",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "pos",
"nodeType": "YulTypedName",
"src": "580:3:1",
"type": ""
}
],
"returnVariables": [
{
"name": "end",
"nodeType": "YulTypedName",
"src": "588:3:1",
"type": ""
}
],
"src": "446:366:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "989:248:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "999:26:1",
"value": {
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "1011:9:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "1022:2:1",
"type": "",
"value": "32"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "1007:3:1"
},
"nodeType": "YulFunctionCall",
"src": "1007:18:1"
},
"variableNames": [
{
"name": "tail",
"nodeType": "YulIdentifier",
"src": "999:4:1"
}
]
},
{
"expression": {
"arguments": [
{
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "1046:9:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "1057:1:1",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "1042:3:1"
},
"nodeType": "YulFunctionCall",
"src": "1042:17:1"
},
{
"arguments": [
{
"name": "tail",
"nodeType": "YulIdentifier",
"src": "1065:4:1"
},
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "1071:9:1"
}
],
"functionName": {
"name": "sub",
"nodeType": "YulIdentifier",
"src": "1061:3:1"
},
"nodeType": "YulFunctionCall",
"src": "1061:20:1"
}
],
"functionName": {
"name": "mstore",
"nodeType": "YulIdentifier",
"src": "1035:6:1"
},
"nodeType": "YulFunctionCall",
"src": "1035:47:1"
},
"nodeType": "YulExpressionStatement",
"src": "1035:47:1"
},
{
"nodeType": "YulAssignment",
"src": "1091:139:1",
"value": {
"arguments": [
{
"name": "tail",
"nodeType": "YulIdentifier",
"src": "1225:4:1"
}
],
"functionName": {
"name": "abi_encode_t_stringliteral_3d7c41d6c8865cb65461f42d9163483a355c37658f2fbd90d39f5ba85a479a7b_to_t_string_memory_ptr_fromStack",
"nodeType": "YulIdentifier",
"src": "1099:124:1"
},
"nodeType": "YulFunctionCall",
"src": "1099:131:1"
},
"variableNames": [
{
"name": "tail",
"nodeType": "YulIdentifier",
"src": "1091:4:1"
}
]
}
]
},
"name": "abi_encode_tuple_t_stringliteral_3d7c41d6c8865cb65461f42d9163483a355c37658f2fbd90d39f5ba85a479a7b__to_t_string_memory_ptr__fromStack_reversed",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "headStart",
"nodeType": "YulTypedName",
"src": "969:9:1",
"type": ""
}
],
"returnVariables": [
{
"name": "tail",
"nodeType": "YulTypedName",
"src": "984:4:1",
"type": ""
}
],
"src": "818:419:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "1339:73:1",
"statements": [
{
"expression": {
"arguments": [
{
"name": "pos",
"nodeType": "YulIdentifier",
"src": "1356:3:1"
},
{
"name": "length",
"nodeType": "YulIdentifier",
"src": "1361:6:1"
}
],
"functionName": {
"name": "mstore",
"nodeType": "YulIdentifier",
"src": "1349:6:1"
},
"nodeType": "YulFunctionCall",
"src": "1349:19:1"
},
"nodeType": "YulExpressionStatement",
"src": "1349:19:1"
},
{
"nodeType": "YulAssignment",
"src": "1377:29:1",
"value": {
"arguments": [
{
"name": "pos",
"nodeType": "YulIdentifier",
"src": "1396:3:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "1401:4:1",
"type": "",
"value": "0x20"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "1392:3:1"
},
"nodeType": "YulFunctionCall",
"src": "1392:14:1"
},
"variableNames": [
{
"name": "updated_pos",
"nodeType": "YulIdentifier",
"src": "1377:11:1"
}
]
}
]
},
"name": "array_storeLengthForEncoding_t_string_memory_ptr_fromStack",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "pos",
"nodeType": "YulTypedName",
"src": "1311:3:1",
"type": ""
},
{
"name": "length",
"nodeType": "YulTypedName",
"src": "1316:6:1",
"type": ""
}
],
"returnVariables": [
{
"name": "updated_pos",
"nodeType": "YulTypedName",
"src": "1327:11:1",
"type": ""
}
],
"src": "1243:169:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "1463:32:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "1473:16:1",
"value": {
"name": "value",
"nodeType": "YulIdentifier",
"src": "1484:5:1"
},
"variableNames": [
{
"name": "cleaned",
"nodeType": "YulIdentifier",
"src": "1473:7:1"
}
]
}
]
},
"name": "cleanup_t_uint256",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "1445:5:1",
"type": ""
}
],
"returnVariables": [
{
"name": "cleaned",
"nodeType": "YulTypedName",
"src": "1455:7:1",
"type": ""
}
],
"src": "1418:77:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "1607:74:1",
"statements": [
{
"expression": {
"arguments": [
{
"arguments": [
{
"name": "memPtr",
"nodeType": "YulIdentifier",
"src": "1629:6:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "1637:1:1",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "1625:3:1"
},
"nodeType": "YulFunctionCall",
"src": "1625:14:1"
},
{
"kind": "string",
"nodeType": "YulLiteral",
"src": "1641:32:1",
"type": "",
"value": "initial value must be positive"
}
],
"functionName": {
"name": "mstore",
"nodeType": "YulIdentifier",
"src": "1618:6:1"
},
"nodeType": "YulFunctionCall",
"src": "1618:56:1"
},
"nodeType": "YulExpressionStatement",
"src": "1618:56:1"
}
]
},
"name": "store_literal_in_memory_3d7c41d6c8865cb65461f42d9163483a355c37658f2fbd90d39f5ba85a479a7b",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "memPtr",
"nodeType": "YulTypedName",
"src": "1599:6:1",
"type": ""
}
],
"src": "1501:180:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "1730:79:1",
"statements": [
{
"body": {
"nodeType": "YulBlock",
"src": "1787:16:1",
"statements": [
{
"expression": {
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "1796:1:1",
"type": "",
"value": "0"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "1799:1:1",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "revert",
"nodeType": "YulIdentifier",
"src": "1789:6:1"
},
"nodeType": "YulFunctionCall",
"src": "1789:12:1"
},
"nodeType": "YulExpressionStatement",
"src": "1789:12:1"
}
]
},
"condition": {
"arguments": [
{
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "1753:5:1"
},
{
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "1778:5:1"
}
],
"functionName": {
"name": "cleanup_t_uint256",
"nodeType": "YulIdentifier",
"src": "1760:17:1"
},
"nodeType": "YulFunctionCall",
"src": "1760:24:1"
}
],
"functionName": {
"name": "eq",
"nodeType": "YulIdentifier",
"src": "1750:2:1"
},
"nodeType": "YulFunctionCall",
"src": "1750:35:1"
}
],
"functionName": {
"name": "iszero",
"nodeType": "YulIdentifier",
"src": "1743:6:1"
},
"nodeType": "YulFunctionCall",
"src": "1743:43:1"
},
"nodeType": "YulIf",
"src": "1740:2:1"
}
]
},
"name": "validator_revert_t_uint256",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "1723:5:1",
"type": ""
}
],
"src": "1687:122:1"
}
]
},
"contents": "{\n\n function abi_decode_t_uint256_fromMemory(offset, end) -> value {\n value := mload(offset)\n validator_revert_t_uint256(value)\n }\n\n function abi_decode_tuple_t_uint256_fromMemory(headStart, dataEnd) -> value0 {\n if slt(sub(dataEnd, headStart), 32) { revert(0, 0) }\n\n {\n\n let offset := 0\n\n value0 := abi_decode_t_uint256_fromMemory(add(headStart, offset), dataEnd)\n }\n\n }\n\n function abi_encode_t_stringliteral_3d7c41d6c8865cb65461f42d9163483a355c37658f2fbd90d39f5ba85a479a7b_to_t_string_memory_ptr_fromStack(pos) -> end {\n pos := array_storeLengthForEncoding_t_string_memory_ptr_fromStack(pos, 30)\n store_literal_in_memory_3d7c41d6c8865cb65461f42d9163483a355c37658f2fbd90d39f5ba85a479a7b(pos)\n end := add(pos, 32)\n }\n\n function abi_encode_tuple_t_stringliteral_3d7c41d6c8865cb65461f42d9163483a355c37658f2fbd90d39f5ba85a479a7b__to_t_string_memory_ptr__fromStack_reversed(headStart ) -> tail {\n tail := add(headStart, 32)\n\n mstore(add(headStart, 0), sub(tail, headStart))\n tail := abi_encode_t_stringliteral_3d7c41d6c8865cb65461f42d9163483a355c37658f2fbd90d39f5ba85a479a7b_to_t_string_memory_ptr_fromStack( tail)\n\n }\n\n function array_storeLengthForEncoding_t_string_memory_ptr_fromStack(pos, length) -> updated_pos {\n mstore(pos, length)\n updated_pos := add(pos, 0x20)\n }\n\n function cleanup_t_uint256(value) -> cleaned {\n cleaned := value\n }\n\n function store_literal_in_memory_3d7c41d6c8865cb65461f42d9163483a355c37658f2fbd90d39f5ba85a479a7b(memPtr) {\n\n mstore(add(memPtr, 0), \"initial value must be positive\")\n\n }\n\n function validator_revert_t_uint256(value) {\n if iszero(eq(value, cleanup_t_uint256(value))) { revert(0, 0) }\n }\n\n}\n",
"id": 1,
"language": "Yul",
"name": "#utility.yul"
}
],
"linkReferences": {},
"object": "608060405234801561001057600080fd5b5060405161024c38038061024c83398181016040528101906100329190610097565b60008111610075576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161006c906100e3565b60405180910390fd5b806000819055505061015e565b60008151905061009181610147565b92915050565b6000602082840312156100a957600080fd5b60006100b784828501610082565b91505092915050565b60006100cd601e83610103565b91506100d88261011e565b602082019050919050565b600060208201905081810360008301526100fc816100c0565b9050919050565b600082825260208201905092915050565b6000819050919050565b7f696e697469616c2076616c7565206d75737420626520706f7369746976650000600082015250565b61015081610114565b811461015b57600080fd5b50565b60e08061016c6000396000f3fe6080604052348015600f57600080fd5b506004361060325760003560e01c80633fa4f245146037578063cfae3217146051575b600080fd5b603d606b565b604051604891906087565b60405180910390f35b60576071565b604051606291906087565b60405180910390f35b60005481565b60008054905090565b60818160a0565b82525050565b6000602082019050609a6000830184607a565b92915050565b600081905091905056fea26469706673582212208034bcac67fa5ab3a29cef8be46cd0b4c6bb90accd347e506fa9f379a00862d364736f6c63430008020033",
"opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 MLOAD PUSH2 0x24C CODESIZE SUB DUP1 PUSH2 0x24C DUP4 CODECOPY DUP2 DUP2 ADD PUSH1 0x40 MSTORE DUP2 ADD SWAP1 PUSH2 0x32 SWAP2 SWAP1 PUSH2 0x97 JUMP JUMPDEST PUSH1 0x0 DUP2 GT PUSH2 0x75 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C SWAP1 PUSH2 0xE3 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST DUP1 PUSH1 0x0 DUP2 SWAP1 SSTORE POP POP PUSH2 0x15E JUMP JUMPDEST PUSH1 0x0 DUP2 MLOAD SWAP1 POP PUSH2 0x91 DUP2 PUSH2 0x147 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0xA9 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0xB7 DUP5 DUP3 DUP6 ADD PUSH2 0x82 JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0xCD PUSH1 0x1E DUP4 PUSH2 0x103 JUMP JUMPDEST SWAP2 POP PUSH2 0xD8 DUP3 PUSH2 0x11E JUMP JUMPDEST PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0xFC DUP2 PUSH2 0xC0 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 MSTORE PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x696E697469616C2076616C7565206D75737420626520706F7369746976650000 PUSH1 0x0 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH2 0x150 DUP2 PUSH2 0x114 JUMP JUMPDEST DUP2 EQ PUSH2 0x15B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP JUMP JUMPDEST PUSH1 0xE0 DUP1 PUSH2 0x16C PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN INVALID PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH1 0xF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x4 CALLDATASIZE LT PUSH1 0x32 JUMPI PUSH1 0x0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x3FA4F245 EQ PUSH1 0x37 JUMPI DUP1 PUSH4 0xCFAE3217 EQ PUSH1 0x51 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x3D PUSH1 0x6B JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH1 0x48 SWAP2 SWAP1 PUSH1 0x87 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH1 0x57 PUSH1 0x71 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH1 0x62 SWAP2 SWAP1 PUSH1 0x87 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH1 0x0 SLOAD DUP2 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x81 DUP2 PUSH1 0xA0 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP PUSH1 0x9A PUSH1 0x0 DUP4 ADD DUP5 PUSH1 0x7A JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 SWAP1 POP SWAP2 SWAP1 POP JUMP INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 DUP1 CALLVALUE 0xBC 0xAC PUSH8 0xFA5AB3A29CEF8BE4 PUSH13 0xD0B4C6BB90ACCD347E506FA9F3 PUSH26 0xA00862D364736F6C634300080200330000000000000000000000 ",
"sourceMap": "56:270:0:-:0;;;108:140;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;175:1;160:12;:16;152:59;;;;;;;;;;;;:::i;:::-;;;;;;;;;229:12;221:5;:20;;;;108:140;56:270;;7:143:1;;95:6;89:13;80:22;;111:33;138:5;111:33;:::i;:::-;70:80;;;;:::o;156:284::-;;275:2;263:9;254:7;250:23;246:32;243:2;;;291:1;288;281:12;243:2;334:1;359:64;415:7;406:6;395:9;391:22;359:64;:::i;:::-;349:74;;305:128;233:207;;;;:::o;446:366::-;;609:67;673:2;668:3;609:67;:::i;:::-;602:74;;685:93;774:3;685:93;:::i;:::-;803:2;798:3;794:12;787:19;;592:220;;;:::o;818:419::-;;1022:2;1011:9;1007:18;999:26;;1071:9;1065:4;1061:20;1057:1;1046:9;1042:17;1035:47;1099:131;1225:4;1099:131;:::i;:::-;1091:139;;989:248;;;:::o;1243:169::-;;1361:6;1356:3;1349:19;1401:4;1396:3;1392:14;1377:29;;1339:73;;;;:::o;1418:77::-;;1484:5;1473:16;;1463:32;;;:::o;1501:180::-;1641:32;1637:1;1629:6;1625:14;1618:56;1607:74;:::o;1687:122::-;1760:24;1778:5;1760:24;:::i;:::-;1753:5;1750:35;1740:2;;1799:1;1796;1789:12;1740:2;1730:79;:::o;56:270:0:-;;;;;;;"
},
"deployedBytecode": {
"generatedSources": [
{
"ast": {
"nodeType": "YulBlock",
"src": "0:439:1",
"statements": [
{
"body": {
"nodeType": "YulBlock",
"src": "72:53:1",
"statements": [
{
"expression": {
"arguments": [
{
"name": "pos",
"nodeType": "YulIdentifier",
"src": "89:3:1"
},
{
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "112:5:1"
}
],
"functionName": {
"name": "cleanup_t_uint256",
"nodeType": "YulIdentifier",
"src": "94:17:1"
},
"nodeType": "YulFunctionCall",
"src": "94:24:1"
}
],
"functionName": {
"name": "mstore",
"nodeType": "YulIdentifier",
"src": "82:6:1"
},
"nodeType": "YulFunctionCall",
"src": "82:37:1"
},
"nodeType": "YulExpressionStatement",
"src": "82:37:1"
}
]
},
"name": "abi_encode_t_uint256_to_t_uint256_fromStack",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "60:5:1",
"type": ""
},
{
"name": "pos",
"nodeType": "YulTypedName",
"src": "67:3:1",
"type": ""
}
],
"src": "7:118:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "229:124:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "239:26:1",
"value": {
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "251:9:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "262:2:1",
"type": "",
"value": "32"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "247:3:1"
},
"nodeType": "YulFunctionCall",
"src": "247:18:1"
},
"variableNames": [
{
"name": "tail",
"nodeType": "YulIdentifier",
"src": "239:4:1"
}
]
},
{
"expression": {
"arguments": [
{
"name": "value0",
"nodeType": "YulIdentifier",
"src": "319:6:1"
},
{
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "332:9:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "343:1:1",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "328:3:1"
},
"nodeType": "YulFunctionCall",
"src": "328:17:1"
}
],
"functionName": {
"name": "abi_encode_t_uint256_to_t_uint256_fromStack",
"nodeType": "YulIdentifier",
"src": "275:43:1"
},
"nodeType": "YulFunctionCall",
"src": "275:71:1"
},
"nodeType": "YulExpressionStatement",
"src": "275:71:1"
}
]
},
"name": "abi_encode_tuple_t_uint256__to_t_uint256__fromStack_reversed",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "headStart",
"nodeType": "YulTypedName",
"src": "201:9:1",
"type": ""
},
{
"name": "value0",
"nodeType": "YulTypedName",
"src": "213:6:1",
"type": ""
}
],
"returnVariables": [
{
"name": "tail",
"nodeType": "YulTypedName",
"src": "224:4:1",
"type": ""
}
],
"src": "131:222:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "404:32:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "414:16:1",
"value": {
"name": "value",
"nodeType": "YulIdentifier",
"src": "425:5:1"
},
"variableNames": [
{
"name": "cleaned",
"nodeType": "YulIdentifier",
"src": "414:7:1"
}
]
}
]
},
"name": "cleanup_t_uint256",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "386:5:1",
"type": ""
}
],
"returnVariables": [
{
"name": "cleaned",
"nodeType": "YulTypedName",
"src": "396:7:1",
"type": ""
}
],
"src": "359:77:1"
}
]
},
"contents": "{\n\n function abi_encode_t_uint256_to_t_uint256_fromStack(value, pos) {\n mstore(pos, cleanup_t_uint256(value))\n }\n\n function abi_encode_tuple_t_uint256__to_t_uint256__fromStack_reversed(headStart , value0) -> tail {\n tail := add(headStart, 32)\n\n abi_encode_t_uint256_to_t_uint256_fromStack(value0, add(headStart, 0))\n\n }\n\n function cleanup_t_uint256(value) -> cleaned {\n cleaned := value\n }\n\n}\n",
"id": 1,
"language": "Yul",
"name": "#utility.yul"
}
],
"immutableReferences": {},
"linkReferences": {},
"object": "6080604052348015600f57600080fd5b506004361060325760003560e01c80633fa4f245146037578063cfae3217146051575b600080fd5b603d606b565b604051604891906087565b60405180910390f35b60576071565b604051606291906087565b60405180910390f35b60005481565b60008054905090565b60818160a0565b82525050565b6000602082019050609a6000830184607a565b92915050565b600081905091905056fea26469706673582212208034bcac67fa5ab3a29cef8be46cd0b4c6bb90accd347e506fa9f379a00862d364736f6c63430008020033",
"opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH1 0xF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x4 CALLDATASIZE LT PUSH1 0x32 JUMPI PUSH1 0x0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x3FA4F245 EQ PUSH1 0x37 JUMPI DUP1 PUSH4 0xCFAE3217 EQ PUSH1 0x51 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x3D PUSH1 0x6B JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH1 0x48 SWAP2 SWAP1 PUSH1 0x87 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH1 0x57 PUSH1 0x71 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH1 0x62 SWAP2 SWAP1 PUSH1 0x87 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH1 0x0 SLOAD DUP2 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x81 DUP2 PUSH1 0xA0 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP PUSH1 0x9A PUSH1 0x0 DUP4 ADD DUP5 PUSH1 0x7A JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 SWAP1 POP SWAP2 SWAP1 POP JUMP INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 DUP1 CALLVALUE 0xBC 0xAC PUSH8 0xFA5AB3A29CEF8BE4 PUSH13 0xD0B4C6BB90ACCD347E506FA9F3 PUSH26 0xA00862D364736F6C634300080200330000000000000000000000 ",
"sourceMap": "56:270:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;82:20;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;254:70;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;82:20;;;;:::o;254:70::-;286:7;312:5;;305:12;;254:70;:::o;7:118:1:-;94:24;112:5;94:24;:::i;:::-;89:3;82:37;72:53;;:::o;131:222::-;;262:2;251:9;247:18;239:26;;275:71;343:1;332:9;328:17;319:6;275:71;:::i;:::-;229:124;;;;:::o;359:77::-;;425:5;414:16;;404:32;;;:::o"
},
"methodIdentifiers": {
"greet()": "cfae3217",
"value()": "3fa4f245"
}
}
}
}
},
"errors": [
{
"component": "general",
"errorCode": "2018",
"formattedMessage": "Warning: Function state mutability can be restricted to view\n --> contracts/WithRevert.sol:11:5:\n |\n11 | function greet() public returns(uint256) {\n | ^ (Relevant source part starts here and spans across multiple lines).\n\n",
"message": "Function state mutability can be restricted to view",
"severity": "warning",
"sourceLocation": {
"end": 324,
"file": "contracts/WithRevert.sol",
"start": 254
},
"type": "Warning"
}
],
"sources": {
"contracts/WithRevert.sol": {
"ast": {
"absolutePath": "contracts/WithRevert.sol",
"exportedSymbols": {
"WithRevert": [
29
]
},
"id": 30,
"license": "MIT",
"nodeType": "SourceUnit",
"nodes": [
{
"id": 1,
"literals": [
"solidity",
"^",
"0.8",
".0"
],
"nodeType": "PragmaDirective",
"src": "31:23:0"
},
{
"abstract": false,
"baseContracts": [],
"contractDependencies": [],
"contractKind": "contract",
"fullyImplemented": true,
"id": 29,
"linearizedBaseContracts": [
29
],
"name": "WithRevert",
"nameLocation": "65:10:0",
"nodeType": "ContractDefinition",
"nodes": [
{
"constant": false,
"functionSelector": "3fa4f245",
"id": 3,
"mutability": "mutable",
"name": "value",
"nameLocation": "97:5:0",
"nodeType": "VariableDeclaration",
"scope": 29,
"src": "82:20:0",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 2,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "82:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "public"
},
{
"body": {
"id": 19,
"nodeType": "Block",
"src": "142:106:0",
"statements": [
{
"expression": {
"arguments": [
{
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 11,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"id": 9,
"name": "initialValue",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 5,
"src": "160:12:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": ">",
"rightExpression": {
"hexValue": "30",
"id": 10,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "175:1:0",
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"src": "160:16:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"hexValue": "696e697469616c2076616c7565206d75737420626520706f736974697665",
"id": 12,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "178:32:0",
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_3d7c41d6c8865cb65461f42d9163483a355c37658f2fbd90d39f5ba85a479a7b",
"typeString": "literal_string \"initial value must be positive\""
},
"value": "initial value must be positive"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_3d7c41d6c8865cb65461f42d9163483a355c37658f2fbd90d39f5ba85a479a7b",
"typeString": "literal_string \"initial value must be positive\""
}
],
"id": 8,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
-18,
-18
],
"referencedDeclaration": -18,
"src": "152:7:0",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 13,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "152:59:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 14,
"nodeType": "ExpressionStatement",
"src": "152:59:0"
},
{
"expression": {
"id": 17,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"id": 15,
"name": "value",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3,
"src": "221:5:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"id": 16,
"name": "initialValue",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 5,
"src": "229:12:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "221:20:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 18,
"nodeType": "ExpressionStatement",
"src": "221:20:0"
}
]
},
"id": 20,
"implemented": true,
"kind": "constructor",
"modifiers": [],
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 6,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 5,
"mutability": "mutable",
"name": "initialValue",
"nameLocation": "128:12:0",
"nodeType": "VariableDeclaration",
"scope": 20,
"src": "120:20:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "120:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "119:22:0"
},
"returnParameters": {
"id": 7,
"nodeType": "ParameterList",
"parameters": [],
"src": "142:0:0"
},
"scope": 29,
"src": "108:140:0",
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "public"
},
{
"body": {
"id": 27,
"nodeType": "Block",
"src": "295:29:0",
"statements": [
{
"expression": {
"id": 25,
"name": "value",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3,
"src": "312:5:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"functionReturnParameters": 24,
"id": 26,
"nodeType": "Return",
"src": "305:12:0"
}
]
},
"functionSelector": "cfae3217",
"id": 28,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "greet",
"nameLocation": "263:5:0",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 21,
"nodeType": "ParameterList",
"parameters": [],
"src": "268:2:0"
},
"returnParameters": {
"id": 24,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 23,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"scope": 28,
"src": "286:7:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 22,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "286:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "285:9:0"
},
"scope": 29,
"src": "254:70:0",
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "public"
}
],
"scope": 30,
"src": "56:270:0"
}
],
"src": "31:296:0"
},
"id": 0
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment