Farseen0/scar-pairs huggingface dataset:
MEDIUM severity: Vulnerable function: ```\n  function upgradeWalletType() external {\n    if (!isWallet(msg.sender)) \n    revert WalletDo. ```\n  function upgradeWalletType() external {\n    if (!isWallet(msg.sender)) \n    revert WalletDoesntExist(msg.sender); uint8 fromWalletType = _walletDataMap[msg.sender].walletType;\n      _setWalletType(msg.sender, _upgradablePaths[fromWalletType]);\n      emit WalletUpgraded(msg.sender, fromWal

Vulnerable code:
```\n  function upgradeWalletType() external {\n    if (!isWallet(msg.sender)) \n    revert WalletDoesntExist(msg.sender); uint8 fromWalletType = _walletDataMap[msg.sender].walletType;\n      _setWalletType(msg.sender, _upgradablePaths[fromWalletType]);\n      emit WalletUpgraded(msg.sender, fromWalletType,\n  _upgradablePaths[fromWalletType]);\n  }\n```\n
MEDIUM severity: Vulnerable function: ```\nrequire(\_isOperator(msg.sender, \_from), EC\_58\_INVALID\_OPERATOR);\n```\. ```\nrequire(\_isOperator(msg.sender, \_from), EC\_58\_INVALID\_OPERATOR);\n```\n

Vulnerable code:
```\nrequire(\_isOperator(msg.sender, \_from), EC\_58\_INVALID\_OPERATOR);\n```\n
MEDIUM severity: Vulnerable function: ```\n      require(msg.sender == txData.user || recoverSignature(txData.transact. ```\n      require(msg.sender == txData.user || recoverSignature(txData.transactionId, relayerFee, "cancel", signature) == txData.user, "#C:022");\n\n      Asset.transferAsset(txData.sendingAssetId, payable(msg.sender), relayerFee);\n    }\n\n    // Get the amount to refund the user\n    uint256 toR

Vulnerable code:
```\n      require(msg.sender == txData.user || recoverSignature(txData.transactionId, relayerFee, "cancel", signature) == txData.user, "#C:022");\n\n      Asset.transferAsset(txData.sendingAssetId, payable(msg.sender), relayerFee);\n    }\n\n    // Get the amount to refund the user\n    uint256 toRefund;\n    unchecked {\n      toRefund = amount - relayerFee;\n    }\n\n    // Return locked funds to sending chain fallback\n    if (toRefund > 0) {\n      Asset.transferAsset(txData.sendingAssetId, payable(txData.sendingChainFallback), toRefund);\n    }\n  }\n\n} else {\n  // Receiver side, router liquidity is returned\n  if (txData.expiry >= block.timestamp) {\n    // Timeout has not expired and tx may only be cancelled by user\n    // Validate signature\n    require(msg.sender == txData.user || recoverSignature(txData.transactionId, relayerFee, "cancel", signature) == txData.user, "#C:022");\n```\n
MEDIUM severity: Vulnerable function: ```\nfunction processDepositCancellation(\n  GMXTypes.Store storage self\n) external {\n  GMXChecks.. ```\nfunction processDepositCancellation(\n  GMXTypes.Store storage self\n) external {\n  GMXChecks.beforeProcessDepositCancellationChecks(self);\n // rest of code\n // Transfer requested withdraw asset to user\n IERC20(self.depositCache.depositParams.token).safeTransfer(\n  self.depositCache.user,\

Vulnerable code:
```\nfunction processDepositCancellation(\n  GMXTypes.Store storage self\n) external {\n  GMXChecks.beforeProcessDepositCancellationChecks(self);\n // rest of code\n // Transfer requested withdraw asset to user\n IERC20(self.depositCache.depositParams.token).safeTransfer(\n  self.depositCache.user,\n  self.depositCache.depositParams.amt\n );\n  // rest of code\n  self.status = GMXTypes.Status.Open;\n\n  emit DepositCancelled(self.depositCache.user);\n}\n```\n
MEDIUM severity: Vulnerable function: ```\n        uint256 totalUserCollateral = totalCollateralValue(_collateralAddre. ```\n        uint256 totalUserCollateral = totalCollateralValue(_collateralAddress, _loanHolder);\n        uint256 proposedLiquidationAmount;\n        { //scope block for liquidationAmount due to stack too deep\n            uint256 liquidationAmount = viewLiquidatableAmount(totalUserCollateral, 1 et

Vulnerable code:
```\n        uint256 totalUserCollateral = totalCollateralValue(_collateralAddress, _loanHolder);\n        uint256 proposedLiquidationAmount;\n        { //scope block for liquidationAmount due to stack too deep\n            uint256 liquidationAmount = viewLiquidatableAmount(totalUserCollateral, 1 ether, isoUSDBorrowed, liquidatableMargin);\n            require(liquidationAmount > 0 , "Loan not liquidatable");\n            proposedLiquidationAmount = _calculateProposedReturnedCapital(_collateralAddress, _loanNFTs, _partialPercentage);\n            require(proposedLiquidationAmount <= liquidationAmount, "excessive liquidation suggested");\n        }\n        uint256 isoUSDreturning = proposedLiquidationAmount*LIQUIDATION_RETURN/LOAN_SCALE;\n        if(proposedLiquidationAmount >= totalUserCollateral){\n            //@audit bad debt cleared here\n        }\n```\n
MEDIUM severity: Vulnerable function: ```\nif (\_openDate != 0) {\n    \_setOpenDate(\_openDate);\n}\n```\n. ```\nif (\_openDate != 0) {\n    \_setOpenDate(\_openDate);\n}\n```\n

Vulnerable code:
```\nif (\_openDate != 0) {\n    \_setOpenDate(\_openDate);\n}\n```\n
MEDIUM severity: Vulnerable function: ```\nNFTTypes nftType;\n// CryptoPunks NFTs\nif (collateral_ == 0xb47e3cd837dDF8. ```\nNFTTypes nftType;\n// CryptoPunks NFTs\nif (collateral_ == 0xb47e3cd837dDF8e4c57F05d70Ab865de6e193BBB ) {\n nftType = NFTTypes.CRYPTOPUNKS;\n}\n// CryptoKitties and CryptoFighters NFTs\nelse if (collateral_ == 0x06012c8cf97BEaD5deAe237070F9587f8E7A266d || collateral_ ==  0x87d598064c736dd0C712D

Vulnerable code:
```\nNFTTypes nftType;\n// CryptoPunks NFTs\nif (collateral_ == 0xb47e3cd837dDF8e4c57F05d70Ab865de6e193BBB ) {\n nftType = NFTTypes.CRYPTOPUNKS;\n}\n// CryptoKitties and CryptoFighters NFTs\nelse if (collateral_ == 0x06012c8cf97BEaD5deAe237070F9587f8E7A266d || collateral_ ==  0x87d598064c736dd0C712D329aFCFAA0Ccc1921A1) {\n nftType = NFTTypes.CRYPTOKITTIES;\n}\n// All other NFTs that support the EIP721 standard\nelse {\n // Here 0x80ac58cd is the ERC721 interface Id\n // Neither a standard NFT nor a non-standard supported NFT(punk, kitty or fighter)\n try IERC165(collateral_).supportsInterface(0x80ac58cd) returns (bool supportsERC721Interface) {\n  if (!supportsERC721Interface) revert NFTNotSupported();\n } catch {\n  revert NFTNotSupported();\n }\n\n nftType = NFTTypes.STANDARD_ERC721;\n}\n```\n
MEDIUM severity: Vulnerable function: ```\n(address[] memory modules,) = GnosisSafe(payable(_safe)).getModulesPaginate. ```\n(address[] memory modules,) = GnosisSafe(payable(_safe)).getModulesPaginated(SENTINEL_MODULES, 5);\nuint256 existingModuleCount = modules.length;\n```\n

Vulnerable code:
```\n(address[] memory modules,) = GnosisSafe(payable(_safe)).getModulesPaginated(SENTINEL_MODULES, 5);\nuint256 existingModuleCount = modules.length;\n```\n
MEDIUM severity: Vulnerable function: ```\nif (calcBase.mul(submissionCount).div(rocketDAONodeTrusted.getMemberCount(). ```\nif (calcBase.mul(submissionCount).div(rocketDAONodeTrusted.getMemberCount()) >= rocketDAOProtocolSettingsNetwork.getNodeConsensusThreshold()) {\n    setMinipoolWithdrawable(\_minipoolAddress, \_stakingStartBalance, \_stakingEndBalance);\n}\n```\n

Vulnerable code:
```\nif (calcBase.mul(submissionCount).div(rocketDAONodeTrusted.getMemberCount()) >= rocketDAOProtocolSettingsNetwork.getNodeConsensusThreshold()) {\n    setMinipoolWithdrawable(\_minipoolAddress, \_stakingStartBalance, \_stakingEndBalance);\n}\n```\n
MEDIUM severity: Vulnerable function: ```\nFile: BondFixedExpiryTeller.sol\n        // If fee is greater than the crea. ```\nFile: BondFixedExpiryTeller.sol\n        // If fee is greater than the create discount, then calculate the fee and store it\n        // Otherwise, fee is zero.\n        if (protocolFee > createFeeDiscount) {\n            // Calculate fee amount\n            uint256 feeAmount = amount_.mulDiv(pr

Vulnerable code:
```\nFile: BondFixedExpiryTeller.sol\n        // If fee is greater than the create discount, then calculate the fee and store it\n        // Otherwise, fee is zero.\n        if (protocolFee > createFeeDiscount) {\n            // Calculate fee amount\n            uint256 feeAmount = amount_.mulDiv(protocolFee - createFeeDiscount, FEE_DECIMALS);\n            rewards[_protocol][underlying_] += feeAmount;\n\n            // Mint new bond tokens\n            bondToken.mint(msg.sender, amount_ - feeAmount);\n\n            return (bondToken, amount_ - feeAmount);\n        } else {\n            // Mint new bond tokens\n            bondToken.mint(msg.sender, amount_);\n\n            return (bondToken, amount_);\n        }\n```\n
HIGH severity: Vulnerable function: ```\nmodifier onlyLatestRocketNetworkContract() {\n    // The owner and other co. ```\nmodifier onlyLatestRocketNetworkContract() {\n    // The owner and other contracts are only allowed to set the storage upon deployment to register the initial contracts/settings, afterwards their direct access is disabled\n    if (boolStorage[keccak256(abi.encodePacked("contract.storage.initial

Vulnerable code:
```\nmodifier onlyLatestRocketNetworkContract() {\n    // The owner and other contracts are only allowed to set the storage upon deployment to register the initial contracts/settings, afterwards their direct access is disabled\n    if (boolStorage[keccak256(abi.encodePacked("contract.storage.initialised"))] == true) {\n        // Make sure the access is permitted to only contracts in our Dapp\n        require(boolStorage[keccak256(abi.encodePacked("contract.exists", msg.sender))], "Invalid or outdated network contract");\n    }\n    \_;\n}\n```\n
HIGH severity: Vulnerable function: ```\nfunction addLiquidity(\n    LiquidityParams calldata lp,\n    uint deadline\n) external overrid. ```\nfunction addLiquidity(\n    LiquidityParams calldata lp,\n    uint deadline\n) external override ensure(deadline) returns (uint256 amountBase) {\n    if (IDAOfiV1Factory(factory).getPair(\n        lp.tokenBase,\n        lp.tokenQuote,\n        lp.slopeNumerator,\n        lp.n,\n        lp.fee\n

Vulnerable code:
```\nfunction addLiquidity(\n    LiquidityParams calldata lp,\n    uint deadline\n) external override ensure(deadline) returns (uint256 amountBase) {\n    if (IDAOfiV1Factory(factory).getPair(\n        lp.tokenBase,\n        lp.tokenQuote,\n        lp.slopeNumerator,\n        lp.n,\n        lp.fee\n    ) == address(0)) {\n        IDAOfiV1Factory(factory).createPair(\n            address(this),\n            lp.tokenBase,\n            lp.tokenQuote,\n            msg.sender,\n            lp.slopeNumerator,\n            lp.n,\n            lp.fee\n        );\n    }\n    address pair = DAOfiV1Library.pairFor(\n        factory, lp.tokenBase, lp.tokenQuote, lp.slopeNumerator, lp.n, lp.fee\n    );\n\n    TransferHelper.safeTransferFrom(lp.tokenBase, lp.sender, pair, lp.amountBase);\n    TransferHelper.safeTransferFrom(lp.tokenQuote, lp.sender, pair, lp.amountQuote);\n    amountBase = IDAOfiV1Pair(pair).deposit(lp.to);\n}\n```\n
HIGH severity: Vulnerable function: ```\n    uint256 amountOut; //amount received by trade\n    bool stablePool; //i. ```\n    uint256 amountOut; //amount received by trade\n    bool stablePool; //if the traded pool is stable or volatile.\n    (amountOut, stablePool) = router.getAmountOut(HUNDRED_TOKENS, token1, USDC);\n    require(stablePool == stable, "pricing occuring through wrong pool" );\n```\n

Vulnerable code:
```\n    uint256 amountOut; //amount received by trade\n    bool stablePool; //if the traded pool is stable or volatile.\n    (amountOut, stablePool) = router.getAmountOut(HUNDRED_TOKENS, token1, USDC);\n    require(stablePool == stable, "pricing occuring through wrong pool" );\n```\n
MEDIUM severity: Vulnerable function: ```\nFile: TellerV2.sol\n\n       if (bidDefaultDuration[_bidId] == 0) return fa. ```\nFile: TellerV2.sol\n\n       if (bidDefaultDuration[_bidId] == 0) return false;\n```\n

Vulnerable code:
```\nFile: TellerV2.sol\n\n       if (bidDefaultDuration[_bidId] == 0) return false;\n```\n
MEDIUM severity: Vulnerable function: ```\nfunction addValidators(\n uint256 \_operatorIndex,\n uint256 \_keyCount,\n bytes calldata \_pub. ```\nfunction addValidators(\n uint256 \_operatorIndex,\n uint256 \_keyCount,\n bytes calldata \_publicKeys,\n bytes calldata \_signatures\n) external onlyActiveOperator(\_operatorIndex) {\n if (\_keyCount == 0) {\n revert InvalidArgument();\n }\n\n if (\_publicKeys.length % PUBLIC\_KEY\_LENGTH != 0

Vulnerable code:
```\nfunction addValidators(\n uint256 \_operatorIndex,\n uint256 \_keyCount,\n bytes calldata \_publicKeys,\n bytes calldata \_signatures\n) external onlyActiveOperator(\_operatorIndex) {\n if (\_keyCount == 0) {\n revert InvalidArgument();\n }\n\n if (\_publicKeys.length % PUBLIC\_KEY\_LENGTH != 0 || \_publicKeys.length / PUBLIC\_KEY\_LENGTH != \_keyCount) {\n revert InvalidPublicKeys();\n }\n```\n
MEDIUM severity: Vulnerable function: ```\nabstract contract BaseStrategyVault is Initializable, IStrategyVault {\n   . ```\nabstract contract BaseStrategyVault is Initializable, IStrategyVault {\n    using TokenUtils for IERC20;\n    using TradeHandler for Trade;\n\n    /// @notice Hardcoded on the implementation contract during deployment\n    NotionalProxy public immutable NOTIONAL;\n    ITradingModule public immu

Vulnerable code:
```\nabstract contract BaseStrategyVault is Initializable, IStrategyVault {\n    using TokenUtils for IERC20;\n    using TradeHandler for Trade;\n\n    /// @notice Hardcoded on the implementation contract during deployment\n    NotionalProxy public immutable NOTIONAL;\n    ITradingModule public immutable TRADING_MODULE;\n    uint8 constant internal INTERNAL_TOKEN_DECIMALS = 8;\n    \n    ..SNIP..\n    \n    // Storage gap for future potential upgrades\n    uint256[45] private __gap;\n }\n```\n
MEDIUM severity: Vulnerable function: ```\n    function removeVault(address vaultAddress) external onlyUpdater {\n        Errors.verifyNot. ```\n    function removeVault(address vaultAddress) external onlyUpdater {\n        Errors.verifyNotZero(vaultAddress, "vaultAddress");\n\n        // remove from vaults list\n        if (!_vaults.remove(vaultAddress)) revert VaultNotFound(vaultAddress);\n\n        address asset = ILMPVault(vaultAddr

Vulnerable code:
```\n    function removeVault(address vaultAddress) external onlyUpdater {\n        Errors.verifyNotZero(vaultAddress, "vaultAddress");\n\n        // remove from vaults list\n        if (!_vaults.remove(vaultAddress)) revert VaultNotFound(vaultAddress);\n\n        address asset = ILMPVault(vaultAddress).asset();\n\n        // remove from assets list if this was the last vault for that asset\n        if (_vaultsByAsset[asset].length() == 1) {\n            //slither-disable-next-line unused-return\n            _assets.remove(asset);\n        }\n\n        // remove from vaultsByAsset mapping\n        if (!_vaultsByAsset[asset].remove(vaultAddress)) revert VaultNotFound(vaultAddress);\n\n        emit VaultRemoved(asset, vaultAddress);\n    }\n```\n
MEDIUM severity: Vulnerable function: ```\n    modifier keep(\n        KeepConfig memory config,\n        bytes callda. ```\n    modifier keep(\n        KeepConfig memory config,\n        bytes calldata applicableCalldata,\n        uint256 applicableValue,\n        bytes memory data\n    ) {\n        uint256 startGas = gasleft();\n\n\n        _;\n\n\n        uint256 applicableGas = startGas - gasleft();\n        (UFi

Vulnerable code:
```\n    modifier keep(\n        KeepConfig memory config,\n        bytes calldata applicableCalldata,\n        uint256 applicableValue,\n        bytes memory data\n    ) {\n        uint256 startGas = gasleft();\n\n\n        _;\n\n\n        uint256 applicableGas = startGas - gasleft();\n        (UFixed18 baseFee, UFixed18 calldataFee) = (\n            _baseFee(applicableGas, config.multiplierBase, config.bufferBase),\n            _calldataFee(applicableCalldata, config.multiplierCalldata, config.bufferCalldata)\n        );\n\n\n        UFixed18 keeperFee = UFixed18.wrap(applicableValue).add(baseFee).add(calldataFee).mul(_etherPrice());\n        _raiseKeeperFee(keeperFee, data);\n        keeperToken().push(msg.sender, keeperFee);\n\n\n        emit KeeperCall(msg.sender, applicableGas, applicableValue, baseFee, calldataFee, keeperFee);\n    }\n```\n
HIGH severity: Vulnerable function: ```\nlet l\_success := staticcall(sub(gas(), 2000),8,mPtr,0x180,0x00,0x20)\n// l. ```\nlet l\_success := staticcall(sub(gas(), 2000),8,mPtr,0x180,0x00,0x20)\n// l\_success := true\nmstore(add(state, state\_success), and(l\_success,mload(add(state, state\_success))))\n```\n

Vulnerable code:
```\nlet l\_success := staticcall(sub(gas(), 2000),8,mPtr,0x180,0x00,0x20)\n// l\_success := true\nmstore(add(state, state\_success), and(l\_success,mload(add(state, state\_success))))\n```\n
MEDIUM severity: Vulnerable function: ```\nOHM token balance: 100_000\nwstETH token balance: 1_000\nTotal LP: 10_000\n. ```\nOHM token balance: 100_000\nwstETH token balance: 1_000\nTotal LP: 10_000\n```\n

Vulnerable code:
```\nOHM token balance: 100_000\nwstETH token balance: 1_000\nTotal LP: 10_000\n```\n
HIGH severity: Vulnerable function: ```\n    function test_Audit_createProfile() public {\n        // create profile\n        bytes32 ne. ```\n    function test_Audit_createProfile() public {\n        // create profile\n        bytes32 newProfileId = registry().createProfile(nonce, name, metadata, profile1_owner(), profile1_members());\n        Registry.Profile memory profile = registry().getProfileById(newProfileId);\n        Anchor 

Vulnerable code:
```\n    function test_Audit_createProfile() public {\n        // create profile\n        bytes32 newProfileId = registry().createProfile(nonce, name, metadata, profile1_owner(), profile1_members());\n        Registry.Profile memory profile = registry().getProfileById(newProfileId);\n        Anchor _anchor = Anchor(payable(profile.anchor));\n\n        console.log("registry address: %s", address(registry()));\n        console.log("anchor address: %s", profile.anchor);\n        console.log("anchor.registry: %s", address(_anchor.registry()));\n\n        emit log_named_bytes32("profile.id", profile.id);\n        emit log_named_bytes32("anchor.profile.id", _anchor.profileId());\n\n        Anchor _anchor_proxy = Anchor(payable(address( _anchor.registry())));\n        assertEq(address(registry()),address(_anchor.registry()) ,"wrong anchor registry");\n    }\n```\n
MEDIUM severity: Vulnerable function: ```\nfunction submitData(\n SubmissionData calldata \_submissionData\n)\n external\n whenTypeNotPaus. ```\nfunction submitData(\n SubmissionData calldata \_submissionData\n)\n external\n whenTypeNotPaused(PROVING\_SYSTEM\_PAUSE\_TYPE)\n whenTypeNotPaused(GENERAL\_PAUSE\_TYPE)\n onlyRole(OPERATOR\_ROLE)\n{\n \_submitData(\_submissionData);\n}\n```\n

Vulnerable code:
```\nfunction submitData(\n SubmissionData calldata \_submissionData\n)\n external\n whenTypeNotPaused(PROVING\_SYSTEM\_PAUSE\_TYPE)\n whenTypeNotPaused(GENERAL\_PAUSE\_TYPE)\n onlyRole(OPERATOR\_ROLE)\n{\n \_submitData(\_submissionData);\n}\n```\n
MEDIUM severity: Vulnerable function: ```\nfunction setRewardRate(uint256 rewardRate)\n public\n virtual\n override\n returns (bool succes. ```\nfunction setRewardRate(uint256 rewardRate)\n public\n virtual\n override\n returns (bool success)\n{\n // range checks for rewardRate. Since rewardRate cannot be more than 100%, the max cap\n // is \_valueDivisor \* 100, which then brings the fees to 100 (percentage)\n require(rewardRate <= \_v

Vulnerable code:
```\nfunction setRewardRate(uint256 rewardRate)\n public\n virtual\n override\n returns (bool success)\n{\n // range checks for rewardRate. Since rewardRate cannot be more than 100%, the max cap\n // is \_valueDivisor \* 100, which then brings the fees to 100 (percentage)\n require(rewardRate <= \_valueDivisor.mul(100), "ST17");\n require(hasRole(DEFAULT\_ADMIN\_ROLE, \_msgSender()), "ST2");\n \_rewardRate.push(rewardRate);\n \_lastMovingRewardTimestamp.push(block.timestamp);\n emit SetRewardRate(rewardRate);\n\n return true;\n}\n```\n
HIGH severity: Vulnerable function: ```\n it("previewWithdraw reverts if buyer has too many contracts", async () => . ```\n it("previewWithdraw reverts if buyer has too many contracts", async () => {\n          assert.isEmpty(await auction.getEpochsByBuyer(addresses.buyer1));\n\n          await asset\n            .connect(signers.buyer1)\n            .approve(addresses.auction, ethers.constants.MaxUint256);\n\n    

Vulnerable code:
```\n it("previewWithdraw reverts if buyer has too many contracts", async () => {\n          assert.isEmpty(await auction.getEpochsByBuyer(addresses.buyer1));\n\n          await asset\n            .connect(signers.buyer1)\n            .approve(addresses.auction, ethers.constants.MaxUint256);\n\n          const totalContracts = await auction.getTotalContracts(epoch);\n          await auction.addLimitOrder(\n            epoch,\n            fixedFromFloat(params.price.max),\n            totalContracts.mul(2)\n          );\n\n          await auction.addLimitOrder(\n            epoch,\n            fixedFromFloat(params.price.max),\n            totalContracts.div(2)\n          );\n\n          const epochByBuyer = await auction.getEpochsByBuyer(addresses.buyer1);\n\n          assert.equal(epochByBuyer.length, 1);\n          assert.bnEqual(epochByBuyer[0], epoch);\n          \n          await expect(auction.callStatic[\n            "previewWithdraw(uint64)"\n          ](epoch)).to.be.reverted;\n        });\n```\n
HIGH severity: Vulnerable function: ```\nfunction clearRequest(\n    uint256 reqID_,\n    bool repayDirect_,\n    bool isCallback_\n) ex. ```\nfunction clearRequest(\n    uint256 reqID_,\n    bool repayDirect_,\n    bool isCallback_\n) external returns (uint256 loanID) {\n    Request memory req = requests[reqID_];\n\n    // If necessary, ensure lender implements the CoolerCallback abstract.\n    if (isCallback_ && !CoolerCallback(msg.

Vulnerable code:
```\nfunction clearRequest(\n    uint256 reqID_,\n    bool repayDirect_,\n    bool isCallback_\n) external returns (uint256 loanID) {\n    Request memory req = requests[reqID_];\n\n    // If necessary, ensure lender implements the CoolerCallback abstract.\n    if (isCallback_ && !CoolerCallback(msg.sender).isCoolerCallback()) revert NotCoolerCallback();\n\n    // Ensure loan request is active. \n    if (!req.active) revert Deactivated();\n\n    // Clear the loan request in memory.\n    req.active = false;\n\n    // Calculate and store loan terms.\n    uint256 interest = interestFor(req.amount, req.interest, req.duration);\n    uint256 collat = collateralFor(req.amount, req.loanToCollateral);\n    uint256 expiration = block.timestamp + req.duration;\n    loanID = loans.length;\n    loans.push(\n        Loan({\n            request: req,\n            amount: req.amount + interest,\n            unclaimed: 0,\n            collateral: collat,\n            expiry: expiration,\n            lender: msg.sender,\n            repayDirect: repayDirect_,\n            callback: isCallback_\n        })\n    );\n\n    // Clear the loan request storage.\n    requests[reqID_].active = false;\n\n    // Transfer debt tokens to the owner of the request.\n    debt().safeTransferFrom(msg.sender, owner(), req.amount);\n\n    // Log the event.\n    factory().newEvent(reqID_, CoolerFactory.Events.ClearRequest, 0);\n}\n```\n
MEDIUM severity: Vulnerable function: ```\n/**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is. ```\n/**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\nfunction _mint(

Vulnerable code:
```\n/**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\nfunction _mint(address to, uint256 tokenId) internal virtual {\n```\n
HIGH severity: Vulnerable function: ```\nif (PublicVault(owner).timeToEpochEnd() <= COLLATERAL_TOKEN.auctionWindow(). ```\nif (PublicVault(owner).timeToEpochEnd() <= COLLATERAL_TOKEN.auctionWindow())\n```\n

Vulnerable code:
```\nif (PublicVault(owner).timeToEpochEnd() <= COLLATERAL_TOKEN.auctionWindow())\n```\n