{
    "Function": "slitherConstructorConstantVariables",
    "File": "src/Libraries/LibAsset.sol",
    "Parent Contracts": [],
    "High-Level Calls": [],
    "Internal Calls": [],
    "Library Calls": [],
    "Low-Level Calls": [],
    "Code": "library LibAsset {\n    uint256 private constant MAX_INT = 2**256 - 1;\n\n    /**\n     * @dev All native assets use the empty address for their asset id\n     *      by convention\n     */\n    address internal constant NATIVE_ASSETID = address(0);\n\n    /**\n     * @notice Determines whether the given assetId is the native asset\n     * @param assetId The asset identifier to evaluate\n     * @return Boolean indicating if the asset is the native asset\n     */\n    function isNativeAsset(address assetId) internal pure returns (bool) {\n        return assetId == NATIVE_ASSETID;\n    }\n\n    /**\n     * @notice Gets the balance of the inheriting contract for the given asset\n     * @param assetId The asset identifier to get the balance of\n     * @return Balance held by contracts using this library\n     */\n    function getOwnBalance(address assetId) internal view returns (uint256) {\n        return isNativeAsset(assetId) ? address(this).balance : IERC20(assetId).balanceOf(address(this));\n    }\n\n    /**\n     * @notice Transfers ether from the inheriting contract to a given\n     *         recipient\n     * @param recipient Address to send ether to\n     * @param amount Amount to send to given recipient\n     */\n    function transferNativeAsset(address payable recipient, uint256 amount) internal {\n        // solhint-disable-next-line avoid-low-level-calls\n        (bool success, ) = recipient.call{ value: amount }(\"\");\n        require(success, \"#TNA:028\");\n    }\n\n    /**\n     * @notice Gives approval for another address to spend tokens\n     * @param assetId Token address to transfer\n     * @param spender Address to give spend approval to\n     * @param amount Amount to approve for spending\n     */\n    function approveERC20(\n        IERC20 assetId,\n        address spender,\n        uint256 amount\n    ) internal {\n        if (isNativeAsset(address(assetId))) return;\n        uint256 allowance = assetId.allowance(address(this), spender);\n        if (allowance < amount) {\n            if (allowance > 0) SafeERC20.safeApprove(IERC20(assetId), spender, 0);\n            SafeERC20.safeApprove(IERC20(assetId), spender, MAX_INT);\n        }\n    }\n\n    /**\n     * @notice Transfers tokens from the inheriting contract to a given\n     *         recipient\n     * @param assetId Token address to transfer\n     * @param recipient Address to send ether to\n     * @param amount Amount to send to given recipient\n     */\n    function transferERC20(\n        address assetId,\n        address recipient,\n        uint256 amount\n    ) internal {\n        SafeERC20.safeTransfer(IERC20(assetId), recipient, amount);\n    }\n\n    /**\n     * @notice Transfers tokens from a sender to a given recipient\n     * @param assetId Token address to transfer\n     * @param from Address of sender/owner\n     * @param to Address of recipient/spender\n     * @param amount Amount to transfer from owner to spender\n     */\n    function transferFromERC20(\n        address assetId,\n        address from,\n        address to,\n        uint256 amount\n    ) internal {\n        SafeERC20.safeTransferFrom(IERC20(assetId), from, to, amount);\n    }\n\n    /**\n     * @notice Increases the allowance of a token to a spender\n     * @param assetId Token address of asset to increase allowance of\n     * @param spender Account whos allowance is increased\n     * @param amount Amount to increase allowance by\n     */\n    function increaseERC20Allowance(\n        address assetId,\n        address spender,\n        uint256 amount\n    ) internal {\n        require(!isNativeAsset(assetId), \"#IA:034\");\n        SafeERC20.safeIncreaseAllowance(IERC20(assetId), spender, amount);\n    }\n\n    /**\n     * @notice Decreases the allowance of a token to a spender\n     * @param assetId Token address of asset to decrease allowance of\n     * @param spender Account whos allowance is decreased\n     * @param amount Amount to decrease allowance by\n     */\n    function decreaseERC20Allowance(\n        address assetId,\n        address spender,\n        uint256 amount\n    ) internal {\n        require(!isNativeAsset(assetId), \"#DA:034\");\n        SafeERC20.safeDecreaseAllowance(IERC20(assetId), spender, amount);\n    }\n\n    /**\n     * @notice Wrapper function to transfer a given asset (native or erc20) to\n     *         some recipient. Should handle all non-compliant return value\n     *         tokens as well by using the SafeERC20 contract by open zeppelin.\n     * @param assetId Asset id for transfer (address(0) for native asset,\n     *                token address for erc20s)\n     * @param recipient Address to send asset to\n     * @param amount Amount to send to given recipient\n     */\n    function transferAsset(\n        address assetId,\n        address payable recipient,\n        uint256 amount\n    ) internal {\n        isNativeAsset(assetId) ? transferNativeAsset(recipient, amount) : transferERC20(assetId, recipient, amount);\n    }\n}"
}