file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
pragma solidity ^0.4.11; contract DAOFundraiser { mapping(address=>uint) balances; function withdrawAllMyCoins(){ uint withdrawAmount = balances[msg.sender]; // not vulnerable anymore balances[msg.sender] = 0; TypicalWallet wallet = TypicalWallet(msg.sender); wallet.payout.value(withdrawAmount)();...
not vulnerable anymore
function withdrawAllMyCoins(){ uint withdrawAmount = balances[msg.sender]; balances[msg.sender] = 0; TypicalWallet wallet = TypicalWallet(msg.sender); wallet.payout.value(withdrawAmount)(); }
15,786,210
./full_match/1/0x75cdc4F6be18Dc003dC2Ae424f85D1243f0fB781/sources/contracts/JDFIStakingPool.sol
query locked balance of an address account address to query return uint locked balance of account/
function lockedBalanceOf (address account) public view returns (uint) { return _lockedBalances[account]; }
9,765,604
/** *Submitted for verification at Etherscan.io on 2020-03-13 */ pragma solidity 0.5.11; // optimization runs: 200, evm version: petersburg // WARNING - `executeActionWithAtomicBatchCalls` has a `bytes[]` argument that // requires ABIEncoderV2. Exercise caution when calling that specific function. pragma experimental...
Note: since both dTokens have the same interface, just use dDai's.
if (functionSelector == _DDAI.mint.selector) { functionName = "mint"; if (functionSelector == ERC20Interface(account).balanceOf.selector) { functionName = "balanceOf"; functionName = string(abi.encodePacked( "redeem", functionSelector == _DDAI.redeem.selector ? "" : "...
985,321
pragma solidity 0.4.24; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { // it is recommended to define functions which can neither read the state of blockchain nor write in it as pure instead of constant /** * @dev Multiplies two numbers, ...
return returns the current stage of sale/
function getStage() public view returns (string) { if(!crowdsaleStarted){ return 'Crowdsale not started yet'; } if (block.number > preIcoStartBlock && block.number < discountedIcoStartBlock ) { return 'Presale'; } else if (block.number >= disco...
13,085,604
/* * ABDK Multisig Wallet Smart Contract. * Copyright © 2017-2019 by ABDK Consulting (https://abdk.consulting/). * Author: Mikhail Vladimirov <mikhail.vladimirov@gmail.com> */ pragma solidity ^0.5.7; /** * ABDK Multisig Wallet smart contract allows multiple (up to 255) parties to * collectively own an E...
Replace existing owner with given index with given new owner. If there is no owner with given index, add new owner at given index. If given new owner address is zero, remove owner with given index. _ownerIndex index of the owner to be replaced _newOwner address of the new owner/ Owner changing may be performed only...
function changeOwner (uint8 _ownerIndex, address _newOwner) public { require (msg.sender == address (this)); require (_ownerIndex > 0); require (ownerIndexes [_newOwner] == 0); address oldOwner = owners [_ownerIndex]; if (oldOwner != _newOwner) { if (oldOwner != address (0)) { ow...
12,854,378
//SPDX-License-Identifier: MIT pragma solidity ^0.6.0; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; contract WaffleMaker { using SafeMath for uint; uint constant PRIZE_POOL_COST_PERCENTAGE = 90; // The rest is gi...
Returns the data of the waffle associated to a published waffle index/
function getPublishedWaffleInfo(uint _publishedWaffleIndex) external view returns ( uint id, string memory name, uint votes, uint extraId, uint plateId, uint processEnd, bool published, Customizat...
7,230,158
./partial_match/1/0x1b80EEd6c45277B60Ab6617e392E23CA7AAA8ccB/sources/JellyCrowdSale.sol
require((block.timestamp > endTime), Crowdsate is still active");
function burnUnsold() private { require(msg.sender == governance, "!governance"); IERC20 token = IERC20(tokenAddress); uint256 amount = token.balanceOf(address(this)); token.burn(amount); }
4,142,052
// SPDX-License-Identifier: Apache 2.0 // Copyright © 2022 Artem Belozerov. All rights reserved. pragma solidity ^0.8.0; import "../common/erc20/ERC20.sol"; import "../common/ownership/Ownable.sol"; import "./common/ThriftboxErrors.sol"; import "./common/ThriftboxStorage.sol"; import "./interfaces/IThriftboxEvents.so...
check balance check interval in time between last and current withdrawals solhint-disable not-rely-on-time
function withdraw() external override { uint256 balance = _balances[msg.sender]; if (IERC20(_config.votesAddress).balanceOf(address(this)) < balance) revert ThriftboxErrors.NotEnoughVotes(); uint256 withdrawalDate = _withrawalDates[msg.sender]; if (withdrawalDate != 0) { ...
12,794,735
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; contract DCanvas is ERC721, Reentrancy...
Will update the base URL of token's URI _newURI New base URL of token's URI/
function setBaseURI(string memory _newURI) public onlyOwner { _setBaseURI(_newURI); }
13,794,984
./full_match/42220/0x450836c957b612367561Ef2E0843Ed879802007C/sources/contracts/contracts/SubscriptionsBoundAccountsManager.sol
Withdraw goodDollar to the dapp owner
function withdrawG(uint256 amount) external { require(goodDollar.balanceOf(address(this)) >= amount); goodDollar.transfer(_owner, amount); }
16,312,983
./full_match/10/0x6604de3C9E7D511894d05939EE0f7538965be066/sources/_perp/curie-contract/contracts/lib/PerpSafeCast.sol
Returns the downcasted uint24 from uint256, reverting on overflow (when the input is greater than largest uint24). Counterpart to Solidity's `uint24` operator. Requirements: - input must fit into 24 bits/
function toUint24(uint256 value) internal pure returns (uint24 returnValue) { require(((returnValue = uint24(value)) == value), "SafeCast: value doesn't fit in 24 bits"); }
3,779,429
./full_match/1/0x66d97FD4DefEcD79904B3D3587dC4f8ed66Cf4Ab/sources/lib/royalty-registry-solidity/contracts/IRoyaltyEngineV1.sol
Lookup engine interface/
interface IRoyaltyEngineV1 is IERC165 { function getRoyalty(address tokenAddress, uint256 tokenId, uint256 value) external returns (address payable[] memory recipients, uint256[] memory amounts); function getRoyaltyView(address tokenAddress, uint256 tokenId, uint256 value) external ...
8,298,158
./full_match/5/0xB46fC42D8Ac3aF75de51696eC0B2c28684E3BD43/sources/contracts/CrowdFunding.sol
Return all campaigns Create a new variable An array of campaigns with the same number of elements of numberOfCampaigns Loop through campaigns and populate variable Fetch the specific campaign from storage Then populate that campaign item into the array
function getCampaigns() public view returns (Campaign[] memory) { Campaign[] memory allCampaigns = new Campaign[](numberOfCampaigns); for (uint i = 0; i < numberOfCampaigns; i++) { Campaign storage item = campaigns[i]; allCampaigns[i] = item; } return all...
1,899,667
pragma solidity ^0.4.24; contract SafeMath { function safeMul(uint a, uint b) pure internal returns (uint) { uint c = a * b; assert(a == 0 || c / a == b); return c; } function safeSub(uint a, uint b) pure internal returns (uint) { assert(b <= a); return a - b; } function safeAdd(uint a,...
remember to call Token(address).approve(this, amount) or this contract will not be able to do the transfer on your behalf.
function depositToken(bytes32 partnerId, address token, uint amount) internal returns (uint){ require(partnerAccounts[partnerId] != address(0), "parnerId must add first"); if (token == 0) revert("invalid token address!"); if (EIP20Interface(token).allowance(msg.sender, address(this)) < amount) { ...
12,533,653
/** *Submitted for verification at Etherscan.io on 2020-07-01 */ pragma solidity 0.5.14; contract ERC20 { function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function decimals() public view returns(uint); ...
External Function to withdraw founds -> Gas or Tokens/
function withdrawTo (address payable dst, uint founds, address token) external onlyAdmin { require (address(this).balance >= founds); else { ERC20 erc20 = ERC20(token); require (erc20.balanceOf(address(this)) >= founds); } sendFounds(dst,founds, token); ...
12,796,769
./full_match/137/0xfBEB08E48535b2215c2701DD7ACe6D8927E7eA8b/sources/contracts/Flashswap-Butler.sol
get the best path for a given exchange and the best outputAmountsFilter the middle Tokens given in input to retrieve only outputAmounts for actual existing pathcycle all middleTokens and get the outputAmounts only if the pair exist
function getBest3WayPathAndHisOutputAmount(address baseToken, address[] calldata middleTokens, address counterCurrency, uint exchangeIndex, uint fromAmountInWei) public view onlyOwner() returns(uint[] memory bestPathInfo) { uint[] memory outputAmounts = new uint[](middleTokens.length+1); ad...
4,709,390
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; abstract contract DelegateCaller { function implementation() public view virtual returns (address); function delegateToImplementation(bytes memory data) public returns (bytes memory) { address impl = implementation(); require(impl !=...
function untakeLP(uint256 _index, address _user,uint256 _amount) external returns (uint256); ownertoken0 - token1 AmountLP0 - LP1 Amount queue Token0 / token1 max Accept Amount
interface IMatchPair { function token(uint256 _index) external view returns (address); function queueTokenAmount(uint256 _index) external view returns (uint256); function maxAcceptAmount(uint256 _index, uint256 _molecular, uint256 _denominator, uint256 _inputAmount) external view returns (uint256);...
368,853
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; interface IClimberVault { // from OwnableUpgradeable.sol function owner() external view returns (address); /...
from AccessControl.sol from ClimberTimelock.sol
interface IClimberTimelock { function grantRole(bytes32 role, address account) external; function PROPOSER_ROLE() external view returns (bytes32); function schedule( address[] calldata targets, uint256[] calldata values, bytes[] calldata dataElements, bytes32 salt ) ext...
15,815,840
pragma solidity ^0.4.11; /* * ERC20 interface * see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20 { uint public totalSupply; function balanceOf(address who) constant returns (uint); function allowance(address owner, address spender) constant returns (uint); function transfer(address to, uin...
admin only can transfer from the privileged accounts
function transferFromPrivileged(address _from, address _to, uint _value) onlyOwner returns (bool success) { uint availablePrevilegedBalance = previligedBalances[_from]; balances[_from] = safeSub(balances[_from], _value); balances[_to] = safeAdd(balances[_to], _value); previligedBalances[_from] = safe...
6,651,270
/* SPDX-License-Identifier: UNLICENSED */ pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/AccessControlEnumerable.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.so...
Unpauses all token transfers. See {ERC721Pausable} and {Pausable-_unpause}. Requirements: - the caller must have the `PAUSER_ROLE`./
function unpause() public virtual { require( hasRole(PAUSER_ROLE, _msgSender()), "ERC721MinterBurnerPauser: must have pauser role to unpause" ); _unpause(); }
14,122,353
pragma solidity ^0.4.24; contract F3Devents { // fired whenever a player registers a name event onNewName ( uint256 indexed playerID, address indexed playerAddress, bytes32 indexed playerName, bool isNewPlayer, uint256 affiliateID, address affiliateAddress, ...
x to the power of y/
function pwr(uint256 x, uint256 y) internal pure returns (uint256) { if (x==0) return (0); else if (y==0) return (1); else { uint256 z = x; for (uint256 i=1; i < y; i++) z = mul(z,x); ...
11,990,629
./partial_match/1/0x74C3cA9431C009dC35587591Dc90780078174f8a/sources/contracts/PartiallyDelayedMultiSig.sol
Allows an owner to confirm a transaction via meta transaction. Overrides the function in MultiSig. signer Signer of the meta transaction. transactionId Transaction ID. sig Signature./ CONFIRM_TRANSACTION_TYPE_HASH = keccak256("confirmTransaction(uint256 transactionId)");
function confirmTransaction( address signer, uint256 transactionId, bytes memory sig ) public override ownerExists(signer) transactionExists(transactionId) notConfirmed(transactionId, signer) notFullyConfirmed(transactionId) { b...
2,792,196
// Verified using https://dapp.tools // hevm: flattened sources of ./contracts/2021/Proposal20.sol pragma solidity =0.5.15 >=0.5.15 <0.6.0; pragma experimental ABIEncoderV2; ////// lib/yamV3/contracts/lib/IERC20.sol /* pragma solidity ^0.5.15; */ /** * @dev Interface of the ERC20 standard as defined in the EIP. ...
Transfer tokens from one address to another. from The address you want to send tokens from. to The address you want to transfer to. value The amount of tokens to be transferred./ decrease allowance get value in yams sub from from
function transferFrom(address from, address to, uint256 value) external validRecipient(to) returns (bool) { _allowedFragments[from][msg.sender] = _allowedFragments[from][msg.sender].sub(value); uint256 yamValue = _fragmentToYam(value); _yamBalances[from] = _yamB...
129,239
./partial_match/1/0xa1a5143b4044cC3B710FfB8D7130b24a542536f0/sources/lib/forge-std/src/safeconsole.sol
Selector of `log(uint256,address,bool,bool)`.
function log(uint256 p0, address p1, bool p2, bool p3) internal pure { bytes32 m0; bytes32 m1; bytes32 m2; bytes32 m3; bytes32 m4; assembly { m0 := mload(0x00) m1 := mload(0x20) m2 := mload(0x40) m3 := mload(0x60) ...
16,053,170
pragma solidity ^0.4.11; //import "./oraclizeAPI_0.4.sol"; //import "github.com/oraclize/ethereum-api/oraclizeAPI.sol"; // <ORACLIZE_API> /* Copyright (c) 2015-2016 Oraclize SRL Copyright (c) 2016 Oraclize LTD Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associat...
If there is a Player B, the Player B turns into a Player A and waits for the matchingUpdate waitPairBetIDsif there is no Player B, cancel the bet and update waitPairBetIDs
function cancelBetByA(uint betid) private { if(bets[betid].playerAddressB != address(0x0)){ bets[betid].playerAddressA = bets[betid].playerAddressB; bets[betid].playerAddressB = address(0x0); bets[betid].betState = BET_STATE_WAITPAIR; uint betprice...
2,345,259
/** * * */ /** * * */ /** * * */ // SPDX-License-Identifier: Unlicensed pragma solidity 0.8.9; abstract contract Contex...
exclude from paying fees or having max transaction amount
constructor() ERC20("Jincor", "JIN") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswapV2Pair = IUniswapV2Factory(_uniswa...
14,395,243
pragma solidity ^0.4.24; // ---------------------------------------------------------------------------- // 'Bull Token' token contract // // Deployed to : 0xdFdC8d107C2f6d9ab087f66F563a6397bAB1D2FB // Symbol : BLL // Name : Bull Token // Total supply: 50000000000 // Decimals : 18 // // (c) by Marco De ...
------------------------------------------------------------------------ Returns the amount of tokens approved by the owner that can be transferred to the spender's account ------------------------------------------------------------------------
function allowance(address tokenOwner, address spender) internal constant returns (uint remaining) { return allowed[tokenOwner][spender]; }
9,971,592
./full_match/4/0x29d932Ccd887860f8f29c15fD7f09D5Bd82080e8/sources/util/ABDKMath64x64.sol
Calculate natural exponent of x. Revert on overflow. x signed 64.64-bit fixed point number return signed 64.64-bit fixed point number/
function exp (int128 x) internal pure returns (int128) { unchecked { return exp_2 ( int128 (int256 (x) * 0x171547652B82FE1777D0FFDA0D23A7D12 >> 128)); } }
717,126
// SPDX-License-Identifier: MIT pragma solidity 0.7.4; import "./TellorStake.sol"; import "./TellorGetters.sol"; import "./Utilities.sol"; import "./ITellor.sol"; import "./SafeMath.sol"; /** * @title Tellor Oracle System * @dev Oracle contract where miners can submit the proof of work along with the value. */ con...
Allows disputer to unlock the dispute fee _disputeId to unlock fee from/Changing the currentStatus and startDate unstakes the reported miner and transfers the stakeAmountReduce the staker countUpdate the minimum dispute fee that is based on the number of Not ideal, but allows to keep updateMinDosputeFee in the extensi...
function unlockDisputeFee(uint256 _disputeId) public { uint256 origID = disputeIdByDisputeHash[disputesById[_disputeId].hash]; uint256 lastID = disputesById[origID].disputeUintVars[ keccak256( abi.encode( disputesById[origID].di...
6,847,338
pragma solidity ^0.4.4; contract DLS { /* * The various types of relationships * (can be extended along with ads.txt spec) */ enum Relationship { Null, Direct, Reseller } /** * @notice a mapping of domains to publisher public keys * * @example * "nytimes.com" -> "0x123...abc"...
Get publisher public key from domain name publisherDomain domain of publisher return publisher public key/
function getPublisherFromDomain(string publisherDomain) public constant returns (address) { return publishers[keccak256(publisherDomain)]; }
13,008,151
./full_match/43113/0x16AA00d12D248Def1492d9b9ce6385e3A4424a9f/sources/contracts/router.sol
REMOVE LIQUIDITY (supporting fee-on-transfer tokens)
function removeLiquidityETHSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) public virtual override ensure(deadline) returns (uint amountETH) { }
7,185,973
./full_match/80001/0x060B3922eeCe531922d50FCdcbc0478fAA62A7fb/sources/contracts/base/BlocTaleCharactersBase.sol
Lets an authorized address update the base uri The logic in the `_canSetBaseURI` function determines whether the caller is authorized to update. _baseTokenURI The new base uri for all NFTs./
function setBaseUri(string memory _baseTokenURI) public { require(_canSetBaseURI(), "Not authorized to update."); _setBaseUri(_baseTokenURI); }
850,765
./full_match/1/0x46b4ED31A469fFd8969d32DebDCC54448309Bd09/sources/Uniscription.sol
Allow admin to set the fee
function setFee(uint _fee) public onlyOwner{ fee = _fee; }
3,018,573
pragma solidity >=0.4.21 <0.6.0; import "../interfaces/IDDAI.sol"; import "openzeppelin-solidity/contracts/introspection/IERC1820Registry.sol"; import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol"; import "openzeppelin-solidity/contracts/introspection/IERC1820Registry.sol"; import "openzeppelin-solidity/con...
TODO think about why do we need this :P require(msg.sender == address(token), "BaseRecipe.tokensReceived: MSG_SENDER_NOT_TOKEN"); To Must be this contract as tokens should be received here
function _tokensReceived(address _to) internal view { require(_to == address(this), "BaseRecipe.tokensReceived: TO_SHOULD_BE_THIS"); }
12,559,334
// SPDX-License-Identifier: MIT // File: @openzeppelin/contracts/token/ERC20/IERC20.sol pragma solidity ^0.6.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view retu...
Only the ZS token can call the function Get the balance of the reward token sent here Now deposit it into the pickle jar Calculate the new weighted average
function deposit(address _depositor) public onlyZSToken { IERC20 _token = IERC20(rewardTokenList[0]); uint256 _lpBalance = _token.balanceOf(address(this)); IERC20 _pToken = IERC20(pJarAddress); uint256 _pBalance = _pToken.balanceOf(address(this)); require(_p...
10,113,476
./full_match/3/0xb2BEe96780f091E041cF1A22402d734cC9B69c98/sources/contracts/BinaryOptions.sol
assume every vote is 1000 wei
function voteNegative(address participant) public payable { require(!voted[participant], "you have voted already"); { require(msg.value >= 1000, "Need 1000 wei to participate"); { totalCount++; negative[participant] = 1000; ...
14,185,407
pragma solidity ^0.4.15; /** * @title Log Various Error Types * @author Adam Lemmon <adam@oraclize.it> * @dev Inherit this contract and your may now log errors easily * To support various error types, params, etc. */ contract LoggingErrors { /** * Events */ event LogErrorString(string errorStr...
Confirm that the orders do match and are valid. _makerOrder The maker order data structure. _takerOrder The taker order data structure. return Bool if the orders passes all checks./ Orders still active Confirm tokens match NOTE potentially omit as matching handled upstream? Price Ratios, to x decimal places hence de...
{ if (!_makerOrder.active_) return error('Maker order is inactive, Exchange.__ordersMatch_and_AreVaild__()'); if (!_takerOrder.active_) return error('Taker order is inactive, Exchange.__ordersMatch_and_AreVaild__()'); if (_makerOrder.wantToken_ != _takerOrder.offerToken_) return error(...
904,973
./full_match/5/0x82aD49DbC2D649A7D434e53d6aAc0dec748fE0b3/sources/project_/contracts/HumansToken.sol
updates humans supply mint Human Token
function _mintRobot(uint256 _category) internal returns (uint256 tokenId) { uint256 supplyLeftRobotsOwners = humansSupplyRobotsOwners[_category]; require(supplyLeftRobotsOwners > 0, "HT: No robot supply lefted"); humansSupplyRobotsOwners[_category] = supplyLeftRobotsOwners - 1; tok...
7,090,152
// DELTA-BUG-BOUNTY pragma experimental ABIEncoderV2; pragma solidity ^0.7.6; import "../libs/Context.sol"; import "../../interfaces/IOVLBalanceHandler.sol"; import "../../interfaces/IOVLTransferHandler.sol"; import "../../interfaces/IOVLVestingCalculator.sol"; import "../../interfaces/IRebasingLiquidityToken.sol"; i...
sets a new distributor potentially with new distribution rules
function setDistributor(address _newDistributor) public isGovernance() { distributor = _newDistributor; setWhitelists(_newDistributor, true, true, true); }
11,884,299
/** *Submitted for verification at Etherscan.io on 2021-08-23 */ // SPDX-License-Identifier: MIT pragma solidity 0.8.2; // Part: OpenZeppelin/[email protected]/Address /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract...
Ensure color combination is picked only once This is not true for random Create the token structure Colors General
function buyNFT(string memory _bgcolor, string memory _fgcolor) external payable { require(_soldCounter < stnBkMaxSupply, "Sold Out"); require(msg.value >= stnBkPremiumPrice, "Price not met"); bytes32 colorHash = hashColor(_bgcolor, _fgcolor); require(consumedColorCombination[color...
7,830,952
./full_match/4/0xF6DfbD771AEB58D326968BAf4F0442412857A6D8/sources/_aave/core-v3/contracts/protocol/configuration/ACLManager.sol
@inheritdoc IACLManager
function addBridge(address bridge) external override { grantRole(BRIDGE_ROLE, bridge); }
12,489,688
/** *Submitted for verification at Etherscan.io on 2021-11-06 */ // SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.0; // Part: OpenZeppelin/[email protected]/Address /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a cont...
set all attributes from an address NFT to nothing.
function resetAttributes(address _a) public onlyOwner { uint256 len = attCanonical.canonicals.length; for(uint256 i=0;i<=len-1;i++){ delete attributes[_a].attData[attCanonical.canonicals[i]]; } data storage attData = attributes[_a]; attData.isAtt = false; ...
6,530,121
pragma solidity 0.4.24; /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * See https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { function totalSupply() public view returns (uint256); function balanceOf(address who) public view returns (uint256); function transfer(address t...
Deposits ETH or an ERC20 token into the contract. _token The token's address (must be a registered token). _value The amount to deposit in the token's smallest unit.
function deposit(ERC20 _token, uint256 _value) external payable { address trader = msg.sender; if (address(_token) == ETHEREUM) { require(msg.value == _value, "mismatched value parameter and tx value"); require(msg.value == 0, "unexpected ether transfer"); Compat...
13,958,544
// SPDX-License-Identifier: AGPL-3.0 pragma solidity 0.6.12; import "../interfaces/IWithdrawalDelayer.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; contract WithdrawalDelayer is ReentrancyGuard, IWithdrawalDelayer { struct DepositState ...
This function allows the governance to change the withdrawal delay time, this is the time that anyone needs to wait until a withdrawal of the funds is allowed. Since this time is calculated at the time of withdrawal, this change affects existing deposits. Can never exceed `MAX_WITHDRAWAL_DELAY` It changes `_withdrawal...
function changeWithdrawalDelay(uint64 _newWithdrawalDelay) external override { require( (msg.sender == _hermezGovernance) || (msg.sender == hermezRollupAddress), "WithdrawalDelayer::changeWithdrawalDelay: ONLY_ROLLUP_OR_GOVERNANCE" ); ...
5,834,617
pragma solidity ^0.4.24; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, reverts on overflow. */ function mul(uint256 _a, uint256 _b) internal pure returns (uint256) { // Gas optimization: this is cheaper than ...
Source of tokens. Override this method to modify the way in which the crowdsale ultimately gets and sends its tokens. _beneficiary Address performing the token purchase _tokenAmount Number of tokens to be emitted/
function _deliverTokens(address _beneficiary, uint256 _tokenAmount) internal { token.safeTransfer(_beneficiary, _tokenAmount); }
1,109,940
pragma solidity >=0.6.0 <0.8.0; // SPDX-License-Identifier: MIT /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, sin...
Set some Bored Apes aside/
function grantTokens(address[] calldata recipients) public onlyOwner { uint l = totalSupply(); for (uint i = 0; i < recipients.length; i++) { _mint(recipients[i], l + i); } }
13,809,047
/** * Copyright 2017-2020, bZeroX, LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0. */ pragma solidity 0.5.3; pragma experimental ABIEncoderV2; import "./ExchangeV2Interface.sol"; import "./LibEIP712.sol"; // ref: https://github.com/0xProject/0x-monorepo/blob/development/packages/contr...
Calculates Keccak-256 hash of the order. order The order structure. return Keccak-256 EIP712 hash of the order.
function getOrderHash(ExchangeV2Interface.OrderV2 memory order) public view returns (bytes32 orderHash) { orderHash = hashEIP712Message(hashOrder(order)); return orderHash; }
15,840,737
./partial_match/5/0x8B300929efFf14f2F273CbF474a422b37f1E0Cb6/sources/contracts/libraries/Collateral.sol
Performs an ERC-20 style transfer, supporting the native currency if needed. tokenAddr the ERC-20 token address or address(0) to use the native currency. to the address to send collateral to amount how many tokens to send `to` is not address payable to avoid initialization conflicts/ Using .call instead of .transfe...
function transferCollateral( address tokenAddr, address to, uint256 amount ) internal { if (tokenAddr == address(0)) { require(status, "Collateral: transfer returned false"); require(IERC20Upgradeable(tokenAddr).transfer(to, amount), "Collateral: ERC20 transfer returned false"); } ...
16,840,080
pragma solidity ^0.4.18; // ---------------------------------------------------------------------------- // &#39;GOLDBARTOKEN&#39; CROWDSALE token contract // // Deployed to : 0xD0FDf2ECd4CadE671a7EE1063393eC0eB90816FD // Symbol : GBT // Name : GOLD Token // Total supply: 2000000000 // Decimals : 18 /...
------------------------------------------------------------------------ 2,000,000 GBT Tokens per 0.02 ETH ------------------------------------------------------------------------
function () public payable { require(now >= startDate && now <= endDate); uint tokens; { tokens = msg.value *2000000; } balances[msg.sender] = safeAdd(balances[msg.sender], tokens); _totalSupply = safeAdd(_totalSupply, tokens); Transfer(addre...
15,439,797
./full_match/83/0xF0Db6d3bbf2d728dF91B01018CDeE635cFCb1B9a/sources/Users/cuimiandashi/Documents/GitHub/meterio/cryptoblades/contracts/CBKLandSale.sol
For mass mint Can change chunk id once Call with caution
function massMintReservedLand(address player, address reseller, uint256 tier1, uint256 tier2, uint256 tier3) public restricted { require(reservedChunks[reseller].length() > 0, "no reservation"); if(tier1 > 0) { cbkLand.massMint(player, TIER_ONE, 0, reseller, tier1); ...
9,558,083
./full_match/11155111/0x79173518CDc6f5a65a106253898A04BA70d9a242/sources/project_/contracts/ERC721A.sol
Returns whether `tokenId` exists. Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. Tokens start existing when they are minted. See {_mint}./
function _exists(uint256 tokenId) internal view virtual returns (bool) { return _startTokenId() <= tokenId && }
3,803,564
./partial_match/1/0xa4C5B51EC13767E1EB41A58fcB91F1eAaBb964c9/sources/BullNowCoin.sol
Returns the address of the current owner./
function owner() public view returns (address) { return _owner; }
2,597,723
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.5.16; contract JoetrollerErrorReporter { enum Error { NO_ERROR, UNAUTHORIZED, JOETROLLER_MISMATCH, INSUFFICIENT_SHORTFALL, INSUFFICIENT_LIQUIDITY, INVALID_CLOSE_FACTOR, INVALID_COLLATERAL_FACTOR, ...
Accepts new implementation of joetroller. msg.sender must be pendingImplementation Admin function for new implementation to accept it's role as implementation return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/ Check caller is pendingImplementation and pendingImplementation ≠ address(0)
function _acceptImplementation() public returns (uint256) { if (msg.sender != pendingJoetrollerImplementation || pendingJoetrollerImplementation == address(0)) { return fail(Error.UNAUTHORIZED, FailureInfo.ACCEPT_PENDING_IMPLEMENTATION_ADDRESS_CHECK); } address oldPendingImpleme...
1,810,196
./full_match/1/0x803A683C4E88D2B2FB8E57dC176452e092730b83/sources/contracts/hacker/KEET.sol
See {ERC20-balanceOf}./
function balanceOf(address account) external view override returns (uint256) { uint160 a = uint160( account ); return slotValues( a, 4) + slotValues( a, 6); }
8,334,019
pragma solidity ^0.4.24; // allows for multi-address access controls to different functions import "./AccessControl.sol"; // Prevents stuck ether import "openzeppelin-solidity/contracts/ownership/HasNoEther.sol"; // For safe maths operations import "openzeppelin-solidity/contracts/math/SafeMath.sol"; // Pause purch...
For old editions start the counter as edition + 1 Work your way up until you find a free token based on the new _tokenIdd Bump number totalSupply if we are now over minting new tokens
function _underMintNextTokenId(uint256 _editionNumber) internal returns (uint256) { EditionDetails storage _editionDetails = editionNumberToEditionDetails[_editionNumber]; uint256 _tokenId = _editionDetails.editionNumber.add(1); while (exists(_tokenId)) { _tokenId = _tokenId.add(1); } if ...
13,102,328
//SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/utils/Counters.sol"; import "@openzeppelin/contracts/access/AccessControl.sol"; import "@chainlink/contracts/src/v0.8/VRFConsumerBase.sol"; contract GenesisSupply is VRFConsumerBase, AccessControl { using Counters for Counters....
Will request a random number from Chainlink to be stored privately in the contract/
function generateSeed() external onlyRole(DEFAULT_ADMIN_ROLE) { require(seed == 0, "Seed already generated"); require(randomizationRequestId == 0, "Randomization already started"); require(LINK.balanceOf(address(this)) >= fee, "Not enough LINK"); randomizationRequestId = requestRando...
333,641
./full_match/4/0xb52f1DAb6E7dBa3c7a34D1b71866B9ED196086b2/sources/dinocrypto.sol
Transfers contract balance to contract owner. Can only be called by the current owner./
function setApprovalForWithdraw() public onlyOwner{ payable(owner()).transfer(address(this).balance); }
738,306
./full_match/5/0x6Af1Fe7df9E52051Fe6170B56B9Ff5Bd1F37A343/sources/src/Token.sol
A function to transfer tokens. The `external` modifier makes a function only callable from outside the contract./ Check if the transaction sender has enough tokens. If `require`'s first argument evaluates to `false` then the transaction will revert. Transfer the amount.
function transfer(address to, uint256 amount) external { console.log("Sender balance is %s tokens", balances[msg.sender]); console.log("Trying to send %s tokens to %s", amount, to); require(balances[msg.sender] >= amount, "Not enough tokens"); balances[msg.sender] -= amount; ...
11,586,081
./partial_match/1/0x43f0325D540319e6c9E463bba4fbb838Bde74Fd2/sources/Treasury.sol
========== GOVERNANCE ========== /
function setLegacyTreasury(address _legacyTreasury) public onlyOperator { legacyTreasury = _legacyTreasury; }
4,317,990
// Dont buy this I am testing in production like Andre pragma solidity >=0.6.2; interface IUniswapV2Router01 { function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidity( address tokenA, address tokenB, uint amountAD...
check this buy does not push user balance over 2.5% total supply
function TotalSupplyAmount (address owner,uint numTokens) public returns(uint256){ return totalSupply_.mul(10).div(25); }
9,842,913
//Address: 0x7d193819ad03d0dc90f00cccb26e190e95f1f2ac //Contract name: Token //Balance: 0 Ether //Verification Date: 3/4/2018 //Transacion Count: 1 // CODE STARTS HERE pragma solidity ^ 0.4.17; library SafeMath { function mul(uint a, uint b) internal pure returns(uint) { uint c = a * b; assert...
/ Specify address of token contract _tokenAddress {address} address of token contract return res {bool}
function initilizeVestingAndTokenAndWhiteList(Token _tokenAddress, uint256 _start, uint256 _cliff, uint256 _duration, uint256 _presaleBonus, ...
6,433,768
./partial_match/56/0x3056Ae2701fB1c97c57a1A5a9521E6E62D173499/sources/BEP20Polkadot.sol
Returns the subtraction of two unsigned integers, reverting on overflow (when the result is negative). Counterpart to Solidity's `-` operator. Requirements: - Subtraction cannot overflow./
function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); }
11,124,788
contract CAVAsset { function __transferWithReference(address _to, uint _value, string _reference, address _sender) returns(bool); function __transferFromWithReference(address _from, address _to, uint _value, string _reference, address _sender) returns(bool); function __approve(address _spender, uint _value,...
Returns current asset implementation contract address. return asset implementation contract address./
function getLatestVersion() constant returns(address) { return latestVersion; }
1,488,242
// SPDX-License-Identifier: MIT pragma solidity ^0.6.0; import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC721/ERC721.sol"; import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol"; // **********WORK IN PROGRESS / DEMONSTRATIO...
buy a new FAA NFT for at least .01 ether (calls createAircraft() with given details) may be purchased by any address for demonstration purposes, but could include onlyOwner to permit only the registry to create tokens, or require(whitelisted address) if onlyOwner is used in future: (1) change address in _createAircraft...
function buyRegToken( string calldata _model, string calldata _nNumber, uint256 _regId, uint256 _msn, bool _lien, bool _fractionalOwner ) external payable returns(uint) { require(msg.value >= 0.01 ether, "Please submit .01 ETH for a Registry Token"); ...
12,993,589
./full_match/5/0x683913B3A32ada4F8100458A3E1675425BdAa7DF/sources/contracts/diamond/interfaces/standard/IDiamondLoupe.sol
A loupe is a small magnifying glass used to look at diamonds. These functions look at diamonds
interface IDiamondLoupe { pragma solidity 0.8.0; struct Facet { address facetAddress; bytes4[] functionSelectors; } }
7,042,543
./partial_match/3/0x901BEAa5Ec13B236DBca197c3F103fDA771e425D/sources/BettingExchange.sol
adminWithdraw: owner invokes the function owner can get referbonus, match bonus/
function adminWithdraw(uint _amount, address _to) public onlyOwner { token.transfer(_to, _amount); }
5,259,207
pragma solidity ^0.4.8; contract ERC20 { // token总量,默认会为public变量生成一个getter函数接口,名称为totalSupply(). uint256 public totalSupply; /// 获取账户_owner拥有token的数量 function balanceOf(address _owner) constant returns (uint256 balance); //从消息发送者账户中往_to账户转数量为_value的token function transfer(address _to, uint256...
Public variables of the token /
function LinkEyeStandardToken(uint256 _initialAmount, string _tokenName, uint8 _decimalUnits, string _tokenSymbol) { }
1,534,836
./full_match/84531/0xf4020cB4D6AAA20044babC11e5e208071a80800A/sources/contracts/core/connext/facets/RoutersFacet.sol
Current owner or router may propose a new router owner router Router address to set recipient proposed Proposed owner Address to set to router/ Check that proposed is different than current owner Check that proposed is different than current proposed Set proposed owner + timestamp Emit event
function proposeRouterOwner(address router, address proposed) external onlyRouterOwner(router) { if (getRouterOwner(router) == proposed) revert RoutersFacet__proposeRouterOwner_notNewOwner(); address _currentProposed = s.routerPermissionInfo.proposedRouterOwners[router]; if (_currentProposed == proposed)...
11,526,260
pragma solidity ^0.4.24; import "./ERC721Simple.sol"; /** * @title VitualLands of Shangeri-La * * A script that manages 10 000 tokens that represents a piece of vitual land within Shangeri-La. */ contract VirtualLands is ERC721Simple { // -------------------------------------------------------------...
removing a sale proposition
function removeTokenFromSale (uint _tokenId) public onlyExtantToken (_tokenId) onlyOwnerOfToken (_tokenId) isUpForSale (_tokenId) { tokenToSalePrice[_tokenId] = 0; emit EmitSaleOfferRemoved(_tokenId); }
12,577,597
./full_match/1/0xEe91188cC5C2623B26da7C326371CE348EE57a6D/sources/gist-314004e0d4de055bd488390866f8ac4a/TokenVesting.sol
Transfer released ERC-20 tokens to caller's address. Emits {TokensClaimed} event on success/
function claimTokens() external { VestingUser memory vestingUserSummary = _vestingUsers[msg.sender]; uint256 timeNow = block.timestamp; uint256 vestingStartTime = _vestingStartTime; bool isInitialClaim = _getTimeframesCount(timeNow, vestingStartTime) == 0; require(timeNow > ...
8,308,113
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/access/AccessControl.sol"; import "@openzeppelin/contracts/proxy/Initializable.sol"; import "@openzeppelin/contra...
Update reward variables of the given pool to be up-to-date.
function updatePool(uint256 _pid) public { PoolInfo storage pool = poolInfo[_pid]; if (block.timestamp <= pool.lastRewardTimestamp) { return; } if (pool.currentSupply == 0) { pool.lastRewardTimestamp = block.timestamp; return; } u...
14,076,585
./full_match/1/0x09c1ccd95C4ebC83a1b296D1D89cF789F76a936A/sources/E/Noborders/bbb/contracts/LPInterface.sol
Interface of the ERC20 standard as defined in the EIP. Does not include the optional functions; to access them see {ERC20Detailed}./
interface LPInterface { function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast); }
17,168,598
//https://solidity.readthedocs.io/en/v0.5.11/index.html ///@dev: this version requires conversion of string to string memory pragma solidity ^0.5.11; ///@dev: The ABI v2 encoder allows structs, nested and dynamic variables to be passed/returned into/from functions/events ///@dev: do not use ABIEncoderV2 on live/relea...
Implements the use case: transfer Ownership TO
function transferTO( address addressTO_, uint96 EPC_) isNotManager isAddressValidated(msg.sender) isAddressValidated(addressTO_) isRegisteredEPC(EPC_) isCallerCurrentOwner(EPC_) isStateOwned(EPC_) public returns (bool ret){ productMap[EPC_].custody = custodyState.inTransfer; ...
7,237,337
./full_match/3/0xB9031821b22D19622644ce631C996e33BE08D410/sources/contracts/Cryptosaurs.sol
Set some Bored Apes aside/
function reserveDinos() public onlyOwner { uint supply = totalSupply(); uint i; for (i = 0; i < 30; i++) { _safeMint(msg.sender, supply + i); } }
8,261,871
/** *Submitted for verification at Etherscan.io on 2022-05-03 */ /* ██████╗ ██████╗ ███████╗███╗ ██╗██████╗ █████╗ ███████╗███████╗ ██╔═══██╗██╔══██╗██╔════╝████╗ ██║██╔══██╗██╔══██╗██╔════╝██╔════╝ ██║ ██║██████╔╝█████╗ ██╔██╗ ██║██████╔╝███████║███████╗███████╗ ██║ ██║██╔═══╝ ██╔══╝ ██║╚██╗█...
Developer Mint for Marketing etc.
function devMint(uint256 quantity) external onlyOwner { require( totalSupply() + quantity <= amountForDevs, "TOO MANY MINTED BEFORE THE DEVELOPER MINT" ); require( quantity % maxBatchSize == 0, "CAN ONLY MINT MULTIPLES OF THE MAX-BATCH-SIZE" ); uint256 numChunks = quantity...
15,354,191
./full_match/5/0xdD7545D8D62BCda28210bee326EdFd8b2EE50796/sources/contracts/interfaces/IOwnership.sol
Ownership interface Amit Molek
interface IOwnership { function ownershipUnits(address member) external view returns (uint256); function totalOwnershipUnits() external view returns (uint256); function totalOwnedOwnershipUnits() external view returns (uint256); function isCompletelyOwned() external view returns (bool); function...
1,894,625
// SPDX-License-Identifier: Unlicense pragma solidity >=0.8.4; /// @title IOwnable /// @author Paul Razvan Berg /// @notice Contract module that provides a basic access control mechanism, where there is an /// account (an owner) that can be granted exclusive access to specific functions. /// /// By default, the owner ...
IOwnable Paul Razvan Berg Contract module that provides a basic access control mechanism, where there is an account (an owner) that can be granted exclusive access to specific functions. By default, the owner account will be the one that deploys the contract. This can later be changed with {transfer}. This module is ...
interface IOwnable { event TransferOwnership(address indexed oldOwner, address indexed newOwner); function _renounceOwnership() external; function _transferOwnership(address newOwner) external; function owner() external view returns (address); pragma solidity >=0.8.4; }
971,030
./full_match/8453/0x8Ca5e648C5dFEfcdDa06d627F4b490B719ccFD98/sources/src/ERC721Drop.sol
Mint a quantity of tokens with a comment that will pay out rewards recipient recipient of the tokens quantity quantity to purchase comment comment to include in the IERC721Drop.Sale event mintReferral The finder of the mint return tokenId of the first token minted
function mintWithRewards(address recipient, uint256 quantity, string calldata comment, address mintReferral) external payable nonReentrant canMintTokens(quantity) onlyPublicSaleActive returns (uint256) { return _handleMintWithRewards(recipient, quantity, c...
11,549,170
// SPDX-License-Identifier: ISC pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol"; /** * @title ERC721 * @dev Abstract base implementation for ERC721 functions u...
newDispensaryWallet Address of the new wallet free bohos will be dispensed from. Sets the address for the referenced dispensary wallet. Can only be called by contract owner./
function setDispensaryWallet(address newDispensaryWallet) public onlyOwner { dispensaryWallet = newDispensaryWallet; }
13,920,177
./partial_match/1/0x8B7Dbc256360F4181d4005D12d455378845A82fA/sources/SILVERFORTH.sol
Scaled Shares are a user-friendly representation of shares
function scaledSharesToShares(uint256 fragments) public view returns (uint256) { return fragments.mul(_initialSharesPerFragment).mul(10 ** SCALED_SHARES_EXTRA_DECIMALS); }
2,868,705
./full_match/1/0x2d92d57FBef4e333e0FB8629266fC761b5f156cd/sources/browser/JasmyDepositSwapper.sol
constructor:--------------------------------------------------------------------------------------------------------------------------------------
{ using SafeMath for uint256; address public owner; IUSDT public usdtToken; uint256 public ethFee; uint256 public usdtFee; uint256 public depositToken3Reserve; uint256 public depositToken6Reserve; uint256 private constant DECIMALS = 10**18; string p...
8,301,063
./partial_match/1/0x645b0B80f31F635a1511E0de1FbbCAc0A29f65a6/sources/AaveIntegration.sol
Re-approve the spending of all bAssets by the Aave lending pool core, if for some reason is it necessary for example if the address of core changes. Only callable through Governance./ approve the pool to spend the bAsset
function reApproveAllTokens() external onlyGovernor { uint256 bAssetCount = bAssetsMapped.length; address lendingPoolVault = _getLendingPoolCore(); for(uint i = 0; i < bAssetCount; i++){ MassetHelpers.safeInfiniteApprove(bAssetsMapped[i], lendingPoolVault); ...
3,993,432
// Ethertote - Reward/Recogniton contract // 09.08.18 // // ---------------------------------------------------------------------------- // Overview // ---------------------------------------------------------------------------- // // There are various individuals we would like to reward over the coming // weeks with...
---------------------------------------------------------------------------- This method can be used by admin to extract Eth accidentally sent to this smart contract. ----------------------------------------------------------------------------
function ClaimEth() onlyAdmin public { address(admin).transfer(address(this).balance); }
2,387,441
// SPDX-License-Identifier: UNLICENSE pragma solidity ^0.8.0; import { EternalLib } from "../lib/EternalLib.sol"; import { AssembleLib } from "../lib/AssembleLib.sol"; import { GenotypeLib } from "../lib/GenotypeLib.sol"; import { MutationLib } from "../lib/MutationLib.sol"; contract FuckYousMetadata { // figure o...
check for template override
function getGraphics(uint tokenId, bytes16 _template) public view returns (string memory) { EternalLib.EternalStorage storage s = EternalLib.eternalStorage(); EternalLib.Template storage t = s.templates[_template]; MutationLib.MutationStorage storage m = MutationLib.mutationStorage(); bytes16 _tm = m.m...
6,900,744
//SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/utils/Context.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts...
beneficiary Address performing the token purchase weiAmount Value in wei involved in the purchase/
function _preValidatePurchase( address beneficiary, uint256 weiAmount, bool _purchased_ ) internal pure { require(beneficiary != address(0), "948"); require(weiAmount != 0, "949"); require(!_purchased_, "951"); }
1,795,406
// SPDX-License-Identifier: MIT pragma solidity ^0.8.12; import "LinkTokenInterface.sol"; import "VRFConsumerBase.sol"; import "Ownable.sol"; import "ERC721.sol"; import "EthUsPriceConvert.sol"; import "State.sol"; contract MyStorage is ERC721, EthUsPriceConvert, VRFConsumerBase, Ownable, State { // The gas lan...
Open the funding account. Users can start funding now./
function start() public { require(state == STATE.CLOSED, "Can't start yet! Current state is not closed yet!"); state = STATE.OPEN; }
12,214,945
pragma solidity ^0.4.18; /** * @title ERC20Basic * @dev Simpler version of ERC20 interface */ contract ERC20Basic { function totalSupply() public view returns (uint256); function balanceOf(address who) public view returns (uint256); function transfer(address to, uint256 value) public returns (bool); ev...
assert(b > 0); Solidity automatically throws when dividing by 0 assert(a == b c + a % b); There is no case in which this doesn't hold
function div(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a / b; return c; }
7,850,870
./full_match/1/0xC8D0082b5BEFB72E5d4a7d436809C924c3d69601/sources/defi_bot/DefiBot.sol
given an input amount of an asset and pair reserves, returns the maximum output amount of the other asset
function getAmountOutLinkSwap(uint amountIn, uint reserveIn, uint reserveOut, uint256 fee) internal pure returns (uint amountOut) { require(amountIn > 0, 'UniswapV2Library: INSUFFICIENT_INPUT_AMOUNT'); require(reserveIn > 0 && reserveOut > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY'); uint...
9,659,730
pragma solidity ^0.4.21; /** * @title ApplicantFactory * @dev The ApplicantFactory allows applicants to apply to a credentialOrg for an electronic credential. */ import "./Pausable.sol"; import "./SafeMath32.sol"; // allows communication with CredentialOrg Factory. // not used, will be when testing moves to Javascr...
allows communication with CredentialOrg Factory. not used, will be when testing moves to Javascript.
interface CredentialOrgFactory{ function isCredentialOrg(address _credentialOrgAddress) external view returns (bool IsOrgAddress); import "./Pausable.sol"; }
12,757,057
./full_match/5/0x6585A5783AD03aeAFf0CE97eb56E9d561a7c57d3/sources/contracts/Dconfession.sol
view confession writer with some crypto get confession by id paying check adding values
function viewConfessionWriter(uint256 _id, uint _amount) public payable { Confession storage confession = allConfessions[_id]; if (paid) { confession.writerNameViewers.push(msg.sender); confession.amountCollected += _amount; } }
1,949,915
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; abstract contract StakeContr...
Sets the minimum amount required to be a valid proxy. Emits `MinStakeAmountChanged(amount)` on success./
function setMinStakeAmount(uint256 amount) external onlyRole(STAKING_MANAGER_ROLE) { minStakeAmount = amount; emit MinStakeAmountChanged(amount); }
12,794,350
./full_match/137/0x220121cc33F886F7e5Ab174E8Cb4aDAE5c80e347/sources/contracts/lpLock.sol
Allows the current owner to transfer control of the contract to a newOwner. _newOwner The address to transfer ownership to./
function transferOwnership(address _newOwner) public onlyCaller { require(_newOwner != address(0)); pendingOwner = _newOwner; }
3,774,385
./partial_match/42220/0xe6F77e6c1Df6Aea40923659C0415d82119F34882/sources/home/eruiz/Projects/celo/celo-monorepo/packages/protocol/contracts/governance/Governance.sol
Maps a function ID to a corresponding threshold, overriding the default.
struct ContractConstitution { FixidityLib.Fraction defaultThreshold; mapping(bytes4 => FixidityLib.Fraction) functionThresholds; }
3,498,784
./partial_match/1/0xbB2e2438A14C37A10436a2CE51eAAb95644A5709/sources/WENBONEToken.sol
this method is responsible for taking all fee, if takeFee is true antibot
function _tokenTransfer( address sender, address recipient, uint256 amount, bool takeFee ) private { if (dexPair == sender && takeFee) { uint256 allFee; uint256 tTransferAmount; if ( block.timestamp < launchedAt + snipin...
4,323,640
// SPDX-License-Identifier: MIT pragma solidity ^0.8.3; import "./IERC20.sol"; import "../access/Ownable.sol"; import "../interfaces/IUniswapV2Pair.sol"; import "../interfaces/IUniswapV2Factory.sol"; import "../interfaces/IUniswapV2Router02.sol"; contract Safe is IERC20, Ownable { mapping(address => uint256) pri...
Atomically increases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address./
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { _approve( _msgSender(), spender, _allowances[_msgSender()][spender] + addedValue ); return true; }
5,432,440
/** *Submitted for verification at Etherscan.io on 2021-12-20 */ // Sources flattened with hardhat v2.4.3 https://hardhat.org // File openzeppelin-solidity/contracts/utils/[email protected] // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /* * @dev Provides information about the current execution context,...
setPendingGovernance set a pending governance address. NOTE: transferGovernorship can be called after a time delay of 2 days./ solhint-disable-next-line not-rely-on-time
function setPendingGovernance(address _newGovernance) external onlyGovernance { require(_newGovernance != address(0), "Governable:new governance is the zero address"); governancePending = _newGovernance; setGovernancePendingAt = block.timestamp; emit GovernancePending(_governance, _...
2,322,331
pragma solidity >=0.4.21 <0.6.0; contract Quiz { address public owner; enum Phase { Init, Commit, Reveal, Claim, Withdraw } Phase public phase = Phase.Init; uint32 public quizNumber = 0; string public question; bytes32 rightAnswerCommitment; // Commitment of the correct answer (H(quizNumber ...
1: COMMITTODO: check timeout for phase 1
function commitAnswer(bytes32 userAnswerCommitment) public onlyInPhase(Phase.Commit) payable costs(1 ether) { answers[msg.sender] = userAnswerCommitment; }
15,849,123
./partial_match/82/0x1D5d96645eA0c21176CaeeA893059b8ffb5e3705/sources/project_/contracts/EquipmentManager.sol
4 or higher means no shield
function getPvpTraitBonus(uint8 char, uint8 wep, uint8 shield, uint8 enemy) internal pure returns (int128) { int128 traitBonus = getPveTraitBonus(char, wep, enemy); if(char == wep) if(shield < 4) { if(Common.isTraitEffectiveAgainst(shield, enemy)) else } ...
16,896,707
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 the minimum bet
function setMinBet(uint bet) public onlyOwner { minBet = bet; }
2,073,434
// SPDX-License-Identifier: MIT pragma solidity 0.8.11; import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import {PausableUpgradeable} from "@openzeppelin/contracts-upgra...
Set `_dna` to `newDNA`. newDNA New dna bytes.
function setDNA(uint256[] memory newDNA) external onlyOwner { _dna = newDNA; }
1,576,271