moonwalkerswap-v2-periphery
Version:
Moonwalkerswap v2 periphery
1,084 lines (1,083 loc) • 875 kB
JSON
{
"contractName": "FixedPoint",
"abi": [
{
"inputs": [],
"name": "Q112",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "RESOLUTION",
"outputs": [
{
"internalType": "uint8",
"name": "",
"type": "uint8"
}
],
"stateMutability": "view",
"type": "function"
}
],
"metadata": "{\"compiler\":{\"version\":\"0.6.6+commit.6c089d02\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"Q112\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"RESOLUTION\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"moonwalkerswap-libraries/contracts/libraries/FixedPoint.sol\":\"FixedPoint\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"moonwalkerswap-libraries/contracts/libraries/Babylonian.sol\":{\"keccak256\":\"0xeb1c2a281a00f4660775f75ccfa1e51fbe1d75f86aeb9d0d297151ecdb900177\",\"urls\":[\"bzz-raw://68515f0265381bddfb1d1356ea10ce4e5784276fc09f197fcdcedfa5c75cc069\",\"dweb:/ipfs/QmXWVVPnuJwRUAu3Qpu1s7Fyc5WPQxmZPczVEe5cJ5wVHZ\"]},\"moonwalkerswap-libraries/contracts/libraries/BitMath.sol\":{\"keccak256\":\"0x19f84d5268286794b44939ec0d85b3c6f59e133f826cdbd9e40112fc94919bb7\",\"urls\":[\"bzz-raw://d21c67ed58cf667d052e141df2fba76c46c159edcc45eb897c908c20c69d2727\",\"dweb:/ipfs/QmUyKz1992wgR8nYAzBuQzjBAKMxLAN3hTgzpYJxusbmVH\"]},\"moonwalkerswap-libraries/contracts/libraries/FixedPoint.sol\":{\"keccak256\":\"0xc3a39b8a11715cea45ad9f67f50e4e4c33778c1124acd59e90daf064c9a93974\",\"urls\":[\"bzz-raw://2c6c3cdcdb30caa5d15477550003b5dbb174cb2c0be3c012af030fce3d043f28\",\"dweb:/ipfs/QmWh3n5g6zq3umJcURnKCFhhif2c8yb6mKczFjfoCNLC3g\"]},\"moonwalkerswap-libraries/contracts/libraries/FullMath.sol\":{\"keccak256\":\"0xc4ffcf28169f73fc9fdd1f82345d6d4fcccf3fd5aea83c133437c25e4e0950a9\",\"urls\":[\"bzz-raw://c9257a47501005f0a648bc4801ef4abc33843681aaf03a6d0c43d46b69e37407\",\"dweb:/ipfs/QmciHvDrqhxs5fjsrm9aNq29FZXpunMn17n2wWj83Zsh3B\"]}},\"version\":1}",
"bytecode": "0x60b9610025600b82828239805160001a60731461001857fe5b30600052607381538281f3fe7300000000000000000000000000000000000000003014608060405260043610603d5760003560e01c80633bf7a83e146042578063552f888a14605a575b600080fd5b60486076565b60408051918252519081900360200190f35b6060607e565b6040805160ff9092168252519081900360200190f35b600160701b81565b60708156fea264697066735822122039464c00e097d24c8ff78d267b2c31104088a05143247629ee167558b89a3b9b64736f6c63430006060033",
"deployedBytecode": "0x7300000000000000000000000000000000000000003014608060405260043610603d5760003560e01c80633bf7a83e146042578063552f888a14605a575b600080fd5b60486076565b60408051918252519081900360200190f35b6060607e565b6040805160ff9092168252519081900360200190f35b600160701b81565b60708156fea264697066735822122039464c00e097d24c8ff78d267b2c31104088a05143247629ee167558b89a3b9b64736f6c63430006060033",
"immutableReferences": {},
"sourceMap": "251:5884:20:-:0;;132:2:-1;166:7;155:9;146:7;137:37;255:7;249:14;246:1;241:23;235:4;232:33;222:2;;269:9;222:2;293:9;290:1;283:20;323:4;314:7;306:22;347:7;338;331:24",
"deployedSourceMap": "251:5884:20:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;12:1:-1;9;2:12;540:62:20;;;:::i;:::-;;;;;;;;;;;;;;;;496:38;;;:::i;:::-;;;;;;;;;;;;;;;;;;;540:62;-1:-1:-1;;;540:62:20;:::o;496:38::-;531:3;496:38;:::o",
"source": "// SPDX-License-Identifier: GPL-3.0-or-later\npragma solidity >=0.4.0;\n\nimport './FullMath.sol';\nimport './Babylonian.sol';\nimport './BitMath.sol';\n\n// a library for handling binary fixed point numbers (https://en.wikipedia.org/wiki/Q_(number_format))\nlibrary FixedPoint {\n // range: [0, 2**112 - 1]\n // resolution: 1 / 2**112\n struct uq112x112 {\n uint224 _x;\n }\n\n // range: [0, 2**144 - 1]\n // resolution: 1 / 2**112\n struct uq144x112 {\n uint256 _x;\n }\n\n uint8 public constant RESOLUTION = 112;\n uint256 public constant Q112 = 0x10000000000000000000000000000; // 2**112\n uint256 private constant Q224 = 0x100000000000000000000000000000000000000000000000000000000; // 2**224\n uint256 private constant LOWER_MASK = 0xffffffffffffffffffffffffffff; // decimal of UQ*x112 (lower 112 bits)\n\n // encode a uint112 as a UQ112x112\n function encode(uint112 x) internal pure returns (uq112x112 memory) {\n return uq112x112(uint224(x) << RESOLUTION);\n }\n\n // encodes a uint144 as a UQ144x112\n function encode144(uint144 x) internal pure returns (uq144x112 memory) {\n return uq144x112(uint256(x) << RESOLUTION);\n }\n\n // decode a UQ112x112 into a uint112 by truncating after the radix point\n function decode(uq112x112 memory self) internal pure returns (uint112) {\n return uint112(self._x >> RESOLUTION);\n }\n\n // decode a UQ144x112 into a uint144 by truncating after the radix point\n function decode144(uq144x112 memory self) internal pure returns (uint144) {\n return uint144(self._x >> RESOLUTION);\n }\n\n // multiply a UQ112x112 by a uint, returning a UQ144x112\n // reverts on overflow\n function mul(uq112x112 memory self, uint256 y) internal pure returns (uq144x112 memory) {\n uint256 z = 0;\n require(y == 0 || (z = self._x * y) / y == self._x, 'FixedPoint::mul: overflow');\n return uq144x112(z);\n }\n\n // multiply a UQ112x112 by an int and decode, returning an int\n // reverts on overflow\n function muli(uq112x112 memory self, int256 y) internal pure returns (int256) {\n uint256 z = FullMath.mulDiv(self._x, uint256(y < 0 ? -y : y), Q112);\n require(z < 2**255, 'FixedPoint::muli: overflow');\n return y < 0 ? -int256(z) : int256(z);\n }\n\n // multiply a UQ112x112 by a UQ112x112, returning a UQ112x112\n // lossy\n function muluq(uq112x112 memory self, uq112x112 memory other) internal pure returns (uq112x112 memory) {\n if (self._x == 0 || other._x == 0) {\n return uq112x112(0);\n }\n uint112 upper_self = uint112(self._x >> RESOLUTION); // * 2^0\n uint112 lower_self = uint112(self._x & LOWER_MASK); // * 2^-112\n uint112 upper_other = uint112(other._x >> RESOLUTION); // * 2^0\n uint112 lower_other = uint112(other._x & LOWER_MASK); // * 2^-112\n\n // partial products\n uint224 upper = uint224(upper_self) * upper_other; // * 2^0\n uint224 lower = uint224(lower_self) * lower_other; // * 2^-224\n uint224 uppers_lowero = uint224(upper_self) * lower_other; // * 2^-112\n uint224 uppero_lowers = uint224(upper_other) * lower_self; // * 2^-112\n\n // so the bit shift does not overflow\n require(upper <= uint112(-1), 'FixedPoint::muluq: upper overflow');\n\n // this cannot exceed 256 bits, all values are 224 bits\n uint256 sum = uint256(upper << RESOLUTION) + uppers_lowero + uppero_lowers + (lower >> RESOLUTION);\n\n // so the cast does not overflow\n require(sum <= uint224(-1), 'FixedPoint::muluq: sum overflow');\n\n return uq112x112(uint224(sum));\n }\n\n // divide a UQ112x112 by a UQ112x112, returning a UQ112x112\n function divuq(uq112x112 memory self, uq112x112 memory other) internal pure returns (uq112x112 memory) {\n require(other._x > 0, 'FixedPoint::divuq: division by zero');\n if (self._x == other._x) {\n return uq112x112(uint224(Q112));\n }\n if (self._x <= uint144(-1)) {\n uint256 value = (uint256(self._x) << RESOLUTION) / other._x;\n require(value <= uint224(-1), 'FixedPoint::divuq: overflow');\n return uq112x112(uint224(value));\n }\n\n uint256 result = FullMath.mulDiv(Q112, self._x, other._x);\n require(result <= uint224(-1), 'FixedPoint::divuq: overflow');\n return uq112x112(uint224(result));\n }\n\n // returns a UQ112x112 which represents the ratio of the numerator to the denominator\n // can be lossy\n function fraction(uint256 numerator, uint256 denominator) internal pure returns (uq112x112 memory) {\n require(denominator > 0, 'FixedPoint::fraction: division by zero');\n if (numerator == 0) return FixedPoint.uq112x112(0);\n\n if (numerator <= uint144(-1)) {\n uint256 result = (numerator << RESOLUTION) / denominator;\n require(result <= uint224(-1), 'FixedPoint::fraction: overflow');\n return uq112x112(uint224(result));\n } else {\n uint256 result = FullMath.mulDiv(numerator, Q112, denominator);\n require(result <= uint224(-1), 'FixedPoint::fraction: overflow');\n return uq112x112(uint224(result));\n }\n }\n\n // take the reciprocal of a UQ112x112\n // reverts on overflow\n // lossy\n function reciprocal(uq112x112 memory self) internal pure returns (uq112x112 memory) {\n require(self._x != 0, 'FixedPoint::reciprocal: reciprocal of zero');\n require(self._x != 1, 'FixedPoint::reciprocal: overflow');\n return uq112x112(uint224(Q224 / self._x));\n }\n\n // square root of a UQ112x112\n // lossy between 0/1 and 40 bits\n function sqrt(uq112x112 memory self) internal pure returns (uq112x112 memory) {\n if (self._x <= uint144(-1)) {\n return uq112x112(uint224(Babylonian.sqrt(uint256(self._x) << 112)));\n }\n\n uint8 safeShiftBits = 255 - BitMath.mostSignificantBit(self._x);\n safeShiftBits -= safeShiftBits % 2;\n return uq112x112(uint224(Babylonian.sqrt(uint256(self._x) << safeShiftBits) << ((112 - safeShiftBits) / 2)));\n }\n}\n",
"sourcePath": "moonwalkerswap-libraries/contracts/libraries/FixedPoint.sol",
"ast": {
"absolutePath": "moonwalkerswap-libraries/contracts/libraries/FixedPoint.sol",
"exportedSymbols": {
"FixedPoint": [
7858
]
},
"id": 7859,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 7231,
"literals": [
"solidity",
">=",
"0.4",
".0"
],
"nodeType": "PragmaDirective",
"src": "45:24:20"
},
{
"absolutePath": "moonwalkerswap-libraries/contracts/libraries/FullMath.sol",
"file": "./FullMath.sol",
"id": 7232,
"nodeType": "ImportDirective",
"scope": 7859,
"sourceUnit": 8080,
"src": "71:24:20",
"symbolAliases": [],
"unitAlias": ""
},
{
"absolutePath": "moonwalkerswap-libraries/contracts/libraries/Babylonian.sol",
"file": "./Babylonian.sol",
"id": 7233,
"nodeType": "ImportDirective",
"scope": 7859,
"sourceUnit": 6952,
"src": "96:26:20",
"symbolAliases": [],
"unitAlias": ""
},
{
"absolutePath": "moonwalkerswap-libraries/contracts/libraries/BitMath.sol",
"file": "./BitMath.sol",
"id": 7234,
"nodeType": "ImportDirective",
"scope": 7859,
"sourceUnit": 7230,
"src": "123:23:20",
"symbolAliases": [],
"unitAlias": ""
},
{
"abstract": false,
"baseContracts": [],
"contractDependencies": [],
"contractKind": "library",
"documentation": null,
"fullyImplemented": true,
"id": 7858,
"linearizedBaseContracts": [
7858
],
"name": "FixedPoint",
"nodeType": "ContractDefinition",
"nodes": [
{
"canonicalName": "FixedPoint.uq112x112",
"id": 7237,
"members": [
{
"constant": false,
"id": 7236,
"mutability": "mutable",
"name": "_x",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 7237,
"src": "363:10:20",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint224",
"typeString": "uint224"
},
"typeName": {
"id": 7235,
"name": "uint224",
"nodeType": "ElementaryTypeName",
"src": "363:7:20",
"typeDescriptions": {
"typeIdentifier": "t_uint224",
"typeString": "uint224"
}
},
"value": null,
"visibility": "internal"
}
],
"name": "uq112x112",
"nodeType": "StructDefinition",
"scope": 7858,
"src": "336:44:20",
"visibility": "public"
},
{
"canonicalName": "FixedPoint.uq144x112",
"id": 7240,
"members": [
{
"constant": false,
"id": 7239,
"mutability": "mutable",
"name": "_x",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 7240,
"src": "473:10:20",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 7238,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "473:7:20",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"name": "uq144x112",
"nodeType": "StructDefinition",
"scope": 7858,
"src": "446:44:20",
"visibility": "public"
},
{
"constant": true,
"functionSelector": "552f888a",
"id": 7243,
"mutability": "constant",
"name": "RESOLUTION",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 7858,
"src": "496:38:20",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint8",
"typeString": "uint8"
},
"typeName": {
"id": 7241,
"name": "uint8",
"nodeType": "ElementaryTypeName",
"src": "496:5:20",
"typeDescriptions": {
"typeIdentifier": "t_uint8",
"typeString": "uint8"
}
},
"value": {
"argumentTypes": null,
"hexValue": "313132",
"id": 7242,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "531:3:20",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_112_by_1",
"typeString": "int_const 112"
},
"value": "112"
},
"visibility": "public"
},
{
"constant": true,
"functionSelector": "3bf7a83e",
"id": 7246,
"mutability": "constant",
"name": "Q112",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 7858,
"src": "540:62:20",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 7244,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "540:7:20",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": {
"argumentTypes": null,
"hexValue": "30783130303030303030303030303030303030303030303030303030303030",
"id": 7245,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "571:31:20",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_5192296858534827628530496329220096_by_1",
"typeString": "int_const 5192...(26 digits omitted)...0096"
},
"value": "0x10000000000000000000000000000"
},
"visibility": "public"
},
{
"constant": true,
"id": 7249,
"mutability": "constant",
"name": "Q224",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 7858,
"src": "618:91:20",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 7247,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "618:7:20",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": {
"argumentTypes": null,
"hexValue": "3078313030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030",
"id": 7248,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "650:59:20",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_26959946667150639794667015087019630673637144422540572481103610249216_by_1",
"typeString": "int_const 2695...(60 digits omitted)...9216"
},
"value": "0x100000000000000000000000000000000000000000000000000000000"
},
"visibility": "private"
},
{
"constant": true,
"id": 7252,
"mutability": "constant",
"name": "LOWER_MASK",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 7858,
"src": "725:68:20",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 7250,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "725:7:20",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": {
"argumentTypes": null,
"hexValue": "307866666666666666666666666666666666666666666666666666666666",
"id": 7251,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "763:30:20",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_5192296858534827628530496329220095_by_1",
"typeString": "int_const 5192...(26 digits omitted)...0095"
},
"value": "0xffffffffffffffffffffffffffff"
},
"visibility": "private"
},
{
"body": {
"id": 7268,
"nodeType": "Block",
"src": "946:59:20",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint224",
"typeString": "uint224"
},
"id": 7265,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 7262,
"name": "x",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 7254,
"src": "981:1:20",
"typeDescriptions": {
"typeIdentifier": "t_uint112",
"typeString": "uint112"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint112",
"typeString": "uint112"
}
],
"id": 7261,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "973:7:20",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_uint224_$",
"typeString": "type(uint224)"
},
"typeName": {
"id": 7260,
"name": "uint224",
"nodeType": "ElementaryTypeName",
"src": "973:7:20",
"typeDescriptions": {
"typeIdentifier": null,
"typeString": null
}
}
},
"id": 7263,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "973:10:20",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint224",
"typeString": "uint224"
}
},
"nodeType": "BinaryOperation",
"operator": "<<",
"rightExpression": {
"argumentTypes": null,
"id": 7264,
"name": "RESOLUTION",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 7243,
"src": "987:10:20",
"typeDescriptions": {
"typeIdentifier": "t_uint8",
"typeString": "uint8"
}
},
"src": "973:24:20",
"typeDescriptions": {
"typeIdentifier": "t_uint224",
"typeString": "uint224"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint224",
"typeString": "uint224"
}
],
"id": 7259,
"name": "uq112x112",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 7237,
"src": "963:9:20",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_struct$_uq112x112_$7237_storage_ptr_$",
"typeString": "type(struct FixedPoint.uq112x112 storage pointer)"
}
},
"id": 7266,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "structConstructorCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "963:35:20",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_struct$_uq112x112_$7237_memory_ptr",
"typeString": "struct FixedPoint.uq112x112 memory"
}
},
"functionReturnParameters": 7258,
"id": 7267,
"nodeType": "Return",
"src": "956:42:20"
}
]
},
"documentation": null,
"id": 7269,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "encode",
"nodeType": "FunctionDefinition",
"overrides": null,
"parameters": {
"id": 7255,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 7254,
"mutability": "mutable",
"name": "x",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 7269,
"src": "894:9:20",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint112",
"typeString": "uint112"
},
"typeName": {
"id": 7253,
"name": "uint112",
"nodeType": "ElementaryTypeName",
"src": "894:7:20",
"typeDescriptions": {
"typeIdentifier": "t_uint112",
"typeString": "uint112"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "893:11:20"
},
"returnParameters": {
"id": 7258,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 7257,
"mutability": "mutable",
"name": "",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 7269,
"src": "928:16:20",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_struct$_uq112x112_$7237_memory_ptr",
"typeString": "struct FixedPoint.uq112x112"
},
"typeName": {
"contractScope": null,
"id": 7256,
"name": "uq112x112",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 7237,
"src": "928:9:20",
"typeDescriptions": {
"typeIdentifier": "t_struct$_uq112x112_$7237_storage_ptr",
"typeString": "struct FixedPoint.uq112x112"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "927:18:20"
},
"scope": 7858,
"src": "878:127:20",
"stateMutability": "pure",
"virtual": false,
"visibility": "internal"
},
{
"body": {
"id": 7285,
"nodeType": "Block",
"src": "1122:59:20",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 7282,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 7279,
"name": "x",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 7271,
"src": "1157:1:20",
"typeDescriptions": {
"typeIdentifier": "t_uint144",
"typeString": "uint144"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint144",
"typeString": "uint144"
}
],
"id": 7278,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "1149:7:20",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_uint256_$",
"typeString": "type(uint256)"
},
"typeName": {
"id": 7277,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1149:7:20",
"typeDescriptions": {
"typeIdentifier": null,
"typeString": null
}
}
},
"id": 7280,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1149:10:20",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "<<",
"rightExpression": {
"argumentTypes": null,
"id": 7281,
"name": "RESOLUTION",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 7243,
"src": "1163:10:20",
"typeDescriptions": {
"typeIdentifier": "t_uint8",
"typeString": "uint8"
}
},
"src": "1149:24:20",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"id": 7276,
"name": "uq144x112",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 7240,
"src": "1139:9:20",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_struct$_uq144x112_$7240_storage_ptr_$",
"typeString": "type(struct FixedPoint.uq144x112 storage pointer)"
}
},
"id": 7283,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "structConstructorCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1139:35:20",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_struct$_uq144x112_$7240_memory_ptr",
"typeString": "struct FixedPoint.uq144x112 memory"
}
},
"functionReturnParameters": 7275,
"id": 7284,
"nodeType": "Return",
"src": "1132:42:20"
}
]
},
"documentation": null,
"id": 7286,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "encode144",
"nodeType": "FunctionDefinition",
"overrides": null,
"parameters": {
"id": 7272,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 7271,
"mutability": "mutable",
"name": "x",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 7286,
"src": "1070:9:20",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint144",
"typeString": "uint144"
},
"typeName": {
"id": 7270,
"name": "uint144",
"nodeType": "ElementaryTypeName",
"src": "1070:7:20",
"typeDescriptions": {
"typeIdentifier": "t_uint144",
"typeString": "uint144"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1069:11:20"
},
"returnParameters": {
"id": 7275,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 7274,
"mutability": "mutable",
"name": "",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 7286,
"src": "1104:16:20",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_struct$_uq144x112_$7240_memory_ptr",
"typeString": "struct FixedPoint.uq144x112"
},
"typeName": {
"contractScope": null,
"id": 7273,
"name": "uq144x112",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 7240,
"src": "1104:9:20",
"typeDescriptions": {
"typeIdentifier": "t_struct$_uq144x112_$7240_storage_ptr",
"typeString": "struct FixedPoint.uq144x112"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1103:18:20"
},
"scope": 7858,
"src": "1051:130:20",
"stateMutability": "pure",
"virtual": false,
"visibility": "internal"
},
{
"body": {
"id": 7301,
"nodeType": "Block",
"src": "1335:54:20",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint224",
"typeString": "uint224"
},
"id": 7298,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 7295,
"name": "self",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 7288,
"src": "1360:4:20",
"typeDescriptions": {
"typeIdentifier": "t_struct$_uq112x112_$7237_memory_ptr",
"typeString": "struct FixedPoint.uq112x112 memory"
}
},
"id": 7296,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "_x",
"nodeType": "MemberAccess",
"referencedDeclaration": 7236,
"src": "1360:7:20",
"typeDescriptions": {
"typeIdentifier": "t_uint224",
"typeString": "uint224"
}
},
"nodeType": "BinaryOperation",
"operator": ">>",
"rightExpression": {
"argumentTypes": null,
"id": 7297,
"name": "RESOLUTION",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 7243,
"src": "1371:10:20",
"typeDescriptions": {
"typeIdentifier": "t_uint8",
"typeString": "uint8"
}
},
"src": "1360:21:20",
"typeDescriptions": {
"typeIdentifier": "t_uint224",
"typeString": "uint224"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint224",
"typeString": "uint224"
}
],
"id": 7294,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "1352:7:20",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_uint112_$",
"typeString": "type(uint112)"
},
"typeName": {
"id": 7293,
"name": "uint112",
"nodeType": "ElementaryTypeName",
"src": "1352:7:20",
"typeDescriptions": {
"typeIdentifier": null,
"typeString": null
}
}
},
"id": 7299,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1352:30:20",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint112",
"typeString": "uint112"
}
},
"functionReturnParameters": 7292,
"id": 7300,
"nodeType": "Return",
"src": "1345:37:20"
}
]
},
"documentation": null,
"id": 7302,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "decode",
"nodeType": "FunctionDefinition",
"overrides": null,
"parameters": {
"id": 7289,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 7288,
"mutability": "mutable",
"name": "self",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 7302,
"src": "1280:21:20",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_struct$_uq112x112_$7237_memory_ptr",
"typeString": "struct FixedPoint.uq112x112"
},
"typeName": {
"contractScope": null,
"id": 7287,
"name": "uq112x112",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 7237,
"src": "1280:9:20",
"typeDescriptions": {
"typeIdentifier": "t_struct$_uq112x112_$7237_storage_ptr",
"typeString": "struct FixedPoint.uq112x112"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1279:23:20"
},
"returnParameters": {
"id": 7292,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 7291,
"mutability": "mutable",
"name": "",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 7302,
"src": "1326:7:20",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint112",
"typeString": "uint112"
},
"typeName": {
"id": 7290,
"name": "uint112",
"nodeType": "ElementaryTypeName",
"src": "1326:7:20",
"typeDescriptions": {
"typeIdentifier": "t_uint112",
"typeString": "uint112"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1325:9:20"
},
"scope": 7858,
"src": "1264:125:20",
"stateMutability": "pure",
"virtual": false,
"visibility": "internal"
},
{
"body": {
"id": 7317,
"nodeType": "Block",
"src": "1546:54:20",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 7314,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 7311,
"name": "self",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 7304,
"src": "1571:4:20",
"typeDescriptions": {
"typeIdentifier": "t_struct$_uq144x112_$7240_memory_ptr",
"typeString": "struct FixedPoint.uq144x112 memory"
}
},
"id": 7312,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "_x",
"nodeType": "MemberAccess",
"referencedDeclaration": 7239,
"src": "1571:7:20",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"