file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
// 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... | Since this is a gas heavy function, we can reduce the gas by asking executors to select the tokens to swap This will likely be the token that is the highest quantity in the strat Now find our target token to sell into Now sell all the other tokens into this token If balance is too small,sell all tokens at once We are g... | function checkAndSwapTokens(address _executor, uint256 _sellID, uint256 _buyID) internal {
require(_sellID < tokenList.length && _buyID < tokenList.length, "Token ID not found");
require(safetyMode == false, "Unable to swap while in safety mode");
require(tokenList[_sellID].active == true &&... | 6,170,904 |
pragma solidity 0.4.24;
/**
* CryptoCanvas Terms of Use
*
* 1. Intro
*
* CryptoCanvas is a set of collectible artworks (“Canvas”) created by the CryptoCanvas community with proof of ownership stored on the Ethereum blockchain.
*
* This agreement does a few things. First, it passes copyright ownership of a Canvas from ... | Adds a bid to fee history. Doesn't perform any checks if the bid is valid! return Returns how the trade ethers were split. Same value as splitTrade function./ | function _registerTrade(uint32 _canvasId, uint _amount)
internal
stateOwned(_canvasId)
forceOwned(_canvasId)
returns (
uint commission,
uint paintersRewards,
uint sellerProfit
){
uint _commission;
uint _rewards;
uint _sellerProfit;
(_commis... | 5,907,396 |
./partial_match/1/0x12A73E14ef40DbD995baE85377961A1D2F1596be/sources/contracts/SphinxManager.sol | Approve a deployment. Only callable by the owner of this contract. _actionRoot Root of the Merkle tree containing the actions for the deployment. This may be `bytes32(0)` if there are no actions in the deployment. _targetRoot Root of the Merkle tree containing the targets for the deployment. This may be `bytes32(0)` ... | function approve(
bytes32 _actionRoot,
bytes32 _targetRoot,
uint256 _numInitialActions,
uint256 _numSetStorageActions,
uint256 _numTargets,
string memory _configUri,
bool _remoteExecution
) public onlyOwner {
if (activeDeploymentId != bytes32(0)) {... | 9,336,507 |
./full_match/43113/0x581019416412183f28125896Bf80a7E2e78C49f7/sources/@elkdex/v3-core/contracts/interfaces/pool/IElkDexV3PoolImmutables.sol | Pool state that never changes These parameters are fixed for a pool forever, i.e., the methods will always return the same values | interface IElkDexV3PoolImmutables {
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function fee() external view returns (uint24);
function tickSpacing() external view returns (int24);
... | 13,145,379 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.4;
import "./DirectLoanBaseMinimal.sol";
import "../../../utils/ContractKeys.sol";
/**
* @title DirectLoanFixed
* @author NFTfi
* @notice Main contract for NFTfi Direct Loans Fixed Type. This contract manages the ability to create NFT-backed
* peer-to-pee... | SPDX-License-Identifier: BUSL-1.1 INftTypeRegistry NFTfi Interface for NFT Wrappers./ | interface INftWrapper {
function transferNFT(
address from,
address to,
address nftContract,
uint256 tokenId
) external returns (bool);
function isOwner(
address owner,
address nftContract,
uint256 tokenId
) external view returns (bool);
func... | 1,474,600 |
./full_match/4/0xBd338B3193d8eAc21a48a4eac2cB8c9aa69cB7d5/sources/Volumes/Work/Code/token-installation-timelock/contracts/Lock.sol | return the beneficiary of the tokens./ return startTime - block.timestamp; solhint-disable-next-line not-rely-on-time uint timeLeft = ; | function getTimeRemaining() public view returns (uint) {
if (_token.balanceOf(address(this)) == 0) return 0;
if(block.timestamp >= startTime) return 0;
}
| 648,013 |
./full_match/1/0x71e2dCd9bc0D2BE70719b3dd2AAC3e763466c9f1/sources/browser/dgexfinanceBank.sol | Update reward variables of the given pool to be up-to-date. | function updatePool(uint256 _pid) public {
PoolInfo storage pool = poolInfo[_pid];
if (block.number <= pool.lastRewardBlock) {
return;
}
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if (lpSupply == 0) {
pool.lastRewardBlock = block.number;... | 3,014,790 |
./partial_match/1/0x8BeEb8f4a719b17F326Bfc6bC928b99BE30aEB71/sources/StakingDextoken.sol | Retrieve the stake for a stakeholder | function stakeOf(address _stakeholder) external view returns (uint) {
return _balances[_stakeholder];
}
| 2,895,238 |
./full_match/1/0xE5d35f68BB3e47bE5161387b061973e6F27a4C0c/sources/DUTToken.sol | add/remove a LP only callable by `owner()`/ | function setIsLpPool(address pairAddress, bool isLp) external override onlyOwner {
_setIsLpPool(pairAddress, isLp);
}
| 2,989,489 |
./partial_match/1/0xC870BDd7185844E9b909a5E04b267a5A762fd8be/sources/MemeStream.sol | once enabled, can never be turned off | function beginTrading() external onlyOwner {
isTradingOpen = true;
isSwapEnabled = true;
lastLpBurnTime = block.timestamp;
}
| 2,582,124 |
pragma solidity 0.4.21;
// File: contracts/BytesDeserializer.sol
/*
* This smart contract code is Copyright 2017 TokenMarket Ltd. For more information see https://tokenmarket.net
*
* Licensed under the Apache License, version 2.0: https://github.com/TokenMarketNet/ico/blob/master/LICENSE.txt
*/
/*
* Deserialize... | This function was written by Pickeringware ltd to facilitate a refund action upon failure of KYC analysis It simply allows the participant to withdraw his ether from the sale Moves the crowdsale sliders accordingly Reclaims the users tokens and burns them Blacklists the user to prevent them from buying any more tokens ... | function refundParticipant(address participant, uint256 _stage1, uint256 _stage2, uint256 _stage3, uint256 _stage4) external onlyOwner {
require(balanceOf[participant] > 0);
uint256 balance = balanceOf[participant];
uint256 tokens = tokenBalanceOf[participant];
balanceOf[participant] = 0;
tokenB... | 2,166,628 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contracts/token/common/ERC2981.sol";
import "@openzeppelin/cont... | Sets the art manager account Address to be used as art manager/ | function setArtManager(address account) external onlyOwner {
require(account != address(0), "Address 0");
artManager = account;
}
| 14,453,256 |
./full_match/1/0xc1374b803DFb1A9c87eaB9e76929222DBa3a8C39/sources/contracts/lazy-forge/NiftyIslandCreations.sol | Retrieve the total burned supply for a token id _id token id/ | function totalBurnedSupply(uint256 _id) public view returns (uint256) {
return _burned[_id];
}
| 3,070,473 |
./partial_match/56/0x128c0A35a70E184484cD49fa7c3e26626Fd81f66/sources/MasterChef.sol | Add a new lp to the pool. Can only be called by the owner. XXX DO NOT add the same LP token more than once. Rewards will be messed up if you do. | function add(uint256 _allocPoint, IBEP20 _lpToken, uint16 _depositFeeBP, bool _withUpdate) public onlyOwner {
require(_depositFeeBP <= 10000, "add: invalid deposit fee basis points");
if (_withUpdate) {
massUpdatePools();
}
uint256 lastRewardBlock = block.number > startBl... | 11,104,487 |
./partial_match/3/0xd15693E50DCFd6d2A3D93729ED2b9C49C152eF9c/sources/SwanMasterFarmer.sol | Determine the prior number of votes for an account as of a block number Block number must be a finalized block or else this function will revert to prevent misinformation. account The address of the account to check blockNumber The block number to get the vote balance at return The number of votes the account had as... | {
require(blockNumber < block.number, "SWAN::getPriorVotes: not yet determined");
uint32 nCheckpoints = numCheckpoints[account];
function delegates(address delegator)
external
view
returns (address)
}
}
function delegateBySig(
address delegatee,
... | 5,076,820 |
./partial_match/56/0xA4a7ab8a4Bc413F3f81Ac894430537dBa12Ab816/sources/StrategyKebabLP.sol | Swaps {kebab} for {lpToken0}, {lpToken1} & {wbnb} using PancakeSwap./ | function addLiquidity() internal {
uint256 kebabHalf = IERC20(kebab).balanceOf(address(this)).div(2);
if (lpToken0 != kebab) {
IPancakeRouter(unirouter).swapExactTokensForTokens(kebabHalf, 0, kebabToLp0Route, address(this), now.add(600));
}
if (lpToken1 != kebab) {
... | 11,098,609 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0 <0.9.0;
/// @title Witnet Request Board basic administration interface.
/// @author The Witnet Foundation.
interface IWitnetRequestBoardAdmin {
event OwnershipTransferred(address indexed from, address indexed to);
/// Gets admin/owner address.
funct... | Witnet Request Board basic administration interface. The Witnet Foundation. | interface IWitnetRequestBoardAdmin {
event OwnershipTransferred(address indexed from, address indexed to);
function owner() external view returns (address);
function transferOwnership(address) external;
}
| 5,420,114 |
./full_match/40/0x48EFAf072b75BB0EDc20B3eeB4FA37a5Bb61d7Bd/sources/scripts/Generator/DeployContracts/Test1.sol | withdraw ether from contract. only owner function | function withdraw() public payable onlyOwner {
require(os);
}
| 9,545,117 |
./full_match/1/0xe1272adbf95FA29ab6aC9Cd8bF2D5462BCD766B3/sources/contracts/cash/CashManager.sol | Override admin function for changing the representation of the amount of collateral a user has deposited to kick off minting process user The user whose balance is being set epoch The epoch in which to set user balance for oldBalance The user's previous balance newBalance The user's new b... | function setPendingMintBalance(
address user,
uint256 epoch,
uint256 oldBalance,
uint256 newBalance
) external updateEpoch onlyRole(MANAGER_ADMIN) {
if (oldBalance != mintRequestsPerEpoch[epoch][user]) {
revert UnexpectedMintBalance();
}
if (epoch > currentEpoch) {
revert Can... | 17,003,321 |
pragma solidity >=0.8.0 <0.9.0;
import "../openzeppelin/Safemath.sol";
import "./FriendRegistry.sol";
import "../utility/StakePool.sol";
import "hardhat/console.sol";
contract Freelancer {
using SafeMath for uint256;
using SafeMath for uint32;
// Use MAX_UINT to signify null uint value
uint256 consta... | Sets a freelancer's availability. - Must be called by logic contracts upon completion or beginning of a job and can only be set if logic contract has access to set it freelancer The address of the freelancer whose rating needs to be updated isAvailable Availability set to true or false/ | function setAvailability(address freelancer, bool isAvailable)
external
onlyFriend(msg.sender)
{
freelancerToMetadata[freelancer].isAvailable = isAvailable;
}
| 7,320,107 |
./partial_match/1/0x860aCd0f9E6436E15407977602bf11fD39db29f1/sources/Dubai1764.sol | Change Price functions for Diamond Tier | function changeUSDTPriceDiamond(uint256 usdtPrice) public onlyOwner {
priceUSDTDiamond = usdtPrice;
}
| 16,136,227 |
// File: contracts\SmartTreasuryV3FragmentPWC.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
///////////////////////////////////////////////////////////////////////////
// __/|
// __/ // /| This smart contract is part of Mover infrastructure
// |/ //_/// https://viamover.com
// |_/ /... | return true if a staked at a specific timestamp powercard is on cooldown now | function isPowerCardCooldown(uint _tsStaked) view public returns(bool) {
if (block.timestamp.sub(_tsStaked).mod(POWERCARD_ACTIVE_PERIOD + POWERCARD_COOLDOWN_PERIOD) >= POWERCARD_ACTIVE_PERIOD) {
return true;
}
return false;
}
| 1,368,528 |
pragma solidity 0.5.15;
import "ROOT/IAugur.sol";
import "ROOT/ISimpleDex.sol";
import "ROOT/CashSender.sol";
import "ROOT/libraries/token/IERC20.sol";
import "ROOT/libraries/token/VariableSupplyToken.sol";
import "ROOT/libraries/Initializable.sol";
import "ROOT/libraries/ReentrancyGuard.sol";
import "ROOT/libraries/m... | cannot reasonably overflow unless the supply of Cash, REP, or ETH became several OOM larger | function update(uint256 _tokenBalance, uint256 _cashBalance) internal {
uint256 _blockNumber = block.number;
uint256 _blocksElapsed = _blockNumber - blockNumberLast;
uint256 _cashReserve = cashReserve;
uint256 _tokenReserve = tokenReserve;
if (_tokenReserve != 0 && _cashReser... | 5,381,371 |
pragma solidity ^0.5.0;
/**
* @title ERC20 interface
* @dev see https://eips.ethereum.org/EIPS/eip-20
*/
interface IERC20 {
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external returns (bool);
function transferFrom(a... | Submits a new oracle's vote describing the results of the tournament | function submitOracleVote(uint oracleIndex, bytes16 winners, uint8 scoreA, uint8 scoreB) public {
require(currentState == ContestState.WAITING_FOR_ORACLES, "Must be in waiting for oracles state");
require(oracles[oracleIndex] == msg.sender, "Wrong oracle index");
require(arePicksOrResultsVal... | 5,431,616 |
// SPDX-License-Identifier: AGPLv3
pragma solidity ^0.7.0;
/**
* @title Int96SafeMath
* @dev Int96 math operations with safety checks that revert on error.
*/
library Int96SafeMath {
int96 constant private _INT96_MIN = -2**95;
/**
* @dev Returns the multiplication of two signed integers, reverting on... | Returns the addition of two signed integers, reverting on overflow. Counterpart to Solidity's `+` operator. Requirements: - Addition cannot overflow./ | function add(int96 a, int96 b, string memory errorMessage) internal pure returns (int96) {
int96 c = a + b;
require((b >= 0 && c >= a) || (b < 0 && c < a), errorMessage);
return c;
}
| 13,001,444 |
// to test issue with nodes breaking with large clients over WS
// fixed in web3 with fragmentationThreshold: 8192
pragma solidity ^0.4.17;
contract BigFreakingContract {
event Transfer(address indexed from, address indexed to, uint value);
event Approval( address indexed owner, address indexed spender, uint valu... | TODO: should increase instead | function approve_205(address spender, uint value) public returns (bool ok) {
_approvals[msg.sender][spender] = value;
emit Approval( msg.sender, spender, value );
return true;
}
| 6,453,918 |
pragma solidity 0.4.15;
contract owned {
address public owner;
event ContractOwnershipTransferred(address newOwner);
function owned() { owner = msg.sender; }
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function setContractOw... | Withdraw your funds, i.e. winnings and refunds. This function can be called in any state and will withdraw all winnings as well as refunds. | function withdraw() external {
uint amount = funds[msg.sender];
funds[msg.sender] = 0;
msg.sender.transfer(amount);
}
| 5,472,933 |
./full_match/100/0xd2FDc59405d1D6B5F293AB3E8fC2fC62D110Ecd6/sources/contracts/OrbisMain.sol | Interface for the ERC20 contracts created for reputation/ | interface ReputationToken {
function mint(address _member, uint _amount) external;
function burn(address _member, uint _amount) external;
function setMerkleRoot(uint _type, uint _id, bytes32 _merkleRoot) external;
}
| 14,267,255 |
./full_match/1/0x71079954D970435C4049e8b81cd393A8aCd1B3E1/sources/contracts/MultiTB.sol | Add or remove addresses from whitelist addrs List of addresses values List of values - true for adding to whitelist, false for removing from whitelist | function setWhitelist(
address[] calldata addrs,
bool[] calldata values
) external onlyOwner {
require(addrs.length == values.length, "Wrong params. Unequal lengths");
for (uint256 i = 0; i < addrs.length; i++) {
_setWhitelist(addrs[i], values[i]);
}
}
| 17,075,062 |
./full_match/43113/0x0A26B100F2b8f52f7655d66D07e90323EC988eDF/sources/YieldFarming/Farm.sol | Transfers accrued PMKN yield to the user The if conditional statement checks for a stored PMKN balance. If it exists, the the accrued yield is added to the accruing yield before the PMKN mint function is called | function withdrawYield() public {
uint256 toTransfer = calculateYieldTotal(msg.sender);
require(
toTransfer > 0 ||
pmknBalance[msg.sender] > 0,
"Nothing to withdraw"
);
if(pmknBalance[msg.sender] != 0){
uint256 oldBala... | 7,189,003 |
pragma solidity 0.4.21;
import "./ERC223.sol";
import "./ERC223Reciever.sol";
import "./StandardToken.sol";
import "./AddressTools.sol";
/**
* @title (Not)Reference implementation of the ERC223 standard token.
*/
contract ERC223Token is ERC223, StandardToken {
using AddressTools for address;
/**
* @dev... | Transfer the specified amount of tokens to the specified address. This function works the same with the previous one but doesn"t contain `_data` param. Added due to backwards compatibility reasons. _to Receiver address _value Amount of tokens that will be transferred/ | function transfer(address _to, uint256 _value) public returns (bool) {
bytes memory _data;
return executeTransfer(_to, _value, _data);
}
| 1,773,481 |
// SPDX-License-Identifier: BlueOak-1.0.0
pragma solidity 0.8.9;
import "contracts/libraries/Fixed.sol";
import "contracts/p0/RToken.sol";
import "contracts/p0/mixins/Component.sol";
import "contracts/p1/RToken.sol";
import "contracts/interfaces/IBackingManager.sol";
import "contracts/interfaces/IBasketHandler.sol";
i... | Governance-controlled setter to cause a basket switch explicitly TODO: modeA = !modeA, and we do all the needed trades and handle capitalization | function setBackupConfig(
bytes32,
uint256,
IERC20[] calldata
function refreshBasket() external {
++nonce;
timestamp = block.timestamp;
}
| 1,833,294 |
//Address: 0xc22407b1f34e494b7f85187fafc2ce5d13871ffb
//Contract name: GratitudeCrowdsale
//Balance: 0 Ether
//Verification Date: 11/1/2017
//Transacion Count: 11
// CODE STARTS HERE
pragma solidity ^0.4.11;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {... | Function using the Golden ticket - the current holder will be able to get the prize only based on the "goldenTicketUsed" event First checks the GT owner, then change the owner and fire an event about the ticket changing owner The Golden ticket isn't a standard ERC20 token and therefore it needs special handling newO... | function giveGoldenTicket(address newOwner) {
require (msg.sender == goldenTicketOwner);
goldenTicketOwner = newOwner;
goldenTicketMoved(newOwner);
}
| 12,655,506 |
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbe... | Check policy eligibility/ | function isEligible(address _addr, string _exchange, string _token) internal view
returns (bool)
{
if (
policies[_addr].exchange[_exchange].token[_token].state == 0 ||
policies[_addr].exchange[_exchange].token[_token].endDate < now
) {
return true;
... | 2,474,634 |
//Address: 0xee61d0f4d7da6953b4e3ca62cbe10c16045b6a67
//Contract name: BitindiaVestingContract
//Balance: 0 Ether
//Verification Date: 1/25/2018
//Transacion Count: 6
// CODE STARTS HERE
/**
*
The MIT License (MIT)
Copyright (c) 2018 Bitindia.
Permission is hereby granted, free of charge, to any person obtaining a ... | Check Own Balance Works only for transaction senders with valid Balance/ | function getMyBalance() public checkValidUser constant returns (uint256){
return ownersMap[msg.sender];
}
| 6,477,146 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.0 <0.9.0;
interface IERC20 {
event Approval(address indexed owner, address indexed spender, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value);
function name() external view returns (string memory);
funct... | Transfers {value} tokens of {from} to {to}, on behalf of the caller. from The address to transfer tokens from to The address to transfer tokens to value The number of tokens to be transferred return A boolean that indicates if the operation was successful/ | function transferFrom(address from, address to, uint256 value)
external
override
returns (bool) {
uint256 currentAllowance = allowance[from][msg.sender];
move(from, to, value);
allowance[from][msg.sender] = currentAllowance - value;
return true;
}
| 5,963,358 |
pragma solidity ^ 0.5.0;
import "./Agreement.sol";
import "./Transaction.sol";
import "./SafeMath.sol";
import "./Graph.sol";
import "./MainGraph.sol";
import "./AgreementFactory.sol";
import "./Transaction Factory.sol";
import "./Tools.sol";
import "./ToolFactory.sol";
contract Netereum
{
using SafeMath for uint25... | require(createdAgreements[agreementAddress].expireTime() > block.timestamp,"5");require(createdAgreements[agreementAddress].counterPermission() == 4, "7 "); | function addAgreement(address agreementAddress)
external
{
require(agreementsStatus[agreementAddress] == 1, "6");
agreements.push(Agreement(address(agreementAddress)));
numberOfAgreements++;
mainGraph.wrappedAddEdge(createdAgreements[agreementAddress].creditorCoordinator(), c... | 12,966,618 |
/**
* SourceUnit: d:\GitWork\MintedTunesNFT\contracts\contracts\MintedTunesAuction.sol
*/
////// SPDX-License-Identifier-FLATTEN-SUPPRESS-WARNING: MIT
pragma solidity ^0.8.0;
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ER... | Bidder sends bid on an auction Auction should be active and not ended Refund previous bidder if a new bid is valid and placed. _auctionId uint256 ID of the created auction/ owner can't bid on their auctions if auction is expired there are previous bids refund the last bidder | function bidOnAuction(uint256 _auctionId, uint256 amount) external payable {
require(_auctionId <= auctions.length && auctions[_auctionId].auctionId == _auctionId, "Could not find item");
Auction memory myAuction = auctions[_auctionId];
require(myAuction.owner != msg.sender, "owner ... | 11,896,971 |
pragma solidity >=0.5.0 <0.6.0;
library AdditiveMath {
/**
* Adds two numbers and returns the result
* THROWS when the result overflows
* @return The sum of the arguments
*/
function add(uint256 x, uint256 y)
internal
pure
returns (uint256) {
uint256 sum = x + y;
... | Subtracts two numbers and returns the result THROWS when the result underflows return The difference of the arguments/ | function subtract(uint256 x, uint256 y)
internal
pure
returns (uint256) {
require(y <= x, "Results in underflow");
return x - y;
}
| 14,038,767 |
./partial_match/1/0x68592c5c98C4F4A8a4bC6dA2121E65Da3d1c0917/sources/src/upgradeability/AdminUpgradeabilityProxy.sol | Upgrade the backing implementation of the proxy and call a function on the new implementation. This is useful to initialize the proxied contract. newImplementation Address of the new implementation. data Data to send as msg.data in the low level call. It should include the signature and the parameters of the function... | function upgradeToAndCall(
address newImplementation,
bytes calldata data
) external payable ifAdmin {
_upgradeTo(newImplementation);
require(success);
}
| 16,019,558 |
./full_match/11297108109/0xfF67105819c3c3503b7D18e26Aa85F7901C2eD18/sources/contracts/NFT/PFPCollection.sol | Just a sanity case in the worst case if this function is called late (EVM only stores last 256 block hashes) Prevent default sequence | function setStartingIndex() public {
_onlyManager();
uint256 targetBlock = _startingIndexBlockNumber;
require(
targetBlock != 0,
"Starting index block number has not been set"
);
require(_startingIndex == 0, "Starting index has already been set");
... | 13,236,599 |
//Address: 0x852de008100cbd305589d8d65850f864056148bd
//Contract name: UseChainToken
//Balance: 0 Ether
//Verification Date: 2/2/2018
//Transacion Count: 1
// CODE STARTS HERE
pragma solidity ^0.4.18;
// Owned contract
// -----------------------------------------------------------------------------
contract Control... | finalize only after closed stage | function finalize() public onlyController {
require(stageNow() == stageAt.finalState);
require(totalSupply + ecoFundSupply >= softCap);
finalized = true;
}
| 13,024,015 |
./partial_match/1/0x85F34416D65eE0a3A1376650802cC0447Fe19733/sources/CryptoCollect.sol | For querying owner of token _tokenId The tokenID for owner inquiry Required for ERC-721 compliance. | function ownerOf(uint256 _tokenId)
public
view
returns (address owner)
{
owner = collectibleIndexToOwner[_tokenId];
require(owner != address(0));
}
| 15,673,323 |
./full_match/3/0x81cef551356E11E5FD0Ca81f139Fec3752921287/sources/browser/PoolPortal.sol | get Bancor converter get converter as contract get connectors and amount approve from portal to converter | function testShit(IERC20 _poolToken, uint256 _amount)public view returns(
address[] memory connectorsAddress,
uint256[] memory connectorsAmount,
uint tokenAmount,
uint etherAmount
)
{
address converterAddress = getBacorConverterAddressByRelay(address(_poolToken));
BancorConver... | 14,191,004 |
// File: contracts\math\SafeMath.sol
pragma solidity 0.5.4;
/**
* @title SafeMath
* @dev Unsigned math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) interna... | isPausedUser/ | function isPausedUser(address account) external view returns (bool) {
return has(account);
}
| 14,082,375 |
pragma solidity ^0.5.0;
pragma experimental ABIEncoderV2;
/* Library Imports */
import { DataTypes } from "./DataTypes.sol";
import { RLPWriter } from "./RLPWriter.sol";
/**
* @title TransactionParser
*/
library TransactionParser {
/*
* Internal Functions
*/
/**
* Utility; computes the hash ... | Utility; RLP encodes an OVMTransactionData struct. Likely to be changed (if not moved to another contract). Currently remaining here as to avoid modifying CanonicalTransactionChain. Unclear whether or not this is the correct transaction structure, but it should work for the meantime. _transactionData Transaction data... | function encodeTransactionData(
DataTypes.OVMTransactionData memory _transactionData
)
internal
pure
returns (bytes memory)
{
bytes[] memory raw = new bytes[](8);
raw[0] = RLPWriter.encodeUint(_transactionData.timestamp);
raw[1] = RLPWriter.encodeUint... | 6,406,763 |
/**
*Submitted for verification at Etherscan.io on 2022-03-03
*/
/**
Contract is by captain ike and frens
,--. ,--. ,--.,--.
,---. ,--,--. ,---. ,-' '-. ,--,--.`--',--,--, `--'| |,-. ,---.
| .--'' ,-. || .-. |'-. .-'' ,-. |,--.| \ ,--.| /| .-. :
\ `--.\ '-' || '-' ' | | \ '-' || || || | | || \ \\ --.
`---... | Replacement for Solidity's `transfer`: sends `amount` wei to `recipient`, forwarding all available gas and reverting on errors. of certain opcodes, possibly making contracts go over the 2300 gas limit imposed by `transfer`, making them unable to receive funds via `transfer`. {sendValue} removes this limitation. IMPORTA... | function sendValue(address payable recipient, uint256 amount) internal {
require(
address(this).balance >= amount,
"Address: insufficient balance"
);
require(
success,
"Address: unable to send value, recipient may have reverted"
);
}
| 2,311,596 |
pragma solidity ^0.4.11;
/**
* Math operations with safety checks
*/
library SafeMath {
function mul(uint a, uint b) internal returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint a, uint b) internal returns (uint) {
// assert(b > 0); //... | Calculate the amount of non vested tokens at a specific time. grant TokenGrant The grant to be checked. time uint64 The time to be checked return An uint representing the amount of non vested tokens of a specifc grant on the passed time frame./ | function nonVestedTokens(TokenGrant grant, uint64 time) private constant returns (uint256) {
return grant.value.sub(vestedTokens(grant, time));
}
| 5,424,902 |
./full_match/4/0x514fd962486337d597b43cbFC1F204Ca1EB8493B/sources/erc721a/ERC721A.sol | Returns the unpacked `TokenOwnership` struct from `packed`./ | function _unpackedOwnership(uint256 packed) private pure returns (TokenOwnership memory ownership) {
ownership.addr = address(uint160(packed));
ownership.startTimestamp = uint64(packed >> _BITPOS_START_TIMESTAMP);
ownership.burned = packed & _BITMASK_BURNED != 0;
ownership.extraData ... | 730,011 |
./full_match/1/0xBf7EE8D41fA851fa94D4E908209aD1A97E13EDD9/sources/POE/GovPOE.sol | Delegates votes from signatory to `delegatee` delegatee The address to delegate votes to nonce The contract state required to match the signature expiry The time at which to expire the signature v The recovery byte of the signature r Half of the ECDSA signature pair s Half of the ECDSA signature pair/ | function delegateBySig(address delegatee, uint nonce, uint expiry, uint8 v, bytes32 r, bytes32 s) public {
bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name())), getChainId(), address(this)));
bytes32 structHash = keccak256(abi.encode(DELEGATION_TYPEHASH, delegatee... | 3,179,251 |
./full_match/42220/0x893Bf1159213B3E412f058631fb239C43b394976/sources/contracts/managed/CircuitBreakerStorageLib.sol | Sets the reference BPT price, normalized weight, and upper and lower bounds for a token. If a bound is zero, it means there is no circuit breaker in that direction for the given token. bptPrice: The BPT price of the token at the time the circuit breaker is set. The BPT Price of a token is generally given by: supply ... | function setCircuitBreaker(
uint256 bptPrice,
uint256 referenceWeight,
uint256 lowerBound,
uint256 upperBound
) internal pure returns (bytes32) {
_require(
lowerBound == 0 || (lowerBound >= _MIN_BOUND_PERCENTAGE && lowerBound <= FixedPoint.ONE),
Er... | 16,314,124 |
pragma solidity ^0.4.17;
/**
* @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);
... | Forward ERC20 methods to upgraded contract if this one is deprecated | function transferFrom(address _from, address _to, uint _value) public whenNotPaused {
require(!isBlackListed[_from]);
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).transferFromByLegacy(msg.sender, _from, _to, _value);
return super.transferFrom(_from, _to, _v... | 436,262 |
pragma solidity ^0.4.18;
/**
* @title ExampleDivisibleNFTs
* @dev Exploring the need for a non-fungible token to have multiple owners with different shares
*
* @dev A 'unit' in this example is the minimum part of a token that an owner can have.
*
* @notice This is just an example for the Ethereum request... | Anybody can create a token in our example Minting grants 100% of the token to a new owner in our exampleMinted(_owner, _tokenId); emit event | function mint(address _owner, uint _tokenId) public onlyNonExistentToken (_tokenId)
{
mintedToken[_tokenId] = true;
_addShareToNewOwner(_owner, _tokenId, divisibility);
_addNewOwnerHoldingsToToken(_owner, _tokenId, divisibility);
totalSupply = totalSupply + 1;
}
| 14,049,372 |
// SPDX-License-Identifier: GPL-3.0
// File: @openzeppelin/contracts/utils/introspection/IERC165.sol
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
... | This sets the max supply. This will be set to 10,000 by default, although it is changable. | function setMaxSupply(uint256 _newSupply) public onlyOwner() {
maxSupply = _newSupply;
}
| 50,501 |
pragma solidity ^0.4.21;
/* ************************************************ */
/* ********** Zeppelin Solidity - v1.5.0 ********** */
/* ************************************************ */
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
... | Appoint sales agent of token | function setSalesAgent(address newSalesAgent) onlyOwner public {
SalesAgentAppointed(salesAgent, newSalesAgent);
salesAgent = newSalesAgent;
}
| 10,655,887 |
./full_match/1/0x2846b7C57C0666203D694f464Fd876d9026ba9d2/sources/contracts/xSGT.sol | burn a token id Requirements: - caller must have burner role/ burn | function burn(uint256 tokenId) external {
require(hasRole(BURNER_ROLE, msg.sender), "Caller is not a burner");
_burn(tokenId);
}
| 8,309,716 |
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.5.0;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "../../abstract/MasterAware.sol";
import "../../interfaces/IClaims.sol";
import "../../interfaces/IClaimsData.sol";
import "../../interfaces/IClaimsReward.sol";
import "../../interfaces/IMemberR... | to check if the address is authorized to govern or not _add is the address in concern return the boolean status status for the check/ | function checkIsAuthToGoverned(address _add) public view returns (bool) {
return isAuthorizedToGovern(_add);
}
| 1,749,084 |
pragma solidity ^0.4.24;
// File: contracts/libs/PointsCalculator.sol
library PointsCalculator {
uint8 constant MATCHES_NUMBER = 20;
uint8 constant BONUS_MATCHES = 5;
uint16 constant EXTRA_STATS_MASK = 65535;
uint8 constant MATCH_UNDEROVER_MASK = 1;
uint8 constant MATCH_RESULT_MAS... | Safely transfers the ownership of a given token ID to another address If the target address is a contract, it must implement `onERC721Received`, which is called upon a safe transfer, and return the magic value `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise, the transfer is reverted. R... | function safeTransferFrom(address _from, address _to, uint256 _tokenId) public {
safeTransferFrom(_from, _to, _tokenId, "");
}
| 12,723,284 |
pragma solidity ^0.5.0;
import "./Services/DSRLending.sol";
// An implementation of handling automated listings
contract ListingManager is DSRLending {
struct Listing {
uint256 price; // Token balance
uint256 timestamp; // timestamp until listing is available again
address renter;
a... | Creates a listing(uint256 _id) | function createListing(
uint256 _id,
) public {
Listing memory listing = Listing(_price, 0, address(0), msg.sender);
listings[_id] = listing;
emit listingCreated(_id, listing.price, _isBooked(listing.timestamp), listing.renter, listing.owner);
}
| 12,668,424 |
/**
*Submitted for verification at Etherscan.io on 2021-07-16
*/
/*
*Website: https://www.coinmerge.io
*Telegram: https://t.me/CoinMergeMain
*Twitter: https://twitter.com/coinmerge?s=21
*
*CoinMerge is the revolutionary new token and platform that not only rewards holders in Ethereum just for hol... | This practice only came about because of the lack of understanding on how contracts work | modifier onlyOwner() {
require(_msgSender() == m_Owner, "Ownable: caller is not the owner");
_;
function createPair(address tokenA, address tokenB) external returns (address pair);
}
| 7,930,529 |
./partial_match/1/0xE583C6ED8222265A4147362540aa7ACc5bc9634a/sources/DMEX_Base.sol | Changes the owner of the contract | function setOwner(address newOwner) public onlyOwner {
emit SetOwner(owner, newOwner);
owner = newOwner;
}
| 3,655,452 |
./partial_match/1/0x5609FE6fDfE82e609E74C1a77B2155b34DFbAa51/sources/Crowdsourcer.sol | record contribution in accounting (will perform validations) actually transfer tokens and revert tx if any problem | function contribute(
uint128 amount,
uint128 feeNumerator
) external requiresInitialization beforeDisputeOnly {
uint128 amountWithFees = m_accounting.addFeesOnTop(amount, feeNumerator);
IERC20 rep = getREP();
require(rep.balanceOf(msg.sender) >= amountWithFees, "Not enough funds");
require(... | 15,930,982 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "../interfaces/LinkTokenInterface.sol";
import "../interfaces/BlockhashStoreInterface.sol";
import "../interfaces/AggregatorV3Interface.sol";
import "../interfaces/VRFCoordinatorV2Interface.sol";
import "../interfaces/TypeAndVersionInterface.sol";
import "... | calls target address with exactly gasAmount gas and data as calldata or reverts if at least gasAmount gas is not available./ solhint-disable-next-line no-inline-assembly Compute g -= GAS_FOR_CALL_EXACT_CHECK and check for underflow The gas actually passed to the callee is min(gasAmount, 6364gas available). We want to e... | function callWithExactGas(
uint256 gasAmount,
address target,
bytes memory data
) private returns (bool success) {
assembly {
let g := gas()
if lt(g, GAS_FOR_CALL_EXACT_CHECK) {
revert(0, 0)
}
g := sub(g, GAS_FOR_CALL_EXACT_CHECK)
if iszero(gt(sub(g, div(g, 64))... | 922,671 |
./full_match/1/0xe5b9239A8be521C9A08ba9A4b925DFa86Ee19024/sources/contracts/CopyPasta.sol | Max tx check Buys Max wallet check Sells Don't check max wallet or you fuck up LP Check if last tx occurred this block - prevents sandwich attacks Sells No code to change transfer tax Still check max wallet | function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
uint32 _ta... | 2,950,166 |
./full_match/5/0xaf5616126ABEF7313ad3F03C978dEccF80c97DF9/sources/contracts/library/erc721A/extentions/ERC721AVestable.sol | @inheritdoc IERC721AVestable | function clearVesting() external virtual override {
delete s_vestingRange;
}
| 1,890,552 |
./partial_match/1/0x613d6d6a81636D8707A7abf45374c4c560FA426C/sources/contracts/universal/OptimismMintableERC20Factory.sol | @custom:legacy Creates an instance of the OptimismMintableERC20 contract. Legacy version of the newer createOptimismMintableERC20 function, which has a more intuitive name. _remoteToken Address of the token on the remote chain. _name ERC20 name. _symbol ERC20 symbol. return Address of the newly ... | function createStandardL2Token(
address _remoteToken,
string memory _name,
string memory _symbol
) external returns (address) {
return createOptimismMintableERC20(_remoteToken, _name, _symbol);
}
| 2,708,264 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.7;
/*
██████╗ ███████╗ █████╗ ██╗ ██╗████████╗██╗ ██╗ ██████╗ █████╗ ██████╗ ██████╗ ███████╗
██╔══██╗██╔════╝██╔══██╗██║ ██║╚══██╔══╝╚██╗ ██╔╝██╔════╝██╔══██╗██╔══██╗██╔══██╗██╔════╝
██████╔╝█████╗ ███████║██║ ██║ ██║ ╚████╔╝ ██║ ██████... | minimum rental duration (1 day divisor: i.e. 24 = 1 hour, 48 = 30 mins) _newDivisor the divisor to set | function setMinRental(uint256 _newDivisor) public override onlyRole(OWNER) {
minRentalDayDivisor = _newDivisor;
}
| 979,345 |
./partial_match/3/0xE5dD5466314a590680d107B2Dea8114cd694BBfd/sources/Strategy.sol | Returns the integer division of two unsigned integers. Reverts on division by zero. The result is rounded towards zero. Counterpart to Solidity's `/` operator. Note: this function uses a `revert` opcode (which leaves remaining gas untouched) while Solidity uses an invalid opcode to revert (consuming all remaining gas).... | function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
| 5,277,432 |
// SPDX-License-Identifier: AGPL-3.0-or-later
// hevm: flattened sources of src/DssSpell.sol
pragma solidity =0.6.12 >=0.6.11 <0.7.0;
////// lib/dss-exec-lib/src/CollateralOpts.sol
/* pragma solidity ^0.6.11; */
struct CollateralOpts {
bytes32 ilk;
address gem;
address join;
address flip;
address ... | / Constants /// Math Functions // | function add(uint x, uint y) internal pure returns (uint z) {
require((z = x + y) >= x);
}
| 10,172,899 |
//Address: 0x22a1ed2f03206be150ede2a7ffa909f7be033d99
//Contract name: AuthenticationManager
//Balance: 0 Ether
//Verification Date: 10/24/2017
//Transacion Count: 1
// CODE STARTS HERE
pragma solidity ^0.4.11;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMat... | Determine how much to pay each shareholder. / Enum all accounts and send them payment / Attempt to send changeuint256 remainder = msg.value.sub(totalPaidOut); | function () payable {
if (xwinContract.isClosed())
throw;
uint256 validSupply = xwinContract.totalSupply();
uint256 paymentPerShare = msg.value.div(validSupply);
if (paymentPerShare == 0)
throw;
uint256 totalPaidOut = 0;
for (uint256 i = 0; i... | 6,355,916 |
./partial_match/42/0xb0D299d01bBD2fb20A52E315c768C88C44256d92/sources/ProofOfHumanity.sol | Change the proportion of arbitration fees that must be paid as fee stake by the winner of the previous round. _winnerStakeMultiplier Multiplier of arbitration fees that must be paid as fee stake. In basis points./ | function changeWinnerStakeMultiplier(uint _winnerStakeMultiplier) external onlyGovernor {
winnerStakeMultiplier = _winnerStakeMultiplier;
}
| 3,440,443 |
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
// Forked from Uniswap's UNI
// Reference: https://etherscan.io/address/0x1f9840a85d5af5bf1d1762f925bdaddc4201f984#code
contract Tribe {
/// @notice EIP-20 token name for this token
// solhint-disable-next-line const-name-snakecase
string public co... | Delegates votes from signatory to `delegatee` delegatee The address to delegate votes to nonce The contract state required to match the signature expiry The time at which to expire the signature v The recovery byte of the signature r Half of the ECDSA signature pair s Half of the ECDSA signature pair/ solhint-dis... | function delegateBySig(address delegatee, uint nonce, uint expiry, uint8 v, bytes32 r, bytes32 s) public {
bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this)));
bytes32 structHash = keccak256(abi.encode(DELEGATION_TYPEHASH, delegatee, ... | 6,180,293 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";
import "@openzeppeli... | Contracts the metadata URI for the Producer Pass of the given episodeId. Requirements: - The Producer Pass exists for the given episode/ | function uri(uint256 episodeId)
public
view
override
returns (string memory)
{
require(
episodeToProducerPass[episodeId].episodeId != 0,
"Invalid episode"
);
return
string(
abi.encodePacked(
... | 1,528,306 |
./partial_match/1/0x9C05dc7c7f6332CBc16Ce1e196Ff6928f3fCe5bF/sources/Platform.sol | The wallet to receive payments here before initiating crowdsale will overwrite old wallet addressemit LogPlatformWallet(_walletAddress); | function setPlatformFundsWallet(address _walletAddress)
external
onlyOwner {
database.setAddress(keccak256(abi.encodePacked("platform.wallet.funds")), _walletAddress);
events.registration('Platform funds wallet', _walletAddress);
}
| 3,619,124 |
./full_match/1/0xBe2E0c770785179210b27d76354B2950EB90b94C/sources/contracts/BLSTokenERC1155.sol | xref:ROOT:erc1155.adocbatch-operations[Batched] variant of {mint}./ | function mintBatch(
address _to,
uint256[] memory _ids,
string[] calldata _uri,
uint256[] memory _amounts,
bytes memory _data
) external virtual {
require(hasRole(MINTER_ROLE, _msgSender()), "BLSTokenERC1155: must have minter role to mint");
_mintBatch(_t... | 16,483,561 |
./full_match/42/0xEBD18473513D68E5b463800cDd717b64B542Cd03/sources/browser/doan_antt_nhom2.sol | Vđv đăng ký tham giaNhập vào các tham số sau: Họ tên, năm sinh, đội muốn tham gia, cự ly, thời gian đăng ký | function registerAthletes(string memory _name,uint _yearOfBirth, uint _team, uint _distance, uint _rperiod) public{
athletes.push(Athletes( idnext, _name, _yearOfBirth, _team, _distance, 0, _rperiod,0));
++idnext;
}
| 16,222,944 |
pragma solidity 0.8.6;
contract AddressesProvider {
address public ownerAddress;
mapping(uint256 => address) addressMap;
mapping(uint256 => string) addressIdMap;
uint256 addressesLength;
constructor() {
ownerAddress = msg.sender;
}
struct AddressMetadata {
string addrId;
... | Case insensitive string search needle The string to search for haystack The string to search in return Returns -1 if no match is found, otherwise returns the index of the match/ | function indexOf(string memory needle, string memory haystack)
internal
pure
returns (int256)
{
bytes memory _needle = bytes(needle);
bytes memory _haystack = bytes(haystack);
if (_haystack.length < _needle.length) {
return -1;
}
bool _... | 12,580,827 |
pragma solidity ^0.4.24;
//==============================================================================
// _ _ _ _|_ _ .
// (/_\/(/_| | | _\ .
//==============================================================================
contract F3Devents {
// fired whenever a player registers a name
event o... | set up our tx event data and determine if player is new or not fetch player id manage affiliate residuals if no affiliate code was given or player tried to use their own, lolz use last stored affiliate code if affiliate code was given get affiliate ID from aff Code if affID is not the same as previously stored | function buyXaddr(address _affCode, uint256 _team)
isActivated()
isHuman()
isWithinLimits(msg.value)
public
payable
{
F3Ddatasets.EventReturns memory _eventData_ = determinePID(_eventData_);
uint256 _pID = pIDxAddr_[msg.sender];
u... | 9,851,753 |
//Contract based on [https://docs.openzeppelin.com/contracts/3.x/erc721](https://docs.openzeppelin.com/contracts/3.x/erc721)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./ERC721.sol";
import "./ZombieAttack.sol";
//the zo
contract ZombieOwnership is ZombieAttack, ERC721 {
//use safemath
us... | 2. Return the owner of `_tokenId` here | function ownerOf(uint256 _tokenId) external override view returns (address) {
return zombieToOwner[_tokenId];
}
| 12,770,456 |
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity >=0.6.11;
pragma experimental ABIEncoderV2;
// ============ Internal Imports ============
import {Home} from "../Home.sol";
import {Version0} from "../Version0.sol";
import {XAppConnectionManager, TypeCasts} from "../XAppConnectionManager.sol";
import {IMes... | Exit recovery mode callable by the recovery manager to end recovery mode/ | function exitRecovery() external onlyRecoveryManager {
require(recoveryActiveAt != 0, "recovery not initiated");
delete recoveryActiveAt;
emit ExitRecovery(recoveryManager);
}
| 9,926,135 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.2;
import '@openzeppelin/contracts/utils/cryptography/ECDSA.sol';
import '@unlock-protocol/contracts/dist/PublicLock/ILockKeyPurchaseHookV7.sol';
import '@unlock-protocol/contracts/dist/PublicLock/IPublicLockV8sol8.sol';
import '../mixins/LockRoles.sol';
/**
* @no... | Allows the lock manager to remove one or more codes./ | function removeCodes(
IPublicLockV8 _lock,
address[] calldata _codeAddresses
) external
onlyLockManager(_lock)
{
for(uint i = 0; i < _codeAddresses.length; i++)
{
require(_codeAddresses[i] != address(0), 'INVALID_CODE');
lockToCodeAddress[address(_lock)][_codeAddresses[i]] = false;... | 1,071,296 |
./full_match/4/0x7C2aEBAfBB7c7AD6bE572A587a4634394924B2c9/sources/smartsig/NiftyNafty.sol | Get the next token ID Randomly gets a new token ID and keeps track of the ones that are still available. return the next token ID If this matrix position is empty, set the value to the generated random number. Otherwise, use the previously stored number from the matrix. If the last available tokenID is still unused...... | function nextToken(uint256 tokenCount) internal returns (uint256) {
uint256 maxIndex = PUBLIC_MAX - tokenCount;
uint256 random = uint256(keccak256(
abi.encodePacked(
msg.sender,
block.coinbase,
block.difficulty,
... | 12,529,387 |
./full_match/4/0x6831048fd98b7f5e58735d2Ad7D35B49F3A2e024/sources/browser/GovTreasurer.sol | DEPOSIT | ASSETS (TOKENS) | function deposit(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
updatePool(_pid);
uint256 taxedAmount = _amount.div(pool.taxRate);
uint256 pending = user.amount.mul(pool.accGDAOPerShare)... | 755,316 |
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function add(uint256 x, uint256 y) pure internal returns (uint256) {
uint256 z = x + y;
assert((z >= x) && (z >= y));
return z;
}
funct... | Main Payable function. In case if purchaser purchases on more than 10 ETH - only send tokens back if a person passed KYC (whitelisted) in other case - funds are being frozen until whitelisting will be done. If price will change before whitelisting is done for person, person will receive tokens basing on the new price,... | function () payable stopInEmergency onlyAfterStart onlyBeforeEnd public
{
require (crowdsaleClosed == false);
require (tokensAvailableForSale > tokensSoldOnPublicRound);
require (msg.value > 500000000000000);
if ((balanceOf[msg.sender] + msg.value) > maxPurchaseNonWhiteListed &&... | 2,554,596 |
pragma solidity 0.6.12;
import "../prize-strategy/PeriodicPrizeStrategy.sol";
/* solium-disable security/no-block-members */
interface PeriodicPrizeStrategyDistributorInterface {
function distribute(uint256 randomNumber) external;
} | solium-disable security/no-block-members / | interface PeriodicPrizeStrategyDistributorInterface {
function distribute(uint256 randomNumber) external;
} | 1,805,083 |
./partial_match/1/0x266aB88D8679f3935990DD3db1d19ceeE939599d/sources/afiUSDT.sol | No rebalance implementation for lower fees and faster swaps Could have over value from cTokens Calc to redeem before updating balances Check balance | function withdraw(uint256 _shares)
external
nonReentrant
{
require(_shares > 0, "withdraw must be greater than 0");
uint256 ibalance = balanceOf(msg.sender);
require(_shares <= ibalance, "insufficient balance");
pool = _calcPoolValueInToken();
uint256 r = (pool.mul(_share... | 3,557,351 |
pragma solidity ^0.5.0;
import "./HotelToken.sol";
contract HotelTokenSale {
address payable admin;
HotelToken public tokenContract;
uint256 public tokenPrice;
uint256 public tokensSold;
event Sell(address _buyer, uint256 _amount);
event EndSale(uint256 _totalAmountSold);
constructor(Hot... | require(tokenContract.transfer(admin, tokenContract.balanceOf(address(this)))); UPDATE: Let's not destroy the contract here Just transfer the balance to the admin | function endSale() public {
require(msg.sender == admin,"sender is not admin");
require(tokenContract.transfer(admin, tokenContract.balanceOf(address(this)),1),"error in end sale");
admin.transfer(address(this).balance);
emit EndSale(tokensSold);
}
| 5,525,891 |
./full_match/1/0x166aEeE931f1933DA41273D0A76d8b23Dca3c196/sources/MouseTrap.sol | must register before trying to steal cheese must wait at least 1 block after registering before trying to steal cheese must have priority fee of at least 20 gwei must pass in the correct block number cheese can be stolen only once per block | function stealTheCheese(uint256 _targetBlock) external {
if (registeredBlock[msg.sender] == 0) return;
if (block.number == registeredBlock[msg.sender]) {
_lose();
return;
}
if (tx.gasprice - block.basefee < 20 gwei) {
_lose();
... | 2,904,878 |
// simple planet invitation management contract
// https://azimuth.network
pragma solidity 0.4.24;
////////////////////////////////////////////////////////////////////////////////
// Imports
////////////////////////////////////////////////////////////////////////////////
// OpenZeppelin's Ownable.sol
/**
* @tit... | transferPoint(): transfer _point to _target, clearing all permissions data and keys if _reset is true Note: the _reset flag is useful when transferring the point to a recipient who doesn't trust the previous owner. Requirements: - :msg.sender must be either _point's current owner, authoriz... | function transferPoint(uint32 _point, address _target, bool _reset)
public
{
require(azimuth.canTransfer(_point, msg.sender));
if ( !azimuth.isActive(_point) )
{
azimuth.activatePoint(_point);
}
{
address old = azimuth.getOwner(_point);
azimuth.setO... | 1,401,170 |
./partial_match/8453/0x6131B5fae19EA4f9D964eAc0408E4408b66337b5/sources/MetaAggregationRouterV2.sol | take fee and deduct total swap amount take fee | function swapSimpleMode(
IAggregationExecutor caller,
SwapDescriptionV2 memory desc,
bytes calldata executorData,
bytes calldata clientData
) public returns (uint256 returnAmount, uint256 gasUsed) {
uint256 gasBefore = gasleft();
require(!_isETH(desc.srcToken), 'src is eth, should use norma... | 16,716,896 |
./full_match/1/0xFD9E52A73d92E08903BFe6f42aeDEB82a86EFF35/sources/contracts/NAGOMIMinterHalfYear.sol | ミント関数/ フリーミント用のMint関数 セールフェイズチェック マークルツリーチェック:ルートはfreeMintMerkleRoot ミント枚数チェック:フリーミントは1枚まで フリーミント済み数加算 | function freeMint(uint256 _mintAmount, bytes32[] calldata _merkleProof)
external
callerIsUser
notZeroMint(_mintAmount)
notOverMaxSupply(_mintAmount)
{
require(phase == SalePhase.FreeMint, "FreeMint is disabled");
bytes32 leaf = keccak256(abi.encodePacked(msg.send... | 3,024,496 |
./full_match/44787/0xE872636cca1c141B62bd9f82C745cE6b9113C6bD/sources/project_/contracts/KolorLandToken.sol | Return all investments made by an address / | function investmentsOf(address account)
public
view
returns (Investment[] memory)
{
uint256 _totalInvestmentsOf = totalInvestmentsOf(account);
Investment[] memory investments = new Investment[](_totalInvestmentsOf);
for (uint256 i = 0; i < _totalInvestmentsOf; i... | 13,260,558 |
// SPDX-License-Identifier: MIYA
pragma solidity ^0.8.0;
// It's important to avoid vulnerabilities due to numeric overflow bugs
// OpenZeppelin's SafeMath library, when used correctly, protects agains such bugs
// More info: https://www.nccgroup.trust/us/about-us/newsroom-and-events/blog/2018/november/smart-contract-... | Register an oracle with the contract Require registration fee | function registerOracle() public payable requireIsOperational() {
require(msg.value >= REGISTRATION_FEE, "Registration fee is required");
require(!oracles[msg.sender].isRegistered , "Oracle already registered");
uint8[3] memory indexes = generateIndexes(msg.sender);
emit OracleReg... | 13,002,042 |
./partial_match/1/0xBf6E1F1Fd72080C4793e89aCB8FB61ef1A61cA67/sources/Proposal32.sol | Rescues tokens and sends them to the `to` address token The address of the token to The address for which the tokens should be send return Success/ | function rescueTokens(
address token,
address to,
uint256 amount
) external returns (bool) {
token;
to;
delegateAndReturn();
}
| 4,473,871 |
/**
//
IMPORTANT: Developer should update the ISecurityTokenRegistry.sol (Interface) if there is any change in
function signature or addition/removal of the functions from SecurityTokenRegistry & STRGetter contract.
//
*/
pragma solidity ^0.5.0;
import "openzeppelin-solidity/contracts/math/S... | Gets the ticker registration fee return Fee amount/ | function getTickerRegistrationFee() public returns(uint256 polyFee) {
(, polyFee) = getFees(TICKERREGFEE);
}
| 12,533,471 |
// Sources flattened with hardhat v2.2.1 https://hardhat.org
// File @openzeppelin/contracts/utils/Context.sol@v3.4.1
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While th... | check if amount1 is exceeded check if swapped amount of token1 is exceeded maximum allowance transfer amount of token1 to this contract send token0 to sender send excess amount of token1 back to sender send token1 to creator | function swap(uint index, uint amount1) external payable poolShouldExist(index) poolShouldOpen(index) checkInWhitelist(index, msg.sender) {
TokenInfo memory tokenInfo = tokenInfos[index];
require(tokenInfo.amountTotal1 > tokenInfo.amountSwap1, "INSUFFICIENT SWAP AMOUNT");
uint excessAmount1... | 280,091 |
/**
*Submitted for verification at Etherscan.io on 2021-06-08
*/
//SPDX-License-Identifier: MIT
pragma solidity 0.8.1;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external v... | This function will put a lien on the user who runs this function Emits Stake_Deposited event if successful amount Amount of tokens to stake vega_public_key Target Vega public key to be credited with the stake lockuser applies this to themselves which only multisig control can remove | function stake_tokens(uint256 amount, bytes32 vega_public_key) public {
require(user_stats[msg.sender].lien + amount > user_stats[msg.sender].lien);
require(user_total_all_tranches(msg.sender) >= user_stats[msg.sender].lien + amount);
user_stats[msg.sender].lien += amount;
emit StakeDeposited(msg.send... | 10,633,224 |
pragma solidity ^0.4.24;
// File: contracts/math/Math.sol
/**
* @title Math
* @dev Assorted math operations
*/
library Math {
function max64(uint64 a, uint64 b) internal pure returns (uint64) {
return a >= b ? a : b;
}
function min64(uint64 a, uint64 b) internal pure returns (uint64) {
return a < b ... | Computes total bonuses amount by value _cents deposit amount in USD cents return total bonus percent (sum of applied bonus percents), bonusIds (sum of applied bonus flags)/ | function computeBonuses(uint256 _cents)
public
view
returns (uint256, uint256)
{
uint256 bonusTotal;
uint256 bonusIds;
for (uint i = 0; i < amountBonuses.length; i++) {
if (_cents >= amountBonuses[i].amountFrom &&
_cents <= amountBonuses[i].amountTo) {
bonusTotal += amoun... | 2,110,680 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.4;
// import "hardhat/console.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "... | The starting time of TGE _timestamp The initial timestamp, this timestap should be used for vesting isInitialized = true; | function setInitialTimestamp(uint256 _timestamp) external onlyOwner() notInitialized() {
_initialTimestamp = _timestamp;
}
| 11,956,341 |
// SPDX-License-Identifier: UNLICENSED
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
pragma solidity ^0.8.0;
/**
*... | Returns the tokenURI if exists and using the default - aka main - metadata storage pointer specified by {mainStorage}. See {IERC721Metadata-tokenURI} for more details./ | function tokenURI(uint256 tokenId) public view virtual override(ERC721) returns (string memory) {
return getTokenURI(tokenId, mainStorage);
}
| 15,862,393 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.