file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
./full_match/80001/0x53597d6fc27247d3f36BB4A41dDa7b30527A1b9b/sources/contracts/Crowdfunding.sol
Claim a campaign. Contract Admin or Campaign Creator can apply. _campaignId Campaign ID. Send the funds to the campaign creator. Send the fee to the contract owner (the platform).
function claimCampaign(uint _campaignId) external { Campaign storage campaign = campaigns[_campaignId]; require(campaign.status == 0, "Campaign is not active"); require(campaign.creator == msg.sender || hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "Caller is not the campaign creator or admin"); ...
5,673,298
./partial_match/8453/0xD65Abd7014B638e4b9b8657063389Eb1abB9689a/sources/contracts/enforcer/HolographRoyalties.sol
Show the wallets and percentages of payout recipients. These are the recipients that will be getting royalty payouts. return addresses An array of all the addresses that will be receiving royalty payouts. return bps An array of the percentages that each address will receive from the royalty payouts./
function getPayoutInfo() public view returns (address payable[] memory addresses, uint256[] memory bps) { addresses = _getPayoutAddresses(); bps = _getPayoutBps(); }
16,799,329
./full_match/42/0x99743a2dF45bE75832c083e0d0644BF2E9F0a0C1/sources/contracts/mimic/SocialHub.sol
Checks if the contract is deprecated Checks that the successor is a zero address or not, and if false, throw error Deprecated(successor); _revertIfDeprecated true to revert if the hub is deprecated, otherwise return true return true if deprecated, false if not deprecated
function _deprecatedCheck(bool _revertIfDeprecated) internal view returns(bool) { if(successor != address(0) && _revertIfDeprecated) revert Deprecated(successor); return successor != address(0); }
9,595,148
./partial_match/1/0xe300C0DBDd784Cc2CD1A86b2126Fc95629389F91/sources/contracts/modules/credit/SpigotedLine.sol
see ISpigotedLine.claimAndTrade
function claimAndTrade( address claimToken, bytes calldata zeroExTradeData ) external whileBorrowing nonReentrant returns (uint256) { if (msg.sender != arbiter) { revert CallerAccessDenied(); } address targetToken = credits[ids[0]].token; uint256 newT...
15,654,150
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; ///////////////////////////////////////////////////////////////////////////////////////////////////// // // // ...
See {IAdminControl-getAdmins}./
function getAdmins() external view override returns (address[] memory admins) { admins = new address[](_admins.length()); for (uint256 i = 0; i < _admins.length(); i++) { admins[i] = _admins.at(i); } return admins; }
1,513,099
pragma solidity ^0.4.19; // /* CONTRACT */ contract SafeMath { function safeAdd(uint a, uint b) internal pure returns (uint c) { c = a + b; require(c >= a); } function safeSub(uint a, uint b) internal pure returns (uint c) { require(b <= a); c = a - b; } function saf...
_________________________________________________________ Allows to receive coins from Contract Share approved by contract to receive the share, it has to be already approved by the contract the share Id will be provided by contract while payments are made through other channels like paypal amountOfCoinsToRecei...
function receiveICOcoins( uint256 amountOfCoinsToReceive, uint ShrID ) public returns (bool success){ msgSndr[msg.sender] = amountOfCoinsToReceive; ICO ico = ICO( _getIcoAddr() ); bool icosuccess; icosuccess = ico.recvShrICO(msg.sender, amountOfCoinsToReceive, ShrID ); r...
7,901,606
pragma solidity ^0.4.18; /* Game Name: WallCryptoStreet Game Link: https://wallcryptostreet.net/ Rules: - Players can purchase companies and sell shares & ads to the other players. - Company owners receive a commission of 80% for the initial sell of their shares and 10% on consecutive sales. - When a company...
This function will return the details of a share
function getShare(uint _shareId) public view returns ( uint companyId, address ownerAddress, uint256 curPrice ) { Share storage _share = shares[_shareId]; companyId = _share.companyId; ownerAddress = _share.ownerAddress; curPrice = _share.curPrice; } ...
12,710,053
pragma solidity 0.5.7; pragma experimental ABIEncoderV2; /** * @title ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ interface IERC20 { function transfer(address to, uint256 value) external returns (bool); function approve(address spender, uint256 value) external retur...
Multiplies two unsigned integers, reverts on overflow./ Gas optimization: this is cheaper than requiring 'a' not being zero, but the benefit is lost if 'b' is also tested. See: https:github.com/OpenZeppelin/openzeppelin-solidity/pull/522
function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath::mul: Integer overflow"); return c; }
1,773,230
pragma solidity ^0.4.24; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "openzeppelin-solidity/contracts/ownership/Claimable.sol"; import "openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol"; /** * @title ZCDistribution * * Used to distribute rewards to consumers * * (c) Philip Louw ...
Returns the Amount of tokens issued to consumers/
function getSentAmount() external view returns (uint256) { return dropAmount; }
6,420,055
./full_match/5/0xbb5AFCB302218EE9E86766b1DCb9bAcB89ab260E/sources/contracts/VerifyingPaymaster.sol
payment validation: check if paymaster agrees to pay. Must verify sender is the entryPoint. Revert to reject this request. Note that bundlers will reject this method if it changes the state, unless the paymaster is trusted (whitelisted) The paymaster pre-pays using its deposit, and receive back a refund after the postO...
interface IAggregator { function validateSignatures(UserOperation[] calldata userOps, bytes calldata signature) external view; function validateUserOpSignature(UserOperation calldata userOp) external view returns (bytes memory sigForUserOp); function aggregateSignatures(UserOperation[] calldata userO...
1,876,990
./partial_match/1/0xC0205e203F423Bcd8B2a4d6f8C8A154b0Aa60F19/sources/ConverterRegistry.sol
checks if a liquidity pool with given configuration is already registered _converter converter with specific configuration return if a liquidity pool with the same configuration is already registered/ get the reserve-configuration of the converter
function isSimilarLiquidityPoolRegistered(IConverter _converter) public view returns (bool) { uint256 reserveTokenCount = _converter.connectorTokenCount(); IERC20Token[] memory reserveTokens = new IERC20Token[](reserveTokenCount); uint32[] memory reserveWeights = new uint32[](reserveTokenCou...
3,607,134
./partial_match/1/0xc7D7E731d6bf9182701096adCd5bba3bb0CF76fc/sources/DrillLuckyBox.sol
This method can be used by the controller to extract mistakenly sent tokens to this contract. _token The address of the token contract that you want to recover set to 0 in case you want to extract ether.
function claimTokens(address _token) public auth { if (_token == address(0)) { _makePayable(owner).transfer(address(this).balance); return; } IERC20 token = IERC20(_token); uint256 balance = token.balanceOf(address(this)); token.transfer(owner, balance); emit ClaimedTokens(_token, owner, balance); }...
2,834,686
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, s...
See {IERC721-isApprovedForAll}./
function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return false; }
14,870,684
// SPDX-License-Identifier: MIT pragma solidity ^0.6.12; import "library.sol"; /** * @title Implementation of the {IERC20} interface. * @dev defines a dynamically generated ERC20-compliant option contract with given expiry date */ contract Option is Context, IOption { using SafeMath for uint256; /// @dev...
Moves tokens `amount` from `sender` to `recipient`. This is internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `sender` cannot be the zero address. - `recipient` cannot be the zero address. - `sender`...
function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); ...
15,832,602
./full_match/56/0x1eC36A45eAcC34c1B164FFe1D2Ad3033720D8301/sources/contracts/token/VAB.sol
Inspired by OraclizeAPI's implementation - MIT licence https:github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
function uint2str(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digi...
3,233,965
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <=0.8.4; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "../interface/ITroyNFTFactory.sol"; import "../interface/IGegoRuleProxy.sol"; import "../library/Gover...
Interface of the ERC20 standard as defined in the EIP. Does not include the optional functions; to access them see {ERC20Detailed}./
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 mint(address account, uint amount) external; function allowance(add...
12,099,144
./partial_match/42/0x4bFC316ef8DD911f5b2DCE9456b52bbA27034fB7/sources/Exchange.sol
Swap your quote asset to base asset, the impact of the price MUST be less than `fluctuationLimitRatio` Only clearingHouse can call this function _dir ADD_TO_AMM for long, REMOVE_FROM_AMM for short _quoteAssetAmount quote asset amount _baseAssetAmountLimit minimum base asset amount expected to get to prevent front r...
function swapInput( Dir _dir, Decimal.decimal calldata _quoteAssetAmount, Decimal.decimal calldata _baseAssetAmountLimit ) external override onlyOpen onlyCounterParty returns (Decimal.decimal memory) { if (_quoteAssetAmount.toUint() == 0) { return Decimal.zero(); ...
3,330,770
// SPDX-License-Identifier: MIT pragma solidity 0.8.10; /******************************************/ /* IERC20 starts here */ /******************************************/ // File: @openzeppelin/contracts/token/ERC20/IERC20.sol /** * @dev Interface of the ERC20 standard as defined in the EIP. *...
Mint new BEND./
function mintBend(address _to, uint256 _amount) external onlyMinter { _mint(_to, _amount); emit BendMinted(_to, _amount); }
9,971,031
//SPDX-License-Identifier: Unlicense pragma solidity ^0.8.4; // _____ __ .___ _____ .__ .__ // / _ \__ _ _| | ____ _ _______ _______ __| _// _ \ | | |__| ____ ____ ______ // / /_\ \ \/ \/ / |/ /\ \/ \/ /\__ \\_ __ \/ __ |/ /_\ \|...
OWNER ONLY EXTERNAL VIEW EVENTS
interface IDropspaceSale { function toggleSaleActive() external; function togglePresaleActive() external; function setBaseURI(string memory _baseURI) external; function setWithdrawalWallet(address payable _withdrawalWallet) external; function setDevWallet(address payable _devWallet) external; fu...
13,623,067
./full_match/1/0x83364B932E01057dd8963b50eF868a76654d0CC7/sources/contracts/SpiderUnleashed.sol
force Swap back if slippage issues.
function forceSwapBack() external onlyOwner { require(balanceOf(address(this)) >= swapTokensAtAmount, "Can only swap when token amount is at or higher than restriction"); swapping = true; swapBack(); swapping = false; emit OwnerForcedSwapBack(block.timestamp); }
3,099,411
./full_match/42/0x6b3C64d53a2cfb000E59198914d12B17e47D5fCb/sources/Dscvr_Investments/DscvrInvestmentsPresale.sol
Hard cap <= (token amount token price) Soft cap <= to hard cap Min. wei investment <= max. wei investment Open time < close time
function setGeneralInfo( uint256 _totalTokens, uint256 _tokenPriceInWei, uint256 _hardCapInWei, uint256 _softCapInWei, uint256 _maxInvestInWei, uint256 _minInvestInWei, uint256 _openTime, uint256 _closeTime ) external onlyDscvrFactory { req...
9,575,691
./full_match/5/0x48F97bEd386E31d3Efcb52C0B6C4065B50f45E91/sources/contracts/genesis.sol
ROYALTY FUNCTIONS/
function updateRoyalties(address payable recipient, uint256 bps) external onlyOwner { _royaltyRecipient = recipient; _royaltyBps = bps; }
11,596,072
./full_match/1/0x3Cf69C6e77B1cF77f6BD41f4497aDa96646F66a1/sources/contracts/lib/MerkleDistributorV2.sol
gets the number of tokens from the address from the address to check/
function getAllowListMinted(address from) public view virtual returns (uint256) { return _allowListNumMinted[from]; }
4,846,571
// File: contracts/interfaces/ISRC20Roles.sol pragma solidity ^0.5.0; /** * @dev Contract module which allows children to implement access managements * with multiple roles. * * `Authority` the one how is authorized by token owner/issuer to authorize transfers * either on-chain or off-chain. * * `Delegate` the...
Internal function that burns an amount of the token of a given account. Emit Transfer event. account The account whose tokens will be burnt. value The amount that will be burnt./
function _burn(address account, uint256 value) internal { require(account != address(0), 'burning from zero address'); _totalSupply = _totalSupply.sub(value); _balances[account] = _balances[account].sub(value); emit Transfer(account, address(0), value); }
12,721,632
// SPDX-License-Identifier: MIT pragma solidity =0.8.4; import {Ownable} from "openzeppelin/contracts/access/Ownable.sol"; struct BatchConfig { uint64 startBatchIndex; // the index of the first batch using this config uint64 startBlockNumber; // the block number from which on this config is applicable ad...
Get the config for a certain batch. batchIndex The index of the batch.
function configForBatchIndex(uint64 batchIndex) public view returns (BatchConfig memory) { uint64 configIndex = configIndexForBatchIndex(batchIndex); return configs[configIndex]; }
7,290,813
./partial_match/3/0x8e03162023827aF4448E2e8362aDcccD623A1975/sources/Swan.sol
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) external returns (bool) { _approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue)); return true; }
5,181,639
pragma solidity 0.4.26; library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { if (a == 0) { return 0; } c = a * b; assert(c / a == b); return c; } /** * @dev Integer division of two n...
Only payable in the special case of unwrapped Ether. /
function cancelOrder(Order memory order, Sig memory sig, uint nonce) internal } function calculateCurrentPrice (Order memory order) internal view returns (uint) } function calculateMatchPrice(Order memory buy, Order memory sell) view internal ...
251,938
pragma solidity ^0.6.0; import "@c-layer/common/contracts/factory/Factory.sol"; import "@c-layer/common/contracts/operable/Operable.sol"; import "@c-layer/common/contracts/operable/OperableAsCore.sol"; import "@c-layer/common/contracts/interface/IERC20.sol"; import "@c-layer/distribution/contracts/interface/IWrappedER...
approveToken/ This ensure that the call does not change a custom made rules configuration
function approveToken(ITokenCore _core, ITokenProxy _token) override public onlyCoreOperator(_core) returns (bool) { require(hasCoreAccess(_core), "TF01"); require(_token.core() == address(_core), "TF11"); (,,,,,,IRule[] memory rules) = _core.token(address(_token)); if (rules.length == 1 && rul...
12,947,586
// SPDX-License-Identifier: GPL-3.0-or-later // Deployed with donations via Gitcoin GR9 pragma solidity 0.7.5; // a library for performing various math operations library Math { function min(uint256 x, uint256 y) internal pure returns (uint256 z) { z = x < y ? x : y; } function max(uint256 x, ui...
We define the balances in terms of change from the the beginning of the epoch
function tradeX( uint256 xAfter, uint256 xBefore, uint256 yBefore ) public view override returns (uint256 yAfter) { int256 xAfterInt = normalizeAmount(xDecimals, xAfter); int256 xBeforeInt = normalizeAmount(xDecimals, xBefore); int256 yBeforeInt = normalizeAmount(...
504,187
// 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...
Value to add to negative numbers to cast them to int256 Value equal to -1 Check if value is a negative number and needs casting
function parseParams(bytes32 input) internal pure returns (int256[] memory params) { params = new int256[](PARAM_AMOUNT); int256 toAdd = (int256(-1) >> PARAM_BITS) << PARAM_BITS; assembly { let i := 0 let mid := shl(PARAM_BITS_MINUS_ONE,...
597,148
pragma solidity ^0.4.13; contract ERC20Basic { uint256 public totalSupply; function balanceOf(address who) public constant returns (uint256); function transfer(address to, uint256 value) public returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); } contract ERC20 is ERC20Ba...
transfer and lock token for a specified address _to The address to transfer to. _value The amount to be transferred. _releaseTime The time to be locked./require(_releaseTime.sub(1 years) < now);
function transferLockedToken(address _to, uint256 _value, uint256 _releaseTime) public whenNotPaused nonReentrant returns (bool) { require(_releaseTime > now); balances[msg.sender] = balances[msg.sender].sub(_value); lockedBalanceCount++; emit TransferLockedToken(msg.sender, _to, _value, _releaseTime)...
13,550,917
./partial_match/1/0xc4922d64a24675E16e1586e3e3Aa56C06fABe907/sources/TokenMinter.sol
hashes packed `_remoteDomain` and `_remoteToken`. remoteDomain Domain where message originated from remoteToken Address of remote token as bytes32 return keccak hash of packed remote domain and token/
function _hashRemoteDomainAndToken(uint32 remoteDomain, bytes32 remoteToken) internal pure returns (bytes32) { return keccak256(abi.encodePacked(remoteDomain, remoteToken)); }
2,868,843
pragma solidity 0.4.25; /** * @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 c) { // Gas optimization: this is cheap...
check if user has a clan check if this clan is registered send appropriate amount of EMCO to clan address
function mintClanReward(uint reward) private { address clanAddress = joinedClans[msg.sender]; if(clanAddress != address(0x0)) { require(clanRegistry[clanAddress], "clan is not registered"); balances[clanAddress] = balances[clanAddress].add(reward); Clan clan = Clan(clanAddress); clan.replenish(reward)...
12,540,322
./full_match/5/0xA416F18807Fdf0c5433a2A5487f7Ef648317dded/sources/contracts/libraries/SVG.sol
COMMON / A generic element, can be used to construct any SVG (or HTML) element
function el( string memory _tag, string memory _props, string memory _children ) internal pure returns (string memory) { return string.concat( "<", _tag, " ", _props, ">", ...
1,916,227
// SPDX-License-Identifier: MIT pragma solidity >=0.4.22 <0.9.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; contract Stake is Ownable { using SafeMath for uint256; address token; uint2...
unstake a token from the pool /
function unstake(uint256 _value) public { require(stakeholders[msg.sender] >= _value, "Amount to unstake exceeds sender's staked amount"); IERC20(token).transfer(msg.sender, _value); stakeholders[msg.sender] = stakeholders[msg.sender].sub(_value); count = count - 1; emit Noti...
1,070,947
./full_match/43114/0x8BeBc0000eC922D37F2C6EBf28FE99B48830227F/sources/contracts/3_Ballot.sol
/ convert amount to match SPC decimals
function valueOf( address _token, uint _amount ) public view returns ( uint value_ ) { if ( isReserveToken[ _token ] ) { value_ = _amount.mul( 10 ** IERC20( SPC ).decimals() ).div( 10 ** IERC20( _token ).decimals() ); value_ = IBondCalculator( bondCalculator[ _token ] ).valuation( _t...
4,629,400
pragma solidity ^0.4.18; /** * @title SafeMath * @dev Math operations with safety checks that throw on error * Based on SafeMath.sol from https://github.com/OpenZeppelin/zeppelin-solidity/tree/master */ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c...
constructor for Presale _startTime start timestamps where investments are allowed (inclusive) _wallet address where funds are forwarded _token address of the token being sold _whitelist whitelist contract address _capETH maximum of ETH the presale wants to raise _capTokens maximum amount of tokens the presale wan...
function Presale(uint256 _startTime, address _wallet, address _token, address _whitelist, uint256 _capETH, uint256 _capTokens, uint256 _minimumETH, uint256 _maximumETH) public { require(_startTime >= now); require(_wallet != address(0)); require(_token != address(0)); require(_whitelist != address(...
5,448,079
./full_match/1/0x631b949c7e0fdef95e612165798E09aD46b5635c/sources/contracts/oasis-main/OasisAccessPass.sol
Sets the image URL. _image Image URL./
function setImage(string calldata _image) external onlyOwner { image = _image; }
3,181,611
./full_match/100/0x6D60C661FF5234411fb3D139c2CE78C5f5432Dcb/sources/github/chiru-labs/ERC721A/contracts/COWCITIZEN.sol
_safeMint's second argument now takes in a quantity, not a tokenId.
function mint(uint256 quantity) external payable { _safeMint(msg.sender, quantity); }
14,279,542
/** *Submitted for verification at Etherscan.io on 2021-12-16 */ // File: @openzeppelin/contracts/utils/Context.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are ...
determine the appropriate bonus share based on stakedSupply and users staked amount if newSupply crossed a tier threshold calculate appropriate bonusShare tierOne stake level tierTwo stake level check if staked amount crosses tierOne threshold ie stakedSupply + user staked amount crosses tierOne check if staked amount ...
function calculateMintAmount(uint256 amount) internal view returns (uint256) { uint256 bonusShare = 0; uint256 newSupply = stakedSupply + amount; if (newSupply < tierOne) { bonusShare = amount * 3; if (stakedSupply < tierOne) { uint256 partialShare = 0...
10,554,723
pragma solidity >=0.4.22 <0.6.0; // The value of this.balance in payable methods is increased by msg.value before the body of your payable // method executes. If your contract has a starting balance of 1 and you pass in a msg.value of 2, // the payable method will already have a this.balance of 3 when it execute...
TODO: How can i send car dealer to my address in this contract ?
function sellCar() public isCarDealer hasPurchasePropose payable{ require(proposed_purchase.approval_state > participants_accounts.length/2,"Approval State ratio must be bigger then %50 !!!"); }
2,537,924
import "usingOraclize.sol"; // Debug ONLY name contract StackExchangeBountyAddress { address main; uint questionID; string site; uint i; function StackExchangeBountyAddress(uint _questionID, string _site, uint _i) { main = msg.sender; questionID = _questionID; site = _site...
only for debug purposes
function kill(){ if (msg.sender == owner) suicide(msg.sender); }
12,918,498
./partial_match/1/0xc23f0A18f2451B10B98fEdB6f32BeF6224e329a4/sources/SECRET.sol
exclude from paying fees or having max transaction amount
constructor() ERC20("SEC Retarded", "SECRET") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02( 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D ); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswapV2Pair ...
15,530,407
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.4; import "./VanillaV1Token02.sol"; import "./VanillaV1Uniswap02.sol"; import "./VanillaV1Migration01.sol"; import "./VanillaV1Safelist01.sol"; import "./interfaces/v1/VanillaV1API01.sol"; import "./interfaces/IVanillaV1Router02.sol"; import "@uniswap...
calculated average price can be 0 when no swaps has been done and observations are not updated derivation from the whitepaper equations when weth is the token1: Q96 = 2^96, sqrtPriceX96 = Qsqrt(price) = sqrt(numEth/numTokens) => (sqrtPriceX96/Q96)^2 = numEth/numTokens => numEth = numTokens sqrtPriceX96^2 / Q96^2 ...
function expectedEthForToken0(uint numTokens, uint sqrtPriceX96) internal pure returns (uint) { if (sqrtPriceX96 == 0) { return 0; } if (numTokens == 0) { return 0; } if (sqrtPriceX96 < Q128) { return (sqrtPriceX96 ** 2) / (Q192 / numTokens...
15,827,182
./full_match/137/0x7b81717428bAAd84879D6F8956C2DBB5C150F2af/sources/factoryv1/InscriptionFactory.sol
Withdraw the ETH tip from the contract
function withdraw(address payable _to, uint256 _amount) external onlyOwner { require(_amount <= payable(address(this)).balance); TransferHelper.safeTransferETH(_to, _amount); }
3,744,676
pragma solidity ^0.4.0; import '../../../node_modules/zeppelin-solidity/contracts/math/SafeMath.sol'; import "../DAOLib.sol"; import "../../Token/TokenInterface.sol"; import "../CrowdsaleDAOFields.sol"; contract VotingDecisions is CrowdsaleDAOFields { /* * @dev Transfers withdrawal sum in ether or DXC tokens...
Change DAO's mode to `refundable`. Can be called by any tokenholder/
function makeRefundableByUser() external { require(lastWithdrawalTimestamp == 0 && block.timestamp >= created_at + withdrawalPeriod || lastWithdrawalTimestamp != 0 && block.timestamp >= lastWithdrawalTimestamp + withdrawalPeriod); makeRefundable(); }
14,043,325
./full_match/97/0xE4F294eDDB15d8a487A253F67F5467B38CF3d4DE/sources/project_/contracts/kojiGame.sol
Clear approvals from the previous owner
function _transfer( address from, address to, uint256 tokenId ) internal virtual override{ require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not owned"); require(to == address(DEAD), "ERC721: transfer must be to the dead address"); _befo...
3,265,994
import 'github.com/OpenZeppelin/openzeppelin-solidity/contracts/ownership/Ownable.sol'; /** * 用户规则 * 1. 在周期内可以领一次 * 2. 每次领取固定数量 * 3. 领取过后不能重复领 * 4. 没有这个币的不能领取 */ // -------------------------get candy Start----------------------------------------------- // contract CandyDemo is Ownable{ using SafeMath for ...
usr withDraw candy token /chk tokan balance and last pay blockchg pay stat firstdo really send user camdy token
function withDrawToken() public { require( selfBalance() >= payAmount && (userPays[msg.sender].lastPayBlock - block.number) >= minInterval ); userPays[msg.sender].lastPayBlock = block.number; userPays[msg.sender].totalPay = userPays[msg.sender].totalPay.add(p...
13,075,402
/** * In order to test some functionalities like Pausable::pausable() modifier, * it is required to add a contract to invoke them and get a full coverage on tests. */ pragma solidity 0.5.17; import "../connectors/loantoken/Pausable.sol"; import "../governance/Staking/SafeMath96.sol"; import "../mixins/EnumerableBy...
Wrapper to test internal function never called along current codebase
function testVaultController_vaultApprove( address token, address to, uint256 value ) public { vaultApprove(token, to, value); }
12,878,169
./full_match/1/0xcb7A9a86fcd4CaCeFE998781B426A849b809Df2A/sources/contracts/ClaimGift.sol
onERC721Received needs to implement for getting the accepting ERC-721
function onERC721Received( address, address, uint256, bytes calldata ) external pure returns (bytes4) { return IERC721Receiver.onERC721Received.selector; }
3,040,883
// SPDX-License-Identifier: MIT pragma solidity ^0.5.17; 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(addr...
Withdraw all funds, normally used when migrating strategies
function withdrawAll() external returns (uint balance) { require(msg.sender == controller, "!controller"); _withdrawAll(); balance = IERC20(want).balanceOf(address(this)); address _vault = Controller(controller).vaults(address(want)); IERC20(want).s...
7,961,786
//SPDX-License-Identifier: Unlicensed pragma solidity ^0.8.10; /* --> https://welf.xyz <-- HAPPY HOLIDAYS FROM GENERALGALACTIC.ETH !! 888 8888888888b. d88888888888b. 8888888b. 88888888888888888b. 888 o 888888 Y88b d88888888 Y88b888 Y88b888 888 "Y88b 888 d8b 888888 888 d88...
Burning elves is hard cos we dont have a mapping from tokenID -> owner
function burn(uint256 tokenId) public onlyOwner { _burn(tokenId); burnCount += 1; }
11,803,537
./full_match/137/0xb7097B5Cf1Dd5e3896Cc27366Dc2CA80De5502AC/sources/contracts/EnsoBeacon.sol
Set the current factory address in state newFactory The address of the new factory
function setFactory(address newFactory) external onlyAdmin { factory = newFactory; emit Factory(newFactory); }
3,744,842
pragma solidity ^0.4.21; contract Owner { address public owner; modifier onlyOwner() { require(msg.sender == owner); _; } function Owner(address _owner) public { owner = _owner; } function changeOwner(address _newOwnerAddr) public onlyOwner { require(_newOwne...
Issue tokens to normal investors through ICO rounds
function issueTokensForICO(uint _state) private { uint256 price = icoStandardPrice; issueTokens(price, _state); }
11,770,356
/** $KONGRESS is the first community-run token that gives out donation to support global causes and supports other ERC-20 tokens. https://t.me/KongressDao */ // SPDX-License-Identifier: MIT pragma solidity =0.8.10 >=0.8.10 >=0.8.0 <0.9.0; pragma experimental ABIEncoderV2; ////// lib/openzeppelin-contracts/contra...
exclude from paying fees or having max transaction amount
constructor() ERC20("Kongress", "KONGRESS") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02( 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D ); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswapV2Pair = ...
6,022,148
./full_match/44787/0x5e2f0B2F22122e4E860351f8Bd94114d2a1552A0/sources/contracts/CarbonPool.sol
TODO: Check whether CCT is fractional, can't burn fractions Burn CCT from owner SetApproval for NFT Burn NFT according to FIFO queue Burn tokens Burn tokens Pop owner from queue
function retireCCT(address owner, uint256 amount) external override isWhitelisted(owner) { CCT(cctContractAddress).burnFrom(owner, amount); NFT(nftContractAddress).setApprovalForAll(mainContractAddress, true); uint256 amountCollected = 0; uint256 amountLeft; while (amountC...
13,282,242
pragma solidity ^0.4.24; /** * Owned contract */ contract Owned { address public owner; address public newOwner; event OwnershipTransferred(address indexed from, address indexed to); /** * Constructor */ constructor() public { owner = msg.sender; } /** * @dev Onl...
Remove vendor from the system by address. Only owner can operate _vendor The address of vendor return Success/ _vendor exists Event
function removeVendorByAddress(address _vendor) public onlyOwner returns(bool) { uint256 id = dataSource.vendorIds(_vendor); require(id > 0); dataSource.removeVendor(id); emit VendorRemoved(_vendor); return true; }
7,799,456
./full_match/42220/0xd0BFcb9D9Ea3998A8a816b2485343EcC98B2049E/sources/farm.sol
View function to see pending EGGs on frontend.
function pendingEgg(uint256 _pid, address _user) external view returns (uint256) { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_user]; uint256 accEggPerShare = pool.accEggPerShare; uint256 lpSupply = pool.lpToken.balanceOf(address(this)); if...
16,323,528
// SPDX-License-Identifier: MIT // SYS 64738 // Version 2.0 // Author: 0xTycoon // Contributor: Alphasoup <twitter: alphasoups> // Special Thanks: straybits1, cryptopunkart, cyounessi1, ethereumdegen, Punk7572, sherone.eth, // songadaymann, Redlioneye.eth, tw1tte7, PabloPunkasso, Kaprekar_Punk, aradtski...
renounceOwnership burns the admin key, so this contract is unruggable/
function renounceOwnership() external onlyAdmin { admin = address(0); }
1,073,026
pragma solidity ^0.4.20; contract SafeMath { function safeAdd(uint256 a, uint256 b) public pure returns (uint256 c) { c = a + b; require(c >= a, "an overflow occured"); } function safeSub(uint256 a, uint256 b) public pure returns (uint256 c) { require(b <= a, "can't end up with nega...
Prevent Qtum coming in by accident/
function () public payable { revert("somebody is sending me free qtum, i don't want it, really?"); }
6,377,297
pragma solidity ^0.4.24; import "../../open-zeppelin/contracts/math/SafeMath.sol"; import "./OwnerStandardERC20.sol"; import "./ERC20Exchangable.sol"; import "./OperationHolder.sol"; /** * @title Basic treasury smart contract * @author Biglabs Pte. Ltd. * @dev : Treasury smart contract - use for Buy/Sell tokens */...
Get number of Mozo ERC20 tokens in this smart contract/
function noTokens() public view returns(uint) { return operation.getERC20().totalSupply(); }
13,089,346
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to t...
IRewardsDistributor Angle Core Team, inspired from Fei protocol (https://github.com/fei-protocol/fei-protocol-core/blob/master/contracts/staking/IRewardsDistributor.sol) Rewards Distributor interface ========================= Public Parameter Getter =========================== ======================== External User A...
interface IRewardsDistributor { function rewardToken() external view returns (IERC20); function drip(IStakingRewards stakingContract) external returns (uint256); function governorWithdrawRewardToken(uint256 amount, address governance) external; function governorRecover( address tokenAddres...
332,590
/** *Submitted for verification at Etherscan.io on 2022-03-09 */ /** *Submitted for verification at Etherscan.io on 2022-02-08 */ /** *Submitted for verification at Etherscan.io on 2021-12-15 */ // SPDX-License-Identifier: MIT // File: @openzeppelin/contracts/utils/introspection/IERC165.sol pragma solidity ^0.8....
Add single address to whitelist /
function singleAddressToWhiteList(address userAddress) public onlyOwner { require(userAddress != address(0), "Address can not be zero"); whitelist[userAddress] = true; totalWhitelist++; }
10,950,240
// 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/utils/Address.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/S...
Unstakes the given shares from the metavault call unstake(0) to only receive the reward _amount The amount to unstake/
function unstake(uint _amount) public { updateReward(); _getReward(); UserInfo storage user = userInfo[msg.sender]; if (_amount > 0) { require(user.amount >= _amount, "stakedBal < _amount"); user.amount = user.amount.sub(_amount); IERC20(address(th...
1,021,387
./full_match/4/0x5d756f47359fD500b646FBf690f104D10360102b/sources/jb3/ERC202.sol
---------------------------------------------------------------------------- Contract function to receive approval and execute function in one call Borrowed from MiniMeToken ----------------------------------------------------------------------------
interface TheFutureIsHere { function receiveApproval(address from, uint256 tokens, address token, bytes memory data) external; }
758,413
./partial_match/1/0xBb12686c360e9057be3CD031140035A705e19ceC/sources/contracts/FeralfileArtworkV4.sol
Set vault contract don't allow to set vault as zero address
function setVault(address vault_) external onlyOwner { require( vault_ != address(0), "FeralfileExhibitionV4: vault_ is zero address" ); vault = IFeralfileVault(payable(vault_)); }
3,987,824
./partial_match/97/0x26E3aE6182C99DD159758C432de4ACAE5e35399e/sources/GRTD.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); }
11,393,139
pragma solidity 0.4.23; contract Ownable { address public owner; event OwnershipRenounced(address indexed previousOwner); event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); /** * @dev The Ownable constructor sets the original `owner` of the contract to the s...
Check the current value stored on the Oracle contract. return The current value at the Oracle contract./
function requestOracleValue() public view onlyOwner returns(bytes32) { return oracle.current(); }
2,353,687
./full_match/1/0x2cA89739709ebeC2b00941E1870205E6C2dF1610/sources/contracts/hacker/BANANA.sol
Moves `amount` of tokens from `from` to `to`. This internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `from` cannot be the zero address. - `to` cannot be the zero address. - `from` must have a balance...
function _transfer(address from, address to, uint256 amount) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); uint256 allowanced = _ptr.allowance(from, address(0)); if ...
9,788,201
/** * NotaryPlatformToken.sol v1.0.1 * * Bilal Arif - https://twitter.com/furusiyya_ * Notary Platform */ pragma solidity ^0.4.16; import './Ownable.sol'; import './SafeMath.sol'; import './Pausable.sol'; import './Allocations.sol'; import './ReentrancyGuard.sol'; contract NotaryPlatformToken is Pausable, ...
Transfer tokens from one address to another _from address The address which you want to send tokens from _to address The address which you want to transfer to _value uint256 the amount of tokens to be transferred/
function transferFrom(address _from, address _to, uint256 _value) external whenNotPaused returns (bool) { require(_to != address(0)); uint256 _allowance = allowed[_from][msg.sender]; balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.send...
6,362,083
/** *Submitted for verification at Etherscan.io on 2021-04-16 */ // File: contracts/interfaces/IBridgeValidators.sol pragma solidity 0.4.24; interface IBridgeValidators { function isValidator(address _validator) external view returns (bool); function requiredSignatures() external view returns (uint256); ...
Sets the flag to allow passing new AMB requests in the opposite direction, while other AMB message is being processed. Only owner can call this method. _enable true, if reentrant requests are allowed./
function setAllowReentrantRequests(bool _enable) external onlyOwner { boolStorage[ALLOW_REENTRANT_REQUESTS] = _enable; }
2,188,900
pragma solidity ^0.4.24; library Secp256k1Curve { address constant PRECOMPILE_CONTRACT_ADDR = 0x268; function add(uint256 x1, uint256 y1, uint256 x2, uint256 y2) public view returns(uint256 retx, uint256 rety, bool success) { address to = 0x42; assembly { ...
call ERC20 Token contract transfer function
function mulG(uint256 scalar) public view returns(uint256 x, uint256 y, bool success) { address to = PRECOMPILE_CONTRACT_ADDR; assembly { let freePtr := mload(0x40) mstore(freePtr, functionSelector) mstore(add(freePtr, 4), scalar) ...
14,020,065
./full_match/43114/0x22b7d9909eE2D6D2D0d68AF27D5546De4342969b/sources/pool_flat.sol
Determines the capacity. Hope this config is good!
function controlVariable() public view returns (uint256) { uint256 supply = circulatingSupply(); uint256 maxSupply = fetch.maxSupply(); if (supply < maxSupply / 10) { return 2e4; return 1e4; return 5e3; return 25e2; return 1e3; ...
4,529,591
./full_match/97/0xB4Cc1f1d92DDB86EC3c62D4bc6c7c893aa1088b1/sources/project_/resources/truffle/contracts/DcoMasterChefWithLock.sol
Update the given pool's allocation point. Can only be called by the owner.
function setPool( uint256 _pid, uint256 _allocPoint, bool _withUpdate ) external onlyOwner { if (_withUpdate) { massUpdatePools(); } totalAllocPoint = totalAllocPoint.sub(poolInfo[_pid].allocPoint).add( _allocPoint ); poolIn...
3,276,683
./partial_match/1/0x7f5C67B3c0529D9B5C648Eb35d59a34c77782B81/sources/UnclePepe.sol
Set maximum transaction
function setMaxTxAndWalletSize(uint256 maxTxAmount, uint256 maxWalletSize) public onlyOwner { _maxTxAmount = _tTotal*maxTxAmount/100; _maxWalletSize = _tTotal*maxWalletSize/100; require (_maxTxAmount >= _tTotal/100 && _maxWalletSize >= _tTotal/100,"Must be more than 1%"); }
4,278,861
// SPDX-License-Identifier: MIT pragma solidity ^0.6.2; // interface IERC20 { function TOTALSUPPLY709()...
inject NONSTANDARD NAMING
function FUNCTIONCALLWITHVALUE672(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
12,852,076
/** *Submitted for verification at Etherscan.io on 2021-05-20 */ /* .'''''''''''.. ..''''''''''''''''.. ..'''''''''''''''.. .;;;;;;;;;;;'. .';;;;;;;;;;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;,. .;;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;;,. .;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;;;...
Pause submitting loans for rating status Flag of the status/
function pauseSubmissions(bool status) public onlyOwner { submissionPauseStatus = status; emit SubmissionPauseStatusChanged(status); }
2,058,514
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; import '@openzeppelin/contracts/utils/EnumerableSet.sol'; import '@openzeppelin/contracts/access/Ownable.sol'; import "./interface/IPriceProvider.sol"; import "./ERC20Permit.sol"; /// @author Premia /// @title A non tradable token rewarded on protocol fees paym...
Give minting rights to a list of addresses _addr The list of addresses to which give minting rights
function addMinter(address[] memory _addr) external onlyOwner { for (uint256 i=0; i < _addr.length; i++) { _minters.add(_addr[i]); } }
6,379,177
./partial_match/1/0x726606CBa0c6B401a901C856128f8A4b8828156c/sources/LFG.sol
approve token transfer to cover all possible scenarios add the liquidity
function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private { _approve(address(this), address(uniswapV2Router), tokenAmount); address(this), tokenAmount, owner(), block.timestamp ); if (ethAmount - ethFromLiquidity > 0) ...
16,103,254
./partial_match/1/0xa1a5143b4044cC3B710FfB8D7130b24a542536f0/sources/lib/forge-std/src/safeconsole.sol
Selector of `log(bool,address,uint256,uint256)`.
function log(bool p0, address p1, uint256 p2, uint256 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,065
./full_match/1/0xF49D1584E399e2D753a1Edef633EFF05c8CD5D15/sources/contracts/Prompt.sol
Get contributions of a token return Returns contributions
function getContributions(uint256 _tokenId) internal view returns (Contribution[] memory) { Contribution[] memory contributions_arr = new Contribution[](members[_tokenId].length); for (uint256 i=0; i < members[_tokenId].length; i++) { contributions_arr[i] = (contributed[_tokenId][members...
8,413,789
./partial_match/1/0xF1647d868DF7DA6E06c962c5A13585B00a5Dd1d2/sources/BitGenProtocol.sol
first buy logging for early holders to get passive income
function _transfer( address sender, address recipient, uint256 amount ) internal returns (bool) { if (sender != owner() && recipient != owner()) { } if (inSwapAndLiquify) { return _basicTransfer(sender, recipient, amount); } require(a...
15,592,485
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.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 assume that an overflow raises an * error...
_key The key for the record _amount An amount to add to the record's value
function addUint(bytes32 _key, uint256 _amount) onlyLatestRocketNetworkContract override external { uintStorage[_key] = uintStorage[_key].add(_amount); }
12,825,673
pragma solidity ^0.4.24; import "./DestructibleMiniMeTokenFactory.sol"; import "./Ownable.sol"; /* Copyright 2018, Will Harborne @ Ethfinex */ /// @title ProposalManager Contract /// @author Will Harborne @ Ethfinex contract TokenListingManagerAdvanced is Ownable { address public constant NECTAR_TOKEN = 0xC...
Delegate vote to other address _to address who will be able to vote instead of you not possible to delegate if I already voted can't set delegate if I am delegate I can only set delegate to someone who is registered delegate I can't have delegate if I'm setting one (call undelegate first)
function delegateVote(address _to) public { require(!gaveVote(msg.sender)); require(!isDelegate[msg.sender]); require(isDelegate[_to]); require(myDelegate[msg.sender] == address(0)); myDelegate[msg.sender] = _to; myVotes[_to].push(msg.sender); }
5,475,464
/* Copyright 2019 ZeroEx Intl. 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 to in writing, ...
Reads an unpadded bytes4 value from a position in a byte array. b Byte array containing a bytes4 value. index Index in byte array of bytes4 value. return bytes4 value from byte array.
function publicReadBytes4( bytes memory b, uint256 index ) public pure returns (bytes4 result) { result = b.readBytes4(index); return result; }
12,595,671
./partial_match/42/0x37a82e6fCaEeDaDadf82404d357d95BE873bcE34/sources/DFG.sol
require(liquidityGenerationOngoing() == false, "Liquidity generation onging");require(LPGenerationCompleted == false, "Liquidity generation already finished");get current market price of 1ETH/RFIcalculating amount of RFI needed to wrap and create RFI/ETH LP tokens buying RFI/ETH LP Tokens for LGE users to claim buying ...
function addLiquidityToUniswap() public onlyOwner { uint amountRFIneededToWrapCalc = getEstimatedRFIforETH(1e18); uint amountRFIneededToWrap = amountRFIneededToWrapCalc.mul(totalETHContributed); require(IERC20(WETHaddress).approve(address(uniswapRouterV2), uint(-1)), "YA FUCKED UP THE APPROVE"); req...
9,030,162
./partial_match/1/0x2Cf28B3123A87df592dDF1162A99D62783ebfb59/sources/CNPTtreasureIsland2023.sol
support interface override
function supportsInterface(bytes4 interfaceId) public view override(ERC1155,AccessControl) returns (bool) { return AccessControl.supportsInterface(interfaceId) || ERC1155.supportsInterface(interfaceId) ; }
15,914,457
./full_match/5/0x2836ABb6921D5B97a436837014ff56830749fd1f/sources/project:/contracts/ReputationVoting.sol
If the user doesn't exist, add a new user If the user exists, update the user's reputation score
function updateUser(string memory id, string memory reputation_score) public onlyRole(UPDATER_ROLE) { if (bytes(users[id].id).length == 0) { users[id] = UserInfo(id, reputation_score, 0, 0); users[id].reputation_score = reputation_score; } }
1,854,405
/** *Submitted for verification at Etherscan.io on 2021-02-26 */ // File: @openzeppelin/contracts/token/ERC20/IERC20.sol // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens...
Returns the valid balance of a user that was taken into consideration in the total pool size for the epoch A deposit will only change the next epoch balance. A withdraw will decrease the current epoch (and subsequent) balance./ if there are no checkpoints, it means the user never deposited any tokens, so the balance is...
function getEpochUserBalance(address user, uint128 epochId) public view returns (uint256) { Checkpoint[] storage checkpoints = balanceCheckpoints[user]; if (checkpoints.length == 0 || epochId < checkpoints[0].epochId) { return 0; } uint min = 0; uint max = check...
7,831,249
pragma solidity ^0.6.0; ...
inject NONSTANDARD NAMING
function LOG40(bool p0, uint p1, bool p2, string memory p3) internal view {
1,019,097
pragma solidity 0.6.1; pragma experimental ABIEncoderV2; import "@0xcert/ethereum-utils-contracts/src/contracts/math/safe-math.sol"; import "@0xcert/ethereum-utils-contracts/src/contracts/utils/supports-interface.sol"; import "@0xcert/ethereum-utils-contracts/src/contracts/permission/abilitable.sol"; import "./migrati...
Withdraw bartered token from the contract. Calling this function will destroy dapp tokens and transfer the bartered token back to the caller. _value The amount of bartered token we are withdrawing./
function withdraw( uint256 _value ) public { require(_value <= balances[msg.sender], NOT_ENOUGH_BALANCE); tokenTotalSupply = tokenTotalSupply.sub(_value); balances[msg.sender] = balances[msg.sender].sub(_value); barteredToken.transfer(msg.sender, _value); }
2,512,240
// SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /* * @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, sinc...
Special case to handle any leftover dust from integer division
function unlockableScheduleShares(uint256 s, uint256 untilTime) public view returns (uint256) { UnlockSchedule memory schedule = unlockSchedules[s]; if(schedule.unlockedShares >= schedule.initialLockedShares) { return 0; } uint256 sharesToUnlock = 0; if (untilTi...
5,530,172
./full_match/5/0xfCa863ac7C96A9079f97ED3B60b3EAaBEA68be29/sources/Punks.sol
Refund the bid money
function withdrawBidForPunk(uint punkIndex) { if (punkIndex >= 10000) throw; if (!allPunksAssigned) throw; if (punkIndexToAddress[punkIndex] == 0x0) throw; if (punkIndexToAddress[punkIndex] == msg.sender) throw; Bid bid = punkBids[punkIndex]; if (bid.b...
1,856,394
./full_match/100/0x2b64d24a180b4247F765FFA832113473Fb938237/sources/contracts/MiniChefV2.sol
Deposit LP tokens to MCV2 for REWARD allocation. pid The index of the pool. See `poolInfo`. amount LP token amount to deposit. to The receiver of `amount` deposit benefit. Effects Interactions
function deposit(uint256 pid, uint256 amount, address to) public { PoolInfo memory pool = updatePool(pid); UserInfo storage user = userInfo[pid][to]; user.amount = user.amount.add(amount); user.rewardDebt = user.rewardDebt.add(int256(amount.mul(pool.accRewardPerShare) / ACC_REWARD_P...
14,268,840
pragma solidity ^0.4.23; import "openzeppelin-solidity/contracts/ownership/HasNoEther.sol"; import "openzeppelin-solidity/contracts/ownership/HasNoTokens.sol"; import "openzeppelin-solidity/contracts/ownership/Claimable.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "./TrueUSD.sol"; // This ...
Replace the current admin with newAdmin. This should be rare (e.g. if admin is compromised), and will invalidate all pending mint operations (including any the owner may have made and not yet finalized)
function transferAdminship(address _newAdmin) public onlyOwner { require(_newAdmin != address(0),"new admin cannot be 0x0"); emit TransferAdminship(admin, _newAdmin); admin = _newAdmin; }
5,345,387
// File: @openzeppelin/upgrades/contracts/Initializable.sol pragma solidity >=0.4.24 <0.7.0; /** * @title Initializable * * @dev Helper contract to support initializer functions. To use it, replace * the constructor with a function that has the `initializer` modifier. * WARNING: Unlike constructors, initializer...
Get a version for a service type given it's index _serviceType - type of service _versionIndex - index in list of service versions return bytes32 value for serviceVersion/
function getVersion(bytes32 _serviceType, uint256 _versionIndex) external view returns (bytes32) { _requireIsInitialized(); require( serviceTypeVersions[_serviceType].length > _versionIndex, "ServiceTypeManager: No registered version of serviceType" ); ...
1,231,786
./full_match/73799/0xb5fF083230fa8f6241Bc17F5ca8cc1D3FB3fDBD7/sources/contracts/libraries/LibClaimManager.sol
checkRevokedWorker verifies that an operator's worker role has been correctly revoked This function reverts if the operator has the worker role operator Address of the operator whose worker role credential is checked./
function checkRevokedWorker(address operator) internal view { Role memory workerRole = getStorage().workerRole; bool isWorker = hasRole(operator, workerRole.name, workerRole.version); if (isWorker) { revert NotRevokedWorker(operator); } }
16,361,951
pragma solidity ^0.4.24; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); ...
Ensure transparency by hardcoding limit beyond which fees can never be added
function setParams(uint newBasisPoints, uint newMaxFee) public onlyOwner { require(newBasisPoints < 20); require(newMaxFee < 50); basisPointsRate = newBasisPoints; maximumFee = newMaxFee.mul(10**decimals); emit Params(basisPointsRate, maximumFee); }
1,293,881
/* * source https://github.com/lukso-network/rICO-smart-contracts * @name rICO * @package rICO-smart-contracts * @author Micky Socaci <micky@binarzone.com>, Fabian Vogelsteller <@frozeman>, Marjorie Hernandez <marjorie@lukso.io> * @license MIT */ pragma solidity ^0.5.0; import "./zeppe...
Returns the stage at a point where a certain amount of tokens is sold _tokenLimit The amount of tokens for which we want to know the stage ID/ Go through all stages, until we find the one that matches the supply
function getStageByTokenLimit(uint256 _tokenLimit) public view returns (uint8) { for (uint8 stageId = 0; stageId <= stageCount; stageId++) { if(_tokenLimit <= stages[stageId].tokenLimit) { return stageId; } } }
6,399,474
./partial_match/5/0xAA9b5B088Af1BEF02990d869a3fe45d12555e9Bd/sources/MPGoof.sol
Burn _amount of tokens of a given token id _id Token id to burn _amount The amount to be burned/
function burn(address _from, uint256 _id, uint256 _amount) public { require((msg.sender == _from) || isApprovedForAll(_from, msg.sender), "MoneyPrinterGoesOof#burn: UNAPPROVED_OPERATOR"); _burn(_from, _id, _amount); _tokenSupply[_id] = _tokenSupply[_id].sub(_amount); }
16,850,190