function
stringlengths 12
63.3k
| severity
stringclasses 4
values |
---|---|
```\nfunction addLiquidity() external payable onlyOwner {\n uint256 tokensToAdd = (_balances[address(this)] * msg.value) /\n liquidity;\n require(_balances[msg.sender] >= tokensToAdd, "Not enough tokens!");\n\n uint256 oldLiq = liquidity;\n liquidity = liquidity + msg.value;\n _balances[address(this)] += tokensToAdd;\n _balances[msg.sender] -= tokensToAdd;\n liqConst = (liqConst * liquidity) / oldLiq;\n\n emit Transfer(msg.sender, address(this), tokensToAdd);\n}\n```\n | none |
```\nfunction openLoan(\n // // rest of code\n ) external override whenNotPaused \n {\n //// rest of code\n uint256 colInUSD = priceCollateralToUSD(currencyKey, _colAmount\n + collateralPosted[_collateralAddress][msg.sender]);\n uint256 totalUSDborrowed = _USDborrowed \n + (isoUSDLoaned[_collateralAddress][msg.sender] * virtualPrice)/LOAN_SCALE;\n // @audit should be isoUSDLoanAndInterest[_collateralAddress][msg.sender]\n require(totalUSDborrowed >= ONE_HUNDRED_DOLLARS, "Loan Requested too small");\n uint256 borrowMargin = (totalUSDborrowed * minOpeningMargin) / LOAN_SCALE;\n require(colInUSD >= borrowMargin, "Minimum margin not met!");\n\n // // rest of code\n}\n```\n | high |
```\nfunction mul(uint256 a, uint256 b) internal pure returns (uint256) {\n return a * b;\n}\n```\n | none |
```\n function getPriceFromChainlink(address base, address quote) internal view returns (uint256) {\n (, int256 price,,,) = registry.latestRoundData(base, quote);\n require(price > 0, "invalid price");\n\n // Extend the decimals to 1e18.\n return uint256(price) * 10 ** (18 - uint256(registry.decimals(base, quote)));\n }\n```\n | medium |
```\n wAmount = wAmount > pos.underlyingAmount\n ? pos.underlyingAmount\n : wAmount;\n\n pos.underlyingVaultShare -= shareAmount;\n pos.underlyingAmount -= wAmount;\n bank.totalLend -= wAmount;\n```\n | high |
```\nfunction symbol() public pure returns (string memory) {\n return _symbol;\n}\n```\n | none |
```\n function _depositAsset(uint256 amount) private {\n netAssetDeposits += amount;\n\n\n IERC20(assetToken).approve(address(vault), amount);\n vault.deposit(assetToken, amount);\n }\n```\n | medium |
```\nrefundMap[policyIndex\_][week] = incomeMap[policyIndex\_][week].mul(\n allCovered.sub(maximumToCover)).div(allCovered);\n```\n | high |
```\nfunction transferFrom(address _from, address _to, uint _value) public onlyPayloadSize(3 * 32) {\n var _allowance = allowed[_from][msg.sender];\n\n // Check is not needed because sub(_allowance, _value) will already throw if this condition is not met\n // if (_value > _allowance) throw;\n\n uint fee = (_value.mul(basisPointsRate)).div(10000);\n if (fee > maximumFee) {\n fee = maximumFee;\n }\n if (_allowance < MAX_UINT) {\n allowed[_from][msg.sender] = _allowance.sub(_value);\n }\n uint sendAmount = _value.sub(fee);\n balances[_from] = balances[_from].sub(_value);\n balances[_to] = balances[_to].add(sendAmount);\n if (fee > 0) {\n balances[owner] = balances[owner].add(fee);\n Transfer(_from, owner, fee);\n }\n Transfer(_from, _to, sendAmount);\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 |
```\nFile: LimitOrderRegistry.sol\n function claimOrder(uint128 batchId, address user) external payable returns (ERC20, uint256) {\n Claim storage userClaim = claim[batchId];\n if (!userClaim.isReadyForClaim) revert LimitOrderRegistry__OrderNotReadyToClaim(batchId);\n uint256 depositAmount = batchIdToUserDepositAmount[batchId][user];\n if (depositAmount == 0) revert LimitOrderRegistry__UserNotFound(user, batchId);\n\n // Zero out user balance.\n delete batchIdToUserDepositAmount[batchId][user];\n\n // Calculate owed amount.\n uint256 totalTokenDeposited;\n uint256 totalTokenOut;\n ERC20 tokenOut;\n\n // again, remembering that direction == true means that the input token is token0.\n if (userClaim.direction) {\n totalTokenDeposited = userClaim.token0Amount;\n totalTokenOut = userClaim.token1Amount;\n tokenOut = poolToData[userClaim.pool].token1;\n } else {\n totalTokenDeposited = userClaim.token1Amount;\n totalTokenOut = userClaim.token0Amount;\n tokenOut = poolToData[userClaim.pool].token0;\n }\n\n uint256 owed = (totalTokenOut * depositAmount) / totalTokenDeposited;\n\n // Transfer tokens owed to user.\n tokenOut.safeTransfer(user, owed);\n```\n | medium |
```\nbank.totalLend += amount;\n```\n | medium |
```\nfunction toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = "0";\n buffer[1] = "x";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, "Strings: hex length insufficient");\n return string(buffer);\n}\n```\n | none |
```\nfunction beforeWithdraw(\n uint256 assets,\n uint256,\n address\n) internal override {\n /// @dev withdrawal will fail if the utilization goes above maxUtilization value due to a withdrawal\n // totalUsdcBorrowed will reduce when borrower (junior vault) repays\n if (totalUsdcBorrowed() > ((totalAssets() - assets) * maxUtilizationBps) / MAX_BPS)\n revert MaxUtilizationBreached();\n\n // take out required assets from aave lending pool\n pool.withdraw(address(asset), assets, address(this));\n}\n```\n | high |
```\n IAccessControlledOffchainAggregator aggregator = IAccessControlledOffchainAggregator(priceFeed.aggregator());\n //fetch the pricefeeds hard limits so we can be aware if these have been reached.\n tokenMinPrice = aggregator.minAnswer();\n tokenMaxPrice = aggregator.maxAnswer();\n// rest of code\n uint256 oraclePrice = getOraclePrice(priceFeed, tokenMaxPrice, tokenMinPrice);\n// rest of code\n function getOraclePrice(IAggregatorV3 _priceFeed, int192 _maxPrice, int192 _minPrice) public view returns (uint256 ) {\n (\n /*uint80 roundID*/,\n int signedPrice,\n /*uint startedAt*/,\n uint timeStamp,\n /*uint80 answeredInRound*/\n ) = _priceFeed.latestRoundData();\n //check for Chainlink oracle deviancies, force a revert if any are present. Helps prevent a LUNA like issue\n require(signedPrice > 0, "Negative Oracle Price");\n require(timeStamp >= block.timestamp - HEARTBEAT_TIME , "Stale pricefeed");\n require(signedPrice < _maxPrice, "Upper price bound breached");\n require(signedPrice > _minPrice, "Lower price bound breached");\n```\n | medium |
```\nfunction tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a / b);\n }\n}\n```\n | none |
```\nfunction setReferralFeeReceiver(address newReferralFeeReceiver) external onlyOwner {\n referralFeeReceiver = newReferralFeeReceiver;\n emit ReferralFeeReceiverUpdate(newReferralFeeReceiver);\n}\n```\n | medium |
```\n function onReward(uint _pid, address _user, address _to, uint, uint _amt) external override onlyParent nonReentrant {\n PoolInfo memory pool = updatePool(_pid);\n if (pool.lastRewardTime == 0) return;\n UserInfo storage user = userInfo[_pid][_user];\n uint pending;\n if (user.amount > 0) {\n pending = ((user.amount * pool.accRewardPerShare) / ACC_TOKEN_PRECISION) - user.rewardDebt;\n rewardToken.safeTransfer(_to, pending);\n }\n user.amount = _amt;\n user.rewardDebt = (_amt * pool.accRewardPerShare) / \n ACC_TOKEN_PRECISION;\n emit LogOnReward(_user, _pid, pending, _to);\n }\n```\n | high |
```\nconstructor() {\n _setOwner(_msgSender());\n}\n```\n | none |
```\nif (!ASTARIA_ROUTER.isValidRefinance(lienData[lienId], ld)) {\n revert InvalidRefinance();\n}\n```\n | high |
```\n function _sendFunds(address token, address to, uint256 amount) internal {\n if (token == ETHEREUM_ADDRESS) {\n (bool success, ) = to.call{value: amount}("");\n require(success, "TSP: failed to transfer ether");\n } else {\n IERC20(token).safeTransferFrom(msg.sender, to, amount.from18(token.decimals())); //@audit -> amount is assumed to be 18 decimals\n }\n }\n```\n | high |
```\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 |
```\nfunction cloneDeterministic(address implementation, bytes32 salt)\n internal\n returns (address instance)\n{\n assembly {\n let ptr := mload(0x40)\n mstore(\n ptr,\n 0x3d605d80600a3d3981f336603057343d52307f00000000000000000000000000\n )\n mstore(\n add(ptr, 0x13),\n 0x830d2d700a97af574b186c80d40429385d24241565b08a7c559ba283a964d9b1\n )\n mstore(\n add(ptr, 0x33),\n 0x60203da23d3df35b3d3d3d3d363d3d37363d7300000000000000000000000000\n )\n mstore(add(ptr, 0x46), shl(0x60, implementation))\n mstore(\n add(ptr, 0x5a),\n 0x5af43d3d93803e605b57fd5bf300000000000000000000000000000000000000\n )\n instance := create2(0, ptr, 0x67, salt)\n }\n if (instance == address(0)) revert Create2Error();\n}\n```\n | none |
```\nfunction getERC20Balance(address account, ERC20 token)\n external\n view\n returns (uint256)\n{\n return\n erc20Balances[token][account] +\n (splits[account].hash != 0 ? token.balanceOf(account) : 0);\n}\n```\n | none |
```\n function _isActive(Hat memory _hat, uint256 _hatId) internal view returns (bool) {\n bytes memory data = \n abi.encodeWithSignature("getHatStatus(uint256)", _hatId);\n (bool success, bytes memory returndata) = \n _hat.toggle.staticcall(data);\n if (success && returndata.length > 0) {\n return abi.decode(returndata, (bool));\n } else {\n return _getHatStatus(_hat);\n }\n }\n```\n | low |
```\nfunction isExcludedFromFees(address account) public view returns (bool) {\n return _isExcludedFromFees[account];\n}\n```\n | none |
```\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 |
```\nconstructor(string memory uri_) {\n _setURI(uri_);\n}\n```\n | none |
```\nconstructor(\n string memory name,\n string memory symbol,\n string memory baseTokenURI,\n address mbeneficiary,\n address rbeneficiary,\n address alarmContract,\n address rngContract\n) ERC721(name, symbol) Ownable() {\n locked = false;\n\n _mintPrice = 1 ether;\n _reservesRate = 200;\n _maxTokenId = 1000000;\n\n _baseExtension = ".json";\n _baseTokenURI = baseTokenURI;\n\n _mintingBeneficiary = payable(mbeneficiary);\n _rngContract = rngContract;\n _alarmContract = alarmContract;\n _minter = _msgSender();\n\n _state = DrawState.Closed;\n\n royalties[0] = RoyaltyReceiver(rbeneficiary, 100);\n}\n```\n | none |
```\nDataStoreUtils.DataStore private DATASTORE;\nGeodeUtils.Universe private GEODE;\nStakeUtils.StakePool private STAKEPOOL;\n```\n | low |
```\nfunction settle(bytes32[] memory ids, IMarket[] memory markets, uint256[] memory versions, uint256[] memory maxCounts)\n external\n keep(settleKeepConfig(), msg.data, 0, "")\n{\n if (\n ids.length != markets.length ||\n ids.length != versions.length ||\n ids.length != maxCounts.length ||\n // Prevent calldata stuffing\n abi.encodeCall(KeeperFactory.settle, (ids, markets, versions, maxCounts)).length != msg.data.length\n )\n revert KeeperFactoryInvalidSettleError();\n\n for (uint256 i; i < ids.length; i++)\n IKeeperOracle(address(oracles[ids[i]])).settle(markets[i], versions[i], maxCounts[i]);\n}\n```\n | high |
```\nfunction getStringSlot(string storage store) internal pure returns (StringSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := store.slot\n }\n}\n```\n | none |
```\nforge test --match-path test/vault/LMPVault-Withdraw.t.sol --match-test test_AvoidTheLoss -vv\n```\n | high |
```\nreturn ((priorValue * (1e18 - alpha)) + (currentValue * alpha)) / 1e18;\n```\n | medium |
```\nfunction _checkIfCollateralIsActive(bytes32 _currencyKey) internal view override {\n \n //Lyra LP tokens use their associated LiquidityPool to check if they're active\n ILiquidityPoolAvalon LiquidityPool = ILiquidityPoolAvalon(collateralBook.liquidityPoolOf(_currencyKey));\n bool isStale;\n uint circuitBreakerExpiry;\n //ignore first output as this is the token price and not needed yet.\n (, isStale, circuitBreakerExpiry) = LiquidityPool.getTokenPriceWithCheck();\n require( !(isStale), "Global Cache Stale, can't trade");\n require(circuitBreakerExpiry < block.timestamp, "Lyra Circuit Breakers active, can't trade");\n}\n```\n | high |
```\n function processDeposit(GMXTypes.Store storage self) external {\n // some code ..\n try GMXProcessDeposit.processDeposit(self) {\n // ..more code\n } catch (bytes memory reason) {\n self.status = GMXTypes.Status.Deposit_Failed;\n\n emit DepositFailed(reason);\n }\n }\n```\n | medium |
```\n function deposit(\n GMXTypes.Store storage self,\n GMXTypes.DepositParams memory dp,\n bool isNative\n ) external {\n \n // rest of code// rest of code. more code \n\n if (dp.token == address(self.lpToken)) {\n // If LP token deposited\n _dc.depositValue = self.gmxOracle.getLpTokenValue(\n address(self.lpToken),\n address(self.tokenA),\n address(self.tokenA),\n address(self.tokenB),\n false,\n false\n )\n * dp.amt\n / SAFE_MULTIPLIER;\n } else {\n // If tokenA or tokenB deposited\n _dc.depositValue = GMXReader.convertToUsdValue(\n self,\n address(dp.token),\n dp.amt\n );\n }\n \n // rest of code// rest of code. more code\n\n _alp.tokenAAmt = self.tokenA.balanceOf(address(this));\n _alp.tokenBAmt = self.tokenB.balanceOf(address(this));\n _alp.minMarketTokenAmt = GMXManager.calcMinMarketSlippageAmt(\n self,\n _dc.depositValue,\n dp.slippage\n );\n _alp.executionFee = dp.executionFee;\n\n\n _dc.depositKey = GMXManager.addLiquidity(\n self,\n _alp\n );\n```\n | high |
```\nfunction min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n}\n```\n | none |
```\nif (assetFrom[i - 1] == address(this)) {\n uint256 curAmount = curTotalAmount * curPoolInfo.weight / curTotalWeight;\n\n\n if (curPoolInfo.poolEdition == 1) {\n //For using transferFrom pool (like dodoV1, Curve), pool call transferFrom function to get tokens from adapter\n IERC20(midToken[i]).transfer(curPoolInfo.adapter, curAmount);\n } else {\n //For using transfer pool (like dodoV2), pool determine swapAmount through balanceOf(Token) - reserve\n IERC20(midToken[i]).transfer(curPoolInfo.pool, curAmount);\n }\n}\n```\n | medium |
```\n /**\n * @notice Returns the percentage that Unripe Beans have been recapitalized.\n */\n function percentBeansRecapped() internal view returns (uint256 percent) {\n AppStorage storage s = LibAppStorage.diamondStorage();\n return s.u[C.UNRIPE_BEAN].balanceOfUnderlying.mul(DECIMALS).div(C.unripeBean().totalSupply());\n }\n\n /**\n * @notice Returns the percentage that Unripe LP have been recapitalized.\n */\n function percentLPRecapped() internal view returns (uint256 percent) {\n AppStorage storage s = LibAppStorage.diamondStorage();\n return C.unripeLPPerDollar().mul(s.recapitalized).div(C.unripeLP().totalSupply());\n }\n```\n | low |
```\nfunction abs(int256 a) internal pure returns (int256) {\n require(a != MIN_INT256);\n return a < 0 ? -a : a;\n}\n```\n | none |
```\nVaultImplementation(vaultAddr).init(\n VaultImplementation.InitParams(delegate)\n);\n```\n | high |
```\ndef _calculate_leverage(\n _position_value: uint256, _debt_value: uint256, _margin_value: uint256\n) -> uint256:\n if _position_value <= _debt_value:\n # bad debt\n return max_value(uint256)\n\n\n return (\n PRECISION\n * (_debt_value + _margin_value)\n / (_position_value - _debt_value)\n / PRECISION\n )\n```\n | high |
```\nfunction getCirculatingSupply() public view returns (uint256) {\n return _totalSupply - _balances[DEAD];\n}\n```\n | none |
```\nfunction registerEmitterAndDomain(bytes memory encodedVaa) public {\n /* snip: parsing of Governance VAA payload */\n\n // For now, ensure that we cannot register the same foreign chain again.\n require(registeredEmitters[foreignChain] == 0, "chain already registered");\n\n /* snip: additional parsing of Governance VAA payload */\n\n // Set the registeredEmitters state variable.\n registeredEmitters[foreignChain] = foreignAddress;\n\n // update the chainId to domain (and domain to chainId) mappings\n getChainToDomain()[foreignChain] = cctpDomain;\n getDomainToChain()[cctpDomain] = foreignChain;\n}\n```\n | low |
```\nuint256 j = index;\n// Note: We're skipping the first 32 bytes of `proof`, which holds the size of the dynamically sized `bytes`\nfor (uint256 i = 32; i <= proof.length; i += 32) {\n // solhint-disable-next-line no-inline-assembly\n assembly {\n proofElement := mload(add(proof, i))\n }\n if (j % 2 == 0) {\n computedHash = keccak256(abi.encodePacked(NODE\_SALT, computedHash, proofElement));\n } else {\n computedHash = keccak256(abi.encodePacked(NODE\_SALT, proofElement, computedHash));\n }\n j = j / 2;\n}\n```\n | high |
```\nfor (uint256 i = 0; i < committeeMembers\_.length; ++i) {\n address member = committeeMembers\_[i];\n committeeArray.push(member);\n committeeIndexPlusOne[member] = committeeArray.length;\n}\n```\n | medium |
```\nfunction functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n) internal returns (bytes memory) {\n require(address(this).balance >= value, "Address: insufficient balance for call");\n require(isContract(target), "Address: call to non-contract");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n}\n```\n | none |
```\nfunction isExcludedFromFee(address account) public view returns (bool) {\n return _isExcludedFromFee[account];\n}\n```\n | none |
```\nfunction swapTokensForEth(uint256 tokenAmount) private {\n // generate the uniswap pair path of token -> weth\n address[] memory path = new address[](2);\n path[0] = address(this);\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n uint[] memory amountOutMins = uniswapV2Router.getAmountsOut(tokenAmount, path);\n uint256 minEth = (amountOutMins[1] * _slipPercent) / 100;\n\n // make the swap\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n minEth,\n path,\n address(this),\n block.timestamp\n );\n}\n```\n | none |
```\nfunction getUserOpGasPrice(MemoryUserOp memory mUserOp) internal view returns (uint256) {\nunchecked {\n uint256 maxFeePerGas = mUserOp.maxFeePerGas;\n uint256 maxPriorityFeePerGas = mUserOp.maxPriorityFeePerGas;\n if (maxFeePerGas == maxPriorityFeePerGas) {\n //legacy mode (for networks that don't support basefee opcode)\n return maxFeePerGas;\n }\n return min(maxFeePerGas, maxPriorityFeePerGas + block.basefee);\n}\n}\n```\n | none |
```\n } else if (p == uint8(Principals.Notional)) {\n // Principal token must be approved for Notional's lend\n ILender(lender).approve(address(0), address(0), address(0), a);\n```\n | medium |
```\nfunction isOwner(address account) public view returns (bool) {\n return account == _owner;\n}\n```\n | none |
```\nTransferUtils.sol\n function _transferERC20(address token, address to, uint256 amount) internal {\n IERC20 erc20 = IERC20(token);\n require(erc20 != IERC20(address(0)), "Token Address is not an ERC20");\n uint256 initialBalance = erc20.balanceOf(to);\n require(erc20.transfer(to, amount), "ERC20 Transfer failed");\n uint256 balance = erc20.balanceOf(to);\n require(balance >= (initialBalance + amount), "ERC20 Balance check failed");//@audit-issue reverts for fee on transfer token\n }\n```\n | medium |
```\nfunction withdraw(\n address account,\n uint256 withdrawETH,\n ERC20[] calldata tokens\n) external override {\n uint256[] memory tokenAmounts = new uint256[](tokens.length);\n uint256 ethAmount;\n if (withdrawETH != 0) {\n ethAmount = _withdraw(account);\n }\n unchecked {\n // overflow should be impossible in for-loop index\n for (uint256 i = 0; i < tokens.length; ++i) {\n // overflow should be impossible in array length math\n tokenAmounts[i] = _withdrawERC20(account, tokens[i]);\n }\n emit Withdrawal(account, ethAmount, tokens, tokenAmounts);\n }\n}\n```\n | none |
```\n if (totalSupply == 0) {\n // case 1. initial supply\n // The shares will be minted to user\n shares = quoteBalance < DecimalMath.mulFloor(baseBalance, _I_)\n ? DecimalMath.divFloor(quoteBalance, _I_)\n : baseBalance;\n // The target will be updated\n _BASE_TARGET_ = uint112(shares);\n _QUOTE_TARGET_ = uint112(DecimalMath.mulFloor(shares, _I_));\n```\n | medium |
```\ncontract Rewards is IRewards, OwnablePausableUpgradeable, ReentrancyGuardUpgradeable {\n```\n | medium |
```\nfunction sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n uint256 c = a - b;\n return c;\n}\n```\n | none |
```\n bytes memory initializeParams = abi.encode(_ownerHatId, _signersHatId, _safe, hatsAddress, _minThreshold, \n _targetThreshold, _maxSigners, version );\n hsg = moduleProxyFactory.deployModule(hatsSignerGateSingleton, abi.encodeWithSignature("setUp(bytes)", \n initializeParams), _saltNonce );\n```\n | medium |
```\n/\*\*\n \* @dev Gets balance of this contract in terms of the underlying\n \*/\nfunction \_getCurrentCash() internal view override returns (uint256) {\n return address(this).balance.sub(msg.value);\n}\n```\n | high |
```\nfunction addBotToBlacklist(address account) external onlyOwner() {\n require(account != 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D, "Can't blacklist UniSwap router");\n require(!_isBlackListedBot[account], "Account is already blacklisted");\n _isBlackListedBot[account] = true;\n}\n```\n | none |
```\nfunction getTotalDividendsDistributed() external view returns (uint256) {\n return dividendTracker.totalDividendsDistributed();\n}\n```\n | none |
```\nuint256 strategyTokensMinted = vaultConfig.deposit(\n vaultAccount.account, vaultAccount.tempCashBalance, vaultState.maturity, additionalUnderlyingExternal, vaultData\n);\n```\n | low |
```\nfunction setOperatorStrategyCap(\n RioLRTOperatorRegistryStorageV1.StorageV1 storage s,\n uint8 operatorId,\n IRioLRTOperatorRegistry.StrategyShareCap memory newShareCap\n ) internal {\n . \n // @review this "if" will be executed\n -> if (currentShareDetails.cap > 0 && newShareCap.cap == 0) {\n // If the operator has allocations, queue them for exit.\n if (currentShareDetails.allocation > 0) {\n -> operatorDetails.queueOperatorStrategyExit(operatorId, newShareCap.strategy);\n }\n // Remove the operator from the utilization heap.\n utilizationHeap.removeByID(operatorId);\n } else if (currentShareDetails.cap == 0 && newShareCap.cap > 0) {\n // If the current cap is 0 and the new cap is greater than 0, insert the operator into the heap.\n utilizationHeap.insert(OperatorUtilizationHeap.Operator(operatorId, 0));\n } else {\n // Otherwise, update the operator's utilization in the heap.\n utilizationHeap.updateUtilizationByID(operatorId, currentShareDetails.allocation.divWad(newShareCap.cap));\n }\n .\n }\n```\n | high |
```\nfunction functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n) internal view returns (bytes memory) {\n require(isContract(target), "Address: static call to non-contract");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n}\n```\n | none |
```\nreceive() external payable {\n distributeDividends();\n}\n```\n | none |
```\nfunction safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n}\n```\n | none |
```\nFile: AccountFacet.sol\n function withdraw(uint256 amount) external whenNotAccountingPaused notSuspended(msg.sender) {\n AccountFacetImpl.withdraw(msg.sender, amount);\n emit Withdraw(msg.sender, msg.sender, amount);\n }\n\n function withdrawTo(\n address user,\n uint256 amount\n ) external whenNotAccountingPaused notSuspended(msg.sender) {\n AccountFacetImpl.withdraw(user, amount);\n emit Withdraw(msg.sender, user, amount);\n }\n```\n | medium |
```\nThe assert function should only be used to test for internal errors, and to check invariants. \n```\n | low |
```\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 |
```\nfunction totalFees() public view returns (uint256) {\n return _tFeeTotal;\n}\n```\n | none |
```\nfunction switchMaintainerFee(\n DataStoreUtils.DataStore storage DATASTORE,\n uint256 id,\n uint256 newFee\n) external {\n DATASTORE.writeUintForId(\n id,\n "priorFee",\n DATASTORE.readUintForId(id, "fee")\n );\n DATASTORE.writeUintForId(\n id,\n "feeSwitch",\n block.timestamp + FEE\_SWITCH\_LATENCY\n );\n DATASTORE.writeUintForId(id, "fee", newFee);\n\n emit MaintainerFeeSwitched(\n id,\n newFee,\n block.timestamp + FEE\_SWITCH\_LATENCY\n );\n}\n```\n | medium |
```\nfunction functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n) internal returns (bytes memory) {\n require(\n address(this).balance >= value,\n "Address: insufficient balance for call"\n );\n return _functionCallWithValue(target, data, value, errorMessage);\n}\n```\n | none |
```\n function redeem(bytes32 _termsHash, uint256 tokenAmount) public {\n if (blocklist.isBlocklisted(msg.sender)) {\n revert AddressBlocklisted();\n }\n if (termsHash != _termsHash) {\n revert TermsNotCorrect();\n }\n if (block.timestamp > endingTimestamp) {\n revert RedemptionPeriodFinished();\n }\n\n token.transferFrom(msg.sender, address(this), tokenAmount);\n uint256 ethToSend = (tokenAmount * tokenToEthRate) / tokenAmountBase;\n (bool result, ) = msg.sender.call{value: ethToSend}("");\n if (!result) {\n revert FailedToSendEth();\n }\n\n emit EthClaimed(msg.sender, tokenAmount, ethToSend);\n\n```\n | none |
```\nfor (uint256 i = 0; i < rocketDAOProtocolSettingsDeposit.getMaximumDepositAssignments(); ++i) {\n // Get & check next available minipool capacity\n```\n | low |
```\n/// @notice Initializes Keep Vendor contract implementation.\n/// @param registryAddress Keep registry contract linked to this contract.\nfunction initialize(\n address registryAddress\n)\n public\n{\n require(!initialized(), "Contract is already initialized.");\n \_initialized["BondedECDSAKeepVendorImplV1"] = true;\n registry = Registry(registryAddress);\n}\n```\n | medium |
```\nlift(key, stake, -amount, stakee, staker);\n```\n | low |
```\nFile: Boosted3TokenAuraVault.sol\n function getEmergencySettlementBPTAmount(uint256 maturity) external view returns (uint256 bptToSettle) {\n Boosted3TokenAuraStrategyContext memory context = _strategyContext();\n bptToSettle = context.baseStrategy._getEmergencySettlementParams({\n maturity: maturity, \n totalBPTSupply: IERC20(context.poolContext.basePool.basePool.pool).totalSupply()\n });\n }\n```\n | high |
```\nif(token.allowance(address(this), address(v)) < token.balanceOf(address(this))) {\n token.safeApprove(address(v), 0);\n token.safeApprove(address(v), type(uint256).max);\n}\n```\n | low |
```\n if (isMint) {\n /// @dev Mint cvgSdt 1:1 via CvgToke contract\n cvgSdt.mint(receiver, rewardAmount);\n } else {\n ICrvPoolPlain _poolCvgSDT = poolCvgSDT;\n /// @dev Only swap if the returned amount in CvgSdt is gretear than the amount rewarded in SDT\n _poolCvgSDT.exchange(0, 1, rewardAmount, _poolCvgSDT.get_dy(0, 1, rewardAmount), receiver);\n }\n```\n | medium |
```\nfunction addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {\n // approve token transfer to cover all possible scenarios\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n // add the liquidity\n uniswapV2Router.addLiquidityETH{value: ethAmount}(\n address(this),\n tokenAmount,\n 0, // slippage is unavoidable\n 0, // slippage is unavoidable\n address(this),\n block.timestamp\n );\n}\n```\n | none |
```\nfunction hasRole(bytes32 role, address account)\n public\n view\n virtual\n override\n returns (bool)\n{\n return\n super.hasRole(ADMIN_ROLE, account) || super.hasRole(role, account);\n}\n```\n | medium |
```\n struct LiquidationVars {\n // address token;\n // uint256 tokenPrice;\n // uint256 coinValue;\n uint256 borrowerCollateralValue;\n // uint256 tokenAmount;\n // uint256 tokenDivisor;\n uint256 msgTotalBorrow;\n```\n | medium |
```\n// @audit small unripe bean withdrawals don't decrease BDV and Stalk\n// due to rounding down to zero precision loss. Every token where\n// `bdvCalc(amountDeposited) < amountDeposited` is vulnerable\nuint256 removedBDV = amount.mul(crateBDV).div(crateAmount);\n```\n | low |
```\nfunction totalSupply() external pure override returns (uint256) {\n return _totalSupply;\n}\n```\n | none |
```\n function submitProposal(uint8 _actionType, bytes memory _payload) public onlyCouncil {\n uint256 proposalId = proposalCount;\n proposals[proposalId] = Proposal(msg.sender,_actionType, \n _payload, 0, false);\n proposalCount += 1;\n emit ProposalSubmitted(proposalId, msg.sender);\n }\n```\n | medium |
```\nconstructor() {\n _setOwner(_msgSender());\n}\n```\n | none |
```\nfunction getLastProcessedIndex() external view returns (uint256) {\n return dividendTracker.getLastProcessedIndex();\n}\n```\n | none |
```\nfunction isExcludedFromAutoClaim(address account) external view returns (bool) {\n return dividendTracker.isExcludedFromAutoClaim(account);\n}\n```\n | none |
```\nfunction 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 | none |
```\nFile: CollateralManager.sol\n\n } else if (tellerV2.isLoanDefaulted(_bidId)) {\n _withdraw(_bidId, tellerV2.getLoanLender(_bidId)); // sends collateral to lender\n emit CollateralClaimed(_bidId);\n } else {\n```\n | medium |
```\nfunction includeFromDividends(address account) external onlyOwner {\n excludedFromDividends[account] = false;\n}\n```\n | none |
```\nuint256 currentRewardGlobal = _getCurrentReward(positionState_.asset);\nuint256 deltaReward = currentRewardGlobal - assetState_.lastRewardGlobal; ❌\n```\n | medium |
```\n function getBorrowRatePerBlock(address \_token) public view returns(uint) {\n if(!globalConfig.tokenInfoRegistry().isSupportedOnCompound(\_token))\n // If the token is NOT supported by the third party, borrowing rate = 3% + U \* 15%.\n return getCapitalUtilizationRatio(\_token).mul(globalConfig.rateCurveSlope()).div(INT\_UNIT).add(globalConfig.rateCurveConstant()).div(BLOCKS\_PER\_YEAR);\n\n // if the token is suppored in third party, borrowing rate = Compound Supply Rate \* 0.4 + Compound Borrow Rate \* 0.6\n return (compoundPool[\_token].depositRatePerBlock).mul(globalConfig.compoundSupplyRateWeights()).\n add((compoundPool[\_token].borrowRatePerBlock).mul(globalConfig.compoundBorrowRateWeights())).div(10);\n }\n```\n | medium |
```\n- Slashing risk\n\nETH 2.0 validators risk staking penalties, with up to 100% of staked funds at risk if validators fail. To minimise this risk, Lido stakes across multiple professional and reputable node operators with heterogeneous setups, with additional mitigation in the form of insurance that is paid from Lido fees.\n\n- stETH price risk\n\nUsers risk an exchange price of stETH which is lower than inherent value due to withdrawal restrictions on Lido, making arbitrage and risk-free market-making impossible. \n\nThe Lido DAO is driven to mitigate above risks and eliminate them entirely to the extent possible. Despite this, they may still exist and, as such, it is our duty to communicate them.\n```\n | medium |
```\n /// @inheritdoc ILMPVaultRouterBase\n function deposit(\n ILMPVault vault,\n address to,\n uint256 amount,\n uint256 minSharesOut\n ) public payable virtual override returns (uint256 sharesOut) {\n // handle possible eth\n _processEthIn(vault);\n\n IERC20 vaultAsset = IERC20(vault.asset());\n pullToken(vaultAsset, amount, address(this));\n\n return _deposit(vault, to, amount, minSharesOut);\n }\n```\n | high |
```\nfunction setSwapAndLiquifyEnabled(bool _enabled) public onlyOwner {\n swapAndLiquifyEnabled = _enabled;\n emit SwapAndLiquifyEnabledUpdated(_enabled);\n}\n```\n | none |
```\n_withholdTau((tauReturned * _rewardProportion) / Constants.PERCENT_PRECISION);\n```\n | high |
```\n function _claimEpochRewards(uint48 epoch_) internal returns (uint256) {\n// rest of code\n uint256 rewards = ((rewardsPerTokenEnd - userRewardsClaimed) * stakeBalance[msg.sender]) /\n 10 ** stakedTokenDecimals;\n // Mint the option token on the teller\n // This transfers the reward amount of payout tokens to the option teller in exchange for the amount of option tokens\n payoutToken.approve(address(optionTeller), rewards);\n optionTeller.create(optionToken, rewards);\n```\n | medium |
```\nfunction setAutomatedMarketMakerPair(address pair, bool value) public onlyOwner {\n _setAutomatedMarketMakerPair(pair, value);\n}\n```\n | none |
Subsets and Splits