Farseen0/scar-pairs huggingface dataset:
MEDIUM severity: The vulnerability in the `swapValidatorDetails` function lies in the way it loads and stores BLS pub. The vulnerability in the `swapValidatorDetails` function lies in the way it loads and stores BLS public keys from storage to memory. Specifically, when swapping the details of validators, the function loads two keys into memory from storage, but incorrectly writes the keys to memory, resulting in pe...

Vulnerable code:
```\nVALIDATOR_DETAILS_POSITION.swapValidatorDetails(operatorId, fromIndex, validators.exited, validatorCount)\n```\n```\nkeyOffset1 = position.computeStorageKeyOffset(operatorId, startIndex1)\nkeyOffset2 = position.computeStorageKeyOffset(operatorId, startIndex2)\n\nassembly {\n    // Load key1 into memory\n    let _part1 := sload(keyOffset1) // Load bytes 0..31\n    let _part2 := sload(add(keyOffset1, 1)) // Load bytes 32..47\n    mstore(add(key1, 0x20), _part1) // Store bytes 0..31\n    mstore(add(key1, 0x30), shr(128, _part2)) // Store bytes 16..47\n\n    isEmpty := iszero(or(_part1, _part2)) // Store if key1 is empty\n\n    // Load key2 into memory\n    let _part1 := sload(keyOffset2) // Load bytes 0..31\n    let _part2 := sload(add(keyOffset2, 1)) // Load bytes 32..47\n    mstore(add(key2, 0x20), _part1) // Store bytes 0..31\n    mstore(add(key2, 0x30), shr(128, _part2)) // Store bytes 16..47\n\n    isEmpty := or(isEmpty, iszero(or(_part1, _part2))) // Store if key1 or key2 is empty\n}\n```\n```\nbytes memory key1 = new bytes(48);\nbytes memory key2 = new bytes(48);\n```\n```\nmstore(add(key1, 0x20), _part1)\nmstore(add(key1, 0x30), shr(128, _part2))\n```\n```\nbytes32 _part1 = 0x95cfcb859956953f9834f8b14cdaa939e472a2b5d0471addbe490b97ed99c6eb;\n```\n```\nbytes32 _part2 = bytes32(bytes16(0x8af94bc3ba4d4bfa93d087d522e4b78d));\n```\n```\nbytes memory key1 = new bytes(48);\n```\n```\nassembly {\n    mstore(add(key1, 0x20), _part1)  # Store bytes 0..31\n    mstore(add(key1, 0x30), shr(128, _part2))  # Store bytes 16..47\n}\n```\n```\n➜!memdump\n[0x00:0x20]: 0x0000000000000000000000000000000000000000000000000000000000000000\n[0x20:0x40]: 0x0000000000000000000000000000000000000000000000000000000000000000\n[0x40:0x60]: 0x00000000000000000000000000000000000000000000000000000000000000e0\n[0x60:0x80]: 0x0000000000000000000000000000000000000000000000000000000000000000\n[0x80:0xa0]: 0x0000000000000000000000000000000000000000000000000000000000000030\n[0xa0:0xc0]: 0x95cfcb859956953f9834f8b14cdaa93900000000000000000000000000000000\n[0xc0:0xe0]: 0x8af94bc3ba4d4bfa93d087d522e4b78d00000000000000000000000000000000\n```
MEDIUM severity: The FraxEtherRedemptionQueue's `rebalancer` address's withdrawal request waiting period is excessive. The FraxEtherRedemptionQueue's `rebalancer` address's withdrawal request waiting period is excessively long, which can lead to a significant duration where certain protocol functions are either unusable or operate at a diminished capacity. This prolonged waiting period is stored in the `redemptionQu...

Vulnerable code:
```\nfunction prefundedRedeem(address recipient) external virtual returns (uint256, uint256) {\n    // SOME CODE\n\n    if (assets > bufferEthCache) {\n        revert InsufficientBuffer();\n    }\n\n    // SOME CODE\n}\n```\n```\nfunction prefundedDeposit() external nonReentrant returns (uint256, uint256) {\n    if (targetBufferEth >= availableEth + queueEthCache) {\n        bufferEth = availableEth.toUint128();\n        return (assets, shares);\n    }\n}\n```
MEDIUM severity: The `DAOfiV1Pair.deposit()` function is responsible for adding liquidity to the pool. However, it ha. The `DAOfiV1Pair.deposit()` function is responsible for adding liquidity to the pool. However, it has a critical flaw that allows an attacker to lock the pool by making a deposit of zero. This is because the function does not verify that the deposit amount is greater than zero before processing the...

Vulnerable code:
```\nfunction deposit(address to) external override lock returns (uint256 amountBaseOut) {\n    require(msg.sender == router, 'DAOfiV1: FORBIDDEN_DEPOSIT');\n    require(deposited == false, 'DAOfiV1: DOUBLE_DEPOSIT');\n\n    reserveBase = IERC20(baseToken).balanceOf(address(this));\n    reserveQuote = IERC20(quoteToken).balanceOf(address(this));\n\n    deposited = true;\n\n    if (reserveQuote > 0) {\n        supply = amountBaseOut = getBaseOut(reserveQuote);\n\n        if (amountBaseOut > 0) {\n            _safeTransfer(baseToken, to, amountBaseOut);\n            reserveBase = reserveBase.sub(amountBaseOut);\n        }\n    }\n\n    emit Deposit(msg.sender, reserveBase, reserveQuote, amountBaseOut, to);\n}\n```
MEDIUM severity: The assimilators in the codebase fail to adhere to the ERC20 standard's requirements for the `transf. The assimilators in the codebase fail to adhere to the ERC20 standard's requirements for the `transfer` and `transferFrom` methods. Specifically, they do not properly handle the return values of these methods, which can lead to unexpected behavior and potential security vulnerabilities.\n\nAccording...

Vulnerable code:
```\ndai.transferFrom(\n    msg.sender,\n    address(this),\n    _amount\n)\n```\n```\ndai.transfer(_dst, _amount)\n```
MEDIUM severity: The `MarketFactory` contract's `fund` function allows a market to claim a fee, which is then sent to. The `MarketFactory` contract's `fund` function allows a market to claim a fee, which is then sent to the `msg.sender` (i.e., the `MarketFactory` itself). This fee is stored in the `protocolFee` variable of the `Global` struct, which is read-only and can only be updated by the `claimFee` function.\n\...

Vulnerable code:
```\nfunction fund(IMarket market) external {\n    if (!instances(IInstance(address(market)))) {\n        revert FactoryNotInstanceError();\n    }\n    market.claimFee();\n```\n```\nfunction claimFee() external {\n    Global memory newGlobal = _global.read();\n\n    if (_claimFee(address(factory()), newGlobal.protocolFee)) {\n        newGlobal.protocolFee = UFixed6Lib.ZERO;\n    }\n    // rest of code\n```\n```\nfunction _claimFee(address receiver, UFixed6 fee) private returns (bool) {\n    if (msg.sender!= receiver) {\n        return false;\n    }\n\n    token.push(receiver, UFixed18Lib.from(fee));\n    emit FeeClaimed(receiver, fee);\n    return true;\n}\n```
MEDIUM severity: The `getMarketTokenPrice` function in the `Reader` contract, which is responsible for retrieving the. The `getMarketTokenPrice` function in the `Reader` contract, which is responsible for retrieving the market token price, has a critical flaw in its implementation. Specifically, the `min` and `max` price parameters are not utilized correctly, allowing the same price to be used for both deposit and w...

Vulnerable code:
```\nfunction getMarketTokenPrice(\n    DataStore dataStore,\n    Market.Props memory market,\n    Price.Props memory indexTokenPrice,\n    Price.Props memory longTokenPrice,\n    Price.Props memory shortTokenPrice,\n    bytes32 pnlFactorType,\n    bool maximize\n) external view returns (int256, MarketPoolValueInfo.Props memory) {\n    return MarketUtils.getMarketTokenPrice(\n        dataStore,\n        market,\n        indexTokenPrice,\n        longTokenPrice,\n        shortTokenPrice,\n        pnlFactorType,\n        maximize\n    );\n}\n```
MEDIUM severity: The `approveDomainBid` function in the smart contract allows any parent domain owner to approve bids. The `approveDomainBid` function in the smart contract allows any parent domain owner to approve bids (signatures) for any other domain, regardless of ownership. This is a critical issue as it enables unauthorized domain owners to approve bids for domains they do not own. The function takes three par...

Vulnerable code:
```\nfunction approveDomainBid(\n    uint256 parentId,\n    string memory bidIPFSHash,\n    bytes memory signature\n) external authorizedOwner(parentId) {\n    bytes32 hashOfSig = keccak256(abi.encode(signature));\n    approvedBids[hashOfSig] = true;\n    emit DomainBidApproved(bidIPFSHash);\n}\n```
MEDIUM severity: The `navPerShareHighMark` variable is not reset to its default value of 1.0 when the `totalSupply` b. The `navPerShareHighMark` variable is not reset to its default value of 1.0 when the `totalSupply` becomes zero, which can lead to a loss of fee collection opportunities. This vulnerability occurs when the `totalAssets` and `totalSupply` are reset to zero, typically during a withdrawal event. In suc...

Vulnerable code:
```\nFile: LMPVault.sol\n\nfunction _collectFees(uint256 idle, uint256 debt, uint256 totalSupply) internal {\n    address sink = feeSink;\n    uint256 fees = 0;\n    uint256 shares = 0;\n    uint256 profit = 0;\n\n    if (totalSupply == 0) {\n        return;\n    }\n\n    uint256 currentNavPerShare = ((idle + debt) * MAX_FEE_BPS) / totalSupply;\n    uint256 effectiveNavPerShareHighMark = navPerShareHighMark;\n\n    if (currentNavPerShare > effectiveNavPerShareHighMark) {\n        profit = (currentNavPerShare - effectiveNavPerShareHighMark) * totalSupply;\n    }\n}\n```
MEDIUM severity: When an execution of a deposit operation fails, the system automatically cancels the deposit. Howeve. When an execution of a deposit operation fails, the system automatically cancels the deposit. However, since the `executeDeposit` function has already consumed a portion of the execution fee, the remaining fee available for cancellation is significantly reduced. This can result in a loss of revenue...

Vulnerable code:
```\n_handleDepositError(\n    key,\n    startingGas,\n    reasonBytes\n);\n```\n```\nfunction _handleDepositError(\n    bytes32 key,\n    uint256 startingGas,\n    bytes memory reasonBytes\n) internal {\n    (string memory reason, ) = ErrorUtils.getRevertMessage(reasonBytes);\n\n    bytes4 errorSelector = ErrorUtils.getErrorSelectorFromData(reasonBytes);\n\n    if (OracleUtils.isEmptyPriceError(errorSelector)) {\n        ErrorUtils.revertWithCustomError(reasonBytes);\n    }\n\n    DepositUtils.cancelDeposit(\n        dataStore,\n        eventEmitter,\n        depositVault,\n        key,\n        msg.sender,\n        startingGas,\n        reason,\n        reasonBytes\n    );\n}\n```
MEDIUM severity: The recursive function `isAdminOfHat()` in the Hats and HatsIdUtilities contracts lacks a mechanism . The recursive function `isAdminOfHat()` in the Hats and HatsIdUtilities contracts lacks a mechanism to limit the number of iterations, which can lead to unlimited gas usage if the hat tree has a significant depth. This can cause the contract to become uncallable, resulting in a broken state for the...

Vulnerable code:
```\nfunction isAdminOfHat(address _user, uint256 _hatId) public view returns (bool isAdmin) {\n    uint256 linkedTreeAdmin;\n    uint32 adminLocalHatLevel;\n    if (isLocalTopHat(_hatId)) {\n        linkedTreeAdmin = linkedTreeAdmins[getTopHatDomain(_hatId)];\n        if (linkedTreeAdmin == 0) {\n            return isAdmin = isWearerOfHat(_user, _hatId);\n        } else {\n            if (isWearerOfHat(_user, linkedTreeAdmin)) {\n                return isAdmin = true;\n            } else {\n                adminLocalHatLevel = getLocalHatLevel(linkedTreeAdmin);\n                _hatId = linkedTreeAdmin;\n            }\n        }\n    } else {\n        adminLocalHatLevel = getLocalHatLevel(_hatId) - 1;\n    }\n\n    while (adminLocalHatLevel > 0) {\n        if (isWearerOfHat(_user, getAdminAtLocalLevel(_hatId, adminLocalHatLevel))) {\n            return isAdmin = true;\n        }\n        unchecked {\n            --adminLocalHatLevel;\n        }\n    }\n\n    if (isWearerOfHat(_user, getAdminAtLocalLevel(_hatId, 0))) {\n        return isAdmin = true;\n    }\n\n    linkedTreeAdmin = linkedTreeAdmins[getTopHatDomain(_hatId)];\n    if (linkedTreeAdmin == 0) {\n        return isAdmin = false;\n    } else {\n        if (isWearerOfHat(_user, linkedTreeAdmin)) {\n            return true;\n        } else {\n            isAdmin = isAdminOfHat(_user, linkedTreeAdmin);\n        }\n    }\n}\n```
MEDIUM severity: This vulnerability is characterized by inconsistencies in the naming conventions of functions, speci. This vulnerability is characterized by inconsistencies in the naming conventions of functions, specifically in the `getCoinLength` function. The function is intended to return the length of a `tokens` array, but its name suggests that it is related to coins. This discrepancy can lead to confusion an...

Vulnerable code:
```\nfunction getCoinLength() public view returns (uint256 length) {\n    return tokens.length;\n}\n```
MEDIUM severity: When a user deposits tokens into the GMX Pool, the vault creates a leverage position based on the de. When a user deposits tokens into the GMX Pool, the vault creates a leverage position based on the delta or delta-neutral strategy. However, depositing tokens in a way that does not balance the pool's reserve ratio can result in a sub-optimal return. This is because the pool's reserve ratio is not al...

Vulnerable code:
```\nfunction deposit(GMXTypes.DepositParams memory dp) external payable nonReentrant {\n    GMXDeposit.deposit(_store, dp, false);\n}\n```\n```\nfunction deposit(\n    GMXTypes.Store storage self,\n    GMXTypes.DepositParams memory dp,\n    bool isNative\n) external {\n    // Borrow assets and create deposit in GMX\n    (\n        uint256 _borrowTokenAAmt,\n        uint256 _borrowTokenBAmt\n    ) = GMXManager.calcBorrow(self, dp.depositValue);\n\n}\n```\n```\nFile: GMXManager.sol\n\nfunction calcBorrow(\n    GMXTypes.Store storage self,\n    uint256 depositValue\n) external view returns (uint256, uint256) {\n    uint256 _positionValue = depositValue * self.leverage / SAFE_MULTIPLIER;\n\n    uint256 _borrowValue = _positionValue - depositValue;\n\n    uint256 _tokenADecimals = IERC20Metadata(address(self.tokenA)).decimals();\n    uint256 _tokenBDecimals = IERC20Metadata(address(self.tokenB)).decimals();\n\n    uint256 _borrowLongTokenAmt;\n    uint256 _borrowShortTokenAmt;\n\n    if (self.delta == GMXTypes.Delta.Neutral) {\n        (uint256 _tokenAWeight,) = GMXReader.tokenWeights(self);\n\n        uint256 _longTokenWeightedValue = _tokenAWeight * _positionValue / SAFE_MULTIPLIER;\n\n        _borrowLongTokenAmt = _longTokenWeightedValue * SAFE_MULTIPLIER\n            / GMXReader.convertToUsdValue(self, address(self.tokenA), 10**(_tokenADecimals))\n            / (10 ** (18 - _tokenADecimals));\n\n        _borrowShortTokenAmt = (_borrowValue - _longTokenWeightedValue) * SAFE_MULTIPLIER\n            / GMXReader.convertToUsdValue(self, address(self.tokenB), 10**(_tokenBDecimals))\n            / (10 ** (18 - _tokenBDecimals));\n    }\n```
MEDIUM severity: The vulnerability allows the owner of a bad Short Record (SR) to prevent its flagging and subsequent. The vulnerability allows the owner of a bad Short Record (SR) to prevent its flagging and subsequent liquidation by front-running attempts to flag the SR. This is achieved by minting an NFT representing the SR and transferring it to another address, effectively canceling the SR and preventing its fl...

Vulnerable code:
```\nfunction test_audit_frontrunFlagShort() public {\n    address alice = makeAddr("Alice"); // Alice will front-run Bob's attempt to flag her short\n    address aliceSecondAddr = makeAddr("AliceSecondAddr");\n    address bob = makeAddr("Bob"); // Bob will try to flag Alice's short\n    address randomUser = makeAddr("randomUser"); // regular user who created a bid order\n\n    // A random user create a bid, Alice create a short, which will match with the user's bid\n    fundLimitBidOpt(DEFAULT_PRICE, DEFAULT_AMOUNT, randomUser);\n    fundLimitShortOpt(DEFAULT_PRICE, DEFAULT_AMOUNT, alice);\n    // Alice then mint the NFT associated to the SR so that it can be transferred\n    vm.prank(alice);\n    diamond.mintNFT(asset, Constants.SHORT_STARTING_ID);\n\n    // ETH price drops from 4000 to 2666, making Alice's short flaggable because its < LibAsset.primaryLiquidationCR(asset)\n    setETH(2666 ether);\n\n    // Alice saw Bob's attempt to flag her short, so she front-runs him and transfers the SR\n    vm.prank(alice);\n    diamond.transferFrom(alice, aliceSecondAddr, 1);\n\n    // Bob's attempt reverts because the transfer of the short by Alice changes the short status to SR.Cancelled\n    vm.prank(bob);\n    vm.expectRevert(Errors.InvalidShortId.selector);\n    diamond.flagShort(asset, alice, Constants.SHORT_STARTING_ID, Constants.HEAD);\n}\n```\n```\nfunction test_audit_frontrunPreventFlagAndSecondaryLiquidation() public {\n    address alice = makeAddr("Alice"); // Alice will front-run Bob's attempt to flag her short\n    address aliceSecondAddr = makeAddr("AliceSecondAddr");\n    address aliceThirdAddr = makeAddr("AliceThirdAddr");\n    address bob = makeAddr("Bob"); // Bob will try to flag Alice's short\n    address randomUser = makeAddr("randomUser"); // regular user who created a bid order\n\n    fundLimitBidOpt(DEFAULT_PRICE, DEFAULT_AMOUNT, randomUser);\n    fundLimitShortOpt(DEFAULT_PRICE, DEFAULT_AMOUNT, alice);\n    vm.prank(alice);\n    diamond.mintNFT(asset, Constants.SHORT_STARTING_ID);\n\n    setETH(700 ether);\n\n    vm.prank(alice);\n    diamond.transferFrom(alice, aliceSecondAddr, 1);\n    vm.prank(bob);\n    vm.expectRevert(Errors.InvalidShortId.selector);\n    diamond.flagShort(asset, alice, Constants.SHORT_STARTING_ID, Constants.HEAD);\n\n    vm.prank(aliceSecondAddr);\n    diamond.transferFrom(aliceSecondAddr, aliceThirdAddr, 1);\n\n    vm.prank(aliceSecondAddr);\n    STypes.ShortRecord memory shortRecord = getShortRecord(aliceSecondAddr, Constants.SHORT_STARTING_ID);\n    depositUsd(bob, shortRecord.ercDebt);\n    vm.expectRevert(Errors.MarginCallSecondaryNoValidShorts.selector);\n    liquidateErcEscrowed(aliceSecondAddr, Constants.SHORT_STARTING_ID, DEFAULT_AMOUNT, bob);\n}\n```
MEDIUM severity: The `blameOperator` function, designed to be called by anyone, allows for the potential imprisonment. The `blameOperator` function, designed to be called by anyone, allows for the potential imprisonment of an operator if the validator has not exited as expected. However, the function's current implementation allows for the blame to be called for any state that is not `3`, which is not the intended b...

Vulnerable code:
```\n/**\n * @notice allows imprisoning an Operator if the validator have not been exited until expectedExit\n * @dev anyone can call this function\n * @dev if operator has given enough allowance, they can rotate the validators to avoid being prisoned\n */\nfunction blameOperator(\n    StakePool storage self,\n    DataStoreUtils.DataStore storage DATASTORE,\n    bytes calldata pk\n) external {\n    if (\n        block.timestamp > self.TELESCOPE._validators[pk].expectedExit &&\n        self.TELESCOPE._validators[pk].state!= 3\n    ) {\n        OracleUtils.imprison(\n            DATASTORE,\n            self.TELESCOPE._validators[pk].operatorId\n        );\n    }\n}\n```
MEDIUM severity: The `NodeRegistry.updateNode` function, when invoked by the `owner` to update the `url` of a node, i. The `NodeRegistry.updateNode` function, when invoked by the `owner` to update the `url` of a node, inadvertently replaces the `signer` of the `url` with the `msg.sender`, which is the `owner` of the node. This can lead to inconsistent events being emitted, as the `LogNodeRegistered` event will alway...

Vulnerable code:
```\nif (newURl!= keccak256(bytes(node.url))) {\n    // deleting the old entry\n    delete urlIndex[keccak256(bytes(node.url))];\n\n    require(!urlIndex[newURl].used, "url is already in use");\n\n    UrlInformation memory ui;\n    ui.used = true;\n    ui.signer = msg.sender;\n    urlIndex[newURl] = ui;\n    node.url = newURl;\n}\n```\n```\nemit LogNodeRegistered(\n    node.url,\n    _props,\n    msg.sender,\n    node.deposit\n);\n```\n```\nevent LogNodeRegistered(\n    string url,\n    uint props,\n    address signer,\n    uint deposit\n);\n```
MEDIUM severity: The Assimilators, a crucial component within the application, act as a "middleware" between the Shel. The Assimilators, a crucial component within the application, act as a "middleware" between the Shell Protocol application and supported tokens. They are responsible for processing various methods, which are critical to the system's functionality. To ensure the correctness and consistency of Assimil...

Vulnerable code:
```\nfunction swapByOrigin(address _o, address _t, uint256 _oAmt, uint256 _mTAmt, uint256 _dline) public notFrozen returns (uint256 tAmt_) {\n    return transferByOrigin(_o, _t, _dline, _mTAmt, _oAmt, msg.sender);\n}\n```\n```\nif (_o.ix == _t.ix):\n    return _t.addr.outputNumeraire(_rcpnt, _o.addr.intakeRaw(_oAmt))\n```\n```\nfunction intakeRaw(uint256 _amount) public returns (int128 amount_) {\n    bool success = cdai.transferFrom(msg.sender, address(this), _amount);\n\n    if (!success) {\n        revert("CDai/transferFrom-failed");\n    }\n\n    uint256 _rate = cdai.exchangeRateStored();\n\n    _amount = (_amount * _rate) / 1e18;\n\n    cdai.redeemUnderlying(_amount);\n\n    amount_ = _amount.divu(1e18);\n}\n```\n```\nfunction intakeRaw(uint256 _amount) public returns (int128 amount_, int128 balance_) {\n    dai.transferFrom(msg.sender, address(this), _amount);\n\n    amount_ = _amount.divu(1e18);\n}\n```
MEDIUM severity: The code contains several instances where division by zero may occur, which could lead to unexpected. The code contains several instances where division by zero may occur, which could lead to unexpected behavior and potential reverts. \n\nIn the first instance, when the vault settles with a value of 0 and a remaining strategy token value of 0, the code attempts to divide claims on the settled assets...

Vulnerable code:
```\nint256 settledVaultValue = settlementRate.convertToUnderlying(residualAssetCashBalance)\n   .add(totalStrategyTokenValueAtSettlement);\n\nif (residualAssetCashBalance < 0) {\n    // If the vault is insolvent (meaning residualAssetCashBalance < 0), it is necessarily\n    // true that totalStrategyTokens == 0 (meaning all tokens were sold in an attempt to\n    // repay the debt). That means settledVaultValue == residualAssetCashBalance, strategyTokenClaim == 0\n    // and assetCashClaim == totalAccountValue. Accounts that are still solvent will be paid from the\n    // reserve, accounts that are insolvent will have a totalAccountValue == 0.\n    strategyTokenClaim = 0;\n    assetCashClaim = totalAccountValue;\n} else {\n    strategyTokenClaim = totalAccountValue.mul(vaultState.totalStrategyTokens.toInt())\n       .div(settledVaultValue).toUint();\n\n    assetCashClaim = totalAccountValue.mul(residualAssetCashBalance)\n       .div(settledVaultValue);\n}\n```\n```\nuint256 vaultSharesToLiquidator;\n\nuint256 vaultSharesToLiquidator = vaultAccount.tempCashBalance.toUint()\n   .mul(vaultConfig.liquidationRate.toUint())\n   .mul(vaultAccount.vaultShares)\n   .div(vaultShareValue.toUint())\n   .div(uint256(Constants.RATE_PRECISION));\n```\n```\nVaultSecondaryBorrowStorage storage balance = \n    LibStorage.getVaultSecondaryBorrow()[vaultConfig.vault][maturity][currencyId];\n\nuint256 totalfCashBorrowed = balance.totalfCashBorrowed;\nuint256 totalAccountDebtShares = balance.totalAccountDebtShares;\n\nfCashToLend = debtSharesToRepay.mul(totalfCashBorrowed).div(totalAccountDebtShares).toInt();\n```
MEDIUM severity: The protocol's auction mechanism is vulnerable to a specific edge case that allows a malicious actor. The protocol's auction mechanism is vulnerable to a specific edge case that allows a malicious actor to steal funds by manipulating the ownership of an NFT during an ongoing auction. This occurs when an NFT is added to a collection without being minted, and the `tokenInitialPeriodStartTime` paramete...

Vulnerable code:
```\nl.availableCollateral[oldBidder] += \n    l.highestBids[tokenId][currentAuctionRound].bidAmount\n```