{
  "contractName": "TokenConservation",
  "abi": [],
  "metadata": "{\"compiler\":{\"version\":\"0.5.10+commit.5a6ea5b1\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"author\":\"@gnosis/dfusion-team <https://github.com/orgs/gnosis/teams/dfusion-team/members>\",\"methods\":{},\"title\":\"Token Conservation A library for updating and verifying the tokenConservation contraint for BatchExchange's batch auction\"},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/Users/felixleupold/Gnosis/dex-contracts/contracts/libraries/TokenConservation.sol\":\"TokenConservation\"},\"evmVersion\":\"petersburg\",\"libraries\":{},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"/Users/felixleupold/Gnosis/dex-contracts/contracts/libraries/TokenConservation.sol\":{\"keccak256\":\"0x674557850e56ef6a716bb1dc528479e290238c592d0764bc7144cc1e811cedea\",\"urls\":[\"bzzr://f6a943472678132ef59cf3b2f131daf28952c1b72cd0e28bda46050dd577a29b\",\"dweb:/ipfs/QmbQsAgu7Fd6i84A98DxXemSnW3UkgccXxNnZLKvtuzHdE\"]},\"@openzeppelin/contracts/drafts/SignedSafeMath.sol\":{\"keccak256\":\"0xf1587a6daea33c93e85fff4e205967183de459159aafcb01b7397fb7ec1f9f77\",\"urls\":[\"bzzr://3fa5ad67118819b61448882baec9ca9964dde65630f574ab3c38841110082923\",\"dweb:/ipfs/QmTaR64X6RsWzXvVGxPCaAoW7ZZ8Fhiii4ddRo7QpQGBrx\"]}},\"version\":1}",
  "bytecode": "0x60556023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea265627a7a723058208367123e792e7b1955b543b9864599c198f064eb4ca790100b9b2bcbf2a9db2964736f6c634300050a0032",
  "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea265627a7a723058208367123e792e7b1955b543b9864599c198f064eb4ca790100b9b2bcbf2a9db2964736f6c634300050a0032",
  "sourceMap": "320:3983:6:-;;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": "320:3983:6:-;;;;;;;;",
  "source": "pragma solidity ^0.5.0;\n\nimport \"@openzeppelin/contracts/drafts/SignedSafeMath.sol\";\n\n/** @title Token Conservation\n *  A library for updating and verifying the tokenConservation contraint for BatchExchange's batch auction\n *  @author @gnosis/dfusion-team <https://github.com/orgs/gnosis/teams/dfusion-team/members>\n */\nlibrary TokenConservation {\n    using SignedSafeMath for int256;\n\n    /** @dev initialize the token conservation data structure\n     * @param tokenIdsForPrice sorted list of tokenIds for which token conservation should be checked\n     */\n    function init(uint16[] memory tokenIdsForPrice) internal pure returns (int256[] memory) {\n        return new int256[](tokenIdsForPrice.length + 1);\n    }\n\n    /** @dev returns the token imbalance of the fee token\n     * @param self internal datastructure created by TokenConservation.init()\n     */\n    function feeTokenImbalance(int256[] memory self) internal pure returns (int256) {\n        return self[0];\n    }\n\n    /** @dev updated token conservation array.\n     * @param self internal datastructure created by TokenConservation.init()\n     * @param buyToken id of token whose imbalance should be subtracted from\n     * @param sellToken id of token whose imbalance should be added to\n     * @param tokenIdsForPrice sorted list of tokenIds\n     * @param buyAmount amount to be subtracted at `self[buyTokenIndex]`\n     * @param sellAmount amount to be added at `self[sellTokenIndex]`\n     */\n    function updateTokenConservation(\n        int256[] memory self,\n        uint16 buyToken,\n        uint16 sellToken,\n        uint16[] memory tokenIdsForPrice,\n        uint128 buyAmount,\n        uint128 sellAmount\n    ) internal pure {\n        uint256 buyTokenIndex = findPriceIndex(buyToken, tokenIdsForPrice);\n        uint256 sellTokenIndex = findPriceIndex(sellToken, tokenIdsForPrice);\n        self[buyTokenIndex] = self[buyTokenIndex].sub(int256(buyAmount));\n        self[sellTokenIndex] = self[sellTokenIndex].add(int256(sellAmount));\n    }\n\n    /** @dev Ensures all array's elements are zero except the first.\n     * @param self internal datastructure created by TokenConservation.init()\n     * @return true if all, but first element of self are zero else false\n     */\n    function checkTokenConservation(int256[] memory self) internal pure {\n        require(self[0] > 0, \"Token conservation at 0 must be positive.\");\n        for (uint256 i = 1; i < self.length; i++) {\n            require(self[i] == 0, \"Token conservation does not hold\");\n        }\n    }\n\n    /** @dev Token ordering is verified by submitSolution. Required because binary search is used to fetch token info.\n     * @param tokenIdsForPrice list of tokenIds\n     * @return true if tokenIdsForPrice is sorted else false\n     */\n    function checkPriceOrdering(uint16[] memory tokenIdsForPrice) internal pure returns (bool) {\n        for (uint256 i = 1; i < tokenIdsForPrice.length; i++) {\n            if (tokenIdsForPrice[i] <= tokenIdsForPrice[i - 1]) {\n                return false;\n            }\n        }\n        return true;\n    }\n\n    /** @dev implementation of binary search on sorted list returns token id\n     * @param tokenId element whose index is to be found\n     * @param tokenIdsForPrice list of (sorted) tokenIds for which binary search is applied.\n     * @return `index` in `tokenIdsForPrice` where `tokenId` appears (reverts if not found).\n     */\n    function findPriceIndex(uint16 tokenId, uint16[] memory tokenIdsForPrice) private pure returns (uint256) {\n        // Fee token is not included in tokenIdsForPrice\n        if (tokenId == 0) {\n            return 0;\n        }\n        // binary search for the other tokens\n        uint256 leftValue = 0;\n        uint256 rightValue = tokenIdsForPrice.length - 1;\n        while (rightValue >= leftValue) {\n            uint256 middleValue = (leftValue + rightValue) / 2;\n            if (tokenIdsForPrice[middleValue] == tokenId) {\n                // shifted one to the right to account for fee token at index 0\n                return middleValue + 1;\n            } else if (tokenIdsForPrice[middleValue] < tokenId) {\n                leftValue = middleValue + 1;\n            } else {\n                rightValue = middleValue - 1;\n            }\n        }\n        revert(\"Price not provided for token\");\n    }\n}\n",
  "sourcePath": "/Users/felixleupold/Gnosis/dex-contracts/contracts/libraries/TokenConservation.sol",
  "ast": {
    "absolutePath": "/Users/felixleupold/Gnosis/dex-contracts/contracts/libraries/TokenConservation.sol",
    "exportedSymbols": {
      "TokenConservation": [
        4661
      ]
    },
    "id": 4662,
    "nodeType": "SourceUnit",
    "nodes": [
      {
        "id": 4413,
        "literals": [
          "solidity",
          "^",
          "0.5",
          ".0"
        ],
        "nodeType": "PragmaDirective",
        "src": "0:23:6"
      },
      {
        "absolutePath": "@openzeppelin/contracts/drafts/SignedSafeMath.sol",
        "file": "@openzeppelin/contracts/drafts/SignedSafeMath.sol",
        "id": 4414,
        "nodeType": "ImportDirective",
        "scope": 4662,
        "sourceUnit": 8468,
        "src": "25:59:6",
        "symbolAliases": [],
        "unitAlias": ""
      },
      {
        "baseContracts": [],
        "contractDependencies": [],
        "contractKind": "library",
        "documentation": "@title Token Conservation\n A library for updating and verifying the tokenConservation contraint for BatchExchange's batch auction\n @author @gnosis/dfusion-team <https://github.com/orgs/gnosis/teams/dfusion-team/members>",
        "fullyImplemented": true,
        "id": 4661,
        "linearizedBaseContracts": [
          4661
        ],
        "name": "TokenConservation",
        "nodeType": "ContractDefinition",
        "nodes": [
          {
            "id": 4417,
            "libraryName": {
              "contractScope": null,
              "id": 4415,
              "name": "SignedSafeMath",
              "nodeType": "UserDefinedTypeName",
              "referencedDeclaration": 8467,
              "src": "358:14:6",
              "typeDescriptions": {
                "typeIdentifier": "t_contract$_SignedSafeMath_$8467",
                "typeString": "library SignedSafeMath"
              }
            },
            "nodeType": "UsingForDirective",
            "src": "352:32:6",
            "typeName": {
              "id": 4416,
              "name": "int256",
              "nodeType": "ElementaryTypeName",
              "src": "377:6:6",
              "typeDescriptions": {
                "typeIdentifier": "t_int256",
                "typeString": "int256"
              }
            }
          },
          {
            "body": {
              "id": 4435,
              "nodeType": "Block",
              "src": "650:65:6",
              "statements": [
                {
                  "expression": {
                    "argumentTypes": null,
                    "arguments": [
                      {
                        "argumentTypes": null,
                        "commonType": {
                          "typeIdentifier": "t_uint256",
                          "typeString": "uint256"
                        },
                        "id": 4432,
                        "isConstant": false,
                        "isLValue": false,
                        "isPure": false,
                        "lValueRequested": false,
                        "leftExpression": {
                          "argumentTypes": null,
                          "expression": {
                            "argumentTypes": null,
                            "id": 4429,
                            "name": "tokenIdsForPrice",
                            "nodeType": "Identifier",
                            "overloadedDeclarations": [],
                            "referencedDeclaration": 4420,
                            "src": "680:16:6",
                            "typeDescriptions": {
                              "typeIdentifier": "t_array$_t_uint16_$dyn_memory_ptr",
                              "typeString": "uint16[] memory"
                            }
                          },
                          "id": 4430,
                          "isConstant": false,
                          "isLValue": false,
                          "isPure": false,
                          "lValueRequested": false,
                          "memberName": "length",
                          "nodeType": "MemberAccess",
                          "referencedDeclaration": null,
                          "src": "680:23:6",
                          "typeDescriptions": {
                            "typeIdentifier": "t_uint256",
                            "typeString": "uint256"
                          }
                        },
                        "nodeType": "BinaryOperation",
                        "operator": "+",
                        "rightExpression": {
                          "argumentTypes": null,
                          "hexValue": "31",
                          "id": 4431,
                          "isConstant": false,
                          "isLValue": false,
                          "isPure": true,
                          "kind": "number",
                          "lValueRequested": false,
                          "nodeType": "Literal",
                          "src": "706:1:6",
                          "subdenomination": null,
                          "typeDescriptions": {
                            "typeIdentifier": "t_rational_1_by_1",
                            "typeString": "int_const 1"
                          },
                          "value": "1"
                        },
                        "src": "680:27:6",
                        "typeDescriptions": {
                          "typeIdentifier": "t_uint256",
                          "typeString": "uint256"
                        }
                      }
                    ],
                    "expression": {
                      "argumentTypes": [
                        {
                          "typeIdentifier": "t_uint256",
                          "typeString": "uint256"
                        }
                      ],
                      "id": 4428,
                      "isConstant": false,
                      "isLValue": false,
                      "isPure": true,
                      "lValueRequested": false,
                      "nodeType": "NewExpression",
                      "src": "667:12:6",
                      "typeDescriptions": {
                        "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_array$_t_int256_$dyn_memory_$",
                        "typeString": "function (uint256) pure returns (int256[] memory)"
                      },
                      "typeName": {
                        "baseType": {
                          "id": 4426,
                          "name": "int256",
                          "nodeType": "ElementaryTypeName",
                          "src": "671:6:6",
                          "typeDescriptions": {
                            "typeIdentifier": "t_int256",
                            "typeString": "int256"
                          }
                        },
                        "id": 4427,
                        "length": null,
                        "nodeType": "ArrayTypeName",
                        "src": "671:8:6",
                        "typeDescriptions": {
                          "typeIdentifier": "t_array$_t_int256_$dyn_storage_ptr",
                          "typeString": "int256[]"
                        }
                      }
                    },
                    "id": 4433,
                    "isConstant": false,
                    "isLValue": false,
                    "isPure": false,
                    "kind": "functionCall",
                    "lValueRequested": false,
                    "names": [],
                    "nodeType": "FunctionCall",
                    "src": "667:41:6",
                    "typeDescriptions": {
                      "typeIdentifier": "t_array$_t_int256_$dyn_memory",
                      "typeString": "int256[] memory"
                    }
                  },
                  "functionReturnParameters": 4425,
                  "id": 4434,
                  "nodeType": "Return",
                  "src": "660:48:6"
                }
              ]
            },
            "documentation": "@dev initialize the token conservation data structure\n@param tokenIdsForPrice sorted list of tokenIds for which token conservation should be checked",
            "id": 4436,
            "implemented": true,
            "kind": "function",
            "modifiers": [],
            "name": "init",
            "nodeType": "FunctionDefinition",
            "parameters": {
              "id": 4421,
              "nodeType": "ParameterList",
              "parameters": [
                {
                  "constant": false,
                  "id": 4420,
                  "name": "tokenIdsForPrice",
                  "nodeType": "VariableDeclaration",
                  "scope": 4436,
                  "src": "576:32:6",
                  "stateVariable": false,
                  "storageLocation": "memory",
                  "typeDescriptions": {
                    "typeIdentifier": "t_array$_t_uint16_$dyn_memory_ptr",
                    "typeString": "uint16[]"
                  },
                  "typeName": {
                    "baseType": {
                      "id": 4418,
                      "name": "uint16",
                      "nodeType": "ElementaryTypeName",
                      "src": "576:6:6",
                      "typeDescriptions": {
                        "typeIdentifier": "t_uint16",
                        "typeString": "uint16"
                      }
                    },
                    "id": 4419,
                    "length": null,
                    "nodeType": "ArrayTypeName",
                    "src": "576:8:6",
                    "typeDescriptions": {
                      "typeIdentifier": "t_array$_t_uint16_$dyn_storage_ptr",
                      "typeString": "uint16[]"
                    }
                  },
                  "value": null,
                  "visibility": "internal"
                }
              ],
              "src": "575:34:6"
            },
            "returnParameters": {
              "id": 4425,
              "nodeType": "ParameterList",
              "parameters": [
                {
                  "constant": false,
                  "id": 4424,
                  "name": "",
                  "nodeType": "VariableDeclaration",
                  "scope": 4436,
                  "src": "633:15:6",
                  "stateVariable": false,
                  "storageLocation": "memory",
                  "typeDescriptions": {
                    "typeIdentifier": "t_array$_t_int256_$dyn_memory_ptr",
                    "typeString": "int256[]"
                  },
                  "typeName": {
                    "baseType": {
                      "id": 4422,
                      "name": "int256",
                      "nodeType": "ElementaryTypeName",
                      "src": "633:6:6",
                      "typeDescriptions": {
                        "typeIdentifier": "t_int256",
                        "typeString": "int256"
                      }
                    },
                    "id": 4423,
                    "length": null,
                    "nodeType": "ArrayTypeName",
                    "src": "633:8:6",
                    "typeDescriptions": {
                      "typeIdentifier": "t_array$_t_int256_$dyn_storage_ptr",
                      "typeString": "int256[]"
                    }
                  },
                  "value": null,
                  "visibility": "internal"
                }
              ],
              "src": "632:17:6"
            },
            "scope": 4661,
            "src": "562:153:6",
            "stateMutability": "pure",
            "superFunction": null,
            "visibility": "internal"
          },
          {
            "body": {
              "id": 4448,
              "nodeType": "Block",
              "src": "945:31:6",
              "statements": [
                {
                  "expression": {
                    "argumentTypes": null,
                    "baseExpression": {
                      "argumentTypes": null,
                      "id": 4444,
                      "name": "self",
                      "nodeType": "Identifier",
                      "overloadedDeclarations": [],
                      "referencedDeclaration": 4439,
                      "src": "962:4:6",
                      "typeDescriptions": {
                        "typeIdentifier": "t_array$_t_int256_$dyn_memory_ptr",
                        "typeString": "int256[] memory"
                      }
                    },
                    "id": 4446,
                    "indexExpression": {
                      "argumentTypes": null,
                      "hexValue": "30",
                      "id": 4445,
                      "isConstant": false,
                      "isLValue": false,
                      "isPure": true,
                      "kind": "number",
                      "lValueRequested": false,
                      "nodeType": "Literal",
                      "src": "967:1:6",
                      "subdenomination": null,
                      "typeDescriptions": {
                        "typeIdentifier": "t_rational_0_by_1",
                        "typeString": "int_const 0"
                      },
                      "value": "0"
                    },
                    "isConstant": false,
                    "isLValue": true,
                    "isPure": false,
                    "lValueRequested": false,
                    "nodeType": "IndexAccess",
                    "src": "962:7:6",
                    "typeDescriptions": {
                      "typeIdentifier": "t_int256",
                      "typeString": "int256"
                    }
                  },
                  "functionReturnParameters": 4443,
                  "id": 4447,
                  "nodeType": "Return",
                  "src": "955:14:6"
                }
              ]
            },
            "documentation": "@dev returns the token imbalance of the fee token\n@param self internal datastructure created by TokenConservation.init()",
            "id": 4449,
            "implemented": true,
            "kind": "function",
            "modifiers": [],
            "name": "feeTokenImbalance",
            "nodeType": "FunctionDefinition",
            "parameters": {
              "id": 4440,
              "nodeType": "ParameterList",
              "parameters": [
                {
                  "constant": false,
                  "id": 4439,
                  "name": "self",
                  "nodeType": "VariableDeclaration",
                  "scope": 4449,
                  "src": "892:20:6",
                  "stateVariable": false,
                  "storageLocation": "memory",
                  "typeDescriptions": {
                    "typeIdentifier": "t_array$_t_int256_$dyn_memory_ptr",
                    "typeString": "int256[]"
                  },
                  "typeName": {
                    "baseType": {
                      "id": 4437,
                      "name": "int256",
                      "nodeType": "ElementaryTypeName",
                      "src": "892:6:6",
                      "typeDescriptions": {
                        "typeIdentifier": "t_int256",
                        "typeString": "int256"
                      }
                    },
                    "id": 4438,
                    "length": null,
                    "nodeType": "ArrayTypeName",
                    "src": "892:8:6",
                    "typeDescriptions": {
                      "typeIdentifier": "t_array$_t_int256_$dyn_storage_ptr",
                      "typeString": "int256[]"
                    }
                  },
                  "value": null,
                  "visibility": "internal"
                }
              ],
              "src": "891:22:6"
            },
            "returnParameters": {
              "id": 4443,
              "nodeType": "ParameterList",
              "parameters": [
                {
                  "constant": false,
                  "id": 4442,
                  "name": "",
                  "nodeType": "VariableDeclaration",
                  "scope": 4449,
                  "src": "937:6:6",
                  "stateVariable": false,
                  "storageLocation": "default",
                  "typeDescriptions": {
                    "typeIdentifier": "t_int256",
                    "typeString": "int256"
                  },
                  "typeName": {
                    "id": 4441,
                    "name": "int256",
                    "nodeType": "ElementaryTypeName",
                    "src": "937:6:6",
                    "typeDescriptions": {
                      "typeIdentifier": "t_int256",
                      "typeString": "int256"
                    }
                  },
                  "value": null,
                  "visibility": "internal"
                }
              ],
              "src": "936:8:6"
            },
            "scope": 4661,
            "src": "865:111:6",
            "stateMutability": "pure",
            "superFunction": null,
            "visibility": "internal"
          },
          {
            "body": {
              "id": 4506,
              "nodeType": "Block",
              "src": "1692:312:6",
              "statements": [
                {
                  "assignments": [
                    4467
                  ],
                  "declarations": [
                    {
                      "constant": false,
                      "id": 4467,
                      "name": "buyTokenIndex",
                      "nodeType": "VariableDeclaration",
                      "scope": 4506,
                      "src": "1702:21:6",
                      "stateVariable": false,
                      "storageLocation": "default",
                      "typeDescriptions": {
                        "typeIdentifier": "t_uint256",
                        "typeString": "uint256"
                      },
                      "typeName": {
                        "id": 4466,
                        "name": "uint256",
                        "nodeType": "ElementaryTypeName",
                        "src": "1702:7:6",
                        "typeDescriptions": {
                          "typeIdentifier": "t_uint256",
                          "typeString": "uint256"
                        }
                      },
                      "value": null,
                      "visibility": "internal"
                    }
                  ],
                  "id": 4472,
                  "initialValue": {
                    "argumentTypes": null,
                    "arguments": [
                      {
                        "argumentTypes": null,
                        "id": 4469,
                        "name": "buyToken",
                        "nodeType": "Identifier",
                        "overloadedDeclarations": [],
                        "referencedDeclaration": 4454,
                        "src": "1741:8:6",
                        "typeDescriptions": {
                          "typeIdentifier": "t_uint16",
                          "typeString": "uint16"
                        }
                      },
                      {
                        "argumentTypes": null,
                        "id": 4470,
                        "name": "tokenIdsForPrice",
                        "nodeType": "Identifier",
                        "overloadedDeclarations": [],
                        "referencedDeclaration": 4459,
                        "src": "1751:16:6",
                        "typeDescriptions": {
                          "typeIdentifier": "t_array$_t_uint16_$dyn_memory_ptr",
                          "typeString": "uint16[] memory"
                        }
                      }
                    ],
                    "expression": {
                      "argumentTypes": [
                        {
                          "typeIdentifier": "t_uint16",
                          "typeString": "uint16"
                        },
                        {
                          "typeIdentifier": "t_array$_t_uint16_$dyn_memory_ptr",
                          "typeString": "uint16[] memory"
                        }
                      ],
                      "id": 4468,
                      "name": "findPriceIndex",
                      "nodeType": "Identifier",
                      "overloadedDeclarations": [],
                      "referencedDeclaration": 4660,
                      "src": "1726:14:6",
                      "typeDescriptions": {
                        "typeIdentifier": "t_function_internal_pure$_t_uint16_$_t_array$_t_uint16_$dyn_memory_ptr_$returns$_t_uint256_$",
                        "typeString": "function (uint16,uint16[] memory) pure returns (uint256)"
                      }
                    },
                    "id": 4471,
                    "isConstant": false,
                    "isLValue": false,
                    "isPure": false,
                    "kind": "functionCall",
                    "lValueRequested": false,
                    "names": [],
                    "nodeType": "FunctionCall",
                    "src": "1726:42:6",
                    "typeDescriptions": {
                      "typeIdentifier": "t_uint256",
                      "typeString": "uint256"
                    }
                  },
                  "nodeType": "VariableDeclarationStatement",
                  "src": "1702:66:6"
                },
                {
                  "assignments": [
                    4474
                  ],
                  "declarations": [
                    {
                      "constant": false,
                      "id": 4474,
                      "name": "sellTokenIndex",
                      "nodeType": "VariableDeclaration",
                      "scope": 4506,
                      "src": "1778:22:6",
                      "stateVariable": false,
                      "storageLocation": "default",
                      "typeDescriptions": {
                        "typeIdentifier": "t_uint256",
                        "typeString": "uint256"
                      },
                      "typeName": {
                        "id": 4473,
                        "name": "uint256",
                        "nodeType": "ElementaryTypeName",
                        "src": "1778:7:6",
                        "typeDescriptions": {
                          "typeIdentifier": "t_uint256",
                          "typeString": "uint256"
                        }
                      },
                      "value": null,
                      "visibility": "internal"
                    }
                  ],
                  "id": 4479,
                  "initialValue": {
                    "argumentTypes": null,
                    "arguments": [
                      {
                        "argumentTypes": null,
                        "id": 4476,
                        "name": "sellToken",
                        "nodeType": "Identifier",
                        "overloadedDeclarations": [],
                        "referencedDeclaration": 4456,
                        "src": "1818:9:6",
                        "typeDescriptions": {
                          "typeIdentifier": "t_uint16",
                          "typeString": "uint16"
                        }
                      },
                      {
                        "argumentTypes": null,
                        "id": 4477,
                        "name": "tokenIdsForPrice",
                        "nodeType": "Identifier",
                        "overloadedDeclarations": [],
                        "referencedDeclaration": 4459,
                        "src": "1829:16:6",
                        "typeDescriptions": {
                          "typeIdentifier": "t_array$_t_uint16_$dyn_memory_ptr",
                          "typeString": "uint16[] memory"
                        }
                      }
                    ],
                    "expression": {
                      "argumentTypes": [
                        {
                          "typeIdentifier": "t_uint16",
                          "typeString": "uint16"
                        },
                        {
                          "typeIdentifier": "t_array$_t_uint16_$dyn_memory_ptr",
                          "typeString": "uint16[] memory"
                        }
                      ],
                      "id": 4475,
                      "name": "findPriceIndex",
                      "nodeType": "Identifier",
                      "overloadedDeclarations": [],
                      "referencedDeclaration": 4660,
                      "src": "1803:14:6",
                      "typeDescriptions": {
                        "typeIdentifier": "t_function_internal_pure$_t_uint16_$_t_array$_t_uint16_$dyn_memory_ptr_$returns$_t_uint256_$",
                        "typeString": "function (uint16,uint16[] memory) pure returns (uint256)"
                      }
                    },
                    "id": 4478,
                    "isConstant": false,
                    "isLValue": false,
                    "isPure": false,
                    "kind": "functionCall",
                    "lValueRequested": false,
                    "names": [],
                    "nodeType": "FunctionCall",
                    "src": "1803:43:6",
                    "typeDescriptions": {
                      "typeIdentifier": "t_uint256",
                      "typeString": "uint256"
                    }
                  },
                  "nodeType": "VariableDeclarationStatement",
                  "src": "1778:68:6"
                },
                {
                  "expression": {
                    "argumentTypes": null,
                    "id": 4491,
                    "isConstant": false,
                    "isLValue": false,
                    "isPure": false,
                    "lValueRequested": false,
                    "leftHandSide": {
                      "argumentTypes": null,
                      "baseExpression": {
                        "argumentTypes": null,
                        "id": 4480,
                        "name": "self",
                        "nodeType": "Identifier",
                        "overloadedDeclarations": [],
                        "referencedDeclaration": 4452,
                        "src": "1856:4:6",
                        "typeDescriptions": {
                          "typeIdentifier": "t_array$_t_int256_$dyn_memory_ptr",
                          "typeString": "int256[] memory"
                        }
                      },
                      "id": 4482,
                      "indexExpression": {
                        "argumentTypes": null,
                        "id": 4481,
                        "name": "buyTokenIndex",
                        "nodeType": "Identifier",
                        "overloadedDeclarations": [],
                        "referencedDeclaration": 4467,
                        "src": "1861:13:6",
                        "typeDescriptions": {
                          "typeIdentifier": "t_uint256",
                          "typeString": "uint256"
                        }
                      },
                      "isConstant": false,
                      "isLValue": true,
                      "isPure": false,
                      "lValueRequested": true,
                      "nodeType": "IndexAccess",
                      "src": "1856:19:6",
                      "typeDescriptions": {
                        "typeIdentifier": "t_int256",
                        "typeString": "int256"
                      }
                    },
                    "nodeType": "Assignment",
                    "operator": "=",
                    "rightHandSide": {
                      "argumentTypes": null,
                      "arguments": [
                        {
                          "argumentTypes": null,
                          "arguments": [
                            {
                              "argumentTypes": null,
                              "id": 4488,
                              "name": "buyAmount",
                              "nodeType": "Identifier",
                              "overloadedDeclarations": [],
                              "referencedDeclaration": 4461,
                              "src": "1909:9:6",
                              "typeDescriptions": {
                                "typeIdentifier": "t_uint128",
                                "typeString": "uint128"
                              }
                            }
                          ],
                          "expression": {
                            "argumentTypes": [
                              {
                                "typeIdentifier": "t_uint128",
                                "typeString": "uint128"
                              }
                            ],
                            "id": 4487,
                            "isConstant": false,
                            "isLValue": false,
                            "isPure": true,
                            "lValueRequested": false,
                            "nodeType": "ElementaryTypeNameExpression",
                            "src": "1902:6:6",
                            "typeDescriptions": {
                              "typeIdentifier": "t_type$_t_int256_$",
                              "typeString": "type(int256)"
                            },
                            "typeName": "int256"
                          },
                          "id": 4489,
                          "isConstant": false,
                          "isLValue": false,
                          "isPure": false,
                          "kind": "typeConversion",
                          "lValueRequested": false,
                          "names": [],
                          "nodeType": "FunctionCall",
                          "src": "1902:17:6",
                          "typeDescriptions": {
                            "typeIdentifier": "t_int256",
                            "typeString": "int256"
                          }
                        }
                      ],
                      "expression": {
                        "argumentTypes": [
                          {
                            "typeIdentifier": "t_int256",
                            "typeString": "int256"
                          }
                        ],
                        "expression": {
                          "argumentTypes": null,
                          "baseExpression": {
                            "argumentTypes": null,
                            "id": 4483,
                            "name": "self",
                            "nodeType": "Identifier",
                            "overloadedDeclarations": [],
                            "referencedDeclaration": 4452,
                            "src": "1878:4:6",
                            "typeDescriptions": {
                              "typeIdentifier": "t_array$_t_int256_$dyn_memory_ptr",
                              "typeString": "int256[] memory"
                            }
                          },
                          "id": 4485,
                          "indexExpression": {
                            "argumentTypes": null,
                            "id": 4484,
                            "name": "buyTokenIndex",
                            "nodeType": "Identifier",
                            "overloadedDeclarations": [],
                            "referencedDeclaration": 4467,
                            "src": "1883:13:6",
                            "typeDescriptions": {
                              "typeIdentifier": "t_uint256",
                              "typeString": "uint256"
                            }
                          },
                          "isConstant": false,
                          "isLValue": true,
                          "isPure": false,
                          "lValueRequested": false,
                          "nodeType": "IndexAccess",
                          "src": "1878:19:6",
                          "typeDescriptions": {
                            "typeIdentifier": "t_int256",
                            "typeString": "int256"
                          }
                        },
                        "id": 4486,
                        "isConstant": false,
                        "isLValue": false,
                        "isPure": false,
                        "lValueRequested": false,
                        "memberName": "sub",
                        "nodeType": "MemberAccess",
                        "referencedDeclaration": 8427,
                        "src": "1878:23:6",
                        "typeDescriptions": {
                          "typeIdentifier": "t_function_internal_pure$_t_int256_$_t_int256_$returns$_t_int256_$bound_to$_t_int256_$",
                          "typeString": "function (int256,int256) pure returns (int256)"
                        }
                      },
                      "id": 4490,
                      "isConstant": false,
                      "isLValue": false,
                      "isPure": false,
                      "kind": "functionCall",
                      "lValueRequested": false,
                      "names": [],
                      "nodeType": "FunctionCall",
                      "src": "1878:42:6",
                      "typeDescriptions": {
                        "typeIdentifier": "t_int256",
                        "typeString": "int256"
                      }
                    },
                    "src": "1856:64:6",
                    "typeDescriptions": {
                      "typeIdentifier": "t_int256",
                      "typeString": "int256"
                    }
                  },
                  "id": 4492,
                  "nodeType": "ExpressionStatement",
                  "src": "1856:64:6"
                },
                {
                  "expression": {
                    "argumentTypes": null,
                    "id": 4504,
                    "isConstant": false,
                    "isLValue": false,
                    "isPure": false,
                    "lValueRequested": false,
                    "leftHandSide": {
                      "argumentTypes": null,
                      "baseExpression": {
                        "argumentTypes": null,
                        "id": 4493,
                        "name": "self",
                        "nodeType": "Identifier",
                        "overloadedDeclarations": [],
                        "referencedDeclaration": 4452,
                        "src": "1930:4:6",
                        "typeDescriptions": {
                          "typeIdentifier": "t_array$_t_int256_$dyn_memory_ptr",
                          "typeString": "int256[] memory"
                        }
                      },
                      "id": 4495,
                      "indexExpression": {
                        "argumentTypes": null,
                        "id": 4494,
                        "name": "sellTokenIndex",
                        "nodeType": "Identifier",
                        "overloadedDeclarations": [],
                        "referencedDeclaration": 4474,
                        "src": "1935:14:6",
                        "typeDescriptions": {
                          "typeIdentifier": "t_uint256",
                          "typeString": "uint256"
                        }
                      },
                      "isConstant": false,
                      "isLValue": true,
                      "isPure": false,
                      "lValueRequested": true,
                      "nodeType": "IndexAccess",
                      "src": "1930:20:6",
                      "typeDescriptions": {
                        "typeIdentifier": "t_int256",
                        "typeString": "int256"
                      }
                    },
                    "nodeType": "Assignment",
                    "operator": "=",
                    "rightHandSide": {
                      "argumentTypes": null,
                      "arguments": [
                        {
                          "argumentTypes": null,
                          "arguments": [
                            {
                              "argumentTypes": null,
                              "id": 4501,
                              "name": "sellAmount",
                              "nodeType": "Identifier",
                              "overloadedDeclarations": [],
                              "referencedDeclaration": 4463,
                              "src": "1985:10:6",
                              "typeDescriptions": {
                                "typeIdentifier": "t_uint128",
                                "typeString": "uint128"
                              }
                            }
                          ],
                          "expression": {
                            "argumentTypes": [
                              {
                                "typeIdentifier": "t_uint128",
                                "typeString": "uint128"
                              }
                            ],
                            "id": 4500,
                            "isConstant": false,
                            "isLValue": false,
                            "isPure": true,
                            "lValueRequested": false,
                            "nodeType": "ElementaryTypeNameExpression",
                            "src": "1978:6:6",
                            "typeDescriptions": {
                              "typeIdentifier": "t_type$_t_int256_$",
                              "typeString": "type(int256)"
                            },
                            "typeName": "int256"
                          },
                          "id": 4502,
                          "isConstant": false,
                          "isLValue": false,
                          "isPure": false,
                          "kind": "typeConversion",
                          "lValueRequested": false,
                          "names": [],
                          "nodeType": "FunctionCall",
                          "src": "1978:18:6",
                          "typeDescriptions": {
                            "typeIdentifier": "t_int256",
                            "typeString": "int256"
                          }
                        }
                      ],
                      "expression": {
                        "argumentTypes": [
                          {
                            "typeIdentifier": "t_int256",
                            "typeString": "int256"
                          }
                        ],
                        "expression": {
                          "argumentTypes": null,
                          "baseExpression": {
                            "argumentTypes": null,
                            "id": 4496,
                            "name": "self",
                            "nodeType": "Identifier",
                            "overloadedDeclarations": [],
                            "referencedDeclaration": 4452,
                            "src": "1953:4:6",
                            "typeDescriptions": {
                              "typeIdentifier": "t_array$_t_int256_$dyn_memory_ptr",
                              "typeString": "int256[] memory"
                            }
                          },
                          "id": 4498,
                          "indexExpression": {
                            "argumentTypes": null,
                            "id": 4497,
                            "name": "sellTokenIndex",
                            "nodeType": "Identifier",
                            "overloadedDeclarations": [],
                            "referencedDeclaration": 4474,
                            "src": "1958:14:6",
                            "typeDescriptions": {
                              "typeIdentifier": "t_uint256",
                              "typeString": "uint256"
                            }
                          },
                          "isConstant": false,
                          "isLValue": true,
                          "isPure": false,
                          "lValueRequested": false,
                          "nodeType": "IndexAccess",
                          "src": "1953:20:6",
                          "typeDescriptions": {
                            "typeIdentifier": "t_int256",
                            "typeString": "int256"
                          }
                        },
                        "id": 4499,
                        "isConstant": false,
                        "isLValue": false,
                        "isPure": false,
                        "lValueRequested": false,
                        "memberName": "add",
                        "nodeType": "MemberAccess",
                        "referencedDeclaration": 8466,
                        "src": "1953:24:6",
                        "typeDescriptions": {
                          "typeIdentifier": "t_function_internal_pure$_t_int256_$_t_int256_$returns$_t_int256_$bound_to$_t_int256_$",
                          "typeString": "function (int256,int256) pure returns (int256)"
                        }
                      },
                      "id": 4503,
                      "isConstant": false,
                      "isLValue": false,
                      "isPure": false,
                      "kind": "functionCall",
                      "lValueRequested": false,
                      "names": [],
                      "nodeType": "FunctionCall",
                      "src": "1953:44:6",
                      "typeDescriptions": {
                        "typeIdentifier": "t_int256",
                        "typeString": "int256"
                      }
                    },
                    "src": "1930:67:6",
                    "typeDescriptions": {
                      "typeIdentifier": "t_int256",
                      "typeString": "int256"
                    }
                  },
                  "id": 4505,
                  "nodeType": "ExpressionStatement",
                  "src": "1930:67:6"
                }
              ]
            },
            "documentation": "@dev updated token conservation array.\n@param self internal datastructure created by TokenConservation.init()\n@param buyToken id of token whose imbalance should be subtracted from\n@param sellToken id of token whose imbalance should be added to\n@param tokenIdsForPrice sorted list of tokenIds\n@param buyAmount amount to be subtracted at `self[buyTokenIndex]`\n@param sellAmount amount to be added at `self[sellTokenIndex]`",
            "id": 4507,
            "implemented": true,
            "kind": "function",
            "modifiers": [],
            "name": "updateTokenConservation",
            "nodeType": "FunctionDefinition",
            "parameters": {
              "id": 4464,
              "nodeType": "ParameterList",
              "parameters": [
                {
                  "constant": false,
                  "id": 4452,
                  "name": "self",
                  "nodeType": "VariableDeclaration",
                  "scope": 4507,
                  "src": "1503:20:6",
                  "stateVariable": false,
                  "storageLocation": "memory",
                  "typeDescriptions": {
                    "typeIdentifier": "t_array$_t_int256_$dyn_memory_ptr",
                    "typeString": "int256[]"
                  },
                  "typeName": {
                    "baseType": {
                      "id": 4450,
                      "name": "int256",
                      "nodeType": "ElementaryTypeName",
                      "src": "1503:6:6",
                      "typeDescriptions": {
                        "typeIdentifier": "t_int256",
                        "typeString": "int256"
                      }
                    },
                    "id": 4451,
                    "length": null,
                    "nodeType": "ArrayTypeName",
                    "src": "1503:8:6",
                    "typeDescriptions": {
                      "typeIdentifier": "t_array$_t_int256_$dyn_storage_ptr",
                      "typeString": "int256[]"
                    }
                  },
                  "value": null,
                  "visibility": "internal"
                },
                {
                  "constant": false,
                  "id": 4454,
                  "name": "buyToken",
                  "nodeType": "VariableDeclaration",
                  "scope": 4507,
                  "src": "1533:15:6",
                  "stateVariable": false,
                  "storageLocation": "default",
                  "typeDescriptions": {
                    "typeIdentifier": "t_uint16",
                    "typeString": "uint16"
                  },
                  "typeName": {
                    "id": 4453,
                    "name": "uint16",
                    "nodeType": "ElementaryTypeName",
                    "src": "1533:6:6",
                    "typeDescriptions": {
                      "typeIdentifier": "t_uint16",
                      "typeString": "uint16"
                    }
                  },
                  "value": null,
                  "visibility": "internal"
                },
                {
                  "constant": false,
                  "id": 4456,
                  "name": "sellToken",
                  "nodeType": "VariableDeclaration",
                  "scope": 4507,
                  "src": "1558:16:6",
                  "stateVariable": false,
                  "storageLocation": "default",
                  "typeDescriptions": {
                    "typeIdentifier": "t_uint16",
                    "typeString": "uint16"
                  },
                  "typeName": {
                    "id": 4455,
                    "name": "uint16",
                    "nodeType": "ElementaryTypeName",
                    "src": "1558:6:6",
                    "typeDescriptions": {
                      "typeIdentifier": "t_uint16",
                      "typeString": "uint16"
                    }
                  },
                  "value": null,
                  "visibility": "internal"
                },
                {
                  "constant": false,
                  "id": 4459,
                  "name": "tokenIdsForPrice",
                  "nodeType": "VariableDeclaration",
                  "scope": 4507,
                  "src": "1584:32:6",
                  "stateVariable": false,
                  "storageLocation": "memory",
                  "typeDescriptions": {
                    "typeIdentifier": "t_array$_t_uint16_$dyn_memory_ptr",
                    "typeString": "uint16[]"
                  },
                  "typeName": {
                    "baseType": {
                      "id": 4457,
                      "name": "uint16",
                      "nodeType": "ElementaryTypeName",
                      "src": "1584:6:6",
                      "typeDescriptions": {
                        "typeIdentifier": "t_uint16",
                        "typeString": "uint16"
                      }
                    },
                    "id": 4458,
                    "length": null,
                    "nodeType": "ArrayTypeName",
                    "src": "1584:8:6",
                    "typeDescriptions": {
                      "typeIdentifier": "t_array$_t_uint16_$dyn_storage_ptr",
                      "typeString": "uint16[]"
                    }
                  },
                  "value": null,
                  "visibility": "internal"
                },
                {
                  "constant": false,
                  "id": 4461,
                  "name": "buyAmount",
                  "nodeType": "VariableDeclaration",
                  "scope": 4507,
                  "src": "1626:17:6",
                  "stateVariable": false,
                  "storageLocation": "default",
                  "typeDescriptions": {
                    "typeIdentifier": "t_uint128",
                    "typeString": "uint128"
                  },
                  "typeName": {
                    "id": 4460,
                    "name": "uint128",
                    "nodeType": "ElementaryTypeName",
                    "src": "1626:7:6",
                    "typeDescriptions": {
                      "typeIdentifier": "t_uint128",
                      "typeString": "uint128"
                    }
                  },
                  "value": null,
                  "visibility": "internal"
                },
                {
                  "constant": false,
                  "id": 4463,
                  "name": "sellAmount",
                  "nodeType": "VariableDeclaration",
                  "scope": 4507,
                  "src": "1653:18:6",
                  "stateVariable": false,
                  "storageLocation": "default",
                  "typeDescriptions": {
                    "typeIdentifier": "t_uint128",
                    "typeString": "uint128"
                  },
                  "typeName": {
                    "id": 4462,
                    "name": "uint128",
                    "nodeType": "ElementaryTypeName",
                    "src": "1653:7:6",
                    "typeDescriptions": {
                      "typeIdentifier": "t_uint128",
                      "typeString": "uint128"
                    }
                  },
                  "value": null,
                  "visibility": "internal"
                }
              ],
              "src": "1493:184:6"
            },
            "returnParameters": {
              "id": 4465,
              "nodeType": "ParameterList",
              "parameters": [],
              "src": "1692:0:6"
            },
            "scope": 4661,
            "src": "1461:543:6",
            "stateMutability": "pure",
            "superFunction": null,
            "visibility": "internal"
          },
          {
            "body": {
              "id": 4544,
              "nodeType": "Block",
              "src": "2307:215:6",
              "statements": [
                {
                  "expression": {
                    "argumentTypes": null,
                    "arguments": [
                      {
                        "argumentTypes": null,
                        "commonType": {
                          "typeIdentifier": "t_int256",
                          "typeString": "int256"
                        },
                        "id": 4518,
                        "isConstant": false,
                        "isLValue": false,
                        "isPure": false,
                        "lValueRequested": false,
                        "leftExpression": {
                          "argumentTypes": null,
                          "baseExpression": {
                            "argumentTypes": null,
                            "id": 4514,
                            "name": "self",
                            "nodeType": "Identifier",
                            "overloadedDeclarations": [],
                            "referencedDeclaration": 4510,
                            "src": "2325:4:6",
                            "typeDescriptions": {
                              "typeIdentifier": "t_array$_t_int256_$dyn_memory_ptr",
                              "typeString": "int256[] memory"
                            }
                          },
                          "id": 4516,
                          "indexExpression": {
                            "argumentTypes": null,
                            "hexValue": "30",
                            "id": 4515,
                            "isConstant": false,
                            "isLValue": false,
                            "isPure": true,
                            "kind": "number",
                            "lValueRequested": false,
                            "nodeType": "Literal",
                            "src": "2330:1:6",
                            "subdenomination": null,
                            "typeDescriptions": {
                              "typeIdentifier": "t_rational_0_by_1",
                              "typeString": "int_const 0"
                            },
                            "value": "0"
                          },
                          "isConstant": false,
                          "isLValue": true,
                          "isPure": false,
                          "lValueRequested": false,
                          "nodeType": "IndexAccess",
                          "src": "2325:7:6",
                          "typeDescriptions": {
                            "typeIdentifier": "t_int256",
                            "typeString": "int256"
                          }
                        },
                        "nodeType": "BinaryOperation",
                        "operator": ">",
                        "rightExpression": {
                          "argumentTypes": null,
                          "hexValue": "30",
                          "id": 4517,
                          "isConstant": false,
                          "isLValue": false,
                          "isPure": true,
                          "kind": "number",
                          "lValueRequested": false,
                          "nodeType": "Literal",
                          "src": "2335:1:6",
                          "subdenomination": null,
                          "typeDescriptions": {
                            "typeIdentifier": "t_rational_0_by_1",
                            "typeString": "int_const 0"
                          },
                          "value": "0"
                        },
                        "src": "2325:11:6",
                        "typeDescriptions": {
                          "typeIdentifier": "t_bool",
                          "typeString": "bool"
                        }
                      },
                      {
                        "argumentTypes": null,
                        "hexValue": "546f6b656e20636f6e736572766174696f6e2061742030206d75737420626520706f7369746976652e",
                        "id": 4519,
                        "isConstant": false,
                        "isLValue": false,
                        "isPure": true,
                        "kind": "string",
                        "lValueRequested": false,
                        "nodeType": "Literal",
                        "src": "2338:43:6",
                        "subdenomination": null,
                        "typeDescriptions": {
                          "typeIdentifier": "t_stringliteral_baf0373ca4917baaa5c52df2e8be013170c18496ed2df4561965764b8bb6695e",
                          "typeString": "literal_string \"Token conservation at 0 must be positive.\""
                        },
                        "value": "Token conservation at 0 must be positive."
                      }
                    ],
                    "expression": {
                      "argumentTypes": [
                        {
                          "typeIdentifier": "t_bool",
                          "typeString": "bool"
                        },
                        {
                          "typeIdentifier": "t_stringliteral_baf0373ca4917baaa5c52df2e8be013170c18496ed2df4561965764b8bb6695e",
                          "typeString": "literal_string \"Token conservation at 0 must be positive.\""
                        }
                      ],
                      "id": 4513,
                      "name": "require",
                      "nodeType": "Identifier",
                      "overloadedDeclarations": [
                        10245,
                        10246
                      ],
                      "referencedDeclaration": 10246,
                      "src": "2317:7:6",
                      "typeDescriptions": {
                        "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
                        "typeString": "function (bool,string memory) pure"
                      }
                    },
                    "id": 4520,
                    "isConstant": false,
                    "isLValue": false,
                    "isPure": false,
                    "kind": "functionCall",
                    "lValueRequested": false,
                    "names": [],
                    "nodeType": "FunctionCall",
                    "src": "2317:65:6",
                    "typeDescriptions": {
                      "typeIdentifier": "t_tuple$__$",
                      "typeString": "tuple()"
                    }
                  },
                  "id": 4521,
                  "nodeType": "ExpressionStatement",
                  "src": "2317:65:6"
                },
                {
                  "body": {
                    "id": 4542,
                    "nodeType": "Block",
                    "src": "2434:82:6",
                    "statements": [
                      {
                        "expression": {
                          "argumentTypes": null,
                          "arguments": [
                            {
                              "argumentTypes": null,
                              "commonType": {
                                "typeIdentifier": "t_int256",
                                "typeString": "int256"
                              },
                              "id": 4538,
                              "isConstant": false,
                              "isLValue": false,
                              "isPure": false,
                              "lValueRequested": false,
                              "leftExpression": {
                                "argumentTypes": null,
                                "baseExpression": {
                                  "argumentTypes": null,
                                  "id": 4534,
                                  "name": "self",
                                  "nodeType": "Identifier",
                                  "overloadedDeclarations": [],
                                  "referencedDeclaration": 4510,
                                  "src": "2456:4:6",
                                  "typeDescriptions": {
                                    "typeIdentifier": "t_array$_t_int256_$dyn_memory_ptr",
                                    "typeString": "int256[] memory"
                                  }
                                },
                                "id": 4536,
                                "indexExpression": {
                                  "argumentTypes": null,
                                  "id": 4535,
                                  "name": "i",
                                  "nodeType": "Identifier",
                                  "overloadedDeclarations": [],
                                  "referencedDeclaration": 4523,
                                  "src": "2461:1:6",
                                  "typeDescriptions": {
                                    "typeIdentifier": "t_uint256",
                                    "typeString": "uint256"
                                  }
                                },
                                "isConstant": false,
                                "isLValue": true,
                                "isPure": false,
                                "lValueRequested": false,
                                "nodeType": "IndexAccess",
                                "src": "2456:7:6",
                                "typeDescriptions": {
                                  "typeIdentifier": "t_int256",
                                  "typeString": "int256"
                                }
                              },
                              "nodeType": "BinaryOperation",
                              "operator": "==",
                              "rightExpression": {
                                "argumentTypes": null,
                                "hexValue": "30",
                                "id": 4537,
                                "isConstant": false,
                                "isLValue": false,
                                "isPure": true,
                                "kind": "number",
                                "lValueRequested": false,
                                "nodeType": "Literal",
                                "src": "2467:1:6",
                                "subdenomination": null,
                                "typeDescriptions": {
                                  "typeIdentifier": "t_rational_0_by_1",
                                  "typeString": "int_const 0"
                                },
                                "value": "0"
                              },
                              "src": "2456:12:6",
                              "typeDescriptions": {
                                "typeIdentifier": "t_bool",
                                "typeString": "bool"
                              }
                            },
                            {
                              "argumentTypes": null,
                              "hexValue": "546f6b656e20636f6e736572766174696f6e20646f6573206e6f7420686f6c64",
                              "id": 4539,
                              "isConstant": false,
                              "isLValue": false,
                              "isPure": true,
                              "kind": "string",
                              "lValueRequested": false,
                              "nodeType": "Literal",
                              "src": "2470:34:6",
                              "subdenomination": null,
                              "typeDescriptions": {
                                "typeIdentifier": "t_stringliteral_0ed36d7851ed9ad33db7d5fcf39e87071ba37c4a77c4bbbb02de703beb5dd66a",
                                "typeString": "literal_string \"Token conservation does not hold\""
                              },
                              "value": "Token conservation does not hold"
                            }
                          ],
                          "expression": {
                            "argumentTypes": [
                              {
                                "typeIdentifier": "t_bool",
                                "typeString": "bool"
                              },
                              {
                                "typeIdentifier": "t_stringliteral_0ed36d7851ed9ad33db7d5fcf39e87071ba37c4a77c4bbbb02de703beb5dd66a",
                                "typeString": "literal_string \"Token conservation does not hold\""
                              }
                            ],
                            "id": 4533,
                            "name": "require",
                            "nodeType": "Identifier",
                            "overloadedDeclarations": [
                              10245,
                              10246
                            ],
                            "referencedDeclaration": 10246,
                            "src": "2448:7:6",
                            "typeDescriptions": {
                              "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
                              "typeString": "function (bool,string memory) pure"
                            }
                          },
                          "id": 4540,
                          "isConstant": false,
                          "isLValue": false,
                          "isPure": false,
                          "kind": "functionCall",
                          "lValueRequested": false,
                          "names": [],
                          "nodeType": "FunctionCall",
                          "src": "2448:57:6",
                          "typeDescriptions": {
                            "typeIdentifier": "t_tuple$__$",
                            "typeString": "tuple()"
                          }
                        },
                        "id": 4541,
                        "nodeType": "ExpressionStatement",
                        "src": "2448:57:6"
                      }
                    ]
                  },
                  "condition": {
                    "argumentTypes": null,
                    "commonType": {
                      "typeIdentifier": "t_uint256",
                      "typeString": "uint256"
                    },
                    "id": 4529,
                    "isConstant": false,
                    "isLValue": false,
                    "isPure": false,
                    "lValueRequested": false,
                    "leftExpression": {
                      "argumentTypes": null,
                      "id": 4526,
                      "name": "i",
                      "nodeType": "Identifier",
                      "overloadedDeclarations": [],
                      "referencedDeclaration": 4523,
                      "src": "2412:1:6",
                      "typeDescriptions": {
                        "typeIdentifier": "t_uint256",
                        "typeString": "uint256"
                      }
                    },
                    "nodeType": "BinaryOperation",
                    "operator": "<",
                    "rightExpression": {
                      "argumentTypes": null,
                      "expression": {
                        "argumentTypes": null,
                        "id": 4527,
                        "name": "self",
                        "nodeType": "Identifier",
                        "overloadedDeclarations": [],
                        "referencedDeclaration": 4510,
                        "src": "2416:4:6",
                        "typeDescriptions": {
                          "typeIdentifier": "t_array$_t_int256_$dyn_memory_ptr",
                          "typeString": "int256[] memory"
                        }
                      },
                      "id": 4528,
                      "isConstant": false,
                      "isLValue": false,
                      "isPure": false,
                      "lValueRequested": false,
                      "memberName": "length",
                      "nodeType": "MemberAccess",
                      "referencedDeclaration": null,
                      "src": "2416:11:6",
                      "typeDescriptions": {
                        "typeIdentifier": "t_uint256",
                        "typeString": "uint256"
                      }
                    },
                    "src": "2412:15:6",
                    "typeDescriptions": {
                      "typeIdentifier": "t_bool",
                      "typeString": "bool"
                    }
                  },
                  "id": 4543,
                  "initializationExpression": {
                    "assignments": [
                      4523
                    ],
                    "declarations": [
                      {
                        "constant": false,
                        "id": 4523,
                        "name": "i",
                        "nodeType": "VariableDeclaration",
                        "scope": 4543,
                        "src": "2397:9:6",
                        "stateVariable": false,
                        "storageLocation": "default",
                        "typeDescriptions": {
                          "typeIdentifier": "t_uint256",
                          "typeString": "uint256"
                        },
                        "typeName": {
                          "id": 4522,
                          "name": "uint256",
                          "nodeType": "ElementaryTypeName",
                          "src": "2397:7:6",
                          "typeDescriptions": {
                            "typeIdentifier": "t_uint256",
                            "typeString": "uint256"
                          }
                        },
                        "value": null,
                        "visibility": "internal"
                      }
                    ],
                    "id": 4525,
                    "initialValue": {
                      "argumentTypes": null,
                      "hexValue": "31",
                      "id": 4524,
                      "isConstant": false,
                      "isLValue": false,
                      "isPure": true,
                      "kind": "number",
                      "lValueRequested": false,
                      "nodeType": "Literal",
                      "src": "2409:1:6",
                      "subdenomination": null,
                      "typeDescriptions": {
                        "typeIdentifier": "t_rational_1_by_1",
                        "typeString": "int_const 1"
                      },
                      "value": "1"
                    },
                    "nodeType": "VariableDeclarationStatement",
                    "src": "2397:13:6"
                  },
                  "loopExpression": {
                    "expression": {
                      "argumentTypes": null,
                      "id": 4531,
                      "isConstant": false,
                      "isLValue": false,
                      "isPure": false,
                      "lValueRequested": false,
                      "nodeType": "UnaryOperation",
                      "operator": "++",
                      "prefix": false,
                      "src": "2429:3:6",
                      "subExpression": {
                        "argumentTypes": null,
                        "id": 4530,
                        "name": "i",
                        "nodeType": "Identifier",
                        "overloadedDeclarations": [],
                        "referencedDeclaration": 4523,
                        "src": "2429:1:6",
                        "typeDescriptions": {
                          "typeIdentifier": "t_uint256",
                          "typeString": "uint256"
                        }
                      },
                      "typeDescriptions": {
                        "typeIdentifier": "t_uint256",
                        "typeString": "uint256"
                      }
                    },
                    "id": 4532,
                    "nodeType": "ExpressionStatement",
                    "src": "2429:3:6"
                  },
                  "nodeType": "ForStatement",
                  "src": "2392:124:6"
                }
              ]
            },
            "documentation": "@dev Ensures all array's elements are zero except the first.\n@param self internal datastructure created by TokenConservation.init()\n@return true if all, but first element of self are zero else false",
            "id": 4545,
            "implemented": true,
            "kind": "function",
            "modifiers": [],
            "name": "checkTokenConservation",
            "nodeType": "FunctionDefinition",
            "parameters": {
              "id": 4511,
              "nodeType": "ParameterList",
              "parameters": [
                {
                  "constant": false,
                  "id": 4510,
                  "name": "self",
                  "nodeType": "VariableDeclaration",
                  "scope": 4545,
                  "src": "2271:20:6",
                  "stateVariable": false,
                  "storageLocation": "memory",
                  "typeDescriptions": {
                    "typeIdentifier": "t_array$_t_int256_$dyn_memory_ptr",
                    "typeString": "int256[]"
                  },
                  "typeName": {
                    "baseType": {
                      "id": 4508,
                      "name": "int256",
                      "nodeType": "ElementaryTypeName",
                      "src": "2271:6:6",
                      "typeDescriptions": {
                        "typeIdentifier": "t_int256",
                        "typeString": "int256"
                      }
                    },
                    "id": 4509,
                    "length": null,
                    "nodeType": "ArrayTypeName",
                    "src": "2271:8:6",
                    "typeDescriptions": {
                      "typeIdentifier": "t_array$_t_int256_$dyn_storage_ptr",
                      "typeString": "int256[]"
                    }
                  },
                  "value": null,
                  "visibility": "internal"
                }
              ],
              "src": "2270:22:6"
            },
            "returnParameters": {
              "id": 4512,
              "nodeType": "ParameterList",
              "parameters": [],
              "src": "2307:0:6"
            },
            "scope": 4661,
            "src": "2239:283:6",
            "stateMutability": "pure",
            "superFunction": null,
            "visibility": "internal"
          },
          {
            "body": {
              "id": 4581,
              "nodeType": "Block",
              "src": "2855:212:6",
              "statements": [
                {
                  "body": {
                    "id": 4577,
                    "nodeType": "Block",
                    "src": "2919:121:6",
                    "statements": [
                      {
                        "condition": {
                          "argumentTypes": null,
                          "commonType": {
                            "typeIdentifier": "t_uint16",
                            "typeString": "uint16"
                          },
                          "id": 4572,
                          "isConstant": false,
                          "isLValue": false,
                          "isPure": false,
                          "lValueRequested": false,
                          "leftExpression": {
                            "argumentTypes": null,
                            "baseExpression": {
                              "argumentTypes": null,
                              "id": 4564,
                              "name": "tokenIdsForPrice",
                              "nodeType": "Identifier",
                              "overloadedDeclarations": [],
                              "referencedDeclaration": 4548,
                              "src": "2937:16:6",
                              "typeDescriptions": {
                                "typeIdentifier": "t_array$_t_uint16_$dyn_memory_ptr",
                                "typeString": "uint16[] memory"
                              }
                            },
                            "id": 4566,
                            "indexExpression": {
                              "argumentTypes": null,
                              "id": 4565,
                              "name": "i",
                              "nodeType": "Identifier",
                              "overloadedDeclarations": [],
                              "referencedDeclaration": 4554,
                              "src": "2954:1:6",
                              "typeDescriptions": {
                                "typeIdentifier": "t_uint256",
                                "typeString": "uint256"
                              }
                            },
                            "isConstant": false,
                            "isLValue": true,
                            "isPure": false,
                            "lValueRequested": false,
                            "nodeType": "IndexAccess",
                            "src": "2937:19:6",
                            "typeDescriptions": {
                              "typeIdentifier": "t_uint16",
                              "typeString": "uint16"
                            }
                          },
                          "nodeType": "BinaryOperation",
                          "operator": "<=",
                          "rightExpression": {
                            "argumentTypes": null,
                            "baseExpression": {
                              "argumentTypes": null,
                              "id": 4567,
                              "name": "tokenIdsForPrice",
                              "nodeType": "Identifier",
                              "overloadedDeclarations": [],
                              "referencedDeclaration": 4548,
                              "src": "2960:16:6",
                              "typeDescriptions": {
                                "typeIdentifier": "t_array$_t_uint16_$dyn_memory_ptr",
                                "typeString": "uint16[] memory"
                              }
                            },
                            "id": 4571,
                            "indexExpression": {
                              "argumentTypes": null,
                              "commonType": {
                                "typeIdentifier": "t_uint256",
                                "typeString": "uint256"
                              },
                              "id": 4570,
                              "isConstant": false,
                              "isLValue": false,
                              "isPure": false,
                              "lValueRequested": false,
                              "leftExpression": {
                                "argumentTypes": null,
                                "id": 4568,
                                "name": "i",
                                "nodeType": "Identifier",
                                "overloadedDeclarations": [],
                                "referencedDeclaration": 4554,
                                "src": "2977:1:6",
                                "typeDescriptions": {
                                  "typeIdentifier": "t_uint256",
                                  "typeString": "uint256"
                                }
                              },
                              "nodeType": "BinaryOperation",
                              "operator": "-",
                              "rightExpression": {
                                "argumentTypes": null,
                                "hexValue": "31",
                                "id": 4569,
                                "isConstant": false,
                                "isLValue": false,
                                "isPure": true,
                                "kind": "number",
                                "lValueRequested": false,
                                "nodeType": "Literal",
                                "src": "2981:1:6",
                                "subdenomination": null,
                                "typeDescriptions": {
                                  "typeIdentifier": "t_rational_1_by_1",
                                  "typeString": "int_const 1"
                                },
                                "value": "1"
                              },
                              "src": "2977:5:6",
                              "typeDescriptions": {
                                "typeIdentifier": "t_uint256",
                                "typeString": "uint256"
                              }
                            },
                            "isConstant": false,
                            "isLValue": true,
                            "isPure": false,
                            "lValueRequested": false,
                            "nodeType": "IndexAccess",
                            "src": "2960:23:6",
                            "typeDescriptions": {
                              "typeIdentifier": "t_uint16",
                              "typeString": "uint16"
                            }
                          },
                          "src": "2937:46:6",
                          "typeDescriptions": {
                            "typeIdentifier": "t_bool",
                            "typeString": "bool"
                          }
                        },
                        "falseBody": null,
                        "id": 4576,
                        "nodeType": "IfStatement",
                        "src": "2933:97:6",
                        "trueBody": {
                          "id": 4575,
                          "nodeType": "Block",
                          "src": "2985:45:6",
                          "statements": [
                            {
                              "expression": {
                                "argumentTypes": null,
                                "hexValue": "66616c7365",
                                "id": 4573,
                                "isConstant": false,
                                "isLValue": false,
                                "isPure": true,
                                "kind": "bool",
                                "lValueRequested": false,
                                "nodeType": "Literal",
                                "src": "3010:5:6",
                                "subdenomination": null,
                                "typeDescriptions": {
                                  "typeIdentifier": "t_bool",
                                  "typeString": "bool"
                                },
                                "value": "false"
                              },
                              "functionReturnParameters": 4552,
                              "id": 4574,
                              "nodeType": "Return",
                              "src": "3003:12:6"
                            }
                          ]
                        }
                      }
                    ]
                  },
                  "condition": {
                    "argumentTypes": null,
                    "commonType": {
                      "typeIdentifier": "t_uint256",
                      "typeString": "uint256"
                    },
                    "id": 4560,
                    "isConstant": false,
                    "isLValue": false,
                    "isPure": false,
                    "lValueRequested": false,
                    "leftExpression": {
                      "argumentTypes": null,
                      "id": 4557,
                      "name": "i",
                      "nodeType": "Identifier",
                      "overloadedDeclarations": [],
                      "referencedDeclaration": 4554,
                      "src": "2885:1:6",
                      "typeDescriptions": {
                        "typeIdentifier": "t_uint256",
                        "typeString": "uint256"
                      }
                    },
                    "nodeType": "BinaryOperation",
                    "operator": "<",
                    "rightExpression": {
                      "argumentTypes": null,
                      "expression": {
                        "argumentTypes": null,
                        "id": 4558,
                        "name": "tokenIdsForPrice",
                        "nodeType": "Identifier",
                        "overloadedDeclarations": [],
                        "referencedDeclaration": 4548,
                        "src": "2889:16:6",
                        "typeDescriptions": {
                          "typeIdentifier": "t_array$_t_uint16_$dyn_memory_ptr",
                          "typeString": "uint16[] memory"
                        }
                      },
                      "id": 4559,
                      "isConstant": false,
                      "isLValue": false,
                      "isPure": false,
                      "lValueRequested": false,
                      "memberName": "length",
                      "nodeType": "MemberAccess",
                      "referencedDeclaration": null,
                      "src": "2889:23:6",
                      "typeDescriptions": {
                        "typeIdentifier": "t_uint256",
                        "typeString": "uint256"
                      }
                    },
                    "src": "2885:27:6",
                    "typeDescriptions": {
                      "typeIdentifier": "t_bool",
                      "typeString": "bool"
                    }
                  },
                  "id": 4578,
                  "initializationExpression": {
                    "assignments": [
                      4554
                    ],
                    "declarations": [
                      {
                        "constant": false,
                        "id": 4554,
                        "name": "i",
                        "nodeType": "VariableDeclaration",
                        "scope": 4578,
                        "src": "2870:9:6",
                        "stateVariable": false,
                        "storageLocation": "default",
                        "typeDescriptions": {
                          "typeIdentifier": "t_uint256",
                          "typeString": "uint256"
                        },
                        "typeName": {
                          "id": 4553,
                          "name": "uint256",
                          "nodeType": "ElementaryTypeName",
                          "src": "2870:7:6",
                          "typeDescriptions": {
                            "typeIdentifier": "t_uint256",
                            "typeString": "uint256"
                          }
                        },
                        "value": null,
                        "visibility": "internal"
                      }
                    ],
                    "id": 4556,
                    "initialValue": {
                      "argumentTypes": null,
                      "hexValue": "31",
                      "id": 4555,
                      "isConstant": false,
                      "isLValue": false,
                      "isPure": true,
                      "kind": "number",
                      "lValueRequested": false,
                      "nodeType": "Literal",
                      "src": "2882:1:6",
                      "subdenomination": null,
                      "typeDescriptions": {
                        "typeIdentifier": "t_rational_1_by_1",
                        "typeString": "int_const 1"
                      },
                      "value": "1"
                    },
                    "nodeType": "VariableDeclarationStatement",
                    "src": "2870:13:6"
                  },
                  "loopExpression": {
                    "expression": {
                      "argumentTypes": null,
                      "id": 4562,
                      "isConstant": false,
                      "isLValue": false,
                      "isPure": false,
                      "lValueRequested": false,
                      "nodeType": "UnaryOperation",
                      "operator": "++",
                      "prefix": false,
                      "src": "2914:3:6",
                      "subExpression": {
                        "argumentTypes": null,
                        "id": 4561,
                        "name": "i",
                        "nodeType": "Identifier",
                        "overloadedDeclarations": [],
                        "referencedDeclaration": 4554,
                        "src": "2914:1:6",
                        "typeDescriptions": {
                          "typeIdentifier": "t_uint256",
                          "typeString": "uint256"
                        }
                      },
                      "typeDescriptions": {
                        "typeIdentifier": "t_uint256",
                        "typeString": "uint256"
                      }
                    },
                    "id": 4563,
                    "nodeType": "ExpressionStatement",
                    "src": "2914:3:6"
                  },
                  "nodeType": "ForStatement",
                  "src": "2865:175:6"
                },
                {
                  "expression": {
                    "argumentTypes": null,
                    "hexValue": "74727565",
                    "id": 4579,
                    "isConstant": false,
                    "isLValue": false,
                    "isPure": true,
                    "kind": "bool",
                    "lValueRequested": false,
                    "nodeType": "Literal",
                    "src": "3056:4:6",
                    "subdenomination": null,
                    "typeDescriptions": {
                      "typeIdentifier": "t_bool",
                      "typeString": "bool"
                    },
                    "value": "true"
                  },
                  "functionReturnParameters": 4552,
                  "id": 4580,
                  "nodeType": "Return",
                  "src": "3049:11:6"
                }
              ]
            },
            "documentation": "@dev Token ordering is verified by submitSolution. Required because binary search is used to fetch token info.\n@param tokenIdsForPrice list of tokenIds\n@return true if tokenIdsForPrice is sorted else false",
            "id": 4582,
            "implemented": true,
            "kind": "function",
            "modifiers": [],
            "name": "checkPriceOrdering",
            "nodeType": "FunctionDefinition",
            "parameters": {
              "id": 4549,
              "nodeType": "ParameterList",
              "parameters": [
                {
                  "constant": false,
                  "id": 4548,
                  "name": "tokenIdsForPrice",
                  "nodeType": "VariableDeclaration",
                  "scope": 4582,
                  "src": "2792:32:6",
                  "stateVariable": false,
                  "storageLocation": "memory",
                  "typeDescriptions": {
                    "typeIdentifier": "t_array$_t_uint16_$dyn_memory_ptr",
                    "typeString": "uint16[]"
                  },
                  "typeName": {
                    "baseType": {
                      "id": 4546,
                      "name": "uint16",
                      "nodeType": "ElementaryTypeName",
                      "src": "2792:6:6",
                      "typeDescriptions": {
                        "typeIdentifier": "t_uint16",
                        "typeString": "uint16"
                      }
                    },
                    "id": 4547,
                    "length": null,
                    "nodeType": "ArrayTypeName",
                    "src": "2792:8:6",
                    "typeDescriptions": {
                      "typeIdentifier": "t_array$_t_uint16_$dyn_storage_ptr",
                      "typeString": "uint16[]"
                    }
                  },
                  "value": null,
                  "visibility": "internal"
                }
              ],
              "src": "2791:34:6"
            },
            "returnParameters": {
              "id": 4552,
              "nodeType": "ParameterList",
              "parameters": [
                {
                  "constant": false,
                  "id": 4551,
                  "name": "",
                  "nodeType": "VariableDeclaration",
                  "scope": 4582,
                  "src": "2849:4:6",
                  "stateVariable": false,
                  "storageLocation": "default",
                  "typeDescriptions": {
                    "typeIdentifier": "t_bool",
                    "typeString": "bool"
                  },
                  "typeName": {
                    "id": 4550,
                    "name": "bool",
                    "nodeType": "ElementaryTypeName",
                    "src": "2849:4:6",
                    "typeDescriptions": {
                      "typeIdentifier": "t_bool",
                      "typeString": "bool"
                    }
                  },
                  "value": null,
                  "visibility": "internal"
                }
              ],
              "src": "2848:6:6"
            },
            "scope": 4661,
            "src": "2764:303:6",
            "stateMutability": "pure",
            "superFunction": null,
            "visibility": "internal"
          },
          {
            "body": {
              "id": 4659,
              "nodeType": "Block",
              "src": "3506:795:6",
              "statements": [
                {
                  "condition": {
                    "argumentTypes": null,
                    "commonType": {
                      "typeIdentifier": "t_uint16",
                      "typeString": "uint16"
                    },
                    "id": 4594,
                    "isConstant": false,
                    "isLValue": false,
                    "isPure": false,
                    "lValueRequested": false,
                    "leftExpression": {
                      "argumentTypes": null,
                      "id": 4592,
                      "name": "tokenId",
                      "nodeType": "Identifier",
                      "overloadedDeclarations": [],
                      "referencedDeclaration": 4584,
                      "src": "3577:7:6",
                      "typeDescriptions": {
                        "typeIdentifier": "t_uint16",
                        "typeString": "uint16"
                      }
                    },
                    "nodeType": "BinaryOperation",
                    "operator": "==",
                    "rightExpression": {
                      "argumentTypes": null,
                      "hexValue": "30",
                      "id": 4593,
                      "isConstant": false,
                      "isLValue": false,
                      "isPure": true,
                      "kind": "number",
                      "lValueRequested": false,
                      "nodeType": "Literal",
                      "src": "3588:1:6",
                      "subdenomination": null,
                      "typeDescriptions": {
                        "typeIdentifier": "t_rational_0_by_1",
                        "typeString": "int_const 0"
                      },
                      "value": "0"
                    },
                    "src": "3577:12:6",
                    "typeDescriptions": {
                      "typeIdentifier": "t_bool",
                      "typeString": "bool"
                    }
                  },
                  "falseBody": null,
                  "id": 4598,
                  "nodeType": "IfStatement",
                  "src": "3573:51:6",
                  "trueBody": {
                    "id": 4597,
                    "nodeType": "Block",
                    "src": "3591:33:6",
                    "statements": [
                      {
                        "expression": {
                          "argumentTypes": null,
                          "hexValue": "30",
                          "id": 4595,
                          "isConstant": false,
                          "isLValue": false,
                          "isPure": true,
                          "kind": "number",
                          "lValueRequested": false,
                          "nodeType": "Literal",
                          "src": "3612:1:6",
                          "subdenomination": null,
                          "typeDescriptions": {
                            "typeIdentifier": "t_rational_0_by_1",
                            "typeString": "int_const 0"
                          },
                          "value": "0"
                        },
                        "functionReturnParameters": 4591,
                        "id": 4596,
                        "nodeType": "Return",
                        "src": "3605:8:6"
                      }
                    ]
                  }
                },
                {
                  "assignments": [
                    4600
                  ],
                  "declarations": [
                    {
                      "constant": false,
                      "id": 4600,
                      "name": "leftValue",
                      "nodeType": "VariableDeclaration",
                      "scope": 4659,
                      "src": "3679:17:6",
                      "stateVariable": false,
                      "storageLocation": "default",
                      "typeDescriptions": {
                        "typeIdentifier": "t_uint256",
                        "typeString": "uint256"
                      },
                      "typeName": {
                        "id": 4599,
                        "name": "uint256",
                        "nodeType": "ElementaryTypeName",
                        "src": "3679:7:6",
                        "typeDescriptions": {
                          "typeIdentifier": "t_uint256",
                          "typeString": "uint256"
                        }
                      },
                      "value": null,
                      "visibility": "internal"
                    }
                  ],
                  "id": 4602,
                  "initialValue": {
                    "argumentTypes": null,
                    "hexValue": "30",
                    "id": 4601,
                    "isConstant": false,
                    "isLValue": false,
                    "isPure": true,
                    "kind": "number",
                    "lValueRequested": false,
                    "nodeType": "Literal",
                    "src": "3699:1:6",
                    "subdenomination": null,
                    "typeDescriptions": {
                      "typeIdentifier": "t_rational_0_by_1",
                      "typeString": "int_const 0"
                    },
                    "value": "0"
                  },
                  "nodeType": "VariableDeclarationStatement",
                  "src": "3679:21:6"
                },
                {
                  "assignments": [
                    4604
                  ],
                  "declarations": [
                    {
                      "constant": false,
                      "id": 4604,
                      "name": "rightValue",
                      "nodeType": "VariableDeclaration",
                      "scope": 4659,
                      "src": "3710:18:6",
                      "stateVariable": false,
                      "storageLocation": "default",
                      "typeDescriptions": {
                        "typeIdentifier": "t_uint256",
                        "typeString": "uint256"
                      },
                      "typeName": {
                        "id": 4603,
                        "name": "uint256",
                        "nodeType": "ElementaryTypeName",
                        "src": "3710:7:6",
                        "typeDescriptions": {
                          "typeIdentifier": "t_uint256",
                          "typeString": "uint256"
                        }
                      },
                      "value": null,
                      "visibility": "internal"
                    }
                  ],
                  "id": 4609,
                  "initialValue": {
                    "argumentTypes": null,
                    "commonType": {
                      "typeIdentifier": "t_uint256",
                      "typeString": "uint256"
                    },
                    "id": 4608,
                    "isConstant": false,
                    "isLValue": false,
                    "isPure": false,
                    "lValueRequested": false,
                    "leftExpression": {
                      "argumentTypes": null,
                      "expression": {
                        "argumentTypes": null,
                        "id": 4605,
                        "name": "tokenIdsForPrice",
                        "nodeType": "Identifier",
                        "overloadedDeclarations": [],
                        "referencedDeclaration": 4587,
                        "src": "3731:16:6",
                        "typeDescriptions": {
                          "typeIdentifier": "t_array$_t_uint16_$dyn_memory_ptr",
                          "typeString": "uint16[] memory"
                        }
                      },
                      "id": 4606,
                      "isConstant": false,
                      "isLValue": false,
                      "isPure": false,
                      "lValueRequested": false,
                      "memberName": "length",
                      "nodeType": "MemberAccess",
                      "referencedDeclaration": null,
                      "src": "3731:23:6",
                      "typeDescriptions": {
                        "typeIdentifier": "t_uint256",
                        "typeString": "uint256"
                      }
                    },
                    "nodeType": "BinaryOperation",
                    "operator": "-",
                    "rightExpression": {
                      "argumentTypes": null,
                      "hexValue": "31",
                      "id": 4607,
                      "isConstant": false,
                      "isLValue": false,
                      "isPure": true,
                      "kind": "number",
                      "lValueRequested": false,
                      "nodeType": "Literal",
                      "src": "3757:1:6",
                      "subdenomination": null,
                      "typeDescriptions": {
                        "typeIdentifier": "t_rational_1_by_1",
                        "typeString": "int_const 1"
                      },
                      "value": "1"
                    },
                    "src": "3731:27:6",
                    "typeDescriptions": {
                      "typeIdentifier": "t_uint256",
                      "typeString": "uint256"
                    }
                  },
                  "nodeType": "VariableDeclarationStatement",
                  "src": "3710:48:6"
                },
                {
                  "body": {
                    "id": 4653,
                    "nodeType": "Block",
                    "src": "3800:447:6",
                    "statements": [
                      {
                        "assignments": [
                          4614
                        ],
                        "declarations": [
                          {
                            "constant": false,
                            "id": 4614,
                            "name": "middleValue",
                            "nodeType": "VariableDeclaration",
                            "scope": 4653,
                            "src": "3814:19:6",
                            "stateVariable": false,
                            "storageLocation": "default",
                            "typeDescriptions": {
                              "typeIdentifier": "t_uint256",
                              "typeString": "uint256"
                            },
                            "typeName": {
                              "id": 4613,
                              "name": "uint256",
                              "nodeType": "ElementaryTypeName",
                              "src": "3814:7:6",
                              "typeDescriptions": {
                                "typeIdentifier": "t_uint256",
                                "typeString": "uint256"
                              }
                            },
                            "value": null,
                            "visibility": "internal"
                          }
                        ],
                        "id": 4621,
                        "initialValue": {
                          "argumentTypes": null,
                          "commonType": {
                            "typeIdentifier": "t_uint256",
                            "typeString": "uint256"
                          },
                          "id": 4620,
                          "isConstant": false,
                          "isLValue": false,
                          "isPure": false,
                          "lValueRequested": false,
                          "leftExpression": {
                            "argumentTypes": null,
                            "components": [
                              {
                                "argumentTypes": null,
                                "commonType": {
                                  "typeIdentifier": "t_uint256",
                                  "typeString": "uint256"
                                },
                                "id": 4617,
                                "isConstant": false,
                                "isLValue": false,
                                "isPure": false,
                                "lValueRequested": false,
                                "leftExpression": {
                                  "argumentTypes": null,
                                  "id": 4615,
                                  "name": "leftValue",
                                  "nodeType": "Identifier",
                                  "overloadedDeclarations": [],
                                  "referencedDeclaration": 4600,
                                  "src": "3837:9:6",
                                  "typeDescriptions": {
                                    "typeIdentifier": "t_uint256",
                                    "typeString": "uint256"
                                  }
                                },
                                "nodeType": "BinaryOperation",
                                "operator": "+",
                                "rightExpression": {
                                  "argumentTypes": null,
                                  "id": 4616,
                                  "name": "rightValue",
                                  "nodeType": "Identifier",
                                  "overloadedDeclarations": [],
                                  "referencedDeclaration": 4604,
                                  "src": "3849:10:6",
                                  "typeDescriptions": {
                                    "typeIdentifier": "t_uint256",
                                    "typeString": "uint256"
                                  }
                                },
                                "src": "3837:22:6",
                                "typeDescriptions": {
                                  "typeIdentifier": "t_uint256",
                                  "typeString": "uint256"
                                }
                              }
                            ],
                            "id": 4618,
                            "isConstant": false,
                            "isInlineArray": false,
                            "isLValue": false,
                            "isPure": false,
                            "lValueRequested": false,
                            "nodeType": "TupleExpression",
                            "src": "3836:24:6",
                            "typeDescriptions": {
                              "typeIdentifier": "t_uint256",
                              "typeString": "uint256"
                            }
                          },
                          "nodeType": "BinaryOperation",
                          "operator": "/",
                          "rightExpression": {
                            "argumentTypes": null,
                            "hexValue": "32",
                            "id": 4619,
                            "isConstant": false,
                            "isLValue": false,
                            "isPure": true,
                            "kind": "number",
                            "lValueRequested": false,
                            "nodeType": "Literal",
                            "src": "3863:1:6",
                            "subdenomination": null,
                            "typeDescriptions": {
                              "typeIdentifier": "t_rational_2_by_1",
                              "typeString": "int_const 2"
                            },
                            "value": "2"
                          },
                          "src": "3836:28:6",
                          "typeDescriptions": {
                            "typeIdentifier": "t_uint256",
                            "typeString": "uint256"
                          }
                        },
                        "nodeType": "VariableDeclarationStatement",
                        "src": "3814:50:6"
                      },
                      {
                        "condition": {
                          "argumentTypes": null,
                          "commonType": {
                            "typeIdentifier": "t_uint16",
                            "typeString": "uint16"
                          },
                          "id": 4626,
                          "isConstant": false,
                          "isLValue": false,
                          "isPure": false,
                          "lValueRequested": false,
                          "leftExpression": {
                            "argumentTypes": null,
                            "baseExpression": {
                              "argumentTypes": null,
                              "id": 4622,
                              "name": "tokenIdsForPrice",
                              "nodeType": "Identifier",
                              "overloadedDeclarations": [],
                              "referencedDeclaration": 4587,
                              "src": "3882:16:6",
                              "typeDescriptions": {
                                "typeIdentifier": "t_array$_t_uint16_$dyn_memory_ptr",
                                "typeString": "uint16[] memory"
                              }
                            },
                            "id": 4624,
                            "indexExpression": {
                              "argumentTypes": null,
                              "id": 4623,
                              "name": "middleValue",
                              "nodeType": "Identifier",
                              "overloadedDeclarations": [],
                              "referencedDeclaration": 4614,
                              "src": "3899:11:6",
                              "typeDescriptions": {
                                "typeIdentifier": "t_uint256",
                                "typeString": "uint256"
                              }
                            },
                            "isConstant": false,
                            "isLValue": true,
                            "isPure": false,
                            "lValueRequested": false,
                            "nodeType": "IndexAccess",
                            "src": "3882:29:6",
                            "typeDescriptions": {
                              "typeIdentifier": "t_uint16",
                              "typeString": "uint16"
                            }
                          },
                          "nodeType": "BinaryOperation",
                          "operator": "==",
                          "rightExpression": {
                            "argumentTypes": null,
                            "id": 4625,
                            "name": "tokenId",
                            "nodeType": "Identifier",
                            "overloadedDeclarations": [],
                            "referencedDeclaration": 4584,
                            "src": "3915:7:6",
                            "typeDescriptions": {
                              "typeIdentifier": "t_uint16",
                              "typeString": "uint16"
                            }
                          },
                          "src": "3882:40:6",
                          "typeDescriptions": {
                            "typeIdentifier": "t_bool",
                            "typeString": "bool"
                          }
                        },
                        "falseBody": {
                          "condition": {
                            "argumentTypes": null,
                            "commonType": {
                              "typeIdentifier": "t_uint16",
                              "typeString": "uint16"
                            },
                            "id": 4636,
                            "isConstant": false,
                            "isLValue": false,
                            "isPure": false,
                            "lValueRequested": false,
                            "leftExpression": {
                              "argumentTypes": null,
                              "baseExpression": {
                                "argumentTypes": null,
                                "id": 4632,
                                "name": "tokenIdsForPrice",
                                "nodeType": "Identifier",
                                "overloadedDeclarations": [],
                                "referencedDeclaration": 4587,
                                "src": "4069:16:6",
                                "typeDescriptions": {
                                  "typeIdentifier": "t_array$_t_uint16_$dyn_memory_ptr",
                                  "typeString": "uint16[] memory"
                                }
                              },
                              "id": 4634,
                              "indexExpression": {
                                "argumentTypes": null,
                                "id": 4633,
                                "name": "middleValue",
                                "nodeType": "Identifier",
                                "overloadedDeclarations": [],
                                "referencedDeclaration": 4614,
                                "src": "4086:11:6",
                                "typeDescriptions": {
                                  "typeIdentifier": "t_uint256",
                                  "typeString": "uint256"
                                }
                              },
                              "isConstant": false,
                              "isLValue": true,
                              "isPure": false,
                              "lValueRequested": false,
                              "nodeType": "IndexAccess",
                              "src": "4069:29:6",
                              "typeDescriptions": {
                                "typeIdentifier": "t_uint16",
                                "typeString": "uint16"
                              }
                            },
                            "nodeType": "BinaryOperation",
                            "operator": "<",
                            "rightExpression": {
                              "argumentTypes": null,
                              "id": 4635,
                              "name": "tokenId",
                              "nodeType": "Identifier",
                              "overloadedDeclarations": [],
                              "referencedDeclaration": 4584,
                              "src": "4101:7:6",
                              "typeDescriptions": {
                                "typeIdentifier": "t_uint16",
                                "typeString": "uint16"
                              }
                            },
                            "src": "4069:39:6",
                            "typeDescriptions": {
                              "typeIdentifier": "t_bool",
                              "typeString": "bool"
                            }
                          },
                          "falseBody": {
                            "id": 4650,
                            "nodeType": "Block",
                            "src": "4176:61:6",
                            "statements": [
                              {
                                "expression": {
                                  "argumentTypes": null,
                                  "id": 4648,
                                  "isConstant": false,
                                  "isLValue": false,
                                  "isPure": false,
                                  "lValueRequested": false,
                                  "leftHandSide": {
                                    "argumentTypes": null,
                                    "id": 4644,
                                    "name": "rightValue",
                                    "nodeType": "Identifier",
                                    "overloadedDeclarations": [],
                                    "referencedDeclaration": 4604,
                                    "src": "4194:10:6",
                                    "typeDescriptions": {
                                      "typeIdentifier": "t_uint256",
                                      "typeString": "uint256"
                                    }
                                  },
                                  "nodeType": "Assignment",
                                  "operator": "=",
                                  "rightHandSide": {
                                    "argumentTypes": null,
                                    "commonType": {
                                      "typeIdentifier": "t_uint256",
                                      "typeString": "uint256"
                                    },
                                    "id": 4647,
                                    "isConstant": false,
                                    "isLValue": false,
                                    "isPure": false,
                                    "lValueRequested": false,
                                    "leftExpression": {
                                      "argumentTypes": null,
                                      "id": 4645,
                                      "name": "middleValue",
                                      "nodeType": "Identifier",
                                      "overloadedDeclarations": [],
                                      "referencedDeclaration": 4614,
                                      "src": "4207:11:6",
                                      "typeDescriptions": {
                                        "typeIdentifier": "t_uint256",
                                        "typeString": "uint256"
                                      }
                                    },
                                    "nodeType": "BinaryOperation",
                                    "operator": "-",
                                    "rightExpression": {
                                      "argumentTypes": null,
                                      "hexValue": "31",
                                      "id": 4646,
                                      "isConstant": false,
                                      "isLValue": false,
                                      "isPure": true,
                                      "kind": "number",
                                      "lValueRequested": false,
                                      "nodeType": "Literal",
                                      "src": "4221:1:6",
                                      "subdenomination": null,
                                      "typeDescriptions": {
                                        "typeIdentifier": "t_rational_1_by_1",
                                        "typeString": "int_const 1"
                                      },
                                      "value": "1"
                                    },
                                    "src": "4207:15:6",
                                    "typeDescriptions": {
                                      "typeIdentifier": "t_uint256",
                                      "typeString": "uint256"
                                    }
                                  },
                                  "src": "4194:28:6",
                                  "typeDescriptions": {
                                    "typeIdentifier": "t_uint256",
                                    "typeString": "uint256"
                                  }
                                },
                                "id": 4649,
                                "nodeType": "ExpressionStatement",
                                "src": "4194:28:6"
                              }
                            ]
                          },
                          "id": 4651,
                          "nodeType": "IfStatement",
                          "src": "4065:172:6",
                          "trueBody": {
                            "id": 4643,
                            "nodeType": "Block",
                            "src": "4110:60:6",
                            "statements": [
                              {
                                "expression": {
                                  "argumentTypes": null,
                                  "id": 4641,
                                  "isConstant": false,
                                  "isLValue": false,
                                  "isPure": false,
                                  "lValueRequested": false,
                                  "leftHandSide": {
                                    "argumentTypes": null,
                                    "id": 4637,
                                    "name": "leftValue",
                                    "nodeType": "Identifier",
                                    "overloadedDeclarations": [],
                                    "referencedDeclaration": 4600,
                                    "src": "4128:9:6",
                                    "typeDescriptions": {
                                      "typeIdentifier": "t_uint256",
                                      "typeString": "uint256"
                                    }
                                  },
                                  "nodeType": "Assignment",
                                  "operator": "=",
                                  "rightHandSide": {
                                    "argumentTypes": null,
                                    "commonType": {
                                      "typeIdentifier": "t_uint256",
                                      "typeString": "uint256"
                                    },
                                    "id": 4640,
                                    "isConstant": false,
                                    "isLValue": false,
                                    "isPure": false,
                                    "lValueRequested": false,
                                    "leftExpression": {
                                      "argumentTypes": null,
                                      "id": 4638,
                                      "name": "middleValue",
                                      "nodeType": "Identifier",
                                      "overloadedDeclarations": [],
                                      "referencedDeclaration": 4614,
                                      "src": "4140:11:6",
                                      "typeDescriptions": {
                                        "typeIdentifier": "t_uint256",
                                        "typeString": "uint256"
                                      }
                                    },
                                    "nodeType": "BinaryOperation",
                                    "operator": "+",
                                    "rightExpression": {
                                      "argumentTypes": null,
                                      "hexValue": "31",
                                      "id": 4639,
                                      "isConstant": false,
                                      "isLValue": false,
                                      "isPure": true,
                                      "kind": "number",
                                      "lValueRequested": false,
                                      "nodeType": "Literal",
                                      "src": "4154:1:6",
                                      "subdenomination": null,
                                      "typeDescriptions": {
                                        "typeIdentifier": "t_rational_1_by_1",
                                        "typeString": "int_const 1"
                                      },
                                      "value": "1"
                                    },
                                    "src": "4140:15:6",
                                    "typeDescriptions": {
                                      "typeIdentifier": "t_uint256",
                                      "typeString": "uint256"
                                    }
                                  },
                                  "src": "4128:27:6",
                                  "typeDescriptions": {
                                    "typeIdentifier": "t_uint256",
                                    "typeString": "uint256"
                                  }
                                },
                                "id": 4642,
                                "nodeType": "ExpressionStatement",
                                "src": "4128:27:6"
                              }
                            ]
                          }
                        },
                        "id": 4652,
                        "nodeType": "IfStatement",
                        "src": "3878:359:6",
                        "trueBody": {
                          "id": 4631,
                          "nodeType": "Block",
                          "src": "3924:135:6",
                          "statements": [
                            {
                              "expression": {
                                "argumentTypes": null,
                                "commonType": {
                                  "typeIdentifier": "t_uint256",
                                  "typeString": "uint256"
                                },
                                "id": 4629,
                                "isConstant": false,
                                "isLValue": false,
                                "isPure": false,
                                "lValueRequested": false,
                                "leftExpression": {
                                  "argumentTypes": null,
                                  "id": 4627,
                                  "name": "middleValue",
                                  "nodeType": "Identifier",
                                  "overloadedDeclarations": [],
                                  "referencedDeclaration": 4614,
                                  "src": "4029:11:6",
                                  "typeDescriptions": {
                                    "typeIdentifier": "t_uint256",
                                    "typeString": "uint256"
                                  }
                                },
                                "nodeType": "BinaryOperation",
                                "operator": "+",
                                "rightExpression": {
                                  "argumentTypes": null,
                                  "hexValue": "31",
                                  "id": 4628,
                                  "isConstant": false,
                                  "isLValue": false,
                                  "isPure": true,
                                  "kind": "number",
                                  "lValueRequested": false,
                                  "nodeType": "Literal",
                                  "src": "4043:1:6",
                                  "subdenomination": null,
                                  "typeDescriptions": {
                                    "typeIdentifier": "t_rational_1_by_1",
                                    "typeString": "int_const 1"
                                  },
                                  "value": "1"
                                },
                                "src": "4029:15:6",
                                "typeDescriptions": {
                                  "typeIdentifier": "t_uint256",
                                  "typeString": "uint256"
                                }
                              },
                              "functionReturnParameters": 4591,
                              "id": 4630,
                              "nodeType": "Return",
                              "src": "4022:22:6"
                            }
                          ]
                        }
                      }
                    ]
                  },
                  "condition": {
                    "argumentTypes": null,
                    "commonType": {
                      "typeIdentifier": "t_uint256",
                      "typeString": "uint256"
                    },
                    "id": 4612,
                    "isConstant": false,
                    "isLValue": false,
                    "isPure": false,
                    "lValueRequested": false,
                    "leftExpression": {
                      "argumentTypes": null,
                      "id": 4610,
                      "name": "rightValue",
                      "nodeType": "Identifier",
                      "overloadedDeclarations": [],
                      "referencedDeclaration": 4604,
                      "src": "3775:10:6",
                      "typeDescriptions": {
                        "typeIdentifier": "t_uint256",
                        "typeString": "uint256"
                      }
                    },
                    "nodeType": "BinaryOperation",
                    "operator": ">=",
                    "rightExpression": {
                      "argumentTypes": null,
                      "id": 4611,
                      "name": "leftValue",
                      "nodeType": "Identifier",
                      "overloadedDeclarations": [],
                      "referencedDeclaration": 4600,
                      "src": "3789:9:6",
                      "typeDescriptions": {
                        "typeIdentifier": "t_uint256",
                        "typeString": "uint256"
                      }
                    },
                    "src": "3775:23:6",
                    "typeDescriptions": {
                      "typeIdentifier": "t_bool",
                      "typeString": "bool"
                    }
                  },
                  "id": 4654,
                  "nodeType": "WhileStatement",
                  "src": "3768:479:6"
                },
                {
                  "expression": {
                    "argumentTypes": null,
                    "arguments": [
                      {
                        "argumentTypes": null,
                        "hexValue": "5072696365206e6f742070726f766964656420666f7220746f6b656e",
                        "id": 4656,
                        "isConstant": false,
                        "isLValue": false,
                        "isPure": true,
                        "kind": "string",
                        "lValueRequested": false,
                        "nodeType": "Literal",
                        "src": "4263:30:6",
                        "subdenomination": null,
                        "typeDescriptions": {
                          "typeIdentifier": "t_stringliteral_41652a1e897276004b780f421c9906aaad906fdd4491e33a1f19d0d414d5f2c9",
                          "typeString": "literal_string \"Price not provided for token\""
                        },
                        "value": "Price not provided for token"
                      }
                    ],
                    "expression": {
                      "argumentTypes": [
                        {
                          "typeIdentifier": "t_stringliteral_41652a1e897276004b780f421c9906aaad906fdd4491e33a1f19d0d414d5f2c9",
                          "typeString": "literal_string \"Price not provided for token\""
                        }
                      ],
                      "id": 4655,
                      "name": "revert",
                      "nodeType": "Identifier",
                      "overloadedDeclarations": [
                        10247,
                        10248
                      ],
                      "referencedDeclaration": 10248,
                      "src": "4256:6:6",
                      "typeDescriptions": {
                        "typeIdentifier": "t_function_revert_pure$_t_string_memory_ptr_$returns$__$",
                        "typeString": "function (string memory) pure"
                      }
                    },
                    "id": 4657,
                    "isConstant": false,
                    "isLValue": false,
                    "isPure": false,
                    "kind": "functionCall",
                    "lValueRequested": false,
                    "names": [],
                    "nodeType": "FunctionCall",
                    "src": "4256:38:6",
                    "typeDescriptions": {
                      "typeIdentifier": "t_tuple$__$",
                      "typeString": "tuple()"
                    }
                  },
                  "id": 4658,
                  "nodeType": "ExpressionStatement",
                  "src": "4256:38:6"
                }
              ]
            },
            "documentation": "@dev implementation of binary search on sorted list returns token id\n@param tokenId element whose index is to be found\n@param tokenIdsForPrice list of (sorted) tokenIds for which binary search is applied.\n@return `index` in `tokenIdsForPrice` where `tokenId` appears (reverts if not found).",
            "id": 4660,
            "implemented": true,
            "kind": "function",
            "modifiers": [],
            "name": "findPriceIndex",
            "nodeType": "FunctionDefinition",
            "parameters": {
              "id": 4588,
              "nodeType": "ParameterList",
              "parameters": [
                {
                  "constant": false,
                  "id": 4584,
                  "name": "tokenId",
                  "nodeType": "VariableDeclaration",
                  "scope": 4660,
                  "src": "3425:14:6",
                  "stateVariable": false,
                  "storageLocation": "default",
                  "typeDescriptions": {
                    "typeIdentifier": "t_uint16",
                    "typeString": "uint16"
                  },
                  "typeName": {
                    "id": 4583,
                    "name": "uint16",
                    "nodeType": "ElementaryTypeName",
                    "src": "3425:6:6",
                    "typeDescriptions": {
                      "typeIdentifier": "t_uint16",
                      "typeString": "uint16"
                    }
                  },
                  "value": null,
                  "visibility": "internal"
                },
                {
                  "constant": false,
                  "id": 4587,
                  "name": "tokenIdsForPrice",
                  "nodeType": "VariableDeclaration",
                  "scope": 4660,
                  "src": "3441:32:6",
                  "stateVariable": false,
                  "storageLocation": "memory",
                  "typeDescriptions": {
                    "typeIdentifier": "t_array$_t_uint16_$dyn_memory_ptr",
                    "typeString": "uint16[]"
                  },
                  "typeName": {
                    "baseType": {
                      "id": 4585,
                      "name": "uint16",
                      "nodeType": "ElementaryTypeName",
                      "src": "3441:6:6",
                      "typeDescriptions": {
                        "typeIdentifier": "t_uint16",
                        "typeString": "uint16"
                      }
                    },
                    "id": 4586,
                    "length": null,
                    "nodeType": "ArrayTypeName",
                    "src": "3441:8:6",
                    "typeDescriptions": {
                      "typeIdentifier": "t_array$_t_uint16_$dyn_storage_ptr",
                      "typeString": "uint16[]"
                    }
                  },
                  "value": null,
                  "visibility": "internal"
                }
              ],
              "src": "3424:50:6"
            },
            "returnParameters": {
              "id": 4591,
              "nodeType": "ParameterList",
              "parameters": [
                {
                  "constant": false,
                  "id": 4590,
                  "name": "",
                  "nodeType": "VariableDeclaration",
                  "scope": 4660,
                  "src": "3497:7:6",
                  "stateVariable": false,
                  "storageLocation": "default",
                  "typeDescriptions": {
                    "typeIdentifier": "t_uint256",
                    "typeString": "uint256"
                  },
                  "typeName": {
                    "id": 4589,
                    "name": "uint256",
                    "nodeType": "ElementaryTypeName",
                    "src": "3497:7:6",
                    "typeDescriptions": {
                      "typeIdentifier": "t_uint256",
                      "typeString": "uint256"
                    }
                  },
                  "value": null,
                  "visibility": "internal"
                }
              ],
              "src": "3496:9:6"
            },
            "scope": 4661,
            "src": "3401:900:6",
            "stateMutability": "pure",
            "superFunction": null,
            "visibility": "private"
          }
        ],
        "scope": 4662,
        "src": "320:3983:6"
      }
    ],
    "src": "0:4304:6"
  },
  "legacyAST": {
    "absolutePath": "/Users/felixleupold/Gnosis/dex-contracts/contracts/libraries/TokenConservation.sol",
    "exportedSymbols": {
      "TokenConservation": [
        4661
      ]
    },
    "id": 4662,
    "nodeType": "SourceUnit",
    "nodes": [
      {
        "id": 4413,
        "literals": [
          "solidity",
          "^",
          "0.5",
          ".0"
        ],
        "nodeType": "PragmaDirective",
        "src": "0:23:6"
      },
      {
        "absolutePath": "@openzeppelin/contracts/drafts/SignedSafeMath.sol",
        "file": "@openzeppelin/contracts/drafts/SignedSafeMath.sol",
        "id": 4414,
        "nodeType": "ImportDirective",
        "scope": 4662,
        "sourceUnit": 8468,
        "src": "25:59:6",
        "symbolAliases": [],
        "unitAlias": ""
      },
      {
        "baseContracts": [],
        "contractDependencies": [],
        "contractKind": "library",
        "documentation": "@title Token Conservation\n A library for updating and verifying the tokenConservation contraint for BatchExchange's batch auction\n @author @gnosis/dfusion-team <https://github.com/orgs/gnosis/teams/dfusion-team/members>",
        "fullyImplemented": true,
        "id": 4661,
        "linearizedBaseContracts": [
          4661
        ],
        "name": "TokenConservation",
        "nodeType": "ContractDefinition",
        "nodes": [
          {
            "id": 4417,
            "libraryName": {
              "contractScope": null,
              "id": 4415,
              "name": "SignedSafeMath",
              "nodeType": "UserDefinedTypeName",
              "referencedDeclaration": 8467,
              "src": "358:14:6",
              "typeDescriptions": {
                "typeIdentifier": "t_contract$_SignedSafeMath_$8467",
                "typeString": "library SignedSafeMath"
              }
            },
            "nodeType": "UsingForDirective",
            "src": "352:32:6",
            "typeName": {
              "id": 4416,
              "name": "int256",
              "nodeType": "ElementaryTypeName",
              "src": "377:6:6",
              "typeDescriptions": {
                "typeIdentifier": "t_int256",
                "typeString": "int256"
              }
            }
          },
          {
            "body": {
              "id": 4435,
              "nodeType": "Block",
              "src": "650:65:6",
              "statements": [
                {
                  "expression": {
                    "argumentTypes": null,
                    "arguments": [
                      {
                        "argumentTypes": null,
                        "commonType": {
                          "typeIdentifier": "t_uint256",
                          "typeString": "uint256"
                        },
                        "id": 4432,
                        "isConstant": false,
                        "isLValue": false,
                        "isPure": false,
                        "lValueRequested": false,
                        "leftExpression": {
                          "argumentTypes": null,
                          "expression": {
                            "argumentTypes": null,
                            "id": 4429,
                            "name": "tokenIdsForPrice",
                            "nodeType": "Identifier",
                            "overloadedDeclarations": [],
                            "referencedDeclaration": 4420,
                            "src": "680:16:6",
                            "typeDescriptions": {
                              "typeIdentifier": "t_array$_t_uint16_$dyn_memory_ptr",
                              "typeString": "uint16[] memory"
                            }
                          },
                          "id": 4430,
                          "isConstant": false,
                          "isLValue": false,
                          "isPure": false,
                          "lValueRequested": false,
                          "memberName": "length",
                          "nodeType": "MemberAccess",
                          "referencedDeclaration": null,
                          "src": "680:23:6",
                          "typeDescriptions": {
                            "typeIdentifier": "t_uint256",
                            "typeString": "uint256"
                          }
                        },
                        "nodeType": "BinaryOperation",
                        "operator": "+",
                        "rightExpression": {
                          "argumentTypes": null,
                          "hexValue": "31",
                          "id": 4431,
                          "isConstant": false,
                          "isLValue": false,
                          "isPure": true,
                          "kind": "number",
                          "lValueRequested": false,
                          "nodeType": "Literal",
                          "src": "706:1:6",
                          "subdenomination": null,
                          "typeDescriptions": {
                            "typeIdentifier": "t_rational_1_by_1",
                            "typeString": "int_const 1"
                          },
                          "value": "1"
                        },
                        "src": "680:27:6",
                        "typeDescriptions": {
                          "typeIdentifier": "t_uint256",
                          "typeString": "uint256"
                        }
                      }
                    ],
                    "expression": {
                      "argumentTypes": [
                        {
                          "typeIdentifier": "t_uint256",
                          "typeString": "uint256"
                        }
                      ],
                      "id": 4428,
                      "isConstant": false,
                      "isLValue": false,
                      "isPure": true,
                      "lValueRequested": false,
                      "nodeType": "NewExpression",
                      "src": "667:12:6",
                      "typeDescriptions": {
                        "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_array$_t_int256_$dyn_memory_$",
                        "typeString": "function (uint256) pure returns (int256[] memory)"
                      },
                      "typeName": {
                        "baseType": {
                          "id": 4426,
                          "name": "int256",
                          "nodeType": "ElementaryTypeName",
                          "src": "671:6:6",
                          "typeDescriptions": {
                            "typeIdentifier": "t_int256",
                            "typeString": "int256"
                          }
                        },
                        "id": 4427,
                        "length": null,
                        "nodeType": "ArrayTypeName",
                        "src": "671:8:6",
                        "typeDescriptions": {
                          "typeIdentifier": "t_array$_t_int256_$dyn_storage_ptr",
                          "typeString": "int256[]"
                        }
                      }
                    },
                    "id": 4433,
                    "isConstant": false,
                    "isLValue": false,
                    "isPure": false,
                    "kind": "functionCall",
                    "lValueRequested": false,
                    "names": [],
                    "nodeType": "FunctionCall",
                    "src": "667:41:6",
                    "typeDescriptions": {
                      "typeIdentifier": "t_array$_t_int256_$dyn_memory",
                      "typeString": "int256[] memory"
                    }
                  },
                  "functionReturnParameters": 4425,
                  "id": 4434,
                  "nodeType": "Return",
                  "src": "660:48:6"
                }
              ]
            },
            "documentation": "@dev initialize the token conservation data structure\n@param tokenIdsForPrice sorted list of tokenIds for which token conservation should be checked",
            "id": 4436,
            "implemented": true,
            "kind": "function",
            "modifiers": [],
            "name": "init",
            "nodeType": "FunctionDefinition",
            "parameters": {
              "id": 4421,
              "nodeType": "ParameterList",
              "parameters": [
                {
                  "constant": false,
                  "id": 4420,
                  "name": "tokenIdsForPrice",
                  "nodeType": "VariableDeclaration",
                  "scope": 4436,
                  "src": "576:32:6",
                  "stateVariable": false,
                  "storageLocation": "memory",
                  "typeDescriptions": {
                    "typeIdentifier": "t_array$_t_uint16_$dyn_memory_ptr",
                    "typeString": "uint16[]"
                  },
                  "typeName": {
                    "baseType": {
                      "id": 4418,
                      "name": "uint16",
                      "nodeType": "ElementaryTypeName",
                      "src": "576:6:6",
                      "typeDescriptions": {
                        "typeIdentifier": "t_uint16",
                        "typeString": "uint16"
                      }
                    },
                    "id": 4419,
                    "length": null,
                    "nodeType": "ArrayTypeName",
                    "src": "576:8:6",
                    "typeDescriptions": {
                      "typeIdentifier": "t_array$_t_uint16_$dyn_storage_ptr",
                      "typeString": "uint16[]"
                    }
                  },
                  "value": null,
                  "visibility": "internal"
                }
              ],
              "src": "575:34:6"
            },
            "returnParameters": {
              "id": 4425,
              "nodeType": "ParameterList",
              "parameters": [
                {
                  "constant": false,
                  "id": 4424,
                  "name": "",
                  "nodeType": "VariableDeclaration",
                  "scope": 4436,
                  "src": "633:15:6",
                  "stateVariable": false,
                  "storageLocation": "memory",
                  "typeDescriptions": {
                    "typeIdentifier": "t_array$_t_int256_$dyn_memory_ptr",
                    "typeString": "int256[]"
                  },
                  "typeName": {
                    "baseType": {
                      "id": 4422,
                      "name": "int256",
                      "nodeType": "ElementaryTypeName",
                      "src": "633:6:6",
                      "typeDescriptions": {
                        "typeIdentifier": "t_int256",
                        "typeString": "int256"
                      }
                    },
                    "id": 4423,
                    "length": null,
                    "nodeType": "ArrayTypeName",
                    "src": "633:8:6",
                    "typeDescriptions": {
                      "typeIdentifier": "t_array$_t_int256_$dyn_storage_ptr",
                      "typeString": "int256[]"
                    }
                  },
                  "value": null,
                  "visibility": "internal"
                }
              ],
              "src": "632:17:6"
            },
            "scope": 4661,
            "src": "562:153:6",
            "stateMutability": "pure",
            "superFunction": null,
            "visibility": "internal"
          },
          {
            "body": {
              "id": 4448,
              "nodeType": "Block",
              "src": "945:31:6",
              "statements": [
                {
                  "expression": {
                    "argumentTypes": null,
                    "baseExpression": {
                      "argumentTypes": null,
                      "id": 4444,
                      "name": "self",
                      "nodeType": "Identifier",
                      "overloadedDeclarations": [],
                      "referencedDeclaration": 4439,
                      "src": "962:4:6",
                      "typeDescriptions": {
                        "typeIdentifier": "t_array$_t_int256_$dyn_memory_ptr",
                        "typeString": "int256[] memory"
                      }
                    },
                    "id": 4446,
                    "indexExpression": {
                      "argumentTypes": null,
                      "hexValue": "30",
                      "id": 4445,
                      "isConstant": false,
                      "isLValue": false,
                      "isPure": true,
                      "kind": "number",
                      "lValueRequested": false,
                      "nodeType": "Literal",
                      "src": "967:1:6",
                      "subdenomination": null,
                      "typeDescriptions": {
                        "typeIdentifier": "t_rational_0_by_1",
                        "typeString": "int_const 0"
                      },
                      "value": "0"
                    },
                    "isConstant": false,
                    "isLValue": true,
                    "isPure": false,
                    "lValueRequested": false,
                    "nodeType": "IndexAccess",
                    "src": "962:7:6",
                    "typeDescriptions": {
                      "typeIdentifier": "t_int256",
                      "typeString": "int256"
                    }
                  },
                  "functionReturnParameters": 4443,
                  "id": 4447,
                  "nodeType": "Return",
                  "src": "955:14:6"
                }
              ]
            },
            "documentation": "@dev returns the token imbalance of the fee token\n@param self internal datastructure created by TokenConservation.init()",
            "id": 4449,
            "implemented": true,
            "kind": "function",
            "modifiers": [],
            "name": "feeTokenImbalance",
            "nodeType": "FunctionDefinition",
            "parameters": {
              "id": 4440,
              "nodeType": "ParameterList",
              "parameters": [
                {
                  "constant": false,
                  "id": 4439,
                  "name": "self",
                  "nodeType": "VariableDeclaration",
                  "scope": 4449,
                  "src": "892:20:6",
                  "stateVariable": false,
                  "storageLocation": "memory",
                  "typeDescriptions": {
                    "typeIdentifier": "t_array$_t_int256_$dyn_memory_ptr",
                    "typeString": "int256[]"
                  },
                  "typeName": {
                    "baseType": {
                      "id": 4437,
                      "name": "int256",
                      "nodeType": "ElementaryTypeName",
                      "src": "892:6:6",
                      "typeDescriptions": {
                        "typeIdentifier": "t_int256",
                        "typeString": "int256"
                      }
                    },
                    "id": 4438,
                    "length": null,
                    "nodeType": "ArrayTypeName",
                    "src": "892:8:6",
                    "typeDescriptions": {
                      "typeIdentifier": "t_array$_t_int256_$dyn_storage_ptr",
                      "typeString": "int256[]"
                    }
                  },
                  "value": null,
                  "visibility": "internal"
                }
              ],
              "src": "891:22:6"
            },
            "returnParameters": {
              "id": 4443,
              "nodeType": "ParameterList",
              "parameters": [
                {
                  "constant": false,
                  "id": 4442,
                  "name": "",
                  "nodeType": "VariableDeclaration",
                  "scope": 4449,
                  "src": "937:6:6",
                  "stateVariable": false,
                  "storageLocation": "default",
                  "typeDescriptions": {
                    "typeIdentifier": "t_int256",
                    "typeString": "int256"
                  },
                  "typeName": {
                    "id": 4441,
                    "name": "int256",
                    "nodeType": "ElementaryTypeName",
                    "src": "937:6:6",
                    "typeDescriptions": {
                      "typeIdentifier": "t_int256",
                      "typeString": "int256"
                    }
                  },
                  "value": null,
                  "visibility": "internal"
                }
              ],
              "src": "936:8:6"
            },
            "scope": 4661,
            "src": "865:111:6",
            "stateMutability": "pure",
            "superFunction": null,
            "visibility": "internal"
          },
          {
            "body": {
              "id": 4506,
              "nodeType": "Block",
              "src": "1692:312:6",
              "statements": [
                {
                  "assignments": [
                    4467
                  ],
                  "declarations": [
                    {
                      "constant": false,
                      "id": 4467,
                      "name": "buyTokenIndex",
                      "nodeType": "VariableDeclaration",
                      "scope": 4506,
                      "src": "1702:21:6",
                      "stateVariable": false,
                      "storageLocation": "default",
                      "typeDescriptions": {
                        "typeIdentifier": "t_uint256",
                        "typeString": "uint256"
                      },
                      "typeName": {
                        "id": 4466,
                        "name": "uint256",
                        "nodeType": "ElementaryTypeName",
                        "src": "1702:7:6",
                        "typeDescriptions": {
                          "typeIdentifier": "t_uint256",
                          "typeString": "uint256"
                        }
                      },
                      "value": null,
                      "visibility": "internal"
                    }
                  ],
                  "id": 4472,
                  "initialValue": {
                    "argumentTypes": null,
                    "arguments": [
                      {
                        "argumentTypes": null,
                        "id": 4469,
                        "name": "buyToken",
                        "nodeType": "Identifier",
                        "overloadedDeclarations": [],
                        "referencedDeclaration": 4454,
                        "src": "1741:8:6",
                        "typeDescriptions": {
                          "typeIdentifier": "t_uint16",
                          "typeString": "uint16"
                        }
                      },
                      {
                        "argumentTypes": null,
                        "id": 4470,
                        "name": "tokenIdsForPrice",
                        "nodeType": "Identifier",
                        "overloadedDeclarations": [],
                        "referencedDeclaration": 4459,
                        "src": "1751:16:6",
                        "typeDescriptions": {
                          "typeIdentifier": "t_array$_t_uint16_$dyn_memory_ptr",
                          "typeString": "uint16[] memory"
                        }
                      }
                    ],
                    "expression": {
                      "argumentTypes": [
                        {
                          "typeIdentifier": "t_uint16",
                          "typeString": "uint16"
                        },
                        {
                          "typeIdentifier": "t_array$_t_uint16_$dyn_memory_ptr",
                          "typeString": "uint16[] memory"
                        }
                      ],
                      "id": 4468,
                      "name": "findPriceIndex",
                      "nodeType": "Identifier",
                      "overloadedDeclarations": [],
                      "referencedDeclaration": 4660,
                      "src": "1726:14:6",
                      "typeDescriptions": {
                        "typeIdentifier": "t_function_internal_pure$_t_uint16_$_t_array$_t_uint16_$dyn_memory_ptr_$returns$_t_uint256_$",
                        "typeString": "function (uint16,uint16[] memory) pure returns (uint256)"
                      }
                    },
                    "id": 4471,
                    "isConstant": false,
                    "isLValue": false,
                    "isPure": false,
                    "kind": "functionCall",
                    "lValueRequested": false,
                    "names": [],
                    "nodeType": "FunctionCall",
                    "src": "1726:42:6",
                    "typeDescriptions": {
                      "typeIdentifier": "t_uint256",
                      "typeString": "uint256"
                    }
                  },
                  "nodeType": "VariableDeclarationStatement",
                  "src": "1702:66:6"
                },
                {
                  "assignments": [
                    4474
                  ],
                  "declarations": [
                    {
                      "constant": false,
                      "id": 4474,
                      "name": "sellTokenIndex",
                      "nodeType": "VariableDeclaration",
                      "scope": 4506,
                      "src": "1778:22:6",
                      "stateVariable": false,
                      "storageLocation": "default",
                      "typeDescriptions": {
                        "typeIdentifier": "t_uint256",
                        "typeString": "uint256"
                      },
                      "typeName": {
                        "id": 4473,
                        "name": "uint256",
                        "nodeType": "ElementaryTypeName",
                        "src": "1778:7:6",
                        "typeDescriptions": {
                          "typeIdentifier": "t_uint256",
                          "typeString": "uint256"
                        }
                      },
                      "value": null,
                      "visibility": "internal"
                    }
                  ],
                  "id": 4479,
                  "initialValue": {
                    "argumentTypes": null,
                    "arguments": [
                      {
                        "argumentTypes": null,
                        "id": 4476,
                        "name": "sellToken",
                        "nodeType": "Identifier",
                        "overloadedDeclarations": [],
                        "referencedDeclaration": 4456,
                        "src": "1818:9:6",
                        "typeDescriptions": {
                          "typeIdentifier": "t_uint16",
                          "typeString": "uint16"
                        }
                      },
                      {
                        "argumentTypes": null,
                        "id": 4477,
                        "name": "tokenIdsForPrice",
                        "nodeType": "Identifier",
                        "overloadedDeclarations": [],
                        "referencedDeclaration": 4459,
                        "src": "1829:16:6",
                        "typeDescriptions": {
                          "typeIdentifier": "t_array$_t_uint16_$dyn_memory_ptr",
                          "typeString": "uint16[] memory"
                        }
                      }
                    ],
                    "expression": {
                      "argumentTypes": [
                        {
                          "typeIdentifier": "t_uint16",
                          "typeString": "uint16"
                        },
                        {
                          "typeIdentifier": "t_array$_t_uint16_$dyn_memory_ptr",
                          "typeString": "uint16[] memory"
                        }
                      ],
                      "id": 4475,
                      "name": "findPriceIndex",
                      "nodeType": "Identifier",
                      "overloadedDeclarations": [],
                      "referencedDeclaration": 4660,
                      "src": "1803:14:6",
                      "typeDescriptions": {
                        "typeIdentifier": "t_function_internal_pure$_t_uint16_$_t_array$_t_uint16_$dyn_memory_ptr_$returns$_t_uint256_$",
                        "typeString": "function (uint16,uint16[] memory) pure returns (uint256)"
                      }
                    },
                    "id": 4478,
                    "isConstant": false,
                    "isLValue": false,
                    "isPure": false,
                    "kind": "functionCall",
                    "lValueRequested": false,
                    "names": [],
                    "nodeType": "FunctionCall",
                    "src": "1803:43:6",
                    "typeDescriptions": {
                      "typeIdentifier": "t_uint256",
                      "typeString": "uint256"
                    }
                  },
                  "nodeType": "VariableDeclarationStatement",
                  "src": "1778:68:6"
                },
                {
                  "expression": {
                    "argumentTypes": null,
                    "id": 4491,
                    "isConstant": false,
                    "isLValue": false,
                    "isPure": false,
                    "lValueRequested": false,
                    "leftHandSide": {
                      "argumentTypes": null,
                      "baseExpression": {
                        "argumentTypes": null,
                        "id": 4480,
                        "name": "self",
                        "nodeType": "Identifier",
                        "overloadedDeclarations": [],
                        "referencedDeclaration": 4452,
                        "src": "1856:4:6",
                        "typeDescriptions": {
                          "typeIdentifier": "t_array$_t_int256_$dyn_memory_ptr",
                          "typeString": "int256[] memory"
                        }
                      },
                      "id": 4482,
                      "indexExpression": {
                        "argumentTypes": null,
                        "id": 4481,
                        "name": "buyTokenIndex",
                        "nodeType": "Identifier",
                        "overloadedDeclarations": [],
                        "referencedDeclaration": 4467,
                        "src": "1861:13:6",
                        "typeDescriptions": {
                          "typeIdentifier": "t_uint256",
                          "typeString": "uint256"
                        }
                      },
                      "isConstant": false,
                      "isLValue": true,
                      "isPure": false,
                      "lValueRequested": true,
                      "nodeType": "IndexAccess",
                      "src": "1856:19:6",
                      "typeDescriptions": {
                        "typeIdentifier": "t_int256",
                        "typeString": "int256"
                      }
                    },
                    "nodeType": "Assignment",
                    "operator": "=",
                    "rightHandSide": {
                      "argumentTypes": null,
                      "arguments": [
                        {
                          "argumentTypes": null,
                          "arguments": [
                            {
                              "argumentTypes": null,
                              "id": 4488,
                              "name": "buyAmount",
                              "nodeType": "Identifier",
                              "overloadedDeclarations": [],
                              "referencedDeclaration": 4461,
                              "src": "1909:9:6",
                              "typeDescriptions": {
                                "typeIdentifier": "t_uint128",
                                "typeString": "uint128"
                              }
                            }
                          ],
                          "expression": {
                            "argumentTypes": [
                              {
                                "typeIdentifier": "t_uint128",
                                "typeString": "uint128"
                              }
                            ],
                            "id": 4487,
                            "isConstant": false,
                            "isLValue": false,
                            "isPure": true,
                            "lValueRequested": false,
                            "nodeType": "ElementaryTypeNameExpression",
                            "src": "1902:6:6",
                            "typeDescriptions": {
                              "typeIdentifier": "t_type$_t_int256_$",
                              "typeString": "type(int256)"
                            },
                            "typeName": "int256"
                          },
                          "id": 4489,
                          "isConstant": false,
                          "isLValue": false,
                          "isPure": false,
                          "kind": "typeConversion",
                          "lValueRequested": false,
                          "names": [],
                          "nodeType": "FunctionCall",
                          "src": "1902:17:6",
                          "typeDescriptions": {
                            "typeIdentifier": "t_int256",
                            "typeString": "int256"
                          }
                        }
                      ],
                      "expression": {
                        "argumentTypes": [
                          {
                            "typeIdentifier": "t_int256",
                            "typeString": "int256"
                          }
                        ],
                        "expression": {
                          "argumentTypes": null,
                          "baseExpression": {
                            "argumentTypes": null,
                            "id": 4483,
                            "name": "self",
                            "nodeType": "Identifier",
                            "overloadedDeclarations": [],
                            "referencedDeclaration": 4452,
                            "src": "1878:4:6",
                            "typeDescriptions": {
                              "typeIdentifier": "t_array$_t_int256_$dyn_memory_ptr",
                              "typeString": "int256[] memory"
                            }
                          },
                          "id": 4485,
                          "indexExpression": {
                            "argumentTypes": null,
                            "id": 4484,
                            "name": "buyTokenIndex",
                            "nodeType": "Identifier",
                            "overloadedDeclarations": [],
                            "referencedDeclaration": 4467,
                            "src": "1883:13:6",
                            "typeDescriptions": {
                              "typeIdentifier": "t_uint256",
                              "typeString": "uint256"
                            }
                          },
                          "isConstant": false,
                          "isLValue": true,
                          "isPure": false,
                          "lValueRequested": false,
                          "nodeType": "IndexAccess",
                          "src": "1878:19:6",
                          "typeDescriptions": {
                            "typeIdentifier": "t_int256",
                            "typeString": "int256"
                          }
                        },
                        "id": 4486,
                        "isConstant": false,
                        "isLValue": false,
                        "isPure": false,
                        "lValueRequested": false,
                        "memberName": "sub",
                        "nodeType": "MemberAccess",
                        "referencedDeclaration": 8427,
                        "src": "1878:23:6",
                        "typeDescriptions": {
                          "typeIdentifier": "t_function_internal_pure$_t_int256_$_t_int256_$returns$_t_int256_$bound_to$_t_int256_$",
                          "typeString": "function (int256,int256) pure returns (int256)"
                        }
                      },
                      "id": 4490,
                      "isConstant": false,
                      "isLValue": false,
                      "isPure": false,
                      "kind": "functionCall",
                      "lValueRequested": false,
                      "names": [],
                      "nodeType": "FunctionCall",
                      "src": "1878:42:6",
                      "typeDescriptions": {
                        "typeIdentifier": "t_int256",
                        "typeString": "int256"
                      }
                    },
                    "src": "1856:64:6",
                    "typeDescriptions": {
                      "typeIdentifier": "t_int256",
                      "typeString": "int256"
                    }
                  },
                  "id": 4492,
                  "nodeType": "ExpressionStatement",
                  "src": "1856:64:6"
                },
                {
                  "expression": {
                    "argumentTypes": null,
                    "id": 4504,
                    "isConstant": false,
                    "isLValue": false,
                    "isPure": false,
                    "lValueRequested": false,
                    "leftHandSide": {
                      "argumentTypes": null,
                      "baseExpression": {
                        "argumentTypes": null,
                        "id": 4493,
                        "name": "self",
                        "nodeType": "Identifier",
                        "overloadedDeclarations": [],
                        "referencedDeclaration": 4452,
                        "src": "1930:4:6",
                        "typeDescriptions": {
                          "typeIdentifier": "t_array$_t_int256_$dyn_memory_ptr",
                          "typeString": "int256[] memory"
                        }
                      },
                      "id": 4495,
                      "indexExpression": {
                        "argumentTypes": null,
                        "id": 4494,
                        "name": "sellTokenIndex",
                        "nodeType": "Identifier",
                        "overloadedDeclarations": [],
                        "referencedDeclaration": 4474,
                        "src": "1935:14:6",
                        "typeDescriptions": {
                          "typeIdentifier": "t_uint256",
                          "typeString": "uint256"
                        }
                      },
                      "isConstant": false,
                      "isLValue": true,
                      "isPure": false,
                      "lValueRequested": true,
                      "nodeType": "IndexAccess",
                      "src": "1930:20:6",
                      "typeDescriptions": {
                        "typeIdentifier": "t_int256",
                        "typeString": "int256"
                      }
                    },
                    "nodeType": "Assignment",
                    "operator": "=",
                    "rightHandSide": {
                      "argumentTypes": null,
                      "arguments": [
                        {
                          "argumentTypes": null,
                          "arguments": [
                            {
                              "argumentTypes": null,
                              "id": 4501,
                              "name": "sellAmount",
                              "nodeType": "Identifier",
                              "overloadedDeclarations": [],
                              "referencedDeclaration": 4463,
                              "src": "1985:10:6",
                              "typeDescriptions": {
                                "typeIdentifier": "t_uint128",
                                "typeString": "uint128"
                              }
                            }
                          ],
                          "expression": {
                            "argumentTypes": [
                              {
                                "typeIdentifier": "t_uint128",
                                "typeString": "uint128"
                              }
                            ],
                            "id": 4500,
                            "isConstant": false,
                            "isLValue": false,
                            "isPure": true,
                            "lValueRequested": false,
                            "nodeType": "ElementaryTypeNameExpression",
                            "src": "1978:6:6",
                            "typeDescriptions": {
                              "typeIdentifier": "t_type$_t_int256_$",
                              "typeString": "type(int256)"
                            },
                            "typeName": "int256"
                          },
                          "id": 4502,
                          "isConstant": false,
                          "isLValue": false,
                          "isPure": false,
                          "kind": "typeConversion",
                          "lValueRequested": false,
                          "names": [],
                          "nodeType": "FunctionCall",
                          "src": "1978:18:6",
                          "typeDescriptions": {
                            "typeIdentifier": "t_int256",
                            "typeString": "int256"
                          }
                        }
                      ],
                      "expression": {
                        "argumentTypes": [
                          {
                            "typeIdentifier": "t_int256",
                            "typeString": "int256"
                          }
                        ],
                        "expression": {
                          "argumentTypes": null,
                          "baseExpression": {
                            "argumentTypes": null,
                            "id": 4496,
                            "name": "self",
                            "nodeType": "Identifier",
                            "overloadedDeclarations": [],
                            "referencedDeclaration": 4452,
                            "src": "1953:4:6",
                            "typeDescriptions": {
                              "typeIdentifier": "t_array$_t_int256_$dyn_memory_ptr",
                              "typeString": "int256[] memory"
                            }
                          },
                          "id": 4498,
                          "indexExpression": {
                            "argumentTypes": null,
                            "id": 4497,
                            "name": "sellTokenIndex",
                            "nodeType": "Identifier",
                            "overloadedDeclarations": [],
                            "referencedDeclaration": 4474,
                            "src": "1958:14:6",
                            "typeDescriptions": {
                              "typeIdentifier": "t_uint256",
                              "typeString": "uint256"
                            }
                          },
                          "isConstant": false,
                          "isLValue": true,
                          "isPure": false,
                          "lValueRequested": false,
                          "nodeType": "IndexAccess",
                          "src": "1953:20:6",
                          "typeDescriptions": {
                            "typeIdentifier": "t_int256",
                            "typeString": "int256"
                          }
                        },
                        "id": 4499,
                        "isConstant": false,
                        "isLValue": false,
                        "isPure": false,
                        "lValueRequested": false,
                        "memberName": "add",
                        "nodeType": "MemberAccess",
                        "referencedDeclaration": 8466,
                        "src": "1953:24:6",
                        "typeDescriptions": {
                          "typeIdentifier": "t_function_internal_pure$_t_int256_$_t_int256_$returns$_t_int256_$bound_to$_t_int256_$",
                          "typeString": "function (int256,int256) pure returns (int256)"
                        }
                      },
                      "id": 4503,
                      "isConstant": false,
                      "isLValue": false,
                      "isPure": false,
                      "kind": "functionCall",
                      "lValueRequested": false,
                      "names": [],
                      "nodeType": "FunctionCall",
                      "src": "1953:44:6",
                      "typeDescriptions": {
                        "typeIdentifier": "t_int256",
                        "typeString": "int256"
                      }
                    },
                    "src": "1930:67:6",
                    "typeDescriptions": {
                      "typeIdentifier": "t_int256",
                      "typeString": "int256"
                    }
                  },
                  "id": 4505,
                  "nodeType": "ExpressionStatement",
                  "src": "1930:67:6"
                }
              ]
            },
            "documentation": "@dev updated token conservation array.\n@param self internal datastructure created by TokenConservation.init()\n@param buyToken id of token whose imbalance should be subtracted from\n@param sellToken id of token whose imbalance should be added to\n@param tokenIdsForPrice sorted list of tokenIds\n@param buyAmount amount to be subtracted at `self[buyTokenIndex]`\n@param sellAmount amount to be added at `self[sellTokenIndex]`",
            "id": 4507,
            "implemented": true,
            "kind": "function",
            "modifiers": [],
            "name": "updateTokenConservation",
            "nodeType": "FunctionDefinition",
            "parameters": {
              "id": 4464,
              "nodeType": "ParameterList",
              "parameters": [
                {
                  "constant": false,
                  "id": 4452,
                  "name": "self",
                  "nodeType": "VariableDeclaration",
                  "scope": 4507,
                  "src": "1503:20:6",
                  "stateVariable": false,
                  "storageLocation": "memory",
                  "typeDescriptions": {
                    "typeIdentifier": "t_array$_t_int256_$dyn_memory_ptr",
                    "typeString": "int256[]"
                  },
                  "typeName": {
                    "baseType": {
                      "id": 4450,
                      "name": "int256",
                      "nodeType": "ElementaryTypeName",
                      "src": "1503:6:6",
                      "typeDescriptions": {
                        "typeIdentifier": "t_int256",
                        "typeString": "int256"
                      }
                    },
                    "id": 4451,
                    "length": null,
                    "nodeType": "ArrayTypeName",
                    "src": "1503:8:6",
                    "typeDescriptions": {
                      "typeIdentifier": "t_array$_t_int256_$dyn_storage_ptr",
                      "typeString": "int256[]"
                    }
                  },
                  "value": null,
                  "visibility": "internal"
                },
                {
                  "constant": false,
                  "id": 4454,
                  "name": "buyToken",
                  "nodeType": "VariableDeclaration",
                  "scope": 4507,
                  "src": "1533:15:6",
                  "stateVariable": false,
                  "storageLocation": "default",
                  "typeDescriptions": {
                    "typeIdentifier": "t_uint16",
                    "typeString": "uint16"
                  },
                  "typeName": {
                    "id": 4453,
                    "name": "uint16",
                    "nodeType": "ElementaryTypeName",
                    "src": "1533:6:6",
                    "typeDescriptions": {
                      "typeIdentifier": "t_uint16",
                      "typeString": "uint16"
                    }
                  },
                  "value": null,
                  "visibility": "internal"
                },
                {
                  "constant": false,
                  "id": 4456,
                  "name": "sellToken",
                  "nodeType": "VariableDeclaration",
                  "scope": 4507,
                  "src": "1558:16:6",
                  "stateVariable": false,
                  "storageLocation": "default",
                  "typeDescriptions": {
                    "typeIdentifier": "t_uint16",
                    "typeString": "uint16"
                  },
                  "typeName": {
                    "id": 4455,
                    "name": "uint16",
                    "nodeType": "ElementaryTypeName",
                    "src": "1558:6:6",
                    "typeDescriptions": {
                      "typeIdentifier": "t_uint16",
                      "typeString": "uint16"
                    }
                  },
                  "value": null,
                  "visibility": "internal"
                },
                {
                  "constant": false,
                  "id": 4459,
                  "name": "tokenIdsForPrice",
                  "nodeType": "VariableDeclaration",
                  "scope": 4507,
                  "src": "1584:32:6",
                  "stateVariable": false,
                  "storageLocation": "memory",
                  "typeDescriptions": {
                    "typeIdentifier": "t_array$_t_uint16_$dyn_memory_ptr",
                    "typeString": "uint16[]"
                  },
                  "typeName": {
                    "baseType": {
                      "id": 4457,
                      "name": "uint16",
                      "nodeType": "ElementaryTypeName",
                      "src": "1584:6:6",
                      "typeDescriptions": {
                        "typeIdentifier": "t_uint16",
                        "typeString": "uint16"
                      }
                    },
                    "id": 4458,
                    "length": null,
                    "nodeType": "ArrayTypeName",
                    "src": "1584:8:6",
                    "typeDescriptions": {
                      "typeIdentifier": "t_array$_t_uint16_$dyn_storage_ptr",
                      "typeString": "uint16[]"
                    }
                  },
                  "value": null,
                  "visibility": "internal"
                },
                {
                  "constant": false,
                  "id": 4461,
                  "name": "buyAmount",
                  "nodeType": "VariableDeclaration",
                  "scope": 4507,
                  "src": "1626:17:6",
                  "stateVariable": false,
                  "storageLocation": "default",
                  "typeDescriptions": {
                    "typeIdentifier": "t_uint128",
                    "typeString": "uint128"
                  },
                  "typeName": {
                    "id": 4460,
                    "name": "uint128",
                    "nodeType": "ElementaryTypeName",
                    "src": "1626:7:6",
                    "typeDescriptions": {
                      "typeIdentifier": "t_uint128",
                      "typeString": "uint128"
                    }
                  },
                  "value": null,
                  "visibility": "internal"
                },
                {
                  "constant": false,
                  "id": 4463,
                  "name": "sellAmount",
                  "nodeType": "VariableDeclaration",
                  "scope": 4507,
                  "src": "1653:18:6",
                  "stateVariable": false,
                  "storageLocation": "default",
                  "typeDescriptions": {
                    "typeIdentifier": "t_uint128",
                    "typeString": "uint128"
                  },
                  "typeName": {
                    "id": 4462,
                    "name": "uint128",
                    "nodeType": "ElementaryTypeName",
                    "src": "1653:7:6",
                    "typeDescriptions": {
                      "typeIdentifier": "t_uint128",
                      "typeString": "uint128"
                    }
                  },
                  "value": null,
                  "visibility": "internal"
                }
              ],
              "src": "1493:184:6"
            },
            "returnParameters": {
              "id": 4465,
              "nodeType": "ParameterList",
              "parameters": [],
              "src": "1692:0:6"
            },
            "scope": 4661,
            "src": "1461:543:6",
            "stateMutability": "pure",
            "superFunction": null,
            "visibility": "internal"
          },
          {
            "body": {
              "id": 4544,
              "nodeType": "Block",
              "src": "2307:215:6",
              "statements": [
                {
                  "expression": {
                    "argumentTypes": null,
                    "arguments": [
                      {
                        "argumentTypes": null,
                        "commonType": {
                          "typeIdentifier": "t_int256",
                          "typeString": "int256"
                        },
                        "id": 4518,
                        "isConstant": false,
                        "isLValue": false,
                        "isPure": false,
                        "lValueRequested": false,
                        "leftExpression": {
                          "argumentTypes": null,
                          "baseExpression": {
                            "argumentTypes": null,
                            "id": 4514,
                            "name": "self",
                            "nodeType": "Identifier",
                            "overloadedDeclarations": [],
                            "referencedDeclaration": 4510,
                            "src": "2325:4:6",
                            "typeDescriptions": {
                              "typeIdentifier": "t_array$_t_int256_$dyn_memory_ptr",
                              "typeString": "int256[] memory"
                            }
                          },
                          "id": 4516,
                          "indexExpression": {
                            "argumentTypes": null,
                            "hexValue": "30",
                            "id": 4515,
                            "isConstant": false,
                            "isLValue": false,
                            "isPure": true,
                            "kind": "number",
                            "lValueRequested": false,
                            "nodeType": "Literal",
                            "src": "2330:1:6",
                            "subdenomination": null,
                            "typeDescriptions": {
                              "typeIdentifier": "t_rational_0_by_1",
                              "typeString": "int_const 0"
                            },
                            "value": "0"
                          },
                          "isConstant": false,
                          "isLValue": true,
                          "isPure": false,
                          "lValueRequested": false,
                          "nodeType": "IndexAccess",
                          "src": "2325:7:6",
                          "typeDescriptions": {
                            "typeIdentifier": "t_int256",
                            "typeString": "int256"
                          }
                        },
                        "nodeType": "BinaryOperation",
                        "operator": ">",
                        "rightExpression": {
                          "argumentTypes": null,
                          "hexValue": "30",
                          "id": 4517,
                          "isConstant": false,
                          "isLValue": false,
                          "isPure": true,
                          "kind": "number",
                          "lValueRequested": false,
                          "nodeType": "Literal",
                          "src": "2335:1:6",
                          "subdenomination": null,
                          "typeDescriptions": {
                            "typeIdentifier": "t_rational_0_by_1",
                            "typeString": "int_const 0"
                          },
                          "value": "0"
                        },
                        "src": "2325:11:6",
                        "typeDescriptions": {
                          "typeIdentifier": "t_bool",
                          "typeString": "bool"
                        }
                      },
                      {
                        "argumentTypes": null,
                        "hexValue": "546f6b656e20636f6e736572766174696f6e2061742030206d75737420626520706f7369746976652e",
                        "id": 4519,
                        "isConstant": false,
                        "isLValue": false,
                        "isPure": true,
                        "kind": "string",
                        "lValueRequested": false,
                        "nodeType": "Literal",
                        "src": "2338:43:6",
                        "subdenomination": null,
                        "typeDescriptions": {
                          "typeIdentifier": "t_stringliteral_baf0373ca4917baaa5c52df2e8be013170c18496ed2df4561965764b8bb6695e",
                          "typeString": "literal_string \"Token conservation at 0 must be positive.\""
                        },
                        "value": "Token conservation at 0 must be positive."
                      }
                    ],
                    "expression": {
                      "argumentTypes": [
                        {
                          "typeIdentifier": "t_bool",
                          "typeString": "bool"
                        },
                        {
                          "typeIdentifier": "t_stringliteral_baf0373ca4917baaa5c52df2e8be013170c18496ed2df4561965764b8bb6695e",
                          "typeString": "literal_string \"Token conservation at 0 must be positive.\""
                        }
                      ],
                      "id": 4513,
                      "name": "require",
                      "nodeType": "Identifier",
                      "overloadedDeclarations": [
                        10245,
                        10246
                      ],
                      "referencedDeclaration": 10246,
                      "src": "2317:7:6",
                      "typeDescriptions": {
                        "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
                        "typeString": "function (bool,string memory) pure"
                      }
                    },
                    "id": 4520,
                    "isConstant": false,
                    "isLValue": false,
                    "isPure": false,
                    "kind": "functionCall",
                    "lValueRequested": false,
                    "names": [],
                    "nodeType": "FunctionCall",
                    "src": "2317:65:6",
                    "typeDescriptions": {
                      "typeIdentifier": "t_tuple$__$",
                      "typeString": "tuple()"
                    }
                  },
                  "id": 4521,
                  "nodeType": "ExpressionStatement",
                  "src": "2317:65:6"
                },
                {
                  "body": {
                    "id": 4542,
                    "nodeType": "Block",
                    "src": "2434:82:6",
                    "statements": [
                      {
                        "expression": {
                          "argumentTypes": null,
                          "arguments": [
                            {
                              "argumentTypes": null,
                              "commonType": {
                                "typeIdentifier": "t_int256",
                                "typeString": "int256"
                              },
                              "id": 4538,
                              "isConstant": false,
                              "isLValue": false,
                              "isPure": false,
                              "lValueRequested": false,
                              "leftExpression": {
                                "argumentTypes": null,
                                "baseExpression": {
                                  "argumentTypes": null,
                                  "id": 4534,
                                  "name": "self",
                                  "nodeType": "Identifier",
                                  "overloadedDeclarations": [],
                                  "referencedDeclaration": 4510,
                                  "src": "2456:4:6",
                                  "typeDescriptions": {
                                    "typeIdentifier": "t_array$_t_int256_$dyn_memory_ptr",
                                    "typeString": "int256[] memory"
                                  }
                                },
                                "id": 4536,
                                "indexExpression": {
                                  "argumentTypes": null,
                                  "id": 4535,
                                  "name": "i",
                                  "nodeType": "Identifier",
                                  "overloadedDeclarations": [],
                                  "referencedDeclaration": 4523,
                                  "src": "2461:1:6",
                                  "typeDescriptions": {
                                    "typeIdentifier": "t_uint256",
                                    "typeString": "uint256"
                                  }
                                },
                                "isConstant": false,
                                "isLValue": true,
                                "isPure": false,
                                "lValueRequested": false,
                                "nodeType": "IndexAccess",
                                "src": "2456:7:6",
                                "typeDescriptions": {
                                  "typeIdentifier": "t_int256",
                                  "typeString": "int256"
                                }
                              },
                              "nodeType": "BinaryOperation",
                              "operator": "==",
                              "rightExpression": {
                                "argumentTypes": null,
                                "hexValue": "30",
                                "id": 4537,
                                "isConstant": false,
                                "isLValue": false,
                                "isPure": true,
                                "kind": "number",
                                "lValueRequested": false,
                                "nodeType": "Literal",
                                "src": "2467:1:6",
                                "subdenomination": null,
                                "typeDescriptions": {
                                  "typeIdentifier": "t_rational_0_by_1",
                                  "typeString": "int_const 0"
                                },
                                "value": "0"
                              },
                              "src": "2456:12:6",
                              "typeDescriptions": {
                                "typeIdentifier": "t_bool",
                                "typeString": "bool"
                              }
                            },
                            {
                              "argumentTypes": null,
                              "hexValue": "546f6b656e20636f6e736572766174696f6e20646f6573206e6f7420686f6c64",
                              "id": 4539,
                              "isConstant": false,
                              "isLValue": false,
                              "isPure": true,
                              "kind": "string",
                              "lValueRequested": false,
                              "nodeType": "Literal",
                              "src": "2470:34:6",
                              "subdenomination": null,
                              "typeDescriptions": {
                                "typeIdentifier": "t_stringliteral_0ed36d7851ed9ad33db7d5fcf39e87071ba37c4a77c4bbbb02de703beb5dd66a",
                                "typeString": "literal_string \"Token conservation does not hold\""
                              },
                              "value": "Token conservation does not hold"
                            }
                          ],
                          "expression": {
                            "argumentTypes": [
                              {
                                "typeIdentifier": "t_bool",
                                "typeString": "bool"
                              },
                              {
                                "typeIdentifier": "t_stringliteral_0ed36d7851ed9ad33db7d5fcf39e87071ba37c4a77c4bbbb02de703beb5dd66a",
                                "typeString": "literal_string \"Token conservation does not hold\""
                              }
                            ],
                            "id": 4533,
                            "name": "require",
                            "nodeType": "Identifier",
                            "overloadedDeclarations": [
                              10245,
                              10246
                            ],
                            "referencedDeclaration": 10246,
                            "src": "2448:7:6",
                            "typeDescriptions": {
                              "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
                              "typeString": "function (bool,string memory) pure"
                            }
                          },
                          "id": 4540,
                          "isConstant": false,
                          "isLValue": false,
                          "isPure": false,
                          "kind": "functionCall",
                          "lValueRequested": false,
                          "names": [],
                          "nodeType": "FunctionCall",
                          "src": "2448:57:6",
                          "typeDescriptions": {
                            "typeIdentifier": "t_tuple$__$",
                            "typeString": "tuple()"
                          }
                        },
                        "id": 4541,
                        "nodeType": "ExpressionStatement",
                        "src": "2448:57:6"
                      }
                    ]
                  },
                  "condition": {
                    "argumentTypes": null,
                    "commonType": {
                      "typeIdentifier": "t_uint256",
                      "typeString": "uint256"
                    },
                    "id": 4529,
                    "isConstant": false,
                    "isLValue": false,
                    "isPure": false,
                    "lValueRequested": false,
                    "leftExpression": {
                      "argumentTypes": null,
                      "id": 4526,
                      "name": "i",
                      "nodeType": "Identifier",
                      "overloadedDeclarations": [],
                      "referencedDeclaration": 4523,
                      "src": "2412:1:6",
                      "typeDescriptions": {
                        "typeIdentifier": "t_uint256",
                        "typeString": "uint256"
                      }
                    },
                    "nodeType": "BinaryOperation",
                    "operator": "<",
                    "rightExpression": {
                      "argumentTypes": null,
                      "expression": {
                        "argumentTypes": null,
                        "id": 4527,
                        "name": "self",
                        "nodeType": "Identifier",
                        "overloadedDeclarations": [],
                        "referencedDeclaration": 4510,
                        "src": "2416:4:6",
                        "typeDescriptions": {
                          "typeIdentifier": "t_array$_t_int256_$dyn_memory_ptr",
                          "typeString": "int256[] memory"
                        }
                      },
                      "id": 4528,
                      "isConstant": false,
                      "isLValue": false,
                      "isPure": false,
                      "lValueRequested": false,
                      "memberName": "length",
                      "nodeType": "MemberAccess",
                      "referencedDeclaration": null,
                      "src": "2416:11:6",
                      "typeDescriptions": {
                        "typeIdentifier": "t_uint256",
                        "typeString": "uint256"
                      }
                    },
                    "src": "2412:15:6",
                    "typeDescriptions": {
                      "typeIdentifier": "t_bool",
                      "typeString": "bool"
                    }
                  },
                  "id": 4543,
                  "initializationExpression": {
                    "assignments": [
                      4523
                    ],
                    "declarations": [
                      {
                        "constant": false,
                        "id": 4523,
                        "name": "i",
                        "nodeType": "VariableDeclaration",
                        "scope": 4543,
                        "src": "2397:9:6",
                        "stateVariable": false,
                        "storageLocation": "default",
                        "typeDescriptions": {
                          "typeIdentifier": "t_uint256",
                          "typeString": "uint256"
                        },
                        "typeName": {
                          "id": 4522,
                          "name": "uint256",
                          "nodeType": "ElementaryTypeName",
                          "src": "2397:7:6",
                          "typeDescriptions": {
                            "typeIdentifier": "t_uint256",
                            "typeString": "uint256"
                          }
                        },
                        "value": null,
                        "visibility": "internal"
                      }
                    ],
                    "id": 4525,
                    "initialValue": {
                      "argumentTypes": null,
                      "hexValue": "31",
                      "id": 4524,
                      "isConstant": false,
                      "isLValue": false,
                      "isPure": true,
                      "kind": "number",
                      "lValueRequested": false,
                      "nodeType": "Literal",
                      "src": "2409:1:6",
                      "subdenomination": null,
                      "typeDescriptions": {
                        "typeIdentifier": "t_rational_1_by_1",
                        "typeString": "int_const 1"
                      },
                      "value": "1"
                    },
                    "nodeType": "VariableDeclarationStatement",
                    "src": "2397:13:6"
                  },
                  "loopExpression": {
                    "expression": {
                      "argumentTypes": null,
                      "id": 4531,
                      "isConstant": false,
                      "isLValue": false,
                      "isPure": false,
                      "lValueRequested": false,
                      "nodeType": "UnaryOperation",
                      "operator": "++",
                      "prefix": false,
                      "src": "2429:3:6",
                      "subExpression": {
                        "argumentTypes": null,
                        "id": 4530,
                        "name": "i",
                        "nodeType": "Identifier",
                        "overloadedDeclarations": [],
                        "referencedDeclaration": 4523,
                        "src": "2429:1:6",
                        "typeDescriptions": {
                          "typeIdentifier": "t_uint256",
                          "typeString": "uint256"
                        }
                      },
                      "typeDescriptions": {
                        "typeIdentifier": "t_uint256",
                        "typeString": "uint256"
                      }
                    },
                    "id": 4532,
                    "nodeType": "ExpressionStatement",
                    "src": "2429:3:6"
                  },
                  "nodeType": "ForStatement",
                  "src": "2392:124:6"
                }
              ]
            },
            "documentation": "@dev Ensures all array's elements are zero except the first.\n@param self internal datastructure created by TokenConservation.init()\n@return true if all, but first element of self are zero else false",
            "id": 4545,
            "implemented": true,
            "kind": "function",
            "modifiers": [],
            "name": "checkTokenConservation",
            "nodeType": "FunctionDefinition",
            "parameters": {
              "id": 4511,
              "nodeType": "ParameterList",
              "parameters": [
                {
                  "constant": false,
                  "id": 4510,
                  "name": "self",
                  "nodeType": "VariableDeclaration",
                  "scope": 4545,
                  "src": "2271:20:6",
                  "stateVariable": false,
                  "storageLocation": "memory",
                  "typeDescriptions": {
                    "typeIdentifier": "t_array$_t_int256_$dyn_memory_ptr",
                    "typeString": "int256[]"
                  },
                  "typeName": {
                    "baseType": {
                      "id": 4508,
                      "name": "int256",
                      "nodeType": "ElementaryTypeName",
                      "src": "2271:6:6",
                      "typeDescriptions": {
                        "typeIdentifier": "t_int256",
                        "typeString": "int256"
                      }
                    },
                    "id": 4509,
                    "length": null,
                    "nodeType": "ArrayTypeName",
                    "src": "2271:8:6",
                    "typeDescriptions": {
                      "typeIdentifier": "t_array$_t_int256_$dyn_storage_ptr",
                      "typeString": "int256[]"
                    }
                  },
                  "value": null,
                  "visibility": "internal"
                }
              ],
              "src": "2270:22:6"
            },
            "returnParameters": {
              "id": 4512,
              "nodeType": "ParameterList",
              "parameters": [],
              "src": "2307:0:6"
            },
            "scope": 4661,
            "src": "2239:283:6",
            "stateMutability": "pure",
            "superFunction": null,
            "visibility": "internal"
          },
          {
            "body": {
              "id": 4581,
              "nodeType": "Block",
              "src": "2855:212:6",
              "statements": [
                {
                  "body": {
                    "id": 4577,
                    "nodeType": "Block",
                    "src": "2919:121:6",
                    "statements": [
                      {
                        "condition": {
                          "argumentTypes": null,
                          "commonType": {
                            "typeIdentifier": "t_uint16",
                            "typeString": "uint16"
                          },
                          "id": 4572,
                          "isConstant": false,
                          "isLValue": false,
                          "isPure": false,
                          "lValueRequested": false,
                          "leftExpression": {
                            "argumentTypes": null,
                            "baseExpression": {
                              "argumentTypes": null,
                              "id": 4564,
                              "name": "tokenIdsForPrice",
                              "nodeType": "Identifier",
                              "overloadedDeclarations": [],
                              "referencedDeclaration": 4548,
                              "src": "2937:16:6",
                              "typeDescriptions": {
                                "typeIdentifier": "t_array$_t_uint16_$dyn_memory_ptr",
                                "typeString": "uint16[] memory"
                              }
                            },
                            "id": 4566,
                            "indexExpression": {
                              "argumentTypes": null,
                              "id": 4565,
                              "name": "i",
                              "nodeType": "Identifier",
                              "overloadedDeclarations": [],
                              "referencedDeclaration": 4554,
                              "src": "2954:1:6",
                              "typeDescriptions": {
                                "typeIdentifier": "t_uint256",
                                "typeString": "uint256"
                              }
                            },
                            "isConstant": false,
                            "isLValue": true,
                            "isPure": false,
                            "lValueRequested": false,
                            "nodeType": "IndexAccess",
                            "src": "2937:19:6",
                            "typeDescriptions": {
                              "typeIdentifier": "t_uint16",
                              "typeString": "uint16"
                            }
                          },
                          "nodeType": "BinaryOperation",
                          "operator": "<=",
                          "rightExpression": {
                            "argumentTypes": null,
                            "baseExpression": {
                              "argumentTypes": null,
                              "id": 4567,
                              "name": "tokenIdsForPrice",
                              "nodeType": "Identifier",
                              "overloadedDeclarations": [],
                              "referencedDeclaration": 4548,
                              "src": "2960:16:6",
                              "typeDescriptions": {
                                "typeIdentifier": "t_array$_t_uint16_$dyn_memory_ptr",
                                "typeString": "uint16[] memory"
                              }
                            },
                            "id": 4571,
                            "indexExpression": {
                              "argumentTypes": null,
                              "commonType": {
                                "typeIdentifier": "t_uint256",
                                "typeString": "uint256"
                              },
                              "id": 4570,
                              "isConstant": false,
                              "isLValue": false,
                              "isPure": false,
                              "lValueRequested": false,
                              "leftExpression": {
                                "argumentTypes": null,
                                "id": 4568,
                                "name": "i",
                                "nodeType": "Identifier",
                                "overloadedDeclarations": [],
                                "referencedDeclaration": 4554,
                                "src": "2977:1:6",
                                "typeDescriptions": {
                                  "typeIdentifier": "t_uint256",
                                  "typeString": "uint256"
                                }
                              },
                              "nodeType": "BinaryOperation",
                              "operator": "-",
                              "rightExpression": {
                                "argumentTypes": null,
                                "hexValue": "31",
                                "id": 4569,
                                "isConstant": false,
                                "isLValue": false,
                                "isPure": true,
                                "kind": "number",
                                "lValueRequested": false,
                                "nodeType": "Literal",
                                "src": "2981:1:6",
                                "subdenomination": null,
                                "typeDescriptions": {
                                  "typeIdentifier": "t_rational_1_by_1",
                                  "typeString": "int_const 1"
                                },
                                "value": "1"
                              },
                              "src": "2977:5:6",
                              "typeDescriptions": {
                                "typeIdentifier": "t_uint256",
                                "typeString": "uint256"
                              }
                            },
                            "isConstant": false,
                            "isLValue": true,
                            "isPure": false,
                            "lValueRequested": false,
                            "nodeType": "IndexAccess",
                            "src": "2960:23:6",
                            "typeDescriptions": {
                              "typeIdentifier": "t_uint16",
                              "typeString": "uint16"
                            }
                          },
                          "src": "2937:46:6",
                          "typeDescriptions": {
                            "typeIdentifier": "t_bool",
                            "typeString": "bool"
                          }
                        },
                        "falseBody": null,
                        "id": 4576,
                        "nodeType": "IfStatement",
                        "src": "2933:97:6",
                        "trueBody": {
                          "id": 4575,
                          "nodeType": "Block",
                          "src": "2985:45:6",
                          "statements": [
                            {
                              "expression": {
                                "argumentTypes": null,
                                "hexValue": "66616c7365",
                                "id": 4573,
                                "isConstant": false,
                                "isLValue": false,
                                "isPure": true,
                                "kind": "bool",
                                "lValueRequested": false,
                                "nodeType": "Literal",
                                "src": "3010:5:6",
                                "subdenomination": null,
                                "typeDescriptions": {
                                  "typeIdentifier": "t_bool",
                                  "typeString": "bool"
                                },
                                "value": "false"
                              },
                              "functionReturnParameters": 4552,
                              "id": 4574,
                              "nodeType": "Return",
                              "src": "3003:12:6"
                            }
                          ]
                        }
                      }
                    ]
                  },
                  "condition": {
                    "argumentTypes": null,
                    "commonType": {
                      "typeIdentifier": "t_uint256",
                      "typeString": "uint256"
                    },
                    "id": 4560,
                    "isConstant": false,
                    "isLValue": false,
                    "isPure": false,
                    "lValueRequested": false,
                    "leftExpression": {
                      "argumentTypes": null,
                      "id": 4557,
                      "name": "i",
                      "nodeType": "Identifier",
                      "overloadedDeclarations": [],
                      "referencedDeclaration": 4554,
                      "src": "2885:1:6",
                      "typeDescriptions": {
                        "typeIdentifier": "t_uint256",
                        "typeString": "uint256"
                      }
                    },
                    "nodeType": "BinaryOperation",
                    "operator": "<",
                    "rightExpression": {
                      "argumentTypes": null,
                      "expression": {
                        "argumentTypes": null,
                        "id": 4558,
                        "name": "tokenIdsForPrice",
                        "nodeType": "Identifier",
                        "overloadedDeclarations": [],
                        "referencedDeclaration": 4548,
                        "src": "2889:16:6",
                        "typeDescriptions": {
                          "typeIdentifier": "t_array$_t_uint16_$dyn_memory_ptr",
                          "typeString": "uint16[] memory"
                        }
                      },
                      "id": 4559,
                      "isConstant": false,
                      "isLValue": false,
                      "isPure": false,
                      "lValueRequested": false,
                      "memberName": "length",
                      "nodeType": "MemberAccess",
                      "referencedDeclaration": null,
                      "src": "2889:23:6",
                      "typeDescriptions": {
                        "typeIdentifier": "t_uint256",
                        "typeString": "uint256"
                      }
                    },
                    "src": "2885:27:6",
                    "typeDescriptions": {
                      "typeIdentifier": "t_bool",
                      "typeString": "bool"
                    }
                  },
                  "id": 4578,
                  "initializationExpression": {
                    "assignments": [
                      4554
                    ],
                    "declarations": [
                      {
                        "constant": false,
                        "id": 4554,
                        "name": "i",
                        "nodeType": "VariableDeclaration",
                        "scope": 4578,
                        "src": "2870:9:6",
                        "stateVariable": false,
                        "storageLocation": "default",
                        "typeDescriptions": {
                          "typeIdentifier": "t_uint256",
                          "typeString": "uint256"
                        },
                        "typeName": {
                          "id": 4553,
                          "name": "uint256",
                          "nodeType": "ElementaryTypeName",
                          "src": "2870:7:6",
                          "typeDescriptions": {
                            "typeIdentifier": "t_uint256",
                            "typeString": "uint256"
                          }
                        },
                        "value": null,
                        "visibility": "internal"
                      }
                    ],
                    "id": 4556,
                    "initialValue": {
                      "argumentTypes": null,
                      "hexValue": "31",
                      "id": 4555,
                      "isConstant": false,
                      "isLValue": false,
                      "isPure": true,
                      "kind": "number",
                      "lValueRequested": false,
                      "nodeType": "Literal",
                      "src": "2882:1:6",
                      "subdenomination": null,
                      "typeDescriptions": {
                        "typeIdentifier": "t_rational_1_by_1",
                        "typeString": "int_const 1"
                      },
                      "value": "1"
                    },
                    "nodeType": "VariableDeclarationStatement",
                    "src": "2870:13:6"
                  },
                  "loopExpression": {
                    "expression": {
                      "argumentTypes": null,
                      "id": 4562,
                      "isConstant": false,
                      "isLValue": false,
                      "isPure": false,
                      "lValueRequested": false,
                      "nodeType": "UnaryOperation",
                      "operator": "++",
                      "prefix": false,
                      "src": "2914:3:6",
                      "subExpression": {
                        "argumentTypes": null,
                        "id": 4561,
                        "name": "i",
                        "nodeType": "Identifier",
                        "overloadedDeclarations": [],
                        "referencedDeclaration": 4554,
                        "src": "2914:1:6",
                        "typeDescriptions": {
                          "typeIdentifier": "t_uint256",
                          "typeString": "uint256"
                        }
                      },
                      "typeDescriptions": {
                        "typeIdentifier": "t_uint256",
                        "typeString": "uint256"
                      }
                    },
                    "id": 4563,
                    "nodeType": "ExpressionStatement",
                    "src": "2914:3:6"
                  },
                  "nodeType": "ForStatement",
                  "src": "2865:175:6"
                },
                {
                  "expression": {
                    "argumentTypes": null,
                    "hexValue": "74727565",
                    "id": 4579,
                    "isConstant": false,
                    "isLValue": false,
                    "isPure": true,
                    "kind": "bool",
                    "lValueRequested": false,
                    "nodeType": "Literal",
                    "src": "3056:4:6",
                    "subdenomination": null,
                    "typeDescriptions": {
                      "typeIdentifier": "t_bool",
                      "typeString": "bool"
                    },
                    "value": "true"
                  },
                  "functionReturnParameters": 4552,
                  "id": 4580,
                  "nodeType": "Return",
                  "src": "3049:11:6"
                }
              ]
            },
            "documentation": "@dev Token ordering is verified by submitSolution. Required because binary search is used to fetch token info.\n@param tokenIdsForPrice list of tokenIds\n@return true if tokenIdsForPrice is sorted else false",
            "id": 4582,
            "implemented": true,
            "kind": "function",
            "modifiers": [],
            "name": "checkPriceOrdering",
            "nodeType": "FunctionDefinition",
            "parameters": {
              "id": 4549,
              "nodeType": "ParameterList",
              "parameters": [
                {
                  "constant": false,
                  "id": 4548,
                  "name": "tokenIdsForPrice",
                  "nodeType": "VariableDeclaration",
                  "scope": 4582,
                  "src": "2792:32:6",
                  "stateVariable": false,
                  "storageLocation": "memory",
                  "typeDescriptions": {
                    "typeIdentifier": "t_array$_t_uint16_$dyn_memory_ptr",
                    "typeString": "uint16[]"
                  },
                  "typeName": {
                    "baseType": {
                      "id": 4546,
                      "name": "uint16",
                      "nodeType": "ElementaryTypeName",
                      "src": "2792:6:6",
                      "typeDescriptions": {
                        "typeIdentifier": "t_uint16",
                        "typeString": "uint16"
                      }
                    },
                    "id": 4547,
                    "length": null,
                    "nodeType": "ArrayTypeName",
                    "src": "2792:8:6",
                    "typeDescriptions": {
                      "typeIdentifier": "t_array$_t_uint16_$dyn_storage_ptr",
                      "typeString": "uint16[]"
                    }
                  },
                  "value": null,
                  "visibility": "internal"
                }
              ],
              "src": "2791:34:6"
            },
            "returnParameters": {
              "id": 4552,
              "nodeType": "ParameterList",
              "parameters": [
                {
                  "constant": false,
                  "id": 4551,
                  "name": "",
                  "nodeType": "VariableDeclaration",
                  "scope": 4582,
                  "src": "2849:4:6",
                  "stateVariable": false,
                  "storageLocation": "default",
                  "typeDescriptions": {
                    "typeIdentifier": "t_bool",
                    "typeString": "bool"
                  },
                  "typeName": {
                    "id": 4550,
                    "name": "bool",
                    "nodeType": "ElementaryTypeName",
                    "src": "2849:4:6",
                    "typeDescriptions": {
                      "typeIdentifier": "t_bool",
                      "typeString": "bool"
                    }
                  },
                  "value": null,
                  "visibility": "internal"
                }
              ],
              "src": "2848:6:6"
            },
            "scope": 4661,
            "src": "2764:303:6",
            "stateMutability": "pure",
            "superFunction": null,
            "visibility": "internal"
          },
          {
            "body": {
              "id": 4659,
              "nodeType": "Block",
              "src": "3506:795:6",
              "statements": [
                {
                  "condition": {
                    "argumentTypes": null,
                    "commonType": {
                      "typeIdentifier": "t_uint16",
                      "typeString": "uint16"
                    },
                    "id": 4594,
                    "isConstant": false,
                    "isLValue": false,
                    "isPure": false,
                    "lValueRequested": false,
                    "leftExpression": {
                      "argumentTypes": null,
                      "id": 4592,
                      "name": "tokenId",
                      "nodeType": "Identifier",
                      "overloadedDeclarations": [],
                      "referencedDeclaration": 4584,
                      "src": "3577:7:6",
                      "typeDescriptions": {
                        "typeIdentifier": "t_uint16",
                        "typeString": "uint16"
                      }
                    },
                    "nodeType": "BinaryOperation",
                    "operator": "==",
                    "rightExpression": {
                      "argumentTypes": null,
                      "hexValue": "30",
                      "id": 4593,
                      "isConstant": false,
                      "isLValue": false,
                      "isPure": true,
                      "kind": "number",
                      "lValueRequested": false,
                      "nodeType": "Literal",
                      "src": "3588:1:6",
                      "subdenomination": null,
                      "typeDescriptions": {
                        "typeIdentifier": "t_rational_0_by_1",
                        "typeString": "int_const 0"
                      },
                      "value": "0"
                    },
                    "src": "3577:12:6",
                    "typeDescriptions": {
                      "typeIdentifier": "t_bool",
                      "typeString": "bool"
                    }
                  },
                  "falseBody": null,
                  "id": 4598,
                  "nodeType": "IfStatement",
                  "src": "3573:51:6",
                  "trueBody": {
                    "id": 4597,
                    "nodeType": "Block",
                    "src": "3591:33:6",
                    "statements": [
                      {
                        "expression": {
                          "argumentTypes": null,
                          "hexValue": "30",
                          "id": 4595,
                          "isConstant": false,
                          "isLValue": false,
                          "isPure": true,
                          "kind": "number",
                          "lValueRequested": false,
                          "nodeType": "Literal",
                          "src": "3612:1:6",
                          "subdenomination": null,
                          "typeDescriptions": {
                            "typeIdentifier": "t_rational_0_by_1",
                            "typeString": "int_const 0"
                          },
                          "value": "0"
                        },
                        "functionReturnParameters": 4591,
                        "id": 4596,
                        "nodeType": "Return",
                        "src": "3605:8:6"
                      }
                    ]
                  }
                },
                {
                  "assignments": [
                    4600
                  ],
                  "declarations": [
                    {
                      "constant": false,
                      "id": 4600,
                      "name": "leftValue",
                      "nodeType": "VariableDeclaration",
                      "scope": 4659,
                      "src": "3679:17:6",
                      "stateVariable": false,
                      "storageLocation": "default",
                      "typeDescriptions": {
                        "typeIdentifier": "t_uint256",
                        "typeString": "uint256"
                      },
                      "typeName": {
                        "id": 4599,
                        "name": "uint256",
                        "nodeType": "ElementaryTypeName",
                        "src": "3679:7:6",
                        "typeDescriptions": {
                          "typeIdentifier": "t_uint256",
                          "typeString": "uint256"
                        }
                      },
                      "value": null,
                      "visibility": "internal"
                    }
                  ],
                  "id": 4602,
                  "initialValue": {
                    "argumentTypes": null,
                    "hexValue": "30",
                    "id": 4601,
                    "isConstant": false,
                    "isLValue": false,
                    "isPure": true,
                    "kind": "number",
                    "lValueRequested": false,
                    "nodeType": "Literal",
                    "src": "3699:1:6",
                    "subdenomination": null,
                    "typeDescriptions": {
                      "typeIdentifier": "t_rational_0_by_1",
                      "typeString": "int_const 0"
                    },
                    "value": "0"
                  },
                  "nodeType": "VariableDeclarationStatement",
                  "src": "3679:21:6"
                },
                {
                  "assignments": [
                    4604
                  ],
                  "declarations": [
                    {
                      "constant": false,
                      "id": 4604,
                      "name": "rightValue",
                      "nodeType": "VariableDeclaration",
                      "scope": 4659,
                      "src": "3710:18:6",
                      "stateVariable": false,
                      "storageLocation": "default",
                      "typeDescriptions": {
                        "typeIdentifier": "t_uint256",
                        "typeString": "uint256"
                      },
                      "typeName": {
                        "id": 4603,
                        "name": "uint256",
                        "nodeType": "ElementaryTypeName",
                        "src": "3710:7:6",
                        "typeDescriptions": {
                          "typeIdentifier": "t_uint256",
                          "typeString": "uint256"
                        }
                      },
                      "value": null,
                      "visibility": "internal"
                    }
                  ],
                  "id": 4609,
                  "initialValue": {
                    "argumentTypes": null,
                    "commonType": {
                      "typeIdentifier": "t_uint256",
                      "typeString": "uint256"
                    },
                    "id": 4608,
                    "isConstant": false,
                    "isLValue": false,
                    "isPure": false,
                    "lValueRequested": false,
                    "leftExpression": {
                      "argumentTypes": null,
                      "expression": {
                        "argumentTypes": null,
                        "id": 4605,
                        "name": "tokenIdsForPrice",
                        "nodeType": "Identifier",
                        "overloadedDeclarations": [],
                        "referencedDeclaration": 4587,
                        "src": "3731:16:6",
                        "typeDescriptions": {
                          "typeIdentifier": "t_array$_t_uint16_$dyn_memory_ptr",
                          "typeString": "uint16[] memory"
                        }
                      },
                      "id": 4606,
                      "isConstant": false,
                      "isLValue": false,
                      "isPure": false,
                      "lValueRequested": false,
                      "memberName": "length",
                      "nodeType": "MemberAccess",
                      "referencedDeclaration": null,
                      "src": "3731:23:6",
                      "typeDescriptions": {
                        "typeIdentifier": "t_uint256",
                        "typeString": "uint256"
                      }
                    },
                    "nodeType": "BinaryOperation",
                    "operator": "-",
                    "rightExpression": {
                      "argumentTypes": null,
                      "hexValue": "31",
                      "id": 4607,
                      "isConstant": false,
                      "isLValue": false,
                      "isPure": true,
                      "kind": "number",
                      "lValueRequested": false,
                      "nodeType": "Literal",
                      "src": "3757:1:6",
                      "subdenomination": null,
                      "typeDescriptions": {
                        "typeIdentifier": "t_rational_1_by_1",
                        "typeString": "int_const 1"
                      },
                      "value": "1"
                    },
                    "src": "3731:27:6",
                    "typeDescriptions": {
                      "typeIdentifier": "t_uint256",
                      "typeString": "uint256"
                    }
                  },
                  "nodeType": "VariableDeclarationStatement",
                  "src": "3710:48:6"
                },
                {
                  "body": {
                    "id": 4653,
                    "nodeType": "Block",
                    "src": "3800:447:6",
                    "statements": [
                      {
                        "assignments": [
                          4614
                        ],
                        "declarations": [
                          {
                            "constant": false,
                            "id": 4614,
                            "name": "middleValue",
                            "nodeType": "VariableDeclaration",
                            "scope": 4653,
                            "src": "3814:19:6",
                            "stateVariable": false,
                            "storageLocation": "default",
                            "typeDescriptions": {
                              "typeIdentifier": "t_uint256",
                              "typeString": "uint256"
                            },
                            "typeName": {
                              "id": 4613,
                              "name": "uint256",
                              "nodeType": "ElementaryTypeName",
                              "src": "3814:7:6",
                              "typeDescriptions": {
                                "typeIdentifier": "t_uint256",
                                "typeString": "uint256"
                              }
                            },
                            "value": null,
                            "visibility": "internal"
                          }
                        ],
                        "id": 4621,
                        "initialValue": {
                          "argumentTypes": null,
                          "commonType": {
                            "typeIdentifier": "t_uint256",
                            "typeString": "uint256"
                          },
                          "id": 4620,
                          "isConstant": false,
                          "isLValue": false,
                          "isPure": false,
                          "lValueRequested": false,
                          "leftExpression": {
                            "argumentTypes": null,
                            "components": [
                              {
                                "argumentTypes": null,
                                "commonType": {
                                  "typeIdentifier": "t_uint256",
                                  "typeString": "uint256"
                                },
                                "id": 4617,
                                "isConstant": false,
                                "isLValue": false,
                                "isPure": false,
                                "lValueRequested": false,
                                "leftExpression": {
                                  "argumentTypes": null,
                                  "id": 4615,
                                  "name": "leftValue",
                                  "nodeType": "Identifier",
                                  "overloadedDeclarations": [],
                                  "referencedDeclaration": 4600,
                                  "src": "3837:9:6",
                                  "typeDescriptions": {
                                    "typeIdentifier": "t_uint256",
                                    "typeString": "uint256"
                                  }
                                },
                                "nodeType": "BinaryOperation",
                                "operator": "+",
                                "rightExpression": {
                                  "argumentTypes": null,
                                  "id": 4616,
                                  "name": "rightValue",
                                  "nodeType": "Identifier",
                                  "overloadedDeclarations": [],
                                  "referencedDeclaration": 4604,
                                  "src": "3849:10:6",
                                  "typeDescriptions": {
                                    "typeIdentifier": "t_uint256",
                                    "typeString": "uint256"
                                  }
                                },
                                "src": "3837:22:6",
                                "typeDescriptions": {
                                  "typeIdentifier": "t_uint256",
                                  "typeString": "uint256"
                                }
                              }
                            ],
                            "id": 4618,
                            "isConstant": false,
                            "isInlineArray": false,
                            "isLValue": false,
                            "isPure": false,
                            "lValueRequested": false,
                            "nodeType": "TupleExpression",
                            "src": "3836:24:6",
                            "typeDescriptions": {
                              "typeIdentifier": "t_uint256",
                              "typeString": "uint256"
                            }
                          },
                          "nodeType": "BinaryOperation",
                          "operator": "/",
                          "rightExpression": {
                            "argumentTypes": null,
                            "hexValue": "32",
                            "id": 4619,
                            "isConstant": false,
                            "isLValue": false,
                            "isPure": true,
                            "kind": "number",
                            "lValueRequested": false,
                            "nodeType": "Literal",
                            "src": "3863:1:6",
                            "subdenomination": null,
                            "typeDescriptions": {
                              "typeIdentifier": "t_rational_2_by_1",
                              "typeString": "int_const 2"
                            },
                            "value": "2"
                          },
                          "src": "3836:28:6",
                          "typeDescriptions": {
                            "typeIdentifier": "t_uint256",
                            "typeString": "uint256"
                          }
                        },
                        "nodeType": "VariableDeclarationStatement",
                        "src": "3814:50:6"
                      },
                      {
                        "condition": {
                          "argumentTypes": null,
                          "commonType": {
                            "typeIdentifier": "t_uint16",
                            "typeString": "uint16"
                          },
                          "id": 4626,
                          "isConstant": false,
                          "isLValue": false,
                          "isPure": false,
                          "lValueRequested": false,
                          "leftExpression": {
                            "argumentTypes": null,
                            "baseExpression": {
                              "argumentTypes": null,
                              "id": 4622,
                              "name": "tokenIdsForPrice",
                              "nodeType": "Identifier",
                              "overloadedDeclarations": [],
                              "referencedDeclaration": 4587,
                              "src": "3882:16:6",
                              "typeDescriptions": {
                                "typeIdentifier": "t_array$_t_uint16_$dyn_memory_ptr",
                                "typeString": "uint16[] memory"
                              }
                            },
                            "id": 4624,
                            "indexExpression": {
                              "argumentTypes": null,
                              "id": 4623,
                              "name": "middleValue",
                              "nodeType": "Identifier",
                              "overloadedDeclarations": [],
                              "referencedDeclaration": 4614,
                              "src": "3899:11:6",
                              "typeDescriptions": {
                                "typeIdentifier": "t_uint256",
                                "typeString": "uint256"
                              }
                            },
                            "isConstant": false,
                            "isLValue": true,
                            "isPure": false,
                            "lValueRequested": false,
                            "nodeType": "IndexAccess",
                            "src": "3882:29:6",
                            "typeDescriptions": {
                              "typeIdentifier": "t_uint16",
                              "typeString": "uint16"
                            }
                          },
                          "nodeType": "BinaryOperation",
                          "operator": "==",
                          "rightExpression": {
                            "argumentTypes": null,
                            "id": 4625,
                            "name": "tokenId",
                            "nodeType": "Identifier",
                            "overloadedDeclarations": [],
                            "referencedDeclaration": 4584,
                            "src": "3915:7:6",
                            "typeDescriptions": {
                              "typeIdentifier": "t_uint16",
                              "typeString": "uint16"
                            }
                          },
                          "src": "3882:40:6",
                          "typeDescriptions": {
                            "typeIdentifier": "t_bool",
                            "typeString": "bool"
                          }
                        },
                        "falseBody": {
                          "condition": {
                            "argumentTypes": null,
                            "commonType": {
                              "typeIdentifier": "t_uint16",
                              "typeString": "uint16"
                            },
                            "id": 4636,
                            "isConstant": false,
                            "isLValue": false,
                            "isPure": false,
                            "lValueRequested": false,
                            "leftExpression": {
                              "argumentTypes": null,
                              "baseExpression": {
                                "argumentTypes": null,
                                "id": 4632,
                                "name": "tokenIdsForPrice",
                                "nodeType": "Identifier",
                                "overloadedDeclarations": [],
                                "referencedDeclaration": 4587,
                                "src": "4069:16:6",
                                "typeDescriptions": {
                                  "typeIdentifier": "t_array$_t_uint16_$dyn_memory_ptr",
                                  "typeString": "uint16[] memory"
                                }
                              },
                              "id": 4634,
                              "indexExpression": {
                                "argumentTypes": null,
                                "id": 4633,
                                "name": "middleValue",
                                "nodeType": "Identifier",
                                "overloadedDeclarations": [],
                                "referencedDeclaration": 4614,
                                "src": "4086:11:6",
                                "typeDescriptions": {
                                  "typeIdentifier": "t_uint256",
                                  "typeString": "uint256"
                                }
                              },
                              "isConstant": false,
                              "isLValue": true,
                              "isPure": false,
                              "lValueRequested": false,
                              "nodeType": "IndexAccess",
                              "src": "4069:29:6",
                              "typeDescriptions": {
                                "typeIdentifier": "t_uint16",
                                "typeString": "uint16"
                              }
                            },
                            "nodeType": "BinaryOperation",
                            "operator": "<",
                            "rightExpression": {
                              "argumentTypes": null,
                              "id": 4635,
                              "name": "tokenId",
                              "nodeType": "Identifier",
                              "overloadedDeclarations": [],
                              "referencedDeclaration": 4584,
                              "src": "4101:7:6",
                              "typeDescriptions": {
                                "typeIdentifier": "t_uint16",
                                "typeString": "uint16"
                              }
                            },
                            "src": "4069:39:6",
                            "typeDescriptions": {
                              "typeIdentifier": "t_bool",
                              "typeString": "bool"
                            }
                          },
                          "falseBody": {
                            "id": 4650,
                            "nodeType": "Block",
                            "src": "4176:61:6",
                            "statements": [
                              {
                                "expression": {
                                  "argumentTypes": null,
                                  "id": 4648,
                                  "isConstant": false,
                                  "isLValue": false,
                                  "isPure": false,
                                  "lValueRequested": false,
                                  "leftHandSide": {
                                    "argumentTypes": null,
                                    "id": 4644,
                                    "name": "rightValue",
                                    "nodeType": "Identifier",
                                    "overloadedDeclarations": [],
                                    "referencedDeclaration": 4604,
                                    "src": "4194:10:6",
                                    "typeDescriptions": {
                                      "typeIdentifier": "t_uint256",
                                      "typeString": "uint256"
                                    }
                                  },
                                  "nodeType": "Assignment",
                                  "operator": "=",
                                  "rightHandSide": {
                                    "argumentTypes": null,
                                    "commonType": {
                                      "typeIdentifier": "t_uint256",
                                      "typeString": "uint256"
                                    },
                                    "id": 4647,
                                    "isConstant": false,
                                    "isLValue": false,
                                    "isPure": false,
                                    "lValueRequested": false,
                                    "leftExpression": {
                                      "argumentTypes": null,
                                      "id": 4645,
                                      "name": "middleValue",
                                      "nodeType": "Identifier",
                                      "overloadedDeclarations": [],
                                      "referencedDeclaration": 4614,
                                      "src": "4207:11:6",
                                      "typeDescriptions": {
                                        "typeIdentifier": "t_uint256",
                                        "typeString": "uint256"
                                      }
                                    },
                                    "nodeType": "BinaryOperation",
                                    "operator": "-",
                                    "rightExpression": {
                                      "argumentTypes": null,
                                      "hexValue": "31",
                                      "id": 4646,
                                      "isConstant": false,
                                      "isLValue": false,
                                      "isPure": true,
                                      "kind": "number",
                                      "lValueRequested": false,
                                      "nodeType": "Literal",
                                      "src": "4221:1:6",
                                      "subdenomination": null,
                                      "typeDescriptions": {
                                        "typeIdentifier": "t_rational_1_by_1",
                                        "typeString": "int_const 1"
                                      },
                                      "value": "1"
                                    },
                                    "src": "4207:15:6",
                                    "typeDescriptions": {
                                      "typeIdentifier": "t_uint256",
                                      "typeString": "uint256"
                                    }
                                  },
                                  "src": "4194:28:6",
                                  "typeDescriptions": {
                                    "typeIdentifier": "t_uint256",
                                    "typeString": "uint256"
                                  }
                                },
                                "id": 4649,
                                "nodeType": "ExpressionStatement",
                                "src": "4194:28:6"
                              }
                            ]
                          },
                          "id": 4651,
                          "nodeType": "IfStatement",
                          "src": "4065:172:6",
                          "trueBody": {
                            "id": 4643,
                            "nodeType": "Block",
                            "src": "4110:60:6",
                            "statements": [
                              {
                                "expression": {
                                  "argumentTypes": null,
                                  "id": 4641,
                                  "isConstant": false,
                                  "isLValue": false,
                                  "isPure": false,
                                  "lValueRequested": false,
                                  "leftHandSide": {
                                    "argumentTypes": null,
                                    "id": 4637,
                                    "name": "leftValue",
                                    "nodeType": "Identifier",
                                    "overloadedDeclarations": [],
                                    "referencedDeclaration": 4600,
                                    "src": "4128:9:6",
                                    "typeDescriptions": {
                                      "typeIdentifier": "t_uint256",
                                      "typeString": "uint256"
                                    }
                                  },
                                  "nodeType": "Assignment",
                                  "operator": "=",
                                  "rightHandSide": {
                                    "argumentTypes": null,
                                    "commonType": {
                                      "typeIdentifier": "t_uint256",
                                      "typeString": "uint256"
                                    },
                                    "id": 4640,
                                    "isConstant": false,
                                    "isLValue": false,
                                    "isPure": false,
                                    "lValueRequested": false,
                                    "leftExpression": {
                                      "argumentTypes": null,
                                      "id": 4638,
                                      "name": "middleValue",
                                      "nodeType": "Identifier",
                                      "overloadedDeclarations": [],
                                      "referencedDeclaration": 4614,
                                      "src": "4140:11:6",
                                      "typeDescriptions": {
                                        "typeIdentifier": "t_uint256",
                                        "typeString": "uint256"
                                      }
                                    },
                                    "nodeType": "BinaryOperation",
                                    "operator": "+",
                                    "rightExpression": {
                                      "argumentTypes": null,
                                      "hexValue": "31",
                                      "id": 4639,
                                      "isConstant": false,
                                      "isLValue": false,
                                      "isPure": true,
                                      "kind": "number",
                                      "lValueRequested": false,
                                      "nodeType": "Literal",
                                      "src": "4154:1:6",
                                      "subdenomination": null,
                                      "typeDescriptions": {
                                        "typeIdentifier": "t_rational_1_by_1",
                                        "typeString": "int_const 1"
                                      },
                                      "value": "1"
                                    },
                                    "src": "4140:15:6",
                                    "typeDescriptions": {
                                      "typeIdentifier": "t_uint256",
                                      "typeString": "uint256"
                                    }
                                  },
                                  "src": "4128:27:6",
                                  "typeDescriptions": {
                                    "typeIdentifier": "t_uint256",
                                    "typeString": "uint256"
                                  }
                                },
                                "id": 4642,
                                "nodeType": "ExpressionStatement",
                                "src": "4128:27:6"
                              }
                            ]
                          }
                        },
                        "id": 4652,
                        "nodeType": "IfStatement",
                        "src": "3878:359:6",
                        "trueBody": {
                          "id": 4631,
                          "nodeType": "Block",
                          "src": "3924:135:6",
                          "statements": [
                            {
                              "expression": {
                                "argumentTypes": null,
                                "commonType": {
                                  "typeIdentifier": "t_uint256",
                                  "typeString": "uint256"
                                },
                                "id": 4629,
                                "isConstant": false,
                                "isLValue": false,
                                "isPure": false,
                                "lValueRequested": false,
                                "leftExpression": {
                                  "argumentTypes": null,
                                  "id": 4627,
                                  "name": "middleValue",
                                  "nodeType": "Identifier",
                                  "overloadedDeclarations": [],
                                  "referencedDeclaration": 4614,
                                  "src": "4029:11:6",
                                  "typeDescriptions": {
                                    "typeIdentifier": "t_uint256",
                                    "typeString": "uint256"
                                  }
                                },
                                "nodeType": "BinaryOperation",
                                "operator": "+",
                                "rightExpression": {
                                  "argumentTypes": null,
                                  "hexValue": "31",
                                  "id": 4628,
                                  "isConstant": false,
                                  "isLValue": false,
                                  "isPure": true,
                                  "kind": "number",
                                  "lValueRequested": false,
                                  "nodeType": "Literal",
                                  "src": "4043:1:6",
                                  "subdenomination": null,
                                  "typeDescriptions": {
                                    "typeIdentifier": "t_rational_1_by_1",
                                    "typeString": "int_const 1"
                                  },
                                  "value": "1"
                                },
                                "src": "4029:15:6",
                                "typeDescriptions": {
                                  "typeIdentifier": "t_uint256",
                                  "typeString": "uint256"
                                }
                              },
                              "functionReturnParameters": 4591,
                              "id": 4630,
                              "nodeType": "Return",
                              "src": "4022:22:6"
                            }
                          ]
                        }
                      }
                    ]
                  },
                  "condition": {
                    "argumentTypes": null,
                    "commonType": {
                      "typeIdentifier": "t_uint256",
                      "typeString": "uint256"
                    },
                    "id": 4612,
                    "isConstant": false,
                    "isLValue": false,
                    "isPure": false,
                    "lValueRequested": false,
                    "leftExpression": {
                      "argumentTypes": null,
                      "id": 4610,
                      "name": "rightValue",
                      "nodeType": "Identifier",
                      "overloadedDeclarations": [],
                      "referencedDeclaration": 4604,
                      "src": "3775:10:6",
                      "typeDescriptions": {
                        "typeIdentifier": "t_uint256",
                        "typeString": "uint256"
                      }
                    },
                    "nodeType": "BinaryOperation",
                    "operator": ">=",
                    "rightExpression": {
                      "argumentTypes": null,
                      "id": 4611,
                      "name": "leftValue",
                      "nodeType": "Identifier",
                      "overloadedDeclarations": [],
                      "referencedDeclaration": 4600,
                      "src": "3789:9:6",
                      "typeDescriptions": {
                        "typeIdentifier": "t_uint256",
                        "typeString": "uint256"
                      }
                    },
                    "src": "3775:23:6",
                    "typeDescriptions": {
                      "typeIdentifier": "t_bool",
                      "typeString": "bool"
                    }
                  },
                  "id": 4654,
                  "nodeType": "WhileStatement",
                  "src": "3768:479:6"
                },
                {
                  "expression": {
                    "argumentTypes": null,
                    "arguments": [
                      {
                        "argumentTypes": null,
                        "hexValue": "5072696365206e6f742070726f766964656420666f7220746f6b656e",
                        "id": 4656,
                        "isConstant": false,
                        "isLValue": false,
                        "isPure": true,
                        "kind": "string",
                        "lValueRequested": false,
                        "nodeType": "Literal",
                        "src": "4263:30:6",
                        "subdenomination": null,
                        "typeDescriptions": {
                          "typeIdentifier": "t_stringliteral_41652a1e897276004b780f421c9906aaad906fdd4491e33a1f19d0d414d5f2c9",
                          "typeString": "literal_string \"Price not provided for token\""
                        },
                        "value": "Price not provided for token"
                      }
                    ],
                    "expression": {
                      "argumentTypes": [
                        {
                          "typeIdentifier": "t_stringliteral_41652a1e897276004b780f421c9906aaad906fdd4491e33a1f19d0d414d5f2c9",
                          "typeString": "literal_string \"Price not provided for token\""
                        }
                      ],
                      "id": 4655,
                      "name": "revert",
                      "nodeType": "Identifier",
                      "overloadedDeclarations": [
                        10247,
                        10248
                      ],
                      "referencedDeclaration": 10248,
                      "src": "4256:6:6",
                      "typeDescriptions": {
                        "typeIdentifier": "t_function_revert_pure$_t_string_memory_ptr_$returns$__$",
                        "typeString": "function (string memory) pure"
                      }
                    },
                    "id": 4657,
                    "isConstant": false,
                    "isLValue": false,
                    "isPure": false,
                    "kind": "functionCall",
                    "lValueRequested": false,
                    "names": [],
                    "nodeType": "FunctionCall",
                    "src": "4256:38:6",
                    "typeDescriptions": {
                      "typeIdentifier": "t_tuple$__$",
                      "typeString": "tuple()"
                    }
                  },
                  "id": 4658,
                  "nodeType": "ExpressionStatement",
                  "src": "4256:38:6"
                }
              ]
            },
            "documentation": "@dev implementation of binary search on sorted list returns token id\n@param tokenId element whose index is to be found\n@param tokenIdsForPrice list of (sorted) tokenIds for which binary search is applied.\n@return `index` in `tokenIdsForPrice` where `tokenId` appears (reverts if not found).",
            "id": 4660,
            "implemented": true,
            "kind": "function",
            "modifiers": [],
            "name": "findPriceIndex",
            "nodeType": "FunctionDefinition",
            "parameters": {
              "id": 4588,
              "nodeType": "ParameterList",
              "parameters": [
                {
                  "constant": false,
                  "id": 4584,
                  "name": "tokenId",
                  "nodeType": "VariableDeclaration",
                  "scope": 4660,
                  "src": "3425:14:6",
                  "stateVariable": false,
                  "storageLocation": "default",
                  "typeDescriptions": {
                    "typeIdentifier": "t_uint16",
                    "typeString": "uint16"
                  },
                  "typeName": {
                    "id": 4583,
                    "name": "uint16",
                    "nodeType": "ElementaryTypeName",
                    "src": "3425:6:6",
                    "typeDescriptions": {
                      "typeIdentifier": "t_uint16",
                      "typeString": "uint16"
                    }
                  },
                  "value": null,
                  "visibility": "internal"
                },
                {
                  "constant": false,
                  "id": 4587,
                  "name": "tokenIdsForPrice",
                  "nodeType": "VariableDeclaration",
                  "scope": 4660,
                  "src": "3441:32:6",
                  "stateVariable": false,
                  "storageLocation": "memory",
                  "typeDescriptions": {
                    "typeIdentifier": "t_array$_t_uint16_$dyn_memory_ptr",
                    "typeString": "uint16[]"
                  },
                  "typeName": {
                    "baseType": {
                      "id": 4585,
                      "name": "uint16",
                      "nodeType": "ElementaryTypeName",
                      "src": "3441:6:6",
                      "typeDescriptions": {
                        "typeIdentifier": "t_uint16",
                        "typeString": "uint16"
                      }
                    },
                    "id": 4586,
                    "length": null,
                    "nodeType": "ArrayTypeName",
                    "src": "3441:8:6",
                    "typeDescriptions": {
                      "typeIdentifier": "t_array$_t_uint16_$dyn_storage_ptr",
                      "typeString": "uint16[]"
                    }
                  },
                  "value": null,
                  "visibility": "internal"
                }
              ],
              "src": "3424:50:6"
            },
            "returnParameters": {
              "id": 4591,
              "nodeType": "ParameterList",
              "parameters": [
                {
                  "constant": false,
                  "id": 4590,
                  "name": "",
                  "nodeType": "VariableDeclaration",
                  "scope": 4660,
                  "src": "3497:7:6",
                  "stateVariable": false,
                  "storageLocation": "default",
                  "typeDescriptions": {
                    "typeIdentifier": "t_uint256",
                    "typeString": "uint256"
                  },
                  "typeName": {
                    "id": 4589,
                    "name": "uint256",
                    "nodeType": "ElementaryTypeName",
                    "src": "3497:7:6",
                    "typeDescriptions": {
                      "typeIdentifier": "t_uint256",
                      "typeString": "uint256"
                    }
                  },
                  "value": null,
                  "visibility": "internal"
                }
              ],
              "src": "3496:9:6"
            },
            "scope": 4661,
            "src": "3401:900:6",
            "stateMutability": "pure",
            "superFunction": null,
            "visibility": "private"
          }
        ],
        "scope": 4662,
        "src": "320:3983:6"
      }
    ],
    "src": "0:4304:6"
  },
  "compiler": {
    "name": "solc",
    "version": "0.5.10+commit.5a6ea5b1.Emscripten.clang"
  },
  "networks": {},
  "schemaVersion": "3.3.1",
  "updatedAt": "2020-11-19T13:47:49.787Z",
  "devdoc": {
    "author": "@gnosis/dfusion-team <https://github.com/orgs/gnosis/teams/dfusion-team/members>",
    "methods": {},
    "title": "Token Conservation A library for updating and verifying the tokenConservation contraint for BatchExchange's batch auction"
  },
  "userdoc": {
    "methods": {}
  }
}