Getting Pair Lists

You could query pair lists using Factory contracts for each volatile / stable pairs.

To avoid errors in queries due to an excessively long list, we support pagination. Please check the pool length and, if it's too long, query in segments to avoid hitting the limit. Both Stable and Volatile pool factories support this feature, and the interface is the same for both.

function getPools(uint256 begin, uint256 maxLength) external view returns (XYKPool[] memory pools) {
        uint256 len = poolList.length <= begin ? 0 : Math.min(poolList.length - begin, maxLength);
        pools = new XYKPool[](len);
        unchecked {
            for (uint256 i = begin; i < begin + len; i++) {
                pools[i] = poolList[i];
            }
        }
    }

function poolsLength() external view returns (uint256) {
    return poolList.length;
}

Last updated