Farseen0/scar-pairs huggingface dataset:
HIGH severity: Vulnerable function: ```\nfunction updateCommitment(\n    uint256 _commitmentId,\n    Commitment calldata _commitment\n) . ```\nfunction updateCommitment(\n    uint256 _commitmentId,\n    Commitment calldata _commitment\n) public commitmentLender(_commitmentId) { <- @audit-info checks that lender is msg.sender\n    require(\n        _commitment.principalTokenAddress ==\n            commitments[_commitmentId].principalTo

Vulnerable code:
```\nfunction updateCommitment(\n    uint256 _commitmentId,\n    Commitment calldata _commitment\n) public commitmentLender(_commitmentId) { <- @audit-info checks that lender is msg.sender\n    require(\n        _commitment.principalTokenAddress ==\n            commitments[_commitmentId].principalTokenAddress,\n        "Principal token address cannot be updated."\n    );\n    require(\n        _commitment.marketId == commitments[_commitmentId].marketId,\n        "Market Id cannot be updated."\n    );\n\n    commitments[_commitmentId] = _commitment; <- @audit-issue never checks _commitment.lender\n\n    validateCommitment(commitments[_commitmentId]);\n```\n
MEDIUM severity: Vulnerable function: ```\n        uint256 tokenReserve = _getBalance(token);\n        uint256 tokenCo. ```\n        uint256 tokenReserve = _getBalance(token);\n        uint256 tokenCollateral = IInsurancePool(insurancePool).getCollateral(token);\n```\n

Vulnerable code:
```\n        uint256 tokenReserve = _getBalance(token);\n        uint256 tokenCollateral = IInsurancePool(insurancePool).getCollateral(token);\n```\n
MEDIUM severity: Vulnerable function: ```\n        ohmMinted -= ohmReceived > ohmMinted ? ohmMinted : ohmReceived;\n  . ```\n        ohmMinted -= ohmReceived > ohmMinted ? ohmMinted : ohmReceived;\n        ohmRemoved += ohmReceived > ohmMinted ? ohmReceived - ohmMinted : 0;\n```\n

Vulnerable code:
```\n        ohmMinted -= ohmReceived > ohmMinted ? ohmMinted : ohmReceived;\n        ohmRemoved += ohmReceived > ohmMinted ? ohmReceived - ohmMinted : 0;\n```\n
HIGH severity: Vulnerable function: ```\nfunction includeAsset (address \_numeraire, address \_nAssim, address \_reserve, address \_rAss. ```\nfunction includeAsset (address \_numeraire, address \_nAssim, address \_reserve, address \_rAssim, uint256 \_weight) public onlyOwner {\n    shell.includeAsset(\_numeraire, \_nAssim, \_reserve, \_rAssim, \_weight);\n}\n```\n

Vulnerable code:
```\nfunction includeAsset (address \_numeraire, address \_nAssim, address \_reserve, address \_rAssim, uint256 \_weight) public onlyOwner {\n    shell.includeAsset(\_numeraire, \_nAssim, \_reserve, \_rAssim, \_weight);\n}\n```\n
HIGH severity: Vulnerable function: ```\n    ICommonStruct.TokenAmount[] memory bribeTokens = _sdtBlackHole.pullSdSt. ```\n    ICommonStruct.TokenAmount[] memory bribeTokens = _sdtBlackHole.pullSdStakingBribes(\n        processor,\n        _processorRewardsPercentage\n    );\n\n    uint256 rewardAmount = _gaugeAsset.reward_count();\n\n    ICommonStruct.TokenAmount[] memory tokenAmounts = new ICommonStruct.TokenAmou

Vulnerable code:
```\n    ICommonStruct.TokenAmount[] memory bribeTokens = _sdtBlackHole.pullSdStakingBribes(\n        processor,\n        _processorRewardsPercentage\n    );\n\n    uint256 rewardAmount = _gaugeAsset.reward_count();\n\n    ICommonStruct.TokenAmount[] memory tokenAmounts = new ICommonStruct.TokenAmount[](\n        rewardAmount + bribeTokens.length\n    );\n\n    uint256 counter;\n    address _processor = processor;\n    for (uint256 j; j < rewardAmount; ) {\n        IERC20 token = _gaugeAsset.reward_tokens(j);\n        uint256 balance = token.balanceOf(address(this));\n        if (balance != 0) {\n            uint256 fullBalance = balance;\n\n            // rest of code\n\n            token.transfer(sdtRewardsReceiver, balance);\n\n          **@audit token and amount added from reward_tokens pulled directly from gauge**\n\n            tokenAmounts[counter++] = ICommonStruct.TokenAmount({token: token, amount: balance});\n        }\n\n        // rest of code\n\n    }\n\n    for (uint256 j; j < bribeTokens.length; ) {\n        IERC20 token = bribeTokens[j].token;\n        uint256 amount = bribeTokens[j].amount;\n\n      **@audit token and amount added directly with no check for duplicate token**\n\n        if (amount != 0) {\n            tokenAmounts[counter++] = ICommonStruct.TokenAmount({token: token, amount: amount});\n\n        // rest of code\n\n    }\n```\n
HIGH severity: Vulnerable function: ```\n    function createDeposit(\n        DataStore dataStore,\n        EventEmitter eventEmitter,\n. ```\n    function createDeposit(\n        DataStore dataStore,\n        EventEmitter eventEmitter,\n        DepositVault depositVault,\n        address account,\n        CreateDepositParams memory params\n    ) external returns (bytes32) {\n        Market.Props memory market = MarketUtils.getEnabled

Vulnerable code:
```\n    function createDeposit(\n        DataStore dataStore,\n        EventEmitter eventEmitter,\n        DepositVault depositVault,\n        address account,\n        CreateDepositParams memory params\n    ) external returns (bytes32) {\n        Market.Props memory market = MarketUtils.getEnabledMarket(dataStore, params.market);\n\n        uint256 initialLongTokenAmount = depositVault.recordTransferIn(params.initialLongToken);\n        uint256 initialShortTokenAmount = depositVault.recordTransferIn(params.initialShortToken);\n\n        address wnt = TokenUtils.wnt(dataStore);\n\n        if (market.longToken == wnt) {\n            initialLongTokenAmount -= params.executionFee;\n        } else if (market.shortToken == wnt) {\n            initialShortTokenAmount -= params.executionFee;\n```\n
HIGH severity: Vulnerable function: ```\nif (\_isPurchased[delegationId]) {\n    address holder = delegation.holder;. ```\nif (\_isPurchased[delegationId]) {\n    address holder = delegation.holder;\n    \_totalDelegated[holder] += delegation.amount;\n    if (\_totalDelegated[holder] >= \_purchased[holder]) {\n        purchasedToUnlocked(holder);\n    }\n}\n```\n

Vulnerable code:
```\nif (\_isPurchased[delegationId]) {\n    address holder = delegation.holder;\n    \_totalDelegated[holder] += delegation.amount;\n    if (\_totalDelegated[holder] >= \_purchased[holder]) {\n        purchasedToUnlocked(holder);\n    }\n}\n```\n
MEDIUM severity: Vulnerable function: ```\nFile: LiquidationModule.sol\n    function liquidate(\n        uint256 tokenID,\n        bytes[]. ```\nFile: LiquidationModule.sol\n    function liquidate(\n        uint256 tokenID,\n        bytes[] calldata priceUpdateData\n    ) external payable whenNotPaused updatePythPrice(vault, msg.sender, priceUpdateData) {\n        liquidate(tokenID);\n    }\n\n    /// @notice Function to liquidate a pos

Vulnerable code:
```\nFile: LiquidationModule.sol\n    function liquidate(\n        uint256 tokenID,\n        bytes[] calldata priceUpdateData\n    ) external payable whenNotPaused updatePythPrice(vault, msg.sender, priceUpdateData) {\n        liquidate(tokenID);\n    }\n\n    /// @notice Function to liquidate a position.\n    /// @dev One could directly call this method instead of `liquidate(uint256, bytes[])` if they don't want to update the Pyth price.\n    /// @param tokenId The token ID of the leverage position.\n    function liquidate(uint256 tokenId) public nonReentrant whenNotPaused liquidationInvariantChecks(vault, tokenId) {\n        FlatcoinStructs.Position memory position = vault.getPosition(tokenId);\n```\n
HIGH severity: Vulnerable function: ```\n    } else {\n        uint256 netRepayLimit = _actionInfo.collateralValue\n. ```\n    } else {\n        uint256 netRepayLimit = _actionInfo.collateralValue\n            .preciseMul(liquidationThresholdRaw.mul(10 ** 14))\n            .preciseMul(PreciseUnitMath.preciseUnit().sub(execution.unutilizedLeveragePercentage));\n\n        return _actionInfo.collateralBalance\n       

Vulnerable code:
```\n    } else {\n        uint256 netRepayLimit = _actionInfo.collateralValue\n            .preciseMul(liquidationThresholdRaw.mul(10 ** 14))\n            .preciseMul(PreciseUnitMath.preciseUnit().sub(execution.unutilizedLeveragePercentage));\n\n        return _actionInfo.collateralBalance\n            .preciseMul(netRepayLimit.sub(_actionInfo.borrowValue))\n            .preciseDiv(netRepayLimit);\n    }\n```\n
HIGH severity: Vulnerable function: ```\nuint256 publicInput = uint256(\n keccak256(\n abi.encode(\n shnarf,\n \_fin. ```\nuint256 publicInput = uint256(\n keccak256(\n abi.encode(\n shnarf,\n \_finalizationData.parentStateRootHash,\n \_finalizationData.lastFinalizedTimestamp,\n \_finalizationData.finalBlockNumber,\n \_finalizationData.finalTimestamp,\n \_finalizationData.l1RollingHash,\n \_finalizationData.l1Rolli

Vulnerable code:
```\nuint256 publicInput = uint256(\n keccak256(\n abi.encode(\n shnarf,\n \_finalizationData.parentStateRootHash,\n \_finalizationData.lastFinalizedTimestamp,\n \_finalizationData.finalBlockNumber,\n \_finalizationData.finalTimestamp,\n \_finalizationData.l1RollingHash,\n \_finalizationData.l1RollingHashMessageNumber,\n keccak256(abi.encodePacked(\_finalizationData.l2MerkleRoots))\n )\n```\n
HIGH severity: Vulnerable function: ```\nfunction \_transferETH(address \_recipient, uint256 \_amount) private {\n```\n. ```\nfunction \_transferETH(address \_recipient, uint256 \_amount) private {\n```\n

Vulnerable code:
```\nfunction \_transferETH(address \_recipient, uint256 \_amount) private {\n```\n
MEDIUM severity: Vulnerable function: ```\n      {\n      uint88 currentShortCollateral = currentShort.collateral;\n  . ```\n      {\n      uint88 currentShortCollateral = currentShort.collateral;\n      uint88 currentShortErcDebt = currentShort.ercDebt;\n      collateral += currentShortCollateral;\n      ercDebt += currentShortErcDebt;\n      yield += currentShortCollateral.mul(currentShort.zethYieldRate);\n      er

Vulnerable code:
```\n      {\n      uint88 currentShortCollateral = currentShort.collateral;\n      uint88 currentShortErcDebt = currentShort.ercDebt;\n      collateral += currentShortCollateral;\n      ercDebt += currentShortErcDebt;\n      yield += currentShortCollateral.mul(currentShort.zethYieldRate);\n      ercDebtSocialized += currentShortErcDebt.mul(currentShort.ercDebtRate);\n      }\n```\n
MEDIUM severity: Vulnerable function: ```\nfunction distributeLiquidatedFunds(uint256 agentID, uint256 amount) external {\n if (!liquidate. ```\nfunction distributeLiquidatedFunds(uint256 agentID, uint256 amount) external {\n if (!liquidated[agentID]) revert Unauthorized();\n\n // transfer the assets into the pool\n GetRoute.wFIL(router).transferFrom(msg.sender, address(this), amount);\n \_writeOffPools(agentID, amount);\n}\n```\n

Vulnerable code:
```\nfunction distributeLiquidatedFunds(uint256 agentID, uint256 amount) external {\n if (!liquidated[agentID]) revert Unauthorized();\n\n // transfer the assets into the pool\n GetRoute.wFIL(router).transferFrom(msg.sender, address(this), amount);\n \_writeOffPools(agentID, amount);\n}\n```\n
MEDIUM severity: Vulnerable function: ```\nfunction _depositAsset(uint256 amount) private {\n    netAssetDeposits += amount;\n    \n    IE. ```\nfunction _depositAsset(uint256 amount) private {\n    netAssetDeposits += amount;\n    \n    IERC20(assetToken).approve(address(vault), amount);\n    vault.deposit(assetToken, amount);\n}\n```\n

Vulnerable code:
```\nfunction _depositAsset(uint256 amount) private {\n    netAssetDeposits += amount;\n    \n    IERC20(assetToken).approve(address(vault), amount);\n    vault.deposit(assetToken, amount);\n}\n```\n
MEDIUM severity: Vulnerable function: ```\nfunction setValidatorAddress(uint128 validatorId, address newAddress) external whenNotPaused {\. ```\nfunction setValidatorAddress(uint128 validatorId, address newAddress) external whenNotPaused {\n    // // rest of code\n    v.stakings[newAddress].shares += v.stakings[msg.sender].shares;\n    v.stakings[newAddress].staked += v.stakings[msg.sender].staked;\n    delete v.stakings[msg.sender];\n 

Vulnerable code:
```\nfunction setValidatorAddress(uint128 validatorId, address newAddress) external whenNotPaused {\n    // // rest of code\n    v.stakings[newAddress].shares += v.stakings[msg.sender].shares;\n    v.stakings[newAddress].staked += v.stakings[msg.sender].staked;\n    delete v.stakings[msg.sender];\n    // // rest of code\n}\n```\n
MEDIUM severity: Vulnerable function: ```\nliqCumL + uint160(((liqCumR - liqCumL) * delta) / denom)\n```\n. ```\nliqCumL + uint160(((liqCumR - liqCumL) * delta) / denom)\n```\n

Vulnerable code:
```\nliqCumL + uint160(((liqCumR - liqCumL) * delta) / denom)\n```\n
MEDIUM severity: Vulnerable function: ```\n        address[] memory targets = new address[](UNDERLYING_IS_ETH ? 2 : 1). ```\n        address[] memory targets = new address[](UNDERLYING_IS_ETH ? 2 : 1);\n        bytes[] memory callData = new bytes[](UNDERLYING_IS_ETH ? 2 : 1);\n        targets[0] = LENDING_POOL;\n        callData[0] = abi.encodeWithSelector(\n            ILendingPool.withdraw.selector, underlyingToken

Vulnerable code:
```\n        address[] memory targets = new address[](UNDERLYING_IS_ETH ? 2 : 1);\n        bytes[] memory callData = new bytes[](UNDERLYING_IS_ETH ? 2 : 1);\n        targets[0] = LENDING_POOL;\n        callData[0] = abi.encodeWithSelector(\n            ILendingPool.withdraw.selector, underlyingToken, withdrawAmount, address(NOTIONAL)\n        );\n\n        if (UNDERLYING_IS_ETH) {\n            // Aave V3 returns WETH instead of native ETH so we have to unwrap it here\n            targets[1] = address(Deployments.WETH);\n            callData[1] = abi.encodeWithSelector(WETH9.withdraw.selector, withdrawAmount);\n        }\n\n        data = new RedeemData[](1);\n        // Tokens with less than or equal to 8 decimals sometimes have off by 1 issues when depositing\n        // into Aave V3. Aave returns one unit less than has been deposited. This adjustment is applied\n        // to ensure that this unit of token is credited back to prime cash holders appropriately.\n        uint8 rebasingTokenBalanceAdjustment = UNDERLYING_DECIMALS <= 8 ? 1 : 0;\n        data[0] = RedeemData(\n            targets, callData, withdrawAmount, ASSET_TOKEN, rebasingTokenBalanceAdjustment\n        );\n```\n
HIGH severity: Vulnerable function: ```\n    IERC20(asset).safeTransferFrom(msg.sender, address(this), amount);\n   . ```\n    IERC20(asset).safeTransferFrom(msg.sender, address(this), amount);\n    (address approveTarget, address swapTarget, bytes memory data) = abi\n    .decode(param, (address, address, bytes));\n    // if usdt\n    IERC20(asset).approve(approveTarget, 0);\n    IERC20(asset).approve(approveTarget

Vulnerable code:
```\n    IERC20(asset).safeTransferFrom(msg.sender, address(this), amount);\n    (address approveTarget, address swapTarget, bytes memory data) = abi\n    .decode(param, (address, address, bytes));\n    // if usdt\n    IERC20(asset).approve(approveTarget, 0);\n    IERC20(asset).approve(approveTarget, amount);\n    (bool success, ) = swapTarget.call(data);\n    if (success == false) {\n        assembly {\n            let ptr := mload(0x40)\n            let size := returndatasize()\n            returndatacopy(ptr, 0, size)\n            revert(ptr, size)\n        }\n    }\n```\n
MEDIUM severity: Vulnerable function: ```\nit('exchange rate manipulation', async () => {\n      const smallDeposit = . ```\nit('exchange rate manipulation', async () => {\n      const smallDeposit = utils.parseEther('1')\n      const smallestDeposit = utils.parseEther('0.000000000000000001')\n\n      // make a deposit with the attacker. Deposit 1 Wei to mint 1 Wei of shares\n      await vault.connect(user).deposit(s

Vulnerable code:
```\nit('exchange rate manipulation', async () => {\n      const smallDeposit = utils.parseEther('1')\n      const smallestDeposit = utils.parseEther('0.000000000000000001')\n\n      // make a deposit with the attacker. Deposit 1 Wei to mint 1 Wei of shares\n      await vault.connect(user).deposit(smallestDeposit, user.address)\n      await updateOracle();\n      await vault.sync()\n\n      console.log(await vault.totalSupply());\n\n      // donating assets to Vault\n      await dsu.connect(user).transfer(vault.address, utils.parseEther('1'))\n\n      console.log(await vault.totalAssets());\n\n      // make a deposit with the victim. Due to rounding the victim will end up with 0 shares\n      await updateOracle();\n      await vault.sync()\n      await vault.connect(user2).deposit(smallDeposit, user2.address)\n      await updateOracle();\n      await vault.sync()\n\n      console.log(await vault.totalAssets());\n      console.log(await vault.totalSupply());\n      // the amount of shares the victim receives is rounded down to 0\n      console.log(await vault.balanceOf(user2.address));\n\n      /*\n      at this point there are 2000000000000000001 Wei of assets in the Vault and only 1 Wei of shares\n      which is owned by the attacker.\n      This means the attacker has stolen all funds from the victim.\n      */\n    })\n```\n
MEDIUM severity: Vulnerable function: ```\n    function balanceOf(address _wearer, uint256 _hatId)\n        public\n        view\n        . ```\n    function balanceOf(address _wearer, uint256 _hatId)\n        public\n        view\n        override(ERC1155, IHats)\n        returns (uint256 balance)\n    {\n        Hat storage hat = _hats[_hatId];\n\n        balance = 0;\n\n        if (_isActive(hat, _hatId) && _isEligible(_wearer, hat, 

Vulnerable code:
```\n    function balanceOf(address _wearer, uint256 _hatId)\n        public\n        view\n        override(ERC1155, IHats)\n        returns (uint256 balance)\n    {\n        Hat storage hat = _hats[_hatId];\n\n        balance = 0;\n\n        if (_isActive(hat, _hatId) && _isEligible(_wearer, hat, _hatId)) {\n            balance = super.balanceOf(_wearer, _hatId);\n        }\n    }\n```\n
MEDIUM severity: Vulnerable function: ```\nif (msg.sender != holder) {\n  require(msg.sender == operator, "invalid req. ```\nif (msg.sender != holder) {\n  require(msg.sender == operator, "invalid request");\n}\n```\n

Vulnerable code:
```\nif (msg.sender != holder) {\n  require(msg.sender == operator, "invalid request");\n}\n```\n
HIGH severity: Vulnerable function: ```\nGEM.newProposal(proposal.CONTROLLER, 2, proposal.NAME, 4 weeks);\n```\n. ```\nGEM.newProposal(proposal.CONTROLLER, 2, proposal.NAME, 4 weeks);\n```\n

Vulnerable code:
```\nGEM.newProposal(proposal.CONTROLLER, 2, proposal.NAME, 4 weeks);\n```\n
HIGH severity: Vulnerable function: ```\nfunction investDAI(uint256 \_tokensAmount, address \_policyBookAddr) external override {\n```\n. ```\nfunction investDAI(uint256 \_tokensAmount, address \_policyBookAddr) external override {\n```\n

Vulnerable code:
```\nfunction investDAI(uint256 \_tokensAmount, address \_policyBookAddr) external override {\n```\n
MEDIUM severity: Vulnerable function: ```\n    function _accumulateExternalRewards() internal override returns (uint256[] memory) {\n     . ```\n    function _accumulateExternalRewards() internal override returns (uint256[] memory) {\n        uint256 numExternalRewards = externalRewardTokens.length;\n\n        auraPool.rewardsPool.getReward(address(this), true);\n\n        uint256[] memory rewards = new uint256[](numExternalRewards);\n 

Vulnerable code:
```\n    function _accumulateExternalRewards() internal override returns (uint256[] memory) {\n        uint256 numExternalRewards = externalRewardTokens.length;\n\n        auraPool.rewardsPool.getReward(address(this), true);\n\n        uint256[] memory rewards = new uint256[](numExternalRewards);\n        for (uint256 i; i < numExternalRewards; ) {\n            ExternalRewardToken storage rewardToken = externalRewardTokens[i];\n            uint256 newBalance = ERC20(rewardToken.token).balanceOf(address(this));\n\n            // This shouldn't happen but adding a sanity check in case\n            if (newBalance < rewardToken.lastBalance) {\n                emit LiquidityVault_ExternalAccumulationError(rewardToken.token);\n                continue;\n            }\n\n            rewards[i] = newBalance - rewardToken.lastBalance;\n            rewardToken.lastBalance = newBalance;\n\n            unchecked {\n                ++i;\n            }\n        }\n        return rewards;\n    }\n// rest of code\n    function _updateExternalRewardState(uint256 id_, uint256 amountAccumulated_) internal {\n        // This correctly uses 1e18 because the LP tokens of all major DEXs have 18 decimals\n        if (totalLP != 0)\n            externalRewardTokens[id_].accumulatedRewardsPerShare +=\n                (amountAccumulated_ * 1e18) /\n                totalLP;\n    }\n```\n
MEDIUM severity: Vulnerable function: ```\nif (block.timestamp >= lien.start + lien.duration) {\n  delta_t = uint256(l. ```\nif (block.timestamp >= lien.start + lien.duration) {\n  delta_t = uint256(lien.start + lien.duration - lien.last);\n} \n```\n

Vulnerable code:
```\nif (block.timestamp >= lien.start + lien.duration) {\n  delta_t = uint256(lien.start + lien.duration - lien.last);\n} \n```\n
MEDIUM severity: Vulnerable function: ```\n    function getTradingFee(uint256 quoteId) internal view returns (uint256 fee) {\n        Quot. ```\n    function getTradingFee(uint256 quoteId) internal view returns (uint256 fee) {\n        QuoteStorage.Layout storage quoteLayout = QuoteStorage.layout();\n        Quote storage quote = quoteLayout.quotes[quoteId];\n        Symbol storage symbol = SymbolStorage.layout().symbols[quote.symbolId]

Vulnerable code:
```\n    function getTradingFee(uint256 quoteId) internal view returns (uint256 fee) {\n        QuoteStorage.Layout storage quoteLayout = QuoteStorage.layout();\n        Quote storage quote = quoteLayout.quotes[quoteId];\n        Symbol storage symbol = SymbolStorage.layout().symbols[quote.symbolId];\n        if (quote.orderType == OrderType.LIMIT) {\n            fee =\n                (LibQuote.quoteOpenAmount(quote) * quote.requestedOpenPrice * symbol.tradingFee) /\n                1e36;\n        } else {\n            fee = (LibQuote.quoteOpenAmount(quote) * quote.marketPrice * symbol.tradingFee) / 1e36;\n        }\n    }\n```\n
HIGH severity: Vulnerable function: ```\nfunction refund(\n uint256 policyIndex\_,\n uint256 week\_,\n address who\_\n) external noReent. ```\nfunction refund(\n uint256 policyIndex\_,\n uint256 week\_,\n address who\_\n) external noReenter {\n Coverage storage coverage = coverageMap[policyIndex\_][week\_][who\_];\n\n require(!coverage.refunded, "Already refunded");\n\n uint256 allCovered = coveredMap[policyIndex\_][week\_];\n uint256

Vulnerable code:
```\nfunction refund(\n uint256 policyIndex\_,\n uint256 week\_,\n address who\_\n) external noReenter {\n Coverage storage coverage = coverageMap[policyIndex\_][week\_][who\_];\n\n require(!coverage.refunded, "Already refunded");\n\n uint256 allCovered = coveredMap[policyIndex\_][week\_];\n uint256 amountToRefund = refundMap[policyIndex\_][week\_].mul(\n coverage.amount).div(allCovered);\n coverage.amount = coverage.amount.mul(\n coverage.premium.sub(amountToRefund)).div(coverage.premium);\n coverage.refunded = true;\n\n IERC20(baseToken).safeTransfer(who\_, amountToRefund);\n\n if (eventAggregator != address(0)) {\n IEventAggregator(eventAggregator).refund(\n policyIndex\_,\n week\_,\n who\_,\n amountToRefund\n );\n }\n}\n```\n
MEDIUM severity: Vulnerable function: ```\n func (evm *EVM) Call(caller ContractRef, addr common.Address, input []byte. ```\n func (evm *EVM) Call(caller ContractRef, addr common.Address, input []byte, gas uint64, value *big.Int) (ret []byte, leftOverGas uint64, err error) { \n  if addr == dump.MessagePasserAddress { \n   statedumper.WriteMessage(caller.Address(), input) \n  } \n```\n

Vulnerable code:
```\n func (evm *EVM) Call(caller ContractRef, addr common.Address, input []byte, gas uint64, value *big.Int) (ret []byte, leftOverGas uint64, err error) { \n  if addr == dump.MessagePasserAddress { \n   statedumper.WriteMessage(caller.Address(), input) \n  } \n```\n