Skip to content

Instantly share code, notes, and snippets.

@loadchange
Created January 25, 2023 02:06
Show Gist options
  • Save loadchange/6121444974a48eb16b85eb3be065e09f to your computer and use it in GitHub Desktop.
Save loadchange/6121444974a48eb16b85eb3be065e09f to your computer and use it in GitHub Desktop.
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
{
"overrides": [
{
"files": "*.sol",
"options": {
"printWidth": 80,
"tabWidth": 4,
"useTabs": false,
"singleQuote": false,
"bracketSpacing": false
}
},
{
"files": "*.yml",
"options": {}
},
{
"files": "*.yaml",
"options": {}
},
{
"files": "*.toml",
"options": {}
},
{
"files": "*.json",
"options": {}
},
{
"files": "*.js",
"options": {}
},
{
"files": "*.ts",
"options": {}
}
]
}
REMIX DEFAULT WORKSPACE
Remix default workspace is present when:
i. Remix loads for the very first time
ii. A new workspace is created with 'Default' template
iii. There are no files existing in the File Explorer
This workspace contains 3 directories:
1. 'contracts': Holds three contracts with increasing levels of complexity.
2. 'scripts': Contains four typescript files to deploy a contract. It is explained below.
3. 'tests': Contains one Solidity test file for 'Ballot' contract & one JS test file for 'Storage' contract.
SCRIPTS
The 'scripts' folder has four typescript files which help to deploy the 'Storage' contract using 'web3.js' and 'ethers.js' libraries.
For the deployment of any other contract, just update the contract's name from 'Storage' to the desired contract and provide constructor arguments accordingly
in the file `deploy_with_ethers.ts` or `deploy_with_web3.ts`
In the 'tests' folder there is a script containing Mocha-Chai unit tests for 'Storage' contract.
To run a script, right click on file name in the file explorer and click 'Run'. Remember, Solidity file must already be compiled.
Output from script will appear in remix terminal.
Please note, require/import is supported in a limited manner for Remix supported modules.
For now, modules supported by Remix are ethers, web3, swarmgw, chai, multihashes, remix and hardhat only for hardhat.ethers object/plugin.
For unsupported modules, an error like this will be thrown: '<module_name> module require is not supported by Remix IDE' will be shown.
{
"id": "2b84239362afef0dfa7c738262f803e9",
"_format": "hh-sol-build-info-1",
"solcVersion": "0.8.7",
"solcLongVersion": "0.8.7+commit.e28d00a7",
"input": {
"language": "Solidity",
"sources": {
"contracts/01.Solidity-8.0新特性/TestHelper.sol": {
"content": "// SPDX-License-Identifier: MIT\r\npragma solidity ^0.8;\r\n\r\n// functions outside contract\r\n\r\nfunction helper(uint x) view returns (uint) {\r\n return x * 2;\r\n}\r\n\r\ncontract TestHelper {\r\n function test() external view returns (uint) {\r\n return helper(123);\r\n }\r\n}"
}
},
"settings": {
"optimizer": {
"enabled": false,
"runs": 200
},
"outputSelection": {
"*": {
"": [
"ast"
],
"*": [
"abi",
"metadata",
"devdoc",
"userdoc",
"storageLayout",
"evm.legacyAssembly",
"evm.bytecode",
"evm.deployedBytecode",
"evm.methodIdentifiers",
"evm.gasEstimates",
"evm.assembly"
]
}
}
}
},
"output": {
"contracts": {
"contracts/01.Solidity-8.0新特性/TestHelper.sol": {
"TestHelper": {
"abi": [
{
"inputs": [],
"name": "test",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
}
],
"devdoc": {
"kind": "dev",
"methods": {},
"version": 1
},
"evm": {
"assembly": " /* \"contracts/01.Solidity-8.0\\xe6\\x96\\xb0\\xe7\\x89\\xb9\\xe6\\x80\\xa7/TestHelper.sol\":162:274 contract TestHelper {\r... */\n mstore(0x40, 0x80)\n callvalue\n dup1\n iszero\n tag_1\n jumpi\n 0x00\n dup1\n revert\ntag_1:\n pop\n dataSize(sub_0)\n dup1\n dataOffset(sub_0)\n 0x00\n codecopy\n 0x00\n return\nstop\n\nsub_0: assembly {\n /* \"contracts/01.Solidity-8.0\\xe6\\x96\\xb0\\xe7\\x89\\xb9\\xe6\\x80\\xa7/TestHelper.sol\":162:274 contract TestHelper {\r... */\n mstore(0x40, 0x80)\n callvalue\n dup1\n iszero\n tag_1\n jumpi\n 0x00\n dup1\n revert\n tag_1:\n pop\n jumpi(tag_2, lt(calldatasize, 0x04))\n shr(0xe0, calldataload(0x00))\n dup1\n 0xf8a8fd6d\n eq\n tag_3\n jumpi\n tag_2:\n 0x00\n dup1\n revert\n /* \"contracts/01.Solidity-8.0\\xe6\\x96\\xb0\\xe7\\x89\\xb9\\xe6\\x80\\xa7/TestHelper.sol\":189:271 function test() external view returns (uint) {\r... */\n tag_3:\n tag_4\n tag_5\n jump\t// in\n tag_4:\n mload(0x40)\n tag_6\n swap2\n swap1\n tag_7\n jump\t// in\n tag_6:\n mload(0x40)\n dup1\n swap2\n sub\n swap1\n return\n tag_5:\n /* \"contracts/01.Solidity-8.0\\xe6\\x96\\xb0\\xe7\\x89\\xb9\\xe6\\x80\\xa7/TestHelper.sol\":228:232 uint */\n 0x00\n /* \"contracts/01.Solidity-8.0\\xe6\\x96\\xb0\\xe7\\x89\\xb9\\xe6\\x80\\xa7/TestHelper.sol\":252:263 helper(123) */\n tag_9\n /* \"contracts/01.Solidity-8.0\\xe6\\x96\\xb0\\xe7\\x89\\xb9\\xe6\\x80\\xa7/TestHelper.sol\":259:262 123 */\n 0x7b\n /* \"contracts/01.Solidity-8.0\\xe6\\x96\\xb0\\xe7\\x89\\xb9\\xe6\\x80\\xa7/TestHelper.sol\":252:258 helper */\n tag_10\n /* \"contracts/01.Solidity-8.0\\xe6\\x96\\xb0\\xe7\\x89\\xb9\\xe6\\x80\\xa7/TestHelper.sol\":252:263 helper(123) */\n jump\t// in\n tag_9:\n /* \"contracts/01.Solidity-8.0\\xe6\\x96\\xb0\\xe7\\x89\\xb9\\xe6\\x80\\xa7/TestHelper.sol\":245:263 return helper(123) */\n swap1\n pop\n /* \"contracts/01.Solidity-8.0\\xe6\\x96\\xb0\\xe7\\x89\\xb9\\xe6\\x80\\xa7/TestHelper.sol\":189:271 function test() external view returns (uint) {\r... */\n swap1\n jump\t// out\n /* \"contracts/01.Solidity-8.0\\xe6\\x96\\xb0\\xe7\\x89\\xb9\\xe6\\x80\\xa7/TestHelper.sol\":91:158 function helper(uint x) view returns (uint) {\r... */\n tag_10:\n /* \"contracts/01.Solidity-8.0\\xe6\\x96\\xb0\\xe7\\x89\\xb9\\xe6\\x80\\xa7/TestHelper.sol\":129:133 uint */\n 0x00\n /* \"contracts/01.Solidity-8.0\\xe6\\x96\\xb0\\xe7\\x89\\xb9\\xe6\\x80\\xa7/TestHelper.sol\":153:154 2 */\n 0x02\n /* \"contracts/01.Solidity-8.0\\xe6\\x96\\xb0\\xe7\\x89\\xb9\\xe6\\x80\\xa7/TestHelper.sol\":149:150 x */\n dup3\n /* \"contracts/01.Solidity-8.0\\xe6\\x96\\xb0\\xe7\\x89\\xb9\\xe6\\x80\\xa7/TestHelper.sol\":149:154 x * 2 */\n tag_12\n swap2\n swap1\n tag_13\n jump\t// in\n tag_12:\n /* \"contracts/01.Solidity-8.0\\xe6\\x96\\xb0\\xe7\\x89\\xb9\\xe6\\x80\\xa7/TestHelper.sol\":142:154 return x * 2 */\n swap1\n pop\n /* \"contracts/01.Solidity-8.0\\xe6\\x96\\xb0\\xe7\\x89\\xb9\\xe6\\x80\\xa7/TestHelper.sol\":91:158 function helper(uint x) view returns (uint) {\r... */\n swap2\n swap1\n pop\n jump\t// out\n /* \"#utility.yul\":7:125 */\n tag_15:\n /* \"#utility.yul\":94:118 */\n tag_17\n /* \"#utility.yul\":112:117 */\n dup2\n /* \"#utility.yul\":94:118 */\n tag_18\n jump\t// in\n tag_17:\n /* \"#utility.yul\":89:92 */\n dup3\n /* \"#utility.yul\":82:119 */\n mstore\n /* \"#utility.yul\":7:125 */\n pop\n pop\n jump\t// out\n /* \"#utility.yul\":131:353 */\n tag_7:\n /* \"#utility.yul\":224:228 */\n 0x00\n /* \"#utility.yul\":262:264 */\n 0x20\n /* \"#utility.yul\":251:260 */\n dup3\n /* \"#utility.yul\":247:265 */\n add\n /* \"#utility.yul\":239:265 */\n swap1\n pop\n /* \"#utility.yul\":275:346 */\n tag_20\n /* \"#utility.yul\":343:344 */\n 0x00\n /* \"#utility.yul\":332:341 */\n dup4\n /* \"#utility.yul\":328:345 */\n add\n /* \"#utility.yul\":319:325 */\n dup5\n /* \"#utility.yul\":275:346 */\n tag_15\n jump\t// in\n tag_20:\n /* \"#utility.yul\":131:353 */\n swap3\n swap2\n pop\n pop\n jump\t// out\n /* \"#utility.yul\":359:707 */\n tag_13:\n /* \"#utility.yul\":399:406 */\n 0x00\n /* \"#utility.yul\":422:442 */\n tag_22\n /* \"#utility.yul\":440:441 */\n dup3\n /* \"#utility.yul\":422:442 */\n tag_18\n jump\t// in\n tag_22:\n /* \"#utility.yul\":417:442 */\n swap2\n pop\n /* \"#utility.yul\":456:476 */\n tag_23\n /* \"#utility.yul\":474:475 */\n dup4\n /* \"#utility.yul\":456:476 */\n tag_18\n jump\t// in\n tag_23:\n /* \"#utility.yul\":451:476 */\n swap3\n pop\n /* \"#utility.yul\":644:645 */\n dup2\n /* \"#utility.yul\":576:642 */\n 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\n /* \"#utility.yul\":572:646 */\n div\n /* \"#utility.yul\":569:570 */\n dup4\n /* \"#utility.yul\":566:647 */\n gt\n /* \"#utility.yul\":561:562 */\n dup3\n /* \"#utility.yul\":554:563 */\n iszero\n /* \"#utility.yul\":547:564 */\n iszero\n /* \"#utility.yul\":543:648 */\n and\n /* \"#utility.yul\":540:671 */\n iszero\n tag_24\n jumpi\n /* \"#utility.yul\":651:669 */\n tag_25\n tag_26\n jump\t// in\n tag_25:\n /* \"#utility.yul\":540:671 */\n tag_24:\n /* \"#utility.yul\":699:700 */\n dup3\n /* \"#utility.yul\":696:697 */\n dup3\n /* \"#utility.yul\":692:701 */\n mul\n /* \"#utility.yul\":681:701 */\n swap1\n pop\n /* \"#utility.yul\":359:707 */\n swap3\n swap2\n pop\n pop\n jump\t// out\n /* \"#utility.yul\":713:790 */\n tag_18:\n /* \"#utility.yul\":750:757 */\n 0x00\n /* \"#utility.yul\":779:784 */\n dup2\n /* \"#utility.yul\":768:784 */\n swap1\n pop\n /* \"#utility.yul\":713:790 */\n swap2\n swap1\n pop\n jump\t// out\n /* \"#utility.yul\":796:976 */\n tag_26:\n /* \"#utility.yul\":844:921 */\n 0x4e487b7100000000000000000000000000000000000000000000000000000000\n /* \"#utility.yul\":841:842 */\n 0x00\n /* \"#utility.yul\":834:922 */\n mstore\n /* \"#utility.yul\":941:945 */\n 0x11\n /* \"#utility.yul\":938:939 */\n 0x04\n /* \"#utility.yul\":931:946 */\n mstore\n /* \"#utility.yul\":965:969 */\n 0x24\n /* \"#utility.yul\":962:963 */\n 0x00\n /* \"#utility.yul\":955:970 */\n revert\n\n auxdata: 0xa264697066735822122060e758bf71d402691de49a3f14214598de3e2c05e5cec7514ecafa53497792f464736f6c63430008070033\n}\n",
"bytecode": {
"functionDebugData": {},
"generatedSources": [],
"linkReferences": {},
"object": "608060405234801561001057600080fd5b50610168806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063f8a8fd6d14610030575b600080fd5b61003861004e565b6040516100459190610084565b60405180910390f35b600061005a607b61005f565b905090565b600060028261006e919061009f565b9050919050565b61007e816100f9565b82525050565b60006020820190506100996000830184610075565b92915050565b60006100aa826100f9565b91506100b5836100f9565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156100ee576100ed610103565b5b828202905092915050565b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fdfea264697066735822122060e758bf71d402691de49a3f14214598de3e2c05e5cec7514ecafa53497792f464736f6c63430008070033",
"opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x168 DUP1 PUSH2 0x20 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN INVALID PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x4 CALLDATASIZE LT PUSH2 0x2B JUMPI PUSH1 0x0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0xF8A8FD6D EQ PUSH2 0x30 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x38 PUSH2 0x4E JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x45 SWAP2 SWAP1 PUSH2 0x84 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH1 0x0 PUSH2 0x5A PUSH1 0x7B PUSH2 0x5F JUMP JUMPDEST SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x2 DUP3 PUSH2 0x6E SWAP2 SWAP1 PUSH2 0x9F JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x7E DUP2 PUSH2 0xF9 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP PUSH2 0x99 PUSH1 0x0 DUP4 ADD DUP5 PUSH2 0x75 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0xAA DUP3 PUSH2 0xF9 JUMP JUMPDEST SWAP2 POP PUSH2 0xB5 DUP4 PUSH2 0xF9 JUMP JUMPDEST SWAP3 POP DUP2 PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DIV DUP4 GT DUP3 ISZERO ISZERO AND ISZERO PUSH2 0xEE JUMPI PUSH2 0xED PUSH2 0x103 JUMP JUMPDEST JUMPDEST DUP3 DUP3 MUL SWAP1 POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x4E487B7100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH1 0x11 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH1 0x0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 PUSH1 0xE7 PC 0xBF PUSH18 0xD402691DE49A3F14214598DE3E2C05E5CEC7 MLOAD 0x4E 0xCA STATICCALL MSTORE8 0x49 PUSH24 0x92F464736F6C634300080700330000000000000000000000 ",
"sourceMap": "162:112:0:-:0;;;;;;;;;;;;;;;;;;;"
},
"deployedBytecode": {
"functionDebugData": {
"@helper_13": {
"entryPoint": 95,
"id": 13,
"parameterSlots": 1,
"returnSlots": 1
},
"@test_23": {
"entryPoint": 78,
"id": 23,
"parameterSlots": 0,
"returnSlots": 1
},
"abi_encode_t_uint256_to_t_uint256_fromStack": {
"entryPoint": 117,
"id": null,
"parameterSlots": 2,
"returnSlots": 0
},
"abi_encode_tuple_t_uint256__to_t_uint256__fromStack_reversed": {
"entryPoint": 132,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"checked_mul_t_uint256": {
"entryPoint": 159,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"cleanup_t_uint256": {
"entryPoint": 249,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"panic_error_0x11": {
"entryPoint": 259,
"id": null,
"parameterSlots": 0,
"returnSlots": 0
}
},
"generatedSources": [
{
"ast": {
"nodeType": "YulBlock",
"src": "0:979: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": "407:300:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "417:25:1",
"value": {
"arguments": [
{
"name": "x",
"nodeType": "YulIdentifier",
"src": "440:1:1"
}
],
"functionName": {
"name": "cleanup_t_uint256",
"nodeType": "YulIdentifier",
"src": "422:17:1"
},
"nodeType": "YulFunctionCall",
"src": "422:20:1"
},
"variableNames": [
{
"name": "x",
"nodeType": "YulIdentifier",
"src": "417:1:1"
}
]
},
{
"nodeType": "YulAssignment",
"src": "451:25:1",
"value": {
"arguments": [
{
"name": "y",
"nodeType": "YulIdentifier",
"src": "474:1:1"
}
],
"functionName": {
"name": "cleanup_t_uint256",
"nodeType": "YulIdentifier",
"src": "456:17:1"
},
"nodeType": "YulFunctionCall",
"src": "456:20:1"
},
"variableNames": [
{
"name": "y",
"nodeType": "YulIdentifier",
"src": "451:1:1"
}
]
},
{
"body": {
"nodeType": "YulBlock",
"src": "649:22:1",
"statements": [
{
"expression": {
"arguments": [],
"functionName": {
"name": "panic_error_0x11",
"nodeType": "YulIdentifier",
"src": "651:16:1"
},
"nodeType": "YulFunctionCall",
"src": "651:18:1"
},
"nodeType": "YulExpressionStatement",
"src": "651:18:1"
}
]
},
"condition": {
"arguments": [
{
"arguments": [
{
"arguments": [
{
"name": "x",
"nodeType": "YulIdentifier",
"src": "561:1:1"
}
],
"functionName": {
"name": "iszero",
"nodeType": "YulIdentifier",
"src": "554:6:1"
},
"nodeType": "YulFunctionCall",
"src": "554:9:1"
}
],
"functionName": {
"name": "iszero",
"nodeType": "YulIdentifier",
"src": "547:6:1"
},
"nodeType": "YulFunctionCall",
"src": "547:17:1"
},
{
"arguments": [
{
"name": "y",
"nodeType": "YulIdentifier",
"src": "569:1:1"
},
{
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "576:66:1",
"type": "",
"value": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
},
{
"name": "x",
"nodeType": "YulIdentifier",
"src": "644:1:1"
}
],
"functionName": {
"name": "div",
"nodeType": "YulIdentifier",
"src": "572:3:1"
},
"nodeType": "YulFunctionCall",
"src": "572:74:1"
}
],
"functionName": {
"name": "gt",
"nodeType": "YulIdentifier",
"src": "566:2:1"
},
"nodeType": "YulFunctionCall",
"src": "566:81:1"
}
],
"functionName": {
"name": "and",
"nodeType": "YulIdentifier",
"src": "543:3:1"
},
"nodeType": "YulFunctionCall",
"src": "543:105:1"
},
"nodeType": "YulIf",
"src": "540:131:1"
},
{
"nodeType": "YulAssignment",
"src": "681:20:1",
"value": {
"arguments": [
{
"name": "x",
"nodeType": "YulIdentifier",
"src": "696:1:1"
},
{
"name": "y",
"nodeType": "YulIdentifier",
"src": "699:1:1"
}
],
"functionName": {
"name": "mul",
"nodeType": "YulIdentifier",
"src": "692:3:1"
},
"nodeType": "YulFunctionCall",
"src": "692:9:1"
},
"variableNames": [
{
"name": "product",
"nodeType": "YulIdentifier",
"src": "681:7:1"
}
]
}
]
},
"name": "checked_mul_t_uint256",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "x",
"nodeType": "YulTypedName",
"src": "390:1:1",
"type": ""
},
{
"name": "y",
"nodeType": "YulTypedName",
"src": "393:1:1",
"type": ""
}
],
"returnVariables": [
{
"name": "product",
"nodeType": "YulTypedName",
"src": "399:7:1",
"type": ""
}
],
"src": "359:348:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "758:32:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "768:16:1",
"value": {
"name": "value",
"nodeType": "YulIdentifier",
"src": "779:5:1"
},
"variableNames": [
{
"name": "cleaned",
"nodeType": "YulIdentifier",
"src": "768:7:1"
}
]
}
]
},
"name": "cleanup_t_uint256",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "740:5:1",
"type": ""
}
],
"returnVariables": [
{
"name": "cleaned",
"nodeType": "YulTypedName",
"src": "750:7:1",
"type": ""
}
],
"src": "713:77:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "824:152:1",
"statements": [
{
"expression": {
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "841:1:1",
"type": "",
"value": "0"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "844:77:1",
"type": "",
"value": "35408467139433450592217433187231851964531694900788300625387963629091585785856"
}
],
"functionName": {
"name": "mstore",
"nodeType": "YulIdentifier",
"src": "834:6:1"
},
"nodeType": "YulFunctionCall",
"src": "834:88:1"
},
"nodeType": "YulExpressionStatement",
"src": "834:88:1"
},
{
"expression": {
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "938:1:1",
"type": "",
"value": "4"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "941:4:1",
"type": "",
"value": "0x11"
}
],
"functionName": {
"name": "mstore",
"nodeType": "YulIdentifier",
"src": "931:6:1"
},
"nodeType": "YulFunctionCall",
"src": "931:15:1"
},
"nodeType": "YulExpressionStatement",
"src": "931:15:1"
},
{
"expression": {
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "962:1:1",
"type": "",
"value": "0"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "965:4:1",
"type": "",
"value": "0x24"
}
],
"functionName": {
"name": "revert",
"nodeType": "YulIdentifier",
"src": "955:6:1"
},
"nodeType": "YulFunctionCall",
"src": "955:15:1"
},
"nodeType": "YulExpressionStatement",
"src": "955:15:1"
}
]
},
"name": "panic_error_0x11",
"nodeType": "YulFunctionDefinition",
"src": "796:180: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 checked_mul_t_uint256(x, y) -> product {\n x := cleanup_t_uint256(x)\n y := cleanup_t_uint256(y)\n\n // overflow, if x != 0 and y > (maxValue / x)\n if and(iszero(iszero(x)), gt(y, div(0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff, x))) { panic_error_0x11() }\n\n product := mul(x, y)\n }\n\n function cleanup_t_uint256(value) -> cleaned {\n cleaned := value\n }\n\n function panic_error_0x11() {\n mstore(0, 35408467139433450592217433187231851964531694900788300625387963629091585785856)\n mstore(4, 0x11)\n revert(0, 0x24)\n }\n\n}\n",
"id": 1,
"language": "Yul",
"name": "#utility.yul"
}
],
"immutableReferences": {},
"linkReferences": {},
"object": "608060405234801561001057600080fd5b506004361061002b5760003560e01c8063f8a8fd6d14610030575b600080fd5b61003861004e565b6040516100459190610084565b60405180910390f35b600061005a607b61005f565b905090565b600060028261006e919061009f565b9050919050565b61007e816100f9565b82525050565b60006020820190506100996000830184610075565b92915050565b60006100aa826100f9565b91506100b5836100f9565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156100ee576100ed610103565b5b828202905092915050565b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fdfea264697066735822122060e758bf71d402691de49a3f14214598de3e2c05e5cec7514ecafa53497792f464736f6c63430008070033",
"opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x4 CALLDATASIZE LT PUSH2 0x2B JUMPI PUSH1 0x0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0xF8A8FD6D EQ PUSH2 0x30 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x38 PUSH2 0x4E JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x45 SWAP2 SWAP1 PUSH2 0x84 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH1 0x0 PUSH2 0x5A PUSH1 0x7B PUSH2 0x5F JUMP JUMPDEST SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x2 DUP3 PUSH2 0x6E SWAP2 SWAP1 PUSH2 0x9F JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x7E DUP2 PUSH2 0xF9 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP PUSH2 0x99 PUSH1 0x0 DUP4 ADD DUP5 PUSH2 0x75 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0xAA DUP3 PUSH2 0xF9 JUMP JUMPDEST SWAP2 POP PUSH2 0xB5 DUP4 PUSH2 0xF9 JUMP JUMPDEST SWAP3 POP DUP2 PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DIV DUP4 GT DUP3 ISZERO ISZERO AND ISZERO PUSH2 0xEE JUMPI PUSH2 0xED PUSH2 0x103 JUMP JUMPDEST JUMPDEST DUP3 DUP3 MUL SWAP1 POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x4E487B7100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH1 0x11 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH1 0x0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 PUSH1 0xE7 PC 0xBF PUSH18 0xD402691DE49A3F14214598DE3E2C05E5CEC7 MLOAD 0x4E 0xCA STATICCALL MSTORE8 0x49 PUSH24 0x92F464736F6C634300080700330000000000000000000000 ",
"sourceMap": "162:112:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;189:82;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;;228:4;252:11;259:3;252:6;:11::i;:::-;245:18;;189:82;:::o;91:67::-;129:4;153:1;149;:5;;;;:::i;:::-;142:12;;91:67;;;:::o;7:118:1:-;94:24;112:5;94:24;:::i;:::-;89:3;82:37;7:118;;:::o;131:222::-;224:4;262:2;251:9;247:18;239:26;;275:71;343:1;332:9;328:17;319:6;275:71;:::i;:::-;131:222;;;;:::o;359:348::-;399:7;422:20;440:1;422:20;:::i;:::-;417:25;;456:20;474:1;456:20;:::i;:::-;451:25;;644:1;576:66;572:74;569:1;566:81;561:1;554:9;547:17;543:105;540:131;;;651:18;;:::i;:::-;540:131;699:1;696;692:9;681:20;;359:348;;;;:::o;713:77::-;750:7;779:5;768:16;;713:77;;;:::o;796:180::-;844:77;841:1;834:88;941:4;938:1;931:15;965:4;962:1;955:15"
},
"gasEstimates": {
"creation": {
"codeDepositCost": "72000",
"executionCost": "123",
"totalCost": "72123"
},
"external": {
"test()": "infinite"
}
},
"legacyAssembly": {
".code": [
{
"begin": 162,
"end": 274,
"name": "PUSH",
"source": 0,
"value": "80"
},
{
"begin": 162,
"end": 274,
"name": "PUSH",
"source": 0,
"value": "40"
},
{
"begin": 162,
"end": 274,
"name": "MSTORE",
"source": 0
},
{
"begin": 162,
"end": 274,
"name": "CALLVALUE",
"source": 0
},
{
"begin": 162,
"end": 274,
"name": "DUP1",
"source": 0
},
{
"begin": 162,
"end": 274,
"name": "ISZERO",
"source": 0
},
{
"begin": 162,
"end": 274,
"name": "PUSH [tag]",
"source": 0,
"value": "1"
},
{
"begin": 162,
"end": 274,
"name": "JUMPI",
"source": 0
},
{
"begin": 162,
"end": 274,
"name": "PUSH",
"source": 0,
"value": "0"
},
{
"begin": 162,
"end": 274,
"name": "DUP1",
"source": 0
},
{
"begin": 162,
"end": 274,
"name": "REVERT",
"source": 0
},
{
"begin": 162,
"end": 274,
"name": "tag",
"source": 0,
"value": "1"
},
{
"begin": 162,
"end": 274,
"name": "JUMPDEST",
"source": 0
},
{
"begin": 162,
"end": 274,
"name": "POP",
"source": 0
},
{
"begin": 162,
"end": 274,
"name": "PUSH #[$]",
"source": 0,
"value": "0000000000000000000000000000000000000000000000000000000000000000"
},
{
"begin": 162,
"end": 274,
"name": "DUP1",
"source": 0
},
{
"begin": 162,
"end": 274,
"name": "PUSH [$]",
"source": 0,
"value": "0000000000000000000000000000000000000000000000000000000000000000"
},
{
"begin": 162,
"end": 274,
"name": "PUSH",
"source": 0,
"value": "0"
},
{
"begin": 162,
"end": 274,
"name": "CODECOPY",
"source": 0
},
{
"begin": 162,
"end": 274,
"name": "PUSH",
"source": 0,
"value": "0"
},
{
"begin": 162,
"end": 274,
"name": "RETURN",
"source": 0
}
],
".data": {
"0": {
".auxdata": "a264697066735822122060e758bf71d402691de49a3f14214598de3e2c05e5cec7514ecafa53497792f464736f6c63430008070033",
".code": [
{
"begin": 162,
"end": 274,
"name": "PUSH",
"source": 0,
"value": "80"
},
{
"begin": 162,
"end": 274,
"name": "PUSH",
"source": 0,
"value": "40"
},
{
"begin": 162,
"end": 274,
"name": "MSTORE",
"source": 0
},
{
"begin": 162,
"end": 274,
"name": "CALLVALUE",
"source": 0
},
{
"begin": 162,
"end": 274,
"name": "DUP1",
"source": 0
},
{
"begin": 162,
"end": 274,
"name": "ISZERO",
"source": 0
},
{
"begin": 162,
"end": 274,
"name": "PUSH [tag]",
"source": 0,
"value": "1"
},
{
"begin": 162,
"end": 274,
"name": "JUMPI",
"source": 0
},
{
"begin": 162,
"end": 274,
"name": "PUSH",
"source": 0,
"value": "0"
},
{
"begin": 162,
"end": 274,
"name": "DUP1",
"source": 0
},
{
"begin": 162,
"end": 274,
"name": "REVERT",
"source": 0
},
{
"begin": 162,
"end": 274,
"name": "tag",
"source": 0,
"value": "1"
},
{
"begin": 162,
"end": 274,
"name": "JUMPDEST",
"source": 0
},
{
"begin": 162,
"end": 274,
"name": "POP",
"source": 0
},
{
"begin": 162,
"end": 274,
"name": "PUSH",
"source": 0,
"value": "4"
},
{
"begin": 162,
"end": 274,
"name": "CALLDATASIZE",
"source": 0
},
{
"begin": 162,
"end": 274,
"name": "LT",
"source": 0
},
{
"begin": 162,
"end": 274,
"name": "PUSH [tag]",
"source": 0,
"value": "2"
},
{
"begin": 162,
"end": 274,
"name": "JUMPI",
"source": 0
},
{
"begin": 162,
"end": 274,
"name": "PUSH",
"source": 0,
"value": "0"
},
{
"begin": 162,
"end": 274,
"name": "CALLDATALOAD",
"source": 0
},
{
"begin": 162,
"end": 274,
"name": "PUSH",
"source": 0,
"value": "E0"
},
{
"begin": 162,
"end": 274,
"name": "SHR",
"source": 0
},
{
"begin": 162,
"end": 274,
"name": "DUP1",
"source": 0
},
{
"begin": 162,
"end": 274,
"name": "PUSH",
"source": 0,
"value": "F8A8FD6D"
},
{
"begin": 162,
"end": 274,
"name": "EQ",
"source": 0
},
{
"begin": 162,
"end": 274,
"name": "PUSH [tag]",
"source": 0,
"value": "3"
},
{
"begin": 162,
"end": 274,
"name": "JUMPI",
"source": 0
},
{
"begin": 162,
"end": 274,
"name": "tag",
"source": 0,
"value": "2"
},
{
"begin": 162,
"end": 274,
"name": "JUMPDEST",
"source": 0
},
{
"begin": 162,
"end": 274,
"name": "PUSH",
"source": 0,
"value": "0"
},
{
"begin": 162,
"end": 274,
"name": "DUP1",
"source": 0
},
{
"begin": 162,
"end": 274,
"name": "REVERT",
"source": 0
},
{
"begin": 189,
"end": 271,
"name": "tag",
"source": 0,
"value": "3"
},
{
"begin": 189,
"end": 271,
"name": "JUMPDEST",
"source": 0
},
{
"begin": 189,
"end": 271,
"name": "PUSH [tag]",
"source": 0,
"value": "4"
},
{
"begin": 189,
"end": 271,
"name": "PUSH [tag]",
"source": 0,
"value": "5"
},
{
"begin": 189,
"end": 271,
"name": "JUMP",
"source": 0,
"value": "[in]"
},
{
"begin": 189,
"end": 271,
"name": "tag",
"source": 0,
"value": "4"
},
{
"begin": 189,
"end": 271,
"name": "JUMPDEST",
"source": 0
},
{
"begin": 189,
"end": 271,
"name": "PUSH",
"source": 0,
"value": "40"
},
{
"begin": 189,
"end": 271,
"name": "MLOAD",
"source": 0
},
{
"begin": 189,
"end": 271,
"name": "PUSH [tag]",
"source": 0,
"value": "6"
},
{
"begin": 189,
"end": 271,
"name": "SWAP2",
"source": 0
},
{
"begin": 189,
"end": 271,
"name": "SWAP1",
"source": 0
},
{
"begin": 189,
"end": 271,
"name": "PUSH [tag]",
"source": 0,
"value": "7"
},
{
"begin": 189,
"end": 271,
"name": "JUMP",
"source": 0,
"value": "[in]"
},
{
"begin": 189,
"end": 271,
"name": "tag",
"source": 0,
"value": "6"
},
{
"begin": 189,
"end": 271,
"name": "JUMPDEST",
"source": 0
},
{
"begin": 189,
"end": 271,
"name": "PUSH",
"source": 0,
"value": "40"
},
{
"begin": 189,
"end": 271,
"name": "MLOAD",
"source": 0
},
{
"begin": 189,
"end": 271,
"name": "DUP1",
"source": 0
},
{
"begin": 189,
"end": 271,
"name": "SWAP2",
"source": 0
},
{
"begin": 189,
"end": 271,
"name": "SUB",
"source": 0
},
{
"begin": 189,
"end": 271,
"name": "SWAP1",
"source": 0
},
{
"begin": 189,
"end": 271,
"name": "RETURN",
"source": 0
},
{
"begin": 189,
"end": 271,
"name": "tag",
"source": 0,
"value": "5"
},
{
"begin": 189,
"end": 271,
"name": "JUMPDEST",
"source": 0
},
{
"begin": 228,
"end": 232,
"name": "PUSH",
"source": 0,
"value": "0"
},
{
"begin": 252,
"end": 263,
"name": "PUSH [tag]",
"source": 0,
"value": "9"
},
{
"begin": 259,
"end": 262,
"name": "PUSH",
"source": 0,
"value": "7B"
},
{
"begin": 252,
"end": 258,
"name": "PUSH [tag]",
"source": 0,
"value": "10"
},
{
"begin": 252,
"end": 263,
"name": "JUMP",
"source": 0,
"value": "[in]"
},
{
"begin": 252,
"end": 263,
"name": "tag",
"source": 0,
"value": "9"
},
{
"begin": 252,
"end": 263,
"name": "JUMPDEST",
"source": 0
},
{
"begin": 245,
"end": 263,
"name": "SWAP1",
"source": 0
},
{
"begin": 245,
"end": 263,
"name": "POP",
"source": 0
},
{
"begin": 189,
"end": 271,
"name": "SWAP1",
"source": 0
},
{
"begin": 189,
"end": 271,
"name": "JUMP",
"source": 0,
"value": "[out]"
},
{
"begin": 91,
"end": 158,
"name": "tag",
"source": 0,
"value": "10"
},
{
"begin": 91,
"end": 158,
"name": "JUMPDEST",
"source": 0
},
{
"begin": 129,
"end": 133,
"name": "PUSH",
"source": 0,
"value": "0"
},
{
"begin": 153,
"end": 154,
"name": "PUSH",
"source": 0,
"value": "2"
},
{
"begin": 149,
"end": 150,
"name": "DUP3",
"source": 0
},
{
"begin": 149,
"end": 154,
"name": "PUSH [tag]",
"source": 0,
"value": "12"
},
{
"begin": 149,
"end": 154,
"name": "SWAP2",
"source": 0
},
{
"begin": 149,
"end": 154,
"name": "SWAP1",
"source": 0
},
{
"begin": 149,
"end": 154,
"name": "PUSH [tag]",
"source": 0,
"value": "13"
},
{
"begin": 149,
"end": 154,
"name": "JUMP",
"source": 0,
"value": "[in]"
},
{
"begin": 149,
"end": 154,
"name": "tag",
"source": 0,
"value": "12"
},
{
"begin": 149,
"end": 154,
"name": "JUMPDEST",
"source": 0
},
{
"begin": 142,
"end": 154,
"name": "SWAP1",
"source": 0
},
{
"begin": 142,
"end": 154,
"name": "POP",
"source": 0
},
{
"begin": 91,
"end": 158,
"name": "SWAP2",
"source": 0
},
{
"begin": 91,
"end": 158,
"name": "SWAP1",
"source": 0
},
{
"begin": 91,
"end": 158,
"name": "POP",
"source": 0
},
{
"begin": 91,
"end": 158,
"name": "JUMP",
"source": 0,
"value": "[out]"
},
{
"begin": 7,
"end": 125,
"name": "tag",
"source": 1,
"value": "15"
},
{
"begin": 7,
"end": 125,
"name": "JUMPDEST",
"source": 1
},
{
"begin": 94,
"end": 118,
"name": "PUSH [tag]",
"source": 1,
"value": "17"
},
{
"begin": 112,
"end": 117,
"name": "DUP2",
"source": 1
},
{
"begin": 94,
"end": 118,
"name": "PUSH [tag]",
"source": 1,
"value": "18"
},
{
"begin": 94,
"end": 118,
"name": "JUMP",
"source": 1,
"value": "[in]"
},
{
"begin": 94,
"end": 118,
"name": "tag",
"source": 1,
"value": "17"
},
{
"begin": 94,
"end": 118,
"name": "JUMPDEST",
"source": 1
},
{
"begin": 89,
"end": 92,
"name": "DUP3",
"source": 1
},
{
"begin": 82,
"end": 119,
"name": "MSTORE",
"source": 1
},
{
"begin": 7,
"end": 125,
"name": "POP",
"source": 1
},
{
"begin": 7,
"end": 125,
"name": "POP",
"source": 1
},
{
"begin": 7,
"end": 125,
"name": "JUMP",
"source": 1,
"value": "[out]"
},
{
"begin": 131,
"end": 353,
"name": "tag",
"source": 1,
"value": "7"
},
{
"begin": 131,
"end": 353,
"name": "JUMPDEST",
"source": 1
},
{
"begin": 224,
"end": 228,
"name": "PUSH",
"source": 1,
"value": "0"
},
{
"begin": 262,
"end": 264,
"name": "PUSH",
"source": 1,
"value": "20"
},
{
"begin": 251,
"end": 260,
"name": "DUP3",
"source": 1
},
{
"begin": 247,
"end": 265,
"name": "ADD",
"source": 1
},
{
"begin": 239,
"end": 265,
"name": "SWAP1",
"source": 1
},
{
"begin": 239,
"end": 265,
"name": "POP",
"source": 1
},
{
"begin": 275,
"end": 346,
"name": "PUSH [tag]",
"source": 1,
"value": "20"
},
{
"begin": 343,
"end": 344,
"name": "PUSH",
"source": 1,
"value": "0"
},
{
"begin": 332,
"end": 341,
"name": "DUP4",
"source": 1
},
{
"begin": 328,
"end": 345,
"name": "ADD",
"source": 1
},
{
"begin": 319,
"end": 325,
"name": "DUP5",
"source": 1
},
{
"begin": 275,
"end": 346,
"name": "PUSH [tag]",
"source": 1,
"value": "15"
},
{
"begin": 275,
"end": 346,
"name": "JUMP",
"source": 1,
"value": "[in]"
},
{
"begin": 275,
"end": 346,
"name": "tag",
"source": 1,
"value": "20"
},
{
"begin": 275,
"end": 346,
"name": "JUMPDEST",
"source": 1
},
{
"begin": 131,
"end": 353,
"name": "SWAP3",
"source": 1
},
{
"begin": 131,
"end": 353,
"name": "SWAP2",
"source": 1
},
{
"begin": 131,
"end": 353,
"name": "POP",
"source": 1
},
{
"begin": 131,
"end": 353,
"name": "POP",
"source": 1
},
{
"begin": 131,
"end": 353,
"name": "JUMP",
"source": 1,
"value": "[out]"
},
{
"begin": 359,
"end": 707,
"name": "tag",
"source": 1,
"value": "13"
},
{
"begin": 359,
"end": 707,
"name": "JUMPDEST",
"source": 1
},
{
"begin": 399,
"end": 406,
"name": "PUSH",
"source": 1,
"value": "0"
},
{
"begin": 422,
"end": 442,
"name": "PUSH [tag]",
"source": 1,
"value": "22"
},
{
"begin": 440,
"end": 441,
"name": "DUP3",
"source": 1
},
{
"begin": 422,
"end": 442,
"name": "PUSH [tag]",
"source": 1,
"value": "18"
},
{
"begin": 422,
"end": 442,
"name": "JUMP",
"source": 1,
"value": "[in]"
},
{
"begin": 422,
"end": 442,
"name": "tag",
"source": 1,
"value": "22"
},
{
"begin": 422,
"end": 442,
"name": "JUMPDEST",
"source": 1
},
{
"begin": 417,
"end": 442,
"name": "SWAP2",
"source": 1
},
{
"begin": 417,
"end": 442,
"name": "POP",
"source": 1
},
{
"begin": 456,
"end": 476,
"name": "PUSH [tag]",
"source": 1,
"value": "23"
},
{
"begin": 474,
"end": 475,
"name": "DUP4",
"source": 1
},
{
"begin": 456,
"end": 476,
"name": "PUSH [tag]",
"source": 1,
"value": "18"
},
{
"begin": 456,
"end": 476,
"name": "JUMP",
"source": 1,
"value": "[in]"
},
{
"begin": 456,
"end": 476,
"name": "tag",
"source": 1,
"value": "23"
},
{
"begin": 456,
"end": 476,
"name": "JUMPDEST",
"source": 1
},
{
"begin": 451,
"end": 476,
"name": "SWAP3",
"source": 1
},
{
"begin": 451,
"end": 476,
"name": "POP",
"source": 1
},
{
"begin": 644,
"end": 645,
"name": "DUP2",
"source": 1
},
{
"begin": 576,
"end": 642,
"name": "PUSH",
"source": 1,
"value": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
},
{
"begin": 572,
"end": 646,
"name": "DIV",
"source": 1
},
{
"begin": 569,
"end": 570,
"name": "DUP4",
"source": 1
},
{
"begin": 566,
"end": 647,
"name": "GT",
"source": 1
},
{
"begin": 561,
"end": 562,
"name": "DUP3",
"source": 1
},
{
"begin": 554,
"end": 563,
"name": "ISZERO",
"source": 1
},
{
"begin": 547,
"end": 564,
"name": "ISZERO",
"source": 1
},
{
"begin": 543,
"end": 648,
"name": "AND",
"source": 1
},
{
"begin": 540,
"end": 671,
"name": "ISZERO",
"source": 1
},
{
"begin": 540,
"end": 671,
"name": "PUSH [tag]",
"source": 1,
"value": "24"
},
{
"begin": 540,
"end": 671,
"name": "JUMPI",
"source": 1
},
{
"begin": 651,
"end": 669,
"name": "PUSH [tag]",
"source": 1,
"value": "25"
},
{
"begin": 651,
"end": 669,
"name": "PUSH [tag]",
"source": 1,
"value": "26"
},
{
"begin": 651,
"end": 669,
"name": "JUMP",
"source": 1,
"value": "[in]"
},
{
"begin": 651,
"end": 669,
"name": "tag",
"source": 1,
"value": "25"
},
{
"begin": 651,
"end": 669,
"name": "JUMPDEST",
"source": 1
},
{
"begin": 540,
"end": 671,
"name": "tag",
"source": 1,
"value": "24"
},
{
"begin": 540,
"end": 671,
"name": "JUMPDEST",
"source": 1
},
{
"begin": 699,
"end": 700,
"name": "DUP3",
"source": 1
},
{
"begin": 696,
"end": 697,
"name": "DUP3",
"source": 1
},
{
"begin": 692,
"end": 701,
"name": "MUL",
"source": 1
},
{
"begin": 681,
"end": 701,
"name": "SWAP1",
"source": 1
},
{
"begin": 681,
"end": 701,
"name": "POP",
"source": 1
},
{
"begin": 359,
"end": 707,
"name": "SWAP3",
"source": 1
},
{
"begin": 359,
"end": 707,
"name": "SWAP2",
"source": 1
},
{
"begin": 359,
"end": 707,
"name": "POP",
"source": 1
},
{
"begin": 359,
"end": 707,
"name": "POP",
"source": 1
},
{
"begin": 359,
"end": 707,
"name": "JUMP",
"source": 1,
"value": "[out]"
},
{
"begin": 713,
"end": 790,
"name": "tag",
"source": 1,
"value": "18"
},
{
"begin": 713,
"end": 790,
"name": "JUMPDEST",
"source": 1
},
{
"begin": 750,
"end": 757,
"name": "PUSH",
"source": 1,
"value": "0"
},
{
"begin": 779,
"end": 784,
"name": "DUP2",
"source": 1
},
{
"begin": 768,
"end": 784,
"name": "SWAP1",
"source": 1
},
{
"begin": 768,
"end": 784,
"name": "POP",
"source": 1
},
{
"begin": 713,
"end": 790,
"name": "SWAP2",
"source": 1
},
{
"begin": 713,
"end": 790,
"name": "SWAP1",
"source": 1
},
{
"begin": 713,
"end": 790,
"name": "POP",
"source": 1
},
{
"begin": 713,
"end": 790,
"name": "JUMP",
"source": 1,
"value": "[out]"
},
{
"begin": 796,
"end": 976,
"name": "tag",
"source": 1,
"value": "26"
},
{
"begin": 796,
"end": 976,
"name": "JUMPDEST",
"source": 1
},
{
"begin": 844,
"end": 921,
"name": "PUSH",
"source": 1,
"value": "4E487B7100000000000000000000000000000000000000000000000000000000"
},
{
"begin": 841,
"end": 842,
"name": "PUSH",
"source": 1,
"value": "0"
},
{
"begin": 834,
"end": 922,
"name": "MSTORE",
"source": 1
},
{
"begin": 941,
"end": 945,
"name": "PUSH",
"source": 1,
"value": "11"
},
{
"begin": 938,
"end": 939,
"name": "PUSH",
"source": 1,
"value": "4"
},
{
"begin": 931,
"end": 946,
"name": "MSTORE",
"source": 1
},
{
"begin": 965,
"end": 969,
"name": "PUSH",
"source": 1,
"value": "24"
},
{
"begin": 962,
"end": 963,
"name": "PUSH",
"source": 1,
"value": "0"
},
{
"begin": 955,
"end": 970,
"name": "REVERT",
"source": 1
}
]
}
}
},
"methodIdentifiers": {
"test()": "f8a8fd6d"
}
},
"metadata": "{\"compiler\":{\"version\":\"0.8.7+commit.e28d00a7\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"test\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/01.Solidity-8.0\\u65b0\\u7279\\u6027/TestHelper.sol\":\"TestHelper\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/01.Solidity-8.0\\u65b0\\u7279\\u6027/TestHelper.sol\":{\"keccak256\":\"0x17f91fc11a6058f23fb302b0cea1d975eef3da6868c789b00f89191d73df2634\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://dfcd13d166950d21775e95f6c2cc1fb4c64a63b4620cce977327f0fc6cc213ed\",\"dweb:/ipfs/QmRyB6LzZR6fEB6NtzAvvJFXUh5xvah3K4ox2bCfqhvtGB\"]}},\"version\":1}",
"storageLayout": {
"storage": [],
"types": null
},
"userdoc": {
"kind": "user",
"methods": {},
"version": 1
}
}
}
},
"errors": [
{
"component": "general",
"errorCode": "2018",
"formattedMessage": "Warning: Function state mutability can be restricted to pure\n --> contracts/01.Solidity-8.0新特性/TestHelper.sol:6:1:\n |\n6 | function helper(uint x) view returns (uint) {\n | ^ (Relevant source part starts here and spans across multiple lines).\n\n",
"message": "Function state mutability can be restricted to pure",
"severity": "warning",
"sourceLocation": {
"end": 158,
"file": "contracts/01.Solidity-8.0新特性/TestHelper.sol",
"start": 91
},
"type": "Warning"
}
],
"sources": {
"contracts/01.Solidity-8.0新特性/TestHelper.sol": {
"ast": {
"absolutePath": "contracts/01.Solidity-8.0新特性/TestHelper.sol",
"exportedSymbols": {
"TestHelper": [
24
],
"helper": [
13
]
},
"id": 25,
"license": "MIT",
"nodeType": "SourceUnit",
"nodes": [
{
"id": 1,
"literals": [
"solidity",
"^",
"0.8"
],
"nodeType": "PragmaDirective",
"src": "33:21:0"
},
{
"body": {
"id": 12,
"nodeType": "Block",
"src": "135:23:0",
"statements": [
{
"expression": {
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 10,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"id": 8,
"name": "x",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3,
"src": "149:1:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "*",
"rightExpression": {
"hexValue": "32",
"id": 9,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "153:1:0",
"typeDescriptions": {
"typeIdentifier": "t_rational_2_by_1",
"typeString": "int_const 2"
},
"value": "2"
},
"src": "149:5:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"functionReturnParameters": 7,
"id": 11,
"nodeType": "Return",
"src": "142:12:0"
}
]
},
"id": 13,
"implemented": true,
"kind": "freeFunction",
"modifiers": [],
"name": "helper",
"nameLocation": "100:6:0",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 4,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 3,
"mutability": "mutable",
"name": "x",
"nameLocation": "112:1:0",
"nodeType": "VariableDeclaration",
"scope": 13,
"src": "107:6:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 2,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "107:4:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "106:8:0"
},
"returnParameters": {
"id": 7,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 6,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"scope": 13,
"src": "129:4:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 5,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "129:4:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "128:6:0"
},
"scope": 25,
"src": "91:67:0",
"stateMutability": "view",
"virtual": false,
"visibility": "internal"
},
{
"abstract": false,
"baseContracts": [],
"contractDependencies": [],
"contractKind": "contract",
"fullyImplemented": true,
"id": 24,
"linearizedBaseContracts": [
24
],
"name": "TestHelper",
"nameLocation": "171:10:0",
"nodeType": "ContractDefinition",
"nodes": [
{
"body": {
"id": 22,
"nodeType": "Block",
"src": "234:37:0",
"statements": [
{
"expression": {
"arguments": [
{
"hexValue": "313233",
"id": 19,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "259:3:0",
"typeDescriptions": {
"typeIdentifier": "t_rational_123_by_1",
"typeString": "int_const 123"
},
"value": "123"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_rational_123_by_1",
"typeString": "int_const 123"
}
],
"id": 18,
"name": "helper",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13,
"src": "252:6:0",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$_t_uint256_$returns$_t_uint256_$",
"typeString": "function (uint256) view returns (uint256)"
}
},
"id": 20,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "252:11:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"functionReturnParameters": 17,
"id": 21,
"nodeType": "Return",
"src": "245:18:0"
}
]
},
"functionSelector": "f8a8fd6d",
"id": 23,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "test",
"nameLocation": "198:4:0",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 14,
"nodeType": "ParameterList",
"parameters": [],
"src": "202:2:0"
},
"returnParameters": {
"id": 17,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 16,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"scope": 23,
"src": "228:4:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 15,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "228:4:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "227:6:0"
},
"scope": 24,
"src": "189:82:0",
"stateMutability": "view",
"virtual": false,
"visibility": "external"
}
],
"scope": 25,
"src": "162:112:0",
"usedErrors": []
}
],
"src": "33:241:0"
},
"id": 0
}
}
}
}
{
"id": "5ea410fc0219159514b9653a13ff7064",
"_format": "hh-sol-build-info-1",
"solcVersion": "0.8.7",
"solcLongVersion": "0.8.7+commit.e28d00a7",
"input": {
"language": "Solidity",
"sources": {
"contracts/01.Solidity-8.0新特性/VendingMachine.sol": {
"content": "// SPDX-License-Identifier: MIT\r\npragma solidity ^0.8;\r\n\r\n// custom error\r\n\r\ncontract VendingMachine {\r\n address payable owner = payable(msg.sender);\r\n\r\n error Unauthorized(address caller);\r\n\r\n function withdraw() public {\r\n if (msg.sender != owner)\r\n // 23642 gas\r\n // revert(\"error\");\r\n // 3000000\r\n // revert(\"error error error error error\");\r\n // 23388\r\n revert Unauthorized(msg.sender);\r\n \r\n\r\n owner.transfer(address(this).balance);\r\n }\r\n}"
}
},
"settings": {
"optimizer": {
"enabled": false,
"runs": 200
},
"outputSelection": {
"*": {
"": [
"ast"
],
"*": [
"abi",
"metadata",
"devdoc",
"userdoc",
"storageLayout",
"evm.legacyAssembly",
"evm.bytecode",
"evm.deployedBytecode",
"evm.methodIdentifiers",
"evm.gasEstimates",
"evm.assembly"
]
}
}
}
},
"output": {
"contracts": {
"contracts/01.Solidity-8.0新特性/VendingMachine.sol": {
"VendingMachine": {
"abi": [
{
"inputs": [
{
"internalType": "address",
"name": "caller",
"type": "address"
}
],
"name": "Unauthorized",
"type": "error"
},
{
"inputs": [],
"name": "withdraw",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
],
"devdoc": {
"kind": "dev",
"methods": {},
"version": 1
},
"evm": {
"assembly": " /* \"contracts/01.Solidity-8.0\\xe6\\x96\\xb0\\xe7\\x89\\xb9\\xe6\\x80\\xa7/VendingMachine.sol\":77:543 contract VendingMachine {\r... */\n mstore(0x40, 0x80)\n /* \"contracts/01.Solidity-8.0\\xe6\\x96\\xb0\\xe7\\x89\\xb9\\xe6\\x80\\xa7/VendingMachine.sol\":140:150 msg.sender */\n caller\n /* \"contracts/01.Solidity-8.0\\xe6\\x96\\xb0\\xe7\\x89\\xb9\\xe6\\x80\\xa7/VendingMachine.sol\":108:151 address payable owner = payable(msg.sender) */\n 0x00\n dup1\n 0x0100\n exp\n dup2\n sload\n dup2\n 0xffffffffffffffffffffffffffffffffffffffff\n mul\n not\n and\n swap1\n dup4\n 0xffffffffffffffffffffffffffffffffffffffff\n and\n mul\n or\n swap1\n sstore\n pop\n /* \"contracts/01.Solidity-8.0\\xe6\\x96\\xb0\\xe7\\x89\\xb9\\xe6\\x80\\xa7/VendingMachine.sol\":77:543 contract VendingMachine {\r... */\n callvalue\n dup1\n iszero\n tag_1\n jumpi\n 0x00\n dup1\n revert\ntag_1:\n pop\n dataSize(sub_0)\n dup1\n dataOffset(sub_0)\n 0x00\n codecopy\n 0x00\n return\nstop\n\nsub_0: assembly {\n /* \"contracts/01.Solidity-8.0\\xe6\\x96\\xb0\\xe7\\x89\\xb9\\xe6\\x80\\xa7/VendingMachine.sol\":77:543 contract VendingMachine {\r... */\n mstore(0x40, 0x80)\n callvalue\n dup1\n iszero\n tag_1\n jumpi\n 0x00\n dup1\n revert\n tag_1:\n pop\n jumpi(tag_2, lt(calldatasize, 0x04))\n shr(0xe0, calldataload(0x00))\n dup1\n 0x3ccfd60b\n eq\n tag_3\n jumpi\n tag_2:\n 0x00\n dup1\n revert\n /* \"contracts/01.Solidity-8.0\\xe6\\x96\\xb0\\xe7\\x89\\xb9\\xe6\\x80\\xa7/VendingMachine.sol\":203:540 function withdraw() public {\r... */\n tag_3:\n tag_4\n tag_5\n jump\t// in\n tag_4:\n stop\n tag_5:\n /* \"contracts/01.Solidity-8.0\\xe6\\x96\\xb0\\xe7\\x89\\xb9\\xe6\\x80\\xa7/VendingMachine.sol\":259:264 owner */\n 0x00\n dup1\n sload\n swap1\n 0x0100\n exp\n swap1\n div\n 0xffffffffffffffffffffffffffffffffffffffff\n and\n /* \"contracts/01.Solidity-8.0\\xe6\\x96\\xb0\\xe7\\x89\\xb9\\xe6\\x80\\xa7/VendingMachine.sol\":245:264 msg.sender != owner */\n 0xffffffffffffffffffffffffffffffffffffffff\n and\n /* \"contracts/01.Solidity-8.0\\xe6\\x96\\xb0\\xe7\\x89\\xb9\\xe6\\x80\\xa7/VendingMachine.sol\":245:255 msg.sender */\n caller\n /* \"contracts/01.Solidity-8.0\\xe6\\x96\\xb0\\xe7\\x89\\xb9\\xe6\\x80\\xa7/VendingMachine.sol\":245:264 msg.sender != owner */\n 0xffffffffffffffffffffffffffffffffffffffff\n and\n eq\n /* \"contracts/01.Solidity-8.0\\xe6\\x96\\xb0\\xe7\\x89\\xb9\\xe6\\x80\\xa7/VendingMachine.sol\":241:472 if (msg.sender != owner)\r... */\n tag_7\n jumpi\n /* \"contracts/01.Solidity-8.0\\xe6\\x96\\xb0\\xe7\\x89\\xb9\\xe6\\x80\\xa7/VendingMachine.sol\":461:471 msg.sender */\n caller\n /* \"contracts/01.Solidity-8.0\\xe6\\x96\\xb0\\xe7\\x89\\xb9\\xe6\\x80\\xa7/VendingMachine.sol\":448:472 Unauthorized(msg.sender) */\n mload(0x40)\n 0x8e4a23d600000000000000000000000000000000000000000000000000000000\n dup2\n mstore\n 0x04\n add\n tag_8\n swap2\n swap1\n tag_9\n jump\t// in\n tag_8:\n mload(0x40)\n dup1\n swap2\n sub\n swap1\n revert\n /* \"contracts/01.Solidity-8.0\\xe6\\x96\\xb0\\xe7\\x89\\xb9\\xe6\\x80\\xa7/VendingMachine.sol\":241:472 if (msg.sender != owner)\r... */\n tag_7:\n /* \"contracts/01.Solidity-8.0\\xe6\\x96\\xb0\\xe7\\x89\\xb9\\xe6\\x80\\xa7/VendingMachine.sol\":495:500 owner */\n 0x00\n dup1\n sload\n swap1\n 0x0100\n exp\n swap1\n div\n 0xffffffffffffffffffffffffffffffffffffffff\n and\n /* \"contracts/01.Solidity-8.0\\xe6\\x96\\xb0\\xe7\\x89\\xb9\\xe6\\x80\\xa7/VendingMachine.sol\":495:509 owner.transfer */\n 0xffffffffffffffffffffffffffffffffffffffff\n and\n /* \"contracts/01.Solidity-8.0\\xe6\\x96\\xb0\\xe7\\x89\\xb9\\xe6\\x80\\xa7/VendingMachine.sol\":495:532 owner.transfer(address(this).balance) */\n 0x08fc\n /* \"contracts/01.Solidity-8.0\\xe6\\x96\\xb0\\xe7\\x89\\xb9\\xe6\\x80\\xa7/VendingMachine.sol\":510:531 address(this).balance */\n selfbalance\n /* \"contracts/01.Solidity-8.0\\xe6\\x96\\xb0\\xe7\\x89\\xb9\\xe6\\x80\\xa7/VendingMachine.sol\":495:532 owner.transfer(address(this).balance) */\n swap1\n dup2\n iszero\n mul\n swap1\n mload(0x40)\n 0x00\n mload(0x40)\n dup1\n dup4\n sub\n dup2\n dup6\n dup9\n dup9\n call\n swap4\n pop\n pop\n pop\n pop\n iszero\n dup1\n iszero\n tag_11\n jumpi\n returndatasize\n 0x00\n dup1\n returndatacopy\n revert(0x00, returndatasize)\n tag_11:\n pop\n /* \"contracts/01.Solidity-8.0\\xe6\\x96\\xb0\\xe7\\x89\\xb9\\xe6\\x80\\xa7/VendingMachine.sol\":203:540 function withdraw() public {\r... */\n jump\t// out\n /* \"#utility.yul\":7:125 */\n tag_13:\n /* \"#utility.yul\":94:118 */\n tag_15\n /* \"#utility.yul\":112:117 */\n dup2\n /* \"#utility.yul\":94:118 */\n tag_16\n jump\t// in\n tag_15:\n /* \"#utility.yul\":89:92 */\n dup3\n /* \"#utility.yul\":82:119 */\n mstore\n /* \"#utility.yul\":7:125 */\n pop\n pop\n jump\t// out\n /* \"#utility.yul\":131:353 */\n tag_9:\n /* \"#utility.yul\":224:228 */\n 0x00\n /* \"#utility.yul\":262:264 */\n 0x20\n /* \"#utility.yul\":251:260 */\n dup3\n /* \"#utility.yul\":247:265 */\n add\n /* \"#utility.yul\":239:265 */\n swap1\n pop\n /* \"#utility.yul\":275:346 */\n tag_18\n /* \"#utility.yul\":343:344 */\n 0x00\n /* \"#utility.yul\":332:341 */\n dup4\n /* \"#utility.yul\":328:345 */\n add\n /* \"#utility.yul\":319:325 */\n dup5\n /* \"#utility.yul\":275:346 */\n tag_13\n jump\t// in\n tag_18:\n /* \"#utility.yul\":131:353 */\n swap3\n swap2\n pop\n pop\n jump\t// out\n /* \"#utility.yul\":359:455 */\n tag_16:\n /* \"#utility.yul\":396:403 */\n 0x00\n /* \"#utility.yul\":425:449 */\n tag_20\n /* \"#utility.yul\":443:448 */\n dup3\n /* \"#utility.yul\":425:449 */\n tag_21\n jump\t// in\n tag_20:\n /* \"#utility.yul\":414:449 */\n swap1\n pop\n /* \"#utility.yul\":359:455 */\n swap2\n swap1\n pop\n jump\t// out\n /* \"#utility.yul\":461:587 */\n tag_21:\n /* \"#utility.yul\":498:505 */\n 0x00\n /* \"#utility.yul\":538:580 */\n 0xffffffffffffffffffffffffffffffffffffffff\n /* \"#utility.yul\":531:536 */\n dup3\n /* \"#utility.yul\":527:581 */\n and\n /* \"#utility.yul\":516:581 */\n swap1\n pop\n /* \"#utility.yul\":461:587 */\n swap2\n swap1\n pop\n jump\t// out\n\n auxdata: 0xa26469706673582212205924ac7f86e6df1bc3da8b037d2c1c5335fc2f637317796e3858b084cea8804464736f6c63430008070033\n}\n",
"bytecode": {
"functionDebugData": {},
"generatedSources": [],
"linkReferences": {},
"object": "6080604052336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555034801561005057600080fd5b506101c5806100606000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c80633ccfd60b14610030575b600080fd5b61003861003a565b005b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146100ca57336040517f8e4a23d60000000000000000000000000000000000000000000000000000000081526004016100c19190610142565b60405180910390fd5b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f19350505050158015610130573d6000803e3d6000fd5b50565b61013c8161015d565b82525050565b60006020820190506101576000830184610133565b92915050565b60006101688261016f565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff8216905091905056fea26469706673582212205924ac7f86e6df1bc3da8b037d2c1c5335fc2f637317796e3858b084cea8804464736f6c63430008070033",
"opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLER PUSH1 0x0 DUP1 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF MUL NOT AND SWAP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND MUL OR SWAP1 SSTORE POP CALLVALUE DUP1 ISZERO PUSH2 0x50 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1C5 DUP1 PUSH2 0x60 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN INVALID PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x4 CALLDATASIZE LT PUSH2 0x2B JUMPI PUSH1 0x0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x3CCFD60B EQ PUSH2 0x30 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x38 PUSH2 0x3A JUMP JUMPDEST STOP JUMPDEST PUSH1 0x0 DUP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ PUSH2 0xCA JUMPI CALLER PUSH1 0x40 MLOAD PUSH32 0x8E4A23D600000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xC1 SWAP2 SWAP1 PUSH2 0x142 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x0 DUP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH2 0x8FC SELFBALANCE SWAP1 DUP2 ISZERO MUL SWAP1 PUSH1 0x40 MLOAD PUSH1 0x0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 DUP6 DUP9 DUP9 CALL SWAP4 POP POP POP POP ISZERO DUP1 ISZERO PUSH2 0x130 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP JUMP JUMPDEST PUSH2 0x13C DUP2 PUSH2 0x15D JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP PUSH2 0x157 PUSH1 0x0 DUP4 ADD DUP5 PUSH2 0x133 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x168 DUP3 PUSH2 0x16F JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND SWAP1 POP SWAP2 SWAP1 POP JUMP INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 MSIZE 0x24 0xAC PUSH32 0x86E6DF1BC3DA8B037D2C1C5335FC2F637317796E3858B084CEA8804464736F6C PUSH4 0x43000807 STOP CALLER ",
"sourceMap": "77:466:0:-:0;;;140:10;108:43;;;;;;;;;;;;;;;;;;;;77:466;;;;;;;;;;;;;;;;"
},
"deployedBytecode": {
"functionDebugData": {
"@withdraw_36": {
"entryPoint": 58,
"id": 36,
"parameterSlots": 0,
"returnSlots": 0
},
"abi_encode_t_address_to_t_address_fromStack": {
"entryPoint": 307,
"id": null,
"parameterSlots": 2,
"returnSlots": 0
},
"abi_encode_tuple_t_address__to_t_address__fromStack_reversed": {
"entryPoint": 322,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"cleanup_t_address": {
"entryPoint": 349,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"cleanup_t_uint160": {
"entryPoint": 367,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
}
},
"generatedSources": [
{
"ast": {
"nodeType": "YulBlock",
"src": "0:590: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_address",
"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_address_to_t_address_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_address_to_t_address_fromStack",
"nodeType": "YulIdentifier",
"src": "275:43:1"
},
"nodeType": "YulFunctionCall",
"src": "275:71:1"
},
"nodeType": "YulExpressionStatement",
"src": "275:71:1"
}
]
},
"name": "abi_encode_tuple_t_address__to_t_address__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:51:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "414:35:1",
"value": {
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "443:5:1"
}
],
"functionName": {
"name": "cleanup_t_uint160",
"nodeType": "YulIdentifier",
"src": "425:17:1"
},
"nodeType": "YulFunctionCall",
"src": "425:24:1"
},
"variableNames": [
{
"name": "cleaned",
"nodeType": "YulIdentifier",
"src": "414:7:1"
}
]
}
]
},
"name": "cleanup_t_address",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "386:5:1",
"type": ""
}
],
"returnVariables": [
{
"name": "cleaned",
"nodeType": "YulTypedName",
"src": "396:7:1",
"type": ""
}
],
"src": "359:96:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "506:81:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "516:65:1",
"value": {
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "531:5:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "538:42:1",
"type": "",
"value": "0xffffffffffffffffffffffffffffffffffffffff"
}
],
"functionName": {
"name": "and",
"nodeType": "YulIdentifier",
"src": "527:3:1"
},
"nodeType": "YulFunctionCall",
"src": "527:54:1"
},
"variableNames": [
{
"name": "cleaned",
"nodeType": "YulIdentifier",
"src": "516:7:1"
}
]
}
]
},
"name": "cleanup_t_uint160",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "488:5:1",
"type": ""
}
],
"returnVariables": [
{
"name": "cleaned",
"nodeType": "YulTypedName",
"src": "498:7:1",
"type": ""
}
],
"src": "461:126:1"
}
]
},
"contents": "{\n\n function abi_encode_t_address_to_t_address_fromStack(value, pos) {\n mstore(pos, cleanup_t_address(value))\n }\n\n function abi_encode_tuple_t_address__to_t_address__fromStack_reversed(headStart , value0) -> tail {\n tail := add(headStart, 32)\n\n abi_encode_t_address_to_t_address_fromStack(value0, add(headStart, 0))\n\n }\n\n function cleanup_t_address(value) -> cleaned {\n cleaned := cleanup_t_uint160(value)\n }\n\n function cleanup_t_uint160(value) -> cleaned {\n cleaned := and(value, 0xffffffffffffffffffffffffffffffffffffffff)\n }\n\n}\n",
"id": 1,
"language": "Yul",
"name": "#utility.yul"
}
],
"immutableReferences": {},
"linkReferences": {},
"object": "608060405234801561001057600080fd5b506004361061002b5760003560e01c80633ccfd60b14610030575b600080fd5b61003861003a565b005b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146100ca57336040517f8e4a23d60000000000000000000000000000000000000000000000000000000081526004016100c19190610142565b60405180910390fd5b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f19350505050158015610130573d6000803e3d6000fd5b50565b61013c8161015d565b82525050565b60006020820190506101576000830184610133565b92915050565b60006101688261016f565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff8216905091905056fea26469706673582212205924ac7f86e6df1bc3da8b037d2c1c5335fc2f637317796e3858b084cea8804464736f6c63430008070033",
"opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x4 CALLDATASIZE LT PUSH2 0x2B JUMPI PUSH1 0x0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x3CCFD60B EQ PUSH2 0x30 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x38 PUSH2 0x3A JUMP JUMPDEST STOP JUMPDEST PUSH1 0x0 DUP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ PUSH2 0xCA JUMPI CALLER PUSH1 0x40 MLOAD PUSH32 0x8E4A23D600000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xC1 SWAP2 SWAP1 PUSH2 0x142 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x0 DUP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH2 0x8FC SELFBALANCE SWAP1 DUP2 ISZERO MUL SWAP1 PUSH1 0x40 MLOAD PUSH1 0x0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 DUP6 DUP9 DUP9 CALL SWAP4 POP POP POP POP ISZERO DUP1 ISZERO PUSH2 0x130 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP JUMP JUMPDEST PUSH2 0x13C DUP2 PUSH2 0x15D JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP PUSH2 0x157 PUSH1 0x0 DUP4 ADD DUP5 PUSH2 0x133 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x168 DUP3 PUSH2 0x16F JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND SWAP1 POP SWAP2 SWAP1 POP JUMP INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 MSIZE 0x24 0xAC PUSH32 0x86E6DF1BC3DA8B037D2C1C5335FC2F637317796E3858B084CEA8804464736F6C PUSH4 0x43000807 STOP CALLER ",
"sourceMap": "77:466:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;203:337;;;:::i;:::-;;;259:5;;;;;;;;;;245:19;;:10;:19;;;241:231;;461:10;448:24;;;;;;;;;;;:::i;:::-;;;;;;;;241:231;495:5;;;;;;;;;;:14;;:37;510:21;495:37;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;203:337::o;7:118:1:-;94:24;112:5;94:24;:::i;:::-;89:3;82:37;7:118;;:::o;131:222::-;224:4;262:2;251:9;247:18;239:26;;275:71;343:1;332:9;328:17;319:6;275:71;:::i;:::-;131:222;;;;:::o;359:96::-;396:7;425:24;443:5;425:24;:::i;:::-;414:35;;359:96;;;:::o;461:126::-;498:7;538:42;531:5;527:54;516:65;;461:126;;;:::o"
},
"gasEstimates": {
"creation": {
"codeDepositCost": "90600",
"executionCost": "24407",
"totalCost": "115007"
},
"external": {
"withdraw()": "infinite"
}
},
"legacyAssembly": {
".code": [
{
"begin": 77,
"end": 543,
"name": "PUSH",
"source": 0,
"value": "80"
},
{
"begin": 77,
"end": 543,
"name": "PUSH",
"source": 0,
"value": "40"
},
{
"begin": 77,
"end": 543,
"name": "MSTORE",
"source": 0
},
{
"begin": 140,
"end": 150,
"name": "CALLER",
"source": 0
},
{
"begin": 108,
"end": 151,
"name": "PUSH",
"source": 0,
"value": "0"
},
{
"begin": 108,
"end": 151,
"name": "DUP1",
"source": 0
},
{
"begin": 108,
"end": 151,
"name": "PUSH",
"source": 0,
"value": "100"
},
{
"begin": 108,
"end": 151,
"name": "EXP",
"source": 0
},
{
"begin": 108,
"end": 151,
"name": "DUP2",
"source": 0
},
{
"begin": 108,
"end": 151,
"name": "SLOAD",
"source": 0
},
{
"begin": 108,
"end": 151,
"name": "DUP2",
"source": 0
},
{
"begin": 108,
"end": 151,
"name": "PUSH",
"source": 0,
"value": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
},
{
"begin": 108,
"end": 151,
"name": "MUL",
"source": 0
},
{
"begin": 108,
"end": 151,
"name": "NOT",
"source": 0
},
{
"begin": 108,
"end": 151,
"name": "AND",
"source": 0
},
{
"begin": 108,
"end": 151,
"name": "SWAP1",
"source": 0
},
{
"begin": 108,
"end": 151,
"name": "DUP4",
"source": 0
},
{
"begin": 108,
"end": 151,
"name": "PUSH",
"source": 0,
"value": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
},
{
"begin": 108,
"end": 151,
"name": "AND",
"source": 0
},
{
"begin": 108,
"end": 151,
"name": "MUL",
"source": 0
},
{
"begin": 108,
"end": 151,
"name": "OR",
"source": 0
},
{
"begin": 108,
"end": 151,
"name": "SWAP1",
"source": 0
},
{
"begin": 108,
"end": 151,
"name": "SSTORE",
"source": 0
},
{
"begin": 108,
"end": 151,
"name": "POP",
"source": 0
},
{
"begin": 77,
"end": 543,
"name": "CALLVALUE",
"source": 0
},
{
"begin": 77,
"end": 543,
"name": "DUP1",
"source": 0
},
{
"begin": 77,
"end": 543,
"name": "ISZERO",
"source": 0
},
{
"begin": 77,
"end": 543,
"name": "PUSH [tag]",
"source": 0,
"value": "1"
},
{
"begin": 77,
"end": 543,
"name": "JUMPI",
"source": 0
},
{
"begin": 77,
"end": 543,
"name": "PUSH",
"source": 0,
"value": "0"
},
{
"begin": 77,
"end": 543,
"name": "DUP1",
"source": 0
},
{
"begin": 77,
"end": 543,
"name": "REVERT",
"source": 0
},
{
"begin": 77,
"end": 543,
"name": "tag",
"source": 0,
"value": "1"
},
{
"begin": 77,
"end": 543,
"name": "JUMPDEST",
"source": 0
},
{
"begin": 77,
"end": 543,
"name": "POP",
"source": 0
},
{
"begin": 77,
"end": 543,
"name": "PUSH #[$]",
"source": 0,
"value": "0000000000000000000000000000000000000000000000000000000000000000"
},
{
"begin": 77,
"end": 543,
"name": "DUP1",
"source": 0
},
{
"begin": 77,
"end": 543,
"name": "PUSH [$]",
"source": 0,
"value": "0000000000000000000000000000000000000000000000000000000000000000"
},
{
"begin": 77,
"end": 543,
"name": "PUSH",
"source": 0,
"value": "0"
},
{
"begin": 77,
"end": 543,
"name": "CODECOPY",
"source": 0
},
{
"begin": 77,
"end": 543,
"name": "PUSH",
"source": 0,
"value": "0"
},
{
"begin": 77,
"end": 543,
"name": "RETURN",
"source": 0
}
],
".data": {
"0": {
".auxdata": "a26469706673582212205924ac7f86e6df1bc3da8b037d2c1c5335fc2f637317796e3858b084cea8804464736f6c63430008070033",
".code": [
{
"begin": 77,
"end": 543,
"name": "PUSH",
"source": 0,
"value": "80"
},
{
"begin": 77,
"end": 543,
"name": "PUSH",
"source": 0,
"value": "40"
},
{
"begin": 77,
"end": 543,
"name": "MSTORE",
"source": 0
},
{
"begin": 77,
"end": 543,
"name": "CALLVALUE",
"source": 0
},
{
"begin": 77,
"end": 543,
"name": "DUP1",
"source": 0
},
{
"begin": 77,
"end": 543,
"name": "ISZERO",
"source": 0
},
{
"begin": 77,
"end": 543,
"name": "PUSH [tag]",
"source": 0,
"value": "1"
},
{
"begin": 77,
"end": 543,
"name": "JUMPI",
"source": 0
},
{
"begin": 77,
"end": 543,
"name": "PUSH",
"source": 0,
"value": "0"
},
{
"begin": 77,
"end": 543,
"name": "DUP1",
"source": 0
},
{
"begin": 77,
"end": 543,
"name": "REVERT",
"source": 0
},
{
"begin": 77,
"end": 543,
"name": "tag",
"source": 0,
"value": "1"
},
{
"begin": 77,
"end": 543,
"name": "JUMPDEST",
"source": 0
},
{
"begin": 77,
"end": 543,
"name": "POP",
"source": 0
},
{
"begin": 77,
"end": 543,
"name": "PUSH",
"source": 0,
"value": "4"
},
{
"begin": 77,
"end": 543,
"name": "CALLDATASIZE",
"source": 0
},
{
"begin": 77,
"end": 543,
"name": "LT",
"source": 0
},
{
"begin": 77,
"end": 543,
"name": "PUSH [tag]",
"source": 0,
"value": "2"
},
{
"begin": 77,
"end": 543,
"name": "JUMPI",
"source": 0
},
{
"begin": 77,
"end": 543,
"name": "PUSH",
"source": 0,
"value": "0"
},
{
"begin": 77,
"end": 543,
"name": "CALLDATALOAD",
"source": 0
},
{
"begin": 77,
"end": 543,
"name": "PUSH",
"source": 0,
"value": "E0"
},
{
"begin": 77,
"end": 543,
"name": "SHR",
"source": 0
},
{
"begin": 77,
"end": 543,
"name": "DUP1",
"source": 0
},
{
"begin": 77,
"end": 543,
"name": "PUSH",
"source": 0,
"value": "3CCFD60B"
},
{
"begin": 77,
"end": 543,
"name": "EQ",
"source": 0
},
{
"begin": 77,
"end": 543,
"name": "PUSH [tag]",
"source": 0,
"value": "3"
},
{
"begin": 77,
"end": 543,
"name": "JUMPI",
"source": 0
},
{
"begin": 77,
"end": 543,
"name": "tag",
"source": 0,
"value": "2"
},
{
"begin": 77,
"end": 543,
"name": "JUMPDEST",
"source": 0
},
{
"begin": 77,
"end": 543,
"name": "PUSH",
"source": 0,
"value": "0"
},
{
"begin": 77,
"end": 543,
"name": "DUP1",
"source": 0
},
{
"begin": 77,
"end": 543,
"name": "REVERT",
"source": 0
},
{
"begin": 203,
"end": 540,
"name": "tag",
"source": 0,
"value": "3"
},
{
"begin": 203,
"end": 540,
"name": "JUMPDEST",
"source": 0
},
{
"begin": 203,
"end": 540,
"name": "PUSH [tag]",
"source": 0,
"value": "4"
},
{
"begin": 203,
"end": 540,
"name": "PUSH [tag]",
"source": 0,
"value": "5"
},
{
"begin": 203,
"end": 540,
"name": "JUMP",
"source": 0,
"value": "[in]"
},
{
"begin": 203,
"end": 540,
"name": "tag",
"source": 0,
"value": "4"
},
{
"begin": 203,
"end": 540,
"name": "JUMPDEST",
"source": 0
},
{
"begin": 203,
"end": 540,
"name": "STOP",
"source": 0
},
{
"begin": 203,
"end": 540,
"name": "tag",
"source": 0,
"value": "5"
},
{
"begin": 203,
"end": 540,
"name": "JUMPDEST",
"source": 0
},
{
"begin": 259,
"end": 264,
"name": "PUSH",
"source": 0,
"value": "0"
},
{
"begin": 259,
"end": 264,
"name": "DUP1",
"source": 0
},
{
"begin": 259,
"end": 264,
"name": "SLOAD",
"source": 0
},
{
"begin": 259,
"end": 264,
"name": "SWAP1",
"source": 0
},
{
"begin": 259,
"end": 264,
"name": "PUSH",
"source": 0,
"value": "100"
},
{
"begin": 259,
"end": 264,
"name": "EXP",
"source": 0
},
{
"begin": 259,
"end": 264,
"name": "SWAP1",
"source": 0
},
{
"begin": 259,
"end": 264,
"name": "DIV",
"source": 0
},
{
"begin": 259,
"end": 264,
"name": "PUSH",
"source": 0,
"value": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
},
{
"begin": 259,
"end": 264,
"name": "AND",
"source": 0
},
{
"begin": 245,
"end": 264,
"name": "PUSH",
"source": 0,
"value": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
},
{
"begin": 245,
"end": 264,
"name": "AND",
"source": 0
},
{
"begin": 245,
"end": 255,
"name": "CALLER",
"source": 0
},
{
"begin": 245,
"end": 264,
"name": "PUSH",
"source": 0,
"value": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
},
{
"begin": 245,
"end": 264,
"name": "AND",
"source": 0
},
{
"begin": 245,
"end": 264,
"name": "EQ",
"source": 0
},
{
"begin": 241,
"end": 472,
"name": "PUSH [tag]",
"source": 0,
"value": "7"
},
{
"begin": 241,
"end": 472,
"name": "JUMPI",
"source": 0
},
{
"begin": 461,
"end": 471,
"name": "CALLER",
"source": 0
},
{
"begin": 448,
"end": 472,
"name": "PUSH",
"source": 0,
"value": "40"
},
{
"begin": 448,
"end": 472,
"name": "MLOAD",
"source": 0
},
{
"begin": 448,
"end": 472,
"name": "PUSH",
"source": 0,
"value": "8E4A23D600000000000000000000000000000000000000000000000000000000"
},
{
"begin": 448,
"end": 472,
"name": "DUP2",
"source": 0
},
{
"begin": 448,
"end": 472,
"name": "MSTORE",
"source": 0
},
{
"begin": 448,
"end": 472,
"name": "PUSH",
"source": 0,
"value": "4"
},
{
"begin": 448,
"end": 472,
"name": "ADD",
"source": 0
},
{
"begin": 448,
"end": 472,
"name": "PUSH [tag]",
"source": 0,
"value": "8"
},
{
"begin": 448,
"end": 472,
"name": "SWAP2",
"source": 0
},
{
"begin": 448,
"end": 472,
"name": "SWAP1",
"source": 0
},
{
"begin": 448,
"end": 472,
"name": "PUSH [tag]",
"source": 0,
"value": "9"
},
{
"begin": 448,
"end": 472,
"name": "JUMP",
"source": 0,
"value": "[in]"
},
{
"begin": 448,
"end": 472,
"name": "tag",
"source": 0,
"value": "8"
},
{
"begin": 448,
"end": 472,
"name": "JUMPDEST",
"source": 0
},
{
"begin": 448,
"end": 472,
"name": "PUSH",
"source": 0,
"value": "40"
},
{
"begin": 448,
"end": 472,
"name": "MLOAD",
"source": 0
},
{
"begin": 448,
"end": 472,
"name": "DUP1",
"source": 0
},
{
"begin": 448,
"end": 472,
"name": "SWAP2",
"source": 0
},
{
"begin": 448,
"end": 472,
"name": "SUB",
"source": 0
},
{
"begin": 448,
"end": 472,
"name": "SWAP1",
"source": 0
},
{
"begin": 448,
"end": 472,
"name": "REVERT",
"source": 0
},
{
"begin": 241,
"end": 472,
"name": "tag",
"source": 0,
"value": "7"
},
{
"begin": 241,
"end": 472,
"name": "JUMPDEST",
"source": 0
},
{
"begin": 495,
"end": 500,
"name": "PUSH",
"source": 0,
"value": "0"
},
{
"begin": 495,
"end": 500,
"name": "DUP1",
"source": 0
},
{
"begin": 495,
"end": 500,
"name": "SLOAD",
"source": 0
},
{
"begin": 495,
"end": 500,
"name": "SWAP1",
"source": 0
},
{
"begin": 495,
"end": 500,
"name": "PUSH",
"source": 0,
"value": "100"
},
{
"begin": 495,
"end": 500,
"name": "EXP",
"source": 0
},
{
"begin": 495,
"end": 500,
"name": "SWAP1",
"source": 0
},
{
"begin": 495,
"end": 500,
"name": "DIV",
"source": 0
},
{
"begin": 495,
"end": 500,
"name": "PUSH",
"source": 0,
"value": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
},
{
"begin": 495,
"end": 500,
"name": "AND",
"source": 0
},
{
"begin": 495,
"end": 509,
"name": "PUSH",
"source": 0,
"value": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
},
{
"begin": 495,
"end": 509,
"name": "AND",
"source": 0
},
{
"begin": 495,
"end": 532,
"name": "PUSH",
"source": 0,
"value": "8FC"
},
{
"begin": 510,
"end": 531,
"name": "SELFBALANCE",
"source": 0
},
{
"begin": 495,
"end": 532,
"name": "SWAP1",
"source": 0
},
{
"begin": 495,
"end": 532,
"name": "DUP2",
"source": 0
},
{
"begin": 495,
"end": 532,
"name": "ISZERO",
"source": 0
},
{
"begin": 495,
"end": 532,
"name": "MUL",
"source": 0
},
{
"begin": 495,
"end": 532,
"name": "SWAP1",
"source": 0
},
{
"begin": 495,
"end": 532,
"name": "PUSH",
"source": 0,
"value": "40"
},
{
"begin": 495,
"end": 532,
"name": "MLOAD",
"source": 0
},
{
"begin": 495,
"end": 532,
"name": "PUSH",
"source": 0,
"value": "0"
},
{
"begin": 495,
"end": 532,
"name": "PUSH",
"source": 0,
"value": "40"
},
{
"begin": 495,
"end": 532,
"name": "MLOAD",
"source": 0
},
{
"begin": 495,
"end": 532,
"name": "DUP1",
"source": 0
},
{
"begin": 495,
"end": 532,
"name": "DUP4",
"source": 0
},
{
"begin": 495,
"end": 532,
"name": "SUB",
"source": 0
},
{
"begin": 495,
"end": 532,
"name": "DUP2",
"source": 0
},
{
"begin": 495,
"end": 532,
"name": "DUP6",
"source": 0
},
{
"begin": 495,
"end": 532,
"name": "DUP9",
"source": 0
},
{
"begin": 495,
"end": 532,
"name": "DUP9",
"source": 0
},
{
"begin": 495,
"end": 532,
"name": "CALL",
"source": 0
},
{
"begin": 495,
"end": 532,
"name": "SWAP4",
"source": 0
},
{
"begin": 495,
"end": 532,
"name": "POP",
"source": 0
},
{
"begin": 495,
"end": 532,
"name": "POP",
"source": 0
},
{
"begin": 495,
"end": 532,
"name": "POP",
"source": 0
},
{
"begin": 495,
"end": 532,
"name": "POP",
"source": 0
},
{
"begin": 495,
"end": 532,
"name": "ISZERO",
"source": 0
},
{
"begin": 495,
"end": 532,
"name": "DUP1",
"source": 0
},
{
"begin": 495,
"end": 532,
"name": "ISZERO",
"source": 0
},
{
"begin": 495,
"end": 532,
"name": "PUSH [tag]",
"source": 0,
"value": "11"
},
{
"begin": 495,
"end": 532,
"name": "JUMPI",
"source": 0
},
{
"begin": 495,
"end": 532,
"name": "RETURNDATASIZE",
"source": 0
},
{
"begin": 495,
"end": 532,
"name": "PUSH",
"source": 0,
"value": "0"
},
{
"begin": 495,
"end": 532,
"name": "DUP1",
"source": 0
},
{
"begin": 495,
"end": 532,
"name": "RETURNDATACOPY",
"source": 0
},
{
"begin": 495,
"end": 532,
"name": "RETURNDATASIZE",
"source": 0
},
{
"begin": 495,
"end": 532,
"name": "PUSH",
"source": 0,
"value": "0"
},
{
"begin": 495,
"end": 532,
"name": "REVERT",
"source": 0
},
{
"begin": 495,
"end": 532,
"name": "tag",
"source": 0,
"value": "11"
},
{
"begin": 495,
"end": 532,
"name": "JUMPDEST",
"source": 0
},
{
"begin": 495,
"end": 532,
"name": "POP",
"source": 0
},
{
"begin": 203,
"end": 540,
"name": "JUMP",
"source": 0,
"value": "[out]"
},
{
"begin": 7,
"end": 125,
"name": "tag",
"source": 1,
"value": "13"
},
{
"begin": 7,
"end": 125,
"name": "JUMPDEST",
"source": 1
},
{
"begin": 94,
"end": 118,
"name": "PUSH [tag]",
"source": 1,
"value": "15"
},
{
"begin": 112,
"end": 117,
"name": "DUP2",
"source": 1
},
{
"begin": 94,
"end": 118,
"name": "PUSH [tag]",
"source": 1,
"value": "16"
},
{
"begin": 94,
"end": 118,
"name": "JUMP",
"source": 1,
"value": "[in]"
},
{
"begin": 94,
"end": 118,
"name": "tag",
"source": 1,
"value": "15"
},
{
"begin": 94,
"end": 118,
"name": "JUMPDEST",
"source": 1
},
{
"begin": 89,
"end": 92,
"name": "DUP3",
"source": 1
},
{
"begin": 82,
"end": 119,
"name": "MSTORE",
"source": 1
},
{
"begin": 7,
"end": 125,
"name": "POP",
"source": 1
},
{
"begin": 7,
"end": 125,
"name": "POP",
"source": 1
},
{
"begin": 7,
"end": 125,
"name": "JUMP",
"source": 1,
"value": "[out]"
},
{
"begin": 131,
"end": 353,
"name": "tag",
"source": 1,
"value": "9"
},
{
"begin": 131,
"end": 353,
"name": "JUMPDEST",
"source": 1
},
{
"begin": 224,
"end": 228,
"name": "PUSH",
"source": 1,
"value": "0"
},
{
"begin": 262,
"end": 264,
"name": "PUSH",
"source": 1,
"value": "20"
},
{
"begin": 251,
"end": 260,
"name": "DUP3",
"source": 1
},
{
"begin": 247,
"end": 265,
"name": "ADD",
"source": 1
},
{
"begin": 239,
"end": 265,
"name": "SWAP1",
"source": 1
},
{
"begin": 239,
"end": 265,
"name": "POP",
"source": 1
},
{
"begin": 275,
"end": 346,
"name": "PUSH [tag]",
"source": 1,
"value": "18"
},
{
"begin": 343,
"end": 344,
"name": "PUSH",
"source": 1,
"value": "0"
},
{
"begin": 332,
"end": 341,
"name": "DUP4",
"source": 1
},
{
"begin": 328,
"end": 345,
"name": "ADD",
"source": 1
},
{
"begin": 319,
"end": 325,
"name": "DUP5",
"source": 1
},
{
"begin": 275,
"end": 346,
"name": "PUSH [tag]",
"source": 1,
"value": "13"
},
{
"begin": 275,
"end": 346,
"name": "JUMP",
"source": 1,
"value": "[in]"
},
{
"begin": 275,
"end": 346,
"name": "tag",
"source": 1,
"value": "18"
},
{
"begin": 275,
"end": 346,
"name": "JUMPDEST",
"source": 1
},
{
"begin": 131,
"end": 353,
"name": "SWAP3",
"source": 1
},
{
"begin": 131,
"end": 353,
"name": "SWAP2",
"source": 1
},
{
"begin": 131,
"end": 353,
"name": "POP",
"source": 1
},
{
"begin": 131,
"end": 353,
"name": "POP",
"source": 1
},
{
"begin": 131,
"end": 353,
"name": "JUMP",
"source": 1,
"value": "[out]"
},
{
"begin": 359,
"end": 455,
"name": "tag",
"source": 1,
"value": "16"
},
{
"begin": 359,
"end": 455,
"name": "JUMPDEST",
"source": 1
},
{
"begin": 396,
"end": 403,
"name": "PUSH",
"source": 1,
"value": "0"
},
{
"begin": 425,
"end": 449,
"name": "PUSH [tag]",
"source": 1,
"value": "20"
},
{
"begin": 443,
"end": 448,
"name": "DUP3",
"source": 1
},
{
"begin": 425,
"end": 449,
"name": "PUSH [tag]",
"source": 1,
"value": "21"
},
{
"begin": 425,
"end": 449,
"name": "JUMP",
"source": 1,
"value": "[in]"
},
{
"begin": 425,
"end": 449,
"name": "tag",
"source": 1,
"value": "20"
},
{
"begin": 425,
"end": 449,
"name": "JUMPDEST",
"source": 1
},
{
"begin": 414,
"end": 449,
"name": "SWAP1",
"source": 1
},
{
"begin": 414,
"end": 449,
"name": "POP",
"source": 1
},
{
"begin": 359,
"end": 455,
"name": "SWAP2",
"source": 1
},
{
"begin": 359,
"end": 455,
"name": "SWAP1",
"source": 1
},
{
"begin": 359,
"end": 455,
"name": "POP",
"source": 1
},
{
"begin": 359,
"end": 455,
"name": "JUMP",
"source": 1,
"value": "[out]"
},
{
"begin": 461,
"end": 587,
"name": "tag",
"source": 1,
"value": "21"
},
{
"begin": 461,
"end": 587,
"name": "JUMPDEST",
"source": 1
},
{
"begin": 498,
"end": 505,
"name": "PUSH",
"source": 1,
"value": "0"
},
{
"begin": 538,
"end": 580,
"name": "PUSH",
"source": 1,
"value": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
},
{
"begin": 531,
"end": 536,
"name": "DUP3",
"source": 1
},
{
"begin": 527,
"end": 581,
"name": "AND",
"source": 1
},
{
"begin": 516,
"end": 581,
"name": "SWAP1",
"source": 1
},
{
"begin": 516,
"end": 581,
"name": "POP",
"source": 1
},
{
"begin": 461,
"end": 587,
"name": "SWAP2",
"source": 1
},
{
"begin": 461,
"end": 587,
"name": "SWAP1",
"source": 1
},
{
"begin": 461,
"end": 587,
"name": "POP",
"source": 1
},
{
"begin": 461,
"end": 587,
"name": "JUMP",
"source": 1,
"value": "[out]"
}
]
}
}
},
"methodIdentifiers": {
"withdraw()": "3ccfd60b"
}
},
"metadata": "{\"compiler\":{\"version\":\"0.8.7+commit.e28d00a7\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"}],\"name\":\"Unauthorized\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"withdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/01.Solidity-8.0\\u65b0\\u7279\\u6027/VendingMachine.sol\":\"VendingMachine\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/01.Solidity-8.0\\u65b0\\u7279\\u6027/VendingMachine.sol\":{\"keccak256\":\"0x45d31ede5f97f9c55addc6609cca0a5ce2e545e1673632406a668b40ce0e7f3f\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://78014aaf82f64236f84ae8a04102ad463378e02979468e3738595b5c4e8a1ba2\",\"dweb:/ipfs/QmWNYq5cwXvaN54zepL8J8yBqXGNmQ3TLksxjJmS5Twj6F\"]}},\"version\":1}",
"storageLayout": {
"storage": [
{
"astId": 8,
"contract": "contracts/01.Solidity-8.0新特性/VendingMachine.sol:VendingMachine",
"label": "owner",
"offset": 0,
"slot": "0",
"type": "t_address_payable"
}
],
"types": {
"t_address_payable": {
"encoding": "inplace",
"label": "address payable",
"numberOfBytes": "20"
}
}
},
"userdoc": {
"kind": "user",
"methods": {},
"version": 1
}
}
}
},
"sources": {
"contracts/01.Solidity-8.0新特性/VendingMachine.sol": {
"ast": {
"absolutePath": "contracts/01.Solidity-8.0新特性/VendingMachine.sol",
"exportedSymbols": {
"VendingMachine": [
37
]
},
"id": 38,
"license": "MIT",
"nodeType": "SourceUnit",
"nodes": [
{
"id": 1,
"literals": [
"solidity",
"^",
"0.8"
],
"nodeType": "PragmaDirective",
"src": "33:21:0"
},
{
"abstract": false,
"baseContracts": [],
"contractDependencies": [],
"contractKind": "contract",
"fullyImplemented": true,
"id": 37,
"linearizedBaseContracts": [
37
],
"name": "VendingMachine",
"nameLocation": "86:14:0",
"nodeType": "ContractDefinition",
"nodes": [
{
"constant": false,
"id": 8,
"mutability": "mutable",
"name": "owner",
"nameLocation": "124:5:0",
"nodeType": "VariableDeclaration",
"scope": 37,
"src": "108:43:0",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
},
"typeName": {
"id": 2,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "108:15:0",
"stateMutability": "payable",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"value": {
"arguments": [
{
"expression": {
"id": 5,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4294967281,
"src": "140:3:0",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 6,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"src": "140:10:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 4,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "132:8:0",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_payable_$",
"typeString": "type(address payable)"
},
"typeName": {
"id": 3,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "132:8:0",
"stateMutability": "payable",
"typeDescriptions": {}
}
},
"id": 7,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "132:19:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"visibility": "internal"
},
{
"id": 12,
"name": "Unauthorized",
"nameLocation": "166:12:0",
"nodeType": "ErrorDefinition",
"parameters": {
"id": 11,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 10,
"mutability": "mutable",
"name": "caller",
"nameLocation": "187:6:0",
"nodeType": "VariableDeclaration",
"scope": 12,
"src": "179:14:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 9,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "179:7:0",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
}
],
"src": "178:16:0"
},
"src": "160:35:0"
},
{
"body": {
"id": 35,
"nodeType": "Block",
"src": "230:310:0",
"statements": [
{
"condition": {
"commonType": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"id": 18,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"expression": {
"id": 15,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4294967281,
"src": "245:3:0",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 16,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"src": "245:10:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "BinaryOperation",
"operator": "!=",
"rightExpression": {
"id": 17,
"name": "owner",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 8,
"src": "259:5:0",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"src": "245:19:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"id": 24,
"nodeType": "IfStatement",
"src": "241:231:0",
"trueBody": {
"errorCall": {
"arguments": [
{
"expression": {
"id": 20,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4294967281,
"src": "461:3:0",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 21,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"src": "461:10:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 19,
"name": "Unauthorized",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 12,
"src": "448:12:0",
"typeDescriptions": {
"typeIdentifier": "t_function_error_pure$_t_address_$returns$__$",
"typeString": "function (address) pure"
}
},
"id": 22,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "448:24:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 23,
"nodeType": "RevertStatement",
"src": "441:31:0"
}
},
{
"expression": {
"arguments": [
{
"expression": {
"arguments": [
{
"id": 30,
"name": "this",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4294967268,
"src": "518:4:0",
"typeDescriptions": {
"typeIdentifier": "t_contract$_VendingMachine_$37",
"typeString": "contract VendingMachine"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_VendingMachine_$37",
"typeString": "contract VendingMachine"
}
],
"id": 29,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "510:7:0",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": {
"id": 28,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "510:7:0",
"typeDescriptions": {}
}
},
"id": 31,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "510:13:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"id": 32,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "balance",
"nodeType": "MemberAccess",
"src": "510:21:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"expression": {
"id": 25,
"name": "owner",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 8,
"src": "495:5:0",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"id": 27,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "transfer",
"nodeType": "MemberAccess",
"src": "495:14:0",
"typeDescriptions": {
"typeIdentifier": "t_function_transfer_nonpayable$_t_uint256_$returns$__$",
"typeString": "function (uint256)"
}
},
"id": 33,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "495:37:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 34,
"nodeType": "ExpressionStatement",
"src": "495:37:0"
}
]
},
"functionSelector": "3ccfd60b",
"id": 36,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "withdraw",
"nameLocation": "212:8:0",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 13,
"nodeType": "ParameterList",
"parameters": [],
"src": "220:2:0"
},
"returnParameters": {
"id": 14,
"nodeType": "ParameterList",
"parameters": [],
"src": "230:0:0"
},
"scope": 37,
"src": "203:337:0",
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "public"
}
],
"scope": 38,
"src": "77:466:0",
"usedErrors": [
12
]
}
],
"src": "33:510:0"
},
"id": 0
}
}
}
}
{
"id": "f8c6c533db4a1b6c98f2424a51707b2b",
"_format": "hh-sol-build-info-1",
"solcVersion": "0.8.7",
"solcLongVersion": "0.8.7+commit.e28d00a7",
"input": {
"language": "Solidity",
"sources": {
"contracts/01.Solidity-8.0新特性/Sol.sol": {
"content": "// SPDX-License-Identifier: MIT\r\npragma solidity ^0.8;\r\n\r\n// safe math\r\ncontract SafeMath {\r\n function testUnderflow() public pure returns (uint) {\r\n uint x = 0;\r\n x--;\r\n return x;\r\n }\r\n\r\n // 不检查时会得到一个溢出的是结果,uint 最大值\r\n function testUncheckedUnderflow() public pure returns (uint) {\r\n uint x = 0;\r\n unchecked { x--; }\r\n return x;\r\n }\r\n}"
}
},
"settings": {
"optimizer": {
"enabled": false,
"runs": 200
},
"outputSelection": {
"*": {
"": [
"ast"
],
"*": [
"abi",
"metadata",
"devdoc",
"userdoc",
"storageLayout",
"evm.legacyAssembly",
"evm.bytecode",
"evm.deployedBytecode",
"evm.methodIdentifiers",
"evm.gasEstimates",
"evm.assembly"
]
}
}
}
},
"output": {
"contracts": {
"contracts/01.Solidity-8.0新特性/Sol.sol": {
"SafeMath": {
"abi": [
{
"inputs": [],
"name": "testUncheckedUnderflow",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [],
"name": "testUnderflow",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "pure",
"type": "function"
}
],
"devdoc": {
"kind": "dev",
"methods": {},
"version": 1
},
"evm": {
"assembly": " /* \"contracts/01.Solidity-8.0\\xe6\\x96\\xb0\\xe7\\x89\\xb9\\xe6\\x80\\xa7/Sol.sol\":72:430 contract SafeMath {\r... */\n mstore(0x40, 0x80)\n callvalue\n dup1\n iszero\n tag_1\n jumpi\n 0x00\n dup1\n revert\ntag_1:\n pop\n dataSize(sub_0)\n dup1\n dataOffset(sub_0)\n 0x00\n codecopy\n 0x00\n return\nstop\n\nsub_0: assembly {\n /* \"contracts/01.Solidity-8.0\\xe6\\x96\\xb0\\xe7\\x89\\xb9\\xe6\\x80\\xa7/Sol.sol\":72:430 contract SafeMath {\r... */\n mstore(0x40, 0x80)\n callvalue\n dup1\n iszero\n tag_1\n jumpi\n 0x00\n dup1\n revert\n tag_1:\n pop\n jumpi(tag_2, lt(calldatasize, 0x04))\n shr(0xe0, calldataload(0x00))\n dup1\n 0x7f3f6a73\n eq\n tag_3\n jumpi\n dup1\n 0xa9a3e611\n eq\n tag_4\n jumpi\n tag_2:\n 0x00\n dup1\n revert\n /* \"contracts/01.Solidity-8.0\\xe6\\x96\\xb0\\xe7\\x89\\xb9\\xe6\\x80\\xa7/Sol.sol\":97:211 function testUnderflow() public pure returns (uint) {\r... */\n tag_3:\n tag_5\n tag_6\n jump\t// in\n tag_5:\n mload(0x40)\n tag_7\n swap2\n swap1\n tag_8\n jump\t// in\n tag_7:\n mload(0x40)\n dup1\n swap2\n sub\n swap1\n return\n /* \"contracts/01.Solidity-8.0\\xe6\\x96\\xb0\\xe7\\x89\\xb9\\xe6\\x80\\xa7/Sol.sol\":290:427 function testUncheckedUnderflow() public pure returns (uint) {\r... */\n tag_4:\n tag_9\n tag_10\n jump\t// in\n tag_9:\n mload(0x40)\n tag_11\n swap2\n swap1\n tag_8\n jump\t// in\n tag_11:\n mload(0x40)\n dup1\n swap2\n sub\n swap1\n return\n /* \"contracts/01.Solidity-8.0\\xe6\\x96\\xb0\\xe7\\x89\\xb9\\xe6\\x80\\xa7/Sol.sol\":97:211 function testUnderflow() public pure returns (uint) {\r... */\n tag_6:\n /* \"contracts/01.Solidity-8.0\\xe6\\x96\\xb0\\xe7\\x89\\xb9\\xe6\\x80\\xa7/Sol.sol\":143:147 uint */\n 0x00\n /* \"contracts/01.Solidity-8.0\\xe6\\x96\\xb0\\xe7\\x89\\xb9\\xe6\\x80\\xa7/Sol.sol\":160:166 uint x */\n dup1\n /* \"contracts/01.Solidity-8.0\\xe6\\x96\\xb0\\xe7\\x89\\xb9\\xe6\\x80\\xa7/Sol.sol\":169:170 0 */\n 0x00\n /* \"contracts/01.Solidity-8.0\\xe6\\x96\\xb0\\xe7\\x89\\xb9\\xe6\\x80\\xa7/Sol.sol\":160:170 uint x = 0 */\n swap1\n pop\n /* \"contracts/01.Solidity-8.0\\xe6\\x96\\xb0\\xe7\\x89\\xb9\\xe6\\x80\\xa7/Sol.sol\":181:184 x-- */\n dup1\n dup1\n tag_13\n swap1\n tag_14\n jump\t// in\n tag_13:\n swap2\n pop\n pop\n /* \"contracts/01.Solidity-8.0\\xe6\\x96\\xb0\\xe7\\x89\\xb9\\xe6\\x80\\xa7/Sol.sol\":202:203 x */\n dup1\n /* \"contracts/01.Solidity-8.0\\xe6\\x96\\xb0\\xe7\\x89\\xb9\\xe6\\x80\\xa7/Sol.sol\":195:203 return x */\n swap2\n pop\n pop\n /* \"contracts/01.Solidity-8.0\\xe6\\x96\\xb0\\xe7\\x89\\xb9\\xe6\\x80\\xa7/Sol.sol\":97:211 function testUnderflow() public pure returns (uint) {\r... */\n swap1\n jump\t// out\n /* \"contracts/01.Solidity-8.0\\xe6\\x96\\xb0\\xe7\\x89\\xb9\\xe6\\x80\\xa7/Sol.sol\":290:427 function testUncheckedUnderflow() public pure returns (uint) {\r... */\n tag_10:\n /* \"contracts/01.Solidity-8.0\\xe6\\x96\\xb0\\xe7\\x89\\xb9\\xe6\\x80\\xa7/Sol.sol\":345:349 uint */\n 0x00\n /* \"contracts/01.Solidity-8.0\\xe6\\x96\\xb0\\xe7\\x89\\xb9\\xe6\\x80\\xa7/Sol.sol\":362:368 uint x */\n dup1\n /* \"contracts/01.Solidity-8.0\\xe6\\x96\\xb0\\xe7\\x89\\xb9\\xe6\\x80\\xa7/Sol.sol\":371:372 0 */\n 0x00\n /* \"contracts/01.Solidity-8.0\\xe6\\x96\\xb0\\xe7\\x89\\xb9\\xe6\\x80\\xa7/Sol.sol\":362:372 uint x = 0 */\n swap1\n pop\n /* \"contracts/01.Solidity-8.0\\xe6\\x96\\xb0\\xe7\\x89\\xb9\\xe6\\x80\\xa7/Sol.sol\":395:398 x-- */\n dup1\n dup1\n 0x01\n swap1\n sub\n swap2\n pop\n pop\n /* \"contracts/01.Solidity-8.0\\xe6\\x96\\xb0\\xe7\\x89\\xb9\\xe6\\x80\\xa7/Sol.sol\":418:419 x */\n dup1\n /* \"contracts/01.Solidity-8.0\\xe6\\x96\\xb0\\xe7\\x89\\xb9\\xe6\\x80\\xa7/Sol.sol\":411:419 return x */\n swap2\n pop\n pop\n /* \"contracts/01.Solidity-8.0\\xe6\\x96\\xb0\\xe7\\x89\\xb9\\xe6\\x80\\xa7/Sol.sol\":290:427 function testUncheckedUnderflow() public pure returns (uint) {\r... */\n swap1\n jump\t// out\n /* \"#utility.yul\":7:125 */\n tag_17:\n /* \"#utility.yul\":94:118 */\n tag_19\n /* \"#utility.yul\":112:117 */\n dup2\n /* \"#utility.yul\":94:118 */\n tag_20\n jump\t// in\n tag_19:\n /* \"#utility.yul\":89:92 */\n dup3\n /* \"#utility.yul\":82:119 */\n mstore\n /* \"#utility.yul\":7:125 */\n pop\n pop\n jump\t// out\n /* \"#utility.yul\":131:353 */\n tag_8:\n /* \"#utility.yul\":224:228 */\n 0x00\n /* \"#utility.yul\":262:264 */\n 0x20\n /* \"#utility.yul\":251:260 */\n dup3\n /* \"#utility.yul\":247:265 */\n add\n /* \"#utility.yul\":239:265 */\n swap1\n pop\n /* \"#utility.yul\":275:346 */\n tag_22\n /* \"#utility.yul\":343:344 */\n 0x00\n /* \"#utility.yul\":332:341 */\n dup4\n /* \"#utility.yul\":328:345 */\n add\n /* \"#utility.yul\":319:325 */\n dup5\n /* \"#utility.yul\":275:346 */\n tag_17\n jump\t// in\n tag_22:\n /* \"#utility.yul\":131:353 */\n swap3\n swap2\n pop\n pop\n jump\t// out\n /* \"#utility.yul\":359:436 */\n tag_20:\n /* \"#utility.yul\":396:403 */\n 0x00\n /* \"#utility.yul\":425:430 */\n dup2\n /* \"#utility.yul\":414:430 */\n swap1\n pop\n /* \"#utility.yul\":359:436 */\n swap2\n swap1\n pop\n jump\t// out\n /* \"#utility.yul\":442:613 */\n tag_14:\n /* \"#utility.yul\":481:484 */\n 0x00\n /* \"#utility.yul\":504:528 */\n tag_25\n /* \"#utility.yul\":522:527 */\n dup3\n /* \"#utility.yul\":504:528 */\n tag_20\n jump\t// in\n tag_25:\n /* \"#utility.yul\":495:528 */\n swap2\n pop\n /* \"#utility.yul\":550:554 */\n 0x00\n /* \"#utility.yul\":543:548 */\n dup3\n /* \"#utility.yul\":540:555 */\n eq\n /* \"#utility.yul\":537:578 */\n iszero\n tag_26\n jumpi\n /* \"#utility.yul\":558:576 */\n tag_27\n tag_28\n jump\t// in\n tag_27:\n /* \"#utility.yul\":537:578 */\n tag_26:\n /* \"#utility.yul\":605:606 */\n 0x01\n /* \"#utility.yul\":598:603 */\n dup3\n /* \"#utility.yul\":594:607 */\n sub\n /* \"#utility.yul\":587:607 */\n swap1\n pop\n /* \"#utility.yul\":442:613 */\n swap2\n swap1\n pop\n jump\t// out\n /* \"#utility.yul\":619:799 */\n tag_28:\n /* \"#utility.yul\":667:744 */\n 0x4e487b7100000000000000000000000000000000000000000000000000000000\n /* \"#utility.yul\":664:665 */\n 0x00\n /* \"#utility.yul\":657:745 */\n mstore\n /* \"#utility.yul\":764:768 */\n 0x11\n /* \"#utility.yul\":761:762 */\n 0x04\n /* \"#utility.yul\":754:769 */\n mstore\n /* \"#utility.yul\":788:792 */\n 0x24\n /* \"#utility.yul\":785:786 */\n 0x00\n /* \"#utility.yul\":778:793 */\n revert\n\n auxdata: 0xa2646970667358221220e9c853b66f40ced323f95fd0de9cda09452ef2e8925eaf635602cc32455c9a0864736f6c63430008070033\n}\n",
"bytecode": {
"functionDebugData": {},
"generatedSources": [],
"linkReferences": {},
"object": "608060405234801561001057600080fd5b5061016d806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80637f3f6a731461003b578063a9a3e61114610059575b600080fd5b610043610077565b60405161005091906100b9565b60405180910390f35b610061610093565b60405161006e91906100b9565b60405180910390f35b600080600090508080610089906100de565b9150508091505090565b600080600090508080600190039150508091505090565b6100b3816100d4565b82525050565b60006020820190506100ce60008301846100aa565b92915050565b6000819050919050565b60006100e9826100d4565b915060008214156100fd576100fc610108565b5b600182039050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fdfea2646970667358221220e9c853b66f40ced323f95fd0de9cda09452ef2e8925eaf635602cc32455c9a0864736f6c63430008070033",
"opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x16D DUP1 PUSH2 0x20 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN INVALID PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x4 CALLDATASIZE LT PUSH2 0x36 JUMPI PUSH1 0x0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x7F3F6A73 EQ PUSH2 0x3B JUMPI DUP1 PUSH4 0xA9A3E611 EQ PUSH2 0x59 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x43 PUSH2 0x77 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x50 SWAP2 SWAP1 PUSH2 0xB9 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x61 PUSH2 0x93 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x6E SWAP2 SWAP1 PUSH2 0xB9 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 SWAP1 POP DUP1 DUP1 PUSH2 0x89 SWAP1 PUSH2 0xDE JUMP JUMPDEST SWAP2 POP POP DUP1 SWAP2 POP POP SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 SWAP1 POP DUP1 DUP1 PUSH1 0x1 SWAP1 SUB SWAP2 POP POP DUP1 SWAP2 POP POP SWAP1 JUMP JUMPDEST PUSH2 0xB3 DUP2 PUSH2 0xD4 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP PUSH2 0xCE PUSH1 0x0 DUP4 ADD DUP5 PUSH2 0xAA JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0xE9 DUP3 PUSH2 0xD4 JUMP JUMPDEST SWAP2 POP PUSH1 0x0 DUP3 EQ ISZERO PUSH2 0xFD JUMPI PUSH2 0xFC PUSH2 0x108 JUMP JUMPDEST JUMPDEST PUSH1 0x1 DUP3 SUB SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x4E487B7100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH1 0x11 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH1 0x0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0xE9 0xC8 MSTORE8 0xB6 PUSH16 0x40CED323F95FD0DE9CDA09452EF2E892 0x5E 0xAF PUSH4 0x5602CC32 GASLIMIT 0x5C SWAP11 ADDMOD PUSH5 0x736F6C6343 STOP ADDMOD SMOD STOP CALLER ",
"sourceMap": "72:358:0:-:0;;;;;;;;;;;;;;;;;;;"
},
"deployedBytecode": {
"functionDebugData": {
"@testUncheckedUnderflow_32": {
"entryPoint": 147,
"id": 32,
"parameterSlots": 0,
"returnSlots": 1
},
"@testUnderflow_16": {
"entryPoint": 119,
"id": 16,
"parameterSlots": 0,
"returnSlots": 1
},
"abi_encode_t_uint256_to_t_uint256_fromStack": {
"entryPoint": 170,
"id": null,
"parameterSlots": 2,
"returnSlots": 0
},
"abi_encode_tuple_t_uint256__to_t_uint256__fromStack_reversed": {
"entryPoint": 185,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"cleanup_t_uint256": {
"entryPoint": 212,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"decrement_t_uint256": {
"entryPoint": 222,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"panic_error_0x11": {
"entryPoint": 264,
"id": null,
"parameterSlots": 0,
"returnSlots": 0
}
},
"generatedSources": [
{
"ast": {
"nodeType": "YulBlock",
"src": "0:802: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"
},
{
"body": {
"nodeType": "YulBlock",
"src": "485:128:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "495:33:1",
"value": {
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "522:5:1"
}
],
"functionName": {
"name": "cleanup_t_uint256",
"nodeType": "YulIdentifier",
"src": "504:17:1"
},
"nodeType": "YulFunctionCall",
"src": "504:24:1"
},
"variableNames": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "495:5:1"
}
]
},
{
"body": {
"nodeType": "YulBlock",
"src": "556:22:1",
"statements": [
{
"expression": {
"arguments": [],
"functionName": {
"name": "panic_error_0x11",
"nodeType": "YulIdentifier",
"src": "558:16:1"
},
"nodeType": "YulFunctionCall",
"src": "558:18:1"
},
"nodeType": "YulExpressionStatement",
"src": "558:18:1"
}
]
},
"condition": {
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "543:5:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "550:4:1",
"type": "",
"value": "0x00"
}
],
"functionName": {
"name": "eq",
"nodeType": "YulIdentifier",
"src": "540:2:1"
},
"nodeType": "YulFunctionCall",
"src": "540:15:1"
},
"nodeType": "YulIf",
"src": "537:41:1"
},
{
"nodeType": "YulAssignment",
"src": "587:20:1",
"value": {
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "598:5:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "605:1:1",
"type": "",
"value": "1"
}
],
"functionName": {
"name": "sub",
"nodeType": "YulIdentifier",
"src": "594:3:1"
},
"nodeType": "YulFunctionCall",
"src": "594:13:1"
},
"variableNames": [
{
"name": "ret",
"nodeType": "YulIdentifier",
"src": "587:3:1"
}
]
}
]
},
"name": "decrement_t_uint256",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "471:5:1",
"type": ""
}
],
"returnVariables": [
{
"name": "ret",
"nodeType": "YulTypedName",
"src": "481:3:1",
"type": ""
}
],
"src": "442:171:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "647:152:1",
"statements": [
{
"expression": {
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "664:1:1",
"type": "",
"value": "0"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "667:77:1",
"type": "",
"value": "35408467139433450592217433187231851964531694900788300625387963629091585785856"
}
],
"functionName": {
"name": "mstore",
"nodeType": "YulIdentifier",
"src": "657:6:1"
},
"nodeType": "YulFunctionCall",
"src": "657:88:1"
},
"nodeType": "YulExpressionStatement",
"src": "657:88:1"
},
{
"expression": {
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "761:1:1",
"type": "",
"value": "4"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "764:4:1",
"type": "",
"value": "0x11"
}
],
"functionName": {
"name": "mstore",
"nodeType": "YulIdentifier",
"src": "754:6:1"
},
"nodeType": "YulFunctionCall",
"src": "754:15:1"
},
"nodeType": "YulExpressionStatement",
"src": "754:15:1"
},
{
"expression": {
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "785:1:1",
"type": "",
"value": "0"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "788:4:1",
"type": "",
"value": "0x24"
}
],
"functionName": {
"name": "revert",
"nodeType": "YulIdentifier",
"src": "778:6:1"
},
"nodeType": "YulFunctionCall",
"src": "778:15:1"
},
"nodeType": "YulExpressionStatement",
"src": "778:15:1"
}
]
},
"name": "panic_error_0x11",
"nodeType": "YulFunctionDefinition",
"src": "619:180: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 function decrement_t_uint256(value) -> ret {\n value := cleanup_t_uint256(value)\n if eq(value, 0x00) { panic_error_0x11() }\n ret := sub(value, 1)\n }\n\n function panic_error_0x11() {\n mstore(0, 35408467139433450592217433187231851964531694900788300625387963629091585785856)\n mstore(4, 0x11)\n revert(0, 0x24)\n }\n\n}\n",
"id": 1,
"language": "Yul",
"name": "#utility.yul"
}
],
"immutableReferences": {},
"linkReferences": {},
"object": "608060405234801561001057600080fd5b50600436106100365760003560e01c80637f3f6a731461003b578063a9a3e61114610059575b600080fd5b610043610077565b60405161005091906100b9565b60405180910390f35b610061610093565b60405161006e91906100b9565b60405180910390f35b600080600090508080610089906100de565b9150508091505090565b600080600090508080600190039150508091505090565b6100b3816100d4565b82525050565b60006020820190506100ce60008301846100aa565b92915050565b6000819050919050565b60006100e9826100d4565b915060008214156100fd576100fc610108565b5b600182039050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fdfea2646970667358221220e9c853b66f40ced323f95fd0de9cda09452ef2e8925eaf635602cc32455c9a0864736f6c63430008070033",
"opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x4 CALLDATASIZE LT PUSH2 0x36 JUMPI PUSH1 0x0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x7F3F6A73 EQ PUSH2 0x3B JUMPI DUP1 PUSH4 0xA9A3E611 EQ PUSH2 0x59 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x43 PUSH2 0x77 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x50 SWAP2 SWAP1 PUSH2 0xB9 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x61 PUSH2 0x93 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x6E SWAP2 SWAP1 PUSH2 0xB9 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 SWAP1 POP DUP1 DUP1 PUSH2 0x89 SWAP1 PUSH2 0xDE JUMP JUMPDEST SWAP2 POP POP DUP1 SWAP2 POP POP SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 SWAP1 POP DUP1 DUP1 PUSH1 0x1 SWAP1 SUB SWAP2 POP POP DUP1 SWAP2 POP POP SWAP1 JUMP JUMPDEST PUSH2 0xB3 DUP2 PUSH2 0xD4 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP PUSH2 0xCE PUSH1 0x0 DUP4 ADD DUP5 PUSH2 0xAA JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0xE9 DUP3 PUSH2 0xD4 JUMP JUMPDEST SWAP2 POP PUSH1 0x0 DUP3 EQ ISZERO PUSH2 0xFD JUMPI PUSH2 0xFC PUSH2 0x108 JUMP JUMPDEST JUMPDEST PUSH1 0x1 DUP3 SUB SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x4E487B7100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH1 0x11 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH1 0x0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0xE9 0xC8 MSTORE8 0xB6 PUSH16 0x40CED323F95FD0DE9CDA09452EF2E892 0x5E 0xAF PUSH4 0x5602CC32 GASLIMIT 0x5C SWAP11 ADDMOD PUSH5 0x736F6C6343 STOP ADDMOD SMOD STOP CALLER ",
"sourceMap": "72:358:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;97:114;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;290:137;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;97:114;143:4;160:6;169:1;160:10;;181:3;;;;;:::i;:::-;;;;202:1;195:8;;;97:114;:::o;290:137::-;345:4;362:6;371:1;362:10;;395:3;;;;;;;;418:1;411:8;;;290:137;:::o;7:118:1:-;94:24;112:5;94:24;:::i;:::-;89:3;82:37;7:118;;:::o;131:222::-;224:4;262:2;251:9;247:18;239:26;;275:71;343:1;332:9;328:17;319:6;275:71;:::i;:::-;131:222;;;;:::o;359:77::-;396:7;425:5;414:16;;359:77;;;:::o;442:171::-;481:3;504:24;522:5;504:24;:::i;:::-;495:33;;550:4;543:5;540:15;537:41;;;558:18;;:::i;:::-;537:41;605:1;598:5;594:13;587:20;;442:171;;;:::o;619:180::-;667:77;664:1;657:88;764:4;761:1;754:15;788:4;785:1;778:15"
},
"gasEstimates": {
"creation": {
"codeDepositCost": "73000",
"executionCost": "123",
"totalCost": "73123"
},
"external": {
"testUncheckedUnderflow()": "372",
"testUnderflow()": "269"
}
},
"legacyAssembly": {
".code": [
{
"begin": 72,
"end": 430,
"name": "PUSH",
"source": 0,
"value": "80"
},
{
"begin": 72,
"end": 430,
"name": "PUSH",
"source": 0,
"value": "40"
},
{
"begin": 72,
"end": 430,
"name": "MSTORE",
"source": 0
},
{
"begin": 72,
"end": 430,
"name": "CALLVALUE",
"source": 0
},
{
"begin": 72,
"end": 430,
"name": "DUP1",
"source": 0
},
{
"begin": 72,
"end": 430,
"name": "ISZERO",
"source": 0
},
{
"begin": 72,
"end": 430,
"name": "PUSH [tag]",
"source": 0,
"value": "1"
},
{
"begin": 72,
"end": 430,
"name": "JUMPI",
"source": 0
},
{
"begin": 72,
"end": 430,
"name": "PUSH",
"source": 0,
"value": "0"
},
{
"begin": 72,
"end": 430,
"name": "DUP1",
"source": 0
},
{
"begin": 72,
"end": 430,
"name": "REVERT",
"source": 0
},
{
"begin": 72,
"end": 430,
"name": "tag",
"source": 0,
"value": "1"
},
{
"begin": 72,
"end": 430,
"name": "JUMPDEST",
"source": 0
},
{
"begin": 72,
"end": 430,
"name": "POP",
"source": 0
},
{
"begin": 72,
"end": 430,
"name": "PUSH #[$]",
"source": 0,
"value": "0000000000000000000000000000000000000000000000000000000000000000"
},
{
"begin": 72,
"end": 430,
"name": "DUP1",
"source": 0
},
{
"begin": 72,
"end": 430,
"name": "PUSH [$]",
"source": 0,
"value": "0000000000000000000000000000000000000000000000000000000000000000"
},
{
"begin": 72,
"end": 430,
"name": "PUSH",
"source": 0,
"value": "0"
},
{
"begin": 72,
"end": 430,
"name": "CODECOPY",
"source": 0
},
{
"begin": 72,
"end": 430,
"name": "PUSH",
"source": 0,
"value": "0"
},
{
"begin": 72,
"end": 430,
"name": "RETURN",
"source": 0
}
],
".data": {
"0": {
".auxdata": "a2646970667358221220e9c853b66f40ced323f95fd0de9cda09452ef2e8925eaf635602cc32455c9a0864736f6c63430008070033",
".code": [
{
"begin": 72,
"end": 430,
"name": "PUSH",
"source": 0,
"value": "80"
},
{
"begin": 72,
"end": 430,
"name": "PUSH",
"source": 0,
"value": "40"
},
{
"begin": 72,
"end": 430,
"name": "MSTORE",
"source": 0
},
{
"begin": 72,
"end": 430,
"name": "CALLVALUE",
"source": 0
},
{
"begin": 72,
"end": 430,
"name": "DUP1",
"source": 0
},
{
"begin": 72,
"end": 430,
"name": "ISZERO",
"source": 0
},
{
"begin": 72,
"end": 430,
"name": "PUSH [tag]",
"source": 0,
"value": "1"
},
{
"begin": 72,
"end": 430,
"name": "JUMPI",
"source": 0
},
{
"begin": 72,
"end": 430,
"name": "PUSH",
"source": 0,
"value": "0"
},
{
"begin": 72,
"end": 430,
"name": "DUP1",
"source": 0
},
{
"begin": 72,
"end": 430,
"name": "REVERT",
"source": 0
},
{
"begin": 72,
"end": 430,
"name": "tag",
"source": 0,
"value": "1"
},
{
"begin": 72,
"end": 430,
"name": "JUMPDEST",
"source": 0
},
{
"begin": 72,
"end": 430,
"name": "POP",
"source": 0
},
{
"begin": 72,
"end": 430,
"name": "PUSH",
"source": 0,
"value": "4"
},
{
"begin": 72,
"end": 430,
"name": "CALLDATASIZE",
"source": 0
},
{
"begin": 72,
"end": 430,
"name": "LT",
"source": 0
},
{
"begin": 72,
"end": 430,
"name": "PUSH [tag]",
"source": 0,
"value": "2"
},
{
"begin": 72,
"end": 430,
"name": "JUMPI",
"source": 0
},
{
"begin": 72,
"end": 430,
"name": "PUSH",
"source": 0,
"value": "0"
},
{
"begin": 72,
"end": 430,
"name": "CALLDATALOAD",
"source": 0
},
{
"begin": 72,
"end": 430,
"name": "PUSH",
"source": 0,
"value": "E0"
},
{
"begin": 72,
"end": 430,
"name": "SHR",
"source": 0
},
{
"begin": 72,
"end": 430,
"name": "DUP1",
"source": 0
},
{
"begin": 72,
"end": 430,
"name": "PUSH",
"source": 0,
"value": "7F3F6A73"
},
{
"begin": 72,
"end": 430,
"name": "EQ",
"source": 0
},
{
"begin": 72,
"end": 430,
"name": "PUSH [tag]",
"source": 0,
"value": "3"
},
{
"begin": 72,
"end": 430,
"name": "JUMPI",
"source": 0
},
{
"begin": 72,
"end": 430,
"name": "DUP1",
"source": 0
},
{
"begin": 72,
"end": 430,
"name": "PUSH",
"source": 0,
"value": "A9A3E611"
},
{
"begin": 72,
"end": 430,
"name": "EQ",
"source": 0
},
{
"begin": 72,
"end": 430,
"name": "PUSH [tag]",
"source": 0,
"value": "4"
},
{
"begin": 72,
"end": 430,
"name": "JUMPI",
"source": 0
},
{
"begin": 72,
"end": 430,
"name": "tag",
"source": 0,
"value": "2"
},
{
"begin": 72,
"end": 430,
"name": "JUMPDEST",
"source": 0
},
{
"begin": 72,
"end": 430,
"name": "PUSH",
"source": 0,
"value": "0"
},
{
"begin": 72,
"end": 430,
"name": "DUP1",
"source": 0
},
{
"begin": 72,
"end": 430,
"name": "REVERT",
"source": 0
},
{
"begin": 97,
"end": 211,
"name": "tag",
"source": 0,
"value": "3"
},
{
"begin": 97,
"end": 211,
"name": "JUMPDEST",
"source": 0
},
{
"begin": 97,
"end": 211,
"name": "PUSH [tag]",
"source": 0,
"value": "5"
},
{
"begin": 97,
"end": 211,
"name": "PUSH [tag]",
"source": 0,
"value": "6"
},
{
"begin": 97,
"end": 211,
"name": "JUMP",
"source": 0,
"value": "[in]"
},
{
"begin": 97,
"end": 211,
"name": "tag",
"source": 0,
"value": "5"
},
{
"begin": 97,
"end": 211,
"name": "JUMPDEST",
"source": 0
},
{
"begin": 97,
"end": 211,
"name": "PUSH",
"source": 0,
"value": "40"
},
{
"begin": 97,
"end": 211,
"name": "MLOAD",
"source": 0
},
{
"begin": 97,
"end": 211,
"name": "PUSH [tag]",
"source": 0,
"value": "7"
},
{
"begin": 97,
"end": 211,
"name": "SWAP2",
"source": 0
},
{
"begin": 97,
"end": 211,
"name": "SWAP1",
"source": 0
},
{
"begin": 97,
"end": 211,
"name": "PUSH [tag]",
"source": 0,
"value": "8"
},
{
"begin": 97,
"end": 211,
"name": "JUMP",
"source": 0,
"value": "[in]"
},
{
"begin": 97,
"end": 211,
"name": "tag",
"source": 0,
"value": "7"
},
{
"begin": 97,
"end": 211,
"name": "JUMPDEST",
"source": 0
},
{
"begin": 97,
"end": 211,
"name": "PUSH",
"source": 0,
"value": "40"
},
{
"begin": 97,
"end": 211,
"name": "MLOAD",
"source": 0
},
{
"begin": 97,
"end": 211,
"name": "DUP1",
"source": 0
},
{
"begin": 97,
"end": 211,
"name": "SWAP2",
"source": 0
},
{
"begin": 97,
"end": 211,
"name": "SUB",
"source": 0
},
{
"begin": 97,
"end": 211,
"name": "SWAP1",
"source": 0
},
{
"begin": 97,
"end": 211,
"name": "RETURN",
"source": 0
},
{
"begin": 290,
"end": 427,
"name": "tag",
"source": 0,
"value": "4"
},
{
"begin": 290,
"end": 427,
"name": "JUMPDEST",
"source": 0
},
{
"begin": 290,
"end": 427,
"name": "PUSH [tag]",
"source": 0,
"value": "9"
},
{
"begin": 290,
"end": 427,
"name": "PUSH [tag]",
"source": 0,
"value": "10"
},
{
"begin": 290,
"end": 427,
"name": "JUMP",
"source": 0,
"value": "[in]"
},
{
"begin": 290,
"end": 427,
"name": "tag",
"source": 0,
"value": "9"
},
{
"begin": 290,
"end": 427,
"name": "JUMPDEST",
"source": 0
},
{
"begin": 290,
"end": 427,
"name": "PUSH",
"source": 0,
"value": "40"
},
{
"begin": 290,
"end": 427,
"name": "MLOAD",
"source": 0
},
{
"begin": 290,
"end": 427,
"name": "PUSH [tag]",
"source": 0,
"value": "11"
},
{
"begin": 290,
"end": 427,
"name": "SWAP2",
"source": 0
},
{
"begin": 290,
"end": 427,
"name": "SWAP1",
"source": 0
},
{
"begin": 290,
"end": 427,
"name": "PUSH [tag]",
"source": 0,
"value": "8"
},
{
"begin": 290,
"end": 427,
"name": "JUMP",
"source": 0,
"value": "[in]"
},
{
"begin": 290,
"end": 427,
"name": "tag",
"source": 0,
"value": "11"
},
{
"begin": 290,
"end": 427,
"name": "JUMPDEST",
"source": 0
},
{
"begin": 290,
"end": 427,
"name": "PUSH",
"source": 0,
"value": "40"
},
{
"begin": 290,
"end": 427,
"name": "MLOAD",
"source": 0
},
{
"begin": 290,
"end": 427,
"name": "DUP1",
"source": 0
},
{
"begin": 290,
"end": 427,
"name": "SWAP2",
"source": 0
},
{
"begin": 290,
"end": 427,
"name": "SUB",
"source": 0
},
{
"begin": 290,
"end": 427,
"name": "SWAP1",
"source": 0
},
{
"begin": 290,
"end": 427,
"name": "RETURN",
"source": 0
},
{
"begin": 97,
"end": 211,
"name": "tag",
"source": 0,
"value": "6"
},
{
"begin": 97,
"end": 211,
"name": "JUMPDEST",
"source": 0
},
{
"begin": 143,
"end": 147,
"name": "PUSH",
"source": 0,
"value": "0"
},
{
"begin": 160,
"end": 166,
"name": "DUP1",
"source": 0
},
{
"begin": 169,
"end": 170,
"name": "PUSH",
"source": 0,
"value": "0"
},
{
"begin": 160,
"end": 170,
"name": "SWAP1",
"source": 0
},
{
"begin": 160,
"end": 170,
"name": "POP",
"source": 0
},
{
"begin": 181,
"end": 184,
"name": "DUP1",
"source": 0
},
{
"begin": 181,
"end": 184,
"name": "DUP1",
"source": 0
},
{
"begin": 181,
"end": 184,
"name": "PUSH [tag]",
"source": 0,
"value": "13"
},
{
"begin": 181,
"end": 184,
"name": "SWAP1",
"source": 0
},
{
"begin": 181,
"end": 184,
"name": "PUSH [tag]",
"source": 0,
"value": "14"
},
{
"begin": 181,
"end": 184,
"name": "JUMP",
"source": 0,
"value": "[in]"
},
{
"begin": 181,
"end": 184,
"name": "tag",
"source": 0,
"value": "13"
},
{
"begin": 181,
"end": 184,
"name": "JUMPDEST",
"source": 0
},
{
"begin": 181,
"end": 184,
"name": "SWAP2",
"source": 0
},
{
"begin": 181,
"end": 184,
"name": "POP",
"source": 0
},
{
"begin": 181,
"end": 184,
"name": "POP",
"source": 0
},
{
"begin": 202,
"end": 203,
"name": "DUP1",
"source": 0
},
{
"begin": 195,
"end": 203,
"name": "SWAP2",
"source": 0
},
{
"begin": 195,
"end": 203,
"name": "POP",
"source": 0
},
{
"begin": 195,
"end": 203,
"name": "POP",
"source": 0
},
{
"begin": 97,
"end": 211,
"name": "SWAP1",
"source": 0
},
{
"begin": 97,
"end": 211,
"name": "JUMP",
"source": 0,
"value": "[out]"
},
{
"begin": 290,
"end": 427,
"name": "tag",
"source": 0,
"value": "10"
},
{
"begin": 290,
"end": 427,
"name": "JUMPDEST",
"source": 0
},
{
"begin": 345,
"end": 349,
"name": "PUSH",
"source": 0,
"value": "0"
},
{
"begin": 362,
"end": 368,
"name": "DUP1",
"source": 0
},
{
"begin": 371,
"end": 372,
"name": "PUSH",
"source": 0,
"value": "0"
},
{
"begin": 362,
"end": 372,
"name": "SWAP1",
"source": 0
},
{
"begin": 362,
"end": 372,
"name": "POP",
"source": 0
},
{
"begin": 395,
"end": 398,
"name": "DUP1",
"source": 0
},
{
"begin": 395,
"end": 398,
"name": "DUP1",
"source": 0
},
{
"begin": 395,
"end": 398,
"name": "PUSH",
"source": 0,
"value": "1"
},
{
"begin": 395,
"end": 398,
"name": "SWAP1",
"source": 0
},
{
"begin": 395,
"end": 398,
"name": "SUB",
"source": 0
},
{
"begin": 395,
"end": 398,
"name": "SWAP2",
"source": 0
},
{
"begin": 395,
"end": 398,
"name": "POP",
"source": 0
},
{
"begin": 395,
"end": 398,
"name": "POP",
"source": 0
},
{
"begin": 418,
"end": 419,
"name": "DUP1",
"source": 0
},
{
"begin": 411,
"end": 419,
"name": "SWAP2",
"source": 0
},
{
"begin": 411,
"end": 419,
"name": "POP",
"source": 0
},
{
"begin": 411,
"end": 419,
"name": "POP",
"source": 0
},
{
"begin": 290,
"end": 427,
"name": "SWAP1",
"source": 0
},
{
"begin": 290,
"end": 427,
"name": "JUMP",
"source": 0,
"value": "[out]"
},
{
"begin": 7,
"end": 125,
"name": "tag",
"source": 1,
"value": "17"
},
{
"begin": 7,
"end": 125,
"name": "JUMPDEST",
"source": 1
},
{
"begin": 94,
"end": 118,
"name": "PUSH [tag]",
"source": 1,
"value": "19"
},
{
"begin": 112,
"end": 117,
"name": "DUP2",
"source": 1
},
{
"begin": 94,
"end": 118,
"name": "PUSH [tag]",
"source": 1,
"value": "20"
},
{
"begin": 94,
"end": 118,
"name": "JUMP",
"source": 1,
"value": "[in]"
},
{
"begin": 94,
"end": 118,
"name": "tag",
"source": 1,
"value": "19"
},
{
"begin": 94,
"end": 118,
"name": "JUMPDEST",
"source": 1
},
{
"begin": 89,
"end": 92,
"name": "DUP3",
"source": 1
},
{
"begin": 82,
"end": 119,
"name": "MSTORE",
"source": 1
},
{
"begin": 7,
"end": 125,
"name": "POP",
"source": 1
},
{
"begin": 7,
"end": 125,
"name": "POP",
"source": 1
},
{
"begin": 7,
"end": 125,
"name": "JUMP",
"source": 1,
"value": "[out]"
},
{
"begin": 131,
"end": 353,
"name": "tag",
"source": 1,
"value": "8"
},
{
"begin": 131,
"end": 353,
"name": "JUMPDEST",
"source": 1
},
{
"begin": 224,
"end": 228,
"name": "PUSH",
"source": 1,
"value": "0"
},
{
"begin": 262,
"end": 264,
"name": "PUSH",
"source": 1,
"value": "20"
},
{
"begin": 251,
"end": 260,
"name": "DUP3",
"source": 1
},
{
"begin": 247,
"end": 265,
"name": "ADD",
"source": 1
},
{
"begin": 239,
"end": 265,
"name": "SWAP1",
"source": 1
},
{
"begin": 239,
"end": 265,
"name": "POP",
"source": 1
},
{
"begin": 275,
"end": 346,
"name": "PUSH [tag]",
"source": 1,
"value": "22"
},
{
"begin": 343,
"end": 344,
"name": "PUSH",
"source": 1,
"value": "0"
},
{
"begin": 332,
"end": 341,
"name": "DUP4",
"source": 1
},
{
"begin": 328,
"end": 345,
"name": "ADD",
"source": 1
},
{
"begin": 319,
"end": 325,
"name": "DUP5",
"source": 1
},
{
"begin": 275,
"end": 346,
"name": "PUSH [tag]",
"source": 1,
"value": "17"
},
{
"begin": 275,
"end": 346,
"name": "JUMP",
"source": 1,
"value": "[in]"
},
{
"begin": 275,
"end": 346,
"name": "tag",
"source": 1,
"value": "22"
},
{
"begin": 275,
"end": 346,
"name": "JUMPDEST",
"source": 1
},
{
"begin": 131,
"end": 353,
"name": "SWAP3",
"source": 1
},
{
"begin": 131,
"end": 353,
"name": "SWAP2",
"source": 1
},
{
"begin": 131,
"end": 353,
"name": "POP",
"source": 1
},
{
"begin": 131,
"end": 353,
"name": "POP",
"source": 1
},
{
"begin": 131,
"end": 353,
"name": "JUMP",
"source": 1,
"value": "[out]"
},
{
"begin": 359,
"end": 436,
"name": "tag",
"source": 1,
"value": "20"
},
{
"begin": 359,
"end": 436,
"name": "JUMPDEST",
"source": 1
},
{
"begin": 396,
"end": 403,
"name": "PUSH",
"source": 1,
"value": "0"
},
{
"begin": 425,
"end": 430,
"name": "DUP2",
"source": 1
},
{
"begin": 414,
"end": 430,
"name": "SWAP1",
"source": 1
},
{
"begin": 414,
"end": 430,
"name": "POP",
"source": 1
},
{
"begin": 359,
"end": 436,
"name": "SWAP2",
"source": 1
},
{
"begin": 359,
"end": 436,
"name": "SWAP1",
"source": 1
},
{
"begin": 359,
"end": 436,
"name": "POP",
"source": 1
},
{
"begin": 359,
"end": 436,
"name": "JUMP",
"source": 1,
"value": "[out]"
},
{
"begin": 442,
"end": 613,
"name": "tag",
"source": 1,
"value": "14"
},
{
"begin": 442,
"end": 613,
"name": "JUMPDEST",
"source": 1
},
{
"begin": 481,
"end": 484,
"name": "PUSH",
"source": 1,
"value": "0"
},
{
"begin": 504,
"end": 528,
"name": "PUSH [tag]",
"source": 1,
"value": "25"
},
{
"begin": 522,
"end": 527,
"name": "DUP3",
"source": 1
},
{
"begin": 504,
"end": 528,
"name": "PUSH [tag]",
"source": 1,
"value": "20"
},
{
"begin": 504,
"end": 528,
"name": "JUMP",
"source": 1,
"value": "[in]"
},
{
"begin": 504,
"end": 528,
"name": "tag",
"source": 1,
"value": "25"
},
{
"begin": 504,
"end": 528,
"name": "JUMPDEST",
"source": 1
},
{
"begin": 495,
"end": 528,
"name": "SWAP2",
"source": 1
},
{
"begin": 495,
"end": 528,
"name": "POP",
"source": 1
},
{
"begin": 550,
"end": 554,
"name": "PUSH",
"source": 1,
"value": "0"
},
{
"begin": 543,
"end": 548,
"name": "DUP3",
"source": 1
},
{
"begin": 540,
"end": 555,
"name": "EQ",
"source": 1
},
{
"begin": 537,
"end": 578,
"name": "ISZERO",
"source": 1
},
{
"begin": 537,
"end": 578,
"name": "PUSH [tag]",
"source": 1,
"value": "26"
},
{
"begin": 537,
"end": 578,
"name": "JUMPI",
"source": 1
},
{
"begin": 558,
"end": 576,
"name": "PUSH [tag]",
"source": 1,
"value": "27"
},
{
"begin": 558,
"end": 576,
"name": "PUSH [tag]",
"source": 1,
"value": "28"
},
{
"begin": 558,
"end": 576,
"name": "JUMP",
"source": 1,
"value": "[in]"
},
{
"begin": 558,
"end": 576,
"name": "tag",
"source": 1,
"value": "27"
},
{
"begin": 558,
"end": 576,
"name": "JUMPDEST",
"source": 1
},
{
"begin": 537,
"end": 578,
"name": "tag",
"source": 1,
"value": "26"
},
{
"begin": 537,
"end": 578,
"name": "JUMPDEST",
"source": 1
},
{
"begin": 605,
"end": 606,
"name": "PUSH",
"source": 1,
"value": "1"
},
{
"begin": 598,
"end": 603,
"name": "DUP3",
"source": 1
},
{
"begin": 594,
"end": 607,
"name": "SUB",
"source": 1
},
{
"begin": 587,
"end": 607,
"name": "SWAP1",
"source": 1
},
{
"begin": 587,
"end": 607,
"name": "POP",
"source": 1
},
{
"begin": 442,
"end": 613,
"name": "SWAP2",
"source": 1
},
{
"begin": 442,
"end": 613,
"name": "SWAP1",
"source": 1
},
{
"begin": 442,
"end": 613,
"name": "POP",
"source": 1
},
{
"begin": 442,
"end": 613,
"name": "JUMP",
"source": 1,
"value": "[out]"
},
{
"begin": 619,
"end": 799,
"name": "tag",
"source": 1,
"value": "28"
},
{
"begin": 619,
"end": 799,
"name": "JUMPDEST",
"source": 1
},
{
"begin": 667,
"end": 744,
"name": "PUSH",
"source": 1,
"value": "4E487B7100000000000000000000000000000000000000000000000000000000"
},
{
"begin": 664,
"end": 665,
"name": "PUSH",
"source": 1,
"value": "0"
},
{
"begin": 657,
"end": 745,
"name": "MSTORE",
"source": 1
},
{
"begin": 764,
"end": 768,
"name": "PUSH",
"source": 1,
"value": "11"
},
{
"begin": 761,
"end": 762,
"name": "PUSH",
"source": 1,
"value": "4"
},
{
"begin": 754,
"end": 769,
"name": "MSTORE",
"source": 1
},
{
"begin": 788,
"end": 792,
"name": "PUSH",
"source": 1,
"value": "24"
},
{
"begin": 785,
"end": 786,
"name": "PUSH",
"source": 1,
"value": "0"
},
{
"begin": 778,
"end": 793,
"name": "REVERT",
"source": 1
}
]
}
}
},
"methodIdentifiers": {
"testUncheckedUnderflow()": "a9a3e611",
"testUnderflow()": "7f3f6a73"
}
},
"metadata": "{\"compiler\":{\"version\":\"0.8.7+commit.e28d00a7\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"testUncheckedUnderflow\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"testUnderflow\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/01.Solidity-8.0\\u65b0\\u7279\\u6027/Sol.sol\":\"SafeMath\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/01.Solidity-8.0\\u65b0\\u7279\\u6027/Sol.sol\":{\"keccak256\":\"0x28eed03bdb54ce39fc9ca66ae96ae880952d670f12fc077af1cd95250a49752a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://7944dbc7a395a509fe0b17fab5252741e18cce28c56b3ca00850c2933a86aa96\",\"dweb:/ipfs/QmVYV3KiNXkaZzBhF7t2S5ZV2UMJcpkEaz5iidMw3EYiNA\"]}},\"version\":1}",
"storageLayout": {
"storage": [],
"types": null
},
"userdoc": {
"kind": "user",
"methods": {},
"version": 1
}
}
}
},
"sources": {
"contracts/01.Solidity-8.0新特性/Sol.sol": {
"ast": {
"absolutePath": "contracts/01.Solidity-8.0新特性/Sol.sol",
"exportedSymbols": {
"SafeMath": [
33
]
},
"id": 34,
"license": "MIT",
"nodeType": "SourceUnit",
"nodes": [
{
"id": 1,
"literals": [
"solidity",
"^",
"0.8"
],
"nodeType": "PragmaDirective",
"src": "33:21:0"
},
{
"abstract": false,
"baseContracts": [],
"contractDependencies": [],
"contractKind": "contract",
"fullyImplemented": true,
"id": 33,
"linearizedBaseContracts": [
33
],
"name": "SafeMath",
"nameLocation": "81:8:0",
"nodeType": "ContractDefinition",
"nodes": [
{
"body": {
"id": 15,
"nodeType": "Block",
"src": "149:62:0",
"statements": [
{
"assignments": [
7
],
"declarations": [
{
"constant": false,
"id": 7,
"mutability": "mutable",
"name": "x",
"nameLocation": "165:1:0",
"nodeType": "VariableDeclaration",
"scope": 15,
"src": "160:6:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 6,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "160:4:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"id": 9,
"initialValue": {
"hexValue": "30",
"id": 8,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "169:1:0",
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"nodeType": "VariableDeclarationStatement",
"src": "160:10:0"
},
{
"expression": {
"id": 11,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"nodeType": "UnaryOperation",
"operator": "--",
"prefix": false,
"src": "181:3:0",
"subExpression": {
"id": 10,
"name": "x",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 7,
"src": "181:1:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 12,
"nodeType": "ExpressionStatement",
"src": "181:3:0"
},
{
"expression": {
"id": 13,
"name": "x",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 7,
"src": "202:1:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"functionReturnParameters": 5,
"id": 14,
"nodeType": "Return",
"src": "195:8:0"
}
]
},
"functionSelector": "7f3f6a73",
"id": 16,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "testUnderflow",
"nameLocation": "106:13:0",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 2,
"nodeType": "ParameterList",
"parameters": [],
"src": "119:2:0"
},
"returnParameters": {
"id": 5,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"scope": 16,
"src": "143:4:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 3,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "143:4:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "142:6:0"
},
"scope": 33,
"src": "97:114:0",
"stateMutability": "pure",
"virtual": false,
"visibility": "public"
},
{
"body": {
"id": 31,
"nodeType": "Block",
"src": "351:76:0",
"statements": [
{
"assignments": [
22
],
"declarations": [
{
"constant": false,
"id": 22,
"mutability": "mutable",
"name": "x",
"nameLocation": "367:1:0",
"nodeType": "VariableDeclaration",
"scope": 31,
"src": "362:6:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 21,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "362:4:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"id": 24,
"initialValue": {
"hexValue": "30",
"id": 23,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "371:1:0",
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"nodeType": "VariableDeclarationStatement",
"src": "362:10:0"
},
{
"id": 28,
"nodeType": "UncheckedBlock",
"src": "383:18:0",
"statements": [
{
"expression": {
"id": 26,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"nodeType": "UnaryOperation",
"operator": "--",
"prefix": false,
"src": "395:3:0",
"subExpression": {
"id": 25,
"name": "x",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 22,
"src": "395:1:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 27,
"nodeType": "ExpressionStatement",
"src": "395:3:0"
}
]
},
{
"expression": {
"id": 29,
"name": "x",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 22,
"src": "418:1:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"functionReturnParameters": 20,
"id": 30,
"nodeType": "Return",
"src": "411:8:0"
}
]
},
"functionSelector": "a9a3e611",
"id": 32,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "testUncheckedUnderflow",
"nameLocation": "299:22:0",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 17,
"nodeType": "ParameterList",
"parameters": [],
"src": "321:2:0"
},
"returnParameters": {
"id": 20,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 19,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"scope": 32,
"src": "345:4:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 18,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "345:4:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "344:6:0"
},
"scope": 33,
"src": "290:137:0",
"stateMutability": "pure",
"virtual": false,
"visibility": "public"
}
],
"scope": 34,
"src": "72:358:0",
"usedErrors": []
}
],
"src": "33:397:0"
},
"id": 0
}
}
}
}
{
"deploy": {
"VM:-": {
"linkReferences": {},
"autoDeployLib": true
},
"main:1": {
"linkReferences": {},
"autoDeployLib": true
},
"ropsten:3": {
"linkReferences": {},
"autoDeployLib": true
},
"rinkeby:4": {
"linkReferences": {},
"autoDeployLib": true
},
"kovan:42": {
"linkReferences": {},
"autoDeployLib": true
},
"goerli:5": {
"linkReferences": {},
"autoDeployLib": true
},
"Custom": {
"linkReferences": {},
"autoDeployLib": true
}
},
"data": {
"bytecode": {
"functionDebugData": {},
"generatedSources": [],
"linkReferences": {},
"object": "608060405234801561001057600080fd5b5061016d806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80637f3f6a731461003b578063a9a3e61114610059575b600080fd5b610043610077565b60405161005091906100b9565b60405180910390f35b610061610093565b60405161006e91906100b9565b60405180910390f35b600080600090508080610089906100de565b9150508091505090565b600080600090508080600190039150508091505090565b6100b3816100d4565b82525050565b60006020820190506100ce60008301846100aa565b92915050565b6000819050919050565b60006100e9826100d4565b915060008214156100fd576100fc610108565b5b600182039050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fdfea2646970667358221220e9c853b66f40ced323f95fd0de9cda09452ef2e8925eaf635602cc32455c9a0864736f6c63430008070033",
"opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x16D DUP1 PUSH2 0x20 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN INVALID PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x4 CALLDATASIZE LT PUSH2 0x36 JUMPI PUSH1 0x0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x7F3F6A73 EQ PUSH2 0x3B JUMPI DUP1 PUSH4 0xA9A3E611 EQ PUSH2 0x59 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x43 PUSH2 0x77 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x50 SWAP2 SWAP1 PUSH2 0xB9 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x61 PUSH2 0x93 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x6E SWAP2 SWAP1 PUSH2 0xB9 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 SWAP1 POP DUP1 DUP1 PUSH2 0x89 SWAP1 PUSH2 0xDE JUMP JUMPDEST SWAP2 POP POP DUP1 SWAP2 POP POP SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 SWAP1 POP DUP1 DUP1 PUSH1 0x1 SWAP1 SUB SWAP2 POP POP DUP1 SWAP2 POP POP SWAP1 JUMP JUMPDEST PUSH2 0xB3 DUP2 PUSH2 0xD4 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP PUSH2 0xCE PUSH1 0x0 DUP4 ADD DUP5 PUSH2 0xAA JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0xE9 DUP3 PUSH2 0xD4 JUMP JUMPDEST SWAP2 POP PUSH1 0x0 DUP3 EQ ISZERO PUSH2 0xFD JUMPI PUSH2 0xFC PUSH2 0x108 JUMP JUMPDEST JUMPDEST PUSH1 0x1 DUP3 SUB SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x4E487B7100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH1 0x11 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH1 0x0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0xE9 0xC8 MSTORE8 0xB6 PUSH16 0x40CED323F95FD0DE9CDA09452EF2E892 0x5E 0xAF PUSH4 0x5602CC32 GASLIMIT 0x5C SWAP11 ADDMOD PUSH5 0x736F6C6343 STOP ADDMOD SMOD STOP CALLER ",
"sourceMap": "72:358:0:-:0;;;;;;;;;;;;;;;;;;;"
},
"deployedBytecode": {
"functionDebugData": {
"@testUncheckedUnderflow_32": {
"entryPoint": 147,
"id": 32,
"parameterSlots": 0,
"returnSlots": 1
},
"@testUnderflow_16": {
"entryPoint": 119,
"id": 16,
"parameterSlots": 0,
"returnSlots": 1
},
"abi_encode_t_uint256_to_t_uint256_fromStack": {
"entryPoint": 170,
"id": null,
"parameterSlots": 2,
"returnSlots": 0
},
"abi_encode_tuple_t_uint256__to_t_uint256__fromStack_reversed": {
"entryPoint": 185,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"cleanup_t_uint256": {
"entryPoint": 212,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"decrement_t_uint256": {
"entryPoint": 222,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"panic_error_0x11": {
"entryPoint": 264,
"id": null,
"parameterSlots": 0,
"returnSlots": 0
}
},
"generatedSources": [
{
"ast": {
"nodeType": "YulBlock",
"src": "0:802: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"
},
{
"body": {
"nodeType": "YulBlock",
"src": "485:128:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "495:33:1",
"value": {
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "522:5:1"
}
],
"functionName": {
"name": "cleanup_t_uint256",
"nodeType": "YulIdentifier",
"src": "504:17:1"
},
"nodeType": "YulFunctionCall",
"src": "504:24:1"
},
"variableNames": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "495:5:1"
}
]
},
{
"body": {
"nodeType": "YulBlock",
"src": "556:22:1",
"statements": [
{
"expression": {
"arguments": [],
"functionName": {
"name": "panic_error_0x11",
"nodeType": "YulIdentifier",
"src": "558:16:1"
},
"nodeType": "YulFunctionCall",
"src": "558:18:1"
},
"nodeType": "YulExpressionStatement",
"src": "558:18:1"
}
]
},
"condition": {
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "543:5:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "550:4:1",
"type": "",
"value": "0x00"
}
],
"functionName": {
"name": "eq",
"nodeType": "YulIdentifier",
"src": "540:2:1"
},
"nodeType": "YulFunctionCall",
"src": "540:15:1"
},
"nodeType": "YulIf",
"src": "537:41:1"
},
{
"nodeType": "YulAssignment",
"src": "587:20:1",
"value": {
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "598:5:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "605:1:1",
"type": "",
"value": "1"
}
],
"functionName": {
"name": "sub",
"nodeType": "YulIdentifier",
"src": "594:3:1"
},
"nodeType": "YulFunctionCall",
"src": "594:13:1"
},
"variableNames": [
{
"name": "ret",
"nodeType": "YulIdentifier",
"src": "587:3:1"
}
]
}
]
},
"name": "decrement_t_uint256",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "471:5:1",
"type": ""
}
],
"returnVariables": [
{
"name": "ret",
"nodeType": "YulTypedName",
"src": "481:3:1",
"type": ""
}
],
"src": "442:171:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "647:152:1",
"statements": [
{
"expression": {
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "664:1:1",
"type": "",
"value": "0"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "667:77:1",
"type": "",
"value": "35408467139433450592217433187231851964531694900788300625387963629091585785856"
}
],
"functionName": {
"name": "mstore",
"nodeType": "YulIdentifier",
"src": "657:6:1"
},
"nodeType": "YulFunctionCall",
"src": "657:88:1"
},
"nodeType": "YulExpressionStatement",
"src": "657:88:1"
},
{
"expression": {
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "761:1:1",
"type": "",
"value": "4"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "764:4:1",
"type": "",
"value": "0x11"
}
],
"functionName": {
"name": "mstore",
"nodeType": "YulIdentifier",
"src": "754:6:1"
},
"nodeType": "YulFunctionCall",
"src": "754:15:1"
},
"nodeType": "YulExpressionStatement",
"src": "754:15:1"
},
{
"expression": {
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "785:1:1",
"type": "",
"value": "0"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "788:4:1",
"type": "",
"value": "0x24"
}
],
"functionName": {
"name": "revert",
"nodeType": "YulIdentifier",
"src": "778:6:1"
},
"nodeType": "YulFunctionCall",
"src": "778:15:1"
},
"nodeType": "YulExpressionStatement",
"src": "778:15:1"
}
]
},
"name": "panic_error_0x11",
"nodeType": "YulFunctionDefinition",
"src": "619:180: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 function decrement_t_uint256(value) -> ret {\n value := cleanup_t_uint256(value)\n if eq(value, 0x00) { panic_error_0x11() }\n ret := sub(value, 1)\n }\n\n function panic_error_0x11() {\n mstore(0, 35408467139433450592217433187231851964531694900788300625387963629091585785856)\n mstore(4, 0x11)\n revert(0, 0x24)\n }\n\n}\n",
"id": 1,
"language": "Yul",
"name": "#utility.yul"
}
],
"immutableReferences": {},
"linkReferences": {},
"object": "608060405234801561001057600080fd5b50600436106100365760003560e01c80637f3f6a731461003b578063a9a3e61114610059575b600080fd5b610043610077565b60405161005091906100b9565b60405180910390f35b610061610093565b60405161006e91906100b9565b60405180910390f35b600080600090508080610089906100de565b9150508091505090565b600080600090508080600190039150508091505090565b6100b3816100d4565b82525050565b60006020820190506100ce60008301846100aa565b92915050565b6000819050919050565b60006100e9826100d4565b915060008214156100fd576100fc610108565b5b600182039050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fdfea2646970667358221220e9c853b66f40ced323f95fd0de9cda09452ef2e8925eaf635602cc32455c9a0864736f6c63430008070033",
"opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x4 CALLDATASIZE LT PUSH2 0x36 JUMPI PUSH1 0x0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x7F3F6A73 EQ PUSH2 0x3B JUMPI DUP1 PUSH4 0xA9A3E611 EQ PUSH2 0x59 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x43 PUSH2 0x77 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x50 SWAP2 SWAP1 PUSH2 0xB9 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x61 PUSH2 0x93 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x6E SWAP2 SWAP1 PUSH2 0xB9 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 SWAP1 POP DUP1 DUP1 PUSH2 0x89 SWAP1 PUSH2 0xDE JUMP JUMPDEST SWAP2 POP POP DUP1 SWAP2 POP POP SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 SWAP1 POP DUP1 DUP1 PUSH1 0x1 SWAP1 SUB SWAP2 POP POP DUP1 SWAP2 POP POP SWAP1 JUMP JUMPDEST PUSH2 0xB3 DUP2 PUSH2 0xD4 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP PUSH2 0xCE PUSH1 0x0 DUP4 ADD DUP5 PUSH2 0xAA JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0xE9 DUP3 PUSH2 0xD4 JUMP JUMPDEST SWAP2 POP PUSH1 0x0 DUP3 EQ ISZERO PUSH2 0xFD JUMPI PUSH2 0xFC PUSH2 0x108 JUMP JUMPDEST JUMPDEST PUSH1 0x1 DUP3 SUB SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x4E487B7100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH1 0x11 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH1 0x0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0xE9 0xC8 MSTORE8 0xB6 PUSH16 0x40CED323F95FD0DE9CDA09452EF2E892 0x5E 0xAF PUSH4 0x5602CC32 GASLIMIT 0x5C SWAP11 ADDMOD PUSH5 0x736F6C6343 STOP ADDMOD SMOD STOP CALLER ",
"sourceMap": "72:358:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;97:114;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;290:137;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;97:114;143:4;160:6;169:1;160:10;;181:3;;;;;:::i;:::-;;;;202:1;195:8;;;97:114;:::o;290:137::-;345:4;362:6;371:1;362:10;;395:3;;;;;;;;418:1;411:8;;;290:137;:::o;7:118:1:-;94:24;112:5;94:24;:::i;:::-;89:3;82:37;7:118;;:::o;131:222::-;224:4;262:2;251:9;247:18;239:26;;275:71;343:1;332:9;328:17;319:6;275:71;:::i;:::-;131:222;;;;:::o;359:77::-;396:7;425:5;414:16;;359:77;;;:::o;442:171::-;481:3;504:24;522:5;504:24;:::i;:::-;495:33;;550:4;543:5;540:15;537:41;;;558:18;;:::i;:::-;537:41;605:1;598:5;594:13;587:20;;442:171;;;:::o;619:180::-;667:77;664:1;657:88;764:4;761:1;754:15;788:4;785:1;778:15"
},
"gasEstimates": {
"creation": {
"codeDepositCost": "73000",
"executionCost": "123",
"totalCost": "73123"
},
"external": {
"testUncheckedUnderflow()": "372",
"testUnderflow()": "269"
}
},
"methodIdentifiers": {
"testUncheckedUnderflow()": "a9a3e611",
"testUnderflow()": "7f3f6a73"
}
},
"abi": [
{
"inputs": [],
"name": "testUncheckedUnderflow",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [],
"name": "testUnderflow",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "pure",
"type": "function"
}
]
}
{
"compiler": {
"version": "0.8.7+commit.e28d00a7"
},
"language": "Solidity",
"output": {
"abi": [
{
"inputs": [],
"name": "testUncheckedUnderflow",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [],
"name": "testUnderflow",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "pure",
"type": "function"
}
],
"devdoc": {
"kind": "dev",
"methods": {},
"version": 1
},
"userdoc": {
"kind": "user",
"methods": {},
"version": 1
}
},
"settings": {
"compilationTarget": {
"contracts/01.Solidity-8.0新特性/Sol.sol": "SafeMath"
},
"evmVersion": "london",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": false,
"runs": 200
},
"remappings": []
},
"sources": {
"contracts/01.Solidity-8.0新特性/Sol.sol": {
"keccak256": "0x28eed03bdb54ce39fc9ca66ae96ae880952d670f12fc077af1cd95250a49752a",
"license": "MIT",
"urls": [
"bzz-raw://7944dbc7a395a509fe0b17fab5252741e18cce28c56b3ca00850c2933a86aa96",
"dweb:/ipfs/QmVYV3KiNXkaZzBhF7t2S5ZV2UMJcpkEaz5iidMw3EYiNA"
]
}
},
"version": 1
}
{
"deploy": {
"VM:-": {
"linkReferences": {},
"autoDeployLib": true
},
"main:1": {
"linkReferences": {},
"autoDeployLib": true
},
"ropsten:3": {
"linkReferences": {},
"autoDeployLib": true
},
"rinkeby:4": {
"linkReferences": {},
"autoDeployLib": true
},
"kovan:42": {
"linkReferences": {},
"autoDeployLib": true
},
"goerli:5": {
"linkReferences": {},
"autoDeployLib": true
},
"Custom": {
"linkReferences": {},
"autoDeployLib": true
}
},
"data": {
"bytecode": {
"functionDebugData": {},
"generatedSources": [],
"linkReferences": {},
"object": "608060405234801561001057600080fd5b50610168806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063f8a8fd6d14610030575b600080fd5b61003861004e565b6040516100459190610084565b60405180910390f35b600061005a607b61005f565b905090565b600060028261006e919061009f565b9050919050565b61007e816100f9565b82525050565b60006020820190506100996000830184610075565b92915050565b60006100aa826100f9565b91506100b5836100f9565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156100ee576100ed610103565b5b828202905092915050565b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fdfea264697066735822122060e758bf71d402691de49a3f14214598de3e2c05e5cec7514ecafa53497792f464736f6c63430008070033",
"opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x168 DUP1 PUSH2 0x20 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN INVALID PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x4 CALLDATASIZE LT PUSH2 0x2B JUMPI PUSH1 0x0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0xF8A8FD6D EQ PUSH2 0x30 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x38 PUSH2 0x4E JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x45 SWAP2 SWAP1 PUSH2 0x84 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH1 0x0 PUSH2 0x5A PUSH1 0x7B PUSH2 0x5F JUMP JUMPDEST SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x2 DUP3 PUSH2 0x6E SWAP2 SWAP1 PUSH2 0x9F JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x7E DUP2 PUSH2 0xF9 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP PUSH2 0x99 PUSH1 0x0 DUP4 ADD DUP5 PUSH2 0x75 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0xAA DUP3 PUSH2 0xF9 JUMP JUMPDEST SWAP2 POP PUSH2 0xB5 DUP4 PUSH2 0xF9 JUMP JUMPDEST SWAP3 POP DUP2 PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DIV DUP4 GT DUP3 ISZERO ISZERO AND ISZERO PUSH2 0xEE JUMPI PUSH2 0xED PUSH2 0x103 JUMP JUMPDEST JUMPDEST DUP3 DUP3 MUL SWAP1 POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x4E487B7100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH1 0x11 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH1 0x0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 PUSH1 0xE7 PC 0xBF PUSH18 0xD402691DE49A3F14214598DE3E2C05E5CEC7 MLOAD 0x4E 0xCA STATICCALL MSTORE8 0x49 PUSH24 0x92F464736F6C634300080700330000000000000000000000 ",
"sourceMap": "162:112:0:-:0;;;;;;;;;;;;;;;;;;;"
},
"deployedBytecode": {
"functionDebugData": {
"@helper_13": {
"entryPoint": 95,
"id": 13,
"parameterSlots": 1,
"returnSlots": 1
},
"@test_23": {
"entryPoint": 78,
"id": 23,
"parameterSlots": 0,
"returnSlots": 1
},
"abi_encode_t_uint256_to_t_uint256_fromStack": {
"entryPoint": 117,
"id": null,
"parameterSlots": 2,
"returnSlots": 0
},
"abi_encode_tuple_t_uint256__to_t_uint256__fromStack_reversed": {
"entryPoint": 132,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"checked_mul_t_uint256": {
"entryPoint": 159,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"cleanup_t_uint256": {
"entryPoint": 249,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"panic_error_0x11": {
"entryPoint": 259,
"id": null,
"parameterSlots": 0,
"returnSlots": 0
}
},
"generatedSources": [
{
"ast": {
"nodeType": "YulBlock",
"src": "0:979: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": "407:300:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "417:25:1",
"value": {
"arguments": [
{
"name": "x",
"nodeType": "YulIdentifier",
"src": "440:1:1"
}
],
"functionName": {
"name": "cleanup_t_uint256",
"nodeType": "YulIdentifier",
"src": "422:17:1"
},
"nodeType": "YulFunctionCall",
"src": "422:20:1"
},
"variableNames": [
{
"name": "x",
"nodeType": "YulIdentifier",
"src": "417:1:1"
}
]
},
{
"nodeType": "YulAssignment",
"src": "451:25:1",
"value": {
"arguments": [
{
"name": "y",
"nodeType": "YulIdentifier",
"src": "474:1:1"
}
],
"functionName": {
"name": "cleanup_t_uint256",
"nodeType": "YulIdentifier",
"src": "456:17:1"
},
"nodeType": "YulFunctionCall",
"src": "456:20:1"
},
"variableNames": [
{
"name": "y",
"nodeType": "YulIdentifier",
"src": "451:1:1"
}
]
},
{
"body": {
"nodeType": "YulBlock",
"src": "649:22:1",
"statements": [
{
"expression": {
"arguments": [],
"functionName": {
"name": "panic_error_0x11",
"nodeType": "YulIdentifier",
"src": "651:16:1"
},
"nodeType": "YulFunctionCall",
"src": "651:18:1"
},
"nodeType": "YulExpressionStatement",
"src": "651:18:1"
}
]
},
"condition": {
"arguments": [
{
"arguments": [
{
"arguments": [
{
"name": "x",
"nodeType": "YulIdentifier",
"src": "561:1:1"
}
],
"functionName": {
"name": "iszero",
"nodeType": "YulIdentifier",
"src": "554:6:1"
},
"nodeType": "YulFunctionCall",
"src": "554:9:1"
}
],
"functionName": {
"name": "iszero",
"nodeType": "YulIdentifier",
"src": "547:6:1"
},
"nodeType": "YulFunctionCall",
"src": "547:17:1"
},
{
"arguments": [
{
"name": "y",
"nodeType": "YulIdentifier",
"src": "569:1:1"
},
{
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "576:66:1",
"type": "",
"value": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
},
{
"name": "x",
"nodeType": "YulIdentifier",
"src": "644:1:1"
}
],
"functionName": {
"name": "div",
"nodeType": "YulIdentifier",
"src": "572:3:1"
},
"nodeType": "YulFunctionCall",
"src": "572:74:1"
}
],
"functionName": {
"name": "gt",
"nodeType": "YulIdentifier",
"src": "566:2:1"
},
"nodeType": "YulFunctionCall",
"src": "566:81:1"
}
],
"functionName": {
"name": "and",
"nodeType": "YulIdentifier",
"src": "543:3:1"
},
"nodeType": "YulFunctionCall",
"src": "543:105:1"
},
"nodeType": "YulIf",
"src": "540:131:1"
},
{
"nodeType": "YulAssignment",
"src": "681:20:1",
"value": {
"arguments": [
{
"name": "x",
"nodeType": "YulIdentifier",
"src": "696:1:1"
},
{
"name": "y",
"nodeType": "YulIdentifier",
"src": "699:1:1"
}
],
"functionName": {
"name": "mul",
"nodeType": "YulIdentifier",
"src": "692:3:1"
},
"nodeType": "YulFunctionCall",
"src": "692:9:1"
},
"variableNames": [
{
"name": "product",
"nodeType": "YulIdentifier",
"src": "681:7:1"
}
]
}
]
},
"name": "checked_mul_t_uint256",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "x",
"nodeType": "YulTypedName",
"src": "390:1:1",
"type": ""
},
{
"name": "y",
"nodeType": "YulTypedName",
"src": "393:1:1",
"type": ""
}
],
"returnVariables": [
{
"name": "product",
"nodeType": "YulTypedName",
"src": "399:7:1",
"type": ""
}
],
"src": "359:348:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "758:32:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "768:16:1",
"value": {
"name": "value",
"nodeType": "YulIdentifier",
"src": "779:5:1"
},
"variableNames": [
{
"name": "cleaned",
"nodeType": "YulIdentifier",
"src": "768:7:1"
}
]
}
]
},
"name": "cleanup_t_uint256",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "740:5:1",
"type": ""
}
],
"returnVariables": [
{
"name": "cleaned",
"nodeType": "YulTypedName",
"src": "750:7:1",
"type": ""
}
],
"src": "713:77:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "824:152:1",
"statements": [
{
"expression": {
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "841:1:1",
"type": "",
"value": "0"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "844:77:1",
"type": "",
"value": "35408467139433450592217433187231851964531694900788300625387963629091585785856"
}
],
"functionName": {
"name": "mstore",
"nodeType": "YulIdentifier",
"src": "834:6:1"
},
"nodeType": "YulFunctionCall",
"src": "834:88:1"
},
"nodeType": "YulExpressionStatement",
"src": "834:88:1"
},
{
"expression": {
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "938:1:1",
"type": "",
"value": "4"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "941:4:1",
"type": "",
"value": "0x11"
}
],
"functionName": {
"name": "mstore",
"nodeType": "YulIdentifier",
"src": "931:6:1"
},
"nodeType": "YulFunctionCall",
"src": "931:15:1"
},
"nodeType": "YulExpressionStatement",
"src": "931:15:1"
},
{
"expression": {
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "962:1:1",
"type": "",
"value": "0"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "965:4:1",
"type": "",
"value": "0x24"
}
],
"functionName": {
"name": "revert",
"nodeType": "YulIdentifier",
"src": "955:6:1"
},
"nodeType": "YulFunctionCall",
"src": "955:15:1"
},
"nodeType": "YulExpressionStatement",
"src": "955:15:1"
}
]
},
"name": "panic_error_0x11",
"nodeType": "YulFunctionDefinition",
"src": "796:180: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 checked_mul_t_uint256(x, y) -> product {\n x := cleanup_t_uint256(x)\n y := cleanup_t_uint256(y)\n\n // overflow, if x != 0 and y > (maxValue / x)\n if and(iszero(iszero(x)), gt(y, div(0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff, x))) { panic_error_0x11() }\n\n product := mul(x, y)\n }\n\n function cleanup_t_uint256(value) -> cleaned {\n cleaned := value\n }\n\n function panic_error_0x11() {\n mstore(0, 35408467139433450592217433187231851964531694900788300625387963629091585785856)\n mstore(4, 0x11)\n revert(0, 0x24)\n }\n\n}\n",
"id": 1,
"language": "Yul",
"name": "#utility.yul"
}
],
"immutableReferences": {},
"linkReferences": {},
"object": "608060405234801561001057600080fd5b506004361061002b5760003560e01c8063f8a8fd6d14610030575b600080fd5b61003861004e565b6040516100459190610084565b60405180910390f35b600061005a607b61005f565b905090565b600060028261006e919061009f565b9050919050565b61007e816100f9565b82525050565b60006020820190506100996000830184610075565b92915050565b60006100aa826100f9565b91506100b5836100f9565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156100ee576100ed610103565b5b828202905092915050565b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fdfea264697066735822122060e758bf71d402691de49a3f14214598de3e2c05e5cec7514ecafa53497792f464736f6c63430008070033",
"opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x4 CALLDATASIZE LT PUSH2 0x2B JUMPI PUSH1 0x0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0xF8A8FD6D EQ PUSH2 0x30 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x38 PUSH2 0x4E JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x45 SWAP2 SWAP1 PUSH2 0x84 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH1 0x0 PUSH2 0x5A PUSH1 0x7B PUSH2 0x5F JUMP JUMPDEST SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x2 DUP3 PUSH2 0x6E SWAP2 SWAP1 PUSH2 0x9F JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x7E DUP2 PUSH2 0xF9 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP PUSH2 0x99 PUSH1 0x0 DUP4 ADD DUP5 PUSH2 0x75 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0xAA DUP3 PUSH2 0xF9 JUMP JUMPDEST SWAP2 POP PUSH2 0xB5 DUP4 PUSH2 0xF9 JUMP JUMPDEST SWAP3 POP DUP2 PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DIV DUP4 GT DUP3 ISZERO ISZERO AND ISZERO PUSH2 0xEE JUMPI PUSH2 0xED PUSH2 0x103 JUMP JUMPDEST JUMPDEST DUP3 DUP3 MUL SWAP1 POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x4E487B7100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH1 0x11 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH1 0x0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 PUSH1 0xE7 PC 0xBF PUSH18 0xD402691DE49A3F14214598DE3E2C05E5CEC7 MLOAD 0x4E 0xCA STATICCALL MSTORE8 0x49 PUSH24 0x92F464736F6C634300080700330000000000000000000000 ",
"sourceMap": "162:112:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;189:82;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;;228:4;252:11;259:3;252:6;:11::i;:::-;245:18;;189:82;:::o;91:67::-;129:4;153:1;149;:5;;;;:::i;:::-;142:12;;91:67;;;:::o;7:118:1:-;94:24;112:5;94:24;:::i;:::-;89:3;82:37;7:118;;:::o;131:222::-;224:4;262:2;251:9;247:18;239:26;;275:71;343:1;332:9;328:17;319:6;275:71;:::i;:::-;131:222;;;;:::o;359:348::-;399:7;422:20;440:1;422:20;:::i;:::-;417:25;;456:20;474:1;456:20;:::i;:::-;451:25;;644:1;576:66;572:74;569:1;566:81;561:1;554:9;547:17;543:105;540:131;;;651:18;;:::i;:::-;540:131;699:1;696;692:9;681:20;;359:348;;;;:::o;713:77::-;750:7;779:5;768:16;;713:77;;;:::o;796:180::-;844:77;841:1;834:88;941:4;938:1;931:15;965:4;962:1;955:15"
},
"gasEstimates": {
"creation": {
"codeDepositCost": "72000",
"executionCost": "123",
"totalCost": "72123"
},
"external": {
"test()": "infinite"
}
},
"methodIdentifiers": {
"test()": "f8a8fd6d"
}
},
"abi": [
{
"inputs": [],
"name": "test",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
}
]
}
{
"compiler": {
"version": "0.8.7+commit.e28d00a7"
},
"language": "Solidity",
"output": {
"abi": [
{
"inputs": [],
"name": "test",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
}
],
"devdoc": {
"kind": "dev",
"methods": {},
"version": 1
},
"userdoc": {
"kind": "user",
"methods": {},
"version": 1
}
},
"settings": {
"compilationTarget": {
"contracts/01.Solidity-8.0新特性/TestHelper.sol": "TestHelper"
},
"evmVersion": "london",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": false,
"runs": 200
},
"remappings": []
},
"sources": {
"contracts/01.Solidity-8.0新特性/TestHelper.sol": {
"keccak256": "0x17f91fc11a6058f23fb302b0cea1d975eef3da6868c789b00f89191d73df2634",
"license": "MIT",
"urls": [
"bzz-raw://dfcd13d166950d21775e95f6c2cc1fb4c64a63b4620cce977327f0fc6cc213ed",
"dweb:/ipfs/QmRyB6LzZR6fEB6NtzAvvJFXUh5xvah3K4ox2bCfqhvtGB"
]
}
},
"version": 1
}
{
"deploy": {
"VM:-": {
"linkReferences": {},
"autoDeployLib": true
},
"main:1": {
"linkReferences": {},
"autoDeployLib": true
},
"ropsten:3": {
"linkReferences": {},
"autoDeployLib": true
},
"rinkeby:4": {
"linkReferences": {},
"autoDeployLib": true
},
"kovan:42": {
"linkReferences": {},
"autoDeployLib": true
},
"goerli:5": {
"linkReferences": {},
"autoDeployLib": true
},
"Custom": {
"linkReferences": {},
"autoDeployLib": true
}
},
"data": {
"bytecode": {
"functionDebugData": {},
"generatedSources": [],
"linkReferences": {},
"object": "6080604052336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555034801561005057600080fd5b506101c5806100606000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c80633ccfd60b14610030575b600080fd5b61003861003a565b005b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146100ca57336040517f8e4a23d60000000000000000000000000000000000000000000000000000000081526004016100c19190610142565b60405180910390fd5b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f19350505050158015610130573d6000803e3d6000fd5b50565b61013c8161015d565b82525050565b60006020820190506101576000830184610133565b92915050565b60006101688261016f565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff8216905091905056fea26469706673582212205924ac7f86e6df1bc3da8b037d2c1c5335fc2f637317796e3858b084cea8804464736f6c63430008070033",
"opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLER PUSH1 0x0 DUP1 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF MUL NOT AND SWAP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND MUL OR SWAP1 SSTORE POP CALLVALUE DUP1 ISZERO PUSH2 0x50 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1C5 DUP1 PUSH2 0x60 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN INVALID PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x4 CALLDATASIZE LT PUSH2 0x2B JUMPI PUSH1 0x0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x3CCFD60B EQ PUSH2 0x30 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x38 PUSH2 0x3A JUMP JUMPDEST STOP JUMPDEST PUSH1 0x0 DUP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ PUSH2 0xCA JUMPI CALLER PUSH1 0x40 MLOAD PUSH32 0x8E4A23D600000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xC1 SWAP2 SWAP1 PUSH2 0x142 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x0 DUP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH2 0x8FC SELFBALANCE SWAP1 DUP2 ISZERO MUL SWAP1 PUSH1 0x40 MLOAD PUSH1 0x0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 DUP6 DUP9 DUP9 CALL SWAP4 POP POP POP POP ISZERO DUP1 ISZERO PUSH2 0x130 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP JUMP JUMPDEST PUSH2 0x13C DUP2 PUSH2 0x15D JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP PUSH2 0x157 PUSH1 0x0 DUP4 ADD DUP5 PUSH2 0x133 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x168 DUP3 PUSH2 0x16F JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND SWAP1 POP SWAP2 SWAP1 POP JUMP INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 MSIZE 0x24 0xAC PUSH32 0x86E6DF1BC3DA8B037D2C1C5335FC2F637317796E3858B084CEA8804464736F6C PUSH4 0x43000807 STOP CALLER ",
"sourceMap": "77:466:0:-:0;;;140:10;108:43;;;;;;;;;;;;;;;;;;;;77:466;;;;;;;;;;;;;;;;"
},
"deployedBytecode": {
"functionDebugData": {
"@withdraw_36": {
"entryPoint": 58,
"id": 36,
"parameterSlots": 0,
"returnSlots": 0
},
"abi_encode_t_address_to_t_address_fromStack": {
"entryPoint": 307,
"id": null,
"parameterSlots": 2,
"returnSlots": 0
},
"abi_encode_tuple_t_address__to_t_address__fromStack_reversed": {
"entryPoint": 322,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"cleanup_t_address": {
"entryPoint": 349,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"cleanup_t_uint160": {
"entryPoint": 367,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
}
},
"generatedSources": [
{
"ast": {
"nodeType": "YulBlock",
"src": "0:590: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_address",
"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_address_to_t_address_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_address_to_t_address_fromStack",
"nodeType": "YulIdentifier",
"src": "275:43:1"
},
"nodeType": "YulFunctionCall",
"src": "275:71:1"
},
"nodeType": "YulExpressionStatement",
"src": "275:71:1"
}
]
},
"name": "abi_encode_tuple_t_address__to_t_address__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:51:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "414:35:1",
"value": {
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "443:5:1"
}
],
"functionName": {
"name": "cleanup_t_uint160",
"nodeType": "YulIdentifier",
"src": "425:17:1"
},
"nodeType": "YulFunctionCall",
"src": "425:24:1"
},
"variableNames": [
{
"name": "cleaned",
"nodeType": "YulIdentifier",
"src": "414:7:1"
}
]
}
]
},
"name": "cleanup_t_address",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "386:5:1",
"type": ""
}
],
"returnVariables": [
{
"name": "cleaned",
"nodeType": "YulTypedName",
"src": "396:7:1",
"type": ""
}
],
"src": "359:96:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "506:81:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "516:65:1",
"value": {
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "531:5:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "538:42:1",
"type": "",
"value": "0xffffffffffffffffffffffffffffffffffffffff"
}
],
"functionName": {
"name": "and",
"nodeType": "YulIdentifier",
"src": "527:3:1"
},
"nodeType": "YulFunctionCall",
"src": "527:54:1"
},
"variableNames": [
{
"name": "cleaned",
"nodeType": "YulIdentifier",
"src": "516:7:1"
}
]
}
]
},
"name": "cleanup_t_uint160",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "488:5:1",
"type": ""
}
],
"returnVariables": [
{
"name": "cleaned",
"nodeType": "YulTypedName",
"src": "498:7:1",
"type": ""
}
],
"src": "461:126:1"
}
]
},
"contents": "{\n\n function abi_encode_t_address_to_t_address_fromStack(value, pos) {\n mstore(pos, cleanup_t_address(value))\n }\n\n function abi_encode_tuple_t_address__to_t_address__fromStack_reversed(headStart , value0) -> tail {\n tail := add(headStart, 32)\n\n abi_encode_t_address_to_t_address_fromStack(value0, add(headStart, 0))\n\n }\n\n function cleanup_t_address(value) -> cleaned {\n cleaned := cleanup_t_uint160(value)\n }\n\n function cleanup_t_uint160(value) -> cleaned {\n cleaned := and(value, 0xffffffffffffffffffffffffffffffffffffffff)\n }\n\n}\n",
"id": 1,
"language": "Yul",
"name": "#utility.yul"
}
],
"immutableReferences": {},
"linkReferences": {},
"object": "608060405234801561001057600080fd5b506004361061002b5760003560e01c80633ccfd60b14610030575b600080fd5b61003861003a565b005b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146100ca57336040517f8e4a23d60000000000000000000000000000000000000000000000000000000081526004016100c19190610142565b60405180910390fd5b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f19350505050158015610130573d6000803e3d6000fd5b50565b61013c8161015d565b82525050565b60006020820190506101576000830184610133565b92915050565b60006101688261016f565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff8216905091905056fea26469706673582212205924ac7f86e6df1bc3da8b037d2c1c5335fc2f637317796e3858b084cea8804464736f6c63430008070033",
"opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x4 CALLDATASIZE LT PUSH2 0x2B JUMPI PUSH1 0x0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x3CCFD60B EQ PUSH2 0x30 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x38 PUSH2 0x3A JUMP JUMPDEST STOP JUMPDEST PUSH1 0x0 DUP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ PUSH2 0xCA JUMPI CALLER PUSH1 0x40 MLOAD PUSH32 0x8E4A23D600000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xC1 SWAP2 SWAP1 PUSH2 0x142 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x0 DUP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH2 0x8FC SELFBALANCE SWAP1 DUP2 ISZERO MUL SWAP1 PUSH1 0x40 MLOAD PUSH1 0x0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 DUP6 DUP9 DUP9 CALL SWAP4 POP POP POP POP ISZERO DUP1 ISZERO PUSH2 0x130 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP JUMP JUMPDEST PUSH2 0x13C DUP2 PUSH2 0x15D JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP PUSH2 0x157 PUSH1 0x0 DUP4 ADD DUP5 PUSH2 0x133 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x168 DUP3 PUSH2 0x16F JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND SWAP1 POP SWAP2 SWAP1 POP JUMP INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 MSIZE 0x24 0xAC PUSH32 0x86E6DF1BC3DA8B037D2C1C5335FC2F637317796E3858B084CEA8804464736F6C PUSH4 0x43000807 STOP CALLER ",
"sourceMap": "77:466:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;203:337;;;:::i;:::-;;;259:5;;;;;;;;;;245:19;;:10;:19;;;241:231;;461:10;448:24;;;;;;;;;;;:::i;:::-;;;;;;;;241:231;495:5;;;;;;;;;;:14;;:37;510:21;495:37;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;203:337::o;7:118:1:-;94:24;112:5;94:24;:::i;:::-;89:3;82:37;7:118;;:::o;131:222::-;224:4;262:2;251:9;247:18;239:26;;275:71;343:1;332:9;328:17;319:6;275:71;:::i;:::-;131:222;;;;:::o;359:96::-;396:7;425:24;443:5;425:24;:::i;:::-;414:35;;359:96;;;:::o;461:126::-;498:7;538:42;531:5;527:54;516:65;;461:126;;;:::o"
},
"gasEstimates": {
"creation": {
"codeDepositCost": "90600",
"executionCost": "24407",
"totalCost": "115007"
},
"external": {
"withdraw()": "infinite"
}
},
"methodIdentifiers": {
"withdraw()": "3ccfd60b"
}
},
"abi": [
{
"inputs": [
{
"internalType": "address",
"name": "caller",
"type": "address"
}
],
"name": "Unauthorized",
"type": "error"
},
{
"inputs": [],
"name": "withdraw",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
]
}
{
"compiler": {
"version": "0.8.7+commit.e28d00a7"
},
"language": "Solidity",
"output": {
"abi": [
{
"inputs": [
{
"internalType": "address",
"name": "caller",
"type": "address"
}
],
"name": "Unauthorized",
"type": "error"
},
{
"inputs": [],
"name": "withdraw",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
],
"devdoc": {
"kind": "dev",
"methods": {},
"version": 1
},
"userdoc": {
"kind": "user",
"methods": {},
"version": 1
}
},
"settings": {
"compilationTarget": {
"contracts/01.Solidity-8.0新特性/VendingMachine.sol": "VendingMachine"
},
"evmVersion": "london",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": false,
"runs": 200
},
"remappings": []
},
"sources": {
"contracts/01.Solidity-8.0新特性/VendingMachine.sol": {
"keccak256": "0x45d31ede5f97f9c55addc6609cca0a5ce2e545e1673632406a668b40ce0e7f3f",
"license": "MIT",
"urls": [
"bzz-raw://78014aaf82f64236f84ae8a04102ad463378e02979468e3738595b5c4e8a1ba2",
"dweb:/ipfs/QmWNYq5cwXvaN54zepL8J8yBqXGNmQ3TLksxjJmS5Twj6F"
]
}
},
"version": 1
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8;
// safe math
contract SafeMath {
function testUnderflow() public pure returns (uint) {
uint x = 0;
x--;
return x;
}
// 不检查时会得到一个溢出的是结果,uint 最大值
function testUncheckedUnderflow() public pure returns (uint) {
uint x = 0;
unchecked { x--; }
return x;
}
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8;
// functions outside contract
function helper(uint x) view returns (uint) {
return x * 2;
}
contract TestHelper {
function test() external view returns (uint) {
return helper(123);
}
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8;
// custom error
contract VendingMachine {
address payable owner = payable(msg.sender);
error Unauthorized(address caller);
function withdraw() public {
if (msg.sender != owner)
// 23642 gas
// revert("error");
// 3000000
// revert("error error error error error");
// 23388
revert Unauthorized(msg.sender);
owner.transfer(address(this).balance);
}
}
// This script can be used to deploy the "Storage" contract using ethers.js library.
// Please make sure to compile "./contracts/1_Storage.sol" file before running this script.
// And use Right click -> "Run" from context menu of the file to run the script. Shortcut: Ctrl+Shift+S
import { deploy } from './ethers-lib'
(async () => {
try {
const result = await deploy('Storage', [])
console.log(`address: ${result.address}`)
} catch (e) {
console.log(e.message)
}
})()
// This script can be used to deploy the "Storage" contract using Web3 library.
// Please make sure to compile "./contracts/1_Storage.sol" file before running this script.
// And use Right click -> "Run" from context menu of the file to run the script. Shortcut: Ctrl+Shift+S
import { deploy } from './web3-lib'
(async () => {
try {
const result = await deploy('Storage', [])
console.log(`address: ${result.address}`)
} catch (e) {
console.log(e.message)
}
})()
import { ethers } from 'ethers'
/**
* Deploy the given contract
* @param {string} contractName name of the contract to deploy
* @param {Array<any>} args list of constructor' parameters
* @param {Number} accountIndex account index from the exposed account
* @return {Contract} deployed contract
*/
export const deploy = async (contractName: string, args: Array<any>, accountIndex?: number): Promise<ethers.Contract> => {
console.log(`deploying ${contractName}`)
// Note that the script needs the ABI which is generated from the compilation artifact.
// Make sure contract is compiled and artifacts are generated
const artifactsPath = `browser/contracts/artifacts/${contractName}.json` // Change this for different path
const metadata = JSON.parse(await remix.call('fileManager', 'getFile', artifactsPath))
// 'web3Provider' is a remix global variable object
const signer = (new ethers.providers.Web3Provider(web3Provider)).getSigner(accountIndex)
const factory = new ethers.ContractFactory(metadata.abi, metadata.data.bytecode.object, signer)
const contract = await factory.deploy(...args)
// The contract is NOT deployed yet; we must wait until it is mined
await contract.deployed()
return contract
}
import Web3 from 'web3'
import { Contract, ContractSendMethod, Options } from 'web3-eth-contract'
/**
* Deploy the given contract
* @param {string} contractName name of the contract to deploy
* @param {Array<any>} args list of constructor' parameters
* @param {string} from account used to send the transaction
* @param {number} gas gas limit
* @return {Options} deployed contract
*/
export const deploy = async (contractName: string, args: Array<any>, from?: string, gas?: number): Promise<Options> => {
const web3 = new Web3(web3Provider)
console.log(`deploying ${contractName}`)
// Note that the script needs the ABI which is generated from the compilation artifact.
// Make sure contract is compiled and artifacts are generated
const artifactsPath = `browser/contracts/artifacts/${contractName}.json`
const metadata = JSON.parse(await remix.call('fileManager', 'getFile', artifactsPath))
const accounts = await web3.eth.getAccounts()
const contract: Contract = new web3.eth.Contract(metadata.abi)
const contractSend: ContractSendMethod = contract.deploy({
data: metadata.data.bytecode.object,
arguments: args
})
const newContractInstance = await contractSend.send({
from: from || accounts[0],
gas: gas || 1500000
})
return newContractInstance.options
}
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
import "remix_tests.sol"; // this import is automatically injected by Remix.
import "hardhat/console.sol";
import "../contracts/3_Ballot.sol";
contract BallotTest {
bytes32[] proposalNames;
Ballot ballotToTest;
function beforeAll () public {
proposalNames.push(bytes32("candidate1"));
ballotToTest = new Ballot(proposalNames);
}
function checkWinningProposal () public {
console.log("Running checkWinningProposal");
ballotToTest.vote(0);
Assert.equal(ballotToTest.winningProposal(), uint(0), "proposal at index 0 should be the winning proposal");
Assert.equal(ballotToTest.winnerName(), bytes32("candidate1"), "candidate1 should be the winner name");
}
function checkWinninProposalWithReturnValue () public view returns (bool) {
return ballotToTest.winningProposal() == 0;
}
}
// Right click on the script name and hit "Run" to execute
const { expect } = require("chai");
const { ethers } = require("hardhat");
describe("Storage", function () {
it("test initial value", async function () {
const Storage = await ethers.getContractFactory("Storage");
const storage = await Storage.deploy();
await storage.deployed();
console.log('storage deployed at:'+ storage.address)
expect((await storage.retrieve()).toNumber()).to.equal(0);
});
it("test updating and retrieving updated value", async function () {
const Storage = await ethers.getContractFactory("Storage");
const storage = await Storage.deploy();
await storage.deployed();
const storage2 = await ethers.getContractAt("Storage", storage.address);
const setValue = await storage2.store(56);
await setValue.wait();
expect((await storage2.retrieve()).toNumber()).to.equal(56);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment