Farseen0/scar-pairs huggingface dataset:
MEDIUM severity: Vulnerable function: ```\nfunction matchOrders(\n    LibOrder.OrderParam memory takerOrderParam,\n    LibOrder.OrderParam. ```\nfunction matchOrders(\n    LibOrder.OrderParam memory takerOrderParam,\n    LibOrder.OrderParam[] memory makerOrderParams,\n    address \_perpetual,\n    uint256[] memory amounts\n) public {\n```\n

Vulnerable code:
```\nfunction matchOrders(\n    LibOrder.OrderParam memory takerOrderParam,\n    LibOrder.OrderParam[] memory makerOrderParams,\n    address \_perpetual,\n    uint256[] memory amounts\n) public {\n```\n
HIGH severity: Vulnerable function: ```\n    function _repayLoan(// rest of code) internal virtual {\n        // rest of code\n        b. ```\n    function _repayLoan(// rest of code) internal virtual {\n        // rest of code\n        bid.loanDetails.lendingToken.safeTransferFrom(\n            _msgSenderForMarket(bid.marketplaceId),\n            lender,\n            paymentAmount\n        );\n        // rest of code\n```\n

Vulnerable code:
```\n    function _repayLoan(// rest of code) internal virtual {\n        // rest of code\n        bid.loanDetails.lendingToken.safeTransferFrom(\n            _msgSenderForMarket(bid.marketplaceId),\n            lender,\n            paymentAmount\n        );\n        // rest of code\n```\n
HIGH severity: Vulnerable function: ```\nif (amountOwed != 0) {\n return fail(Error.NONZERO\_BORROW\_BALANCE, Failur. ```\nif (amountOwed != 0) {\n return fail(Error.NONZERO\_BORROW\_BALANCE, FailureInfo.EXIT\_MARKET\_BALANCE\_OWED);\n}\n\n/\* Fail if the sender is not permitted to redeem all of their tokens \*/\nuint allowed = redeemAllowedInternal(cTokenAddress, msg.sender, tokensHeld);\nif (allowed != 0) {\n ret

Vulnerable code:
```\nif (amountOwed != 0) {\n return fail(Error.NONZERO\_BORROW\_BALANCE, FailureInfo.EXIT\_MARKET\_BALANCE\_OWED);\n}\n\n/\* Fail if the sender is not permitted to redeem all of their tokens \*/\nuint allowed = redeemAllowedInternal(cTokenAddress, msg.sender, tokensHeld);\nif (allowed != 0) {\n return failOpaque(Error.REJECTION, FailureInfo.EXIT\_MARKET\_REJECTION, allowed);\n}\n```\n
HIGH severity: Vulnerable function: ```\n((borrowsValue - collateralValue) / underlyingValue) >= underlyingLiqThresh. ```\n((borrowsValue - collateralValue) / underlyingValue) >= underlyingLiqThreshold\n```\n

Vulnerable code:
```\n((borrowsValue - collateralValue) / underlyingValue) >= underlyingLiqThreshold\n```\n
HIGH severity: Vulnerable function: ```\nfunction liquidateVaultsForToken(\n    address fromToken,\n    address asyncSwapper,\n    IDest. ```\nfunction liquidateVaultsForToken(\n    address fromToken,\n    address asyncSwapper,\n    IDestinationVault[] memory vaultsToLiquidate,\n    SwapParams memory params\n) external nonReentrant hasRole(Roles.LIQUIDATOR_ROLE) onlyWhitelistedSwapper(asyncSwapper) {\n    uint256 gasBefore = gasleft()

Vulnerable code:
```\nfunction liquidateVaultsForToken(\n    address fromToken,\n    address asyncSwapper,\n    IDestinationVault[] memory vaultsToLiquidate,\n    SwapParams memory params\n) external nonReentrant hasRole(Roles.LIQUIDATOR_ROLE) onlyWhitelistedSwapper(asyncSwapper) {\n    uint256 gasBefore = gasleft();\n\n    (uint256 totalBalanceToLiquidate, uint256[] memory vaultsBalances) =\n        _prepareForLiquidation(fromToken, vaultsToLiquidate);\n    _performLiquidation(\n        gasBefore, fromToken, asyncSwapper, vaultsToLiquidate, params, totalBalanceToLiquidate, vaultsBalances\n    );\n}\n```\n
HIGH severity: Vulnerable function: ```\n  function _requestWithdrawal(uint256 _sTokenAmount) internal {\n    uint256 _sTokenBalance = b. ```\n  function _requestWithdrawal(uint256 _sTokenAmount) internal {\n    uint256 _sTokenBalance = balanceOf(msg.sender);\n    if (_sTokenAmount > _sTokenBalance) {\n      revert InsufficientSTokenBalance(msg.sender, _sTokenBalance);\n    }\n\n    /// Get current cycle index for this pool\n    uint2

Vulnerable code:
```\n  function _requestWithdrawal(uint256 _sTokenAmount) internal {\n    uint256 _sTokenBalance = balanceOf(msg.sender);\n    if (_sTokenAmount > _sTokenBalance) {\n      revert InsufficientSTokenBalance(msg.sender, _sTokenBalance);\n    }\n\n    /// Get current cycle index for this pool\n    uint256 _currentCycleIndex = poolCycleManager.getCurrentCycleIndex(\n      address(this)\n    );\n\n    /// Actual withdrawal is allowed in open period of cycle after next cycle\n    /// For example: if request is made in at some time in cycle 1,\n    /// then withdrawal is allowed in open period of cycle 3\n    uint256 _withdrawalCycleIndex = _currentCycleIndex + 2;\n\n    WithdrawalCycleDetail storage withdrawalCycle = withdrawalCycleDetails[\n      _withdrawalCycleIndex\n    ];\n\n    /// Cache existing requested amount for the cycle for the sender\n    uint256 _oldRequestAmount = withdrawalCycle.withdrawalRequests[msg.sender];\n    withdrawalCycle.withdrawalRequests[msg.sender] = _sTokenAmount;\n\n    unchecked {\n      /// Update total requested withdrawal amount for the cycle considering existing requested amount\n      if (_oldRequestAmount > _sTokenAmount) {\n        withdrawalCycle.totalSTokenRequested -= (_oldRequestAmount -\n          _sTokenAmount);\n      } else {\n        withdrawalCycle.totalSTokenRequested += (_sTokenAmount -\n          _oldRequestAmount);\n      }\n    }\n\n    emit WithdrawalRequested(msg.sender, _sTokenAmount, _withdrawalCycleIndex);\n  }\n```\n
MEDIUM severity: Vulnerable function: ```\nfunction initialize(\n address \_GOVERNANCE,\n address \_gETH,\n address \_ORACLE\_POSITION,\n . ```\nfunction initialize(\n address \_GOVERNANCE,\n address \_gETH,\n address \_ORACLE\_POSITION,\n address \_DEFAULT\_gETH\_INTERFACE,\n address \_DEFAULT\_DWP,\n address \_DEFAULT\_LP\_TOKEN,\n address \_MINI\_GOVERNANCE\_POSITION,\n uint256 \_GOVERNANCE\_TAX,\n uint256 \_COMET\_TAX,\n uint256 \_M

Vulnerable code:
```\nfunction initialize(\n address \_GOVERNANCE,\n address \_gETH,\n address \_ORACLE\_POSITION,\n address \_DEFAULT\_gETH\_INTERFACE,\n address \_DEFAULT\_DWP,\n address \_DEFAULT\_LP\_TOKEN,\n address \_MINI\_GOVERNANCE\_POSITION,\n uint256 \_GOVERNANCE\_TAX,\n uint256 \_COMET\_TAX,\n uint256 \_MAX\_MAINTAINER\_FEE,\n uint256 \_BOOSTRAP\_PERIOD\n) public virtual override initializer {\n \_\_ReentrancyGuard\_init();\n \_\_Pausable\_init();\n \_\_ERC1155Holder\_init();\n \_\_UUPSUpgradeable\_init();\n\n GEODE.SENATE = \_GOVERNANCE;\n GEODE.GOVERNANCE = \_GOVERNANCE;\n GEODE.GOVERNANCE\_TAX = \_GOVERNANCE\_TAX;\n GEODE.MAX\_GOVERNANCE\_TAX = \_GOVERNANCE\_TAX;\n GEODE.SENATE\_EXPIRY = type(uint256).max;\n\n STAKEPOOL.GOVERNANCE = \_GOVERNANCE;\n STAKEPOOL.gETH = IgETH(\_gETH);\n STAKEPOOL.TELESCOPE.gETH = IgETH(\_gETH);\n STAKEPOOL.TELESCOPE.ORACLE\_POSITION = \_ORACLE\_POSITION;\n STAKEPOOL.TELESCOPE.MONOPOLY\_THRESHOLD = 20000;\n\n updateStakingParams(\n \_DEFAULT\_gETH\_INTERFACE,\n \_DEFAULT\_DWP,\n \_DEFAULT\_LP\_TOKEN,\n \_MAX\_MAINTAINER\_FEE,\n \_BOOSTRAP\_PERIOD,\n type(uint256).max,\n type(uint256).max,\n \_COMET\_TAX,\n 3 days\n );\n```\n
HIGH severity: Vulnerable function: ```\nfunction totalTokenXBalance()\n    public\n    view\n    override\n    returns (uint256 balance. ```\nfunction totalTokenXBalance()\n    public\n    view\n    override\n    returns (uint256 balance)\n{\n    return tokenX.balanceOf(address(this)) - lockedPremium;\n}\n```\n

Vulnerable code:
```\nfunction totalTokenXBalance()\n    public\n    view\n    override\n    returns (uint256 balance)\n{\n    return tokenX.balanceOf(address(this)) - lockedPremium;\n}\n```\n
MEDIUM severity: Vulnerable function: ```\nfunction updateFeePerSecond(uint256 feePerSecond) external onlyOwner {\n        _store.feePerSe. ```\nfunction updateFeePerSecond(uint256 feePerSecond) external onlyOwner {\n        _store.feePerSecond = feePerSecond;\n        emit FeePerSecondUpdated(feePerSecond);\n    }\n```\n

Vulnerable code:
```\nfunction updateFeePerSecond(uint256 feePerSecond) external onlyOwner {\n        _store.feePerSecond = feePerSecond;\n        emit FeePerSecondUpdated(feePerSecond);\n    }\n```\n
HIGH severity: Vulnerable function: ```\n/\*\*\n \* Calculate an account's borrow power based on token's LTV\n \*/\nfunction getBorrowPo. ```\n/\*\*\n \* Calculate an account's borrow power based on token's LTV\n \*/\nfunction getBorrowPower(address \_borrower) public view returns (uint256 power) {\n    for(uint8 i = 0; i < globalConfig.tokenInfoRegistry().getCoinLength(); i++) {\n        if (isUserHasDeposits(\_borrower, i)) {\n     

Vulnerable code:
```\n/\*\*\n \* Calculate an account's borrow power based on token's LTV\n \*/\nfunction getBorrowPower(address \_borrower) public view returns (uint256 power) {\n    for(uint8 i = 0; i < globalConfig.tokenInfoRegistry().getCoinLength(); i++) {\n        if (isUserHasDeposits(\_borrower, i)) {\n            address token = globalConfig.tokenInfoRegistry().addressFromIndex(i);\n            uint divisor = INT\_UNIT;\n            if(token != ETH\_ADDR) {\n                divisor = 10\*\*uint256(globalConfig.tokenInfoRegistry().getTokenDecimals(token));\n            }\n            // globalConfig.bank().newRateIndexCheckpoint(token);\n            power = power.add(getDepositBalanceCurrent(token, \_borrower)\n                .mul(globalConfig.tokenInfoRegistry().priceFromIndex(i))\n                .mul(globalConfig.tokenInfoRegistry().getBorrowLTV(token)).div(100)\n                .div(divisor)\n            );\n        }\n    }\n    return power;\n}\n```\n
HIGH severity: Vulnerable function: ```\nfunction enterMarket(address \_cTokenAddr) public {\n    address[] memory markets = new address. ```\nfunction enterMarket(address \_cTokenAddr) public {\n    address[] memory markets = new address[](1);\n    markets[0] = \_cTokenAddr;\n\n    IComptroller(COMPTROLLER\_ADDR).enterMarkets(markets);\n}\n\n/// @notice Exits the Compound market\n/// @param \_cTokenAddr CToken address of the token\nf

Vulnerable code:
```\nfunction enterMarket(address \_cTokenAddr) public {\n    address[] memory markets = new address[](1);\n    markets[0] = \_cTokenAddr;\n\n    IComptroller(COMPTROLLER\_ADDR).enterMarkets(markets);\n}\n\n/// @notice Exits the Compound market\n/// @param \_cTokenAddr CToken address of the token\nfunction exitMarket(address \_cTokenAddr) public {\n    IComptroller(COMPTROLLER\_ADDR).exitMarket(\_cTokenAddr);\n}\n```\n
MEDIUM severity: Vulnerable function: ```\nFile: Tranche.sol\n    function issue(\n        address to,\n        uint256 underlyingAmount\n. ```\nFile: Tranche.sol\n    function issue(\n        address to,\n        uint256 underlyingAmount\n    ) external nonReentrant whenNotPaused notExpired returns (uint256 issued) {\n..SNIP..\n        // Transfer underlying from user to adapter and deposit it into adapter to get target token\n        

Vulnerable code:
```\nFile: Tranche.sol\n    function issue(\n        address to,\n        uint256 underlyingAmount\n    ) external nonReentrant whenNotPaused notExpired returns (uint256 issued) {\n..SNIP..\n        // Transfer underlying from user to adapter and deposit it into adapter to get target token\n        _underlying.safeTransferFrom(msg.sender, address(adapter), underlyingAmount);\n        (, uint256 sharesMinted) = adapter.prefundedDeposit();\n\n        // Deduct the issuance fee from the amount of target token minted + reinvested yield\n        // Fee should be rounded up towards the protocol (against the user) so that issued principal is rounded down\n        // Hackmd: F0\n        // ptIssued\n        // = (u/s + y - fee) * S\n        // = (sharesUsed - fee) * S\n        // where u = underlyingAmount, s = current scale, y = reinvested yield, S = maxscale\n        uint256 sharesUsed = sharesMinted + accruedInTarget;\n        uint256 fee = sharesUsed.mulDivUp(issuanceFeeBps, MAX_BPS);\n        issued = (sharesUsed - fee).mulWadDown(_maxscale);\n\n        // Accumulate issueance fee in units of target token\n        issuanceFees += fee;\n        // Mint PT and YT to user\n        _mint(to, issued);\n        _yt.mint(to, issued);\n\n        emit Issue(msg.sender, to, issued, sharesUsed);\n    }\n\n```\n
MEDIUM severity: Vulnerable function: ```\nFile: Tranche.sol\n    function withdraw(\n        uint256 underlyingAmount,\n        address t. ```\nFile: Tranche.sol\n    function withdraw(\n        uint256 underlyingAmount,\n        address to,\n        address from\n    ) external override nonReentrant expired returns (uint256) {\n        GlobalScales memory _gscales = gscales;\n        uint256 cscale = _updateGlobalScalesCache(_gscales)

Vulnerable code:
```\nFile: Tranche.sol\n    function withdraw(\n        uint256 underlyingAmount,\n        address to,\n        address from\n    ) external override nonReentrant expired returns (uint256) {\n        GlobalScales memory _gscales = gscales;\n        uint256 cscale = _updateGlobalScalesCache(_gscales);\n\n        // Compute the shares to be redeemed\n        uint256 sharesRedeem = underlyingAmount.divWadDown(cscale);\n        uint256 principalAmount = _computePrincipalTokenRedeemed(_gscales, sharesRedeem);\n\n        // Update the global scales\n        gscales = _gscales;\n        // Burn PT tokens from `from`\n        _burnFrom(from, principalAmount);\n        // Withdraw underlying tokens from the adapter and transfer them to `to`\n        _target.safeTransfer(address(adapter), sharesRedeem);\n        (uint256 underlyingWithdrawn, ) = adapter.prefundedRedeem(to);\n```\n
MEDIUM severity: Vulnerable function: ```\nstruct Order {\n    address trader;\n    address broker;\n    address perpe. ```\nstruct Order {\n    address trader;\n    address broker;\n    address perpetual;\n    uint256 amount;\n    uint256 price;\n    /\*\*\n \* Data contains the following values packed into 32 bytes\n \* ╔════════════════════╤═══════════════════════════════════════════════════════════╗\n \* ║ │ leng

Vulnerable code:
```\nstruct Order {\n    address trader;\n    address broker;\n    address perpetual;\n    uint256 amount;\n    uint256 price;\n    /\*\*\n \* Data contains the following values packed into 32 bytes\n \* ╔════════════════════╤═══════════════════════════════════════════════════════════╗\n \* ║ │ length(bytes) desc ║\n \* ╟────────────────────┼───────────────────────────────────────────────────────────╢\n \* ║ version │ 1 order version ║\n \* ║ side │ 1 0: buy (long), 1: sell (short) ║\n \* ║ isMarketOrder │ 1 0: limitOrder, 1: marketOrder ║\n \* ║ expiredAt │ 5 order expiration time in seconds ║\n \* ║ asMakerFeeRate │ 2 maker fee rate (base 100,000) ║\n \* ║ asTakerFeeRate │ 2 taker fee rate (base 100,000) ║\n \* ║ (d) makerRebateRate│ 2 rebate rate for maker (base 100) ║\n \* ║ salt │ 8 salt ║\n \* ║ isMakerOnly │ 1 is maker only ║\n \* ║ isInversed │ 1 is inversed contract ║\n \* ║ │ 8 reserved ║\n \* ╚════════════════════╧═══════════════════════════════════════════════════════════╝\n \*/\n    bytes32 data;\n}\n```\n
HIGH severity: Vulnerable function: ```\nuint256 constant MAXIMUM\_DEPOSIT\_FEE = 5e16; // 5%\nuint256 constant DEFA. ```\nuint256 constant MAXIMUM\_DEPOSIT\_FEE = 5e16; // 5%\nuint256 constant DEFAULT\_DEPOSIT\_FEE = 0e16; // 0%\n  \nuint256 constant MAXIMUM\_PERFORMANCE\_FEE = 50e16; // 50%\nuint256 constant DEFAULT\_PERFORMANCE\_FEE = 10e16; // 10%\n```\n

Vulnerable code:
```\nuint256 constant MAXIMUM\_DEPOSIT\_FEE = 5e16; // 5%\nuint256 constant DEFAULT\_DEPOSIT\_FEE = 0e16; // 0%\n  \nuint256 constant MAXIMUM\_PERFORMANCE\_FEE = 50e16; // 50%\nuint256 constant DEFAULT\_PERFORMANCE\_FEE = 10e16; // 10%\n```\n
MEDIUM severity: Vulnerable function: ```\nfunction getBorrowETH(\n    address \_accountAddr\n) public view returns (uint256 borrowETH) {\. ```\nfunction getBorrowETH(\n    address \_accountAddr\n) public view returns (uint256 borrowETH) {\n    uint tokenNum = globalConfig.tokenInfoRegistry().getCoinLength();\n    //console.log("tokenNum", tokenNum);\n    for(uint i = 0; i < tokenNum; i++) {\n        if(isUserHasBorrows(\_accountAddr, u

Vulnerable code:
```\nfunction getBorrowETH(\n    address \_accountAddr\n) public view returns (uint256 borrowETH) {\n    uint tokenNum = globalConfig.tokenInfoRegistry().getCoinLength();\n    //console.log("tokenNum", tokenNum);\n    for(uint i = 0; i < tokenNum; i++) {\n        if(isUserHasBorrows(\_accountAddr, uint8(i))) {\n            address tokenAddress = globalConfig.tokenInfoRegistry().addressFromIndex(i);\n            uint divisor = INT\_UNIT;\n            if(tokenAddress != ETH\_ADDR) {\n                divisor = 10 \*\* uint256(globalConfig.tokenInfoRegistry().getTokenDecimals(tokenAddress));\n            }\n            borrowETH = borrowETH.add(getBorrowBalanceCurrent(tokenAddress, \_accountAddr).mul(globalConfig.tokenInfoRegistry().priceFromIndex(i)).div(divisor));\n        }\n    }\n    return borrowETH;\n}\n```\n
HIGH severity: Vulnerable function: ```\nbytes32   private constant PRESALE\_ID                    = 0x5de9bbdeaf658. ```\nbytes32   private constant PRESALE\_ID                    = 0x5de9bbdeaf6584c220c7b7f1922383bcd8bbcd4b48832080afd9d5ebf9a04df5;\n```\n

Vulnerable code:
```\nbytes32   private constant PRESALE\_ID                    = 0x5de9bbdeaf6584c220c7b7f1922383bcd8bbcd4b48832080afd9d5ebf9a04df5;\n```\n
MEDIUM severity: Vulnerable function: ```\n while ((length - _operations) <= i) {\n            // this loop impelement. ```\n while ((length - _operations) <= i) {\n            // this loop impelements FILO (first in last out) stack to reduce gas cost and improve code readability\n            // changing it to FIFO (first in first out) would require more code changes and would be more expensive\n            _mintShar

Vulnerable code:
```\n while ((length - _operations) <= i) {\n            // this loop impelements FILO (first in last out) stack to reduce gas cost and improve code readability\n            // changing it to FIFO (first in first out) would require more code changes and would be more expensive\n            _mintShares(\n                queue[i].receiver,\n                _epochId,\n                queue[i].assets - relayerFee\n            );\n            emit Deposit(\n                msg.sender,\n                queue[i].receiver,\n                _epochId,\n                queue[i].assets - relayerFee\n            );\n            depositQueue.pop();\n            if (i == 0) break;\n            unchecked {\n                i--;\n            }\n        }\n```\n
MEDIUM severity: Vulnerable function: ```\nfunction withdraw(address depositor, IERC20 token, uint256 amountShares)\n    external\n    vir. ```\nfunction withdraw(address depositor, IERC20 token, uint256 amountShares)\n    external\n    virtual\n    override\n    onlyWhenNotPaused(PAUSED\_WITHDRAWALS)\n    onlyStrategyManager\n{\n    require(token == underlyingToken, "StrategyBase.withdraw: Can only withdraw the strategy token");\n    /

Vulnerable code:
```\nfunction withdraw(address depositor, IERC20 token, uint256 amountShares)\n    external\n    virtual\n    override\n    onlyWhenNotPaused(PAUSED\_WITHDRAWALS)\n    onlyStrategyManager\n{\n    require(token == underlyingToken, "StrategyBase.withdraw: Can only withdraw the strategy token");\n    // copy `totalShares` value to memory, prior to any decrease\n    uint256 priorTotalShares = totalShares;\n    require(\n        amountShares <= priorTotalShares,\n        "StrategyBase.withdraw: amountShares must be less than or equal to totalShares"\n    );\n\n    // Calculate the value that `totalShares` will decrease to as a result of the withdrawal\n    uint256 updatedTotalShares = priorTotalShares - amountShares;\n    // check to avoid edge case where share rate can be massively inflated as a 'griefing' sort of attack\n    require(updatedTotalShares >= MIN\_NONZERO\_TOTAL\_SHARES || updatedTotalShares == 0,\n        "StrategyBase.withdraw: updated totalShares amount would be nonzero but below MIN\_NONZERO\_TOTAL\_SHARES");\n    // Actually decrease the `totalShares` value\n    totalShares = updatedTotalShares;\n\n    /\*\*\n \* @notice calculation of amountToSend \*mirrors\* `sharesToUnderlying(amountShares)`, but is different since the `totalShares` has already\n \* been decremented. Specifically, notice how we use `priorTotalShares` here instead of `totalShares`.\n \*/\n    uint256 amountToSend;\n    if (priorTotalShares == amountShares) {\n        amountToSend = \_tokenBalance();\n    } else {\n        amountToSend = (\_tokenBalance() \* amountShares) / priorTotalShares;\n    }\n\n    underlyingToken.safeTransfer(depositor, amountToSend);\n}\n```\n
MEDIUM severity: Vulnerable function: ```\n        if gt(swapAmountInDataValue, 0) {\n            mstore(add(add(ptr, . ```\n        if gt(swapAmountInDataValue, 0) {\n            mstore(add(add(ptr, 0x24), mul(swapAmountInDataIndex, 0x20)), swapAmountInDataValue)\n        }\n        success := call(\n            maxGas,\n            target,\n            0, //value\n            ptr, //Inputs are stored at location pt

Vulnerable code:
```\n        if gt(swapAmountInDataValue, 0) {\n            mstore(add(add(ptr, 0x24), mul(swapAmountInDataIndex, 0x20)), swapAmountInDataValue)\n        }\n        success := call(\n            maxGas,\n            target,\n            0, //value\n            ptr, //Inputs are stored at location ptr\n            data.length,\n            0,\n            0\n        )\n```\n
MEDIUM severity: Vulnerable function: ```\nfunction deposit(address to) external override lock returns (uint256 amountBaseOut) {\n    requ. ```\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    reserveBase = IERC20(baseToken).balanceOf(address(this));\n    reserveQuote

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    reserveBase = IERC20(baseToken).balanceOf(address(this));\n    reserveQuote = IERC20(quoteToken).balanceOf(address(this));\n    // this function is locked and the contract can not reset reserves\n    deposited = true;\n    if (reserveQuote > 0) {\n        // set initial supply from reserveQuote\n        supply = amountBaseOut = getBaseOut(reserveQuote);\n        if (amountBaseOut > 0) {\n            \_safeTransfer(baseToken, to, amountBaseOut);\n            reserveBase = reserveBase.sub(amountBaseOut);\n        }\n    }\n    emit Deposit(msg.sender, reserveBase, reserveQuote, amountBaseOut, to);\n}\n```\n
MEDIUM severity: Vulnerable function: ```\nuint256 newExchangeRate = (totalUnderlying * (10 ** decimals)) / totalSuppl. ```\nuint256 newExchangeRate = (totalUnderlying * (10 ** decimals)) / totalSupply;\n```\n

Vulnerable code:
```\nuint256 newExchangeRate = (totalUnderlying * (10 ** decimals)) / totalSupply;\n```\n
HIGH severity: Vulnerable function: ```\nfunction swapByOrigin (address \_o, address \_t, uint256 \_oAmt, uint256 \_mTAmt, uint256 \_dli. ```\nfunction swapByOrigin (address \_o, address \_t, uint256 \_oAmt, uint256 \_mTAmt, uint256 \_dline) public notFrozen returns (uint256 tAmt\_) {\n\n    return transferByOrigin(\_o, \_t, \_dline, \_mTAmt, \_oAmt, msg.sender);\n\n}\n```\n

Vulnerable code:
```\nfunction swapByOrigin (address \_o, address \_t, uint256 \_oAmt, uint256 \_mTAmt, uint256 \_dline) public notFrozen returns (uint256 tAmt\_) {\n\n    return transferByOrigin(\_o, \_t, \_dline, \_mTAmt, \_oAmt, msg.sender);\n\n}\n```\n