{
    "Function": "sortPoolsWithPurge",
    "File": "contracts/test/BalancerRegistry.sol",
    "Parent Contracts": [],
    "High-Level Calls": [
        "Math"
    ],
    "Internal Calls": [
        "getPoolsWithLimit",
        "_buildSortIndices",
        "_getEffectiveLiquidityForPoolsPurge",
        "_createKey"
    ],
    "Library Calls": [
        "min"
    ],
    "Low-Level Calls": [],
    "Code": "function sortPoolsWithPurge(address[] calldata tokens, uint256 lengthLimit) external {\n        for (uint i = 0; i < tokens.length; i++) {\n            for (uint j = i + 1; j < tokens.length; j++) {\n                bytes32 key = _createKey(tokens[i], tokens[j]);\n                address[] memory pools = getPoolsWithLimit(tokens[i], tokens[j], 0, Math.min(256, lengthLimit));\n                uint256[] memory effectiveLiquidity = _getEffectiveLiquidityForPoolsPurge(tokens[i], tokens[j], pools);\n                bytes32 indices = _buildSortIndices(effectiveLiquidity);\n\n                if (indices != _pools[key].indices) {\n                    emit IndicesUpdated(\n                        tokens[i] < tokens[j] ? tokens[i] : tokens[j],\n                        tokens[i] < tokens[j] ? tokens[j] : tokens[i],\n                        _pools[key].indices,\n                        indices\n                    );\n                    _pools[key].indices = indices;\n                }\n            }\n        }\n    }"
}