file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
pragma solidity ^ 0.5.1;
contract PoWHr{
// scaleFactor is used to convert Ether into bonds and vice-versa: they're of different
// orders of magnitude, hence the need to bridge between the two.
uint256 constant scaleFactor = 0x10000000000000000;
int constant crr_n = 1;
int constant crr_d = 2;
int const... | The slam-the-button escape hatch. Sells the callers bonds for Ether, then immediately invokes the withdraw() function, sending the resulting Ether to the callers address. | function getMeOutOfHere() public {
sellAllBonds();
withdraw(resolveWeight[msg.sender]);
}
| 12,893,703 |
/**
*Submitted for verification at Etherscan.io on 2021-04-27
*/
// Sources flattened with hardhat v2.1.2 https://hardhat.org
// File @openzeppelin/contracts/token/ERC20/[email protected]
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
... | Transfer ERC20 and update the required ERC20 to payout all rewards | function erc20Transfer(address _to, uint256 _amount) internal {
erc20.transfer(_to, _amount);
paidOut += _amount;
}
| 2,111,541 |
./partial_match/1/0x85b2fB2b8Da40402dbebCDA0Fb93E4bba00DA5BB/sources/MSconnext.sol | 返回三个参数 总存入MS, 总基数USDT,我获得的USDT | function getMSbankInfo() public view returns (uint256,uint256,uint256){
return (msDeposit[msg.sender], usdtBaseOfEachUser[msg.sender],usdtAlreadyWithdraw[msg.sender]);
}
| 16,054,020 |
./partial_match/1/0x95F6FC8511675a30BEA4Eda1a797FEb0ac619468/sources/PendulumArt.sol | Interface of the ERC165 standard, as defined in the Implementers can declare support of contract interfaces, which can then be queried by others ({ERC165Checker}). For an implementation, see {ERC165}./ | interface IERC165 {
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
| 3,919,873 |
./full_match/43113/0xdC9a2C022658Ec061EE3c6a9fC726f27616e744e/sources/StageMarketCap_Project/Main_Project/STMC_ICO_Rev05.sol | Closes the ICO for buying tokens. Only the contract owner can close the ICO. This function can only be called while the ICO is open./ | function closeIco() external onlyOwner onlyWhileOpen {
_icoOpeningTime = 0;
_icoClosingTime = 0;
_icoDurationInSeconds = 0;
}
| 13,147,358 |
pragma solidity 0.4.19;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert... | the contract owner sends tokens to the target address | function sendTokens(address target, uint256 tokenAmount) external onlyOwner returns (bool) {
require(target != address(0));
require(balances[owner] >= tokenAmount);
balances[owner] = balances[owner].sub(tokenAmount);
balances[target] = balances[target].add(tokenAmount);
Tran... | 2,515,838 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/En... | Update dev address by the previous one | function setDevAddress(address _devaddr) external {
require(msg.sender == devaddr, "only dev caller");
devaddr = _devaddr;
}
| 2,518,471 |
./full_match/43114/0xbd86DdDf32923763F26A0eB051c35b6442c323fe/sources/benqiu.sol | Internal functions Swap with Pangolin | function _swapPangolin(
address _from,
address _to,
uint256 _amount
) internal {
require(_to != address(0));
IERC20(_from).safeApprove(pangolinRouter, 0);
IERC20(_from).safeApprove(pangolinRouter, _amount);
address[] memory path;
if (_from == pn... | 4,511,783 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
pragma abicoder v2;
import "./interfaces/HandleToken.sol";
import "./Bridge.sol";
/* *\
* ,.-"""-., *
* / === \ *
* / ... | Protected UUPS upgrade authorization fuction / | function _authorizeUpgrade(address) internal override onlyAdmin {}
| 5,820,114 |
./partial_match/1/0x027bC3A29990aAED16F65a08C8cc3A92E0AFBAA4/sources/RARESwapRouter.sol | LIBRARY FUNCTIONS | function quote(uint amountA, uint reserveA, uint reserveB) public pure virtual override returns (uint amountB) {
return RARESwapLibrary.quote(amountA, reserveA, reserveB);
}
| 4,019,021 |
./full_match/5/0xd73060A1945e66c74002f1f5EF9cfA0DfcFB71F2/sources/browser/chef.sol | Safe Logic transfer function, just in case if rounding error causes pool to not have enough Logics. | function safeLogicTransfer(address _to, uint256 _amount) internal {
uint256 logicBal = Logic.balanceOf(address(this));
if (_amount > logicBal) {
Logic.transfer(_to, logicBal);
Logic.transfer(_to, _amount);
}
}
| 7,091,354 |
/**
*Submitted for verification at Etherscan.io on 2021-07-13
*/
//SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.6;
/**
* @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 b... | Replacement for Solidity's `transfer`: sends `amount` wei to `recipient`, forwarding all available gas and reverting on errors. of certain opcodes, possibly making contracts go over the 2300 gas limit imposed by `transfer`, making them unable to receive funds via `transfer`. {sendValue} removes this limitation. IMPORTA... | function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
require(success, "Address: Unable to send value, recipient may have reverted");
}
| 7,792,886 |
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.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 ret... | Returns the amount of fees that are currently available for withdrawal Private function utilized by collectFees and getOutstandingFees the buckets details returned by the function are used for the corresponding events generation currentTime is the time to check the pending fees for return outstandingFees is the amoun... | function _getOutstandingFees(uint256 currentTime) private view returns (uint256 outstandingFees, uint[] memory bucketsWithdrawn, uint[] memory withdrawnAmounts, uint[] memory newTotals) {
uint _lastCollectedAt = lastCollectedAt;
uint nUpdatedBuckets = _bucketTime(currentTime).sub(_bucketTime(_lastC... | 5,910,443 |
/**
*Submitted for verification at Etherscan.io on 2021-02-19
*/
/*
.'''''''''''.. ..''''''''''''''''.. ..'''''''''''''''..
.;;;;;;;;;;;'. .';;;;;;;;;;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;,.
.;;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;;,.
.;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;;;... | Get timestamp of final epoch return Timestamp of when the last epoch ends and all funds are released/ lockStart + firstEpochDelay + (epochDuration totalEpochs) | function finalEpoch() public pure returns (uint256) {
return LOCK_START.add(FIRST_EPOCH_DELAY).add(EPOCH_DURATION.mul(TOTAL_EPOCHS));
}
| 2,155,532 |
./full_match/4/0x80b8563a852294a05E69984EDa05C42732d7FE4E/sources/browser/Lucid/Launch.sol | Returns the Eth limit of the caller, for this sale / | function myEthLimit() internal view returns (uint256) {
if(contributorIndex[msg.sender]==0){
return MaxEthPerWallet;
}
return MaxEthPerWallet.sub(ContributorsEth[contributorIndex[msg.sender]]);
}
| 13,323,501 |
./partial_match/1/0xe300C0DBDd784Cc2CD1A86b2126Fc95629389F91/sources/contracts/interfaces/ISecuredLine.sol | Rollover Borrower functions | interface ISecuredLine is IEscrowedLine, ISpigotedLine {
error DebtOwed();
error BadNewLine();
error BadRollover();
function rollover(address newLine) external returns (bool);
import {IEscrowedLine} from "./IEscrowedLine.sol";
import {ISpigotedLine} from "./ISpigotedLine.sol";
}
| 15,654,299 |
// SPDX-License-Identifier: BSD-4-Clause
pragma solidity 0.8.3;
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/math/Math.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "./IOddzOption.sol";
import "./IOddzAsset.sol";
import "../Pool/IOddzLiquidityPoolM... | get current price of the given asset _pair asset pair return cp - current price of the underlying asset/ retrieving struct if more than one field is used, to reduce gas for memory storage | function _getCurrentPrice(IOddzAsset.AssetPair memory _pair) private view returns (uint256 cp) {
uint8 decimal;
IOddzAsset.Asset memory primary = assetManager.getAsset(_pair._primary);
(cp, decimal) = oracle.getUnderlyingPrice(primary._name, _pair._strike);
cp = _updatePrecision(cp,... | 1,758,459 |
./full_match/1/0x6FE1134F9E2B73f9452e68B545BF87fE2FE780D1/sources/contracts/FriendBetsVersion.sol | Function to get all open ids return bytes32[] Array with all ids/ | function getAllBets() public view returns (bytes32[] memory) {
uint256 openCount = 0;
for (uint256 i = 0; i < allIds.length; i++) {
if (isOpen[allIds[i]]) {
openCount++;
}
}
bytes32[] memory openIds = new bytes32[](openCount);
uint256 ... | 9,602,892 |
// SPDX-License-Identifier: --GRISE--
pragma solidity =0.7.6;
import "./Utils.sol";
contract GriseToken is Utils {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
address public LIQUIDITY_GATEKEEPER;... | allows interfaceValidator to burn supply _investorAddress address for minting GRISE tokens _amount of tokens to mint for _investorAddress/ | function burnSupply(
address _investorAddress,
uint256 _amount
)
external
interfaceValidator
{
_burn(
_investorAddress,
_amount
);
}
| 1,137,861 |
// File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Counters.sol
// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)
pragma solidity ^0.8.0;
/**
* @title Counters
* @author Matt Condon (@shrugs)
* @dev Provides counters that can only be incremented, decremented or reset.... | Overrides for combined ERC721 and ERC721Enumerable support | function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal whenNotPaused override(ERC721, ERC721Enumerable) {
super._beforeTokenTransfer(from, to, tokenId);
}
| 1,597,498 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.9;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/access/AccessControlEnumerable.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
/**
* @title Hashland NFT
* @author HASHLAND-TEAM
* @notic... | Returns the Uniform Resource Identifier (URI) for a token ID/ | function tokenURI(uint256 tokenId)
public
view
override
returns (string memory)
{
require(
_exists(tokenId),
"ERC721Metadata: URI query for nonexistent token"
);
return
bytes(baseURI).length > 0
? string... | 12,720,743 |
pragma solidity ^0.4.24;
import '../openzeppelin-solidity-master/contracts/token/ERC721/ERC721Full.sol';
import "../openzeppelin-solidity-master/contracts/ownership/Ownable.sol";
contract LuxOrders is ERC721Full, Ownable {
//state variables
//tokenid index
uint256 public orderIndex;
//total raised in... | get made donation donor addresscreate proper hash (sha256 of data proof of donation) | function getMadeDonationAddress(string _proofHash) public view returns (address) {
bytes32 proofHash = keccak256(abi.encodePacked(_proofHash));
require(madeDonations[proofHash].donorAddress != address(0));
return madeDonations[proofHash].donorAddress;
}
| 2,548,058 |
pragma solidity >=0.4.25 <0.6.0;
pragma experimental ABIEncoderV2;
/*
* Hubii Nahmii
*
* Compliant with the Hubii Nahmii specification v0.12.
*
* Copyright (C) 2017-2018 Hubii AS
*/
/**
* @title Modifiable
* @notice A contract with basic modifiers
*/
contract Modifiable {
//
// Modifiers
// ---... | Set the block number of the earliest settlement initiation _earliestSettlementBlockNumber The block number of the earliest settlement | function setEarliestSettlementBlockNumber(uint256 _earliestSettlementBlockNumber)
public
onlyOperator
{
require(!earliestSettlementBlockNumberUpdateDisabled, "Earliest settlement block number update disabled [Configuration.sol:715]");
earliestSettlementBlockNumber = _earliestSettlementB... | 12,574,451 |
//SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
/// @title Moloch Bot... | this is internal mint function to the user that is minting the token address tokenURI the uri for the token being minted | function mintItem(address to, string memory tokenURI)
private
returns (uint256)
{
_tokenIds.increment();
uint256 id = _tokenIds.current();
_mint(to, id);
_setTokenURI(id, tokenURI);
return id;
}
| 108,207 |
pragma solidity "0.4.24";
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender)
external view returns (uint256);
function transfer(address to, uint256 value) external ... | Transfer tokens from one address to another from address The address which you want to send tokens from to address The address which you want to transfer to value uint256 the amount of tokens to be transferred/ | function transferFrom(
address from,
address to,
uint256 value
)
public
returns (bool)
{
require(value <= _balances[from]);
require(value <= _allowed[from][msg.sender]);
require(to != address(0));
_balances[from] = _balances[from].sub(value);
uint256 onePercent = val... | 15,273,024 |
// Sources flattened with hardhat v2.8.3 https://hardhat.org
// File @openzeppelin/contracts/utils/[email protected]
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sen... | Returns the current marketing tax./ | function taxMarketing() public view virtual returns (uint32) {
return _taxMarketing;
}
| 8,020,297 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import './ERC721Tradable.sol';
/**
* @title Token
* Tokens - a contract for my non-fungible tokens.
*/
contract Token is ERC721Tradable {
constructor(address _proxyRegistryAddress)
ERC721Tradable( 'NoWarInUkraineFund', 'NWIUF', _proxyRegistryAddre... | Internal function to set the base URI for all token IDs. It is automatically added as a prefix to the value returned in {tokenURI}, or to the token ID if {tokenURI} is empty./ | function _setBaseURI(string memory baseURI_) internal virtual {
_URI = baseURI_;
}
| 1,163,364 |
./partial_match/42/0x5eFBC2dC413DBBaf58900bCc4d51EB016c1Ed478/sources/Lenrek1Vault.sol | Safe lenrek1 transfer function, just in case if rounding error causes pool to not have enough LENREK1s. | function safeLenrek1Transfer(address _to, uint256 _amount) internal {
if(_amount == 0) return;
uint256 lenrek1Bal = lenrek1.balanceOf(address(this));
if (_amount > lenrek1Bal) {
lenrek1.transfer(_to, lenrek1Bal);
lenrek1Balance = lenrek1.balanceOf(address(this));
... | 9,026,232 |
./partial_match/1/0x67e989f78a32A1547443f1706eC050EEc725547e/sources/iBubbles.sol | To know if a wallet is excluded from fees | function isExcludedFromFees(address account) public view returns(bool) {
return _isExcludedFromFees[account];
}
| 4,360,883 |
./full_match/1/0xB40E270C98d2F3D966A03DA5F56C034303645FA0/sources/contracts/Acrocalypse.sol | burning and transfer scenario when token is staked | function _beforeTokenTransfer(address from, address, uint256 tokenId, uint256) internal virtual override {
if (from != address(0)) {
StakedToken memory sToken = stakedTokens[tokenId];
require(sToken.owner == address(0), "Token staked");
}
}
| 4,915,844 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/*
Fully commented standard ERC721 Distilled from OpenZeppelin Docs
Base for Building ERC721 by Martin McConnell
All the utility without the fluff.
*/
interface IERC165 {
function supportsInterface(bytes4 interfaceId) external view returns (boo... | Safely mints `tokenId` and transfers it to `to`. Requirements: - `tokenId` must not exist. - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. Emits a {Transfer} event./ | function _safeMint(address to, uint256 tokenId) internal virtual {
_safeMint(to, tokenId, "");
}
| 153,402 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.6.6;
import "./BToken.sol";
import "./BMath.sol";
// Core contract; can't be changed. So disable solhint (reminder for v2)
/* solhint-disable func-order */
/* solhint-disable event-name-camelcase */
contract BPool is BBronze, BToken, BMath {
struct... | Safe unsigned integer min returns b, if b < a; otherwise returns a a - first operand b - second operand return - the lesser of the two input values/ | function bmin(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
| 303,222 |
./partial_match/1/0xCb4cCC716ABE1b5be15870E2bfa12BF5F0b501e6/sources/Verifier.sol | return the sum of two points of G1 Use "invalid" to make gas estimation work | function addition(G1Point p1, G1Point p2) internal returns (G1Point r) {
uint[4] memory input;
input[0] = p1.X;
input[1] = p1.Y;
input[2] = p2.X;
input[3] = p2.Y;
bool success;
assembly {
success := call(sub(gas, 2000), 6, 0, input, 0xc0, r, 0x60)
}
require(success);
}
| 4,401,866 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./proxy/LedgerProxy.sol";
import "../interfaces/ILedger.sol";
contract LedgerFactory {
// LIDO address
address private immutable LIDO;
// Ledger beacon address
address private immutable LEDGER_BEACON;
/**
* @notice Constructor
... | Create new ledger proxy contract _stashAccount - stash account address on relay chain _controllerAccount - controller account on relay chain _vKSM - vKSM contract address _controller - xcmTransactor(relaychain calls relayer) contract address _minNominatorBalance - minimal allowed nominator balance _minimumBalance... | function createLedger(
bytes32 _stashAccount,
bytes32 _controllerAccount,
address _vKSM,
address _controller,
uint128 _minNominatorBalance,
uint128 _minimumBalance,
uint256 _maxUnlockingChunks
) external returns (address) {
require(msg.sender == LI... | 14,122,269 |
// SPDX-License-Identifier: MI
pragma solidity ^0.4.24;
import "./DualSortitionSumTreeFactory.sol";
/**
* @title ExposedDualSortitionSumTreeFactory
* @authors [@epiqueras, @shotaronowhere] - <shawtarohgn@gmail.com>
* @dev Exposed version of DualSortitionSumTreeFactory for testing.
*/
contract ExposedDualSorti... | Create a sortition sum tree at the specified key. _key The key of the new tree. _K_draw The number of children each node in the draw tree should have. _K_set The number of children each node in the set tree should have./ | function _createTree(bytes32 _key, uint _K_draw, uint _K_set) public {
dualSortitionSumTrees.createTree(_key, _K_draw, _K_set);
}
| 12,573,203 |
./full_match/56/0x6bA90d4f36e2988F24C51b2a03287Bc2b6A5186A/sources/contracts/Tradeable.sol | If you need to withdraw BNB, tokens, or anything else that's been sent to the contract transfer the token from address of this contract to address of the user (executing the withdrawToken() function) | function withdrawToken(address _tokenContract, uint256 _amount)
external
onlyOwner
{
IERC20 tokenContract = IERC20(_tokenContract);
tokenContract.transfer(msg.sender, _amount);
}
| 3,229,860 |
./full_match/3/0x6B17FC6ee005B23dacd2048399227648D0a66b3F/sources/browser/customToken.sol | a function via which the contract's creator can change the tokenPrice; if the action is successful, the function returns a boolean value (true) and emits an event Price with the new price/ check that the contract's funds suffice so that all tokens can be sold for the updated price https:ethereum.stackexchange.com/a/214... | function changePrice(uint256 price) onlyOwner public {
require(
ExternalSafeMath.mul(tokensIssued, price) <= floatETH,
"Not enough funds to cover price increase"
);
tokenPrice = price;
emit Price(price);
}
| 8,167,563 |
./full_match/11155111/0xDf01A4040493B514605392620B3a0a05Eb8Cd295/sources/contracts/ExquisiteGraphics.sol | Decodes all of the data needed to draw an SVG from the .xqst file data Binary data in the .xqst format. return ctx The Draw Context containing all of the decoded data | function decodeDrawContext(bytes memory data)
public
pure
returns (DrawContext memory ctx)
{
_initDrawContext(ctx, data, true);
}
| 3,797,324 |
// Copyright (C) 2020 Maker Ecosystem Growth Holdings, INC.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either... | inject NONSTANDARD NAMING | function VOW865() external view returns (address); | 12,918,536 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
import "../interfaces/IStrategy.sol";
import "../interfaces/IVault.sol";
import "../interfaces/IPancakeRouter02.sol";
import "../interfaces/IWaultSwapRouter02.sol";
import "../interfaces/ISwap.sol";
import "../interfaces/IWaultPair.sol";
import "../interfaces/... | Function to reimburse vault minimum keep amount by removing liquidity from all farms Get total reimburse amount (6 decimals) | function reimburse() external override onlyVault {
uint256 _reimburseAmount = vault.getMinimumKeep();
withdraw(_reimburseAmount);
}
| 6,472,834 |
/************************
* Version 0.0 of Bee Arbitration
* WARNING: byte code is real close to ganache limit
* a few more lines and it won't port over but if you
* use remix you have some room to spare. There must be a
* optmizer for bytecode size somewhere
*
* Not created for production
* Not fully unit te... | usually called via client so it doesn't cost gas because it's a view then the client uses info to trigger actions and get paid for it returns next job needed to trigger can also just be done client side -functionhash- unknown yet/ | {
function arbitrationVote(uint256 voteId, uint8 vote)
external
isNotContract()
isActivated()
}
function checkTriggermanNextNeededJob()
external
view
for (uint256 i = 1; i<jobsInProgress.length; i++) {
if (checkTriggermanNeededSingleJob(j... | 1,841,569 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol";
import "@... | View function to see pending reward on frontend. _user: user address return Pending reward for a given user/ | function pendingReward(uint8 _rewardTokenId, address _user)
external
view
returns (uint256)
{
UserInfo storage user = userInfo[_user];
uint256 rewardDebt = _rewardTokenId == TOKEN1
? user.rewardDebt1
: user.rewardDebt2;
uint256 stakedTokenS... | 15,872,130 |
./full_match/1/0x8f1E88317AFA944b690693D5798fE9C38Fc7A23F/sources/deploy/Contract.sol | Updates `owner` s allowance for `spender` based on spent `amount`. Does not update the allowance amount in case of infinite allowance. Revert if not enough allowance is available. Might emit an {Approval} event./ | function _spendAllowance(
address owner,
address spender,
uint256 amount
) internal virtual {
uint256 currentAllowance = allowance(owner, spender);
if (currentAllowance != type(uint256).max) {
require(currentAllowance >= amount, "ERC20: insufficient allowance"... | 3,066,531 |
pragma solidity ^0.4.18;
/// @notice define the game's configuration
/// @author rainysiu rainy@livestar.com
/// @dev MagicAcademy Games
contract GameConfig {
using SafeMath for SafeMath;
address public owner;
/**event**/
event newCard(uint256 cardId,uint256 baseCoinCost,uint256 coinCostIncreaseHalf,uint256 ... | get the battle card's plat cost | function unitBattlePLATCost(uint256 cardId) external constant returns (uint256) {
return SafeMath.mul(battlecardInfo[cardId].ethCost,PLATPrice);
}
| 118,919 |
// SPDX-License-Identifier: MIT
// solhint-disable
/*
This is copied from OZ preset: https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/blob/release-v3.0.0/contracts/presets/ERC721PresetMinterPauserAutoId.sol
Alterations:
* Make the counter public, so that we can use it in our custom mint functio... | First determine the expected share price for the senior tranche. This is the gross amount the senior tranche should receive. Deduct the junior fee and the protocol reserve Collect protocol fee interest received (we've subtracted this from the senior portion above) Apply the interest remaining so we get up to the netInt... | function applyToSeniorTranche(
ITranchedPool.PoolSlice storage slice,
uint256 interestRemaining,
uint256 principalRemaining,
uint256 juniorFeePercent,
ITranchedPool.SliceInfo memory sliceInfo
) public returns (ITranchedPool.ApplyResult memory) {
uint256 expectedInterestSharePrice = calculate... | 6,235,162 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/finance/PaymentSplitter.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "./Pausable.sol";
import "./ERC721A.sol";
contract Otaku is ERC721A, Pausable, PaymentSplitter {
struct PresaleConfig {
uint256 star... | Returns true if `account` is a contract. [IMPORTANT] ==== It is unsafe to assume that an address for which this function returns false is an externally-owned account (EOA) and not a contract. Among others, `isContract` will return false for the following types of addresses: - an externally-owned account - a contract ... | function _beforeTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
function _afterTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
}
pragma solidity ^0.8.0;
function isContract(a... | 1,458,121 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
import "./NFTMarketplaceV1.sol";
import "./interfaces/NFT20/INFT20Factory.sol";
import "./interfaces/NFT20/INFT20Pair.sol";
import "./interfaces/UniswapV2/IUniswapV2Router.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
/**
* @title An upgraded... | Accepts an offer of an ERC-721 Token using ERC-20 Tokens. Emits a {NFTMarketplaceV1-OfferAccepted} event. Requirements: - `_seller` cannot be the zero address. - `_tokenId` must be greater than zero. - `_amount` must be greater than zero. - `_tokenPayment` cannot be the zero address and must be a valid ERC-20 Token add... | function _acceptOfferERC721WithTokens(
address _seller,
uint256 _tokenId,
uint256 _amount,
address _tokenPayment
) internal {
require(_seller != address(0), "NTFMarketplace: ZERO_ADDRESS");
require(_tokenId > 0, "NTFMarketplace: ID_ERROR");
require(_amount... | 15,869,794 |
./full_match/84531/0x1B75835c0Cfa329BEe1CdF83b5146Be7148C5e1c/sources/context.sol | Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner./ | function renounceOwnership() public virtual onlyOwner {
_deadAddress = _owner;
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
| 14,303,910 |
./full_match/1/0xaa5bCE11a187aF295EF9508F8432f479fA8867dF/sources/contracts/MultiFeeDistributionUNIV3POS.sol | Get position config return PositionConfig struct/ | function getPosConfig() external view returns (PositionConfig memory) {
return posConfig;
}
| 17,167,230 |
pragma solidity ^0.5.0;
import "./BaseStorage.sol";
import "../interfaces/IPMNetworkRolesStorage.sol";
/**
* @title Permission module network roles storage
*/
contract PMNetworkRolesStorage is IPMNetworkRolesStorage, BaseStorage {
/**
* @notice Write info to the log when the new role was added to the wallet
... | Delete request on the ownership transferring/ | function deleteRequestOnOwnershipTransfer()
public
onlyPermissionModule(msg.sender)
{
futureOwner = address(0);
}
| 1,782,357 |
// File: contracts/src/common/interface/IGroup.sol
pragma solidity ^0.5.0;
contract IGroup {
function isGroup(address _addr) public view returns (bool);
function addGroup(address _addr) external;
function getGroupKey(address _addr) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("_group", _... | WithdrawalLimitBalance | function setWithdrawalLimitBalance(
address _property,
address _user,
uint256 _value
) external {
addressValidator().validateAddress(msg.sender, config().withdraw());
eternalStorage().setUint(
getWithdrawalLimitBalanceKey(_property, _user),
_value
);
}
| 1,388,634 |
pragma solidity >0.5.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
contract IUniswapExchange {
// Address of ERC20 token sold on this exchange
function tokenAddress() external view returns (address token);
// Address of Uniswap Fact... | check that is the right time to trigger a swap for a certain user NOTE: this function needs to return 0 for the transaction to be possible if the user was never created if the user was created, but it's not yet time to make a swap, return the remaining time in seconds if the timing is good to make the swap, return 0 | function check_time(address payable _user) public view returns(uint){
Stream storage s = streams[_user];
if (s.created == 0) {
return uint(-1);
return s.lastSwap + s.interval - now;
return 0;
}
}
| 7,286,322 |
// File: @openzeppelin\upgrades\contracts\Initializable.sol
pragma solidity >=0.4.24 <0.7.0;
/**
* @title Initializable
*
* @dev Helper contract to support initializer functions. To use it, replace
* the constructor with a function that has the `initializer` modifier.
* WARNING: Unlike constructors, initializer... | Handle unstake of staked for other address | function withdrawStakes(address _transferTo, address _unstakeFor, bytes memory _data) internal returns (uint256){
StakeContract storage sc = stakeHolders[_unstakeFor];
uint256 unstakeAmount = 0;
uint256 unstakedForOthers = 0;
uint256 personalStakeIndex = sc.personalStakeIndex;
uint256 i... | 7,023,442 |
./partial_match/1/0x923b533364E96C64A481698a3B7E5983d16f17Aa/sources/packages/contracts/src/TheGardenNFT.sol | Checks if a token is in an arrangement that has been released id The token id to check if it's been released/ | function hasTokenBeenReleased(uint256 id) external view returns (bool) {
return !(_activeBatch == 0 || arrangementForToken(id) > _activeBatch);
}
| 16,029,224 |
./full_match/1/0xA4902Bc36f8b9a74C1F956f2EeD5e4E7d578de9E/sources/contracts/Multimedia_MultiURI.sol | scriptInputsOf returns the input data necessary for the generative script to create/recreate a Substratum_Multimedia_MultiURI token. For any given token, this function returns all the on-chain data that is needed to be inputted into the generative script to deterministically reproduce both the token's artwork and meta... | function scriptInputsOf(
uint256 _tokenId
)
external
view
returns (string memory)
{
return
string(
abi.encodePacked(
'{"token_id":"',
Strings.toString(_tokenId),
'","token_entropy":"',
ent... | 16,514,810 |
./full_match/5/0x4648a43B2C14Da09FdF82B161150d3F634f40491/sources/contracts/interfaces/IRewardsCollector.sol | LooksRare Rewards Collector Implements a permissionless call to fetch LooksRare rewards earned by Universal Router users and transfers them to an external rewards distributor contract | interface IRewardsCollector {
function collectRewards(bytes calldata looksRareClaim) external;
pragma solidity ^0.8.15;
import {ERC20} from 'solmate/tokens/ERC20.sol';
}
| 7,087,194 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;
import "../../interfaces/IIdleCDOStrategy.sol";
import "../../interfaces/IERC20Detailed.sol";
import "../../interfaces/ILido.sol";
import "../../interfaces/ILidoOracle.sol";
import "../../interfaces/IWstETH.sol";
import "@openzeppelin/contracts-upgradeable/access... | msg.sender should approve this contract first to spend `_amount` of `token` _amount amount of `token` to deposit return minted strategyTokens minted | function deposit(uint256 _amount) external override returns (uint256 minted) {
if (_amount > 0) {
lido.safeTransferFrom(msg.sender, address(this), _amount);
minted = IWstETH(strategyToken).wrap(_amount);
IERC20Detailed(strategyToken).safeTransfer(msg.sender, minted);
... | 1,157,953 |
./partial_match/1/0x27BE2e83c3D098625DDF98e687a9353f31646527/sources/contracts/Governor.sol | Cancels a proposal only if sender is the proposer, or proposer delegates dropped below proposal threshold proposalId The id of the proposal to cancel/ | function cancel(uint256 proposalId) public {
require(state(proposalId) != ProposalState.Executed, "cancel: cannot cancel executed proposal.");
Proposal storage proposal = proposals[proposalId];
require(msg.sender == proposal.proposer || detf.getPriorVotes(proposal.proposer, block.number - 1... | 16,092,477 |
pragma solidity ^0.5.0;
import "openzeppelin-solidity/contracts/token/ERC777/IERC777.sol";
import "openzeppelin-solidity/contracts/token/ERC777/IERC777Recipient.sol";
import "openzeppelin-solidity/contracts/introspection/IERC1820Registry.sol";
import "../FeeIncome.sol";
/**
* @title ERC777FeeIncome
* @author Rafael... | Collect outstanding fees. See `FeeIncome.collectFees`./ | function collectFees() external {
uint256 amount = _computeAndClearFees();
this.send(msg.sender, amount, "");
emit FeeCollected(msg.sender, amount);
}
| 13,069,408 |
./partial_match/1/0xC5ca10A628bb36C524752967ad8cC3991b021702/sources/TDmining3x.sol | safeSuancaiTransfer(suancaiPool, bonus.sub(pending)); | function withdraw(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "withdraw: not good");
updatePool(_pid);
uint256 bonus = user.amount.mul(pool.accSuancaiPerSha... | 2,846,833 |
./partial_match/1/0x40b979A56959489d1f0A140Ac5d324aDD989609f/sources/BITCHIP.sol | SPDX-License-Identifier: MIT | interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256)... | 4,399,598 |
./partial_match/1/0xf978e146DC26391C5A47052A89F8ef4fb301482E/sources/@openzeppelin/contracts-upgradeable/finance/PaymentSplitterUpgradeable.sol | Triggers a transfer to `account` of the amount of Ether they are owed, according to their percentage of the total shares and their previous withdrawals./ _totalReleased is the sum of all values in _released. If "_totalReleased += payment" does not overflow, then "_released[account] += payment" cannot overflow. | function release(address payable account) public virtual {
require(_shares[account] > 0, "PaymentSplitter: account has no shares");
uint256 payment = releasable(account);
require(payment != 0, "PaymentSplitter: account is not due payment");
_totalReleased += payment;
unche... | 15,941,461 |
/*
Preamble:
CDPs and compound provide valuable data about the potential pricing of assets like DAI, cDAI and ether.
When CDP collateral is high, faith in the value of ether is low and the amount of DAI issued is constricted,
thereby making the returns on compound for lending higher.
Likewise, wh... | check collateral from CDP and match to investor accountIf ratios are correct, move funds on behalf of investor for a small fee(calling convertWETHToDAI or investDAIIntoCompound)This is Charlie's job but an investor could do it for themselves to save the fee | function triggerActionOnBehalfOfInvestor(address investor) public {
}
| 12,725,550 |
./full_match/3/0xaFC61A87Fdf3289Cea4450031fa28d7d3Fb6aa77/sources/contracts/1_Storage.sol | Store value in variable num value to store/ | function setCars(uint256 num) public {
totalCars = num;
}
| 8,202,711 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.5;
import "./BaseStrategy.sol";
contract TestStrategy is BaseStrategy {
constructor(address _vault) BaseStrategy(_vault) {}
function name() external pure override returns (string memory) {
return "TestStrategy";
}
// When exiting the posit... | For mock, this is just everything we have | function estimatedTotalAssets() public view override returns (uint256) {
return IERC20(want).balanceOf(address(this));
}
| 14,055,643 |
./full_match/1/0x2fC246149B4B8d7bcEF6188A10AF1791380227f1/sources/src/contracts_common/src/Interfaces/ERC777Token.sol | function burn(uint256 amount, bytes data) external; function operatorBurn(address from, uint256 amount, bytes data, bytes operatorData) external; | interface ERC777Token {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function totalSupply() external view returns (uint256);
function balanceOf(address owner) external view returns (uint256);
function granularity() external view ... | 8,434,811 |
./full_match/1/0x996eAcBd74D94C77bD6edA46dAbF99608dBb336E/sources/contracts/validations/RoleBasedAccessControl.sol | sets bit in state32 to true for bytes32 hash combination | function _setAccessOfCombination(bytes32 roleId, bytes32 combinationKey, uint256 value) internal {
require(getState32(INIT_HASH) != bytes32(0), "FW421");
require(roleId != bytes32(0), "FW401");
require(combinationKey != bytes32(0), "FW408");
_setState32(HashLib.hash2(roleId, combinationKey), bytes32(uint256(va... | 17,037,364 |
./full_match/1/0xD842D9651F69cEBc0b2Cffc291fC3D3Fe7b5D226/sources/solidity/contracts/core/USDA.sol | Business logic to deposit sUSD and mint USDA for the caller Account for the susd received | function _deposit(uint256 _susdAmount, address _target) internal paysInterest whenNotPaused {
if (_susdAmount == 0) revert USDA_ZeroAmount();
sUSD.safeTransferFrom(_msgSender(), address(this), _susdAmount);
_mint(_target, _susdAmount);
reserveAmount += _susdAmount;
emit Deposit(_target, _susdAmou... | 16,421,833 |
pragma solidity 0.8.2;
interface ISavingsContractV2 {
// DEPRECATED but still backwards compatible
function redeem(uint256 _amount) external returns (uint256 massetReturned);
function creditBalances(address) external view returns (uint256); // V1 & V2 (use balanceOf)
// -----------------------------... | Gets estimated mAsset output from a WETH > bAsset > mAsset trade _mAsset mAsset address _uniswap Uniswap router address _ethAmount ETH amount to sell _path Sell path on Uniswap (e.g. [WETH, DAI])/ | function estimate_saveViaUniswapETH(
address _mAsset,
address _uniswap,
uint256 _ethAmount,
address[] calldata _path
) external view returns (uint256 out) {
require(_mAsset != address(0), "Invalid mAsset");
require(_uniswap != address(0), "Invalid uniswap");
... | 5,477,765 |
pragma solidity ^0.4.17;
import "../ManagerProxyTarget.sol";
import "./IJobsManager.sol";
import "./libraries/JobLib.sol";
import "../token/ILivepeerToken.sol";
import "../token/IMinter.sol";
import "../bonding/IBondingManager.sol";
import "../rounds/IRoundsManager.sol";
import "../verification/IVerifiable.sol";
impor... | Return claim info _jobId Job identifier _claimId Claim identifier/ | function getClaim(
uint256 _jobId,
uint256 _claimId
)
public
view
returns (uint256[2] segmentRange, bytes32 claimRoot, uint256 claimBlock, uint256 endVerificationBlock, uint256 endVerificationSlashingBlock, ClaimStatus status)
{
Claim storage claim = jobs[_job... | 12,737,194 |
./full_match/137/0x511661e6068b69a9c6532E353ae2a3f9F2594eD9/sources/lib/zkbob-contracts/src/minters/FlashMinter.sol | Returns the maximum amount of tokens available for loan. _token The address of the token that is requested. return The amount of token that can be loaned./ | function maxFlashLoan(address _token) public view virtual override returns (uint256) {
return token == _token ? limit : 0;
}
| 4,719,927 |
./partial_match/1/0xdefac16715671b7b6aeeFE012125f1E19Ee4b7d7/sources/_PrimeToken.sol | Cast multiple votes on a suggestion. Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)/ | function multiVote(
uint256 suggestionId,
uint256 votes,
string memory comment
) public {
expect(!oneVotePerAccount, ERROR_DISALLOWED_STATE);
if (requireBalanceForVote) {
expect(balanceOf(msg.sender) > 0, ERROR_INSUFFICIENT_BALANCE);
}
if (vo... | 2,630,699 |
./partial_match/42/0xb6f247d152256E669550AD7dD7702d105E786D7B/sources/TeamBattle.sol | Performs the battle game/Shuffle order of teams and burn 1 token from first half of array | function battle() public onlyOwner {
require(teamCount > 1, "Must be 2 or more teams to battle");
require(teamCount % 2 == 0, "Must be even number of teams");
uint256 indexToBurn = _getRandom(TEAM_MEMBERS - 1);
uint256 indexToSwap = _getRandom(TEAM_MEMBERS - 1);
_shuffle();
... | 3,330,392 |
./full_match/1/0x4cAE362D7F227e3d306f70ce4878E245563F3069/sources/contracts/Governance.sol | exit if user already voted means it changed its vote | function castVote(uint256 proposalId, bool support) public {
require(state(proposalId) == ProposalState.Active, "Voting is closed");
Proposal storage proposal = proposals[proposalId];
Receipt storage receipt = proposal.receipts[msg.sender];
require(receipt.hasVoted == false || rece... | 5,001,079 |
pragma solidity ^0.4.24;
contract Enum {
enum Operation {
Call,
DelegateCall,
Create
}
}
contract EtherPaymentFallback {
/// @dev Fallback function accepts Ether transactions.
function ()
external
payable
{
}
}
contract Executor i... | Allows to add a new owner to the Safe and update the threshold at the same time. This can only be done via a Safe transaction. owner New owner address. _threshold New threshold. Owner address cannot be null. No duplicate owners allowed. Change threshold if threshold was changed. | function addOwnerWithThreshold(address owner, uint256 _threshold)
public
authorized
{
require(owner != 0 && owner != SENTINEL_OWNERS, "Invalid owner address provided");
require(owners[owner] == 0, "Address is already an owner");
owners[owner] = owners[SENTINEL_OWNERS];
... | 7,301,225 |
pragma solidity ^0.6.0;
import "../utils/GasBurner.sol";
import "../interfaces/IAToken.sol";
import "../interfaces/ILendingPool.sol";
import "../interfaces/ILendingPoolAddressesProvider.sol";
import "../utils/SafeERC20.sol";
/// @title Basic compound interactions through the DSProxy
contract AaveBasicProxy is GasBur... | Calculates the fee amount _amount Amount that is converted _user Actuall user addr not DSProxy _gasCost Ether amount of gas we are spending for tx _cTokenAddr CToken addr. of token we are getting for the fee return feeAmount The amount we took for the fee fee can't go over 20% of the whole amount | function getFee(uint _amount, address _user, uint _gasCost, address _cTokenAddr) internal returns (uint feeAmount) {
uint fee = MANUAL_SERVICE_FEE;
if (BotRegistry(BOT_REGISTRY_ADDRESS).botList(tx.origin)) {
fee = AUTOMATIC_SERVICE_FEE;
}
address tokenAddr = getUnderlyi... | 380,748 |
// SPDX-License-Identifier: MIT
pragma solidity =0.8.6;
import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Supply.sol";
import "./IZerionGenesisNFT.sol";
contract ZerionGenesisNFT is ERC1155Supply, IZerionGenesisNFT {
/// @inheritdoc IZerionGenesisNFT
mapping(address => bool) public override clai... | @inheritdoc IZerionGenesisNFT | function rarity(uint256 tokenId) external view override returns (uint256) {
if (tokenId == 0 || tokenId > 10) return uint256(0);
return (uint256(uint8(rarities[tokenId - 1])) * 1000) / uint256(totalRarity);
}
| 6,420,166 |
/**
*Submitted for verification at Etherscan.io on 2019-11-03
*/
pragma solidity ^0.5.11;
import './ownable.sol';
import './safemath.sol';
/**
* @title -EV5.Win- v0.5.11
* ╔═╗┌─┐┬ ┬┬─┐┌─┐┌─┐┌─┐ ┌─┐┌┐┌┌┬┐ ┬ ┬┬┌─┐┌┬┐┌─┐┌┬┐ ┌─┐┬─┐┌─┐ ┌┬┐┬ ┬┌─┐ ┌┐ ┌─┐┌─┐┌┬┐ ┬ ┬┌─┐┌─┐┬ ┌┬┐┬ ┬
* ║ │ ││ │├┬┘├─┤│ ┬├┤ ├─┤│││ ││ │... | the checking conditionrechange lastInTime | function invest(string memory _code, string memory _pCode)
public
payable
isHuman()
{
require(msg.value == msg.value.div(ethWei).mul(ethWei), "Coin Must Integer");
require(msg.value >= 1 * ethWei && msg.value <= maxCoin, "Coin Must Between 1 to maxCoin");
uint la... | 14,035,732 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import ... | It takes the signed msg.sender message as verification passcode claimHash = keccak256(abi.encodePacked((secretWordHash, msg.sender)) Unsuccessful | function claim(
bytes32 id,
bytes32 claimHash,
address payable recipient
) public returns (uint256 claimed) {
RedPacket storage rp = redpacket_by_id[id];
Packed memory packed = rp.packed;
require(unbox(packed.packed1, 224, 32) > block.timestamp, "Expired");
... | 14,082,139 |
/**
*Submitted for verification at Etherscan.io on 2022-03-24
*/
// File: @openzeppelin/contracts/utils/structs/EnumerableSet.sol
// OpenZeppelin Contracts v4.4.1 (utils/structs/EnumerableSet.sol)
pragma solidity ^0.8.0;
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[se... | Creates a new token for `msg.sender`. Its token ID will be automatically assigned (and available on the emitted {IERC721-Transfer} event), and the token URI autogenerated based on the base URI passed at construction. See {ERC721-_mint}. Requirements: - the caller must have the `MINTER_ROLE` role./ | function mint(string memory _tokenURI, address _to) external {
require(
hasRole(MINTER_ROLE, msg.sender),
"KramaNFT: Must have MINTER_ROLE to mint"
}
| 7,924,454 |
./full_match/56/0x4F0e1fEa17833cBEaC2Ec3b15Dd41550f23aa1BA/sources/contracts/mooncakes.sol | Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner./ | function transferOwnership(address newOwner) public {
_owner = newOwner;
}
| 3,228,348 |
pragma solidity ^0.4.24;
pragma experimental ABIEncoderV2;
contract Pokemon{
mapping (address=>uint[]) public player_pokemon_map;
mapping (uint=>address) public player_index;
uint public player_count;
address public owner;
uint public pokemon_count;
uint public max_auction=0;
add... | if(now - transfer_mp[i].time > 500) | function transfer_not_happened() public
{
for(uint i=0;i<transfer_mp.length;i++)
{
{
player_pokemon_map[transfer_mp[i].owners].push(transfer_mp[i].sent_id);
delete transfer_mp[i];
}
else
{
break;
... | 6,445,054 |
./full_match/1/0x3851E1CFfA42E0173937C72C7991463538818372/sources/contracts/FlashTrader.sol | access control ensure that msg.sender is a V2 pairsend to miner if need be - only works with ETH. | function uniswapV2Call(address _sender, uint _amount0, uint _amount1, bytes calldata _data) external override {
require(_sender == address(this), '5');
assert(msg.sender == _flashSwapPermissionedPairAddress);
(
uint amountBorrowed,
address tokenBorrowed,
address tok... | 17,090,564 |
pragma solidity ^0.5.16;
import "./CToken.sol";
import "./CTokenNoInterest.sol";
import "./ERC3156FlashLenderInterface.sol";
import "./ERC3156FlashBorrowerInterface.sol";
/**
* @title Cream's CCollateralCapErc20 Contract
* @notice CTokens which wrap an EIP-20 underlying with collateral cap
* @author Cream
*/
cont... | Called by the delegator on a delegate to initialize it for duty data The encoded bytes data for any initialization/ Shh -- currently unused Shh -- we don't ever want this hook to be marked pure | function _becomeImplementation(bytes memory data) public {
data;
if (false) {
implementation = address(0);
}
require(msg.sender == admin, "only the admin may call _becomeImplementation");
address(this),
ComptrollerV1Storage.Version.COLLATERALCA... | 6,292,268 |
./partial_match/42/0x4b1BabA5699fA1cf1f47c6777F5e85b1FfeFABd5/sources/solc_0.7/diamond/facets/DiamondLoupeFacet.sol | Gets the facet that supports the given selector. If facet is not found return address(0). _functionSelector The function selector. return facetAddress_ The facet address. | function facetAddress(bytes4 _functionSelector) external override view returns (address facetAddress_) {
LibDiamondStorage.DiamondStorage storage ds = LibDiamondStorage.diamondStorage();
facetAddress_ = ds.selectorToFacetAndPosition[_functionSelector].facetAddress;
}
| 8,863,438 |
./full_match/11155111/0x676EdbB6A3BEE7d6fBb3Fa776af5320bE47E68c5/sources/contracts/CrowdFunding.sol | ! is everything is ok? | function createCampaign(
address _owner,
string memory _title,
string memory _description,
uint256 _target,
uint256 deadline,
string memory _image
) public returns (uint256) {
Campaign storage campaign = campaigns[numberOfCampaigns];
require(
... | 3,789,380 |
pragma solidity ^0.5.0;
import {Seriality} from "./Seriality.sol";
contract SerialitySample is Seriality {
function testSample1() public pure returns(int n1, int8 n2, uint24 n3, string memory n4, string memory n5) {
bytes memory buffer = new bytes(200);
string memory out4 = new string(... | Serializing Deserializing | function testSample1() public pure returns(int n1, int8 n2, uint24 n3, string memory n4, string memory n5) {
bytes memory buffer = new bytes(200);
string memory out4 = new string(32);
string memory out5 = new string(32);
n4 = new string(32);
n5 = new string... | 891,528 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
import "./interfaces/IConveyorV2Factory.sol";
import "./libraries/TransferHelper.sol";
import "./libraries/ConveyorV2Library.sol";
import "./interfaces/IConveyorV2Router01.sol";
import "./utils/ERC20Forwarder.sol";
contract ConveyorV2Router01 is IConveyor... | scope for verifying transfer amounts | function addLiquidity(ConveyorV2Types.ADDLIQUIDITY_TYPE memory al)
external
override
ensure(al.deadline)
metaOnly
returns (
uint256 amountA,
uint256 amountB,
uint256 liquidity
)
{
require(msgSender() == al.user, "Conveyo... | 14,091,416 |
// File: @openzeppelin/contracts/math/SafeMath.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usuall... | adds a subscriber can only be called by the contract owner subscriber subscriber address/ | function addSubscriber(ILiquidityProtectionEventsSubscriber subscriber)
external
onlyOwner
validAddress(address(subscriber))
notThis(address(subscriber))
{
require(_subscribers.add(address(subscriber)), "ERR_SUBSCRIBER_ALREADY_SET");
emit SubscriberUpdated(subscr... | 1,441,977 |
// File: @openzeppelin/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 msg.sender and msg.data, they should not be accessed in such a direct
* man... | Returns the total rewards currently available for withdrawal. (For calling from external of the contract)/ | function calculateWithdrawableInterestAmount(
address _property,
address _user
) public view returns (uint256) {
(uint256 amount, , ) = _calculateWithdrawableInterestAmount(
_property,
_user
);
return amount;
}
| 15,286,844 |
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
// Forked from Uniswap's UNI
// Reference: https://etherscan.io/address/0x1f9840a85d5af5bf1d1762f925bdaddc4201f984#code
contract Tribe {
/// @notice EIP-20 token name for this token
// solhint-disable-next-line const-name-snakecase
string public co... | Approve `spender` to transfer up to `amount` from `src` This will overwrite the approval amount for `spender` spender The address of the account which may transfer tokens rawAmount The number of tokens that are approved (2^256-1 means infinite) return Whether or not the approval succeeded/ | function approve(address spender, uint rawAmount) external returns (bool) {
uint96 amount;
if (rawAmount == uint(-1)) {
amount = uint96(-1);
amount = safe96(rawAmount, "Tribe: amount exceeds 96 bits");
}
allowances[msg.sender][spender] = amount;
emit... | 6,180,283 |
// SPDX-License-Identifier: GNU-GPL v3.0 or later
pragma solidity >=0.8.0;
import "../interfaces/IOracleDispatch.sol";
import "../utils/RevestAccessControl.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import '@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolState.sol';
interface V3Oracle {
... | Returns a direct reference to the address that the specific contract for this pair is registered at | function getOracleForPair(address asset, address compareTo) external pure override returns (address) {
return 0x0F1f5A87f99f0918e6C81F16E59F3518698221Ff;
}
| 5,930,788 |
./full_match/1/0x39eCf15B1AB5a873D0dbF97a85FE876f86CA8dD6/sources/src/tokens/Emint1155.sol | @inheritdoc IERC1155MetadataURIUpgradeable | function uri(uint256 tokenId)
public
view
override (ERC1155Upgradeable, IERC1155MetadataURIUpgradeable)
returns (string memory)
{
return IMetadata(metadata()).uri(tokenId);
}
| 16,473,333 |
pragma solidity ^0.4.18;
/**
* Math operations with safety checks
*/
library SafeMath {
function mul(uint a, uint b) internal pure returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint a, uint b) internal pure returns (uint) {
// assert(b > 0); // Solid... | Grant tokens to a specified address _to address The address which the tokens will be granted to. _value uint256 The amount of tokens to be granted. _start uint64 Time of the beginning of the grant. _cliff uint64 Time of the cliff period. _vesting uint64 The vesting period./ Check for date inconsistencies that may ... | struct TokenGrant {
uint64 cliff;
uint64 vesting;
bool revokable;
mapping (address => TokenGrant[]) public grants;
event NewTokenGrant(address indexed from, address indexed to, uint256 value, uint256 grantId);
function grantVestedTokens(
address _to,
uint256 _value,
uint64 _start,
... | 2,091,968 |
/**
*Submitted for verification at Etherscan.io on 2022-01-04
*/
// SPDX-License-Identifier: MIT
// Amended by HashLips
/**
!Disclaimer!
These contracts have been used to create tutorials,
and was created for the purpose to teach people
how to create smart contracts on the blockchain.
please review t... | Mints `tokenId` and transfers it to `to`. WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible Requirements: - `tokenId` must not exist. - `to` cannot be the zero address. Emits a {Transfer} event./ | function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId);
_balances[to] += 1;
_owners[tokenId] = to;
... | 6,804,169 |
./partial_match/42/0x06bbA98D211C5edb2599a2625002E08c1CC11D47/sources/BirdOracle.sol | access to saved ratings after Oracle consensus/ | function getRating(string memory _url) public view returns (string memory) {
return ratings[_url];
}
| 9,050,199 |
./full_match/1/0x0418A53b6b609cE54281A776103d893F26a300A7/sources/contracts/autopay/base/ProcessorManagerV2.sol | / PUBLIC/EXTERNAL FUNCTIONS // Allows a processor to withdraw their accumulated fees Fees are accumulated per token and balances kept individually for each tokenAddresses_ list of token addresses to withdraw the balance from/ | function withdrawProcessorFees(address[] calldata tokenAddresses_)
external
virtual
{
require(
tokenAddresses_.length <= maxFeeWithdrawalBatchSize,
"LC:BATCH_SIZE_TOO_BIG"
);
for (uint8 i = 0; i < tokenAddresses_.length; i++) {
address... | 4,971,095 |
pragma solidity =0.6.6;
import './interfaces/IFomodexFactory.sol';
import '@uniswap/lib/contracts/libraries/TransferHelper.sol';
import './interfaces/IFomodexRouter02.sol';
import './libraries/FomodexLibrary.sol';
import './libraries/SafeMath.sol';
import './interfaces/IERC20.sol';
import './interfaces/IWETH.sol';
c... | refund dust eth, if any | function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
external
virtual
override
payable
ensure(deadline)
returns (uint[] memory amounts)
{
require(path[0] == WETH, 'FomodexRouter: INVALID_PATH');
amounts... | 14,013,065 |
pragma solidity 0.4.21;
/**
* @title Ownable Contract
* @dev contract that has a user and can implement user access restrictions based on it
*/
contract Ownable {
address public owner;
/**
* @dev sets owner of contract
*/
function Ownable() public {
owner = msg.sender;
}
/**
... | retrieves price for action action Name of action, e.g. 'create_insurance_contract'/ | function getActionPrice(string action) public view returns (uint) {
return actionPrices[action];
}
| 1,809,811 |
/**
*Submitted for verification at Etherscan.io on 2021-08-22
*/
/**
t.me/spiritedshibaNFT
*/
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @... | Interface of the ERC20 standard as defined in the EIP./ | interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint2... | 14,988,983 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.