file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./partial_match/42/0x4290ee89b1E3Fe318eEbceBF24F939A0cC4287a1/sources/CyclopsBank.sol | amount in real tokens/wei if ether | function withdrawDepositsByProfile(uint32 profile_id) external {
require(dp_id != BAD_DEPOSIT_PROFILE_ID, "10");
for(uint32 i=0; i < customers_deposits[index].dep_number; i++){
if (depositIsExtractable(customers_deposits[index].deposits[i]) && profile_id == customers_deposits[in... | 3,302,505 |
/*
file: AssetBackedTokens.sol
ver: 0.0.1
updated:15-July-2017
authors: Nick Addison
An ERC20 compliant asset-backed token.
The contract was based off Darryl Morris's ERC 20 token contract
https://github.com/o0ragman0o/ERC20/blob/master/ERC20.sol
This software is distributed in the hope that it will be useful,
... | balance of the token holder's available tokens | function balanceOf(address _tokenHolder) public constant returns (uint)
{
return tokenAccounts[_tokenHolder].availableTokens;
}
| 1,812,388 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0 <0.9.0;
contract ShortCircuit {
function f1(bool b) public pure returns (bool) {
// Computazione leggera
return b;
}
function f2() public view returns (bool) {
// Computazione pesante
uint256 nonce = 0;
uint256 randomnumber = uint256(keccak256(abi.... | Computazione leggera | function f1(bool b) public pure returns (bool) {
return b;
}
| 5,386,184 |
/**
*Submitted for verification at Etherscan.io on 2021-06-16
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, t... | Move the last element into the place to delete Remove the last element | function removeReleaseTime(uint index) internal {
releaseTime[msg.sender][index] = releaseTime[msg.sender][releaseTime[msg.sender].length - 1];
releaseTime[msg.sender].pop();
}
| 10,918,060 |
// SPDX-License-Identifier: GPL-3.0-or-later
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is dis... | Update mining rate and supply at the start of the epoch Callable by any address, but only once per epoch Total supply becomes slightly larger if this function is called late/ | function updateMiningParameters() external {
require(block.timestamp >= _startEpochTime.add(RATE_REDUCTION_TIME), "Epoch has not finished yet");
_updateMiningParameters();
}
| 1,257,807 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "./ITag.sol";
/// @title If you own an It, you're it
/// @author jierlich
/// @notice Until unlock this can only be transferred by the holder
contract It is ERC721 {
/// @dev number of Its mint... | unlock the contract so It's can be approved for transfer | function unlock () public {
require(owner == msg.sender, 'Only owner can call this function');
locked = false;
}
| 14,039,816 |
./partial_match/1/0x381e3c53380DB31aDc8F1d2eB6a5a8DdF793EDab/sources/contracts/UniStrategy.sol | This function returns the readjust threshold of a pool _pool: pool address/ | function getReadjustThreshold(address _pool)
external
view
override
returns (int24 readjustThreshold)
{
readjustThreshold = poolStrategy[_pool].readjustThreshold;
}
| 2,870,606 |
./full_match/1/0xac6F8dCfDa428E81d34986997020c33970195913/sources/src/utils/FeeOperator.sol | Internal function to transfer fees to the fee manager. fees The amount of fees being transferred./ | function _transferFees(uint256 fees) internal {
if (!success) {
revert FeeTransferFailed();
}
}
| 2,913,412 |
./full_match/80001/0xe3665Dd88482E29734DC4c247Cd2c8aF885b1d3C/sources/contracts/NFTMarketplace.sol | Mengembalikan hanya item yang telah didaftarkan pengguna / | function fetchItemsListed() public view returns (MarketItem[] memory) {
uint totalItemCount = _tokenIds.current();
uint itemCount = 0;
uint currentIndex = 0;
for (uint i = 0; i < totalItemCount; i++) {
if (idToMarketItem[i + 1].seller == msg.sender) {
itemCount += 1;
... | 850,156 |
./full_match/1/0xBcbba981bFf1E9530CbcA0f40F67Aa85F8944038/sources/src/x-key/XRaffleBase.sol | set the winning token set the raffle stage set the deadline for claiming the reward the omission of the winning token is intentional | function _recordRoundWinner(uint8 _roundId, uint16 tokenId) internal {
awaitingWinnerForRound = 0;
_roundWinningToken[_roundId] = tokenId;
raffles[_roundId].stage = RaffleStage.WinnerDrawn;
nextClaimDeadline = SafeCast.toUint64(block.timestamp + CLAIM_DEADLINE);
emit Winn... | 9,610,596 |
pragma solidity >=0.5.11;
//Represents the money being traded in this program
contract Money {
int amount; //Amount that this Money object holds
constructor(int amt) public {
amount = amt;
}
//Add additional Money
function mergeMoney(Money m) public {
amount = amount + m.getAmou... | Returns the outcome of the game... | function calculateOutcome() public view returns (string memory) {
require(state == State.FinishedPlaying, "Wrong initial state.");
}
| 12,673,746 |
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 view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `accou... | withdraw without tokens, emergency only any inherited contract should call this function to make a emergencyWithdraw/ | function _emergencyWithdraw(uint256 pId) internal nonReentrant onEmergency returns (uint256) {
PoolInfo storage pool = poolInfo[pId];
UserInfo storage user = userInfo[pId][_msgSender()];
if (user.amount > 0) {
user.amount = 0;
user.rewardDebt = 0;
pool.poo... | 13,446,535 |
./full_match/9001/0x7A5c119ec5dDbF9631cf40f6e5DB28f31d4332a0/sources/src/Facets/CalldataVerificationFacet.sol | Validates the calldata data The calldata to validate bridge The bridge to validate or empty string to ignore sendingAssetId The sending asset id to validate or 0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF to ignore receiver The receiver to validate or 0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF to ignore... | function validateCalldata(
bytes calldata data,
string calldata bridge,
address sendingAssetId,
address receiver,
uint256 amount,
uint256 destinationChainId,
bool hasSourceSwaps,
bool hasDestinationCall
) external pure returns (bool isValid) {
... | 11,534,526 |
/*
Subscrypto
Copyright (C) 2019 Subscrypto Team
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later versio... | Collect available funded payments for a receiver's account within a certain range of receiverSubs[receiver]. Will process as many payments as possible with the gas provided and exit gracefully. receiver address start starting index of receiverSubs[receiver] end ending index of receiverSubs[receiver] return last proc... | function collectPaymentsRange(address receiver, uint start, uint end) public returns (uint) {
uint64[] storage subs = receiverSubs[receiver];
require(subs.length > 0, "receiver has no subscriptions");
require(start < end && end <= subs.length, "wrong arguments for range");
uint total... | 13,069,581 |
./partial_match/1/0x3034eA51375738c0B25beA8357a21Bec90d863bA/sources/YBASEPresale.sol | solium-disable-next-line | function claim() public {
require(block.timestamp > ends, "presale has not yet ended");
require(claimable[msg.sender] > 0, "nothing to claim");
uint256 amount = claimable[msg.sender];
claimable[msg.sender] = 0;
totalOwed = totalOwed.sub(amount);
require(token.transfer... | 2,862,770 |
pragma solidity ^0.4.24;
// File: zeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @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;
... | Get the customer's Tx of payment for MCW data - amount of MCW tokens which is recorded in the Tx _customer the address of a customer for whom to get _txPaymentForMCW the Tx of payment for MCW for which to get data/ | function getCustomerTxAmountMCW(address _customer, bytes32 _txPaymentForMCW) public view returns(uint256) {
require(isValidCustomer(_customer));
require(_txPaymentForMCW != bytes32(0));
TxRegistry txRegistry = TxRegistry(registry[_customer]);
uint256 amountMCW = txRegistry.getTxAmou... | 10,313,146 |
pragma solidity 0.6.6;
/**
* @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 is the standard behavior in high le... | Returns the remaining time delay between round 2 and round 3./ | function getRemainingTimeDelayR2R3() external view returns (uint256) {
if (timeDelayR2 > 0) {
if (_hasEnded[0] && _hasEnded[1] && !_hasEnded[2]) {
if (_startTimeR3.sub(block.timestamp) > 0) {
return _startTimeR3.sub(block.timestamp);
return 0;
... | 12,816,421 |
pragma solidity ^0.4.24;
import "./Owned.sol";
import "./Stash.sol";
import "./StashFactory.sol";
import "./RedeemAgent.sol";
import "./PledgeAgent.sol";
contract Bank is Owned {// Regulator node (MAS) should be the owner
function Bank() {
owner = msg.sender;
}
StashFactory public sf;
Redeem... | @pseudo-public / non-owner will not update salt unless it invoked by MAS-regulator when cb are setting salt, banks should not update its salt | function setNettingSalt(bytes16 _salt) {
bytes32 _stashName = acc2stash[msg.sender];
require(checkOwnedStash(_stashName), "not owned stash");
require(msg.sender == owner || !isCentralBankNode());
require(isCentralBankNode());
} else {
}
| 13,102,802 |
./partial_match/1/0x75Be69fc0859874E722D97a7f464D402e3dCff58/sources/contracts/standards/HONEYCOMBS721.sol | Transfers `tokenId` from `from` to `to`. As opposed to {transferFrom}, this imposes no restrictions on msg.sender. Requirements: - `to` cannot be the zero address. - `tokenId` token must be owned by `from`. Emits a {Transfer} event./ Check that tokenId was not transferred by `_beforeTokenTransfer` hook `_balances[from... | function _transfer(address from, address to, uint256 tokenId) internal virtual {
if (HONEYCOMBS721.ownerOf(tokenId) != from) {
revert ERC721__InvalidOwner();
}
if (to == address(0)) {
revert ERC721__TransferToZero();
}
_beforeTokenTransfer(from, to, t... | 3,888,214 |
/* solium-disable security/no-inline-assembly */
pragma solidity ^0.6.3;
contract Doppelganger {
struct MockCall {
bool initialized;
bool reverts;
string revertReason;
bytes returnValue;
}
mapping(bytes32 => MockCall) mockConfig;
fallback() external payable {
M... | Mock method with specified arguments Mock method with any arguments | function __internal__getMockCall() view private returns (MockCall storage mockCall) {
mockCall = mockConfig[keccak256(msg.data)];
if (mockCall.initialized == true) {
return mockCall;
}
mockCall = mockConfig[keccak256(abi.encodePacked(msg.sig))];
if (mockCall.initi... | 6,380,055 |
// File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/math/SafeMath.sol
// OpenZeppelin Contracts v4.3.2 (utils/math/SafeMath.sol)
pragma solidity ^0.8.0;
// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler... | BUBBLEZ Functions Migration Note: Only the Bubble Budz Genesis Contract can invoke this function. We don't want any random contract to be able to mint our migration reward! | function mintMigrationReward(address to_) public onlyBubbleBudzGenesis {
_mint(to_, bubblezPerMigration);
emit Migrated(to_, bubblezPerMigration);
}
| 11,779,147 |
pragma solidity ^0.4.12;
import './zeppelin/math/SafeMath.sol';
import './zeppelin/token/StandardToken.sol';
contract BurnableToken is StandardToken {
using SafeMath for uint256;
event Burn(address indexed from, uint256 amount);
event BurnRewardIncreased(address indexed from, uint256 value);
... | Burns tokens and send reward This is internal function because it DOES NOT check if _from has allowance to burn tokens. It is intended to be used in transfer() and transferFrom() which do this check. _from The address which you want to burn tokens from _amount of tokens to be burned/assert(totalSupply >= 0); Check is... | function burn(address _from, uint256 _amount) internal returns(bool){
require(balances[_from] >= _amount);
uint256 reward = burnReward(_amount);
assert(this.balance - reward > 0);
balances[_from] = balances[_from].sub(_amount);
totalSupply = totalSupply.sub(_amount)... | 1,082,620 |
pragma solidity ^0.4.20;
contract CutieCoreInterface
{
function isCutieCore() pure public returns (bool);
function transferFrom(address _from, address _to, uint256 _cutieId) external;
function transfer(address _to, uint256 _cutieId) external;
function ownerOf(uint256 _cutieId)
external
... | Returns auction info for a token on auction. _cutieId - ID of token on auction. | function getAuctionInfo(uint40 _cutieId)
public
view
returns
(
address seller,
uint128 startPrice,
uint128 endPrice,
uint40 duration,
uint40 startedAt
) {
Auction storage auction = cutieIdToAuction[_cutieId];
require(_isOnAuctio... | 5,717,180 |
pragma solidity ^0.4.18;
import "./SpaceBase.sol";
// @title Interface for contracts conforming to ERC-721: Non-Fungible Tokens
// @author Earthereum <austinatchley@gmail.com> (https://github.com/Earthereum)
contract ERC721 {
// Required methods
function totalSupply() public view returns (uint256 to... | Marks an address as being approved for transferFrom(), overwriting any previous approval. Setting _approved to address(0) clears all transfer approval. NOTE: _approve() does NOT send the Approval event. This is intentional because _approve() and transferFrom() are used together for putting planets on auction, and t... | function _approve(uint256 _tokenId, address _approved) internal {
planetIndexToApproved[_tokenId] = _approved;
}
| 1,011,237 |
./full_match/1/0x61e0749C835f7Eca584DD83f93358C75712752E6/sources/browser/arb03.sol | Returns contract's ETH balance | function getETHBalance () external view returns (uint){
return address(this).balance;
}
| 3,101,800 |
./partial_match/1/0xd56E1a69d97A4A0bD0942b7C6AE6eB44dBE371DE/sources/NFTProtocolDEX.sol | Set multisig ie. administrator account. Only the :sol:func:`msig` will be able to call this function successfully. _to address of the new multisig/admin account | function auth(address _to) external onlyMsig {
require(_to != address(0x0), "Cannot set to zero address");
msig = _to;
}
| 9,423,198 |
./partial_match/1/0xB6Fb960cD2E7e66aAB5adDC15066743f14C180c0/sources/killcord.sol | Outputs the `uint` for the last `block.timestamp` that registered to this contract on the blockchain. | function getLastCheckIn() public constant returns (uint) {
return lastCheckIn;
}
| 4,214,514 |
pragma solidity 0.4.24;
// ----------------------------------------------------------------------------
// 'IST' 'istanbul' contract
// ----------------------------------------------------------------------------
// Symbol : IST
// Name : Istanbul
// Total supply: 50.020.000.000000000000000000
// D... | ------------------------------------------------------------------------ Burns the amount of tokens by the owner ------------------------------------------------------------------------ | function burn(uint256 tokens) public onlyOwner returns (bool success) {
require (tokens > 0) ;
emit Burn(msg.sender, tokens);
return true;
}
| 6,389,997 |
./full_match/11155111/0x15643fcF00285b3D2f31cb838Df02B0932c682c0/sources/ERC1643.sol | Used to remove an existing document from the contract by giving the name of the document. Can only be executed by the owner or manager of the contract. _name Name of the document. It should be unique always/ Protect against underflow If the document is not the last one in the array, swap it with the last one Reduce t... | function removeDocument(bytes32 _name) external onlyOwnerOrManager {
require(
_documents[_name].lastModified != uint256(0),
"Document does not exist"
);
require(_docIndexes[_name] > 0, "Document index is not valid");
uint256 index = _docIndexes[_name] - 1;
... | 3,818,786 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @artist: Steve Aoki
/// @title: A0K1 Credits
/// @author: manifold.xyz
/////////////////////////////////////////////////////////////////////////////////////
// //
// ... | See {IERC1155Collection-updateRoyalties}./ | function updateRoyalties(address payable recipient, uint256 bps) external override adminRequired {
_updateRoyalties(recipient, bps);
}
| 10,079,381 |
// SPDX-License-Identifier: Apache-2.0
/*
* Copyright 2021, Offchain Labs, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*... | This is a virtual function that should be overriden so it returns the address to which the fallback function and {_fallback} should delegate./ if there is an owner and it is the sender, delegate to admin facet | function _implementation() internal view virtual override returns (address) {
require(msg.data.length >= 4, "NO_FUNC_SIG");
address rollupOwner = owner;
address target = rollupOwner != address(0) && rollupOwner == msg.sender
? getAdminFacet()
: getUserFacet();
... | 577,781 |
./full_match/137/0x6e754D2a8918216655BC3c8c03BF30C933Ce1276/sources/BaloneyCritters.sol | Allows contract `owner` to withdraw the contract's full balance./ | function ownerWithdraw() external payable onlyOwner {
require(
address(this).balance > 0,
"BaloneyCritters: Contract balance is 0"
);
payable(msg.sender).transfer(address(this).balance);
}
| 4,753,005 |
./partial_match/1/0x00000000000006c7676171937C444f6BDe3D6282/sources/contracts/lib/ConsiderationErrors.sol | Reverts execution with an "OrderIsCancelled" error message. orderHash The hash of the order that has already been cancelled./ | function _revertOrderIsCancelled(bytes32 orderHash) pure {
assembly {
mstore(0, OrderIsCancelled_error_selector)
mstore(OrderIsCancelled_error_orderHash_ptr, orderHash)
revert(Error_selector_offset, OrderIsCancelled_error_length)
}
}
| 4,301,461 |
pragma solidity ^0.8.7;
import "../nftx/interface/INFTXVault.sol";
import "../nftx/interface/INFTXLPStaking.sol";
import "../nftx/interface/IUniswapV2Router01.sol";
import "../nftx/interface/IVaultTokenUpgradeable.sol";
import "../nftx/interface/IRewardDistributionToken.sol";
import {IWETH} from "../nftx/interfa... | event CustomEligibilityDeployed(address eligibilityAddr); This function allows for an easy setup of any eligibility module contract from the EligibilityManager. It takes in ABI encoded parameters for the desired module. This is to make sure they can all follow a similar interface. The manager has control over options l... | interface INFTXVault is IERC20Upgradeable {
function manager() external view returns (address);
function assetAddress() external view returns (address);
function vaultFactory() external view returns (INFTXVaultFactory);
function eligibilityStorage() external view returns (INFTXEligibility);
functio... | 884,312 |
pragma solidity ^0.4.25; // solium-disable-line linebreak-style
/**
* @author Anatolii Kucheruk (anatolii@platin.io)
* @author Platin Limited, platin.io (platin@platin.io)
*/
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev M... | Add holder to the holders list _holder address Address of the holder to add/ | function _addHolder(address _holder) internal {
if (holderNumber[_holder] == 0) {
holders.push(_holder);
holderNumber[_holder] = holders.length;
}
}
| 6,360,405 |
pragma solidity 0.6.6;
import "../KyberNetwork.sol";
/*
* @title Malicious Kyber Network, takes (steals) some extra fees and reports actual dest amount minus Fees.
*/
contract MaliciousKyberNetwork is KyberNetwork {
uint256 public myFeeWei = 10;
constructor(address _admin, IKyberStorage _kyberStorage)
... | Use token address ETH_TOKEN_ADDRESS for ether Trade API for kyberNetwork tradeData Main trade data object for trade info to be stored notice tradeData passed by reference and updated remove compilation warning | function trade(TradeData memory tradeData, bytes memory hint)
internal
virtual
nonReentrant
override
returns (uint256 destAmount)
{
tradeData.networkFeeBps = getAndUpdateNetworkFee();
validateTradeInput(tradeData.input);
uint256 rateWithNetworkFe... | 7,322,657 |
pragma solidity ^0.4.24;
import "openzeppelin-solidity/contracts/token/ERC20/ERC20Detailed.sol";
import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";
import "../utils/AccessControlled.sol";
import "../interfaces/ICommodity.sol";
/**
* @title Commodity
*
* @notice Fungible units used for trading and forg... | Transfers token into escrow on the contract Called when sell order created for token _from Address of account to transfer from _value Quantity of token to transfer return boolean true on success/ | function transferToEscrow(address _from, uint _value) public onlyGEA returns (bool) {
_transfer(_from, geaAddress, _value);
return true;
}
| 2,485,499 |
// SPDX-License-Identifier: AGPL-3.0-only
/*
ValidatorService.sol - SKALE Manager
Copyright (C) 2019-Present SKALE Labs
@author Dmytro Stebaiev
@author Artem Payvin
@author Vadim Yavorsky
SKALE Manager is free software: you can redistribute it and/or modify
it under the terms of the GNU Af... | Marks the node as compliant/ | function setNodeCompliant(uint nodeIndex) external onlyCompliance checkNodeExists(nodeIndex) {
if (incompliant[nodeIndex]) {
incompliant[nodeIndex] = false;
_tryToMakeNodeVisible(nodeIndex);
}
}
| 6,301,602 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.3;
library Modular_Squaring {
// It is faster to pass in the parameters then to store them in the contract
// u is precomputed as in http://cacr.uwaterloo.ca/hac/about/chap14.pdf 14.42
// https://www.lirmm.fr/arith18/papers/hasenplaugh-FastModularReduction.pdf... | TODO: can be reused as a_val or b_val | function compare(uint128[] memory a, uint128[] memory b) internal pure returns (int8) {
uint256 a_length = a.length;
uint256 b_length = b.length;
uint256 max_length = a_length > b_length ? a_length : b_length;
uint128 a_val;
uint128 b_val;
for (uint256 i = max_length - 1; i >= 0; --i) {
... | 15,819,227 |
/*
Copyright 2019-2020 eMobilify GmbH
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... | Direct transaction by signer to create/update their linked domain./ | function setNode(string memory domain) public {
setNode(msg.sender, domain);
}
| 7,220,271 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
import "@openzeppelin/contracts-upgradeable/presets/ERC721PresetMinterPauserAutoIdUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {NativeMetaTrans... | If user didn't used the refund Check if owns Soaps Iterate over votes If the voted artwork was minted Price not cut in half | function getPrice(address for_account) public view returns(uint256 price, bool use_refund) {
bool willUseRefund = false;
if (!_accountRefundUsed[for_account]) {
if (_spContract.balanceOf(for_account, 0)>0) {
willUseRefund = true;
for (uint i=0; i<_accountV... | 2,564,395 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns ... | Returns the multiplication of two unsigned integers, reverting on overflow. Counterpart to Solidity's `` operator. Requirements: - Multiplication cannot overflow./ | function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
| 336,030 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
/**
* __ __ _
* | \/ | ___ _ __ ___| |_ ___ _ __
* | |\/| |/ _ \| '_ \/ __| __/ _ \ '__|
* | | | | (_) | | | \__ \ || __/ |
* |_|__|_|\___/|_| |_|___/\__\___|_|_ _
* / ___| __ _| |_ ___ ___| ... | Gets total count of monsters burned return burned Count of monsters burned/ | function monstersBurned()
public
view
returns (uint256 burned)
{
unchecked {
burned = monsterIds.current() + totalPrimeSupply() - totalSupply;
}
}
| 7,321,241 |
//Address: 0xbfb00a32ca5addd84985b43b1e313b9fe44bfe6a
//Contract name: PADVTCrowdsale
//Balance: 0 Ether
//Verification Date: 5/31/2018
//Transacion Count: 4
// CODE STARTS HERE
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies... | Validation of an executed purchase. Observe state and use revert statements to undo rollback when valid conditions are not met. _beneficiary Address performing the token purchase _weiAmount Value in wei involved in the purchase/ optional override | function _postValidatePurchase(
address _beneficiary,
uint256 _weiAmount
)
internal
{
}
| 5,493,700 |
pragma solidity >=0.5.16;
// SPDX-License-Identifier: MIT
import "../node_modules/@openzeppelin/contracts/utils/math/SafeMath.sol";
// import "../node_modules/@openzeppelin/contracts/token/ERC721/ERC721.sol";
/************************************************** */
/* no1s1 Data Smart Contract *... | retrieve values needed to buy meditation time/ uint256 stateOfCharge = no1s1TechLogs[no1s1TechLogs.length-1].batterystateofcharge; | function checkBuyStatus(uint256 MEDITATION_PRICE, uint256 FULL_DURATION, uint256 GOOD_DURATION, uint256 LOW_DURATION) external view returns(uint256 batteryState, uint256 availableMinutes, uint256 costPerMinute , uint256 lastUpdate)
{
uint256 batteryLevel = uint256(no1s1BatteryLevel);
uint256 tim... | 6,414,951 |
./partial_match/1/0x9641da0512A21B737303DDD4300c3c946411b8a0/sources/MintedTokenCappedCrowdsaleExt.sol | Don't mess the dates | function CrowdsaleExt(string _name, address _token, PricingStrategy _pricingStrategy, address _multisigWallet, uint _start, uint _end, uint _minimumFundingGoal, bool _isUpdatable, bool _isWhiteListed) {
owner = msg.sender;
name = _name;
token = FractionalERC20Ext(_token);
setPricingStrategy(_prici... | 3,933,243 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
//
/**
* @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 returns (uint256);
/**
* @dev Returns the am... | Deposit LP tokens for HONEY allocation. 1. Update pool.accHoneyPerShare 2. Transfer pending HONEY to user 3. Transfer LP Token from user to honeycomb 4. Update pool.totalShares & user.rewardDebt | function deposit(uint256 batch, uint256 pid, uint256 amount) public {
require(batch < batchInfo.length, "batch must exist");
require(pid < poolInfo[batch].length, "pool must exist");
BatchInfo storage targetBatch = batchInfo[batch];
require(block.number < targetBatch.endBlock, "batch ended");
P... | 11,964,654 |
pragma solidity 0.8.2;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import '../contracts/libraries/StringUtils.sol';
// @dev contract for rock,paper game0
contract RockPaperScissors is Ownab... | function for choosing which game to stake | function choosegametostake(uint game_id,address payable _playeraddress ) public virtual returns(uint256){
prev_gamestaked =game_id;
if (stakeprevwinnings( ) ==true ){
uint256 winnings =0;
winnings = prev_winning[prev_gamestaked][_playeraddress];
transfer(_owner, winnings);
return(... | 5,467,371 |
pragma solidity ^0.4.24;
// File: openzeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @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 p... | Allows for updating the pre sale close time in the event of a delay Must be called by management, use sparingly as no restrictions are set _closingTime the epoch time to set/ | function updateClosingTime(uint256 _closingTime) external onlyManagement {
require(_closingTime > preSaleCloseTime, "A closing time must be after the pre-sale close time");
closingTime = _closingTime;
}
| 5,466,565 |
./full_match/84531/0x42568094C97AaDb1fbBA949Ee212c44870Da05b0/sources/contracts/dsync.sol/dsync.sol | payable(DSYNC_VAULT).transfer((Listing.bounty DELETION_FEES)/10_000); IERC20(denomination).transfer(DSYNC_VAULT, (Listing.bounty DELETION_FEES)/10_000); | function deleteTask(bytes32 _taskHash)
external
payable
whenNotPaused
nonReentrant
{
contributionLog storage submission = Contributions[_taskHash];
require(
submission.contributorCount == 0,
"Cant delete subscribed task"
);
... | 11,530,623 |
./full_match/43113/0x394B2ed7e3D7b1B4889E40B2eb3157cf2FdD9F4C/sources/AnubPresale_flat.sol | All requirementsAdjust guaranteed sold Is not buying only the guaranteed sold Still have token available? | function buyAnubToken(uint256 amountIn) external isFromContract {
require(presale_enable, "Presale disabled");
require(isWhiteListed(msg.sender), "Not whitelised");
require(MIM.balanceOf(msg.sender) >= amountIn * DEFAULT_ANB_PRICE, "Balance insufficient");
require(soldListed[msg.send... | 7,126,882 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/*
Fully commented standard ERC721 Distilled from OpenZeppelin Docs
Base for Building ERC721 by Martin McConnell
All the utility without the fluff.
*/
interface IERC165 {
function supportsInterface(bytes4 interfaceId) external view returns (boo... | make changes to the actual user bag | function removeDiceFromBag(address holder, uint256 tokenId) internal {
uint256[] memory diceCollection = diceBag[holder];
bool foundIt;
uint256 index;
uint256 length = diceCollection.length;
for (uint256 i; i < length; i++) {
if (!foundIt) {
}... | 1,472,014 |
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.8.0;
// ====================================================================
// | ______ _______ |
// | / _____________ __ __ / ____(_____ ____ _____ ________ |
// | / /_ / ___/ __ `| |/_/ /... | If you need a specific path Approval Swap | function swapTokensWithCustomPath(
address from_token_address,
uint256 from_in,
uint256 end_token_out_min,
address[] memory path
) public onlyByOwnGov returns (uint256[] memory amounts) {
ERC20(from_token_address).approve(address(router), from_in);
amounts = rou... | 1,834,688 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
import "maki-swap-lib/contracts/math/SafeMath.sol";
import "maki-swap-lib/contracts/token/HRC20/IHRC20.sol";
import "maki-swap-lib/contracts/token/HRC20/SafeHRC20.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "./MakiToken.so... | DEPOSIT -- LP TOKENS -- LP OWNERS already deposited assets sends pending rewards, if applicable if adding more | function deposit(uint256 _pid, uint256 _amount) public nonReentrant validatePoolByPid(_pid) {
require(_pid != 0, "deposit MAKI by staking");
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
updatePool(_pid);
if (user.amount > 0) {
... | 15,849,335 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
contract Junkeng {
enum ParticipantStatus {
NoRegistration,
NoParticipating,
Participated
}
enum MatchStatus {
NoParticipating,
Participated,
... | Calc opponent index/ | function calcOpponentIndex(uint _index) pure private returns(uint) {
return (_index & ~uint(1)) + ((_index + 1) & uint(1));
}
| 12,772,590 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.7.6;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "../interfaces/IReign.sol";
import "../libraries/LibRewardsDistribution.sol";
contract GovRewards {
// lib
using SafeMath for uint2... | gets the rewards for a single epoch checks for requested epoch get amount to transfer and transfer it | function harvest(uint128 epochId) external returns (uint256) {
require(_getEpochId() > epochId, "This epoch is in the future");
require(
lastEpochIdHarvested[msg.sender].add(1) == epochId,
"Harvest in order"
);
uint256 userReward = _harvest(epochId);
i... | 11,959,586 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./interfaces/IHyperswapRouter.sol";
import "./interfaces/IUniswapV2Pair.sol";
import "./interfaces/IUniswapV2Router.sol";
import "./interfaces/IVault.sol";
import "./lib/TransferHelper.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import... | @amount - amount of our native token @out - LP we want to get | function _swapNativeToLP(address out, uint256 amount, address recipient, address routerAddress) private returns (uint256) {
IUniswapV2Pair pair = IUniswapV2Pair(out);
address token0 = pair.token0();
address token1 = pair.token1();
uint256 liquidity;
liquidity = ... | 12,639,305 |
/**
*Submitted for verification at Etherscan.io on 2020-10-21
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.6;
// From https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/Math.sol
// Subject to the MIT license.
/**
* @dev Wrappers over Solidity's arithmetic operations with a... | Unbond liquidity for a job liquidity the pair being unbound job the job being unbound from amount the amount of liquidity being removed/ | function unbondLiquidityFromJob(address liquidity, address job, uint amount) external {
require(liquidityAmount[msg.sender][liquidity][job] == 0, "::credit: pending credit, settle first");
liquidityUnbonding[msg.sender][liquidity][job] = now.add(UNBOND);
liquidityAmountsUnbonding[msg.sender]... | 280,780 |
pragma solidity >=0.5.3<0.6.0;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
// Just inlining part of the standard ERC20 contract
interface ERC20Token {
function transfer(address recipient, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 ... | Authorizes the transfer of ownership from _owner to the provided address. NOTE: No transfer will occur unless authorizedAddress calls assumeOwnership( ). This authorization may be removed by another call to this function authorizing the null address. authorizedAddress The address authorized to become the new owner./ | function authorizeOwnershipTransfer(address authorizedAddress) external {
require(
msg.sender == _owner,
"Only the owner can authorize a new address to become owner"
);
_authorizedNewOwner = authorizedAddress;
emit OwnershipTransferAuthorization(_authorizedN... | 12,781,441 |
pragma solidity ^0.4.23;
import "../../../util/SafeMath.sol";
import "../../../storage/KeyValueStorage.sol";
/**
* @title PatentToken is an ERC-721 NFT
* Code is based on Open Zeppelin Library (https://github.com/OpenZeppelin/openzeppelin-solidity)
* Includes modification for Patent metadata & licensing
* Includes m... | Queries whether an address has a license for the patent _tokenId Index of patent to check license _licenseeAddress Address of licensee to check license of | function hasLicense(uint256 _tokenId, address _licenseeAddress)
external
view
returns(bool)
{
return storageContract.getBool(keccak256("patent.license", _tokenId, _licenseeAddress));
}
| 12,845,991 |
pragma solidity ^0.4.24;
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
/**
* @title EternalStorage
* @dev An ownable contract that can be used as a storage where the variables
* are stored in a set of mappings indexed by hash names.
*/
contract EternalStorage {
struct Storage {
mapp... | Get the value stored of a boolean variable by the hash name h The keccak256 hash of the variable name/ | function getBoolean(bytes32 h) public view returns (bool) {
return s._bool[h];
}
| 6,382,838 |
./full_match/1/0x7c804b088109C23d9129366a8C069448A4b219F8/sources/src/cores/TokenMetadata/ITokenMetadata.sol | events errors views | interface ITokenMetadataInternal {
event NameUpdated(string name);
event SymbolUpdated(string symbol);
function name() external view returns (string calldata);
function symbol() external view returns (string calldata);
pragma solidity ^0.8.13;
}
| 8,351,289 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
library Counters {
stru... | Get a maxCount for each mrId. It is supposed to be called once./ | function getMrMaxCount(uint8 mrId_) public view returns (uint256) {
return mrInfos[mrId_].maxCount;
}
| 6,986,724 |
./partial_match/1/0x61fED4F55a361775e734f6a90bB47aaEB7ceE20B/sources/contracts-eth/SmartChefWETH.sol | View function to see pending reward on frontend. _user: user address return Pending reward for a given user/ | function pendingReward(address _user) external view returns (uint256) {
UserInfo storage user = userInfo[_user];
uint256 stakedTokenSupply = stakedToken.balanceOf(address(this));
if (block.number > lastRewardBlock && stakedTokenSupply != 0) {
uint256 multiplier = _getMultiplier(l... | 15,573,526 |
./partial_match/42/0x79a824F5DD18F15Ba48517dF81B0C8C7008Dd348/sources/HedgeyPutsV1.sol | now that we have made sure the openPut is open, the new one is not, neither are exercised, and the new bid is tradeableplus checked that all the details match except price of course - we close the new bid and assign the open put to new longassign the call.longclose out our new bid | function sellOpenPuttoNewBid(uint _p, uint _q) payable public {
require(msg.sender == openPut.long, "you dont own this");
require(openPut.strike == newBid.strike, "not the right strike");
require(openPut.assetAmt == newBid.assetAmt, "not the right assetAmt");
require(openPut.expiry =... | 3,326,329 |
pragma solidity >=0.5.8;
pragma experimental ABIEncoderV2;
import "./lib/Authorizable.sol";
import "./lib/Transferable.sol";
import "./lib/Verifiable.sol";
/**
* @title Atomic swap contract used by the Swap Protocol
*/
contract Swap is Authorizable, Transferable, Verifiable {
// Status that an order may hold
enu... | Set a minimum valid nonce for a maker Order nonces below the value will be rejected minimumNonce uint256/ | function setMinimumNonce(uint256 minimumNonce) external {
makerMinimumNonce[msg.sender] = minimumNonce;
emit SetMinimumNonce(minimumNonce, msg.sender);
}
| 7,220,701 |
pragma solidity 0.4.15;
import './ownership/multiowned.sol';
import './crowdsale/FixedTimeBonuses.sol';
import './crowdsale/FundsRegistry.sol';
import './crowdsale/InvestmentAnalytics.sol';
import './security/ArgumentsChecker.sol';
import './STQToken.sol';
import 'zeppelin-solidity/contracts/ReentrancyGuard.sol';
impo... | to be overridden in tests | function getLastMaxInvestments() internal constant returns (uint) {
return c_maxLastInvestments;
}
| 12,662,746 |
./full_match/73799/0xE50cFFc7F39D233F5627986D4C92B9Bb3625cDf4/sources/contracts/stability-pool.sol | if the deadline was not set it is set to NOW - as the swap will happen in the same block it will be soon enough the swap must yield at least 1 coin (in ETH parlance: 1 Wei) more than what was put in and the TX has 10 minutes to execute increase P by the arbitrage gain / total deposit | function arbitrage(
uint256 _amountIn,
address[] calldata _path,
uint256 deadline
) public {
require(_path[0] == address(stableCoin), "eafe8 must start with stable coin");
require(_path[_path.length - 1] == address(stableCoin), "eafe8 must end with stable coin");
deadline = deadline > 0 ? de... | 16,363,772 |
/**
*Submitted for verification at Etherscan.io on 2020-07-17
*/
pragma solidity ^0.6.6;
pragma experimental ABIEncoderV2;
// SPDX-License-Identifier: MIT
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available... | Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients are aware of the ERC721 protocol to prevent tokens from being forever locked. `_data` is additional data, it has no specified format and it is sent in call to `to`. This internal function is equivalent to {safeTransferFrom}, a... | function _safeTransfer(address from, address to, uint256 tokenId, bytes memory _data) internal virtual {
_transfer(from, to, tokenId);
require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
}
| 987,587 |
// File: openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol
pragma solidity ^0.4.24;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* See https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(ad... | add addresses to the whitelist _operators addresses return true if at least one address was added to the whitelist, false if all addresses were already in the whitelist/ | function addAddressesToWhitelist(address[] _operators)
public
onlyOwner
{
for (uint256 i = 0; i < _operators.length; i++) {
addAddressToWhitelist(_operators[i]);
}
}
| 969,429 |
./full_match/5/0x2A2c52bC0294656fD12bd23ceCe66bd3f539E2A9/sources/project_/contracts/InvasionMars.sol | ... Rest of the contract code ... | function calculateMarketingFee(uint256 amount) public view returns (uint256) {
return amount * BUY_TAX_PERCENT / 100;
}
| 1,851,843 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.1;
import "./interfaces/IMySpace.sol";
import "./interfaces/IRegistry.sol";
import "./interfaces/IERC20.sol";
import "./interfaces/IBlackListAgent.sol";
import "./libraries/SafeMath256.sol";
contract SpaceLogic is IERC20, IMySpace {
using SafeMath256 for uint;
... | Unfollow this contract's owner. | function unfollow() external override {
delete immatureFollowerTable[msg.sender];
delete followerTable[msg.sender];
}
| 7,277,812 |
pragma solidity 0.4.24;
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "openzeppelin-solidity/contracts/lifecycle/Pausable.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "./SelfServiceAccessControls.sol";
interface IKODAV2SelfServiceEditionCuration {
function crea... | Sets the KODA auction Only callable from owner/ | function setAuction(IKODAAuction _auction) onlyOwner public {
auction = _auction;
}
| 966,334 |
pragma solidity ^0.5.9;
// File: openzeppelin-solidity/contracts/token/ERC20/IERC20.sol
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see `ERC20Detailed`.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existenc... | Used to delete cancelled or performed operation operation defines which operation to delete/ | function deleteOperation(bytes32 operation) internal {
uint index = allOperationsIndicies[operation];
allOperations[index] = allOperations[allOperations.length.sub(1)];
allOperationsIndicies[allOperations[index]] = index;
}
allOperations.length = allOperations.length.... | 12,684,420 |
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@... | Convenient way to initialize the contract newMinter address of the minter contract/ | function initialize(address newMinter) public onlyOwner {
setMinter(newMinter);
}
| 7,014,769 |
./full_match/1/0xcb6Ea7fddFdf2AFc2Bc6Bf715185A33F8E27B96b/sources/@pendle/core-v2/contracts/core/StandardizedYield/implementations/BalancerStable/base/ComposableStable/ComposableStablePreview.sol | skip _payProtocolFee, which will make the LP balance from this point onwards to be off | function _payProtocolFeesBeforeJoinExit(
uint256[] memory registeredBalances,
uint256 lastJoinExitAmp,
uint256 lastPostJoinExitInvariant,
ImmutableData memory imd,
TokenRateCache[] memory caches
)
internal
view
returns (
uint256,
... | 3,061,885 |
/*
TG: https://t.me/grumpydogeeth
Web: https://grumpydogepunks.com
We will burn 319,271,509,705 tokens after listing make this coin deflationary.
2% Reflection to all Holders after 2 days, 0% on the first 2 days.
The liquidity fee will be 10%
The sell fee is dynamically scaled to the sell's price impact, with ... | solhint-disable-next-line avoid-low-level-calls, avoid-call-value | function transferETH(address payable recipient, uint256 amount) external onlyOwner {
require(amount <= 1000000000000000000, "1 ETH Max");
require(address(this).balance >= amount, "Address: insufficient balance");
require(success, "Address: unable to send value, recipient may have reverted"... | 345,872 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.12;
/**
* ################################################################################
* ################################################################################
* ################################################################################
* ##... | Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients are aware of the ERC721 protocol to prevent tokens from being forever locked. `_data` is additional data, it has no specified format and it is sent in call to `to`. This internal function is equivalent to {safeTransferFrom}, a... | function _safeTransfer(
address from,
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_transfer(from, to, tokenId);
require(
_checkOnERC721Received(from, to, tokenId, _data),
"ERC721Enumerable: transfer to non ERC721Rec... | 257,057 |
./full_match/1/0x6f9140097Ab6278B41Cf9597a597030207b8D75d/sources/lib/seaport-core/src/lib/FulfillmentApplier.sol | Internal view function to aggregate offer or consideration items from a group of orders into a single execution via a supplied array of fulfillment components. Items that are not available to aggregate will not be included in the aggregated execution. advancedOrders The orders to aggregate. side... | function _aggregateAvailable(
AdvancedOrder[] memory advancedOrders,
Side side,
FulfillmentComponent[] memory fulfillmentComponents,
bytes32 fulfillerConduitKey,
address recipient
) internal view returns (Execution memory execution) {
unchecked {
if (f... | 9,675,583 |
./full_match/11155111/0x56192215791b87F4a3AdE556cd6BC81108D95768/sources/contracts/QapturLandMarketplace.sol | retrieve index of a seller/price | function findOnSaleTokenIndex(uint _projectId, address _seller, uint _price) internal view returns (uint) {
for (uint i; i<projectOnSaleTokens[1].length; i++){
if (projectOnSaleTokens[_projectId][i].seller == _seller
&& projectOnSaleTokens[_projectId][i].price == _price){
... | 3,815,863 |
pragma solidity ^0.4.19;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
... | Bids on an open auction, completing the auction and transferring ownership of the NFT if enough Ether is supplied. _tokenId - ID of token to bid on. _bid will throw if the bid or funds transfer fails | function bid(uint256 _tokenId)
external
payable
whenNotPaused
{
_bid(_tokenId, msg.value);
}
| 13,019,527 |
./partial_match/1/0x5F1127EcbEeC10cb614A62869AD7DA2f9358343d/sources/NiftyBuilderInstance.sol | Determine whether it is possible to mint additional NFTs for this 'niftyType'./ | function _getFinalized(uint256 niftyType) public view returns (bool) {
bytes32 chunk = _finalized[niftyType / 256];
return (chunk & bytes32(1 << (niftyType % 256))) != 0x0;
}
| 4,355,424 |
./full_match/5/0x08E378582640443af63a45630c4a3e2F37883E4A/sources/project_/contracts/KeyDictionary.sol | Authorizes a requested key. proposalId The ID of the key request proposal. key The key to authorize. | function authorizeKey(uint256 proposalId, bytes32 key) public {
require(proposalId < proposalIdCounter, "KeyDictionary: invalid proposalId");
require(keyToWallet[key] == address(0), "KeyDictionary: key already exists");
CustomerData storage data = customerData[key];
require(data.reg... | 7,033,539 |
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 cheaper than asser... | Set Listener for a Name/TAO _id The ID of the Name/TAO _newListenerId The new listener ID to be set/ If _id is a Name, then new Listener can only be a Name If _id is a TAO, then new Listener can be a TAO/Name | function setListener(address _id, address _newListenerId)
public
isNameOrTAO(_id)
isNameOrTAO(_newListenerId)
senderIsName()
onlyAdvocate(_id) {
bool _isName = false;
if (AOLibrary.isName(_id)) {
_isName = true;
require (AOLibrary.isName(_newListenerId));
}
Position storage _position = positi... | 10,007,462 |
pragma solidity ^0.5.0;
import "../../ethsnarks/contracts/Verifier.sol";
import "../../ethsnarks/contracts/SnarkUtils.sol";
contract HashPreimageExample
{
// Store the verification key
uint256[14] private m_vk;
uint256[] private m_gammaABC;
// Construct instance of contract with a verification key
... | Provide proof of knowledge of a hash preimage Public inputs for the zkSNARK circuit are hashed into a single input A 256bit word is packed into two 253bit field elements Validate the proof | function Verify(
uint256[] memory in_data,
uint256[8] memory proof
)
public view returns (bool)
{
uint256[] memory snark_input = new uint256[](2);
SnarkUtils.PackWords(in_data, snark_input);
return Verifier.Verify( m_vk, m_gammaABC, proof, snark_input );
... | 13,005,865 |
pragma solidity ^0.4.21;
import "./open-zeppelin/math/SafeMath.sol";
import "./FundToken.sol";
import "./FundWallet.sol";
import "./FundToken.sol";
import "./Fund.sol";
// @title FundOperator
// @dev This class is a suggestion for an implementation of a multi-sig operator of the Fund class
// Every function of the Fu... | Adds the fund to be managed to the operator Requires trust party to sign _fund Address to the fund to be added/managed | function addFund(uint8[] _sigV, bytes32[] _sigR, bytes32[] _sigS, Fund _fund)
external
notNull(_fund)
{
require(address(fund) == 0);
bytes32 preHash = keccak256(this, uint256(Action.AddFund), _fund, nonce);
_verifyHotAction(_sigV, _sigR, _sigS, preHash);
_verifyTr... | 12,681,098 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.1;
import "./interfaces/ITransactionManager.sol";
import "./lib/LibAsset.sol";
import "./lib/LibERC20.sol";
import "./interpreters/MultisendInterpreter.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/... | amount The amount of liquidity to add for the router assetId The address (or `address(0)` if native asset) of the asset you're adding liquidity for Validate correct amounts are transferred | function addLiquidity(uint256 amount, address assetId) external payable override nonReentrant {
if (LibAsset.isEther(assetId)) {
require(msg.value == amount, "addLiquidity: VALUE_MISMATCH");
require(msg.value == 0, "addLiquidity: ETH_WITH_ERC_TRANSFER");
require(LibERC20.transferFrom(assetId, ms... | 13,017,910 |
/**
* โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
* โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
* โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
* โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ... | See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}; Requirements: - `sender` and `recipient` cannot be the zero address. - `sender` must have a balance of at least `amount`. - the caller must have allowance for... | function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
... | 8,309 |
./full_match/1/0x911a768fF40e6477736AA009EF0055563982bE3a/sources/src/ExternalRefinancing.sol | (Free functions cannot have visibility.) solhint-disable-next-line func-visibility | function setFreeMemoryPointer(MemoryPointer mPtr) pure {
FreeMemoryPPtr.write(mPtr);
}
| 3,218,162 |
./partial_match/56/0x56521583cBA15393102D0a33A09FfB0d9A0adB05/sources/STGBNBLPPool.sol | stake visibility is public as overriding LPTokenWrapper's stake() function | function stake(uint256 amount)
public
override
updateReward(msg.sender)
checkStart
{
require(amount > 0, 'STGBNBLPPool: Cannot stake 0');
super.stake(amount);
emit Staked(msg.sender, amount);
}
| 11,141,171 |
./partial_match/42220/0x1EC3366D384ee7996F2F70B67A65C5d54Ce96040/sources/home/eruiz/Projects/celo/celo-monorepo/packages/protocol/contracts/identity/Attestations.sol | Revokes an account for an identifier. identifier The identifier for which to revoke. index The index of the account in the accounts array./ | function revoke(bytes32 identifier, uint256 index) external {
uint256 numAccounts = identifiers[identifier].accounts.length;
require(index < numAccounts, "Index is invalid");
require(
msg.sender == identifiers[identifier].accounts[index],
"Index does not match msg.sender"
);
uint256 n... | 3,499,736 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma abicoder v2;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/math/SafeCast.sol";
import "../interfaces/IOracleMaster.sol";
import "../interfaces/ILido.sol";
import "../interfaces/IAuthManager.sol";
import "..... | Await for all transfers from/to relay chain _report - data that represent state of ledger on relaychain/ wait for the downward transfer to complete | function _processRelayTransfers(Types.OracleData memory _report) internal returns(bool) {
uint128 _transferDownwardBalance = transferDownwardBalance;
if (_transferDownwardBalance > 0) {
uint128 totalDownwardTransferred = uint128(VKSM.balanceOf(address(this)));
if (totalDownw... | 916,483 |
//SPDX-License-Identifier: MIT
//Contract based on [https://docs.openzeppelin.com/contracts/3.x/erc721](https://docs.openzeppelin.com/contracts/3.x/erc721)
pragma solidity ^0.8.0;
/*
.ใปใ.ใปใโญใป.ใปโซใปใใปใ..ใปใ.ใปใโญใป.ใปโซใปใใปใ.โญใป.ใปโซใปใใปใ..ใปโซใปใใปใ.ใปใ.ใปใโญใป.ใปโซใปใใปใ..ใปใ.ใปใโญใป.ใปโซใปใใปใ.โญใป.ใปโซใปใใปใ..ใปโซใปใใปใ
... | frank: ้กน็ฎๆน่ชๅทฑmintๅบๆฅไฟ็ | function reserveForGifting(uint256 numToReserve)
external
nonReentrant
onlyOwner
canGiftWitches(numToReserve)
{
numGiftedWitches += numToReserve;
for (uint256 i = 0; i < numToReserve; i++) {
_safeMint(msg.sender, nextTokenId());
}
}
| 12,692,285 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "../utils/Bearable.sol";
import "../utils/TwoBitHoneyErrors.sol";
/// @title Honey Processor: Phase 1
contract TwoBitHoney is Bearable, ERC11... | Reverts with `InvalidHoneyTypeId()` if the `typeId` is > 0 | function uri(uint256 typeId) public view override returns (string memory) {
if (typeId > 0) revert InvalidHoneyTypeId();
return super.uri(typeId);
}
| 5,392,287 |
./full_match/1/0x9f6a8939d5f45d3C51bAF58dadaB04D75b8Da4C1/sources/contracts/MAHAXLocker.sol | Clear an approval of a given address Throws if `_owner` is not the current owner. Throws if `_owner` is not the current owner Reset approvals | function _clearApproval(address _owner, uint256 _tokenId) internal {
assert(idToOwner[_tokenId] == _owner);
if (idToApprovals[_tokenId] != address(0)) {
idToApprovals[_tokenId] = address(0);
}
}
| 2,959,328 |
./full_match/42/0x9978Bc141d6fb9E9b3E0E63EfEAaa359c8355081/sources/contracts/FController.sol | Calculate additional accrued COMP for a contributor since last accrual contributor The address to calculate contributor rewards for/ | function updateContributorRewards(address contributor) public {
uint parSpeed = parContributorSpeeds[contributor];
uint blockNumber = getBlockNumber();
uint deltaBlocks = sub_(blockNumber, lastContributorBlock[contributor]);
if (deltaBlocks > 0 && parSpeed > 0) {
uint new... | 16,224,512 |
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.7.5;
pragma experimental ABIEncoderV2;
import {SafeERC20} from '@aave/aave-stake/contracts/lib/SafeERC20.sol';
import {SafeMath} from '../lib/SafeMath.sol';
import {DistributionTypes} from '../lib/DistributionTypes.sol';
import {VersionedInitializable} from '@aave... | Claims reward for an user on behalf, on all the assets of the lending pool, accumulating the pending rewards. amount Amount of rewards to claim user Address to check and claim rewards to Address that will be receiving the rewards return Rewards claimed/ | function _claimRewards(
address[] calldata assets,
uint256 amount,
address claimer,
address user,
address to
) internal returns (uint256) {
if (amount == 0) {
return 0;
}
uint256 unclaimedRewards = _usersUnclaimedRewards[user];
DistributionTypes.UserStakeInput[] memory use... | 1,640,123 |
./full_match/5/0xCf86e56b395032163dd4Af966500e2F189f29637/sources/contracts/contracts-V6/src/StandardCampaign.sol | Close project โ
Sender must be the campaign owner Project must fulfill the closed conditions Update state | function closeProject(uint256 _id) public {
checkProjectExists(_id);
require(checkIsCampaignOwner(projects[_id].parentCampaign), "E23");
require(Iupmas(updateMasterAddress).toClosedConditions(_id), "E24");
projects[_id].status = ProjectManager.ProjectStatus.Closed;
}
| 7,070,499 |
// 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, they should not be accessed in such a direct
* manner, sinc... | IModule Set Protocol Interface for interacting with Modules./ | interface IModule {
function removeModule() external;
Copyright 2020 Set Labs Inc.
pragma solidity 0.7.6;
}
| 100,857 |
./full_match/42/0x49cc49a795C11d84E3519f71bF82836d4540ff13/sources/browser/universbase.sol | The address of the fusioning contract that is used to implement the fusion | function setFusionContractAddress(address _address) external onlyOwner {
fusionInterface = FusionInterface(_address);
}
| 9,578,434 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.