file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
/** * Copyright 2017-2020, bZeroX, LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0. */ pragma solidity 0.5.17; pragma experimental ABIEncoderV2; import "../core/State.sol"; import "../events/LoanOpeningsEvents.sol"; import "../events/LoanMaintenanceEvents.sol"; import "../mixins/VaultCon...
Get one loan data structure by matching ID. Wrapper to internal _getLoan call. loanId A unique ID representing the loan. return loansData The data structure w/ loan information. /
function getLoanV2(bytes32 loanId) external view returns (LoanReturnDataV2 memory loanDataV2) { return _getLoanV2( loanId, ); }
897,195
/** *Submitted for verification at Etherscan.io on 2021-09-25 */ // File: node_modules\@openzeppelin\contracts\utils\Context.sol // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its da...
Changes the BLOCK_DELAY to value > MIN_BLOCK_DELAY. Meant to allow for increasing the block delay in case of clogged transactions./
function changeBlockDelay(uint8 newBlockDelay) onlyOwner public { require(newBlockDelay >= MIN_BLOCK_DELAY, "Block delay can't be smaller than the MIN_BLOCK_DELAY."); BLOCK_DELAY = newBlockDelay; }
7,989,917
./partial_match/100/0x81A194828e3c8e3ac91668E93A8A202dF505ACBa/sources/PriceBettingT1S2.sol
(uint80 roundID, int256 int256, , , ) = price = uint256(AggregatorEthereumV3().latestRoundData); console.log("roundID: %s, price: %s", roundID, price);
function getLatestPrice() public view returns (uint256) { return uint256( AggregatorXDAI(addrPriceFeed).latestAnswer() ); }
16,649,822
// File: @openzeppelin\contracts-ethereum-package\contracts\token\ERC20\IERC20.sol pragma solidity ^0.5.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. Does not include * the optional functions; to access them see {ERC20Detailed}. */ interface IERC20 { /** * @dev Returns the amount of...
We need to unregister tokens first
function setCurveFi(address deposit, address liquidityGauge) public onlyDefiOperator { if (address(curveFiDeposit) != address(0)) { for (uint256 i=0; i < _registeredTokens.length; i++){ if (_registeredTokens[i] != address(0)) { _unregisterToken(_registeredToke...
6,960,272
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.4; import "./Cryptomedia.sol"; import "@openzeppelin/contracts/proxy/Clones.sol"; /** * @title Cryptomedia Factory * @author neuroswish * * Factory for deploying cryptomedia * * Good morning * Look at the valedictorian * Scared of the future whi...
Approve token allowance Emits an Approval event upon success/
function _approve( address owner, address spender, uint256 value ) private { allowance[owner][spender] = value; emit Approval(owner, spender, value); }
1,269,424
./partial_match/1/0x00000000000006c7676171937C444f6BDe3D6282/sources/contracts/lib/Verifiers.sol
Computes the bulk order hash for the specified proof and leaf. proofAndSignature The proof and signature of the bulk order. leaf The leaf of the bulk order tree. return bulkOrderHash The bulk order hash./ Declare arguments for the root hash and the height of the proof. Utilize assembly to efficient...
function _computeBulkOrderProof( bytes memory proofAndSignature, bytes32 leaf ) internal view returns (bytes32 bulkOrderHash) { bytes32 root; uint256 height; assembly { let fullLength := mload(proofAndSignature) let signatureLength := sub(ECDSA_M...
4,301,134
./full_match/137/0xe558726C468Ccc21cc09ca4B8B46131dC1002923/sources/project_/contracts/Exchange.sol
Settles a liquidity addition by transferring deposited assets from wallet balances to pool reserves and minting LP tokens addition A `LiquidityAddition` struct encoding the parameters of the addition requested by the user either on-chain via `addLiquidity` or `addLiquidityETH` or off-chain via ECDSA-signed API request...
function executeAddLiquidity( LiquidityAddition calldata addition, LiquidityChangeExecution calldata execution ) external onlyDispatcher { require(!isWalletExitFinalized(addition.wallet), 'Wallet exit finalized'); _liquidityPools.executeAddLiquidity( addition, execution, _feeWalle...
4,761,986
./full_match/43114/0xDFb772ABfBC6B8D7028c44b9047c334C612cd1f2/sources/contracts/MultiChainFuture.sol
Interface of the ERC20 standard as defined in the EIP./
interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); funct...
4,615,985
./partial_match/1/0xda99cbAaa7307D4e0c3D1CF83D459f9ad729e9C8/sources/contracts/twap/libraries/TwapShareHelper.sol
Calculates the fee shares from accumulated fees _factory Strategy factory address _manager Strategy manager contract address _fee0 Accumulated token0 fee amount _fee1 Accumulated token1 fee amount/ protocol fees performance fee to manager protocol performance fee calculate the fees for protocol and manager from pe...
function calculateFeeTokenShares( ITwapStrategyFactory _factory, ITwapStrategyManager _manager, uint256 _fee0, uint256 _fee1 ) public view returns ( address managerFeeTo, address protocolFeeTo, uint256 managerToken0Amoun...
3,692,630
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Context.sol"; import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol"; import "https://github.com/OpenZeppelin/openzeppeli...
Updates taxLiquify Emits a {TaxLiquifyUpdate} event. Requirements: - auto swap and liquify feature must be enabled. - total tax rate must be less than 100%./
function setTaxLiquify(uint8 taxLiquify_, uint8 taxLiquifyDecimals_) public onlyOwner { require(_autoSwapAndLiquifyEnabled, "Auto swap and liquify feature must be enabled. Try the EnableAutoSwapAndLiquify function."); require(_taxBurn + _taxReward + taxLiquify_ < 100, "Tax fee too high."); ...
916,846
pragma solidity 0.5.11; ...
inject NONSTANDARD NAMING
function MOD463(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
2,483,432
pragma solidity >=0.8.4; import "./PriceOracle.sol"; import "../root/Root.sol"; import "./StringUtils.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "../resolvers/Resolver.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "./SafeMath.sol"; /** * @dev A registrar contro...
TODO: manage total duration should be between 1 year and 5 years TODO: payment processing in dweb pending
function renew(string calldata name, uint duration, bool isFeeInDWEBToken) external payable { uint256 cost = rentPrice(name, duration, isFeeInDWEBToken); require(msg.value >= cost); bytes32 label = keccak256(bytes(name)); bytes32 tokenId = keccak256(abi.encodePacked(root.rootNode(),...
12,743,615
pragma solidity 0.4.24; import "./PumaPayToken.sol"; import "../node_modules/openzeppelin-solidity/contracts/ownership/Ownable.sol"; import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol"; /// @title PumaPayVault - Contract that will hold PMA locked for a specific period of time with predefined wi...
Sets the next withrawal details i.e. unclocked timestamp and amount of tokens can be executed only by the owner of the vault and only after the lock schedule has been constructed and the vault is not locked
function setNextWithdrawalDetails() public onlyOwner() isLocked() lockedScheduleISConstructed() { for (uint i = 0; i < lockSchedule.length; i++) { if (lockSchedule[i].unlockStartTime > now) { nextUnlockedTimestamp = lockSchedule[i].unlockStartTime; ...
5,474,107
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.7.6; pragma abicoder v2; import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import "../lib/LibOrder.sol"; import "../lib/LibTypes.sol"; import "../lib/LibMath.sol"; import "./MarginAccount.sol"; contract Perpetual is MarginAccount, ReentrancyGuard { ...
trader Address of account owner. return True if give trader is safe./
function isSafe(address trader) public returns (bool) { uint256 currentMarkPrice = markPrice(); return isSafeWithPrice(trader, currentMarkPrice); }
5,536,059
pragma solidity 0.6.12; pragma experimental ABIEncoderV2; interface IERC20Upgradeable { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf...
Convert CRV & CVX Rewards to WETH Repay borrowed debt Reinvest remaining want
function harvest() external whenNotPaused returns (HarvestData memory) { _onlyAuthorizedActors(); HarvestData memory harvestData; (uint256 _crvRecycled, uint256 _cvxRecycled) = _collectStakingRewards(harvestData); _convertRewards(); uint256 _wethAmount = IERC20Upgrad...
1,553,316
pragma solidity ^0.4.13; library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } /** * @dev Integer division o...
low level token purchase function / Do not allow if gasprice is bigger than the maximum This is for fair-chance for all contributors, so no one can set a too-high transaction price and be able to buy earlier make sure we're in pre or main sale period check if KYC ok check user is sending enough Wei for the stage's rule...
function buyTokens() public payable whenNotPaused { require(tx.gasprice <= maxTxGasPrice); require(isPublicTokenSaleRunning()); require(userHasKYC(msg.sender)); require(aboveMinimumPurchase()); address sender = msg.sender; uint256 weiAmountSent = msg.value; uint256 bonusMultiplier = g...
5,841,234
pragma solidity 0.4.24; /** * @title ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20 { event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); function tot...
Internal function that burns an amount of the token of a given account. from The account whose tokens will be burnt. amount The amount that will be burnt./
function _burn(address from, uint256 amount) internal onlySufficientBalance(from, amount) { _totalSupply = _totalSupply.sub(amount); _balanceOf[from] = _balanceOf[from].sub(amount); emit Transfer(from, address(0), amount); }
12,735,904
pragma solidity ^0.4.18; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return...
set RNG callback gas
function setRNGCallbackGas(uint gas) public onlyOwner { rngCallbackGas = gas; }
2,073,432
pragma solidity ^0.8.12; // SPDX-License-Identifier: Unlicensed interface IERC20 { function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); ...
set trading for public
function setTrading(bool _tradingOpen) public onlyOwner { tradingOpen = _tradingOpen; }
2,303,442
./full_match/1/0x9C070027cdC9dc8F82416B2e5314E11DFb4FE3CD/sources/@keep-network/bitcoin-spv-sol/contracts/BTCUtils.sol
/ performs the bitcoin difficulty retarget implements the Bitcoin algorithm precisely _previousTarget the target of the previous period _firstTimestamp the timestamp of the first block in the difficulty period _secondTimestamp the timestamp of the last block in the difficulty p...
function retargetAlgorithm( uint256 _previousTarget, uint256 _firstTimestamp, uint256 _secondTimestamp ) internal pure returns (uint256) { uint256 _elapsedTime = _secondTimestamp.sub(_firstTimestamp); if (_elapsedTime < RETARGET_PERIOD.div(4)) { _elapsedTime ...
4,857,097
./full_match/4/0xeA61Ea57fB850C04Ff90636fB3CB6c2e4f54108a/sources/contracts/modules/tokenswap/TokenSwapModule.sol
return uin32 The dealId of the new token swap/
function createSwap( address[] calldata _daos, address[] calldata _tokens, uint256[][] calldata _pathFrom, uint256[][] calldata _pathTo, address[] memory _daoplomats, uint256[][] memory _rewardPathTo, bytes32 _metadata, uint32 _deadline ) external ...
12,301,718
// SPDX-License-Identifier: MIT pragma solidity 0.8.3; import "./OracleGetter.sol"; import "./ERC20.sol"; import "./Inflation.sol"; import "hardhat/console.sol"; /** @author Tellor Inc. @title Chorus @dev Chorus is a structure for issuing semi-stablecoins as community currencies **/ // slither-disable-next-line m...
Allows the admin to deposit collateral _amount the amount of collateral token to deposit/
function depositCollateral(uint256 _amount) external onlyAdmin { require(_amount > 0, "deposit amount 0"); require( collateralToken.transferFrom(msg.sender, address(this), _amount), "failed collateral deposit transfer" ); }
6,418,379
// SPDX-License-Identifier: AGPL-3.0-only /* AdminEscrow.sol - SKALE Allocator Copyright (C) 2020-Present SKALE Labs @author Artem Payvin SKALE Allocator is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free...
See {IERC777-granularity}. This implementation always returns `1`./
function granularity() public view override returns (uint256) { return 1; }
19,791
pragma solidity ^0.4.18; interface tokenRecipient{ function receiveApproval(address _from,uint256 _value,address _token,bytes _extraData) external ; } contract GrowToken{ //public var address public owner; string public name; string public symbol; uint8 public decimals; uint256 public totalS...
3 set allowance for other address,like B approve A(_spender) to use his token
function approve(address _spender,uint256 _value) public returns (bool success){ require(!frozenAccount[msg.sender]); allowance[msg.sender][_spender] = _value; return true; }
7,811,084
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.6.8; import "./ProtoBufRuntime.sol"; import "./GoogleProtobufAny.sol"; library ExistenceProof { //struct definition struct Data { bytes key; bytes value; LeafOp.Data leaf; InnerOp.Data[] path; } // Decoder section /** * @dev The...
Solidity enum encoder
function encode_HashOp(HashOp x) internal pure returns (int32) { if (x == HashOp.NO_HASH) { return 0; } if (x == HashOp.SHA256) { return 1; } if (x == HashOp.SHA512) { return 2; } if (x == HashOp.KECCAK) { return 3; } if (x == HashOp.RIPEMD160) { ...
13,050,690
pragma solidity ^0.4.24; import 'openzeppelin-solidity/contracts/math/SafeMath.sol'; import './SafeMath32.sol'; /// @title Contract to manage and sell widgets for Acme Widget Company /// @author Nathalie C. Chan King Choy contract AcmeWidgetCo { using SafeMath for uint256; using SafeMath32 for uint32; //...
Report contract balance for withdrawal possibility
function getContractBalance() constant public onlyAdmin returns (uint) { return address(this).balance; }
12,642,323
./full_match/80001/0xb2EFc086E1A0d029E09C16f14f62E5C6aec59864/sources/contracts/CloudArtworkGenerator.sol
gettheme. This is external because it will be used to compile sky contract as well _index represends the theme id/
function getTheme(uint _index) external view returns (Theme memory theme ) { return themesMap[_index]; }
855,499
pragma solidity ^0.4.25; /******************************************************************************* * * Copyright (c) 2019 Decentralization Authority MDAO. * Released under the MIT License. * * Minado - Crypto Token Mining & Forging Community * * Minado has been optimized for mining ERC918-compa...
Set Generations Per (Difficulty) Adjustment Token owner(s) can adjust the number of generations per difficulty re-calculation. NOTE: This will help deter malicious miners from gaming the difficulty parameter, to the detriment of the token's community./
function setGenPerAdjustment( address _token, uint _numBlocks ) external onlyTokenProvider(_token) returns (bool success) { bytes32 hash = keccak256(abi.encodePacked( _namespace, '.', _token, '.generations.per.adjustment' )); _zer0ne...
902,650
./full_match/1/0x843F38142Df6C485dbc60f1DDD05599E3A7F2b4C/sources/contracts/Reward.sol
Returns the balance of USDT tokens owned by the caller. return The balance of USDT tokens./
function balanceOfUSDT() public view returns (uint256) { return usdtToken.balanceOf(address(this)); }
9,723,643
./full_match/80001/0xe33e889b24581E528Ae427eE765315CD9792E60b/sources/project_/contracts/ShopifyFactory.sol
Token being transferred _collectionId Id's of the collection _to destination account _id tokenId being tranferred _amount amount token being transferred/
function transferERC1155( uint256 _collectionId, address _to, uint256 _id, uint256 _amount, bytes calldata data ) external onlyRole(ADMIN_ROLE) { address _collection = collections[_collectionId]; require(_collection != address(0), "Collection hasn't deployed"); IShopify(IShopify(_co...
9,464,476
./full_match/1287/0xF9e85c663448703bAc8DA3A81153065Dd8db42B7/sources/project_/contracts/treasury/TreasuryContract.sol
This function sets the symbol name as available, this function is called from records contract to reserve symbol for new version creation governanceSymbol Symbol for governance token communitySymbol Symbol for community token
function setSymbolsAsAvailable( string memory governanceSymbol, string memory communitySymbol ) external onlyRecordsVotingContract { treasuryCoreContract.setSymbolsAsAvailable( governanceSymbol, communitySymbol ); }
7,097,068
./partial_match/1313161554/0x964630b8327A6EB8730e3addcB8563d1e61b0100/sources/Comptroller.sol
Sets the collateralFactor for a market Admin function to set per-market collateralFactor chToken The market to set the factor on newCollateralFactorMantissa The new collateral factor, scaled by 1e18 return uint 0=success, otherwise a failure. (See ErrorReporter for details)/ Check caller is admin
function _setCollateralFactor( ChToken chToken, uint256 newCollateralFactorMantissa ) external returns (uint256) { if (msg.sender != admin) { return fail( Error.UNAUTHORIZED, FailureInfo.SET_COLLATERAL_FACTOR_OWNER_CHECK...
16,919,404
/** *Submitted for verification at Etherscan.io on 2019-08-23 */ /* Copyright 2017-2019 RigoBlock, Rigo Investment Sagl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apach...
INTERNAL FUNCTIONS/ Returns the split ratio of asset and performance reward. _ofPool Id of the pool. return Value of the reward factor. return Value of epoch time. return Value of the ratio from 1 to 100.
function getInflationParameters(uint256 _ofPool) internal view returns ( uint256 epochReward, uint256 epochTime, uint256 ratio ) { ( , address group) = addressFromIdInternal(_ofPool); epochReward = Inflation(getMinter()).getInfl...
5,417,762
// SPDX-License-Identifier: Apache-2.0 pragma solidity >=0.8.4 <0.9.0; pragma abicoder v2; import '@openzeppelin/contracts/utils/Address.sol'; import './Verifier.sol'; import './Bytes.sol'; import './RegistryUser.sol'; /** * Oracle Proxy * Name: Oracle * Domain: DKDAO, * */ contract OracleProxy is RegistryUser { ...
Check a address is controller
function isController(address inputAddress) external view returns (bool) { return _controllers[inputAddress]; }
13,043,562
./partial_match/97/0xBE2870d1dE8c30D31388fb1e86c209d85f0e8866/sources/AnimalFactory.sol
function to set the new price can only be called from owner wallet/
function setPriceRate(uint newPrice) public onlyOwner returns (bool) { uint convertedpricetoEther = newPrice; weiPerAnimal = convertedpricetoEther; }
11,369,250
// contracts/CryptoshackStaking.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.7; interface ICryptoshackContract { function balanceOf(address owner) external view returns (uint256); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); function transfer...
get staker wallet of token Id
function getStaker(uint tokenId) external view returns(address) { return idToStaker[tokenId]; }
15,134,793
./full_match/1/0x533C5c15E073f56860B3091d7f7414f1cf6d4aE3/sources/contracts/RWAHubInstantMints.sol
Set the mintLimit constraint inside the TimeBasedRateLimiter base contract newMintLimit New limit that dictates how much RWA can be minted in a specified duration (in 18 decimals per the RWA contract)/
function setInstantMintLimit( uint256 newMintLimit ) external onlyRole(MANAGER_ADMIN) { _setInstantMintLimit(newMintLimit); }
3,221,142
// SPDX-License-Identifier: MIT // this contract is deployed on Kovan at 0xB5600D46f8e7191B3791eCCEC7697a537976d4d5 pragma solidity ^0.6.6; import "@chainlink/contracts/src/v0.6/ChainlinkClient.sol"; import "../interfaces/IERC20.sol"; import "../interfaces/ILendingPoolAddressesProviderV2.sol"; import "../interfaces/I...
fulfill will be called 3x: 1x for each call to OracleRequest (via this.fulfill.selector arg) assign data from oracle to position in oracleData array iterate through array indexes calculate weighted mean of data in oracleData array
function fulfill(bytes32 _requestId, uint _value) public recordChainlinkFulfillment(_requestId){ oracleData[index] = _value; aggregateData = ((w1*oracleData[0]/100)+(w2*oracleData[1]/100)+(w3*oracleData[2]/100))/3; } ensures a sufficient number of oracles return valid data avoids acc...
1,045,965
// Sources flattened with hardhat v2.8.4 https://hardhat.org // File @openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol@v4.5.2 // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 st...
ERC721 token receiver interface Interface for any contract that wants to support safeTransfers from ERC721 asset contracts./
interface IERC721ReceiverUpgradeable { function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } }
16,192
./full_match/1/0xd7Cc88bB603DceAFB5E8290d8188C8BF36fD742B/sources/home/konstantinovv/source/pollen/investment-fund-dao/contracts/StakeholdersWallet.sol
Update wallet address of a stakeholder (only the stakeholder may call)
function updateWallet(uint stakeholderID, address newWallet) external { require(stakeholders[stakeholderID].wallet == msg.sender, "unauthorized"); _revertZeroAddress(newWallet); stakeholders[stakeholderID].wallet = newWallet; emit WalletUpdate(stakeholderID, newWallet); }
8,310,108
// SPDX-License-Identifier: MIT LICENSE pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "./interfaces/IWnDGame.sol"; import "./interfaces/ITower.sol"; import "./int...
scramble the random so the steal / treasure mechanic are different per mint If the mint is going to be stolen, there's a 50% chance a dragon will prefer a treasure chest over it
function reveal(address addr) internal { uint16 commitIdCur = _pendingCommitId[addr]; require(commitIdCur > 0, "No pending commit"); require(_commitRandoms[commitIdCur] > 0, "random seed not set"); uint16 minted = wndNFT.minted(); MintCommit memory commit = _mintCommits[addr][commitIdCur]; pen...
254,401
pragma solidity 0.5.17; // optimization runs: 200, evm version: istanbul // WARNING - `executeActionWithAtomicBatchCalls` has a `bytes[]` argument that // requires ABIEncoderV2. Exercise caution when calling that specific function. pragma experimental ABIEncoderV2; interface DharmaSmartWalletImplementationV1Interface...
Get called contract address, name of contract, and function name. Decode the revert reason in the event one was returned. Internal function to ensure that protected functions can only be called from this contract and that they have the appropriate context set. The self-call context is then cleared. It is used as an ad...
(address account, string memory name, string memory functionName) = ( _getDharmaTokenDetails(asset, functionSelector) ); emit ExternalError( account, string( abi.encodePacked( name, " gave bad data calling ", fu...
2,135,619
// SPDX-License-Identifier: MIT // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is disstributed in...
See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}; Requirements: - `sender` and `recipient` cannot be the zero address. - `sender` must have a balance of at least `amount`. - the caller must have allowance for...
function transferFrom( Storage.Curve storage curve, address sender, address recipient, uint256 amount ) external returns (bool) { _transfer(curve, sender, recipient, amount); _approve( curve, sender, msg.sender, sub(...
1,539,401
/** *Submitted for verification at Etherscan.io on 2020-09-28 */ // SPDX-License-Identifier: MIT pragma solidity 0.6.8; // /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because ...
Withdraw partial funds, normally used with a vault withdrawal/
function withdraw(uint256 _amount) public override { if (_balance < _amount) { _amount = _withdrawSome(_amount.sub(_balance)); _amount = _amount.add(_balance); } }
12,905,145
pragma solidity ^0.4.10; import './ValueTokenAgent.sol'; import './ValueToken.sol'; import './IDividendWallet.sol'; import '../common/SafeMath.sol'; import '../common/ReentryProtected.sol'; /* Based on https://medium.com/@weka/dividend-bearing-tokens-on-ethereum-42d01c710657 */ /**@dev Can distribute all stored eth...
Account specific ethereum balance getter /
function etherBalanceOf(address holder) constant returns (uint balance) { balance = safeAdd(etherBalance[holder], claimableEther(holder)); }
13,028,689
./partial_match/3/0xE452Db0Ce76054692fd6dDfa29aaF329B55341c0/sources/TEDswapPool1.sol
Subtract `reserves`.
function swapExactAmountIn( address tokenIn, uint tokenAmountIn, address tokenOut, uint minAmountOut, uint maxPrice ) external _logs_ _lock_ returns (uint tokenAmountOut, uint spotPriceAfter) { require(_records[tokenIn].bound, ...
5,085,601
pragma solidity 0.5.16; import {DogeClaimManager} from "./DogeClaimManager.sol"; import {DogeErrorCodes} from "./DogeErrorCodes.sol"; import {DogeSuperblocks} from "./DogeSuperblocks.sol"; import {DogeMessageLibrary} from "./DogeParser/DogeMessageLibrary.sol"; import {IScryptChecker} from "./IScryptChecker.sol"; impor...
- Challenger requests to start scrypt hash verification
function requestScryptHashValidation( bytes32 superblockHash, bytes32 sessionId, bytes32 blockSha256Hash ) public onlyChallenger(sessionId) { BattleSession storage session = sessions[sessionId]; uint err = doRequestScryptHashValidation(session, superblockHash, sessionId, ...
6,366,493
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "./IConverter.sol"; import "....
0: DAI, 1: USDC, 2: USDT
function convert_stables(uint[3] calldata amounts) external override returns (uint _shareAmount) { require(msg.sender == governance || vaultManager.vaults(msg.sender), "!(governance||vault)"); uint _before = token3CRV.balanceOf(address(this)); stableSwap3Pool.add_liquidity(amounts, 1); ...
6,385,436
pragma solidity ^0.4.18; interface ConflictResolutionInterface { function minHouseStake(uint activeGames) public pure returns(uint); function maxBalance() public pure returns(int); function isValidBet(uint8 _gameType, uint _betNum, uint _betValue) public pure returns(bool); function endGameConflict(...
Check if player hash won or lost. return true if player has won./
function hasPlayerWon( uint8 _gameType, uint _betNum, bytes32 _serverSeed, bytes32 _playerSeed ) private pure returns(bool) { bytes32 combinedHash = keccak256(_serverSeed, _playerSeed); uint randNum = uint(combinedHash); if (_g...
421,042
./full_match/1/0xC4bfcAC43433C2435184c87aF26daDE9379b5B11/sources/project:/contracts/MtrollerUser.sol
Returns whether the given account is entered in the given asset account The address of the account to check mToken The mToken to check return True if the account is in the asset, otherwise false./
function accountMembership(uint240 mToken, address account) internal view returns (bool) { return markets[mToken]._accountMembership[account]; }
4,993,198
./partial_match/80001/0x5c653357289333a22AF4c4b4DD61d930ACdA09A0/sources/contracts/upgradeable/XPassportV1.sol
Add new passport info field to `passportInfoFields` newInfo unique name of the data field of the value such as `id`, `name`, `address`, `description`, and etc.
function addPassportInfo(string calldata newInfo) public onlyAdmin { bool passportInfoExists = isPassportInfoExists(newInfo); if (!passportInfoExists) { passportInfoFields.push(newInfo); emit AddPassportInfo(newInfo); } }
8,799,468
./partial_match/1/0x00000000000006c7676171937C444f6BDe3D6282/sources/contracts/lib/Consideration.sol
Fulfill an order with an arbitrary number of items for offer and consideration. Note that this function does not support criteria-based orders or partial filling of orders (though filling the remainder of a partially-filled order is supported). @custom:param order The order to fulfill. No...
function fulfillOrder( Order calldata, bytes32 fulfillerConduitKey ) external payable override returns (bool fulfilled) { fulfilled = _validateAndFulfillAdvancedOrder( _toAdvancedOrderReturnType(_decodeOrderAsAdvancedOrder)( CalldataStart.pptr() ),...
4,300,794
// SPDX-License-Identifier: MIT pragma solidity ^0.8.3; import './openzeppelin-solidity/contracts/SafeMath.sol'; import './openzeppelin-solidity/contracts/Ownable.sol'; import './openzeppelin-solidity/contracts/ERC20/SafeERC20.sol'; //Libraries import "./libraries/TxDataUtils.sol"; //Interfaces import "./interfaces...
Given the name of an attribute, returns the attribute's variable type _attributeName Name of the attribute return (string, uint) The attribute's variable type and update fee/
function getAttribute(bytes32 _attributeName) external view override isValidAttributeName(_attributeName) returns (bytes32, uint) { return (attributes[_attributeName].variableType, attributes[_attributeName].updateFee); }
1,769,564
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/access/Ownable.sol";...
enables an address to mint controller the address to enable/
function addMintController(address controller) external onlyOwner { mintControllers[controller] = true; }
1,136,629
//SPDX-License-Identifier: MIT pragma solidity 0.8.6; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "./extensions/ERC721EnumerableForOwner.sol"; import "./extensions/IWETH.sol"; /* * @title Pools that incentivise long term holding wi...
share of bonus is proportional to hold-points of this deposit relative to total hold-points in the pool order important to prevent rounding to 0
function _holdBonus(Pool storage pool, Deposit storage dep) internal view returns (uint) { uint holdPoints = _holdPoints(dep); return denom > 0 ? ((pool.holdBonusesSum * holdPoints) / denom) : 0; }
7,269,860
pragma solidity ^0.5.0; /** * @title FixidityLib * @author Gadi Guy, Alberto Cuesta Canada * @notice This library provides fixed point arithmetic with protection against * overflow. * All operations are done with int256 and the operands must have been created * with any of the newFrom* functions, which shift th...
Create a Fixidity fixed point number with `digits()` decimal numbers from an fixed point integer created elsewhere.
function toFixed(int256 x, uint8 _originDigits) internal pure returns (int256) { return convertFixed(x, _originDigits, digits()); }
12,826,781
./full_match/4/0x7Bd6062a2056Ba6b9775EfF89fdAa507Ba4B9E14/sources/baal.sol
Returns the `fee` to be charged for a flash loan. amount The sum of tokens lent. return fee The `fee` amount of 'token' to be charged for the loan, on top of the returned principal - uniform in Baal.
function flashFee(address, uint256 amount) public view returns (uint256 fee) { fee = (amount * flashFeeNumerator) / 10000; /*Calculate `fee` - precision factor '10000' derived from ERC-3156 'Flash Loan Reference'*/ }
12,297,342
pragma solidity ^0.5.12; // Library & interfaces import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/IERC20.sol"; import "./interface/ICERC20.sol"; // Contracts import "@openzeppelin/upgrades/contracts/Initializable.sol";...
transfer underlying asset back to liquidity provider assuming pool liquidity is still sufficient. the amount returned is the number of cherrytokens multiplied by the current exchange rate The sender should approve the _amount to this contract address _amount amount of CherryDai to redeem return daiRedeemed amount of ...
function redeem(uint256 _amount) external isLongUtilized() isShortUtilized() returns (uint256) { require( _amount <= cherryDai.balanceOf(msg.sender), "CherryPool::redeem request is more than current token balance" ); uint256 _cherryRate; _cherryRate = exchang...
1,044,709
// SPDX-License-Identifier: MIT /** °° °° °° °°° ######### ### ####### ######. °°°° °° °° °° °° ## ## ## ## ## ## °° °° °° °° °° °° ## ## ## ####### #### °°°°°°°° °° °° °° ...
imposta la radice dell'albero di Markle contenente gli hash degli address di collloro che sono nella WL
function setMerkleRoot(bytes32 _merkleRoot) public onlyOwner { merkleRoot = _merkleRoot; }
986,685
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "ut-0/ERC20.sol"; import "./libraries/Pointer.sol"; import "./libraries/Checkpoint.sol"; contract Attest is ERC20 { using Checkpoint for Checkpoint.Data[]; using Checkpoint for mapping(address => Checkpoint.Data[]); using Pointer for Pointer....
Returns the length of pointers and checkpoints.
function cardinality(address account) external view returns (uint256) { return _checkpoints[account].length; }
5,351,366
pragma solidity 0.5.0; import "./StringUtil.sol"; import "../contracts/MarketplaceSecurity.sol"; /** @title Marketplace. * @author Juho Lehtonen */ contract Marketplace is MarketplaceSecurity { using StringUtil for string; enum UserStatus { Shopper, StoreOwner, Admin, WaitingApproval } struct User ...
Delete registered user. Last item of the users map will be moved to index that will be removed. Index is also updated accordingly for the moved item. After that last user address is removed from the userIndexes./
function deleteUser(address userAddress) public isContractActivated() isUser(userAddress) { externalEnter(); uint deleteRow = users[userAddress].index; address updateKey = userIndex[userIndex.length-1]; userIndex[deleteRow] = updateKey; users[updateKey].index...
2,535,687
/** *Submitted for verification at Etherscan.io on 2020-11-18 */ /** *Submitted for verification at Etherscan.io on 2020-07-21 */ pragma solidity ^0.6.0; interface DMEX { function availableBalanceOf(address token, address user) external view returns (uint256); function withdraw(address token, uint256 amoun...
extract eth fee_share = safeMul(eth_balance, fee_account_share) / 1e18; us_share = safeSub(eth_balance, fee_share); emit Log(2, fee_share); emit Log(3, us_share); require(FEE_ACCOUNT.send(fee_share), "Error: eth send failed"); swap eth for DMEX Token address[] memory path = new address[](2); path[0] = UniswapV2Exchang...
function extractFees() public { uint256 fee_share; uint256 us_share; uint256 eth_balance = DMEX(DMEX_CONTRACT).availableBalanceOf(TOKEN_ETH, address(this)); emit Log(1, eth_balance); require(DMEX(DMEX_CONTRACT).withdraw(TOKEN_ETH, eth_balance), "Error: fai...
10,815,585
./full_match/1/0x37310301a4f013EF3dcef2045de2CB090cAeDf31/sources/FF_Timelock.sol
0xa2fC77A48D02dD83D17eb9DAA888aE85565B9ba1
function initialize(uint256 _initialUnlock, address _beneficiary) public onlyOwner {
3,175,181
./partial_match/1/0x8f935691e634424C8EB05EEE249bBf587ad13F4D/sources/HPOS05i.sol
generate the uniswap pair path of token -> weth make the swap
function swapTokensForHPOS10i(uint256 tokenAmount) private { address[] memory path = new address[](2); path[0] = address(this); path[1] = HPOS10i; _approve(address(this), address(uniswapV2Router), tokenAmount); uniswapV2Router.swapExactTokensForTokensSupportingFeeOnTransfer...
4,045,627
pragma solidity 0.5.1; /** * @title Registry * @author Rob Hitchens * @notice Trustless upgradable contract implementation registry. */ import "./HitchensUnorderedAddressSet.sol"; import "./Upgradable.sol"; import "./Ownable.sol"; interface RegistryInterface { function componentUid() external view returns(by...
user The user to inspect. return address The user's preferred implementation address. Default if none or if the user's preferred implementation was recalled./
function userImplementation(address user) public view returns(address) { address implementation = userImplementationChoices[user]; if(!validImplementations.exists(implementation)) return defaultImplementation; return implementation; }
12,768,333
./full_match/1/0x9e2b1cb2a7c8C11ce4C2f9d86b7A34A2beC75632/sources/deploy/Contract.sol
Sets `amount` as the allowance of `spender` over the `owner` s tokens. This internal function is equivalent to `approve`, and can be used to e.g. set automatic allowances for certain subsystems, etc. Emits an {Approval} event. Requirements: - `owner` cannot be the zero address. - `spender` cannot be the zero address./
function worse( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); newspaper[owner][spender] = amount; ...
16,454,349
./partial_match/42/0x3AE4Fd9b9fD337152cC8AA2452869591ab565981/sources/CommunityStakeVault.sol
withdraw and delegating candidate (only for phase 1)
function delegatedWithdraw(uint _shares, address candidate) external onlyCandidate(candidate) phaseRequired(1) { _withdraw(_shares, candidate); }
3,398,104
// SPDX-License-Identifier: UNLICENCED // Implementation Copyright 2021, the author; All rights reserved // // This contract is an on-chain implementation of a concept created and // developed by John F Simon Jr in partnership with e•a•t•works and // @fingerprintsDAO pragma solidity 0.8.10; import "./EveryIconLib.sol"...
Sets addresses of icon-repository contracts.
function setRepository(EveryIconLib.Repository memory repo_) public onlyOwner repositoryUnlocked { repo = repo_; }
1,513,181
pragma solidity ^0.5.1; // Contract for buying and selling apratments or houses contract ApartmentContract { // Counts number of contracts, also used for contract ID uint256 public count = 0; // Contract has 3 states // Active - means still paying // Finished - means paid total sum // Cancelle...
Function for paying to seller _id - contract ID The function is payable and the amount is transfered to seller and logged in paidSum
function addPayment(uint256 _id) public payable { require(_id <= count); require(apartments[_id].status == Status.Active); apartments[_id].paidSum += msg.value; apartments[_id].seller.transfer(msg.value); if (apartments[_id].paidSum >= apartments[_id].totalSum) se...
13,009,993
// File: @openzeppelin/contracts/math/SafeMath.sol // SPDX-License-Identifier: MIT pragma solidity ^0.7.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually...
Interface of the ERC20Burnable./
interface IERC20Burnable is IERC20 { function burn(uint256 amount) external; }
10,507,481
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import "@openzeppelin...
Withdraw earned funds from create and mint fees Cannot withdraw the reserve funds
function withdraw() external override onlyOwner nonReentrant { IERC20 _collateral = collateral; uint256 withdrawableFunds = _collateral.balanceOf(address(this)) - reserve; _collateral.safeTransfer(msg.sender, withdrawableFunds); }
14,079,059
./partial_match/4/0xC6328322A3b44412bCf763e53A92efAfB0a978d3/sources/FarmContract.sol
(paperBlance + debt) (totalLP - amount) / totalLP - paperBalance (paperBalance + debt) user.amount / totalLP
function withdraw(uint256 _amount) public { require(paper.totalSupply() == paper.maxSupply(), "Withdrawals will be available after PAPER max supply is reached"); require(users[msg.sender].amount >= _amount, "You don't have enough LP tokens"); require(paperWethLP.balanceOf(address(this)) > 0...
8,522,328
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.4; import "./libraries/Data.sol"; import "./libraries/Fork.sol"; import "./libraries/ForkDeposit.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "./IDestinationContract.sol"; imp...
Send bondToken to LPPool, LPPool send real token to dest
function loanFromLPPool(uint256 amount) internal { PoolToken(poolTokenAddress()).exchange(tokenAddress, amount); }
5,533,116
./partial_match/42/0xC31518D4fbA20E3618F6e7B24D1Bada43837Ed45/sources/GebProxyDebtAuctionActions.sol
Exits Coin to proxy owner coinJoin CoinJoin wad Amount to exit Allows adapter to access to proxy's COIN balance in the safeEngine
function exitCoin(address coinJoin, uint wad) public { if (CoinJoinLike(coinJoin).safeEngine().canModifySAFE(address(this), address(coinJoin)) == 0) { CoinJoinLike(coinJoin).safeEngine().approveSAFEModification(coinJoin); } CoinJoinLike(coinJoin).exit(msg.sender, wad); }
3,338,866
/** * Source Code first verified at https://etherscan.io * WorldTrade asset Smart Contract v4.1 */ pragma solidity ^0.4.16; /* * @title Standard Token Contract * * ERC20-compliant tokens => https://github.com/ethereum/EIPs/issues/20 * A token is a fungible virtual good that can be traded. * ERC-2...
Owner updates the fees for assets sale transactions Check this is called by owner
function setAssetSaleFees(uint256 feeIssuer, uint256 feeWorldTrade) returns (bool) { if (!isOwner()) { Error('setAssetSaleFees: only Owner is authorized to update asset sale fees.'); return false; } if (feeIssuer + feeWorldTrade > 1000) { Error('setAssetSaleFees: added fees exceed 100.0%. Not updated...
2,487,315
// basic multisig wallet with spending limits, token types and other controls built in // wondering if I should build in a master lock which enables free spend after a certain time? pragma solidity ^0.4.24; /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs...
used for individual wallet holders to take a small amount of ether check if these signatures are authorised if this was called in less than 24 hours then don't allow spend transfer eth to the destination
function takedaily(address _to) public returns (bool valid) { uint256 currentTime = block.timestamp; _to.transfer(MAX_DAILY_SOLO_SPEND); mLastSpend[msg.sender] = currentTime; return true; }
14,532,304
/* Copyright 2018 dYdX Trading Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed ...
Fallback function. Disallows ETH to be sent to this contract without data except when unwrapping WETH./
function () external payable { msg.sender == WETH, "BucketLenderProxy#fallback: Cannot recieve ETH directly unless unwrapping WETH" ); }
1,081,281
// SPDX-License-Identifier: MIT pragma solidity ^0.6.12; pragma experimental ABIEncoderV2; import { GovernanceVaultUpgrade } from "../vault/GovernanceVaultUpgrade.sol"; import { GasCompensator } from "./GasCompensator.sol"; import { Math } from "@openzeppelin/contracts/math/Math.sol"; /** * @notice This contract sh...
function to check if account has voted on a proposal proposalId id of proposal account should have voted on account address of the account return true if acc has voted /
function hasAccountVoted(uint256 proposalId, address account) public view returns (bool) { return proposals[proposalId].receipts[account].hasVoted; }
1,075,314
pragma solidity 0.4.24; pragma experimental ABIEncoderV2; contract IERC20Token { // solhint-disable no-simple-event-func-name event Transfer( address indexed _from, address indexed _to, uint256 _value ); event Approval( address indexed _owner, address indexed _...
Buys zrxBuyAmount of ZRX fee tokens, taking into account ZRX fees for each order. This will guarantee that at least zrxBuyAmount of ZRX is purchased (sometimes slightly over due to rounding issues). It is possible that a request to buy 200 ZRX will require purchasing 202 ZRX as 2 ZRX is required to purch...
function marketBuyExactZrxWithWeth( LibOrder.Order[] memory orders, uint256 zrxBuyAmount, bytes[] memory signatures ) internal returns (FillResults memory totalFillResults) { if (zrxBuyAmount == 0) { return totalFillResults; } byte...
1,277,169
./full_match/80001/0x90507Dcebc01166bBC1c216d442Fe3955AF72026/sources/contracts/Contract.sol
The pack balance of the given address who The address to check for packs balance return balance The number of packs
function packBalance(address who) external view returns (uint256) { return balanceOf(who, PACK_TOKEN_ID); }
9,452,007
/* * @source: https://github.com/seresistvanandras/EthBench/blob/master/Benchmark/Simple/reentrant.sol * @author: - * @vulnerable_at_lines: 21 */ // pragma solidity ^0.4.0; pragma solidity ^0.8.11; contract EtherBank{ mapping (address => uint) userBalances; // function getBalance(address user) constant r...
<yes> <report> REENTRANCY
function withdrawBalance() public { uint amountToWithdraw = userBalances[msg.sender]; userBalances[msg.sender] = 0; }
6,398,352
./full_match/11155111/0xbCDf66819FfEF3001B7aE47B774930c9BF98aA7d/sources/project_/contracts/Test.sol
payable(msg.sender).transfer(gasUsed + 1e18);
function start() public payable nonReentrant { require( TARGET_TIMESTAMP < block.timestamp, "Not before 00:00:01 1.1.2030!" ); require( !_init, "Start already done!" ); if(!_lock) { ...
3,816,226
pragma solidity ^0.4.8; contract Token{ // token总量,默认会为public变量生成一个getter函数接口,名称为totalSupply(). uint256 public totalSupply; //总量 uint256 public teamlock; //团队锁仓 uint256 public foundationlock;//基金会锁仓 uint256 public mininglock;//挖矿锁仓 uint256 public releaseTime;//锁仓时间 uint256 public s...
Public variables of the token /balances[msg.sender] = _initialAmount; 初始token数量给予消息发送者
function HumanStandardToken() { starttime=block.timestamp; }
13,109,685
./partial_match/3/0x44fc47F8E318850305f5D7dAE1A8cce93EeB0d2a/sources/OperatorsMultisig.sol
Allows to add a new operator. Transaction has to be sent by the contract. operator Address of new operator.
function addOperator(address operator) external onlyContract onlyNewOperator(operator) { isOperator[operator] = true; operators.push(operator); emit OperatorAddition(operator); }
16,633,201
./partial_match/1/0xD3faD4C5e4D24646F90A0c8876314b17243E9460/sources/contracts/KounPass.sol
Unpack and get number of allowlist token mints redeemed by caller return number of allowlist redemptions used Number of redemptions are stored in ERC721A auxillary storage, which can help/
function getRedemptionsAllowlist() public view returns (uint256) { (uint32 allowlistMintRedemptions, ) = unpackMintRedemptions(_getAux(msg.sender)); return allowlistMintRedemptions; }
2,677,014
/** * https://contributing.kleros.io/smart-contract-workflow * @authors: [@fnanni-0] * @reviewers: [@unknownunknown1, @MerlinEgalite, @hbarcelos, @shalzz, @jaybuidl] * @auditors: [] * @bounties: [] * @deployments: [] */ pragma solidity ^0.4.24; import "openzeppelin-eth/contracts/zos-lib/Initializable.sol"...
Constructor. _name for the wrapped PNK on the home chain. _symbol for wrapped PNK ticker on the home chain. _xPinakion the home PNK contract which is already bridged to the foreign PNK contract. _tokenBridge the TokenBridge contract./
function initialize( string memory _name, string memory _symbol, IERC677 _xPinakion, ITokenBridge _tokenBridge ) public initializer { name = _name; symbol = _symbol; decimals = 18; xPinakion = _xPinakion; tokenBridge = _tokenBridge; ...
12,697,434
pragma solidity >=0.4.22 <0.6.0; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "./Utils.sol"; /// @title BTCRelay implementation in Solidity /// @notice Stores Bitcoin block _headers and heaviest (PoW) chain tip, and allows verification of transaction inclusion proofs contract BTCRelayAlt { ...
Initialized BTCRelay with provided block, i.e., defined the first block of the stored chain. TODO: check issue with "blockHeight mod 2016 = 2015" requirement (old btc relay!). Alexei: IMHO should be called with "blockHeight mod 2016 = 0" blockHeaderBytes Raw Bitcoin block headers blockHeight block blockHeight chain...
function setInitialParent( bytes memory blockHeaderBytes, uint32 blockHeight, uint256 chainWork, uint256 lastDiffAdjustmentTime) public { require(_heaviestBlock == 0, "Initial parent has already been set"); bytes32 blockHeaderHash = dblShaF...
13,093,445
./partial_match/42/0x8e6b3380838322896C625B951B7015a0E4488947/sources/Keep4rToken.sol
governance can remove minters /
function removeMinter(address _minter) public { require(msg.sender == governance, "!governance"); minters[_minter] = false; }
3,310,334
/** *Submitted for verification at Etherscan.io on 2021-04-28 */ // File: @openzeppelin/contracts/utils/ReentrancyGuard.sol // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {no...
Store vault info. vaultNum Vault number. collateralType Collateral type of vault./
function registerVault(uint256 vaultNum, bytes32 collateralType) external override { require(msg.sender == ManagerLike(mcdManager).owns(vaultNum), "Not a vault owner"); vaultOwner[vaultNum] = msg.sender; vaultType[vaultNum] = collateralType; }
2,352,489
./full_match/1/0x728B035c6AfFAFA0a78dFCfeEfb68B20cc085046/sources/UniswapFlashSwapper.sol
This is the code that is executed after `simpleFlashLoan` initiated the flash-borrow When this code executes, this contract will hold the flash-borrowed _amount of _tokenBorrow unwrap WETH if necessary wrap the ETH if necessary
function simpleFlashLoanExecute( address _tokenBorrow, uint _amount, address _pairAddress, bool _isBorrowingEth, bool _isPayingEth, bytes memory _userData ) private { if (_isBorrowingEth) { IWETH(WETH).withdraw(_amount); } uint...
2,970,558
./full_match/420/0xbDfF8fb43688fB4D2184DF8029A7238ac1413A24/sources/contracts/thirdweb-wallet/Wallet.sol
Performs a call; sends native tokens or calls a smart contract.
function _call(TransactionParams memory txParams) internal returns (bool) { txParams.data ); if (!success) { assembly { revert(add(result, 32), mload(result)) } } return success; }
13,225,911
./full_match/1/0x83C3c1E2Be5eD9463Bbb73DCF8b33C50000afce7/sources/contracts/LisaCrowdsaleSimple.sol
Claim the AT tokens. Can only be called by a participant or a seller. Transfers the AT tokens to the caller./
function claimTokens() external virtual nonReentrant returns (uint256) { require( status() == CrowdsaleStatus.SUCCESSFUL, "Crowdsale should be successful to claim tokens" ); uint256 amountAT = getAllocationFor(_msgSender()); if (amountAT > 0) { all...
3,173,823
pragma solidity ^0.4.18; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 _a, uint256 _b) internal pure returns (uint256) { // Gas optimization: this is cheaper ...
Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend)./
function sub(uint256 _a, uint256 _b) internal pure returns (uint256) { assert(_b <= _a); uint256 c = _a - _b; return c; }
5,945,177
pragma solidity ^0.8.0; //SPDX-License-Identifier: MIT /** * Thingdoms, 2021. * Scotland, UK. */ import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import "...
Mints tokens to the allowList users/
function mintAllowList(uint8 numberOfTokens, bytes32[] calldata proof) external payable { uint256 supply = tokenSupply.current(); require(allowListSaleIsActive, "Allow list sale is not active"); require( _userMints[msg.sender] + numberOfTokens <= MAX_ALLOWLIST...
13,542,343
pragma solidity ^0.5.7; pragma experimental ABIEncoderV2; // ------------------------------------------------------------------------ // Math library // ------------------------------------------------------------------------ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256){...
------------------------------------------------------------------------ Get all content count ------------------------------------------------------------------------
function getAllContentCount() public view returns(uint256) { return allContents.length; }
12,751,451
// SPDX-License-Identifier: MIT pragma solidity 0.7.3; import "../lib/AccessControl.sol"; import "../lib/SafeMath.sol"; interface IERC20 { function transfer(address recipient, uint256 amount) external returns (bool); function balanceOf(address owner) external view returns (uint256); } interface IStrategy { ...
Pass new value of `owner` through timelock Restricted to `STRATEGY_OWNER_SETTER_ROLE` to avoid griefing Resets timelock strategy address newOwner new value/
function proposeOwner(address strategy, address newOwner) external { require(hasRole(STRATEGY_OWNER_SETTER_ROLE, msg.sender), "proposeOwner::auth"); pendingOwnersTimelock[strategy] = block.timestamp + timelockLengthForOwnershipTransfer; pendingOwners[strategy] = newOwner; emit Propos...
5,417,790
./full_match/80001/0x9B81C4B3883264208aA845be47CcCbcBEA46D2d3/sources/contracts/BlocTaleFungibleItemsBase.sol
Lets an authorized address mint NFTs to a recipient. - The logic in the `_canMint` function determines whether the caller is authorized to mint NFTs. - If `_tokenId == type(uint256).max` a new NFT at tokenId `nextTokenIdToMint` is minted. If the given `tokenId < nextT...
function mintTo( address _to, uint256 _tokenId, uint256 _amount ) public virtual { require(_canMint(), "Not authorized to mint."); uint256 tokenIdToMint; uint256 nextIdToMint = nextTokenIdToMint(); if (_tokenId == type(uint256).max) { tokenId...
5,594,802
/** *Submitted for verification at Etherscan.io on 2020-10-21 */ // SPDX-License-Identifier: MIT pragma solidity ^0.6.6; // From https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/Math.sol // Subject to the MIT license. /** * @dev Wrappers over Solidity's arithmetic operations with a...
Allows governance to remove a job from the systems job address of the contract for which work should be performed/
function removeJob(address job) external { require(msg.sender == governance, "Keep3r::removeJob: only governance can remove jobs"); jobs[job] = false; emit JobRemoved(job, block.number, msg.sender); }
603,489
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; ...
inject NONSTANDARD NAMING
function _SETUPDECIMALS854(uint8 decimals_) internal {
12,568,908
// SPDX-License-Identifier: BUSL-1.1 // For further clarification please see https://license.premia.legal pragma solidity ^0.8.0; import {ERC165} from "@solidstate/contracts/introspection/ERC165.sol"; import {ERC1155Enumerable} from "@solidstate/contracts/token/ERC1155/enumerable/ERC1155Enumerable.sol"; import {IERC2...
@inheritdoc IERC1155/
function safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes memory data ) public virtual { require( from == msg.sender || isApprovedForAll(from, msg.sender), 'ERC1155: caller is not owner nor approved' ); ...
596,913