UNPKG

@aragon/apps-payroll

Version:

_**Code in Github:**_ [aragon-apps/apps/payroll](https://github.com/aragon/aragon-apps/tree/master/future-apps/payroll)

883 lines 32.4 kB
{ "contractName": "Uint256Helpers", "abi": [], "bytecode": "0x604c602c600b82828239805160001a60731460008114601c57601e565bfe5b5030600052607381538281f30073000000000000000000000000000000000000000030146080604052600080fd00a165627a7a72305820e09043b0b6de869c3f5ceceab14d973abbf93b5258d7a77c231de92ffb993b9e0029", "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fd00a165627a7a72305820e09043b0b6de869c3f5ceceab14d973abbf93b5258d7a77c231de92ffb993b9e0029", "sourceMap": "27:312:38:-;;132:2:-1;166:7;155:9;146:7;137:37;252:7;246:14;243:1;238:23;232:4;229:33;270:1;265:20;;;;222:63;;265:20;274:9;222:63;;298:9;295:1;288:20;328:4;319:7;311:22;352:7;343;336:24", "deployedSourceMap": "27:312:38:-;;;;;;;;", "source": "pragma solidity ^0.4.24;\n\n\nlibrary Uint256Helpers {\n uint256 private constant MAX_UINT64 = uint64(-1);\n\n string private constant ERROR_NUMBER_TOO_BIG = \"UINT64_NUMBER_TOO_BIG\";\n\n function toUint64(uint256 a) internal pure returns (uint64) {\n require(a <= MAX_UINT64, ERROR_NUMBER_TOO_BIG);\n return uint64(a);\n }\n}\n", "sourcePath": "@aragon/os/contracts/common/Uint256Helpers.sol", "ast": { "absolutePath": "@aragon/os/contracts/common/Uint256Helpers.sol", "exportedSymbols": { "Uint256Helpers": [ 11231 ] }, "id": 11232, "nodeType": "SourceUnit", "nodes": [ { "id": 11202, "literals": [ "solidity", "^", "0.4", ".24" ], "nodeType": "PragmaDirective", "src": "0:24:38" }, { "baseContracts": [], "contractDependencies": [], "contractKind": "library", "documentation": null, "fullyImplemented": true, "id": 11231, "linearizedBaseContracts": [ 11231 ], "name": "Uint256Helpers", "nodeType": "ContractDefinition", "nodes": [ { "constant": true, "id": 11208, "name": "MAX_UINT64", "nodeType": "VariableDeclaration", "scope": 11231, "src": "56:48:38", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 11203, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "56:7:38", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 11206, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "UnaryOperation", "operator": "-", "prefix": true, "src": "101:2:38", "subExpression": { "argumentTypes": null, "hexValue": "31", "id": 11205, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "102:1:38", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_1_by_1", "typeString": "int_const 1" }, "value": "1" }, "typeDescriptions": { "typeIdentifier": "t_rational_-1_by_1", "typeString": "int_const -1" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_rational_-1_by_1", "typeString": "int_const -1" } ], "id": 11204, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "94:6:38", "typeDescriptions": { "typeIdentifier": "t_type$_t_uint64_$", "typeString": "type(uint64)" }, "typeName": "uint64" }, "id": 11207, "isConstant": false, "isLValue": false, "isPure": true, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "94:10:38", "typeDescriptions": { "typeIdentifier": "t_uint64", "typeString": "uint64" } }, "visibility": "private" }, { "constant": true, "id": 11211, "name": "ERROR_NUMBER_TOO_BIG", "nodeType": "VariableDeclaration", "scope": 11231, "src": "111:70:38", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_string_memory", "typeString": "string" }, "typeName": { "id": 11209, "name": "string", "nodeType": "ElementaryTypeName", "src": "111:6:38", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": { "argumentTypes": null, "hexValue": "55494e5436345f4e554d4245525f544f4f5f424947", "id": 11210, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "158:23:38", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_0097450fa85b09f7141faf60e71f2a076ecfed0c9fa787056beef57ff0d975db", "typeString": "literal_string \"UINT64_NUMBER_TOO_BIG\"" }, "value": "UINT64_NUMBER_TOO_BIG" }, "visibility": "private" }, { "body": { "id": 11229, "nodeType": "Block", "src": "248:89:38", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 11221, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 11219, "name": "a", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 11213, "src": "266:1:38", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "<=", "rightExpression": { "argumentTypes": null, "id": 11220, "name": "MAX_UINT64", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 11208, "src": "271:10:38", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "266:15:38", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, { "argumentTypes": null, "id": 11222, "name": "ERROR_NUMBER_TOO_BIG", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 11211, "src": "283:20:38", "typeDescriptions": { "typeIdentifier": "t_string_memory", "typeString": "string memory" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" }, { "typeIdentifier": "t_string_memory", "typeString": "string memory" } ], "id": 11218, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ 15156, 15157 ], "referencedDeclaration": 15157, "src": "258:7:38", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", "typeString": "function (bool,string memory) pure" } }, "id": 11223, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "258:46:38", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 11224, "nodeType": "ExpressionStatement", "src": "258:46:38" }, { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 11226, "name": "a", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 11213, "src": "328:1:38", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "id": 11225, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "321:6:38", "typeDescriptions": { "typeIdentifier": "t_type$_t_uint64_$", "typeString": "type(uint64)" }, "typeName": "uint64" }, "id": 11227, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "321:9:38", "typeDescriptions": { "typeIdentifier": "t_uint64", "typeString": "uint64" } }, "functionReturnParameters": 11217, "id": 11228, "nodeType": "Return", "src": "314:16:38" } ] }, "documentation": null, "id": 11230, "implemented": true, "isConstructor": false, "isDeclaredConst": true, "modifiers": [], "name": "toUint64", "nodeType": "FunctionDefinition", "parameters": { "id": 11214, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 11213, "name": "a", "nodeType": "VariableDeclaration", "scope": 11230, "src": "206:9:38", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 11212, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "206:7:38", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "205:11:38" }, "payable": false, "returnParameters": { "id": 11217, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 11216, "name": "", "nodeType": "VariableDeclaration", "scope": 11230, "src": "240:6:38", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint64", "typeString": "uint64" }, "typeName": { "id": 11215, "name": "uint64", "nodeType": "ElementaryTypeName", "src": "240:6:38", "typeDescriptions": { "typeIdentifier": "t_uint64", "typeString": "uint64" } }, "value": null, "visibility": "internal" } ], "src": "239:8:38" }, "scope": 11231, "src": "188:149:38", "stateMutability": "pure", "superFunction": null, "visibility": "internal" } ], "scope": 11232, "src": "27:312:38" } ], "src": "0:340:38" }, "legacyAST": { "absolutePath": "@aragon/os/contracts/common/Uint256Helpers.sol", "exportedSymbols": { "Uint256Helpers": [ 11231 ] }, "id": 11232, "nodeType": "SourceUnit", "nodes": [ { "id": 11202, "literals": [ "solidity", "^", "0.4", ".24" ], "nodeType": "PragmaDirective", "src": "0:24:38" }, { "baseContracts": [], "contractDependencies": [], "contractKind": "library", "documentation": null, "fullyImplemented": true, "id": 11231, "linearizedBaseContracts": [ 11231 ], "name": "Uint256Helpers", "nodeType": "ContractDefinition", "nodes": [ { "constant": true, "id": 11208, "name": "MAX_UINT64", "nodeType": "VariableDeclaration", "scope": 11231, "src": "56:48:38", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 11203, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "56:7:38", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 11206, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "UnaryOperation", "operator": "-", "prefix": true, "src": "101:2:38", "subExpression": { "argumentTypes": null, "hexValue": "31", "id": 11205, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "102:1:38", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_1_by_1", "typeString": "int_const 1" }, "value": "1" }, "typeDescriptions": { "typeIdentifier": "t_rational_-1_by_1", "typeString": "int_const -1" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_rational_-1_by_1", "typeString": "int_const -1" } ], "id": 11204, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "94:6:38", "typeDescriptions": { "typeIdentifier": "t_type$_t_uint64_$", "typeString": "type(uint64)" }, "typeName": "uint64" }, "id": 11207, "isConstant": false, "isLValue": false, "isPure": true, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "94:10:38", "typeDescriptions": { "typeIdentifier": "t_uint64", "typeString": "uint64" } }, "visibility": "private" }, { "constant": true, "id": 11211, "name": "ERROR_NUMBER_TOO_BIG", "nodeType": "VariableDeclaration", "scope": 11231, "src": "111:70:38", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_string_memory", "typeString": "string" }, "typeName": { "id": 11209, "name": "string", "nodeType": "ElementaryTypeName", "src": "111:6:38", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": { "argumentTypes": null, "hexValue": "55494e5436345f4e554d4245525f544f4f5f424947", "id": 11210, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "158:23:38", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_0097450fa85b09f7141faf60e71f2a076ecfed0c9fa787056beef57ff0d975db", "typeString": "literal_string \"UINT64_NUMBER_TOO_BIG\"" }, "value": "UINT64_NUMBER_TOO_BIG" }, "visibility": "private" }, { "body": { "id": 11229, "nodeType": "Block", "src": "248:89:38", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 11221, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 11219, "name": "a", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 11213, "src": "266:1:38", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "<=", "rightExpression": { "argumentTypes": null, "id": 11220, "name": "MAX_UINT64", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 11208, "src": "271:10:38", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "266:15:38", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, { "argumentTypes": null, "id": 11222, "name": "ERROR_NUMBER_TOO_BIG", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 11211, "src": "283:20:38", "typeDescriptions": { "typeIdentifier": "t_string_memory", "typeString": "string memory" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" }, { "typeIdentifier": "t_string_memory", "typeString": "string memory" } ], "id": 11218, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ 15156, 15157 ], "referencedDeclaration": 15157, "src": "258:7:38", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", "typeString": "function (bool,string memory) pure" } }, "id": 11223, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "258:46:38", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 11224, "nodeType": "ExpressionStatement", "src": "258:46:38" }, { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 11226, "name": "a", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 11213, "src": "328:1:38", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "id": 11225, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "321:6:38", "typeDescriptions": { "typeIdentifier": "t_type$_t_uint64_$", "typeString": "type(uint64)" }, "typeName": "uint64" }, "id": 11227, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "321:9:38", "typeDescriptions": { "typeIdentifier": "t_uint64", "typeString": "uint64" } }, "functionReturnParameters": 11217, "id": 11228, "nodeType": "Return", "src": "314:16:38" } ] }, "documentation": null, "id": 11230, "implemented": true, "isConstructor": false, "isDeclaredConst": true, "modifiers": [], "name": "toUint64", "nodeType": "FunctionDefinition", "parameters": { "id": 11214, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 11213, "name": "a", "nodeType": "VariableDeclaration", "scope": 11230, "src": "206:9:38", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 11212, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "206:7:38", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "205:11:38" }, "payable": false, "returnParameters": { "id": 11217, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 11216, "name": "", "nodeType": "VariableDeclaration", "scope": 11230, "src": "240:6:38", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint64", "typeString": "uint64" }, "typeName": { "id": 11215, "name": "uint64", "nodeType": "ElementaryTypeName", "src": "240:6:38", "typeDescriptions": { "typeIdentifier": "t_uint64", "typeString": "uint64" } }, "value": null, "visibility": "internal" } ], "src": "239:8:38" }, "scope": 11231, "src": "188:149:38", "stateMutability": "pure", "superFunction": null, "visibility": "internal" } ], "scope": 11232, "src": "27:312:38" } ], "src": "0:340:38" }, "compiler": { "name": "solc", "version": "0.4.24+commit.e67f0147.Emscripten.clang" }, "networks": {}, "schemaVersion": "2.0.1", "updatedAt": "2019-09-04T11:02:55.762Z" }