Farseen0/scar-pairs huggingface dataset:
MEDIUM severity: Vulnerable function: ```\n    function test_heal_in_next_round_v1() public {\n        _startGameAndDrawOneRound();\n\n   . ```\n    function test_heal_in_next_round_v1() public {\n        _startGameAndDrawOneRound();\n\n        _drawXRounds(11);\n\n\n        (uint256[] memory woundedAgentIds, ) = infiltration.getRoundInfo({roundId: 12});\n\n        address agentOwner = _ownerOf(woundedAgentIds[0]);\n        looks.mint(a

Vulnerable code:
```\n    function test_heal_in_next_round_v1() public {\n        _startGameAndDrawOneRound();\n\n        _drawXRounds(11);\n\n\n        (uint256[] memory woundedAgentIds, ) = infiltration.getRoundInfo({roundId: 12});\n\n        address agentOwner = _ownerOf(woundedAgentIds[0]);\n        looks.mint(agentOwner, HEAL_BASE_COST);\n\n        vm.startPrank(agentOwner);\n        _grantLooksApprovals();\n        looks.approve(TRANSFER_MANAGER, HEAL_BASE_COST);\n\n        uint256[] memory agentIds = new uint256[](1);\n        agentIds[0] = woundedAgentIds[0];\n\n        uint256[] memory costs = new uint256[](1);\n        costs[0] = HEAL_BASE_COST;\n\n        //get gameInfo\n        (,,,,,uint40 currentRoundId,,,,,) = infiltration.gameInfo();\n        assert(currentRoundId == 13);\n\n        //get agent Info\n        IInfiltration.Agent memory agentInfo = infiltration.getAgent(woundedAgentIds[0]);\n        assert(agentInfo.woundedAt == 12);\n\n        //agent can't invoke heal in the next round.\n        vm.expectRevert(IInfiltration.HealingMustWaitAtLeastOneRound.selector);\n        infiltration.heal(agentIds);\n    }\n```\n
MEDIUM severity: Vulnerable function: ```\nCurve Pools\n\nCurve stETH/ETH: 0x06325440D014e39736583c165C2963BA99fAf14E\. ```\nCurve Pools\n\nCurve stETH/ETH: 0x06325440D014e39736583c165C2963BA99fAf14E\nCurve stETH/ETH ng: 0x21E27a5E5513D6e65C4f830167390997aA84843a\nCurve stETH/ETH concentrated: 0x828b154032950C8ff7CF8085D841723Db2696056\nCurve stETH/frxETH: 0x4d9f9D15101EEC665F77210cB999639f760F831E\nCurve rETH/ETH: 0

Vulnerable code:
```\nCurve Pools\n\nCurve stETH/ETH: 0x06325440D014e39736583c165C2963BA99fAf14E\nCurve stETH/ETH ng: 0x21E27a5E5513D6e65C4f830167390997aA84843a\nCurve stETH/ETH concentrated: 0x828b154032950C8ff7CF8085D841723Db2696056\nCurve stETH/frxETH: 0x4d9f9D15101EEC665F77210cB999639f760F831E\nCurve rETH/ETH: 0x6c38cE8984a890F5e46e6dF6117C26b3F1EcfC9C\nCurve rETH/wstETH: 0x447Ddd4960d9fdBF6af9a790560d0AF76795CB08\nCurve rETH/frxETH: 0xbA6c373992AD8ec1f7520E5878E5540Eb36DeBf1\nCurve cbETH/ETH: 0x5b6C539b224014A09B3388e51CaAA8e354c959C8\nCurve cbETH/frxETH: 0x548E063CE6F3BaC31457E4f5b4e2345286274257\nCurve frxETH/ETH: 0xf43211935C781D5ca1a41d2041F397B8A7366C7A\nCurve swETH/frxETH: 0xe49AdDc2D1A131c6b8145F0EBa1C946B7198e0BA\n```\n
MEDIUM severity: Vulnerable function: ```\nFile: Curve2TokenPoolMixin.sol\nabstract contract Curve2TokenPoolMixin is C. ```\nFile: Curve2TokenPoolMixin.sol\nabstract contract Curve2TokenPoolMixin is CurvePoolMixin {\n..SNIP..\n    constructor(\n        NotionalProxy notional_,\n        ConvexVaultDeploymentParams memory params\n    ) CurvePoolMixin(notional_, params) {\n        address primaryToken = _getNotionalUnde

Vulnerable code:
```\nFile: Curve2TokenPoolMixin.sol\nabstract contract Curve2TokenPoolMixin is CurvePoolMixin {\n..SNIP..\n    constructor(\n        NotionalProxy notional_,\n        ConvexVaultDeploymentParams memory params\n    ) CurvePoolMixin(notional_, params) {\n        address primaryToken = _getNotionalUnderlyingToken(params.baseParams.primaryBorrowCurrencyId);\n\n        PRIMARY_TOKEN = primaryToken;\n\n        // Curve uses ALT_ETH_ADDRESS\n        if (primaryToken == Deployments.ETH_ADDRESS) {\n            primaryToken = Deployments.ALT_ETH_ADDRESS;\n        }\n\n        address token0 = CURVE_POOL.coins(0);\n        address token1 = CURVE_POOL.coins(1);\n        \n        uint8 primaryIndex;\n        address secondaryToken;\n        if (token0 == primaryToken) {\n            primaryIndex = 0;\n            secondaryToken = token1;\n        } else {\n            primaryIndex = 1;\n            secondaryToken = token0;\n        }\n\n        if (secondaryToken == Deployments.ALT_ETH_ADDRESS) {\n            secondaryToken = Deployments.ETH_ADDRESS;\n        }\n\n        PRIMARY_INDEX = primaryIndex;\n        SECONDARY_TOKEN = secondaryToken;\n```\n
HIGH severity: Vulnerable function: ```\nif (stateRootHashes[currentL2BlockNumber] != \_finalizationData.parentState. ```\nif (stateRootHashes[currentL2BlockNumber] != \_finalizationData.parentStateRootHash) {\n revert StartingRootHashDoesNotMatch();\n}\n```\n

Vulnerable code:
```\nif (stateRootHashes[currentL2BlockNumber] != \_finalizationData.parentStateRootHash) {\n revert StartingRootHashDoesNotMatch();\n}\n```\n
MEDIUM severity: Vulnerable function: ```\n    uint256 rewardTokensLength = rewardTokens.length;\n    for (uint256 i; . ```\n    uint256 rewardTokensLength = rewardTokens.length;\n    for (uint256 i; i != rewardTokensLength; ) {\n        IERC20Upgradeable(rewardTokens[i]).safeTransfer(\n            msg.sender,\n            rewards[i]\n        );\n```\n

Vulnerable code:
```\n    uint256 rewardTokensLength = rewardTokens.length;\n    for (uint256 i; i != rewardTokensLength; ) {\n        IERC20Upgradeable(rewardTokens[i]).safeTransfer(\n            msg.sender,\n            rewards[i]\n        );\n```\n
MEDIUM severity: Vulnerable function: ```\nFile: BalancerEnvironment.py\n            "oracleWindowInSeconds": 3600,\n . ```\nFile: BalancerEnvironment.py\n            "oracleWindowInSeconds": 3600,\n            "maxBalancerPoolShare": 2e3, # 20%\n            "settlementSlippageLimitPercent": 5e6, # 5%\n```\n

Vulnerable code:
```\nFile: BalancerEnvironment.py\n            "oracleWindowInSeconds": 3600,\n            "maxBalancerPoolShare": 2e3, # 20%\n            "settlementSlippageLimitPercent": 5e6, # 5%\n```\n
MEDIUM severity: Vulnerable function: ```\n    function _loadUpdateContext(\n        Context memory context,\n        address account,\n  . ```\n    function _loadUpdateContext(\n        Context memory context,\n        address account,\n        address referrer\n    ) private view returns (UpdateContext memory updateContext) {\n// rest of code\n        updateContext.referrer = referrers[account][context.local.currentId];\n        updat

Vulnerable code:
```\n    function _loadUpdateContext(\n        Context memory context,\n        address account,\n        address referrer\n    ) private view returns (UpdateContext memory updateContext) {\n// rest of code\n        updateContext.referrer = referrers[account][context.local.currentId];\n        updateContext.referralFee = IMarketFactory(address(factory())).referralFee(referrer);\n    }\n\n    function _processReferrer(\n        UpdateContext memory updateContext,\n        Order memory newOrder,\n        address referrer\n    ) private pure {\n      if (newOrder.makerReferral.isZero() && newOrder.takerReferral.isZero()) return;\n        if (updateContext.referrer == address(0)) updateContext.referrer = referrer;\n        if (updateContext.referrer == referrer) return;\n\n        revert MarketInvalidReferrerError();\n    }\n\n\n    function _storeUpdateContext(Context memory context, UpdateContext memory updateContext, address account) private {\n// rest of code\n        referrers[account][context.local.currentId] = updateContext.referrer;\n    }\n```\n
MEDIUM severity: Vulnerable function: ```\nfunction _marginFeeHandler(MTypes.MarginCallPrimary memory m) private {\n    STypes.VaultUser s. ```\nfunction _marginFeeHandler(MTypes.MarginCallPrimary memory m) private {\n    STypes.VaultUser storage VaultUser = s.vaultUser[m.vault][msg.sender];\n    STypes.VaultUser storage TAPP = s.vaultUser[m.vault][address(this)];\n    // distribute fees to TAPP and caller\n    uint88 tappFee = m.ethFil

Vulnerable code:
```\nfunction _marginFeeHandler(MTypes.MarginCallPrimary memory m) private {\n    STypes.VaultUser storage VaultUser = s.vaultUser[m.vault][msg.sender];\n    STypes.VaultUser storage TAPP = s.vaultUser[m.vault][address(this)];\n    // distribute fees to TAPP and caller\n    uint88 tappFee = m.ethFilled.mulU88(m.tappFeePct);\n    uint88 callerFee = m.ethFilled.mulU88(m.callerFeePct) + m.gasFee;\n    m.totalFee += tappFee + callerFee;\n    //@dev TAPP already received the gasFee for being the forcedBid caller. tappFee nets out.\n    if (TAPP.ethEscrowed >= callerFee) {\n        TAPP.ethEscrowed -= callerFee;\n        VaultUser.ethEscrowed += callerFee;\n    } else {\n        // Give caller (portion of?) tappFee instead of gasFee\n        VaultUser.ethEscrowed += callerFee - m.gasFee + tappFee;\n        m.totalFee -= m.gasFee;\n❌      TAPP.ethEscrowed -= m.totalFee;\n    }\n}\n```\n
MEDIUM severity: Vulnerable function: ```\nrequire(account != Constants.RESERVE); // Reserve address is address(0)\nre. ```\nrequire(account != Constants.RESERVE); // Reserve address is address(0)\nrequire(account != address(this));\n(\n    uint256 isNToken,\n    /* incentiveAnnualEmissionRate */,\n    /* lastInitializedTime */,\n    /* assetArrayLength */,\n    /* parameters */\n) = nTokenHandler.getNTokenContext(ac

Vulnerable code:
```\nrequire(account != Constants.RESERVE); // Reserve address is address(0)\nrequire(account != address(this));\n(\n    uint256 isNToken,\n    /* incentiveAnnualEmissionRate */,\n    /* lastInitializedTime */,\n    /* assetArrayLength */,\n    /* parameters */\n) = nTokenHandler.getNTokenContext(account);\nrequire(isNToken == 0);\n```\n
HIGH severity: Vulnerable function: ```\nFile: Boosted3TokenPoolMixin.sol\n    function _underlyingPoolContext(ILinearPool underlyingPoo. ```\nFile: Boosted3TokenPoolMixin.sol\n    function _underlyingPoolContext(ILinearPool underlyingPool) private view returns (UnderlyingPoolContext memory) {\n        (uint256 lowerTarget, uint256 upperTarget) = underlyingPool.getTargets();\n        uint256 mainIndex = underlyingPool.getMainIndex();\

Vulnerable code:
```\nFile: Boosted3TokenPoolMixin.sol\n    function _underlyingPoolContext(ILinearPool underlyingPool) private view returns (UnderlyingPoolContext memory) {\n        (uint256 lowerTarget, uint256 upperTarget) = underlyingPool.getTargets();\n        uint256 mainIndex = underlyingPool.getMainIndex();\n        uint256 wrappedIndex = underlyingPool.getWrappedIndex();\n\n        (\n            /* address[] memory tokens */,\n            uint256[] memory underlyingBalances,\n            /* uint256 lastChangeBlock */\n        ) = Deployments.BALANCER_VAULT.getPoolTokens(underlyingPool.getPoolId());\n\n        uint256[] memory underlyingScalingFactors = underlyingPool.getScalingFactors();\n        // The wrapped token's scaling factor is not constant, but increases over time as the wrapped token increases in\n        // value.\n        uint256 wrappedScaleFactor = underlyingScalingFactors[mainIndex] * underlyingPool.getWrappedTokenRate() /\n            BalancerConstants.BALANCER_PRECISION;\n\n        return UnderlyingPoolContext({\n            mainScaleFactor: underlyingScalingFactors[mainIndex],\n            mainBalance: underlyingBalances[mainIndex],\n            wrappedScaleFactor: wrappedScaleFactor,\n            wrappedBalance: underlyingBalances[wrappedIndex],\n            virtualSupply: underlyingPool.getVirtualSupply(),\n            fee: underlyingPool.getSwapFeePercentage(),\n            lowerTarget: lowerTarget,\n            upperTarget: upperTarget    \n        });\n    }\n```\n
HIGH severity: Vulnerable function: ```\n    function topUp(\n        address source,\n        uint256[] memory indices\n    ) external . ```\n    function topUp(\n        address source,\n        uint256[] memory indices\n    ) external onlyRole(EXECUTOR_ROLE) {\n        for (uint i = 0; i < indices.length; i++) {\n            // get staking contract and config\n            StakingRewards staking = stakingContracts[i];\n            S

Vulnerable code:
```\n    function topUp(\n        address source,\n        uint256[] memory indices\n    ) external onlyRole(EXECUTOR_ROLE) {\n        for (uint i = 0; i < indices.length; i++) {\n            // get staking contract and config\n            StakingRewards staking = stakingContracts[i];\n            StakingConfig memory config = stakingConfigs[staking];\n\n            // will revert if block.timestamp <= periodFinish\n            staking.setRewardsDuration(config.rewardsDuration);\n\n            // pull tokens from owner of this contract to fund the staking contract\n            rewardToken.transferFrom(\n                source,\n                address(staking),\n                config.rewardAmount\n            );\n\n            // start periods\n            staking.notifyRewardAmount(config.rewardAmount);\n\n            emit ToppedUp(staking, config);\n        }\n    }\n```\n
HIGH severity: Vulnerable function: ```\nfunction repay (uint256 loanID, uint256 repaid) external {\n    Loan storage loan = loans[loanI. ```\nfunction repay (uint256 loanID, uint256 repaid) external {\n    Loan storage loan = loans[loanID];\n\n    if (block.timestamp > loan.expiry) \n        revert Default();\n    \n    uint256 decollateralized = loan.collateral * repaid / loan.amount;\n\n    if (repaid == loan.amount) delete loans[l

Vulnerable code:
```\nfunction repay (uint256 loanID, uint256 repaid) external {\n    Loan storage loan = loans[loanID];\n\n    if (block.timestamp > loan.expiry) \n        revert Default();\n    \n    uint256 decollateralized = loan.collateral * repaid / loan.amount;\n\n    if (repaid == loan.amount) delete loans[loanID];\n    else {\n        loan.amount -= repaid;\n        loan.collateral -= decollateralized;\n    }\n\n    debt.transferFrom(msg.sender, loan.lender, repaid);\n    collateral.transfer(owner, decollateralized);\n}\n```\n
MEDIUM severity: Vulnerable function: ```\nfunction \_addLiquidityFor(address \_liquidityHolderAddr, uint256 \_liquidityAmount, bool \_isL. ```\nfunction \_addLiquidityFor(address \_liquidityHolderAddr, uint256 \_liquidityAmount, bool \_isLM) internal {\n  daiToken.transferFrom(\_liquidityHolderAddr, address(this), \_liquidityAmount);   \n  \n  uint256 \_amountToMint = \_liquidityAmount.mul(PERCENTAGE\_100).div(getDAIToDAIxRatio());\n  

Vulnerable code:
```\nfunction \_addLiquidityFor(address \_liquidityHolderAddr, uint256 \_liquidityAmount, bool \_isLM) internal {\n  daiToken.transferFrom(\_liquidityHolderAddr, address(this), \_liquidityAmount);   \n  \n  uint256 \_amountToMint = \_liquidityAmount.mul(PERCENTAGE\_100).div(getDAIToDAIxRatio());\n  totalLiquidity = totalLiquidity.add(\_liquidityAmount);\n  \_mintERC20(\_liquidityHolderAddr, \_amountToMint);\n\n  if (\_isLM) {\n    liquidityFromLM[\_liquidityHolderAddr] = liquidityFromLM[\_liquidityHolderAddr].add(\_liquidityAmount);\n  }\n\n  \_updateWithdrawalQueue();\n\n  emit AddLiquidity(\_liquidityHolderAddr, \_liquidityAmount, totalLiquidity);\n}\n```\n
MEDIUM severity: Vulnerable function: ```\nfunction \_removeFromQueue(uint256 \_countToRemove) internal {\n  for (uint256 i = 0; i < \_cou. ```\nfunction \_removeFromQueue(uint256 \_countToRemove) internal {\n  for (uint256 i = 0; i < \_countToRemove; i++) {\n    delete withdrawalsInfo[withdrawalQueue[i]];\n  }   \n\n  if (\_countToRemove == withdrawalQueue.length) {\n    delete withdrawalQueue;\n  } else {\n    uint256 \_remainingArrLe

Vulnerable code:
```\nfunction \_removeFromQueue(uint256 \_countToRemove) internal {\n  for (uint256 i = 0; i < \_countToRemove; i++) {\n    delete withdrawalsInfo[withdrawalQueue[i]];\n  }   \n\n  if (\_countToRemove == withdrawalQueue.length) {\n    delete withdrawalQueue;\n  } else {\n    uint256 \_remainingArrLength = withdrawalQueue.length.sub(\_countToRemove);\n    address[] memory \_remainingArr = new address[](\_remainingArrLength);\n\n    for (uint256 i = 0; i < \_remainingArrLength; i++) {\n      \_remainingArr[i] = withdrawalQueue[i.add(\_countToRemove)];\n    }\n\n    withdrawalQueue = \_remainingArr;\n  }\n}\n```\n
HIGH severity: Vulnerable function: ```\nfunction \_transferETH(address \_recipient, uint256 \_amount) private {\n    (bool success, ) =. ```\nfunction \_transferETH(address \_recipient, uint256 \_amount) private {\n    (bool success, ) = \_recipient.call{value: \_amount}(\n        abi.encodeWithSignature("")\n    );\n    require(success, "Transfer Failed");\n}\n```\n

Vulnerable code:
```\nfunction \_transferETH(address \_recipient, uint256 \_amount) private {\n    (bool success, ) = \_recipient.call{value: \_amount}(\n        abi.encodeWithSignature("")\n    );\n    require(success, "Transfer Failed");\n}\n```\n
HIGH severity: Vulnerable function: ```\nfunction beforeTokenTransfer(address from, address to, uint256 amount, address controlledToken). ```\nfunction beforeTokenTransfer(address from, address to, uint256 amount, address controlledToken) external override onlyPrizePool {\n  if (controlledToken == address(ticket)) {\n    \_requireNotLocked();\n  }\n```\n

Vulnerable code:
```\nfunction beforeTokenTransfer(address from, address to, uint256 amount, address controlledToken) external override onlyPrizePool {\n  if (controlledToken == address(ticket)) {\n    \_requireNotLocked();\n  }\n```\n
MEDIUM severity: Vulnerable function: ```\nfunction getTVLForAsset(address asset) public view returns (uint256) {\n        uint256 balance. ```\nfunction getTVLForAsset(address asset) public view returns (uint256) {\n        uint256 balance = getTotalBalanceForAsset(asset);\n        if (asset == ETH_ADDRESS) {\n            return balance;\n        }\n        return convertToUnitOfAccountFromAsset(asset, balance);\n    }\n\n    function 

Vulnerable code:
```\nfunction getTVLForAsset(address asset) public view returns (uint256) {\n        uint256 balance = getTotalBalanceForAsset(asset);\n        if (asset == ETH_ADDRESS) {\n            return balance;\n        }\n        return convertToUnitOfAccountFromAsset(asset, balance);\n    }\n\n    function getTotalBalanceForAsset(address asset) public view returns (uint256) {\n        if (!isSupportedAsset(asset)) revert ASSET_NOT_SUPPORTED(asset);\n\n        address depositPool_ = address(depositPool());\n        if (asset == ETH_ADDRESS) {\n            return depositPool_.balance + getETHBalanceInEigenLayer();\n        }\n\n        uint256 sharesHeld = getAssetSharesHeld(asset);\n        uint256 tokensInRio = IERC20(asset).balanceOf(depositPool_);\n        uint256 tokensInEigenLayer = convertFromSharesToAsset(getAssetStrategy(asset), sharesHeld);\n\n        return tokensInRio + tokensInEigenLayer;\n    }\n\n    function getETHBalanceInEigenLayer() public view returns (uint256 balance) {\n        balance = ethBalanceInUnverifiedValidators;\n\n        IRioLRTOperatorRegistry operatorRegistry_ = operatorRegistry();\n        -> uint8 endAtID = operatorRegistry_.operatorCount() + 1; // Operator IDs start at 1.\n        -> for (uint8 id = 1; id < endAtID; ++id) {\n            -> balance += operatorDelegator(operatorRegistry_, id).getETHUnderManagement();\n        }\n    }\n```\n
MEDIUM severity: Vulnerable function: ```\nFile: SwEthEthOracle.sol\n    function getPriceInEth(address token) external view returns (uint. ```\nFile: SwEthEthOracle.sol\n    function getPriceInEth(address token) external view returns (uint256 price) {\n        // Prevents incorrect config at root level.\n        if (token != address(swEth)) revert Errors.InvalidToken(token);\n\n        // Returns in 1e18 precision.\n        price = swE

Vulnerable code:
```\nFile: SwEthEthOracle.sol\n    function getPriceInEth(address token) external view returns (uint256 price) {\n        // Prevents incorrect config at root level.\n        if (token != address(swEth)) revert Errors.InvalidToken(token);\n\n        // Returns in 1e18 precision.\n        price = swEth.swETHToETHRate();\n    }\n```\n
MEDIUM severity: Vulnerable function: ```\n    function getDeltaB() internal view returns (int256 deltaB) {\n        uint256[2] memory bal. ```\n    function getDeltaB() internal view returns (int256 deltaB) {\n        uint256[2] memory balances = C.curveMetapool().get_balances();\n        uint256 d = getDFroms(balances);\n        deltaB = getDeltaBWithD(balances[0], d);\n    }\n```\n

Vulnerable code:
```\n    function getDeltaB() internal view returns (int256 deltaB) {\n        uint256[2] memory balances = C.curveMetapool().get_balances();\n        uint256 d = getDFroms(balances);\n        deltaB = getDeltaBWithD(balances[0], d);\n    }\n```\n
HIGH severity: Vulnerable function: ```\nfunction finalizeBlocks(\n BlockData[] calldata \_blocksData,\n bytes calldata \_proof,\n uint2. ```\nfunction finalizeBlocks(\n BlockData[] calldata \_blocksData,\n bytes calldata \_proof,\n uint256 \_proofType,\n bytes32 \_parentStateRootHash\n)\n external\n whenTypeNotPaused(PROVING\_SYSTEM\_PAUSE\_TYPE)\n whenTypeNotPaused(GENERAL\_PAUSE\_TYPE)\n onlyRole(OPERATOR\_ROLE)\n{\n if (stateRootH

Vulnerable code:
```\nfunction finalizeBlocks(\n BlockData[] calldata \_blocksData,\n bytes calldata \_proof,\n uint256 \_proofType,\n bytes32 \_parentStateRootHash\n)\n external\n whenTypeNotPaused(PROVING\_SYSTEM\_PAUSE\_TYPE)\n whenTypeNotPaused(GENERAL\_PAUSE\_TYPE)\n onlyRole(OPERATOR\_ROLE)\n{\n if (stateRootHashes[currentL2BlockNumber] != \_parentStateRootHash) {\n revert StartingRootHashDoesNotMatch();\n }\n\n \_finalizeBlocks(\_blocksData, \_proof, \_proofType, \_parentStateRootHash, true);\n}\n```\n
MEDIUM severity: Vulnerable function: ```\nfunction decreaseCollateral(address asset, uint8 id, uint88 amount)\n    external\n    isNotFro. ```\nfunction decreaseCollateral(address asset, uint8 id, uint88 amount)\n    external\n    isNotFrozen(asset)\n    nonReentrant\n    onlyValidShortRecord(asset, msg.sender, id)\n{\n    STypes.ShortRecord storage short = s.shortRecords[asset][msg.sender][id];\n    short.updateErcDebt(asset);\n    if

Vulnerable code:
```\nfunction decreaseCollateral(address asset, uint8 id, uint88 amount)\n    external\n    isNotFrozen(asset)\n    nonReentrant\n    onlyValidShortRecord(asset, msg.sender, id)\n{\n    STypes.ShortRecord storage short = s.shortRecords[asset][msg.sender][id];\n    short.updateErcDebt(asset);\n    if (amount > short.collateral) revert Errors.InsufficientCollateral();\n    short.collateral -= amount;\n❌  uint256 cRatio = short.getCollateralRatio(asset);\n    if (cRatio < LibAsset.initialMargin(asset)) {\n        revert Errors.CollateralLowerThanMin();\n    }\n    uint256 vault = s.asset[asset].vault;\n    s.vaultUser[vault][msg.sender].ethEscrowed += amount;\n    LibShortRecord.disburseCollateral(\n        asset, msg.sender, amount, short.zethYieldRate, short.updatedAt\n    );\n    emit Events.DecreaseCollateral(asset, msg.sender, id, amount);\n}\n```\n
HIGH severity: Vulnerable function: ```\n_stemTipForToken = s.ss[token].milestoneStem +\n    int96(s.ss[token].stalk. ```\n_stemTipForToken = s.ss[token].milestoneStem +\n    int96(s.ss[token].stalkEarnedPerSeason).mul(\n        int96(s.season.current).sub(int96(s.ss[token].milestoneSeason))\n    );\n```\n

Vulnerable code:
```\n_stemTipForToken = s.ss[token].milestoneStem +\n    int96(s.ss[token].stalkEarnedPerSeason).mul(\n        int96(s.season.current).sub(int96(s.ss[token].milestoneSeason))\n    );\n```\n
MEDIUM severity: Vulnerable function: ```\nuint256 availableShares = assetRegistry().convertToSharesFromAsset(asset, a. ```\nuint256 availableShares = assetRegistry().convertToSharesFromAsset(asset, assetRegistry().getTotalBalanceForAsset(asset));\n```\n

Vulnerable code:
```\nuint256 availableShares = assetRegistry().convertToSharesFromAsset(asset, assetRegistry().getTotalBalanceForAsset(asset));\n```\n