becrypto/build/contracts/SignedMath.json

1352 lines
56 KiB
JSON

{
"contractName": "SignedMath",
"abi": [],
"metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"details\":\"Standard signed math utilities missing in the Solidity language.\",\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/utils/math/SignedMath.sol\":\"SignedMath\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/utils/math/SignedMath.sol\":{\"keccak256\":\"0xf92515413956f529d95977adc9b0567d583c6203fc31ab1c23824c35187e3ddc\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c50fcc459e49a9858b6d8ad5f911295cb7c9ab57567845a250bf0153f84a95c7\",\"dweb:/ipfs/QmcEW85JRzvDkQggxiBBLVAasXWdkhEysqypj9EaB6H2g6\"]}},\"version\":1}",
"bytecode": "0x60566050600b82828239805160001a6073146043577f4e487b7100000000000000000000000000000000000000000000000000000000600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220ecc55b2e1208d2c71df0f53ec7abb56ed1f8f1f97da9d4c4938f6523450c090764736f6c634300080a0033",
"deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220ecc55b2e1208d2c71df0f53ec7abb56ed1f8f1f97da9d4c4938f6523450c090764736f6c634300080a0033",
"immutableReferences": {},
"generatedSources": [],
"deployedGeneratedSources": [],
"sourceMap": "215:1047:37:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;",
"deployedSourceMap": "215:1047:37:-:0;;;;;;;;",
"source": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMath {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n",
"sourcePath": "@openzeppelin\\contracts\\utils\\math\\SignedMath.sol",
"ast": {
"absolutePath": "@openzeppelin/contracts/utils/math/SignedMath.sol",
"exportedSymbols": {
"SignedMath": [
8146
]
},
"id": 8147,
"license": "MIT",
"nodeType": "SourceUnit",
"nodes": [
{
"id": 8043,
"literals": [
"solidity",
"^",
"0.8",
".0"
],
"nodeType": "PragmaDirective",
"src": "109:23:37"
},
{
"abstract": false,
"baseContracts": [],
"canonicalName": "SignedMath",
"contractDependencies": [],
"contractKind": "library",
"documentation": {
"id": 8044,
"nodeType": "StructuredDocumentation",
"src": "134:80:37",
"text": " @dev Standard signed math utilities missing in the Solidity language."
},
"fullyImplemented": true,
"id": 8146,
"linearizedBaseContracts": [
8146
],
"name": "SignedMath",
"nameLocation": "223:10:37",
"nodeType": "ContractDefinition",
"nodes": [
{
"body": {
"id": 8061,
"nodeType": "Block",
"src": "375:37:37",
"statements": [
{
"expression": {
"condition": {
"commonType": {
"typeIdentifier": "t_int256",
"typeString": "int256"
},
"id": 8056,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"id": 8054,
"name": "a",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 8047,
"src": "392:1:37",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
}
},
"nodeType": "BinaryOperation",
"operator": ">",
"rightExpression": {
"id": 8055,
"name": "b",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 8049,
"src": "396:1:37",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
}
},
"src": "392:5:37",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseExpression": {
"id": 8058,
"name": "b",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 8049,
"src": "404:1:37",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
}
},
"id": 8059,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"nodeType": "Conditional",
"src": "392:13:37",
"trueExpression": {
"id": 8057,
"name": "a",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 8047,
"src": "400:1:37",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
}
},
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
}
},
"functionReturnParameters": 8053,
"id": 8060,
"nodeType": "Return",
"src": "385:20:37"
}
]
},
"documentation": {
"id": 8045,
"nodeType": "StructuredDocumentation",
"src": "240:66:37",
"text": " @dev Returns the largest of two signed numbers."
},
"id": 8062,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "max",
"nameLocation": "320:3:37",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 8050,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 8047,
"mutability": "mutable",
"name": "a",
"nameLocation": "331:1:37",
"nodeType": "VariableDeclaration",
"scope": 8062,
"src": "324:8:37",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
},
"typeName": {
"id": 8046,
"name": "int256",
"nodeType": "ElementaryTypeName",
"src": "324:6:37",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 8049,
"mutability": "mutable",
"name": "b",
"nameLocation": "341:1:37",
"nodeType": "VariableDeclaration",
"scope": 8062,
"src": "334:8:37",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
},
"typeName": {
"id": 8048,
"name": "int256",
"nodeType": "ElementaryTypeName",
"src": "334:6:37",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
}
},
"visibility": "internal"
}
],
"src": "323:20:37"
},
"returnParameters": {
"id": 8053,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 8052,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"scope": 8062,
"src": "367:6:37",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
},
"typeName": {
"id": 8051,
"name": "int256",
"nodeType": "ElementaryTypeName",
"src": "367:6:37",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
}
},
"visibility": "internal"
}
],
"src": "366:8:37"
},
"scope": 8146,
"src": "311:101:37",
"stateMutability": "pure",
"virtual": false,
"visibility": "internal"
},
{
"body": {
"id": 8079,
"nodeType": "Block",
"src": "554:37:37",
"statements": [
{
"expression": {
"condition": {
"commonType": {
"typeIdentifier": "t_int256",
"typeString": "int256"
},
"id": 8074,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"id": 8072,
"name": "a",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 8065,
"src": "571:1:37",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
}
},
"nodeType": "BinaryOperation",
"operator": "<",
"rightExpression": {
"id": 8073,
"name": "b",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 8067,
"src": "575:1:37",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
}
},
"src": "571:5:37",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseExpression": {
"id": 8076,
"name": "b",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 8067,
"src": "583:1:37",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
}
},
"id": 8077,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"nodeType": "Conditional",
"src": "571:13:37",
"trueExpression": {
"id": 8075,
"name": "a",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 8065,
"src": "579:1:37",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
}
},
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
}
},
"functionReturnParameters": 8071,
"id": 8078,
"nodeType": "Return",
"src": "564:20:37"
}
]
},
"documentation": {
"id": 8063,
"nodeType": "StructuredDocumentation",
"src": "418:67:37",
"text": " @dev Returns the smallest of two signed numbers."
},
"id": 8080,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "min",
"nameLocation": "499:3:37",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 8068,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 8065,
"mutability": "mutable",
"name": "a",
"nameLocation": "510:1:37",
"nodeType": "VariableDeclaration",
"scope": 8080,
"src": "503:8:37",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
},
"typeName": {
"id": 8064,
"name": "int256",
"nodeType": "ElementaryTypeName",
"src": "503:6:37",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 8067,
"mutability": "mutable",
"name": "b",
"nameLocation": "520:1:37",
"nodeType": "VariableDeclaration",
"scope": 8080,
"src": "513:8:37",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
},
"typeName": {
"id": 8066,
"name": "int256",
"nodeType": "ElementaryTypeName",
"src": "513:6:37",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
}
},
"visibility": "internal"
}
],
"src": "502:20:37"
},
"returnParameters": {
"id": 8071,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 8070,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"scope": 8080,
"src": "546:6:37",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
},
"typeName": {
"id": 8069,
"name": "int256",
"nodeType": "ElementaryTypeName",
"src": "546:6:37",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
}
},
"visibility": "internal"
}
],
"src": "545:8:37"
},
"scope": 8146,
"src": "490:101:37",
"stateMutability": "pure",
"virtual": false,
"visibility": "internal"
},
{
"body": {
"id": 8123,
"nodeType": "Block",
"src": "796:162:37",
"statements": [
{
"assignments": [
8091
],
"declarations": [
{
"constant": false,
"id": 8091,
"mutability": "mutable",
"name": "x",
"nameLocation": "865:1:37",
"nodeType": "VariableDeclaration",
"scope": 8123,
"src": "858:8:37",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
},
"typeName": {
"id": 8090,
"name": "int256",
"nodeType": "ElementaryTypeName",
"src": "858:6:37",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
}
},
"visibility": "internal"
}
],
"id": 8104,
"initialValue": {
"commonType": {
"typeIdentifier": "t_int256",
"typeString": "int256"
},
"id": 8103,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"components": [
{
"commonType": {
"typeIdentifier": "t_int256",
"typeString": "int256"
},
"id": 8094,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"id": 8092,
"name": "a",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 8083,
"src": "870:1:37",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
}
},
"nodeType": "BinaryOperation",
"operator": "&",
"rightExpression": {
"id": 8093,
"name": "b",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 8085,
"src": "874:1:37",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
}
},
"src": "870:5:37",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
}
}
],
"id": 8095,
"isConstant": false,
"isInlineArray": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"nodeType": "TupleExpression",
"src": "869:7:37",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
}
},
"nodeType": "BinaryOperation",
"operator": "+",
"rightExpression": {
"components": [
{
"commonType": {
"typeIdentifier": "t_int256",
"typeString": "int256"
},
"id": 8101,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"components": [
{
"commonType": {
"typeIdentifier": "t_int256",
"typeString": "int256"
},
"id": 8098,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"id": 8096,
"name": "a",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 8083,
"src": "881:1:37",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
}
},
"nodeType": "BinaryOperation",
"operator": "^",
"rightExpression": {
"id": 8097,
"name": "b",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 8085,
"src": "885:1:37",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
}
},
"src": "881:5:37",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
}
}
],
"id": 8099,
"isConstant": false,
"isInlineArray": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"nodeType": "TupleExpression",
"src": "880:7:37",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
}
},
"nodeType": "BinaryOperation",
"operator": ">>",
"rightExpression": {
"hexValue": "31",
"id": 8100,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "891:1:37",
"typeDescriptions": {
"typeIdentifier": "t_rational_1_by_1",
"typeString": "int_const 1"
},
"value": "1"
},
"src": "880:12:37",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
}
}
],
"id": 8102,
"isConstant": false,
"isInlineArray": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"nodeType": "TupleExpression",
"src": "879:14:37",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
}
},
"src": "869:24:37",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "858:35:37"
},
{
"expression": {
"commonType": {
"typeIdentifier": "t_int256",
"typeString": "int256"
},
"id": 8121,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"id": 8105,
"name": "x",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 8091,
"src": "910:1:37",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
}
},
"nodeType": "BinaryOperation",
"operator": "+",
"rightExpression": {
"components": [
{
"commonType": {
"typeIdentifier": "t_int256",
"typeString": "int256"
},
"id": 8119,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"arguments": [
{
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 8113,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"arguments": [
{
"id": 8110,
"name": "x",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 8091,
"src": "930:1:37",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_int256",
"typeString": "int256"
}
],
"id": 8109,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "922:7:37",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_uint256_$",
"typeString": "type(uint256)"
},
"typeName": {
"id": 8108,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "922:7:37",
"typeDescriptions": {}
}
},
"id": 8111,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "922:10:37",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": ">>",
"rightExpression": {
"hexValue": "323535",
"id": 8112,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "936:3:37",
"typeDescriptions": {
"typeIdentifier": "t_rational_255_by_1",
"typeString": "int_const 255"
},
"value": "255"
},
"src": "922:17:37",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"id": 8107,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "915:6:37",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_int256_$",
"typeString": "type(int256)"
},
"typeName": {
"id": 8106,
"name": "int256",
"nodeType": "ElementaryTypeName",
"src": "915:6:37",
"typeDescriptions": {}
}
},
"id": 8114,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "915:25:37",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
}
},
"nodeType": "BinaryOperation",
"operator": "&",
"rightExpression": {
"components": [
{
"commonType": {
"typeIdentifier": "t_int256",
"typeString": "int256"
},
"id": 8117,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"id": 8115,
"name": "a",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 8083,
"src": "944:1:37",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
}
},
"nodeType": "BinaryOperation",
"operator": "^",
"rightExpression": {
"id": 8116,
"name": "b",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 8085,
"src": "948:1:37",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
}
},
"src": "944:5:37",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
}
}
],
"id": 8118,
"isConstant": false,
"isInlineArray": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"nodeType": "TupleExpression",
"src": "943:7:37",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
}
},
"src": "915:35:37",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
}
}
],
"id": 8120,
"isConstant": false,
"isInlineArray": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"nodeType": "TupleExpression",
"src": "914:37:37",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
}
},
"src": "910:41:37",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
}
},
"functionReturnParameters": 8089,
"id": 8122,
"nodeType": "Return",
"src": "903:48:37"
}
]
},
"documentation": {
"id": 8081,
"nodeType": "StructuredDocumentation",
"src": "597:126:37",
"text": " @dev Returns the average of two signed numbers without overflow.\n The result is rounded towards zero."
},
"id": 8124,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "average",
"nameLocation": "737:7:37",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 8086,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 8083,
"mutability": "mutable",
"name": "a",
"nameLocation": "752:1:37",
"nodeType": "VariableDeclaration",
"scope": 8124,
"src": "745:8:37",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
},
"typeName": {
"id": 8082,
"name": "int256",
"nodeType": "ElementaryTypeName",
"src": "745:6:37",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 8085,
"mutability": "mutable",
"name": "b",
"nameLocation": "762:1:37",
"nodeType": "VariableDeclaration",
"scope": 8124,
"src": "755:8:37",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
},
"typeName": {
"id": 8084,
"name": "int256",
"nodeType": "ElementaryTypeName",
"src": "755:6:37",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
}
},
"visibility": "internal"
}
],
"src": "744:20:37"
},
"returnParameters": {
"id": 8089,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 8088,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"scope": 8124,
"src": "788:6:37",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
},
"typeName": {
"id": 8087,
"name": "int256",
"nodeType": "ElementaryTypeName",
"src": "788:6:37",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
}
},
"visibility": "internal"
}
],
"src": "787:8:37"
},
"scope": 8146,
"src": "728:230:37",
"stateMutability": "pure",
"virtual": false,
"visibility": "internal"
},
{
"body": {
"id": 8144,
"nodeType": "Block",
"src": "1102:158:37",
"statements": [
{
"id": 8143,
"nodeType": "UncheckedBlock",
"src": "1112:142:37",
"statements": [
{
"expression": {
"arguments": [
{
"condition": {
"commonType": {
"typeIdentifier": "t_int256",
"typeString": "int256"
},
"id": 8136,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"id": 8134,
"name": "n",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 8127,
"src": "1227:1:37",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
}
},
"nodeType": "BinaryOperation",
"operator": ">=",
"rightExpression": {
"hexValue": "30",
"id": 8135,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1232:1:37",
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"src": "1227:6:37",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseExpression": {
"id": 8139,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"nodeType": "UnaryOperation",
"operator": "-",
"prefix": true,
"src": "1240:2:37",
"subExpression": {
"id": 8138,
"name": "n",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 8127,
"src": "1241:1:37",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
}
},
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
}
},
"id": 8140,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"nodeType": "Conditional",
"src": "1227:15:37",
"trueExpression": {
"id": 8137,
"name": "n",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 8127,
"src": "1236:1:37",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
}
},
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_int256",
"typeString": "int256"
}
],
"id": 8133,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "1219:7:37",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_uint256_$",
"typeString": "type(uint256)"
},
"typeName": {
"id": 8132,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1219:7:37",
"typeDescriptions": {}
}
},
"id": 8141,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1219:24:37",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"functionReturnParameters": 8131,
"id": 8142,
"nodeType": "Return",
"src": "1212:31:37"
}
]
}
]
},
"documentation": {
"id": 8125,
"nodeType": "StructuredDocumentation",
"src": "964:78:37",
"text": " @dev Returns the absolute unsigned value of a signed value."
},
"id": 8145,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "abs",
"nameLocation": "1056:3:37",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 8128,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 8127,
"mutability": "mutable",
"name": "n",
"nameLocation": "1067:1:37",
"nodeType": "VariableDeclaration",
"scope": 8145,
"src": "1060:8:37",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
},
"typeName": {
"id": 8126,
"name": "int256",
"nodeType": "ElementaryTypeName",
"src": "1060:6:37",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
}
},
"visibility": "internal"
}
],
"src": "1059:10:37"
},
"returnParameters": {
"id": 8131,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 8130,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"scope": 8145,
"src": "1093:7:37",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 8129,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1093:7:37",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "1092:9:37"
},
"scope": 8146,
"src": "1047:213:37",
"stateMutability": "pure",
"virtual": false,
"visibility": "internal"
}
],
"scope": 8147,
"src": "215:1047:37",
"usedErrors": []
}
],
"src": "109:1154:37"
},
"compiler": {
"name": "solc",
"version": "0.8.10+commit.fc410830.Emscripten.clang"
},
"networks": {},
"schemaVersion": "3.4.14",
"updatedAt": "2023-07-12T06:52:15.366Z",
"devdoc": {
"details": "Standard signed math utilities missing in the Solidity language.",
"kind": "dev",
"methods": {},
"version": 1
},
"userdoc": {
"kind": "user",
"methods": {},
"version": 1
}
}