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/43113/0x6bAD76c2FC9d2FaA9544469e83f3611F71e36876/sources/contracts/AG.sol | get user Apas from walletcheck if APA has already voted and add to UserAPAs if eligibleadd to User arrayUserAPAs.push(currentAPA);cant use push for memory arrayadd to proposal arraycheck if APA has already voted anIERC721Enumerabled add to UserAPAs if eligibleadd to User arrayadd to proposal array1 vote per APA1 vote p... | function vote(uint proposalId, Votes _vote) external {
uint voterBalance = balanceOf(msg.sender);
require(voterBalance > 0, "Need at least one APA to cast a vote");
require(block.timestamp < proposals[proposalId].end, "Proposal has Expired");
uint currentAPA;
uint[] memory U... | 13,162,566 |
./full_match/1/0x5f7B49dA80ec5Ba62bE896432F3ae2a2718276E6/sources/@divergencetech/ethier/contracts/erc721/BaseTokenURI.sol | Sets the base token URI prefix. Only callable by the contract steerer./ | function setBaseTokenURI(string memory baseTokenURI_)
public
onlyRole(DEFAULT_STEERING_ROLE)
{
_setBaseTokenURI(baseTokenURI_);
}
| 2,953,698 |
pragma solidity ^0.4.17;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets the original... | Function to mint tokens _to The address that will recieve the minted tokens. _amount The amount of tokens to mint. return A boolean that indicates if the operation was successful./ | function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
totalSupply = totalSupply.add(_amount);
balances[_to] = balances[_to].add(_amount);
Transfer(0X0, _to, _amount);
return true;
}
| 640,064 |
//Address: 0xd73be539d6b2076bab83ca6ba62dfe189abc6bbe
//Contract name: BlockchainCutiesCore
//Balance: 20.223731891324013681 Ether
//Verification Date: 4/25/2018
//Transacion Count: 8014
// CODE STARTS HERE
pragma solidity ^0.4.20;
/// BlockchainCuties: Collectible and breedable cuties on the Ethereum blockchain.
/... | Creates a new gen0 cutie with the given genes and creates an auction for it. | function createGen0Auction(uint256 _genes, uint128 startPrice, uint128 endPrice, uint40 duration) public onlyOperator
{
require(gen0CutieCreatedCount < gen0Limit);
uint40 cutieId = _createCutie(0, 0, 0, 0, _genes, address(this), uint40(now));
_approve(cutieId, saleMarket);
saleM... | 12,941,819 |
./full_match/80001/0x29c20584D390669C4A8ed4f1Af3F713Ba2d26572/sources/contracts/LoyaltyMembershipNFTMinter.sol | For returning token URI | function tokenURI(uint _tokenId) public view override returns (string memory){
return getTokenURI(_tokenId);
}
| 9,541,338 |
./partial_match/1/0xF9f7234c2B5E000D38759eFbc104f413e1Dc17f1/sources/src/ERC20Token.sol | Revokes the minter address oldMinter minter address to revoke/ | function revokeMinter(address oldMinter) external onlyGovernor {
require(oldMinter != address(0), "oldMinter cannot be the zero address");
_revokeRole(MINTER_ROLE, oldMinter);
}
| 15,602,525 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.1;
import {LibAavegotchi, AavegotchiInfo} from "../libraries/LibAavegotchi.sol";
import {LibStrings} from "../../shared/libraries/LibStrings.sol";
import {AppStorage} from "../libraries/LibAppStorage.sol";
// import "hardhat/console.sol";
import {LibMeta} from "../.... | Get all details about all the NFTs owned by an address _owner The address to check for the NFTs return aavegotchiInfos_ an array of structs,where each struct contains all the details of each NFT | function allAavegotchisOfOwner(address _owner) external view returns (AavegotchiInfo[] memory aavegotchiInfos_) {
uint256 length = s.ownerTokenIds[_owner].length;
aavegotchiInfos_ = new AavegotchiInfo[](length);
for (uint256 i; i < length; i++) {
aavegotchiInfos_[i] = LibAavegotc... | 6,412,883 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function return... | Transfers vested tokens to beneficiary./ | function release() public {
uint256 unreleased = _releasableAmount();
require(unreleased > 0, "Vesting: no tokens are due");
_released = _released.add(unreleased);
_dvf.safeTransfer(_beneficiary, unreleased);
emit TokensReleased(address(_dvf), unreleased);
}
| 1,349,330 |
// SPDX-License-Identifier: MIT
/*******************************************************************************
***
*** Deployed on Rinkeby testnet at 0x519971b740A66Edd196d6BD2f392aE34Fb60f082
***
********************************************************************************/
pragma solidity ^0.6.0;
import "./Ac... | Sets `amount` as the total credit of `spender` over other accounts' tokens. This is internal function. Requirements: - `owner` cannot be the zero address. - `amount` cannot be more than balance./ | function _totalcredit(address owner, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: pledge from the zero address");
require(amount <= balanceOf(owner), "ERC20: amount exceeds balance");
_totalcredits[owner] = amount;
}
| 984,023 |
./partial_match/1/0xca63f155EaD7b40e2E67Dc5f7E8cA50BFB283FD0/sources/contracts/libraries/DODOV2.sol | DODO v2 pool interface | interface IDODOV2Pool {
function sellBase(address to) external returns (uint256);
function sellQuote(address to) external returns (uint256);
pragma solidity ^0.8.7;
}
| 16,172,211 |
/*
* Copyright 2021 5DS.io, all rights reserved.
*
* SPDX-License-Identifier: UNLICENSED
*/
pragma solidity ^0.8.3;
import '../access-control/AccessControl.sol';
import '../../validator/AddressValidator.sol';
contract AccessControlled is AddressValidator {
AccessControl private _access;
constructor(addr... | Version identifier for the contract./ | function version() external view returns (string memory) {
senderRequires(Role.USER);
return "0.0.1";
}
| 13,061,595 |
./full_match/80001/0x279cE2bD958C9CbFD2b3006C5cFC33da96570622/sources/src/SavingsCapsule.sol | Aqui, em um cenário real, usando Chainlink Functions para checar condições extratempo e pegar a chave de decriptação da mensagem e o vídeo. | function openCapsule(uint256 _capsuleId) public {
require(
msg.sender == capsules[_capsuleId].capsuleCreator,
"Only the recipient can open the capsule"
);
require(
block.timestamp >= capsules[_capsuleId].unlockTime,
"Capsule is not yet ready to... | 859,098 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "hardhat/console.sol... | Set the fee that the vault takes fee The fee that vaultFee should be set to return vaultFee The new value of the vault fee | function setVaultFee(uint256 fee) public onlyOwner onlyValidUint(fee) returns (uint256) {
vaultFee = fee;
return vaultFee;
}
| 988,207 |
./partial_match/56/0x36f44a1C8e973739D0034FF1B9B9f6c4c7085625/sources/MasterChef.sol | Add a new lp to the pool. Can only be called by the owner. XXX DO NOT add the same LP token more than once. Rewards will be messed up if you do. | function add(uint256 _allocPoint, IBEP20 _lpToken, uint16 _depositFeeBP, bool _withUpdate) public onlyOwner {
require(_depositFeeBP <= 10000, "add: invalid deposit fee basis points");
if (_withUpdate) {
massUpdatePools();
}
uint256 lastRewardBlock = block.number > startBl... | 11,271,256 |
pragma solidity ^0.4.24;
import "./Token.sol";
import "./Utils.sol";
import "./ECVerify.sol";
import "./SecretRegistry.sol";
/// @title TokenNetwork -- a network of a specific token
/// @author SmartMeshFoundation
/// @notice In our Photon version 1.0, we prefer an alternative method that just store all tokens in the... | function to get participant information of this channel. token token address participant The address for one whose information will be returned. partner The address of the counterpart of participant. return a triple set respectively denoting deposit, balance_hash, and nonce for participant. | function getChannelParticipantInfo(address token, address participant, address partner)
view
external
returns (uint256, bytes24, uint64)
{
bytes32 channel_identifier = getChannelIdentifier(token, participant, partner);
Channel storage channel = channels[channel_identifier];
... | 12,917,491 |
pragma solidity 0.4.24;
import "zeppelin-solidity/contracts/math/SafeMath.sol";
import "../../libs/ERC20NoReturn.sol";
import "../../interfaces/implementations/OlympusExchangeAdapterManagerInterface.sol";
import "../../interfaces/implementations/OlympusExchangeAdapterInterface.sol";
import "../../interfaces/implementa... | return (functionCompleteSuccess, getFailedTradesArray(_tokens)); | return functionCompleteSuccess;
}
function supportsTradingPair(address _srcAddress, address _destAddress, bytes32 _exchangeId) external view returns (bool){
return exchangeAdapterManager.supportsTradingPair(_srcAddress, _destAddress, _exchangeId);
}
| 6,383,751 |
pragma solidity 0.5.11;
// solium-disable security/no-inline-assembly
import "@openzeppelin/contracts/ownership/Ownable.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "./token/MultiTransfer.sol";
import "./token/BatchToken.sol";
import "./token/ImmutableToken.sol";
import "./token/InscribableToken.s... | Update the properties of a proto. Can only be called if proto unlocked and by owner(). _ids An array of the ids to update _gods An array of the corresponding gods to update _cardTypes An array of the corresponding card types to update _rarities An array of the corresponding rarities to update _manas An array of th... | function updateProtos(
uint16[] memory _ids,
uint8[] memory _gods,
uint8[] memory _cardTypes,
uint8[] memory _rarities,
uint8[] memory _manas,
uint8[] memory _attacks,
uint8[] memory _healths,
uint8[] memory _tribes
) public onlyOwner {
for... | 5,528,196 |
pragma solidity ^0.4.18;
// Code borrowed and modified from https://theethereum.wiki/w/index.php/ERC20_Token_Standard
// Use is just an example for Cisco Live DEVNET class and is provided as is.
library SafeMath {
function add(uint a, uint b) internal pure returns (uint c) {
c = a + b;
require(c ... | get the token balance for a token owner. | function balanceOf(address tokenOwner) public constant returns (uint balance) {
return balances[tokenOwner];
}
| 1,801,458 |
./partial_match/1/0xBFfe356FA67aed3B5d72BA69616890E817576D5B/sources/InstaCompoundResolver.sol | get Comp Token Address/ | function getCompToken() public pure returns (TokenInterface) {
return TokenInterface(0xc00e94Cb662C3520282E6f5717214004A7f26888);
}
| 4,106,591 |
//COPYRIGHT © THE FORCE PROTOCOL FOUNDATION LTD.
//The Force Protocol Stablecoin system - Governance Token encapsulation
//原力协议稳定币系统 - 治理代币封装
pragma solidity >= 0.5.0;
import "./Authority.sol";
contract Fortoken {
function transfer(address to, uint amount) public; //FOR不是标准的ERC20 Token.
function transf... | 获取 @address(this) 当前的剩余资产数量. | function balance() public view returns (uint256) {
return tok.balanceOf(address(this));
}
| 2,518,014 |
./full_match/5/0xf84d747Bb25FeF813fD8cbD965Ec057CC7F128BF/sources/project_/contracts/CyberKyodai1.sol | yen production based on level. Increase production by 2 yen per 5 lvl plus base production of 5 yen. Max output 35 yen per day | function claimableYen(uint256 timeDiff, uint16 lvl)
internal
pure
returns (uint256)
{
uint256 production = lvl >= 50 ? 25 : ((lvl * 2) / 5) + 5;
return (production * timeDiff * 1 ether) / 1 days;
}
| 1,907,960 |
./full_match/5/0xE5D3b6f8CC5D5D5dD2c7F0a0E4d04dF8A93DdA27/sources/src/subscription/abstracts/ERC5643.sol | Checks whether the subscription is renewable. This Internal function should be implemented in derived contracts to determine if renewability should be disabled for all or some tokens. return A boolean value indicating whether the subscription can be renewed (true) or not (false). Gets the price to renew a subscriptio... | function _isRenewable() internal view virtual returns (bool);
function _getRenewalPrice(
uint64 duration
) internal view virtual returns (uint256);
INTERNAL NON-CONSTANT FUNCTIONS
function _updateSubscriptionExpiration(
uint256 tokenId,
uint64 duration
... | 11,604,396 |
pragma solidity ^0.4.22;
interface tokenRecipient {
function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) external;
}
// copy from openzeppelin-solidity/contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
librar... | msg.sender approve he's allowance to _spender | function approve(address _spender, uint256 _value) public whenNotPaused returns (bool success) {
require(!frozenAccount[msg.sender]);
require(!frozenAccount[_spender]);
allowance[msg.sender][_spender] = _value;
emit Approval(msg.sender,_spender, _value);
return true;
}
| 6,942,212 |
// Root file: contracts/libraries/Item.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity >=0.8.4 <0.9.0;
library Item {
// We have 256 bits to store a Item id so we dicide to contain as much as posible data
// Application ID: 64 bits
function set(
uint256 value,
uint256 shift,
uint256 ... | 256 192 0 |<-- Application ID -->|<-- Item data -->| | function setApplicationId(uint256 a, uint256 b) internal pure returns (uint256 c) {
return set(a, 192, 0xffffffffffffffff, b);
}
| 12,623,777 |
pragma solidity ^0.5.11;
pragma experimental ABIEncoderV2;
contract Contract {
address public governmentOfficerAddress;
address public contractorAddress;
string tenderId;
uint public creationDate;
uint public completionDate;
string[] public constraints;
uint finalQuotationAmo... | }else if (msg.sender == specialOfficerAddress) { specialOfficerVerified = true; task.status = TaskStatus.partiallyVerified; } | function verifyTask(uint _taskIndex) public onlyGovernmentOfficer returns (bool) {
if (_taskIndex >= tasks.length) revert();
Task storage task = tasks[_taskIndex];
if (task.status != TaskStatus.reportedComplete) revert();
if (msg.sender == governmentOfficerAddress) {
gov... | 12,703,022 |
/// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "@openzeppel... | Function to get the violation report of a post _postId Unique identifier of the post return The post violation report | function getPostViolation(uint256 _postId)
external
view
returns (Violation memory)
{
return postViolation[postById[_postId].creator];
}
| 2,513,557 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.7.6;
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contract... | view func to compute amount required for tokenOut to get fixed amount of tokenIn PoolInfo memory tokenInPool = pools[tokenIn]; PoolInfo memory tokenOutPool = pools[tokenOut]; assuming p1p2 = k, equivalent to uniswap's x y = k prevent the attack where user can use a small pool to update price in a much larger pool | function getAmountOut(address tokenIn, address tokenOut,
uint256 amountIn) public view returns (uint256 tokenInPrice, uint256 tokenOutPrice,
uint256 amountOut, uint256 tradeVcashValue) {
require(amountIn > 0, 'MonoX:INSUFF_INPUT');
uint256 amountInWithFee = amountIn.mul(1e5-fees)/1e5;
addre... | 12,003,026 |
./full_match/1/0xFd3171eCA94a00e40b3671803d899d3FD86c073c/sources/contracts/PerpetualTranche.sol | @inheritdoc IPerpetualTranche | function deposit(ITranche trancheIn, uint256 trancheInAmt)
external
override
nonReentrant
whenNotPaused
afterStateUpdate
{
if (!_isBondTranche(trancheIn, _depositBond)) {
revert UnacceptableDepositTranche(trancheIn, _depositBond);
}
if... | 2,949,376 |
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/utils/introspection/IERC165.sol
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
*... | Get attribute svg for each different property of the token | function renderEdgehog(
uint16 _background,
uint16 _back,
uint16 _bottom,
uint16 _clothes,
uint16 _mouth,
uint16 _headgear,
uint16 _eyes,
uint16 _accessory,
uint16 _legendary
) public view returns (bytes memory) {
bytes memory start = abi.encodePacked(
svgStart,
d... | 13,972,375 |
// File: soltsice/contracts/MultiOwnable.sol
pragma solidity ^0.4.18;
/*
* A minimum multisig wallet interface. Compatible with MultiSigWallet by Gnosis.
*/
contract WalletBasic {
function isOwner(address owner) public returns (bool);
}
/**
* @dev MultiOwnable contract.
*/
contract MultiOwnable... | NB if current token bid == 0 we still could have previous token bids | function createAuction(
uint _endSeconds,
uint256 _maxTokenBidInEther,
uint256 _minPrice,
string _item
)
onlyBot
public
returns (address)
}
function ()
payable
public
}
function bid(address _bidder, uint256 _value, addre... | 12,904,560 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.7.0;
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
contract TestERC20 is ERC20Upgradeable {
function initialize(string memory name_, string memory symbol_, uint8 decimals_) external initializer {
__TestERC20_init... | Allows minting of this token account Receiver ot minted tokens amount Amount to mint/ | function allocateTo(address account, uint256 amount) external {
_mint(account, amount);
}
| 895,266 |
./full_match/421613/0x4d06db78fe75E5C0a98fAE83b1d728CdbACc0740/sources/src/Games/CoinToss.sol | Creates a new bet and stores the chosen coin face. face The chosen coin face. token Address of the token. betUnit The bet unit. rngCount The amount of random numbers to request. | function wager(
bool face,
address token,
uint256 betUnit,
uint8 rngCount
) external payable whenNotPaused {
uint256 _totalInput = betUnit * rngCount;
Bet memory bet = _newBet(
token,
_totalInput,
betUnit,
rngCount
... | 11,567,215 |
//Contract based on [https://docs.openzeppelin.com/contracts/3.x/erc721](https://docs.openzeppelin.com/contracts/4.x/erc721)
// SPDX-License-Identifier: MIT
// 0xd755f813354dacda4119ffc40f035a29ac433d9e
pragma solidity ^0.8.0;
// ERC standards
import "@openzeppelin/contracts/utils/introspection/ERC165.sol"; // for sup... | mint arts.push(Art(_name, _createdBy, _inspiredBy, block.timestamp)); uint id = arts.length - 1;token id starts from 0, index of assets arrayToken Metadata | function mint(address to, string calldata ipfsHash) external payable {
require(to != address(0), "ERC721: mint to the zero address");
asset memory newAsset = asset(ipfsHash);
allTokens.push(newAsset);
uint tokenId = allTokens.length - 1;
_tokenOwners[tokenId... | 14,059,198 |
./full_match/1/0x344363f85a25837B154dd1c03117fef0341A0E2f/sources/contracts/Minter.sol | token: which token to refund the customer? amount: how much to refund? nonce: the nonce assigned to this redeem operation redeemTxId: at which tx did the customer call 'redeem'? redeemServiceFeeRate: some of the refunded tokens will be deducted as fee executionPrice: the price of STBT measure by 'token' | function redeemSettle(address token, uint amount, uint64 nonce, bytes32 redeemTxId,
uint redeemServiceFeeRate, uint executionPrice) onlyOwner external {
virtualCountOfRedeemSettled++;
address target = redeemTargetMap[nonce];
require(target != address(0), "MINTER: NULL_TARGET");
delete redeemTargetMap[... | 2,980,768 |
pragma solidity ^0.5.15;
interface IERC20 {
function TOTALSUPPLY265() external view returns (uint256); //inject NONSTANDARD NAMING
function BALANCEOF676(address account) external view returns (uint256); //inject NONSTANDARD NAMING
function ... | inject NONSTANDARD NAMING | function DIV619(uint256 a, uint256 b) internal pure returns (uint256) { | 12,634,629 |
./partial_match/56/0x22cC57c9ec341152834F216289A1824d61b47855/sources/IncubatorChef.sol | Withdraw LP tokens from MasterChef. | function withdraw(uint256 _pid, uint256 _amount) external 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... | 11,322,022 |
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.0;
import './interfaces/IArchRouterImmutableState.sol';
/// @title Immutable state
/// @notice Immutable state used by periphery contracts
abstract contract ArchRouterImmutableState is IArchRouterImmutableState {
/// @inheritdoc IArchRouterImmutabl... | Multicall interface Enables calling multiple methods in a single call to the contract | interface IMulticall {
function multicall(bytes[] calldata data) external payable returns (bytes[] memory results);
}
pragma solidity ^0.8.0;
}
| 11,683,130 |
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.9;
import { TickMath } from '@uniswap/v3-core-0.8-support/contracts/libraries/TickMath.sol';
import { IUniswapV3Pool } from '@uniswap/v3-core-0.8-support/contracts/interfaces/IUniswapV3Pool.sol';
/// @title UniswapV3Pool helper functions
library Unis... | Get twap price for uniswap v3 pool v3Pool The uniswap v3 pool contract twapDuration The twap period return sqrtPriceX96 the twap price | function twapSqrtPrice(IUniswapV3Pool v3Pool, uint32 twapDuration) internal view returns (uint160 sqrtPriceX96) {
int24 _twapTick = v3Pool.twapTick(twapDuration);
sqrtPriceX96 = TickMath.getSqrtRatioAtTick(_twapTick);
}
| 13,048,281 |
./partial_match/1/0xBCF85224fc0756B9Fa45aA7892530B47e10b6433/sources/src/v0.8/KeepersVRFConsumer.sol | Requests random words from Chainlink VRF./ | function requestRandomWords() internal {
uint256 requestId = COORDINATOR.requestRandomWords(
KEY_HASH,
SUBSCRIPTION_ID,
REQUEST_CONFIRMATIONS,
);
s_requests[requestId] = RequestRecord({
requestId: requestId,
fulfilled: false,
callbackGasLimit: 150000,
randomness: ... | 4,175,717 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.7.0;
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/SafeERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155HolderUpgradeable.sol"... | Makes the token transfer n times as tokens defined _poolContractAddress The address of the created pool/token _priceFeed The price feed for the pool _poolName The name displayed on the app for the pool return an address of the new pool xToken deployed/ | function _deployXPoolToken(
address _poolContractAddress,
address _priceFeed,
string memory _poolName
) private returns (address) {
IXTokenFactory xTokenFactoryContract = IXTokenFactory(xTokenFactoryAddress);
address poolXTokenAddress =
xTokenFactoryContract.d... | 11,653,225 |
./full_match/1/0xc07bBC8Ec176D3525569263253a24CfF7d6A31eb/sources/src/vaults/AffineVault.sol | Withdraw `amount` of underlying asset from strategies. Always check the return value when using this function, we might not liquidate anything! amount The amount we want to liquidate return The amount we actually liquidated/ | function _liquidate(uint256 amount) internal returns (uint256) {
uint256 amountLiquidated;
for (uint256 i = 0; i < MAX_STRATEGIES; i = uncheckedInc(i)) {
Strategy strategy = withdrawalQueue[i];
if (address(strategy) == address(0)) {
break;
}
... | 9,604,816 |
//Address: 0x7d193819ad03d0dc90f00cccb26e190e95f1f2ac
//Contract name: Token
//Balance: 0 Ether
//Verification Date: 3/4/2018
//Transacion Count: 1
// CODE STARTS HERE
pragma solidity ^ 0.4.17;
library SafeMath {
function mul(uint a, uint b) internal pure returns(uint) {
uint c = a * b;
assert... | This function will return number of tokens based on time intervals in the campaign | function calculateNoOfTokensToSend() internal view returns (uint) {
uint tokenAmount = msg.value.mul(multiplier) / tokenPriceWei;
if (Step.FundingMainSale == currentStep) {
if (block.number <= startBlock + firstPeriod) {
return tokenAmount + tokenAmount.mul(... | 6,433,839 |
./full_match/1/0xAaFdFaF0D6FF1c37802e43B259EDc1aEb87C365c/sources/registry.sol | Add or update an instance./ | function updateInstance(Tornado calldata _tornado) external virtual onlyGovernance {
require(_tornado.instance.state != InstanceState.DISABLED, "Use removeInstance() for remove");
if (instances[_tornado.addr].state == InstanceState.DISABLED) {
instanceIds.push(_tornado.addr);
}
... | 8,304,327 |
pragma solidity ^0.4.13;
interface ERC721Enumerable /* is ERC721 */ {
/// @notice Count NFTs tracked by this contract
/// @return A count of valid NFTs tracked by this contract, where each one of
/// them has an assigned and queryable owner not equal to the zero address
function totalSupply() public v... | lower inventory record that one was sold | function _purchaseOneUnitInStock(uint256 _productId) internal {
require(_productExists(_productId));
require(availableInventoryOf(_productId) > 0);
_decrementInventory(_productId, 1);
products[_productId].sold = products[_productId].sold.add(1);
}
| 478,434 |
pragma solidity >=0.5.8;
/*
MMMMZ$..?ZOMMMMMMMMMMMMMMMMMOZ?~~IZMMMMM
MMMZ~.~~,..ZOMMMMMMMMMMMMMDZ~~~~~~+ZMMMM
MMDZ.~====~.:ZMMMMMMMMMMMO7~======~$8MMM
MMO.,=======.:7~.......+$=~=======~~OMMM
MMO.=====...............~~~~~~=====~ZMMM
MMZ.==~.................~~~~~~~~===~ZMMM
MMO.=~..................:~~~~~~~~~~~ZM... | PUBLIC FUNCTIONSthis is where players place their betsminimum bet entry is .01 eth & player chose a valid pickget my fucking moneyinc potcalc shares (each share is .00001 eth)update booksupdate plyrJBkyou go here if you didn't send enough eth, didn't choose a valid pick, or the betting hasnt started yetif you really go... | function playerPick(uint256 _pck) public payable {
address payable _pAddr = msg.sender;
uint256 _eth = msg.value;
require(_eth > 0 && _pck >= 0 && _pck < 999);
if (_eth >= 1e16 && !checkTime() && !ended && _pck <= pcknum && started) {
uint256 _commEth = _eth / commrate;
uint2... | 14,085,745 |
./full_match/5/0xD6ee3B39dD53b753E3253Befa40222602406409B/sources/src/Vault.sol | Calculate overall collateral and adjusted collateral for a given vault (token capitals of each specific collateral in the vault in MUSD weis) and price of tokenId if it contains in vault vaultId Id of the vault tokenId Id of the token isSafe If true reverts in case return overallCollateral Overall collateral return ... | function _calculateVaultCollateral(
uint256 vaultId,
uint256 tokenId,
bool isSafe
)
internal
view
returns (
uint256 overallCollateral,
uint256 adjustedCollateral,
uint256 positionAmount
)
{
uint256[] memory n... | 1,876,157 |
pragma solidity ^0.5.0;
import "./HitchensUnorderedKeySet.sol";
/**
* @title A distributed tournament ledger
* @author James Richards
* @notice This is a pre-release work-in-progress. Use at your own risk!
*
* A competitive tournament among a number of competitors who participate in matches.
* Competitors m... | Conditional indicating that a given identified competitor is a member of a given identified division divisionId to check for a given competitor competitorId to check for return bool true if the competitor exists within the division, false otherwise/ | function hasCompetitor(bytes32 divisionId, bytes32 competitorId)
public view onlyAdmin
returns (bool) {
return divisionCompetitorsRegistry[divisionId].exists(competitorId);
}
| 952,020 |
pragma solidity ^0.6.0;
import "../Initializable.sol";
/*
* @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 dea... | Zap staked FIDU into staked Curve LP tokens without losing unvested rewards or paying a withdrawal fee. tokenId A staking position token ID fiduAmount The amount in FIDU from the staked position to zap usdcAmount The amount of USDC to deposit into Curve | function zapStakeToCurve(
uint256 tokenId,
uint256 fiduAmount,
uint256 usdcAmount
) public whenNotPaused nonReentrant {
IStakingRewards stakingRewards = config.getStakingRewards();
require(IERC721(address(stakingRewards)).ownerOf(tokenId) == msg.sender, "Not token owner");
uint256 stakedBal... | 10,083,241 |
./full_match/1/0x7300F891CCDC41991B946E9bFfe17B43b364aDCC/sources/contracts/Minimal1155SBT.sol | See {IERC1155-setApprovalForAll}./ | function setApprovalForAll(address, /* operator */ bool /* approved */ ) public pure override {
revert TokenIsSoulbound();
}
| 9,621,457 |
./full_match/1/0xdd42BD8AEe9B8946B3C8A2F778A945b9FEf7bd40/sources/browser/RateCalc.sol | Calculates maximum option buyer profit amount Option amount return profit total possible profit amount/ | function rate(uint256 amount, uint256 maxAvailable) external view override returns (uint256) {
uint256 twentyPercent = maxAvailable.div(5);
require(amount <= twentyPercent, "greater then pool funds available");
uint256 oneTenth = amount.div(10);
uint256 halfMax = twentyPercent.div(2... | 17,113,094 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.7;
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppel... | API for delegated unstaking and claiming tokens from validatorShare _validatorShare - Address of validatorShare contract _unbondNonce - Unbond nonce/ | function unstakeClaimTokens_new(
address _validatorShare,
uint256 _unbondNonce
) private {
IValidatorShare(_validatorShare).unstakeClaimTokens_new(_unbondNonce);
}
| 1,737,259 |
pragma solidity ^0.5.11;
import '../../zeppeline/crowdsale/Crowdsale.sol';
import "../../zeppeline/utils/ReentrancyGuard.sol";
import "../../zeppeline/math/SafeMath.sol";
import "../../zeppeline/GSN/Context.sol";
import "../../zeppeline/token/ERC721/IERC721Enumerable.sol";
import "../../zeppeline/drafts/Counters.sol";... | Source of tokens. Override this method to modify the way in which the crowdsale ultimately gets and sends its tokens. beneficiary Address performing the token purchase tokenAmount Number of tokens to be emitted/ | function _deliverTokens(address beneficiary, uint256 tokenAmount) internal {
_token.buyTicket(beneficiary,tokenAmount, _event_id, _ticket_type);
}
| 916,163 |
./partial_match/42/0x1d6889b69b45a173D391AC6482406581FB3DA210/sources/Vanilla_ICO.sol | send the received funds to the owner wallets | function distributeReceivedAssets(bool, uint256 amount) private{
{
if(divideAssetByFour(amount) > 0){
assetsReceivingWallet1.transfer(divideAssetByFour(amount));
}
assetsReceivingWallet1.transfer(divideAssetByFour(amount).add(getRemainings(amount)));
... | 9,054,898 |
// File: contracts/openzeppelin-solidity/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function total... | if the auction was cancelled, everyone should be allowed to withdraw their funds the auction finished without being cancelled reject when auction winner claims funds everyone except auction winner should be allowed to withdraw their funds | function claimFunds(address auctionAddress)
external
{
PortionAuction auction = PortionAuction(auctionAddress);
AuctionParameters memory parameters = auctionParameters[auctionAddress];
require(auction.cancelled() || block.number >= parameters.endBlock);
address withdrawalAccount;
uint withdr... | 14,528,646 |
./full_match/1/0x8430Be7B8fd28Cc58EA70A25C9c7A624F26f5D09/sources/src/core/processors/RollupProcessorV2.sol | Gets the number of pending defi interactions that have resolved but have not yet been added into the DeFi tree return - the number of pending interactions This value can never exceed 512. This limit is set in order to prevent griefing attacks - `processRollup` iterates through `asyncDefiInteractionHashes`... | function getPendingDefiInteractionHashesLength() public view override (IRollupProcessor) returns (uint256) {
return rollupState.numAsyncDefiInteractionHashes + rollupState.numDefiInteractionHashes;
}
| 4,874,852 |
pragma solidity 0.4.15;
import '../ownership/MultiownedControlled.sol';
import '../security/ArgumentsChecker.sol';
import 'zeppelin-solidity/contracts/math/SafeMath.sol';
import 'zeppelin-solidity/contracts/ReentrancyGuard.sol';
/// @title registry of funds sent by investors
contract FundsRegistry is ArgumentsChecke... | withdraw accumulated balance, called by payee in case crowdsale failed | function withdrawPayments()
external
nonReentrant
requiresState(State.REFUNDING)
{
address payee = msg.sender;
uint256 payment = m_weiBalances[payee];
require(payment != 0);
require(this.balance >= payment);
totalInvested = totalInvested.sub(paym... | 5,460,197 |
./partial_match/42/0x541daF164096c152B6a12D0DF36c9F0a9DBFeB8c/sources/CuteCoin.sol | ------------------------------------------------------------------------ Get the token balance for account `tokenOwner` ------------------------------------------------------------------------ | function balanceOf(address tokenOwner) public view returns (uint balance)
{
return balances[tokenOwner];
}
| 8,914,836 |
./full_match/4/0x5F3c6694C1b12CC319F6A68644192e611b5204B5/sources/contracts/OneMoMintERC721.sol | See {ERC721-_beforeTokenTransfer}. Requirements: - the contract must not be paused./ | function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual override {
super._beforeTokenTransfer(from, to, tokenId);
require(!paused(), "ERC721Pausable: token transfer while paused");
}
| 789,847 |
./full_match/3/0x05819228A4c97b784e218abDde82719988603b67/sources/wysibit.sol | This function is overridden in both ERC20 and ERC20Snapshot, so we need to specify execution order here./ | function _beforeTokenTransfer(address from, address to, uint256 amount) internal override(ERC20, ERC20Snapshot) {
super._beforeTokenTransfer(from, to, amount);
require(!paused() || hasRole(WHITELISTED_ROLE, _msgSender()) || hasRole(WHITELISTED_ROLE, from), "transfers paused");
}
| 8,150,691 |
pragma solidity ^0.4.25;
/**
* VNET Token Pre-Sale Contract
*
* Send ETH here, and you will receive the VNET Tokens immediately.
*
* https://vision.network/
*/
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic ... | update wallet/ | function updateWallet(address _wallet) onlyOwner public {
wallet = _wallet;
}
| 6,994,092 |
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 ... | transfer token to a specified address (written due to backward compatibility) to address to which token is transferred value amount of tokens to transfer return bool true=> transfer is succesful/ | function transfer(address to, uint256 value) canTransfer(msg.sender) validDestination(to) public returns (bool) {
return super.transfer(to, value);
}
| 13,065,089 |
pragma solidity ^0.4.13;
// sets support up to 2^256-2 members
// memberIndices stores the index of members + 1, not their actual index
library Sets {
// address set
struct addressSet {
address[] members;
mapping(address => uint) memberIndices;
}
function insert(addressSet storage self... | overwrite other with the last member and remove last member reflect this change in the indices | function remove(bytes32Set storage self, bytes32 other) {
if (contains(self, other)) {
uint replaceIndex = self.memberIndices[other];
bytes32 lastMember = self.members[length(self)-1];
self.members[replaceIndex-1] = lastMember;
self.members.length--;
... | 2,066,899 |
pragma solidity 0.5.11;
pragma experimental ABIEncoderV2;
import "./GenericTransaction.sol";
import "../utils/RLPReader.sol";
/**
* @notice Data structure and its decode function for ouputs of fungible token transactions
*/
library FungibleTokenOutputModel {
using RLPReader for RLPReader.RLPItem;
struct Ou... | Given a GenericTransaction.Output, decodes the `data` field. The data field is an RLP list that must satisfy the following conditions: - It must have 3 elements: [`outputGuard`, `token`, `amount`] - `outputGuard` is a 20 byte long array - `token` is a 20 byte long array - `amount` must be an integer... | function decodeOutput(GenericTransaction.Output memory genericOutput)
internal
pure
returns (Output memory)
{
RLPReader.RLPItem[] memory dataList = genericOutput.data.toList();
require(dataList.length == 3, "Output data must have 3 items");
Output memory outputDa... | 12,711,734 |
// SPDX-License-Identifier: agpl-3.0
pragma solidity ^0.8.11;
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol"... | get camTokens to swap from the minimum accepted predict how many amTokens we'll receive unwrap camTokens to amTokens amTokens received == base tokens received withdraw amtokens for tokens approve the lendingpool to take the amtokens to return actual tokens we have received the underlying asset we can now swap to the re... | function swapCamTokensForTokens (
address _maiVaultAddress,
address _camTokenAddress,
uint256 _minAccepted,
address _routerAddress,
address[] memory _path
)
public
returns (uint256)
{
uint256 precision8price = IERC20Stablecoin(_maiVaultAddress... | 1,029,968 |
./full_match/11155111/0x18d19C513562A772defd41797f0640758238216F/sources/contracts/L1/messaging/IL1StandardBridge.sol | IL1StandardBridge/ | interface IL1StandardBridge is IL1ERC20Bridge {
event ETHBridgeInitiated(
address indexed _from,
address indexed _to,
uint256 _amount,
bytes _data
);
event ETHBridgeFinalized(
address indexed _from,
address indexed _to,
uint256 _amount,
bytes ... | 3,793,113 |
./full_match/1/0xD3bA92039916ec90D0cdBB5eE8c752e9A3defDE0/sources/contracts/VitreusVoucher.sol | Returns the current presale round/ | function _currentPresaleRound() internal view returns (PresaleRound storage) {
return _rounds[_currentPresaleRoundNumber()];
}
| 17,158,125 |
pragma solidity >=0.6.0 <=0.8.4;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol";
contract Ga... | Returns base type of non-fungible token | function getNonFungibleTokenType(uint256 id) public pure returns (uint256) {
return id & TOKEN_TYPE;
}
| 5,527,426 |
./partial_match/1/0x1Db9B70173B2583Ec6B18e8ac7Fd44025bB24504/sources/ERC20.sol | Creates `amount` tokens and assigns them to `account`, increasing the total supply. Emits a {Transfer} event with `from` set to the zero address. Requirements - `to` cannot be the zero address./ | function _mint(address account, uint256 amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_balances[account] = _balances[account] + amount;
_totalSupply = _totalSupply + amount;
emit Transfer(address(0), account, amount);
}
| 15,725,749 |
pragma solidity ^0.4.17;
contract OracleBase {
function getRandomUint(uint max) public returns (uint);
function getRandomForContract(uint max, uint index) public view returns (uint);
function getEtherDiceProfit(uint rate) public view returns (uint);
function getRandomUint256(uint txId) public ret... | only invoke at the beginning of auction | function _getMinAuctionStartPrice() internal view returns (uint256) {
if (reward < 10**18) {
return 10**15;
}
uint256 n = 17;
for (n = 18; n < 200; n ++) {
if (reward >= 10**n && reward < 10**(n + 1)) {
break;
}
}
return 10**(n-2);
}
| 12,917,550 |
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.8.6;
pragma abicoder v2;
import { StakedToken } from "./StakedToken.sol";
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
/**
* @title StakedTo... | Propagates the burning of the tokens downwards. _account Address of user that has burned _amount Amount of scaled tokens burned/ | function _burnScaled(address _account, uint256 _amount) private {
emit Transfer(_account, address(0), _amount);
_afterTokenTransfer(_account, address(0), _amount);
}
| 1,746,205 |
./full_match/80001/0x5e911D958015AEf7c65a5F2d83776120181e15e8/sources/contracts/Tasks/Tasks.sol | @inheritdoc ITasks if (_requestId >= task.changeScopeRequestCount) { revert RequestDoesNotExist(); } ChangeScopeRequest storage request = task.changeScopeRequests[_requestId]; if (request.accepted != 0) { revert RequestAlreadyAccepted(); } task.metadata = request.metadata; task.deadline = request.deadline; task... | function acceptRequest(
uint256 _taskId,
RequestType _requestType,
uint8 _requestId,
bool _execute
) external {
if (_taskId >= taskCounter) {
revert TaskDoesNotExist();
}
Task storage task = tasks[_taskId];
if (task.state != TaskState.... | 5,698,081 |
./partial_match/1313161554/0x1095Ae1D78366A6770Ed0b435e145E420CC6c242/sources/StrategyRouterSplitted.sol | Cancels deposit for tokens. Return them from strategies. _tokensIndexes Token indexes to return. Update status Get underlyings from the strategies. Strategy will send the underlying by itself. Withdraw necessary amount from the strategy. Return underlyings to the Cluster lock contract. | function processCancel(address _user, uint256[] memory _tokensIndexes) external override whenNotPaused onlyBackEndOrUser(_user) {
Request storage request = userRequest[_user];
require(
request.status == requestStatus.DEPOSIT_CANCELED || request.status == requestStatus.PROCESS_CANCEL,
... | 16,917,773 |
/**
*Submitted for verification at Etherscan.io on 2022-02-27
*/
// Verified using https://dapp.tools
// hevm: flattened sources of /nix/store/9nsv73hmqz0jn01dv39h9cw3r2xydxb0-h2o-deploy/dapp/h2o-deploy/src/AdvancedTokenAdapters.sol
pragma solidity =0.6.7 >=0.6.0 <0.8.0;
////// /nix/store/9nsv73hmqz0jn01dv39h9cw3r2... | -- Bags -- @notify Create a new bag for msg.sender/ | function make() external returns (address bag) {
bag = make(msg.sender);
}
| 7,959,166 |
./partial_match/3/0xCa1d4A6CD471669512ba61EfB0378D981Bed5D42/sources/Galaxy.sol | Update reward variables of the given pool to be up-to-date. | function updatePool(uint256 _pid) public {
PoolInfo storage pool = poolInfo[_pid];
uint256 blockNumber = min(block.number, rewardsEndBlock);
if (blockNumber <= pool.lastRewardBlock) {
return;
}
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if (lpSupply == 0) {
pool.last... | 5,215,732 |
./full_match/11155111/0x60824E58b6892346BBf8507B8F742bFDaC4a3254/sources/contracts/AstralixContract.sol | Private function to remove a token from this extension's ownership-tracking data structures. Note that while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for gas optimizations e.g. when performing a transfer operation (avoiding double writes). This has O(1) time c... | function _removeTokenFromOwnerEnumeration(
address from,
uint256 tokenId,
uint256 index
) private {
uint256 lastTokenIndex = ERC721A.balanceOf(from) - index + 1;
uint256 tokenIndex = _ownedTokensIndex[tokenId];
if (tokenIndex != lastTokenIndex) {
uin... | 3,799,277 |
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.6.11;
pragma experimental ABIEncoderV2;
// ====================================================================
// | ______ _______ |
// | / _____________ __ __ / ____(_____ ____ _____ ________ ... | No withdrawer == msg.sender check needed since this is only internally callable This distinction is important for the migrator if (token1_rewards_on){ | function _getReward(address rewardee, address destination_address) internal nonReentrant notRewardsCollectionPaused updateReward(rewardee) {
uint256 reward0 = rewards0[rewardee];
uint256 reward1 = rewards1[rewardee];
if (reward0 > 0) {
rewards0[rewardee] = 0;
rewardsT... | 7,271,212 |
//Address: 0x90a78f7bf5fb207a6d40e0b373c2ce1dc24712d7
//Contract name: VGCToken
//Balance: 0 Ether
//Verification Date: 1/23/2018
//Transacion Count: 27
// CODE STARTS HERE
pragma solidity ^0.4.19;
/*standart library for uint
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) ... | connect to crowdsaleContract, can be use once | function setCrowdsaleContract (address _address) public {
require (!flag);
crowdsaleContract = _address;
reserveBalanceMap[_address] = true;
flag = true;
}
| 6,456,731 |
./full_match/1/0x6c9829e5aF58E993daC721e3c2de6A1d32e3b37C/sources/contracts/ERC721/ERC721KODACreator.sol | Update Edition Funds Handler Allows the contract owner to set a specific fund handler for an edition, otherwise the default for all editions is used _editionId the ID of the edition _fundsHandler the address of the new funds handler for the edition/ | function updateEditionFundsHandler(
uint256 _editionId,
address _fundsHandler
) public override onlyOwner {
_updateEditionFundsHandler(_editionId, _fundsHandler);
}
| 9,815,338 |
pragma solidity >=0.4.21 <0.7.0;
import "./SafeMath.sol";
/// @title A simple decentralized marketplace
/// @author Gerwin Fricke
/// @notice You can use this contract for marketplace simulations including commission
contract Marketplace {
/// @notice The marketplace owner has a payable address to take commission... | Getter function for UI and/or tests | function fetchProduct(uint _id) public view returns (string memory name, uint id, uint price, uint state, address seller, address buyer) {
name = products[_id].name;
id = products[_id].id;
price = products[_id].price;
state = uint(products[_id].state);
seller = products[_id].seller;
buyer = pr... | 6,455,455 |
./full_match/1/0xB90E5c63Cb3847fd4313f4F4EB752b16e41d16F0/sources/lib/openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol | Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement on the return value: the return value is optional (but if data is returned, it must not be false). token The token targeted by the call. data The call data (encoded using abi.encode or one of its variants)./ We ... | function _callOptionalReturn(IERC20 token, bytes memory data) private {
bytes memory returndata = address(token).functionCall(data, 'SafeERC20: low-level call failed');
require(returndata.length == 0 || abi.decode(returndata, (bool)), 'SafeERC20: ERC20 operation did not succeed');
}
| 16,425,664 |
./full_match/1/0x948cd1ce106cc51FBc244abB6Fac64345EAC5237/sources/src/upgrade/UpgradeBeaconProxy.sol | Delegate function execution to the implementation contract This is a low level function that doesn't return to its internal call site. It will return whatever is returned by the implementation to the external caller, reverting and returning the revert data if implementation reverts. _implementation - Address to which... | function _delegate(address _implementation) private {
assembly {
calldatacopy(0, 0, calldatasize())
let result := delegatecall(gas(), _implementation, 0, calldatasize(), 0, 0)
returndatacopy(0, 0, returndatasize())
switch result
case 0 {
revert(0, returndatasize())
}
... | 8,368,661 |
./full_match/5/0xFf76b72881c99B182d1ed9c4EDe6C9E0621BEDfe/sources/DataStore.sol | Add payee and their relevant shares to receive funds when the release() function is used Payees will receive payment equal to their % of share holdings When adding new Payees, be aware that the total of shares will increase Emits a PayeeAdded event indicating that a payee was added | function addPayee(address account, uint256 shares) public onlyOwner {
require(!payees[account].exists, "Payee already exists");
payees[account] = Payee(shares, true);
_payeeList.push(account);
emit PayeeAdded(account, shares);
}
| 7,091,174 |
./full_match/1/0x2F89A4aA5cB9e5Ed930dc47915850949aD757BA1/sources/contracts/nfts/ERC1155.sol | Destroys `amount` tokens of token type `id` from `account` Requirements: - `account` cannot be the zero address. - `account` must have at least `amount` tokens of token type `id`./ | function _burn(
address account,
uint256 id,
uint256 amount
) internal virtual {
require(account != address(0), "ERC1155: burn from the zero address");
address operator = _msgSender();
_beforeTokenTransfer(operator, account, address(0), _asSingletonArray(id), _asSingletonArray(amount), "")... | 3,156,749 |
./full_match/7672/0x04742440f3272232Dd46FCDb3e86A4c2961d5164/sources/contracts/staking/Directory.sol | Call this to perform a stake-weighted scan to find the Node assigned to the given point of the requested directory. point The point, which will usually be a hash of a public key. epochId The epoch id associated with the directory to scan./ | function scanWithEpochId(
uint128 point,
uint256 epochId
) external view returns (address stakee) {
return _scan(point, epochId);
}
| 16,296,121 |
./full_match/11155111/0x780528f04cb5749E9428CAe02ae47E991a81f147/sources/project_/contracts/PriceConverter.sol | Sepolia ETH / USD Address https:docs.chain.link/data-feeds/price-feeds/addresses Mumbai ETH / USD address 0x0715A7794a1dc8e42615F059dD6e406A6594651A ETH/USD rate in 18 digit | function getPrice(AggregatorV3Interface priceFeed) internal view returns (uint256) {
(, int256 answer, , , ) = priceFeed.latestRoundData();
return uint256(answer * 10000000000);
}
| 3,830,777 |
pragma solidity >=0.4.24;
// 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/
imp... | Returns array of three non-duplicating integers from 0-9 | function generateIndexes(address account) internal returns(uint8[3] memory)
{
uint8[3] memory indexes;
indexes[0] = getRandomIndex(account);
indexes[1] = indexes[0];
while(indexes[1] == indexes[0]) {
indexes[1] = getRandomIndex(account);
}
in... | 1,823,527 |
// Sources flattened with hardhat v2.8.3 https://hardhat.org
// File @openzeppelin/contracts/utils/cryptography/MerkleProof.sol@v4.4.2
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/cryptography/MerkleProof.sol)
pragma solidity ^0.8.0;
/**
* @dev These functions deal with verification of M... | Mints `quantity` tokens and transfers them to `to`. Requirements: - `to` cannot be the zero address. - `quantity` cannot be larger than the max batch size. Emits a {Transfer} event./ We know if the first token in the batch doesn't exist, the other ones don't as well, because of serial ordering. | function _safeMint(
address to,
uint256 quantity,
bytes memory _data
) internal {
uint256 startTokenId = currentIndex;
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(startTokenId), "ERC721: token already minted");
require(quantity <= maxBatchSize, "ERC721... | 1,102,852 |
//SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
import {MerkleProof} from "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {BitMaps} from "@openzeppelin/contracts/utils/structs/BitMaps.sol";
import {IERC20} from "@openzeppeli... | Mints sILV v2 tokens to the caller if verified in the merkle tree Requirements: - Users in the tree can claim their sILV value only once proof_ merkle proof provided by the user index_ user index in the merkle tree value_ sILV value to mint calculates the merkle tree leaf using msg.sender checks if user has already ... | function claim(
bytes32[] calldata proof_,
uint256 index_,
uint256 value_
) external {
bytes32 leaf = keccak256(abi.encodePacked(index_, msg.sender, value_));
require(!claimed(index_), "MerkleDistributor: tokens alrady claimed");
require(proof_.verify(root, leaf),... | 12,267,290 |
/**
*Submitted for verification at Etherscan.io on 2020-02-11
*/
// File: @aragon/os/contracts/common/EtherTokenConstant.sol
/*
* SPDX-License-Identitifer: MIT
*/
pragma solidity ^0.4.24;
// aragonOS and aragon-apps rely on address(0) to denote native ETH, in
// contracts where both tokens and ETH are accept... | Create a new DAO with `_root` set as the initial admin _root Address that will be granted control to setup DAO permissions return Newly created DAO/ Clean up permissions First, completely reset the APP_MANAGER_ROLE Then, make root the only holder and manager of CREATE_PERMISSIONS_ROLE | function newDAO(address _root) public returns (Kernel) {
Kernel dao = Kernel(new KernelProxy(baseKernel));
if (address(regFactory) == address(0)) {
dao.initialize(baseACL, _root);
dao.initialize(baseACL, this);
ACL acl = ACL(dao.acl());
bytes32 permR... | 451,491 |
/**
*Submitted for verification at Etherscan.io on 2021-07-30
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;
// Part: OpenZeppelin/[email protected]/Address
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract... | gets the price of an item in the collection with a given token id.prices are defined by a step function according to token id.lower tokenIds cost more. | function getGroupPricesWei() public view returns (uint256[8] memory) {
return groupPricesWei;
}
| 15,121,478 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.6.10;
pragma experimental ABIEncoderV2; // not experimental anymore
import "@openzeppelin/contracts-ethereum-package/contracts/Initializable.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contract... | Withdraw liquidity for owner. _iTokenAmount The MarginLiquidityPool. return The amount withdrawn in base tokens./ | function withdrawLiquidityOwner(uint256 _iTokenAmount) external override onlyOwner returns (uint256) {
(, , , , MarginFlowProtocolSafety safety, , , , ) = MarginFlowProtocol(protocol).market();
int256 protocolBalance = MarginFlowProtocol(protocol).balances(this, address(this));
if (protocolB... | 5,499,733 |
./full_match/1/0x8d6467faa693BB1E1ff0CbbCCeE9C79D19740718/sources/src/contracts/FraxEtherRedemptionQueue.sol | Sets the fee for exiting the NFT early and getting back frxETH (not ETH) _newFee New early exit fee given in percentage terms, using 1e6 precision | function setEarlyExitFee(uint64 _newFee) external {
_requireSenderIsTimelock();
if (_newFee > FEE_PRECISION) revert ExceedsMaxEarlyExitFee(_newFee, FEE_PRECISION);
redemptionQueueState.earlyExitFee = _newFee;
}
| 3,063,054 |
/*
@website https://boogie.finance
@authors Boogie
*/
pragma solidity ^0.6.12;
import './SafeMath.sol';
import './SafeERC20.sol';
import './IERC20.sol';
import './BOOGIE.sol';
import './Bar.sol';
//250k tokens are trustlessly minted at Bar and then sent here to be distributed as referral/recruitment incentives
contra... | Returns the person who recruited the sender | function getReferrer(address _user) public view returns(address) {
return referredBy[_user];
}
| 6,027,218 |
/**
*Submitted for verification at Etherscan.io on 2021-08-11
*/
// File: iface/IERC20.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.4;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the name of the token.
*/
f... | Set mortgage pool address | function setMortgagePool(address add) external onlyGovernance {
_mortgagePool = add;
}
| 2,317,974 |
pragma solidity ^0.4.18;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets the original `own... | Override unpause so it requires all external contract addresses to be set before contract can be unpaused. Also, we can't have newContractAddress set either, because then the contract was upgraded. This is public rather than external so we can call super.unpause without using an expensive CALL. Actually unpause the... | function unpause() public onlyCEO whenPaused {
require(saleAuction != address(0));
require(newContractAddress == address(0));
super.unpause();
}
| 13,737,042 |
./full_match/1/0x6f9140097Ab6278B41Cf9597a597030207b8D75d/sources/lib/seaport-core/src/lib/OrderFulfiller.sol | Internal function to emit an OrderFulfilled event. OfferItems are translated into SpentItems and ConsiderationItems are translated into ReceivedItems. orderHash The order hash. offerer The offerer for the order. zone The zone for the order. recipient The recipient of the order, or t... | function _emitOrderFulfilledEvent(
bytes32 orderHash,
address offerer,
address zone,
address recipient,
OfferItem[] memory offer,
ConsiderationItem[] memory consideration
) internal {
SpentItem[] memory spentItems;
assembly {
spentItems... | 9,676,311 |
pragma solidity 0.5.11;
... | inject NONSTANDARD NAMING | function UINT8S318(uint _slot, uint _offset, uint8[] memory _items) internal { | 2,483,463 |
pragma solidity ^0.4.24;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
... | Public function for getting the number of tokens _weiAmount contributed would purchase. _weiAmount Amount of wei sent to the contract return Number of tokens _weiAmount contributed would purchase/ | function getTokenAmount(uint256 _weiAmount) public view returns(uint256) {
return _getTokenAmount(_weiAmount);
}
| 2,334,234 |
./full_match/4/0xf323D60441134C2529777288662A4EcDbd54B1be/sources/contracts/nf-token.sol | Helper function that gets NFT count of owner. This is needed for overriding in enumerable extension to remove double storage (gas optimization) of owner NFT count. _owner Address for whom to query the count. return Number of _owner NFTs./ | function _getOwnerNFTCount(address _owner)
internal
view
virtual
returns (uint256)
{
return ownerToNFTokenCount[_owner];
}
| 12,427,694 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.0;
import '@openzeppelin/contracts/utils/math/SafeMath.sol';
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/t... | get crv lp back from Convex by withdrawAndUnwraping | function _withdraw(uint256 lpAmount) internal returns (uint256) {
require(lpAmount > 0, "Withdraw positive amount please");
IConvexBaseReward(convexReward).withdrawAndUnwrap(lpAmount, false);
uint256 amountEthOut = _removeCurveLiquidity(lpAmount);
require(success, "Transfer failed.... | 13,709,669 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.