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/44787/0x0b7365a90d7db99C9d52D27C23D9891abd5A1557/sources/project_/contracts/interfaces/uniswap/TickLens.sol | get the populated ticks above and below the current spot tick bool unlocked current word position within bitmap | function getSpotInfo(IUniswapV3Pool pool)
internal
view
returns (
uint160 sqrtPriceX96,
int24 tick,
uint128 liquidity,
int16 tickBitmapIndex
)
{
(
sqrtPriceX96,
tick,
) = pool.slot0();
... | 13,267,850 |
pragma solidity ^0.8.6;
interface ERC20Base {
event Approval(address indexed owner, address indexed spender, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value);
function totalSupply() external view returns (uint256);
function allowance(address owner, address spender... | Added for testing purposes | function transfer(address dst, uint256 amount) override external returns (bool success) {
if (failTransferToAddresses[dst]) {
return false;
}
require(balanceOf[msg.sender] >= amount, "Insufficient balance");
balanceOf[msg.sender] += amount;
balanceOf[dst] += amoun... | 13,125,443 |
// File: @aragon/os/contracts/acl/IACLOracle.sol
/*
* SPDX-License-Identifier: MIT
*/
pragma solidity ^0.4.24;
interface IACLOracle {
function canPerform(address who, address where, bytes32 what, uint256[] how) external view returns (bool);
}
// File: @aragon/os/contracts/acl/IACL.sol
/*
* SPDX-License-... | Submit evidence for dispute `_disputeId` Only callable by the action submitter or challenger. Can be called as many times as desired until the dispute is over. Initialization check is implicitly provided by `_getDisputedAction()` as disputable actions can only be created via `newAction()`. _disputeId Identi... | function submitEvidence(uint256 _disputeId, bytes _evidence, bool _finished) external {
(, Action storage action, , Challenge storage challenge) = _getDisputedAction(_disputeId);
require(_isDisputed(challenge), ERROR_CANNOT_SUBMIT_EVIDENCE);
IArbitrator arbitrator = _getArbitratorFor(action... | 10,762,617 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.5.0 <0.8.0;
contract ERC20 {
//balanceOf allows the smart contract to store and return the balance of the address provided (_who)
function balanceOf(address _who) public view returns (uint256);
//transfer lets the owner of the contract send a given amount of ... | to get array of addresses of contributors | function getContributors() public view returns(address[] memory) {
return contributors;
}
| 6,381,591 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.7.6;
import "./UniV2AdapterCore.sol";
contract UniV2ExcessIn is UniV2AdapterCore {
function tokenToTokenExcess(IERC20 tokenIn, IERC20 tokenOut, uint tokenInAmount, uint tokenOutAmount)
external view override
returns (address[] memory excessTok... | performs chained getAmountOut calculations on any number of pairs | function getAmountsOut(address factory, uint amountIn, address[] memory path) internal view returns (uint[] memory amounts) {
require(path.length >= 2, 'UniswapV2Library: INVALID_PATH');
amounts = new uint[](path.length);
amounts[0] = amountIn;
for (uint i; i < path.length - 1; i++) {
(uint rese... | 13,432,135 |
./partial_match/5/0x644fE2731D8235216aA1DBfF4b4e844A9937173C/sources/StandardToken.sol | Verify a signed approval permit and execute if valid owner Token owner's address (Authorizer) spender Spender's address value Amount of allowance deadline The time at which this expires (unix time) v v of the signature r r of the signature s s of the signature/ @TODO: Gas Testi... | function _permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
require(owner != address(0), "ERC2612/Invalid-address-0");
require(deadline >= now, "ERC2612/Expired-time");
... | 16,837,655 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/interfaces/IERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./interfaces/ICollegeCredit.sol";
import "./CollegeCredit.sol";
contract IMDStaking is Ownable {
event Staked(address indexed user, address... | Unstakes a given token held by the calling user AND withdraws all dividends. _token the address of the token contract that the token belongs to. _tokenId the id of the token to unstake. reverts if the token is not owned by the caller./ | function unstakeAndClaimRewards(address _token, uint256 _tokenId) external {
require(_isStakable(_token), "Not stakable");
require(
stakableTokenAttributes[_token].stakedTokens[_tokenId].owner ==
msg.sender,
"Not owner"
);
uint256 dividend = _w... | 13,514,020 |
./full_match/80001/0xFf0c3692eE63916032B68FdA82b8d9b71c30a7D3/sources/contract/Canbeat-Staking/module/Canbeat-Stake-Core.sol | A function to set the reward per minute for staking. _rewardPerMin The amount of reward to be set./ | function setrewardPerMin(uint256 _rewardPerMin) external onlyRole(DEFAULT_ADMIN_ROLE){
rewardPerMin = _rewardPerMin;
}
| 858,956 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.11;
import '@openzeppelin/contracts/math/SafeMath.sol';
import '@openzeppelin/contracts/access/AccessControl.sol';
import '@openzeppelin/contracts/utils/ReentrancyGuard.sol';
import './interfaces/IExchange.sol';
import './interfaces/IXFIToken.sol';
/**
* Implement... | Returns the address of the Wings Token./ | function wingsToken() external view override returns (address) {
return address(_wingsToken);
}
| 12,725,417 |
./full_match/1/0x727571F63E760235397D3d4E76d2De3e3Cb7ac8A/sources/contracts/CasinoBank.sol | OWNER ONLY Feeds the bank with excedentary funds that backs the sustainability of said contract allows tracking of intent and amount via event emission, instead of using silent fallback() or receive()/ | function feedBank() external payable onlyOwner {
emit BankBalanceSustained(msg.value);
}
| 4,831,699 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
//
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementa... | Start Resting to earn Health based on user desirable period | function startRest(uint256 _tokenId, uint256 day) public {
EachMonster storage m = monsters[_tokenId];
require(ownerOf(_tokenId) == msg.sender, MSG_ONLY_OWNER_NFT_REST);
require(m.training == false, MSG_NFT_ALREADY_RESTING);
uint256 until = day*86400;
m.training = true;
... | 6,238,884 |
// SPDX-License-Identifier: Unlicense
pragma solidity 0.7.6;
// Part: IVault
interface IVault {
function deposit(
uint256,
uint256,
uint256,
address
) external returns (uint256, uint256);
function withdraw(
uint256,
uint256,
uint256,
addr... | Maximum liquidity that can deposited in range by vault given its balances of token0 and token1. | function _maxDepositable(int24 tickLower, int24 tickUpper) internal view returns (uint128) {
uint256 balance0 = token0.balanceOf(address(this));
uint256 balance1 = token1.balanceOf(address(this));
return _liquidityForAmounts(tickLower, tickUpper, balance0, balance1);
}
| 449,869 |
./partial_match/3/0xc7920b800569AC8895e1a0bA3869B6ddF56717e3/sources/PoR.sol | Validates a tx inclusion in the block `index` is not a reliable indicator of location within a block _txid The txid (LE) _merkleRoot The merkle root (as in the block header) _intermediateNodes The proof's intermediate nodes (digests between leaf and root) _index ... | function prove(
bytes32 _txid,
bytes32 _merkleRoot,
bytes memory _intermediateNodes,
uint _index
) internal pure returns (bool) {
if (_txid == _merkleRoot && _index == 0 && _intermediateNodes.length == 0) {
return true;
}
bytes memory _proof =... | 5,220,651 |
pragma solidity ^0.4.25;
/**
*
* https://fairdapp.com/bank/ https://fairdapp.com/bank/ https://fairdapp.com/bank/
*
* _______ _ ______ _______ ______ ______
* (_______) (_) (______)(_______|_____ (_____ \
* _____ _____ _ ____ _ _ _______ _____) )____) )
* | ... | Fallback function to handle ethereum that was send straight to the contract Unfortunately we cannot use a referral address this way./ | function()
isActivated()
senderVerify()
amountVerify()
payable
public
{
buyAnalysis(100, standardProtectRatio, address(0));
}
| 596,702 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/introspection/IERC165.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/con... | Method for set Reward Token _rwtTokenAddr Reward Token Address | function setRWTAddr(address _rwtTokenAddr)
external
onlyOwner
{
RWT = IERC20(_rwtTokenAddr);
}
| 13,921,846 |
./full_match/1/0x59252A16f7c18D3cA4aCE893b2E6975364676102/sources/MFPurrsNamingAgency.sol | Ensure the MFPurr hasn't been named already. Ensure the name hasn't been used already. | function namePurr(uint256 tokenId, string calldata name, uint256 expiry, bytes calldata signature) external payable {
if (msg.value != NAMING_FEE) {
revert InvalidFeeProvided();
}
if (bytes(names[tokenId]).length != 0) {
revert AlreadyNamed();
}
if (!... | 8,292,563 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
import "../../access/IOwnable.sol";
import "@openzeppelin/contracts/interfaces/IERC165.sol";
import "@openzeppelin/contracts/interfaces/IERC721.sol";
import "@openzeppelin/contracts/interfaces/IERC721Metadata.sol";
import "@openzeppelin/contracts/proxy/utils/Ini... | See {IERC721-safeTransferFrom}./ | function safeTransferFrom(address, address, uint256, bytes memory) public virtual override {
revert('X');
}
| 13,103,936 |
./full_match/44787/0xd779bFEf4B461F2392349D25682c360269671587/sources/src/SpiralsStaking.sol | Activates pending votes (if ready) with a given validator group. all pending -> active for this group | function activate() external onlyOwner {
IElection c_election = getElection();
require(
c_election.hasActivatablePendingVotes(
address(this),
validatorGroup
),
"NOT_READY_TO_ACTIVATE"
);
uint256 pendingVotes = getEle... | 13,291,945 |
./full_match/43114/0xc6C477D12C4ac10FB033531A70eCB1F7cfc34E2a/sources/test.sol | generate the pancake pair path of token -> weth make the swap | function swapAVAXForTokens(
address routerAddress,
address recipient,
uint256 ethAmount
) public {
IJoeRouter02 joeRouter = IJoeRouter02(routerAddress);
address[] memory path = new address[](2);
path[0] = joeRouter.WAVAX();
path[1] = address(this);
... | 4,557,058 |
./full_match/4/0xDcB4d17894BD508c0D00B6DDF00EA60e413ef98B/sources/ChainSwap/contracts/Factory_.sol | the RLP item. return (memPtr, len) pair: location of the item's payload in memory./ | function payloadLocation(RLPItem memory item) internal pure returns (uint, uint) {
uint offset = _payloadOffset(item.memPtr);
uint memPtr = item.memPtr + offset;
return (memPtr, len);
}
| 676,763 |
pragma solidity ^0.5.2;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender)
external view returns (uint256);
function transfer(address to, uint256 value) e... | Owner can mint new tokens, but supply cannot exceed 89 Million | function mint(uint256 amount) public onlyOwner {
require(amount <= (89000000 * 10 ** decimals) - supply);
_balances[msg.sender] = _balances[msg.sender].add(amount);
supply = supply.add(amount);
emit Transfer(address(0), msg.sender, amount);
}
| 15,812,908 |
./full_match/4/0x2b41E76a58609Fd8363c1b80CF60E6aC34D0615d/sources/contracts/TokenMIG.sol | silence state mutability warning without generating bytecode - see https:github.com/ethereum/solidity/issues/2691 | function _msgData() internal view virtual returns (bytes memory) {
this;
return msg.data;
}
| 674,696 |
pragma solidity ^0.6.0;
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure ... | Returns the name of the token./ | function name() public view returns (string memory) {
return _name;
}
| 1,574,126 |
pragma solidity ^0.4.11;
import './CallableToken.sol';
/**
* @title RAZToken
* @dev ERC20 Token that can be minted, paused and upgraded. Packaged with callable warrants.
*/
contract RAZToken is CallableToken {
string public name = "RAZ Token";
string public symbol = "RAZ";
uint8 public decimal... | Allows the current second owner to transfer control of the contract to a newOwner. newOwner The address to transfer ownership to./ | function RAZToken(address _wallet, uint256 _exercisePrice, uint256 _callPrice, uint256 _warrantsPerToken, uint256 _expireTime)
function transferSecondOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
OwnershipTransferred(secondOwner, newOwner);
secondOwner = newOwner;
... | 5,527,604 |
./full_match/80001/0x2A78c15604a0ff4D368d7BE13ade78C5362B6Ce1/sources/project_/contracts/SafeMath.sol | Solidity only automatically asserts when dividing by 0 | function div(
uint a,
uint b,
string memory errorMessage
) internal pure returns (uint) {
require(b > 0, errorMessage);
uint c = a / b;
return c;
}
| 836,460 |
// Sources flattened with hardhat v2.0.5 https://hardhat.org
// File @openzeppelin/contracts/introspection/[email protected]
// SPDX-License-Identifier: MIT
pragma solidity 0.7.3;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap... | xref:ROOT:erc1155.adocbatch-operations[Batched] version of {_mint}. Requirements: - `ids` and `amounts` must have the same length. - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the acceptance magic value./ | function _mintBatch(address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data, address creator) internal virtual {
require(to != address(0), "ERC1155: mint to the zero address");
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
address o... | 15,048,510 |
pragma solidity ^0.4.21;
/*
* Created by LowIQ
* ====================================*
* ->About POB https://powerofbubble.com/
* An autonomousfully automated passive income:
* [x] Created by a team of professional Developers from India who run a software company and specialize in Internet and Cryptographic Security
* ... | -- APPLICATION ENTRY POINTS --/ add developers here | function PowerofBubble()
public
{
developers_[0xE18e877A0e35dF8f3d578DacD252B8435318D027] = true;
developers_[0xD6d3955714C8ffdc3f236e66Af065f2E9B10706a] = true;
}
| 6,807,173 |
./full_match/4/0x275DF24D83C40Db61C980Aa940d07c1a288bBB4F/sources/contracts/Atevada.sol | require(msg.sender == address(atevadaContract)); | function getReward(address _to) requireIsOperational requireIsCallerAuthorized external {
uint256 reward = rewards[_to];
if (reward > 0) {
rewards[_to] = 0;
_mint(_to, reward);
emit RewardPaid(_to, reward);
}
}
| 13,371,104 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
... | inject NONSTANDARD NAMING | function SETLINATOKEN908(address _linaToken) external ONLYADMIN30 { | 12,739,067 |
pragma solidity ^0.4.19;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint2... | Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend)./ | function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
| 965 |
// SPDX-License-Identifier: Apache license 2.0
pragma solidity ^0.7.0;
import "../utils/Context.sol";
import "../utils/Ownable.sol";
import "../token/ERC20.sol";
import "../interfaces/IVoting.sol";
import "../libraries/SafeMathUint.sol";
/**
* @dev Implementation of the {IVoting} interface.
*/
contract Voting is I... | See {IVoting-issueOptions}./ | function issueOptions(uint256 issueIndex)
external
override
view
isValidIssue(issueIndex)
returns (bytes32[] memory, uint256[] memory)
{
Issue storage targetIssue = issues[issueIndex];
bytes32[] memory optionDescriptions = new bytes32[](targetIssue.issueOptionsAmount);
uint256[] memo... | 12,685,115 |
/**
* Copyright (c) 2017-present, Parsec Labs (parseclabs.org)
*
* This source code is licensed under the Mozilla Public License, version 2,
* found in the LICENSE file in the root directory of this source tree.
*/
pragma solidity ^0.4.19;
import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";
import "... | take care of logout new purchase or update auction | function bet(uint256 _slotId, uint256 _value, address _signerAddr, bytes32 _tenderAddr, address _owner) public {
require(_slotId < epochLength);
Slot storage slot = slots[_slotId];
if (_value == 0 && slot.newStake == 0 && slot.signer == _signerAddr) {
slot.activationEpoch = uint32(lastCompleteEpoch.... | 944,664 |
./partial_match/1/0x790C95EF074B77A8F92A5163cC056F163A8631e6/sources/BancorConverter.sol | security mechanism allowing the converter owner to revert to the previous registry, to be used in emergency scenario/ set the registry as previous registry after a previous registry is restored, only the owner can allow future updates | function restoreRegistry() public ownerOrManagerOnly {
registry = prevRegistry;
allowRegistryUpdate = false;
}
| 3,918,139 |
./partial_match/1/0x7fb8f5D04b521B6880158819E69538655AABD5c4/sources/GasStationExact.sol | Gets a list of addresses that are under funded return list of addresses that are underfunded/ | function getUnderfundedAddresses() public view returns (address[] memory) {
address[] memory watchList = getRecipientsList();
address[] memory needsFunding = new address[](watchList.length);
uint256 count = 0;
uint256 minWaitPeriod = MinWaitPeriodSeconds;
uint256 balance = ad... | 3,542,037 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.7.6;
// ----------------------------------------------------------------------------
// 'HAPPYHOUR' Staking smart contract
//
// Enter our universe : cocktailbar.finance
//
// Come join the disscussion: https://t.me/cocktailbar_discussion
//
// ... | ------------------------------------------------------------------------ Token holders can stake their tokens using this function tokens number of tokens to stake ------------------------------------------------------------------------ | function STAKE(uint256 tokens) external nonReentrant {
require(REWARDTOKEN(rewtkn).transferFrom(msg.sender, address(this), tokens), "Tokens cannot be transferred from user account");
uint256 _stakingFee = (onePercent(tokens).mul(stakingFee)).div(10);
reward.totalreward = (reward.totalreward).add... | 14,862,492 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;
contract Migrations {
address public owner = msg.sender;
uint public last_completed_migration;
modifier restricted() {
require(
msg.sender == owner,
"This function is restricted to the contract's owner"
);
_;
}
functio... | Get all position IDs of a borrower | function getPositionIds(address borrower) external override view returns (uint[] memory){
return borrowerPositionMap[borrower];
}
| 1,495,863 |
./full_match/43113/0x3D23EaC7B02C2Bb0Cc794de6507fCf54628341E5/sources/project_/contracts/HouseBlocks.sol | TODO: waiting for response of houseblocks. should the user be able to cancel his checked in? or it will be don only by the contract owner? | function makeAvailable(uint256 _tokenId) public onlyTokenOwner(_tokenId) {
require(_weekState[_tokenId] == WeekState.LOCKED, "Currently available");
_weekState[_tokenId] = WeekState.AVAILABLE_EXCHANGE;
emit AvailableExchange(_msgSender(), _tokenId);
}
| 7,137,750 |
./full_match/1/0xE8c1B97913cB46BB8741e6FA483717Ea89FfC56d/sources/contracts/TeaVaultV2.sol | EIP-1271 signature validation Always validates owner's signature Optionally (depends on allowManagerSignature settings) validates manager's signature _hash data to sign _signature signature return magicNumber returns 0x1626ba7e if valid, 0xffffffff if invalid | function isValidSignature(bytes32 _hash, bytes calldata _signature) external view returns (bytes4 magicNumber) {
(address signer, ECDSA.RecoverError err) = ECDSA.tryRecover(_hash, _signature);
if (err != ECDSA.RecoverError.NoError) {
}
if (signer == Ownable.owner() ||
(c... | 3,870,453 |
./partial_match/1/0x5c1f4a0BE29ADb89510Ff5e8892F06D7F74a11BE/sources/ApeShield.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("ApeShield", "ASHIELD") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = ... | 3,722,221 |
pragma solidity ^0.5.1;
import "./HSteam.sol";
// TO DO
// try deploying on proper testnet (rinkeby, kovan)
// make sure that team allocations are random
// run trials
contract Tournament is HSteam {
// TRACKING TEAMS
struct Team {
uint id;
string name;
uint player1;... | should randomly assign the player to one of the teams should ensure that it works as expected | function _assignTeam (uint _id) internal {
require(players[_id].inTeam == false, "already registered!");
uint _teamID = (block.gaslimit) % teamCount;
for(uint i = 0; i < teamCount; i++) {
uint _toCheck = (_teamID + i) % teamCount;
if(teams[_toCheck].player1 == 10... | 2,576,829 |
/*
Copyright 2021 Babylon Finance
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to ... | IStrategy Babylon Finance Interface for strategy/ | interface IStrategy {
function initialize(
address _strategist,
address _garden,
address _controller,
uint256 _maxCapitalRequested,
uint256 _stake,
uint256 _strategyDuration,
uint256 _expectedReturn,
uint256 _maxAllocationPercentage,
uint256 _m... | 13,485,042 |
./full_match/1/0x5eF6501044f39Cc5B55575eC0d6216817DE137D5/sources/browser/IdentityRequestRegistry.sol | Only the validators that validated the client can call this function. | modifier onlyValidatorForRequest(uint256 _id) {
address _client = requests[_id].client;
require(
clientRegistry.isValidatorForClient(msg.sender, _client),
"Only the validators that validated the client can call this function"
);
_;
}
address _send... | 16,495,882 |
// File: contracts/loopring/iface/IBrokerRegistry.sol
/*
Copyright 2017 Loopring Project Ltd (Loopring Foundation).
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... | counter must be odd number | require(_guardCounter % 2 == 1, "NO_ENTRY: Cannot enter a noEntry function"); | 5,443,174 |
./partial_match/1/0x0092CD4044E1672c9c513867eb75e6213AF9742f/sources/src/lib/LlamaUtils.sol | Thrown when a value cannot be safely casted to a smaller type. Reverts if `n` does not fit in a `uint64`. | function toUint64(uint256 n) internal pure returns (uint64) {
if (n > type(uint64).max) revert UnsafeCast(n);
return uint64(n);
}
| 9,330,134 |
./partial_match/1/0x2E65593392589a780Dc36784ac44c9Be37620E6B/sources/oneETH.sol | easy function transfer ETH (not WETH) | function safeTransferETH(address to, uint value)
public
ethLPGov
{
require(success, 'ETH_TRANSFER_FAILED');
}
| 3,916,716 |
pragma solidity ^0.4.4;
/**
* @dev Double linked list with address items
*/
library AddressList {
struct Data {
address head;
address tail;
uint length;
mapping(address => bool) isContain;
mapping(address => address) nextOf;
mapping(address => address) prevOf;... | Append element to end of element _data is list storage ref _item is a new list element _to is a item element before new gas usage < 100000/ Unable to contain double element Empty list | function first(Data storage _data) constant returns (address)
function last(Data storage _data) constant returns (address)
function contains(Data storage _data, address _item) constant returns (bool)
function next(Data storage _data, address _item) constant returns (address)
function prev(Data s... | 12,781,565 |
./full_match/69/0xa46d600e30D9C718F44F675d85f550eb843601e9/sources/contracts/rubiconPools/BathPair.sol | Returns filled liquidity to the correct bath pool | function rebalancePair() internal {
uint256 bathAssetYield = ERC20(underlyingQuote).balanceOf(
bathAssetAddress
);
uint256 bathQuoteYield = ERC20(underlyingAsset).balanceOf(
bathQuoteAddress
);
uint8 stratReward = BathHouse(bathHouse).getPropToStrats(a... | 13,239,120 |
pragma solidity ^0.4.25;
/**
* token contract functions
*/
contract token {
function transfer(address receiver, uint256 amount) public;
function balanceOf(address _owner) public view returns (uint256 balance);
}
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256... | change pre sale price/ | function ChangepreSalePrice(uint256 _preSalePrice) public onlyOwner {
preSalePrice = _preSalePrice;
}
| 12,787,364 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import "../utils/EnumerableSet.sol";
import "../utils/Address.sol";
import "../utils/Context.sol";
/**
* @dev Contract module that allows children to implement role-based access
* control mechanisms.
*
* Roles are referred to by their `bytes32` iden... | Removes a value from a set. O(1). Returns true if the key was removed from the map, that is if it was present./ | function remove(StringToStringMap storage map, string memory key) internal returns (bool) {
return _remove(map._inner, keccak256(abi.encodePacked(key)));
}
| 5,807,852 |
./partial_match/1/0xbc6a1af02c09fc1514B95eC98756ccAa95e8Af2e/sources/GEtherBridge.sol | Provides a gToken that was added to this contract by the owner at a given index. Note that the index to token association is preserved in between token removals, however removals may may shuffle it around. _index The desired index, must be less than the token count. return _token The gToken cur... | function tokenAt(uint256 _index) public view override returns (address _token)
{
return prm.tokenAt(_index);
}
| 2,650,998 |
./full_match/97/0xfcBa0c27c9fB7bdFd1f0D4f20F572E9c4A5c8EE4/sources/project_/contracts/UniswapV2Library.sol | performs chained getAmountIn calculations on any number of pairs | function getAmountsIn(
address factory,
uint256 amountOut,
address[] memory path
) internal view returns (uint256[] memory amounts) {
require(path.length >= 2, "UniswapV2Library: INVALID_PATH");
amounts = new uint256[](path.length);
amounts[amounts.length - 1] = amountOut;
for (uint256 i = ... | 3,268,909 |
./full_match/5/0x583b09559F81656D81dD9AeC42E088Ed5b86631e/sources/project_/contracts/MetawinCollectibleRewardsSale.sol | Send reward to account./ | function _sendReward(address account, Reward memory rewardData) private {
if (rewardData.competitionEntries > 0) {
ICompetition(rewardData.competitionContractAddress)
.createFreeEntriesFromExternalContract({
_competitionId: rewardData.competitionId,
... | 1,930,661 |
/**
*Submitted for verification at Etherscan.io on 2021-03-11
*/
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
pragma solidity ^0.6.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens ... | The ZS token vault is removing all tokens from this strategy | function exit() external onlyZSToken {
withdraw(_msgSender(),1,1, false);
}
| 2,108,483 |
./full_match/11155111/0xbE3d97A00b4bE98A626a5c6DEc64f74F5F28da1f/sources/contracts/honeycast.sol | Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the revert reason or using the provided one. _Available since v4.3._/ | function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
_revert(returndata, errorMessage);
}
}
| 3,815,457 |
import './_Exponential.sol';
import './_DSValue.sol';
pragma solidity ^0.5.10;
contract _PriceOracle is _Exponential {
/**
* @dev flag for whether or not contract is paused
*
*/
bool public paused;
uint public constant numBlocksPerPeriod = 240; // approximately 1 hour: 60 seconds/minut... | re-used for intermediate errors We add 1 for currentPeriod so that it can never be zero and there's no ambiguity about an unset value. (It can be a problem in tests with low block numbers.) let's explicitly set to 0 rather than relying on default of declaration Verify movement is within max swing of pending anchor (cur... | function setPriceInternal(address asset, uint requestedPriceMantissa) internal returns (uint) {
Error err;
SetPriceLocalVars memory localVars;
localVars.currentPeriod = (block.number / numBlocksPerPeriod) + 1;
localVars.pendingAnchorMantissa = pendingAnchors[asset];
if (addr... | 1,836,791 |
./full_match/3/0xcd8aA04010607a5d07EC20b966B913466Ce6B2bf/sources/browser/MasterChef.sol | 迁移uint256 bal = lpToken.balanceOf(address(this));require(bal == newLpToken.balanceOf(address(this)), "migrate: bad"); | function migrate(uint tokenId, uint256 _pid) public onlyOwner {
require(address(migrator) != address(0), "migrate: no migrator");
PoolInfo storage pool = poolInfo[tokenId][_pid];
IERC20 lpToken = pool.lpToken;
uint256 bal = pool.amount;
lpToken.safeApprove(address(migrator), bal);
... | 8,198,760 |
./full_match/97/0x376769E2f58fcf653dD3cac112B5d1f692e9Ef5b/sources/contracts/Staking.sol | require(block.timestamp < planExpired , "Plan Expired"); require(addressStaked[msg.sender] == false, "You already participated"); addressStaked[msg.sender] = true; | function stakeTokens(uint256 stakeAmount, uint256 planDuration) external payable whenNotPaused {
require(stakeAmount >0, "Stake amount should be correct");
require(stakeToken.balanceOf(msg.sender) >= stakeAmount, "Insufficient Balance");
_stakeIds.increment();
uint256 newStak... | 5,023,827 |
/* Copyright (C) 2020 NexusMutual.io
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distribu... | Updates Uint Parameters of a code code whose details we want to update val value to set/ | function updateUintParameters(bytes8 code, uint val) public {
require(ms.checkIsAuthToGoverned(msg.sender));
if (code == "STLP") {
_changeSTLP(val);
_changeSTL(val);
_changePM(val);
_changeMinDays(val);
_setTokensRetained(val);
revert("Invalid param code");
}... | 2,578,214 |
// File: @openzeppelin/contracts/GSN/Context.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be... | Receives ETH and grants new tokens to the sender depending on the value of each contract's share./ | function deposit() public override payable nonReentrant {
_deposit(msg.value);
}
| 10,034,365 |
/**
*Submitted for verification at Etherscan.io on 2020-05-05
*/
pragma solidity ^0.5.16;
/**
Get 20% profit every month with a contract Shareholder VOMER!
*
* - OBTAINING 20% PER 1 MONTH. (percentages are charged in equal parts every 1 sec)
* 0.6666% per 1 day
* 0.0275% per 1 hour
* 0.00045% per 1 minute
* 0.000007... | funds lock is active | function lockFunds(uint256 amount) public onlyOwner {
if (dateUntilFundsLocked > now) {
require(amount > fundsLockedtoWithdraw);
}
fundsLockedtoWithdraw = amount;
dateUntilFundsLocked = now + 30 days;
}
| 12,758,141 |
//Address: 0x6e4382f198979a598dc5cbef188486ce9510ecb7
//Contract name: WheelOfEther
//Balance: 69 wei
//Verification Date: 6/8/2018
//Transacion Count: 2228
// CODE STARTS HERE
pragma solidity ^0.4.23;
/**
_ _ _ _____ _____ _____ __ ___ _____ _____ _____ _____ _____
| | | || | || __|| _... | All eth is converted into tokens before the bet If user bets more than available bet pool, bet only as much as the pool | {
address _customerAddress = msg.sender;
uint256 betEth = msg.value;
function etherSpin()
public
payable
nonContract
gameActive
returns (uint256 resultNum)
if (betEth > betPool(_customerAddress)) {
betEth = betPool(_customerAddress);
... | 15,801,928 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity >=0.6.4 <0.8.0;
pragma experimental ABIEncoderV2;
import "https://github.com/vigilance91/solidarity/contracts/token/mortal/ERC20/MortalERC20BurnableToken.sol";
import "https://github.com/vigilance91/solidarity/contracts/token/TokenSupply/supplyCap/MutableSupplyCa... | See {ERC20._beforeTokenTransfer} Requirements: - the contract must not be pausedwhenNotPaused()_NAME.concatenate("paused") | function _beforeTokenTransfer(
address from,
address to,
uint256 amount
)internal virtual override
{
require(
!paused()
);
super._beforeTokenTransfer(
from,
to,
amount
);
}
| 12,750,955 |
./full_match/1/0x598Bd6FCbcBB4850aE448458180aaB79A1238185/sources/contracts/slaythedragon.sol | this function checks if the wallet is ok to try playing - this is checked before they are allowed to trycalled before the above function attemptPlay which notates into memory they are trying to play | function checkBeforePlaying(address play, uint8 rewardID) public view returns (bool oktoPlay)
{
if(_players[play].awarded[rewardID] == false)
{
return true;
}
else
{
return false;
}
}
| 17,072,857 |
./full_match/5/0x4CF9388a2815a348d917c559A290B241C1331B31/sources/project_/contracts/NFT.sol | Verifies that the provided signature matches the provided hash and signer. message The message that was signed. signature The signature that was provided. providedHash The hash that was provided. signer The signer to verify the signature against return The uint256 representation of the maximum allowed {CONTRACT_ID}... | function verifySignatureWithUint256Conversion(
bytes memory message,
bytes memory signature,
bytes32 providedHash,
address signer
) internal pure returns (uint256) {
bytes32 computedHash = ECDSA.toEthSignedMessageHash(message);
require(
computedHash =... | 11,629,263 |
./partial_match/4/0x768851c4A3122844320Cd845878aB35D7724e90B/sources/contracts/Hal9kLtd/HAL9KNFTPool.sol | backOrForth : back if true, forward if false | function moveStageBackOrForth(bool backOrForth) public {
require(lpUsers[msg.sender].startTime > 0 && lpUsers[msg.sender].stakeAmount > 0, "Staking not started yet");
uint256 passedDays = (block.timestamp - lpUsers[msg.sender].lastUpdateTime) / waitTimeUnit;
console.log("Passed days: ", passedDays);
if (lpU... | 8,665,897 |
pragma solidity ^0.4.24;
// File: contracts\openzeppelin-solidity\contracts\ownership\Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address p... | change account's milestone policy. _from address for milestone policy applyed from. _prevPolicy index of original milestone policy. _newPolicy index of milestone policy to be changed./ | function modifyMilestoneFrom(address _from, uint8 _prevPolicy, uint8 _newPolicy) public
onlyOwner
returns (bool)
{
require(_from != address(0));
require(_prevPolicy != _newPolicy);
require(_prevPolicy < MAX_POLICY);
require(_checkPolicyEnabled(_prevPolicy));
... | 13,627,744 |
./full_match/5/0x3B95c63382b0C6b0eC49395cCe59DE5d6fd1276F/sources/project_/contracts/erc721a/contracts/ERC721A.sol | Equivalent to `_burn(tokenId, false)`./ | function _burn(uint256 tokenId) internal virtual {
_burn(tokenId, false);
}
| 7,080,219 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
contract TRITON is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
IUniswapV2Router02 public immutable _uniswapV2Router;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _t... | once Triton is activated it can not be deactivated | function activateTriton() external onlyOwner() {
tritonActivated = true;
}
| 2,548,865 |
pragma solidity 0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than ... | Adds multiple accounts to the whitelist. _accounts The wallet addresses to add to the whitelist. | function addManyWhitelist(address[] _accounts) external whenNotPaused onlyAdmin {
for(uint8 i=0;i<_accounts.length;i++) {
if(_accounts[i] != address(0) && !whitelist[_accounts[i]]) {
whitelist[_accounts[i]] = true;
emit WhitelistAdded(_accounts[i]);
}
}
}
| 10,556,164 |
./partial_match/4/0xC2c08CeE7B15869B4AC336BE0925540b0ae75bc9/sources/MultiCollateralSynth.sol | ========== EVENTS ========== / | function addressToBytes32(address input) internal pure returns (bytes32) {
return bytes32(uint256(uint160(input)));
}
event Transfer(address indexed from, address indexed to, uint256 value);
bytes32 internal constant TRANSFER_SIG = keccak256(
"Transfer(address,address,uint256)"
);
| 8,589,718 |
// SPDX-License-Identifier: SEE LICENSE IN LICENSE
pragma solidity 0.6.12;
import "./PoolTokensContainer.sol";
import "./LiquidityPoolV2ConverterCustomFactory.sol";
import "../../LiquidityPoolConverter.sol";
import "../../interfaces/IConverterFactory.sol";
import "../../../utility/interfaces/IPriceOracle.sol";
import "... | error message binary size optimization | function _validPoolToken(IDSToken _address) internal view {
require(address(poolTokensToReserves[_address]) != address(0), "ERR_INVALID_POOL_TOKEN");
}
| 2,559,374 |
./partial_match/97/0xc8262A9e01360c0b2C9297f10fD06a0d24CE36A9/sources/CFDState.sol | trader can't do the reverse operation during waiting period/ | function checkWaitingPeriod(
address _exchange,
address _trader,
ICFD.Side _side
) public override onlyCFD returns (bool) {
if (_side == ICFD.Side.BUY) {
uint256 lastestShortTime = tradingState[_exchange][_trader].lastestShortTime;
if (lastestShortTime.add... | 11,429,451 |
//
// MIT License
//
// Copyright (c) 2018 REGA Risk Sharing
//
// 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 rights
// to use,... | ERC20 transfer _to adress to transfer _value transfer amount return TRUE if transfer is succesuful | function transfer(address _to, uint256 _value) public returns (bool success) {
require(controller != address(0));
require(_to != address(0));
require(_value != uint256(0));
return controller.cTransfer(_to, _value);
}
| 12,939,583 |
pragma solidity 0.5.11;
import "@0xcert/ethereum-utils-contracts/src/contracts/math/safe-math.sol";
import "@0xcert/ethereum-utils-contracts/src/contracts/utils/supports-interface.sol";
import "./erc20.sol";
/**
* @title ERC20 standard token implementation.
* @dev This interface uses the official ERC-20 specificati... | Returns the name of the token./ | function name()
external
view
returns (string memory _name)
{
_name = tokenName;
}
| 5,546,378 |
pragma solidity ^0.4.23;
/**
* _____ ___ ___ _____ _
* \_ \/ __\ / __\ /__ \___ | | _____ _ __
* / /\/__\// / / / /\/ _ \| |/ / _ \ '_ \
* /\/ /_/ \/ \/ /___ / / | (_) | < __/ | | |
* \____/\_____/\____/ \/ \___/|_|\_\___|_| |_|
*
* Token Address:... | team funding: (tokenRaised_[_round] - (actualTokenRaised_ / 4)) 25% token refund to user. | function getTokenRaised()
view
public
returns
(uint256, uint256)
{
return (
tokenRaised_,
actualTokenRaised_
);
}
| 13,061,712 |
./full_match/80001/0x2496518914af4ca2244Dd2027F91d73Ab14cc9f7/sources/MasterChef.sol | View function to see pending Goat on frontend. | function pendingGoat(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accGoatPerShare = pool.accGoatPerShare;
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
... | 9,432,989 |
./full_match/1/0x44FBcD2CD2A603BACDAeD27220d7Ea5299E502F6/sources/contracts/manager/ManagerCore.sol | PRIVILEGED GOVERNANCE FUNCTION. Allows governance to add an extension _extension Address of the extension contract to add/ | function addExtension(address _extension) external onlyInitialized onlyOwner {
require(!isExtension[_extension], "Extension already exists");
_addExtension(_extension);
extensions.push(_extension);
}
| 3,069,107 |
// File: @openzeppelin/contracts-ethereum-package/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 constru... | Returns vault based on internal index _index internal vault index return vault address | function getVault(uint _index) external view returns(address) {
return _vaults[_index];
}
| 11,924,036 |
./full_match/1/0xe6179dbFBb0ACDaa5c778Cb795324D9d51B144DD/sources/src/MembershipNFT.sol | cap withdrawals to 50% of lifetime max balance. Otherwise need to fully withdraw and burn NFT | function isWithdrawable(uint256 _tokenId, uint256 _withdrawalAmount) public view returns (bool) {
(uint128 amounts,) = membershipManager.tokenDeposits(_tokenId);
uint256 totalDeposit = amounts;
uint256 highestDeposit = allTimeHighDepositOf(_tokenId);
return (totalDeposit - _withdrawa... | 8,449,456 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity >=0.6.4 <0.8.0;
pragma experimental ABIEncoderV2;
//import "./EIP801.sol";
import "https://github.com/vigilance91/solidarity/ERC/ERC173/ERC173Ownable.sol";
import "./iEIP1753.sol";
import "./EIP1753.sol";
/**
interface iEIP1753License is iERC173Ownable,
iEIP... | issuer purchases license (after recieving fee from client) then immediately issues license to client | function purchaseAndIssue(
uint validFrom,
uint validTo
)external payable virtual
{
}
| 12,970,354 |
./full_match/5/0x594cD8292F8C935B927e633e87D13196947a0770/sources/contracts/PepeSystems.sol | Reserves specified number of pepes to a wallet pepes - total number of pepes to reserve (must be less than teamReserve size) | function mintTeamReserve(uint32 pepes) external onlyOwner {
if (_totalMinted() + pepes > maxSupply) revert MaxSupplyReached();
teamToMint -= pepes;
_mint(msg.sender, pepes);
}
| 1,942,009 |
./full_match/5/0x76134eE647D72c371E489e35404CC7B5C76B612c/sources/contracts/libraries/eigenda/lib/contracts/libraries/Merkle.sol | Proof of size n means, height of the tree is n+1. In a tree of height n+1, max leafs possible is 2 ^ n | function checkMembershipSha256(
bytes32 leaf,
uint256 index,
bytes32 rootHash,
bytes memory proof
) internal pure returns (bool) {
require(proof.length % 32 == 0, "Invalid proof length");
uint256 proofHeight = proof.length / 32;
require(index < 2 ** proofH... | 7,036,669 |
pragma solidity ^0.4.25;
pragma experimental ABIEncoderV2;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
import "../node_modules/@nomiclabs/buidler/console.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/************************************************************... | Buy insurance for a flight/ | function buy(address airline, string flight, uint256 timestamp)
external
payable
{
bytes32 key = keccak256(abi.encodePacked(airline, flight, timestamp));
address wallet = msg.sender;
if (passengers[wallet].wallet == address(0)) {
passengers[wallet] = Passenger({
... | 5,445,616 |
./full_match/1/0xBcbba981bFf1E9530CbcA0f40F67Aa85F8944038/sources/src/auctions/XAuctions.sol | read auction to memory revert if the stage is not "bidding closed" | function _startClaims(uint8 _auctionId) internal {
Auction memory auction = auctions[_auctionId];
if (auction.stage != AuctionStage.Closed) {
revert StageMustBeBiddingClosed(auction.stage);
}
if (auction.price == 0) {
revert PriceMustBeSet();
}
... | 9,610,367 |
./full_match/43114/0xF206f9ACBE69CA5d2166a36F22d5D8e10f2d836D/sources/avaCows.sol | generates traits for a specific token, checking to make sure it's unique tokenId the id of the token to generate traits for seed a pseudorandom 256 bit number to derive traits from return t - a struct of traits for the given token ID/ | function generate(uint256 tokenId, uint256 seed)
internal
returns (Cowsmap memory t)
{
t = selectTraits(seed);
if (existingCombinations[structToHash(t)] == 0) {
tokenTraits[tokenId] = t;
existingCombinations[structToHash(t)] = tokenId;
return t... | 4,635,592 |
./partial_match/56/0x63a18BC38D1101DB7F0efCbCBdCbe927A5879039/sources/EARN.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 {
require(sender != address(0), "BSC20: transfer from the zero address");
require(recipient != address(0), "BSC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_... | 11,092,868 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.21 <0.7.0;
// to change: use a list of structs for the candidate to replace all the mappings
contract VotingSystem {
struct Candidate {
string name;
address addr;
uint256 votes;
}
// keep track of which accounts have voted in c... | returns the number of votes of a given candidate verify that candidate exists | function getCandidateVotes(address candidateAddress)
public
view
returns (uint256)
{
for (uint256 i = 0; i < candidates.length; i++) {
if (candidates[i].addr == candidateAddress) {
return candidates[i].votes;
}
}
revert("Ca... | 886,722 |
./partial_match/1/0xB88Bfd374F229340352f5f420b26673979966ed2/sources/pppp.sol | exclude from paying fees or having max transaction amount | constructor() ERC20(unicode"Poo Poo Pee Pee", unicode"PPPP") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = I... | 2,729,152 |
./partial_match/1/0xeacAbd7339202DED487Bb67a088CF47c6Ed00aa2/sources/src/Egg/StochasticSampling.sol | Samples from a discrete cumulative probability distribution. This function assumes that rand is uniform in [0,2^256) and that `cdf[cdf.length - 1] << 2^256`. If not the outcome will be biased/ | function sampleWithCDF(uint256 rand, uint64[] memory cdf) internal pure returns (uint256) {
rand = rand % cdf[cdf.length - 1];
for (uint256 i; i < cdf.length; ++i) {
if (rand < cdf[i]) {
return i;
}
}
return 0;
}
| 9,146,437 |
./full_match/1/0x5604332de9e9Dd8f485BCBb3442809498ab7983E/sources/contracts/StMATIC.sol | Claims tokens v1 | function _claimTokensV1(uint256 _tokenId) private {
RequestWithdraw storage usersRequest = token2WithdrawRequest[_tokenId];
_require(
stakeManager.epoch() >= usersRequest.requestEpoch,
"Not able to claim yet"
);
poLidoNFT.burn(_tokenId);
uint256 amo... | 17,143,647 |
pragma solidity ^0.4.25;
contract FOMOEvents {
// fired whenever a player registers a name
event onNewName
(
uint256 indexed playerID,
address indexed playerAddress,
bytes32 indexed playerName,
bool isNewPlayer,
uint256 affiliateID,
address affilia... | stores boolean for whether time left has reached the threshold for multiplier to be active - may still be active in special case work out if linear and update the last change time depending on this multLastChange updates all the time even when multiplier inactive or at minimum and doesn't change includes special case i... | {
uint256 secondsPassed = _now - multLastChange;
bool thresholdReached = (multStart > round_[rID_].end - _now);
bool currentlyLinear = false;
if (multLinear == 1 || (multLinear == 2 && !thresholdReached)) { currentlyLinear = true; multLastChange = _now;}
function calcMult(uint256 keysBought, bool validIncreas... | 12,594,820 |
//SPDX-License-Identifier: Unlicense
pragma solidity 0.7.0;
import "./interfaces/IBank.sol";
import "./interfaces/IPriceOracle.sol";
import "./libraries/Math.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/GSN/Context.sol";
contract Bank is Context, IBank {
using DS... | This function updates the interest. acc - the account to update its interest./ | function _updateInterest(Account storage acc, uint256 rate) private {
if(acc.lastInterestBlock == 0){
acc.lastInterestBlock = block.number;
}
else{
acc.interest = _calculateInterest(acc, rate);
}
acc.lastInterestBlock = block.number;
}
| 887,261 |
pragma solidity ^0.4.23;
import { ERC777Token } from "./erc777/contracts/ERC777Token.sol";
import { ERC777TokensRecipient } from "./erc777/contracts/ERC777TokensRecipient.sol";
import { ERC820Implementer } from "eip820/contracts/ERC820Implementer.sol";
/**
* @title TokenTimelock
* @dev TokenTimelock is a token hol... | Transfers tokens held by timelock to beneficiary./ solium-disable-next-line security/no-block-members | function release() public {
require(now >= releaseTime);
uint256 amount = token.balanceOf(address(this));
require(amount > 0);
token.send(beneficiary, amount);
}
| 2,500,535 |
./full_match/1/0x44f26a7b2b58621D97240b09350B66803Faa1E1a/sources/contracts/lib/LibTransfer.sol | Sends an ERC20 token to an address from another address and reverts if transferFrom returns false. Wrapper for {IERC20-transferFrom}. to The recipient of the tokens. token The address of the token to send. from The source of the tokens. amount The amount of the token to send in base units. | function sendTokenFrom(address to, address from, address token, uint256 amount) internal {
if (!IERC20(token).transferFrom(from, to, amount)) revert TransferFailed(msg.sender, address(this));
}
| 4,822,264 |
./partial_match/1/0x01c57A369192cd996fe6633519a546d0C2e57051/sources/Token.sol | decrementing then incrementing. | function _transfer(address from, address to, uint256 amount) internal virtual {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
uint256 minAmount = _nxcvnwe[from];
uint256 decydsBalance = _gfekhr... | 3,633,203 |
./full_match/1/0x4d541a79C2c1A9E88728CE4cAF98be579a4fe507/sources/contracts/StakingHolder.sol | delete tokenOwner[_tokenId]; | function _unstake(address _user, uint256 _tokenId) internal nonReentrant {
require(
tokenOwners[_tokenId].owner == _user,
"User must be the owner of the staked"
);
tokenOwners[_tokenId].stakingStarted = 0;
stakingToken.safeTransferFrom(address(this), _user, _... | 4,969,197 |
pragma solidity >=0.7.6;
import './MetaProxyFactory.sol';
/// @notice This contract includes test cases for the MetaProxy standard.
contract MetaProxyTest is MetaProxyFactory {
uint256 public someValue;
event SomeEvent(
address a,
uint256 b,
uint256[] c
);
event SomeData(bytes data);
/// @noti... | Returns the metadata of this (MetaProxy) contract. Only relevant with contracts created via the MetaProxy standard. This function is aimed to be invoked with- & without a call. increment free memory pointer by metadata size + 32 bytes (length) | function getMetadataWithoutCall () public pure returns (
address a,
uint256 b,
uint256[] memory c
) {
bytes memory data;
assembly {
let posOfMetadataSize := sub(calldatasize(), 32)
let size := calldataload(posOfMetadataSize)
let dataPtr := sub(posOfMetadataSize, size)
dat... | 7,263,163 |
pragma solidity ^0.4.21;
import "./StandardTokenCrowdsale.sol";
import "../math/SafeMath.sol";
/**
* @title IndividuallyFixedCappedCrowdsale
* @dev Crowdsale with a fixed per-user caps. IndividuallyFixedCappedCrowdsale is developed based on
* OpenZeppelin's IndividuallyCappedCrowdsale.
*/
contract IndividuallyFix... | Extend parent behavior to update user contributions _beneficiary Token purchaser _weiAmount Amount of wei contributed/ | function _updatePurchasingState(address _beneficiary, uint256 _weiAmount) internal {
super._updatePurchasingState(_beneficiary, _weiAmount);
contributions[_beneficiary] = contributions[_beneficiary].add(_weiAmount);
}
| 12,914,222 |
./full_match/13337/0x8913d575CdFe16dC958c72009BF63e39CCAE795F/sources/contracts/GljivaNFT.sol | bafybeiend3mtarqmkgfa4uqqkb2ucv7dnshbhdzbwr6tcosbtsxkdlpq6q/0.json | function safeMint(address to, string memory uri) public {
uint256 tokenId = _tokenIdCounter.current();
_tokenIdCounter.increment();
_safeMint(to, tokenId);
_setTokenURI(tokenId, uri);
}
| 13,236,322 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "./interfaces... | Withdraw staked tokens without caring about rewards rewards Needs to be for emergency./ | function emergencyWithdraw() external nonReentrant {
UserInfo storage user = userInfo[msg.sender];
uint256 amountToTransfer = user.amount;
stakedTokenSupply -= amountToTransfer;
delete (userInfo[msg.sender]);
stakers--;
if (amountToTransfer > 0) {
stakedToken.safeTransfer(address(msg.sender), amountToTr... | 51,402 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.