solidity-cron
Version:
[](https://travis-ci.com/Frontier-project/cron) [ public {\n stack = new Stack(_T);\n period = new Period (_T);\n }\n\n function setPeriodLength(uint256 _T) public {\n require(msg.sender == owner());\n stack.empty();\n period.setPeriodLength(_T);\n }\n\n function pushStage(uint256 _duration) public {\n require(msg.sender == owner());\n stack.push(_duration);\n }\n\n /**\n * Getter for the current Stage inside a period where we are, given the current block\n * @return Current stage inside a period, using the internal Index of the given period\n */\n \n function currentStage() public view returns (uint256) {\n uint256 internalBlock = period.getRelativeIndex();\n uint256 size = stack.height();\n if(size == 0) {\n return 0;\n }\n for (uint i = 0 ; i < size; i++) {\n if (stack.positionIsOnSlot(i, internalBlock)) {\n return i;\n } \n }\n }\n\n}\n",
"sourcePath": "/Users/carlosbuendia/Documents/Projects/consensys/Frontier/cron/contracts/blocks/PeriodicStages.sol",
"ast": {
"absolutePath": "/Users/carlosbuendia/Documents/Projects/consensys/Frontier/cron/contracts/blocks/PeriodicStages.sol",
"exportedSymbols": {
"PeriodicStages": [
491
]
},
"id": 492,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 366,
"literals": [
"solidity",
"0.4",
".24"
],
"nodeType": "PragmaDirective",
"src": "0:23:4"
},
{
"absolutePath": "openzeppelin-solidity/contracts/math/SafeMath.sol",
"file": "openzeppelin-solidity/contracts/math/SafeMath.sol",
"id": 367,
"nodeType": "ImportDirective",
"scope": 492,
"sourceUnit": 1861,
"src": "25:59:4",
"symbolAliases": [],
"unitAlias": ""
},
{
"absolutePath": "openzeppelin-solidity/contracts/ownership/Ownable.sol",
"file": "openzeppelin-solidity/contracts/ownership/Ownable.sol",
"id": 368,
"nodeType": "ImportDirective",
"scope": 492,
"sourceUnit": 1970,
"src": "85:63:4",
"symbolAliases": [],
"unitAlias": ""
},
{
"absolutePath": "/Users/carlosbuendia/Documents/Projects/consensys/Frontier/cron/contracts/blocks/Stack.sol",
"file": "./Stack.sol",
"id": 369,
"nodeType": "ImportDirective",
"scope": 492,
"sourceUnit": 715,
"src": "149:21:4",
"symbolAliases": [],
"unitAlias": ""
},
{
"absolutePath": "/Users/carlosbuendia/Documents/Projects/consensys/Frontier/cron/contracts/blocks/Period.sol",
"file": "./Period.sol",
"id": 370,
"nodeType": "ImportDirective",
"scope": 492,
"sourceUnit": 365,
"src": "171:22:4",
"symbolAliases": [],
"unitAlias": ""
},
{
"baseContracts": [
{
"arguments": null,
"baseName": {
"contractScope": null,
"id": 371,
"name": "Ownable",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 1969,
"src": "312:7:4",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Ownable_$1969",
"typeString": "contract Ownable"
}
},
"id": 372,
"nodeType": "InheritanceSpecifier",
"src": "312:7:4"
}
],
"contractDependencies": [
364,
714,
1969
],
"contractKind": "contract",
"documentation": " A periodic contract. Enables any contract to change state on a periodic basis*",
"fullyImplemented": true,
"id": 491,
"linearizedBaseContracts": [
491,
1969
],
"name": "PeriodicStages",
"nodeType": "ContractDefinition",
"nodes": [
{
"id": 375,
"libraryName": {
"contractScope": null,
"id": 373,
"name": "SafeMath",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 1860,
"src": "332:8:4",
"typeDescriptions": {
"typeIdentifier": "t_contract$_SafeMath_$1860",
"typeString": "library SafeMath"
}
},
"nodeType": "UsingForDirective",
"src": "326:27:4",
"typeName": {
"id": 374,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "345:7:4",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
},
{
"constant": false,
"id": 377,
"name": "period",
"nodeType": "VariableDeclaration",
"scope": 491,
"src": "396:20:4",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Period_$364",
"typeString": "contract Period"
},
"typeName": {
"contractScope": null,
"id": 376,
"name": "Period",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 364,
"src": "396:6:4",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Period_$364",
"typeString": "contract Period"
}
},
"value": null,
"visibility": "public"
},
{
"constant": false,
"id": 379,
"name": "stack",
"nodeType": "VariableDeclaration",
"scope": 491,
"src": "422:18:4",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Stack_$714",
"typeString": "contract Stack"
},
"typeName": {
"contractScope": null,
"id": 378,
"name": "Stack",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 714,
"src": "422:5:4",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Stack_$714",
"typeString": "contract Stack"
}
},
"value": null,
"visibility": "public"
},
{
"body": {
"id": 398,
"nodeType": "Block",
"src": "616:72:4",
"statements": [
{
"expression": {
"argumentTypes": null,
"id": 389,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 384,
"name": "stack",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 379,
"src": "626:5:4",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Stack_$714",
"typeString": "contract Stack"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 387,
"name": "_T",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 381,
"src": "644:2:4",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"id": 386,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"nodeType": "NewExpression",
"src": "634:9:4",
"typeDescriptions": {
"typeIdentifier": "t_function_creation_nonpayable$_t_uint256_$returns$_t_contract$_Stack_$714_$",
"typeString": "function (uint256) returns (contract Stack)"
},
"typeName": {
"contractScope": null,
"id": 385,
"name": "Stack",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 714,
"src": "638:5:4",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Stack_$714",
"typeString": "contract Stack"
}
}
},
"id": 388,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "634:13:4",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Stack_$714",
"typeString": "contract Stack"
}
},
"src": "626:21:4",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Stack_$714",
"typeString": "contract Stack"
}
},
"id": 390,
"nodeType": "ExpressionStatement",
"src": "626:21:4"
},
{
"expression": {
"argumentTypes": null,
"id": 396,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 391,
"name": "period",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 377,
"src": "657:6:4",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Period_$364",
"typeString": "contract Period"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 394,
"name": "_T",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 381,
"src": "678:2:4",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"id": 393,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"nodeType": "NewExpression",
"src": "666:10:4",
"typeDescriptions": {
"typeIdentifier": "t_function_creation_nonpayable$_t_uint256_$returns$_t_contract$_Period_$364_$",
"typeString": "function (uint256) returns (contract Period)"
},
"typeName": {
"contractScope": null,
"id": 392,
"name": "Period",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 364,
"src": "670:6:4",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Period_$364",
"typeString": "contract Period"
}
}
},
"id": 395,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "666:15:4",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Period_$364",
"typeString": "contract Period"
}
},
"src": "657:24:4",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Period_$364",
"typeString": "contract Period"
}
},
"id": 397,
"nodeType": "ExpressionStatement",
"src": "657:24:4"
}
]
},
"documentation": "Constructor. Sets up a new period, initializes the offset.\n@param _T Initial number of blocks for the period*",
"id": 399,
"implemented": true,
"isConstructor": true,
"isDeclaredConst": false,
"modifiers": [],
"name": "",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 382,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 381,
"name": "_T",
"nodeType": "VariableDeclaration",
"scope": 399,
"src": "597:10:4",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 380,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "597:7:4",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "596:12:4"
},
"payable": false,
"returnParameters": {
"id": 383,
"nodeType": "ParameterList",
"parameters": [],
"src": "616:0:4"
},
"scope": 491,
"src": "585:103:4",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
},
{
"body": {
"id": 423,
"nodeType": "Block",
"src": "738:106:4",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"id": 409,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 405,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1984,
"src": "756:3:4",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 406,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "756:10:4",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"arguments": [],
"expression": {
"argumentTypes": [],
"id": 407,
"name": "owner",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1894,
"src": "770:5:4",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$__$returns$_t_address_$",
"typeString": "function () view returns (address)"
}
},
"id": 408,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "770:7:4",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"src": "756:21:4",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
}
],
"id": 404,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
1987,
1988
],
"referencedDeclaration": 1987,
"src": "748:7:4",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$",
"typeString": "function (bool) pure"
}
},
"id": 410,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "748:30:4",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 411,
"nodeType": "ExpressionStatement",
"src": "748:30:4"
},
{
"expression": {
"argumentTypes": null,
"arguments": [],
"expression": {
"argumentTypes": [],
"expression": {
"argumentTypes": null,
"id": 412,
"name": "stack",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 379,
"src": "788:5:4",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Stack_$714",
"typeString": "contract Stack"
}
},
"id": 414,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "empty",
"nodeType": "MemberAccess",
"referencedDeclaration": 676,
"src": "788:11:4",
"typeDescriptions": {
"typeIdentifier": "t_function_external_nonpayable$__$returns$__$",
"typeString": "function () external"
}
},
"id": 415,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "788:13:4",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 416,
"nodeType": "ExpressionStatement",
"src": "788:13:4"
},
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 420,
"name": "_T",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 401,
"src": "834:2:4",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"expression": {
"argumentTypes": null,
"id": 417,
"name": "period",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 377,
"src": "811:6:4",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Period_$364",
"typeString": "contract Period"
}
},
"id": 419,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "setPeriodLength",
"nodeType": "MemberAccess",
"referencedDeclaration": 194,
"src": "811:22:4",
"typeDescriptions": {
"typeIdentifier": "t_function_external_nonpayable$_t_uint256_$returns$__$",
"typeString": "function (uint256) external"
}
},
"id": 421,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "811:26:4",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 422,
"nodeType": "ExpressionStatement",
"src": "811:26:4"
}
]
},
"documentation": null,
"id": 424,
"implemented": true,
"isConstructor": false,
"isDeclaredConst": false,
"modifiers": [],
"name": "setPeriodLength",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 402,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 401,
"name": "_T",
"nodeType": "VariableDeclaration",
"scope": 424,
"src": "719:10:4",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 400,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "719:7:4",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "718:12:4"
},
"payable": false,
"returnParameters": {
"id": 403,
"nodeType": "ParameterList",
"parameters": [],
"src": "738:0:4"
},
"scope": 491,
"src": "694:150:4",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
},
{
"body": {
"id": 443,
"nodeType": "Block",
"src": "895:78:4",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"id": 434,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 430,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1984,
"src": "913:3:4",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 431,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "913:10:4",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"arguments": [],
"expression": {
"argumentTypes": [],
"id": 432,
"name": "owner",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1894,
"src": "927:5:4",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$__$returns$_t_address_$",
"typeString": "function () view returns (address)"
}
},
"id": 433,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "927:7:4",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"src": "913:21:4",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
}
],
"id": 429,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
1987,
1988
],
"referencedDeclaration": 1987,
"src": "905:7:4",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$",
"typeString": "function (bool) pure"
}
},
"id": 435,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "905:30:4",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 436,
"nodeType": "ExpressionStatement",
"src": "905:30:4"
},
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 440,
"name": "_duration",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 426,
"src": "956:9:4",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"expression": {
"argumentTypes": null,
"id": 437,
"name": "stack",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 379,
"src": "945:5:4",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Stack_$714",
"typeString": "contract Stack"
}
},
"id": 439,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "push",
"nodeType": "MemberAccess",
"referencedDeclaration": 573,
"src": "945:10:4",
"typeDescriptions": {
"typeIdentifier": "t_function_external_nonpayable$_t_uint256_$returns$__$",
"typeString": "function (uint256) external"
}
},
"id": 441,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "945:21:4",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 442,
"nodeType": "ExpressionStatement",
"src": "945:21:4"
}
]
},
"documentation": null,
"id": 444,
"implemented": true,
"isConstructor": false,
"isDeclaredConst": false,
"modifiers": [],
"name": "pushStage",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 427,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 426,
"name": "_duration",
"nodeType": "VariableDeclaration",
"scope": 444,
"src": "869:17:4",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 425,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "869:7:4",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "868:19:4"
},
"payable": false,
"returnParameters": {
"id": 428,
"nodeType": "ParameterList",
"parameters": [],
"src": "895:0:4"
},
"scope": 491,
"src": "850:123:4",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
},
{
"body": {
"id": 489,
"nodeType": "Block",
"src": "1232:315:4",
"statements": [
{
"assignments": [
450
],
"declarations": [
{
"constant": false,
"id": 450,
"name": "internalBlock",
"nodeType": "VariableDeclaration",
"scope": 490,
"src": "1242:21:4",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 449,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1242:7:4",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 454,
"initialValue": {
"argumentTypes": null,
"arguments": [],
"expression": {
"argumentTypes": [],
"expression": {
"argumentTypes": null,
"id": 451,
"name": "period",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 377,
"src": "1266:6:4",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Period_$364",
"typeString": "contract Period"
}
},
"id": 452,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "getRelativeIndex",
"nodeType": "MemberAccess",
"referencedDeclaration": 352,
"src": "1266:23:4",
"typeDescriptions": {
"typeIdentifier": "t_function_external_view$__$returns$_t_uint256_$",
"typeString": "function () view external returns (uint256)"
}
},
"id": 453,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1266:25:4",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "1242:49:4"
},
{
"assignments": [
456
],
"declarations": [
{
"constant": false,
"id": 456,
"name": "size",
"nodeType": "VariableDeclaration",
"scope": 490,
"src": "1301:12:4",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 455,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1301:7:4",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 460,
"initialValue": {
"argumentTypes": null,
"arguments": [],
"expression": {
"argumentTypes": [],
"expression": {
"argumentTypes": null,
"id": 457,
"name": "stack",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 379,
"src": "1316:5:4",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Stack_$714",
"typeString": "contract Stack"
}
},
"id": 458,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "height",
"nodeType": "MemberAccess",
"referencedDeclaration": 528,
"src": "1316:12:4",
"typeDescriptions": {
"typeIdentifier": "t_function_external_view$__$returns$_t_uint256_$",
"typeString": "function () view external returns (uint256)"
}
},
"id": 459,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1316:14:4",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "1301:29:4"
},
{
"condition": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 463,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 461,
"name": "size",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 456,
"src": "1343:4:4",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"hexValue": "30",
"id": 462,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1351:1:4",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"src": "1343:9:4",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": null,
"id": 467,
"nodeType": "IfStatement",
"src": "1340:47:4",
"trueBody": {
"id": 466,
"nodeType": "Block",
"src": "1354:33:4",
"statements": [
{
"expression": {
"argumentTypes": null,
"hexValue": "30",
"id": 464,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1375:1:4",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"functionReturnParameters": 448,
"id": 465,
"nodeType": "Return",
"src": "1368:8:4"
}
]
}
},
{
"body": {
"id": 487,
"nodeType": "Block",
"src": "1429:112:4",
"statements": [
{
"condition": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 480,
"name": "i",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 469,
"src": "1470:1:4",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
{
"argumentTypes": null,
"id": 481,
"name": "internalBlock",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 450,
"src": "1473:13:4",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"expression": {
"argumentTypes": null,
"id": 478,
"name": "stack",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 379,
"src": "1447:5:4",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Stack_$714",
"typeString": "contract Stack"
}
},
"id": 479,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "positionIsOnSlot",
"nodeType": "MemberAccess",
"referencedDeclaration": 713,
"src": "1447:22:4",
"typeDescriptions": {
"typeIdentifier": "t_function_external_view$_t_uint256_$_t_uint256_$returns$_t_bool_$",
"typeString": "function (uint256,uint256) view external returns (bool)"
}
},
"id": 482,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1447:40:4",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": null,
"id": 486,
"nodeType": "IfStatement",
"src": "1443:87:4",
"trueBody": {
"id": 485,
"nodeType": "Block",
"src": "1489:41:4",
"statements": [
{
"expression": {
"argumentTypes": null,
"id": 483,
"name": "i",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 469,
"src": "1514:1:4",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"functionReturnParameters": 448,
"id": 484,
"nodeType": "Return",
"src": "1507:8:4"
}
]
}
}
]
},
"condition": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 474,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 472,
"name": "i",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 469,
"src": "1414:1:4",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "<",
"rightExpression": {
"argumentTypes": null,
"id": 473,
"name": "size",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 456,
"src": "1418:4:4",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "1414:8:4",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"id": 488,
"initializationExpression": {
"assignments": [
469
],
"declarations": [
{
"constant": false,
"id": 469,
"name": "i",
"nodeType": "VariableDeclaration",
"scope": 490,
"src": "1401:6:4",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 468,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "1401:4:4",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 471,
"initialValue": {
"argumentTypes": null,
"hexValue": "30",
"id": 470,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1410:1:4",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"nodeType": "VariableDeclarationStatement",
"src": "1401:10:4"
},
"loopExpression": {
"expression": {
"argumentTypes": null,
"id": 476,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"nodeType": "UnaryOperation",
"operator": "++",
"prefix": false,
"src": "1424:3:4",
"subExpression": {
"argumentTypes": null,
"id": 475,
"name": "i",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 469,
"src": "1424:1:4",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 477,
"nodeType": "ExpressionStatement",
"src": "1424:3:4"
},
"nodeType": "ForStatement",
"src": "1396:145:4"
}
]
},
"documentation": "Getter for the current Stage inside a period where we are, given the current block\n@return Current stage inside a period, using the internal Index of the given period",
"id": 490,
"implemented": true,
"isConstructor": false,
"isDeclaredConst": true,
"modifiers": [],
"name": "currentStage",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 445,
"nodeType": "ParameterList",
"parameters": [],
"src": "1199:2:4"
},
"payable": false,
"returnParameters": {
"id": 448,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 447,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 490,
"src": "1223:7:4",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 446,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1223:7:4",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1222:9:4"
},
"scope": 491,
"src": "1178:369:4",
"stateMutability": "view",
"superFunction": null,
"visibility": "public"
}
],
"scope": 492,
"src": "285:1265:4"
}
],
"src": "0:1551:4"
},
"legacyAST": {
"absolutePath": "/Users/carlosbuendia/Documents/Projects/consensys/Frontier/cron/contracts/blocks/PeriodicStages.sol",
"exportedSymbols": {
"PeriodicStages": [
491
]
},
"id": 492,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 366,
"literals": [
"solidity",
"0.4",
".24"
],
"nodeType": "PragmaDirective",
"src": "0:23:4"
},
{
"absolutePath": "openzeppelin-solidity/contracts/math/SafeMath.sol",
"file": "openzeppelin-solidity/contracts/math/SafeMath.sol",
"id": 367,
"nodeType": "ImportDirective",
"scope": 492,
"sourceUnit": 1861,
"src": "25:59:4",
"symbolAliases": [],
"unitAlias": ""
},
{
"absolutePath": "openzeppelin-solidity/contracts/ownership/Ownable.sol",
"file": "openzeppelin-solidity/contracts/ownership/Ownable.sol",
"id": 368,
"nodeType": "ImportDirective",
"scope": 492,
"sourceUnit": 1970,
"src": "85:63:4",
"symbolAliases": [],
"unitAlias": ""
},
{
"absolutePath": "/Users/carlosbuendia/Documents/Projects/consensys/Frontier/cron/contracts/blocks/Stack.sol",
"file": "./Stack.sol",
"id": 369,
"nodeType": "ImportDirective",
"scope": 492,
"sourceUnit": 715,
"src": "149:21:4",
"symbolAliases": [],
"unitAlias": ""
},
{
"absolutePath": "/Users/carlosbuendia/Documents/Projects/consensys/Frontier/cron/contracts/blocks/Period.sol",
"file": "./Period.sol",
"id": 370,
"nodeType": "ImportDirective",
"scope": 492,
"sourceUnit": 365,
"src": "171:22:4",
"symbolAliases": [],
"unitAlias": ""
},
{
"baseContracts": [
{
"arguments": null,
"baseName": {
"contractScope": null,
"id": 371,
"name": "Ownable",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 1969,
"src": "312:7:4",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Ownable_$1969",
"typeString": "contract Ownable"
}
},
"id": 372,
"nodeType": "InheritanceSpecifier",
"src": "312:7:4"
}
],
"contractDependencies": [
364,
714,
1969
],
"contractKind": "contract",
"documentation": " A periodic contract. Enables any contract to change state on a periodic basis*",
"fullyImplemented": true,
"id": 491,
"linearizedBaseContracts": [
491,
1969
],
"name": "PeriodicStages",
"nodeType": "ContractDefinition",
"nodes": [
{
"id": 375,
"libraryName": {
"contractScope": null,
"id": 373,
"name": "SafeMath",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 1860,
"src": "332:8:4",
"typeDescriptions": {
"typeIdentifier": "t_contract$_SafeMath_$1860",
"typeString": "library SafeMath"
}
},
"nodeType": "UsingForDirective",
"src": "326:27:4",
"typeName": {
"id": 374,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "345:7:4",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
},
{
"constant": false,
"id": 377,
"name": "period",
"nodeType": "VariableDeclaration",
"scope": 491,
"src": "396:20:4",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Period_$364",
"typeString": "contract Period"
},
"typeName": {
"contractScope": null,
"id": 376,
"name": "Period",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 364,
"src": "396:6:4",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Period_$364",
"typeString": "contract Period"
}
},
"value": null,
"visibility": "public"
},
{
"constant": false,
"id": 379,
"name": "stack",
"nodeType": "VariableDeclaration",
"scope": 491,
"src": "422:18:4",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Stack_$714",
"typeString": "contract Stack"
},
"typeName": {
"contractScope": null,
"id": 378,
"name": "Stack",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 714,
"src": "422:5:4",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Stack_$714",
"typeString": "contract Stack"
}
},
"value": null,
"visibility": "public"
},
{
"body": {
"id": 398,
"nodeType": "Block",
"src": "616:72:4",
"statements": [
{
"expression": {
"argumentTypes": null,
"id": 389,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 384,
"name": "stack",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 379,
"src": "626:5:4",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Stack_$714",
"typeString": "contract Stack"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 387,
"name": "_T",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 381,
"src": "644:2:4",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"id": 386,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"nodeType": "NewExpression",
"src": "634:9:4",
"typeDescriptions": {
"typeIdentifier": "t_function_creation_nonpayable$_t_uint256_$returns$_t_contract$_Stack_$714_$",
"typeString": "function (uint256) returns (contract Stack)"
},
"typeName": {
"contractScope": null,
"id": 385,
"name": "Stack",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 714,
"src": "638:5:4",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Stack_$714",
"typeString": "contract Stack"
}
}
},
"id": 388,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "634:13:4",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Stack_$714",
"typeString": "contract Stack"
}
},
"src": "626:21:4",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Stack_$714",
"typeString": "contract Stack"
}
},
"id": 390,
"nodeType": "ExpressionStatement",
"src": "626:21:4"
},
{
"expression": {
"argumentTypes": null,
"id": 396,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 391,
"name": "period",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 377,
"src": "657:6:4",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Period_$364",
"typeString": "contract Period"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 394,
"name": "_T",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 381,
"src": "678:2:4",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"id": 393,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"nodeType": "NewExpression",
"src": "666:10:4",
"typeDescriptions": {
"typeIdentifier": "t_function_creation_nonpayable$_t_uint256_$returns$_t_contract$_Period_$364_$",
"typeString": "function (uint256) returns (contract Period)"
},
"typeName": {
"contractScope": null,
"id": 392,
"name": "Period",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 364,
"src": "670:6:4",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Period_$364",
"typeString": "contract Period"
}
}
},
"id": 395,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "666:15:4",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Period_$364",
"typeString": "contract Period"
}
},
"src": "657:24:4",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Period_$364",
"typeString": "contract Period"
}
},
"id": 397,
"nodeType": "ExpressionStatement",
"src": "657:24:4"
}
]
},
"documentation": "Constructor. Sets up a new period, initializes the offset.\n@param _T Initial number of blocks for the period*",
"id": 399,
"implemented": true,
"isConstructor": true,
"isDeclaredConst": false,
"modifiers": [],
"name": "",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 382,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 381,
"name": "_T",
"nodeType": "VariableDeclaration",
"scope": 399,
"src": "597:10:4",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 380,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "597:7:4",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "596:12:4"
},
"payable": false,
"returnParameters": {
"id": 383,
"nodeType": "ParameterList",
"parameters": [],
"src": "616:0:4"
},
"scope": 491,
"src": "585:103:4",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
},
{
"body": {
"id": 423,
"nodeType": "Block",
"src": "738:106:4",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"id": 409,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 405,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1984,
"src": "756:3:4",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 406,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "756:10:4",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"arguments": [],
"expression": {
"argumentTypes": [],
"id": 407,
"name": "owner",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1894,
"src": "770:5:4",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$__$returns$_t_address_$",
"typeString": "function () view returns (address)"
}
},
"id": 408,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "770:7:4",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"src": "756:21:4",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
}
],
"id": 404,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
1987,
1988
],
"referencedDeclaration": 1987,
"src": "748:7:4",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$",
"typeString": "function (bool) pure"
}
},
"id": 410,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "748:30:4",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 411,
"nodeType": "ExpressionStatement",
"src": "748:30:4"
},
{
"expression": {
"argumentTypes": null,
"arguments": [],
"expression": {
"argumentTypes": [],
"expression": {
"argumentTypes": null,
"id": 412,
"name": "stack",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 379,
"src": "788:5:4",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Stack_$714",
"typeString": "contract Stack"
}
},
"id": 414,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "empty",
"nodeType": "MemberAccess",
"referencedDeclaration": 676,
"src": "788:11:4",
"typeDescriptions": {
"typeIdentifier": "t_function_external_nonpayable$__$returns$__$",
"typeString": "function () external"
}
},
"id": 415,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "788:13:4",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 416,
"nodeType": "ExpressionStatement",
"src": "788:13:4"
},
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 420,
"name": "_T",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 401,
"src": "834:2:4",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"expression": {
"argumentTypes": null,
"id": 417,
"name": "period",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 377,
"src": "811:6:4",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Period_$364",
"typeString": "contract Period"
}
},
"id": 419,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "setPeriodLength",
"nodeType": "MemberAccess",
"referencedDeclaration": 194,
"src": "811:22:4",
"typeDescriptions": {
"typeIdentifier": "t_function_external_nonpayable$_t_uint256_$returns$__$",
"typeString": "function (uint256) external"
}
},
"id": 421,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "811:26:4",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 422,
"nodeType": "ExpressionStatement",
"src": "811:26:4"
}
]
},
"documentation": null,
"id": 424,
"implemented": true,
"isConstructor": false,
"isDeclaredConst": false,
"modifiers": [],
"name": "setPeriodLength",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 402,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 401,
"name": "_T",
"nodeType": "VariableDeclaration",
"scope": 424,
"src": "719:10:4",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 400,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "719:7:4",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "718:12:4"
},
"payable": false,
"returnParameters": {
"id": 403,
"nodeType": "ParameterList",
"parameters": [],
"src": "738:0:4"
},
"scope": 491,
"src": "694:150:4",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
},
{
"body": {
"id": 443,
"nodeType": "Block",
"src": "895:78:4",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"id": 434,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 430,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1984,
"src": "913:3:4",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 431,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "913:10:4",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"arguments": [],
"expression": {
"argumentTypes": [],
"id": 432,
"name": "owner",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1894,
"src": "927:5:4",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$__$returns$_t_address_$",
"typeString": "function () view returns (address)"
}
},
"id": 433,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "927:7:4",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"src": "913:21:4",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
}
],
"id": 429,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
1987,
1988
],
"referencedDeclaration": 1987,
"src": "905:7:4",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$",
"typeString": "function (bool) pure"
}
},
"id": 435,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "905:30:4",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 436,
"nodeType": "ExpressionStatement",
"src": "905:30:4"
},
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 440,
"name": "_duration",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 426,
"src": "956:9:4",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"expression": {
"argumentTypes": null,
"id": 437,
"name": "stack",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 379,
"src": "945:5:4",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Stack_$714",
"typeString": "contract Stack"
}
},
"id": 439,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "push",
"nodeType": "MemberAccess",
"referencedDeclaration": 573,
"src": "945:10:4",
"typeDescriptions": {
"typeIdentifier": "t_function_external_nonpayable$_t_uint256_$returns$__$",
"typeString": "function (uint256) external"
}
},
"id": 441,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "945:21:4",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 442,
"nodeType": "ExpressionStatement",
"src": "945:21:4"
}
]
},
"documentation": null,
"id": 444,
"implemented": true,
"isConstructor": false,
"isDeclaredConst": false,
"modifiers": [],
"name": "pushStage",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 427,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 426,
"name": "_duration",
"nodeType": "VariableDeclaration",
"scope": 444,
"src": "869:17:4",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 425,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "869:7:4",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "868:19:4"
},
"payable": false,
"returnParameters": {
"id": 428,
"nodeType": "ParameterList",
"parameters": [],
"src": "895:0:4"
},
"scope": 491,
"src": "850:123:4",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
},
{
"body": {
"id": 489,
"nodeType": "Block",
"src": "1232:315:4",
"statements": [
{
"assignments": [
450
],
"declarations": [
{
"constant": false,
"id": 450,
"name": "internalBlock",
"nodeType": "VariableDeclaration",
"scope": 490,
"src": "1242:21:4",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 449,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1242:7:4",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 454,
"initialValue": {
"argumentTypes": null,
"arguments": [],
"expression": {
"argumentTypes": [],
"expression": {
"argumentTypes": null,
"id": 451,
"name": "period",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 377,
"src": "1266:6:4",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Period_$364",
"typeString": "contract Period"
}
},
"id": 452,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "getRelativeIndex",
"nodeType": "MemberAccess",
"referencedDeclaration": 352,
"src": "1266:23:4",
"typeDescriptions": {
"typeIdentifier": "t_function_external_view$__$returns$_t_uint256_$",
"typeString": "function () view external returns (uint256)"
}
},
"id": 453,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1266:25:4",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "1242:49:4"
},
{
"assignments": [
456
],
"declarations": [
{
"constant": false,
"id": 456,
"name": "size",
"nodeType": "VariableDeclaration",
"scope": 490,
"src": "1301:12:4",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 455,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1301:7:4",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 460,
"initialValue": {
"argumentTypes": null,
"arguments": [],
"expression": {
"argumentTypes": [],
"expression": {
"argumentTypes": null,
"id": 457,
"name": "stack",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 379,
"src": "1316:5:4",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Stack_$714",
"typeString": "contract Stack"
}
},
"id": 458,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "height",
"nodeType": "MemberAccess",
"referencedDeclaration": 528,
"src": "1316:12:4",
"typeDescriptions": {
"typeIdentifier": "t_function_external_view$__$returns$_t_uint256_$",
"typeString": "function () view external returns (uint256)"
}
},
"id": 459,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1316:14:4",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "1301:29:4"
},
{
"condition": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 463,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 461,
"name": "size",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 456,
"src": "1343:4:4",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"hexValue": "30",
"id": 462,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1351:1:4",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"src": "1343:9:4",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": null,
"id": 467,
"nodeType": "IfStatement",
"src": "1340:47:4",
"trueBody": {
"id": 466,
"nodeType": "Block",
"src": "1354:33:4",
"statements": [
{
"expression": {
"argumentTypes": null,
"hexValue": "30",
"id": 464,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1375:1:4",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"functionReturnParameters": 448,
"id": 465,
"nodeType": "Return",
"src": "1368:8:4"
}
]
}
},
{
"body": {
"id": 487,
"nodeType": "Block",
"src": "1429:112:4",
"statements": [
{
"condition": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 480,
"name": "i",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 469,
"src": "1470:1:4",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
{
"argumentTypes": null,
"id": 481,
"name": "internalBlock",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 450,
"src": "1473:13:4",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"expression": {
"argumentTypes": null,
"id": 478,
"name": "stack",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 379,
"src": "1447:5:4",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Stack_$714",
"typeString": "contract Stack"
}
},
"id": 479,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "positionIsOnSlot",
"nodeType": "MemberAccess",
"referencedDeclaration": 713,
"src": "1447:22:4",
"typeDescriptions": {
"typeIdentifier": "t_function_external_view$_t_uint256_$_t_uint256_$returns$_t_bool_$",
"typeString": "function (uint256,uint256) view external returns (bool)"
}
},
"id": 482,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1447:40:4",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": null,
"id": 486,
"nodeType": "IfStatement",
"src": "1443:87:4",
"trueBody": {
"id": 485,
"nodeType": "Block",
"src": "1489:41:4",
"statements": [
{
"expression": {
"argumentTypes": null,
"id": 483,
"name": "i",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 469,
"src": "1514:1:4",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"functionReturnParameters": 448,
"id": 484,
"nodeType": "Return",
"src": "1507:8:4"
}
]
}
}
]
},
"condition": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 474,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 472,
"name": "i",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 469,
"src": "1414:1:4",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "<",
"rightExpression": {
"argumentTypes": null,
"id": 473,
"name": "size",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 456,
"src": "1418:4:4",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "1414:8:4",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"id": 488,
"initializationExpression": {
"assignments": [
469
],
"declarations": [
{
"constant": false,
"id": 469,
"name": "i",
"nodeType": "VariableDeclaration",
"scope": 490,
"src": "1401:6:4",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 468,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "1401:4:4",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 471,
"initialValue": {
"argumentTypes": null,
"hexValue": "30",
"id": 470,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1410:1:4",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"nodeType": "VariableDeclarationStatement",
"src": "1401:10:4"
},
"loopExpression": {
"expression": {
"argumentTypes": null,
"id": 476,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"nodeType": "UnaryOperation",
"operator": "++",
"prefix": false,
"src": "1424:3:4",
"subExpression": {
"argumentTypes": null,
"id": 475,
"name": "i",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 469,
"src": "1424:1:4",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 477,
"nodeType": "ExpressionStatement",
"src": "1424:3:4"
},
"nodeType": "ForStatement",
"src": "1396:145:4"
}
]
},
"documentation": "Getter for the current Stage inside a period where we are, given the current block\n@return Current stage inside a period, using the internal Index of the given period",
"id": 490,
"implemented": true,
"isConstructor": false,
"isDeclaredConst": true,
"modifiers": [],
"name": "currentStage",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 445,
"nodeType": "ParameterList",
"parameters": [],
"src": "1199:2:4"
},
"payable": false,
"returnParameters": {
"id": 448,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 447,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 490,
"src": "1223:7:4",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 446,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1223:7:4",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1222:9:4"
},
"scope": 491,
"src": "1178:369:4",
"stateMutability": "view",
"superFunction": null,
"visibility": "public"
}
],
"scope": 492,
"src": "285:1265:4"
}
],
"src": "0:1551:4"
},
"compiler": {
"name": "solc",
"version": "0.4.24+commit.e67f0147.Emscripten.clang"
},
"networks": {},
"schemaVersion": "2.0.0",
"updatedAt": "2018-11-22T12:03:13.685Z"
}