{
    "Function": "release",
    "File": "contracts/peripheral_contracts/BathBuddy.sol",
    "Parent Contracts": [
        "contracts/interfaces/IBathBuddy.sol"
    ],
    "High-Level Calls": [
        "SafeMath",
        "SafeMath",
        "SafeMath",
        "SafeMath",
        "SafeMath",
        "IERC20"
    ],
    "Internal Calls": [
        "require(bool,string)",
        "released",
        "vestedAmount"
    ],
    "Library Calls": [
        "mul",
        "mul",
        "sub",
        "div",
        "div"
    ],
    "Low-Level Calls": [],
    "Code": "function release(\n        IERC20 token,\n        address recipient,\n        uint256 sharesWithdrawn,\n        uint256 initialTotalSupply,\n        uint256 poolFee\n    ) external override {\n        require(\n            msg.sender == beneficiary,\n            \"Caller is not the Bath Token beneficiary of these rewards\"\n        );\n        uint256 releasable = vestedAmount(\n            address(token),\n            uint64(block.timestamp)\n        ) - released(address(token));\n        if (releasable > 0) {\n            uint256 amount = releasable.mul(sharesWithdrawn).div(\n                initialTotalSupply\n            );\n            uint256 _fee = amount.mul(poolFee).div(10000);\n\n            // If FeeTo == address(this) then the fee is effectively accrued by the pool\n            // Assume the caller is the liquidity pool and they receive the fee\n            // Keep tokens here by not transfering the _fee anywhere, it is accrued to the Bath Token's Bath Buddy\n            // token.transfer(address(this), _fee);\n\n            uint256 amountWithdrawn = amount.sub(_fee);\n            token.transfer(recipient, amountWithdrawn);\n\n            _erc20Released[address(token)] += amount;\n            emit ERC20Released(address(token), amount);\n\n            emit LogClaimBonusToken(\n                recipient,\n                msg.sender,\n                amountWithdrawn,\n                sharesWithdrawn,\n                token,\n                releasable\n            );\n        }\n    }"
}