{
    "Function": "withdraw",
    "File": "src/Facets/WithdrawFacet.sol",
    "Parent Contracts": [],
    "High-Level Calls": [
        "IERC20",
        "SafeERC20",
        "LibDiamond"
    ],
    "Internal Calls": [
        "assert(bool)",
        "assert(bool)"
    ],
    "Library Calls": [
        "safeTransfer",
        "enforceIsContractOwner"
    ],
    "Low-Level Calls": [],
    "Code": "function withdraw(\n        address _assetAddress,\n        address _to,\n        uint256 _amount\n    ) public {\n        LibDiamond.enforceIsContractOwner();\n        address sendTo = (_to == address(0)) ? msg.sender : _to;\n        uint256 assetBalance;\n        if (_assetAddress == NATIVE_ASSET) {\n            address self = address(this); // workaround for a possible solidity bug\n            assert(_amount <= self.balance);\n            payable(sendTo).transfer(_amount);\n        } else {\n            assetBalance = IERC20(_assetAddress).balanceOf(address(this));\n            assert(_amount <= assetBalance);\n            IERC20(_assetAddress).safeTransfer(sendTo, _amount);\n        }\n        emit LogWithdraw(sendTo, _assetAddress, _amount);\n    }"
}