file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./full_match/83/0x41eB86d3FF7a5b039a2f16CFB5CA469cA130aaab/sources/contracts/CToken/CToken.sol | accrues interest and sets a new reserve factor for the protocol using _setReserveFactorFresh Admin function to accrue interest and set a new reserve factor return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/ accrueInterest emits logs on errors, but on top of that we want to log the fact tha... | function _setReserveFactor(uint256 newReserveFactorMantissa) external override nonReentrant returns (uint256) {
uint256 error = accrueInterest();
if (error != uint256(Error.NO_ERROR)) {
Error(error).fail(FailureInfo.SET_RESERVE_FACTOR_ACCRUE_INTEREST_FAILED);
}
}
| 9,557,180 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.4;
import './IFastLoan.sol';
contract FastLoanEscrow is IFastLoan {
struct LoanRequest {
address payable borrower;
uint256 projectID;
string projectTitle;
uint projectDuration;
uint256 amount;
}
struct Loan {
uint256 projectID;
... | deposit ETH to lender managing the loan request/ | function depositToEscrow(address _lender) public payable {
require(_lender == msg.sender, "Must be deposited by the lender");
lenderDepositInEscrow[_lender] += msg.value;
escrowBalance += msg.value;
}
| 12,804,957 |
./partial_match/56/0xebF98D41DF08c68649acc5D7321C7dCa284bcEFc/sources/HomeMediator.sol | File: contracts/interfaces/ISimpleBridgeKitty.sol | interface ISimpleBridgeKitty {
function mint(
uint256 _tokenId,
bool _isReady,
uint256 _cooldownIndex,
uint256 _nextActionAt,
uint256 _siringWithId,
uint256 _birthTime,
uint256 _matronId,
uint256 _sireId,
uint256 _generation,
uint256 _g... | 11,126,595 |
// First, a simple Bank contract
// Allows deposits, withdrawals, and balance checks
// simple_bank.sol (note .sol extension)
/* **** START EXAMPLE **** */
// Declare the source file compiler version
pragma solidity ^0.4.19;
// Start with Natspec comment (the three slashes)
// used for documentation - and as descri... | abstract function cannot be compiled, so used in base/abstract contracts that are then implemented C. Import 8. OTHER KEYWORDS A. Selfdestruct selfdestruct current contract, sending funds to address (often creator) removes storage/code from current/future blocks helps thin clients, but previous data persists in blockch... | function remove() {
}
| 12,554,291 |
pragma solidity ^0.4.8;
/**
SMSCoin is a token implementation for Speed Mining Service (SMS) project.
We are aim to issue the SMS tokens to give the privilege to the closed group of investors,
as then they will be able to receive the devidends from our mining farm in Hokkaido and the other countries as well.
Our clou... | Function used in Reward contract to know address of token holder | function getAddress(uint i) public constant returns(address) {
return addresses[i];
}
| 5,480,013 |
pragma solidity ^0.5.0;
contract Ethreon123 {
// The general structure for a user
struct People {
string name;
address owner;
}
// Mapping to get User ID given the public address
mapping (address => uint) getUserId;
// Mapping to get all the Creator ID's patron has subscribed... | Function to create a new user from the name, public address and return the id | function newUser (string memory _name) public {
require(getUserId[msg.sender] == 0, "Address already registered!");
uint uid = patrons.push(People(_name, msg.sender)) - 1;
uint[] memory users;
getSubscriptions[uid] = users;
getUserId[msg.sender] = uid;
emit NewPatron(... | 2,509,170 |
pragma solidity 0.4.25;
// 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 pr... | _approveKYCAddress provides the function to approve the specified address indicating KYC Verified _addressToApprove of the user that is being verified/ Ensure that _addressToApprove is not address(0) Get this addesses contribution record Set the contribution record to indicate address has been kyc verified | function _approveKYCAddress(address _addressToApprove)
onlyOwner
internal
{
require(_addressToApprove != address(0), "Invalid address specified: address(0)");
OrderBook storage order = orders[_addressToApprove];
order.kycVerified = true;
}
| 14,059,157 |
./full_match/1/0xaBcf18BF1937e3d7Bac7Ac743b7829aD6aD6D2ca/sources/contracts/MintPass.sol | Calculates the royalty information for a given sale. Implements the required royaltyInfo function for the ERC2981 standard. _salePrice The sale price of the token being sold. return receiver The address of the royalty recipient. return royaltyAmount The amount of royalty to be paid./ | function royaltyInfo(
uint256,
uint256 _salePrice
) external view returns (address receiver, uint256 royaltyAmount) {
return (project.royaltyAddress, (_salePrice * project.royalty) / 10000);
}
| 17,053,550 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
// Global Enums and Structs
struct PoolInfo {
IERC20 lpToken; // Address of LP token contract.
uint256 allocPoint; // How many allocation points assigned to this pool. TOKENs to distribute per bloc... | View function to see deposited TOKENs on frontend. | function tokenOfUser(uint256 _pid, address _user) external view returns (uint256) {
UserInfo storage user = userInfo[_pid][_user];
return user.amount;
}
| 5,794,867 |
pragma solidity 0.6.0;
contract Nest_NToken_OfferMain {
using SafeMath for uint256;
using address_make_payable for address;
using SafeERC20 for ERC20;
... | inject NONSTANDARD NAMING | function OREDRAWING657(address ntoken) private returns(uint256) { | 14,093,867 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.1.0/contracts/utils/Context.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.1.0/contracts/access/Ownable.sol";
import "https://github.com/OpenZeppelin/openzeppeli... | Delegates votes from signatory to `delegatee` delegatee The address to delegate votes to nonce The contract state required to match the signature expiry The time at which to expire the signature v The recovery byte of the signature r Half of the ECDSA signature pair s Half of the ECDSA signature pair/ | function delegateBySig(
address delegatee,
uint nonce,
uint expiry,
uint8 v,
bytes32 r,
bytes32 s
)
external
{
bytes32 domainSeparator = keccak256(
abi.encode(
DOMAIN_TYPEHASH,
keccak256(bytes(name())),
... | 7,321,521 |
pragma solidity ^0.4.18;
// CONTRACT USED TO TEST THE ICO CONTRACT
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public view returns (uint256);... | Function to get balance of an address | function balanceOf(address _addr) public view returns (uint256 balance) {
return token.balanceOf(_addr);
}
| 11,778,097 |
pragma solidity >=0.5.0;
//Interfaces
import './interfaces/IAddressResolver.sol';
import './interfaces/ISettings.sol';
import './interfaces/IERC20.sol';
import './interfaces/IBaseUbeswapAdapter.sol';
import "./interfaces/IStableCoinStakingRewards.sol";
import './interfaces/IUniswapV2Pair.sol';
import './interfaces/ISt... | Given the index of a position, returns the amount of USD received for the given number of LP tokens positionIndex Index of the leveraged position in array of leveraged positions numberOfTokens Number of LP tokens in the position's liquidity pair return uint Amount of USD received/ | function _calculateUserUSDShare(uint positionIndex, uint numberOfTokens) internal view positionIndexInRange(positionIndex) returns (uint) {
require(numberOfTokens > 0, "LeveragedLiquidityPositionManager: number of tokens must be greater than 0");
require(numberOfTokens <= leveragedPositions[position... | 2,548,282 |
./partial_match/1/0xA6D724A4D9AA11E146c7CB43FD6F0c7D5AAF52F3/sources/DeflectPoolStakingLock.sol | Staking function which updates the user balances in the parent contract / Call the parent to adjust the balances.set user lock time | function stake(uint256 amount) public override {
require(amount > 0, "Cannot stake 0");
updateReward(msg.sender);
super.stake(amount);
userLockTime[msg.sender] = block.timestamp + lockTime;
emit Staked(msg.sender, amount);
}
| 4,393,613 |
/**
* SPDX-License-Identifier: MIT
*
* Copyright (c) 2018-2020 CENTRE SECZ
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the right... | Assign the rescuer role to a given address. newRescuer New rescuer's address/ | function updateRescuer(address newRescuer) external onlyOwner {
require(
newRescuer != address(0),
"Rescuable: new rescuer is the zero address"
);
_rescuer = newRescuer;
emit RescuerChanged(newRescuer);
}
| 44,722 |
/**
*Submitted for verification at Etherscan.io on 2020-09-18
*/
pragma solidity ^0.4.24;
library HxSafeMath { //중요 1/3: 자식에서 compile문제로 SafeMath->HxSafeMath
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
... | If lockupinfo was deleted, loop restart at same position. | function _autoUnlock(address holder) internal returns(bool) {
for(uint256 idx =0; idx < timelockList[holder].length ; idx++ ) {
if (timelockList[holder][idx]._releaseTime <= now) {
if( _unlock(holder, idx) ) {
idx -=1;
}
}
}... | 555,891 |
pragma solidity ^0.4.25;
/*
* @title: SafeMath
* @dev: Helper contract functions to arithmatic operations safely.
*/
contract SafeMath {
function Sub(uint128 a, uint128 b) pure public returns (uint128) {
assert(b <= a);
return a - b;
}
function Add(uint128 a, uint128 b) pure public re... | Find or revert account | function FindOrRevertAccount() private view returns (uint32)
{
uint32 accountId = account_id[msg.sender];
require(accountId != 0);
return accountId;
}
| 1,032,937 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
//import "./ENY_Token.sol";
//import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";
//import "openzeppelin-solidity/contracts/math/SafeMath.sol";
//
// timed crowdsale
// refundable ?
// not minted (transfer from token contract / gnosis at the end... | / verfifier owner/admin du Contract tokenLeft = tokenContract.balanceOf(address(this)); | function launchICO() internal{
require(icoState == icoStates.WAITING, "Too late, ICO already started !");
tokenIcoStart = block.timestamp;
icoState = icoStates.STARTED;
tokenLeft = tokenIco;
}
| 12,606,681 |
./partial_match/4/0x29Df8785C95DB450f072F83A5654d27DBBE7a3E6/sources/Tantinople.sol | Update reward variables of the given pool to be up-to-date.当前区块已经奖励过了池子总量==0时,设置最后奖励块为当前区块号 | function updatePool(uint256 _pid) public {
PoolInfo storage pool = poolInfo[_pid];
if (block.number <= pool.lastRewardBlock) {
return;
}
if (lpSupply == 0) {
pool.lastRewardBlock = block.number;
return;
}
uint256 blockRewards = getB... | 8,655,689 |
pragma solidity ^0.4.25; //
contract EntryToken
{
mapping(address => uint256[]) inventory;
uint256[] public spawnedTokens;
mapping(bytes32 => bool) signatureChecked;
address public organiser;
address public paymaster;
string public name;
uint8 public constant decimals = 0; //no deci... | checks expiry timestamp,if fake timestamp is added then message verification will fail 0 means Token gone. | function trade(uint256 expiry,
uint256[] TokenIndices,
uint8 v,
bytes32 r,
bytes32 s) public payable
{
require(expiry > block.timestamp || expiry == 0);
bytes32 message = encodeMessage(msg.value, expiry, Toke... | 15,818,074 |
pragma solidity ^0.5.0;
import '@openzeppelin/contracts/math/SafeMath.sol';
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '@openzeppelin/contracts/lifecycle/Pausable.sol';
import './usingProvable.sol';
contract Ownable {
address payable public owner;
event OwnershipTransferred(add... | Oraclize callback Call it every day | function __callback(bytes32 myid, string memory result) public {
if (!validIds[myid]) revert();
if (msg.sender != provable_cbAddress()) revert();
ethPrice = safeParseInt(result);
emit PriceUpdated(now, ethPrice);
validIds[queryId] = true;
}
| 5,441,085 |
./full_match/1313161554/0x20D0E2D27D7d3f5420E68eBA474D4206431734D8/sources/contracts/Stableswap/rewards/MiniChefV2.sol | Withdraw without caring about rewards. EMERGENCY ONLY. pid The index of the pool. See `poolInfo`. to Receiver of the LP tokens. | function emergencyWithdraw(uint256 pid, address to) public {
UserInfo storage user = userInfo[pid][msg.sender];
uint256 amount = user.amount;
user.amount = 0;
user.rewardDebt = 0;
IRewarder _rewarder = rewarder[pid];
if (address(_rewarder) != address(0)) {
... | 13,230,063 |
./full_match/4/0x87a4F79a4F856736070795f888f94C71C39B1cE1/sources/contracts/BondDepository.sol | allow user to stake payout automatically _stake bool _amount uint return uint/ if user does not want to stake if user wants to stake use if staking warmup is 0 | function stakeOrSend(
address _recipient,
bool _stake,
uint256 _amount
) internal returns (uint256) {
if (!_stake) {
if (useHelper) {
IERC20(Bash).approve(stakingHelper, _amount);
IStakingHelper(stakingHelper).stake(_amount, _recipient)... | 724,324 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
import "@chainlink/contracts/src/v0.8/ChainlinkClient.sol";
/**
* @title The APIConsumer contract
* @notice An API Consumer contract that makes GET requests to obtain 24h trading volume of ETH in USD
*/
contract APIConsumer is ChainlinkClient {
using Chainl... | Witdraws LINK from the contract Implement a withdraw function to avoid locking your LINK in the contract/ | function withdrawLink() external {}
| 12,886,649 |
/*
* Kryptium Oracle Smart Contract v.1.0.0
* Copyright © 2018 Kryptium Team <info@kryptium.io>
* Author: Giannis Zarifis <jzarifis@kryptium.io>
*
* The Oracle smart contract is used by the House smart contract (and, in turn,
* the betting app) as a “trusted source of truth” for upcoming events and their ... | Adds a new output to existing an Upcoming Event/ | function addUpcomingEventOutput(uint id, string memory outputTitle, EventOutputType eventOutputType, bytes32[] memory _possibleResults,uint decimals) onlyOwner public {
require(events[id].closeDateTime >= now,"Close time should be greater than now");
eventOutputs[id][events[id].totalAvailableOutputs... | 15,809,413 |
/* SPDX-License-Identifier: MIT */
pragma solidity 0.6.10;
pragma experimental ABIEncoderV2;
import { console } from "@nomiclabs/buidler/console.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@chainlink/contracts/src/v0.6/ChainlinkClient.sol"... | Get address for ChainLink token contract ChainLink contract method | function getChainlinkToken() public view returns (address tokenAddress) {
return chainlinkTokenAddress();
}
| 1,060,829 |
//SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.0;
import "../node_modules/@0xcert/ethereum-erc721/src/contracts/ownership/ownable.sol";
import "../node_modules/@0xcert/ethereum-erc721/src/contracts/tokens/nf-token-metadata.sol";
contract Purchasing is Ownable {
event Sent(address indexed payee, uint256 am... | Updates _currentPrice Throws if _currentPrice is zero/ | function setCurrentPrice(uint256 _currentPrice) public onlyOwner {
require(_currentPrice > 0);
currentPrice = _currentPrice;
}
| 946,583 |
./full_match/1/0xcE49B4483dda381106a33243a5a09D142819e721/sources/contracts/lotterey.sol | buyTokens function that sells available tokens/ | function buyTokens(uint256 amount) public whenSaleIsActive {
uint256 USDTtokens = (amount.mul(RATE)).div(10**18);
USDT.transferFrom(msg.sender, owner,USDTtokens);
}
| 9,776,705 |
pragma solidity ^0.4.8;
contract ERC20 {
uint public totalSupply;
function balanceOf(address who) constant returns (uint);
function allowance(address owner, address spender) constant returns (uint);
function transfer(address to, uint value) returns (bool ok);
function transferFrom(address from, addr... | The fallback function corresponds to a donation in ETH/ | function() payable {
if (now > endBlock) throw;
receiveETH(msg.sender);
}
| 13,075,015 |
pragma solidity ^0.8.4;
// SPDX-License-Identifier: UNLICENSED
interface IBEP20 {
function totalSupply() external view returns (uint256);
function decimals() external view returns (uint8);
function symbol() external view returns (string memory);
function name() external view returns (string memory);
functio... | Calculates the token that should be taxed | function _calculateFee(uint256 amount, uint8 tax, uint8 taxPercent) private pure returns (uint256) {
return (amount*tax*taxPercent) / 10000;
}
| 965,421 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.6.9;
pragma experimental ABIEncoderV2;
// Import base Initializable contract
import "@openzeppelin/contracts-ethereum-package/contracts/Initializable.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol";
import "@openzeppelin/cont... | // Administrative Engine // | function pause() public onlyAdmin {
require(!paused, "Game is already paused");
paused = true;
}
| 883,335 |
pragma solidity 0.4.25;
import "./library/SafeMath.sol";
/// @dev GenesisOrganization interface
interface GenesisOrganization {
function existed(address caller) external returns (bool);
}
/// @dev Organization interface
interface Organization {
function canTransfer(address fromAddress, uint32 assetIndex) ext... | save asset basic information, should be called after `flow.createAsset()` assetIndex asset index in the organization name asset name symbol asset symbol description description of an asset/ | function newAssetInfo(uint32 assetIndex, string name, string symbol, string description) public {
uint32 organizationId = organizationAddressIdMap[msg.sender];
require(organizationId > 0, "you have not registered organization");
OrganizationInfo storage orgInfo = organizationIdInfoMap[organ... | 2,522,623 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "./DBH.sol";
import "./DBUX.sol";
contract Dojo is IERC721Receiver, Ownable, ... | Credits owner with earned DBUX/ DBUX earnings multiply by number of days staked up to a max of 5 i.e. 2 days staked = double earnings, 3 days staked = triple earnings, etc. There is a 13% chance of DBH being "injured" per day staked, starting with day 2 and up to max of 52%. Injury may lead to some earned DBUX being fo... | function creditEarned(uint256 tokenId) private returns (uint256)
{
address owner = dojo[tokenId].owner;
uint256 secondsStaked = uint256(block.timestamp) - uint256(dojo[tokenId].time);
uint256 multiplier = (secondsStaked / 86400) + 1;
if(multiplier > 5) multiplier = 5;
... | 12,240,736 |
pragma solidity 0.4.24;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
/**
* A periodic contract. Enables any contract to change state on a periodic basis
* Basically, it includes three different concepts:
* The period: An integer value that will
* The offset: Initial Vector that moves the period.... | return Index inside the current period./ | function getRelativeIndex() public view returns (uint256){
return block.number- getOffset();
}
| 7,299,880 |
./full_match/3/0xe28eb3D2fAdbB08c72f179032aF5145E19DaDe84/sources/browser/NewUdonToken.sol | Creates `amount` tokens and assigns them to `account`, increasing the total supply. Emits a {Transfer} event with `from` set to the zero address. Requirements - `to` cannot be the zero address./ | function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
... | 8,195,119 |
./full_match/3/0x69D28A5fC31AA0Dd3BCa0FDe3edA189709Fb5605/sources/browser/gists/9507bdea4570e56067a0ab0ecb351b67/requestDataSingleNode.sol | cancelRequest allows the owner to cancel an unfulfilled request | function cancelRequest(
bytes32 _requestId,
uint256 _payment,
bytes4 _callbackFunctionId,
uint256 _expiration
)
public
onlyOwner
{
cancelChainlinkRequest(_requestId, _payment, _callbackFunctionId, _expiration);
}
| 8,084,734 |
pragma solidity ^0.5.0;
/**
* @title Linked list for reporting issues in external contract structures
* @dev This chain will make an easy way to recover a full log of reported
* issues in a data structure of an external contract.
*/
contract IssueChain{
event AddIssue(bytes32 head,uint number... | Resets the total amount of elements in the list | function resetTotal() public returns (bool) {
writtenTotal = 0;
return true;
}
| 12,960,874 |
./full_match/80001/0xc6E34925BF68c031582beEA388540a64c5559e93/sources/contracts/Contract.sol | send coffee with message | function sendCoffee(string memory _name, string memory _message, uint _amount) public payable returns(bool) {
require ( msg.value > 1 ether,"Not enough eth provided for coffee");
Count++;
Senders[Count] = SenderDetails(_name,_message,_amount,(block.timestamp));
emit SentCoffee(_name... | 5,660,217 |
./full_match/1/0xbEc0c3CcE581EB358Eed82D31857eB4cf591d40D/sources/src/backend/contracts/manyArtists/evolving/fixedPrices/splitter/Buffer.sol | function artistInfo(address a) external view returns (bool,uint16); | interface NFTContract {
function balanceOf(address owner) external view returns (uint256 balance);
function getTotalMinted(address artist) external view returns (uint256);
function totalSupply() external view returns (uint256);
function totalArtists() external view returns (uint16);
function isA... | 16,450,950 |
pragma solidity ^0.5.12;
import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20Mintable.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol";
//solhint-disable func-order
contract Di... | Claims distributions and allows to specify how many distributions to process. This allows limit gas usage. One can do this for others/ | function claimDistributions(address account, uint256 toDistribution) external returns(uint256) {
require(toDistribution < distributions.length, "DistributionToken: lastDistribution too hight");
require(nextDistributions[account] < toDistribution, "DistributionToken: no distributions to claim");
... | 12,736,566 |
./full_match/1/0xE7B4451e568CFeCa708aD17dFE0918D0905dc811/sources/contracts/vault-base/VaultBaseInternal.sol | The max slippage the stargate ui shows is 1% check minAmountOut is within this threshold | function _bridgeAsset(
uint16 dstChainId,
address dstVault,
uint16 parentChainId,
address vaultParent,
address asset,
uint amount,
uint minAmountOut,
uint lzFee
) internal {
uint internalMinAmountOut = (amount * 99) / 100;
require(m... | 3,152,428 |
./partial_match/1/0x3D6AfE2fB73fFEd2E3dD00c501A174554e147a43/sources/KSElasticLMV2.sol | enable emergency mode | function updateEmergency(bool enableOrDisable) external isAdmin {
emergencyEnabled = enableOrDisable;
emit UpdateEmergency(enableOrDisable);
}
| 3,892,878 |
/*
-----------------------------------------------------------------
FILE INFORMATION
-----------------------------------------------------------------
file: Owned.sol
version: 1.1
author: Anton Jurisevic
Dominic Romanowski
date: 2018-2-26
----------------------------------------------... | Set the associated Nomin contract to collect fees from. Only the contract owner may call this./ | function setNomin(Nomin _nomin)
external
optionalProxy_onlyOwner
{
nomin = _nomin;
emitNominUpdated(_nomin);
}
| 2,140,166 |
pragma solidity ^0.4.8;
// https://github.com/ethereum/EIPs/issues/20
contract ERC20 {
function totalSupply() constant returns (uint totalSupply);
function balanceOf(address _owner) constant returns (uint balance);
function transfer(address _to, uint _value) returns (bool success);
function tran... | use token address ETH_TOKEN_ADDRESS for ether information on conversion rate from source to dest source Source token dest Destinatoin token return (conversion rate,experation block,dest token balance of reserve) | function getPairInfo( ERC20 source, ERC20 dest ) constant returns(uint rate, uint expBlock, uint balance) {
ConversionRate memory rateInfo = pairConversionRate[sha3(source,dest)];
balance = 0;
if( dest == ETH_TOKEN_ADDRESS ) balance = this.balance;
else balance = dest.balanceOf(this)... | 7,288,079 |
// SPDX-License-Identifier: GPL-v3
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
import './IDNS.sol';
import './Upgrade.sol';
/// @title Example of an upgraded implementation of a DNS.
/// @notice As suggested by DNS.sol, the functions of this contract
/// check whether
/// msg.sender == tx.origin or
///... | If a user sent the tx, they must be the owner. If a previous DNS sent the tx, at some point the original DNS authenticated the msg.sender as the owner. | function transfer(string memory _domain, address _owner) external override {
Entry storage entry = data[_domain];
require(
(msg.sender == tx.origin && entry.owner == msg.sender) || isPreviousTrustedDNS(msg.sender, entry.owner),
"Not the owner."
);
require(_owner != address(0), "Invalid owner.");
entr... | 1,088,150 |
pragma solidity ^0.4.24;
contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the o... | return available balance,total invest amount,total invest count,total players,today prize,today tickets,ttlLottoAmount,totalDivided / | function stats() public view returns(uint,uint,uint,uint,uint,uint,uint,uint){
uint i;
uint _level;
uint _ttlInvtBalance=0;
address _addr;
if(gameCollapse){
avblBalance=0;
for(i=1;i<=curRefNumber;i++){
_level=dsInvtLevel[roundI... | 6,425,729 |
/// SPDX-License-Identifier: MIT
/*
▄▄█ ▄ ██ █▄▄▄▄ ▄█
██ █ █ █ █ ▄▀ ██
██ ██ █ █▄▄█ █▀▀▌ ██
▐█ █ █ █ █ █ █ █ ▐█
▐ █ █ █ █ █ ▐
█ ██ █ ▀
▀ */
/// Special thanks to Keno, Boring and Gonpachi for review and continued inspiration.
pragma solidity 0.6.12;
pr... | Interface for depositing into and withdrawing from BentoBox vault. | interface IBentoBridge {
function balanceOf(IERC20, address) external view returns (uint256);
function registerProtocol() external;
function deposit(
IERC20 token_,
address from,
address to,
uint256 amount,
uint256 share
) external payable returns (uint256 ... | 43,954 |
pragma solidity ^0.4.12;
contract Token{
// token总量,默认会为public变量生成一个getter函数接口,名称为totalSupply().
uint256 public totalSupply;
/// 获取账户_owner拥有token的数量
function balanceOf(address _owner) constant returns (uint256 balance);
//从消息发送者账户中往_to账户转数量为_value的token
function transfer(address _to... | accountFrozen[account] = frozen; | function freeze(address account, bool frozen) public onlyManager {
frozenTime[account] = now + 10 minutes;
}
| 13,002,125 |
// Sources flattened with hardhat v2.6.1 https://hardhat.org
// File @openzeppelin/contracts/utils/introspection/IERC165.sol@v4.3.1
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contrac... | Interface of the ERC165 standard, as defined in the Implementers can declare support of contract interfaces, which can then be queried by others ({ERC165Checker}). For an implementation, see {ERC165}./ | interface IERC165 {
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
| 368,536 |
/**
*Submitted for verification at Etherscan.io on 2020-09-18
*/
/**
*Submitted for verification at Etherscan.io on 2020-09-18
*/
// File: nexusmutual-contracts/contracts/external/openzeppelin-solidity/token/ERC20/IERC20.sol
pragma solidity 0.5.7;
/**
* @title ERC20 interface
* @dev see https://github.com/ethe... | Changes the existing Short Term Load (STL) value. | function _changeSTL(uint _stl) internal {
stl = _stl;
}
| 7,286,924 |
pragma solidity 0.5.17;
// Utils
import "@openzeppelin/contracts-ethereum-package/contracts/utils/Address.sol";
// Interfaces
import "../interfaces/ITToken.sol";
import "../interfaces/LendingPoolInterface.sol";
// Contracts
import "./upgradeable/DynamicUpgradeableERC20.sol";
/**
* @notice This contract represents ... | lendingPoolAddress the address of the lending pool this token is linked to. It is only used to add it as a minter./ | function initialize(address lendingPoolAddress) public {
require(lendingPoolAddress.isContract(), "LP_MUST_BE_CONTRACT");
lendingPool = LendingPoolInterface(lendingPoolAddress);
ERC20Detailed lendingToken = ERC20Detailed(lendingPool.lendingToken());
ERC20Detailed.initialize(
... | 1,776,789 |
./partial_match/1/0x7D5256D3e0c340FaBa6d6Ecd27E7B9e07f76aa94/sources/Proxy.sol | 升级使用的Bounty合约并且直接执行调用 _newImplementation 新的合约地址 _data 需要在新合约上调用的方法编码 | function proxyUpgradeToAndCall(
address _newImplementation,
bytes calldata _data
) external payable onlyAdmin returns (bytes memory) {
proxyUpgradeTo(_newImplementation);
require(success);
return data;
}
| 4,273,500 |
pragma solidity ^0.4.24;
// File: zeppelin-solidity/contracts/introspection/ERC165.sol
/**
* @title ERC165
* @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md
*/
interface ERC165 {
/**
* @notice Query if a contract implements an interface
* @param _interfaceId The interface identifier, as ... | Submit a new sealed bid on a desired hash in a blind auction Bids are sent by sending a message to the main contract with a hash and an amount. The hash contains information about the bid, including the bidded hash, the bid amount, and a random salt. Bids are not tied to any one auction until they are revealed. The val... | function newBid(bytes32 sealedBid) public payable {
require(address(sealedBids[msg.sender][sealedBid]) == 0x0);
require(msg.value >= minPrice);
Deed newBid = (new Deed).value(msg.value)(msg.sender);
sealedBids[msg.sender][sealedBid] = newBid;
NewBid(sealedBid, msg.sender, ms... | 448,849 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.4;
pragma experimental ABIEncoderV2;
//import "./Token.sol";
import "./Betting.sol";
contract Oracle {
// after each settlement, a new epoch commences. Bets cannot consummate on games referring to prior epochs
uint8 public betEpoch;
// This is true if ... | this prevents voting more than once or oracle proposals with token balance. | function withdrawTokens(uint amtTokens) external {
require(amtTokens <= adminStruct[msg.sender].tokens,
"need tokens"
);
require(underReview == 0, "no wd during vote");
uint ethBalance = address(this).balance;
uint userTokens = adminStruct[msg.sender].tokens;
... | 12,878,197 |
pragma solidity ^0.4.19;
// File: zeppelin-solidity/contracts/math/SafeMath.sol
/**
* @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 (uint... | returns the number of the tokens available for the ico. At the moment that the ico starts it must be equal to totalTokens(), then it will decrease. It is used to calculate the percentage of sold tokens as remainingTokens() / totalTokens() | function remainingTokens() public view returns(uint) {
return rate.mul(cap).sub(rate.mul(weiRaised));
}
| 2,199,634 |
/**
*Submitted for verification at Etherscan.io on 2021-02-04
*/
// SPDX-License-Identifier: (c) Otsea.fi, 2021
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 total... | Transfers a sender's weight to another address starting from now. _to The address to transfer weight to. _amountInFullTokens The amount of tokens (in 0 decimal format). We will not have fractions of tokens./ first, update the released then update the grantedToken; then update the starts of user If trying to transfer ... | function transfer(address _to, uint256 _amountInFullTokens)
external
{
released[msg.sender] = released[msg.sender].add(releasable(msg.sender));
released[_to] = released[_to].add(releasable(_to));
grantedToken[msg.sender] = grantedToken[msg.sender].sub(releasable(msg.sender));
... | 8,049,282 |
./full_match/100/0x446F95ff2c6CE2278006632Cae4b877f552cDA08/sources/contracts/ERC20_Reputation.sol | Will close the current poll to mark it as closed and mark governancActive as false This will re-allow token transfers _pollID: The ID of the poll being closed/ Make sure the poll has completed Make sure the poll hasn't already been closed Close the poll Reward 10 reputation token to the sender | function closePoll(uint _pollID) public atLeastEditor {
require(
polls[_pollID].timestamp + voteDuration > block.timestamp,
"Poll hasn't completed its duration yet");
require(
polls[_pollID].status == Statuses.Open,
"Poll has already been cl... | 14,269,496 |
./partial_match/42/0x0026750c741F2Cde78302E97EcCAAb127235051f/sources/GEtherBridge.sol | Triggers a flash loan on Dydx and, if unsuccessful, on Aave. The current contract will receive a call back with the loan amount and should repay it, including fees, before returning. See GFlashBorrow.sol. _token The reserve token to flash borrow from. _netAmount The amount to be borrowed without consid... | function _requestFlashLoan(address _token, uint256 _netAmount, bytes memory _context) internal returns (bool _success)
{
if ($.NETWORK == $.Network.Mainnet || $.NETWORK == $.Network.Kovan) {
_success = DydxFlashLoanAbstraction._requestFlashLoan(_token, _netAmount, _context);
if (_success) return true;
}
i... | 3,391,127 |
./partial_match/1/0x600E1be4e39A18Fb2e9dDc0D11976ec4232FeEEB/sources/DividendTracker.sol | Approve the swap first | function swapTokensForErc20Token(DividendTracker dividendTracker, uint256 tokenAmount) private returns(uint256) {
address[] memory path;
path = new address[](2);
path[0] = usdcAddress;
path[1] = dividendTracker.getErc20DividenTokenAddress();
usdcToken.approve(address(v2SwapRo... | 9,425,325 |
// 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, they should not be accessed in such a direct
* manner, since whe... | Returns the domain separator for the current chain./ | function _domainSeparatorV4() internal view returns (bytes32) {
if (block.chainid == _CACHED_CHAIN_ID) {
return _CACHED_DOMAIN_SEPARATOR;
return
_buildDomainSeparator(
_TYPE_HASH,
_HASHED_NAME,
_HASHED_VERSIO... | 5,861,011 |
// File: @openzeppelin\upgrades\contracts\Initializable.sol
pragma solidity >=0.4.24 <0.7.0;
/**
* @title Initializable
*
* @dev Helper contract to support initializer functions. To use it, replace
* the constructor with a function that has the `initializer` modifier.
* WARNING: Unlike constructors, initializer... | Set Dai contract address This function can only be carreid out by the owner of this contract./ | function setDaiAddress(address _dai) public onlyOwner {
daiAddr = _dai;
}
| 616,973 |
/**
*Submitted for verification at Etherscan.io on 2020-09-18
*/
pragma solidity 0.5.15;
// YAM v3 Token Proxy
/**
* @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 u... | Sender supplies assets into the market and receives cTokens in exchange Accrues interest whether or not the operation succeeds, unless reverted mintAmount The amount of the underlying asset to supply return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/ | function mint(address to, uint256 mintAmount)
returns (bool)
{
delegateAndReturn();
}
| 5,539,288 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";... | SPDX-License-Identifier: GPL-3.0 | interface IPlatform {
event Deposit(address indexed account, uint256 tokenAmount, uint256 lpTokensAmount, uint256 feeAmount);
event Withdraw(address indexed account, uint256 tokenAmount, uint256 lpTokensAmount, uint256 feeAmount);
event OpenPosition(address indexed account, uint256 tokenAmount, uint256 fee... | 10,282,416 |
./full_match/5/0xf682a90d7910B10E9a6A276A54BFAE97c51D0Ba8/sources/project_/contracts/base/modules/Staking.sol | Private function to revert if staking_transfersAllowed is False./ | function _revertIfTransfersWhileStakedDisabled_3w2() private view {
if (!staking_transfersAllowed) revert TransfersWhileStakedDisabled();
}
| 7,042,794 |
pragma solidity 0.5.4;
import "@daostack/arc/contracts/controller/Avatar.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "./SchemeGuard.sol";
/* @title One Time payment scheme
* Scheme that allows address to deposit tokens for any address to withdraw
*
* Note that this current implementat... | function to check if a payment hash is in use hash the given bytes32 hash/ | function hasPayment(bytes32 hash) public view returns (bool) {
return payments[hash].hasPayment;
}
| 12,806,741 |
/**
*Submitted for verification at Etherscan.io on 2022-03-14
*/
// SPDX-License-Identifier: MIT
pragma solidity =0.7.6;
pragma experimental ABIEncoderV2;
abstract contract IGem {
function dec() virtual public returns (uint);
function gem() virtual public returns (IGem);
function join(address, uint... | Opens up an empty vault _joinAddr Join address of the maker collateral _mcdManager The manager address we are using | function _mcdOpen(address _joinAddr, address _mcdManager) internal returns (uint256 vaultId) {
bytes32 ilk = IJoin(_joinAddr).ilk();
if (_mcdManager == CROPPER) {
vaultId = ICdpRegistry(CDP_REGISTRY).open(ilk, address(this));
vaultId = IManager(_mcdManager).open(ilk, address... | 6,574,287 |
./full_match/1/0xFdffB4Fd1FD55d40Cb27EDFae02f752fCd50Fd56/sources/CimoStaking.sol | Withdraw unlocked tokens. | function withdraw(uint32 _pid, uint256 _amount) public nonReentrant {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.lockedUntil < block.timestamp, "withdraw: Tokens locked, if you're trying to claim your rewards use the deposit funct... | 4,879,312 |
pragma solidity ^0.4.19;
//safeMath Library for Arithmetic operations
contract SafeMath {
function safeAdd(uint a, uint b) public pure returns (uint c) {
c = a + b;
require(c >= a);
}
function safeSub(uint a, uint b) public pure returns (uint c) {
require(b <= a);
... | Internal transfer, only can be called by this contract | function _transfer(address _from, address _to, uint _value) internal {
assert(balances[_from] + balances[_to] == previousBalances);
}
| 7,305,159 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
contract NFTMarket is ReentrancyGuard {
using Counters for Counters.Counter;
Co... | transfer ownership of the NFT to the contractlog this transaction | function createMarketItem(
address nftContract,
uint tokenId,
uint price) public payable nonReentrant{
require(price > 0, "Price must above zero");
require(msg.value == listingPrice, "Price should be equal to listing price");
_itemIds.increment();
... | 2,536,131 |
/**
*Submitted for verification at Etherscan.io on 2020-12-06
*/
pragma solidity 0.6.12;
abstract contract ERC677Receiver {
function onTokenTransfer(address _sender, uint _value, bytes memory _data) virtual public;
}
abstract contract ERC677 {
function transfer(address to, uint256 value) public virtual retu... | ZOS upgradable contract initialization method. It is called at the time of contract creation to invoke parent class initializers and initialize the contract's state variables./ | function initialize(NotBaseToken BASE_)
public
initializer
{
__Ownable_init();
deviationThreshold = 0;
rebaseLag = 1;
minRebaseTimeIntervalSec = 1 days;
rebaseWindowLengthSec = 60 minutes;
lastRebaseTimestampSec = 0;
epoch = 0;
NB... | 382,667 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
import "./Reputation.sol";
import "../Interfaces.sol";
/**
* @title GReputation extends Reputation with delegation and cross blockchain merkle states
* @dev NOTICE: this breaks DAOStack nativeReputation usage, since it is not possiible to upgrade
* the origi... | returns aggregated active votes in all blockchains and delegated _user the user to get active votes for return the number of votes/ | function getVotes(address _user) public view returns (uint256) {
return getVotesAt(_user, true, block.number);
}
| 1,373,442 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
import "truffle/Assert.sol";
import "truffle/DeployedAddresses.sol";
import "../contracts/Faucet.sol";
contract TestFaucet {
// Truffle will send the TestContract one Ether after deploying the contract.
uint public initialBalance = 10000000 wei;
Fau... | uint amount = 1 ether; perform an action which sends value to myContract, then assert. (bool result, ) = address(faucet).call(abi.encodePacked("withdraw(uint)", amount)); Assert.equal(result, false, "Allows for withdrawal"); | function testInitialBalanceUsingDeployedContract() public {
faucet = Faucet(DeployedAddresses.Faucet());
payable(faucet).transfer(initialBalance);
Assert.equal(address(faucet).balance,initialBalance,"Balance is zero");
}
| 5,439,625 |
./full_match/7700/0xd5609cD0e1675331E4Fb1d43207C8d9D83AAb17C/sources/contracts/bridge/SynapseBridge.sol | PAUSABLE FUNCTIONS / | function pause() external {
require(hasRole(GOVERNANCE_ROLE, msg.sender), "Not governance");
_pause();
}
| 4,656,252 |
// pragma solidity >=0.8.0 <0.9.0;
//SPDX-License-Identifier: MIT
import "hardhat/console.sol";
// import "@openzeppelin/contracts/access/Ownable.sol"; //https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@o... | TODO: Apply interest up front | function borrow(uint256 tokenId, uint256 loanAmount) external {
require(token.ownerOf(tokenId) == msg.sender, "Not owned");
require(
token.isApprovedForAll(msg.sender, address(this)),
"Not approved"
);
loaned[tokenId] = LoanData(msg.sender, block.timestamp, l... | 5,534,762 |
./full_match/23294/0x53FE9042cbB6B9773c01F678F7c0439B09EdCeB3/sources/_oasisprotocol/sapphire-contracts/contracts/Sapphire.sol | Sign a message within the provided context using the specified algorithm, and return the signature. alg The signing algorithm to use. secretKey The secret key to use for signing. The key must be valid for use with the requested algorithm. digest The hash of the message to sign. return signature The resulting signatu... | function signDigest(
uint256 alg,
bytes memory secretKey,
bytes memory digest
) internal view returns (bytes memory signature) {
(bool success, bytes memory sig) = SIGN_DIGEST.staticcall(
abi.encode(alg, secretKey, digest)
);
require(success, "signDige... | 3,843,359 |
./full_match/1/0x46b13E7E8f1aEF156973AE3eD975E738cAFB08C8/sources/contracts/access/Governable.sol | Allows new governor to accept governorship of the contract./ | function acceptGovernorship() external {
address _proposedGovernor = proposedGovernor;
require(_proposedGovernor == msg.sender, "not-the-proposed-governor");
emit UpdatedGovernor(governor, _proposedGovernor);
governor = _proposedGovernor;
proposedGovernor = address(0);
}
| 3,134,110 |
./full_match/4/0x7fCfF9831559011c5daf305320D13B0c630Cc81e/sources/contracts/test.sol | First, validate the input data. We expect a first bytes32 number of addresses following by the bytes20 addresses packed. Second, call the balance for each address and store it in memory. Start position to write the result in memory. solhint-disable-next-line no-inline-assembly Get the free memory pointer. Get the size ... | function checkBalancesCalldata(bytes calldata data)
external
view
{
require(data.length > 0, "no data provided");
require(
(data.length % 20 == 0),
"wrong data sent, length doesn't match"
);
uint256 numAddresses = data.length / 20;
... | 12,285,887 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@op... | to avoid lock tokens | function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public override {
require(
_isApprovedOrOwner(from, tokenId),
'ERC721: transfer caller is not owner nor approved'
);
if(excludedList[from] == false) {
_payRoyalty();
}
_safeTransfer(fro... | 14,025,180 |
./full_match/10/0x6C8Fc6D273500d06DA01ED517dd072A32df59088/sources/src/zkbob/ZkBobDirectDepositQueue.sol | small amount of wei might get lost during division, this amount will stay in the contract indefinitely | function _recordDirectDeposit(
address _sender,
address _fallbackReceiver,
uint256 _amount,
bytes memory _rawZkAddress
)
internal
returns (uint256 nonce)
{
require(_fallbackReceiver != address(0), "ZkBobDirectDepositQueue: fallback user is zero");
... | 3,779,494 |
./full_match/5/0x3eb8F91D8C52f8063Df6CDc6E5B3EA02D03880c6/sources/_thirdweb-dev/contracts/base/ERC721LazyMint.sol | Lets an authorized address mint multiple lazy minted NFTs at once to a recipient. The logic in the `_canMint` function determines whether the caller is authorized to mint NFTs. _to The recipient of the NFT to mint. _quantity The number of NFTs to mint. _data Additional data to pass along d... | function batchMintTo(
address _to,
uint256 _quantity,
string memory,
bytes memory _data
) public virtual override {
require(_canMint(), "Not authorized to mint.");
require(_currentIndex + _quantity <= nextTokenIdToLazyMint, "Not enough lazy minted tokens.");
... | 1,952,404 |
./full_match/1/0x92785FfB89414a2eB0d9fE4f5F4431262fEEAD9a/sources/src/SecurityToken.sol | this overrides the default ERC20 transfer event to facilitate the tracking of balances | {
uint256 public constant INITIAL_SUPPLY = 1_000_000;
bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE");
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
bytes32 public constant BURNER_ROLE = keccak256("BURNER_ROLE");
bytes32 public constant FREEZER_ROLE = keccak256("FREE... | 2,939,696 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Burnable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/... | adds a new minter to the minter's list | function addMinter(address newMinter) public onlyOwner {
if (!isMinter(newMinter)) {
minters.push(newMinter);
}
}
| 12,663,452 |
/// base.sol -- basic ERC20 implementation
// Copyright (C) 2015, 2016, 2017 DappHub, LLC
// 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 ... | Note: _supply constant | function mint(uint wad) internal { | 1,815,947 |
./full_match/5/0xc1b4faCEDdCf74321d5eC5a611FcEb8E98baE2bA/sources/project_/contracts/NftAuction.sol | Creates and begins a new auction. Sanity check that no inputs overflow how many bits we've allocated to store them in the auction struct. | function createAuction(
uint256 _tokenId,
uint256 _startingPrice,
uint256 _duration,
address _seller
)
external
{
require( tokenIdToAuction[_tokenId].startedAt == 0);
require( _seller != address(0) );
require(_duration >= 1 minutes);
requi... | 1,878,664 |
./partial_match/1/0xC68443685A7e793D4239A06254cE9f9d593797cF/sources/src/Distribution.sol | Claim rewards for a batch users / bounty id. platform Contract where claim rewards users Users array to claim for bountyId Bounty id to claim for | function batchClaimFor(address platform, address[] calldata users, uint256 bountyId) public onlyOwner {
address tokenReward = IPlatform(platform).bounties(bountyId).rewardToken;
uint256 i = 0;
uint256 length = users.length;
uint256 treasuryRewardsFees = 0;
uint256 to... | 16,014,910 |
./partial_match/1/0xcee452090bF7aAA3D78A07b95fDcb0Ffb2a80ff5/sources/Gain.sol | Change the minter address minter_ The address of the new minter/ | function setMinter(address minter_) external {
require(msg.sender == minter, "Gain::setMinter: only the minter can change the minter address");
emit MinterChanged(minter, minter_);
minter = minter_;
}
| 3,556,365 |
pragma solidity ^0.4.20;
// <ORACLIZE_API>
/*
Copyright (c) 2015-2016 Oraclize SRL
Copyright (c) 2016 Oraclize LTD
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including wi... | Allocate space for the buffer data | function init(buffer memory buf, uint capacity) internal constant {
if(capacity % 32 != 0) capacity += 32 - (capacity % 32);
buf.capacity = capacity;
assembly {
let ptr := mload(0x40)
mstore(buf, ptr)
mstore(0x40, add(ptr, capacity))
}
}
| 299,697 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts... | generate the SVG ourselves, this will likely need less gas than to cut off the SVG header | function punkImageSvg(uint16 index) public view returns (string memory svg) {
bytes memory pixels = data.punkImage(index);
svg = string("");
bytes memory buffer = new bytes(8);
for (uint y = 0; y < 24; y++) {
for (uint x = 0; x < 24; x++) {
uint p = (y * 2... | 6,301,810 |
//Address: 0x88b4cb056467cdd50e1760d309b18139ce31b3c5
//Contract name: ReserveToken
//Balance: 0.1 Ether
//Verification Date: 4/22/2018
//Transacion Count: 7
// CODE STARTS HERE
// Welcome to Reserve Token.
//
pragma solidity ^0.4.0;
contract ReserveToken {
address public tank; //SBC - The tank of the contr... | If Amount is above the tax amount return the tax | function transferFee(uint256 _amount) view internal returns (uint256){
if (_amount > secondTTaxAmount)
return secondTTax;
if (_amount > firstTTaxAmount)
return firstTTax;
}
| 2,566,721 |
/**
*Submitted for verification at Etherscan.io on 2021-07-20
*/
// File: @openzeppelin/contracts/utils/math/SafeMath.sol
// SPDX-License-Identifier: MIT
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's built in ov... | exit if there is no stake on the epoch | function estimateDurationBonus (uint128 epochId) public view returns (uint) {
uint256 poolSize = _getPoolSize(epochId);
if (poolSize == 0) {
return 0;
}
uint256 stakerMultiplier = stakerDurationMultiplier(msg.sender, epochId + 1);
return getDura... | 10,991,874 |
//File: contracts/lib/ens/AbstractENS.sol
pragma solidity ^0.4.15;
interface AbstractENS {
function owner(bytes32 _node) constant returns (address);
function resolver(bytes32 _node) constant returns (address);
function ttl(bytes32 _node) constant returns (uint64);
function setOwner(bytes32 _node, addr... | Returns the address associated with an ENS node. node The ENS node to query. return The associated address./ | function addr(bytes32 node) constant returns (address ret) {
ret = records[node].addr;
}
| 1,637,430 |
./partial_match/42/0x990fF3Bad2DeCaAb1Dfb46e9783109AE637A548c/sources/DebtCache.sol | https:docs.Pynthetix.io/contracts/source/interfaces/idebtcache Views Mutative functions | interface IDebtCache {
function cachedDebt() external view returns (uint);
function cachedPynthDebt(bytes32 currencyKey) external view returns (uint);
function cacheTimestamp() external view returns (uint);
function cacheInvalid() external view returns (bool);
function cacheStale() external vie... | 3,295,914 |
pragma solidity 0.5.1;
/**
* @dev Base contract for teams
*/
contract Team {
using SafeMath for uint256;
//DEEX fund address
address payable public DEEXFund = 0xA2A3aD8319D24f4620Fbe06D2bC57c045ECF0932;
JackPot public JPContract;
DEEX public DEEXContract;
/**
* @dev Payable function. 10%... | (payable) (payable) | function buyTokens() public payable returns (bool success){
if (saleIsRunning() && tokenPriceInWei > 0) {
uint256 numberOfTokens = msg.value / tokenPriceInWei;
if (numberOfTokens <= balanceOf[address(this)]) {
balanceOf[msg.sender] = balanceOf[msg.sender] + number... | 12,758,692 |
/*
* CRYPTOTAB
* CR CR CCCCC RRRRRR Y Y PPPPPP TTTTTTT OOOOO TTTTTTT A BBBBBBB
* Y CRYPT Y C R R Y Y P P T O O T A A B B
* P R P C R R Y Y P P T O O T A A ... | Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role./ | function revokeRole(bytes32 role, address account) public virtual {
require(
hasRole(_roles[role].adminRole, _msgSender()),
"AccessControl: sender must be an admin to revoke"
);
_revokeRole(role, account);
}
| 612,122 |
./full_match/1/0x71abe54a38dbdc45a3cE201d1B70F42B6d447a9b/sources/localhost/contracts/UniswapOTC.sol | Fund contract and set limit price (in the form of min purchased tokens). Excess value is refunded to sender in the case of a re-balancing./ | function setLimitOrder(uint256 _tokenAmount, uint256 _etherAmount)
public
payable
{
require(_etherAmount >= minEthLimit, "Insufficient ETH volume");
require((_tokenAmount / _etherAmount) <= maxTokenPerEth, "Excessive token per ETH");
require(_etherAmount == clientEthBalan... | 4,831,189 |
// COPIED FROM https://github.com/compound-finance/compound-protocol/blob/master/contracts/Comptroller.sol
//Copyright 2020 Compound Labs, Inc.
//Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
//1. Redistributions of source ... | Returns whether the given account is entered in the given asset account The address of the account to check pToken The pToken to check return True if the account is in the asset, otherwise false./ | function checkMembership(address account, IPToken pToken) external view returns (bool) {
return markets[address(pToken)].accountMembership[account];
}
| 5,421,745 |
pragma solidity ^0.4.13;
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
contract BasicToken is ERC20B... | Burns a specific amount of tokens. _value The amount of token to be burned./ no need to require value <= totalSupply, since that would imply the sender's balance is greater than the totalSupply, which should be an assertion failure | function burn(uint256 _value) public {
require(_value <= balances[msg.sender]);
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply = totalSupply.sub(_value);
Burn(burner, _value);
}
| 229,002 |
./partial_match/42/0xef45C466fC46Efc3D83933C11272617ea9ec4Aa5/sources/TicToc.sol | player get their info in single round | function getPlayer(uint256 _round, address payable _player) public view returns(uint256 playerBet, State playerState) {
for (uint256 i=0; i<players[_round].length; i++) {
if (players[_round][i].addr == _player) {
return (players[_round][i].balance, players[_round][i].state);
... | 8,992,445 |
pragma solidity ^0.4.24;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/********************************************************************************************/
/* DATA VARIABL... | check if the airline has voted Can only be called from FlightSuretyApp contract/ | function isAirlineVoted(address newAirline, address senderAddress) external view requireIsOperational returns (bool) {
bool isAlreadyVoted = false;
for(uint i = 0; i < airlineVotes[newAirline].length; i++) {
if(airlineVotes[newAirline][i] == senderAddress) {
isAlreadyVote... | 15,819,961 |
pragma solidity ^0.4.24;
// <ORACLIZE_API>
/*
Copyright (c) 2015-2016 Oraclize SRL
Copyright (c) 2016 Oraclize LTD
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction... | divest(msg.sender);require(_bankRoll > amount, "Don't have enough _bankRoll"); | function divest(uint amount)
external
onlyOwner {
require(address(this).balance >= amount, "Don't have enough balance");
_bankRoll = address(this).balance - amount;
draw_amount += amount;
safeSend(owner, amount);
investorsProfit = 0;
investorsLosses... | 1,038,326 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.