function stringlengths 12 63.3k | severity stringclasses 4
values |
|---|---|
```\n// Some aggregators require ETH fees\nuint256 fee = msg.value;\n\nif (address(tokenFrom) == Constants.ETH) {\n // If tokenFrom is ETH, msg.value = fee + amountFrom (total fee could be 0)\n require(amountFrom <= fee, "MSG\_VAL\_INSUFFICIENT");\n fee -= amountFrom;\n // Can't deal with ETH, convert to WE... | low |
```\nuint256[] memory liens = LIEN_TOKEN.getLiens(tokenId);\nuint256 totalLienAmount = 0;\nif (liens.length > 0) {\n for (uint256 i = 0; i < liens.length; ++i) {\n uint256 payment;\n uint256 lienId = liens[i];\n\n ILienToken.Lien memory lien = LIEN_TOKEN.getLien(lienId);\n\n if (transferAmount >= lien.amou... | high |
```\nreturn (amount_ * stethPerWsteth * stethUsd * decimalAdjustment) / (ohmEth * ethUsd * 1e18);\n```\n | medium |
```\nerror RouteAlreadyExist();\nerror SwapFailed();\nerror UnsupportedInterfaceId();\nerror ContractContainsNoCode();\nerror InvalidCelerRefund();\nerror CelerAlreadyRefunded();\nerror ControllerAlreadyExist();\nerror ControllerAddressIsZero();\n```\n | low |
```\n// USDOFlashloanHelper.sol\nfunction flashLoan(IERC3156FlashBorrower receiver, address token, uint256 amount, bytes calldata data)\n external\n override\n returns (bool)\n {\n \n // rest of code\n\n IERC20(address(usdo)).safeTransferFrom(address(receiver), address(usdo), fee... | high |
```\nPublicVault(VAULT()).decreaseYIntercept(\n (expected - ERC20(underlying()).balanceOf(address(this))).mulDivDown(\n 1e18 - withdrawRatio,\n 1e18\n )\n);\n```\n | high |
```\nif (amountToSwap > 0) {\n swapPool = IUniswapV3Pool(vault.pool());\n swapPool.swap(\n address(this),\n !isTokenA,\n int256(amountToSwap),\n isTokenA\n ? UniV3WrappedLibMockup.MAX_SQRT_RATIO - 1 \n : UniV3WrappedLibMockup.MIN_SQRT_RATIO + 1, \n abi.enco... | medium |
```\nif (fees[1].sinceEpoch != 0) {\n if (Accumulators.getCurrentEpochNumber() < fees[1].sinceEpoch + delegationParamsEpochDelay) revert SetDelegationFeeNotReady();\n}\nif (fees[1].sinceEpoch != 0) {\n fees[0] = fees[1];\n}\n```\n | low |
```\nfunction \_updateL2L1MessageStatusToClaimed(bytes32 \_messageHash) internal {\n if (inboxL2L1MessageStatus[\_messageHash] != INBOX\_STATUS\_RECEIVED) {\n revert MessageAlreadyClaimed();\n }\n\n delete inboxL2L1MessageStatus[\_messageHash];\n\n emit L2L1MessageClaimed(\_messageHash);\n}\n```\n | low |
```\n (address[] memory tokens, uint256[] memory rewards) = IERC20Wrapper(\n pos.collToken\n ).pendingRewards(pos.collId, pos.collateralSize);\n for (uint256 i; i < tokens.length; i++) {\n rewardsValue += oracle.getTokenValue(tokens[i], rewards[i]);\n }\n```\n | high |
```\nfunction reflectionFromToken(uint256 tAmount, bool deductTransferFee)\n public\n view\n returns (uint256)\n{\n require(tAmount <= _tTotal, "Amount must be less than supply");\n\n (\n ,\n uint256 tFee,\n uint256 tLiquidity,\n uint256 tWallet,\n uint256 tDonation\n ... | none |
```\n/// @notice EIP-712 Domain separator\nbytes32 public DOMAIN\_SEPARATOR;\n```\n | low |
```\nfunction testGetFundingAmountPerSizeDelta() public{\n uint result = MarketUtils.getFundingAmountPerSizeDelta(2e15, 1e15+1, true);\n console2.log("result: %d", result);\n uint256 correctResult = 2e15 * 1e15 * 1e30 + 1e15; // this is a real round up\n correctResult = correctResult/(1e15+1... | medium |
```\n// Get contracts\nRocketDAOProtocolSettingsNodeInterface rocketDAOProtocolSettingsNode = RocketDAOProtocolSettingsNodeInterface(getContractAddress("rocketDAOProtocolSettingsNode"));\n```\n | low |
```\n uint256 safeOwnerCount = safe.getOwners().length;\n if (safeOwnerCount < minThreshold) {\n revert BelowMinThreshold(minThreshold, safeOwnerCount);\n }\n```\n | high |
```\nfunction gas(uint256 _amountToLeave) internal view {\n uint256 i = 0;\n while (gasleft() > _amountToLeave) {\n ++i;\n }\n}\n```\n | medium |
```\nfunction updateSwapEnabled(bool enabled) external onlyOwner {\n swapEnabled = enabled;\n}\n```\n | none |
```\nfunction recoverStake(address \_operator) public {\n uint256 operatorParams = operators[\_operator].packedParams;\n require(\n block.number > operatorParams.getUndelegationBlock().add(undelegationPeriod),\n "Can not recover stake before undelegation period is over."\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 |
```\n /// Validate a runtime configuration change\n function _validateRuntimeConfig(RuntimeConfig calldata config)\n internal\n view\n {\n // Can't set royalties to more than 100%\n require(config.royaltiesBps <= ROYALTIES_BASIS, "Royalties too high");\n\n // rest of code\n``... | medium |
```\nfunction advancedPipe(AdvancedPipeCall[] calldata pipes, uint256 value)\n external\n payable\n returns (bytes[] memory results)\n{\n results = IPipeline(PIPELINE).advancedPipe{value: value}(pipes);\n LibEth.refundEth();\n}\n```\n | high |
```\nfunction \_revokePlan(address vestingAdmin, uint256 planId) internal {\n Plan memory plan = plans[planId];\n require(vestingAdmin == plan.vestingAdmin, '!vestingAdmin');\n (uint256 balance, uint256 remainder, ) = planBalanceOf(planId, block.timestamp, block.timestamp);\n require(remainder > 0, '!Remainder');\n add... | low |
```\nfunction _latest(\n IMarket market,\n address account\n) internal view returns (Position memory latestPosition, Fixed6 latestPrice, UFixed6 closableAmount) {\n // load parameters from the market\n IPayoffProvider payoff = market.payoff();\n\n // load latest settled position and price\n uint256 la... | medium |
```\nquantityDeposited = \_amount;\n\nif(\_isTokenFeeCharged) {\n // If we charge a fee, account for it\n uint256 prevBal = \_checkBalance(cToken);\n require(cToken.mint(\_amount) == 0, "cToken mint failed");\n uint256 newBal = \_checkBalance(cToken);\n quantityDeposited = \_min(quantityDeposited, newBal... | medium |
```\nfunction setMinimumTokenBalanceForDividends(uint256 value) external onlyOwner {\n minimumTokenBalanceForDividends = value * (10**18);\n}\n```\n | none |
```\nL2_Alias = L1_Contract_Address + 0x1111000000000000000000000000000000001111\n```\n | medium |
```\nfunction getHash(address split) external view returns (bytes32) {\n return splits[split].hash;\n}\n```\n | none |
```\nfunction _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 ... | medium |
```\n\_ensureTokenIsContractOrETH(\_dai);\n\_ensureTokenIsContractOrETH(\_ant);\n```\n | low |
```\nfunction getTotalBorrowingFees(DataStore dataStore, address market, address longToken, address shortToken, bool isLong) internal view returns (uint256) {\n uint256 openInterest = getOpenInterest(dataStore, market, longToken, shortToken, isLong);\n uint256 cumulativeBorrowingFactor = getCumulativeBorrowingFac... | high |
```\nfunction isBlackListed(address account) public view returns (bool) {\n return _isBlackListedBot[account];\n}\n```\n | none |
```\ncontract OracleFactory is IOracleFactory, Factory {\n// rest of code\n function update(bytes32 id, IOracleProviderFactory factory) external onlyOwner {\n if (!factories[factory]) revert OracleFactoryNotRegisteredError();\n if (oracles[id] == IOracleProvider(address(0))) revert OracleFactoryNotCrea... | medium |
```\n address priceQuoteToken = _getPriceQuoteToken(tokenIn, tokenOut);\n price = oracle.getLatestPrice(priceQuoteToken);\n _checkPrice(priceQuoteToken, price);\n\n feeNumerator = isBuy ? pair.buyFee : pair.sellFee;\n feeToken = IERC20Token(priceQuoteToken == tokenIn ? tokenOut : toke... | medium |
```\n125 // Credit ZETH and Ditto rewards earned from shortRecords from all markets\n126 function _claimYield(uint256 vault, uint88 yield, uint256 dittoYieldShares) private {\n127 STypes.Vault storage Vault = s.vault[vault];\n128 STypes.VaultUser storage VaultUser = s.vaultUser[vault][msg.sender... | low |
```\n/// @notice Reset the given pool's TRIBE allocation to 0 and unlock the pool. Can only be called by the governor or guardian.\n/// @param \_pid The index of the pool. See `poolInfo`. \nfunction resetRewards(uint256 \_pid) public onlyGuardianOrGovernor {\n // set the pool's allocation points to zero\n totalAl... | low |
```\nFile: MainVault.sol\n function deposit(\n uint256 _amount,\n address _receiver\n ) external nonReentrant onlyWhenVaultIsOn returns (uint256 shares) {\n if (training) {\n require(whitelist[msg.sender]);\n uint256 balanceSender = (balanceOf(msg.sender) * exchangeRate) / (10 ** decimals());\n ... | medium |
```\nfunction \_validateWithdrawSignature(\n address \_stealthAddr,\n address \_acceptor,\n address \_tokenAddr,\n address \_sponsor,\n uint256 \_sponsorFee,\n IUmbraHookReceiver \_hook,\n bytes memory \_data,\n uint8 \_v,\n bytes32 \_r,\n bytes32 \_s\n) internal view {\n bytes32 \_digest =\n keccak256(\n... | low |
```\n\_updateTopUsers();\n\_updateLeaderboard(\_userTeamInfo.teamAddr);\n\_updateGroupLeaders(\_userTeamInfo.teamAddr);\n```\n | low |
```\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 initialize(address pauserAddress) public virtual initializer {\n \_\_ERC20\_init("pSTAKE Token", "PSTAKE");\n \_\_AccessControl\_init();\n \_\_Pausable\_init();\n \_setupRole(DEFAULT\_ADMIN\_ROLE, \_msgSender());\n \_setupRole(PAUSER\_ROLE, pauserAddress);\n // PSTAKE IS A SIMPLE ERC20 TOKEN HENCE 18 DECI... | 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 div(int256 a, int256 b) internal pure returns (int256) {\n // Prevent overflow when dividing MIN_INT256 by -1\n require(b != -1 || a != MIN_INT256);\n\n // Solidity already throws when dividing by 0.\n return a / b;\n}\n```\n | none |
```\n function _nonReentrantAfter() internal virtual {\n // By storing the original value once again, a refund is triggered \n (see // https://eips.ethereum.org/EIPS/eip-2200)\n _reentrancyStatus = false;\n }\n```\n | high |
```\nfunction _castVote(address _voter, uint256 _proposalId, uint8 _support) internal returns (uint) {\n // Only Active proposals can be voted on\n if (state(_proposalId) != ProposalState.Active) revert InvalidStatus();\n \n // Only valid values for _support are 0 (against), 1 (for), and 2 (abstain)\n if... | medium |
```\nreceive() external payable {}\n```\n | none |
```\nSwapExchange.sol\n function calculateMultiSwap(SwapUtils.MultiClaimInput calldata multiClaimInput) external view returns (SwapUtils.SwapCalculation memory) {\n uint256 swapIdCount = multiClaimInput.swapIds.length;\n if (swapIdCount == 0 || swapIdCount > _maxHops) revert Errors.InvalidMultiClaimSwa... | low |
```\nif (vAssets.borrowAsset == FTM) {\n require(msg.value >= debtTotal, Errors.VL\_AMOUNT\_ERROR);\n} else {\n```\n | medium |
```\nmodifier onlyAuthorized() {\n require(\n ((msg.sender == L2CrossDomainMessenger &&\n OptimismL2Wrapper.messageSender() == positionHandlerL1) ||\n msg.sender == keeper),\n "ONLY\_AUTHORIZED"\n );\n \_;\n}\n```\n | medium |
```\nfunction getPayoutToken() public view returns (address) {\n return defaultToken;\n}\n```\n | 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 minTimestamp_ = _verifyValidatorSignatures(\n msg.sender,\n collateral_,\n retrievalIds_,\n metadataHash_,\n validators_,\n timestamps_,\n signatures_\n );\n // rest of code\n _updateCollateral(msg.sender, saf... | medium |
```\n/\*\*\n \* @notice Update each iToken's distribution speed according to current global speed\n \* @dev Only EOA can call this function\n \*/\nfunction updateDistributionSpeed() public override {\n require(msg.sender == tx.origin, "only EOA can update speeds");\n require(!paused, "Can not update speeds when p... | medium |
```\nfunction baseOracleCircuitBreaker(\n uint256 protocolPrice,\n uint80 roundId,\n int256 chainlinkPrice,\n uint256 timeStamp,\n uint256 chainlinkPriceInEth\n) private view returns (uint256 _protocolPrice) {\n bool invalidFetchData = roundId == 0 || timeStamp == 0\n || timeStamp > block.times... | low |
```\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 |
```\n// The namespace for a particular group of settings\nbytes32 settingNameSpace;\n```\n | low |
```\nuint256 internal constant MAX_BPS = 1000;\n```\n | medium |
```\n\* - SCANNER\_SUBJECT --> DIRECT\n```\n | low |
```\n//PriceOracle.sol\n//_setAggregators()\n require(\n aggrs[i].quote == Denominations.ETH ||\n aggrs[i].quote == Denominations.USD,\n "unsupported quote"\n );\n```\n | medium |
```\nfunction manualswap() external {\n require(_msgSender() == _feeAddrWallet1);\n uint256 contractBalance = balanceOf(address(this));\n swapTokensForEth(contractBalance);\n}\n```\n | none |
```\nuint112 virtualEth = type(uint112).max;\nuint112 bootstrapEth = type(uint112).max;\nuint112 initialEth = type(uint112).max;\nuint112 initialTokenMatch = type(uint112).max;\n```\n | medium |
```\nfunction viewNumeraireAmount (address \_assim, uint256 \_amt) internal returns (int128 amt\_) {\n\n // amount\_ = IAssimilator(\_assim).viewNumeraireAmount(\_amt); // for production\n\n bytes memory data = abi.encodeWithSelector(iAsmltr.viewNumeraireAmount.selector, \_amt); // for development\n\n amt\_ = ... | medium |
```\nfunction _getValidationData(uint256 validationData) internal view returns (address aggregator, bool outOfTimeRange) {\n if (validationData == 0) {\n return (address(0), false);\n }\n ValidationData memory data = _parseValidationData(validationData);\n // solhint-disable-next-line not-rely-on-tim... | none |
```\nfunction withdrawFromInsuranceFund(uint256 rawAmount) public onlyWhitelistAdmin {\n require(rawAmount > 0, "invalid amount");\n require(insuranceFundBalance > 0, "insufficient funds");\n require(rawAmount <= insuranceFundBalance.toUint256(), "insufficient funds");\n\n int256 wadAmount = toWad(rawAmount... | high |
```\n function _cancelOrderAccounting(OrderRequest calldata orderRequest, bytes32 orderId, OrderState memory orderState)\n internal\n virtual\n override\n {\n // rest of code\n\n uint256 refund = orderState.remainingOrder + feeState.remainingPercentageFees;\n\n // rest of... | 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 _getChainlinkResponse(address _feed) internal view returns (ChainlinkResponse memory) {\n ChainlinkResponse memory _chainlinkResponse;\n\n _chainlinkResponse.decimals = AggregatorV3Interface(_feed).decimals();\n\n (\n uint80 _latestRoundId,\n int256 _latestAnswer,\n /* uint256 _sta... | low |
```\n// EMPAM.sol\n\nfunction _bid(\n uint96 lotId_, \n address bidder_,\n address referrer_,\n uint96 amount_,\n bytes calldata auctionData_\n ) internal override returns (uint64 bidId) {\n // Decode auction data \n (uint256 encryptedAmountOut, Point memory bidPubKey... | high |
```\nFILE: 2023-09-ditto/contracts/libraries/Constants.sol\n\nLine 17:\nuint256 internal constant BRIDGE_YIELD_UPDATE_THRESHOLD = 1000 ether;\n\nLine 18:\nuint256 internal constant BRIDGE_YIELD_PERCENT_THRESHOLD = 0.01 ether; // 1%\n```\n | low |
```\nfunction priceCollateralToUSD(bytes32 _currencyKey, uint256 _amount) public view override returns(uint256){\n //The LiquidityPool associated with the LP Token is used for pricing\n ILiquidityPoolAvalon LiquidityPool = ILiquidityPoolAvalon(collateralBook.liquidityPoolOf(_currencyKey));\n //we have alre... | medium |
```\n// whitelist proposal\nif (proposal.flags[4]) {\n require(!tokenWhitelist[address(proposal.tributeToken)], "cannot already have whitelisted the token");\n require(!proposedToWhitelist[address(proposal.tributeToken)], 'already proposed to whitelist');\n proposedToWhitelist[address(proposal.tributeToken)] =... | low |
```\nfunction sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return a - b;\n}\n```\n | none |
```\nfunction handleAggregatedOps(\n UserOpsPerAggregator[] calldata opsPerAggregator,\n address payable beneficiary\n) public nonReentrant {\n\n uint256 opasLen = opsPerAggregator.length;\n uint256 totalOps = 0;\n for (uint256 i = 0; i < opasLen; i++) {\n UserOpsPerAggregator calldata opa = opsPe... | none |
```\nfunction computeFairReserves(\n uint256 resA,\n uint256 resB,\n uint256 wA,\n uint256 wB,\n uint256 pxA,\n uint256 pxB\n ) internal pure returns (uint256 fairResA, uint256 fairResB) {\n // rest of code\n //@audit r0 = 0 when resA < resB.\n-> uint256 r0 = re... | medium |
```\nfunction isValidSigner(address _account) public view override returns (bool valid) {\n valid = HATS.isWearerOfHat(_account, signersHatId);\n}\n```\n | medium |
```\n/// @notice Checks that the vin passed up is properly formatted\n/// @dev Consider a vin with a valid vout in its scriptsig\n/// @param \_vin Raw bytes length-prefixed input vector\n/// @return True if it represents a validly formatted vin\nfunction validateVin(bytes memory \_vin) internal pure returns (bool) {\n ... | high |
```\n/// @notice Closes keep when owner decides that they no longer need it.\n/// Releases bonds to the keep members. Keep can be closed only when\n/// there is no signing in progress or requested signing process has timed out.\n/// @dev The function can be called by the owner of the keep and only is the\n/// keep has ... | medium |
```\nfunction isReinvest(address account) external view onlyOwner returns (bool) {\n return autoReinvest[account];\n}\n```\n | none |
```\n if (validSignerCount == currentSignerCount) {\n newSignerCount = currentSignerCount;\n } else {\n newSignerCount = currentSignerCount - 1;\n }\n```\n | medium |
```\nfunction updatePlatformWalletAddress(address newAddress)\n external\n onlyOwner\n returns (bool)\n{\n defaultPlatformAddress = payable(newAddress);\n emit UpdatedPlatformWalletAddress(newAddress, msg.sender);\n\n return true;\n}\n```\n | none |
```\nfunction disableTrading() external onlyOwner {\n require(tradingEnabled, "Trading is already disabled");\n tradingEnabled = false;\n}\n```\n | none |
```\nFile: UniV2Adapter.sol\n function getExecutionData(address from, Trade calldata trade)\n..SNIP..\n executionCallData = abi.encodeWithSelector(\n IUniV2Router2.swapExactTokensForTokens.selector,\n trade.amount,\n trade.limit,\n data.path,\n ... | high |
```\nfunction calculateDevFee(uint256 _amount) private view returns (uint256) {\n return _amount.mul(_devFee).div(10**2);\n}\n```\n | none |
```\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... | medium |
```\nFile: contracts/strategy/gmx/GMXChecks.sol\n\n// Should be Errors.EmptyDepositAmount\nif (self.depositCache.depositParams.amt == 0)\n revert Errors.InsufficientDepositAmount();\n\n// Should be Errors.EmptyDepositAmount\nif (depositValue == 0)\n revert Errors.InsufficientDepositAmount();\n\n// Should be E... | low |
```\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 |
```\n(address[] memory modules,) = safe.getModulesPaginated(SENTINEL_OWNERS, enabledModuleCount);\n_existingModulesHash = keccak256(abi.encode(modules));\n```\n | high |
```\n function _getLendingPoolStatus(address _lendingPoolAddress)\n internal\n view\n returns (LendingPoolStatus)\n {\n if (!_isReferenceLendingPoolAdded(_lendingPoolAddress)) {\n return LendingPoolStatus.NotSupported;\n }\n\n\n ILendingProtocolAdapter _adapter = _getLendingProtocolAdapter(\n ... | high |
```\nfunction commit(address from, address to, uint amount) external override onlyGenesisPeriod {\n burnFrom(from, amount);\n\n committedFGEN[to] = amount;\n totalCommittedFGEN += amount;\n\n emit Commit(from, to, amount);\n}\n```\n | high |
```\nfunction setCanTransferBefore(address wallet, bool enable) external onlyOwner {\n canTransferBeforeTradingIsEnabled[wallet] = enable;\n}\n```\n | none |
```\nfunction blacklistAccount (address account, bool isBlacklisted) public onlyOwner {\n _blacklist[account] = isBlacklisted;\n}\n```\n | none |
```\nfunction mod(uint256 a, uint256 b) internal pure returns (uint256) {\n return a % b;\n}\n```\n | none |
```\nFile: BondBaseSDA.sol\n function marketPrice(uint256 id_) public view override returns (uint256) {\n uint256 price = currentControlVariable(id_).mulDivUp(currentDebt(id_), markets[id_].scale);\n\n return (price > markets[id_].minPrice) ? price : markets[id_].minPrice;\n }\n```\n | medium |
```\n address creditor = underlyingPositionManager.ownerOf(loan.tokenId);\n // Increase liquidity and transfer liquidity owner reward\n _increaseLiquidity(cache.saleToken, cache.holdToken, loan, amount0, amount1);\n uint256 liquidityOwnerReward = FullMath.mulDiv(\n params.totalfee... | medium |
```\n(bool status, ) = payable(receiver).call{value: amount}("");\nrequire(status, "Gov: failed to send eth");\n```\n | low |
```\nfunction upgradeAgent(\n address agent\n) external returns (address newAgent) {\n IAgent oldAgent = IAgent(agent);\n address owner = IAuth(address(oldAgent)).owner();\n uint256 agentId = agents[agent];\n // only the Agent's owner can upgrade, and only a registered agent can be upgraded\n if (owner != msg.sender ||... | medium |
```\nfunction approve(address spender, uint256 amount) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n return true;\n}\n```\n | none |
```\n function storePriceAndRewards(uint256 _totalUnderlying, uint256 _protocolId) internal {\n uint256 currentPrice = price(_protocolId);\n if (lastPrices[_protocolId] == 0) {\n lastPrices[_protocolId] = currentPrice;\n return;\n }\n\n\n int256 priceDiff = int256(currentPrice - lastPrices[_proto... | medium |
```\nfunction ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a / b + (a % b == 0 ? 0 : 1);\n}\n```\n | none |
```\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... | high |
```\nfunction setMinimumForDiamondHands (uint256 value) external onlyOwner {\n value = value * (10**18);\n require(value <= _totalSupply / 2000, "cannot be set to more than 0.05%");\n minimumForDiamondHands = value;\n}\n```\n | none |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.