UNPKG

solidity-cron

Version:

[![Build Status](https://travis-ci.com/Frontier-project/cron.svg?token=DJeMzxJJncp3nRaEUuxH&branch=master)](https://travis-ci.com/Frontier-project/cron) [![codecov](https://codecov.io/gh/Frontier-project/cron/branch/master/graph/badge.svg?token=BGbU5Q6IRV

975 lines (974 loc) 261 kB
{ "contractName": "Stack", "abi": [ { "constant": true, "inputs": [], "name": "totalCapacity", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [ { "name": "", "type": "uint256" } ], "name": "strg", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "stackPointer", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": false, "inputs": [], "name": "renounceOwnership", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [], "name": "owner", "outputs": [ { "name": "", "type": "address" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "isOwner", "outputs": [ { "name": "", "type": "bool" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [ { "name": "", "type": "uint256" } ], "name": "exportValue", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": false, "inputs": [ { "name": "newOwner", "type": "address" } ], "name": "transferOwnership", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "name": "_totalCapacity", "type": "uint256" } ], "payable": false, "stateMutability": "nonpayable", "type": "constructor" }, { "anonymous": false, "inputs": [ { "indexed": true, "name": "previousOwner", "type": "address" }, { "indexed": true, "name": "newOwner", "type": "address" } ], "name": "OwnershipTransferred", "type": "event" }, { "constant": true, "inputs": [], "name": "height", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": false, "inputs": [ { "name": "_size", "type": "uint256" } ], "name": "push", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": false, "inputs": [], "name": "pop", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": false, "inputs": [], "name": "empty", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [ { "name": "slotIndex", "type": "uint256" }, { "name": "position", "type": "uint256" } ], "name": "positionIsOnSlot", "outputs": [ { "name": "", "type": "bool" } ], "payable": false, "stateMutability": "view", "type": "function" } ], "bytecode": "0x608060405234801561001057600080fd5b50604051602080610b1d83398101806040528101908080519060200190929190505050336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a38060048190555050610a17806101066000396000f3006080604052600436106100c5576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630ef26743146100ca5780632f91f1f4146100f55780634a720f27146101205780635439e423146101615780636f54dce51461018c578063715018a6146101db5780638da5cb5b146101f25780638f32d59b14610249578063959ac48414610278578063a4ece52c146102a5578063b1becf2a146102bc578063f2a75fe4146102fd578063f2fde38b14610314575b600080fd5b3480156100d657600080fd5b506100df610357565b6040518082815260200191505060405180910390f35b34801561010157600080fd5b5061010a610361565b6040518082815260200191505060405180910390f35b34801561012c57600080fd5b5061014b60048036038101908080359060200190929190505050610367565b6040518082815260200191505060405180910390f35b34801561016d57600080fd5b5061017661038a565b6040518082815260200191505060405180910390f35b34801561019857600080fd5b506101c16004803603810190808035906020019092919080359060200190929190505050610390565b604051808215151515815260200191505060405180910390f35b3480156101e757600080fd5b506101f061040b565b005b3480156101fe57600080fd5b506102076104dd565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561025557600080fd5b5061025e610506565b604051808215151515815260200191505060405180910390f35b34801561028457600080fd5b506102a36004803603810190808035906020019092919050505061055d565b005b3480156102b157600080fd5b506102ba610681565b005b3480156102c857600080fd5b506102e7600480360381019080803590602001909291905050506107e6565b6040518082815260200191505060405180910390f35b34801561030957600080fd5b506103126107fe565b005b34801561032057600080fd5b50610355600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610881565b005b6000600554905090565b60045481565b60018181548110151561037657fe5b906000526020600020016000915090505481565b60035481565b6000808314156103be576001838154811015156103a957fe5b90600052602060002001548211159050610405565b60018084038154811015156103cf57fe5b9060005260206000200154821015801561040257506001838154811015156103f357fe5b90600052602060002001548211155b90505b92915050565b610413610506565b151561041e57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614905090565b6105656104dd565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561059e57600080fd5b60045481600354011115151561061c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f424c4f434b5f4e554d5f4f564552464c4f57000000000000000000000000000081525060200191505060405180910390fd5b600181600354019080600181540180825580915050906001820390600052602060002001600090919290919091505550806003600082825401925050819055506005600081548092919060010191905055506004546003541115151561067e57fe5b50565b600061068b6104dd565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156106c457600080fd5b6000600180549050111515610741576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f454d5054592053544f524147450000000000000000000000000000000000000081525060200191505060405180910390fd5b60018080805490500381548110151561075657fe5b9060005260206000200154905060018080805490500381548110151561077857fe5b9060005260206000200160009055600180548091906001900361079b919061099a565b50600060018054905014156107bf57600060058190555060006003819055506107e3565b60056000815480929190600190039190505550806003600082825403925050819055505b50565b60026020528060005260406000206000915090505481565b6000806108096104dd565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561084257600080fd5b6001805490509150600090505b8181101561086c5761085f610681565b808060010191505061084f565b600060018054905014151561087d57fe5b5050565b610889610506565b151561089457600080fd5b61089d816108a0565b50565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156108dc57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b8154818355818111156109c1578183600052602060002091820191016109c091906109c6565b5b505050565b6109e891905b808211156109e45760008160009055506001016109cc565b5090565b905600a165627a7a723058203a3e89de096ccb22cb10fe208000abd307b88e2b2727b0d03714ce7c52c4b83b0029", "deployedBytecode": "0x6080604052600436106100c5576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630ef26743146100ca5780632f91f1f4146100f55780634a720f27146101205780635439e423146101615780636f54dce51461018c578063715018a6146101db5780638da5cb5b146101f25780638f32d59b14610249578063959ac48414610278578063a4ece52c146102a5578063b1becf2a146102bc578063f2a75fe4146102fd578063f2fde38b14610314575b600080fd5b3480156100d657600080fd5b506100df610357565b6040518082815260200191505060405180910390f35b34801561010157600080fd5b5061010a610361565b6040518082815260200191505060405180910390f35b34801561012c57600080fd5b5061014b60048036038101908080359060200190929190505050610367565b6040518082815260200191505060405180910390f35b34801561016d57600080fd5b5061017661038a565b6040518082815260200191505060405180910390f35b34801561019857600080fd5b506101c16004803603810190808035906020019092919080359060200190929190505050610390565b604051808215151515815260200191505060405180910390f35b3480156101e757600080fd5b506101f061040b565b005b3480156101fe57600080fd5b506102076104dd565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561025557600080fd5b5061025e610506565b604051808215151515815260200191505060405180910390f35b34801561028457600080fd5b506102a36004803603810190808035906020019092919050505061055d565b005b3480156102b157600080fd5b506102ba610681565b005b3480156102c857600080fd5b506102e7600480360381019080803590602001909291905050506107e6565b6040518082815260200191505060405180910390f35b34801561030957600080fd5b506103126107fe565b005b34801561032057600080fd5b50610355600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610881565b005b6000600554905090565b60045481565b60018181548110151561037657fe5b906000526020600020016000915090505481565b60035481565b6000808314156103be576001838154811015156103a957fe5b90600052602060002001548211159050610405565b60018084038154811015156103cf57fe5b9060005260206000200154821015801561040257506001838154811015156103f357fe5b90600052602060002001548211155b90505b92915050565b610413610506565b151561041e57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614905090565b6105656104dd565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561059e57600080fd5b60045481600354011115151561061c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f424c4f434b5f4e554d5f4f564552464c4f57000000000000000000000000000081525060200191505060405180910390fd5b600181600354019080600181540180825580915050906001820390600052602060002001600090919290919091505550806003600082825401925050819055506005600081548092919060010191905055506004546003541115151561067e57fe5b50565b600061068b6104dd565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156106c457600080fd5b6000600180549050111515610741576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f454d5054592053544f524147450000000000000000000000000000000000000081525060200191505060405180910390fd5b60018080805490500381548110151561075657fe5b9060005260206000200154905060018080805490500381548110151561077857fe5b9060005260206000200160009055600180548091906001900361079b919061099a565b50600060018054905014156107bf57600060058190555060006003819055506107e3565b60056000815480929190600190039190505550806003600082825403925050819055505b50565b60026020528060005260406000206000915090505481565b6000806108096104dd565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561084257600080fd5b6001805490509150600090505b8181101561086c5761085f610681565b808060010191505061084f565b600060018054905014151561087d57fe5b5050565b610889610506565b151561089457600080fd5b61089d816108a0565b50565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156108dc57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b8154818355818111156109c1578183600052602060002091820191016109c091906109c6565b5b505050565b6109e891905b808211156109e45760008160009055506001016109cc565b5090565b905600a165627a7a723058203a3e89de096ccb22cb10fe208000abd307b88e2b2727b0d03714ce7c52c4b83b0029", "sourceMap": "243:2615:5:-;;;705:90;8:9:-1;5:2;;;30:1;27;20:12;5:2;705:90:5;;;;;;;;;;;;;;;;;;;;;;;;;;;;;518:10:11;509:6;;:19;;;;;;;;;;;;;;;;;;572:6;;;;;;;;;;;539:40;;568:1;539:40;;;;;;;;;;;;774:14:5;758:13;:30;;;;705:90;243:2615;;;;;;", "deployedSourceMap": "243:2615:5:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;970:78;;8:9:-1;5:2;;;30:1;27;20:12;5:2;970:78:5;;;;;;;;;;;;;;;;;;;;;;;577:28;;8:9:-1;5:2;;;30:1;27;20:12;5:2;577:28:5;;;;;;;;;;;;;;;;;;;;;;;339:21;;8:9:-1;5:2;;;30:1;27;20:12;5:2;339:21:5;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;497:27;;8:9:-1;5:2;;;30:1;27;20:12;5:2;497:27:5;;;;;;;;;;;;;;;;;;;;;;;2565:291;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2565:291:5;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1273:127:11;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1273:127:11;;;;;;639:70;;8:9:-1;5:2;;;30:1;27;20:12;5:2;639:70:11;;;;;;;;;;;;;;;;;;;;;;;;;;;926:83;;8:9:-1;5:2;;;30:1;27;20:12;5:2;926:83:11;;;;;;;;;;;;;;;;;;;;;;;;;;;1213:301:5;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1213:301:5;;;;;;;;;;;;;;;;;;;;;;;;;;1576:423;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1576:423:5;;;;;;407:47;;8:9:-1;5:2;;;30:1;27;20:12;5:2;407:47:5;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2070:205;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2070:205:5;;;;;;1561:101:11;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1561:101:11;;;;;;;;;;;;;;;;;;;;;;;;;;;;970:78:5;1009:7;1035:6;;1028:13;;970:78;:::o;577:28::-;;;;:::o;339:21::-;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;497:27::-;;;;:::o;2565:291::-;2649:4;2681:1;2668:9;:14;2665:185;;;2717:4;2722:9;2717:15;;;;;;;;;;;;;;;;;;2705:8;:27;;2697:35;;;;2665:185;2790:4;2805:1;2795:9;:11;2790:17;;;;;;;;;;;;;;;;;;2778:8;:29;;:60;;;;;2823:4;2828:9;2823:15;;;;;;;;;;;;;;;;;;2811:8;:27;;2778:60;2770:69;;2565:291;;;;;:::o;1273:127:11:-;824:9;:7;:9::i;:::-;816:18;;;;;;;;1367:1;1330:40;;1351:6;;;;;;;;;;;1330:40;;;;;;;;;;;;1393:1;1376:6;;:19;;;;;;;;;;;;;;;;;;1273:127::o;639:70::-;676:7;698:6;;;;;;;;;;;691:13;;639:70;:::o;926:83::-;965:4;998:6;;;;;;;;;;;984:20;;:10;:20;;;977:27;;926:83;:::o;1213:301:5:-;1281:7;:5;:7::i;:::-;1267:21;;:10;:21;;;1259:30;;;;;;;;1333:13;;1323:5;1308:12;;:20;1307:39;;1299:70;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1379:4;1404:5;1389:12;;:20;1379:31;;39:1:-1;33:3;27:10;23:18;57:10;52:3;45:23;79:10;72:17;;0:93;1379:31:5;;;;;;;;;;;;;;;;;;;;;;1436:5;1420:12;;:21;;;;;;;;;;;1451:6;;:9;;;;;;;;;;;;;1493:13;;1477:12;;:29;;1470:37;;;;;;1213:301;:::o;1576:423::-;1699:23;1630:7;:5;:7::i;:::-;1616:21;;:10;:21;;;1608:30;;;;;;;;1670:1;1656:4;:11;;;;:15;1648:41;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1725:4;1742:1;1730:4;:11;;;;:13;1725:19;;;;;;;;;;;;;;;;;;1699:45;;1761:4;1778:1;1766:4;:11;;;;:13;1761:19;;;;;;;;;;;;;;;;;1754:26;;;1790:4;:14;;;;;;;;;;;;:::i;:::-;;1833:1;1818:4;:11;;;;:16;1814:179;;;1859:1;1850:6;:10;;;;1889:1;1874:12;:16;;;;1814:179;;;1928:6;;:9;;;;;;;;;;;;;;1967:15;1951:12;;:31;;;;;;;;;;;1814:179;1576:423;:::o;407:47::-;;;;;;;;;;;;;;;;;:::o;2070:205::-;2144:9;2182:6;2126:7;:5;:7::i;:::-;2112:21;;:10;:21;;;2104:30;;;;;;;;2156:4;:11;;;;2144:23;;2191:1;2182:10;;2177:58;2198:1;2194;:5;2177:58;;;2219:5;:3;:5::i;:::-;2201:3;;;;;;;2177:58;;;2266:1;2251:4;:11;;;;:16;2244:24;;;;;;2070:205;;:::o;1561:101:11:-;824:9;:7;:9::i;:::-;816:18;;;;;;;;1629:28;1648:8;1629:18;:28::i;:::-;1561:101;:::o;1796:169::-;1885:1;1865:22;;:8;:22;;;;1857:31;;;;;;;;1928:8;1899:38;;1920:6;;;;;;;;;;;1899:38;;;;;;;;;;;;1952:8;1943:6;;:17;;;;;;;;;;;;;;;;;;1796:169;:::o;243:2615:5:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o", "source": "pragma solidity 0.4.24;\n\nimport \"openzeppelin-solidity/contracts/math/SafeMath.sol\";\nimport \"openzeppelin-solidity/contracts/ownership/Ownable.sol\";\n\n/**\n * A simple FIFO blockstack. \n * Enables to manage tasks inside a certain capacity \n */\n\ncontract Stack is Ownable { \n \n // Each Value represents the final position of a slot\n uint256[] public strg; \n \n //Assigned value for each Slot\n mapping (uint256 => uint256) public exportValue;\n\n // Current pointer of the Stack\n uint256 public stackPointer;\n\n // Total Capacity assigned for this stack\n uint256 public totalCapacity;\n\n // Current height (number of assigned Slots) of this Stack\n uint256 public height; \n\n\n constructor(uint256 _totalCapacity) public {\n totalCapacity = _totalCapacity;\n }\n\n /**\n * Current amount of slots that are used inside the stack\n * @return height uint representing the amount of slots already reserved in the stack\n */\n\n function height() public view returns (uint256) {\n return height;\n }\n\n /**\n * Push a new value to storage if it fits, thus moving the pointer += size\n * @param _size value that will be inserted into the stack\n */\n\n function push(uint256 _size) public {\n require(msg.sender == owner());\n require((stackPointer + _size) <= totalCapacity, 'BLOCK_NUM_OVERFLOW');\n strg.push(stackPointer + _size);\n stackPointer += _size;\n height ++;\n assert(stackPointer <= totalCapacity);\n }\n\n /**\n * Pops the last value from storage\n */\n function pop() public {\n require(msg.sender == owner());\n require(strg.length > 0, 'EMPTY STORAGE');\n uint256 slotSizeToEmpty = strg[strg.length-1];\n delete strg[strg.length-1];\n strg.length --;\n if (strg.length == 0) {\n height = 0;\n stackPointer = 0;\n }\n else{\n height --;\n stackPointer -= slotSizeToEmpty;\n }\n }\n\n /**\n * Removes every single value from the Stack\n */\n function empty() public {\n require(msg.sender == owner());\n uint256 l = strg.length;\n for (uint i = 0; i < l; i++){\n pop();\n }\n assert(strg.length == 0);\n }\n\n /**\n * Returns true if a given position is in the range of a certain slot\n * @param slotIndex Position in the storage array\n * @param position Position that is checked to be inside the slot range\n * @return true if the position i is inside the given slot\n */\n\n function positionIsOnSlot(uint256 slotIndex, uint256 position) public view returns (bool) {\n if(slotIndex == 0){\n return position <= strg[slotIndex];\n }\n else{\n return (position >= strg[slotIndex-1] && position <= strg[slotIndex]);\n }\n }\n}", "sourcePath": "/Users/carlosbuendia/Documents/Projects/consensys/Frontier/cron/contracts/blocks/Stack.sol", "ast": { "absolutePath": "/Users/carlosbuendia/Documents/Projects/consensys/Frontier/cron/contracts/blocks/Stack.sol", "exportedSymbols": { "Stack": [ 714 ] }, "id": 715, "nodeType": "SourceUnit", "nodes": [ { "id": 493, "literals": [ "solidity", "0.4", ".24" ], "nodeType": "PragmaDirective", "src": "0:23:5" }, { "absolutePath": "openzeppelin-solidity/contracts/math/SafeMath.sol", "file": "openzeppelin-solidity/contracts/math/SafeMath.sol", "id": 494, "nodeType": "ImportDirective", "scope": 715, "sourceUnit": 1861, "src": "25:59:5", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "openzeppelin-solidity/contracts/ownership/Ownable.sol", "file": "openzeppelin-solidity/contracts/ownership/Ownable.sol", "id": 495, "nodeType": "ImportDirective", "scope": 715, "sourceUnit": 1970, "src": "85:63:5", "symbolAliases": [], "unitAlias": "" }, { "baseContracts": [ { "arguments": null, "baseName": { "contractScope": null, "id": 496, "name": "Ownable", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 1969, "src": "261:7:5", "typeDescriptions": { "typeIdentifier": "t_contract$_Ownable_$1969", "typeString": "contract Ownable" } }, "id": 497, "nodeType": "InheritanceSpecifier", "src": "261:7:5" } ], "contractDependencies": [ 1969 ], "contractKind": "contract", "documentation": "A simple FIFO blockstack. \nEnables to manage tasks inside a certain capacity ", "fullyImplemented": true, "id": 714, "linearizedBaseContracts": [ 714, 1969 ], "name": "Stack", "nodeType": "ContractDefinition", "nodes": [ { "constant": false, "id": 500, "name": "strg", "nodeType": "VariableDeclaration", "scope": 714, "src": "339:21:5", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_storage", "typeString": "uint256[]" }, "typeName": { "baseType": { "id": 498, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "339:7:5", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 499, "length": null, "nodeType": "ArrayTypeName", "src": "339:9:5", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", "typeString": "uint256[]" } }, "value": null, "visibility": "public" }, { "constant": false, "id": 504, "name": "exportValue", "nodeType": "VariableDeclaration", "scope": 714, "src": "407:47:5", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_uint256_$_t_uint256_$", "typeString": "mapping(uint256 => uint256)" }, "typeName": { "id": 503, "keyType": { "id": 501, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "416:7:5", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Mapping", "src": "407:28:5", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_uint256_$_t_uint256_$", "typeString": "mapping(uint256 => uint256)" }, "valueType": { "id": 502, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "427:7:5", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } }, "value": null, "visibility": "public" }, { "constant": false, "id": 506, "name": "stackPointer", "nodeType": "VariableDeclaration", "scope": 714, "src": "497:27:5", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 505, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "497:7:5", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "public" }, { "constant": false, "id": 508, "name": "totalCapacity", "nodeType": "VariableDeclaration", "scope": 714, "src": "577:28:5", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 507, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "577:7:5", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "public" }, { "constant": false, "id": 510, "name": "height", "nodeType": "VariableDeclaration", "scope": 714, "src": "675:21:5", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 509, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "675:7:5", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "public" }, { "body": { "id": 519, "nodeType": "Block", "src": "748:47:5", "statements": [ { "expression": { "argumentTypes": null, "id": 517, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 515, "name": "totalCapacity", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 508, "src": "758:13:5", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 516, "name": "_totalCapacity", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 512, "src": "774:14:5", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "758:30:5", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 518, "nodeType": "ExpressionStatement", "src": "758:30:5" } ] }, "documentation": null, "id": 520, "implemented": true, "isConstructor": true, "isDeclaredConst": false, "modifiers": [], "name": "", "nodeType": "FunctionDefinition", "parameters": { "id": 513, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 512, "name": "_totalCapacity", "nodeType": "VariableDeclaration", "scope": 520, "src": "717:22:5", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 511, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "717:7:5", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "716:24:5" }, "payable": false, "returnParameters": { "id": 514, "nodeType": "ParameterList", "parameters": [], "src": "748:0:5" }, "scope": 714, "src": "705:90:5", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { "id": 527, "nodeType": "Block", "src": "1018:30:5", "statements": [ { "expression": { "argumentTypes": null, "id": 525, "name": "height", "nodeType": "Identifier", "overloadedDeclarations": [ 510 ], "referencedDeclaration": 510, "src": "1035:6:5", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "functionReturnParameters": 524, "id": 526, "nodeType": "Return", "src": "1028:13:5" } ] }, "documentation": "Current amount of slots that are used inside the stack\n@return height uint representing the amount of slots already reserved in the stack", "id": 528, "implemented": true, "isConstructor": false, "isDeclaredConst": true, "modifiers": [], "name": "height", "nodeType": "FunctionDefinition", "parameters": { "id": 521, "nodeType": "ParameterList", "parameters": [], "src": "985:2:5" }, "payable": false, "returnParameters": { "id": 524, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 523, "name": "", "nodeType": "VariableDeclaration", "scope": 528, "src": "1009:7:5", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 522, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1009:7:5", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "1008:9:5" }, "scope": 714, "src": "970:78:5", "stateMutability": "view", "superFunction": null, "visibility": "public" }, { "body": { "id": 572, "nodeType": "Block", "src": "1249:265:5", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_address", "typeString": "address" }, "id": 538, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 534, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1984, "src": "1267:3:5", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 535, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1267:10:5", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "id": 536, "name": "owner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1894, "src": "1281:5:5", "typeDescriptions": { "typeIdentifier": "t_function_internal_view$__$returns$_t_address_$", "typeString": "function () view returns (address)" } }, "id": 537, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1281:7:5", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "src": "1267:21:5", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" } ], "id": 533, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ 1987, 1988 ], "referencedDeclaration": 1987, "src": "1259:7:5", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", "typeString": "function (bool) pure" } }, "id": 539, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1259:30:5", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 540, "nodeType": "ExpressionStatement", "src": "1259:30:5" }, { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 547, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "components": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 544, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 542, "name": "stackPointer", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 506, "src": "1308:12:5", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "+", "rightExpression": { "argumentTypes": null, "id": 543, "name": "_size", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 530, "src": "1323:5:5", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "1308:20:5", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "id": 545, "isConstant": false, "isInlineArray": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "TupleExpression", "src": "1307:22:5", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "<=", "rightExpression": { "argumentTypes": null, "id": 546, "name": "totalCapacity", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 508, "src": "1333:13:5", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "1307:39:5", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, { "argumentTypes": null, "hexValue": "424c4f434b5f4e554d5f4f564552464c4f57", "id": 548, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "1348:20:5", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_711f95f64d05c6d3f3ef2b16d070473d09edb9bf25a4df4974e2f813a45a47bc", "typeString": "literal_string \"BLOCK_NUM_OVERFLOW\"" }, "value": "BLOCK_NUM_OVERFLOW" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" }, { "typeIdentifier": "t_stringliteral_711f95f64d05c6d3f3ef2b16d070473d09edb9bf25a4df4974e2f813a45a47bc", "typeString": "literal_string \"BLOCK_NUM_OVERFLOW\"" } ], "id": 541, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ 1987, 1988 ], "referencedDeclaration": 1988, "src": "1299:7:5", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", "typeString": "function (bool,string memory) pure" } }, "id": 549, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1299:70:5", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 550, "nodeType": "ExpressionStatement", "src": "1299:70:5" }, { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 556, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 554, "name": "stackPointer", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 506, "src": "1389:12:5", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "+", "rightExpression": { "argumentTypes": null, "id": 555, "name": "_size", "nodeType": "Identifier",