{
    "Function": "getBestPoolsWithLimit",
    "File": "contracts/test/BalancerRegistry.sol",
    "Parent Contracts": [],
    "High-Level Calls": [
        "SafeMath",
        "EnumerableSet",
        "Math"
    ],
    "Internal Calls": [
        "_createKey"
    ],
    "Library Calls": [
        "min",
        "sub",
        "at"
    ],
    "Low-Level Calls": [],
    "Code": "function getBestPoolsWithLimit(address fromToken, address destToken, uint256 limit)\n        public view returns(address[] memory pools)\n    {\n        bytes32 key = _createKey(fromToken, destToken);\n        bytes32 indices = _pools[key].indices;\n        uint256 len = 0;\n        while (indices[len] > 0 && len < Math.min(limit, indices.length)) {\n            len++;\n        }\n\n        pools = new address[](len);\n        for (uint i = 0; i < len; i++) {\n            uint256 index = uint256(uint8(indices[i])).sub(1);\n            pools[i] = _pools[key].pools.at(index);\n        }\n    }"
}