@dolomite-exchange/dolomite-margin
Version:
Ethereum Smart Contracts and TypeScript library used for the DolomiteMargin trading protocol
1,165 lines • 314 kB
JSON
{
"contractName": "Bits",
"abi": [],
"metadata": "{\"compiler\":{\"version\":\"0.5.16+commit.9c3226ce\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"author\":\"Dolomite * Library for caching information about markets\",\"methods\":{},\"title\":\"Bits\"},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/Bits.sol\":\"Bits\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/Bits.sol\":{\"keccak256\":\"0x6d9a641163b2dd25e648c65f5d9e4949a57938e29ddc4c9dddefd74a9964aeef\",\"urls\":[\"bzz-raw://67e5a04ed4055faafbc100d6ccca9c54448ed378a1a8c71171562edda7bcbf7c\",\"dweb:/ipfs/QmYRikK3Xbgiq3UBJkgoo2zNUSSrShVabpRHmQj6iQHhrc\"]},\"/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/Require.sol\":{\"keccak256\":\"0x05a2a90b41b6a5f42f0a72da63d015fb0b406a9ba2172823352e522e8bf3a606\",\"urls\":[\"bzz-raw://19883f0c6d33266f756ec5c3d17539524aa24b993c46c33f8400801d09373a6c\",\"dweb:/ipfs/QmYX2fwK3vQQDSZLMrc5wMfeb8RWrcC9CGX8XECLty8QDk\"]}},\"version\":1}",
"bytecode": "0x60636023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea365627a7a72315820f6ba1e66caa0c1d9bdc6af50a3c59a61005bb1fa089ba14c2f6bc9fb765faf296c6578706572696d656e74616cf564736f6c63430005100040",
"deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea365627a7a72315820f6ba1e66caa0c1d9bdc6af50a3c59a61005bb1fa089ba14c2f6bc9fb765faf296c6578706572696d656e74616cf564736f6c63430005100040",
"sourceMap": "800:2375:89:-;;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": "800:2375:89:-;;;;;;;;",
"source": "/*\n\n Copyright 2019 dYdX Trading Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.5.7;\npragma experimental ABIEncoderV2;\n\nimport { Require } from \"./Require.sol\";\n\n\n/**\n * @title Bits\n * @author Dolomite\n *\n * Library for caching information about markets\n */\nlibrary Bits {\n\n // ============ Constants ============\n\n uint256 internal constant ONE = 1;\n uint256 internal constant MAX_UINT_BITS = 256;\n\n // ============ Functions ============\n\n function createBitmaps(uint256 maxLength) internal pure returns (uint256[] memory) {\n return new uint256[]((maxLength / MAX_UINT_BITS) + ONE);\n }\n\n function getMarketIdFromBit(\n uint256 index,\n uint256 bit\n ) internal pure returns (uint256) {\n return (MAX_UINT_BITS * index) + bit;\n }\n\n function setBit(\n uint256[] memory bitmaps,\n uint256 marketId\n ) internal pure {\n uint256 bucketIndex = marketId / MAX_UINT_BITS;\n uint256 indexFromRight = marketId % MAX_UINT_BITS;\n bitmaps[bucketIndex] |= (ONE << indexFromRight);\n }\n\n function hasBit(\n uint256[] memory bitmaps,\n uint256 marketId\n ) internal pure returns (bool) {\n uint256 bucketIndex = marketId / MAX_UINT_BITS;\n uint256 indexFromRight = marketId % MAX_UINT_BITS;\n uint256 bit = bitmaps[bucketIndex] & (ONE << indexFromRight);\n return bit != 0;\n }\n\n function unsetBit(\n uint256 bitmap,\n uint256 bit\n ) internal pure returns (uint256) {\n return bitmap & ~(ONE << bit);\n }\n\n // solium-disable security/no-assign-params\n function getLeastSignificantBit(uint256 x) internal pure returns (uint256) {\n // gas usage peaks at 350 per call\n\n uint256 lsb = 255;\n\n if (x & uint128(-1) != 0) {\n lsb -= 128;\n } else {\n x >>= 128;\n }\n\n if (x & uint64(-1) != 0) {\n lsb -= 64;\n } else {\n x >>= 64;\n }\n\n if (x & uint32(-1) != 0) {\n lsb -= 32;\n } else {\n x >>= 32;\n }\n\n if (x & uint16(-1) != 0) {\n lsb -= 16;\n } else {\n x >>= 16;\n }\n\n if (x & uint8(-1) != 0) {\n lsb -= 8;\n } else {\n x >>= 8;\n }\n\n if (x & 0xf != 0) {\n lsb -= 4;\n } else {\n x >>= 4;\n }\n\n if (x & 0x3 != 0) {\n lsb -= 2;\n } else {\n x >>= 2;\n // solium-enable security/no-assign-params\n }\n\n if (x & 0x1 != 0) {\n lsb -= 1;\n }\n\n return lsb;\n }\n}\n",
"sourcePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/Bits.sol",
"ast": {
"absolutePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/Bits.sol",
"exportedSymbols": {
"Bits": [
25656
]
},
"id": 25657,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 25371,
"literals": [
"solidity",
"^",
"0.5",
".7"
],
"nodeType": "PragmaDirective",
"src": "603:23:89"
},
{
"id": 25372,
"literals": [
"experimental",
"ABIEncoderV2"
],
"nodeType": "PragmaDirective",
"src": "627:33:89"
},
{
"absolutePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/Require.sol",
"file": "./Require.sol",
"id": 25374,
"nodeType": "ImportDirective",
"scope": 25657,
"sourceUnit": 28453,
"src": "662:40:89",
"symbolAliases": [
{
"foreign": 25373,
"local": null
}
],
"unitAlias": ""
},
{
"baseContracts": [],
"contractDependencies": [],
"contractKind": "library",
"documentation": "@title Bits\n@author Dolomite\n * Library for caching information about markets",
"fullyImplemented": true,
"id": 25656,
"linearizedBaseContracts": [
25656
],
"name": "Bits",
"nodeType": "ContractDefinition",
"nodes": [
{
"constant": true,
"id": 25377,
"name": "ONE",
"nodeType": "VariableDeclaration",
"scope": 25656,
"src": "864:33:89",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 25375,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "864:7:89",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": {
"argumentTypes": null,
"hexValue": "31",
"id": 25376,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "896:1:89",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_1_by_1",
"typeString": "int_const 1"
},
"value": "1"
},
"visibility": "internal"
},
{
"constant": true,
"id": 25380,
"name": "MAX_UINT_BITS",
"nodeType": "VariableDeclaration",
"scope": 25656,
"src": "903:45:89",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 25378,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "903:7:89",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": {
"argumentTypes": null,
"hexValue": "323536",
"id": 25379,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "945:3:89",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_256_by_1",
"typeString": "int_const 256"
},
"value": "256"
},
"visibility": "internal"
},
{
"body": {
"id": 25399,
"nodeType": "Block",
"src": "1082:72:89",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 25396,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"components": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 25393,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 25391,
"name": "maxLength",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 25382,
"src": "1114:9:89",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "/",
"rightExpression": {
"argumentTypes": null,
"id": 25392,
"name": "MAX_UINT_BITS",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 25380,
"src": "1126:13:89",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "1114:25:89",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"id": 25394,
"isConstant": false,
"isInlineArray": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"nodeType": "TupleExpression",
"src": "1113:27:89",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "+",
"rightExpression": {
"argumentTypes": null,
"id": 25395,
"name": "ONE",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 25377,
"src": "1143:3:89",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "1113:33:89",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"id": 25390,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "NewExpression",
"src": "1099:13:89",
"typeDescriptions": {
"typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_array$_t_uint256_$dyn_memory_$",
"typeString": "function (uint256) pure returns (uint256[] memory)"
},
"typeName": {
"baseType": {
"id": 25388,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1103:7:89",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 25389,
"length": null,
"nodeType": "ArrayTypeName",
"src": "1103:9:89",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr",
"typeString": "uint256[]"
}
}
},
"id": 25397,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1099:48:89",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_uint256_$dyn_memory",
"typeString": "uint256[] memory"
}
},
"functionReturnParameters": 25387,
"id": 25398,
"nodeType": "Return",
"src": "1092:55:89"
}
]
},
"documentation": null,
"id": 25400,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "createBitmaps",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 25383,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 25382,
"name": "maxLength",
"nodeType": "VariableDeclaration",
"scope": 25400,
"src": "1022:17:89",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 25381,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1022:7:89",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1021:19:89"
},
"returnParameters": {
"id": 25387,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 25386,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 25400,
"src": "1064:16:89",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr",
"typeString": "uint256[]"
},
"typeName": {
"baseType": {
"id": 25384,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1064:7:89",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 25385,
"length": null,
"nodeType": "ArrayTypeName",
"src": "1064:9:89",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr",
"typeString": "uint256[]"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1063:18:89"
},
"scope": 25656,
"src": "999:155:89",
"stateMutability": "pure",
"superFunction": null,
"visibility": "internal"
},
{
"body": {
"id": 25416,
"nodeType": "Block",
"src": "1270:53:89",
"statements": [
{
"expression": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 25414,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"components": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 25411,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 25409,
"name": "MAX_UINT_BITS",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 25380,
"src": "1288:13:89",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "*",
"rightExpression": {
"argumentTypes": null,
"id": 25410,
"name": "index",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 25402,
"src": "1304:5:89",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "1288:21:89",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"id": 25412,
"isConstant": false,
"isInlineArray": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"nodeType": "TupleExpression",
"src": "1287:23:89",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "+",
"rightExpression": {
"argumentTypes": null,
"id": 25413,
"name": "bit",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 25404,
"src": "1313:3:89",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "1287:29:89",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"functionReturnParameters": 25408,
"id": 25415,
"nodeType": "Return",
"src": "1280:36:89"
}
]
},
"documentation": null,
"id": 25417,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "getMarketIdFromBit",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 25405,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 25402,
"name": "index",
"nodeType": "VariableDeclaration",
"scope": 25417,
"src": "1197:13:89",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 25401,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1197:7:89",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 25404,
"name": "bit",
"nodeType": "VariableDeclaration",
"scope": 25417,
"src": "1220:11:89",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 25403,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1220:7:89",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1187:50:89"
},
"returnParameters": {
"id": 25408,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 25407,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 25417,
"src": "1261:7:89",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 25406,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1261:7:89",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1260:9:89"
},
"scope": 25656,
"src": "1160:163:89",
"stateMutability": "pure",
"superFunction": null,
"visibility": "internal"
},
{
"body": {
"id": 25446,
"nodeType": "Block",
"src": "1425:179:89",
"statements": [
{
"assignments": [
25426
],
"declarations": [
{
"constant": false,
"id": 25426,
"name": "bucketIndex",
"nodeType": "VariableDeclaration",
"scope": 25446,
"src": "1435:19:89",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 25425,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1435:7:89",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 25430,
"initialValue": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 25429,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 25427,
"name": "marketId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 25422,
"src": "1457:8:89",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "/",
"rightExpression": {
"argumentTypes": null,
"id": 25428,
"name": "MAX_UINT_BITS",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 25380,
"src": "1468:13:89",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "1457:24:89",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "1435:46:89"
},
{
"assignments": [
25432
],
"declarations": [
{
"constant": false,
"id": 25432,
"name": "indexFromRight",
"nodeType": "VariableDeclaration",
"scope": 25446,
"src": "1491:22:89",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 25431,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1491:7:89",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 25436,
"initialValue": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 25435,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 25433,
"name": "marketId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 25422,
"src": "1516:8:89",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "%",
"rightExpression": {
"argumentTypes": null,
"id": 25434,
"name": "MAX_UINT_BITS",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 25380,
"src": "1527:13:89",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "1516:24:89",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "1491:49:89"
},
{
"expression": {
"argumentTypes": null,
"id": 25444,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 25437,
"name": "bitmaps",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 25420,
"src": "1550:7:89",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr",
"typeString": "uint256[] memory"
}
},
"id": 25439,
"indexExpression": {
"argumentTypes": null,
"id": 25438,
"name": "bucketIndex",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 25426,
"src": "1558:11:89",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": true,
"nodeType": "IndexAccess",
"src": "1550:20:89",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "|=",
"rightHandSide": {
"argumentTypes": null,
"components": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 25442,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 25440,
"name": "ONE",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 25377,
"src": "1575:3:89",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "<<",
"rightExpression": {
"argumentTypes": null,
"id": 25441,
"name": "indexFromRight",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 25432,
"src": "1582:14:89",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "1575:21:89",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"id": 25443,
"isConstant": false,
"isInlineArray": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"nodeType": "TupleExpression",
"src": "1574:23:89",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "1550:47:89",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 25445,
"nodeType": "ExpressionStatement",
"src": "1550:47:89"
}
]
},
"documentation": null,
"id": 25447,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "setBit",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 25423,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 25420,
"name": "bitmaps",
"nodeType": "VariableDeclaration",
"scope": 25447,
"src": "1354:24:89",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr",
"typeString": "uint256[]"
},
"typeName": {
"baseType": {
"id": 25418,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1354:7:89",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 25419,
"length": null,
"nodeType": "ArrayTypeName",
"src": "1354:9:89",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr",
"typeString": "uint256[]"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 25422,
"name": "marketId",
"nodeType": "VariableDeclaration",
"scope": 25447,
"src": "1388:16:89",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 25421,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1388:7:89",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1344:66:89"
},
"returnParameters": {
"id": 25424,
"nodeType": "ParameterList",
"parameters": [],
"src": "1425:0:89"
},
"scope": 25656,
"src": "1329:275:89",
"stateMutability": "pure",
"superFunction": null,
"visibility": "internal"
},
{
"body": {
"id": 25484,
"nodeType": "Block",
"src": "1721:217:89",
"statements": [
{
"assignments": [
25458
],
"declarations": [
{
"constant": false,
"id": 25458,
"name": "bucketIndex",
"nodeType": "VariableDeclaration",
"scope": 25484,
"src": "1731:19:89",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 25457,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1731:7:89",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 25462,
"initialValue": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 25461,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 25459,
"name": "marketId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 25452,
"src": "1753:8:89",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "/",
"rightExpression": {
"argumentTypes": null,
"id": 25460,
"name": "MAX_UINT_BITS",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 25380,
"src": "1764:13:89",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "1753:24:89",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "1731:46:89"
},
{
"assignments": [
25464
],
"declarations": [
{
"constant": false,
"id": 25464,
"name": "indexFromRight",
"nodeType": "VariableDeclaration",
"scope": 25484,
"src": "1787:22:89",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 25463,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1787:7:89",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 25468,
"initialValue": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 25467,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 25465,
"name": "marketId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 25452,
"src": "1812:8:89",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "%",
"rightExpression": {
"argumentTypes": null,
"id": 25466,
"name": "MAX_UINT_BITS",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 25380,
"src": "1823:13:89",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "1812:24:89",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeStrin