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/1/0x0Fd8Dca19CF252cFDdde5895dC860486276Dee4c/sources/browser/QNTX.sol | Withdraws GSN fee that collect from user/ | function withdrawGSNFee(address _payee, uint256 _amount)
public
onlyOwner
{
_transfer(address(this), _payee, _amount);
emit GSNFeeWithdrawed(_payee, _amount);
}
| 2,969,105 |
./partial_match/1/0x075B36dE1Bd11cb361c5B3B1E80A9ab0e7aa8a60/sources/contracts/libraries/UniswapV2Library.sol | given an output amount of an asset and pair reserves, returns a required input amount of the other asset | function getAmountIn(
uint256 amountOut,
uint256 reserveIn,
uint256 reserveOut
) internal pure returns (uint256 amountIn) {
require(amountOut > 0, 'INSUFFICIENT_OUTPUT_AMOUNT');
require(reserveIn > 0 && reserveOut > 0, 'INSUFFICIENT_LIQUIDITY');
uint256 numerator ... | 2,802,223 |
// SPDX-License-Identifier: UNLICENSED
// (c) Copyright 2021 YieldMagic LLC. All rights reserved.
//
// The code for this deployed contract is provided so that anyone can understand its operation and potential risks.
// Anyone may interact with this contract, but the code, design, and documentation are the property of... | See {MasterChefAdapter-_masterChefWithdraw} Get the balance of staking tokens on the adapter before withdrawing Withdraw the pool tokens from the MasterChef staking pool The difference is the amount of staking tokens burned by withdrawing | function _masterChefWithdraw(PoolInfo calldata pool, uint256 poolTokens)
virtual override
internal
{
uint256 stakingTokens = pool.tokenA.balanceOf(address(this));
super._masterChefWithdraw(pool, poolTokens);
stakingTokens = stakingTokens - pool.tokenA.balanceOf(address(... | 1,014,570 |
/*
Copyright (c) 2016 Smart Contract Solutions, Inc.
Original: https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol
*/
pragma solidity ^0.4.21;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multipli... | Integer division of two numbers, truncating the quotient./ assert(b > 0); Solidity automatically throws when dividing by 0 uint256 c = a / b; assert(a == b c + a % b); There is no case in which this doesn't hold | function div(uint a, uint b) internal pure returns (uint c) {
require(b > 0);
c = a / b;
}
| 12,922,865 |
/**
*Submitted for verification at Etherscan.io on 2021-11-15
*/
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 ({ERC165C... | Unstakes the zombies from the grave, but only if the zombie has been claimed first. graveId Grave Id/ "You need to claim the zombie first" "Message Sender was not original staker!" | function claimAndUnstake(uint256 graveId) public {
claimZombie(graveId);
require(
tokenIdToYield[graveId] == true
);
for (uint256 i = 0; i < graveyardIdToCatIds[graveId].length; i++) {
require(
tokenIdToStaker[graveyardIdToCatIds[graveId][i]]... | 2,153,078 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import { LibDiamondCut } from "./diamond/LibDiamondCut.sol";
import { DiamondFacet } from "./diamond/DiamondFacet.sol";
import { OwnershipFacet } from "./diamond/OwnershipFacet.sol";
import { LibDiamondStorage } from "./diamond/... | This function issues DDX rewards to a trader. It can be called by any facet part of the diamond. _amount DDX tokens to be rewarded. _trader Trader address./ If trader does not have a DDX on-chain wallet yet, create one | function issueDDXReward(uint96 _amount, address _trader) internal {
LibDiamondStorageTrader.DiamondStorageTrader storage dsTrader = LibDiamondStorageTrader.diamondStorageTrader();
TraderDefs.Trader storage trader = dsTrader.traders[_trader];
if (trader.ddxWalletContract == address(0)) {
... | 1,813,521 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
import "@openzeppelin/contracts-upgradeable/proxy/ClonesUpgradeable.sol";
import "./GoodAaveStakingV2.sol";
import "../../Interfaces.sol";
/**
* @title Staking contract that donates earned interest to the DAO
* allowing stakers to deposit Token
* or withdraw... | Query user's pending reward with updated variables user the user to update rewardsPerBlock how much rewards does this contract earns per block blockStart block from which contract starts earning rewards blockEnd block from which contract stops earning rewards return returns amount of user's earned but not minted r... | function getUserPendingReward(
address user,
uint256 rewardsPerBlock,
uint256 blockStart,
uint256 blockEnd
) public view returns (uint256) {
UserInfo memory userInfo = users[user];
uint256 _accAmountPerShare = accAmountPerShare;
uint256 pending = 0;
if (
totalEffectiveStakes != 0 &&
block.numbe... | 1,307,326 |
./full_match/40/0x110dE362cc436D7f54210f96b8C7652C2617887D/sources/contracts/libraries/AmountMath.sol | rightPt - (leftPt - 1), pc = leftPt - 1 | function getAmountXUnitLiquidity_96(
int24 leftPt,
int24 rightPt,
uint160 sqrtPriceR_96,
uint160 sqrtRate_96
) internal pure returns (uint256 amount_96) {
uint160 sqrtPricePrPc_96 = LogPowMath.getSqrtPrice(rightPt - leftPt + 1);
uint160 sqrtPricePrPd_96 = LogPowMa... | 9,551,907 |
/**
*Submitted for verification at Etherscan.io on 2021-11-13
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.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, ... | Returns the subtraction of two unsigned integers, reverting with custom message on overflow (when the result is negative). CAUTION: This function is deprecated because it requires allocating memory for the error message unnecessarily. For custom revert reasons use {trySub}. Counterpart to Solidity's `-` operator. Requi... | function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
return a - b;
}
| 10,697,548 |
./full_match/3/0xc88bdE7AD1047F6A66c1443A3Ef41d048526326b/sources/browser/Nhom1.sol | ham lay ten tat ca tac gia | function getNameAuthors() public view returns(string memory auth1,string memory auth2,string memory auth3){
(auth1, auth2, auth3) = (authors[0].name, authors[1].name, authors[2].name);
}
| 14,234,252 |
./full_match/97/0x0109c89bc47a13Aa0939d7292E2E38500F7AE9fC/sources/project_/contracts/factories/KatanaNftFactory.sol | Function execute flex by abi decoded and params/ solhint-disable-next-line no-inline-assembly solhint-disable-next-line no-inline-assembly | function execute(
address to,
uint256 value,
bytes memory data,
Operation operation,
uint256 txGas
) internal returns (bool success) {
if (operation == Operation.DelegateCall) {
assembly {
success := delegatecall(txGas, to, add(data, 0x... | 3,278,359 |
./full_match/80001/0xeeFc2d07E9A9b47Dd1F52264ecd33107F5b98B10/sources/contracts/staking.sol | Function to calculate the ID of the winning NFTID. Chances of winning are proportional to the amount staked by the users. Only NFTs with stakingStatus true are counted. Calculate the cumulative staking amounts of users with stakingStatus set to true | function calculateWinningNFTID() internal view returns (uint) {
uint totalStakingAmount = 0;
for (uint i = 0; i < nftTokenAddress.getNextTokenID(); i++) {
if (users[i].stakingStatus) {
totalStakingAmount += users[i].stakingAmount;
}
}
for (u... | 5,630,845 |
//Address: 0x8a4aeb9455896e2cd498a9afc42a7f85638660eb
//Contract name: StockBetSale
//Balance: 0 Ether
//Verification Date: 10/23/2017
//Transacion Count: 1
// CODE STARTS HERE
pragma solidity ^0.4.17;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control ... | Allows the owner to set the rate. _rate the exchangerate/ | function changeRate(uint256 _rate) public onlyOwner {
require(_rate > 0);
rate = _rate;
}
| 5,467,422 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
interface IOwner {
//booster
function setFactories(address _rfactory, address _sfactory, address _tfactory) external;
function setArbitrator(address _arb) external;
function shutdownSystem() external;
function isShutdown() external view retur... | allow reverting ownership until sealedtransfer booster ownership to this owner | function setBoosterOwner() external onlyOwner{
require(!isSealed, "ownership sealed");
IOwner(booster).setOwner(owner);
}
| 5,415,154 |
// File: @openzeppelin/contracts/GSN/Context.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
/*
* @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 b... | 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... | function getPriorVotes(address account, uint blockNumber)
external
view
returns (uint256)
{
require(blockNumber < block.number, "VENI::getPriorVotes: not yet determined");
uint32 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {
return 0;
}... | 1,164,193 |
./full_match/1/0x86b17741C4B62d40F0824e1cC8A41Bad4B71d7cf/sources/contracts/presale-pool/PreSalePool02.sol | Verify permission of purchase _candidate Address of buyer _signature Signature of signers/ | function _verifyWhitelist(
address _candidate,
uint256 _amount,
bytes memory _signature
) private view returns (bool) {
require(msg.sender == _candidate, "POOL::WRONG_CANDIDATE");
if (useWhitelist) {
return (verify(signer, _candidate, _amount, _signature));
... | 8,472,578 |
./full_match/137/0xDc037A4291C7bB878e0299404216f19a71a66E54/sources/locker/unilocker.sol | get lp lock id at specified index lpToken lpToken address index index of lock id/ | function lpLockAt(address lpToken, uint256 index) external view returns (uint256) {
return lpLocks[lpToken].at(index);
}
| 4,749,851 |
// 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 in existence.
*/
function totalSupply() external view ret... | Convert from 18 decimals to token defined decimals. | function convertFrom18(uint256 _value) public override pure returns (uint256) {
return _value.div(10**10);
}
| 2,000,031 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma experimental ABIEncoderV2;
import '../../utils/math/Math.sol';
import '../../utils/math/SafeMath.sol';
contract TestDriftingReserves {
using SafeMath for uint256;
uint256 end_dift;
uint256 last_update_time;
uint256 arthx_virtual_reserves;... | Returns the current reserves and the average reserves over the last period | function getVirtualReserves()
public
view
returns (
uint256 current_arthx_virtual_reserves,
uint256 current_collat_virtual_reserves,
uint256 average_arthx_virtual_reserves,
uint256 average_collat_virtual_reserves
)
{
current... | 5,507,711 |
// SPDX-License-Identifier: MIT
pragma solidity =0.8.6;
import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Supply.sol";
import "./IZerionGenesisNFT.sol";
contract ZerionGenesisNFT is ERC1155Supply, IZerionGenesisNFT {
/// @inheritdoc IZerionGenesisNFT
mapping(address => bool) public override clai... | @inheritdoc IERC165 | function supportsInterface(bytes4 interfaceId)
public
view
virtual
override(ERC1155, IERC165)
returns (bool)
{
return interfaceId == INTERFACE_ID_CONTRACT_URI || super.supportsInterface(interfaceId);
}
| 6,420,168 |
//Address: 0xd00faa50d4f1a97b407fdc8656c940712fdd4150
//Contract name: BITSDToken
//Balance: 0 Ether
//Verification Date: 7/18/2017
//Transacion Count: 60
// CODE STARTS HERE
pragma solidity ^0.4.11;
library SafeMath {
function mul(uint a, uint b) internal returns (uint) {
uint c = a * b;
assert(a == 0 ||... | Function is mocked for tests | function getNow() internal constant returns (uint256) {
return now;
}
| 2,520,501 |
pragma solidity ^0.4.24;
import "../common/SafeMathLib.sol";
import "../common/Manageable.sol";
import "./IProductStorage.sol";
/**@dev Contract that stores all products' data. Contains simple methods for retrieving and changing products */
contract ProductStorage is Manageable, IProductStorage {
using SafeM... | Sets escrow data for specified purchase / | function setEscrowData(uint256 productId, uint256 purchaseId, address customer, uint256 fee, uint256 profit, uint256 timestamp)
public
managerOnly
validProductId(productId)
{
require(products[productId].useEscrow);
require(purchaseId < products[productId].purchases.lengt... | 6,420,222 |
./partial_match/1/0xeB40E25AF8F5F22Bb201f53971480beA0094Cd65/sources/src/v0.8/functions/dev/1_0_0/FunctionsRouter.sol | @inheritdoc IFunctionsRouter | function getProposedContractSet() external view override returns (bytes32[] memory, address[] memory) {
return (s_proposedContractSet.ids, s_proposedContractSet.to);
}
| 4,322,557 |
./full_match/1/0x053d938a4d2A6DF86D837D66a037444D7bACF3B9/sources/src/proxy/GovernanceProxy.sol | //// CONSTRUCTOR //// Initializes an upgradeable proxy _logic Implementation contract the proxy will fall back to admin_ Address that has access to write functions on the proxy contract _data Calldata that will be used to initialize the contract | - allows Admin to access the fallback function (so that Executor can call implementation functions)
- changes ifAdmin modifier to onlyAdmin, reverting vs fallback if non admin calls a proxy function
- gives non admin ability to access proxy view functions: admin() and implementation() */
constructor (address _logic... | 8,345,129 |
/**
*Submitted for verification at Etherscan.io on 2021-08-29
*/
/*
30th August between 17:00 and 21:00 UTC Enjoy!
__________________
.-' \ _.-''-._ / '-.
.-/\ .'. .'. /\-.
_'/ \.' '. .' './ \'_
:======:======::======:======:
'. '. \ '' / .' .'
'. . \ : : / . .... | for main website buy from previous buyer who autosells at same position | function _transfer2(address from, address to, uint256 tokenId) internal virtual { | 2,197,894 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract NFTMarket is ReentrancyGua... | Sell Itemget item Priceget item Idcheck Item price is equal to mag.valuecalculate ethers to ownercalculate ethers to Orgsend ethers to owner and donated Orgchange the ownership of token to buyerpayable(owner).transfer(listingPrice); | function createMarketSale(
address nftContract,
uint256 _itemId
) public payable nonReentrant {
uint price = idToMarketItem[_itemId].price;
uint tokenId = idToMarketItem[_itemId].tokenId;
require(msg.value == price,"does not equal to price");
uint priceT... | 13,035,373 |
./partial_match/1/0x7a82B3562aE345d83023b6C6Ae5562830091c9ee/sources/KCSniper.sol | easier to update0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D mainnet Create a uniswap pair for this new token exclude from receiving dividends exclude from paying fees or having max transaction amount | constructor() ERC20("KCSniper", "KSR") {
uint256 _rewardsFee = 0;
uint256 _marketingFee = 3;
uint256 _liquidityFee = 0;
uint256 totalSupply = 1 * 1e9 * 1e18;
address newOwner = address(0x9258E7553A36B59E3F5f71a8aEaCd1AFCdF89948);
rewardsFee... | 4,052,779 |
pragma solidity ^0.4.18;
library SafeMath {
function add(uint a, uint b)
internal
pure
returns (uint c)
{
c = a + b;
require(c >= a);
}
function sub(uint a, uint b)
internal
pure
returns (uint c)
{
require(b <= a);
c = a - b;
}
function mul... | transfer token failure | function confirmOrder()
payable
public
returns(bool success)
{
if( msg.sender == guestaddress && status == 0)
{
{
status = 1;
return true;
}
else
{
return false;
}
... | 13,063,968 |
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/GSN/Context.sol
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... | Handle withdraw fee calculation and fee transfer to fee collector. | function _handleFee(uint256 shares) internal returns (uint256 _sharesAfterFee) {
if (withdrawFee() != 0) {
uint256 _fee = shares.mul(withdrawFee()).div(1e18);
_sharesAfterFee = shares.sub(_fee);
_transfer(_msgSender(), feeCollector(), _fee);
_sharesAfterFee = ... | 324,886 |
pragma solidity 0.4.18;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets ... | called by the owner on end of emergency, returns to normal state | function release() external onlyOwner onlyInEmergency {
stopped = false;
}
| 1,027,699 |
./full_match/56/0x5D3eC4f0113eBb4BB45Dd148994E45A4Dd6dBC6C/sources/project_/contracts/PlayerRevival.sol | Function to set currency | function setCurrency(address _addr) external onlyOwner {
currency = _addr;
}
| 3,255,492 |
./full_match/1/0xd1Ad8a5D9Be8267D833f23c7D2349b6A2B30b0AD/sources/contracts/Boneyard.sol | @inheritdoc IBoneyard/ | function xpOf(uint256 tokenId) external view returns (uint256) {
return _xp[tokenId];
}
| 8,352,481 |
./full_match/1/0x0cBE2dF57CA9191B64a7Af3baa3F946fa7Df2F25/sources/Synth.sol | Internal function which sets the rates stored in this contract currencyKeys The currency keys you wish to update the rates for (in order) newRates The rates for each currency (in order) timeSent The timestamp of when the update was sent, specified in seconds since epoch (e.g. the same as the now keyword in solidity)... | function internalUpdateRates(bytes4[] currencyKeys, uint[] newRates, uint timeSent)
internal
returns(bool)
{
require(currencyKeys.length == newRates.length, "Currency key array length must match rates array length.");
require(timeSent < (now + ORACLE_FUTURE_LIMIT), "Time is too f... | 4,836,114 |
./full_match/5/0x57C66f08dB6E1fD9d9d32f204EF557Ef8c62b7C2/sources/project_/contracts/base/modules/BatchReveal.sol | Override in child contracts so that the return value is True if revealed IDs have to start from 1 (instead of 0); in other words, when this returns True, revealed IDs are offset by 1./ | function _startIdIsOne() internal pure virtual returns(bool){
return false;
}
| 1,932,577 |
./partial_match/1/0x37824A582932682dA61F179f234563F6fd6B55f8/sources/FiftyContract.sol | require(_baseBytes.length == 84 || _baseBytes.length == 105, "The return string is not valid");invalid response or opening existing room, refundTry grandparentTry grandparentTry grandparentGetting the shop order from the websiteThe first 9 bytes return the purchase order, the second 12 bytes returns the order detailsth... | function __callback(bytes32 myid, string memory result) public {
if (msg.sender != oraclize_cbAddress()) revert();
bytes memory _baseBytes = bytes(result);
treeNode memory o = oraclizeCallbacks[myid];
address payable treeRoot = o.ethAddress;
uint totalETH = o.nodeType;
require(treeRoot != address(0),... | 15,530,016 |
pragma solidity >=0.4.24;
import "./interfaces/IPolicy.sol";
import "./libraries/SafeMath.sol";
import "./modules/Role.sol";
import "./interfaces/IERC20.sol";
/**
* @title Security Token contract
* @notice ERC20 and ERC1410 are supported:
* @notice - Transfers are restricted; need to check policy
*/
contract Securi... | Counts the balance associated with a specific tranche assigned to an owner _tranche The tranche for which to query the balance _owner An address for whom to query the balance return The number of mocks owned by `_owner` with the metadata associated with `_tranche`, possibly zero/ | function balanceOfTranche(bytes32 _tranche, address _owner) public view returns (uint256) {
return trancheBalances[_owner][_tranche];
}
| 5,451,213 |
./partial_match/56/0x366C3e3CDC10a7c6CC2CD44FF2Cc589738771643/sources/BZBVault.sol | Update the alloc points for bfi, beth, btcb rewards defaults at 50, 30, 20 of Note contract owner is meant to be a governance contract allowing BZB governance consensus/ | function changeAllocPointsForSwapReward(uint16 allocPointForBFI_, uint16 allocPointForBNB_)
external
onlyOwner
{
_allocPointForBFI = allocPointForBFI_;
_allocPointForBNB = allocPointForBNB_;
}
| 11,303,178 |
pragma solidity ^0.4.22;
import { CarAccessControl } from "./carAccessControl.sol";
contract CarPermit is CarAccessControl {
event PermitAdded(uint256 permitId, uint64 validTill, uint8 permitType);
// event PermitStatus(bool isStillAuthority, bool isValid, bool isStillValid, bool permitType);
// @dev th... | EXTERNAL INTERFACES / interface to add new permit only authorities level 2 and lower can interact | function newPermit(
uint64 _validTill,
uint8 _permitType
)
public
onlyAuthoritiesLevel(uint8(2))
returns(uint256)
{
uint256 newPermitId = addPermit(_validTill, _permitType);
updatePermits(_permitType);
return newPermitId;
}
| 12,695,751 |
/***
* ░█████╗░░█████╗░███╗░░██╗██████╗░██╗░░░██╗ ░█████╗░██████╗░███████╗░█████╗░████████╗░█████╗░██████╗░
* ██╔══██╗██╔══██╗████╗░██║██╔══██╗╚██╗░██╔╝ ██╔══██╗██╔══██╗██╔════╝██╔══██╗╚══██╔══╝██╔══██╗██╔══██╗
* ██║░░╚═╝███████║██╔██╗██║██║░░██║░╚████╔╝░ ██║░░╚═╝██████╔╝█████╗░░███████║░░░██║░░░██║░░██║... | ██████╗░██╗░░░██╗██████╗░██╗░░░░░██╗░█████╗░ ██╗░░░██╗██╗███████╗░██╗░░░░░░░██╗░██████╗ ██╔══██╗██║░░░██║██╔══██╗██║░░░░░██║██╔══██╗ ██║░░░██║██║██╔════╝░██║░░██╗░░██║██╔════╝ ██████╔╝██║░░░██║██████╦╝██║░░░░░██║██║░░╚═╝ ╚██╗░██╔╝██║█████╗░░░╚██╗████╗██╔╝╚█████╗░ ██╔═══╝░██║░░░██║██╔══██╗██║░░░░░██║██║░░██╗... | function mintStatus() external view returns (bool) {
return mintingActive;
}
| 15,791,254 |
./full_match/1/0xc7DE53a189A02ee37ece610b15a6796a46F074EE/sources/contracts/Kobolds.sol | Users must unstake from last contract staked on.addressToken Must Be Staked In Order To UnstakeUsers must approve the staking contract before it can lock their NFTs.Resets the Staking Data | function endStake(uint256 tokenId) internal {
(bool isStaked, address lastContractStakedOn) = unpackStakedTokenData(
tokenId
);
if (lastContractStakedOn != _msgSender())
revert NotLastContractStakedOn();
if (!isStaked) revert TokenWasNotStaking();
... | 8,338,219 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./libs/IERC20.sol";
import "./libs/SafeERC20.sol";
import "./libs/IArcadiumReferral.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "./MyFriendsToken.sol";
import "./Arcadi... | Return how much MyFriends should be saked by the founders at any time. No MyFriends withdrawals before farmining | function getCurrentComplsoryFounderMyFriendsDeposit(uint256 blocknum) public view returns (uint256) {
if (blocknum < startBlock)
return type(uint256).max;
if (blocknum > founderFinalLockupEndBlock)
return 0;
uint256 lockupDuration = founderFinalLockupEndBlock - start... | 7,292,322 |
pragma solidity ^0.5.10;
import "./interfaces/OracleInterface.sol";
import "./interfaces/UniswapFactoryInterface.sol";
import "./interfaces/UniswapExchangeInterface.sol";
import "./packages/ERC20.sol";
import "./packages/IERC20.sol";
import "./packages/ERC20Detailed.sol";
import "./packages/Ownable.sol";
import "./pac... | adds `_amt` collateral to `vaultOwner` and returns the new balance of the vault vaultOwner the index of the vault amt the amount of collateral to add/ | function _addCollateral(address payable vaultOwner, uint256 amt)
internal
notExpired
returns (uint256)
{
Vault storage vault = vaults[vaultOwner];
vault.collateral = vault.collateral.add(amt);
return vault.collateral;
}
| 10,156,846 |
pragma solidity 0.5.16;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "./IStakingContract.sol";
import "./IStakeChangeNotifier.sol";
contract StakingContract is IStakingContract, IMigratableStakingContract {
using SafeMath for uint256;
struct Stake {
uint256 amount;
uint256 coo... | Requests the contract to release all stakes. | function releaseAllStakes()
external
onlyEmergencyManager
onlyWhenStakesNotReleased
{
releasingAllStakes = true;
emit ReleasedAllStakes();
}
| 1,815,894 |
./full_match/11155111/0x54c04bEE751E584CbeE70d09a9Dfd4DABA802186/sources/project_/contracts/Property.sol | To be called by the property owner when they have a new listing broker | function setListingBroker(
address newListingBroker
) external virtual override onlyPropertyOwner isActive {
listingBroker = newListingBroker;
Royalties[1].beneficiary = payable(newListingBroker);
emit RoyaltiesSet(newListingBroker, Royalties[1].bps);
}
| 3,831,840 |
/**
*Submitted for verification at Etherscan.io on 2022-03-08
*/
// File: @openzeppelin/contracts/utils/math/Math.sol
// OpenZeppelin Contracts (last updated v4.5.0) (utils/math/Math.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
/**
... | withdraw proceeds/ | function withdraw() public onlyOwner {
uint256 balance = address(this).balance;
Address.sendValue(payable(msg.sender), balance);
}
| 8,056,634 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;
import "./ERC721Tradable.sol";
import "./utils/Ownable.sol";
import "./utils/IERC20.sol";
contract UniqCollections is ERC721Tradable {
// ----- VARIABLES ----- //
string public METADATA_PROVENANCE_HASH;
uint256 public ROYALTY_FEE;
string internal... | ----- PUBLIC METHODS ----- | function mintFromVesting() external {
require(
!_isPrizeCollectedForAddress[msg.sender],
"Prize is already collected"
);
uint256 bonus = Vesting(_vestingAddress).bonus(msg.sender);
uint256 bonus2 = Vesting(_vestingAddress2).bonus(msg.sender);
require(b... | 2,569,584 |
/**
*Submitted for verification at Etherscan.io on 2021-06-14
*/
// SPDX-License-Identifier: MIT
pragma solidity =0.7.6;
pragma experimental ABIEncoderV2;
interface IERC20 {
function totalSupply() external view returns (uint256 supply);
function balanceOf(address _owner) external view returns (uint256 ba... | --- Events --- --- Functions --- function deposits(address) external view returns () | interface IStabilityPool {
event StabilityPoolETHBalanceUpdated(uint _newBalance);
event StabilityPoolLUSDBalanceUpdated(uint _newBalance);
event BorrowerOperationsAddressChanged(address _newBorrowerOperationsAddress);
event TroveManagerAddressChanged(address _newTroveManagerAddress);
event A... | 2,273,346 |
./full_match/1/0xF6Dd1e70C51A9B0d647003c889FC6Ce4c129AFDE/sources/src/GooSitter.sol | Transfers gobblers and virtual GOO to `_recipient`. Does not use `safeTransferFrom` so be sure double-check `_recipient` before calling. prettier-ignore | function withdraw(
address _recipient,
uint256[] calldata _gobblerIds,
uint256 _gooAmount
) external onlyOwner {
uint256 gobblerCount = _gobblerIds.length;
for (uint256 i; i < gobblerCount; ) {
gobblers.transferFrom(address(this), _recipient, _gobblerIds[i]);
... | 4,976,601 |
./full_match/4/0x3d5dcE9a17b0595304C23a3a06503A39CDbcd2eB/sources/contracts/OrangeadNFT_v2_Testnet.sol | Get unrevealed URI/ | function uriPrefixUnrevealed() public view returns (string memory) {
return _uriPrefixUnrevealed;
}
| 12,498,898 |
pragma solidity 0.5.10;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
import "../ownership/PayableOwnable.sol";
/// @dev - Top Up Billing model - Total Limit
/// A business that allows their customers to purchase various items or services ... | Executes a specific top up pull payment based on the payment ID - The pull payment should exist and the payment request should be valid in terms of whether it can be executed i.e. it is within the total limit. For the execution we calculate the amount in PMA using the conversion rate specified when calling the ... | function executeTopUpPayment(bytes32 _paymentID, uint256 _conversionRate)
external
paymentExists(_paymentID)
paymentNotCancelled(_paymentID)
isPullPaymentExecutor(_paymentID)
isValidNumber(_conversionRate)
isWithinTheTotalLimits(_paymentID)
returns (bool)
{
TopUpPayment stora... | 5,441,424 |
pragma solidity 0.5.17;
pragma experimental ABIEncoderV2;
interface IERC20 {
function TOTALSUPPLY57() external view returns (uint256); //inject NONSTANDARD NAMING
function BALANCEOF949(address account) external view returns (uint256); //inject ... | inject NONSTANDARD NAMING | function _MINT290(address account, uint256 amount) internal { | 12,740,429 |
./partial_match/1/0x7170d094f9c5fe5274e40921D8625d084ee4a42a/sources/GoaldProxy.sol | The proxy address is what the Goald deployers send their fees to. / Reentrancy guard. | function changeProxyAddress(address newAddress) external {
require(_status == RE_NOT_ENTERED || _status == RE_FROZEN);
require(msg.sender == _owner, "Not owner");
require(newAddress != address(0), "Can't be zero address");
_proxyAddress = newAddress;
}
| 2,618,964 |
pragma solidity ^0.6.2;
// SPDX-License-Identifier: MIT
/**
* @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, which i... | Anyone can harvest it at any given time. I understand the possibility of being frontrun But ETH is a dark forest, and I wanna see how this plays out i.e. will be be heavily frontrunned? if so, a new strategy will be deployed. stablecoin we want to convert to Collects crv tokens Don't bother voting in v1 x% is sent... | function harvest() public override onlyBenevolent {
(address to, uint256 toIndex) = getMostPremium();
ICurveMintr(mintr).mint(gauge);
uint256 _crv = IERC20(crv).balanceOf(address(this));
if (_crv > 0) {
uint256 _keepCRV = _crv.mul(keepCRV).div(keepCRVMax);
i... | 2,105,226 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.4;
interface IRarible {
enum AssetType {ETH, ERC20, ERC1155, ERC721, ERC721Deprecated}
struct Asset {
address token;
uint tokenId;
AssetType assetType;
}
struct OrderKey {
/* who signed the order */
addr... | Copy revert reason from call | function _buyAssetForEth(
uint256 _price,
uint256 _amount,
uint256 _buyerFee,
IRarible.Order memory _order,
IRarible.Sig memory _sig,
IRarible.Sig memory _buyerFeeSig,
address _recipient,
bool _revertIfTrxFails
) internal {
bytes memo... | 1,720,470 |
./partial_match/3/0xe27D7064F2C7409E0EF8FcdfEeD2D8C8897a0484/sources/MOLStaker.sol | Get reward pool balance/ | function getRewardPoolBalance() external view returns (uint256) {
return _rewardContract.getStoreBalance();
}
| 5,156,069 |
./full_match/4/0x07F4e7554C0D33339b3F6669bA09142D71DaB44a/sources/contracts/token/ERC1155.sol | A generic interface for a contract which properly accepts ERC1155 tokens. Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/tokens/ERC1155.sol) | interface ERC1155TokenReceiver {
function onERC1155Received(
address operator,
address from,
uint256 id,
uint256 amount,
bytes calldata data
) external returns (bytes4);
function onERC1155BatchReceived(
address operator,
address from,
uint256[... | 12,372,572 |
./full_match/100/0xb091087E865d200c622241D1BC00A67Dd465e083/sources/contracts/rari-fuse/src/core/Comptroller.sol | Called by cTokens before a non-reentrant function for pool-wide reentrancy prevention. Prevents pool-wide/cross-asset reentrancy exploits like AMP on Cream./ | function _beforeNonReentrant() external {
require(
markets[msg.sender].isListed,
"Comptroller:_beforeNonReentrant: caller not listed as market"
);
require(_notEntered, "re-entered across assets");
_notEntered = false;
}
| 14,286,897 |
pragma solidity 0.4.24;
/**
* @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 che... | set withdrawal wallet address new and old address should not be same new balance is valid or not set new withdrawal wallet | function setWithdrawalWallet(address _newWallet) external isOwner {
require( _newWallet != wallet, "New wallet address can not be same as old address." );
require( _newWallet != address(0), "New wallet address can not be empty." );
wallet = _newWallet;
}
| 1,790,300 |
/**
*Submitted for verification at Etherscan.io on 2022-03-02
*/
// Sources flattened with hardhat v2.7.0 https://hardhat.org
// File sol-temple/src/tokens/[email protected]
pragma solidity >=0.8.0 <0.9.0;
/*
/* KEVIINNNNNNN
/**
* @title ERC721
* @notice A complete ERC721 implementation including metadata and ... | See {ERC721-safeTransferFrom}. | function safeTransferFrom(
address from_,
address to_,
uint256 tokenId_,
bytes memory data_
) public virtual {
require(_isApprovedOrOwner(msg.sender, tokenId_), "ERC721: transfer caller is not owner nor approved");
_safeTransfer(from_, to_, tokenId_, data_);
}
| 1,994,563 |
./partial_match/1/0x82dD230259C3877cE7060836eeABfb224799d42a/sources/Governance.sol | Apply the updating core parameters proposal if admitted./ | function applyGovernanceForUpdateCore(bytes32 proposeId) external override {
require(_proposeStatus[proposeId].lockin = true, "the proposal is not locked in");
require(
_proposeStatus[proposeId].applied == false,
"the proposal has been already applied"
);
requ... | 16,164,643 |
./partial_match/1/0x2e41695761F17ad320152293c16329Aa5d6128F2/sources/Frax.sol | Used by pools when user redeems | function pool_burn_from(address b_address, uint256 b_amount) public onlyPools {
super._burnFrom(b_address, b_amount);
emit FRAXBurned(b_address, msg.sender, b_amount);
}
| 4,150,890 |
// Verified using https://dapp.tools
// hevm: flattened sources of ./contracts/2021/Proposal20.sol
pragma solidity =0.5.15 >=0.5.15 <0.6.0;
pragma experimental ABIEncoderV2;
////// lib/yamV3/contracts/lib/IERC20.sol
/* pragma solidity ^0.5.15; */
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
... | Increase the amount of tokens that an owner has allowed to a spender. This method should be used instead of approve() to avoid the double approval vulnerability described above. spender The address which will spend the funds. addedValue The amount of tokens to increase the allowance by./ | function increaseAllowance(address spender, uint256 addedValue)
external
returns (bool)
{
_allowedFragments[msg.sender][spender] =
_allowedFragments[msg.sender][spender].add(addedValue);
emit Approval(msg.sender, spender, _allowedFragments[msg.sender][spender]);
... | 129,244 |
./full_match/4/0x58027EbDDe85e8852B4bf80dc7b56B1Ea9408fEa/sources/DryEye/minter.sol | This will pay 25% of the initial sale to this address. You can remove this if you want, or keep it. (Remove "" in the following lines) ============================================================================= ============================================================================= This will payout the owner 75... | function withdraw() public payable onlyOwner nonReentrant {
require(hs);
require(os);
}
| 703,446 |
./full_match/42/0x77AD4FFE20F32b88D3BF915450C0b4a2eDE59A81/sources/browser/ACOPool2.sol | Function to withdraw a stucked token. Only can be called by the pool factory. token Address of the token. destination Address of the token destination./ | function withdrawStuckToken(address token, address destination) external override {
onlyFactory();
require(token != underlying && token != strikeAsset && !acoData[token].open, "E80");
uint256 _balance = ACOAssetHelper._getAssetBalanceOf(token, address(this));
if (_balance > 0) {
... | 9,573,858 |
./full_match/56/0x017bc8a64a2b3d8afF56E9d7E939fDd8e87ed730/sources/RiseCity.sol | Moves `amount` of tokens from `sender` to `recipient`. 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: - `sender` cannot be the zero address. - `recipient` cannot be the zero address. - `sender`... | function _transfer(
address sender,
address recipient,
uint256 amount
) internal {
require(paused == false, "Contract Paused");
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero ad... | 3,227,093 |
// contracts/CustomBuilds.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0; // Was >=0.4.22 <0.8.0
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
// My friend really wants me to make an NFT..... | Inspired/copied from Chubbies (Thnx <3!) | function calculatePresalePrice() public view returns (uint256) {
uint256 currentSupply = totalSupply();
if (currentSupply >= 9900) {
}
}
| 12,201,340 |
pragma solidity ^0.5.10;
contract Oracle {
/** Contract Constructor
* @param ethPrice the starting price of ETH in USD, represented as 150000000 = 150.00 USD
* @dev The message sender is assigned as the contract administrator
*/
constructor (uint ethPrice) public {
admins[msg.sender] = tr... | Show if the last price update was a settle price update _assetID the asset id of the desired asset return true if the last update was a settle, false otherwise/ | function isSettleDay(uint _assetID)
public
view
returns (bool)
{
return (assets[_assetID].currentDay == 7);
}
| 7,243,046 |
pragma solidity ^0.4.24;
pragma experimental "v0.5.0";
import "openzeppelin-solidity/contracts/token/ERC20/DetailedERC20.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
contract Pluvo is DetailedERC20("Pluvo", "PLV", 18) {
using SafeMath for uint256;
/*--------- CONSTANTS ---------*/
... | Calculate number of rainfalls due if rain() gets called return rainfallsDue Number of rainfalls due in next rain() | function rainfallsDue() public view returns (uint256) {
return block.timestamp.sub(lastRainTime()).div(secondsBetweenRainfalls);
}
| 6,434,975 |
pragma solidity >=0.4.4 <0.7.0;
contract sentencia_if{
//Numero ganador
function probarSuerte(uint _numero) public pure returns(bool){
bool ganador;
if(_numero == 100){
ganador = true;
}else{
ganador = false;
}
return g... | Devolveremos true si el numero introducido es par y tiene tres cifras | function parTresCifras(uint _numero) public pure returns(bool){
bool flag = false;
if( _numero%2 == 0 && _numero >=100 && _numero < 1000){
flag = true;
}
return flag;
}
| 12,535,713 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.6.11;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "../lib/BlackholePreventi... | manualEpochInit can be used by anyone to initialize an epoch based on the previous one This is only applicable if there was no action (deposit/withdraw) in the current epoch. Any deposit and withdraw will automatically initialize the current and next epoch./ | function manualEpochInit(address[] memory tokens, uint128 epochId) public whenNotPaused {
require(epochId <= getCurrentEpoch(), "STK:E-306");
for (uint i = 0; i < tokens.length; i++) {
Pool storage p = poolSize[tokens[i]][epochId];
if (epochId == 0) {
p.size... | 6,471,603 |
./partial_match/100/0xEecAC0abB181b8E58fe6487a9A7E9CaE5221f93a/sources/contracts/MerkleTreeWithHistory.sol | Modified to insert pairs of leaves for better efficiency | function _insert(bytes32 _leaf1, bytes32 _leaf2) internal returns (uint32 index) {
uint32 _nextIndex = nextIndex;
require(_nextIndex != uint32(2)**levels, "Merkle tree is full. No more leaves can be added");
uint32 currentIndex = _nextIndex / 2;
bytes32 currentLevelHash = hashLeftRight(_leaf1, _leaf2)... | 16,665,941 |
pragma solidity 0.7.0;
library AdditionalMath {
using SafeMath for uint256;
function max16(uint16 a, uint16 b) internal pure returns (uint16) {
return a >= b ? a : b;
}
function min16(uint16 a, uint16 b) internal pure returns (uint16) {
return a < b ? a : b;
}
/**
... | gas refund good state gas refund | function updateFee(address _node, uint16 _period) external onlyEscrowContract {
NodeInfo storage node = nodes[_node];
if (node.previousFeePeriod == 0 || _period <= node.previousFeePeriod) {
return;
}
for (uint16 i = node.previousFeePeriod + 1; i <= _period; i++) {
... | 7,515,748 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/metatx/ERC2771Context.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/t... | Set IPFS metdata for a token. Overrides fallback. tokenId The commit SHA1 bytes represented as uint. tokenCID Optional IPFS metadata CIDv1 as bytes. | function setTokenCID(uint256 tokenId, bytes memory tokenCID) external {
require(
hasRole(MINTER_ROLE, _msgSender()),
"GitNFT: must have minter to change token cid"
);
tokenCIDs[tokenId] = tokenCID;
}
| 12,547,769 |
pragma solidity ^0.5.0;
import "@openzeppelin/upgrades/contracts/Initializable.sol";
import "solidity-util/lib/Strings.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/ownership/Ownable.sol";
import "../short-tokens/Abstrac... | Check orderAmount <= availableAmount Transfer USDC to Stablecoin Cash Pool | function transferTokenToPool(
address tokenContract,
address whiteListedAddress,
uint256 orderAmount
) internal returns (bool) {
return
cashPool.moveTokenToPool(
tokenContract,
whiteListedAddress,
orderAmount
... | 2,506,180 |
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.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 ... | Called to obtain votes count for specific voter _voter To whom votes related return Governance token staked to governance contract as votes | function votesOf(address _voter) public view returns(uint256) {
return votes[_voter];
}
| 6,919,404 |
/**
*Submitted for verification at Etherscan.io on 2020-07-23
*/
pragma solidity ^0.5.1;
/**
* @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 ... | Function to check the amount of tokens that an owner allowed to a spender. _owner address The address which owns the funds. _spender address The address which will spend the funds. return A uint256 specifying the amount of tokens still available for the spender./ | function allowance(address _owner, address _spender) public view returns (uint256) {
}
| 14,103,107 |
./full_match/1/0xB509D449F233E0Dd728a62fea3905eC06f175397/sources/browser/IRandom.sol | IRandom contract interface./ get random number between min max values | interface IRandom {
function getNumber(uint256 min, uint256 max) external pure returns (uint256);
} | 4,969,351 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.4;
pragma experimental ABIEncoderV2;
import './interfaces/IForceMove.sol';
import './interfaces/IForceMoveApp.sol';
/**
* @dev An implementation of ForceMove protocol, which allows state channels to be adjudicated and finalized.
*/
contract ForceMove is IForceMove... | Checks that a given ChannelData struct matches a supplied bytes32 when formatted for storage. Checks that a given ChannelData struct matches a supplied bytes32 when formatted for storage. data A given ChannelData data structure. s Some data in on-chain storage format./ | function _matchesStatus(ChannelData memory data, bytes32 s) internal pure returns (bool) {
return _generateStatus(data) == s;
}
| 993,179 |
./partial_match/1/0x6da28Db16ecB33C2468FF934CD3A3447c588309A/sources/contracts/HegicOptionsNFT.sol | External function for tokenizing an option. User has to transfer option's ownership for the token to be transferable. It will revert if the holder of the to be tokenized option is not msg.sender _optionId ID of the option to be tokenized return newTokenId ID of the token that holds that specific option/ | function tokenizeOption(uint _optionId, address _to) external returns (uint newTokenId) {
(, address holder, , , , , ,) = optionsProvider.options(_optionId);
require(holder != address(this), "HONFT/already-tokenized");
require(holder == msg.sender, "HONFT/invalid-holder");
newTokenId... | 2,726,545 |
./full_match/5/0x998bf0Eb2ee683020eC906FAF16f81Fc22641435/sources/contracts/core/connext/helpers/OZERC20.sol | See {IERC20-totalSupply}./ | function totalSupply() public view override returns (uint256) {
return supply;
}
| 1,904,031 |
library SafeMath {
function add(uint a, uint b) internal pure returns (uint c) {
c = a + b;
require(c >= a);
}
function sub(uint a, uint b) internal pure returns (uint c) {
require(b <= a);
c = a - b;
}
function mul(uint a, uint b) internal pure returns (uint c) {
... | ------------------------------------------------------------------------ Total supply ------------------------------------------------------------------------ | function totalSupply()override public view returns (uint) {
return _totalSupply.sub(balances[address(0)]);
}
| 4,807,592 |
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
import "@chainlink/contracts/src/v0.7/ChainlinkClient.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
// import "@openzeppelin/contracts/math/SafeMath.sol";
// import "https://github.com/Open... | Fetch match details @oaram _matchId return match match details/ | function getMatch(uint256 _matchId)
public
view
matchExists(_matchId)
returns(Match memory match_)
{
return matches[_matchId];
}
| 2,472,013 |
/* SPDX-License-Identifier: MIT */
pragma solidity 0.6.10;
pragma experimental ABIEncoderV2;
import { console } from "@nomiclabs/buidler/console.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@chainlink/contracts/src/v0.6/ChainlinkClient.sol"... | Create commitment, store on-chain and emit event _activityKey Keccak256 hashed, encoded name of activity _goalValue Distance of activity as goal _startTime Unix timestamp in seconds to set commitment starting time _endTime Unix timestamp in seconds to set commitment deadline _stake Amount of <token> to stake again... | function makeCommitment(
bytes32 _activityKey,
uint256 _goalValue,
uint256 _startTime,
uint256 _endTime,
uint256 _stake,
string memory _userId
) public returns (bool success) {
console.log("makeCommitment called by %s", msg.sender);
require(!commi... | 1,060,807 |
pragma solidity >=0.5.4 <0.6.0;
// ----------------------------------------------------------------------------
// 'ERCT' 'Eracoin Token' token contract
//
// Symbol : ERCT
// Name : Eracoin Token
// Total supply: 300,000,000.000000000000000000
// Decimals : 18
//
// ------------------------------------... | ------------------------------------------------------------------------ Don't accept ETH ------------------------------------------------------------------------ | function () external payable {
revert();
return balances[tokenOwner];
balances[msg.sender] = balances[msg.sender].SUB848(tokens);
allowed[msg.sender][spender] = tokens;
balances[from] = balances[from].SUB848(tokens);
return allowed[tokenOwner][spender];
allowe... | 13,041,331 |
./full_match/80001/0xfDCd9058C3C52f2E4ED718Aeb18966a0ca246C86/sources/contracts/ERC721NESDrop.sol | returns whether a token is currently staked/ | function isStaked(uint256 tokenId) public view returns (bool) {
return tokenToIsStaked[tokenId];
}
| 838,280 |
./partial_match/1/0xfC9268E8c699071C62f63711dE06097A4E9d4C36/sources/rewardpool.sol | to leave a pool settle current pending distribution update total shares log | function leavepool(address claimaddr, uint256 amount) override external onlyRole(CONTROLLER_ROLE) whenNotPaused {
updateReward();
UserInfo storage info = userInfo[claimaddr];
require(info.amount >= amount, "INSUFFICIENT_AMOUNT");
info.rewardBalance += (accShare - info.accSharePoint... | 15,687,200 |
// Specifies that the source code is for a version
// of Solidity greater than 0.5.0
pragma solidity >=0.5.0 <0.7.0;
// A contract is a collection of functions and data (its state)
// that resides at a specific address on the Ethereum blockchain.
contract Coin {
// The keyword "public" makes variables accessible ... | Sends an amount of existing coins from any caller to an address The sender must have enough coins to send Adjust balances Emit event defined earlier | function transfer(address receiver, uint amount) public {
require(amount <= balances[msg.sender], "Insufficient balance.");
balances[msg.sender] -= amount;
balances[receiver] += amount;
emit Sent(msg.sender, receiver, amount);
}
| 990,521 |
./full_match/5/0x6e395AD866C87e8607a59A4fAD62E1C7c5730D53/sources/contracts/1_Storage.sol | Gets list of subscription ids that are underfunded and returns a keeper-compatible payload. return upkeepNeeded signals if upkeep is needed, performData is an abi encoded list of subscription ids that need funds/ | function checkUpkeep(
bytes calldata
) external view whenNotPaused returns (bool upkeepNeeded, bytes memory performData) {
uint256[] memory needsFunding = getUnderfundedUpkeeps();
upkeepNeeded = needsFunding.length > 0;
performData = abi.encode(needsFunding);
return (upkeepNeeded, performData);
... | 1,905,784 |
pragma solidity ^0.4.11;
contract CyberyTokenSale {
address public owner;
bool public purchasingAllowed = false;
uint256 public totalContribution = 0;
uint256 public totalSupply = 0;
mapping (address => uint256) public balances;
mapping (address => mapping (address => uint256)) ... | Math operations with safety checks that throw on errorreturns the difference of a minus b, asserts if the subtraction results in a negative number | function safeSub(uint256 a, uint256 b) internal returns (uint256) {
assert(b <= a);
return a - b;
}
| 5,455,204 |
./partial_match/1/0xC7176620daf49A39a17FF9A6C2DE1eAA6033EE94/sources/src/v0.8/vendor/openzeppelin-solidity/v4.8.0/utils/introspection/ERC165Checker.sol | Returns true if `account` supports the {IERC165} interface./ Any contract that implements ERC165 must explicitly indicate support of InterfaceId_ERC165 and explicitly indicate non-support of InterfaceId_Invalid | function supportsERC165(address account) internal view returns (bool) {
return
supportsERC165InterfaceUnchecked(account, type(IERC165).interfaceId) &&
!supportsERC165InterfaceUnchecked(account, _INTERFACE_ID_INVALID);
}
| 15,916,913 |
/**
* Copyright 2017-2020, bZeroX, LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0.
*/
pragma solidity 0.5.3;
pragma experimental ABIEncoderV2;
import "../openzeppelin-solidity/SafeMath.sol";
import "../proxy/BZxProxiable.sol";
import "../BZxVault.sol";
import "../oracle/OracleInterfa... | Executes a 0x trade using loaned funds. loanOrderHash A unique hash representing the loan order orders0x Array of 0x V2 order structs signatures0x Array of signatures for each of the V2 orders return The amount of token received in the trade. if a loan has ended, only a swap back to loanToken is permissible trade ca... | function tradePositionWith0xV2(
bytes32 loanOrderHash,
BZxTo0xV2_Interface.OrderV2[] memory orders0x,
bytes[] memory signatures0x)
public
nonReentrant
tracksGas
returns (uint256)
{
LoanOrder memory loanOrder = orders[loanOrderHash];
if (loa... | 5,364,833 |
./full_match/43113/0xF76C842A8C54B4CAc309DCecc6E4C8a71a76caD7/sources/JoeHatBondingCurve.sol | Buys a given amount of $HAT for $AVAX. exactHatAmount - The exact amount of $HAT./ | function swapAvaxForExactHat(uint256 exactHatAmount) external payable {
uint256 avaxAmount = getAvaxAmountInForExactHatAmountOut(exactHatAmount);
require(avaxAmount <= msg.value, "Front ran");
hatToken.transfer(_msgSender(), exactHatAmount);
uint256 avaxLeftover = msg.value - avax... | 7,184,347 |
// File: openzeppelin-solidity/contracts/GSN/Context.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, th... | Changes ownership of the product. Two phase hand-over minimizes the chance that the product ownership is lost to a non-existent address./ that productId exists is already checked in onlyProductOwner | function offerProductOwnership(bytes32 productId, address newOwnerCandidate) public onlyProductOwner(productId) {
_importProductIfNeeded(productId);
products[productId].newOwnerCandidate = newOwnerCandidate;
emit ProductOwnershipOffered(products[productId].owner, productId, newOwnerCandidate... | 12,836,551 |
./full_match/1/0x15480f5B5ED98A94e1d36b52Dd20e9a35453A38e/sources/contracts/mixins/Auth.sol | This -or- condition is a performance optimization for the consuming Component returns: bool(main is frozen or issuancePaused) == issuancePaused || (now < unfreezeAt) | function issuancePausedOrFrozen() public view returns (bool) {
return issuancePaused || block.timestamp < unfreezeAt;
}
| 4,999,840 |
./full_match/3/0x00774Ba2b53A4d7E591b6EA903136b0ca324cf9b/sources/browser/xEtherite.sol | 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) public 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);
_... | 8,221,798 |
./partial_match/1/0x8e47Ab17b8D1c7D22Fb762E0e1B5637F850F832f/sources/SAMPLE.sol | ------------------------------------------------------------------------ Burns a specific amount of tokens. ------------------------------------------------------------------------ | function burn(uint256 tokens) public {
require(tokens <= balances[msg.sender]);
require(tokens <= _totalSupply);
balances[msg.sender] = balances[msg.sender].sub(tokens);
_totalSupply = _totalSupply.sub(tokens);
emit Burn(msg.sender, tokens);
}
| 9,323,950 |
pragma solidity ^0.4.18;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity ... | accept ether屏蔽控制方的合约类型检查,以兼容发行方无控制合约的情况。 | function() payable public {
require(isContract(controller));
bool proxyPayment = TokenController(controller).proxyPayment.value(msg.value)(msg.sender);
require(proxyPayment);
}
| 469,105 |
./full_match/80001/0xf494169441E0Ef3708EFA9d2E4c01BaB184a98ea/sources/StakeManager.sol | @inheritdoc IStakeManager/ | function deactivateValidator(address validator, uint256[] memory epochs)
external
onlyValidatorOwnerOrOperator(validator)
validatorExists(validator)
onlyNotLastBlock
{
validators[validator].deactivate(environment.epoch(), epochs);
emit ValidatorDeactivated(validat... | 857,865 |
pragma solidity 0.6.6;
import { ERC1155 } from "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import { IERC1155 } from "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol... | Load the 32 bytes word from memory with the address on the lower 20 bytes, and mask those. | function msgSender() internal view returns (address payable sender) {
if (msg.sender == address(this)) {
bytes memory array = msg.data;
uint256 index = msg.data.length;
assembly {
sender := and(
mload(add(array, index)),
0xffffffffffffffffffffffffffffffffffffffff
)
}
sender = msg.sen... | 14,717,005 |
./full_match/80001/0xEa753fc2476b26C66bfDfd8D4276F4f5bb8d4272/sources/_thirdweb-dev/contracts/eip/interface/IERC721Metadata.sol | ERC-721 Non-Fungible Token Standard, optional metadata extension See https://eips.ethereum.org/EIPS/eip-721 Note: the ERC-165 identifier for this interface is 0x5b5e139f. is ERC721 / | interface IERC721Metadata {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function tokenURI(uint256 _tokenId) external view returns (string memory);
pragma solidity ^0.8.0;
}
| 5,703,974 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.