function stringlengths 12 7.23k | severity stringclasses 4
values |
|---|---|
```\nfunction initializeInvestorStateDefault(\n address[] memory addresses\n ) external onlyRole(CONFIGURER_ROLE) {\n _initializeInvestorState(\n addresses,\n defaultMintLimit,\n defaultRedemptionLimit,\n defaultMintLimitDuration,\n defaultRedemptionLimitDuration\n );\n}\n\nfunction... | low |
```\nfunction max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a >= b ? a : b;\n}\n```\n | none |
```\n return \n (votes * cpMultipliers.votes / PERCENT) + \n (proposalsCreated * cpMultipliers.proposalsCreated / PERCENT) + \n (proposalsPassed * cpMultipliers.proposalsPassed / PERCENT);\n```\n | medium |
```\nfunction toDataWithIntendedValidatorHash(\n address validator,\n bytes memory data\n) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked("\x19\x00", validator, data));\n}\n```\n | none |
```\nfunction toShortString(string memory str) internal pure returns (ShortString) {\n bytes memory bstr = bytes(str);\n if (bstr.length > 31) {\n revert StringTooLong(str);\n }\n return ShortString.wrap(bytes32(uint256(bytes32(bstr)) | bstr.length));\n}\n```\n | none |
```\nuint256 collateralToLiquidateWithoutDiscount = (_debtToLiquidate * (10 ** decimals)) / price;\ncollateralToLiquidate = (collateralToLiquidateWithoutDiscount * totalLiquidationDiscount) / Constants.PRECISION;\nif (collateralToLiquidate > _accountCollateral) {\n collateralToLiquidate = _accountCollateral;... | medium |
```\nfunction toSharesGlobal(Checkpoint memory self, UFixed6 assets) internal pure returns (UFixed6) {\n // vault is fresh, use par value\n if (self.shares.isZero()) return assets;\n\n // if vault is insolvent, default to par value\n return self.assets.lte(Fixed6Lib.ZERO) ? assets : _toShares(self, _withou... | medium |
```\nuint256 timeSinceMigration = finalMigrationTime - lastClaimTime;\n\n// (timeSinceMigration \* INTERNAL\_TOKEN\_PRECISION \* finalEmissionRatePerYear) / YEAR\nuint256 incentiveRate =\n timeSinceMigration\n .mul(uint256(Constants.INTERNAL\_TOKEN\_PRECISION))\n // Migration emission rate is stored as... | medium |
```\nFile: MetaStable2TokenAuraHelper.sol\n function reinvestReward(\n MetaStable2TokenAuraStrategyContext calldata context,\n ReinvestRewardParams calldata params\n ) external {\n```\n | medium |
```\nall: clean solc\n```\n | low |
```\n uint256 totalUserCollateral = totalCollateralValue(_collateralAddress, _loanHolder);\n uint256 proposedLiquidationAmount;\n { //scope block for liquidationAmount due to stack too deep\n uint256 liquidationAmount = viewLiquidatableAmount(totalUserCollateral, 1 ether, isoUSDBorrowed,... | medium |
```\nfunction setSellFee(\n uint16 tax,\n uint16 liquidity,\n uint16 marketing,\n uint16 dev,\n uint16 donation\n) external onlyOwner {\n sellFee.tax = tax;\n sellFee.marketing = marketing;\n sellFee.liquidity = liquidity;\n sellFee.dev = dev;\n sellFee.donation = donation;\n}\n```\n | none |
```\nfunction getMemberAt(uint256 \_index) override public view returns (address) {\n AddressSetStorageInterface addressSetStorage = AddressSetStorageInterface(getContractAddress("addressSetStorage"));\n return addressSetStorage.getItem(keccak256(abi.encodePacked(daoNameSpace, "member.index")), \_index);\n}\n```\... | low |
```\n// invariant\n// @audit operator - pass\nif (msg.sender != account && !IVaultFactory(address(factory())).operators(account, msg.sender))\n revert VaultNotOperatorError();\n// @audit 0,0,0 is single-sided - pass\nif (!depositAssets.add(redeemShares).add(claimAssets).eq(depositAssets.max(redeemShares).max(claimAs... | 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-contra... | none |
```\n feeManager = config_.feeManager();\n```\n | medium |
```\n struct PoolInfo {\n uint128 accRewardPerShare;\n uint64 lastRewardTime;\n uint64 allocPoint;\n```\n | medium |
```\nFile: NapierRouter.sol\n function swapUnderlyingForYt(\n address pool,\n uint256 index,\n uint256 ytOutDesired,\n uint256 underlyingInMax,\n address recipient,\n uint256 deadline\n ) external payable override nonReentrant checkDeadline(deadline) returns (uint256) {\n... | medium |
```\nfunction _setOwner(address newOwner) private {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n}\n```\n | none |
```\n\_addUsedAmount(\_fee + \_value);\n```\n | medium |
```\n/// @notice Constructor method allowing us to prevent calls to initCLFR by setting the appropriate version\nconstructor(uint256 \_version) {\n VERSION\_SLOT.setUint256(\_version);\n}\n```\n | low |
```\n bool cancelled = l.Auction.isCancelled(lastEpoch);\n bool finalized = l.Auction.isFinalized(lastEpoch);\n\n require(\n (!finalized && cancelled) || (finalized && !cancelled),\n "auction is not finalized nor cancelled"\n );\n```\n | medium |
```\n/\*\*\n \* @dev Creates a request to generate a new relay entry, which will include\n \* a random number (by signing the previous entry's random number).\n \* @param callbackContract Callback contract address. Callback is called once a new relay entry has been generated.\n \* @param callbackMethod Callback contrac... | medium |
```\nLien storage lien = lienData[lienId];\nlien.amount = _getOwed(lien); // @audit current debt, including accrued interest; saved to storage!\n```\n | high |
```\nfunction _createSenderIfNeeded(uint256 opIndex, UserOpInfo memory opInfo, bytes calldata initCode) internal {\n if (initCode.length != 0) {\n address sender = opInfo.mUserOp.sender;\n if (sender.code.length != 0) revert FailedOp(opIndex, "AA10 sender already constructed");\n address sender1... | none |
```\nfunction setValidator(address _validator ) external onlyRole(BRIDGE_MANAGER) {\n validator = _validator;\n}\n```\n | none |
```\nconstructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n}\n```\n | none |
```\npragma solidity ^0.8;\n```\n | low |
```\n function rate() external view returns (uint256) {\n uint256 safeEarnerRate_ = getSafeEarnerRate(\n IMinterGateway(minterGateway).totalActiveOwedM(),\n IMToken(mToken).totalEarningSupply(),\n IMinterGateway(minterGateway).minterRate()\n );\n\n return UIntMat... | medium |
```\nconstructor(\n bytes4 source_,\n bytes32 sourceAddress_,\n uint8 decimals_,\n string memory name,\n string memory symbol\n) ERC20(name, symbol) {\n source = source_;\n sourceAddress = sourceAddress_;\n _decimals = decimals_;\n}\n```\n | none |
```\nsignedOnly(abi.encodePacked(msg.sender, instance, data), signature)\n```\n | medium |
```\n/// @notice read the oracle price\n/// @return oracle price\n/// @return true if price is valid\nfunction read() external view override returns (Decimal.D256 memory, bool) {\n (uint80 roundId, int256 price,,, uint80 answeredInRound) = chainlinkOracle.latestRoundData();\n bool valid = !paused() && price > 0 &... | medium |
```\nfunction verify(\n bytes calldata inputTxBytes,\n uint16 outputIndex,\n uint256 inputTxPos,\n bytes calldata spendingTxBytes,\n uint16 inputIndex,\n bytes calldata signature,\n bytes calldata /\*optionalArgs\*/\n)\n external\n view\n returns (bool)\n{\n PaymentTransactionModel.Tran... | high |
```\nfunction borrow(VerifiableCredential memory vc) external isOpen subjectIsAgentCaller(vc) {\n // 1e18 => 1 FIL, can't borrow less than 1 FIL\n if (vc.value < WAD) revert InvalidParams();\n // can't borrow more than the pool has\n if (totalBorrowableAssets() < vc.value) revert InsufficientLiquidity();\n Account memo... | medium |
```\n require(_poolWeights <= _calculateMaxVotePossible(_pool), "Max votes exceeded");\n```\n | high |
```\n function lockCapital(address _lendingPoolAddress)\n external\n payable\n override\n onlyDefaultStateManager\n whenNotPaused\n returns (uint256 _lockedAmount, uint256 _snapshotId)\n {\n// rest of code.\n uint256 _length = activeProtectionIndexes.length();\n for (uint256 i; i < _length; ) ... | high |
```\nfunction mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The res... | none |
```\n if (_seniorVaultWethRewards > state.wethConversionThreshold) {\n // converts senior tranche share of weth into usdc and deposit into AAVE\n // Deposit aave vault share to AAVE in usdc\n uint256 minUsdcAmount = _getTokenPriceInUsdc(state, state.weth).mulDivDown(\n _seniorVaultWethRewards *... | medium |
```\n if(proposals[_proposalId].actionType == TYPE_MINT_BURN) {\n (address _token, address _to, uint256 _amount, bool _flag) = \n abi.decode(proposals[_proposalId].payload, (address, address, uint256, bool));\n if(_flag) {\n IXMozToken(_token).mint(_amount, _to);\n } ... | low |
```\nmodifier initiator(\n DataStoreUtils.DataStore storage DATASTORE,\n uint256 \_TYPE,\n uint256 \_id,\n address \_maintainer\n) {\n require(\n msg.sender == DATASTORE.readAddressForId(\_id, "CONTROLLER"),\n "MaintainerUtils: sender NOT CONTROLLER"\n );\n require(\n DATASTORE.readUintForId(\_id, "TYPE") == \_TYPE,\n ... | medium |
```\nfunction requestLinkTopHatToTree(uint32 _topHatDomain, uint256 _requestedAdminHat) external {\n uint256 fullTopHatId = uint256(_topHatDomain) << 224; // (256 - TOPHAT_ADDRESS_SPACE);\n\n _checkAdmin(fullTopHatId);\n\n linkedTreeRequests[_topHatDomain] = _requestedAdminHat;\n emit TopHatLinkRequested(_t... | high |
```\n/\*\*\n \* @dev Slash provided token amount from every member in the misbehaved\n \* operators array and burn 100% of all the tokens.\n \* @param amount Token amount to slash from every misbehaved operator.\n \* @param misbehavedOperators Array of addresses to seize the tokens from.\n \*/\nfunction slash(uint256 a... | low |
```\nfunction claimDefaulted(uint256 loanID_) external returns (uint256, uint256, uint256) {\n Loan memory loan = loans[loanID_];\n delete loans[loanID_];\n```\n | high |
```\nfunction transfer(address recipient, uint amount) external override returns (bool) {\n return doTransfer(msg.sender, recipient, amount);\n}\n```\n | none |
```\nfunction includeFromDividends(address account) external onlyOwner {\n excludedFromDividends[account] = false;\n}\n```\n | none |
```\nfunction updatePartnershipsWallet(address newAddress) external onlyOwner {\n _partnershipswallet = newAddress;\n}\n```\n | none |
```\n// Call `init()` on the staking contract to initialize storage.\n(bool didInitSucceed, bytes memory initReturnData) = stakingContract.delegatecall(\n abi.encodeWithSelector(IStorageInit(0).init.selector)\n);\nif (!didInitSucceed) {\n assembly {\n revert(add(initReturnData, 0x20), mload(initReturnData)... | medium |
```\nconstructor() {\n address msgSender = _msgSender();\n _owner = msgSender;\n emit OwnershipTransferred(address(0), msgSender);\n}\n```\n | none |
```\nfunction withdrawDeposit(\n address token\n)\n external\n{\n address owner = \_getContextAccount();\n uint256 lockedUntil = deposits[owner].withdrawalLockedUntil[token];\n\n /\* solhint-disable not-rely-on-time \*/\n\n if (lockedUntil != 0 && lockedUntil <= now) {\n deposits[owner].withdrawalLockedUntil[token] = 0... | medium |
```\nfunction functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n}\n```\n | none |
```\nfunction beneficiaryWithdrawable(\n address recipient,\n address sender,\n uint256 agentID,\n uint256 proposedAmount\n) external returns (\n uint256 amount\n) {\n AgentBeneficiary memory beneficiary = \_agentBeneficiaries[agentID];\n address benneficiaryAddress = beneficiary.active.beneficiary;\n // If the sender ... | high |
```\n function fund(IMarket market) external {\n if (!instances(IInstance(address(market)))) revert FactoryNotInstanceError();\n market.claimFee();\n }\n```\n | high |
```\n function claim() external {\n address sender = msg.sender;\n\n UserDetails storage s = userdetails[sender];\n require(s.userDeposit != 0, "No Deposit");\n require(s.index != vestingPoints.length, "already claimed");\n uint256 pctAmount;\n uint256 i = s.index;\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 uint256 amountToSend = _send.amountLD > _options.tapAmount ? _options.tapAmount : _send.amountLD;\n if (_send.minAmountLD > amountToSend) {\n _send.minAmountLD = amountToSend;\n }\n```\n | medium |
```\n /**\n * Calculate total notional rebalance quantity and chunked rebalance quantity in collateral units.\n *\n * return uint256 Chunked rebalance notional in collateral units\n * return uint256 Total rebalance notional in collateral units\n */\n function _calculateChunkR... | medium |
```\nuser.rewardDebt = int128(user.virtualAmount \* pool.accTribePerShare) / toSigned128(ACC\_TRIBE\_PRECISION);\n```\n | medium |
```\nFile: ProportionalRebalancingStrategy.sol\n for (uint256 i; i < holdings.length;) {\n address holding = holdings[i];\n uint256 targetAmount = totalValue * rebalancingTargets[i] / uint256(Constants.PERCENTAGE_DECIMALS);\n uint256 currentAmount = values[i];\n\n rede... | medium |
```\nbalance = elapsedTime_ * (RATE_DECIMALS_MULTIPLIER * tokenAmount_ / duration) / RATE_DECIMALS_MULTIPLIER\n```\n | medium |
```\nfunction processAccount(address payable account, bool automatic) public onlyOwner\n returns (bool)\n{\n if (dividendsPaused) {\n return false;\n }\n\n bool reinvest = autoReinvest[account];\n\n if (automatic && reinvest && !allowAutoReinvest) {\n return false;\n }\n\n uint256 amo... | none |
```\n/// @notice Get the votes against count of this proposal\n/// @param _proposalID The ID of the proposal to query\n```\n | low |
```\nfunction _calcQuoteAmountSellBase(\n address baseToken,\n uint256 baseAmount,\n IWooracleV2.State memory state\n ) private view returns (uint256 quoteAmount, uint256 newPrice) {\n require(state.woFeasible, "WooPPV2: !ORACLE_FEASIBLE");\n\n DecimalInfo memory decs = decimalInfo... | medium |
```\nfunction getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\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... | none |
```\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 |
```\n // Loop through each money market and withdraw all the tokens\n for (uint256 i = 0; i < moneyMarketsLength; i++) {\n IMoneyMarketAdapter moneyMarket = moneyMarkets[i];\n if (!moneyMarket.supportsToken(tokenAddress)) continue;\n moneyMarket.withdrawAll(tokenAddress, address(this));\n\n ... | medium |
```\nfunction createBid(\n uint256 parentId,\n uint256 bidAmount,\n string memory bidIPFSHash,\n string memory name\n) public pure returns(bytes32) {\n return keccak256(abi.encode(parentId, bidAmount, bidIPFSHash, name));\n}\n```\n | high |
```\nfunction wpkhSpendSighash(\n bytes memory \_outpoint, // 36 byte UTXO id\n bytes20 \_inputPKH, // 20 byte hash160\n bytes8 \_inputValue, // 8-byte LE\n bytes8 \_outputValue, // 8-byte LE\n bytes memory \_outputScript // lenght-prefixed output script\n) internal pure returns (bytes... | medium |
```\nfunction restoreAllFee() private {\n _taxFee = 5;\n _teamFee = 15;\n}\n```\n | none |
```\n//solidity 0.8.7\n » int(uint(2\*\*255))\n-57896044618658097711785492504343953926634992332820282019728792003956564819968\n » int(uint(2\*\*255-2))\n57896044618658097711785492504343953926634992332820282019728792003956564819966\n```\n | low |
```\nfunction mod(\n uint256 a,\n uint256 b,\n string memory errorMessage\n) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a % b;\n }\n}\n```\n | none |
```\n function _accumulateInternalRewards() internal view returns (uint256[] memory) {\n uint256 numInternalRewardTokens = internalRewardTokens.length;\n uint256[] memory accumulatedInternalRewards = new uint256[](numInternalRewardTokens);\n\n\n for (uint256 i; i < numInternalRewardTokens; ) {\n... | medium |
```\nfunction _validatePaymasterPrepayment(uint256 opIndex, UserOperation calldata op, UserOpInfo memory opInfo, uint256 requiredPreFund, uint256 gasUsedByValidateAccountPrepayment)\ninternal returns (bytes memory context, uint256 validationData) {\nunchecked {\n MemoryUserOp memory mUserOp = opInfo.mUserOp;\n ui... | none |
```\nfunction \_capFeeAmount(uint256 \_amount) internal view returns (uint256 \_capped, uint256 \_retained)\n{\n \_retained = 0;\n uint256 \_limit = \_calcMaxRewardTransferAmount();\n if (\_amount > \_limit) {\n \_amount = \_limit;\n \_retained = \_amount.sub(\_limit);\n }\n return (\_amount, \_retained);\n}\n```\n | medium |
```\n function _loadUpdateContext(\n Context memory context,\n address account,\n address referrer\n ) private view returns (UpdateContext memory updateContext) {\n// rest of code\n updateContext.referrer = referrers[account][context.local.currentId];\n updateContext.referralFee... | medium |
```\nfunction transferOwnership(address payable newOwner) external onlyOwner {\n require(newOwner != address(0), "Auth: owner address cannot be zero");\n isAuthorized[newOwner] = true;\n _transferOwnership(newOwner);\n}\n```\n | none |
```\nfunction pillMintingSale(bytes32[] calldata _merkleProof)\n external\n payable\n returns (bool)\n{\n if (\n (block.timestamp >=\n defaultSaleStartTime + DEFAULT_PIXELMINT_SALE) &&\n (block.timestamp < defaultSaleStartTime + DEFAULT_PILLMINT_SALE)\n ) {\n _tokenIds++;\... | none |
```\nfunction delBot(address notbot) public onlyOwner {\n bots[notbot] = false;\n}\n```\n | none |
```\ntryToMoveToValidating(\_proposalId);\n```\n | high |
```\n function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {\n _transfer(sender, recipient, amount);\n _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));\n return true;\n }... | medium |
```\nfunction _handlePostOp(uint256 opIndex, IPaymaster.PostOpMode mode, UserOpInfo memory opInfo, bytes memory context, uint256 actualGas) private returns (uint256 actualGasCost) {\n uint256 preGas = gasleft();\nunchecked {\n address refundAddress;\n MemoryUserOp memory mUserOp = opInfo.mUserOp;\n uint256 ... | none |
```\n-- reward period ends -- front-run other claimers to maximize profits\n[create x minipools]\n[stake to max effective RPL for amount of minipools; locked for 14 days]\n[claim rewards for inflated effective RPL stake]\n[dissolve(), close() minipools -> refund NETH]\n[burn NETH for ETH]\n// rest of code wait 14 days\... | high |
```\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-contra... | 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 u... | none |
```\nfunction setAutomatedMarketMakerPair(address pair, bool value) public onlyOwner {\n require(pair != uniswapV2Pair, "The pair cannot be removed from automatedMarketMakerPairs");\n\n _setAutomatedMarketMakerPair(pair, value);\n}\n```\n | none |
```\nfunction beginGlobalSettlement(uint256 price) public onlyWhitelistAdmin {\n require(status != LibTypes.Status.SETTLED, "already settled");\n settlementPrice = price;\n status = LibTypes.Status.SETTLING;\n emit BeginGlobalSettlement(price);\n}\n```\n | medium |
```\n /// @notice Minimum voting period\n uint32 public constant MIN_VOTING_PERIOD = 5760; // About 24 hours\n\n /// @notice Maximum voting period\n uint32 public constant MAX_VOTING_PERIOD = 80640; // About 2 weeks\n\n /// @notice Minimum voting delay\n uint32 public constant MIN_VOTING_DELAY = 1;\n\n /// @noti... | medium |
```\nfunction distributeLiquidatedFunds(uint256 agentID, uint256 amount) external {\n if (!liquidated[agentID]) revert Unauthorized();\n\n // transfer the assets into the pool\n GetRoute.wFIL(router).transferFrom(msg.sender, address(this), amount);\n \_writeOffPools(agentID, amount);\n}\n```\n | medium |
```\n function repayAccountPrimeDebtAtSettlement(\n PrimeRate memory pr,\n VaultStateStorage storage primeVaultState,\n uint16 currencyId,\n address vault,\n address account,\n int256 accountPrimeCash,\n int256 accountPrimeStorageValue\n ) internal returns (int256 ... | high |
```\nL2_Alias = L1_Contract_Address + 0x1111000000000000000000000000000000001111\n```\n | medium |
```\nfunction max(uint256 x, uint256 y) internal pure returns (uint256) {\n return x >= y ? x : y;\n}\n```\n | high |
```\n function clear (uint256 reqID) external returns (uint256 loanID) {\n Request storage req = requests[reqID];\n\n factory.newEvent(reqID, CoolerFactory.Events.Clear);\n\n if (!req.active) \n revert Deactivated();\n else req.active = false;\n\n uint256 interest = inte... | high |
```\nfunction approveBorrow(address spender, uint256 amount) external returns (bool) {\n _approveBorrow(msg.sender, spender, amount);\n return true;\n }\n```\n | high |
```\n// **** ADD LIQUIDITY ****\nfunction _addLiquidity(\n address tokenA,\n address tokenB,\n uint amountADesired,\n uint amountBDesired,\n uint amountAMin,\n uint amountBMin\n) internal virtual returns (uint amountA, uint amountB) {\n // create the pair if it doesn't exist yet\n if (IUniswapV2Factory(factory).getPair... | high |
```\nfunction _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {\n // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and\n // then delete the last slot (swap and pop).\n\n uint256 lastTokenIndex = ERC721.balanceOf(from) - 1;\n uin... | none |
```\nfunction Withdraw(uint256 amount) external {\n ethbalance[msg.sender] = SafeMath.sub(ethbalance[msg.sender], amount);\n payable(msg.sender).transfer(amount);\n emit Withdrew(msg.sender, amount);\n}\n```\n | low |
```\nfunction sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return a - b;\n}\n```\n | none |
```\nunction testAttack() public {\n mockRootPrice(WSTETH, 1_123_300_000_000_000_000); //wstETH\n mockRootPrice(CBETH, 1_034_300_000_000_000_000); //cbETH\n\n IBalancerMetaStablePool pool = IBalancerMetaStablePool(WSTETH_CBETH_POOL);\n\n address[] memory assets = new address[](2);\n a... | medium |
```\nfunction tryMod(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 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 ... | none |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.