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/1/0x83FE4b074A2f60e04b48189167B81F95dC94fAbD/sources/Stakecsx.sol | Withdraw staked tokens and collect reward tokens _amount: amount to withdraw (in rewardToken)/ | function withdraw(uint256 _amount) external nonReentrant {
UserInfo storage user = userInfo[msg.sender];
require(user.amount >= _amount, "Amount to withdraw too high");
_updatePool();
uint256 pending = user
.amount
.mul(accTokenPerShare)
.div(PRE... | 5,001,625 |
./full_match/43113/0x356a6FFe55C56a728AA0105d5069F0FfBdfC8205/sources/project:/contracts/superfluid/SuperfluidToken.sol | ISuperfluidToken.makeLiquidationPayoutsV2 implementation we set the rewardAccount to the user who executed the liquidation if no rewardAccount is set (aka. ANARCHY MODE - should not occur in reality, for testing purposes) LIKELY BRANCH: target account pays penalty to rewarded account LESS LIKELY BRANCH: target account ... | function makeLiquidationPayoutsV2(
bytes32 id,
bytes memory liquidationTypeData,
) external virtual override onlyAgreement {
address rewardAccount = _getRewardAccount();
if (rewardAccount == address(0)) {
rewardAccount = liquidatorAccount;
}
address ... | 7,192,713 |
./full_match/80001/0xD020917Bc396787375AcE783DF896d14aDF18FB6/sources/src/exchange/libraries/TransferHelper.sol | Transfer an ERC1155 token token - The contract address of the token to be transferred from - The originating address from which the tokens will be transferred to - The destination address of the transfer id - The tokenId of the token to be transferred amount - The amount to be transferred | function _transferFromERC1155(address token, address from, address to, uint256 id, uint256 amount) internal {
IERC1155(token).safeTransferFrom(from, to, id, amount, "");
}
| 9,433,524 |
pragma solidity ^0.4.21;
/**
* @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;
}
uint... | Uitl function to calculate total supply according to total user amount. _userAmount total user amount./ | function calTotalSupply(uint _userAmount) private view returns (uint ret) {
uint tokenAmount = 0;
for (uint8 i = 0; i < MINING_LAYERS.length ; i++ ) {
if(_userAmount < MINING_LAYERS[i+1]) {
tokenAmount = tokenAmount.add(MINING_REWARDS[i].mul(_userAmount.sub(MINING_LAYERS[i])));
break;
... | 2,432,879 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
import "contracts/ERC721SW.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
contract GlitchGirlsReloaded is ERC721SW, Ownable {
address internal _GGContractAddress;
mapping(address => in... | Returns the number of tokens minted by `owner`./ | function _numberMinted(address owner) internal view returns (uint256) {
return uint256(_addressData[owner].numberMinted);
}
| 232,699 |
./full_match/100/0x7993Bb17D8D8A0676Cc1527f8b4CE52A2B490352/sources/contracts/core/connext/facets/PortalFacet.sol | Used by routers to perform a manual repayment to Aave Portals to cover any outstanding debt The router must be approved for portal and with enough liquidity, and must be the caller of this function. If the asset is not whitelisted, must use the `repayAavePortalFor` function. _params TransferInfo associated with the t... | function repayAavePortal(
TransferInfo calldata _params,
uint256 _backingAmount,
uint256 _feeAmount,
uint256 _maxIn
) external nonReentrant {
bytes32 key = AssetLogic.calculateCanonicalHash(_params.canonicalId, _params.canonicalDomain);
if (!s.tokenConfigs[key].approval) {
revert Port... | 14,285,218 |
... | inject NONSTANDARD NAMING | function BALANCEOF516(address account) external view returns (uint); | 5,441,318 |
./full_match/1/0x4EA67AeBb61f7Ff6E15E237C8b79D29C41F750fd/sources/contracts/auction/BrandCentralClaimAuction.sol | Based on the start block and auction length in days, returns the current day of the auction | function currentDayOfAuction() public view returns (uint256) {
if (_blockNumber() < startBlock) {
return 1;
}
uint256 day;
for(uint i = 0; i < AUCTION_LENGTH_IN_DAYS; i++) {
day += 1;
uint256 lastBlockOfTheDay = startBlock + (day * BLOCKS_PER_DA... | 8,328,488 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/utils/EnumerableSet.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/acc... | Deposit LP tokens to BagBang for reward allocation. | function deposit(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
updatePool(_pid);
if (user.amount > 0) {
uint256 pending = user.amount.mul(pool.accRewardPerShare).div(1e24).sub(user.rewar... | 14,774,199 |
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/math/SignedSafeMathUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol";
import "@... | Moves `amount` of tokens from `sender` to `recipient`. This 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), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender... | 5,794,483 |
./full_match/1/0xfdaFc9d1902f4e0b84f65F49f244b32b31013b74/sources/src/ComposableCoW.sol | Get the `GPv2Order.Data` and signature for submitting to CoW Protocol API owner of the order params `ConditionalOrderParams` for the order offchainInput any dynamic off-chain input for generating the discrete order proof if using merkle-roots that H(handler || salt || staticInput) is in the merkle tree return order... | function getTradeableOrderWithSignature(
address owner,
IConditionalOrder.ConditionalOrderParams calldata params,
bytes calldata offchainInput,
bytes32[] calldata proof
) external view returns (GPv2Order.Data memory order, bytes memory signature) {
bytes32 ctx = _auth(own... | 3,132,812 |
pragma solidity ^0.4.25;
// It's important to avoid vulnerabilities due to numeric overflow bugs
// OpenZeppelin's SafeMath library, when used correctly, protects agains such bugs
// More info: https://www.nccgroup.trust/us/about-us/newsroom-and-events/blog/2018/november/smart-contract-insecurity-bad-arithmetic/
impo... | Register an oracle with the contract Require registration fee | function registerOracle() external payable
{
require(msg.value >= REGISTRATION_FEE, "Registration fee is required");
uint8[3] memory indexes = generateIndexes(msg.sender);
oracles[msg.sender] = Oracle({
isRegistered: true,
... | 2,521,723 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/utils/EnumerableSet.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/acc... | Update the given pool's CVP allocation point. Can only be called by the owner. | function set(
uint256 _pid,
uint256 _allocPoint,
uint8 _poolType,
bool _votesEnabled
) public onlyOwner {
massUpdatePools();
totalAllocPoint = totalAllocPoint.sub(poolInfo[_pid].allocPoint).add(_allocPoint);
poolInfo[_pid].allocPoint = _allocPoint;
poolInfo[_pid].votesEnabled = _vote... | 14,088,776 |
pragma solidity ^0.4.24;
/** @title PEpsilon
* @author Daniel Babbev
*
* This contract implements a p + epsilon attack against the Kleros court.
* The attack is described by VitaliK Buterin here: https://blog.ethereum.org/2015/01/28/p-epsilon-attack/
*/
contract PEpsilon {
Pinakion public pinakion... | Setter for alpha. _alpha Alpha in ‱./ | function setAlpha(uint _alpha) public onlyGovernor {
alpha = _alpha;
}
| 1,073,871 |
./full_match/80001/0xe75DEa14d684b4D91067e6C40C159c33eF36D1AA/sources/contracts/Ignite/Tournament.sol | reimburse user after tournament | function reimburse() external onlyFactory{
require(block.timestamp < _startTime,"AS");
for (uint256 i = 1; i < _playerID; i++) {
if (playerbyId[i].isDeleted == false) {
registrationVault.transfer(
playerbyId[i].playersAdd,
_registr... | 5,556,387 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.9;
import "ds-test/test.sol";
contract AccumulatorTest is DSTest {
function youShallNotPass(uint16[10] memory inputs) pure public {
uint32 accumulator = 1;
unchecked {
for (uint i = 0; i < 10; i++) {
acc... | require(inputs[0] == 0x0104); <--- can't get this constraint to be satisfied | function proveFail_weShallActuallyPassWithConstraints(uint16[10] memory inputs) public {
require(inputs[1] == 1);
require(inputs[2] & 0xff00 == 0xff00);
youShallNotPass(inputs);
}
| 12,876,503 |
./partial_match/1/0x63a60C5469379149757Cc3e58453202eBDB7e933/sources/Wager.sol | Changes the maximum amount of tokens that can be bought or sold in a single transaction newNum Base 1000, so 1% = 10 | function updateMaxTxnAmount(uint256 newNum) external onlyOwner {
require(newNum >= 2, "Cannot set maxTx lower than 0.2%");
maxTx = (newNum * totalSupply()) / 1000;
}
| 2,808,156 |
./partial_match/1/0xB2334249a16152C3FB71C3431EBCdAd555130325/sources/SmartMonkeys.sol | Set a single value on a token metadata key. tokenId the token identifier. key the token metadata key. value the token metadata value./ | function _setValue(uint256 tokenId, bytes32 key, bytes memory value) internal {
bytes[] memory values = new bytes[](1);
values[0] = value;
_setValues(tokenId, key, values);
}
| 9,197,731 |
pragma solidity 0.5.11;
contract RarityProvider {
uint16[] legendaries = [
801, 811, 818, 819, 824, 825, 826, 827, 828, 829, 830, 831, 832, 833, 834, 835,
846, 847, 858, 859, 870, 871, 878, 879, 885, 905
];
uint16[] epics = [
803, 807, 816, 817, 844, 845, 856, 857, 868, 869, 876, 8... | return 'length' bytes of 'num' starting at 'start' | function extract(
uint num,
uint length,
uint start
)
internal
pure
returns (uint)
{
return (((1 << (length * 8)) - 1) & (num >> ((start - 1) * 8)));
}
| 7,320,913 |
./full_match/1/0x7b3Af546061fa9Af9Ec3351BC6f51A68De466E91/sources/contracts/ERC721Min.sol | Mints tokenId and transfers it to `to`. WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible Requirements: - `to` cannot be the zero address. Emits a {Transfer} event./ | function _mintMin2(address to) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
_owners.push(to);
_balances[to]++;
emit Transfer(address(0), to, _owners.length - 1);
}
| 17,197,340 |
./full_match/10/0xa48666D91Ac494A3CCA96A3A4357d998d8619387/sources/src/UMATrigger.sol | UMA callback for proposals. This function is called by the UMA oracle when a new answer is proposed for the query. Its only purpose is to prevent people from proposing negative answers and prematurely closing our queries. For example, if our query were something like "Has Compound been hacked since block X?" the correc... | function priceProposed(
bytes32 _identifier,
uint256 _timestamp,
bytes memory _ancillaryData
) external {
OptimisticOracleV2Interface _oracle = getOracle();
if (
msg.sender != address(_oracle) ||
_timestamp != requestTimestamp ||
keccak256(_ancillaryData) != keccak256(bytes(que... | 3,781,924 |
./full_match/43114/0x6351C5c0F6A7b9519F459d7C98aADA73594Ced5a/sources/perklefarms.sol | Determine the prior number of votes for an account as of a block number Block number must be a finalized block or else this function will revert to prevent misinformation. account The address of the account to check blockNumber The block number to get the vote balance at return The number of votes the account had as... | function getPriorVotes(address account, uint blockNumber)
external
view
returns (uint256)
{
require(blockNumber < block.number, "sXPZ::getPriorVotes: not yet determined");
uint32 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {
return ... | 4,608,618 |
pragma solidity ^0.4.18;
contract ERC20 {
uint public totalSupply;
function balanceOf(address who) constant returns (uint);
function allowance(address owner, address spender) constant returns (uint);
function transfer(address _to, uint _value) returns (bool success);
function transferFrom(address ... | Move team token pool to founder balance Sub from total tokens team pool Sub from total tokens bounty pool Total supply is 500000 | function TradingForest(address _founder) payable {
owner = msg.sender;
founder = _founder;
balances[founder] = team;
totalTokens = safeSub(totalTokens, team);
totalTokens = safeSub(totalTokens, bounty);
totalSupply = totalTokens;
balances[owner] = t... | 7,807,857 |
/*
* The MIT License
*
* Copyright (c) 2017-2018 , Akropolis Decentralised Ltd (Gibraltar), http://akropolis.io
*
*/
pragma solidity ^0.4.24;
pragma experimental "v0.5.0";
import "./AkropolisFund.sol";
import "./interfaces/ERC20Token.sol";
import "./utils/Set.sol";
import "./utils/Owned.sol";
contract Registry is Ow... | This function is called by the fund itself during construction. Take the fee, payer must have set the allowance first. this will probably be the person deploying the fund! This is easier than making the fund itself (msg.sender) pay for the fund because it is called during construction of the fund Ensure the fund isn't ... | function addFund(address payer)
external
{
_withdrawFee(payer, fundRegistrationFee);
require(!_funds.contains(msg.sender), "Fund already registered.");
_funds.add(msg.sender);
emit NewFund(AkropolisFund(msg.sender));
}
| 12,972,409 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import '@openzeppelin/contracts/utils/Context.sol';
import '@openzeppelin/contracts/access/Ownable.sol';
import '@openzeppelin/contracts/token/ERC20/ERC20.sol';
import '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';
import '@openzeppelin/contr... | Zunami protocol owner complete all active pending deposits of users userList - dev send array of users from pending to complete pid - number of the pool to which the deposit goes/ | function completeDeposits(address[] memory userList, uint256 pid)
external
onlyOwner
startedPool(pid)
{
IStrategy strategy = poolInfo[pid].strategy;
uint256 currentTotalHoldings = totalHoldings();
uint256 completeAmount = 0;
uint256[3] memory totalAmounts... | 1,433,800 |
./partial_match/1/0xeecD0eDCBD6c7e5AA0052d448C89977a6B5eb56a/sources/contracts/account-abstraction/Account.sol | execute a transaction (called directly from owner, or by entryPoint)/ | function execute(
address dest,
uint256 value,
bytes calldata func
) external {
_requireFromEntryPointOrOwner();
_call(dest, value, func);
}
| 3,922,480 |
/**
*Submitted for verification at Etherscan.io on 2021-03-05
*/
pragma solidity ^0.5.16;
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see {ERC20Detailed}.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in exis... | Distribute purchased tokens | function distribute(uint256 _offset) external onlyOwner returns (uint256) {
uint256 _distributed = 0;
for (uint256 i = _offset; i < buyers.length; i++) {
address _buyer = buyers[i];
uint256 _purchase = purchases[_buyer];
if (_purchase > 0) {
purcha... | 2,008,085 |
./partial_match/1/0x1c73E16b68933Ae54664B04559C030E5136F823e/sources/Ruletka.sol | Empty room roomId and refund each player. Safety mechanism which shouldn't be used. _roomId Which room id to empty and refundroom.players[i].transfer(balanceToRefund); | function refundPlayersInRoom(uint256 _roomId) public onlyCTO{
uint256 nbrOfPlayers = room.players.length;
uint256 balanceToRefund = room.balance / nbrOfPlayers;
for (uint i = 0; i<nbrOfPlayers; i++) {
payable(room.players[i]).transfer(balanceToRefund);
room.balance -=... | 9,310,425 |
// SPDX-License-Identifier: MIT
// @unsupported: ovm
pragma solidity >0.7.5;
pragma experimental ABIEncoderV2;
/* Interface Imports */
import { iL1NFTBridge } from "./interfaces/iL1NFTBridge.sol";
import { iL2NFTBridge } from "./interfaces/iL2NFTBridge.sol";
import { IERC721 } from "@openzeppelin/contracts/token/ERC72... | / @inheritdoc iL1NFTBridge / if token has base on this layer check the existence of bridgeExtraData(uint256) on l1Contract otherwise send tokenURI return (encoded in bytes) allow to fail if the call fails | function depositNFTWithExtraData(
address _l1Contract,
uint256 _tokenId,
uint32 _l2Gas
)
external
virtual
override
nonReentrant()
whenNotPaused()
{
bytes memory extraData;
if (pairNFTInfo[_l1Contract].baseNetwork == Network.L1) ... | 13,054,811 |
// SPDX-License-Identifier: MIT
// Copyright 2021 Primitive Finance
//
// 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
// us... | Calculates the effective premium, denominated in underlyingTokens, to buy `quantity` of `optionToken`s. UniswapV2 adds a 0.3009027% fee which is applied to the premium as 0.301%. IMPORTANT: If the pair's reserve ratio is incorrect, there could be a 'negative' premium. Buying negative premium options... | function getOpenPremium(IOption optionToken, uint256 quantity)
public
view
override
returns (uint256, uint256)
{
return SwapsLib.getOpenPremium(_router, optionToken, quantity);
}
| 5,382,731 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
// Part: IGMMetadata
/**
@title GreatMasters NFT metadata
@author Gene A. Tsvigun
*/
interface IGMMetadata {
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @de... | Initializes the contract by setting a `name` and a `symbol` to the token collection./ | function _authorizeUpgrade(address newImplementation) internal virtual;
uint256[50] private __gap;
}
function __ERC721_init(string memory name_, string memory symbol_) internal initializer {
__Context_init_unchained();
__ERC165_init_unchained();
__ERC721_init_unchained(name_, symbo... | 5,986,817 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.1;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when de... | Mint some tokens to target account. There is a check for the cap inside./ | function mint(address target, uint256 mintedAmount)
external
override
onlyOperator
{
_mint(target, mintedAmount);
}
| 7,291,863 |
./partial_match/5/0x2C0892917AbAd4455D9e5b50220743392A225184/sources/contracts/mixins/OZ/ERC721Upgradeable.sol | See {IERC721Metadata-tokenURI}./ If there is no base URI, return the token URI. If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked). | function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
string memory _tokenURI = _tokenURIs[tokenId];
if (bytes(_baseURI).length == 0) {
return _tokenURI;
}
if (bytes(_tokenURI)... | 16,839,554 |
// File: @openzeppelin/contracts/utils/Context.sol
// OpenZeppelin Contracts v4.4.0 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg... | Set the start block for companions. | function setStartBlockCompanion(uint256 arg) public onlyOwner {
if(arg == 0){
startBlockCompanion = block.timestamp;
startBlockCompanion = arg;
}
}
| 170,168 |
./full_match/5/0xA18817e452d5b5913A28fB1a9d1257aF98b79059/sources/contracts/messaging/connectors/SpokeConnector.sol | This returns the root of all messages with the origin domain as this domain (i.e. all outbound messages)/ | function outboundRoot() external view returns (bytes32) {
return MERKLE.root();
}
| 1,923,896 |
pragma solidity 0.5.12;
pragma experimental ABIEncoderV2;
contract Token {
... | inject NONSTANDARD NAMING | function TRANSFER539(address _to, uint256 _value) public returns (bool success) { | 12,856,769 |
./full_match/5/0x32ff4D05236E95FF60299E9b7BaB351179138389/sources/contracts/core/PoolTicksState.sol | update ticks if necessary calculate feeGrowthInside | function _updatePosition(
UpdatePositionData memory updateData,
int24 currentTick,
CumulativesData memory cumulatives
) internal returns (uint256 feesClaimable, uint256 feeGrowthInside) {
uint256 feeGrowthOutsideLowerTick = _updateTick(
updateData.tickLower,
currentTick,
updateData... | 1,940,652 |
./partial_match/1/0x05310880FBA5f373E871351a4B67A516c20Ce1C2/sources/_contracts/lottery/JoysLottery.sol | freeClaim with no joys token cost lottery hero/ | function freeClaim(address _address, uint32 _requestId) private returns (uint32, uint32, uint256) {
require(heroClaimed < FREE_HERO_COUNT, "JoysLottery: no free hero claimed");
require(freeClaimHero[_address] == CS_NORMAL, "JoysLottery: have claimed");
uint32 level;
uint32 strength;... | 15,465,559 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
interface IERC20 {
modifier onlyPayloadSize(uint numWords) {
assert(msg.data.length >= numWords * 32 + 4);
_;
}
/**
* Public functions
*/
function transfer(address to, uint256 value) external returns (bool);
function appro... | Burns a specific amount of tokens. _value The amount of token to be burned./ | function burnForCrowdsale(uint256 _value) public {
_burnForCrowdsale(_value);
}
| 11,718,856 |
// SPDX-License-Identifier: LGPL-3.0-or-later
pragma solidity 0.7.6;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol";
import "@openzeppelin/contracts/utils/Pausable.sol";
import "./inte... | Batch burn an amounts of tokens ERC-1155 _account Account which owns the token _tokenIds IDs of the tokens _values Amounts of the tokens/ | function burnBatch(
address _account,
uint256[] calldata _tokenIds,
uint256[] calldata _values
) external onlyFromVoucherKernel {
_burnBatch(_account, _tokenIds, _values);
}
| 14,468,876 |
./partial_match/3/0x1dAF7905b465D614D0cC1C155D2Be8e501505b82/sources/PID721A.sol | Internal function to burn a specific token. Reverts if the token does not exist. Deprecated, use {_burn} instead. owner owner of the token to burn tokenId uint256 ID of the token being burned/ | function _burn(address owner, uint256 tokenId) external {
require(ownerOf(tokenId) == owner, "PIDToken: burn of token that is not own");
_clearApproval(tokenId);
_ownedTokensCount[owner].decrement();
_tokenOwner[tokenId] = address(0);
emit Transfer(owner, address(0), token... | 5,161,441 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.9;
import '@openzeppelin/contracts/security/PullPayment.sol';
import './Governed.sol';
import './OwnerBalanceContributor.sol';
import './Macabris.sol';
import './Bank.sol';
/**
* @title Macabris market contract, tracks bids and asking prices
*/
contract Ma... | Returns payout amount per token for the given interval totals Interval totals return Payout value in wei Notes: - Returns zero for the "virtual" interval after the payout schedule end - Returns zero if no active tokens exists for the interval/ If we're calculating next payout for the "virtual" interval after the last ... | function _getPayoutPerToken(IntervalTotals memory totals) private view returns (uint) {
if (totals.activeTokens > 0 && totals.index < intervalCount) {
return (totals.deposits - totals.payouts) / (intervalCount - totals.index) / totals.activeTokens;
return 0;
}
}
| 10,435,161 |
./full_match/137/0x6907136c8f986191a570D080cBEfB4044d5Ab269/sources/MaticRouter.sol | SWAP requires the initial amount to have already been sent to the first pair | function _swap(uint[] memory amounts, address[] memory path, address _to) internal virtual {
for (uint i; i < path.length - 1; i++) {
(address input, address output) = (path[i], path[i + 1]);
(address token0,) = MaticLibrary.sortTokens(input, output);
uint amountOut = amo... | 3,745,790 |
// SPDX-License-Identifier: MIT
// GO TO LINE 1904 TO SEE WHERE THE TOKEN CONTRACT STARTS
// File: @openzeppelin/contracts/utils/Context.sol
pragma solidity >=0.6.0 <0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are ... | Just in case ETH does something silly | function setTokenPrice(uint256 newPrice) public onlyOwner {
tokenPrice = newPrice;
}
| 1,149,595 |
/*
ERC20BaseRewardModule
https://github.com/gysr-io/core
SPDX-License-Identifier: MIT
*/
pragma solidity 0.8.4;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "./interfaces/IRewardModule.sol";
/**
* @title ERC20 base reward module... | internal implementation of stake method account address of staking account user address of user shares number of new shares minted data addtional data return amount of gysr spent return amount of gysr vested/ | function _stake(
address account,
address user,
uint256 shares,
bytes calldata data
) internal returns (uint256, uint256) {
require(data.length == 0 || data.length == 32, "frm2");
uint256 gysr;
if (data.length == 32) {
assembly {
... | 85,420 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import { ContextUpgradeable } from '@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol';
import { Initializable } from '@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol';
import { IGovernable } from '../interfaces/IGovernable.sol'... | Transfers governance to a new account (`newGovernance`). Can only be called by the current governance./ | function transferGovernance(address newGovernance) external virtual onlyGovernance {
if (newGovernance == address(0)) revert ZeroAddress();
emit GovernanceTransferred(_governance, newGovernance);
_governance = newGovernance;
}
| 14,014,754 |
pragma solidity ^0.5.7;
// Copyright BigchainDB GmbH and Ocean Protocol contributors
// SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
// Code is Apache-2.0 and docs are CC-BY-4.0
import "./BToken.sol";
import "./BMath.sol";
import "../interfaces/DatatokenInterface.sol";
/**
* @title BPool
*
* @dev Used by th... | Called prior to contract initialization (e.g creating new BPool instance) Calls private _initialize function. Only if contract is not initialized. | function initialize(
address controller,
address factory,
uint256 swapFee,
bool publicSwap,
bool finalized,
uint256 peggedPrice
) external onlyNotInitialized returns (bool) {
require(controller != address(0), "ERR_INVALID_CONTROLLER_ADDRESS");
requ... | 931,004 |
// File: contracts\modules\Ownable.sol
pragma solidity =0.5.16;
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* This module is used through inheritance. It will make available the ... | Set the calculation results of the collateral pool shared worth. The foundation operator will invoke this function frequently newNetworth Current expired options' net worth sharedBalances All unexpired options' shared balance distributed by time. firstOption The new first unexpired option's index./ | function setSharedPayment(address[] memory /*_whiteList*/,int256[] memory /*newNetworth*/,
int256[] memory /*sharedBalances*/,uint256 /*firstOption*/) public{
delegateAndReturn();
}
| 13,779,851 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
// import "@openzeppelin/contracts/access/Ownable.sol";
import "@divergencetech/ethier/contracts/sales/LinearDutchAuction.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "./interfaces/IMMNFT.sol";
contract MMDutchAuction is LinearDutchAu... | Pauses the contract. | function pause() public onlyOwner {
Pausable._pause();
}
| 18,314 |
// ton-solidity adapted version of https://github.com/blitslabs/filecoin-blake2b-solidity
pragma ton-solidity >=0.35.0;
pragma AbiHeader expire;
pragma AbiHeader time;
pragma AbiHeader pubkey;
contract Blake2b {
uint64[8] constant IV = [
uint64(0x6a09e667f3bcc908),
uint64(0xbb67ae8584caa73b),
... | XOR current state with both halves of v | function compress(BLAKE2b_ctx ctx, bool last) internal view returns(BLAKE2b_ctx){
uint64[16] v = new uint64[](16);
uint64[16] m = new uint64[](16);
for (uint256 i = 0; i < 8; i++) {
v[i] = ctx.h[i];
v[i + 8] = IV[i];
}
v[13] = v[13] ^ uint64(ctx.t >>... | 14,083,496 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./ERC2981.sol";
import "./ITokenSale.sol";
import "./IVTailERC721... | set the allowed minter/ | function setMinter(address minter_) public {
require(minter == address(0), 'immutable');
minter = minter_;
}
| 2,529,381 |
./partial_match/56/0xb50a7dBCef6BDA5a35e27EdC9334f87736e142dB/sources/MasterChefV2.sol | Withdraw LP tokens from MasterChef. | function withdraw(uint256 _pid, uint256 _amount) public nonReentrant {
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.a... | 11,242,781 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
import {BytesLib} from '@interlay/bitcoin-spv-sol/contracts/BytesLib.sol';
import {BTCUtils} from '@interlay/bitcoin-spv-sol/contracts/BTCUtils.sol';
library Script {
using BytesLib for bytes;
using BTCUtils for bytes;
bytes1 internal constant OP_H... | solhint-disable-next-line func-name-mixedcase | function P2PKH(bytes memory script) internal pure returns (bytes20) {
return toBytes20(script.slice(3, 20));
}
| 13,039,543 |
/**
*Submitted for verification at Etherscan.io on 2021-07-12
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/******************************************/
/* IERC20 starts here */
/******************************************/
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
/*... | Withdraw all unlocked shares./ | function withdrawShare() external
{
require(allocations[msg.sender].lastWithdrawalBlock < endBlock, "All shares have already been claimed.");
uint256 unlockedBlock;
if (block.number > endBlock) {
unlockedBlock = endBlock;
unlockedBlock = block.number;
}
... | 911,272 |
pragma solidity 0.4.18;
/**
* @title Masterium Token [MTI]
* @author primeRev
* @notice masterium [mti] token contract (tokensale, (cummulated) interest payouts, masternodes
*/
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mu... | public (read only): unixtime to next interest payoutuint256 timestamp = _getTimestamp(); | function tokensaleSecondsToStart() public constant returns (uint256) {
return (tokensale.startAtTimestamp <= _getTimestamp()) ? 0 : tokensale.startAtTimestamp - _getTimestamp();
}
| 13,033,252 |
// contracts/ERC721PresetMinterPauserAutoIdUpgradeableCustomized.sol
// SPDX-License-Identifier: None
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol";
import "@... | See {IERC165-supportsInterface}./ | function supportsInterface(bytes4 interfaceId) public view virtual override(AccessControlEnumerableUpgradeable, ERC721Upgradeable, ERC721EnumerableUpgradeable) returns (bool) {
return super.supportsInterface(interfaceId);
}
uint256[48] private __gap;
| 12,136,199 |
pragma solidity 0.4.24;
import 'reporting/IReputationToken.sol';
import 'libraries/DelegationTarget.sol';
import 'libraries/ITyped.sol';
import 'libraries/Initializable.sol';
import 'libraries/token/VariableSupplyToken.sol';
import 'libraries/token/ERC20.sol';
import 'reporting/IUniverse.sol';
import 'reporting/IMark... | Initialize migration related state. If this is Genesis universe REP the balances from the Legacy contract must be migrated before we enable usage | function initialize(IUniverse _universe) public beforeInitialized returns (bool) {
endInitialization();
require(_universe != address(0));
universe = _universe;
updateParentTotalTheoreticalSupply();
ERC20 _legacyRepToken = getLegacyRepToken();
isMigratingFromLegacy = _... | 1,837,212 |
pragma solidity =0.5.16;
import "openzeppelin-solidity-2.3.0/contracts/ownership/Ownable.sol";
import "openzeppelin-solidity-2.3.0/contracts/token/ERC20/IERC20.sol";
import "@uniswap/v2-core/contracts/libraries/Math.sol";
import "./uniswap/UniswapV2Library.sol";
import "./uniswap/IUniswapV2Router02.sol";
import "./inte... | Add ETH and Alpha to ibETH-Alpha Pool. All ETH and Alpha supplied are optimally swap and add too ibETH-Alpha Pool. | function addLiquidityTwoSidesOptimalETH(
uint256 amountAlphaDesired,
uint256 amountLPMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 liquidity
) {
... | 14,115,055 |
/**
* The edgeless casino contract v2 holds the players's funds and provides state channel functionality.
* The casino has at no time control over the players's funds.
* State channels can be updated and closed from both parties: the player and the casino.
* author: Julia Altenried
**/
pragma solidity ^0.... | accepts deposits for an arbitrary address. retrieves tokens from the message sender and adds them to the balance of the specified address. edgeless tokens do not have any decimals, but are represented on this contract with decimals. receiver address of the receiver numTokens number of tokens to deposit (0 deci... | function deposit(address receiver, uint numTokens, bool chargeGas) public isAlive {
require(numTokens > 0);
uint value = safeMul(numTokens, oneEDG);
uint gasCost;
if (chargeGas) {
gasCost = getGasCost();
value = safeSub(value, gasCost);
gasPayback = safeAdd(gasPayback, gasCost);
}
uint newBalance ... | 2,416,647 |
./partial_match/1/0xE351832D873673f771CCe54c07Cf8fFAe5c55809/sources/contracts/liquidity/LPool.sol | Get the underlying balance of the `owner` This also accrues interest in a transaction owner The address of the account to query return The amount of underlying owned by `owner` | function balanceOfUnderlying(address owner) external override returns (uint) {
(MathError mErr, uint balance) = mulScalarTruncate(exchangeRate, accountTokens[owner]);
require(mErr == MathError.NO_ERROR, "calc failed");
return balance;
}
| 15,984,567 |
//Address: 0x289925d08b07e73dd0dd02d1407c877942215082
//Contract name: AVYToken
//Balance: 0 Ether
//Verification Date: 2/9/2018
//Transacion Count: 53
// CODE STARTS HERE
pragma solidity ^0.4.18;
library SafeMath {
function add(uint a, uint b) pure internal returns (uint) {
uint c = a + b;
asse... | Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. | function approve(address spender, uint tokens) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
Approval(msg.sender, spender, tokens);
return true;
}
| 5,401,697 |
pragma solidity ^0.4.24;
/**
* @title Module
* @dev Interface for a module.
* A module MUST implement the addModule() method to ensure that a wallet with at least one module
* can never end up in a "frozen" state.
* @author Julien Niset - <julien@argent.xyz>
*/
interface Module {
/**
* @de... | Gets the number of valid signatures that must be provided to execute a specific relayed transaction. _wallet The target wallet. _data The data of the relayed transaction. return The number of required signatures./ Validates the signatures provided with a relayed transaction. The method MUST throw if one or more sign... | function getRequiredSignatures(BaseWallet _wallet, bytes _data) internal view returns (uint256);
function validateSignatures(BaseWallet _wallet, bytes _data, bytes32 _signHash, bytes _signatures) internal view returns (bool);
function execute(
BaseWallet _wallet,
bytes _data,
uin... | 1,818,618 |
./partial_match/1/0x7799FfB5704D2782F6f190A460784B32e24319bD/sources/CompliantCrowdsale.sol | reject buy tokens requests nonces request recorded at these nonces reasons reasons for rejection/ | function bulkRejectMints(uint256[] nonces, uint256[] reasons)
external
onlyValidator
{
for (uint i = 0; i < nonces.length; i++) {
require(whiteListingContract.isInvestorApproved(pendingMints[nonces[i]].to));
rejectedMintBalance[pendingMints[nonces[i]].to] = reje... | 4,366,905 |
./full_match/1/0xF49D1584E399e2D753a1Edef633EFF05c8CD5D15/sources/contracts/Prompt.sol | Get current count of minted tokens return Returns number | function tokenCount() external view virtual returns (uint256) {
return _tokenIds.current();
}
| 8,413,783 |
pragma solidity 0.4.24;
// File: zeppelin-solidity/contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint2... | Removes single address from whitelist. _beneficiary Address to be removed to the whitelist/ | function removeFromWhitelist(address _beneficiary) external onlyOwnerOrExecutor {
whitelist[_beneficiary] = false;
}
| 98,359 |
pragma solidity ^0.6.2;
import "./ERC777GSN.sol";
import "./ERC777WithAdminOperatorUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
contract PToken is
Initializable,
AccessControlUpgradeabl... | Returns the amount of tokens owned by an account (`tokenHolder`)./ | function balanceOf(address tokenHolder) public view virtual override(IERC20Upgradeable, IERC777Upgradeable) returns (uint256) {
return _balances[tokenHolder];
}
| 21,379 |
pragma solidity ^0.4.25;
pragma experimental ABIEncoderV2;
import "../utils/TimeUtil.sol";
import "./TableDefTools.sol";
/*
* GovCooperation模拟政府办公协作的流程
* 首先科员提交材料申请。等待上级审批是否通过,通过后公示给大众
*
*/
contract GovCooperation is TableDefTools{
/******* 引入库 *******/
using TimeUtil for *;
/*
* 构造函数,初始化使用到的表结构
... | 2.查询申请材料当前状态 并以字符串数组方式输出 _applicationid 材料id唯一主键 return 执行状态码 return 该用户信息的字符串数组 测试举例 参数一:"1976945"/ | function getUserApplyArray(string memory _applicationid) public view returns(int8, string[]){
return selectOneRecordToArray(t_application_struct, _applicationid, ["application_id",_applicationid]);
}
| 14,064,469 |
./full_match/5/0x6883Aba8A39CF1c90a0F4c1dc6e44533Ba176907/sources/contracts/WavePortal.sol | You'll notice I changed the wave function a little here as well and now it requires a string called _message. This is the message our user sends us from the frontend!/ | function wave(string memory _message) public {
totalWaves += 1;
console.log("%s waved w/ message %s", msg.sender, _message);
waves.push(Wave(msg.sender, _message, block.timestamp));
emit NewWave(msg.sender, block.timestamp, _message);
| 1,961,068 |
./partial_match/1/0xc9268c7F59850B26567b0f5d3Dcc317cEDC43490/sources/src/contracts/SlippageAuction.sol | The ```getAmountIn``` function calculates how many buyTokens you would need in order to obtain a given number of sellTokens Maintains compatability with some router implementations amountOut The amount out of sell tokens tokenOut The sell token address return _amountIn The amount of buyToken needed | function getAmountIn(uint256 amountOut, address tokenOut) external view returns (uint256 _amountIn) {
if (tokenOut != SELL_TOKEN) revert InvalidTokenOut();
}
| 15,952,494 |
./partial_match/42/0x1Dea112a84F50316fa8D4Dbfa3306A7f543352e6/sources/MasterChef.sol | View function to see pending GHOSTs on frontend. | function pendingGhost(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accGHOSTsPerShare = pool.accGHOSTsPerShare;
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
... | 3,295,521 |
./full_match/42/0x512364155BD156170f5484B863baf82108F5298b/sources/browser/ViolasMProofDatas-V1.sol | Allows the current owner to grant manage role for account. newManager ./ | function grantedMngPermission(address newManager) public onlyOwner {
require(newManager != address(0), "address(0x0) is invalid");
managers[newManager] = true;
_updateVaildManager(newManager);
}
| 16,235,637 |
./full_match/56/0xcBD57e01a6e46A53617215B968d2182FdA0Ec6F5/sources/usertoken_flattened.sol | USE THIS FUNCTION WITHDRAW/REJECT TRANSACTION | function revoke(uint _trnxId) external
onlyOwner
trnxExists(_trnxId)
notExecuted(_trnxId)
{
require(approved[_trnxId][msg.sender],"trnx has not been approve");
approved[_trnxId][msg.sender]=false;
emit Revoke(msg.sender,_trnxId);
}
| 3,242,278 |
./full_match/43114/0xD781b8126F857A2073D5d0DD3D2903253DAA46bD/sources/src/token/ERC721/base/ERC721ABaseInternal.sol | Returns the total amount of tokens minted in the contract./ Counter underflow is impossible as `_currentIndex` does not decrement, and it is initialized to 0. | function _totalMinted() internal view virtual returns (uint256) {
unchecked {
return ERC721SupplyStorage.layout().currentIndex;
}
}
| 4,637,401 |
// SPDX-License-Identifier: MIT
// Copyright 2021 Mosaic Labs UG, Berlin
pragma solidity >=0.8.0 <0.9.0;
import "./IERC20Burnable.sol";
import "hardhat/console.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
// import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
/**
* @title Raffle c... | Organiser can submit a proposal for the root of the raffle. It starts a challenge period where independent observers can challenge the proposed commit, leaving the final decision up to the arbiter./ store the proposed precommit by the organiser set time window to expire after challenge window; | function proposePrecommit(
uint256 _index,
bytes32 _precommit
)
external
onlyOrganiser(_index)
isInCreationPhase(_index)
{
require(
_precommit != bytes32(0),
"Precommit cannot be zero bytes."
);
raffles[_index].status =... | 935,804 |
./full_match/80001/0x593c1490121bEF64347dc951633bAA1Dc3526E38/sources/contracts/1_Storage.sol | "Consume a nonce": return the current value and increment/ | function _useNonce(
address owner
) internal virtual returns (uint256 current) {
current = _currentNonce[owner];
_currentNonce[owner]++;
}
| 9,471,077 |
./full_match/1/0xEa8E6F2c426d207cA0916adB42CeA032102B18Ba/sources/contracts/fund/PrimaryMarketRouter.sol | Create QUEEN Stake QUEEN | function createAndStake(
uint256 underlying,
uint256 minOutQ,
address staking,
uint256 version
) external payable override {
uint256 outQ = create(staking, underlying, minOutQ, version);
ShareStaking(staking).deposit(TRANCHE_Q, outQ, msg.sender, version);
}
| 3,192,939 |
pragma solidity 0.4.4;
pragma solidity ^0.4.4;
pragma solidity ~0.4.4;
pragma solidity >0.4.4;
pragma solidity >=0.4.4;
pragma solidity <0.4.4;
pragma solidity <=0.4.4;
pragma solidity =0.4.4;
pragma solidity 0.4;
pragma solidity ^0.6;
pragma solidity >=0.5.0 <0.7.0;
library a {}
library b {}
library c {}
library f {}... | function dispatcher memory allocator the contract function | function() {
assembly {
switch div(calldataload(0), exp(2, 226))
case 0xb3de648b {
let (r) := f(calldataload(4))
let ret := $allocate(0x20)
mstore(ret, r)
return(ret, 0x20)
}
function $allocate(size) -> pos {
pos := mload(0x40)
mstore(0x40, add(pos, size))
}
function f(x) -... | 13,012,356 |
./full_match/43113/0x3a7D90487F8E6c8631317E1B812d020CE5bB1288/sources/src/LBPair.sol | Swap tokens iterating over the bins until the entire amount is swapped. Token X will be swapped for token Y if `swapForY` is true, and token Y for token X if `swapForY` is false. This function will not transfer the tokens from the caller, it is expected that the tokens have already been transferred to this contract thr... | function swap(bool swapForY, address to) external override nonReentrant returns (bytes32 amountsOut) {
bytes32 reserves = _reserves;
bytes32 protocolFees = _protocolFees;
bytes32 amountsLeft = swapForY ? reserves.receivedX(_tokenX()) : reserves.receivedY(_tokenY());
if (amountsLeft ... | 7,117,338 |
./partial_match/1/0x235b25f9f56B39eFD8293C0d2A9Ee70719E25B85/sources/src/ButtonswapPair.sol | @inheritdoc IButtonswapPair/ overflow is desired | function movingAveragePrice0() public view returns (uint256 _movingAveragePrice0) {
uint32 blockTimestamp = uint32(block.timestamp % 2 ** 32);
uint32 timeElapsed;
unchecked {
timeElapsed = blockTimestamp - blockTimestampLast;
}
uint256 currentPrice0 = uint256(UQ11... | 4,108,338 |
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.8.6;
import { IClaimRewards } from "../../polygon/IClaimRewards.sol";
import { ImmutableModule } from "../../shared/ImmutableModule.sol";
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import { IERC20 } from "@openze... | Claims the rewards and sends them to the receiverSafe, e.g. claims and sends stkAave _integration Integration address, this contract should have permissions to spend the token _token Address of the token that are claimed and send/ 1. Claim rewards for the integration contract 2. Send token rewards to receiverSafe | function claimAndDistributeRewards(address _integration, address _token) external {
require(_integration != address(0), "Invalid integration address");
require(_token != address(0), "Invalid token address");
IClaimRewards(_integration).claimRewards();
_sendRewards(_integration, _to... | 6,143,912 |
// hevm: flattened sources of ./contracts/token/UniswapIncentive.sol
pragma solidity >=0.4.0 >=0.5.0 >=0.6.2 >=0.6.0 <0.7.0 >=0.6.0 <0.8.0 >=0.6.2 <0.7.0 >=0.6.2 <0.8.0;
pragma experimental ABIEncoderV2;
////// ./contracts/core/IPermissions.sol
/* pragma solidity ^0.6.0; */
/* pragma experimental ABIEncoderV2; */
///... | updates the referenced oracle return true if the update is effective | function updateOracle() public override returns (bool) {
return oracle.update();
}
| 1,692,109 |
/**
*Submitted for verification at Etherscan.io on 2021-05-18
*/
// File: @openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol
pragma solidity ^0.6.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. T... | manager2 == alternative admin caller to owner/ | function setManager2(address _manager2) public onlyOwner {
manager2 = _manager2;
}
| 2,408,651 |
./full_match/100/0x87b52eD635DF746cA29651581B4d87517AAa9a9F/sources/src/CoWTWAPFallbackHandler.sol | @inheritdoc CoWFallbackHandler Apply specific TWAP order validation. | function dispatch(bytes calldata payload) public override(CoWFallbackHandler) {
TWAPOrder.validate(abi.decode(payload, (TWAPOrder.Data)));
super.dispatch(payload);
| 14,289,313 |
./full_match/1/0xC5ec4f1FC86DA45AE788EC98756BA70B57676409/sources/OjeToken.sol | generate the uniswap pair path of token -> weth make the swap | function swapETHForTokens(uint256 amount) private {
address[] memory path = new address[](2);
path[0] = uniswapV2Router.WETH();
path[1] = address(this);
path,
block.timestamp.add(300)
);
}
| 3,868,314 |
./full_match/1/0xBe9064ec3331F7Fc9E10DD9074Cc23C411E7EE00/sources/contracts/erc721a/ERC721A.sol | Returns the packed ownership data of `tokenId`./ If not burned. If the data at the starting slot does not exist, start the scan. Invariant: There will always be an initialized ownership slot (i.e. `ownership.addr != address(0) && ownership.burned == false`) before an unintialized ownership slot (i.e. `ownership.addr ==... | function _packedOwnershipOf(uint256 tokenId)
private
view
returns (uint256 packed)
{
if (_startTokenId() <= tokenId) {
packed = _packedOwnerships[tokenId];
if (packed & _BITMASK_BURNED == 0) {
if (packed == 0) {
if (toke... | 9,702,409 |
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 ... | Returns total tokens held by an address (locked + transferable) _of The address to query the total balance of/ | function totalBalanceOf(address _of) public view returns (uint256 amount) {
amount = balanceOf(_of);
for (uint256 i = 0; i < lockReason[_of].length; i++) {
amount = amount.add(tokensLocked(_of, lockReason[_of][i]));
}
}
| 1,829,005 |
./partial_match/1/0x891696CCa87aa2f175124b412198c23D54680E31/sources/NFTWinner.sol | Gas spent here starts off proportional to the maximum mint batch size. It gradually moves to O(1) as tokens get transferred around over time./ | function _ownershipOf(uint256 tokenId)
internal
view
virtual
returns (TokenOwnership memory)
{
return _unpackedOwnership(_packedOwnershipOf(tokenId));
}
| 3,585,503 |
pragma solidity ^0.4.15;
contract Pear
{
struct Account {
mapping (uint => uint) reputation;
//uint[3] stake;
bool hasAccount;
}
struct Review {
address author;
uint[3] score;
uint stake;
uint timestamp;
bool exists;
}
struct Paper {
... | require(hasAccount(addr)); | function deleteAccount(address addr) public onlyOwner hasAccount(addr) returns(bool) {
accounts[addr].hasAccount = false;
return true;
}
| 2,567,201 |
./partial_match/1/0xd042207C5e904AdDB831878Dd07c239f05F4a75F/sources/AiPTP.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("AiPTP", "ATMT") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uint256 _buyMktFee = 2;... | 15,582,903 |
./full_match/1/0xC383AAc4B3dC18D9ce08AB7F63B4632716F1e626/sources/src/contracts/AToken.sol | Overrides the base function to fully implement IAToken see `EIP712Base.DOMAIN_SEPARATOR()` for more detailed documentation/ | function DOMAIN_SEPARATOR() public view override(IAToken, EIP712Base) returns (bytes32) {
return super.DOMAIN_SEPARATOR();
}
| 3,095,123 |
/**
* .
* / \
* |.'.|
* |'.'|
* ,'| |`.
* |,-'-|-'-.|
* __|_| | _ _ _____ _
* | ___ \| | | | | | ___ \ | |
* | |_/ /|__ ___| | _____| |_ | |_/ /__ ___ | |
* | // _ \ / __| |/ / _ \ __| | __/ _ \ / _ \| |
*... | The member proposal quorum threshold for this DAO | function getQuorum() override external view returns (uint256) {
return getSettingUint("members.quorum");
}
| 14,852,780 |
//Address: 0x73185bc2a1aa75ec49ba9239b28ea22fda5940fa
//Contract name: Governance
//Balance: 0 Ether
//Verification Date: 2/19/2018
//Transacion Count: 20
// CODE STARTS HERE
pragma solidity ^0.4.13;
contract DSExec {
function tryExec( address target, bytes calldata, uint value)
internal
... | PUBLIC METHODS Propose new versions of Melon ofVersion Address of version contract to be proposed | function Governance(
address[] ofAuthorities,
uint ofQuorum,
uint ofWindow
)
DSGroup(ofAuthorities, ofQuorum, ofWindow)
function proposeVersion(address ofVersion) {
versionToProposalIds[ofVersion] = propose(address(this), new bytes(0), 0);
}
| 1,064,953 |
/**
*Submitted for verification at Etherscan.io on 2021-12-29
*/
/**
*Submitted for verification at Etherscan.io on 2021-06-09
*/
// Dependency file: @openzeppelin/contracts/utils/Context.sol
// SPDX-License-Identifier: MIT
// pragma solidity >=0.6.0 <0.8.0;
/*
* @dev Provides information about the current exec... | Returns current merkle tree root/ | function merkleRoot() public view returns (bytes32) {
return _merkleRoot;
}
| 2,054,944 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
import "../core/interfaces/IERC20V5.sol";
import "./OrderPool.sol";
import "./ExecVirtualOrders.sol";
///@notice This library handles the state and execution of long term orders.
library LongTermOrdersLib {
using OrderPoolLib for OrderPoolLib.OrderPool... | withdraw proceeds from a long term swap (can be expired or ongoing) make sure to update virtual order state (before calling this function) | function withdrawProceedsFromLongTermSwap(LongTermOrders storage self, uint256 orderId) internal returns (address proceedToken, uint256 proceeds) {
Order storage order = self.orderMap[orderId];
OrderPoolLib.OrderPool storage OrderPool = order.sellTokenId == self.tokenA ? self.OrderPoolA : self.Ord... | 1,052,146 |
./partial_match/56/0xF7EBf8670ADFCF4729D39A5c83d8521B6a3Eb8d9/sources/CandyMasterFarmer.sol | Delegate votes from `msg.sender` to `delegatee` delegatee The address to delegate votes to/ | function delegate(address delegatee) external {
return _delegate(msg.sender, delegatee);
}
| 11,294,992 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "./ERC20.sol";
import "./Dubi.sol";
import "./IHodl.sol";
import "./MintMath.sol";
contract Purpose is ERC20 {
// The DUBI contract, required for auto-minting DUBI on burn.
Dubi private immutable _dubi;
// Th... | Asserts that the caller (msg.sender) is allowed to revert a pending operation. The caller must be opted-in by user and provide a valid signature from the user that hasn't expired yet./ Revert if not LIFO order In order to verify the boosterMessage, we need the hash and timestamp of when it was signed. To interpret the ... | function _assertCanRevert(
address user,
OpHandle memory opHandle,
uint64 opTimestamp,
bytes memory boosterMessage,
Signature memory signature
) internal {
_assertRevertLIFO(user, opHandle.opId);
IOptIn.OptInStatus memory optInStatus = getOptInStatus(user... | 491,424 |
./full_match/43114/0x2BE7c057c9F95Df849fa1F106c1CBc5BF16605AB/sources/SHOGUNDAO.sol | ACTIVATION OF PRIVATE SALE | function activatePrivateSale() public {
require(msg.sender == owners, "not owners");
privateSale = true;
}
| 4,514,210 |
./partial_match/4/0x6F925C1AA62e736e2077c6d7cA1bC70538146a22/sources/METHToken.sol | Update reward variables of the given pool to be up-to-date. | function updatePool(uint256 _pid) public {
PoolInfo storage pool = poolInfo[_pid];
if (block.number <= pool.lastRewardBlock) {
return;
}
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if (lpSupply == 0) {
pool.lastRewardBlock = block.number;... | 8,568,825 |
./full_match/1/0x97b6a74BcC7Bfc03e9Ce97DE7Fb82a4a03b110Bf/sources/contracts/Pool/Pool.sol | @inheritdoc IPool If principal is zero, balance is zero too | function balanceOf(address lender) external view override returns (uint256 balance) {
Member storage member = poolMembers[lender];
if (member.principal == 0) {
return 0;
}
uint256 currentTs = block.timestamp;
if (defaultedAt != 0) {
currentTs = defaultedAt;
}
balance = membe... | 16,489,455 |
./full_match/42220/0x8e9dD3170dbb04BBfe5Af3ABB6bcF320F1D0684e/sources/contracts/community/CommunityAdminImplementation.sol | Migrates a community by deploying a new contract. _community address of the community to be split _numberOfCopies the number of communities that will copy the data _ambassador address of the ambassador _managers address of the community managers/ | function splitCommunity(
ICommunity _community,
uint256 _numberOfCopies,
address _ambassador,
address[] memory _managers
) external override onlyOwnerOrImpactMarketCouncil nonReentrant {
require(
communities[address(_community)] == CommunityState.Valid,
... | 16,342,706 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.