function
stringlengths
12
63.3k
severity
stringclasses
4 values
```\n 1 2 3 4 5 6 7 8 9 < block number\nO1: A B B B B C C C D\nA A B B B B C C C\n^^ grouped oracle block ranges\n```\n
high
```\n function reinvestReward(\n MetaStable2TokenAuraStrategyContext calldata context,\n ReinvestRewardParams calldata params\n )\n```\n
medium
```\nfunction setTokenStatus(address tokenAddress, TokenStatus status) external onlyRole(TOKEN_MANAGER) {\n require(tokenInfos[tokenAddress].tokenSourceAddress != bytes32(0), "Bridge: unsupported token");\n tokenInfos[tokenAddress].tokenStatus = status;\n}\n```\n
none
```\nstruct ZeroExTransaction {\n uint256 salt; // Arbitrary number to ensure uniqueness of transaction hash.\n uint256 expirationTimeSeconds; // Timestamp in seconds at which transaction expires.\n uint256 gasPrice; // gasPrice that transaction is required to be executed with.\n address signerAddress; // Address of transaction signer.\n bytes data; // AbiV2 encoded calldata.\n}\n```\n
low
```\n if (amountToSwap > 0) {\n SWAP_POOL = IUniswapV3Pool(vault.pool());\n uint160 deltaSqrt = (param.sqrtRatioLimit *\n uint160(param.sellSlippage)) / uint160(Constants.DENOMINATOR);\n SWAP_POOL.swap(\n address(this),\n // if withdraw token is Token0, then swap token1 -> token0 (false)\n !isTokenA,\n amountToSwap.toInt256(),\n isTokenA\n ? param.sqrtRatioLimit + deltaSqrt\n : param.sqrtRatioLimit - deltaSqrt, // slippaged price cap\n abi.encode(address(this))\n );\n }\n```\n
high
```\n/// @dev only callable in the 1st year after deployment\nfunction removeNodeFromRegistry(address \_signer)\n external\n onlyActiveState(\_signer)\n{\n\n // solium-disable-next-line security/no-block-members\n require(block.timestamp < (blockTimeStampDeployment + YEAR\_DEFINITION), "only in 1st year");// solhint-disable-line not-rely-on-time\n require(msg.sender == unregisterKey, "only unregisterKey is allowed to remove nodes");\n\n SignerInformation storage si = signerIndex[\_signer];\n In3Node memory n = nodes[si.index];\n\n unregisterNodeInternal(si, n);\n\n}\n```\n
medium
```\n/// @notice Goes from courtesy call to active\n/// @dev Only callable if collateral is sufficient and the deposit is not expiring\n/// @param \_d deposit storage pointer\nfunction exitCourtesyCall(DepositUtils.Deposit storage \_d) public {\n require(\_d.inCourtesyCall(), "Not currently in courtesy call");\n require(block.timestamp <= \_d.fundedAt + TBTCConstants.getDepositTerm(), "Deposit is expiring");\n require(getCollateralizationPercentage(\_d) >= \_d.undercollateralizedThresholdPercent, "Deposit is still undercollateralized");\n \_d.setActive();\n \_d.logExitedCourtesyCall();\n}\n```\n
low
```\nfunction getRoundData(uint80 _roundId)\n public\n view\n virtual\n override\n returns (\n uint80 roundId,\n int256 answer,\n uint256 startedAt,\n uint256 updatedAt,\n uint80 answeredInRound\n )\n {\n (uint16 phaseId, uint64 aggregatorRoundId) = parseIds(_roundId);\n\n (\n uint80 roundId,\n int256 answer,\n uint256 startedAt,\n uint256 updatedAt,\n uint80 ansIn\n ) = phaseAggregators[phaseId].getRoundData(aggregatorRoundId);\n\n return addPhaseIds(roundId, answer, startedAt, updatedAt, ansIn, phaseId);\n }\n```\n
medium
```\n function test_protocol_owner_frontRuns_swaps_with_higher_fees() public whenMaturityNotPassed {\n // pre-condition\n vm.warp(maturity - 30 days);\n deal(address(pts[0]), alice, type(uint96).max, false); // ensure alice has enough pt\n uint256 preBaseLptSupply = tricrypto.totalSupply();\n uint256 ptInDesired = 100 * ONE_UNDERLYING;\n uint256 expectedBaseLptIssued = tricrypto.calc_token_amount([ptInDesired, 0, 0], true);\n\n // Pool owner sees swap about to occur and front runs updating fees to max value\n vm.startPrank(owner);\n pool.setFeeParameter("protocolFeePercent", 100);\n vm.stopPrank();\n\n // execute\n vm.prank(alice);\n uint256 underlyingOut = pool.swapPtForUnderlying(\n 0, ptInDesired, recipient, abi.encode(CallbackInputType.SwapPtForUnderlying, SwapInput(underlying, pts[0]))\n );\n // sanity check\n uint256 protocolFee = SwapEventsLib.getProtocolFeeFromLastSwapEvent(pool);\n assertGt(protocolFee, 0, "fee should be charged");\n }\n```\n
medium
```\n uint256 constant ISOUSD_TIME_DELAY = 3; // days;\n```\n
medium
```\n// AccountV1.sol\n\nfunction _deposit(\n address[] memory assetAddresses,\n uint256[] memory assetIds,\n uint256[] memory assetAmounts,\n address from\n ) internal {\n // If no Creditor is set, batchProcessDeposit only checks if the assets can be priced.\n // If a Creditor is set, batchProcessDeposit will also update the exposures of assets and underlying assets for the Creditor.\n uint256[] memory assetTypes =\n IRegistry(registry).batchProcessDeposit(creditor, assetAddresses, assetIds, assetAmounts);\n\n for (uint256 i; i < assetAddresses.length; ++i) {\n // Skip if amount is 0 to prevent storing addresses that have 0 balance.\n if (assetAmounts[i] == 0) continue;\n\n if (assetTypes[i] == 0) {\n if (assetIds[i] != 0) revert AccountErrors.InvalidERC20Id();\n _depositERC20(from, assetAddresses[i], assetAmounts[i]);\n } else if (assetTypes[i] == 1) {\n if (assetAmounts[i] != 1) revert AccountErrors.InvalidERC721Amount();\n _depositERC721(from, assetAddresses[i], assetIds[i]);\n } else if (assetTypes[i] == 2) {\n _depositERC1155(from, assetAddresses[i], assetIds[i], assetAmounts[i]);\n } else {\n revert AccountErrors.UnknownAssetType();\n }\n }\n\n if (erc20Stored.length + erc721Stored.length + erc1155Stored.length > ASSET_LIMIT) {\n revert AccountErrors.TooManyAssets();\n }\n }\n```\n
high
```\n _require(minPrice <= price && price <= maxPrice, Errors.PRICE_INVALID);\n```\n
medium
```\nfunction toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n}\n```\n
none
```\nrequire(block.timestamp >= \_d.withdrawalRequestTime + TBTCConstants.getIncreaseFeeTimer(), "Fee increase not yet permitted");\n```\n
medium
```\n require(!v.frozen, "Validator is frozen");\n```\n
medium
```\nfunction functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, "Address: low-level call failed");\n}\n```\n
none
```\nuint256 ticketSplit = totalSupply.div(\_\_numberOfWinners);\nuint256 nextRandom = randomNumber.add(ticketSplit);\n// the other winners receive their prizeShares\nfor (uint256 winnerCount = 1; winnerCount < \_\_numberOfWinners; winnerCount++) {\n winners[winnerCount] = ticket.draw(nextRandom);\n nextRandom = nextRandom.add(ticketSplit);\n}\n```\n
low
```\nfunction updatePayoutToken(address token) public onlyOwner {\n defaultToken = token;\n}\n```\n
none
```\nfunction withdrawStuckTokens(address ERC20_token) external onlyOwner {\n require(ERC20_token != address(this), "Owner cannot claim native tokens");\n\n uint256 tokenBalance = IERC20(ERC20_token).balanceOf(address(this));\n require(tokenBalance > 0, "No tokens available to withdraw");\n\n bool success = IERC20(ERC20_token).transfer(msg.sender, tokenBalance);\n require(success, "transferring tokens failed!");\n}\n```\n
none
```\nslot0 = slot0_ | ((block.timestamp + LIQUIDATION_GRACE_PERIOD) << 208);\n```\n
high
```\n (\n uint80 baseRoundID,\n int256 basePrice,\n /*uint256 baseStartedAt*/\n ,\n uint256 baseTimeStamp,\n /*uint80 baseAnsweredInRound*/\n ) = baseOracle.latestRoundData();\n```\n
low
```\n// Findings are labeled with '<= FOUND'\n// File: src/Distributor.sol\n function _distribute(address token, address[] memory winners, uint256[] memory percentages, bytes memory data)\n // rest of code\n _commissionTransfer(erc20);// <= FOUND\n // rest of code\n }\n // rest of code\n function _commissionTransfer(IERC20 token) internal {\n token.safeTransfer(STADIUM_ADDRESS, token.balanceOf(address(this)));// <= FOUND: Blacklisted STADIUM_ADDRESS address cause fund stuck in the contract forever\n }\n```\n
medium
```\nconstructor() {\n _balances[address(this)] = _totalSupply;\n\n isFeeExempt[msg.sender] = true;\n isFeeExempt[MIGRATION_WALLET] = true;\n \n isTxLimitExempt[MIGRATION_WALLET] = true;\n isTxLimitExempt[msg.sender] = true;\n isTxLimitExempt[address(this)] = true;\n isTxLimitExempt[DEAD] = true;\n isTxLimitExempt[address(0)] = true;\n\n emit Transfer(address(0), address(this), _totalSupply);\n}\n```\n
none
```\nfunction update(\n Account memory self,\n uint256 currentId,\n UFixed6 assets,\n UFixed6 shares,\n UFixed6 deposit,\n UFixed6 redemption\n) internal pure {\n self.current = currentId;\n // @audit global account will have less assets and shares than sum of local accounts\n (self.assets, self.shares) = (self.assets.sub(assets), self.shares.sub(shares));\n (self.deposit, self.redemption) = (self.deposit.add(deposit), self.redemption.add(redemption));\n}\n```\n
high
```\n for (uint256 i; i < numRecipients; ) {\n expectedTotalValue += amounts[i];\n\n unchecked {\n ++i;\n }\n }\n\n if (msg.value != expectedTotalValue) {\n revert INVALID_DEPOSIT();\n }\n```\n
high
```\n if (token == quoteAsset || token == baseAsset || token == weth) {\n revert CannotRecoverRestrictedToken(address(this));\n }\n token.transfer(recipient, token.balanceOf(address(this)));\n```\n
medium
```\nfunc MigrateWithdrawal(withdrawal *LegacyWithdrawal, l1CrossDomainMessenger *common.Address) (*Withdrawal, error) {\n // Attempt to parse the value\n value, err := withdrawal.Value()\n if err != nil {\n return nil, fmt.Errorf("cannot migrate withdrawal: %w", err)\n }\n\n abi, err := bindings.L1CrossDomainMessengerMetaData.GetAbi()\n if err != nil {\n return nil, err\n }\n\n // Migrated withdrawals are specified as version 0. Both the\n // L2ToL1MessagePasser and the CrossDomainMessenger use the same\n // versioning scheme. Both should be set to version 0\n versionedNonce := EncodeVersionedNonce(withdrawal.XDomainNonce, new(big.Int))\n // Encode the call to `relayMessage` on the `CrossDomainMessenger`.\n // The minGasLimit can safely be 0 here.\n data, err := abi.Pack(\n "relayMessage",\n versionedNonce,\n withdrawal.XDomainSender,\n withdrawal.XDomainTarget,\n value,\n new(big.Int), // <= THIS IS THE INNER GAS LIMIT BEING SET TO ZERO\n []byte(withdrawal.XDomainData),\n )\n if err != nil {\n return nil, fmt.Errorf("cannot abi encode relayMessage: %w", err)\n }\n\n gasLimit := MigrateWithdrawalGasLimit(data)\n\n w := NewWithdrawal(\n versionedNonce,\n &predeploys.L2CrossDomainMessengerAddr,\n l1CrossDomainMessenger,\n value,\n new(big.Int).SetUint64(gasLimit), // <= THIS IS THE OUTER GAS LIMIT BEING SET\n data,\n )\n return w, nil\n}\n```\n
high
```\n uint256 balanceBefore = getVaultBalance() - reservedFunds;\n vaultCurrency.safeTransferFrom(msg.sender, address(this), _amount);\n uint256 balanceAfter = getVaultBalance() - reservedFunds;\n uint256 amount = balanceAfter - balanceBefore;\n```\n
medium
```\nfunction _createAuction() private returns (bool) {\n // Get the next token available for bidding\n try token.mint() returns (uint256 tokenId) {\n // Store the token id\n auction.tokenId = tokenId;\n\n // Cache the current timestamp\n uint256 startTime = block.timestamp;\n\n // Used to store the auction end time\n uint256 endTime;\n\n // Cannot realistically overflow\n unchecked {\n // Compute the auction end time\n endTime = startTime + settings.duration;\n }\n\n // Store the auction start and end time\n auction.startTime = uint40(startTime);\n auction.endTime = uint40(endTime);\n\n // Reset data from the previous auction\n auction.highestBid = 0;\n auction.highestBidder = address(0);\n auction.settled = false;\n\n // Reset referral from the previous auction\n currentBidReferral = address(0);\n\n emit AuctionCreated(tokenId, startTime, endTime);\n return true;\n } catch {\n // Pause the contract if token minting failed\n _pause();\n return false;\n }\n}\n```\n
medium
```\nfunction test_fulfillRandomWords_revert() public {\n _startGameAndDrawOneRound();\n\n _drawXRounds(48);\n \n uint256 counter = 0;\n uint256[] memory wa = new uint256[](30);\n uint256 totalCost = 0;\n\n for (uint256 j=2; j <= 6; j++) \n {\n (uint256[] memory woundedAgentIds, ) = infiltration.getRoundInfo({roundId: j});\n\n uint256[] memory costs = new uint256[](woundedAgentIds.length);\n for (uint256 i; i < woundedAgentIds.length; i++) {\n costs[i] = HEAL_BASE_COST;\n wa[counter] = woundedAgentIds[i];\n counter++;\n if(counter > 29) break;\n }\n\n if(counter > 29) break;\n }\n \n \n totalCost = HEAL_BASE_COST * wa.length;\n looks.mint(user1, totalCost);\n\n vm.startPrank(user1);\n _grantLooksApprovals();\n looks.approve(TRANSFER_MANAGER, totalCost);\n\n\n infiltration.heal(wa);\n vm.stopPrank();\n\n _drawXRounds(1);\n }\n```\n
medium
```\nfunction div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, "SafeMath: division by zero");\n}\n```\n
none
```\nfunction swapBack() private {\n uint256 contractBalance = balanceOf(address(this));\n uint256 totalTokensToSwap = contractBalance;\n bool success;\n\n if (contractBalance == 0) {\n return;\n }\n\n if (contractBalance > swapBackValueMax) {\n contractBalance = swapBackValueMax;\n }\n\n uint256 amountToSwapForETH = contractBalance;\n\n uint256 initialETHBalance = address(this).balance;\n\n swapTokensForEth(amountToSwapForETH);\n\n uint256 ethBalance = address(this).balance.sub(initialETHBalance);\n\n uint256 ethForDev = ethBalance.mul(tokensForProject).div(\n totalTokensToSwap\n );\n\n tokensForMarketing = 0;\n tokensForProject = 0;\n\n (success, ) = address(projectWallet).call{value: ethForDev}("");\n\n (success, ) = address(marketingWallet).call{\n value: address(this).balance\n }("");\n}\n```\n
none
```\nuser.rewardDebt = int128(user.virtualAmount \* pool.accTribePerShare) / toSigned128(ACC\_TRIBE\_PRECISION);\n```\n
medium
```\nif (virtualSupply > 0) {\n uint256 blocks = block.number - pool.lastRewardBlock;\n uint256 tribeReward = (blocks \* tribePerBlock() \* pool.allocPoint) / totalAllocPoint;\n pool.accTribePerShare = uint128(pool.accTribePerShare + ((tribeReward \* ACC\_TRIBE\_PRECISION) / virtualSupply));\n}\n```\n
low
```\nFile: Constants.sol\n // Basis for percentages\n int256 internal constant PERCENTAGE_DECIMALS = 100;\n```\n
medium
```\n // Cut withdraw fee if it is in withdrawVaultFee Window (2 months)\n if (\n block.timestamp <\n config.withdrawVaultFeeWindowStartTime() +\n config.withdrawVaultFeeWindow()\n ) {\n uint256 fee = (withdrawAmount * config.withdrawVaultFee()) /\n DENOMINATOR;\n uToken.safeTransfer(config.treasury(), fee);\n withdrawAmount -= fee;\n }\n```\n
high
```\n for (uint i = 0; i < rewardTokens.length; i++) {\n IERC20Upgradeable(rewardTokens[i]).safeTransfer(\n msg.sender,\n rewards[i]\n );\n }\n```\n
high
```\nfunction checkBlacklist(address _address) external view returns (bool) {\n return blacklisted[_address];\n}\n```\n
none
```\n function liveMarketsBy(address owner_) external view returns (uint256[] memory) {\n uint256 count;\n IBondAuctioneer auctioneer;\n for (uint256 i; i < marketCounter; ++i) {\n auctioneer = marketsToAuctioneers[i];\n if (auctioneer.isLive(i) && auctioneer.ownerOf(i) == owner_) {\n ++count;\n }\n }\n\n\n uint256[] memory ids = new uint256[](count);\n count = 0;\n for (uint256 i; i < marketCounter; ++i) {\n auctioneer = marketsToAuctioneers[i];\n if (auctioneer.isLive(i) && auctioneer.ownerOf(i) == owner_) {\n ids[count] = i;\n ++count;\n }\n }\n\n\n return ids;\n }\n```\n
medium
```\nfunction sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, "SafeMath: subtraction overflow");\n}\n```\n
none
```\nfunction refund() override external onlyMinipoolOwnerOrWithdrawalAddress(msg.sender) onlyInitialised {\n // Check refund balance\n require(nodeRefundBalance > 0, "No amount of the node deposit is available for refund");\n // If this minipool was distributed by a user, force finalisation on the node operator\n if (!finalised && userDistributed) {\n \_finalise();\n }\n // Refund node\n \_refund();\n}\n```\n
medium
```\n // 9 >= 10 is false\n if (currentSignerCount >= maxSigs) {\n revert MaxSignersReached();\n }\n\n // msg.sender is a new signer so he is not yet owner\n if (safe.isOwner(msg.sender)) {\n revert SignerAlreadyClaimed(msg.sender);\n }\n\n // msg.sender is a valid signer, he wears the signer hat\n if (!isValidSigner(msg.sender)) {\n revert NotSignerHatWearer(msg.sender);\n }\n```\n
high
```\nuint256 totalShare = rocketMinipoolManager.getMinipoolWithdrawalTotalBalance(msg.sender);\nuint256 nodeShare = rocketMinipoolManager.getMinipoolWithdrawalNodeBalance(msg.sender);\nuint256 userShare = totalShare.sub(nodeShare);\n// Get withdrawal amounts based on shares\nuint256 nodeAmount = 0;\nuint256 userAmount = 0;\nif (totalShare > 0) {\n nodeAmount = msg.value.mul(nodeShare).div(totalShare);\n userAmount = msg.value.mul(userShare).div(totalShare);\n}\n```\n
low
```\nfunction initiatePlanet(\n DataStoreUtils.DataStore storage DATASTORE,\n uint256[3] memory uintSpecs,\n address[5] memory addressSpecs,\n string[2] calldata interfaceSpecs\n)\n external\n initiator(DATASTORE, 5, uintSpecs[0], addressSpecs[1])\n returns (\n address miniGovernance,\n address gInterface,\n address withdrawalPool\n )\n```\n
low
```\n reserveRatio = ScalingUtils.scaleByBases(\n allReserves * valueBase / liabilities,\n valueBase,\n tokenManager.RESERVE_RATIO_BASE()\n );\n```\n
medium
```\nreceive() external payable {\n\n}\n```\n
none
```\nfunction getValueOfHoldings(address holder) public view returns (uint256) {\n return\n ((_balances[holder] * liquidity) / _balances[address(this)]) *\n getBNBPrice();\n}\n```\n
none
```\n// File: telcoin-audit/contracts/sablier/core/CouncilMember.sol\n function burn(\n // rest of code\n balances.pop(); // <= FOUND: balances.length decreases, while latest minted nft withold its unique tokenId\n _burn(tokenId);\n }\n```\n
high
```\nfunction totalSupply() public view override returns (uint256) {\n return _tTotal;\n}\n```\n
none
```\nFile: BaseLSTAdapter.sol\n function setRebalancer(address _rebalancer) external onlyOwner {\n rebalancer = _rebalancer;\n }\n```\n
medium
```\nfunction add(uint256 a, uint256 b) internal pure returns (uint256) {\n return a + b;\n}\n```\n
none
```\nfunction calculateLiquidityFee(uint256 _amount)\n private\n view\n returns (uint256)\n{\n return _amount.mul(_liquidityFee).div(10**2);\n}\n```\n
none
```\nfunction tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (a == 0) return (true, 0);\n uint256 c = a * b;\n if (c / a != b) return (false, 0);\n return (true, c);\n }\n}\n```\n
none
```\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n "SafeERC20: approve from non-zero to non-zero allowance"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n```\n
medium
```\nRocketDAONodeTrustedInterface rocketDAONodeTrusted = RocketDAONodeTrustedInterface(getContractAddress("rocketDAONodeTrusted"));\nif (calcBase.mul(submissionCount).div(rocketDAONodeTrusted.getMemberCount()) >= rocketDAOProtocolSettingsNetwork.getNodeConsensusThreshold()) {\n // Update the price\n updatePrices(\_block, \_rplPrice);\n}\n```\n
medium
```\nfunction _updateGrandPrizePool(uint256 grandPrize) internal {\n require(\n grandPrize <= address(this).balance.sub(_reserves),\n "DCBW721: GrandPrize-Balance Mismatch"\n );\n _grandPrizePool = grandPrize;\n}\n```\n
none
```\n for (uint i; i < swapParams.length; ) {\n // find excess amount after repay\n uint swapAmt = swapParams[i].operation == SwapOperation.EXACT_IN\n ? IERC20(swapParams[i].tokenIn).balanceOf(address(this)) - openTokenInfos[i].borrowAmt\n : openTokenInfos[i].borrowAmt - IERC20(swapParams[i].tokenOut).balanceOf(address(this));\n swapAmt = (swapAmt * swapParams[i].percentSwapE18) / ONE_E18\n if (swapAmt == 0) {\n revert SwapZeroAmount();\n }\n```\n
medium
```\n function mint(\n uint8 p,\n address u,\n uint256 m,\n uint256 a\n ) external unpaused(u, m, p) returns (bool) {\n // Fetch the desired principal token\n address principal = IMarketPlace(marketPlace).token(u, m, p);\n\n // Transfer the users principal tokens to the lender contract\n Safe.transferFrom(IERC20(principal), msg.sender, address(this), a);\n\n // Mint the tokens received from the user\n IERC5095(principalToken(u, m)).authMint(msg.sender, a);\n\n emit Mint(p, u, m, a);\n\n return true;\n }\n```\n
high
```\nFile: LiquidationModule.sol\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 (uint256 currentPrice, ) = IOracleModule(vault.moduleAddress(FlatcoinModuleKeys._ORACLE_MODULE_KEY)).getPrice();\n\n // Settle funding fees accrued till now.\n vault.settleFundingFees();\n\n // Check if the position can indeed be liquidated.\n if (!canLiquidate(tokenId)) revert FlatcoinErrors.CannotLiquidate(tokenId);\n\n FlatcoinStructs.PositionSummary memory positionSummary = PerpMath._getPositionSummary(\n position,\n vault.cumulativeFundingRate(),\n currentPrice\n );\n..SNIP..\n vault.updateGlobalPositionData({\n price: position.lastPrice,\n marginDelta: -(int256(position.marginDeposited) + positionSummary.accruedFunding),\n additionalSizeDelta: -int256(position.additionalSize) // Since position is being closed, additionalSizeDelta should be negative.\n });\n```\n
high
```\nfunction setState(uint delegationId, State newState) internal {\n TimeHelpers timeHelpers = TimeHelpers(contractManager.getContract("TimeHelpers"));\n DelegationController delegationController = DelegationController(contractManager.getContract("DelegationController"));\n\n require(newState != State.PROPOSED, "Can't set state to proposed");\n\n if (newState == State.ACCEPTED) {\n State currentState = getState(delegationId);\n require(currentState == State.PROPOSED, "Can't set state to accepted");\n\n \_state[delegationId] = State.ACCEPTED;\n \_timelimit[delegationId] = timeHelpers.getNextMonthStart();\n } else if (newState == State.DELEGATED) {\n revert("Can't set state to delegated");\n } else if (newState == State.ENDING\_DELEGATED) {\n require(getState(delegationId) == State.DELEGATED, "Can't set state to ending delegated");\n DelegationController.Delegation memory delegation = delegationController.getDelegation(delegationId);\n\n \_state[delegationId] = State.ENDING\_DELEGATED;\n \_timelimit[delegationId] = timeHelpers.calculateDelegationEndTime(delegation.created, delegation.delegationPeriod, 3);\n \_endingDelegations[delegation.holder].push(delegationId);\n } else {\n revert("Unknown state");\n }\n}\n```\n
medium
```\nFile: LMPVault.sol\n function _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 there's no supply then there should be no assets and so nothing\n // to actually take fees on\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 // Even if we aren't going to take the fee (haven't set a sink)\n // We still want to calculate so we can emit for off-chain analysis\n profit = (currentNavPerShare - effectiveNavPerShareHighMark) * totalSupply;\n```\n
medium
```\nfunction setBlacklist(address _address, bool _isBlacklisted) external onlyOwner {\n blacklisted[_address] = _isBlacklisted;\n emit Blacklist(_address, _isBlacklisted);\n}\n```\n
none
```\naddressToWithdrawalNonce[\_partition][supplier] = withdrawalRootNonce;\n```\n
medium
```\nfunction _hashSplit(\n address[] memory accounts,\n uint32[] memory percentAllocations,\n uint32 distributorFee\n) internal pure returns (bytes32) {\n return\n keccak256(abi.encodePacked(accounts, percentAllocations, distributorFee));\n}\n```\n
none
```\nFile: libraries/V2Calculations.sol\n\n 93: // Cast to int265 to avoid underflow errors (negative means loan duration has passed)\n 94: int256 durationLeftOnLoan = int256(\n 95: uint256(_bid.loanDetails.loanDuration)\n 96: ) -\n 97: (int256(_timestamp) -\n 98: int256(uint256(_bid.loanDetails.acceptedTimestamp)));\n 99: bool isLastPaymentCycle = durationLeftOnLoan <\n int256(uint256(_bid.terms.paymentCycle)) || // Check if current payment cycle is within or beyond the last one\n owedPrincipal_ + interest_ <= _bid.terms.paymentCycleAmount; // Check if what is left to pay is less than the payment cycle amount\n```\n
medium
```\nfunction numberMarker() internal view {\n assembly {mstore(0, number())}\n}\n```\n
none
```\n// Previous code\n\n function addUnderlying(uint256 amount, uint256 minAmountOut) internal {\n //// rest of code\n C.bean().mint(\n address(this),\n newDepositedBeans.add(newDepositedLPBeans)\n );\n\n // Add Liquidity\n uint256 newLP = C.curveZap().add_liquidity(\n C.CURVE_BEAN_METAPOOL, // where to add liquidity\n [\n newDepositedLPBeans, // BEANS to add\n 0,\n amount, // USDC to add\n 0\n ], // how much of each token to add\n minAmountOut // min lp ampount to receive\n ); // @audit-ok Does not admit depositing 0 --> https://etherscan.io/address/0x5F890841f657d90E081bAbdB532A05996Af79Fe6#code#L487\n\n // Increment underlying balances of Unripe Tokens\n LibUnripe.incrementUnderlying(C.UNRIPE_BEAN, newDepositedBeans);\n LibUnripe.incrementUnderlying(C.UNRIPE_LP, newLP);\n\n s.recapitalized = s.recapitalized.add(amount);\n }\n```\n
medium
```\ncontract esLBRBoost is Ownable {\n esLBRLockSetting[] public esLBRLockSettings;\n mapping(address => LockStatus) public userLockStatus;\n IMiningIncentives public miningIncentives;\n\n // Define a struct for the lock settings\n struct esLBRLockSetting {\n uint256 duration;\n uint256 miningBoost;\n }\n\n // Define a struct for the user's lock status\n struct LockStatus {\n uint256 lockAmount;\n uint256 unlockTime;\n uint256 duration;\n uint256 miningBoost;\n }\n\n // Constructor to initialize the default lock settings\n constructor(address \_miningIncentives) {\n```\n
low
```\nif (\_purchased[delegation.holder] > 0) {\n \_isPurchased[delegationId] = true;\n if (\_purchased[delegation.holder] > delegation.amount) {\n \_purchased[delegation.holder] -= delegation.amount;\n } else {\n \_purchased[delegation.holder] = 0;\n }\n} else {\n \_isPurchased[delegationId] = false;\n}\n```\n
high
```\nfunction allowance(address owner, address spender) public view override returns (uint256) {\n return _allowances[owner][spender];\n}\n```\n
none
```\nFile: VaultLiquidationAction.sol\n function deleverageAccount(\n address account,\n address vault,\n address liquidator,\n uint16 currencyIndex,\n int256 depositUnderlyingInternal\n ) external payable nonReentrant override returns (\n uint256 vaultSharesToLiquidator,\n int256 depositAmountPrimeCash\n ) {\n require(currencyIndex < 3);\n (\n VaultConfig memory vaultConfig,\n VaultAccount memory vaultAccount,\n VaultState memory vaultState\n ) = _authenticateDeleverage(account, vault, liquidator);\n\n PrimeRate memory pr;\n // Currency Index is validated in this method\n (\n depositUnderlyingInternal,\n vaultSharesToLiquidator,\n pr\n ) = IVaultAccountHealth(address(this)).calculateDepositAmountInDeleverage(\n currencyIndex, vaultAccount, vaultConfig, vaultState, depositUnderlyingInternal\n );\n\n uint16 currencyId = vaultConfig.borrowCurrencyId;\n if (currencyIndex == 1) currencyId = vaultConfig.secondaryBorrowCurrencies[0];\n else if (currencyIndex == 2) currencyId = vaultConfig.secondaryBorrowCurrencies[1];\n\n Token memory token = TokenHandler.getUnderlyingToken(currencyId);\n // Excess ETH is returned to the liquidator natively\n (/* */, depositAmountPrimeCash) = TokenHandler.depositUnderlyingExternal(\n liquidator, currencyId, token.convertToExternal(depositUnderlyingInternal), pr, false \n );\n\n // Do not skip the min borrow check here\n vaultAccount.vaultShares = vaultAccount.vaultShares.sub(vaultSharesToLiquidator);\n if (vaultAccount.maturity == Constants.PRIME_CASH_VAULT_MATURITY) {\n // Vault account will not incur a cash balance if they are in the prime cash maturity, their debts\n // will be paid down directly.\n _reduceAccountDebt(\n vaultConfig, vaultState, vaultAccount, pr, currencyIndex, depositUnderlyingInternal, true\n );\n depositAmountPrimeCash = 0;\n }\n\n // Check min borrow in this liquidation method, the deleverage calculation should adhere to the min borrow\n vaultAccount.setVaultAccountForLiquidation(vaultConfig, currencyIndex, depositAmountPrimeCash, true);\n\n emit VaultDeleverageAccount(vault, account, currencyId, vaultSharesToLiquidator, depositAmountPrimeCash);\n emit VaultLiquidatorProfit(vault, account, liquidator, vaultSharesToLiquidator, true);\n\n _transferVaultSharesToLiquidator(\n liquidator, vaultConfig, vaultSharesToLiquidator, vaultAccount.maturity\n );\n\n Emitter.emitVaultDeleverage(\n liquidator, account, vault, currencyId, vaultState.maturity,\n depositAmountPrimeCash, vaultSharesToLiquidator\n );\n }\n```\n
high
```\n mapping(address => mapping(address => listInfo)) private allowedPairsMap;\n pair[] private allowedPairsList;\n```\n
medium
```\nfunction addLiquidity(address inputToken, uint256 inputAmount, uint256 minLP)\n external\n payable\n onlyListedToken(inputToken)\n override\n returns (uint256 actualLP)\n {\n // Check that the exchange is unlocked and thus open for business\n Config memory _config = DFPconfig;\n require(_config.unlocked, "DFP: Locked");\n\n // Pull in input token and check the exchange balance for that token\n uint256 initialBalance;\n if (inputToken == address(0)) {\n require(msg.value == inputAmount, "DFP: Incorrect amount of ETH");\n initialBalance = address(this).balance - inputAmount;\n } else {\n initialBalance = IERC20(inputToken).balanceOf(address(this));\n IERC20(inputToken).safeTransferFrom(msg.sender, address(this), inputAmount);\n }\n\n // Prevent excessive liquidity add which runs of the approximation curve\n require(inputAmount < initialBalance, "DFP: Too much at once");\n\n // See https://en.wikipedia.org/wiki/Binomial_approximation for the below\n // Compute the 6th power binomial series approximation of R.\n //\n // X 15 X^2 155 X^3 7285 X^4 91791 X^5 2417163 X^6\n // (1+X)^1/16 - 1 ≈ -- - ------ + ------- - -------- + --------- - -----------\n // 16 512 8192 524288 8388608 268435456\n //\n // Note that we need to terminate at an even order to guarantee an underestimate\n // for safety. The underestimation leads to slippage for higher amounts, but\n // protects funds of those that are already invested.\n uint256 X = (inputAmount * _config.oneMinusTradingFee) / initialBalance; // 0.64 bits\n uint256 X_ = X * X; // X^2 0.128 bits\n uint256 R_ = (X >> 4) - (X_ * 15 >> 73); // R2 0.64 bits\n X_ = X_ * X; // X^3 0.192 bits\n R_ = R_ + (X_ * 155 >> 141); // R3 0.64 bits\n X_ = X_ * X >> 192; // X^4 0.64 bits\n R_ = R_ - (X_ * 7285 >> 19); // R4 0.64 bits\n X_ = X_ * X; // X^5 0.128 bits\n R_ = R_ + (X_ * 91791 >> 87); // R5 0.64 bits\n X_ = X_ * X; // X^6 0.192 bits\n R_ = R_ - (X_ * 2417163 >> 156); // R6 0.64 bits\n\n // Calculate and mint LPs to be awarded\n actualLP = R_ * totalSupply() >> 64;\n require(actualLP > minLP, "DFP: No deal");\n _mint(msg.sender, actualLP);\n\n // Emitting liquidity add event to enable better governance decisions\n emit LiquidityAdded(msg.sender, inputToken, inputAmount, actualLP);\n }\n\n\n```\n
none
```\nfunction transferToAddressETH(address payable recipient, uint256 amount) private \n{\n recipient.transfer(amount);\n}\n```\n
none
```\nfunction removeMultiple(uint256 LPamount, address[] calldata tokens)\n external\n override\n returns (bool success)\n{\n // Perform basic validation (no lock check here on purpose)\n require(tokens.length == 16, "DFP: Bad tokens array length");\n\n // Calculate fraction of total liquidity to be returned\n uint256 fraction = (LPamount << 128) / totalSupply();\n\n // Send the ETH first (use transfer to prevent reentrancy)\n uint256 dexBalance = address(this).balance;\n address payable sender = payable(msg.sender);\n sender.transfer(fraction * dexBalance >> 128);\n\n // Send the ERC20 tokens\n address previous;\n for (uint256 i = 1; i < 16; i++) {\n address token = tokens[i];\n require(token > previous, "DFP: Require ordered list");\n require(\n listedTokens[token].state > State.Delisting,\n "DFP: Token not listed"\n );\n dexBalance = IERC20(token).balanceOf(address(this));\n IERC20(token).safeTransfer(msg.sender, fraction * dexBalance >> 128);\n previous = token;\n }\n\n // Burn the LPs\n _burn(msg.sender, LPamount);\n emit MultiLiquidityRemoved(msg.sender, LPamount, totalSupply());\n\n // That's all folks\n return true;\n}\n```\n
none
```\n// Transfer remaining balance of tokenTo to sender\nif (address(tokenTo) != Constants.ETH) {\n uint256 balance = tokenTo.balanceOf(address(this));\n require(balance >= amountTo, "INSUFFICIENT\_AMOUNT");\n \_transfer(tokenTo, balance, recipient);\n} else {\n```\n
high
```\nfunction changeTreasury(uint256 _marketId, address _treasury)\n public\n onlyTimeLocker\n{\n if (_treasury == address(0)) revert AddressZero();\n\n address[2] memory vaults = marketIdToVaults[_marketId];\n\n if (vaults[0] == address(0) || vaults[1] == address(0)) {\n revert MarketDoesNotExist(_marketId);\n }\n\n IVaultV2(vaults[0]).whiteListAddress(_treasury);\n IVaultV2(vaults[1]).whiteListAddress(_treasury);\n IVaultV2(vaults[0]).setTreasury(treasury);\n IVaultV2(vaults[1]).setTreasury(treasury);\n\n emit AddressWhitelisted(_treasury, _marketId);\n}\n```\n
medium
```\n function setIntervals(uint256 id_, uint32[3] calldata intervals_) external override {\n // Check that the market is live\n if (!isLive(id_)) revert Auctioneer_InvalidParams();\n\n\n // Check that the intervals are non-zero\n if (intervals_[0] == 0 || intervals_[1] == 0 || intervals_[2] == 0)\n revert Auctioneer_InvalidParams();\n\n\n // Check that tuneInterval >= tuneAdjustmentDelay\n if (intervals_[0] < intervals_[1]) revert Auctioneer_InvalidParams();\n\n\n BondMetadata storage meta = metadata[id_];\n // Check that tuneInterval >= depositInterval\n if (intervals_[0] < meta.depositInterval) revert Auctioneer_InvalidParams();\n\n\n // Check that debtDecayInterval >= minDebtDecayInterval\n if (intervals_[2] < minDebtDecayInterval) revert Auctioneer_InvalidParams();\n\n\n // Check that sender is market owner\n BondMarket memory market = markets[id_];\n if (msg.sender != market.owner) revert Auctioneer_OnlyMarketOwner();\n\n\n // Update intervals\n meta.tuneInterval = intervals_[0];\n meta.tuneIntervalCapacity = market.capacity.mulDiv(\n uint256(intervals_[0]),\n uint256(terms[id_].conclusion) - block.timestamp\n ); // don't have a stored value for market duration, this will update tuneIntervalCapacity based on time remaining\n meta.tuneAdjustmentDelay = intervals_[1];\n meta.debtDecayInterval = intervals_[2];\n }\n```\n
medium
```\nnonReentrant\nrefundFinalBalance\n```\n
low
```\nif (price_ < MIN_PRICE || price_ > MAX_PRICE) revert BucketPriceOutOfBounds();\n```\n
medium
```\nDepositVault.sol\n function withdraw(uint256 amount, uint256 nonce, bytes memory signature, address payable recipient) public {\n require(nonce < deposits.length, "Invalid deposit index");\n Deposit storage depositToWithdraw = deposits[nonce];//@audit-info non aligned with common understanding of nonce\n bytes32 withdrawalHash = getWithdrawalHash(Withdrawal(amount, nonce));\n address signer = withdrawalHash.recover(signature);\n require(signer == depositToWithdraw.depositor, "Invalid signature");\n require(!usedWithdrawalHashes[withdrawalHash], "Withdrawal has already been executed");\n require(amount == depositToWithdraw.amount, "Withdrawal amount must match deposit amount");\n usedWithdrawalHashes[withdrawalHash] = true;\n depositToWithdraw.amount = 0;\n if(depositToWithdraw.tokenAddress == address(0)){\n recipient.transfer(amount);\n } else {\n IERC20 token = IERC20(depositToWithdraw.tokenAddress);\n token.safeTransfer(recipient, amount);\n }\n emit WithdrawalMade(recipient, amount);\n }\n```\n
low
```\nfunction updateAddressesAndTransferOwnership(\n address mintingBeneficiary,\n address alarmContract,\n address rngContract,\n address minter,\n address _owner\n) external onlyOwner {\n changeMintBeneficiary(mintingBeneficiary);\n changeMinter(minter);\n\n setAlarmAccount(alarmContract);\n setVRFAccount(rngContract);\n\n transferOwnership(_owner);\n}\n```\n
none
```\n function findMarketFor(\n address payout_,\n address quote_,\n uint256 amountIn_,\n uint256 minAmountOut_,\n uint256 maxExpiry_\n ) external view returns (uint256) {\n// rest of code\n if (expiry <= maxExpiry_) {\n payouts[i] = minAmountOut_ <= maxPayout\n ? payoutFor(amountIn_, ids[i], address(0))\n : 0;\n\n if (payouts[i] > highestOut) {//****@audit not check payouts[i] >= minAmountOut_******//\n highestOut = payouts[i];\n id = ids[i];\n }\n }\n```\n
medium
```\nfunction _initialize() internal virtual override {\n // check if the owner is the deployer of this contract\n if (msg.sender != deployer) {\n revert UnexpectedDeployer(deployer, msg.sender);\n }\n\n __ReentrancyGuard_init();\n // owner of the transceiver is set to the owner of the nttManager\n __PausedOwnable_init(msg.sender, getNttManagerOwner());\n}\n```\n
medium
```\n loans.push(\n Loan(req, req.amount + interest, collat, expiration, true, msg.sender)\n );\n```\n
medium
```\nfunction consult(address token) public view whenNotPaused returns (int256, uint8) {\n address _feed = feeds[token];\n\n if (_feed == address(0)) revert Errors.NoTokenPriceFeedAvailable();\n\n ChainlinkResponse memory chainlinkResponse = _getChainlinkResponse(_feed);\n ChainlinkResponse memory prevChainlinkResponse = _getPrevChainlinkResponse(_feed, chainlinkResponse.roundId);\n\n if (_chainlinkIsFrozen(chainlinkResponse, token)) revert Errors.FrozenTokenPriceFeed();\n if (_chainlinkIsBroken(chainlinkResponse, prevChainlinkResponse, token)) revert Errors.BrokenTokenPriceFeed();\n\n return (chainlinkResponse.answer, chainlinkResponse.decimals);\n }\n```\n
low
```\n//solidity 0.8.7\n » int(uint(2\*\*255))\n-57896044618658097711785492504343953926634992332820282019728792003956564819968\n » int(uint(2\*\*255-2))\n57896044618658097711785492504343953926634992332820282019728792003956564819966\n```\n
low
```\n it('5) Grief xChainController send funds to vaults', async function () {\n await xChainController.sendFundsToVault(vaultNumber, slippage, 10000, 0, { value: 0, });\n await xChainController.sendFundsToVault(vaultNumber, slippage, 10000, 0, { value: 0, });\n await xChainController.sendFundsToVault(vaultNumber, slippage, 10000, 0, { value: 0, });\n await xChainController.sendFundsToVault(vaultNumber, slippage, 10000, 0, { value: 0, });\n\n expect(await xChainController.getFundsReceivedState(vaultNumber)).to.be.equal(0);\n\n expect(await vault3.state()).to.be.equal(3);\n\n // can't trigger state change anymore\n await expect(xChainController.sendFundsToVault(vaultNumber, slippage, 1000, relayerFee, {value: parseEther('0.1'),})).to.be.revertedWith('Not all funds received');\n });\n```\n
medium
```\nfunction functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, "Address: low-level call with value failed");\n}\n```\n
none
```\n function liveMarketsBy(address owner_) external view returns (uint256[] memory) {\n uint256 count;\n IBondAuctioneer auctioneer;\n for (uint256 i; i < marketCounter; ++i) {\n auctioneer = marketsToAuctioneers[i];\n if (auctioneer.isLive(i) && auctioneer.ownerOf(i) == owner_) {\n ++count;\n }\n }\n\n\n uint256[] memory ids = new uint256[](count);\n count = 0;\n for (uint256 i; i < marketCounter; ++i) {\n auctioneer = marketsToAuctioneers[i];\n if (auctioneer.isLive(i) && auctioneer.ownerOf(i) == owner_) {\n ids[count] = i;\n ++count;\n }\n }\n\n\n return ids;\n }\n```\n
medium
```\nfunction changeMarketingWallet(address newWallet) external onlyOwner {\n emit MarketingWalletUpdated(newWallet, marketingWallet);\n marketingWallet = newWallet;\n}\n```\n
none
```\nfunction isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n}\n```\n
none
```\nFile: AuraStakingMixin.sol\n function claimRewardTokens() external returns (uint256[] memory claimedBalances) {\n uint16 feePercentage = BalancerVaultStorage.getStrategyVaultSettings().feePercentage;\n IERC20[] memory rewardTokens = _rewardTokens();\n\n uint256 numRewardTokens = rewardTokens.length;\n\n claimedBalances = new uint256[](numRewardTokens);\n for (uint256 i; i < numRewardTokens; i++) {\n claimedBalances[i] = rewardTokens[i].balanceOf(address(this));\n }\n\n AURA_REWARD_POOL.getReward(address(this), true);\n for (uint256 i; i < numRewardTokens; i++) {\n claimedBalances[i] = rewardTokens[i].balanceOf(address(this)) - claimedBalances[i];\n\n if (claimedBalances[i] > 0 && feePercentage != 0 && FEE_RECEIVER != address(0)) {\n uint256 feeAmount = claimedBalances[i] * feePercentage / BalancerConstants.VAULT_PERCENT_BASIS;\n rewardTokens[i].checkTransfer(FEE_RECEIVER, feeAmount);\n claimedBalances[i] -= feeAmount;\n }\n }\n\n emit BalancerEvents.ClaimedRewardTokens(rewardTokens, claimedBalances);\n }\n```\n
medium
```\nAdditional tokens may be added to the Deposit Whitelist via Beanstalk governance. In order for a token to be added to the Deposit Whitelist, Beanstalk requires:\n1. The token address;\n2. A function to calculate the Bean Denominated Value (BDV) of the token (see Section 14.2 of the whitepaper for complete formulas); and\n3. The number of Stalk and Seeds per BDV received upon Deposit.\n```\n
medium
```\nfunction pullTokens(\n address \_token,\n address \_from,\n uint256 \_amount\n) internal returns (uint256) {\n // handle max uint amount\n if (\_amount == type(uint256).max) {\n uint256 allowance = IERC20(\_token).allowance(address(this), \_from);\n uint256 balance = getBalance(\_token, \_from);\n\n \_amount = (balance > allowance) ? allowance : balance;\n }\n\n if (\_from != address(0) && \_from != address(this) && \_token != ETH\_ADDR && \_amount != 0) {\n IERC20(\_token).safeTransferFrom(\_from, address(this), \_amount);\n }\n\n return \_amount;\n}\n```\n
medium
```\nfunction validateOrderParam(IPerpetual perpetual, LibOrder.OrderParam memory orderParam)\n internal\n view\n returns (bytes32)\n{\n address broker = perpetual.currentBroker(orderParam.trader);\n require(broker == msg.sender, "invalid broker");\n require(orderParam.getOrderVersion() == 2, "unsupported version");\n require(orderParam.getExpiredAt() >= block.timestamp, "order expired");\n\n bytes32 orderHash = orderParam.getOrderHash(address(perpetual), broker);\n require(orderParam.signature.isValidSignature(orderHash, orderParam.trader), "invalid signature");\n require(filled[orderHash] < orderParam.amount, "fullfilled order");\n\n return orderHash;\n}\n```\n
medium
```\nconstructor() {\n _status = _NOT_ENTERED;\n}\n```\n
none
```\nfunction trySub(\n uint256 a,\n uint256 b\n) internal pure returns (bool, uint256) {\n unchecked {\n if (b > a) return (false, 0);\n return (true, a - b);\n }\n}\n```\n
none
```\nif (\_fee > 0) {\n address feeReceiver = \_feeRecipient == address(0) ? msg.sender : \_feeRecipient;\n (bool feePaymentSuccess, ) = feeReceiver.call{ value: \_fee }("");\n if (!feePaymentSuccess) {\n revert FeePaymentFailed(feeReceiver);\n }\n```\n
medium
```\nfunction withdraw(uint256 \_shares, uint256 \_minAmount) external onlyEOAorWhitelist nonReentrant\n{\n address \_from = msg.sender;\n (uint256 \_amount, uint256 \_withdrawalAmount, uint256 \_netAmount) = \_calcAmountFromShares(\_shares);\n require(\_netAmount >= \_minAmount, "high slippage");\n \_burn(\_from, \_shares);\n \_withdraw(\_amount);\n Transfers.\_pushFunds(reserveToken, \_from, \_withdrawalAmount);\n}\n```\n
medium