├── .gitignore ├── README.md ├── build └── contracts │ ├── Bidder.json │ ├── ChatApp.json │ ├── Coin.json │ ├── GasCont.json │ ├── Lottery.json │ ├── Migrations.json │ ├── MyContract.json │ ├── SingleStorage.json │ └── VotingSystem.json ├── contracts ├── BallotV1.sol ├── Bidder.sol ├── ChatApp.sol ├── GasCont.sol ├── Lottery.sol ├── Migrations.sol ├── Minter.sol ├── SingleStorage.sol └── Voting.sol ├── migrations └── 1_initial_migration.js ├── package-lock.json ├── package.json ├── test ├── .gitkeep └── inbox.test.js └── truffle-config.js /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SmartContracts-Solidity 2 | Smart Contracts practice work 3 | -------------------------------------------------------------------------------- /build/contracts/Migrations.json: -------------------------------------------------------------------------------- 1 | { 2 | "contractName": "Migrations", 3 | "abi": [ 4 | { 5 | "inputs": [], 6 | "name": "last_completed_migration", 7 | "outputs": [ 8 | { 9 | "internalType": "uint256", 10 | "name": "", 11 | "type": "uint256" 12 | } 13 | ], 14 | "stateMutability": "view", 15 | "type": "function" 16 | }, 17 | { 18 | "inputs": [], 19 | "name": "owner", 20 | "outputs": [ 21 | { 22 | "internalType": "address", 23 | "name": "", 24 | "type": "address" 25 | } 26 | ], 27 | "stateMutability": "view", 28 | "type": "function" 29 | }, 30 | { 31 | "inputs": [ 32 | { 33 | "internalType": "uint256", 34 | "name": "completed", 35 | "type": "uint256" 36 | } 37 | ], 38 | "name": "setCompleted", 39 | "outputs": [], 40 | "stateMutability": "nonpayable", 41 | "type": "function" 42 | } 43 | ], 44 | "metadata": "{\"compiler\":{\"version\":\"0.8.0+commit.c7dfd78e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"last_completed_migration\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"completed\",\"type\":\"uint256\"}],\"name\":\"setCompleted\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"project:/contracts/Migrations.sol\":\"Migrations\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"project:/contracts/Migrations.sol\":{\"keccak256\":\"0x7eaedbb1a3e4e0f585d9063393872f88ded247ca3c3c3c8492ea18e7629a6411\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4a3eb571cee910095df65a06a1c1d3f89187c72a3c184ef87a7538d9aa39ad07\",\"dweb:/ipfs/QmdqR3vrSSGR49qFGZr49Mb39z7dgD6tSzEDoaqtM31o61\"]}},\"version\":1}", 45 | "bytecode": "0x6080604052336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555034801561005057600080fd5b50610312806100606000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c8063445df0ac146100465780638da5cb5b14610064578063fdacd57614610082575b600080fd5b61004e61009e565b60405161005b919061025d565b60405180910390f35b61006c6100a4565b6040516100799190610222565b60405180910390f35b61009c60048036038101906100979190610175565b6100c8565b005b60015481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610156576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161014d9061023d565b60405180910390fd5b8060018190555050565b60008135905061016f816102c5565b92915050565b60006020828403121561018757600080fd5b600061019584828501610160565b91505092915050565b6101a781610289565b82525050565b60006101ba603383610278565b91507f546869732066756e6374696f6e206973207265737472696374656420746f207460008301527f686520636f6e74726163742773206f776e6572000000000000000000000000006020830152604082019050919050565b61021c816102bb565b82525050565b6000602082019050610237600083018461019e565b92915050565b60006020820190508181036000830152610256816101ad565b9050919050565b60006020820190506102726000830184610213565b92915050565b600082825260208201905092915050565b60006102948261029b565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6102ce816102bb565b81146102d957600080fd5b5056fea26469706673582212205bd2d8fb4d0e3707b9c0e759b95ddbb96b800eac47622a6d102d80a86e3db0e564736f6c63430008000033", 46 | "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c8063445df0ac146100465780638da5cb5b14610064578063fdacd57614610082575b600080fd5b61004e61009e565b60405161005b919061025d565b60405180910390f35b61006c6100a4565b6040516100799190610222565b60405180910390f35b61009c60048036038101906100979190610175565b6100c8565b005b60015481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610156576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161014d9061023d565b60405180910390fd5b8060018190555050565b60008135905061016f816102c5565b92915050565b60006020828403121561018757600080fd5b600061019584828501610160565b91505092915050565b6101a781610289565b82525050565b60006101ba603383610278565b91507f546869732066756e6374696f6e206973207265737472696374656420746f207460008301527f686520636f6e74726163742773206f776e6572000000000000000000000000006020830152604082019050919050565b61021c816102bb565b82525050565b6000602082019050610237600083018461019e565b92915050565b60006020820190508181036000830152610256816101ad565b9050919050565b60006020820190506102726000830184610213565b92915050565b600082825260208201905092915050565b60006102948261029b565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6102ce816102bb565b81146102d957600080fd5b5056fea26469706673582212205bd2d8fb4d0e3707b9c0e759b95ddbb96b800eac47622a6d102d80a86e3db0e564736f6c63430008000033", 47 | "immutableReferences": {}, 48 | "generatedSources": [], 49 | "deployedGeneratedSources": [ 50 | { 51 | "ast": { 52 | "nodeType": "YulBlock", 53 | "src": "0:2555:3", 54 | "statements": [ 55 | { 56 | "body": { 57 | "nodeType": "YulBlock", 58 | "src": "59:87:3", 59 | "statements": [ 60 | { 61 | "nodeType": "YulAssignment", 62 | "src": "69:29:3", 63 | "value": { 64 | "arguments": [ 65 | { 66 | "name": "offset", 67 | "nodeType": "YulIdentifier", 68 | "src": "91:6:3" 69 | } 70 | ], 71 | "functionName": { 72 | "name": "calldataload", 73 | "nodeType": "YulIdentifier", 74 | "src": "78:12:3" 75 | }, 76 | "nodeType": "YulFunctionCall", 77 | "src": "78:20:3" 78 | }, 79 | "variableNames": [ 80 | { 81 | "name": "value", 82 | "nodeType": "YulIdentifier", 83 | "src": "69:5:3" 84 | } 85 | ] 86 | }, 87 | { 88 | "expression": { 89 | "arguments": [ 90 | { 91 | "name": "value", 92 | "nodeType": "YulIdentifier", 93 | "src": "134:5:3" 94 | } 95 | ], 96 | "functionName": { 97 | "name": "validator_revert_t_uint256", 98 | "nodeType": "YulIdentifier", 99 | "src": "107:26:3" 100 | }, 101 | "nodeType": "YulFunctionCall", 102 | "src": "107:33:3" 103 | }, 104 | "nodeType": "YulExpressionStatement", 105 | "src": "107:33:3" 106 | } 107 | ] 108 | }, 109 | "name": "abi_decode_t_uint256", 110 | "nodeType": "YulFunctionDefinition", 111 | "parameters": [ 112 | { 113 | "name": "offset", 114 | "nodeType": "YulTypedName", 115 | "src": "37:6:3", 116 | "type": "" 117 | }, 118 | { 119 | "name": "end", 120 | "nodeType": "YulTypedName", 121 | "src": "45:3:3", 122 | "type": "" 123 | } 124 | ], 125 | "returnVariables": [ 126 | { 127 | "name": "value", 128 | "nodeType": "YulTypedName", 129 | "src": "53:5:3", 130 | "type": "" 131 | } 132 | ], 133 | "src": "7:139:3" 134 | }, 135 | { 136 | "body": { 137 | "nodeType": "YulBlock", 138 | "src": "218:196:3", 139 | "statements": [ 140 | { 141 | "body": { 142 | "nodeType": "YulBlock", 143 | "src": "264:16:3", 144 | "statements": [ 145 | { 146 | "expression": { 147 | "arguments": [ 148 | { 149 | "kind": "number", 150 | "nodeType": "YulLiteral", 151 | "src": "273:1:3", 152 | "type": "", 153 | "value": "0" 154 | }, 155 | { 156 | "kind": "number", 157 | "nodeType": "YulLiteral", 158 | "src": "276:1:3", 159 | "type": "", 160 | "value": "0" 161 | } 162 | ], 163 | "functionName": { 164 | "name": "revert", 165 | "nodeType": "YulIdentifier", 166 | "src": "266:6:3" 167 | }, 168 | "nodeType": "YulFunctionCall", 169 | "src": "266:12:3" 170 | }, 171 | "nodeType": "YulExpressionStatement", 172 | "src": "266:12:3" 173 | } 174 | ] 175 | }, 176 | "condition": { 177 | "arguments": [ 178 | { 179 | "arguments": [ 180 | { 181 | "name": "dataEnd", 182 | "nodeType": "YulIdentifier", 183 | "src": "239:7:3" 184 | }, 185 | { 186 | "name": "headStart", 187 | "nodeType": "YulIdentifier", 188 | "src": "248:9:3" 189 | } 190 | ], 191 | "functionName": { 192 | "name": "sub", 193 | "nodeType": "YulIdentifier", 194 | "src": "235:3:3" 195 | }, 196 | "nodeType": "YulFunctionCall", 197 | "src": "235:23:3" 198 | }, 199 | { 200 | "kind": "number", 201 | "nodeType": "YulLiteral", 202 | "src": "260:2:3", 203 | "type": "", 204 | "value": "32" 205 | } 206 | ], 207 | "functionName": { 208 | "name": "slt", 209 | "nodeType": "YulIdentifier", 210 | "src": "231:3:3" 211 | }, 212 | "nodeType": "YulFunctionCall", 213 | "src": "231:32:3" 214 | }, 215 | "nodeType": "YulIf", 216 | "src": "228:2:3" 217 | }, 218 | { 219 | "nodeType": "YulBlock", 220 | "src": "290:117:3", 221 | "statements": [ 222 | { 223 | "nodeType": "YulVariableDeclaration", 224 | "src": "305:15:3", 225 | "value": { 226 | "kind": "number", 227 | "nodeType": "YulLiteral", 228 | "src": "319:1:3", 229 | "type": "", 230 | "value": "0" 231 | }, 232 | "variables": [ 233 | { 234 | "name": "offset", 235 | "nodeType": "YulTypedName", 236 | "src": "309:6:3", 237 | "type": "" 238 | } 239 | ] 240 | }, 241 | { 242 | "nodeType": "YulAssignment", 243 | "src": "334:63:3", 244 | "value": { 245 | "arguments": [ 246 | { 247 | "arguments": [ 248 | { 249 | "name": "headStart", 250 | "nodeType": "YulIdentifier", 251 | "src": "369:9:3" 252 | }, 253 | { 254 | "name": "offset", 255 | "nodeType": "YulIdentifier", 256 | "src": "380:6:3" 257 | } 258 | ], 259 | "functionName": { 260 | "name": "add", 261 | "nodeType": "YulIdentifier", 262 | "src": "365:3:3" 263 | }, 264 | "nodeType": "YulFunctionCall", 265 | "src": "365:22:3" 266 | }, 267 | { 268 | "name": "dataEnd", 269 | "nodeType": "YulIdentifier", 270 | "src": "389:7:3" 271 | } 272 | ], 273 | "functionName": { 274 | "name": "abi_decode_t_uint256", 275 | "nodeType": "YulIdentifier", 276 | "src": "344:20:3" 277 | }, 278 | "nodeType": "YulFunctionCall", 279 | "src": "344:53:3" 280 | }, 281 | "variableNames": [ 282 | { 283 | "name": "value0", 284 | "nodeType": "YulIdentifier", 285 | "src": "334:6:3" 286 | } 287 | ] 288 | } 289 | ] 290 | } 291 | ] 292 | }, 293 | "name": "abi_decode_tuple_t_uint256", 294 | "nodeType": "YulFunctionDefinition", 295 | "parameters": [ 296 | { 297 | "name": "headStart", 298 | "nodeType": "YulTypedName", 299 | "src": "188:9:3", 300 | "type": "" 301 | }, 302 | { 303 | "name": "dataEnd", 304 | "nodeType": "YulTypedName", 305 | "src": "199:7:3", 306 | "type": "" 307 | } 308 | ], 309 | "returnVariables": [ 310 | { 311 | "name": "value0", 312 | "nodeType": "YulTypedName", 313 | "src": "211:6:3", 314 | "type": "" 315 | } 316 | ], 317 | "src": "152:262:3" 318 | }, 319 | { 320 | "body": { 321 | "nodeType": "YulBlock", 322 | "src": "485:53:3", 323 | "statements": [ 324 | { 325 | "expression": { 326 | "arguments": [ 327 | { 328 | "name": "pos", 329 | "nodeType": "YulIdentifier", 330 | "src": "502:3:3" 331 | }, 332 | { 333 | "arguments": [ 334 | { 335 | "name": "value", 336 | "nodeType": "YulIdentifier", 337 | "src": "525:5:3" 338 | } 339 | ], 340 | "functionName": { 341 | "name": "cleanup_t_address", 342 | "nodeType": "YulIdentifier", 343 | "src": "507:17:3" 344 | }, 345 | "nodeType": "YulFunctionCall", 346 | "src": "507:24:3" 347 | } 348 | ], 349 | "functionName": { 350 | "name": "mstore", 351 | "nodeType": "YulIdentifier", 352 | "src": "495:6:3" 353 | }, 354 | "nodeType": "YulFunctionCall", 355 | "src": "495:37:3" 356 | }, 357 | "nodeType": "YulExpressionStatement", 358 | "src": "495:37:3" 359 | } 360 | ] 361 | }, 362 | "name": "abi_encode_t_address_to_t_address_fromStack", 363 | "nodeType": "YulFunctionDefinition", 364 | "parameters": [ 365 | { 366 | "name": "value", 367 | "nodeType": "YulTypedName", 368 | "src": "473:5:3", 369 | "type": "" 370 | }, 371 | { 372 | "name": "pos", 373 | "nodeType": "YulTypedName", 374 | "src": "480:3:3", 375 | "type": "" 376 | } 377 | ], 378 | "src": "420:118:3" 379 | }, 380 | { 381 | "body": { 382 | "nodeType": "YulBlock", 383 | "src": "690:237:3", 384 | "statements": [ 385 | { 386 | "nodeType": "YulAssignment", 387 | "src": "700:74:3", 388 | "value": { 389 | "arguments": [ 390 | { 391 | "name": "pos", 392 | "nodeType": "YulIdentifier", 393 | "src": "766:3:3" 394 | }, 395 | { 396 | "kind": "number", 397 | "nodeType": "YulLiteral", 398 | "src": "771:2:3", 399 | "type": "", 400 | "value": "51" 401 | } 402 | ], 403 | "functionName": { 404 | "name": "array_storeLengthForEncoding_t_string_memory_ptr_fromStack", 405 | "nodeType": "YulIdentifier", 406 | "src": "707:58:3" 407 | }, 408 | "nodeType": "YulFunctionCall", 409 | "src": "707:67:3" 410 | }, 411 | "variableNames": [ 412 | { 413 | "name": "pos", 414 | "nodeType": "YulIdentifier", 415 | "src": "700:3:3" 416 | } 417 | ] 418 | }, 419 | { 420 | "expression": { 421 | "arguments": [ 422 | { 423 | "arguments": [ 424 | { 425 | "name": "pos", 426 | "nodeType": "YulIdentifier", 427 | "src": "795:3:3" 428 | }, 429 | { 430 | "kind": "number", 431 | "nodeType": "YulLiteral", 432 | "src": "800:1:3", 433 | "type": "", 434 | "value": "0" 435 | } 436 | ], 437 | "functionName": { 438 | "name": "add", 439 | "nodeType": "YulIdentifier", 440 | "src": "791:3:3" 441 | }, 442 | "nodeType": "YulFunctionCall", 443 | "src": "791:11:3" 444 | }, 445 | { 446 | "kind": "string", 447 | "nodeType": "YulLiteral", 448 | "src": "804:34:3", 449 | "type": "", 450 | "value": "This function is restricted to t" 451 | } 452 | ], 453 | "functionName": { 454 | "name": "mstore", 455 | "nodeType": "YulIdentifier", 456 | "src": "784:6:3" 457 | }, 458 | "nodeType": "YulFunctionCall", 459 | "src": "784:55:3" 460 | }, 461 | "nodeType": "YulExpressionStatement", 462 | "src": "784:55:3" 463 | }, 464 | { 465 | "expression": { 466 | "arguments": [ 467 | { 468 | "arguments": [ 469 | { 470 | "name": "pos", 471 | "nodeType": "YulIdentifier", 472 | "src": "860:3:3" 473 | }, 474 | { 475 | "kind": "number", 476 | "nodeType": "YulLiteral", 477 | "src": "865:2:3", 478 | "type": "", 479 | "value": "32" 480 | } 481 | ], 482 | "functionName": { 483 | "name": "add", 484 | "nodeType": "YulIdentifier", 485 | "src": "856:3:3" 486 | }, 487 | "nodeType": "YulFunctionCall", 488 | "src": "856:12:3" 489 | }, 490 | { 491 | "kind": "string", 492 | "nodeType": "YulLiteral", 493 | "src": "870:21:3", 494 | "type": "", 495 | "value": "he contract's owner" 496 | } 497 | ], 498 | "functionName": { 499 | "name": "mstore", 500 | "nodeType": "YulIdentifier", 501 | "src": "849:6:3" 502 | }, 503 | "nodeType": "YulFunctionCall", 504 | "src": "849:43:3" 505 | }, 506 | "nodeType": "YulExpressionStatement", 507 | "src": "849:43:3" 508 | }, 509 | { 510 | "nodeType": "YulAssignment", 511 | "src": "902:19:3", 512 | "value": { 513 | "arguments": [ 514 | { 515 | "name": "pos", 516 | "nodeType": "YulIdentifier", 517 | "src": "913:3:3" 518 | }, 519 | { 520 | "kind": "number", 521 | "nodeType": "YulLiteral", 522 | "src": "918:2:3", 523 | "type": "", 524 | "value": "64" 525 | } 526 | ], 527 | "functionName": { 528 | "name": "add", 529 | "nodeType": "YulIdentifier", 530 | "src": "909:3:3" 531 | }, 532 | "nodeType": "YulFunctionCall", 533 | "src": "909:12:3" 534 | }, 535 | "variableNames": [ 536 | { 537 | "name": "end", 538 | "nodeType": "YulIdentifier", 539 | "src": "902:3:3" 540 | } 541 | ] 542 | } 543 | ] 544 | }, 545 | "name": "abi_encode_t_stringliteral_f60fe2d9d123295bf92ecf95167f1fa709e374da35e4c083bd39dc2d82acd8b1_to_t_string_memory_ptr_fromStack", 546 | "nodeType": "YulFunctionDefinition", 547 | "parameters": [ 548 | { 549 | "name": "pos", 550 | "nodeType": "YulTypedName", 551 | "src": "678:3:3", 552 | "type": "" 553 | } 554 | ], 555 | "returnVariables": [ 556 | { 557 | "name": "end", 558 | "nodeType": "YulTypedName", 559 | "src": "686:3:3", 560 | "type": "" 561 | } 562 | ], 563 | "src": "544:383:3" 564 | }, 565 | { 566 | "body": { 567 | "nodeType": "YulBlock", 568 | "src": "998:53:3", 569 | "statements": [ 570 | { 571 | "expression": { 572 | "arguments": [ 573 | { 574 | "name": "pos", 575 | "nodeType": "YulIdentifier", 576 | "src": "1015:3:3" 577 | }, 578 | { 579 | "arguments": [ 580 | { 581 | "name": "value", 582 | "nodeType": "YulIdentifier", 583 | "src": "1038:5:3" 584 | } 585 | ], 586 | "functionName": { 587 | "name": "cleanup_t_uint256", 588 | "nodeType": "YulIdentifier", 589 | "src": "1020:17:3" 590 | }, 591 | "nodeType": "YulFunctionCall", 592 | "src": "1020:24:3" 593 | } 594 | ], 595 | "functionName": { 596 | "name": "mstore", 597 | "nodeType": "YulIdentifier", 598 | "src": "1008:6:3" 599 | }, 600 | "nodeType": "YulFunctionCall", 601 | "src": "1008:37:3" 602 | }, 603 | "nodeType": "YulExpressionStatement", 604 | "src": "1008:37:3" 605 | } 606 | ] 607 | }, 608 | "name": "abi_encode_t_uint256_to_t_uint256_fromStack", 609 | "nodeType": "YulFunctionDefinition", 610 | "parameters": [ 611 | { 612 | "name": "value", 613 | "nodeType": "YulTypedName", 614 | "src": "986:5:3", 615 | "type": "" 616 | }, 617 | { 618 | "name": "pos", 619 | "nodeType": "YulTypedName", 620 | "src": "993:3:3", 621 | "type": "" 622 | } 623 | ], 624 | "src": "933:118:3" 625 | }, 626 | { 627 | "body": { 628 | "nodeType": "YulBlock", 629 | "src": "1155:124:3", 630 | "statements": [ 631 | { 632 | "nodeType": "YulAssignment", 633 | "src": "1165:26:3", 634 | "value": { 635 | "arguments": [ 636 | { 637 | "name": "headStart", 638 | "nodeType": "YulIdentifier", 639 | "src": "1177:9:3" 640 | }, 641 | { 642 | "kind": "number", 643 | "nodeType": "YulLiteral", 644 | "src": "1188:2:3", 645 | "type": "", 646 | "value": "32" 647 | } 648 | ], 649 | "functionName": { 650 | "name": "add", 651 | "nodeType": "YulIdentifier", 652 | "src": "1173:3:3" 653 | }, 654 | "nodeType": "YulFunctionCall", 655 | "src": "1173:18:3" 656 | }, 657 | "variableNames": [ 658 | { 659 | "name": "tail", 660 | "nodeType": "YulIdentifier", 661 | "src": "1165:4:3" 662 | } 663 | ] 664 | }, 665 | { 666 | "expression": { 667 | "arguments": [ 668 | { 669 | "name": "value0", 670 | "nodeType": "YulIdentifier", 671 | "src": "1245:6:3" 672 | }, 673 | { 674 | "arguments": [ 675 | { 676 | "name": "headStart", 677 | "nodeType": "YulIdentifier", 678 | "src": "1258:9:3" 679 | }, 680 | { 681 | "kind": "number", 682 | "nodeType": "YulLiteral", 683 | "src": "1269:1:3", 684 | "type": "", 685 | "value": "0" 686 | } 687 | ], 688 | "functionName": { 689 | "name": "add", 690 | "nodeType": "YulIdentifier", 691 | "src": "1254:3:3" 692 | }, 693 | "nodeType": "YulFunctionCall", 694 | "src": "1254:17:3" 695 | } 696 | ], 697 | "functionName": { 698 | "name": "abi_encode_t_address_to_t_address_fromStack", 699 | "nodeType": "YulIdentifier", 700 | "src": "1201:43:3" 701 | }, 702 | "nodeType": "YulFunctionCall", 703 | "src": "1201:71:3" 704 | }, 705 | "nodeType": "YulExpressionStatement", 706 | "src": "1201:71:3" 707 | } 708 | ] 709 | }, 710 | "name": "abi_encode_tuple_t_address__to_t_address__fromStack_reversed", 711 | "nodeType": "YulFunctionDefinition", 712 | "parameters": [ 713 | { 714 | "name": "headStart", 715 | "nodeType": "YulTypedName", 716 | "src": "1127:9:3", 717 | "type": "" 718 | }, 719 | { 720 | "name": "value0", 721 | "nodeType": "YulTypedName", 722 | "src": "1139:6:3", 723 | "type": "" 724 | } 725 | ], 726 | "returnVariables": [ 727 | { 728 | "name": "tail", 729 | "nodeType": "YulTypedName", 730 | "src": "1150:4:3", 731 | "type": "" 732 | } 733 | ], 734 | "src": "1057:222:3" 735 | }, 736 | { 737 | "body": { 738 | "nodeType": "YulBlock", 739 | "src": "1456:248:3", 740 | "statements": [ 741 | { 742 | "nodeType": "YulAssignment", 743 | "src": "1466:26:3", 744 | "value": { 745 | "arguments": [ 746 | { 747 | "name": "headStart", 748 | "nodeType": "YulIdentifier", 749 | "src": "1478:9:3" 750 | }, 751 | { 752 | "kind": "number", 753 | "nodeType": "YulLiteral", 754 | "src": "1489:2:3", 755 | "type": "", 756 | "value": "32" 757 | } 758 | ], 759 | "functionName": { 760 | "name": "add", 761 | "nodeType": "YulIdentifier", 762 | "src": "1474:3:3" 763 | }, 764 | "nodeType": "YulFunctionCall", 765 | "src": "1474:18:3" 766 | }, 767 | "variableNames": [ 768 | { 769 | "name": "tail", 770 | "nodeType": "YulIdentifier", 771 | "src": "1466:4:3" 772 | } 773 | ] 774 | }, 775 | { 776 | "expression": { 777 | "arguments": [ 778 | { 779 | "arguments": [ 780 | { 781 | "name": "headStart", 782 | "nodeType": "YulIdentifier", 783 | "src": "1513:9:3" 784 | }, 785 | { 786 | "kind": "number", 787 | "nodeType": "YulLiteral", 788 | "src": "1524:1:3", 789 | "type": "", 790 | "value": "0" 791 | } 792 | ], 793 | "functionName": { 794 | "name": "add", 795 | "nodeType": "YulIdentifier", 796 | "src": "1509:3:3" 797 | }, 798 | "nodeType": "YulFunctionCall", 799 | "src": "1509:17:3" 800 | }, 801 | { 802 | "arguments": [ 803 | { 804 | "name": "tail", 805 | "nodeType": "YulIdentifier", 806 | "src": "1532:4:3" 807 | }, 808 | { 809 | "name": "headStart", 810 | "nodeType": "YulIdentifier", 811 | "src": "1538:9:3" 812 | } 813 | ], 814 | "functionName": { 815 | "name": "sub", 816 | "nodeType": "YulIdentifier", 817 | "src": "1528:3:3" 818 | }, 819 | "nodeType": "YulFunctionCall", 820 | "src": "1528:20:3" 821 | } 822 | ], 823 | "functionName": { 824 | "name": "mstore", 825 | "nodeType": "YulIdentifier", 826 | "src": "1502:6:3" 827 | }, 828 | "nodeType": "YulFunctionCall", 829 | "src": "1502:47:3" 830 | }, 831 | "nodeType": "YulExpressionStatement", 832 | "src": "1502:47:3" 833 | }, 834 | { 835 | "nodeType": "YulAssignment", 836 | "src": "1558:139:3", 837 | "value": { 838 | "arguments": [ 839 | { 840 | "name": "tail", 841 | "nodeType": "YulIdentifier", 842 | "src": "1692:4:3" 843 | } 844 | ], 845 | "functionName": { 846 | "name": "abi_encode_t_stringliteral_f60fe2d9d123295bf92ecf95167f1fa709e374da35e4c083bd39dc2d82acd8b1_to_t_string_memory_ptr_fromStack", 847 | "nodeType": "YulIdentifier", 848 | "src": "1566:124:3" 849 | }, 850 | "nodeType": "YulFunctionCall", 851 | "src": "1566:131:3" 852 | }, 853 | "variableNames": [ 854 | { 855 | "name": "tail", 856 | "nodeType": "YulIdentifier", 857 | "src": "1558:4:3" 858 | } 859 | ] 860 | } 861 | ] 862 | }, 863 | "name": "abi_encode_tuple_t_stringliteral_f60fe2d9d123295bf92ecf95167f1fa709e374da35e4c083bd39dc2d82acd8b1__to_t_string_memory_ptr__fromStack_reversed", 864 | "nodeType": "YulFunctionDefinition", 865 | "parameters": [ 866 | { 867 | "name": "headStart", 868 | "nodeType": "YulTypedName", 869 | "src": "1436:9:3", 870 | "type": "" 871 | } 872 | ], 873 | "returnVariables": [ 874 | { 875 | "name": "tail", 876 | "nodeType": "YulTypedName", 877 | "src": "1451:4:3", 878 | "type": "" 879 | } 880 | ], 881 | "src": "1285:419:3" 882 | }, 883 | { 884 | "body": { 885 | "nodeType": "YulBlock", 886 | "src": "1808:124:3", 887 | "statements": [ 888 | { 889 | "nodeType": "YulAssignment", 890 | "src": "1818:26:3", 891 | "value": { 892 | "arguments": [ 893 | { 894 | "name": "headStart", 895 | "nodeType": "YulIdentifier", 896 | "src": "1830:9:3" 897 | }, 898 | { 899 | "kind": "number", 900 | "nodeType": "YulLiteral", 901 | "src": "1841:2:3", 902 | "type": "", 903 | "value": "32" 904 | } 905 | ], 906 | "functionName": { 907 | "name": "add", 908 | "nodeType": "YulIdentifier", 909 | "src": "1826:3:3" 910 | }, 911 | "nodeType": "YulFunctionCall", 912 | "src": "1826:18:3" 913 | }, 914 | "variableNames": [ 915 | { 916 | "name": "tail", 917 | "nodeType": "YulIdentifier", 918 | "src": "1818:4:3" 919 | } 920 | ] 921 | }, 922 | { 923 | "expression": { 924 | "arguments": [ 925 | { 926 | "name": "value0", 927 | "nodeType": "YulIdentifier", 928 | "src": "1898:6:3" 929 | }, 930 | { 931 | "arguments": [ 932 | { 933 | "name": "headStart", 934 | "nodeType": "YulIdentifier", 935 | "src": "1911:9:3" 936 | }, 937 | { 938 | "kind": "number", 939 | "nodeType": "YulLiteral", 940 | "src": "1922:1:3", 941 | "type": "", 942 | "value": "0" 943 | } 944 | ], 945 | "functionName": { 946 | "name": "add", 947 | "nodeType": "YulIdentifier", 948 | "src": "1907:3:3" 949 | }, 950 | "nodeType": "YulFunctionCall", 951 | "src": "1907:17:3" 952 | } 953 | ], 954 | "functionName": { 955 | "name": "abi_encode_t_uint256_to_t_uint256_fromStack", 956 | "nodeType": "YulIdentifier", 957 | "src": "1854:43:3" 958 | }, 959 | "nodeType": "YulFunctionCall", 960 | "src": "1854:71:3" 961 | }, 962 | "nodeType": "YulExpressionStatement", 963 | "src": "1854:71:3" 964 | } 965 | ] 966 | }, 967 | "name": "abi_encode_tuple_t_uint256__to_t_uint256__fromStack_reversed", 968 | "nodeType": "YulFunctionDefinition", 969 | "parameters": [ 970 | { 971 | "name": "headStart", 972 | "nodeType": "YulTypedName", 973 | "src": "1780:9:3", 974 | "type": "" 975 | }, 976 | { 977 | "name": "value0", 978 | "nodeType": "YulTypedName", 979 | "src": "1792:6:3", 980 | "type": "" 981 | } 982 | ], 983 | "returnVariables": [ 984 | { 985 | "name": "tail", 986 | "nodeType": "YulTypedName", 987 | "src": "1803:4:3", 988 | "type": "" 989 | } 990 | ], 991 | "src": "1710:222:3" 992 | }, 993 | { 994 | "body": { 995 | "nodeType": "YulBlock", 996 | "src": "2034:73:3", 997 | "statements": [ 998 | { 999 | "expression": { 1000 | "arguments": [ 1001 | { 1002 | "name": "pos", 1003 | "nodeType": "YulIdentifier", 1004 | "src": "2051:3:3" 1005 | }, 1006 | { 1007 | "name": "length", 1008 | "nodeType": "YulIdentifier", 1009 | "src": "2056:6:3" 1010 | } 1011 | ], 1012 | "functionName": { 1013 | "name": "mstore", 1014 | "nodeType": "YulIdentifier", 1015 | "src": "2044:6:3" 1016 | }, 1017 | "nodeType": "YulFunctionCall", 1018 | "src": "2044:19:3" 1019 | }, 1020 | "nodeType": "YulExpressionStatement", 1021 | "src": "2044:19:3" 1022 | }, 1023 | { 1024 | "nodeType": "YulAssignment", 1025 | "src": "2072:29:3", 1026 | "value": { 1027 | "arguments": [ 1028 | { 1029 | "name": "pos", 1030 | "nodeType": "YulIdentifier", 1031 | "src": "2091:3:3" 1032 | }, 1033 | { 1034 | "kind": "number", 1035 | "nodeType": "YulLiteral", 1036 | "src": "2096:4:3", 1037 | "type": "", 1038 | "value": "0x20" 1039 | } 1040 | ], 1041 | "functionName": { 1042 | "name": "add", 1043 | "nodeType": "YulIdentifier", 1044 | "src": "2087:3:3" 1045 | }, 1046 | "nodeType": "YulFunctionCall", 1047 | "src": "2087:14:3" 1048 | }, 1049 | "variableNames": [ 1050 | { 1051 | "name": "updated_pos", 1052 | "nodeType": "YulIdentifier", 1053 | "src": "2072:11:3" 1054 | } 1055 | ] 1056 | } 1057 | ] 1058 | }, 1059 | "name": "array_storeLengthForEncoding_t_string_memory_ptr_fromStack", 1060 | "nodeType": "YulFunctionDefinition", 1061 | "parameters": [ 1062 | { 1063 | "name": "pos", 1064 | "nodeType": "YulTypedName", 1065 | "src": "2006:3:3", 1066 | "type": "" 1067 | }, 1068 | { 1069 | "name": "length", 1070 | "nodeType": "YulTypedName", 1071 | "src": "2011:6:3", 1072 | "type": "" 1073 | } 1074 | ], 1075 | "returnVariables": [ 1076 | { 1077 | "name": "updated_pos", 1078 | "nodeType": "YulTypedName", 1079 | "src": "2022:11:3", 1080 | "type": "" 1081 | } 1082 | ], 1083 | "src": "1938:169:3" 1084 | }, 1085 | { 1086 | "body": { 1087 | "nodeType": "YulBlock", 1088 | "src": "2158:51:3", 1089 | "statements": [ 1090 | { 1091 | "nodeType": "YulAssignment", 1092 | "src": "2168:35:3", 1093 | "value": { 1094 | "arguments": [ 1095 | { 1096 | "name": "value", 1097 | "nodeType": "YulIdentifier", 1098 | "src": "2197:5:3" 1099 | } 1100 | ], 1101 | "functionName": { 1102 | "name": "cleanup_t_uint160", 1103 | "nodeType": "YulIdentifier", 1104 | "src": "2179:17:3" 1105 | }, 1106 | "nodeType": "YulFunctionCall", 1107 | "src": "2179:24:3" 1108 | }, 1109 | "variableNames": [ 1110 | { 1111 | "name": "cleaned", 1112 | "nodeType": "YulIdentifier", 1113 | "src": "2168:7:3" 1114 | } 1115 | ] 1116 | } 1117 | ] 1118 | }, 1119 | "name": "cleanup_t_address", 1120 | "nodeType": "YulFunctionDefinition", 1121 | "parameters": [ 1122 | { 1123 | "name": "value", 1124 | "nodeType": "YulTypedName", 1125 | "src": "2140:5:3", 1126 | "type": "" 1127 | } 1128 | ], 1129 | "returnVariables": [ 1130 | { 1131 | "name": "cleaned", 1132 | "nodeType": "YulTypedName", 1133 | "src": "2150:7:3", 1134 | "type": "" 1135 | } 1136 | ], 1137 | "src": "2113:96:3" 1138 | }, 1139 | { 1140 | "body": { 1141 | "nodeType": "YulBlock", 1142 | "src": "2260:81:3", 1143 | "statements": [ 1144 | { 1145 | "nodeType": "YulAssignment", 1146 | "src": "2270:65:3", 1147 | "value": { 1148 | "arguments": [ 1149 | { 1150 | "name": "value", 1151 | "nodeType": "YulIdentifier", 1152 | "src": "2285:5:3" 1153 | }, 1154 | { 1155 | "kind": "number", 1156 | "nodeType": "YulLiteral", 1157 | "src": "2292:42:3", 1158 | "type": "", 1159 | "value": "0xffffffffffffffffffffffffffffffffffffffff" 1160 | } 1161 | ], 1162 | "functionName": { 1163 | "name": "and", 1164 | "nodeType": "YulIdentifier", 1165 | "src": "2281:3:3" 1166 | }, 1167 | "nodeType": "YulFunctionCall", 1168 | "src": "2281:54:3" 1169 | }, 1170 | "variableNames": [ 1171 | { 1172 | "name": "cleaned", 1173 | "nodeType": "YulIdentifier", 1174 | "src": "2270:7:3" 1175 | } 1176 | ] 1177 | } 1178 | ] 1179 | }, 1180 | "name": "cleanup_t_uint160", 1181 | "nodeType": "YulFunctionDefinition", 1182 | "parameters": [ 1183 | { 1184 | "name": "value", 1185 | "nodeType": "YulTypedName", 1186 | "src": "2242:5:3", 1187 | "type": "" 1188 | } 1189 | ], 1190 | "returnVariables": [ 1191 | { 1192 | "name": "cleaned", 1193 | "nodeType": "YulTypedName", 1194 | "src": "2252:7:3", 1195 | "type": "" 1196 | } 1197 | ], 1198 | "src": "2215:126:3" 1199 | }, 1200 | { 1201 | "body": { 1202 | "nodeType": "YulBlock", 1203 | "src": "2392:32:3", 1204 | "statements": [ 1205 | { 1206 | "nodeType": "YulAssignment", 1207 | "src": "2402:16:3", 1208 | "value": { 1209 | "name": "value", 1210 | "nodeType": "YulIdentifier", 1211 | "src": "2413:5:3" 1212 | }, 1213 | "variableNames": [ 1214 | { 1215 | "name": "cleaned", 1216 | "nodeType": "YulIdentifier", 1217 | "src": "2402:7:3" 1218 | } 1219 | ] 1220 | } 1221 | ] 1222 | }, 1223 | "name": "cleanup_t_uint256", 1224 | "nodeType": "YulFunctionDefinition", 1225 | "parameters": [ 1226 | { 1227 | "name": "value", 1228 | "nodeType": "YulTypedName", 1229 | "src": "2374:5:3", 1230 | "type": "" 1231 | } 1232 | ], 1233 | "returnVariables": [ 1234 | { 1235 | "name": "cleaned", 1236 | "nodeType": "YulTypedName", 1237 | "src": "2384:7:3", 1238 | "type": "" 1239 | } 1240 | ], 1241 | "src": "2347:77:3" 1242 | }, 1243 | { 1244 | "body": { 1245 | "nodeType": "YulBlock", 1246 | "src": "2473:79:3", 1247 | "statements": [ 1248 | { 1249 | "body": { 1250 | "nodeType": "YulBlock", 1251 | "src": "2530:16:3", 1252 | "statements": [ 1253 | { 1254 | "expression": { 1255 | "arguments": [ 1256 | { 1257 | "kind": "number", 1258 | "nodeType": "YulLiteral", 1259 | "src": "2539:1:3", 1260 | "type": "", 1261 | "value": "0" 1262 | }, 1263 | { 1264 | "kind": "number", 1265 | "nodeType": "YulLiteral", 1266 | "src": "2542:1:3", 1267 | "type": "", 1268 | "value": "0" 1269 | } 1270 | ], 1271 | "functionName": { 1272 | "name": "revert", 1273 | "nodeType": "YulIdentifier", 1274 | "src": "2532:6:3" 1275 | }, 1276 | "nodeType": "YulFunctionCall", 1277 | "src": "2532:12:3" 1278 | }, 1279 | "nodeType": "YulExpressionStatement", 1280 | "src": "2532:12:3" 1281 | } 1282 | ] 1283 | }, 1284 | "condition": { 1285 | "arguments": [ 1286 | { 1287 | "arguments": [ 1288 | { 1289 | "name": "value", 1290 | "nodeType": "YulIdentifier", 1291 | "src": "2496:5:3" 1292 | }, 1293 | { 1294 | "arguments": [ 1295 | { 1296 | "name": "value", 1297 | "nodeType": "YulIdentifier", 1298 | "src": "2521:5:3" 1299 | } 1300 | ], 1301 | "functionName": { 1302 | "name": "cleanup_t_uint256", 1303 | "nodeType": "YulIdentifier", 1304 | "src": "2503:17:3" 1305 | }, 1306 | "nodeType": "YulFunctionCall", 1307 | "src": "2503:24:3" 1308 | } 1309 | ], 1310 | "functionName": { 1311 | "name": "eq", 1312 | "nodeType": "YulIdentifier", 1313 | "src": "2493:2:3" 1314 | }, 1315 | "nodeType": "YulFunctionCall", 1316 | "src": "2493:35:3" 1317 | } 1318 | ], 1319 | "functionName": { 1320 | "name": "iszero", 1321 | "nodeType": "YulIdentifier", 1322 | "src": "2486:6:3" 1323 | }, 1324 | "nodeType": "YulFunctionCall", 1325 | "src": "2486:43:3" 1326 | }, 1327 | "nodeType": "YulIf", 1328 | "src": "2483:2:3" 1329 | } 1330 | ] 1331 | }, 1332 | "name": "validator_revert_t_uint256", 1333 | "nodeType": "YulFunctionDefinition", 1334 | "parameters": [ 1335 | { 1336 | "name": "value", 1337 | "nodeType": "YulTypedName", 1338 | "src": "2466:5:3", 1339 | "type": "" 1340 | } 1341 | ], 1342 | "src": "2430:122:3" 1343 | } 1344 | ] 1345 | }, 1346 | "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(0, 0) }\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_address_to_t_address_fromStack(value, pos) {\n mstore(pos, cleanup_t_address(value))\n }\n\n function abi_encode_t_stringliteral_f60fe2d9d123295bf92ecf95167f1fa709e374da35e4c083bd39dc2d82acd8b1_to_t_string_memory_ptr_fromStack(pos) -> end {\n pos := array_storeLengthForEncoding_t_string_memory_ptr_fromStack(pos, 51)\n\n mstore(add(pos, 0), \"This function is restricted to t\")\n\n mstore(add(pos, 32), \"he contract's owner\")\n\n end := add(pos, 64)\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_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 abi_encode_tuple_t_stringliteral_f60fe2d9d123295bf92ecf95167f1fa709e374da35e4c083bd39dc2d82acd8b1__to_t_string_memory_ptr__fromStack_reversed(headStart ) -> tail {\n tail := add(headStart, 32)\n\n mstore(add(headStart, 0), sub(tail, headStart))\n tail := abi_encode_t_stringliteral_f60fe2d9d123295bf92ecf95167f1fa709e374da35e4c083bd39dc2d82acd8b1_to_t_string_memory_ptr_fromStack( tail)\n\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 array_storeLengthForEncoding_t_string_memory_ptr_fromStack(pos, length) -> updated_pos {\n mstore(pos, length)\n updated_pos := add(pos, 0x20)\n }\n\n function cleanup_t_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 function cleanup_t_uint256(value) -> cleaned {\n cleaned := value\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", 1347 | "id": 3, 1348 | "language": "Yul", 1349 | "name": "#utility.yul" 1350 | } 1351 | ], 1352 | "sourceMap": "66:352:1:-:0;;;113:10;90:33;;;;;;;;;;;;;;;;;;;;66:352;;;;;;;;;;;;;;;;", 1353 | "deployedSourceMap": "66:352:1:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;127:36;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;90:33;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;313:103;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;127:36;;;;:::o;90:33::-;;;;;;;;;;;;:::o;313:103::-;225:5;;;;;;;;;;211:19;;:10;:19;;;196:101;;;;;;;;;;;;:::i;:::-;;;;;;;;;402:9:::1;375:24;:36;;;;313:103:::0;:::o;7:139:3:-;;91:6;78:20;69:29;;107:33;134:5;107:33;:::i;:::-;59:87;;;;:::o;152:262::-;;260:2;248:9;239:7;235:23;231:32;228:2;;;276:1;273;266:12;228:2;319:1;344:53;389:7;380:6;369:9;365:22;344:53;:::i;:::-;334:63;;290:117;218:196;;;;:::o;420:118::-;507:24;525:5;507:24;:::i;:::-;502:3;495:37;485:53;;:::o;544:383::-;;707:67;771:2;766:3;707:67;:::i;:::-;700:74;;804:34;800:1;795:3;791:11;784:55;870:21;865:2;860:3;856:12;849:43;918:2;913:3;909:12;902:19;;690:237;;;:::o;933:118::-;1020:24;1038:5;1020:24;:::i;:::-;1015:3;1008:37;998:53;;:::o;1057:222::-;;1188:2;1177:9;1173:18;1165:26;;1201:71;1269:1;1258:9;1254:17;1245:6;1201:71;:::i;:::-;1155:124;;;;:::o;1285:419::-;;1489:2;1478:9;1474:18;1466:26;;1538:9;1532:4;1528:20;1524:1;1513:9;1509:17;1502:47;1566:131;1692:4;1566:131;:::i;:::-;1558:139;;1456:248;;;:::o;1710:222::-;;1841:2;1830:9;1826:18;1818:26;;1854:71;1922:1;1911:9;1907:17;1898:6;1854:71;:::i;:::-;1808:124;;;;:::o;1938:169::-;;2056:6;2051:3;2044:19;2096:4;2091:3;2087:14;2072:29;;2034:73;;;;:::o;2113:96::-;;2179:24;2197:5;2179:24;:::i;:::-;2168:35;;2158:51;;;:::o;2215:126::-;;2292:42;2285:5;2281:54;2270:65;;2260:81;;;:::o;2347:77::-;;2413:5;2402:16;;2392:32;;;:::o;2430:122::-;2503:24;2521:5;2503:24;:::i;:::-;2496:5;2493:35;2483:2;;2542:1;2539;2532:12;2483:2;2473:79;:::o", 1354 | "source": "// SPDX-License-Identifier: MIT\npragma solidity >=0.4.22 <0.9.0;\n\ncontract Migrations {\n address public owner = msg.sender;\n uint public last_completed_migration;\n\n modifier restricted() {\n require(\n msg.sender == owner,\n \"This function is restricted to the contract's owner\"\n );\n _;\n }\n\n function setCompleted(uint completed) public restricted {\n last_completed_migration = completed;\n }\n}\n", 1355 | "sourcePath": "/home/zaryab/VSCodeProjects/SmartContracts-Solidity/contracts/Migrations.sol", 1356 | "ast": { 1357 | "absolutePath": "project:/contracts/Migrations.sol", 1358 | "exportedSymbols": { 1359 | "Migrations": [ 1360 | 65 1361 | ] 1362 | }, 1363 | "id": 66, 1364 | "license": "MIT", 1365 | "nodeType": "SourceUnit", 1366 | "nodes": [ 1367 | { 1368 | "id": 34, 1369 | "literals": [ 1370 | "solidity", 1371 | ">=", 1372 | "0.4", 1373 | ".22", 1374 | "<", 1375 | "0.9", 1376 | ".0" 1377 | ], 1378 | "nodeType": "PragmaDirective", 1379 | "src": "32:32:1" 1380 | }, 1381 | { 1382 | "abstract": false, 1383 | "baseContracts": [], 1384 | "contractDependencies": [], 1385 | "contractKind": "contract", 1386 | "fullyImplemented": true, 1387 | "id": 65, 1388 | "linearizedBaseContracts": [ 1389 | 65 1390 | ], 1391 | "name": "Migrations", 1392 | "nodeType": "ContractDefinition", 1393 | "nodes": [ 1394 | { 1395 | "constant": false, 1396 | "functionSelector": "8da5cb5b", 1397 | "id": 38, 1398 | "mutability": "mutable", 1399 | "name": "owner", 1400 | "nodeType": "VariableDeclaration", 1401 | "scope": 65, 1402 | "src": "90:33:1", 1403 | "stateVariable": true, 1404 | "storageLocation": "default", 1405 | "typeDescriptions": { 1406 | "typeIdentifier": "t_address", 1407 | "typeString": "address" 1408 | }, 1409 | "typeName": { 1410 | "id": 35, 1411 | "name": "address", 1412 | "nodeType": "ElementaryTypeName", 1413 | "src": "90:7:1", 1414 | "stateMutability": "nonpayable", 1415 | "typeDescriptions": { 1416 | "typeIdentifier": "t_address", 1417 | "typeString": "address" 1418 | } 1419 | }, 1420 | "value": { 1421 | "expression": { 1422 | "id": 36, 1423 | "name": "msg", 1424 | "nodeType": "Identifier", 1425 | "overloadedDeclarations": [], 1426 | "referencedDeclaration": 4294967281, 1427 | "src": "113:3:1", 1428 | "typeDescriptions": { 1429 | "typeIdentifier": "t_magic_message", 1430 | "typeString": "msg" 1431 | } 1432 | }, 1433 | "id": 37, 1434 | "isConstant": false, 1435 | "isLValue": false, 1436 | "isPure": false, 1437 | "lValueRequested": false, 1438 | "memberName": "sender", 1439 | "nodeType": "MemberAccess", 1440 | "src": "113:10:1", 1441 | "typeDescriptions": { 1442 | "typeIdentifier": "t_address", 1443 | "typeString": "address" 1444 | } 1445 | }, 1446 | "visibility": "public" 1447 | }, 1448 | { 1449 | "constant": false, 1450 | "functionSelector": "445df0ac", 1451 | "id": 40, 1452 | "mutability": "mutable", 1453 | "name": "last_completed_migration", 1454 | "nodeType": "VariableDeclaration", 1455 | "scope": 65, 1456 | "src": "127:36:1", 1457 | "stateVariable": true, 1458 | "storageLocation": "default", 1459 | "typeDescriptions": { 1460 | "typeIdentifier": "t_uint256", 1461 | "typeString": "uint256" 1462 | }, 1463 | "typeName": { 1464 | "id": 39, 1465 | "name": "uint", 1466 | "nodeType": "ElementaryTypeName", 1467 | "src": "127:4:1", 1468 | "typeDescriptions": { 1469 | "typeIdentifier": "t_uint256", 1470 | "typeString": "uint256" 1471 | } 1472 | }, 1473 | "visibility": "public" 1474 | }, 1475 | { 1476 | "body": { 1477 | "id": 51, 1478 | "nodeType": "Block", 1479 | "src": "190:119:1", 1480 | "statements": [ 1481 | { 1482 | "expression": { 1483 | "arguments": [ 1484 | { 1485 | "commonType": { 1486 | "typeIdentifier": "t_address", 1487 | "typeString": "address" 1488 | }, 1489 | "id": 46, 1490 | "isConstant": false, 1491 | "isLValue": false, 1492 | "isPure": false, 1493 | "lValueRequested": false, 1494 | "leftExpression": { 1495 | "expression": { 1496 | "id": 43, 1497 | "name": "msg", 1498 | "nodeType": "Identifier", 1499 | "overloadedDeclarations": [], 1500 | "referencedDeclaration": 4294967281, 1501 | "src": "211:3:1", 1502 | "typeDescriptions": { 1503 | "typeIdentifier": "t_magic_message", 1504 | "typeString": "msg" 1505 | } 1506 | }, 1507 | "id": 44, 1508 | "isConstant": false, 1509 | "isLValue": false, 1510 | "isPure": false, 1511 | "lValueRequested": false, 1512 | "memberName": "sender", 1513 | "nodeType": "MemberAccess", 1514 | "src": "211:10:1", 1515 | "typeDescriptions": { 1516 | "typeIdentifier": "t_address", 1517 | "typeString": "address" 1518 | } 1519 | }, 1520 | "nodeType": "BinaryOperation", 1521 | "operator": "==", 1522 | "rightExpression": { 1523 | "id": 45, 1524 | "name": "owner", 1525 | "nodeType": "Identifier", 1526 | "overloadedDeclarations": [], 1527 | "referencedDeclaration": 38, 1528 | "src": "225:5:1", 1529 | "typeDescriptions": { 1530 | "typeIdentifier": "t_address", 1531 | "typeString": "address" 1532 | } 1533 | }, 1534 | "src": "211:19:1", 1535 | "typeDescriptions": { 1536 | "typeIdentifier": "t_bool", 1537 | "typeString": "bool" 1538 | } 1539 | }, 1540 | { 1541 | "hexValue": "546869732066756e6374696f6e206973207265737472696374656420746f2074686520636f6e74726163742773206f776e6572", 1542 | "id": 47, 1543 | "isConstant": false, 1544 | "isLValue": false, 1545 | "isPure": true, 1546 | "kind": "string", 1547 | "lValueRequested": false, 1548 | "nodeType": "Literal", 1549 | "src": "238:53:1", 1550 | "typeDescriptions": { 1551 | "typeIdentifier": "t_stringliteral_f60fe2d9d123295bf92ecf95167f1fa709e374da35e4c083bd39dc2d82acd8b1", 1552 | "typeString": "literal_string \"This function is restricted to the contract's owner\"" 1553 | }, 1554 | "value": "This function is restricted to the contract's owner" 1555 | } 1556 | ], 1557 | "expression": { 1558 | "argumentTypes": [ 1559 | { 1560 | "typeIdentifier": "t_bool", 1561 | "typeString": "bool" 1562 | }, 1563 | { 1564 | "typeIdentifier": "t_stringliteral_f60fe2d9d123295bf92ecf95167f1fa709e374da35e4c083bd39dc2d82acd8b1", 1565 | "typeString": "literal_string \"This function is restricted to the contract's owner\"" 1566 | } 1567 | ], 1568 | "id": 42, 1569 | "name": "require", 1570 | "nodeType": "Identifier", 1571 | "overloadedDeclarations": [ 1572 | 4294967278, 1573 | 4294967278 1574 | ], 1575 | "referencedDeclaration": 4294967278, 1576 | "src": "196:7:1", 1577 | "typeDescriptions": { 1578 | "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", 1579 | "typeString": "function (bool,string memory) pure" 1580 | } 1581 | }, 1582 | "id": 48, 1583 | "isConstant": false, 1584 | "isLValue": false, 1585 | "isPure": false, 1586 | "kind": "functionCall", 1587 | "lValueRequested": false, 1588 | "names": [], 1589 | "nodeType": "FunctionCall", 1590 | "src": "196:101:1", 1591 | "tryCall": false, 1592 | "typeDescriptions": { 1593 | "typeIdentifier": "t_tuple$__$", 1594 | "typeString": "tuple()" 1595 | } 1596 | }, 1597 | "id": 49, 1598 | "nodeType": "ExpressionStatement", 1599 | "src": "196:101:1" 1600 | }, 1601 | { 1602 | "id": 50, 1603 | "nodeType": "PlaceholderStatement", 1604 | "src": "303:1:1" 1605 | } 1606 | ] 1607 | }, 1608 | "id": 52, 1609 | "name": "restricted", 1610 | "nodeType": "ModifierDefinition", 1611 | "parameters": { 1612 | "id": 41, 1613 | "nodeType": "ParameterList", 1614 | "parameters": [], 1615 | "src": "187:2:1" 1616 | }, 1617 | "src": "168:141:1", 1618 | "virtual": false, 1619 | "visibility": "internal" 1620 | }, 1621 | { 1622 | "body": { 1623 | "id": 63, 1624 | "nodeType": "Block", 1625 | "src": "369:47:1", 1626 | "statements": [ 1627 | { 1628 | "expression": { 1629 | "id": 61, 1630 | "isConstant": false, 1631 | "isLValue": false, 1632 | "isPure": false, 1633 | "lValueRequested": false, 1634 | "leftHandSide": { 1635 | "id": 59, 1636 | "name": "last_completed_migration", 1637 | "nodeType": "Identifier", 1638 | "overloadedDeclarations": [], 1639 | "referencedDeclaration": 40, 1640 | "src": "375:24:1", 1641 | "typeDescriptions": { 1642 | "typeIdentifier": "t_uint256", 1643 | "typeString": "uint256" 1644 | } 1645 | }, 1646 | "nodeType": "Assignment", 1647 | "operator": "=", 1648 | "rightHandSide": { 1649 | "id": 60, 1650 | "name": "completed", 1651 | "nodeType": "Identifier", 1652 | "overloadedDeclarations": [], 1653 | "referencedDeclaration": 54, 1654 | "src": "402:9:1", 1655 | "typeDescriptions": { 1656 | "typeIdentifier": "t_uint256", 1657 | "typeString": "uint256" 1658 | } 1659 | }, 1660 | "src": "375:36:1", 1661 | "typeDescriptions": { 1662 | "typeIdentifier": "t_uint256", 1663 | "typeString": "uint256" 1664 | } 1665 | }, 1666 | "id": 62, 1667 | "nodeType": "ExpressionStatement", 1668 | "src": "375:36:1" 1669 | } 1670 | ] 1671 | }, 1672 | "functionSelector": "fdacd576", 1673 | "id": 64, 1674 | "implemented": true, 1675 | "kind": "function", 1676 | "modifiers": [ 1677 | { 1678 | "id": 57, 1679 | "modifierName": { 1680 | "id": 56, 1681 | "name": "restricted", 1682 | "nodeType": "IdentifierPath", 1683 | "referencedDeclaration": 52, 1684 | "src": "358:10:1" 1685 | }, 1686 | "nodeType": "ModifierInvocation", 1687 | "src": "358:10:1" 1688 | } 1689 | ], 1690 | "name": "setCompleted", 1691 | "nodeType": "FunctionDefinition", 1692 | "parameters": { 1693 | "id": 55, 1694 | "nodeType": "ParameterList", 1695 | "parameters": [ 1696 | { 1697 | "constant": false, 1698 | "id": 54, 1699 | "mutability": "mutable", 1700 | "name": "completed", 1701 | "nodeType": "VariableDeclaration", 1702 | "scope": 64, 1703 | "src": "335:14:1", 1704 | "stateVariable": false, 1705 | "storageLocation": "default", 1706 | "typeDescriptions": { 1707 | "typeIdentifier": "t_uint256", 1708 | "typeString": "uint256" 1709 | }, 1710 | "typeName": { 1711 | "id": 53, 1712 | "name": "uint", 1713 | "nodeType": "ElementaryTypeName", 1714 | "src": "335:4:1", 1715 | "typeDescriptions": { 1716 | "typeIdentifier": "t_uint256", 1717 | "typeString": "uint256" 1718 | } 1719 | }, 1720 | "visibility": "internal" 1721 | } 1722 | ], 1723 | "src": "334:16:1" 1724 | }, 1725 | "returnParameters": { 1726 | "id": 58, 1727 | "nodeType": "ParameterList", 1728 | "parameters": [], 1729 | "src": "369:0:1" 1730 | }, 1731 | "scope": 65, 1732 | "src": "313:103:1", 1733 | "stateMutability": "nonpayable", 1734 | "virtual": false, 1735 | "visibility": "public" 1736 | } 1737 | ], 1738 | "scope": 66, 1739 | "src": "66:352:1" 1740 | } 1741 | ], 1742 | "src": "32:387:1" 1743 | }, 1744 | "legacyAST": { 1745 | "absolutePath": "project:/contracts/Migrations.sol", 1746 | "exportedSymbols": { 1747 | "Migrations": [ 1748 | 65 1749 | ] 1750 | }, 1751 | "id": 66, 1752 | "license": "MIT", 1753 | "nodeType": "SourceUnit", 1754 | "nodes": [ 1755 | { 1756 | "id": 34, 1757 | "literals": [ 1758 | "solidity", 1759 | ">=", 1760 | "0.4", 1761 | ".22", 1762 | "<", 1763 | "0.9", 1764 | ".0" 1765 | ], 1766 | "nodeType": "PragmaDirective", 1767 | "src": "32:32:1" 1768 | }, 1769 | { 1770 | "abstract": false, 1771 | "baseContracts": [], 1772 | "contractDependencies": [], 1773 | "contractKind": "contract", 1774 | "fullyImplemented": true, 1775 | "id": 65, 1776 | "linearizedBaseContracts": [ 1777 | 65 1778 | ], 1779 | "name": "Migrations", 1780 | "nodeType": "ContractDefinition", 1781 | "nodes": [ 1782 | { 1783 | "constant": false, 1784 | "functionSelector": "8da5cb5b", 1785 | "id": 38, 1786 | "mutability": "mutable", 1787 | "name": "owner", 1788 | "nodeType": "VariableDeclaration", 1789 | "scope": 65, 1790 | "src": "90:33:1", 1791 | "stateVariable": true, 1792 | "storageLocation": "default", 1793 | "typeDescriptions": { 1794 | "typeIdentifier": "t_address", 1795 | "typeString": "address" 1796 | }, 1797 | "typeName": { 1798 | "id": 35, 1799 | "name": "address", 1800 | "nodeType": "ElementaryTypeName", 1801 | "src": "90:7:1", 1802 | "stateMutability": "nonpayable", 1803 | "typeDescriptions": { 1804 | "typeIdentifier": "t_address", 1805 | "typeString": "address" 1806 | } 1807 | }, 1808 | "value": { 1809 | "expression": { 1810 | "id": 36, 1811 | "name": "msg", 1812 | "nodeType": "Identifier", 1813 | "overloadedDeclarations": [], 1814 | "referencedDeclaration": 4294967281, 1815 | "src": "113:3:1", 1816 | "typeDescriptions": { 1817 | "typeIdentifier": "t_magic_message", 1818 | "typeString": "msg" 1819 | } 1820 | }, 1821 | "id": 37, 1822 | "isConstant": false, 1823 | "isLValue": false, 1824 | "isPure": false, 1825 | "lValueRequested": false, 1826 | "memberName": "sender", 1827 | "nodeType": "MemberAccess", 1828 | "src": "113:10:1", 1829 | "typeDescriptions": { 1830 | "typeIdentifier": "t_address", 1831 | "typeString": "address" 1832 | } 1833 | }, 1834 | "visibility": "public" 1835 | }, 1836 | { 1837 | "constant": false, 1838 | "functionSelector": "445df0ac", 1839 | "id": 40, 1840 | "mutability": "mutable", 1841 | "name": "last_completed_migration", 1842 | "nodeType": "VariableDeclaration", 1843 | "scope": 65, 1844 | "src": "127:36:1", 1845 | "stateVariable": true, 1846 | "storageLocation": "default", 1847 | "typeDescriptions": { 1848 | "typeIdentifier": "t_uint256", 1849 | "typeString": "uint256" 1850 | }, 1851 | "typeName": { 1852 | "id": 39, 1853 | "name": "uint", 1854 | "nodeType": "ElementaryTypeName", 1855 | "src": "127:4:1", 1856 | "typeDescriptions": { 1857 | "typeIdentifier": "t_uint256", 1858 | "typeString": "uint256" 1859 | } 1860 | }, 1861 | "visibility": "public" 1862 | }, 1863 | { 1864 | "body": { 1865 | "id": 51, 1866 | "nodeType": "Block", 1867 | "src": "190:119:1", 1868 | "statements": [ 1869 | { 1870 | "expression": { 1871 | "arguments": [ 1872 | { 1873 | "commonType": { 1874 | "typeIdentifier": "t_address", 1875 | "typeString": "address" 1876 | }, 1877 | "id": 46, 1878 | "isConstant": false, 1879 | "isLValue": false, 1880 | "isPure": false, 1881 | "lValueRequested": false, 1882 | "leftExpression": { 1883 | "expression": { 1884 | "id": 43, 1885 | "name": "msg", 1886 | "nodeType": "Identifier", 1887 | "overloadedDeclarations": [], 1888 | "referencedDeclaration": 4294967281, 1889 | "src": "211:3:1", 1890 | "typeDescriptions": { 1891 | "typeIdentifier": "t_magic_message", 1892 | "typeString": "msg" 1893 | } 1894 | }, 1895 | "id": 44, 1896 | "isConstant": false, 1897 | "isLValue": false, 1898 | "isPure": false, 1899 | "lValueRequested": false, 1900 | "memberName": "sender", 1901 | "nodeType": "MemberAccess", 1902 | "src": "211:10:1", 1903 | "typeDescriptions": { 1904 | "typeIdentifier": "t_address", 1905 | "typeString": "address" 1906 | } 1907 | }, 1908 | "nodeType": "BinaryOperation", 1909 | "operator": "==", 1910 | "rightExpression": { 1911 | "id": 45, 1912 | "name": "owner", 1913 | "nodeType": "Identifier", 1914 | "overloadedDeclarations": [], 1915 | "referencedDeclaration": 38, 1916 | "src": "225:5:1", 1917 | "typeDescriptions": { 1918 | "typeIdentifier": "t_address", 1919 | "typeString": "address" 1920 | } 1921 | }, 1922 | "src": "211:19:1", 1923 | "typeDescriptions": { 1924 | "typeIdentifier": "t_bool", 1925 | "typeString": "bool" 1926 | } 1927 | }, 1928 | { 1929 | "hexValue": "546869732066756e6374696f6e206973207265737472696374656420746f2074686520636f6e74726163742773206f776e6572", 1930 | "id": 47, 1931 | "isConstant": false, 1932 | "isLValue": false, 1933 | "isPure": true, 1934 | "kind": "string", 1935 | "lValueRequested": false, 1936 | "nodeType": "Literal", 1937 | "src": "238:53:1", 1938 | "typeDescriptions": { 1939 | "typeIdentifier": "t_stringliteral_f60fe2d9d123295bf92ecf95167f1fa709e374da35e4c083bd39dc2d82acd8b1", 1940 | "typeString": "literal_string \"This function is restricted to the contract's owner\"" 1941 | }, 1942 | "value": "This function is restricted to the contract's owner" 1943 | } 1944 | ], 1945 | "expression": { 1946 | "argumentTypes": [ 1947 | { 1948 | "typeIdentifier": "t_bool", 1949 | "typeString": "bool" 1950 | }, 1951 | { 1952 | "typeIdentifier": "t_stringliteral_f60fe2d9d123295bf92ecf95167f1fa709e374da35e4c083bd39dc2d82acd8b1", 1953 | "typeString": "literal_string \"This function is restricted to the contract's owner\"" 1954 | } 1955 | ], 1956 | "id": 42, 1957 | "name": "require", 1958 | "nodeType": "Identifier", 1959 | "overloadedDeclarations": [ 1960 | 4294967278, 1961 | 4294967278 1962 | ], 1963 | "referencedDeclaration": 4294967278, 1964 | "src": "196:7:1", 1965 | "typeDescriptions": { 1966 | "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", 1967 | "typeString": "function (bool,string memory) pure" 1968 | } 1969 | }, 1970 | "id": 48, 1971 | "isConstant": false, 1972 | "isLValue": false, 1973 | "isPure": false, 1974 | "kind": "functionCall", 1975 | "lValueRequested": false, 1976 | "names": [], 1977 | "nodeType": "FunctionCall", 1978 | "src": "196:101:1", 1979 | "tryCall": false, 1980 | "typeDescriptions": { 1981 | "typeIdentifier": "t_tuple$__$", 1982 | "typeString": "tuple()" 1983 | } 1984 | }, 1985 | "id": 49, 1986 | "nodeType": "ExpressionStatement", 1987 | "src": "196:101:1" 1988 | }, 1989 | { 1990 | "id": 50, 1991 | "nodeType": "PlaceholderStatement", 1992 | "src": "303:1:1" 1993 | } 1994 | ] 1995 | }, 1996 | "id": 52, 1997 | "name": "restricted", 1998 | "nodeType": "ModifierDefinition", 1999 | "parameters": { 2000 | "id": 41, 2001 | "nodeType": "ParameterList", 2002 | "parameters": [], 2003 | "src": "187:2:1" 2004 | }, 2005 | "src": "168:141:1", 2006 | "virtual": false, 2007 | "visibility": "internal" 2008 | }, 2009 | { 2010 | "body": { 2011 | "id": 63, 2012 | "nodeType": "Block", 2013 | "src": "369:47:1", 2014 | "statements": [ 2015 | { 2016 | "expression": { 2017 | "id": 61, 2018 | "isConstant": false, 2019 | "isLValue": false, 2020 | "isPure": false, 2021 | "lValueRequested": false, 2022 | "leftHandSide": { 2023 | "id": 59, 2024 | "name": "last_completed_migration", 2025 | "nodeType": "Identifier", 2026 | "overloadedDeclarations": [], 2027 | "referencedDeclaration": 40, 2028 | "src": "375:24:1", 2029 | "typeDescriptions": { 2030 | "typeIdentifier": "t_uint256", 2031 | "typeString": "uint256" 2032 | } 2033 | }, 2034 | "nodeType": "Assignment", 2035 | "operator": "=", 2036 | "rightHandSide": { 2037 | "id": 60, 2038 | "name": "completed", 2039 | "nodeType": "Identifier", 2040 | "overloadedDeclarations": [], 2041 | "referencedDeclaration": 54, 2042 | "src": "402:9:1", 2043 | "typeDescriptions": { 2044 | "typeIdentifier": "t_uint256", 2045 | "typeString": "uint256" 2046 | } 2047 | }, 2048 | "src": "375:36:1", 2049 | "typeDescriptions": { 2050 | "typeIdentifier": "t_uint256", 2051 | "typeString": "uint256" 2052 | } 2053 | }, 2054 | "id": 62, 2055 | "nodeType": "ExpressionStatement", 2056 | "src": "375:36:1" 2057 | } 2058 | ] 2059 | }, 2060 | "functionSelector": "fdacd576", 2061 | "id": 64, 2062 | "implemented": true, 2063 | "kind": "function", 2064 | "modifiers": [ 2065 | { 2066 | "id": 57, 2067 | "modifierName": { 2068 | "id": 56, 2069 | "name": "restricted", 2070 | "nodeType": "IdentifierPath", 2071 | "referencedDeclaration": 52, 2072 | "src": "358:10:1" 2073 | }, 2074 | "nodeType": "ModifierInvocation", 2075 | "src": "358:10:1" 2076 | } 2077 | ], 2078 | "name": "setCompleted", 2079 | "nodeType": "FunctionDefinition", 2080 | "parameters": { 2081 | "id": 55, 2082 | "nodeType": "ParameterList", 2083 | "parameters": [ 2084 | { 2085 | "constant": false, 2086 | "id": 54, 2087 | "mutability": "mutable", 2088 | "name": "completed", 2089 | "nodeType": "VariableDeclaration", 2090 | "scope": 64, 2091 | "src": "335:14:1", 2092 | "stateVariable": false, 2093 | "storageLocation": "default", 2094 | "typeDescriptions": { 2095 | "typeIdentifier": "t_uint256", 2096 | "typeString": "uint256" 2097 | }, 2098 | "typeName": { 2099 | "id": 53, 2100 | "name": "uint", 2101 | "nodeType": "ElementaryTypeName", 2102 | "src": "335:4:1", 2103 | "typeDescriptions": { 2104 | "typeIdentifier": "t_uint256", 2105 | "typeString": "uint256" 2106 | } 2107 | }, 2108 | "visibility": "internal" 2109 | } 2110 | ], 2111 | "src": "334:16:1" 2112 | }, 2113 | "returnParameters": { 2114 | "id": 58, 2115 | "nodeType": "ParameterList", 2116 | "parameters": [], 2117 | "src": "369:0:1" 2118 | }, 2119 | "scope": 65, 2120 | "src": "313:103:1", 2121 | "stateMutability": "nonpayable", 2122 | "virtual": false, 2123 | "visibility": "public" 2124 | } 2125 | ], 2126 | "scope": 66, 2127 | "src": "66:352:1" 2128 | } 2129 | ], 2130 | "src": "32:387:1" 2131 | }, 2132 | "compiler": { 2133 | "name": "solc", 2134 | "version": "0.8.0+commit.c7dfd78e.Emscripten.clang" 2135 | }, 2136 | "networks": {}, 2137 | "schemaVersion": "3.4.1", 2138 | "updatedAt": "2021-07-23T05:59:21.268Z", 2139 | "devdoc": { 2140 | "kind": "dev", 2141 | "methods": {}, 2142 | "version": 1 2143 | }, 2144 | "userdoc": { 2145 | "kind": "user", 2146 | "methods": {}, 2147 | "version": 1 2148 | } 2149 | } -------------------------------------------------------------------------------- /build/contracts/VotingSystem.json: -------------------------------------------------------------------------------- 1 | { 2 | "contractName": "VotingSystem", 3 | "abi": [], 4 | "metadata": "{\"compiler\":{\"version\":\"0.8.0+commit.c7dfd78e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"project:/contracts/Voting.sol\":\"VotingSystem\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"project:/contracts/Voting.sol\":{\"keccak256\":\"0x0ef1e6ce668fafb6c49bb74e6f4f780386fd576dca137bbd718adc3f83aaf5bd\",\"urls\":[\"bzz-raw://b7c80ffc63e860bd9504dc2798af446bcbf9fd0810769f747d4829ee9c3b07cc\",\"dweb:/ipfs/QmZ8e3Hs9tk8rUN7UpZuP9CRZNVYB6Z6qC8eGqi3xGBaFc\"]}},\"version\":1}", 5 | "bytecode": "0x6080604052348015600f57600080fd5b50603f80601d6000396000f3fe6080604052600080fdfea2646970667358221220a75234fb3b98bf01a8e05c94f73f42b6e3b6345901527ae90016b0664bb32ead64736f6c63430008000033", 6 | "deployedBytecode": "0x6080604052600080fdfea2646970667358221220a75234fb3b98bf01a8e05c94f73f42b6e3b6345901527ae90016b0664bb32ead64736f6c63430008000033", 7 | "immutableReferences": {}, 8 | "generatedSources": [], 9 | "deployedGeneratedSources": [], 10 | "sourceMap": "63:26:1:-:0;;;;;;;;;;;;;;;;;;;", 11 | "deployedSourceMap": "63:26:1:-:0;;;;;", 12 | "source": "pragma solidity ^0.8.0;\n\n// write voting system smart contract\ncontract VotingSystem {\n\n}", 13 | "sourcePath": "/home/zaryab/VSCodeProjects/SmartContracts-Solidity/contracts/Voting.sol", 14 | "ast": { 15 | "absolutePath": "project:/contracts/Voting.sol", 16 | "exportedSymbols": { 17 | "VotingSystem": [ 18 | 51 19 | ] 20 | }, 21 | "id": 52, 22 | "nodeType": "SourceUnit", 23 | "nodes": [ 24 | { 25 | "id": 50, 26 | "literals": [ 27 | "solidity", 28 | "^", 29 | "0.8", 30 | ".0" 31 | ], 32 | "nodeType": "PragmaDirective", 33 | "src": "0:23:1" 34 | }, 35 | { 36 | "abstract": false, 37 | "baseContracts": [], 38 | "contractDependencies": [], 39 | "contractKind": "contract", 40 | "fullyImplemented": true, 41 | "id": 51, 42 | "linearizedBaseContracts": [ 43 | 51 44 | ], 45 | "name": "VotingSystem", 46 | "nodeType": "ContractDefinition", 47 | "nodes": [], 48 | "scope": 52, 49 | "src": "63:26:1" 50 | } 51 | ], 52 | "src": "0:89:1" 53 | }, 54 | "legacyAST": { 55 | "absolutePath": "project:/contracts/Voting.sol", 56 | "exportedSymbols": { 57 | "VotingSystem": [ 58 | 51 59 | ] 60 | }, 61 | "id": 52, 62 | "nodeType": "SourceUnit", 63 | "nodes": [ 64 | { 65 | "id": 50, 66 | "literals": [ 67 | "solidity", 68 | "^", 69 | "0.8", 70 | ".0" 71 | ], 72 | "nodeType": "PragmaDirective", 73 | "src": "0:23:1" 74 | }, 75 | { 76 | "abstract": false, 77 | "baseContracts": [], 78 | "contractDependencies": [], 79 | "contractKind": "contract", 80 | "fullyImplemented": true, 81 | "id": 51, 82 | "linearizedBaseContracts": [ 83 | 51 84 | ], 85 | "name": "VotingSystem", 86 | "nodeType": "ContractDefinition", 87 | "nodes": [], 88 | "scope": 52, 89 | "src": "63:26:1" 90 | } 91 | ], 92 | "src": "0:89:1" 93 | }, 94 | "compiler": { 95 | "name": "solc", 96 | "version": "0.8.0+commit.c7dfd78e.Emscripten.clang" 97 | }, 98 | "networks": {}, 99 | "schemaVersion": "3.4.1", 100 | "updatedAt": "2021-08-23T05:46:56.210Z", 101 | "devdoc": { 102 | "kind": "dev", 103 | "methods": {}, 104 | "version": 1 105 | }, 106 | "userdoc": { 107 | "kind": "user", 108 | "methods": {}, 109 | "version": 1 110 | } 111 | } -------------------------------------------------------------------------------- /contracts/BallotV1.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.8.0; 2 | 3 | contract Ballot { 4 | 5 | struct Voter { 6 | uint weight; 7 | bool voted; 8 | uint vote; 9 | } 10 | 11 | struct Proposal { 12 | uint voteCount; 13 | } 14 | 15 | address chairperson; 16 | mapping(address => Voter) voters; 17 | Proposal[] proposals; 18 | 19 | constructor(uint _numProposals) { 20 | chairperson = msg.sender; 21 | voters[chairperson].weight = 2; 22 | proposals.length = _numProposals; 23 | } 24 | 25 | function register(address toVoter) public { 26 | if (msg.sender != chairperson || voters[toVoter].voted) return; 27 | voters[toVoter].weight = 1; 28 | voters[toVoter].voted = false; 29 | } 30 | 31 | function vote (uint toProposal) public { 32 | Voter storage sender = voters[msg.sender]; 33 | if (sender.voted || toProposal >= proposals.length) return; 34 | sender.vote = toProposal; 35 | sender.voted = true; 36 | proposals[toProposal].voteCount = proposals[toProposal].voteCount + sender.weight; 37 | } 38 | 39 | function winningProposal() public view returns (uint) { 40 | uint winningCountProposal = 0; 41 | for (uint i = 0; i < proposals.length; i++) { 42 | if (proposals[i].voteCount > winningCountProposal) { 43 | winningCountProposal = proposals[i].voteCount; 44 | } 45 | } 46 | return winningCountProposal; 47 | } 48 | } -------------------------------------------------------------------------------- /contracts/Bidder.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.8.0; 2 | 3 | contract Bidder { 4 | string public name; 5 | uint256 public bidAmount = 20000; 6 | bool public eligible; 7 | uint256 constant minBid = 1000; 8 | 9 | function setName(string memory _name) public { 10 | name = _name; 11 | } 12 | 13 | function setBidAmount(uint256 _bidAmount) public { 14 | bidAmount = _bidAmount; 15 | } 16 | 17 | function determinEligibility() public { 18 | if (bidAmount >= minBid) eligible = true; 19 | else eligible = false; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /contracts/ChatApp.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.8.0; 2 | 3 | // write chatapp contract in solidity 4 | contract ChatApp { 5 | // the chat message 6 | string public message; 7 | // the chat message sender 8 | address public sender; 9 | // the chat message timestamp 10 | uint public timestamp; 11 | // the chat message signature 12 | bytes public signature; 13 | // the chat message signature hash 14 | bytes public signatureHash; 15 | // the chat message signature valid 16 | bool public signatureValid; 17 | // write get and set methods for message 18 | function getMessage() view public returns (string memory) { 19 | return message; 20 | } 21 | function setMessage(string memory _message) public { 22 | message = _message; 23 | } 24 | } -------------------------------------------------------------------------------- /contracts/GasCont.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.8.0; 2 | 3 | contract GasCont { 4 | 5 | string public message; 6 | uint public gas; 7 | 8 | // set the message function 9 | function setMessage(string memory _message) public { 10 | message = _message; 11 | gas = gasleft(); 12 | } 13 | } -------------------------------------------------------------------------------- /contracts/Lottery.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.8.0; 2 | 3 | contract Lottery { 4 | address public manager; 5 | address[] public players; 6 | 7 | constructor() { 8 | manager = msg.sender; 9 | } 10 | 11 | function enter() public payable { 12 | require(msg.value > .01 ether); 13 | players.push(msg.sender); 14 | } 15 | 16 | function random() private view returns (uint256) { 17 | return 18 | uint256( 19 | keccak256( 20 | abi.encodePacked(block.difficulty, block.timestamp, players) 21 | ) 22 | ); 23 | } 24 | 25 | function pickWinner() public restricted { 26 | uint256 index = random() % players.length; 27 | payable(players[index]).transfer(address(this).balance); 28 | players = new address[](0); 29 | } 30 | 31 | modifier restricted() { 32 | require(msg.sender == manager); 33 | _; 34 | } 35 | 36 | function getPlayers() public view returns (address[] memory) { 37 | return players; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /contracts/Migrations.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity >=0.4.22 <0.9.0; 3 | 4 | contract Migrations { 5 | address public owner = msg.sender; 6 | uint public last_completed_migration; 7 | 8 | modifier restricted() { 9 | require( 10 | msg.sender == owner, 11 | "This function is restricted to the contract's owner" 12 | ); 13 | _; 14 | } 15 | 16 | function setCompleted(uint completed) public restricted { 17 | last_completed_migration = completed; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /contracts/Minter.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.8.0; 2 | 3 | contract Coin { 4 | address minter; 5 | mapping(address => uint256) balances; 6 | 7 | event Sent(address from, address to, uint256 value); 8 | 9 | constructor() { 10 | minter = msg.sender; 11 | } 12 | 13 | function mint(address receiver, uint256 value) public { 14 | if (msg.sender != minter) return; 15 | balances[receiver] += value; 16 | } 17 | 18 | function send(address receiver, uint256 value) public { 19 | if (balances[msg.sender] < value) return; 20 | balances[msg.sender] -= value; 21 | balances[receiver] += value; 22 | emit Sent(msg.sender, receiver, value); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /contracts/SingleStorage.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.8.0; 2 | 3 | contract SingleStorage { 4 | string value; 5 | 6 | constructor() { 7 | value = "Myvalue"; 8 | } 9 | 10 | function get() public view returns(string memory) { 11 | return value; 12 | } 13 | 14 | function set(string memory _value) public { 15 | value = _value; 16 | } 17 | } -------------------------------------------------------------------------------- /contracts/Voting.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.8.0; 2 | 3 | // write voting system smart contract 4 | contract VotingSystem { 5 | 6 | } -------------------------------------------------------------------------------- /migrations/1_initial_migration.js: -------------------------------------------------------------------------------- 1 | const Migrations = artifacts.require("Migrations"); 2 | 3 | module.exports = function (deployer) { 4 | deployer.deploy(Migrations); 5 | }; 6 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "ganache-cli": "^6.12.2", 4 | "truffle": "^5.4.1", 5 | "web3": "^1.4.0" 6 | }, 7 | "scripts": { 8 | "test": "mocha", 9 | "start": "node index.js" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /test/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rust-master/SmartContracts-Solidity/3a570389a08c9ba846fc4baae875ef49e2c8a63d/test/.gitkeep -------------------------------------------------------------------------------- /test/inbox.test.js: -------------------------------------------------------------------------------- 1 | const assert = require("assert"); 2 | const ganache = require("ganache-cli"); 3 | const Web3 = require("web3"); 4 | const web3 = new Web3(ganache.provider()); 5 | 6 | let accounts; 7 | 8 | beforeEach(async () => { 9 | accounts = await web3.eth.getAccounts(); 10 | }); 11 | 12 | describe("Inbox", () => { 13 | it("deploys a contract", () => {}); 14 | console.log(accounts); 15 | }); 16 | -------------------------------------------------------------------------------- /truffle-config.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Use this file to configure your truffle project. It's seeded with some 3 | * common settings for different networks and features like migrations, 4 | * compilation and testing. Uncomment the ones you need or modify 5 | * them to suit your project as necessary. 6 | * 7 | * More information about configuration can be found at: 8 | * 9 | * trufflesuite.com/docs/advanced/configuration 10 | * 11 | * To deploy via Infura you'll need a wallet provider (like @truffle/hdwallet-provider) 12 | * to sign your transactions before they're sent to a remote public node. Infura accounts 13 | * are available for free at: infura.io/register. 14 | * 15 | * You'll also need a mnemonic - the twelve word phrase the wallet uses to generate 16 | * public/private key pairs. If you're publishing your code to GitHub make sure you load this 17 | * phrase from a file you've .gitignored so it doesn't accidentally become public. 18 | * 19 | */ 20 | 21 | // const HDWalletProvider = require('@truffle/hdwallet-provider'); 22 | // const infuraKey = "fj4jll3k....."; 23 | // 24 | // const fs = require('fs'); 25 | // const mnemonic = fs.readFileSync(".secret").toString().trim(); 26 | 27 | module.exports = { 28 | /** 29 | * Networks define how you connect to your ethereum client and let you set the 30 | * defaults web3 uses to send transactions. If you don't specify one truffle 31 | * will spin up a development blockchain for you on port 9545 when you 32 | * run `develop` or `test`. You can ask a truffle command to use a specific 33 | * network from the command line, e.g 34 | * 35 | * $ truffle test --network 36 | */ 37 | 38 | networks: { 39 | // Useful for testing. The `development` name is special - truffle uses it by default 40 | // if it's defined here and no other network is specified at the command line. 41 | // You should run a client (like ganache-cli, geth or parity) in a separate terminal 42 | // tab if you use this network and you must also set the `host`, `port` and `network_id` 43 | // options below to some value. 44 | // 45 | // development: { 46 | // host: "127.0.0.1", // Localhost (default: none) 47 | // port: 8545, // Standard Ethereum port (default: none) 48 | // network_id: "*", // Any network (default: none) 49 | // }, 50 | // Another network with more advanced options... 51 | // advanced: { 52 | // port: 8777, // Custom port 53 | // network_id: 1342, // Custom network 54 | // gas: 8500000, // Gas sent with each transaction (default: ~6700000) 55 | // gasPrice: 20000000000, // 20 gwei (in wei) (default: 100 gwei) 56 | // from:
, // Account to send txs from (default: accounts[0]) 57 | // websocket: true // Enable EventEmitter interface for web3 (default: false) 58 | // }, 59 | // Useful for deploying to a public network. 60 | // NB: It's important to wrap the provider as a function. 61 | // ropsten: { 62 | // provider: () => new HDWalletProvider(mnemonic, `https://ropsten.infura.io/v3/YOUR-PROJECT-ID`), 63 | // network_id: 3, // Ropsten's id 64 | // gas: 5500000, // Ropsten has a lower block limit than mainnet 65 | // confirmations: 2, // # of confs to wait between deployments. (default: 0) 66 | // timeoutBlocks: 200, // # of blocks before a deployment times out (minimum/default: 50) 67 | // skipDryRun: true // Skip dry run before migrations? (default: false for public nets ) 68 | // }, 69 | // Useful for private networks 70 | // private: { 71 | // provider: () => new HDWalletProvider(mnemonic, `https://network.io`), 72 | // network_id: 2111, // This network is yours, in the cloud. 73 | // production: true // Treats this network as if it was a public net. (default: false) 74 | // } 75 | }, 76 | 77 | // Set default mocha options here, use special reporters etc. 78 | mocha: { 79 | // timeout: 100000 80 | }, 81 | 82 | // Configure your compilers 83 | compilers: { 84 | solc: { 85 | version: "0.8.0", // Fetch exact version from solc-bin (default: truffle's version) 86 | // docker: true, // Use "0.5.1" you've installed locally with docker (default: false) 87 | // settings: { // See the solidity docs for advice about optimization and evmVersion 88 | // optimizer: { 89 | // enabled: false, 90 | // runs: 200 91 | // }, 92 | // evmVersion: "byzantium" 93 | // } 94 | } 95 | }, 96 | 97 | // Truffle DB is currently disabled by default; to enable it, change enabled: false to enabled: true 98 | // 99 | // Note: if you migrated your contracts prior to enabling this field in your Truffle project and want 100 | // those previously migrated contracts available in the .db directory, you will need to run the following: 101 | // $ truffle migrate --reset --compile-all 102 | 103 | db: { 104 | enabled: false 105 | } 106 | }; 107 | --------------------------------------------------------------------------------