function stringlengths 12 7.23k | severity stringclasses 4
values |
|---|---|
```\nuint oldValue = getAndUpdateDelegatedByHolderToValidator(holder, validatorId);\nif (oldValue > 0) {\n uint month = \_slashes[index].month;\n reduce(\n \_delegatedByHolderToValidator[holder][validatorId],\n \_delegatedByHolder[holder],\n \_slashes[index].reducingCoefficient,\n mont... | high |
```\n uint locked = \_getAndUpdateLockedAmount(from);\n if (locked > 0) {\n require(\_balances[from] >= locked.add(amount), "Token should be unlocked for burning");\n }\n//-------------------------------------------------------------------------\n\n \_callTokensToSend(\n ... | high |
```\nuint256 borrowingCollateral = cache.borrowedAmount - cache.holdTokenBalance;\n```\n | medium |
```\nfunction \_afterMint() internal override {\n IPCVSwapper(target).swap();\n}\n```\n | medium |
```\n/\*\*\n \* @notice Receives approval of token transfer and stakes the approved amount.\n \* @dev Makes sure provided token contract is the same one linked to this contract.\n \* @param \_from The owner of the tokens who approved them to transfer.\n \* @param \_value Approved amount for the transfer and stake.\n \*... | medium |
```\nstring private s_password;\n```\n | high |
```\nfunction getZethTotal(uint256 vault) internal view returns (uint256 zethTotal) {\n AppStorage storage s = appStorage();\n address[] storage bridges = s.vaultBridges[vault];\n uint256 bridgeCount = bridges.length;\n\n for (uint256 i; i < bridgeCount;) {\n zethTotal += IBridge(bridges[i]).getZethV... | low |
```\nfinalUserAmount = finalToken.balanceOf(address(this)) - relayerFeeAmount;\n```\n | medium |
```\nswapToken.transferFrom(\_from, swapTokenGraveyard, amount);\n```\n | high |
```\n function _liquidateUser(\n address user,\n uint256 maxBorrowPart,\n IMarketLiquidatorReceiver _liquidatorReceiver,\n bytes calldata _liquidatorReceiverData,\n uint256 _exchangeRate,\n uint256 minLiquidationBonus\n ) private {\n uint256 callerReward = _getCall... | high |
```\n function _processPendingPosition(Context memory context, Position memory newPendingPosition) private {\n context.pendingCollateral = context.pendingCollateral\n .sub(newPendingPosition.fee)\n .sub(Fixed6Lib.from(newPendingPosition.keeper));\n \n context.closable = c... | medium |
```\nFile: BalancerSpotPrice.sol\n function _calculateStableMathSpotPrice(\n..SNIP..\n // Apply scale factors\n uint256 secondary = balances[index2] * scalingFactors[index2] / BALANCER_PRECISION;\n\n uint256 invariant = StableMath._calculateInvariant(\n ampParam, StableMath._balances(... | high |
```\n\_ensureTokenIsContractOrETH(\_dai);\n\_ensureTokenIsContractOrETH(\_ant);\n```\n | low |
```\n receive() external payable {}\n```\n | low |
```\nfunction withdraw(uint256 _share) public {\n // Gets the amount of xABR in existence\n uint256 totalShares = totalSupply();\n // Calculates the amount of ABR the xABR is worth\n uint256 what = _share * ABR.balanceOf(address(this)) / totalShares;\n _burn(msg.sender, _share);\n ABR.transfer(msg.sen... | 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[] m... | none |
```\nSTATICCALL IchiLpOracle.getPrice(token=0xFCFE742e19790Dd67a627875ef8b45F17DB1DaC6) => (1101189125194558706411110851447)\n```\n | medium |
```\nrequire(getPair(baseToken, quoteToken, slopeNumerator, n, fee) == address(0), 'DAOfiV1: PAIR\_EXISTS'); // single check is sufficient\nbytes memory bytecode = type(DAOfiV1Pair).creationCode;\nbytes32 salt = keccak256(abi.encodePacked(baseToken, quoteToken, slopeNumerator, n, fee));\nassembly {\n pair := create2... | low |
```\nfunction updateBlockList(address[] calldata blockAddressess, bool shouldBlock) external onlyOwner {\n for(uint256 i = 0;i<blockAddressess.length;i++){\n address blockAddress = blockAddressess[i];\n if(blockAddress != address(this) && \n blockAddress != uniV2router && \n blockAd... | none |
```\n //E Burn vusd from msg.sender and queue the withdrawal to "to" address\n function _withdrawTo(address to, uint amount) internal {\n //E check min amount\n require(amount >= 5 * (10 ** 6), "min withdraw is 5 vusd"); //E @audit-info not enough to prevent grief\n //E burn this amount from ... | medium |
```\nfunction isExcludedFromFees(address account) public view returns (bool) {\n return _isExcludedFromFees[account];\n}\n```\n | none |
```\n(bool success, bytes memory returnData) = \_to.call{ value: \_value }(\_calldata);\nif (!success) {\n if (returnData.length > 0) {\n assembly {\n let data\_size := mload(returnData)\n revert(add(32, returnData), data\_size)\n }\n } else {\n revert MessageSendingFailed(\_to);\n }\n}\n```\n | high |
```\nfunction convertFundsFromInput(address \_from, address \_to, uint256 \_inputAmount, uint256 \_minOutputAmount) external override returns (uint256 \_outputAmount)\n{\n address \_sender = msg.sender;\n Transfers.\_pullFunds(\_from, \_sender, \_inputAmount);\n \_inputAmount = Math.\_min(\_inputAmount, Transfers.\_get... | medium |
```\n// Increase the user's stake balance and the total balance\nstakeBalance[msg.sender] = userBalance + amount_;\ntotalBalance += amount_;\n\n// Transfer the staked tokens from the user to this contract\nstakedToken.safeTransferFrom(msg.sender, address(this), amount_);\n```\n | medium |
```\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... | high |
```\n if (balance >= borrows) {\n collateral += min(balance - borrows, info.maxCollateralAmount).mul(info.collateralWeight).mul(price);\n } else {\n debt += (borrows - balance).mul(info.debtWeight).mul(price);\n }\n```\n | medium |
```\nunchecked {\n for (uint256 i = 0; i < claimCount; ++i) {\n // Load claim in memory\n MerkleClaim memory claim = claims[I];\n\n // Requires one proof per tokenId to handle cases where users want to partially claim\n if (!MerkleProof.verify(claim.merkleProof, settings.merkleRoot, kecca... | medium |
```\nFile: contracts\WooPPV2.sol\n function _swapBaseToBase(\n// rest of code\n ) private nonReentrant whenNotPaused returns (uint256 base2Amount) {\n require(baseToken1 != address(0) && baseToken1 != quoteToken, "WooPPV2: !baseToken1");\n require(baseToken2 != address(0) && baseToken2 != quoteToken... | medium |
```\nrequire(msg.sender == amp, "Invalid sender");\n```\n | low |
```\nfunction _giveAllowances() private {\n IERC20Metadata(lpToken0).forceApprove(unirouter, type(uint256).max);\n IERC20Metadata(lpToken1).forceApprove(unirouter, type(uint256).max);\n}\n```\n | medium |
```\nfunction getMemoryBytesFromOffset(uint256 offset) internal pure returns (bytes memory data) {\n assembly {data := offset}\n}\n```\n | none |
```\nconstructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n}\n```\n | none |
```\nif (value > 0) {\n totalERC20Claimed[_token][_to] += value;\n _token.transfer(_to, value);\n}\n```\n | medium |
```\nfunction setNumberOfWinners(uint256 count) external onlyOwner {\n \_\_numberOfWinners = count;\n\n emit NumberOfWinnersSet(count);\n}\n```\n | high |
```\nslot0 = slot0_ | ((block.timestamp + LIQUIDATION_GRACE_PERIOD) << 208);\n```\n | high |
```\nfunction getLastProcessedIndex() external view returns (uint256) {\n return dividendTracker.getLastProcessedIndex();\n}\n```\n | none |
```\nif (address(quote.sellToken) != ETH) _transferFrom(permit, stake, stakeSize);\n if (address(quote.sellToken) != stake) _fillQuote(quote);\n```\n | medium |
```\n require(msg.sender == txData.user || recoverSignature(txData.transactionId, relayerFee, "cancel", signature) == txData.user, "#C:022");\n\n Asset.transferAsset(txData.sendingAssetId, payable(msg.sender), relayerFee);\n }\n\n // Get the amount to refund the user\n uint256 toRefund;\n unchecke... | medium |
```\nfunction decimals() public view returns (uint8) {\n return _decimals;\n}\n```\n | none |
```\nuint256 availableShares = assetRegistry().convertToSharesFromAsset(asset, assetRegistry().getTotalBalanceForAsset(asset));\n```\n | medium |
```\nfunction approve(address spender, uint256 amount) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n return true;\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 // make ... | none |
```\n@external\n@nonreentrant('lock')\ndef remove_liquidity_one_coin(token_amount: uint256, i: uint256, min_amount: uint256,\n use_eth: bool = False, receiver: address = msg.sender) -> uint256:\n A_gamma: uint256[2] = self._A_gamma()\n\n dy: uint256 = 0\n D: uint256 = 0\n p: uin... | high |
```\nfunction transfer(address recipient, uint256 amount) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n return true;\n}\n```\n | none |
```\nreceive() external payable {}\n```\n | none |
```\n_stemTipForToken = s.ss[token].milestoneStem +\n int96(s.ss[token].stalkEarnedPerSeason).mul(\n int96(s.season.current).sub(int96(s.ss[token].milestoneSeason))\n );\n```\n | high |
```\nFile: wfCashBase.sol\n function _getMaturedCashValue(uint256 fCashAmount) internal view returns (uint256) { \n if (!hasMatured()) return 0; \n // If the fCash has matured we use the cash balance instead.\n (uint16 currencyId, uint40 maturity) = getDecodedID(); \n PrimeRate memory pr ... | medium |
```\nfunction calculateDonationFee(uint256 _amount)\n private\n view\n returns (uint256)\n{\n return _amount.mul(_donationFee).div(10**2);\n}\n```\n | none |
```\n function claimProceeds(\n uint96 lotId_,\n bytes calldata callbackData_\n ) external override nonReentrant {\n \n // rest of code\n\n (uint96 purchased_, uint96 sold_, uint96 payoutSent_) =\n _getModuleForId(lotId_).claimProceeds(lotId_);\n\n // rest of c... | high |
```\nfunction current(Counter storage counter) internal view returns (uint256) {\n return counter._value;\n}\n```\n | none |
```\n// Get the current price of the lookup token in terms of the quote token\n(, int24 currentTick, , , , , bool unlocked) = params.pool.slot0();\n\n// Check for re-entrancy\nif (unlocked == false) revert UniswapV3_PoolReentrancy(address(params.pool));\n```\n | medium |
```\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 ... | medium |
```\n if (_isLever) {\n uint256 netBorrowLimit = _actionInfo.collateralValue\n .preciseMul(maxLtvRaw.mul(10 ** 14))\n .preciseMul(PreciseUnitMath.preciseUnit().sub(execution.unutilizedLeveragePercentage));\n\n return netBorrowLimit\n .sub(_action... | medium |
```\nassert(amount < targetReserveBalance);\n```\n | low |
```\n function blacklistProtocol(uint256 _protocolNum) external onlyGuardian {\n uint256 balanceProtocol = balanceUnderlying(_protocolNum);\n currentAllocations[_protocolNum] = 0;\n controller.setProtocolBlacklist(vaultNumber, _protocolNum);\n savedTotalUnderlying -= balanceProtocol;\n withdrawFromProto... | medium |
```\n NP_t = (1 + rate_s) * MOMP_s * TP_s * \frac{TP_s}{LUP_s} * \frac{BI_s}{BI_t}\n```\n | medium |
```\nFile: SwEthEthOracle.sol\n function getPriceInEth(address token) external view returns (uint256 price) {\n // Prevents incorrect config at root level.\n if (token != address(swEth)) revert Errors.InvalidToken(token);\n\n // Returns in 1e18 precision.\n price = swEth.swETHToETHRate();... | medium |
```\nfunction deposit(\n GMXTypes.Store storage self,\n GMXTypes.DepositParams memory dp,\n bool isNative\n) external {\n // Sweep any tokenA/B in vault to the temporary trove for future compouding and to prevent\n // it from being considered as part of depositor's assets\n if (self.tokenA.balanceOf(address(this)... | high |
```\nfunction transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {\n _transfer(sender, recipient, amount);\n _approve(sender, _msgSender(), _allowances[sender][_msgSender()] - amount);\n return true;\n}\n```\n | none |
```\nfunction bridgeAfterSwap(\n```\n | medium |
```\n// additional data is generated in off-chain using the OneInch API which takes in\n// fromTokenAddress, toTokenAddress, amount, fromAddress, slippage, destReceiver, disableEstimate\n(bool success, bytes memory result) = ONEINCH\_AGGREGATOR.call(\n swapExtraData\n);\n```\n | medium |
```\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 ... | medium |
```\n if (\n collateralBalance > 0 &&\n (currentFees + borrowing.feesOwed) / Constants.COLLATERAL_BALANCE_PRECISION >\n Constants.MINIMUM_AMOUNT\n ) {\n liquidationBonus +=\n uint256(collateralBalance) /\n ... | medium |
```\nconstructor() {\n address msgSender = _msgSender();\n _owner = msgSender;\n emit OwnershipTransferred(address(0), msgSender);\n}\n```\n | none |
```\nfunction executeTransaction(uint256 transactionId)\n public\n notExecuted(transactionId)\n fullyConfirmed(transactionId)\n```\n | medium |
```\nerror RouteAlreadyExist();\nerror SwapFailed();\nerror UnsupportedInterfaceId();\nerror ContractContainsNoCode();\nerror InvalidCelerRefund();\nerror CelerAlreadyRefunded();\nerror ControllerAlreadyExist();\nerror ControllerAddressIsZero();\n```\n | low |
```\n// Redirect net portion of minor's side to maker\nif (fromPosition.long.gt(fromPosition.short)) {\n fundingValues.fundingMaker = fundingValues.fundingShort.mul(Fixed6Lib.from(fromPosition.skew().abs()));\n fundingValues.fundingShort = fundingValues.fundingShort.sub(fundingValues.fundingMaker);\n}\nif (fromPo... | medium |
```\nfunction processDepositCancellation(\n GMXTypes.Store storage self\n) external {\n GMXChecks.beforeProcessDepositCancellationChecks(self);\n // rest of code\n // Transfer requested withdraw asset to user\n IERC20(self.depositCache.depositParams.token).safeTransfer(\n self.depositCache.user,\n self.depositCache... | medium |
```\nfunction changeHatToggle(uint256 _hatId, address _newToggle) external {\n if (_newToggle == address(0)) revert ZeroAddress();\n\n _checkAdmin(_hatId);\n Hat storage hat = _hats[_hatId];\n\n if (!_isMutable(hat)) {\n revert Immutable();\n }\n\n hat.toggle = _newToggle;\n\n emit HatToggle... | medium |
```\n// Confirm that the caller is the `mintRecipient` to ensure atomic execution.\nrequire(\n msg.sender.toUniversalAddress() == deposit.mintRecipient, "caller must be mintRecipient"\n);\n```\n | medium |
```\nfunction tryRecover(\n bytes32 hash,\n bytes memory signature\n) internal pure returns (address, RecoverError) {\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currentl... | none |
```\nfunction setAutomatedMarketMakerPair(\n address pair,\n bool value\n) public onlyOwner {\n require(\n pair != dexPair,\n "The pair cannot be removed from automatedMarketMakerPairs"\n );\n\n _setAutomatedMarketMakerPair(pair, value);\n}\n```\n | none |
```\nfunction toEthSignedMessageHash(\n bytes32 hash\n) internal pure returns (bytes32 message) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x00, "\x19Ethereum Signed Message:\n32")\n mstore(0... | none |
```\n _transferAmountFrom(_token, TransferData({from: msg.sender, to: address(_strategy), amount: amountAfterFee}));\n _strategy.increasePoolAmount(amountAfterFee);\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.L1CrossDomainMessenge... | 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 verifyC... | none |
```\nuint amountOut = IWETH10(WETH).balanceOf(address(this));\nrequire(\n IWETH10(sp.tokenOut).balanceOf(address(this)).sub(balanceBefore) >= sp.amountOut,\n 'DAOfiV1Router: INSUFFICIENT\_OUTPUT\_AMOUNT'\n);\n```\n | high |
```\n function getSellRate(address \_srcAddr, address \_destAddr, uint \_srcAmount, bytes memory) public override view returns (uint rate) {\n (rate, ) = KyberNetworkProxyInterface(KYBER\_INTERFACE)\n .getExpectedRate(IERC20(\_srcAddr), IERC20(\_destAddr), \_srcAmount);\n\n // multiply with d... | low |
```\nfunction drawDebt(\n address borrowerAddress_,\n uint256 amountToBorrow_,\n uint256 limitIndex_,\n uint256 collateralToPledge_\n) external nonReentrant {\n PoolState memory poolState = _accruePoolInterest();\n\n // rest of code\n\n DrawDebtResult memory result = BorrowerActions.drawDebt(\n ... | medium |
```\nstring internal \_name;\n```\n | low |
```\nFile: BondBaseSDA.sol\n // Circuit breaker. If max debt is breached, the market is closed\n if (term.maxDebt < market.totalDebt) {\n _close(id_);\n } else {\n // If market will continue, the control variable is tuned to to expend remaining capacity over remaining market d... | medium |
```\nfunction swapAndLiquify(uint256 tokens) private lockTheSwap {\n // Split the contract balance into halves\n uint256 denominator = (buyFee.liquidity +\n sellFee.liquidity +\n buyFee.marketing +\n sellFee.marketing +\n buyFee.dev +\n sellFee.dev) * 2;\n uint256 tokensToAdd... | none |
```\nfunction _calculateMinRepayUnits(uint256 _collateralRebalanceUnits, uint256 _slippageTolerance, ActionInfo memory _actionInfo) internal pure returns (uint256) {\n return _collateralRebalanceUnits\n .preciseMul(_actionInfo.collateralPrice)\n .preciseDiv(_actionInfo.borrowPrice)\n .preciseMul... | medium |
```\n function rebase(uint32 _l2Gas) external {\n inflationMultiplier = IECO(l1Eco).getPastLinearInflation(block.number);\n```\n | high |
```\nfunction div(uint256 a, uint256 b) internal pure returns (uint256) {\n return a / b;\n}\n```\n | none |
```\n function repay(uint256 repayAmount, uint256 _userLoanId) external {\n Loan memory userLoan = loans[msg.sender][_userLoanId];\n if(userLoan.borrowedAmount < repayAmount) revert ExcessiveRepay();\n if(block.timestamp > userLoan.endDate) revert LoanExpired();\n uint256 interestLoanRatio = FixedP... | medium |
```\n uint256 deltaExchangeRateMantissa = uint256(exchangeRateMantissa).sub(userState.lastExchangeRateMantissa);\n uint128 newTokens = FixedPoint.multiplyUintByMantissa(userMeasureBalance, deltaExchangeRateMantissa).toUint128();\n userStates[user] = UserState({\n lastExchangeRateMantissa: exchangeRateMantiss... | low |
```\nfunction owner() public view returns (address) {\n return _owner;\n}\n```\n | none |
```\nfunction checkRole(bytes32 role, address \_sender) public view returns(bool){\n return hasRole(role, \_sender) || hasRole(DAO, \_sender);\n}\n\nfunction checkOnlyRole(bytes32 role, address \_sender) public view returns(bool){\n return hasRole(role, \_sender);\n}\n```\n | high |
```\nfunction updateSwapEnabled(bool enabled) external onlyOwner(){\n swapEnabled = enabled;\n}\n```\n | none |
```\n function _tokensToShares(\n uint128 amount,\n uint128 rate\n ) internal view returns (uint128) {\n return uint128((uint256(amount) * DIVIDER) / uint256(rate));\n }\n```\n | medium |
```\nfunction disableTransferDelay() external onlyOwner returns (bool) {\n transferDelayEnabled = false;\n return true;\n}\n```\n | none |
```\n function reclaimContract(Order calldata order) public nonReentrant {\n bytes32 orderHash = hashOrder(order);\n\n // ContractId\n uint contractId = uint(orderHash);\n\n address bull = bulls[contractId];\n\n // Check that the contract is expired\n require(block.timestamp... | high |
```\ncontract TokenBridge is ITokenBridge, PausableUpgradeable, OwnableUpgradeable {\n```\n | low |
```\nfunction setDevelopmentAddress(address _newaddress) external onlyOwner {\n require(_newaddress != address(0), "can not set marketing to dead wallet");\n DevelopmentAddress = payable(_newaddress);\n emit DevelopmentAddressChanged(_newaddress);\n}\n```\n | none |
```\nfunction add(uint256 a, uint256 b) internal pure returns (uint256) {\n return a + b;\n}\n```\n | none |
```\nfunction setReinvest(bool value) external {\n dividendTracker.setReinvest(msg.sender, value);\n}\n```\n | none |
```\nfunction viewRawAmount (address \_assim, int128 \_amt) internal returns (uint256 amount\_) {\n\n // amount\_ = IAssimilator(\_assim).viewRawAmount(\_amt); // for production\n\n bytes memory data = abi.encodeWithSelector(iAsmltr.viewRawAmount.selector, \_amt.abs()); // for development\n\n amount\_ = abi.de... | medium |
```\nfunction isValidSigner(address _account) public view override returns (bool valid) {\n valid = HATS.isWearerOfHat(_account, signersHatId);\n}\n```\n | medium |
```\nFile: ERC4626Oracle.sol\n function getPrice(address token) external view returns (uint) {\n uint decimals = IERC4626(token).decimals();\n return IERC4626(token).previewRedeem(\n 10 ** decimals\n ).mulDivDown(\n oracleFacade.getPrice(IERC4626(token).asset()),\n ... | medium |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.