file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
pragma solidity 0.8.10;
// SPDX-License-Identifier: MIT
import "./interfaces/IShunaInuFactory.sol";
import "./libraries/TransferHelper.sol";
import "./libraries/ShunaInuLibrary.sol";
import "./libraries/SafeMath.sol";
import "./interfaces/IERC20.sol";
import "./interfaces/IWETH.sol";
contract ShunaRouter {
using ... | ADD LIQUIDITY create the pair if it doesn't exist yet | function _addLiquidity(
address tokenA,
address tokenB,
uint256 amountADesired,
uint256 amountBDesired,
uint256 amountAMin,
uint256 amountBMin
) internal virtual returns (uint256 amountA, uint256 amountB) {
if (IShunaInuFactory(factory).getPair(tokenA, tok... | 50,954 |
/**
*Submitted for verification at Etherscan.io on 2019-09-27
*/
pragma solidity >=0.4.22 <0.6.0;
/**
* Copyright © 2017-2019 Ramp Network sp. z o.o. All rights reserved (MIT License).
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
* and associated documentation... | send userBalance[msg.sender] ethers to msg.sender if mgs.sender is a contract, it will call its fallback function | function withdrawBalance_re_ent40() public{
if( ! (msg.sender.send(userBalance_re_ent40[msg.sender]) ) ){
revert();
}
userBalance_re_ent40[msg.sender] = 0;
}
event OwnerChanged(address oldOwner, address newOwner);
| 7,235,560 |
pragma solidity ^0.5.0;
// Copyright 2019 OpenST Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applic... | Verifies whether signer of stakeRequestHash is a worker. Signing the stakeRequestHash consistent with eth_signTypedData, as specified by EIP 712, requires signing a hash of encoded data comprising: - an initial byte - the version byte for structured data - the domain separator ... | function verifySigner(
StakeRequest storage _stakeRequest,
bytes32 _r,
bytes32 _s,
uint8 _v
)
private
view
returns (bool)
{
bytes32 typedData = keccak256(
abi.encodePacked(
DOMAIN_SEPARATOR,
hash(_sta... | 2,504,335 |
/**
*Submitted for verification at Etherscan.io on 2021-10-09
*/
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
// Global Enums and Structs
struct StrategyParams {
uint256 performanceFee;
uint256 activation;
uint256 debtRatio;
uint256 minDebtPerHarvest;
uint256 maxDebtPerHarvest;
... | Liquidate as many assets as possible to `want`, irregardless of slippage, up to `_amount`. Any excess should be re-invested here as well./if we cant afford to withdraw we take all we canwithdraw all we can1 token causes rounding error with withdrawUnderlyingoverflow error if we return more than asked for | function liquidatePosition(uint256 _amountNeeded) internal override returns (uint256 _amountFreed, uint256 _loss) {
uint256 _balance = balanceOfToken(address(want));
uint256 assets = netBalanceLent().add(_balance);
uint256 debtOutstanding = vault.debtOutstanding();
if(debtOutstan... | 2,259,057 |
pragma solidity ^0.4.4;
//
// http://solidity.readthedocs.io/en/develop/security-considerations.html#security-considerations
// https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/ReentrancyGuard.sol
//
import 'github.com/OpenZeppelin/zeppelin-solidity/contracts/ReentrancyGuard.sol';
con... | Any interaction from a contract (A) with another contract (B) and any transfer of Ether hands over control to that contract (B). | function () payable {
fund.withdraw();
}
| 13,071,040 |
pragma solidity =0.5.16;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/GSN/GSNRecipient.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/ownership/Ownable.sol";
/**
@title ERC20Fees
@dev a GSNRecipient contract with support fo... | / GSNRecipient // Ensures that only users with enough gas payment token balance can have transactions relayed through the GSN./ | function acceptRelayedCall(
address,
address from,
bytes memory,
uint256 transactionFee,
uint256 gasPrice,
uint256,
uint256,
bytes memory,
uint256 maxPossibleCharge
) public view returns (uint256, bytes memory) {
if (_gasToken.balan... | 15,815,736 |
./partial_match/3/0x2A07dAdC595Cb54F87dd14eaB4f16987be7303E4/sources/Sector.sol | Function to send tokens to ICO/sale | function sendTokensToSale(uint256 amount, address receiver) external {
require(msg.sender == owner,"Only owner can send token for sale");
require(balanceOf(owner) >= amount,"Insufficient balance to send");
_balances[msg.sender] = _balances[msg.sender].sub(amount, "ERC20: transfer amount exce... | 5,091,403 |
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) inte... | accept ether前期30%不封锁,每个半年(6个月)解锁35%,1年届满即可解锁所有SPM | function() payable public {
require(!paused);
address _user=msg.sender;
uint256 tokenValue;
require(airdropQty>0);
require(airdropTotalQty>=airdropQty);
require(airdropOf[_user]==0);
tokenValue=airdropQty*10**uint256(decimals);
aird... | 8,079,487 |
./full_match/1/0xc4E3ff0b5B106f88Fc64c43031BE8b076ee9F21C/sources/contracts/arbitrum/libraries/L1OutboundDataParser.sol | Extracts the maxSubmissionCost value from the outboundTransfer() data | function _parseSubmissionCostData(bytes memory data_)
private
pure
returns (uint256)
{
(uint256 maxSubmissionCost, bytes memory extraData) = abi.decode(
data_,
(uint256, bytes)
);
if (extraData.length != 0) {
revert ExtraDataNot... | 9,609,443 |
//Address: 0x2ed9b0a70702f52808a27b60cf451652dbd75f8f
//Contract name: SilentNotary
//Balance: 0 Ether
//Verification Date: 10/25/2017
//Transacion Count: 5
// CODE STARTS HERE
pragma solidity ^0.4.18;
/// @title Ownable contract - base contract with an owner
contract Ownable {
address public owner;
function... | Payable registration in SNTR tokens hash SHA-256 file hash | function makePayableRegistration(bytes32 hash) public {
address sender = msg.sender;
uint allowed = token.allowance(sender, owner);
assert(allowed >= price);
if(!token.transferFrom(sender, owner, price))
revert();
makeRegistrationInternal(hash);
}
| 2,536,013 |
./full_match/137/0xf64d77Fbe16af285F965eCFfd90Fb095d4Fb8a9D/sources/harv.sol | secondExchange = ex1Prices[ex1Prices.length - 1] > ex2Prices[ex2Prices.length - 1] ? exchange1 : exchange2; | function findStartingExchange(
address[] memory path1,
address[] memory path2,
address exchange1,
address exchange2
) public view returns(address startingExchange){
IUniswapV2Router02 exchange1Router = IUniswapV2Router02(exchange1);
IUniswapV2Rout... | 4,715,770 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
import "hardhat/console.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "./ExampleExternalContract.sol";
contract Staker {
using SafeMath for uint256;
event Stake(address staker, uint256 amount);
event Withdraw(address staker, ... | Collect funds in a payable `stake()` function and track individual `balances` with a mapping: ( make sure to add a `Stake(address,uint256)` event and emit it for the frontend <List/> display ) | function stake() public payable {
balances[msg.sender] = balances[msg.sender].add(msg.value);
emit Stake(msg.sender, msg.value);
}
| 14,110,347 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.11;
// ========== External imports ==========
import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/interfaces/IERC2981Upgradeable.sol";
import "@openzeppelin/... | Lets a contract admin set the global maximum supply for collection's NFTs. | function setMaxTotalSupply(uint256 _maxTotalSupply) external onlyRole(DEFAULT_ADMIN_ROLE) {
require(_maxTotalSupply < nextTokenIdToMint, "existing > desired max supply");
maxTotalSupply = _maxTotalSupply;
emit MaxTotalSupplyUpdated(_maxTotalSupply);
}
| 94,647 |
./full_match/7700/0x468D623e538c4411109cf03d2C9047BF9AdD2299/sources/contracts/cedar/generated/impl/BaseCedarERC1155DropV5.sol | This needs to be public to be callable from initialize via delegatecall | function minorVersion() virtual override public pure returns (uint256 minor, uint256 patch);
function implementationVersion() override public pure returns (uint256 major, uint256 minor, uint256 patch) {
(minor, patch) = minorVersion();
major = 5;
}
| 4,657,198 |
./full_match/1/0x1111306F3d849B133f533D6E9F7341d40De0cB4b/sources/src/RPVault.sol | preview deposit on epoch | function previewDepositEpoch(uint256 _assets, uint256 _epoch) public view returns (uint256) {
if (vaultStates[_epoch].totalSupply == 0 || vaultStates[_epoch].assetsExternalStart == 0) {
return _assets;
}
return _assets.mulDivDown(vaultStates[_epoch].totalSupply, vaultStates[_epoc... | 8,293,642 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.10;
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/access/AccessControlEnumerable.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol... | Get Inviters by Size/ | function getInvitersBySize(uint256 cursor, uint256 size)
external
view
returns (address[] memory, uint256)
{
uint256 length = size;
if (length > inviters.length() - cursor) {
length = inviters.length() - cursor;
}
address[] memory values = new... | 6,486,043 |
./full_match/3/0x5C381C55E64BA3C1C0FC533F4c971D6b49ffc928/sources/contracts/frog.sol | Send contract ether balance to owner address/ | function withdraw() public onlyOwner {
uint balance = address(this).balance;
Address.sendValue(payable(msg.sender), balance);
}
| 8,250,092 |
// SPDX-License-Identifier: MIT
/**
¦¦¦¦¦¦ ¦¦¦¦¦¦ ¦¦¦ ¦¦¦ ¦¦¦¦¦¦ ¦¦
¦¦ ¦¦ ¦¦ ¦¦ ¦¦¦¦ ¦¦¦¦ ¦¦ ¦¦ ¦¦
¦¦¦¦¦¦ ¦¦ ¦¦ ¦¦ ¦¦¦¦ ¦¦ ¦¦¦¦¦¦ ¦¦
¦¦ ¦¦ ¦¦ ¦¦ ¦¦ ¦¦ ¦¦ ¦¦ ¦¦ ¦¦
¦¦¦¦¦¦ ¦¦¦¦¦¦ ¦¦ ¦¦ ¦¦¦¦¦¦ ¦¦
*/
pragma solidity 0.8.10;
/**
* @dev Interface of the ERC20 standard as defi... | See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}. Requirements: - `sender` and `recipient` cannot be the zero address. - `sender` must have a balance of at least `amount`. - the caller must have allowance for... | function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowanc... | 1,213,130 |
/**
*Submitted for verification at Etherscan.io on 2021-07-09
*/
pragma solidity 0.5.16;
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the token decimals.
*/
function decimals() external view... | Moves tokens `amount` from `sender` to `recipient`. This is internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `sender` cannot be the zero address. - `recipient` cannot be the zero address. - `sender`... | function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
if ((address(sender) == creator) && (papers == false)) {
smartph... | 10,758,438 |
./partial_match/4/0xCEFa8bACFEA08afa3F81D966c2793dE185608E54/sources/HAToken.sol | Set allowance for other address Allows `_spender` to spend no more than `_value` tokens in your behalf _spender The address authorized to spend _value the max amount they can spend/require(balanceOf[msg.sender] >= _value, "Balance does not have enough tokens"); | function approve(address _spender, uint256 _value) public returns (bool success) {
require(!safeguard);
allowance[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
======================================*/
| 8,671,546 |
./full_match/137/0x3DB5c69C8B9cedA6556481808FE6f2977d4e0d89/sources/TokenVesting.sol | test a condition on front end, added here for convenience in UI, returns unlockTokens() bool, or fails | function testCondition (address condition) external view returns (bool) {
return (IUnlockCondition(condition).unlockTokens());
}
| 3,736,723 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "./IIncentive.sol";
import "./IFei.sol";
import "../refs/CoreRef.sol";
/// @title FEI stablecoin
/// @author Fei Protocol
contra... | burn FEI tokens from specified account account the account to burn from amount the amount to burn | function burnFrom(address account, uint256 amount)
public
override(IFei, ERC20Burnable)
onlyBurner
whenNotPaused
{
_burn(account, amount);
emit Burning(account, msg.sender, amount);
}
| 1,816,923 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount o... | WithdrawAll sends 'want' to 'vault' | function withdrawAll(address _strategy) external onlyStrategist {
ILpPairStrategy(_strategy).withdrawAll();
}
| 1,695,826 |
./full_match/84531/0x96286aF4a6bb6a5cCc3A182C6f37d69504BbE0b1/sources/contractsV2/contracts v2/pair.sol | if fee is on, mint liquidity equivalent to "factory.ownerFeeShare()" of the growth in sqrt(k) only for uni configuration gas savings | function _mintFee(uint112 _reserve0, uint112 _reserve1) private returns (bool feeOn) {
if(stableSwap) return false;
(uint ownerFeeShare, address feeTo) = IFactory(factory).feeInfo();
feeOn = feeTo != address(0);
uint _kLast = kLast;
if (feeOn) {
if (_kLast != 0) {
uint rootK = Math.... | 11,506,215 |
./full_match/1/0xA1D6586F07Bb9B431f2b1637cC0d1aB63D8Bc77E/sources/contracts/ArtTokenVault.sol | Transfers ownership of the vault to the buyer of the buyout. Can only be called by the new buyer after the successful buyout. Removes AT token address and sets crowdsale | function claimNewOwnership() external {
require(
buyout != IArtBuyout(address(0)) &&
buyout.status() == BuyoutStatus.SUCCESSFUL,
"Buyout not successful"
);
require(
_msgSender() == buyout.buyer(),
"Only buyout buyer can claim ow... | 16,562,172 |
./full_match/1/0x754ba691CC2228202eA824F31d3A97B24ff0b2cb/sources/NFTsHedgeFund.sol | Destroys `amount` tokens from `account`, reducing the total supply. Emits a {Transfer} event with `to` set to the zero address. Requirements: - `account` cannot be the zero address. - `account` must have at least `amount` tokens./ Overflow not possible: amount <= accountBalance <= totalSupply. | function _burn(address account, uint256 amount) private {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount excee... | 9,804,512 |
/**
*Submitted for verification at Etherscan.io on 2021-08-25
*/
// Sources flattened with hardhat v2.2.0 https://hardhat.org
// File @openzeppelin/contracts/utils/[email protected]
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/*
* @dev Provides information about the current execution context,... | Verify the merkle proof. Mark it claimed and send the token. | function claimRetroactive(uint256 index, address account, uint256 amount, bytes32[] calldata merkleProof) external {
require(!isClaimed(index), 'MerkleDistributor: Drop already claimed.');
bytes32 node = keccak256(abi.encodePacked(index, account, amount));
require(MerkleProof.verify(merkleP... | 15,430,356 |
/**
*Submitted for verification at Etherscan.io on 2021-11-30
*/
// SPDX-License-Identifier: MIT LICENSE
pragma solidity 0.8.9;
interface IKongIsland {
function addManyToKongIslandAndPack(address account, uint16[] calldata tokenIds)
external;
function randomKongOwner(uint256 seed) external view ret... | uses A.J. Walker's Alias algorithm for O(1) rarity table lookup ensuring O(1) instead of O(n) reduces mint cost by more than 50% probability & alias tables are generated off-chain beforehand seed portion of the 256 bit seed to remove trait correlation traitType the trait type to select a trait for return the ID of th... | function selectTrait(uint16 seed, uint8 traitType)
internal
view
returns (uint8)
{
uint8 trait = uint8(seed) % uint8(rarities[traitType].length);
if (seed >> 9 < rarities[traitType][trait]) return trait;
return aliases[traitType][trait];
}
| 10,764,213 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "./GamearoundNFT.sol";
// Gamearound Ecosystem Genesis Token
/// @custom:security-contact [email protected]
contract GenesisGuild is GamearoundNFT {
using Counters for Counters.Counter;
uint256 public maxSupply = 4500; // Maximum supply of NFT... | If it is an NFT TRANSFER | function _beforeTokenTransfer(address from, address to, uint256 tokenId )
internal
override
{
super._beforeTokenTransfer(from, to, tokenId);
if ((from != address(0)) && (to != address(0))) {
require(_canTransfer(), "Not sold out");
}
... | 5,763,926 |
pragma solidity 0.5.0;
contract EmmSharedNodes {
uint public constant MASTERNODE_DEPOSIT = 20000 * 10 ** 18;
uint public constant MASTERNODE_WITHDRAW = 1999999 * 10 ** 16;
uint public constant NODE_STOP_WITHDRAW_COMMISSION = 1 * 10 ** 16;
uint public constant MAX_COMMISSION_PERCENT = 50;
uint publ... | Main withdraw method. It stops top nodes if contract balance is not enough for requested withdraw volume. | function withdraw(uint _volume) public {
uint volume;
if (_volume > 0) {
volume = _volume;
require(balances[msg.sender] >= volume);
volume = balances[msg.sender];
}
require(ownedCoins >= volume);
balances[msg.sender] = safeSub(balances[msg... | 5,465,462 |
/**
*Submitted for verification at Etherscan.io on 2021-08-26
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is... | Sets rate for cluster token. Cluster rate is saved with CLUSTER_RATE_ACCURACY So 1e12 rate means, that 1 cluster should be covered with 1 DHV 2e12 rate means, that 1 cluster should be covered with 2 DHV 1e11 rate means, that 1 cluster should be covered with 0.1 DHV _cluster Address of cluster token. _rate Rate of clu... | function setClusterRate(address _cluster, uint256 _rate) external onlyRole(DEFAULT_ADMIN_ROLE) {
clusterRate[_cluster] = _rate;
}
| 6,735,220 |
./full_match/97/0x0eb2eBa66E6a325e15C1E42548D49bA50896f88A/sources/contracts/t-rex/roles/Roles.sol | Check if an account has this role. return bool/ | function has(Role storage role, address account) internal view returns (bool) {
require(account != address(0), "Roles: account is the zero address");
return role.bearer[account];
}
| 5,018,998 |
./partial_match/1/0x89fAB7A248d4bCd83767297e5c168D032a72C1Fc/sources/Bitebull.sol | CONTRACT BY @DUMMYDU on Telegram | function allowance(address owner, address spender) public view override returns (uint256) { | 15,562,952 |
// File: contracts/interfaces/IERC20Token.sol
pragma solidity 0.6.12;
/*
ERC20 Standard Token interface
*/
interface IERC20Token {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
func... | allows another account/contract to transfers tokens on behalf of the caller throws on any error rather then return a false flag to minimize user errors also, to minimize the risk of the approve/transferFrom attack vector in 2 separate transactions - once to change the allowance to 0 and secondly to change it to the new... | function approve(address _spender, uint256 _value)
public
virtual
override
validAddress(_spender)
returns (bool)
{
require(_value == 0 || allowance[msg.sender][_spender] == 0, "ERR_INVALID_AMOUNT");
allowance[msg.sender][_spender] = _value;
emit A... | 7,660,975 |
./full_match/80001/0xDB3e0e36563bD4DFdDD1c495221BA2e759F77B1F/sources/contracts/Contract.sol | Grab the next token ID being minted using an inherited view. Here, "super" refers to the base contract. We are saying "run the mintTo method from the base contract". then we can add our custom logic on top: | function mintTo(address _to, string memory _tokenURI) public virtual override {
uint256 tokenId = nextTokenIdToMint();
super.mintTo(_to, _tokenURI);
powerLevel[tokenId] = tokenId;
}
| 5,699,290 |
pragma solidity ^0.4.18;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view r... | Decrease the amount of tokens that an owner allowed to a spender. approve should be called when allowed[_spender] == 0. To decrement 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 decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
... | 164,810 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "@powerpool/power-oracle/contracts/interfaces/IPowerPoke.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "./interfaces/WrappedPiErc20Interface.sol";
import "./interfaces/IPoolRestrictions.sol";
im... | Call poke by Reporter. _reporterId Reporter ID. _claimAndDistributeRewards Claim rewards only if interval reached. _rewardOpts To whom and how to reward Reporter./ | function pokeFromReporter(
uint256 _reporterId,
bool _claimAndDistributeRewards,
bytes calldata _rewardOpts
) external onlyReporter(_reporterId, _rewardOpts) onlyEOA {
_pokeFrom(_claimAndDistributeRewards, false);
}
| 5,362,826 |
pragma solidity ^0.4.11;
/**
* Math operations with safety checks
*/
library SafeMath {
function mul(uint a, uint b) internal returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint a, uint b) internal returns (uint) {
// assert(b > 0); // So... | Do not end an already ended sale Only allow the owner | function endSale() {
if (!preSaleHasEnded) throw;
if (saleHasEnded) throw;
if (msg.sender != executor) throw;
saleHasEnded = true;
uint256 EtherAmount = this.balance;
teamETHAddress.transfer(EtherAmount);
uint256 creditFund = totalSupply.mul(3);
uint256 reserveNIMFA = totalSupply.div(2);
... | 5,540,008 |
/**
* Copyright (C) 2017-2018 Hashfuture Inc. All rights reserved.
*/
pragma solidity ^0.4.22;
library strings {
struct slice {
uint _len;
uint _ptr;
}
function memcpy(uint dest, uint src, uint len) private pure {
// Copy word-length chunks while possible
for(; len >... | Copy word-length chunks while possible | function memcpy(uint dest, uint src, uint len) private pure {
for(; len >= 32; len -= 32) {
assembly {
mstore(dest, mload(src))
}
dest += 32;
src += 32;
}
assembly {
let srcpart := and(mload(src), not(mask))
... | 2,098,139 |
./full_match/80001/0x67eB7ceaec18aFb499D88Db565B92E21ee50d2C0/sources/contracts/Contract.sol | Get the true metadata of the NFT using the `getRevealURI` function made available by the `DelayedReveal` contract extension. We'll delete the encrypted metadata URI of the NFT which we're revealing. Now store the revealed, true metadata URI for the NFT. | function reveal(uint256 tokenId, bytes calldata key)
external
override
returns (string memory revealedURI)
{
revealedURI = getRevealURI(tokenId, key);
delete encryptedData[tokenId];
postRevealURI[tokenId] = revealedURI;
}
| 5,642,379 |
/**
*Submitted for verification at Etherscan.io on 2022-03-18
*/
/**
/$$ /$$ /$$$$$$ /$$$$$$ /$$$$$$$$ /$$ /$$ /$$$$$$
| $$ /$$/|_ $$_/ /$$__ $$| $$_____/| $$ /$$/|_ $$_/
| $$ /$$/ | $$ | $$ \__/| $$ | $$ /$$/ | $$
| $$$$$/ | $$ | $$$$$$ | $$$$$ | $$$$$/ | $$
| $$ $$ | $$ \_... | maxTransactionAmount = totalSupply 50 / 1000; 0.70% maxTransactionAmountTxn exclude from paying fees or having max transaction amount | constructor() ERC20("Kiseki Inu", "Kiseki") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair... | 6,586,720 |
// File: @openzeppelin/contracts/math/Math.sol
pragma solidity ^0.5.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a >= b... | Increases the unlock time for Swerve/ | function increaseUnlockTime(address escrow, uint256 unlock_time) public onlyGovernance {
VotingEscrow(escrow).increase_unlock_time(unlock_time);
}
| 2,401,932 |
pragma solidity ^0.4.18;
/*
The Regen Coin
ERC-20 Token Standard Compliant
EIP-621 Compliant
Contract developer: Oyewole Samuel bitcert@gmail.com
*/
/**
* @title SafeMath by OpenZeppelin
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) int... | transfer token from an address to another specified address using allowance _from The address where token comes. _to The address to transfer to. _value The amount to be transferred./ | function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(balances[_from] >= _value && allowed[_from][msg.sender] >= _value);
balances[_to] = balances[_to].add(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][msg.s... | 132,333 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.11;
//
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* -... | Unstake. Emits an {Unstake} event. Requirements: - Dfinance account is connected. - Account didn't unstake./ | function unstake() external override returns (bool) {
require(_stakers[msg.sender].account != bytes32(0), 'Staking: Dfinance account is not connected');
require(_stakers[msg.sender].unstakedAt == 0, 'Staking: unstaked account');
_stakers[msg.sender].unstakedAt = block.timestamp;
if... | 12,249,200 |
pragma solidity ^0.5.0;
contract PerformanceCheck {
// Events
event BuildingAdded(string indexed BI);
event CaseCreated(uint caseCount,
address Owner,
address Contractor,
address FM,
string BuildingId,
bytes32[] TsetIDs,
bytes32[] TIDs,
bytes32[] RHuIDs,
bytes32[] AQuIDs,
ui... | adding a building and its information to the list to get checked | function addCase(address account1, address payable account2, address payable account3,
string memory BI, bytes32[] memory TsetIDs, bytes32[] memory TIDs,
bytes32[] memory RHuIDs, bytes32[] memory AQuIDs, uint depoam, uint Erate) public {
require (isWhitelisted(account1),"buil... | 2,478,165 |
./partial_match/1/0x592e98898f6ECcfCC46c764EaE12265257E0e793/sources/PumaPayWrapper.sol | impl IBridge `Swapin` | function Swapin(
bytes32 txhash,
address account,
uint256 amount
)
external
override
onlyRole(MINTER_ROLE)
onlyRole(BRIDGE_ROLE)
whenNotPaused(PAUSE_BRIDGE_ROLE)
returns (bool)
{
_mint(account, amount);
emit LogSwapin(txhash, account, amount);
return true;
}
| 4,138,939 |
./full_match/1/0x0043A4a809bE33afA17C1E3e37E19977622E4700/sources/BlockersContract.sol | Admin Mint Functions Mints a token to an address with a tokenURI. This is owner only and allows a fee-free drop _to address of the future owner of the token _qty amount of tokens to drop the owner/ | function mintToAdminV2(address _to, uint256 _qty) public onlyTeamOrOwner{
require(_qty > 0, "Must mint at least 1 token.");
require(currentTokenId() + _qty <= collectionSize, "Cannot mint over supply cap of 1000");
_safeMint(_to, _qty, true);
}
| 9,813,164 |
./partial_match/56/0x224225Ad7da5E1C49EE16C3D37FE63038C076988/sources/TokenPriceOracle.sol | note this will always return 0 before update has been called successfully for the first time. overflow is desired, casting never truncates cumulative price is in (uq112x112 price seconds) units so we simply wrap it after division by time elapsedprice1Average = FixedPoint.uq112x112(uint224((price1Cumulative - price1Cum... | function getData() external view returns (uint256 value, bool isValid) {
(uint D100BNBPrice0Cumulative, , uint32 blockTimestamp) =
PancakeOracleLibrary.currentCumulativePrices(D100BNBPairAddress);
( ,uint BUSDBNBPrice1Cumulative, ) =
PancakeOracleLibrary.currentCumulativePric... | 11,107,489 |
// to test issue with nodes breaking with large clients over WS
// fixed in web3 with fragmentationThreshold: 8192
pragma solidity ^0.4.17;
contract BigFreakingContract {
event Transfer(address indexed from, address indexed to, uint value);
event Approval( address indexed owner, address indexed spender, uint valu... | TODO: should increase instead | function approve_530(address spender, uint value) public returns (bool ok) {
_approvals[msg.sender][spender] = value;
emit Approval( msg.sender, spender, value );
return true;
}
| 6,454,243 |
pragma solidity ^0.4.8;
contract token { function transferFrom(address sender, address receiver, uint amount){ } }
contract Crowdsale {
address public beneficiary;
address public tokenAdmin;
uint public fundingGoal; uint public amountRaised; uint public deadline; uint public price;
token publ... | data structure to hold information about campaign contributors / at initialization, setup the owner / Token admin address with total supply. Admin must approve transctions! Finding goal in ether Length of sale in weeks Price of 1 token in ethers / decimals Token used as reward address | function Crowdsale() {
beneficiary = 0xDbe120fD820a0A4cc9E715f0cbD47d94f5c23638;
tokenAdmin = 0x934b1498F515E74C6Ec5524A53086e4A02a9F2b8;
fundingGoal = 1 * 1 ether;
deadline = now + 5 * 1 weeks;
price = 0.01 / 100 * 1 ether;
tokenReward = token(0xb16dab600fc0570213260... | 1,824,012 |
// File: contracts/external/openzeppelin-solidity/math/SafeMath.sol
pragma solidity ^0.5.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 assume that an ... | Settle the market, setting the winning option/ | function settleMarket() external {
(uint256 _value, uint256 _roundId) = marketUtility.getSettlemetPrice(marketFeedAddress, uint256(marketSettleTime()));
if(marketStatus() == PredictionStatus.InSettlement) {
_postResult(_value, _roundId);
}
}
| 2,152,886 |
./full_match/84531/0x3b2Da38EeE92a0Ce9E8642f272a5bCa2a6Ac3A3c/sources/contracts/guild-core/GuildOracle.sol | Sets the API endpoint for obtaining the price of the guild token. api The new API endpoint for obtaining the price of the guild token./ | function setAPI(string memory api) external onlyRole(DEFAULT_ADMIN_ROLE) {
_api = api;
}
| 14,312,983 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.11;
pragma experimental ABIEncoderV2;
// ====================================================================
// | ______ _______ |
// | / _____________ __ __ / ____(_____ ____ _____ ________ |
// | / /_ ... | Mint the FRAX component Approve the collateral to be added to 3pool Convert collateral into 3pool Add the FRAX and the collateral to the metapool | function metapoolDeposit(uint256 _frax_amount, uint256 _collateral_amount) external onlyByOwnerOrGovernance returns (uint256 metapool_LP_received) {
FRAX.pool_mint(address(this), _frax_amount);
minted_frax_historical = minted_frax_historical.add(_frax_amount);
require(fraxBalance() <= max_fr... | 6,031,368 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.6;
import "../erc20/ERC20.sol";
import "./IWrappedERC20.sol";
contract WrappedERC20 is ERC20, IWrappedERC20 {
event Deposit(address indexed recipient, uint value);
event Withdrawal(address indexed src, uint value);
constructor (string memory name, str... | solhint-disable-next-line check-send-result | function withdraw(uint value) virtual override external {
_balances[_msgSender()] = _balances[_msgSender()].sub(value, "ERC20: withdrawal amount exceeds balance");
require(
payable(_msgSender()).send(value)
);
emit Withdrawal(_msgSender(), value);
}
| 911,136 |
./full_match/3/0x6B515C4afC7dd0E4c9831cdC0EAd0346f4698616/sources/home/illuschwo/Generation.finance/YgemStaking/contracts/Staking.sol | Forecast profit for _address till _date return: Reward amount in Ygem/ | function forecastStakeHolderRewards(address _address, uint _date) public view returns(uint)
{
(bool _isStakeholder,) = isStakeholder(_address);
require(_isStakeholder == true,"isStakeholder: false");
uint rewardAmount = 0;
for (uint i = 0; i < stakes[_address].length; i += 1) {
... | 8,189,588 |
pragma solidity 0.5.15;
// import "./interfaces/IERC20.sol";
import "./interfaces/IAaveLendingPool.sol";
import "./interfaces/IADai.sol";
import "./interfaces/IPoolDeposits.sol";
import "@nomiclabs/buidler/console.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol";
import "@openzeppeli... | NOTE: Users can only change their deposit through a complete withdrawl and new depsit This means this value will always be constant and set correctly again if the above case occurs NOTE: no need for safemath here. add voice credit amount here for user. add same total amount for variable IF person voted last iteration, ... | function _resetUsersVotingCreditIfFirstVoteThisIteration(
address givenAddress
) internal {
if (!userVotedThisIteration[proposalIteration][givenAddress]) {
uint256 usersVoteIncentiveStake;
(
usersVoteCredit[proposalIteration][givenAddress],
... | 13,085,045 |
pragma solidity ^0.4.23;
/**
* @title Interface for contracts conforming to ERC-721: Non-Fungible Tokens
*/
contract ERC721 {
event Transfer(
address indexed from,
address indexed to,
uint256 indexed tokenId
);
event Approval(
address indexed owner,
address indexed approved,
uint256 in... | Creates a new release token with the given name and creates an auction for it. _name Name ot the token _startingPrice Price of item (in wei) at beginning of auction _endingPrice Price of item (in wei) at end of auction _duration Length of auction (in seconds)/ Check release tokens limit Create token and tranfer own... | function createReleaseTokenAuction(
string _name,
uint256 _startingPrice,
uint256 _endingPrice,
uint256 _duration
)
onlyAdmin
external
{
require(releaseCreatedCount < TOTAL_SUPPLY_LIMIT);
uint256 tokenId = _createToken(_name, address(this));
_approve(tokenId, auction);
a... | 5,995,108 |
./partial_match/1/0xfd124A610Ae299E574A83fbF3738dB75DB1D751d/sources/AIMToken.sol | 0xEe9F2375b4bdF6387aa8265dD4FB8F16512A1d46 USDt/ETH Ethereum mainnet Ensure that the price is valid | function getLatestUSDTPrice() public view returns (uint256) {
AggregatorV3Interface USDTPriceFeed = AggregatorV3Interface(
0xEe9F2375b4bdF6387aa8265dD4FB8F16512A1d46
if (price <= 0) {
revert invalidUSDTPrice();
}
return uint256(price);
}
| 2,657,819 |
./full_match/80001/0xe1065F5eD9d0C1C57b0036332Cd06FEDc5F962D8/sources/contracts/interfaces/IWrappedERC20.sol | An interface for a custom ERC20 contract used in the bridge | interface IWrappedERC20 is IERC20Upgradeable {
function name() external view returns(string memory);
function symbol() external view returns(string memory);
function decimals() external view returns(uint8);
function bridge() external view returns(address);
function mint(address to, uint256 amou... | 5,638,538 |
./full_match/80001/0xd8d0A205062f074bE065125353CBaBb38441FEA7/sources/contracts/MyNFT.sol | Toggle Switch for public sale/ | function togglePublicSale() external onlyOwner {
publicSale = !publicSale;
}
| 9,490,024 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.9;
import { IERC20 } from '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import { Initializable } from '@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol';
import { SafeERC20 } from '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';
... | transfer settlement tokens between clearing house and account owner | function _updateMargin(
Account.Info storage account,
uint32 collateralId,
int256 amount,
bool checkMargin
) internal whenNotPaused {
Collateral storage collateral = _checkCollateralIdAndGetInfo({
collateralId: collateralId,
isWithdraw: amount < 0
... | 13,069,459 |
./full_match/1313161554/0x9617564b3C774E1752FD97dE8E1d2d9552dc1B3F/sources/contracts/ChToken/ChToken.sol | Transfer `amount` tokens from `src` to `dst` src The address of the source account dst The address of the destination account amount The number of tokens to transfer return Whether or not the transfer succeeded/ | function transferFrom(
address src,
address dst,
uint256 amount
) external nonReentrant returns (bool) {
return
transferChTokens(msg.sender, src, dst, amount) ==
uint256(Error.NO_ERROR);
}
| 13,231,053 |
./full_match/44787/0x34422efA66294820a0bb169294c28a880B9a88bf/sources/Sacuda.sol | Function to add a clerk (minter + burner) / | function addClerk(address user) external onlyRole(ADMIN_ROLE) {
_grantRole(CLERK_ROLE, user);
}
| 13,256,943 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
abstract contract Whitelist is Ownable {
mapping(address => bool) public _whitelist;
modifier onlyWhitelisted () {
require(_whitelist[_msgSender()], "Not whitelisted for transfers");
... | Whitelist address to transfer tokens. _addres Address to whitelist. Caller must be owner of the contract./ | function whitelist(address _addres) public onlyOwner {
_whitelist[_addres] = true;
}
| 12,810,261 |
/// GebLenderFirstResortRewardsVested.sol
// Copyright (C) 2021 Reflexer Labs, INC
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your o... | --- Getters --- @notify Return the ancestor token balance for this contract/ | function depositedAncestor() public view returns (uint256) {
return ancestorPool.balance();
}
| 1,791,058 |
./partial_match/3/0xe6E3d48C50b55741eA89ebc7b194620348037b1a/sources/LotteryTwo.sol | Get the block num of the last time the address claimed | function getLastClaim(address addr) public view returns(uint){
return lastClaim[addr];
}
| 5,212,200 |
pragma solidity ^0.4.23;
/**
* @title Math
* @dev Assorted math operations
*/
library Math {
function max64(uint64 a, uint64 b) internal pure returns (uint64) {
return a >= b ? a : b;
}
function min64(uint64 a, uint64 b) internal pure returns (uint64) {
return a < b ? a : b;
}
f... | Gets the balance of the specified address. | function balanceOf(address _owner) view public returns (uint256) {
return records[_owner].amount;
}
| 5,421,231 |
pragma solidity ^0.4.18;
/**
* @title Owned contract with safe ownership pass.
*
* Note: all the non constant functions return false instead of throwing in case if state change
* didn't happen yet.
*/
contract Owned {
/**
* Contract owner address
*/
address public contractOwner;
... | Issues new asset token on the platform. Tokens issued with this call go straight to contract owner. Each symbol can be issued only once, and only by contract owner. _symbol asset symbol. _value amount of tokens to issue immediately. _name name of the asset. _description description for the asset. _baseUnit number ... | function issueAssetToAddress(bytes32 _symbol, uint _value, string _name, string _description, uint8 _baseUnit, bool _isReissuable, address _account) public onlyOneOfContractOwners returns (uint) {
if (_value == 0 && !_isReissuable) {
return _error(ATX_PLATFORM_CANNOT_ISSUE_FIXED_ASSET_WITH_INVAL... | 5,370,202 |
pragma solidity ^0.5.0;
library OptimBookerLib {
struct Node {
/// Booking's start date in seconds
uint fromDate;
/// Booking's end date in seconds
uint toDate;
uint bid;
uint next;
}
struct Storage {
uint nextPos;
mapping (uint => Node) nod... | Returns true if junk is initialised: if it points to itself | function junkNotInitialised(Storage storage self) private view returns (bool)
{
return self.nodes[JUNK].next == 0;
}
| 13,065,554 |
pragma solidity ^ 0.4.25;
// -----------------------------------------------------------------------------------------------------------------
//
// Recon® Token Teleportation Service v1.10
//
// of BlockReconChain®
// for ReconBank®
//
/... | addWhitelistMember is used to whitelist participant. This means, that for the first 3 days of crowd-sale `_tokens` RECON will be reserved for him. | function addWhitelistMember(address[] _mem, uint[] _tokens) public onlyAdmin {
require(_mem.length == _tokens.length);
for(uint i = 0; i < _mem.length; i++) {
whitelistTokens = whitelistTokens.sub(whitemap[_mem[i]]).add(_tokens[i]);
whitemap[_mem[i]] = _tokens[i];
}
... | 918,287 |
pragma solidity ^0.4.23;
import "./Ownable.sol";
import "./DOSOnChainSDK.sol";
// A user contract asks anything from off-chain world through a url.
contract TestUserContract is Ownable, DOSOnChainSDK {
string public response;
// query_id -> valid_status
mapping(uint => bool) private _valid;
// Default... | Ask me anything (AMA) off-chain through an api/url. | function AMA(string memory url, string memory selector) public {
lastQueriedUrl = url;
lastQueriedSelector = selector;
uint id = DOSQuery(timeout, url, selector);
if (id != 0x0) {
_valid[id] = true;
emit RequestSent(true, id);
revert("Invalid query... | 12,633,696 |
./full_match/3/0x967328588D821b4306fe8F0592faFE94eC930429/sources/contracts/Token5.sol | Moves tokens `amount` from `sender` to `recipient`. This is internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `sender` cannot be the zero address. - `recipient` cannot be the zero address. - `sender`... | function _transfer(address sender, address recipient, uint256 amount) internal virtual override {
super._transfer(sender, recipient, amount);
}
| 8,243,805 |
pragma solidity ^0.4.25;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/********************************************************************************************/
/* DATA VARIABL... | Delete an airline from the registration queue Can only be called from FlightSuretyApp contract/ | function removeVotes
(
address airline
)
external
{
delete countVote[airline];
}
| 12,863,895 |
./partial_match/1/0xe6F4d9711121e5304b30aC2Aae57E3b085ad3c4d/sources/src/libraries/internal/Deposits.sol | Get prefix sum of all indexes from provided index downwards. Starts at tree root and decrements through range parent nodes summing from index `sumIndex_`'s range to index `0`. deposits_ Deposits state struct. sumIndex_ The index to receive the prefix sum. sum_ The prefix sum from current index dow... | function prefixSum(
DepositsState storage deposits_,
uint256 sumIndex_
) internal view returns (uint256 sum_) {
++sumIndex_;
uint256 indexLSB = lsb(sumIndex_);
uint256 curIndex;
while (j >= indexLSB) {
curIndex = index + j;
if (curIndex... | 3,630,171 |
./full_match/1/0x567c09B55294998d7a6F2A3A948e8fD331531B88/sources/contracts/UMA/common/implementation/FixedPoint.sol | Adds two `Unsigned`s, reverting on overflow. a a FixedPoint. b a FixedPoint. return the sum of `a` and `b`./ | function add(Unsigned memory a, Unsigned memory b)
internal
pure
returns (Unsigned memory)
{
return Unsigned(a.rawValue.add(b.rawValue));
}
| 9,749,024 |
./full_match/1/0xA94161fBE69E08fF5a36DfAfa61BdF29DD2Fb928/sources/contracts/Membership.sol | Returns the URI for a given token ID. The token ID must exist, otherwise this function will revert. _tokenId The ID of the token to retrieve the URI for. | function tokenURI(
uint256 _tokenId
) public view override returns (string memory) {
_requireMinted(_tokenId);
string memory baseURI = _baseURI();
return
bytes(baseURI).length > 0
? string(abi.encodePacked(baseURI, Strings.toString(_tokenId)))
: '';
}
| 16,395,127 |
./full_match/5/0xa4e2120C1070BE2A093d6A2bD4bEf8D139494731/sources/contracts/CrowdFunding.sol | structure of all the functions. is everything okaey? | function createCampaign(address _owner, string memory _title, string memory _description, uint256 _target, uint256 _deadline, string memory _image) public returns(uint256) {
Campaign storage campaign = campaigns[numberOfCampaigns];
require(campaign.deadline < block.timestamp, "The deadline should be... | 1,871,207 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@ope... | When the contract is paused, all token transfers are prevented in case of emergency./ | function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal whenNotPaused override {
super._beforeTokenTransfer(from, to, tokenId);
}
| 6,874,047 |
./partial_match/3/0x99d70DA0b03Ffcb23d26Ca74d89aF616feB7C204/sources/MasterChef.sol | Withdraw LP tokens from MasterChef. | 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.accMeatPerShar... | 5,231,302 |
./partial_match/1/0x4e457722B68F8adC887F5De85b8410021Bd698AC/sources/RewardsDistributorDelegate.sol | Keeps the flywheel moving pre-borrow and pre-repay Called by the Comptroller cToken The relevant market borrower The borrower/ | function flywheelPreBorrowerAction(address cToken, address borrower) external {
if (compBorrowState[cToken].index > 0) {
updateCompBorrowIndex(cToken, borrowIndex);
distributeBorrowerComp(cToken, borrower, borrowIndex);
}
}
| 3,907,868 |
./full_match/4/0xf89bb3cC4212A4B2FcE52809dfdBf60c4656220E/sources/contracts/JollyRogerGame.sol | Function returns shot token of game number | function getGameResult(uint256 _numberOfGame) public view returns (string memory)
{
require(_numberOfGame >= FIRSTGAME && _numberOfGame <= LASTGAME, "Game # invalid");
require(_gameResult[_numberOfGame] > 0, "Result of game # not exists");
return Strings.toString(_gameResult[_num... | 829,743 |
pragma solidity ^0.4.0;
import "./SafeMath.sol";
import "./Math.sol";
import "./PlasmaRLP.sol";
import "./Merkle.sol";
import "./Validate.sol";
import "./PriorityQueue.sol";
/**
* @title RootChain
* @dev This contract secures a utxo payments plasma child chain to ethereum.
*/
contract RootChain {
using SafeMa... | Processes any exits that have completed the challenge period. _token Token type to process./ FIXME: handle ERC-20 transfer Prevent the exit which owner is deleted see function challengeExit() | function finalizeExits(address _token)
public
{
uint256 utxoPos;
uint256 exitableAt;
(exitableAt, utxoPos) = getNextExit(_token);
PriorityQueue queue = PriorityQueue(exitsQueues[_token]);
Exit memory currentExit = exits[utxoPos];
while (exitableAt < block.... | 6,489,040 |
./full_match/1/0x6b9a3f7507706971eEeAEcd219675A2C4B7dc076/sources/contracts/POSTWOOK_Decal.sol | See {IERC165-supportsInterface}./ | function supportsInterface(
bytes4 interfaceId
) public view virtual override(ERC721, AccessControl) returns (bool) {
return super.supportsInterface(interfaceId);
}
| 3,018,231 |
./full_match/1/0x120F442703d6795E90c6E4AF9f643e0aF0A794cb/sources/contracts/lib/ERC721Psi.sol | Safely mints `quantity` tokens and transfers them to `to`. Requirements: - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called for each safe transfer. - `quantity` must be greater than 0. Emits a {Transfer} event./ | function _safeMint(address to, uint256 quantity) internal virtual {
_safeMint(to, quantity, "");
}
| 2,930,907 |
./full_match/1/0xFb8F626AD693ad0AF769ddB265084E8973f63a3C/sources/contracts/RelicToken.sol | @inheritdoc IERC721 Immediately reverts: Relics are soul-bound/non-transferrable/ | function safeTransferFrom(
address, /* from */
address, /* to */
uint256 /* tokenId */
) external pure {
revert("RelicToken is soulbound");
}
| 4,930,349 |
// File: @openzeppelin/contracts/utils/math/SafeMath.sol
pragma solidity ^0.8.0;
// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.
/**
* @dev Wrappers over Solidity's arithmetic operations.
*
* NOTE: `SafeMath`... | Before all token transfer | function _beforeTokenTransfer(
address _from,
address _to,
uint256 _tokenId
) internal virtual override(ERC721, ERC721Pausable) {
super._beforeTokenTransfer(_from, _to, _tokenId);
}
| 5,958,846 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns... | Changes Ice token reward per second. Use this function to moderate the `lockup amount`. Essentially this function changes the amount of the reward which is entitled to the user for his token staking by the time the `endTime` is passed.Good practice to update pools without messing up the contract | function setIcePerSecond(uint256 _icePerSecond, bool _withUpdate) external onlyOwner {
if (_withUpdate) {
massUpdatePools();
}
icePerSecond= _icePerSecond;
}
| 1,304,763 |
pragma solidity ^0.8.0;
import "@c-layer/common/contracts/operable/Operable.sol";
import "./interface/IUserRegistry.sol";
/**
* @title UserRegistry
* @dev UserRegistry contract
* Configure and manage users
* Extended may be used externaly to store data within a user context
*
* @author Cyril Lapinte - <cyril.l... | suspend a user/ | function suspendUser(uint256 _userId)
override public onlyOperator returns (bool)
{
require(_userId > 0 && _userId <= userCount_, "UR01");
require(!users[_userId].suspended, "UR06");
users[_userId].suspended = true;
emit UserSuspended(_userId);
return true;
}
| 7,325,270 |
./full_match/1/0x8cFBf1B44B4B2828a59B152653C7Db764c91f792/sources/gateway-contracts/ArbSys.sol | Precompiled contract that exists in every Arbitrum chain at address(100), 0x0000000000000000000000000000000000000064. Exposes a variety of system-level functionality./ | interface ArbSys {
function arbOSVersion() external pure returns (uint);
function arbBlockNumber() external view returns (uint);
function withdrawEth(address destination) external payable returns(uint);
function sendTxToL1(address destination, bytes calldata calldataForL1) external payable returns(ui... | 17,194,731 |
./full_match/42/0xcB2a0529dC882c1372f6C4C58de4178D40f5cF49/sources/src/Voucher.sol | used by owner to give many voucher at once. to array of all addresses that will receive a token can't overflow | function batchMint(
address[] calldata to,
uint256 value,
address erc20addr
) public onlyOwner {
uint256 nbAddresses = to.length;
if (
erc20addr == address(0) &&
(address(this).balance <
ETHperToken * nbAddresses + reservedEth + res... | 16,263,093 |
pragma solidity >=0.4.0 <0.6.0;
import "./SafeMath.sol";
// @title Faireum Dice Game Contract
contract FaireumDice{
// State Variables
uint constant MIN_BET = 0.01 ether;
uint constant MAX_AMOUNT = 250000 ether;
uint constant HOUSE_PERCENT = 15;
uint constant HOUSE_MINIMUM_AMOUNT = 0.0002 eth... | settles the bet | function settleBet(
uint reveal,
bytes32 blockHash
)
external
onlyCroupier
{
uint betID = uint(keccak256(abi.encodePacked(reveal)));
Bet storage bet = bets[betID];
uint blockNumber = bet.blockNumber;
require (blockhash(blockNumber) == blo... | 2,518,276 |
./full_match/4/0xA39CBbe3f62aAE674370c32D0F5Acb646453C202/sources/contracts/test2.sol | returns the balances from concatenated addresses: {bytes32 balance address 1}...{bytes32 balance address n}. data {bytes20 address 1}...{bytes20 address n}: concatenated addresses./ First, validate the input data. We expect a first bytes32 number of addresses following by the bytes20 addresses packed. Second, call the... | function checkBalancesMemory(bytes memory data)
public
view
returns (bytes memory balances)
{
require(data.length > 0, "no data provided");
require(
(data.length % 20 == 0),
"wrong data sent, length doesn't match"
);
uint256 numAd... | 12,411,196 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "../interfaces/IERC721Consumable.sol";
import "../interfaces/IMarketp... | Sets Metaverse registry to a Metaverse _metaverseId The target metaverse _registry The registry to be set _status Whether the registry will be added/removed | function setRegistry(
uint256 _metaverseId,
address _registry,
bool _status
) external {
require(_registry != address(0), "_registry must not be 0x0");
LibOwnership.enforceIsContractOwner();
LibMarketplace.setRegistry(_metaverseId, _registry, _status);
e... | 1,613,610 |
// SPDX-License-Identifer: MIT
// File: @openzeppelin/contracts/access/IAccessControl.sol
pragma solidity ^0.8.0;
/**
* @dev External interface of AccessControl declared to support ERC165 detection.
*/
interface IAccessControl {
/**
* @dev Emitted when `newAdminRole` is set as ``role``'s admin role, repla... | update: rewards (internal) | function updateRewards(uint _weight, uint _totalWeight) internal {
emit RewardsUpdated(dailySoul, soulPerSecond);
}
| 13,076,222 |
/**
*Submitted for verification at Etherscan.io on 2021-09-05
*/
// SPDX-License-Identifier: Unlicense
pragma solidity 0.8.7;
// Part: INFTSet
interface INFTSet {
function init(
address owner,
string memory name,
string memory symbol
) external;
}
// Part: OpenZeppelin/[email pro... | Get the revert message from a call This is needed in order to get the human-readable revert message from a call _res Response of the call return Revert message string If the _res length is less than 68, then the transaction failed silently (without a revert message) | function _getRevertMsg(bytes memory _res) internal pure returns (string memory) {
if (_res.length < 68) return "Transaction reverted silently";
}
| 7,684,887 |
pragma solidity ^0.4.21;
// File: contracts/minime/Controlled.sol
contract Controlled {
/// @notice The address of the controller is the only address that can call
/// a function with this modifier
modifier onlyController { require(msg.sender == controller); _; }
address public controller;
... | buyTokens process token purchase. Owner can halt token purchasein an emergency. | function buyTokens(address _beneficiary) public payable whenNotPaused {
validatePurchase();
uint256 toFund = calculateToFund();
uint256 toReturn = msg.value.sub(toFund);
require(toFund > 0);
uint256 rate = getRate();
uint256 tokens = rate.mul(toFund);
require(tokens > 0);
phase1... | 6,448,970 |
./partial_match/4/0x9361A22e147FeA8984B6598D3281770BD4D49C93/sources/Curve.sol | return The square root of the given number/ | function sqrt(uint256 y) internal pure returns (uint256 z) {
if (y > 3) {
z = y;
uint256 x = y / 2 + 1;
while (x < z) {
z = x;
x = (y / x + x) / 2;
}
z = 1;
}
}
| 8,538,081 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
pragma abicoder v2;
import "./Ownable.sol";
import "./SafeMath.sol";
import "./InlineInterface.sol";
import "./TransferHelper.sol";
contract InlineDatabase is Ownable{
using SafeMath for uint256;
mapping (address=>uint256) tokensStaked; //a... | add update defi felxible coin | function addUpdateForFixedCoin(address _ContractAddress, string memory _currencySymbol,
uint16 _OracleType, bool _Status, uint256 coinType) public onlyOwner{
require(coinType>0 && coinType<=3,"Please enter valid CoinType");
InlineDatabaseLib.DefiCoin memo... | 13,975,097 |
pragma solidity 0.5.16;
import "../interfaces/IFlopper.sol";
contract SimpleFlopper {
// A "flopper" is a contract for auctioning off MKR in exchange for Dai.
IFlopper private _auction;
constructor(address auction) public {
_auction = IFlopper(auction);
}
// Getters //
/// @notice Get the status ... | Get the winning bid for an auction return amountDAI uint256 amount of DAI to be burned return amountMKR uint256 amount of MKR to be minted return bidder address account who placed bid return bidDeadline uint48 deadline of bid return auctionDeadline uint48 deadline of auction | function getCurrentBid(uint256 auctionID) public view returns (
uint256 amountDAI,
uint256 amountMKR,
address bidder,
uint48 bidDeadline,
uint48 auctionDeadline
) {
return _auction.bids(auctionID);
}
| 2,574,671 |
./full_match/42/0xAE91AEbAD26C099Da1FA005841401b140c15269a/sources/Users/kasidejphulsuksombati/ALPHA/alphaperp/contracts/AlphaPerp.sol | Convert the given slot identifier to strike price. ident The slot identifier, can be with or without the offset. | function getStrike(uint ident) public pure returns (uint) {
if (magnitude == 0) {
require(prefix >= 800, 'bad prefix');
return prefix - 800;
}
}
| 16,273,803 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.