{
    "Function": "exitEarly",
    "File": "contracts/Auction/AuctionEscapeHatch.sol",
    "Parent Contracts": [
        "contracts/StabilizedPoolExtensions/DexHandlerExtension.sol",
        "contracts/StabilizedPoolExtensions/AuctionExtension.sol",
        "contracts/StabilizedPoolExtensions/StabilizedPoolUnit.sol",
        "contracts/Permissions.sol",
        "lib/openzeppelin-contracts/contracts/security/ReentrancyGuard.sol",
        "lib/openzeppelin-contracts/contracts/access/AccessControl.sol",
        "lib/openzeppelin-contracts/contracts/utils/introspection/ERC165.sol",
        "lib/openzeppelin-contracts/contracts/utils/introspection/IERC165.sol",
        "lib/openzeppelin-contracts/contracts/access/IAccessControl.sol",
        "lib/openzeppelin-contracts/contracts/utils/Context.sol"
    ],
    "High-Level Calls": [
        "IDexHandler",
        "IAuction",
        "IBurnMintableERC20",
        "SafeERC20"
    ],
    "Internal Calls": [
        "nonReentrant",
        "onlyActive",
        "earlyExitReturn",
        "require(bool,string)",
        "require(bool,string)"
    ],
    "Library Calls": [
        "safeTransfer"
    ],
    "Low-Level Calls": [],
    "Code": "function exitEarly(\n    uint256 _auctionId,\n    uint256 amount,\n    uint256 minOut\n  ) external nonReentrant onlyActive {\n    AuctionExits storage auctionExits = auctionEarlyExits[_auctionId];\n\n    (, uint256 maltQuantity, uint256 newAmount) = earlyExitReturn(\n      msg.sender,\n      _auctionId,\n      amount\n    );\n\n    require(maltQuantity > 0, \"ExitEarly: Insufficient output\");\n\n    malt.mint(address(dexHandler), maltQuantity);\n    // Early exits happen below peg in recovery mode\n    // So risk of sandwich is very low\n    uint256 amountOut = dexHandler.sellMalt(maltQuantity, 5000);\n\n    require(amountOut >= minOut, \"EarlyExit: Insufficient output\");\n\n    auctionExits.exitedEarly += newAmount;\n    auctionExits.earlyExitReturn += amountOut;\n    auctionExits.maltUsed += maltQuantity;\n    auctionExits.accountExits[msg.sender].exitedEarly += newAmount;\n    auctionExits.accountExits[msg.sender].earlyExitReturn += amountOut;\n    auctionExits.accountExits[msg.sender].maltUsed += maltQuantity;\n\n    auction.accountExit(msg.sender, _auctionId, newAmount);\n\n    collateralToken.safeTransfer(msg.sender, amountOut);\n    emit EarlyExit(msg.sender, newAmount, amountOut);\n  }"
}