{
    "Function": "getExpectedSwapFill",
    "File": "contracts/RubiconRouter.sol",
    "Parent Contracts": [],
    "High-Level Calls": [
        "SafeMath",
        "SafeMath",
        "RubiconMarket",
        "SafeMath"
    ],
    "Internal Calls": [
        "require(bool,string)"
    ],
    "Library Calls": [
        "mul",
        "sub",
        "div"
    ],
    "Low-Level Calls": [],
    "Code": "function getExpectedSwapFill(\n        uint256 pay_amt,\n        uint256 buy_amt_min,\n        address[] calldata route, // First address is what is being payed, Last address is what is being bought\n        uint256 expectedMarketFeeBPS //20\n    ) public view returns (uint256 fill_amt) {\n        address _market = RubiconMarketAddress;\n        uint256 currentAmount = 0;\n        for (uint256 i = 0; i < route.length - 1; i++) {\n            (address input, address output) = (route[i], route[i + 1]);\n            uint256 _pay = i == 0\n                ? pay_amt\n                : (\n                    currentAmount.sub(\n                        currentAmount.mul(expectedMarketFeeBPS).div(10000)\n                    )\n                );\n            uint256 wouldBeFillAmount = RubiconMarket(_market).getBuyAmount(\n                ERC20(output),\n                ERC20(input),\n                _pay\n            );\n            currentAmount = wouldBeFillAmount;\n        }\n        require(currentAmount >= buy_amt_min, \"didnt clear buy_amt_min\");\n\n        // Return the wouldbe resulting swap amount\n        return (currentAmount);\n    }"
}