Skip to content

Instantly share code, notes, and snippets.

@mdip226
Created October 4, 2021 01:32
Show Gist options
  • Save mdip226/29806d9f4dbe24ed27ae6855965ff87b to your computer and use it in GitHub Desktop.
Save mdip226/29806d9f4dbe24ed27ae6855965ff87b 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=
{
"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
},
"görli:5": {
"linkReferences": {},
"autoDeployLib": true
},
"Custom": {
"linkReferences": {},
"autoDeployLib": true
}
},
"data": {
"bytecode": {
"functionDebugData": {
"@_17": {
"entryPoint": null,
"id": 17,
"parameterSlots": 0,
"returnSlots": 0
}
},
"generatedSources": [],
"linkReferences": {},
"object": "608060405234801561001057600080fd5b5060006001819055506000808190555061027a8061002f6000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80634717f97c146100465780634900a285146100645780639a0e7d6614610080575b600080fd5b61004e61009e565b60405161005b9190610135565b60405180910390f35b61007e600480360381019061007991906100f9565b6100a7565b005b6100886100da565b6040516100959190610135565b60405180910390f35b60008054905090565b806000808282546100b89190610150565b92505081905550600160008154809291906100d2906101b0565b919050555050565b6000600154905090565b6000813590506100f38161022d565b92915050565b60006020828403121561010f5761010e610228565b5b600061011d848285016100e4565b91505092915050565b61012f816101a6565b82525050565b600060208201905061014a6000830184610126565b92915050565b600061015b826101a6565b9150610166836101a6565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561019b5761019a6101f9565b5b828201905092915050565b6000819050919050565b60006101bb826101a6565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156101ee576101ed6101f9565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600080fd5b610236816101a6565b811461024157600080fd5b5056fea2646970667358221220a695e4212a81b0b68877b4749d9ef5fc25d76ccb53ec6eba48954233ea0eb69a64736f6c63430008070033",
"opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x0 PUSH1 0x1 DUP2 SWAP1 SSTORE POP PUSH1 0x0 DUP1 DUP2 SWAP1 SSTORE POP PUSH2 0x27A DUP1 PUSH2 0x2F 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 0x41 JUMPI PUSH1 0x0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x4717F97C EQ PUSH2 0x46 JUMPI DUP1 PUSH4 0x4900A285 EQ PUSH2 0x64 JUMPI DUP1 PUSH4 0x9A0E7D66 EQ PUSH2 0x80 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4E PUSH2 0x9E JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x5B SWAP2 SWAP1 PUSH2 0x135 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x7E PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x79 SWAP2 SWAP1 PUSH2 0xF9 JUMP JUMPDEST PUSH2 0xA7 JUMP JUMPDEST STOP JUMPDEST PUSH2 0x88 PUSH2 0xDA JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x95 SWAP2 SWAP1 PUSH2 0x135 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH1 0x0 DUP1 SLOAD SWAP1 POP SWAP1 JUMP JUMPDEST DUP1 PUSH1 0x0 DUP1 DUP3 DUP3 SLOAD PUSH2 0xB8 SWAP2 SWAP1 PUSH2 0x150 JUMP JUMPDEST SWAP3 POP POP DUP2 SWAP1 SSTORE POP PUSH1 0x1 PUSH1 0x0 DUP2 SLOAD DUP1 SWAP3 SWAP2 SWAP1 PUSH2 0xD2 SWAP1 PUSH2 0x1B0 JUMP JUMPDEST SWAP2 SWAP1 POP SSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1 SLOAD SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP2 CALLDATALOAD SWAP1 POP PUSH2 0xF3 DUP2 PUSH2 0x22D JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x10F JUMPI PUSH2 0x10E PUSH2 0x228 JUMP JUMPDEST JUMPDEST PUSH1 0x0 PUSH2 0x11D DUP5 DUP3 DUP6 ADD PUSH2 0xE4 JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH2 0x12F DUP2 PUSH2 0x1A6 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP PUSH2 0x14A PUSH1 0x0 DUP4 ADD DUP5 PUSH2 0x126 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x15B DUP3 PUSH2 0x1A6 JUMP JUMPDEST SWAP2 POP PUSH2 0x166 DUP4 PUSH2 0x1A6 JUMP JUMPDEST SWAP3 POP DUP3 PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SUB DUP3 GT ISZERO PUSH2 0x19B JUMPI PUSH2 0x19A PUSH2 0x1F9 JUMP JUMPDEST JUMPDEST DUP3 DUP3 ADD SWAP1 POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1BB DUP3 PUSH2 0x1A6 JUMP JUMPDEST SWAP2 POP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 EQ ISZERO PUSH2 0x1EE JUMPI PUSH2 0x1ED PUSH2 0x1F9 JUMP JUMPDEST JUMPDEST PUSH1 0x1 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x4E487B7100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH1 0x11 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH1 0x0 REVERT JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x236 DUP2 PUSH2 0x1A6 JUMP JUMPDEST DUP2 EQ PUSH2 0x241 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP JUMP INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0xA6 SWAP6 0xE4 0x21 0x2A DUP2 0xB0 0xB6 DUP9 PUSH24 0xB4749D9EF5FC25D76CCB53EC6EBA48954233EA0EB69A6473 PUSH16 0x6C634300080700330000000000000000 ",
"sourceMap": "26:467:0:-:0;;;126:66;;;;;;;;;;163:1;150:10;:14;;;;184:1;174:7;:11;;;;26:467;;;;;;"
},
"deployedBytecode": {
"functionDebugData": {
"@getResults_25": {
"entryPoint": 158,
"id": 25,
"parameterSlots": 0,
"returnSlots": 1
},
"@getTotalVotes_33": {
"entryPoint": 218,
"id": 33,
"parameterSlots": 0,
"returnSlots": 1
},
"@sendBallot_46": {
"entryPoint": 167,
"id": 46,
"parameterSlots": 1,
"returnSlots": 0
},
"abi_decode_t_uint256": {
"entryPoint": 228,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_decode_tuple_t_uint256": {
"entryPoint": 249,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_encode_t_uint256_to_t_uint256_fromStack": {
"entryPoint": 294,
"id": null,
"parameterSlots": 2,
"returnSlots": 0
},
"abi_encode_tuple_t_uint256__to_t_uint256__fromStack_reversed": {
"entryPoint": 309,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"allocate_unbounded": {
"entryPoint": null,
"id": null,
"parameterSlots": 0,
"returnSlots": 1
},
"checked_add_t_uint256": {
"entryPoint": 336,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"cleanup_t_uint256": {
"entryPoint": 422,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"increment_t_uint256": {
"entryPoint": 432,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"panic_error_0x11": {
"entryPoint": 505,
"id": null,
"parameterSlots": 0,
"returnSlots": 0
},
"revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db": {
"entryPoint": null,
"id": null,
"parameterSlots": 0,
"returnSlots": 0
},
"revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b": {
"entryPoint": 552,
"id": null,
"parameterSlots": 0,
"returnSlots": 0
},
"validator_revert_t_uint256": {
"entryPoint": 557,
"id": null,
"parameterSlots": 1,
"returnSlots": 0
}
},
"generatedSources": [
{
"ast": {
"nodeType": "YulBlock",
"src": "0:2110:1",
"statements": [
{
"body": {
"nodeType": "YulBlock",
"src": "59:87:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "69:29:1",
"value": {
"arguments": [
{
"name": "offset",
"nodeType": "YulIdentifier",
"src": "91:6:1"
}
],
"functionName": {
"name": "calldataload",
"nodeType": "YulIdentifier",
"src": "78:12:1"
},
"nodeType": "YulFunctionCall",
"src": "78:20:1"
},
"variableNames": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "69:5:1"
}
]
},
{
"expression": {
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "134:5:1"
}
],
"functionName": {
"name": "validator_revert_t_uint256",
"nodeType": "YulIdentifier",
"src": "107:26:1"
},
"nodeType": "YulFunctionCall",
"src": "107:33:1"
},
"nodeType": "YulExpressionStatement",
"src": "107:33:1"
}
]
},
"name": "abi_decode_t_uint256",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "offset",
"nodeType": "YulTypedName",
"src": "37:6:1",
"type": ""
},
{
"name": "end",
"nodeType": "YulTypedName",
"src": "45:3:1",
"type": ""
}
],
"returnVariables": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "53:5:1",
"type": ""
}
],
"src": "7:139:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "218:263:1",
"statements": [
{
"body": {
"nodeType": "YulBlock",
"src": "264:83:1",
"statements": [
{
"expression": {
"arguments": [],
"functionName": {
"name": "revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b",
"nodeType": "YulIdentifier",
"src": "266:77:1"
},
"nodeType": "YulFunctionCall",
"src": "266:79:1"
},
"nodeType": "YulExpressionStatement",
"src": "266:79:1"
}
]
},
"condition": {
"arguments": [
{
"arguments": [
{
"name": "dataEnd",
"nodeType": "YulIdentifier",
"src": "239:7:1"
},
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "248:9:1"
}
],
"functionName": {
"name": "sub",
"nodeType": "YulIdentifier",
"src": "235:3:1"
},
"nodeType": "YulFunctionCall",
"src": "235:23:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "260:2:1",
"type": "",
"value": "32"
}
],
"functionName": {
"name": "slt",
"nodeType": "YulIdentifier",
"src": "231:3:1"
},
"nodeType": "YulFunctionCall",
"src": "231:32:1"
},
"nodeType": "YulIf",
"src": "228:119:1"
},
{
"nodeType": "YulBlock",
"src": "357:117:1",
"statements": [
{
"nodeType": "YulVariableDeclaration",
"src": "372:15:1",
"value": {
"kind": "number",
"nodeType": "YulLiteral",
"src": "386:1:1",
"type": "",
"value": "0"
},
"variables": [
{
"name": "offset",
"nodeType": "YulTypedName",
"src": "376:6:1",
"type": ""
}
]
},
{
"nodeType": "YulAssignment",
"src": "401:63:1",
"value": {
"arguments": [
{
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "436:9:1"
},
{
"name": "offset",
"nodeType": "YulIdentifier",
"src": "447:6:1"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "432:3:1"
},
"nodeType": "YulFunctionCall",
"src": "432:22:1"
},
{
"name": "dataEnd",
"nodeType": "YulIdentifier",
"src": "456:7:1"
}
],
"functionName": {
"name": "abi_decode_t_uint256",
"nodeType": "YulIdentifier",
"src": "411:20:1"
},
"nodeType": "YulFunctionCall",
"src": "411:53:1"
},
"variableNames": [
{
"name": "value0",
"nodeType": "YulIdentifier",
"src": "401:6:1"
}
]
}
]
}
]
},
"name": "abi_decode_tuple_t_uint256",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "headStart",
"nodeType": "YulTypedName",
"src": "188:9:1",
"type": ""
},
{
"name": "dataEnd",
"nodeType": "YulTypedName",
"src": "199:7:1",
"type": ""
}
],
"returnVariables": [
{
"name": "value0",
"nodeType": "YulTypedName",
"src": "211:6:1",
"type": ""
}
],
"src": "152:329:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "552:53:1",
"statements": [
{
"expression": {
"arguments": [
{
"name": "pos",
"nodeType": "YulIdentifier",
"src": "569:3:1"
},
{
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "592:5:1"
}
],
"functionName": {
"name": "cleanup_t_uint256",
"nodeType": "YulIdentifier",
"src": "574:17:1"
},
"nodeType": "YulFunctionCall",
"src": "574:24:1"
}
],
"functionName": {
"name": "mstore",
"nodeType": "YulIdentifier",
"src": "562:6:1"
},
"nodeType": "YulFunctionCall",
"src": "562:37:1"
},
"nodeType": "YulExpressionStatement",
"src": "562:37:1"
}
]
},
"name": "abi_encode_t_uint256_to_t_uint256_fromStack",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "540:5:1",
"type": ""
},
{
"name": "pos",
"nodeType": "YulTypedName",
"src": "547:3:1",
"type": ""
}
],
"src": "487:118:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "709:124:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "719:26:1",
"value": {
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "731:9:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "742:2:1",
"type": "",
"value": "32"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "727:3:1"
},
"nodeType": "YulFunctionCall",
"src": "727:18:1"
},
"variableNames": [
{
"name": "tail",
"nodeType": "YulIdentifier",
"src": "719:4:1"
}
]
},
{
"expression": {
"arguments": [
{
"name": "value0",
"nodeType": "YulIdentifier",
"src": "799:6:1"
},
{
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "812:9:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "823:1:1",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "808:3:1"
},
"nodeType": "YulFunctionCall",
"src": "808:17:1"
}
],
"functionName": {
"name": "abi_encode_t_uint256_to_t_uint256_fromStack",
"nodeType": "YulIdentifier",
"src": "755:43:1"
},
"nodeType": "YulFunctionCall",
"src": "755:71:1"
},
"nodeType": "YulExpressionStatement",
"src": "755:71:1"
}
]
},
"name": "abi_encode_tuple_t_uint256__to_t_uint256__fromStack_reversed",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "headStart",
"nodeType": "YulTypedName",
"src": "681:9:1",
"type": ""
},
{
"name": "value0",
"nodeType": "YulTypedName",
"src": "693:6:1",
"type": ""
}
],
"returnVariables": [
{
"name": "tail",
"nodeType": "YulTypedName",
"src": "704:4:1",
"type": ""
}
],
"src": "611:222:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "879:35:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "889:19:1",
"value": {
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "905:2:1",
"type": "",
"value": "64"
}
],
"functionName": {
"name": "mload",
"nodeType": "YulIdentifier",
"src": "899:5:1"
},
"nodeType": "YulFunctionCall",
"src": "899:9:1"
},
"variableNames": [
{
"name": "memPtr",
"nodeType": "YulIdentifier",
"src": "889:6:1"
}
]
}
]
},
"name": "allocate_unbounded",
"nodeType": "YulFunctionDefinition",
"returnVariables": [
{
"name": "memPtr",
"nodeType": "YulTypedName",
"src": "872:6:1",
"type": ""
}
],
"src": "839:75:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "964:261:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "974:25:1",
"value": {
"arguments": [
{
"name": "x",
"nodeType": "YulIdentifier",
"src": "997:1:1"
}
],
"functionName": {
"name": "cleanup_t_uint256",
"nodeType": "YulIdentifier",
"src": "979:17:1"
},
"nodeType": "YulFunctionCall",
"src": "979:20:1"
},
"variableNames": [
{
"name": "x",
"nodeType": "YulIdentifier",
"src": "974:1:1"
}
]
},
{
"nodeType": "YulAssignment",
"src": "1008:25:1",
"value": {
"arguments": [
{
"name": "y",
"nodeType": "YulIdentifier",
"src": "1031:1:1"
}
],
"functionName": {
"name": "cleanup_t_uint256",
"nodeType": "YulIdentifier",
"src": "1013:17:1"
},
"nodeType": "YulFunctionCall",
"src": "1013:20:1"
},
"variableNames": [
{
"name": "y",
"nodeType": "YulIdentifier",
"src": "1008:1:1"
}
]
},
{
"body": {
"nodeType": "YulBlock",
"src": "1171:22:1",
"statements": [
{
"expression": {
"arguments": [],
"functionName": {
"name": "panic_error_0x11",
"nodeType": "YulIdentifier",
"src": "1173:16:1"
},
"nodeType": "YulFunctionCall",
"src": "1173:18:1"
},
"nodeType": "YulExpressionStatement",
"src": "1173:18:1"
}
]
},
"condition": {
"arguments": [
{
"name": "x",
"nodeType": "YulIdentifier",
"src": "1092:1:1"
},
{
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "1099:66:1",
"type": "",
"value": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
},
{
"name": "y",
"nodeType": "YulIdentifier",
"src": "1167:1:1"
}
],
"functionName": {
"name": "sub",
"nodeType": "YulIdentifier",
"src": "1095:3:1"
},
"nodeType": "YulFunctionCall",
"src": "1095:74:1"
}
],
"functionName": {
"name": "gt",
"nodeType": "YulIdentifier",
"src": "1089:2:1"
},
"nodeType": "YulFunctionCall",
"src": "1089:81:1"
},
"nodeType": "YulIf",
"src": "1086:107:1"
},
{
"nodeType": "YulAssignment",
"src": "1203:16:1",
"value": {
"arguments": [
{
"name": "x",
"nodeType": "YulIdentifier",
"src": "1214:1:1"
},
{
"name": "y",
"nodeType": "YulIdentifier",
"src": "1217:1:1"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "1210:3:1"
},
"nodeType": "YulFunctionCall",
"src": "1210:9:1"
},
"variableNames": [
{
"name": "sum",
"nodeType": "YulIdentifier",
"src": "1203:3:1"
}
]
}
]
},
"name": "checked_add_t_uint256",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "x",
"nodeType": "YulTypedName",
"src": "951:1:1",
"type": ""
},
{
"name": "y",
"nodeType": "YulTypedName",
"src": "954:1:1",
"type": ""
}
],
"returnVariables": [
{
"name": "sum",
"nodeType": "YulTypedName",
"src": "960:3:1",
"type": ""
}
],
"src": "920:305:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "1276:32:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "1286:16:1",
"value": {
"name": "value",
"nodeType": "YulIdentifier",
"src": "1297:5:1"
},
"variableNames": [
{
"name": "cleaned",
"nodeType": "YulIdentifier",
"src": "1286:7:1"
}
]
}
]
},
"name": "cleanup_t_uint256",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "1258:5:1",
"type": ""
}
],
"returnVariables": [
{
"name": "cleaned",
"nodeType": "YulTypedName",
"src": "1268:7:1",
"type": ""
}
],
"src": "1231:77:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "1357:190:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "1367:33:1",
"value": {
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "1394:5:1"
}
],
"functionName": {
"name": "cleanup_t_uint256",
"nodeType": "YulIdentifier",
"src": "1376:17:1"
},
"nodeType": "YulFunctionCall",
"src": "1376:24:1"
},
"variableNames": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "1367:5:1"
}
]
},
{
"body": {
"nodeType": "YulBlock",
"src": "1490:22:1",
"statements": [
{
"expression": {
"arguments": [],
"functionName": {
"name": "panic_error_0x11",
"nodeType": "YulIdentifier",
"src": "1492:16:1"
},
"nodeType": "YulFunctionCall",
"src": "1492:18:1"
},
"nodeType": "YulExpressionStatement",
"src": "1492:18:1"
}
]
},
"condition": {
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "1415:5:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "1422:66:1",
"type": "",
"value": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
}
],
"functionName": {
"name": "eq",
"nodeType": "YulIdentifier",
"src": "1412:2:1"
},
"nodeType": "YulFunctionCall",
"src": "1412:77:1"
},
"nodeType": "YulIf",
"src": "1409:103:1"
},
{
"nodeType": "YulAssignment",
"src": "1521:20:1",
"value": {
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "1532:5:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "1539:1:1",
"type": "",
"value": "1"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "1528:3:1"
},
"nodeType": "YulFunctionCall",
"src": "1528:13:1"
},
"variableNames": [
{
"name": "ret",
"nodeType": "YulIdentifier",
"src": "1521:3:1"
}
]
}
]
},
"name": "increment_t_uint256",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "1343:5:1",
"type": ""
}
],
"returnVariables": [
{
"name": "ret",
"nodeType": "YulTypedName",
"src": "1353:3:1",
"type": ""
}
],
"src": "1314:233:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "1581:152:1",
"statements": [
{
"expression": {
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "1598:1:1",
"type": "",
"value": "0"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "1601:77:1",
"type": "",
"value": "35408467139433450592217433187231851964531694900788300625387963629091585785856"
}
],
"functionName": {
"name": "mstore",
"nodeType": "YulIdentifier",
"src": "1591:6:1"
},
"nodeType": "YulFunctionCall",
"src": "1591:88:1"
},
"nodeType": "YulExpressionStatement",
"src": "1591:88:1"
},
{
"expression": {
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "1695:1:1",
"type": "",
"value": "4"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "1698:4:1",
"type": "",
"value": "0x11"
}
],
"functionName": {
"name": "mstore",
"nodeType": "YulIdentifier",
"src": "1688:6:1"
},
"nodeType": "YulFunctionCall",
"src": "1688:15:1"
},
"nodeType": "YulExpressionStatement",
"src": "1688:15:1"
},
{
"expression": {
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "1719:1:1",
"type": "",
"value": "0"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "1722:4:1",
"type": "",
"value": "0x24"
}
],
"functionName": {
"name": "revert",
"nodeType": "YulIdentifier",
"src": "1712:6:1"
},
"nodeType": "YulFunctionCall",
"src": "1712:15:1"
},
"nodeType": "YulExpressionStatement",
"src": "1712:15:1"
}
]
},
"name": "panic_error_0x11",
"nodeType": "YulFunctionDefinition",
"src": "1553:180:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "1828:28:1",
"statements": [
{
"expression": {
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "1845:1:1",
"type": "",
"value": "0"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "1848:1:1",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "revert",
"nodeType": "YulIdentifier",
"src": "1838:6:1"
},
"nodeType": "YulFunctionCall",
"src": "1838:12:1"
},
"nodeType": "YulExpressionStatement",
"src": "1838:12:1"
}
]
},
"name": "revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db",
"nodeType": "YulFunctionDefinition",
"src": "1739:117:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "1951:28:1",
"statements": [
{
"expression": {
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "1968:1:1",
"type": "",
"value": "0"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "1971:1:1",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "revert",
"nodeType": "YulIdentifier",
"src": "1961:6:1"
},
"nodeType": "YulFunctionCall",
"src": "1961:12:1"
},
"nodeType": "YulExpressionStatement",
"src": "1961:12:1"
}
]
},
"name": "revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b",
"nodeType": "YulFunctionDefinition",
"src": "1862:117:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "2028:79:1",
"statements": [
{
"body": {
"nodeType": "YulBlock",
"src": "2085:16:1",
"statements": [
{
"expression": {
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "2094:1:1",
"type": "",
"value": "0"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "2097:1:1",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "revert",
"nodeType": "YulIdentifier",
"src": "2087:6:1"
},
"nodeType": "YulFunctionCall",
"src": "2087:12:1"
},
"nodeType": "YulExpressionStatement",
"src": "2087:12:1"
}
]
},
"condition": {
"arguments": [
{
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "2051:5:1"
},
{
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "2076:5:1"
}
],
"functionName": {
"name": "cleanup_t_uint256",
"nodeType": "YulIdentifier",
"src": "2058:17:1"
},
"nodeType": "YulFunctionCall",
"src": "2058:24:1"
}
],
"functionName": {
"name": "eq",
"nodeType": "YulIdentifier",
"src": "2048:2:1"
},
"nodeType": "YulFunctionCall",
"src": "2048:35:1"
}
],
"functionName": {
"name": "iszero",
"nodeType": "YulIdentifier",
"src": "2041:6:1"
},
"nodeType": "YulFunctionCall",
"src": "2041:43:1"
},
"nodeType": "YulIf",
"src": "2038:63:1"
}
]
},
"name": "validator_revert_t_uint256",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "2021:5:1",
"type": ""
}
],
"src": "1985:122:1"
}
]
},
"contents": "{\n\n function abi_decode_t_uint256(offset, end) -> value {\n value := calldataload(offset)\n validator_revert_t_uint256(value)\n }\n\n function abi_decode_tuple_t_uint256(headStart, dataEnd) -> value0 {\n if slt(sub(dataEnd, headStart), 32) { revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() }\n\n {\n\n let offset := 0\n\n value0 := abi_decode_t_uint256(add(headStart, offset), dataEnd)\n }\n\n }\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 allocate_unbounded() -> memPtr {\n memPtr := mload(64)\n }\n\n function checked_add_t_uint256(x, y) -> sum {\n x := cleanup_t_uint256(x)\n y := cleanup_t_uint256(y)\n\n // overflow, if x > (maxValue - y)\n if gt(x, sub(0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff, y)) { panic_error_0x11() }\n\n sum := add(x, y)\n }\n\n function cleanup_t_uint256(value) -> cleaned {\n cleaned := value\n }\n\n function increment_t_uint256(value) -> ret {\n value := cleanup_t_uint256(value)\n if eq(value, 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) { panic_error_0x11() }\n ret := add(value, 1)\n }\n\n function panic_error_0x11() {\n mstore(0, 35408467139433450592217433187231851964531694900788300625387963629091585785856)\n mstore(4, 0x11)\n revert(0, 0x24)\n }\n\n function revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db() {\n revert(0, 0)\n }\n\n function revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() {\n revert(0, 0)\n }\n\n function validator_revert_t_uint256(value) {\n if iszero(eq(value, cleanup_t_uint256(value))) { revert(0, 0) }\n }\n\n}\n",
"id": 1,
"language": "Yul",
"name": "#utility.yul"
}
],
"immutableReferences": {},
"linkReferences": {},
"object": "608060405234801561001057600080fd5b50600436106100415760003560e01c80634717f97c146100465780634900a285146100645780639a0e7d6614610080575b600080fd5b61004e61009e565b60405161005b9190610135565b60405180910390f35b61007e600480360381019061007991906100f9565b6100a7565b005b6100886100da565b6040516100959190610135565b60405180910390f35b60008054905090565b806000808282546100b89190610150565b92505081905550600160008154809291906100d2906101b0565b919050555050565b6000600154905090565b6000813590506100f38161022d565b92915050565b60006020828403121561010f5761010e610228565b5b600061011d848285016100e4565b91505092915050565b61012f816101a6565b82525050565b600060208201905061014a6000830184610126565b92915050565b600061015b826101a6565b9150610166836101a6565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561019b5761019a6101f9565b5b828201905092915050565b6000819050919050565b60006101bb826101a6565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156101ee576101ed6101f9565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600080fd5b610236816101a6565b811461024157600080fd5b5056fea2646970667358221220a695e4212a81b0b68877b4749d9ef5fc25d76ccb53ec6eba48954233ea0eb69a64736f6c63430008070033",
"opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x4 CALLDATASIZE LT PUSH2 0x41 JUMPI PUSH1 0x0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x4717F97C EQ PUSH2 0x46 JUMPI DUP1 PUSH4 0x4900A285 EQ PUSH2 0x64 JUMPI DUP1 PUSH4 0x9A0E7D66 EQ PUSH2 0x80 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4E PUSH2 0x9E JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x5B SWAP2 SWAP1 PUSH2 0x135 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x7E PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x79 SWAP2 SWAP1 PUSH2 0xF9 JUMP JUMPDEST PUSH2 0xA7 JUMP JUMPDEST STOP JUMPDEST PUSH2 0x88 PUSH2 0xDA JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x95 SWAP2 SWAP1 PUSH2 0x135 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH1 0x0 DUP1 SLOAD SWAP1 POP SWAP1 JUMP JUMPDEST DUP1 PUSH1 0x0 DUP1 DUP3 DUP3 SLOAD PUSH2 0xB8 SWAP2 SWAP1 PUSH2 0x150 JUMP JUMPDEST SWAP3 POP POP DUP2 SWAP1 SSTORE POP PUSH1 0x1 PUSH1 0x0 DUP2 SLOAD DUP1 SWAP3 SWAP2 SWAP1 PUSH2 0xD2 SWAP1 PUSH2 0x1B0 JUMP JUMPDEST SWAP2 SWAP1 POP SSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1 SLOAD SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP2 CALLDATALOAD SWAP1 POP PUSH2 0xF3 DUP2 PUSH2 0x22D JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x10F JUMPI PUSH2 0x10E PUSH2 0x228 JUMP JUMPDEST JUMPDEST PUSH1 0x0 PUSH2 0x11D DUP5 DUP3 DUP6 ADD PUSH2 0xE4 JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH2 0x12F DUP2 PUSH2 0x1A6 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP PUSH2 0x14A PUSH1 0x0 DUP4 ADD DUP5 PUSH2 0x126 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x15B DUP3 PUSH2 0x1A6 JUMP JUMPDEST SWAP2 POP PUSH2 0x166 DUP4 PUSH2 0x1A6 JUMP JUMPDEST SWAP3 POP DUP3 PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SUB DUP3 GT ISZERO PUSH2 0x19B JUMPI PUSH2 0x19A PUSH2 0x1F9 JUMP JUMPDEST JUMPDEST DUP3 DUP3 ADD SWAP1 POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1BB DUP3 PUSH2 0x1A6 JUMP JUMPDEST SWAP2 POP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 EQ ISZERO PUSH2 0x1EE JUMPI PUSH2 0x1ED PUSH2 0x1F9 JUMP JUMPDEST JUMPDEST PUSH1 0x1 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x4E487B7100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH1 0x11 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH1 0x0 REVERT JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x236 DUP2 PUSH2 0x1A6 JUMP JUMPDEST DUP2 EQ PUSH2 0x241 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP JUMP INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0xA6 SWAP6 0xE4 0x21 0x2A DUP2 0xB0 0xB6 DUP9 PUSH24 0xB4749D9EF5FC25D76CCB53EC6EBA48954233EA0EB69A6473 PUSH16 0x6C634300080700330000000000000000 ",
"sourceMap": "26:467:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;202:82;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;393:98;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;294:88;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;202:82;244:7;270;;263:14;;202:82;:::o;393:98::-;456:6;445:7;;:17;;;;;;;:::i;:::-;;;;;;;;472:10;;:12;;;;;;;;;:::i;:::-;;;;;;393:98;:::o;294:88::-;339:7;365:10;;358:17;;294:88;:::o;7:139:1:-;53:5;91:6;78:20;69:29;;107:33;134:5;107:33;:::i;:::-;7:139;;;;:::o;152:329::-;211:6;260:2;248:9;239:7;235:23;231:32;228:119;;;266:79;;:::i;:::-;228:119;386:1;411:53;456:7;447:6;436:9;432:22;411:53;:::i;:::-;401:63;;357:117;152:329;;;;:::o;487:118::-;574:24;592:5;574:24;:::i;:::-;569:3;562:37;487:118;;:::o;611:222::-;704:4;742:2;731:9;727:18;719:26;;755:71;823:1;812:9;808:17;799:6;755:71;:::i;:::-;611:222;;;;:::o;920:305::-;960:3;979:20;997:1;979:20;:::i;:::-;974:25;;1013:20;1031:1;1013:20;:::i;:::-;1008:25;;1167:1;1099:66;1095:74;1092:1;1089:81;1086:107;;;1173:18;;:::i;:::-;1086:107;1217:1;1214;1210:9;1203:16;;920:305;;;;:::o;1231:77::-;1268:7;1297:5;1286:16;;1231:77;;;:::o;1314:233::-;1353:3;1376:24;1394:5;1376:24;:::i;:::-;1367:33;;1422:66;1415:5;1412:77;1409:103;;;1492:18;;:::i;:::-;1409:103;1539:1;1532:5;1528:13;1521:20;;1314:233;;;:::o;1553:180::-;1601:77;1598:1;1591:88;1698:4;1695:1;1688:15;1722:4;1719:1;1712:15;1862:117;1971:1;1968;1961:12;1985:122;2058:24;2076:5;2058:24;:::i;:::-;2051:5;2048:35;2038:63;;2097:1;2094;2087:12;2038:63;1985:122;:::o"
},
"gasEstimates": {
"creation": {
"codeDepositCost": "126800",
"executionCost": "10199",
"totalCost": "136999"
},
"external": {
"getResults()": "2415",
"getTotalVotes()": "2459",
"sendBallot(uint256)": "infinite"
}
},
"methodIdentifiers": {
"getResults()": "4717f97c",
"getTotalVotes()": "9a0e7d66",
"sendBallot(uint256)": "4900a285"
}
},
"abi": [
{
"inputs": [],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"inputs": [],
"name": "getResults",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getTotalVotes",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "ballot",
"type": "uint256"
}
],
"name": "sendBallot",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
]
}
{
"compiler": {
"version": "0.8.7+commit.e28d00a7"
},
"language": "Solidity",
"output": {
"abi": [
{
"inputs": [],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"inputs": [],
"name": "getResults",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getTotalVotes",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "ballot",
"type": "uint256"
}
],
"name": "sendBallot",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
],
"devdoc": {
"kind": "dev",
"methods": {},
"version": 1
},
"userdoc": {
"kind": "user",
"methods": {},
"version": 1
}
},
"settings": {
"compilationTarget": {
"Democracy.sol": "Democracy"
},
"evmVersion": "london",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": false,
"runs": 200
},
"remappings": []
},
"sources": {
"Democracy.sol": {
"keccak256": "0xe5a3139839ad536329b5db3bf78309908a1078b85f926d97da76614d47efb8bb",
"urls": [
"bzz-raw://cbfb563549e6057aa88513e1181c958282b4900f0c24816a42f82d06e7274e1c",
"dweb:/ipfs/Qma9vJRrFVebavkMNKy94CGSbszgeVFeBFHTCkSk1bPJQL"
]
}
},
"version": 1
}
pragma solidity '0.8.7';
contract Democracy {
// int tallyYes = 0;
uint256 results;
uint256 totalVotes;
constructor() {
totalVotes = 0;
results = 0;
}
function getResults() view public returns(uint256) {
return results;
}
function getTotalVotes() view public returns(uint256) {
return totalVotes;
}
function sendBallot(uint256 ballot) public{
results += ballot;
totalVotes++;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment