file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
// SPDX-License-Identifier: MIT //** LFG MasterChef Contract */ //** Author Alex Hong : LFG Platform 2021.9 */ pragma solidity 0.6.6; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin...
Safe LFG transfer function, just in case if rounding error causes pool to not have enough LFGs.
function safeLFGTransferFrom( address _from, address _to, uint256 _amount ) internal { uint256 lfgBal = lfg.balanceOf(rewardHolder); if (_amount > lfgBal) { revert("Not enough balance"); lfg.transferFrom(_from, _to, _amount); } }
14,084,399
// File: localhost/base/InitializableOwnable.sol //SPDX-License-Identifier: SimPL-2.0 pragma solidity ^0.6.0; contract InitializableOwnable { address public _OWNER_; address public _NEW_OWNER_; bool internal _INITIALIZED_; event OwnershipTransferPrepared(address indexed previousOwner, address indexed...
this method is responsible for taking all fee, if takeFee is true
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private { if (!takeFee) removeAllFee(); if (_isExcluded[sender] && !_isExcluded[recipient]) { _transferFromExcluded(sender, recipient, amount); _transferToExcluded(sender, re...
184,166
./full_match/5/0x18C68B3adacE08C934408c343BC50a7EDe3F4aD7/sources/project_/contracts/EchoooERC721.sol
Required interface of an ERC721 compliant contract./
interface IERC721 is IERC165 { event Transfer(address indexed from, address indexed to, uint256 indexed tokenId, string txType); event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); event ApprovalForAll(address indexed owner, address indexed operator, bool approved); ...
1,859,613
//SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts/utils/introspection/ERC165.sol"; import "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol"; import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol"; import "@openzeppelin/contracts/token/ERC1155/extensions/IERC1155Meta...
See {IERC1155-safeTransferFrom}./
function safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes memory data ) public virtual override { require(to != address(0), "ERC1155: transfer to the zero address"); require( from == msg.sender || isApprovedForAll(f...
6,390,016
/** *Submitted for verification at Etherscan.io on 2022-02-02 */ // SPDX-License-Identifier: MIT pragma solidity ^0.8.4; // (c) by Mario, Santa Cruz - EspaΓ±a. interface ERC721 { /** * @dev Emits when ownership of any NFT changes by any mechanism. This event emits when NFTs are * created (`from` == 0) and des...
CONTRACT CUSTOM FUNCTIONS/
function includeToPrivateWhiteList(address[] memory _users) public { require(msg.sender==owner,"Only approved staff can act here"); for(uint8 i = 0; i < _users.length; i++) { whiteList[_users[i]] = true; } }
6,807,691
// SPDX-License-Identifier: MIT // Amended by LeZig /* ______ ______ _____ __ ______ ______ ______ __ __ __ __ ______ __ ______ ______ ______ ______ /\___ \ /\ __ \ /\ __-. /\ \ /\ __ \ /\ ___\ /\ ___\ /\ "-.\ \ /\ \ / / /\ __...
Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), reverting with custom message when dividing by zero. CAUTION: This function is deprecated because it requires allocating memory for the error message unnecessarily. For custom revert reasons use {tryMod}. Counterpart to Solidity's `%` o...
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); return a % b; }
13,457,786
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/access/AccessControl.sol"; contract NFT is ERC721, AccessControl { bytes32 public constant REDEEMER_ROLE = keccak256("REDEEMER_ROLE"); string private _mediaURI; ...
returns uri for audio file for owner
function mediaURI() public view returns(string memory) { return _mediaURI; }
5,385,142
pragma solidity ^0.7.0; pragma experimental ABIEncoderV2; /** * @title 1Inch(On-chain). * @dev On-chain and off-chian DEX Aggregator. */ import { TokenInterface , MemoryInterface } from "../../common/interfaces.sol"; import { Stores } from "../../common/stores.sol"; import { OneProtoInterface, OneProtoData, OnePro...
1proto contract multi swap handler oneProtoData - Struct with multiple swap data defined in interfaces.sol/
function oneProtoSwapMulti(OneProtoMultiData memory oneProtoData) internal returns (uint buyAmt) { TokenInterface _sellAddr = oneProtoData.sellToken; TokenInterface _buyAddr = oneProtoData.buyToken; uint _sellAmt = oneProtoData._sellAmt; uint _slippageAmt = getSlippageAmt(_buyAddr, _...
104,292
// SPDX-License-Identifier: MIT pragma solidity 0.8.10; import { Ownable } from "./lib/Ownable.sol"; import { SafeTransferLib } from "solmate/utils/SafeTransferLib.sol"; import { ReentrancyGuard } from "solmate/utils/ReentrancyGuard.sol"; import { ERC20 } from "solmate/tokens/ERC20.sol"; import { ERC721, ERC721Toke...
Cancels the auction and returns the asset to the auction owner Can only be called if an auction is in the INACTIVE or RESERVE_NOT_MET phases transfer auctionAsset to owner
function cancelAuction() public onlyOwner { require( currentPhase == AuctionPhase.INACTIVE || currentPhase == AuctionPhase.RESERVE_NOT_MET, "Auction::auction cannot be cancelled" ); emit Cancelled(msg.sender); currentPhase = ...
12,595,646
pragma solidity ^0.4.18; import "./lib/Ownable.sol"; import "./lib/Convert.sol"; import "./CardTypes.sol"; import "./Cards.sol"; contract Challenges is Ownable { enum challengeResultEnum {INITIATOR_WIN, CHALLENGER_WIN, DRAFT, UNKNOWN} struct Challenge { address initiator; address challenger; challe...
require(_challenge.initiator != msg.sender);
function accept(uint id, uint hero, uint[cardAmount] _cards) public { Challenge storage _challenge = challenges[id]; require(_challenge.challenger == address(0)); _challenge.challenger = msg.sender; _challenge.challengerHero = hero; _challenge.challengerCards = _cards; }
12,734,730
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.6.8; import "./ProtoBufRuntime.sol"; import "./GoogleProtobufAny.sol"; import "./Types.sol"; import "./Validator.sol"; import "./Proofs.sol"; import "./Commitment.sol"; library ClientState { //struct definition struct Data { string chain_id; Fract...
The decoder for reading a field p The offset of bytes array to start decode bs The bytes array to be decoded r The in-memory struct counters The counters for repeated fields return The number of bytes decoded/ if `r` is NULL, then only counting the number of fields./
function _read_time_delay( uint256 p, bytes memory bs, Data memory r, uint[10] memory counters ) internal pure returns (uint) { (uint64 x, uint256 sz) = ProtoBufRuntime._decode_uint64(p, bs); if (isNil(r)) { counters[9] += 1; r.time_delay = x; if (counters[9] > 0) counters[...
5,547,561
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC1155/ERC1155.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 * queri...
xref:ROOT:erc1155.adocbatch-operations[Batched] version of {_safeTransferFrom}. Emits a {TransferBatch} event. Requirements: - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the acceptance magic value./
function _safeBatchTransferFrom( address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual { require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"); require(to != address(0), "ERC1155: transfer to the zero ad...
5,879,056
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) { if (a == 0) { retur...
totalSupply function returns the total supply of tokens./
function totalSupply() public view returns (uint256) { return TOTAL_SUPPLY; }
8,052,369
./full_match/4/0x19D59Ea6A136Cc5Fd55e09b2Bacc745B2a0B4eE8/sources/contracts/interfaces/IProject.sol
MODIFIERS initialize this contract with required parameters. This is initialized by HomeFi contract modifier initializer _currency currency address for this project _sender address of the creator / builder for this project _homeFiAddress address of the HomeFi contract/ Contractor with fee schedule can be added t...
function initialize( address _currency, address _sender, address _homeFiAddress ) external virtual; function inviteContractor(bytes calldata _data, bytes calldata _signature) external virtual; function updateProjectHash(bytes calldata _data, bytes calldata _sign...
671,252
pragma solidity ^0.4.15; import "./AuctionInterface.sol"; /** @title GoodAuction */ contract GoodAuction is AuctionInterface { /* New data structure, keeps track of refunds owed to ex-highest bidders */ mapping(address => uint) refunds; /* Bid function, shifts to push paradigm * Must return true on successful s...
New data structure, keeps track of refunds owed to ex-highest bidders / Bid function, shifts to push paradigm Must return true on successful send and/or bid, bidder reassignment Must return false on failure and allow people to retrieve their funds/
function bid() payable external returns(bool) { if (msg.value <= highestBid){ refunds[msg.sender] = msg.value; return false; } if (highestBidder != 0){ refunds[highestBidder] = highestBid; } highestBidder = msg.sender; highestBid = msg.value; return true; }
1,789,979
// SPDX-License-Identifier: MIT // File: @openzeppelin/contracts/security/ReentrancyGuard.sol // OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the ...
See {IERC721-balanceOf}./
function balanceOf(address owner) public view override returns (uint256) { require(owner != address(0), 'ERC721A: balance query for the zero address'); return uint256(_addressData[owner].balance); }
14,565,524
pragma solidity ^0.5.12; library SafeMath { function MUL98(uint256 a, uint256 b) internal pure returns (uint256) { //inject NONSTANDARD NAMING if (a == 0) return 0; uint256 c = a * b; require(c / a == b); ...
inject NONSTANDARD NAMING
function SETPRICEORACLE428(address _priceOracle) public;
5,544,567
/** authorized to perform the sacred rituals of The Cult. Every Church Needs A Priest. **/ // SPDX-License-Identifier: MIT pragma solidity =0.8.10 >=0.8.10 >=0.8.0 <0.9.0; pragma experimental ABIEncoderV2; abstract contract Context { function _msgSender() internal view virtual returns (address) { retu...
/ exclude from paying fees or having max transaction amount
constructor() ERC20("Priest DAO", unicode"PRIEST") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02( 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D ); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswapV2...
13,799,385
./full_match/3/0x777Ad6549e2a1fd15142cF1794e02Baa161be659/sources/home/jonathancole/Documents/GitHub/cryptokitties-clone/contracts/Kittycontract.sol
color mixing algorithm for mouth, belly and tail in colors.js file the color ranges are: red 9-24 orange 25-39 yellow 40-54 green 55-69 blue 70-84 purple 85-98 / this is 'eye shape' and 'markings shape' only numbers less than 80 (for the 'tens' digit, eye shape) AND less than 8 (for the 'ones' digit, markings shape) ...
function _mixDna(uint256 _dadDna, uint256 _momDna) internal returns (uint256) { uint256[8] memory geneArray; uint256 mom_Dna = _momDna; uint256 dad_Dna = _dadDna; uint256 rand100 = now % 100; uint256 rand10 = now % 10; uint256 index = 7; uint256 mouth = 1e12...
8,228,717
/** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { // Gas optimization: this is cheaper than asserting 'a' not...
Check whether contract is initialised return true if initialized
function isInitialized() public constant returns (bool) { return isInitialized_; }
5,374,371
// SPDX-License-Identifier: MIT pragma solidity ^0.7.6; import "./utils/Context.sol"; import "./interfaces/IERC721.sol"; import "./interfaces/IERC721Metadata.sol"; import "./interfaces/IERC721Enumerable.sol"; import "./interfaces/IERC721Receiver.sol"; import "./utils/ERC165.sol"; import "./utils/SafeMath.sol"; import...
See {IERC721-safeTransferFrom}./
function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) public override { require(_isApprovedOrOwner(_msgSender(), tokenId), "Anoncats: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); }
10,180,118
pragma solidity 0.5.15; contract IAugur { function createChildUniverse(bytes32 _parentPayoutDistributionHash, uint256[] memory _parentPayoutNumerators) public returns (IUniverse); function isKnownUniverse(IUniverse _universe) public view returns (bool); function trustedCashTransfer(address _from, address _...
1. Create a user's wallet if it does not exist 2. Get funds from the wallet to compensate this contract for paying the relayer 3. Execute the transaction and return success status, or revert if appropriate 4. Fund the signer with ETH as specified
function executeWalletTransaction(address _to, bytes calldata _data, uint256 _value, uint256 _payment, address _referralAddress, bytes32 _fingerprint, uint256 _desiredSignerBalance, uint256 _maxExchangeRateInDai, bool _revertOnFailure) external { address _user = _msgSender(); IAugurWallet _wallet = ...
12,948,708
./full_match/42/0xe66C93545aee977584bA8Bb9c4079C765761F6c0/sources/PaymentSystem.sol
amountInMax must be retrieved from an oracle of some kind
function swapExactOut(address _fromToken, address _toToken, uint256 _amountOut, uint256 _msgValue) internal returns(uint256, uint256) { address[] memory path = new address[](2); path[0] = _fromToken; path[1] = _toToken; uint[] memory amounts; if(_fromToken == SwapRouter.WETH()){ req...
9,595,123
./full_match/7701/0x03BCE3eDEaD608171FBcDaB63961dbba3e811e45/sources/src/VotingEscrow.sol
See IVotingEscrow for documentation A lock is active until both lock.amount==0 and lock.end<=block.timestamp Validate inputs Update lock Undelegated lock Delegated lock, update sender's lock first Then, update delegatee's lock and voting power (checkpoint)
function increaseAmount(uint256 _value) external payable nonReentrant { LockedBalance memory locked_ = locked[msg.sender]; require(_value > 0, "Only non zero amount"); require(msg.value == _value, "Invalid value"); require(locked_.amount > 0, "No lock"); require(locked_.end >...
13,216,408
pragma solidity ^0.5.6; import "./openzeppelin-solidity/contracts/token/ERC20/ERC20Detailed.sol"; import "./openzeppelin-solidity/contracts/token/ERC20/ERC20.sol"; import "./openzeppelin-solidity/contracts/token/ERC20/ERC20Burnable.sol"; import "./openzeppelin-solidity/contracts/token/ERC20/SafeERC20.sol"; import "./o...
Allows owner to claim any ERC20 tokens.
function claimTokens(ERC20 token) external payable onlyOwner { require(address(token) != address(0), "Invalid address"); uint256 balance = token.balanceOf(address(this)); token.transfer(owner(), token.balanceOf(address(this))); emit TokensClaimed(address(token), balance); }
910,286
./full_match/1/0x556d9E146CC7Fe7DF93fBdd90347Af8930acb104/sources/browser/Contract_Code_Min.sol
ERC20Basic Simpler version of ERC20 interface/
interface ERC20Basic { function totalSupply() external view returns (uint256); function balanceOf(address who) external view returns (uint256); function transfer(address to, uint256 value) external returns (bool); event Transfer( address indexed _from, address indexed _to, uint25...
3,090,232
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "@openzeppelin/contracts/GSN/Context.sol"; import "@openzeppelin/contracts/token/ERC777/IERC777.sol"; import "@openzeppelin/contracts/token/ERC777/IERC777Recipient.sol"; import "@openzeppelin/contracts/token/ERC777/IERC777Sender.sol"; import "@ope...
Unset game contract as default operator
function removeGameContract(address game) public onlyGameMaster() { _removeDefaultOperator(game); }
1,228,446
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; import "./IVoteD21.sol"; /** * @title D21 voting system contract * @author smrza * @notice More about D21 voting system: https://www.ih21.org/en/d21-janecekmethod */ contract D21 is IVoteD21 { address immutable public owner; // Chairperson or someone impo...
Gets all subjects' addresses return The addresses of subjects/
function getSubjects() external view returns(address[] memory) { return subjectsAddr; }
15,782,244
./full_match/43114/0xd288A09f07C5AfBd65AEa7ba9534D5f830f9d1c6/sources/ArkenDexV2.sol
ETH => TOKEN TOKEN => ETH
function _tradeIDfyn( IERC20 _src, IERC20 _dest, uint256 inputAmount, uint256 minOutputAmount, address[] memory paths, address to, address dexAddr ) private returns (uint256[] memory amounts) { IUniswapV2Router02 uniRouter = IUniswapV2Router02(dexA...
4,582,035
//File: contracts/Owned.sol pragma solidity ^0.4.19; /// @title Owned /// @author AdriΓ  Massanet <adria@codecontext.io> /// @notice The Owned contract has an owner address, and provides basic /// authorization control functions, this simplifies & the implementation of /// user permissions; this contract has three ...
Update a DAppNode package idPackage the id of the package to be changed name the new ENS name of the package repo the new AragonPackageManager address of the repo. An event to notify that a package has been updated
function updatePackage ( uint idPackage, string name, address repo ) onlyOwner public { require(idPackage < DAppNodePackages.length); DAppNodePackage storage c = DAppNodePackages[idPackage]; c.name = name; c.repo = repo; PackageUpdated(idPackage,na...
13,943,330
pragma solidity ^0.4.25; /** * Math operations with safety checks */ library Safe { function safeMul(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function safeDiv(uint256 a, uint256 b) internal pure returns (uint25...
_value The amount of token to be unfreeze return Is it successfully unfroze
function unfreeze(uint256 _value) public returns (bool) { require(freezeOf[msg.sender] >= _value); require(_value > 0); freezeOf[msg.sender] = Safe.safeSub(freezeOf[msg.sender], _value); balanceOf[msg.sender] = Safe.safeAdd(balanceOf[msg.sender], _value); emit Unfreeze(msg.se...
6,390,044
pragma solidity ^0.4.8; contract CryptoWaifusMarket { // You can use this hash to verify the image file containing all the waifus string public imageHash = "ac39af4793119ee46bbff351d8cb6b5f23da60222126add4268e261199a2921b"; address owner; string public standard = "CryptoWaifus"; string pu...
Remember to zero the pending refund before sending to prevent re-entrancy attacks
function withdraw() { if (!allWaifusAssigned) throw; uint256 amount = pendingWithdrawals[msg.sender]; pendingWithdrawals[msg.sender] = 0; msg.sender.transfer(amount); }
912,726
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../utils/Context.sol"; /** * @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. * * By default, the owner account will be...
Unpack parameters sent from the `liquidate` function NOTE: these are being passed in from some other contract, and cannot necessarily be trusted Perform the liquidation Redeem cTokens for underlying ERC20 Compute debt and pay back pair Convert WETH to ETH Perform the liquidation Redeem cTokens for underlying ERC20 Comp...
function uniswapV2Call(address sender, uint amount0, uint amount1, bytes calldata data) override external { (address borrower, address repayCToken, address seizeCToken) = abi.decode(data, (address, address, address)); address token0 = IUniswapV2Pair(msg.sender).token0(); address token1 = IU...
1,329,758
pragma solidity 0.4.25; library Math { function min(uint a, uint b) internal pure returns(uint) { if (a > b) { return b; } return a; } } library Zero { function requireNotZero(address addr) internal pure { require(addr != address(0), "require not zero...
Adds two numbers, reverts on overflow./
function add(uint256 _a, uint256 _b) internal pure returns (uint256) { uint256 c = _a + _b; require(c >= _a); return c; }
15,854,893
// SPDX-License-Identifier: MIT // Copyright (c) 2021 the ethier authors (github.com/divergencetech/ethier) pragma solidity >=0.8.0 <0.9.0; import "../../contracts/crypto/SignatureChecker.sol"; import "../../contracts/crypto/SignerManager.sol"; import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; /** @no...
Reverts if the signature is invalid or the nonce is already used.
@notice Exposes functions allowing testing of SignatureChecker. ) external { signers.requireValidSignature( abi.encodePacked(data, nonce), signature, usedMessages ); }
15,841,998
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0 <0.9.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; /** * @title DEX Template * @author stevepham.eth and m00npapi.eth * @notice Empty DEX.sol that just outlines what features could be pa...
allows deposits of $BAL and $ETH to liquidity pool NOTE: parameter is the msg.value sent with this function call. That amount is used to determine the amount of $BAL needed as well and taken from the depositor. NOTE: user has to make sure to give DEX approval to spend their tokens on their behalf by calling approve fun...
function deposit() public payable returns (uint256 tokensDeposited) {}
12,753,060
./partial_match/1/0xE19b31c00c01Ab38ea279E93aC66CA773D314c91/sources/src/interfaces/pool/erc721/IERC721PoolBorrowerActions.sol
ERC721 Pool Borrower Actions/
interface IERC721PoolBorrowerActions { function drawDebt( address borrower_, uint256 amountToBorrow_, uint256 limitIndex_, uint256[] calldata tokenIdsToPledge_ ) external; function repayDebt( address borrowerAddress_, uint256 maxQuoteTokenAmountToRepay_, ...
3,951,590
/* Copyright 2018 ZeroEx Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, ...
Verifies that an order signature is valid. signer address of signer. hash Signed Keccak-256 hash. v ECDSA signature parameter v. r ECDSA signature parameters r. s ECDSA signature parameters s. return Validity of order signature.
function isValidSignature( address signer, bytes32 hash, uint8 v, bytes32 r, bytes32 s) public constant returns (bool) { bytes32 signedData = keccak256("\x19Ethereum Signed Message:\n32", hash); return edverify(signer, abi.encodePac...
12,596,806
./partial_match/1/0x82a90C0FF84F8cEe692C9C6C7351DA28bB331154/sources/lib/mip21-toolkit/src/conduits/RwaSwapOutputConduit.sol
Revokes `usr` operator access from this contract. usr The user address./
function nope(address usr) external auth { can[usr] = 0; emit Nope(usr); }
3,691,851
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; import "hardhat/console.sol"; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import "./OutfitNFT.sol"; // import "@openzeppelin/contracts/introspection/IERC165.sol"; //import "./Royalty.sol"; //PR...
Returns True if the token exists, else false.
function tokenExists(uint256 _tokenId) external view returns (bool){ return _exists(_tokenId); }
7,298,424
./partial_match/1/0x740392312D99A4eCEE6549AEB8fa6Eb0a579e8F8/sources/TraderPaired.sol
Approve exit of investment _traderAddress trader address _investorAddress investor address _signer Signer address _investmentId investment id _token token address _amount transaction amount
function approveExit(address _traderAddress, address _investorAddress, address _signer, uint256 _investmentId, address _token, uint256 _amount) public whenNotPaused onlyWallet returns (uint256[3] memory payouts) { _Trader memory _trader = traders[_traderAddress]; ...
16,110,636
// SPDX-License-Identifier: MIT pragma solidity ^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 totalSupply() external view returns (uint256); /** * @dev Returns the amount o...
Hash to SVG function/
function hashToSVG(string memory _hash) public view returns (string memory) { string memory svgString; bool[24][24] memory placedPixels; for (uint8 i = 0; i < 9; i++) { uint8 thisTraitIndex = AnonymiceLibrary.parseInt( AnonymiceLibrary...
5,731,679
./full_match/137/0x9E30F3C8BF0309A169347d8762efc53FDb3d941e/sources/contracts/ART_SALE.sol
Call Chainlink VRF to get random number
function getStartingIndex() external onlyOwner { require(startingIndex == 0, "startingIndex is set already"); require(block.timestamp >= startTimestamp, "Sale is inactive"); require(totalSupply() > MAX_SUPPLY / 5, "Need at least 1/5 supply sold"); requestRandomness(KEY_HASH, LINK_FEE...
4,698,637
./full_match/80001/0x1F60b3be173EA9B5D1301Dd39f8A7cA70B4ABee4/sources/contracts/padisah.sol
See {IERC721Enumerable-tokenByIndex}./
function tokenByIndex(uint256 index) public view virtual override returns (uint256) { require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds"); return _allTokens[index]; }
5,578,023
./full_match/1/0x7924743bdD32d1fD1769F703d712eEeCCB59aEfE/sources/contracts/NftKeysV1.sol
Destroys token with ID This has to be overridden even though it is not used tokenId Token ID
function _burn( uint256 tokenId ) internal virtual override(ERC721Royalty, ERC721) { ERC721Royalty._burn(tokenId); }
2,933,114
./full_match/42/0x43Db1564c757410B031791C65bE972F4f861de15/sources/browser/LAOLAND.sol
Internal function that burns an amount of the token of a given account, deducting from the sender's allowance for said account. Uses the internal burn function. Emits an Approval event (reflecting the reduced allowance). account The account whose tokens will be burnt. value The amount that will be burnt./
function _burnFrom(address account, uint256 value) internal { _burn(account, value); _approve(account, msg.sender, _allowances[account][msg.sender] - value); }
16,274,908
// SPDX-License-Identifier: MIT pragma solidity ^0.7.4; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./interfaces/IBMIStaking.sol"; import "./interfaces/IContractsRegist...
keccak256(AbstractDependant.setInjector(address)) - 1
function stakeWithPermit( uint256 _amountBMI, uint8 _v, bytes32 _r, bytes32 _s ) external; function stakeFor(address _user, uint256 _amountBMI) external; function stake(uint256 _amountBMI) external; function maturityAt() external view returns (uint256); functi...
10,143,040
./partial_match/1/0x9078976c0b05ffed53b792dBF406af49faBbb925/sources/ONEPIECE.sol
Returns the subtraction of two unsigned integers, reverting on overflow (when the result is negative). Counterpart to Solidity's `-` operator. Requirements: - Subtraction cannot overflow./
function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMathHelper: subtraction overflow"); }
2,828,217
// File: openzeppelin-solidity/contracts/ownership/Ownable.sol pragma solidity ^0.5.0; /** * @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 w...
return the total amount of token being held in this vault/
function totalBalance() public view returns(uint256) { return _totalBalance; }
12,574,897
pragma solidity >0.5.4; import "@daostack/arc/contracts/controller/Avatar.sol"; import "./SchemeGuard.sol"; import "../../identity/Identity.sol"; import "../../identity/IdentityGuard.sol"; /** * @dev Contract for letting scheme add itself to identity * to allow transferring GoodDollar without paying fees * and tra...
Internal function to add contract to identity. Can only be called if scheme is registered./
function addRights() internal onlyRegistered { controller.genericCall( address(identity), abi.encodeWithSignature("addContract(address)", address(this)), avatar, 0 ); transferOwnership(address(avatar)); }
12,962,703
pragma solidity ^0.4.24; /** * @title LotteryInterface */ interface LotteryInterface { function claimReward(address playerAddress, uint256 tokenAmount) external returns (bool); function calculateLotteryContributionPercentage() external constant returns (uint256); function getNumLottery() external constant...
Allows player to withdraw balance in case of a failed win send return Return true if success/ External call to untrusted contract
function playerWithdrawPendingTransactions() public gameIsActive { require(playerPendingWithdrawals[msg.sender] > 0); uint256 withdrawAmount = playerPendingWithdrawals[msg.sender]; playerPendingWithdrawals[msg.sender] = 0; if (!msg.sender.send(withdrawAmount)) { playerPendingWithdrawals[msg.sender] = w...
12,551,523
// SPDX-License-Identifier: MIT pragma solidity ^0.6.6; pragma experimental ABIEncoderV2; import "./NumericalMath.sol"; import "./FixidityLib.sol"; import "https://github.com/smartcontractkit/chainlink/blob/master/evm-contracts/src/v0.6/VRFConsumerBase.sol"; import "https://github.com/jstat17/Random-Walk-NFT/bl...
Set the token URI for an NFT so that it can be viewed in a market like opensea. tokenID: the ID of the specific NFT _tokenURI: the token URI/
function setTokenURI(uint256 tokenID, string memory _tokenURI) public { require( _isApprovedOrOwner(_msgSender(), tokenID), "ERC721: transfer caller is not owner nor approved" ); _setTokenURI(tokenID, _tokenURI); }
5,478,213
pragma solidity ^0.5.0; contract TrustMe { // TrustMe events event newProject(string name, string description, uint stakeToSell, uint projectValuation, uint finishCriteria); event investment(address investor, string projectName, uint amount, uint stakeBuyed); event projectWithdraw(string name, uint balance); ...
get all address projects count
function getAddressProjectsIndexes () public view returns ( uint[] memory ) { return projects[msg.sender]; }
12,551,253
./full_match/4/0xbdB88734C86D0613Daad4218865A2d5474F13173/sources/browser/OroNetwork.sol
Shows latest USDC price for given asset/ Asset Price USDC Price Converting to gram
function toUSDC(address assetAdd, uint256 asset) public view returns(uint256) { if (asset == 0) return 0; uint256 value; return value; }
728,319
./full_match/80001/0xf2F9Dc580289FC127D88f6A6FeF19b0e3c99BBCd/sources/contracts/ClearingHouse.sol
@inheritdoc IClearingHouse input requirement checks: maker: in _cancelExcessOrders() baseToken: in Exchange.settleFunding() orderIds: in OrderBook.removeLiquidityByIds()
function cancelExcessOrders( address maker, address baseToken, bytes32[] calldata orderIds ) external override whenNotPaused nonReentrant { _checkMarketOpen(baseToken); _cancelExcessOrders(maker, baseToken, orderIds); }
9,453,994
./partial_match/3/0x9BEA3F2Ac6bF212E6F63270B3d918E2B711518E9/sources/Flashloan.sol
/bytes memory data = "";
function flashloan(address _asset, bytes memory data) public onlyOwner { uint amount = 1 ether; ILendingPool lendingPool = ILendingPool(addressesProvider.getLendingPool()); lendingPool.flashLoan(address(this), _asset, amount, data); }
5,229,391
./full_match/42/0x9978Bc141d6fb9E9b3E0E63EfEAaa359c8355081/sources/contracts/FRToken.sol
Sets a new reserve factor for the protocol (requires fresh interest accrual) Admin function to set a new reserve factor return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/ Check caller is admin Verify market's block number equals current block number Check newReserveFactor ≀ maxReserveFacto...
function _setReserveFactorFresh(uint newReserveFactorMantissa) internal returns (uint) { if (msg.sender != admin) { return fail(Error.UNAUTHORIZED_I, FailureInfo.SET_RESERVE_FACTOR_ADMIN_CHECK); } if (accrualBlockNumber != getBlockNumber()) { return fail(Error.MARKET...
16,224,255
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; contract UnidirectionalPaymentChannelHub { struct PaymentChannel { address payable sender; address payable recipient; address tokenAddress...
the recipient can close the channel at any time by presenting a signed amount from the sender. the recipient will be sent that amount, and the remainder will go back to the sender ERC20 Token Ether
function close(address sender, address recipient, address tokenAddress, uint256 amount, bytes memory signature) public { require(_channelExists(sender, recipient, tokenAddress), "Channel does not exist"); bytes32 id = usersToId[sender][recipient][tokenAddress]; PaymentChannel storage channel...
14,064,838
./partial_match/1/0xa6Ec49E06C25F63292bac1Abc1896451A0f4cFB7/sources/ERC20Plus.sol
Check the proof of an address if valid for merkle root _to address to check for proof _merkleProof Proof of the address to validate against root and leaf/
function isAllowlisted(address _to, bytes32[] calldata _merkleProof) public view returns(bool) { if(merkleRoot == 0) revert ValueCannotBeZero(); bytes32 leaf = keccak256(abi.encodePacked(_to)); return MerkleProof.verify(_merkleProof, merkleRoot, leaf); }
15,666,034
./partial_match/1/0xa4Bc10991e2721762E30B50Ea6D6b3A1B76750D9/sources/EverBurn.sol
approve the Uniswap Router to spend the contract's WETH calculate the amount of Token B that will be received
function buyAndBurnEvermoon(uint256 amountETH) internal { address[] memory path = new address[](2); path[0] = uniswapV2Router.WETH(); path[1] = evermoon; IERC20(uniswapV2Router.WETH()).approve(address(uniswapV2Router), amountETH); uint[] memory amounts = uniswapV2Router.get...
9,139,665
pragma solidity 0.4.25; // https://github.com/ethereum/EIPs/issues/20 interface TRC20 { function totalSupply() external view returns (uint supply); function balanceOf(address _owner) external view returns (uint balance); function transfer(address _to, uint _value) external returns (bool success); funct...
get the balance of a user. token The token type return The balance
function getBalance(TRC20 token, address user) public view returns(uint) { if (token == TOMO_TOKEN_ADDRESS) return user.balance; else return token.balanceOf(user); }
1,804,195
./full_match/1/0x40Cd77D9aa9e0b2D485259415eA05486B201c514/sources/contracts/nfts/ValidatorNft.sol
Returns the validators that are active (may contain validator that are yet active on beacon chain)/
function activeValidators() external view returns (bytes[] memory) { uint256 total = _nextTokenId(); uint256 tokenIdsIdx; bytes[] memory validators = new bytes[](total); TokenOwnership memory ownership; for (uint256 i = _startTokenId(); i < total; ++i) { ownership = _ownershipAt(i); ...
16,606,208
./full_match/5/0x583b09559F81656D81dD9AeC42E088Ed5b86631e/sources/project_/contracts/MetawinCollectibleRewardsSale.sol
[Admin] Unpause the contract/
function unpauseContract() external onlyRole(DEFAULT_ADMIN_ROLE) { _unpause(); }
1,930,668
./full_match/1/0x6ccfD65b0b14F67259C77Ca6267104e058dDB292/sources/contracts/tokenBridge/TokenBridge.sol
Contract will be used as proxy implementation. _messageService The address of the MessageService contract. _tokenBeacon The address of the tokenBeacon. _sourceChainId The source chain id of the current layer _targetChainId The target chaind id of the targeted layer _reservedTokens The list of reserved tokens to be...
function initialize( address _securityCouncil, address _messageService, address _tokenBeacon, uint256 _sourceChainId, uint256 _targetChainId, address[] calldata _reservedTokens ) external nonZeroAddress(_securityCouncil) nonZeroAddress(_messageService) nonZeroAddress(_tokenBeacon) initialize...
2,969,309
// File: @openzeppelin/contracts/utils/Context.sol // SPDX-License-Identifier: MIT 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 generally available * via msg.sender and msg.data, they sh...
To set the amount of allowd withdrawal daily amount _limit is the value to be set as daily limit/
function setDailyLimit(uint256 _limit) external onlyOwner { require(_limit > 0, "limit must be greater than zero."); dailyLimit = _limit ; }
12,918,949
./full_match/8217/0xe41066e28Ff95244741262Bd877015Edf3f8a9a0/sources/contracts/StKlay.sol
Unpauses functionality Emits a `Unpaused` event/
function unpause() external onlyRole(ROLE_PAUSER) { _unpause(); }
13,229,562
./full_match/421613/0x230a9e216E7d5DDFcB0ff52e3E217e642fbf67ad/sources/contracts/Material.sol
random = random + (random / (i + 1) + random (random - i)) + i i;
function getRewardUnits( uint256 _chestId, uint256 _amountToOpen ) internal returns (uint256[] memory tokenIds, uint256[] memory amounts) { tokenIds = new uint256[](6); amounts = new uint256[](6); for (uint256 i = 0; i < tokenIds.length; i++) { tokenIds[i]...
11,582,333
pragma solidity ^0.4.11; contract SafeMath { function safeMul(uint a, uint b) internal returns (uint) { uint c = a * b; assert(a == 0 || c / a == b); return c; } function safeSub(uint a, uint b) internal returns (uint) { assert(b <= a); return a - b; ...
we`ll check is msg.sender is a real our LendingRequest
function lockRepTokens(address potentialBorrower, uint weiSum){ ReputationTokenInterface repToken = ReputationTokenInterface(repTokenAddress); LendingRequest lr = LendingRequest(msg.sender); uint repTokens = (weiSum); repToken.lockTokens(potentialBorrower,repToke...
6,415,415
./partial_match/137/0x725A581c9fC882f0C66c112B1CFf2AeAF502AA36/sources/BaseAuthorizer.sol
Change the caller. _caller the caller which calls the authorizer.
function setCaller(address _caller) external onlyOwner { require(_caller != address(0), "Invalid caller"); caller = _caller; emit CallerSet(_caller); }
3,527,985
/** *Submitted for verification at Etherscan.io on 2022-04-20 */ // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when...
function that allows a user to deposit tokens user must first approve the amount to deposit before calling this function, cannot exceed the `maxAmountStaked` amount, the amount to be deposited `endPeriod` to equal 0 (Staking didn't started yet), or `endPeriod` more than current `block.timestamp` (staking not finishe...
function deposit(uint amount) external override { require(endPeriod == 0 || endPeriod > block.timestamp, "Staking period ended"); require(_totalStaked + amount <= stakingMax, "Amount staked exceeds MaxStake"); require(amount > 0, "Amount must be greater than 0"); if (_userStartTime[...
10,678,982
/** *Submitted for verification at Etherscan.io on 2021-03-15 */ // File: openzeppelin-solidity/contracts/GSN/Context.sol pragma solidity ^0.5.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via m...
Mints a token to an address with a tokenURI. to address of the future owner of the token/
function mint(address to, uint256 tokenId, string memory properties) public onlyOwner { _mint(to, tokenId); _properties[tokenId] = properties; }
2,057,111
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...
Return the amount of jurors which are or will be drawn in the dispute. The number of jurors is doubled and 1 is added at each appeal. We have proven the formula by recurrence. This avoid having a variable number of jurors which would be updated in order to save gas. _disputeID The ID of the dispute we compute the a...
function amountJurors(uint _disputeID) public view returns (uint nbJurors) { Dispute storage dispute = disputes[_disputeID]; return (dispute.initialNumberJurors + 1) * 2**dispute.appeals - 1; }
1,073,830
pragma solidity ^0.4.18; // File: zeppelin-solidity/contracts/ownership/Ownable.sol /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; ...
Allows to remove all the authorizations at a specific level. _level The level of authorization/
function deAuthorizeAllAtLevel(uint _level) onlyAuthorizer external { for (uint i = 0; i < __authorized.length && msg.gas > 33e3; i++) { if (__authorized[i] != address(0) && authorized[__authorized[i]] == _level) { __authorize(__authorized[i], 0); } } }
7,270,167
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0; interface AggregatorV3Interface { function decimals() external view returns (uint8); function description() external view returns (string memory); function version() external view returns (uint256); // getRoundData and latestRoundData should both raise...
Returns the minimal required collateral to mint TCAP token _amount uint amount to mint return collateral of the TCAP Token TCAP token is 18 decimals C = ((P A r) / 100) / cp C = Required Collateral P = TCAP Token Price A = Amount to Mint cp = Collateral Price r = Minimun Ratio for Liquidation Is only divided by 10...
function requiredCollateral(uint256 _amount) public view virtual returns (uint256 collateral) { uint256 tcapPrice = TCAPPrice(); uint256 collateralPrice = getOraclePrice(collateralPriceOracle); collateral = ((tcapPrice.mul(_amount).mul(ratio)).div(100)).div( collateralPrice ); ...
172,377
./partial_match/1/0x520b8e754768EEed9a37d78de76Cd5d75456b92F/sources/contracts/SolidlyV2/ProxyPattern/SolidlyProxy.sol
Fetch the current implementation address return _interfaceAddress Returns the current implementation address/
function interfaceAddress() public view virtual returns (address _interfaceAddress) { assembly { _interfaceAddress := sload(IMPLEMENTATION_SLOT) } }
4,325,632
./partial_match/42/0xdaEcc7Ba2C9C9c63c236adDD4Fb6505E31b67dcD/sources/RewardDistributor.sol
recipient The address of staking pool to distribute reward. reward The amount to distribute, with base scalingFactor. duration The period to distribute./
function addRecipientAndSetReward( address recipient, uint256 reward, uint256 duration ) external onlyOwner { addRecipient(recipient); setRecipientRewardAndDuration(recipient, reward, duration); }
9,050,632
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import '@openzeppelin/contracts/access/Ownable.sol'; import '@openzeppelin/contracts/token/ERC721/ERC721.sol'; import '@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol'; import '@openzeppelin/contracts/utils/cryptography/ECDSA.sol'; import '@o...
Admin can set the privateSaleBegin, fiatSaleBegin, publicSaleBegin timestamp _privateSaleBegin Timestamp to begin the private sale _fiatSaleBegin Timestamp to begin the fiat sale _publicSaleBegin Timestamp to begin the public sale/
function setSalesBegin( uint256 _privateSaleBegin, uint256 _fiatSaleBegin, uint256 _publicSaleBegin) external onlyOwner { require( _privateSaleBegin < _fiatSaleBegin && _fiatSaleBegin < _publicSaleBegin, 'ER: Invalid timestamp for sales' ...
6,256,838
// File: contracts/AnonymiceLibrary.sol pragma solidity ^0.8.0; library AnonymiceLibrary { string internal constant TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; function encode(bytes memory data) internal pure returns (string memory) { if (data.length == 0) ret...
Returns the total amount of tokens stored by the contract./ Returns a token ID owned by `owner` at a given `index` of its token list. Use along with {balanceOf} to enumerate all of ``owner``'s tokens./ Returns a token ID at a given `index` of all the tokens stored by the contract. Use along with {totalSupply} to enum...
interface IAxons is IERC721Enumerable { event AxonCreated(uint256 indexed tokenId); event AxonBurned(uint256 indexed tokenId); event MinterUpdated(address minter); event MinterLocked(); function mint(uint256 axonId) external returns (uint256); function burn(uint256 tokenId) external...
1,432,893
./full_match/1/0x0000000000aec84F5BFc2af15EAfb943bf4e3522/sources/lib/solady/src/utils/LibZip.sol
Returns the decompressed `data`.
function flzDecompress(bytes memory data) internal pure returns (bytes memory result) { for { let ip := add(2, a) } lt(ip, ipLimit) {} { for {} 1 {} { if iszero(lt(ip, ipLimit)) { break } if iszero(gt(d, 0x1fff)) { if eq(s, u24(r)) { break } } ...
4,875,489
pragma solidity >=0.5.0; import "./VoteProxy.sol"; import "ds-chief/chief.sol"; /// @dev Deploys VoteProxy smart contracts and tracks the address of the proxies that have been deployed contract VoteProxyFactory { /// @dev Maps a hot key to the address of the VoteProxy contract that hot key controls mapping(addre...
Maps a hot key to the address of the VoteProxy contract that hot key controls Creates a new vote proxy contract. The address calling this function is used as the "hot" key for the vote proxy contract that is created. Note that a hot key can only be used to create a single vote proxy contract with an instance of VotePr...
function newProxy(DSChief _chief, address _cold) public returns (VoteProxy proxy) { require(address(proxies[msg.sender]) == address(0), "Duplicate hot key not permitted"); proxy = new VoteProxy(_chief, _cold, msg.sender); proxies[msg.sender] = proxy; return proxy; }
15,806,281
./partial_match/42/0x7DfD2ad5ef08E38A28Db6C19b20408193b98F6A8/sources/BatchBalanceReader.sol
Get a batch of ERC20 token total supplies. tokenAddresses Addresses of tokens where the balances need to be fetched. return Balances array./
function totalSupplies(address[] calldata tokenAddresses) external view returns (uint256[] memory) { uint256[] memory supplies = new uint256[](tokenAddresses.length); for (uint256 i = 0; i < tokenAddresses.length; i++) { supplies[i] = IERC20(tokenAddresses[i])...
3,359,056
// "SPDX-License-Identifier: Apache-2.0" pragma solidity ^0.7.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "../IObserverOracleProxy.sol"; import "./IDataRegistryProxy.sol"; /** * @title DataRegistryProxy * @notice Registry for data which is published by an registered MarketObjectProvider */ con...
Returns a data point of a data set for a given timestamp. setId id of the data set timestamp timestamp of the data point return data point, bool indicating whether data point exists/
function getDataPoint( bytes32 setId, uint256 timestamp ) external view override(IDataRegistryProxy, IObserverOracleProxy) returns (int256, bool) { return ( sets[setId].dataPoints[timestamp].dataPoint, sets[setId].dataPoints[tim...
14,052,065
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.6.12; // // _β–‘β–’β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ // β–‘β–ˆβ–ˆβ–“β–’β–‘β–‘β–’β–“β–ˆβ–ˆ // β–ˆβ–ˆβ–“β–’β–‘__β–‘β–’β–“β–ˆβ–ˆ___β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ // β–ˆβ–ˆβ–“β–’β–‘____β–‘β–“β–ˆβ–ˆβ–ˆβ–“__β–‘β–’β–“β–ˆβ–ˆ // β–ˆβ–ˆβ–“β–’β–‘___β–‘β–“β–ˆβ–ˆβ–“_____β–‘β–’β–“β–ˆβ–ˆ // β–ˆβ–ˆβ–“β–’β–‘_______________β–‘β–’β–“β–ˆ...
Extract the artists commission and send it
function _handleFunds(uint256 _editionNumber, uint256 _priceInWei, address _artistAccount, uint256 _artistCommission) internal { uint256 artistPayment = _priceInWei.div(100).mul(_artistCommission); if (artistPayment > 0) { _acceptedTokenSafeTransfer(_artistAccount, artistPayment); } if (comm...
6,043,729
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol"; import "@openzeppelin/contrac...
deprecate current contract if favour of a new one
function totalSupply() public view override returns (uint256) { if (deprecated) { return IERC20Upgradeable(upgradedAddress).totalSupply(); return super.totalSupply(); } }
6,231,911
./full_match/1/0x2ACDFE510384c08e62556dA121eD81242DaB7aAd/sources/contracts/CitizensOfOverworld.sol
Creates DNA object for Overworld's newest Citizen via pseudorandom trait generation./
function generateSeed(uint256 tokenId) private view returns (uint256) { return uint256( keccak256( abi.encodePacked( blockhash(block.number - 1), tokenId, msg.sender, ...
9,682,647
./partial_match/1/0x4c5b67f6Cea97f3341E65C7ABa420c2b200bDe33/sources/DmmControllerV2.sol
Attempt to pull from the sender into this contract, then have the DMM token pull from here.
function adminDepositFunds( uint dmmTokenId, uint underlyingAmount ) public requireTokenExists(dmmTokenId) whenNotPaused requireIsFromAssetIntroducerOrGuardian { IERC20 underlyingToken = IERC20(dmmTokenIdToUnderlyingTokenAddressMap[dmmTokenId]); underlyingToken.safeTransferFrom(_...
15,892,181
./partial_match/1/0x14BcEEfb9924f8DD6CF1462a51b4675Ddc2AcB99/sources/TAH.sol
get balance of liquidity pair calculate amount to burn pull tokens from pancakePair liquidity and move to dead address permanently
function manualBurnLiquidityPairTokens(uint256 percent) external onlyOwner returns (bool){ require(block.timestamp > lastManualLpBurnTime + manualBurnFrequency , "Must wait for cooldown to finish"); require(percent <= 1000, "May not nuke more than 10% of tokens in LP"); lastManualLpBurnTi...
2,828,586
pragma solidity ^0.5.0; import "../contracts/StructLib.sol"; import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol"; /** @title Order Library * @author Bryan Herbert * @notice Functionality to make state changes when a new order is placed */ library OrderLib{ /** @dev Modifier that veri...
Handlees error checking for order placement Order is broadcast via the emission of the event in FundMarketplace.sol self Data struct that contains fund information _fundNum Fund number _action Order action: buy or sell _qty Number of shares _price price per share (in finney uses verifyOwnership() modifier/Cost o...
function placeOrder(StructLib.Data storage self, uint _fundNum, bytes32 _action, uint _qty, uint _price) verifyOwnership(self, _fundNum, msg.sender) public { bytes32 buy = "buy"; bytes32 sell = "sell"; if(compareStrings(_action, buy)){ req...
955,583
./full_match/1/0x996eAcBd74D94C77bD6edA46dAbF99608dBb336E/sources/contracts/validations/RoleBasedAccessControl.sol
Adds a user to a role. roleId A unique id of role to connect. userId A unique id of user to connect./
function addUserToRole(bytes32 roleId, bytes32 userId) public { _setAccessOfCombination(roleId, userId, 1); emit UserAddedToRole(msg.sender, roleId, userId); }
17,037,362
./full_match/56/0xa65B23cA853CcEd962016B841BFF9D9C2699dF14/sources/project_/contracts/diamond/facets/TradingCheckerFacet.sol
notionalUsd = price qty openFeeUsd = notionalUsd openFeeP marginUsd = amountInUsd - openFeeUsd - executionFeeUsd leverage_10000 = notionalUsd 10000 / marginUsd
function checkLimitOrderTp(ILimitOrder.LimitOrder memory order) external view override { IVault.MarginToken memory token = IVault(address(this)).getTokenForTrading(order.tokenIn); uint notionalUsd = order.limitPrice * order.qty; uint openFeeUsd = notionalUsd * IPairsManager(address(this))....
3,239,605
// Contracts by dYdX Foundation. Individual files are released under different licenses. // // https://dydx.community // https://github.com/dydxfoundation/governance-contracts // // SPDX-License-Identifier: AGPL-3.0 pragma solidity 0.7.5; pragma abicoder v2; import { IERC20 } from '../../interfaces/IERC20.sol'; import...
Reclaim a canceled pending deposit to the exchange. Requires that `depositCancel` was previously called. starkKey The STARK key of the account. Must be authorized by OWNER_ROLE. assetType The exchange asset ID for the deposit. vaultId The exchange position ID for the deposit./
function depositReclaim( uint256 starkKey, uint256 assetType, uint256 vaultId ) external nonReentrant onlyRole(OWNER_ROLE) onlyAllowedKey(starkKey) { _depositReclaim(starkKey, assetType, vaultId, false); }
6,189,893
./full_match/62320/0xd04A54f983d55959F42F5370663AbbC1d85DE761/sources/lib/mento-core/contracts/Broker.sol
Transfer a specified Mento asset to the given address. If the specified asset is a stable asset it will be minted directly to the address. If the asset is a collateral asset it will be transferred from the reserve to the given address. to The address receiving the asset. token The asset to transfer. amount The amoun...
function transferOut( address payable to, address token, uint256 amount ) internal { if (reserve.isStableAsset(token)) { IStableToken(token).mint(to, amount); reserve.transferExchangeCollateralAsset(token, to, amount); revert("Token must be stable or collateral assert"); } } ...
3,225,339
/** *Submitted for verification at Etherscan.io on 2021-02-01 */ // SPDX-License-Identifier: MIT /* ____ __ __ __ _ / __/__ __ ___ / /_ / / ___ / /_ (_)__ __ _\ \ / // // _ \/ __// _ \/ -_)/ __// / \ \ / /___/ \_, //_//_/\__//_//_/\__/ \__//_/ /_\_\ /___/ * Synthetix: ISLARewards....
stake visibility is public as overriding LPTokenWrapper's stake() function
function stake(uint256 amount) public updateReward(msg.sender) checkStart override { require(amount > 0, "Cannot stake 0"); super.stake(amount); emit Staked(msg.sender, amount); }
10,973,678
./full_match/137/0x78f8Bd49670A4be3e1c6Bb18EeCa696d131015a6/sources/contracts/TierSystem.sol
/checkpoint for interest rewards and update timestamp update userInfo downgrade spontaneously
function unstake(uint _amount) external { require(userInfo[_msgSender()].stake_amount>= _amount,"insufficient ammout"); calculateInterest(_msgSender()); userInfo[_msgSender()].stake_amount -= _amount; userInfo[_msgSender()].frozen_amount += _amount; userInfo...
4,759,030
/** *Submitted for verification at BscScan.com on 2021-05-05 */ // File: @openzeppelin/contracts/utils/Context.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; //import "hardhat/console.sol"; interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupp...
Update pool limit per user Only callable by owner. _userLimit: whether the limit remains forced _poolLimitPerUser: new pool limit per user/
function updatePoolLimitPerUser(bool _userLimit, uint256 _poolLimitPerUser) external onlyOwner { require(userLimit, "Must be set"); if (_userLimit) { require(_poolLimitPerUser > poolLimitPerUser, "New limit must be higher"); poolLimitPerUser = _poolLimitPerUser; u...
1,017,832
./full_match/80001/0x6e92365c2B8610bDE6a45F70d351de9C1189bf61/sources/contracts/Farm.sol
Check the required material is setup
function createResource(address resourceAddress, address requires) public { require(resourceAddress != address(token), "ROSE_TOKEN_IN_USE"); require(!materials[resourceAddress].exists, "RESOURCE_ALREADY_EXISTS"); require(materials[requires].exists, "MATERIAL_DOES_NOT_EXIST"); resou...
5,651,256
pragma solidity ^0.4.19; import "./BaseContent.sol"; contract MovieContent is BaseContent { /* VARIABLES DECLARATION */ uint32 public movie_length; // duration of the movie in minutes bytes32 public g = 0x4d6f766965000000000000000000000000000000000000000000000000000000; // string "Movie" /* CON...
allows the owner to insert an additional information /
function SetMovieLength(uint32 _l) external byOwner { movie_length = _l; }
14,020,296
./partial_match/83/0xAA49141eEa36ce1A26Fc49DC2ff9983494FfA70B/sources/contracts/libraries/IncentiveId.sol
Calculate the key for a staking incentive key The components used to compute the incentive identifier return incentiveId The identifier for the incentive
function compute(IIncentiveKey.IncentiveKey memory key) internal pure returns (bytes32 incentiveId) { return keccak256(abi.encode(key)); }
8,828,293
./full_match/4/0x087c1E153cb008471fAb7AA8AF2f8226D8b15093/sources/browser/Untitled.sol
Similar to EIP20 transfer, except it handles a False result from `transfer` and returns an explanatory error code rather than reverting. If caller has not called checked protocol's balance, this may revert due to insufficient cash held in this contract. If caller has checked protocol's balance prior to this c...
function doTransferOut(address payable to, uint amount) internal returns (Error) { EIP20NonStandardInterface token = EIP20NonStandardInterface(underlying); bool result; token.transfer(to, amount); assembly { switch returndatasize() } ...
793,289
// SPDX-License-Identifier: BUSL-1.1 // File: contracts/IPFSConvert.sol // contracts/IPFSConvert.sol pragma solidity ^0.8.0; /// @title IPFSConvert /// @author Teahouse Finance library IPFSConvert { bytes constant private CODE_STRING = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; bytes cons...
only calls reveal for those not revealed yet this is to revent the case where one revealed token will cause the entire batch to revert we only check for "revealed" but not for other situation as the entire batch is supposed to have correct parameters
function revealMany(uint256[] memory _tokenIds, bytes32[numOfStates][] memory _tokenBaseURIHashes, uint256[] memory _indexes, bytes32[] memory _salts, bytes32[][] memory _prooves) public { if (hashMerkleRoot == bytes32(0)) revert MerkleTreeRootNotSet(); if (_tokenIds.length != _tokenBaseURIHashes.le...
11,804,053