{
    "Function": "buyTo",
    "File": "contracts/Router.sol",
    "Parent Contracts": [],
    "High-Level Calls": [
        "Pool",
        "iDAO",
        "Pool",
        "iPOOLFACTORY"
    ],
    "Internal Calls": [
        "_handleTransferOut",
        "_DAO",
        "getsDividend",
        "_handleTransferIn"
    ],
    "Library Calls": [],
    "Low-Level Calls": [],
    "Code": "function buyTo(uint amount, address token, address member) public {\n        address _pool = iPOOLFACTORY(_DAO().POOLFACTORY()).getPool(token); // Get the pool address\n        _handleTransferIn(BASE, amount, _pool); // Transfer SPARTA to pool\n        uint fee;\n        if(token != address(0)){\n            (, uint feey) = Pool(_pool).swapTo(token, member); // Swap SPARTA to TOKEN & tsf to user\n            fee = feey;\n        } else {\n            (uint outputAmount, uint feez) = Pool(_pool).swap(WBNB); // Swap SPARTA to WBNB\n            _handleTransferOut(token, outputAmount, member); // Unwrap to BNB & tsf to user\n            fee = feez;\n        }\n        getsDividend(_pool, fee); // Check for dividend & tsf it to pool\n    }"
}