{ "contractName": "Utils", "abi": [], "metadata": "{\"compiler\":{\"version\":\"0.6.12+commit.27d51765\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"details\":\"Utilities & Common Modifiers\",\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"/home/lash/src/ext/cic/grassrootseconomics/bancor-contracts/solidity/contracts/utility/Utils.sol\":\"Utils\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"/home/lash/src/ext/cic/grassrootseconomics/bancor-contracts/solidity/contracts/utility/Utils.sol\":{\"keccak256\":\"0x073efa69fcd6b5e60f841b28b366d63b62ff48ab12a06ce3f5a7f41afd6ce885\",\"license\":\"SEE LICENSE IN LICENSE\",\"urls\":[\"bzz-raw://e8b8ecb2d29197ca77f0ed98f728ace54e6edcfdf5cd1194ae22701607eaf608\",\"dweb:/ipfs/QmcsR6Q35Hurh3TrPkYAboicz9bQQoGCWmZLzUCDyhotH8\"]}},\"version\":1}", "bytecode": "0x6080604052348015600f57600080fd5b50603f80601d6000396000f3fe6080604052600080fdfea264697066735822122072beacb2f236921456c94ed3f088875bd1c58ecb350ecaefd7afc6aed233995164736f6c634300060c0033", "deployedBytecode": "0x6080604052600080fdfea264697066735822122072beacb2f236921456c94ed3f088875bd1c58ecb350ecaefd7afc6aed233995164736f6c634300060c0033", "immutableReferences": {}, "sourceMap": "127:1043:64:-:0;;;;;;;;;;;;;;;;;;;", "deployedSourceMap": "127:1043:64:-:0;;;;;", "source": "// SPDX-License-Identifier: SEE LICENSE IN LICENSE\r\npragma solidity 0.6.12;\r\n\r\n/**\r\n * @dev Utilities & Common Modifiers\r\n*/\r\ncontract Utils {\r\n // verifies that a value is greater than zero\r\n modifier greaterThanZero(uint256 _value) {\r\n _greaterThanZero(_value);\r\n _;\r\n }\r\n\r\n // error message binary size optimization\r\n function _greaterThanZero(uint256 _value) internal pure {\r\n require(_value > 0, \"ERR_ZERO_VALUE\");\r\n }\r\n\r\n // validates an address - currently only checks that it isn't null\r\n modifier validAddress(address _address) {\r\n _validAddress(_address);\r\n _;\r\n }\r\n\r\n // error message binary size optimization\r\n function _validAddress(address _address) internal pure {\r\n require(_address != address(0), \"ERR_INVALID_ADDRESS\");\r\n }\r\n\r\n // verifies that the address is different than this contract address\r\n modifier notThis(address _address) {\r\n _notThis(_address);\r\n _;\r\n }\r\n\r\n // error message binary size optimization\r\n function _notThis(address _address) internal view {\r\n require(_address != address(this), \"ERR_ADDRESS_IS_SELF\");\r\n }\r\n}\r\n", "sourcePath": "/home/lash/src/ext/cic/grassrootseconomics/bancor-contracts/solidity/contracts/utility/Utils.sol", "ast": { "absolutePath": "/home/lash/src/ext/cic/grassrootseconomics/bancor-contracts/solidity/contracts/utility/Utils.sol", "exportedSymbols": { "Utils": [ 22661 ] }, "id": 22662, "license": "SEE LICENSE IN LICENSE", "nodeType": "SourceUnit", "nodes": [ { "id": 22584, "literals": [ "solidity", "0.6", ".12" ], "nodeType": "PragmaDirective", "src": "52:23:64" }, { "abstract": false, "baseContracts": [], "contractDependencies": [], "contractKind": "contract", "documentation": { "id": 22585, "nodeType": "StructuredDocumentation", "src": "79:46:64", "text": " @dev Utilities & Common Modifiers" }, "fullyImplemented": true, "id": 22661, "linearizedBaseContracts": [ 22661 ], "name": "Utils", "nodeType": "ContractDefinition", "nodes": [ { "body": { "id": 22594, "nodeType": "Block", "src": "241:55:64", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 22590, "name": "_value", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22587, "src": "269:6:64", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "id": 22589, "name": "_greaterThanZero", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22608, "src": "252:16:64", "typeDescriptions": { "typeIdentifier": "t_function_internal_pure$_t_uint256_$returns$__$", "typeString": "function (uint256) pure" } }, "id": 22591, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "252:24:64", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 22592, "nodeType": "ExpressionStatement", "src": "252:24:64" }, { "id": 22593, "nodeType": "PlaceholderStatement", "src": "287:1:64" } ] }, "documentation": null, "id": 22595, "name": "greaterThanZero", "nodeType": "ModifierDefinition", "overrides": null, "parameters": { "id": 22588, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 22587, "mutability": "mutable", "name": "_value", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22595, "src": "225:14:64", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 22586, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "225:7:64", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "224:16:64" }, "src": "200:96:64", "virtual": false, "visibility": "internal" }, { "body": { "id": 22607, "nodeType": "Block", "src": "407:56:64", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 22603, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 22601, "name": "_value", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22597, "src": "426:6:64", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": ">", "rightExpression": { "argumentTypes": null, "hexValue": "30", "id": 22602, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "435:1:64", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" }, "src": "426:10:64", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, { "argumentTypes": null, "hexValue": "4552525f5a45524f5f56414c5545", "id": 22604, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "438:16:64", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_6d867a5fb86a4ba31dbc28b32cea703c5633c272ff1c7db7eff591a6c9397723", "typeString": "literal_string \"ERR_ZERO_VALUE\"" }, "value": "ERR_ZERO_VALUE" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" }, { "typeIdentifier": "t_stringliteral_6d867a5fb86a4ba31dbc28b32cea703c5633c272ff1c7db7eff591a6c9397723", "typeString": "literal_string \"ERR_ZERO_VALUE\"" } ], "id": 22600, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ -18, -18 ], "referencedDeclaration": -18, "src": "418:7:64", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", "typeString": "function (bool,string memory) pure" } }, "id": 22605, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "418:37:64", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 22606, "nodeType": "ExpressionStatement", "src": "418:37:64" } ] }, "documentation": null, "id": 22608, "implemented": true, "kind": "function", "modifiers": [], "name": "_greaterThanZero", "nodeType": "FunctionDefinition", "overrides": null, "parameters": { "id": 22598, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 22597, "mutability": "mutable", "name": "_value", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22608, "src": "377:14:64", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 22596, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "377:7:64", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "376:16:64" }, "returnParameters": { "id": 22599, "nodeType": "ParameterList", "parameters": [], "src": "407:0:64" }, "scope": 22661, "src": "351:112:64", "stateMutability": "pure", "virtual": false, "visibility": "internal" }, { "body": { "id": 22617, "nodeType": "Block", "src": "583:54:64", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 22613, "name": "_address", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22610, "src": "608:8:64", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" } ], "id": 22612, "name": "_validAddress", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22634, "src": "594:13:64", "typeDescriptions": { "typeIdentifier": "t_function_internal_pure$_t_address_$returns$__$", "typeString": "function (address) pure" } }, "id": 22614, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "594:23:64", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 22615, "nodeType": "ExpressionStatement", "src": "594:23:64" }, { "id": 22616, "nodeType": "PlaceholderStatement", "src": "628:1:64" } ] }, "documentation": null, "id": 22618, "name": "validAddress", "nodeType": "ModifierDefinition", "overrides": null, "parameters": { "id": 22611, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 22610, "mutability": "mutable", "name": "_address", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22618, "src": "565:16:64", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 22609, "name": "address", "nodeType": "ElementaryTypeName", "src": "565:7:64", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "564:18:64" }, "src": "543:94:64", "virtual": false, "visibility": "internal" }, { "body": { "id": 22633, "nodeType": "Block", "src": "747:73:64", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_address", "typeString": "address" }, "id": 22629, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 22624, "name": "_address", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22620, "src": "766:8:64", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "BinaryOperation", "operator": "!=", "rightExpression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "hexValue": "30", "id": 22627, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "786:1:64", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" } ], "id": 22626, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "778:7:64", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": { "id": 22625, "name": "address", "nodeType": "ElementaryTypeName", "src": "778:7:64", "typeDescriptions": { "typeIdentifier": null, "typeString": null } } }, "id": 22628, "isConstant": false, "isLValue": false, "isPure": true, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "778:10:64", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "src": "766:22:64", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, { "argumentTypes": null, "hexValue": "4552525f494e56414c49445f41444452455353", "id": 22630, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "790:21:64", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_a7d3f5b8fcfdb9260fb71cc6af515e9b07a68a1202d1cb2f5a3f8f30449ddc07", "typeString": "literal_string \"ERR_INVALID_ADDRESS\"" }, "value": "ERR_INVALID_ADDRESS" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" }, { "typeIdentifier": "t_stringliteral_a7d3f5b8fcfdb9260fb71cc6af515e9b07a68a1202d1cb2f5a3f8f30449ddc07", "typeString": "literal_string \"ERR_INVALID_ADDRESS\"" } ], "id": 22623, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ -18, -18 ], "referencedDeclaration": -18, "src": "758:7:64", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", "typeString": "function (bool,string memory) pure" } }, "id": 22631, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "758:54:64", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 22632, "nodeType": "ExpressionStatement", "src": "758:54:64" } ] }, "documentation": null, "id": 22634, "implemented": true, "kind": "function", "modifiers": [], "name": "_validAddress", "nodeType": "FunctionDefinition", "overrides": null, "parameters": { "id": 22621, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 22620, "mutability": "mutable", "name": "_address", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22634, "src": "715:16:64", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 22619, "name": "address", "nodeType": "ElementaryTypeName", "src": "715:7:64", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "714:18:64" }, "returnParameters": { "id": 22622, "nodeType": "ParameterList", "parameters": [], "src": "747:0:64" }, "scope": 22661, "src": "692:128:64", "stateMutability": "pure", "virtual": false, "visibility": "internal" }, { "body": { "id": 22643, "nodeType": "Block", "src": "937:49:64", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 22639, "name": "_address", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22636, "src": "957:8:64", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" } ], "id": 22638, "name": "_notThis", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22660, "src": "948:8:64", "typeDescriptions": { "typeIdentifier": "t_function_internal_view$_t_address_$returns$__$", "typeString": "function (address) view" } }, "id": 22640, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "948:18:64", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 22641, "nodeType": "ExpressionStatement", "src": "948:18:64" }, { "id": 22642, "nodeType": "PlaceholderStatement", "src": "977:1:64" } ] }, "documentation": null, "id": 22644, "name": "notThis", "nodeType": "ModifierDefinition", "overrides": null, "parameters": { "id": 22637, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 22636, "mutability": "mutable", "name": "_address", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22644, "src": "919:16:64", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 22635, "name": "address", "nodeType": "ElementaryTypeName", "src": "919:7:64", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "918:18:64" }, "src": "902:84:64", "virtual": false, "visibility": "internal" }, { "body": { "id": 22659, "nodeType": "Block", "src": "1091:76:64", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_address", "typeString": "address" }, "id": 22655, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 22650, "name": "_address", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22646, "src": "1110:8:64", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "BinaryOperation", "operator": "!=", "rightExpression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 22653, "name": "this", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": -28, "src": "1130:4:64", "typeDescriptions": { "typeIdentifier": "t_contract$_Utils_$22661", "typeString": "contract Utils" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_contract$_Utils_$22661", "typeString": "contract Utils" } ], "id": 22652, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "1122:7:64", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": { "id": 22651, "name": "address", "nodeType": "ElementaryTypeName", "src": "1122:7:64", "typeDescriptions": { "typeIdentifier": null, "typeString": null } } }, "id": 22654, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1122:13:64", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "src": "1110:25:64", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, { "argumentTypes": null, "hexValue": "4552525f414444524553535f49535f53454c46", "id": 22656, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "1137:21:64", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_d6038575e9704a3ea491558fda267e4bebfff2c5aa46f54a3ab71ebfebd80861", "typeString": "literal_string \"ERR_ADDRESS_IS_SELF\"" }, "value": "ERR_ADDRESS_IS_SELF" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" }, { "typeIdentifier": "t_stringliteral_d6038575e9704a3ea491558fda267e4bebfff2c5aa46f54a3ab71ebfebd80861", "typeString": "literal_string \"ERR_ADDRESS_IS_SELF\"" } ], "id": 22649, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ -18, -18 ], "referencedDeclaration": -18, "src": "1102:7:64", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", "typeString": "function (bool,string memory) pure" } }, "id": 22657, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1102:57:64", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 22658, "nodeType": "ExpressionStatement", "src": "1102:57:64" } ] }, "documentation": null, "id": 22660, "implemented": true, "kind": "function", "modifiers": [], "name": "_notThis", "nodeType": "FunctionDefinition", "overrides": null, "parameters": { "id": 22647, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 22646, "mutability": "mutable", "name": "_address", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22660, "src": "1059:16:64", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 22645, "name": "address", "nodeType": "ElementaryTypeName", "src": "1059:7:64", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "1058:18:64" }, "returnParameters": { "id": 22648, "nodeType": "ParameterList", "parameters": [], "src": "1091:0:64" }, "scope": 22661, "src": "1041:126:64", "stateMutability": "view", "virtual": false, "visibility": "internal" } ], "scope": 22662, "src": "127:1043:64" } ], "src": "52:1120:64" }, "legacyAST": { "absolutePath": "/home/lash/src/ext/cic/grassrootseconomics/bancor-contracts/solidity/contracts/utility/Utils.sol", "exportedSymbols": { "Utils": [ 22661 ] }, "id": 22662, "license": "SEE LICENSE IN LICENSE", "nodeType": "SourceUnit", "nodes": [ { "id": 22584, "literals": [ "solidity", "0.6", ".12" ], "nodeType": "PragmaDirective", "src": "52:23:64" }, { "abstract": false, "baseContracts": [], "contractDependencies": [], "contractKind": "contract", "documentation": { "id": 22585, "nodeType": "StructuredDocumentation", "src": "79:46:64", "text": " @dev Utilities & Common Modifiers" }, "fullyImplemented": true, "id": 22661, "linearizedBaseContracts": [ 22661 ], "name": "Utils", "nodeType": "ContractDefinition", "nodes": [ { "body": { "id": 22594, "nodeType": "Block", "src": "241:55:64", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 22590, "name": "_value", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22587, "src": "269:6:64", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "id": 22589, "name": "_greaterThanZero", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22608, "src": "252:16:64", "typeDescriptions": { "typeIdentifier": "t_function_internal_pure$_t_uint256_$returns$__$", "typeString": "function (uint256) pure" } }, "id": 22591, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "252:24:64", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 22592, "nodeType": "ExpressionStatement", "src": "252:24:64" }, { "id": 22593, "nodeType": "PlaceholderStatement", "src": "287:1:64" } ] }, "documentation": null, "id": 22595, "name": "greaterThanZero", "nodeType": "ModifierDefinition", "overrides": null, "parameters": { "id": 22588, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 22587, "mutability": "mutable", "name": "_value", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22595, "src": "225:14:64", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 22586, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "225:7:64", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "224:16:64" }, "src": "200:96:64", "virtual": false, "visibility": "internal" }, { "body": { "id": 22607, "nodeType": "Block", "src": "407:56:64", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 22603, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 22601, "name": "_value", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22597, "src": "426:6:64", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": ">", "rightExpression": { "argumentTypes": null, "hexValue": "30", "id": 22602, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "435:1:64", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" }, "src": "426:10:64", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, { "argumentTypes": null, "hexValue": "4552525f5a45524f5f56414c5545", "id": 22604, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "438:16:64", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_6d867a5fb86a4ba31dbc28b32cea703c5633c272ff1c7db7eff591a6c9397723", "typeString": "literal_string \"ERR_ZERO_VALUE\"" }, "value": "ERR_ZERO_VALUE" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" }, { "typeIdentifier": "t_stringliteral_6d867a5fb86a4ba31dbc28b32cea703c5633c272ff1c7db7eff591a6c9397723", "typeString": "literal_string \"ERR_ZERO_VALUE\"" } ], "id": 22600, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ -18, -18 ], "referencedDeclaration": -18, "src": "418:7:64", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", "typeString": "function (bool,string memory) pure" } }, "id": 22605, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "418:37:64", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 22606, "nodeType": "ExpressionStatement", "src": "418:37:64" } ] }, "documentation": null, "id": 22608, "implemented": true, "kind": "function", "modifiers": [], "name": "_greaterThanZero", "nodeType": "FunctionDefinition", "overrides": null, "parameters": { "id": 22598, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 22597, "mutability": "mutable", "name": "_value", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22608, "src": "377:14:64", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 22596, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "377:7:64", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "376:16:64" }, "returnParameters": { "id": 22599, "nodeType": "ParameterList", "parameters": [], "src": "407:0:64" }, "scope": 22661, "src": "351:112:64", "stateMutability": "pure", "virtual": false, "visibility": "internal" }, { "body": { "id": 22617, "nodeType": "Block", "src": "583:54:64", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 22613, "name": "_address", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22610, "src": "608:8:64", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" } ], "id": 22612, "name": "_validAddress", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22634, "src": "594:13:64", "typeDescriptions": { "typeIdentifier": "t_function_internal_pure$_t_address_$returns$__$", "typeString": "function (address) pure" } }, "id": 22614, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "594:23:64", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 22615, "nodeType": "ExpressionStatement", "src": "594:23:64" }, { "id": 22616, "nodeType": "PlaceholderStatement", "src": "628:1:64" } ] }, "documentation": null, "id": 22618, "name": "validAddress", "nodeType": "ModifierDefinition", "overrides": null, "parameters": { "id": 22611, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 22610, "mutability": "mutable", "name": "_address", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22618, "src": "565:16:64", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 22609, "name": "address", "nodeType": "ElementaryTypeName", "src": "565:7:64", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "564:18:64" }, "src": "543:94:64", "virtual": false, "visibility": "internal" }, { "body": { "id": 22633, "nodeType": "Block", "src": "747:73:64", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_address", "typeString": "address" }, "id": 22629, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 22624, "name": "_address", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22620, "src": "766:8:64", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "BinaryOperation", "operator": "!=", "rightExpression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "hexValue": "30", "id": 22627, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "786:1:64", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" } ], "id": 22626, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "778:7:64", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": { "id": 22625, "name": "address", "nodeType": "ElementaryTypeName", "src": "778:7:64", "typeDescriptions": { "typeIdentifier": null, "typeString": null } } }, "id": 22628, "isConstant": false, "isLValue": false, "isPure": true, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "778:10:64", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "src": "766:22:64", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, { "argumentTypes": null, "hexValue": "4552525f494e56414c49445f41444452455353", "id": 22630, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "790:21:64", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_a7d3f5b8fcfdb9260fb71cc6af515e9b07a68a1202d1cb2f5a3f8f30449ddc07", "typeString": "literal_string \"ERR_INVALID_ADDRESS\"" }, "value": "ERR_INVALID_ADDRESS" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" }, { "typeIdentifier": "t_stringliteral_a7d3f5b8fcfdb9260fb71cc6af515e9b07a68a1202d1cb2f5a3f8f30449ddc07", "typeString": "literal_string \"ERR_INVALID_ADDRESS\"" } ], "id": 22623, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ -18, -18 ], "referencedDeclaration": -18, "src": "758:7:64", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", "typeString": "function (bool,string memory) pure" } }, "id": 22631, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "758:54:64", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 22632, "nodeType": "ExpressionStatement", "src": "758:54:64" } ] }, "documentation": null, "id": 22634, "implemented": true, "kind": "function", "modifiers": [], "name": "_validAddress", "nodeType": "FunctionDefinition", "overrides": null, "parameters": { "id": 22621, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 22620, "mutability": "mutable", "name": "_address", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22634, "src": "715:16:64", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 22619, "name": "address", "nodeType": "ElementaryTypeName", "src": "715:7:64", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "714:18:64" }, "returnParameters": { "id": 22622, "nodeType": "ParameterList", "parameters": [], "src": "747:0:64" }, "scope": 22661, "src": "692:128:64", "stateMutability": "pure", "virtual": false, "visibility": "internal" }, { "body": { "id": 22643, "nodeType": "Block", "src": "937:49:64", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 22639, "name": "_address", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22636, "src": "957:8:64", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" } ], "id": 22638, "name": "_notThis", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22660, "src": "948:8:64", "typeDescriptions": { "typeIdentifier": "t_function_internal_view$_t_address_$returns$__$", "typeString": "function (address) view" } }, "id": 22640, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "948:18:64", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 22641, "nodeType": "ExpressionStatement", "src": "948:18:64" }, { "id": 22642, "nodeType": "PlaceholderStatement", "src": "977:1:64" } ] }, "documentation": null, "id": 22644, "name": "notThis", "nodeType": "ModifierDefinition", "overrides": null, "parameters": { "id": 22637, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 22636, "mutability": "mutable", "name": "_address", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22644, "src": "919:16:64", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 22635, "name": "address", "nodeType": "ElementaryTypeName", "src": "919:7:64", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "918:18:64" }, "src": "902:84:64", "virtual": false, "visibility": "internal" }, { "body": { "id": 22659, "nodeType": "Block", "src": "1091:76:64", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_address", "typeString": "address" }, "id": 22655, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 22650, "name": "_address", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22646, "src": "1110:8:64", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "BinaryOperation", "operator": "!=", "rightExpression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 22653, "name": "this", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": -28, "src": "1130:4:64", "typeDescriptions": { "typeIdentifier": "t_contract$_Utils_$22661", "typeString": "contract Utils" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_contract$_Utils_$22661", "typeString": "contract Utils" } ], "id": 22652, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "1122:7:64", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": { "id": 22651, "name": "address", "nodeType": "ElementaryTypeName", "src": "1122:7:64", "typeDescriptions": { "typeIdentifier": null, "typeString": null } } }, "id": 22654, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1122:13:64", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "src": "1110:25:64", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, { "argumentTypes": null, "hexValue": "4552525f414444524553535f49535f53454c46", "id": 22656, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "1137:21:64", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_d6038575e9704a3ea491558fda267e4bebfff2c5aa46f54a3ab71ebfebd80861", "typeString": "literal_string \"ERR_ADDRESS_IS_SELF\"" }, "value": "ERR_ADDRESS_IS_SELF" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" }, { "typeIdentifier": "t_stringliteral_d6038575e9704a3ea491558fda267e4bebfff2c5aa46f54a3ab71ebfebd80861", "typeString": "literal_string \"ERR_ADDRESS_IS_SELF\"" } ], "id": 22649, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ -18, -18 ], "referencedDeclaration": -18, "src": "1102:7:64", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", "typeString": "function (bool,string memory) pure" } }, "id": 22657, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1102:57:64", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 22658, "nodeType": "ExpressionStatement", "src": "1102:57:64" } ] }, "documentation": null, "id": 22660, "implemented": true, "kind": "function", "modifiers": [], "name": "_notThis", "nodeType": "FunctionDefinition", "overrides": null, "parameters": { "id": 22647, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 22646, "mutability": "mutable", "name": "_address", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22660, "src": "1059:16:64", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 22645, "name": "address", "nodeType": "ElementaryTypeName", "src": "1059:7:64", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "1058:18:64" }, "returnParameters": { "id": 22648, "nodeType": "ParameterList", "parameters": [], "src": "1091:0:64" }, "scope": 22661, "src": "1041:126:64", "stateMutability": "view", "virtual": false, "visibility": "internal" } ], "scope": 22662, "src": "127:1043:64" } ], "src": "52:1120:64" }, "compiler": { "name": "solc", "version": "0.6.12+commit.27d51765.Emscripten.clang" }, "networks": {}, "schemaVersion": "3.2.3", "updatedAt": "2020-10-20T08:24:47.848Z", "devdoc": { "details": "Utilities & Common Modifiers", "kind": "dev", "methods": {}, "version": 1 }, "userdoc": { "kind": "user", "methods": {}, "version": 1 } }