file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
// contracts/NFT.sol
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity 0.8.9;
import "@openzeppelin/contracts/utils/Counters.sol";
import "./ERC721IMGStorage.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
contract SOULS is ERC... | Returns total number of tokens minted | function totalSupply() external view returns (uint256) {
return _tokenIds.current();
}
| 925,487 |
pragma solidity^0.6.0;
/*
* Team Equitable Builds Inc presents..
* ====================================*
* _____ ___ _______ ______ *
* | _ | || | __| __| *
* | | | | __| |__ *
* |__|__|_____|____|_____| *
* *
* =============... | Check and address to see if it has CEVA privileges or not/ | function checkCEVA(address _identifier)
public
view
returns(bool)
{
if(ceva_[_identifier] == true){
return true;
return false;
}
}
| 6,506,264 |
pragma solidity ^0.4.24;
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @d... | Increase the amount of tokens that an owner allowed to a spender. approve should be called when allowed[_spender] == 0. To increment allowed value is better to use this function to avoid 2 calls (and wait until the first transaction is mined) From MonolithDAO Token.sol _spender The address which will spend the funds. ... | function increaseApproval( address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = (allowed[msg.sender][_spender].add(_addedValue));
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
| 14,821,131 |
./full_match/1/0x4D91AaD0Deb494C71d538039c8C5d689fAFfa5Fc/sources/src/Portfolio.sol | Set deposit fee. _pct Percentage as ZOC (e.g. 1000 = 10%)./ | function setDepositFee(uint256 _pct) external virtual requiresAuth {
if (_pct > Math.ZOC) revert PercentageOver100();
depositFee = _pct;
emit DepositFeeSet(_pct);
}
| 17,094,295 |
./full_match/1/0x3589139f058b1659a0d7151cC14F44437DCBc48A/sources/browser/tests/WhaleClub.sol | userStage[_poolStage][msg.sender].claimable -= temp.claimable; | function claim(uint _poolStage) external nonReentrant{
PoolTemp memory temp;
temp.claimable = userStage[_poolStage][msg.sender].claimable;
temp.pendingClaim = pendingClaim(_poolStage, msg.sender);
temp.pendingClaim = _getTokenAmount(address(poolInfo.depositToken), temp.pendingClaim);
require(temp.pendi... | 3,027,154 |
./partial_match/1/0xF82D94E97E467c96F95B1Cbcb3BA4279b17A4ad0/sources/DOOGEE.sol | Number of Tokens to Accrue before Selling To Add to Marketing | function setnumTokensSwapToETHForMarketing(uint256 tokenAmount) external onlyOwner() {
_numTokensSwapToETHForMarketing = tokenAmount;
}
| 2,821,235 |
pragma solidity ^0.4.24;
/////設定管理者/////
contract owned {
address public owner;
function owned() {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) onlyOwner {
owner = newOwner;
}
} ... | input 0 => 布 1 => 剪刀 2 => 石頭 output 0 => 輸 1 => 平手 2 => 贏 | function compare(uint8 player,uint computer) internal returns(uint8 result){
uint8 _result;
_result = 2;
}
| 2,157,122 |
pragma solidity ^0.4.18;
// File: contracts/flavours/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;
event Owners... | Remove address from ICO whitelist address_ Investor address/ | function blacklist(address address_) external onlyOwner {
delete whitelist[address_];
ICOBlacklisted(address_);
}
| 1,641,982 |
pragma solidity ^0.4.23;
contract DSAuthority {
function canCall(
address src, address dst, bytes4 sig
) public view returns (bool);
}
contract DSAuthEvents {
event LogSetAuthority (address indexed authority);
event LogSetOwner (address indexed owner);
}
contract DSAuth is DS... | This method can be used by the owner to extract mistakenly sent tokens to this contract. _token The address of the token contract that you want to recover set to 0 in case you want to extract ether. | function claimTokens(address _token) auth {
if (_token == 0x0) {
address(msg.sender).transfer(address(this).balance);
return;
}
ERC20 token = ERC20(_token);
uint balance = token.balanceOf(this);
token.transfer(address(msg.sender), balance);
e... | 7,278,743 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721EnumerableLemon.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import ... | burn token id/ | function burn(uint256 tokenId) public virtual {
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721Burnable: caller is not owner nor approved");
numTokensBurned++;
_burn(tokenId);
}
| 624,665 |
//SPDX-License-Identifier: CAL
pragma solidity 0.6.12;
import {Math} from "@openzeppelin/contracts/math/Math.sol";
import {SafeMath} from "@openzeppelin/contracts/math/SafeMath.sol";
import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import {TierUtil}
from "@beehiveinnovation/rain-protocol/contract... | Mint reward and upgrade the last claim register by the user. Update `lastClaim`, next claims will be calculated from this moment. | function claim() external override {
uint256 reward_ = getReward(msg.sender);
require(reward_ > 0, "Claimer: no reward to claim");
_mint(msg.sender, reward_);
lastClaim[msg.sender] = block.number;
emit RedeemReward(msg.sender, reward_);
}
| 5,460,263 |
pragma solidity 0.4.18;
/*
Sketches:
- can be created
- can be traded: you make a bid, the other party can accept or you can withdraw the bid
- can not be destroyed
*/
contract Ownable {
address public owner;
function Ownable() public {
owner = msg.sender;
}
modifier only... | Buy a Sketch that's up for sale now, provided you've matched the Offer price and it's not on offer to a specific buyer Refund any bid the new buyer had placed for this Sketch. Other bids have to stay put for continued consideration or until their values have been withdrawn. | function buySketch(uint256 sketchIndex) external payable {
Offer storage offer = sketchIndexToOffer[sketchIndex];
uint256 messageValue = msg.value;
require(totalSupply != 0);
require(sketchIndex < totalSupply);
require(offer.isForSale);
require(offer.onlySellTo == 0x0 || offer.onlySellT... | 12,862,429 |
/**
*Submitted for verification at Etherscan.io on 2021-03-24
*/
pragma solidity ^0.5.17;
/*
* @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 su... | Will update the base URL of token's URI _newBaseMetadataURI New base URL of token's URI/ | function setBaseMetadataURI(string memory _newBaseMetadataURI) public onlyWhitelistAdmin {
_setBaseMetadataURI(_newBaseMetadataURI);
if (_currentTokenID > 0) {
_logURIs(_currentTokenID);
}
}
| 2,000,250 |
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity ^0.8.10;
import "./types/NoteKeeper.sol";
import "./libraries/SafeERC20.sol";
import "./interfaces/IERC20Metadata.sol";
import "./interfaces/IBondDepository.sol";
/// @title Floor Bond Depository V2
/// @author Zeus, Indigo
/// Review by: JeffX
contract... | deposit quote tokens in exchange for a bond from a specified market _id the ID of the market _amount the amount of quote token to spend _maxPrice the maximum price at which to buy _user the recipient of the payout _referral the front end operator address return payout_ the amount of ... | function deposit(
uint256 _id,
uint256 _amount,
uint256 _maxPrice,
address _user,
address _referral
) external override returns (
uint256 payout_,
uint256 expiry_,
uint256 index_
) {
Market storage market = markets[_id];
Terms memory term = terms[_id];
uint48 currentTi... | 10,010,460 |
pragma solidity ^0.4.24;
/** ----------------------MonetaryCoin V1.0.0 ------------------------*/
/**
* Homepage: https://MonetaryCoin.org Distribution: https://MonetaryCoin.io
*
* Full source code: https://github.com/Monetary-Foundation/MonetaryCoin
*
* Licenced MIT - The Monetary Foundation 2018
... | solium-disable-line | function upgradeM5Token(address newM5Token) public onlyUpgradeManager { | 911,006 |
pragma solidity ^0.4.25;
/**
* @author wpzczbyqy <weipengzhen@czbyqy.com>
* @title uint256类型集合操作
* 提供uint256集合类型操作,包括新增元素,删除元素,获取元素等
**/
library LibUint256Set {
struct Uint256Set {
uint256[] values;
mapping(uint256 => uint256) indexes;
}
/**
*@dev uint256集合是否包含某个元素
*@param set ... | 获取集合中元素的数量 set uint256类型集合return uint256 集合中元素数量/ | function getSize(Uint256Set storage set) internal view returns (uint256) {
return set.values.length;
}
| 12,582,092 |
pragma solidity 0.8.4;
import "@openzeppelin/contracts/access/Ownable.sol";
/**
* @title Blocklist
* @dev This contract manages a list of addresses and has a simple CRUD
*/
contract Blocklist is Ownable {
/**
* @dev The index of each user in the list
*/
mapping(address => uint256) private _userIndex;
... | Fetches the list of all blocklisted addresses return array The list of currently blocklisted addresses/ | function getFullList() public view returns (address[] memory) {
return _userList;
}
| 12,205,981 |
/**
*Submitted for verification at Etherscan.io on 2022-03-01
*/
/**
_ _
___ ___ (_)_ ____ _(_) _____ _____ __ _ _ __
/ __/ _ \| | '_ \ \ / / |/ _ \ \ /\ / / __/ _` | '_ \
| (_| (_) | | | | \ V /| | __/\ V V / (_| (_| | |_) |
\___\___/|_|_| |_|... | SPDX-License-Identifier: MIT | interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint... | 15,116,563 |
// SPDX-License-Identifier: MIT
// 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 disstributed in... | views the total amount of liquidity in the curve in numeraire value and format - 18 decimals return total_ the total value in the curve return individual_ the individual values in the curve | function liquidity() public view returns (uint256 total_, uint256[] memory individual_) {
return ViewLiquidity.viewLiquidity(curve);
}
| 1,539,431 |
pragma solidity ^0.5.7;
import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/ownership/Ownable.sol";
import "@openzeppelin/upgrades/contracts/Initiali... | Get sell curve contract | function sellCurve() public view returns (ICurveLogic) {
return _sellCurve;
}
| 12,964,105 |
./partial_match/97/0x0b31D8180B87669DDC224c3D0aeac0d7046Acd03/sources/SmartChef.sol | Update reward variables of the given pool to be up-to-date. | function updatePool(uint256 _pid) public {
PoolInfo storage pool = poolInfo[_pid];
if (block.number <= pool.lastRewardBlock) {
return;
}
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if (lpSupply == 0) {
pool.lastRewardBlock = block.number;... | 11,437,703 |
// SPDX-License-Identifier: MIT
import './abstract/ReaperBaseStrategy.sol';
import './interfaces/IUniswapRouter.sol';
import './interfaces/CErc20I.sol';
import './interfaces/IComptroller.sol';
import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
pragma solidity 0.8.11;
/**
* @dev... | Core harvest function. Swaps {SCREAM} to {WFTM}/ | function _swapRewardsToWftm() internal {
uint256 screamBalance = IERC20Upgradeable(SCREAM).balanceOf(address(this));
if (screamBalance >= minScreamToSell) {
IUniswapRouter(UNI_ROUTER).swapExactTokensForTokensSupportingFeeOnTransferTokens(
screamBalance,
0,... | 12,544,030 |
./partial_match/1/0xe35aC90D3BD1009977c989F3eb0c0d3E9F171817/sources/contracts/core/DaoRegistry.sol | Checks if an adapter has a given ACL flag return Whether or not the given adapter has the given flag set adapterAddress The address to look up flag The ACL flag to check against the given address/ | function hasAdapterAccess(address adapterAddress, AclFlag flag)
external
view
returns (bool)
{
return
DaoHelper.getFlag(inverseAdapters[adapterAddress].acl, uint8(flag));
}
| 15,956,501 |
./full_match/3/0x62c3BCAfb403B1AB5f0a936934D538F5F3ab45c1/sources/contracts/token.sol | Function _disable_mint: Disable future minting of your token. You can change the inputs, or the scope of your function, as needed. Do not remove the AdminOnly modifier! | function _disable_mint()
public
AdminOnly
{
_disable_mint_coin = true;
| 14,239,508 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
import "./DividendPayingToken.sol";
import "./SafeMath.sol";
import "./IterableMapping.sol";
import "./SafeMathInt.sol";
import "./Ownable.sol";
import "./IUniswapV2Pair.sol";
import "./IUniswapV2Factory.sol";
import "./IUniswapV2Router.sol";
contract MoonaRew... | transfers of this token are blocked in order to prevent an exploit like other coins suffered. | function _transfer(address, address, uint256) internal pure override {
require(false, "dev: No transfers allowed");
}
| 12,633,713 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";
import "./ERC1404.sol";
... | Public function that enables or disables the black list enforcement enabled A boolean flag that enables token transfers to be black listed | function setBlacklistEnabled(bool enabled) external onlyOwner {
_setBlacklistEnabled(enabled);
}
| 9,906,281 |
./partial_match/1/0x41C1F38A4BbFA4f14Ef235ed8901b3a0e51a2933/sources/NABC.sol | Allows turning off the swapping additional tokens to marketing funds/ | function setSwapEnabled(bool _enabled) public onlyOwner {
swapEnabled = _enabled;
emit SwapEnabledUpdated(_enabled);
}
| 2,617,117 |
pragma solidity ^0.4.18;
import "./ConvertLib.sol";
/// @title A library that houses the data structures used by the engine
/// @author Aaron Kendall
/// @notice Not all data structures have been used yet
/// @dev There are probably more efficient layout for these structures
library WonkaLib {
/// @title A data str... | Aaron Kendall Should be used just for testing by the user This method is just a proxy to call the 'parseInt()' method origVal The 'string' which we want to convert into a 'uint' return uint that contains the conversion of the provided string | function convertStringToNumber(string origVal) public pure returns (uint) {
uint convertVal = 123;
convertVal = ConvertLib.parseInt(origVal, 0);
return convertVal;
}
| 12,559,364 |
./full_match/1/0x9f60a931c50596632E220384Ad7e90D2e9Eb7031/sources/Dorkland.sol | Atomically decreases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. - `spender` must have ... | function decreaseAllowance(
address spender,
uint256 requestedDecrease
) public virtual returns (bool) {
address owner = _msgSender();
uint256 currentAllowance = allowance(owner, spender);
if (currentAllowance < requestedDecrease) {
revert ERC20FailedDecreaseA... | 2,940,528 |
pragma solidity ^0.6.0;
import { SafeMath as OZSafeMath } from "@openzeppelin/contracts/math/SafeMath.sol";
contract MockSlidingWindowOracle {
using OZSafeMath for uint256;
uint256 public constant ONE = 10**18;
mapping(address => mapping(address => uint256)) public twaps;
function setPrice(address ... | TWAP is for 1018 tokenA | function setPrice(address tokenA, address tokenB, uint256 twap) public {
twaps[tokenA][tokenB] = twap;
}
| 1,840,258 |
./partial_match/42/0x8a4149264f2627B9aCA8597A30Af3Cf94e10c980/sources/Unitroller.sol | Get a snapshot of the account's balances, and the cached exchange rate This is used by comptroller to more efficiently perform liquidity checks. account Address of the account to snapshot return (possible error, token balance, borrow balance, exchange rate mantissa)/ | function getAccountSnapshot(address account) external view returns (uint, uint, uint, uint) {
uint vTokenBalance = accountTokens[account];
uint borrowBalance;
uint exchangeRateMantissa;
MathError mErr;
(mErr, borrowBalance) = borrowBalanceStoredInternal(account);
if... | 8,885,414 |
pragma solidity ^0.4.21;
// Manages the puzzles generation and hashes comparing.
contract PuzzleManager
{
// Represents a generated puzzle.
struct Puzzle
{
// The unique identifier for this puzzle.
uint Id;
// The owner who generated this puzzle.
address Owner;
// Th... | <summary> Compares the metrics associated to this address to the original metrics, for the given puzzle id. </summary> | function CompareMetrics(uint puzzleId) public view returns(bool)
{
Puzzle storage puzzle = m_puzzles[puzzleId];
if(puzzle.OriginalHash == puzzle.Hashes[msg.sender])
{
return true;
}
return false;
}
| 12,607,891 |
pragma solidity 0.5.1;
// RCC Tokenization Contract
/**
* @title ERC20
* @author Prashant Prabhakar Singh
* @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md
*/
contract ERC20Interface {
function transfer(address to, uint tokens) public returns (bool success);
event Transfer(address... | Burn an existing weapon _id Id of weapon to be burned/ | function burn(uint _id)
public
whenNotPaused
{
super._burn(msg.sender, _id);
}
| 5,413,836 |
//***********************************EthVentures****************************************************************************
//
// TIRED OF POINTLESS PONZI SCHEMES? Then join EthVentures the first decentralized company!
//
//
// EthVentures is the first decentralized ethereum based company, with shareholder func... | DIVIDEND PAYOUT FUNCTION, IT WILL GET INCOME FROM OTHER CONTRACTS, THE DIVIDENDS WILL ALWAYS BE SENTIN LESS THAN 5 ETHER SIZE PACKETS, BECAUSE ANY DEPOSIT OVER 5 ETHER GETS REGISTERED AS AN INVESTOR!!!Distribute Dividends collect management fees and update contract balance and deposited amount add a new participant to ... | function Enter() {
if (msg.value < 5 ether)
{
uint PRE_inv_length = investors.length;
uint PRE_payout;
uint PRE_amount=msg.value;
if(PRE_inv_length !=0 && PRE_amount !=0)
{
for(uint PRE_i=0; PRE_i<PRE_inv_length;PRE_i++)
{
}
}
}
{
uint amount=msg.value;
uint inv_length = ... | 15,883,371 |
./full_match/1/0x0ac5f3d54bAE068BA24910bE99746e3e3a3Ad23e/sources/contracts/SendMainnet/SendIt.sol | Updates max `buy`, `sell` & `hold` amounts. WARNING: These limits disable when executing removeLimits function functionality: - prevents user from purchasing over 1% of supply - prevents user from selling over 1% of supply - prevents user from holding over 2% of supply/ | function updateMaxBuyAmount(uint256 newNum) external onlyOwner {
require(
newNum >= ((totalSupply() * 1) / 1_000),
"SENDIT ERROR: Cannot set max buy amount lower than 0.1%"
);
maxBuyAmount = newNum;
emit UpdatedMaxBuyAmount(maxBuyAmount);
}
| 4,911,422 |
pragma solidity >=0.5.0 <0.6.0;
import "./installed_contracts/zeppelin/contracts/math/SafeMath.sol";
import "./installed_contracts/zeppelin/contracts/math/SafeMath16.sol";
import "./installed_contracts/zeppelin/contracts/ownership/Ownable.sol";
/**
* @title Certification Smart Contract
* @author Harsh Rajat | http... | 1. OVERRIDE OWANABLE FUNCTIONS FOR ADMIN FUNCTIONALITY Remove Previous Admin and Add New Owner if necessary | Overriding Ownable.sol Remove Admin Add New Admin Call parent | function transferOwnership(address newOwner) public onlyOwner {
_removeAdmin(owner());
_addAdmin(newOwner);
super._transferOwnership(newOwner);
}
| 909,696 |
./partial_match/56/0xfE7B02D0B10e83F943051e4ED36aEeF9BB7c7C51/sources/ReferralRewardsType4.sol | Returns user's unclaimed reward. _user Address of the user. _includeDeposit Should the finnished deposits be included into calculations. return _reward User's reward. | function getPendingReward(address _user, bool _includeDeposit)
public
view
virtual
returns (uint256 _reward)
{
UserInfo storage user = userInfo[_user];
_reward = user.claimable.add(
now.sub(user.lastUpdate).mul(user.amount).mul(rewardPerSec).div(
... | 11,320,662 |
./partial_match/8453/0xED3632ad146CD488fFcf13d8C4D0A9317314D2Aa/sources/project:/contracts/StrategySonne.sol | File: contracts/BIFI/interfaces/common/IERC20Extended.sol | interface IERC20Extended {
function symbol() external view returns (string memory);
function decimals() external view returns (uint);
}
| 16,705,384 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4;
pragma experimental ABIEncoderV2;
import "./ethregistrar/BaseRegistrarImplementation.sol";
import "./resolvers/Resolver.sol";
import "./root/Controllable.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
contract AMAENSClient is Controllable {
... | Transfers ownership of a node to a new address. May only be called by the current owner of the node. tokenId The node to transfer ownership of. owner The address of the new owner./ | function _transferOwnership(uint256 tokenId, address owner) private {
BaseRegistrarImplementation(baseAddr).reclaim(tokenId, owner);
BaseRegistrarImplementation(baseAddr).transferFrom(address(this), owner, tokenId);
}
| 12,912,370 |
./partial_match/1/0xB10daee1FCF62243aE27776D7a92D39dC8740f95/sources/lib/prb-math/src/sd59x18/Helpers.sol | Implements the unchecked subtraction operation (-) in the SD59x18 type. | function uncheckedSub(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {
unchecked {
result = wrap(x.unwrap() - y.unwrap());
}
}
| 9,308,796 |
pragma solidity ^0.4.24;
/**
* Authored by https://www.coinfabrik.com/
*/
pragma solidity ^0.4.24;
/**
* Originally from https://github.com/TokenMarketNet/ico
* Modified by https://www.coinfabrik.com/
*/
pragma solidity ^0.4.24;
/**
* Envisioned in FirstBlood ICO contract.
* Originally from https://github.c... | Set policy do we need to have server-side customer ids for the investments./ | function setRequireCustomerId(bool value) public onlyOwner {
requireCustomerId = value;
emit InvestmentPolicyChanged(requireCustomerId, requiredSignedAddress, signerAddress);
}
| 7,872,940 |
./partial_match/1/0x2FD4f0569896B4009FFAd793ac6308BFD79B4C35/sources/Cave.sol | Call returns a boolean value indicating success or failure. This is the current recommended method to use. | function _sendViaCall(address payable _to, uint256 amountETH) internal {
require(sent, "Failed to send Ether");
}
| 9,122,624 |
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;
}
/**
... | Check default value for feeDelta gas refund | function refundInternal(bytes16 _policyId, address _node, bool _forceRevoke)
internal returns (uint256 refundValue)
{
refundValue = 0;
Policy storage policy = policies[_policyId];
require(!policy.disabled);
uint16 endPeriod = uint16(policy.endTimestamp / secondsPerP... | 7,515,777 |
./full_match/4/0xF385BE5f6AE64f3C6e967C1CD7Ac359039BcE62c/sources/contracts/NaffleNew.sol | uint256 _totalPrice = _ticketPrice (_currentTickets); sendIncomeToCreater(_creator, _totalPrice - _entirePenalty);/ | function cancelCampaign (uint256 _campaignIndex) public nonReentrant returns(uint256){
address _creator = msg.sender;
require(creatorToCampaign[_creator][_campaignIndex].creator != address(0), "Can't find the campaign.");
uint256 _returnValue;
uint256 _ticketPrice = creatorToCampai... | 12,288,296 |
./full_match/43114/0xD781b8126F857A2073D5d0DD3D2903253DAA46bD/sources/src/token/ERC721/base/ERC721ABase.sol | @inheritdoc IERC721ABase/ | function ownerOf(uint256 tokenId) external view virtual returns (address) {
return _ownerOf(tokenId);
}
| 4,637,494 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
import "./Interfaces/CLODAOAsset.sol";
contract SimpleAmortizedLoanAsset is CLODAOReceivablesAsset {
uint32 principalAmount;
uint32 dailyInterestRateAmount;
constructor(uint32 principalAmt, uint32 dailyInterestRateAmt) {
principalAmount = pr... | The method for calculating interest return STATED_RATE or BANK_METHOD | function interestCalculcationMethod() external view returns (string memory) {
return "STATED_RATE";
}
| 12,711,024 |
./partial_match/1/0x82a208C2845F922f8453FBe0788a2DE73D6281Cd/sources/Presale.sol | ============================================================= Claim Functions ============================================================= | function claim(uint256 amount, address beneficiary) internal {
require(
IERC20(tokenAddress).balanceOf(Vowner) > amount,
"No token to release by owner"
);
IERC20(tokenAddress).safeTransferFrom(Vowner, beneficiary, amount);
totalClaimed = totalClaimed + amount;... | 15,964,922 |
./full_match/44787/0xA5013FA7276Ab9132cc25F8dE86fEbD7cdb7771d/sources/contracts/Marketplace.sol | Function to add a product | function writeProduct(
string memory _name,
string memory _image,
string memory _description,
string memory _location,
uint _price
) public {
uint _sold = 0;
products[productsLength] = Product(
payable(msg.sender),
_name,
... | 13,291,162 |
./full_match/1/0xEF10cc185357039b92a3C9B6BF1E5AaF3c5ff18A/sources/browser/Airdrop.sol | Transfer tokens from one address to another _to address The address which you want to transfer to _value uint the amount of tokens to be transferred return true if success/ | function transfer(address _to, uint256 _value) public override onlyPayloadSize(2 * 32) whenNotPaused returns (bool) {
require(!isBlackListed[msg.sender], "Transfer - Sender is blacklisted");
require(!isBlackListed[_to], "Transfer - Recipient is blacklisted");
super.transfer(_to, _value);
... | 9,647,038 |
./full_match/100/0xdB915c418B850c5556eEdd49e5b56E35Bec9708a/sources/concFr.sol | Updates `wETH9` amount forwarded for `DAO` membership 'tribute' and 'shares' requested. sharesForTribute_ `DAO` 'shares' requested. tributeForShares_ `DAO` 'tribute' made. Can only be called by `owner`. | function updateTribute(uint256 sharesForTribute_, uint256 tributeForShares_) external onlyOwner {
sharesForTribute = sharesForTribute_;
tributeForShares = tributeForShares_;
emit UpdateTribute(sharesForTribute_, tributeForShares_);
}
| 14,275,330 |
pragma solidity 0.4.24;
contract ERC20TokenInterface {
function totalSupply () external constant returns (uint);
function balanceOf (address tokenOwner) external constant returns (uint balance);
function transfer (address to, uint tokens) external returns (bool success);
function transferFrom (address... | Calculate tokens available for withdrawal. tokensUnlockedPercentage Percent of tokens that are allowed to be sent. return Amount of tokens that can be sent according to provided percentage./ | function getTokensAmountAllowedToWithdraw (uint256 tokensUnlockedPercentage) private view returns (uint256) {
uint256 totalTokensAllowedToWithdraw = initialTokensBalance.mul(tokensUnlockedPercentage).div(100);
uint256 unsentTokensAmount = totalTokensAllowedToWithdraw.sub(tokensSent);
return ... | 1,110,520 |
pragma solidity ^0.4.20; // solhint-disable-line
/*
modified pyramid contract by Cryptopinions (https://ethverify.net)
*/
contract DailyDivsSavings{
using SafeMath for uint;
address public ceo;
address public ceo2;
mapping(address => address) public referrer;//who has referred who
mapping(address => uint2... | setup data update dividend tracker add ref. bonus_dividends += referralBalance_[_customerAddress];referralBalance_[_customerAddress] = 0;payout fire event | function withdraw()
private
{
address _customerAddress = msg.sender;
payoutsTo_[_customerAddress] += (int256) (_dividends * magnitude);
_customerAddress.transfer(_dividends);
onWithdraw(_customerAddress, _dividends);
}
| 5,996,061 |
//Address: 0xab37d7c4a2ae9ad4451aa796171dc8ac0fa429f4
//Contract name: IcoToken
//Balance: 0 Ether
//Verification Date: 2/2/2018
//Transacion Count: 95
// CODE STARTS HERE
//File: node_modules/zeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol
pragma solidity ^0.4.18;
/**
* @title ERC20Basic
* @dev Simpler v... | returns number of elements in the vestinWallets array/ | function getVestingWalletLength() public view returns (uint256) {
return vestingWallets.length;
}
| 13,074,891 |
pragma solidity ^0.4.24;
import "openzeppelin-solidity/contracts/token/ERC721/ERC721.sol";
import "openzeppelin-solidity/contracts/token/ERC721/ERC721Receiver.sol";
import "openzeppelin-solidity/contracts/ownership/Contactable.sol";
import "openzeppelin-solidity/contracts/AddressUtils.sol";
import "openzeppelin-solidi... | Gets the token owner by its ID _tokenId uint ID of the token the owner of wich need to find return address the `_tokenId` owner/ | function ownerOf(uint _tokenId) public view returns (address) {
require(exists(_tokenId));
return tokenOwner[_tokenId];
}
| 12,959,488 |
./full_match/1/0xB6eB928D47f4562A8e704acbdA3F52423fEbbF0d/sources/contracts/utils/RolesUpgradeable.sol | Add an address to the manager role Can only be called by a manager manager address to add | function addManager(address manager) external virtual onlyManager {
_grantRole(MANAGER_ROLE, manager);
emit ManagerAdded(manager);
}
| 9,703,932 |
pragma solidity ^0.4.21;
// Redenom 2.9.0023
// The GNU General Public License v3
// © Musqogees Tech 2018, Redenom ™
// -------------------- SAFE MATH ----------------------------------------------
library SafeMath {
function add(uint a, uint b) internal pure returns (uint c) {
c = a + b;
req... | Refresh user acc Pays dividends if any | function updateAccount(address account) public returns(uint new_balance){
require(frozen == false);
require(round<=9);
if(epoch > 1 && accounts[account].lastEpoch < epoch){
if((accounts[account].balance - entire*100000000) >0){
emit Transfer(account, address(0),... | 11,983,507 |
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 amount of tokens owned by `account`.
... | helper for buying Bancor pool token by a certain converter version and converter type Bancor has 3 cases for different converter version and type/ get Bancor converter address by pool token and pool type transfer from sender and approve to converter for detect if there are ETH in connectors or not we use etherAmount Bu... | function buyBancorPool(
uint256 _amount,
address _poolToken,
address[] calldata _connectorsAddress,
uint256[] calldata _connectorsAmount,
bytes32[] calldata _additionalArgs,
bytes calldata _additionalData
)
private
returns(uint256 poolAmountReceive)
{
address converterAddress =... | 6,512,816 |
./full_match/42220/0x8e9dD3170dbb04BBfe5Af3ABB6bcF320F1D0684e/sources/contracts/community/CommunityAdminImplementation.sol | Updates the value of the treasurySafetyPercentage _newTreasurySafetyPercentage value of the treasurySafetyPercentage/ | function updateTreasurySafetyPercentage(uint256 _newTreasurySafetyPercentage)
external
override
onlyOwnerOrImpactMarketCouncil
{
require(
_newTreasurySafetyPercentage > 0 && _newTreasurySafetyPercentage < 101,
"CommunityAdmin::updateTreasurySafetyPercentag... | 16,342,700 |
./partial_match/1/0xdAFF9B276B8c55D34Fa1A65a764973D6A61a126f/sources/MRBURN.sol | change the minimum amount of tokens to swap | function updateSwapTokensAtAmount(uint256 newAmount) external onlyOwner returns (bool) {
require(newAmount >= (totalSupply() * 1 / 100000) / 1e6, "Swap amount cannot be lower than 0.001% total supply.");
require(newAmount <= (totalSupply() * 5 / 1000) / 1e6, "Swap amount cannot b... | 3,576,184 |
./full_match/80001/0x65d63958fc1Bf199e8a44762F77b329c864898fA/sources/contracts/Battle.sol | Simplify stun logic Check if the battle has ended and declare a winner If no character has lost all their health, reset the move submissions for the next round. | function _resolveRound(
uint256 battleId,
uint256 _skillId0,
uint256 _skillId1
) private {
BattleData storage battle = battles[battleId];
CharacterProxy storage proxyA = _getCharacterProxy(
battleId,
battle.players[0]
);
CharacterP... | 5,549,083 |
./partial_match/137/0x1F214c24cd5d947C10690A83294447bFf578846d/sources/PresaleERC1155.sol | removes the address from the whitelist if currently whitelisted can be executed even after whitelistedSaleStartDate/ | function removeWhitelisted(address whitelistedAddress) external onlyOwner {
require(whitelisted[whitelistedAddress], "the address not in the whitelist");
whitelisted[whitelistedAddress] = false;
emit RemoveWhitelisted(whitelistedAddress);
}
| 3,522,865 |
./partial_match/1/0x1201FAa7258A48b820619dD57Cd8FdEb25D49b2c/sources/contracts/managed/ManagedPool.sol | Called when a swap with the Pool occurs, where the tokens leaving the Pool are BPT. This function is responsible for upscaling any amounts received, in particular `balanceTokenIn` and `request.amount`. The return value is expected to be downscaled (appropriately rounded based on the swap type) ready to be passed to the... | function _onJoinSwap(
SwapRequest memory request,
uint256 balanceTokenIn,
uint256 actualSupply,
bytes32 poolState
) internal view returns (uint256) {
(uint256 tokenInWeight, uint256 scalingFactorTokenIn) = _getTokenInfo(
request.tokenIn,
ManagedPoo... | 4,227,874 |
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
interface IComptroller {
function enterMarkets(address[] calldata _cTokens) external returns (uint[] memory);
function exitMarket(address _cToken) external returns (uint);
function getAssetsIn(address _account) external view returns (address[] me... | Returns true if the feature is authorised for the wallet _wallet The target wallet. _feature The feature./ Lets a feature (caller) invoke a wallet. _wallet The target wallet. _to The target address for the transaction. _value The value of the transaction. _data The data of the transaction./ Backward Compatibili... | interface IWallet {
function owner() external view returns (address);
function modules() external view returns (uint);
function setOwner(address _newOwner) external;
function authorised(address _module) external view returns (bool);
function enabled(bytes4 _sig) ex... | 7,354,890 |
pragma solidity ^0.5.0;
import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
import "./interfaces/IModuleRegistry.sol";
import "./interfaces/IModuleFactory.sol";
import "./interfaces/ISecurityTokenRegistry.sol";
import "./interfaces/IPolymathRegistry.sol";
import "./interfaces/IFeatureRegistry.sol";
import... | Called by the ModuleFactory owner to register new modules for SecurityTokens to use _moduleFactory is the address of the module factory to be registered/ | function registerModule(address _moduleFactory) external whenNotPausedOrOwner {
if (IFeatureRegistry(getAddressValue(FEATURE_REGISTRY)).getFeatureStatus("customModulesAllowed")) {
require(
msg.sender == IOwnable(_moduleFactory).owner() || msg.sender == owner(),
"m... | 12,806,943 |
pragma solidity >=0.7.0;
contract owned {
address public owner;
constructor() {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) external onlyOwner {
owner = newOwner;
}
}
interface tokenRecipient { function receive... | allow other contracts to spend tokens / | function approve(address _spender, uint256 _value) external returns (bool success) {
allowance[msg.sender][_spender] = _value;
tokenRecipient spender = tokenRecipient(_spender);
return true;
}
| 2,503,747 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;
/**
* @notice A sample upkeep contract that emits event at regular intervals
*/
contract TimedUpKeep {
uint public lastBlockServiced;
uint public blocksInterval = 50;
event timedAlarm(uint);
function checkUpkeep(bytes calldata data) external view ... | check if set number of blocks have passed | function checkUpkeep(bytes calldata data) external view returns (bool, bytes memory) {
bool shouldPerformUpkeep = (block.number-lastBlockServiced) > blocksInterval;
return (shouldPerformUpkeep, "");
}
| 601,105 |
pragma solidity ^0.8.0;
import "../equivocation-inspector/EquivocationInspector.sol";
import "./ValidatorProxy.sol";
contract ValidatorSet {
/// Issue this log event to signal a desired change in validator set.
/// This will not lead to a change in active validator set until
/// finalizeChange is called.
... | Called when an initiated change reaches finality and is activated. Only valid when msg.sender == SUPER_USER (EIP96, 2160 - 2) Also called when the contract is first enabled for consensus. In this case, the "change" finalized is the activation of the initial set. do not modify this function, aura will likely bug | function finalizeChange() public onlySystem {
currentValidators = pendingValidators;
finalized = true;
epochStartHeights.push(block.number);
epochValidators[block.number] = currentValidators;
validatorProxy.updateValidators(currentValidators);
}
| 12,889,013 |
./full_match/4/0x92C05933C897079ffa2B8853B873Ed53D98a5df0/sources/browser/TokenSaleCoinDBS.sol | 1 Get active phase token price | function activePhasePrice() internal returns (uint256 ) {
Token tObj= Token(tokenContractAddress);
uint256 currentPhaseAsPerDate = activePhase();
require(currentPhaseAsPerDate!=0,"ICO completed");
if(currentPhaseAsPerDate == defaultActivePhase){
if(soldTokenInfo... | 791,426 |
./full_match/1/0x0000000000aec84F5BFc2af15EAfb943bf4e3522/sources/lib/solady/src/utils/LibBit.sol | Returns `x` reversed at the byte level. | function reverseBytes(uint256 x) internal pure returns (uint256 r) {
assembly {
let m := not(0)
r := x
m := xor(m, shl(s, m))
r := or(and(shr(s, r), m), and(shl(s, r), not(m)))
s := shr(1, s)
}
for { let s := 128... | 4,875,534 |
./partial_match/1/0x50c640146BE3393cb5aC8A410E0b726E24aa96F8/sources/EternalStorageProxy.sol | Tells the version name of the current implementation return string representing the name of the current version/ | function version() public view returns (uint256) {
return _version;
}
| 3,932,605 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.6;
import "@openzeppelin/contracts-upgradeable/governance/GovernorUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/governance/extensions/GovernorSettingsUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/governance/extensions/GovernorVote... | Store proposal metadata for later lookup/ | function _storeProposal(
address proposer,
address[] memory targets,
uint256[] memory values,
string[] memory signatures,
bytes[] memory calldatas,
string memory description
) private {
bytes32 descriptionHash = keccak256(bytes(description));
uint2... | 637,011 |
./partial_match/1/0xe3DC713dB6689183C6dFBEB9f47540d0A7E1198e/sources/UNITY.sol | Destoys `amount` tokens from `account`.`amount` is then deducted from the caller's allowance. See {_burn} and {_approve}./ | function burnFrom(address account, uint256 amount) public {
burn(account, amount);
_approve(account, msg.sender, _allowances[account][msg.sender].sub(amount));
}
| 2,790,941 |
./partial_match/42/0xDcD8a5C2cD166f90196205b2f76f273fd31684B4/sources/YieldDaiERC3156.sol | From ERC-3156. Loan `amount` Dai to `receiver`, which needs to return them plus fee to this contract within the same transaction. receiver The contract receiving the tokens, needs to implement the `onFlashLoan(address user, uint256 amount, uint256 fee, bytes calldata)` interface. token The loan currency. Must be the ... | function flashLoan(address receiver, address token, uint256 amount, bytes memory userData) public override {
require(token == address(pool.dai()), "Unsupported currency");
bytes memory data = abi.encode(msg.sender, receiver, amount, userData);
uint256 fyDaiAmount = pool.buyDaiPreview(amount.... | 3,383,078 |
pragma solidity ^0.4.25;
/*
██╗ ██╗██╗ ██╗██████╗ ███████╗██████╗ ███████╗████████╗ █████╗ ██╗ ██╗███████╗
██║ ██║╚██╗ ██╔╝██╔══██╗██╔════╝██╔══██╗██╔════╝╚══██╔══╝██╔══██╗██║ ██╔╝██╔════╝
███████║ ╚████╔╝ ██████╔╝█████╗ ██████╔╝███████╗ ██║ ███████║█████╔╝ █████╗
██╔══██║ ╚██╔╝ ██╔═══╝ ██╔══╝ ██╔... | Reinvest generated profit/ update Dealer update total deposit value trigger event | function reinvestProfit()
onlyStronghands()
public
{
address _customerAddress = msg.sender;
Dealer storage _dealer = dealers_[_customerAddress];
uint256 _profits = myProfit(_customerAddress);
totalDeposit_ = totalDeposit_.add(_profits);
emit onReinvestProfit(_customerAddress, _profits);
}
... | 5,433,586 |
./full_match/100/0x745D5C694695e977295040B239C9E316eF266B37/sources/contracts/citrus-oracle/src/MasterPriceOracle.sol | Attempts to return the price in base currency of `underlying` (implements `BasePriceOracle`)./ | function price(address underlying) external view returns (uint256) {
return _price(underlying);
}
| 14,290,654 |
./full_match/42/0x24197C1C7eb17D1bf8d0152A3BED2720ADEd21d5/sources/assignmentToken.sol | burn tokens by sending tokens to `address(0)` NOTE: must have enough balance to burnupdate supply | function burn(uint256 amount) public returns (bool) {
require(balances[msg.sender] >= amount);
balances[msg.sender] -= amount;
balances[burnerAddress] += amount;
supply -= amount;
return true;
}
| 9,586,336 |
./full_match/80001/0x1464B242Ca1d0fc14369860Cff04837850a4Fbaf/sources/project_/contracts/EnglishAuction.sol | ready to settle.no bidders, prize stays with owner; | function settle_owner() public{
require(msg.sender == owner);
require(most_recent_bid_block_number < block.number - 3, "Bidding still live!");
if(highest_bid!=0){
if(most_recent_bid_block_number < block.number - 3){
prize_id_owner[1] = highest_bidder;
payable(owner).transf... | 860,595 |
./full_match/5/0x13FDeFcadca58916f3BFDD492dBa2F522fb58558/sources/ERC1410Snapshot.sol | Total amount of tokens from a specific partition at a specific `_blockNumber`. partition The partition from which to retrieve the total supply _blockNumber The block number when the totalSupply is queried return The total amount of tokens from `partition` at `_blockNumber`/ | function totalSupplyAt(
bytes32 partition,
uint256 _blockNumber
) public view returns (uint256) {
return _getValueAt(_snapshotTotalSupply[partition], _blockNumber);
}
| 1,852,772 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
import "../interfaces/ERC20Spec.sol";
import "../interfaces/ERC721Spec.sol";
import "../utils/AccessControl.sol";
/**
* @title NFT Staking
*
* @notice Enables NFT staking for a given NFT smart contract defined on deployment
*
* @notice Doesn't introduce any ... | ERC-721 Non-Fungible Token Standard, optional enumeration extension The ERC-165 identifier for this interface is 0x780e9d63. William Entriken, Dieter Shirley, Jacob Evans, Nastassia Sachs/ | interface ERC721Enumerable is ERC721 {
function totalSupply() external view returns (uint256);
function tokenByIndex(uint256 _index) external view returns (uint256);
function tokenOfOwnerByIndex(address _owner, uint256 _index) external view returns (uint256);
}
}
| 113,889 |
./partial_match/1/0xD2Eedb0A785A64F478B2741bA4E81426c6b2fD5d/sources/DebaseToken.sol | Allows to change team wallet to set a new team wallet address. newTeamWallet The address of the new team wallet/ | function setTeamWallet(
address newTeamWallet
) external {
require(msg.sender == teamWallet || msg.sender == owner(), "unauthorized");
require(newTeamWallet != address(0), "zero address");
teamWallet = newTeamWallet;
emit SetTeamWallet(newTeamWallet);
}
| 3,600,204 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/utils/Counters.so... | supply = 0 _newReadyNFTs = 100 | function setReadyNFTs(uint256 _newReadyNFTs, string memory _newBaseURI) public onlyOwner {
require(
_newReadyNFTs > 0 && _newReadyNFTs >= totalSupply(),
"Must be more than zero and greater or equal to current supply"
);
readyNFTs = _newReadyNFTs;
baseURI = _newBaseUR... | 5,425,775 |
// File: contracts/lib/LibBytes.sol
pragma solidity ^0.5.7;
// Modified from 0x LibBytes
/*
Copyright 2018 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
h... | Fills an order. order Order object. takerAmountToFill Desired amount of takerToken to sell. allowInsufficient Whether insufficient order remaining is allowed to fill. return results Amounts filled and fees paid by maker and taker. | function fillOrder(
Common.Order memory order,
uint256 takerAmountToFill,
bool allowInsufficient
)
public
nonReentrant
returns (Common.FillResults memory results)
{
results = fillOrderInternal(
order,
takerAmountToFill,
allowIns... | 6,454,709 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts-upgradeable/token/ERC20/SafeERC20Upgradeable.sol";
import "./TokenBase/Base.sol";
/**
* @title dForce's Lending Protocol Contract.
* @notice iTokens which wrap an EIP-20 underlying.
* @author dForce Team.
*/
contract iToken i... | Gets the user's borrow balance with the latest `borrowIndex`./ Accrues interest. | function borrowBalanceCurrent(address _account)
external
nonReentrant
returns (uint256)
{
_updateInterest();
return _borrowBalanceInternal(_account);
}
| 133,168 |
// File: @openzeppelin/contracts/math/SafeMath.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually... | calculate logarithm base 10 of x magic constant comes from log10(2) 2^128 -> hex x signed 64.64-bit fixed point number, require x > 0 return signed 64.64-bit fixed point number/ | function logbase10(int128 x) internal pure returns (int128) {
require(x > 0);
return
int128(
(uint256(logbase2(x)) * 0x4d104d427de7fce20a6e420e02236748) >>
128
);
}
| 303,567 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.5.0;
pragma experimental ABIEncoderV2;
//import "./Base.sol";
import "./StakeSet.sol";
import "./SafeERC20.sol";
import "./Ownable.sol";
// contract Blog{
// function burnFrom(address account, uint256 amount) public;
// }
contract StakePool is Ownable{
usin... | get stake item by '_account' and '_index'/ | function getStakeOf(address _account, uint _index) external view returns (StakeSet.Item memory) {
require(_stakeOf[_account].length() > _index, "getStakeOf: _stakeOf[_account].length() > _index");
return _stakeOf[_account].at(_index);
}
| 6,300,815 |
./full_match/1/0x46b13E7E8f1aEF156973AE3eD975E738cAFB08C8/sources/contracts/utils/Pauseable.sol | Shutdown contract operations, if not already shutdown./ | function shutdown() external virtual whenNotShutdown onlyGovernor {
_everythingStopped = true;
_paused = true;
emit Shutdown(msg.sender);
}
| 3,134,160 |
//Address: 0x5e99ff20c437adbb0f503f0b33ba8aa0f9661a9d
//Contract name: DeveryPresale
//Balance: 0 Ether
//Verification Date: 12/14/2017
//Transacion Count: 8
// CODE STARTS HERE
pragma solidity ^0.4.18;
// ----------------------------------------------------------------------------
// 'PREVE' 'Presale EVE Tokens' t... | require(now <= START_DATE); | function setWhitelist(address _whitelist) public onlyOwner {
WhitelistUpdated(address(whitelist), _whitelist);
whitelist = DeveryPresaleWhitelist(_whitelist);
}
| 5,501,869 |
pragma solidity ^0.4.24;
/**
* Audited by VZ Chains (vzchains.com)
* HashRushICO.sol creates the client's token for crowdsale and allows for subsequent token sales and minting of tokens
* Crowdsale contracts edited from original contract code at https://www.ethereum.org/crowdsale#crowdfund-your-idea
* Addition... | Gets the balance of the specified address. _owner The address to query the the balance of. return An uint256 representing the amount owned by the passed address./ | function balanceOf(address _owner) public view returns (uint256) {
return balance[_owner];
}
| 14,075,560 |
./partial_match/1/0x1699FE9CaDC8a0b6c93E06B62Ab4592a0fFEcF61/sources/src/contracts/voting/libs/StateProofVerifier.sol | Parses RLP-encoded block header. _headerRlpBytes RLP-encoded block header./ | function parseBlockHeader(
bytes memory _headerRlpBytes
) internal pure returns (BlockHeader memory) {
BlockHeader memory result;
RLPReader.RLPItem[] memory headerFields = _headerRlpBytes
.toRlpItem()
.toList();
require(headerFields.length > HEADER_TIMESTAMP_INDEX);
result.stateRoo... | 9,364,333 |
./full_match/421613/0x7f36543B91cC30F84AE6718F319F49C076e93229/sources/project_/contracts/mercenaries/StatManager.sol | Restore characters health with an item tokenID Characters ID itemID item ID total number of items to use Return the Item Modifiers values for Health items (21)Check that the amount to increase is greater than zero, otherwise it's likely the item wasn't found in the set Increase the health (5 = health item) Burn the ... | function restoreHealth(uint256 tokenID, uint256 itemID, uint256 total)
external
nonReentrant
onlyOwnerOfToken(tokenID)
onlyInactive(tokenID)
{
require(itemsContract.balanceOf(msg.sender, itemID) >= total, "You don't have that item in your wallet");
(uint256 amount... | 11,574,787 |
pragma solidity ^0.5.0;
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "openzeppelin-solidity/contracts/math/Math.sol";
import "./ICryptoArcadeGame.sol";
import "./RewardSplitter.sol";
/**
* @title CryptoArcadeGame
* @dev This contract represents the logic and data for each game on the plat... | Method that pays to the player the ether corresponding to the number of shares as a % representation on the total. _player The address of the player return The amount of ether in wei paid to the player/ | function releaseReward(address payable _player)
external
returns (uint256 amount)
{
amount = rewardShare.release(_player);
}
| 1,001,480 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.7.6;
pragma experimental ABIEncoderV2;
import "./interfaces/IDiamondCut.sol";
import "./interfaces/IDiamondLoupe.sol";
import "./libraries/LibDiamond.sol";
import "./libraries/LibOwnership.sol";
import "./libraries/LibDiamondStorage.sol";
import "./interfaces/IE... | same as multiplierAtTs but for the current block timestamp | function multiplierOf(address user) public view returns (uint256) {
return multiplierAtTs(user, block.timestamp);
}
| 607,851 |
pragma solidity 0.8.10;
// SPDX-License-Identifier: MIT
import "./IERC20.sol";
import "./Ownable.sol";
import "./Address.sol";
import "./Context.sol";
import "./IDEXRouter.sol";
import "./IDEXFactory.sol";
import "./BuybackTreasury.sol";
import "./IUnicryptLiquidityLocker.sol";
import "./IAntiSnipe.sol";
contract Ha... | swap fee tokens to ETH calculate correct amounts to send out send out fees | function _processFees(uint256 amount) private {
uint256 feeSum = buyFees.marketingFee + buyFees.treasuryFee;
if (feeSum == 0) return;
_swapExactTokensForETH(amount);
uint256 amountEth = address(this).balance;
uint256 amountForMarketing = amountEth * buyFees.marketingFee / feeSum;
uint256 amountForTreasur... | 14,863,442 |
mapping(address => bool) public whitelist;
function addToWhitelist(address _investor) external
onlyOwner {
whitelist[_investor] = true;
}
function addMultipleToWhitelist(address[] _investors)
external onlyOwner {
for (uint256 i = 0; i < _investors.length; i++) {
whitelist[_invest... | Removes single address from whitelist. _investor Address to be removed to the whitelist/ | function removeFromWhitelist(address _investor) external
onlyOwner {
whitelist[_investor] = false;
}
| 922,506 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract WrappedEth is ... | Allows owner to unpause the contract/ | function unpause() public onlyOwner returns (bool) {
_unpause();
return true;
}
| 12,786,666 |
./partial_match/42/0xE8A0980A0a76FFEC2ED097Ec6Eb81e54386D8c32/sources/WyAttackV1.sol | 实现操作 WETH兑换成ETH ETH兑换成WETH 检查归还数量 | function callFunction(
address sender,
Account.Info memory account,
bytes memory data
) public payable {
MyCustomData memory mcd = abi.decode(data, (MyCustomData));
uint256 tokenBalanceBefore = IERC20(mcd.token).balanceOf(address(this));
WETH9(WETHAddress).withdr... | 3,398,012 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "../../contracts/ActiveBridgeSetBlockRelay.sol";
/**
* @title Test Helper for the new block Relay contract
* @dev The aim of this contract is to raise the visibility modifier of new block relay contract functions for testing purposes
* @author Witnet... | Gets the vote with the poposeBlock inputs | function getVote(
uint256 _blockHash,
uint256 _epoch,
uint256 _drMerkleRoot,
uint256 _tallyMerkleRoot,
uint256 _previousVote) external pure returns(uint256)
{
uint256 vote = uint256(
sha256(
abi.encodePacked(
_blockHash,
_epoch,
_drMerkleRoot,
_tallyMe... | 5,430,838 |
./partial_match/42/0x7eDB2b5ca57067eCdE8B0702b036FEa634B7D156/sources/ToyAdmin.sol | Withdraw LP tokens from ToyAdmin. | function withdraw(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "withdraw: not good");
updatePool(_pid);
uint256 pending = user.amount.mul(pool.accToyPerShare... | 8,954,773 |
./full_match/11155111/0x897B45f3FE10065A001DbC32B04d9843faaC49C8/sources/contracts/Exchange.sol | getReserve returns the balance of `token` held by `this` contract | function getReserve() public view returns (uint256) {
return ERC20(tokenAddress).balanceOf(address(this));
}
| 3,793,967 |
./partial_match/42/0x7Dab59e2Ca3a043316C2039453989d8519756d92/sources/DisposableGovernance.sol | to perform kyc verdict _userAddress whose kyc is being performed verdict of kyc process/ | function kycVerdict(address payable _userAddress, bool verdict) public {
require(msg.sender == qd.kycAuthAddress());
require(!ms.isPause());
require(_userAddress != address(0));
require(!ms.isMember(_userAddress));
require(qd.refundEligible(_userAddress));
if (verdict) {
qd.setRefundEli... | 3,300,337 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.