{
    "Function": "setMaxAllowance",
    "File": "contracts/libraries/ExchangeHelpers.sol",
    "Parent Contracts": [],
    "High-Level Calls": [
        "SafeERC20",
        "IERC20",
        "SafeERC20",
        "SafeERC20"
    ],
    "Internal Calls": [],
    "Library Calls": [
        "safeApprove",
        "safeApprove",
        "safeApprove"
    ],
    "Low-Level Calls": [],
    "Code": "function setMaxAllowance(IERC20 _token, address _spender) internal {\n        uint256 _currentAllowance = _token.allowance(address(this), _spender);\n        if (_currentAllowance == 0) {\n            _token.safeApprove(_spender, type(uint256).max);\n        } else if (_currentAllowance != type(uint256).max) {\n            // Approve 0 first for tokens mitigating the race condition\n            _token.safeApprove(_spender, 0);\n            _token.safeApprove(_spender, type(uint256).max);\n        }\n    }"
}