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.4.24;
/**
* @dev winner events
*/
contract WinnerEvents {
event onBuy
(
address paddr,
uint256 ethIn,
string reff,
uint256 timeStamp
);
event onBuyUseBalance
(
address paddr,
uint256 keys,
uint256 tim... | send eth to contract/ | function ()
isActivated()
isHuman()
isWithinLimits(msg.value)
public
payable {
buyCore(msg.sender, msg.value, "");
}
| 1,012,875 |
// SPDX-License-Identifier: Apache-2.0
/******************************************************************************
* Copyright 2020 IEXEC BLOCKCHAIN TECH *
* *
* Licensed under the Apache License, Ve... | Consensus methods / setup denominator | function initialize(bytes32 _dealid, uint256 idx)
public override returns (bytes32)
{
IexecLibCore_v5.Deal memory deal = m_deals[_dealid];
require(idx >= deal.botFirst );
require(idx < deal.botFirst.add(deal.botSize));
bytes32 taskid = keccak256(abi.encodePacked(_dealid, idx));
IexecLi... | 983,893 |
/*
*
*
* /$$$$$$$$ /$$ /$$ /$$ /$$$$$$ /$$$$$$ /$$$$$$
*|__ $$__/|__/ | $$ | $$ /$$__ $$ /$$__ $$ /$$__ $$
* | $$ /$$ /$$$$$$ /$$$$$$ /$$$$$$ | $$ /$$ /$$ /$$$$$$$| $$ ... | reflection 2%, 2.4% marketing, 3.2% Lp, 2.4% winner Lift max tx amount too | function defaultTaxAfter24h() external onlyOwner {
_taxFee = 2;
_liquidityFee = 8;
_maxTxAmount = 1e12 * 10**9;
}
| 10,940,343 |
./full_match/421613/0xEa539B37177387cB23c1bAE7F9E6aCecC6F1C470/sources/project:/contracts/diamond/facets/PredictUpDownFacet.sol | Generate prediction data Request feed price. | function _predictAndBet(PredictionInput memory pi) private {
LibPredictUpDown.PredictionUpDownStorage storage puds = LibPredictUpDown.predictionUpDownStorage();
uint256 openFee = _predictCheck(puds, pi);
pi.tokenIn.transferFrom(msg.sender, pi.amountIn);
PendingPrediction memory pendi... | 11,583,143 |
./full_match/4/0x75716Ca83c93c9b6fBbf2481bCF2aF72A225098E/sources/contracts/AnniversaryAchievement.sol | Rename a team Callable only by owner admins./ Verify length is between 3 and 16 | function renameTeam(
uint256 _teamId,
string calldata _teamName,
string calldata _teamDescription
) external onlyOwner {
require((_teamId <= numberTeams) && (_teamId > 0), "teamId invalid");
bytes memory strBytes = bytes(_teamName);
require(strBytes.length < 20, ... | 647,249 |
//SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.6.12;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability... | generate the uniswap pair path of weth -> token make the swap | function swapEthForTokens(address token, uint256 amount) private {
address[] memory path = new address[](2);
path[0] = uniswapV2Router.WETH();
path[1] = token;
_approve(address(this), address(uniswapV2Router), amount);
path,
_deadWalletAddress,
b... | 1,136,898 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721URIStorageUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
impo... | @inheritdoc ITRLabCore | function getArtwork(uint256 _artworkId) external view override returns (LibArtwork.Artwork memory artwork) {
artwork = _getArtwork(_artworkId);
}
| 1,574,244 |
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 returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
... | helper for buy pool in Bancor network _poolToken address of bancor converter _amount amount of bancor relay/ get Bancor converter calculate connectors amount for buy certain pool amount get converter as contract approve bancor and coonector amount to converter get connectors reset approve (some ERC20... | function buyBancorPool(IERC20 _poolToken, uint256 _amount) private {
address converterAddress = getBacorConverterAddressByRelay(address(_poolToken));
(uint256 bancorAmount,
uint256 connectorAmount) = getBancorConnectorsAmountByRelayAmount(_amount, _poolToken);
BancorConverterInterface converter = Ban... | 14,713,694 |
./partial_match/1/0x3FC9b031aAF1E9F993CdD637833948B16828dB5D/sources/src/SchwapMarket.sol | There is a chance that pay_amt is smaller than 1 wei of the other token | function sellAllAmount(IERC20 pay_gem, uint pay_amt, IERC20 buy_gem, uint min_fill_amount)
public
returns (uint fill_amt)
{
require(!locked, "Reentrancy attempt");
uint offerId;
if (pay_amt * 1 ether < wdiv(offers[offerId].buy_amt, offers[offerId].pay_amt)) {
... | 3,963,710 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.2;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without ... | Create a uniswap pair for this new token exclude from receiving dividends exclude from paying fees or having max transaction amount | constructor() public ERC20("Kroo Nation", "KROO") {
uint256 _ETHRewardsFee = 3;
uint256 _liquidityFee = 3;
ETHRewardsFee = _ETHRewardsFee;
liquidityFee = _liquidityFee;
totalFees = _ETHRewardsFee.add(_liquidityFee);
dividendTracker = new KROODividendTracker();
l... | 1,579,808 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import './math/SafeMath.sol';
import './token/BEP20/IBEP20.sol';
import './token/BEP20/SafeBEP20.sol';
import './access/Ownable.sol';
interface IMigratorChef {
function migrate(IBEP20 token) external returns (IBEP20);
}
// Note ... | Add a new lp to the pool. Can only be called by the owner. | function executeAddPools() external onlyOwner {
uint256 length = waitingPoolInfo.length;
if(length > 0){
for (uint256 pid = 0; pid < length; ++pid) {
PoolInfo storage pool = waitingPoolInfo[pid];
if(!pool.executed && pool.executeTimestamp <= block.timestam... | 990,738 |
pragma solidity ^0.4.23;
/// @title ERC-165 Standard Interface Detection
/// @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md
interface ERC165 {
function supportsInterface(bytes4 interfaceID) external view returns (bool);
}
/// @title ERC-721 Non-Fungible Token Standard
/// @dev See ... | Enable or disable approval for a third party ("operator") to manage all your asset. _operator Address to add to the set of authorized operators. _approved True if the operators is approved, false to revoke approval | function setApprovalForAll(address _operator, bool _approved) external whenNotPaused{
operatorToApprovals[msg.sender][_operator] = _approved;
emit ApprovalForAll(msg.sender, _operator, _approved);
}
| 2,483,225 |
//SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.7.0 <0.9.0;
import "./Whitelist.sol";
import "./Admin.sol";
import "./ReceiverFactory.sol";
/*
This class is a factory class used to produce instances of Corporates, Corporates will act as a parent class to Subsidiary
*/
contract CorporateFactory {
a... | Oracle end point for inserting transaction details into blockchain and recording the mapping function insertTransaction(uint txId, address receiverId, uint txAmount) restricted accountValid public returns(bool) { | function insertTransaction(Receiver receiverId, uint txAmount, string memory link) public returns(bool) {
transactions[numOfTransactions] = Transaction(numOfTransactions, address(receiverId), txAmount, link);
numOfTransactions++;
require(receiverId.admin().owner() == admin.owner(), "This rec... | 15,839,221 |
./full_match/5/0x6ac1074235eF587f047fd44DFe9977788A54a1FF/sources/contracts/Strategy/NoopStrategy.sol | Cashes everything out and withdraws to the vault/ | function withdrawAllToVault() external override onlyVault {
withdrawAllCalled = true;
if (underlyingERC.balanceOf(address(this)) > 0) {
underlyingERC.safeTransfer(
vault,
underlyingERC.balanceOf(address(this))
);
}
}
| 1,899,140 |
/**
*Submitted for verification at Etherscan.io on 2021-12-01
*/
/**
DeepDefiCapital.com
t.me/DeepDefiCapital
https://twitter.com/DeepDefiCapital
https://medium.com/@deepdeficapital/deep-defi-capital-634bffd1299c
Deep Defi Capital is an alternative investment firm with a key focus in decentralised investments.... | solhint-disable-next-line avoid-low-level-calls, avoid-call-value | 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");
}
| 10,666,943 |
// File: @openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol
pragma solidity ^0.5.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 usually assum... | Withdraws funds from the Compound pool. amount The amount of tokens to be withdrawn./ | function withdraw(uint256 amount) external {
require(amount > 0, "Amount must be greater than to 0.");
uint256 redeemResult = _cETHContract.redeemUnderlying(amount);
require(redeemResult == 0, "Error calling redeemUnderlying on Compound cToken: error code not equal to 0");
}
| 12,084,339 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
// Creator: Chiru Labs
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-16... | Mint one or more tokens for address on pre-sale list. | function mintPreDoug(uint256 numberOfTokens, bytes32[] calldata merkleProof)
external
payable
nonReentrant
preSaleActive
isCorrectPayment(dougsPrice, numberOfTokens)
isValidMerkleProof(merkleProof, preMintRoot)
{
uint256 numAlreadyMinted = preMintCount[msg... | 1,132,763 |
./partial_match/1/0xD3ec656617f61324Bc2a2711DBa591295DD0306d/sources/contracts/ERC721PartnerSeaDrop.sol | Update the allowed SeaDrop contracts. Only the owner or administrator can use this function. allowedSeaDrop The allowed SeaDrop addresses./ | function updateAllowedSeaDrop(address[] calldata allowedSeaDrop)
external
override
onlyOwnerOrAdministrator
{
_updateAllowedSeaDrop(allowedSeaDrop);
}
| 3,927,009 |
./full_match/11155111/0x733dcE043088af19443373c839b3a7efEe344817/sources/contracts/KC721.sol | this is the mint function they will be using on our mint page Use below line if no batch buy feature require(msg.value >= ((MINTPRICE + (MINTPRICE/50) + (TWO_DOLLARS_ETH)) amount), "Not enough ETH sent; check price!");remove this if and its contents if they dont want presaleif no delayed reveal get rid of this if else... | function batchMint(uint256 amount) public payable {
require((mintLive == true && block.timestamp >= mintStartTime) || (presaleActive == true), "Mint is not Live");
require(amount > 0, "Cant mint 0 tokens king");
require(amount <= maxMintPerBatch, "Exceeds max mint per batch");
requir... | 3,807,764 |
./partial_match/3/0x65B29b471f69400244Ffee30914745c88883810d/sources/option.sol | Moves tokens `amount` from `sender` to `recipient`. This is internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `sender` cannot be the zero address. - `recipient` cannot be the zero address. - `sender`... | function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer();
rounds[round].balances[s... | 5,236,944 |
./full_match/43114/0xDc173BfF1F72a6Ca6beFEf0173297a00049322e1/sources/contracts/avax.sol | Unchanged OK, check 2 | function clearStuckBalance(uint256 amountPercentage) external authorized {
uint256 amountBNB = address(this).balance;
payable(marketingFeeReceiver).transfer(amountBNB * amountPercentage / 100);
}
| 4,544,993 |
// File: @openzeppelin/contracts/utils/Context.sol
pragma solidity >=0.6.0 <0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a dir... | Determines the amount of tokens that have not vested in the given account. The math is: not vested amount = vesting amount (end date - on date)/(end date - start date) grantHolder = The account to check. onDayOrToday = The day to check for, in days since the UNIX epoch. Can pass the special value 0 to indicate tod... | function _getNotVestedAmount(address grantHolder, uint32 onDayOrToday)
internal
view
returns (uint256 amountNotVested)
{
tokenGrant storage grant = _tokenGrants[grantHolder];
vestingSchedule storage vesting = _vestingSchedules[grant.vestingLocation];
uint32 onDay = _effectiveDay(onDayOrToday... | 327,725 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0 <0.8.0;
import 'hardhat/console.sol';
import {Ownable} from '@openzeppelin/contracts/access/Ownable.sol';
import {SafeMath} from '@openzeppelin/contracts/math/SafeMath.sol';
import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import {SafeERC20}... | collect rewards from pools/ | function collectReward() public override {
if (store.totalSupply() > 0) {
for (uint256 i = 0; i < rewardPools.length(); i++) {
try IRewardPool(rewardPools.at(i)).collect() returns (
address token,
uint256 amount
) {
... | 6,417,698 |
pragma solidity ^0.4.8;
// Utility contract for ownership functionality.
contract owned {
address public owner;
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) onlyOwner ... | Allows anyone to get the final result information for the specified match matchHash the identifying hash for the match league the league the match pertains to/ require the match is finalized loop through result counter and determine most numerous result | function getFinalResult(
bytes32 matchHash,
string league
) view public returns (bytes32, bytes32, string, uint, string, uint) {
League storage thisLeague = leagues[leagueIndex[validateLeague(league)]];
Match storage thisMatch = thisLeague.matches[thisLeague.matchIndex[matchHash]... | 12,535,203 |
/**
*Submitted for verification at Etherscan.io on 2022-04-29
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
interface IVault {
function token() external view returns (address);
}
interface IRegistry {
function numVaults(address) external view returns (uint256);
function vaults(address, uint256) exte... | Fetch registry adapter address/ | function registryAdapterAddress() public view returns (address) {
return
IAddressesProvider(addressesProviderAddress).addressById(
"REGISTRY_ADAPTER_V2_VAULTS"
);
}
| 15,392,231 |
./full_match/1/0x4669159013301f8B0e0bF43077f4263E244101BC/sources/contracts/AvoFactory.sol | deploys a AvoSafe deterministically for owner_ owner_ AvoSafe owner return deployedAvoSafe_ the deployed contract address deploy AvoSafe using CREATE2 opcode (through specifying salt) initialize AvoWallet through proxy with IAvoWallet interface | function _deployAvoSafeDeterministic(address owner_) internal returns (address deployedAvoSafe_) {
IAvoWallet(deployedAvoSafe_).initialize(owner_);
emit AvoSafeDeployed(owner_, deployedAvoSafe_);
}
| 9,774,914 |
pragma solidity ^0.4.8;
import "./Ownable.sol";
import "../token/ERC20Basic.sol";
/// @title Contracts that should not own Tokens
/// @author Remco Bloemen <remco@2π.com>
///
/// This blocks incoming ERC23 tokens to prevent accidental
/// loss of tokens. Should tokens (any ERC20Basic compatible)
/// end up in the con... | Reject all ERC23 compatible tokens | function tokenFallback(address from_, uint value_, bytes data_) external {
throw;
}
| 905,525 |
pragma solidity ^0.5.0;
// Copyright 2019 OpenST Ltd.
//
// 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 applic... | Indicates whether an actor is unrestricted. _actor Actor. return isUnrestricted_ Whether unrestricted./ | function isUnrestricted(address _actor)
external
view
returns (bool isUnrestricted_)
{
return unrestricted[_actor];
}
| 2,504,321 |
./full_match/80001/0x263Dc586cFcEd78cB2838a23B2B5a4E57B72fabA/sources/src/RealEstate.sol | for (uint256 i; i < propertyIndex; ++i){ if(properties[i+1].owner == user){ itemCount++; } } | function getUserProperties(
address user
) external view returns (Property[] memory) {
Property[] memory userProperties;
for (uint i; i < propertyIndex; ++i) {
if (properties[i + 1].owner == user) {
userProperties[i] = properties[i + 1];
}
... | 5,695,285 |
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... | Gets the swapping data offchian for swaps and calls swap. oneProtoData - Struct with multiple swap data defined in interfaces.sol getId Get token amount at this ID from `InstaMemory` Contract. setId Set token amount at this ID in `InstaMemory` Contract./ emitLogSellMulti(oneProtoData, getId, setId); | function _sellMulti(
OneProtoMultiData memory oneProtoData,
uint getId,
uint setId
) internal returns (OneProtoMultiData memory) {
uint _sellAmt = getUint(getId, oneProtoData._sellAmt);
oneProtoData._sellAmt = _sellAmt == uint(-1) ?
getTokenBal(oneProtoData.s... | 104,295 |
./partial_match/42/0x1827E00dB6C889A332D1Ce532A341fE1f752038F/sources/Exchange.sol | overridden by state variable can not be overridden by state variable due to type `Deciaml.decimal` File: contracts/interface/ICFD.sol | interface ICFD {
function getMMLiquidity(address _exchange) external view returns (SignedDecimal.signedDecimal memory);
}
| 3,301,058 |
/**
*Submitted for verification at Etherscan.io on 2021-06-16
*/
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
interface IERC20 {
function balanceOf(address) external view returns (uint256);
function totalSupply() external view returns (uint256);
function decimals() external view returns (ui... | pool - gelato pool address. amount0In - amount of token0 user wants to deposit. amount1In - amount of token1 user wants to deposit. slippage in 18 decimal where 100% = 1e18. return zeroForOne - if true swap token0 for token1 else vice versa return swapAmount - Amount of tokens to swap. return swapThreshold - Max sli... | function getSwapAndDepositParams(
address pool,
uint amount0In,
uint amount1In,
uint slippage
) public view returns (
bool zeroForOne,
uint256 swapAmount,
uint160 swapThreshold
) {
uint slippageBPS = slippage / 1e16;
(zeroForOne, swapA... | 6,572,623 |
./partial_match/42220/0x6023fF93A3b37791a94B15D6AEaD488933b01Db3/sources/C/Users/guill/github/witnet/witnet-solidity-bridge/flattened/WitnetRandomness/FlattenedWitnetRandomness.sol | Generates a pseudo-random number uniformly distributed within the range [0 .. _range), by using the given `_nonce` value and the randomness returned by `getRandomnessAfter(_block)`. Fails under same conditions as `getRandomnessAfter(uint256)` may do. _range Range within which the uniformly-distributed random number w... | function random(uint32 _range, uint256 _nonce, uint256 _block)
external view
virtual override
returns (uint32)
{
return random(
_range,
_nonce,
keccak256(
abi.encode(
msg.sender,
getRandom... | 3,500,484 |
./full_match/1/0x44cD00771f57488A1988136cC38EB03554db1f77/sources/browser/Wasabi.sol | External function call This function adjust how many token will be produced by each block, eg: changeAmountPerBlock(100) will set the produce rate to 100/block. | function changeInterestsPerBlock(uint value) external override requireGovernor returns (bool) {
uint old = wasabiPerBlock;
require(value != old, 'AMOUNT_PER_BLOCK_NO_CHANGE');
wasabiPerBlock = value;
emit InterestsPerBlockChanged(old, value);
return true;
}
| 3,085,217 |
./full_match/80001/0x71cDC196C4b2484D9a8743Fc8be0af9D97858775/sources/project_/contracts/ERC4907.sol | Get the user expires of an NFT The zero value indicates that there is no user tokenId The NFT to get the user expires for return The user expires for this NFT | function userExpires(
uint256 tokenId
) public view virtual returns (address, uint256, uint256) {
return (
_users[tokenId].user,
_users[tokenId].startDate,
_users[tokenId].endDate
);
}
| 5,574,073 |
pragma solidity ^0.4.2;
// @title Interface for contracts conforming to ERC-721: Non-Fungible Tokens
// @author Dieter Shirley <dete@axiomzen.co> (https://github.com/dete)
contract ERC721 {
// Required methods
function approve(address _to, uint256 _tokenId) public;
function balanceOf(address _owner) pu... | For querying balance of a particular account _owner The address for balance query Required for ERC-721 compliance. | function balanceOf(address _owner) public view returns (uint256 balance) {
return ownershipTokenCount[_owner];
}
| 5,503,514 |
pragma solidity ^0.4.23;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
fun... | Withdraw the funds/ | function safeWithdrawFunds(uint256 amount) onlyOwner public returns (bool) {
require(beneficiary == msg.sender);
if (beneficiary.send(amount)) {
return true;
return false;
}
}
| 15,840,426 |
./full_match/5/0xFf3820bd8196C6Fdb5568d7CB1814ecC305787a5/sources/src/AmphorSyntheticVault.sol | The `previewWithdraw` function is used to calculate the shares amount received in exchange of the specified underlying amount. assets The underlying assets amount to be converted into shares. return Amount of shares received in exchange of the specified underlying assets amount./ | function previewWithdraw(uint256 assets) public view returns (uint256) {
return _convertToShares(assets, Math.Rounding.Up);
}
| 1,860,062 |
//Address: 0x398e41ac3d5972b4bac2320cd130c7a25ca446f7
//Contract name: Crowdsale
//Balance: 0 Ether
//Verification Date: 4/6/2018
//Transacion Count: 1670
// CODE STARTS HERE
pragma solidity ^0.4.21;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/iss... | Validation of an incoming purchase. Use require statements to revert state when conditions are not met. Use super to concatenate validations. _beneficiary Address performing the token purchase/ | function _preValidatePurchase(address _beneficiary) internal pure {
require(_beneficiary != address(0));
}
| 5,438,380 |
./full_match/42220/0x6e512BFC33be36F2666754E996ff103AD1680Cc9/sources/project_/contracts/WrappedToken.sol | Destroys `amount` tokens from `account`, reducing the total supply. Emits a {Transfer} event with `to` set to the zero address. Requirements - `account` cannot be the zero address. - `account` must have at least `amount` tokens./ | function burn(address account, uint256 amount) external onlyMintBurnAuthority {
require(account != address(0), "ERC20: burn from the zero address");
require(_balances[account] >= amount, "ERC20: burn amount exceeds balance");
_balances[account] = _balances[account] - amount;
_total... | 16,342,683 |
./full_match/1/0x03f2a869915984b9BEd52C53eE492668a326BC18/sources/src/diamonds/shared/libs/LibDiamond.sol | add facet for selector "_selectorCount & 7" is a gas efficient modulo by eight "_selectorCount % 8" clear selector position in slot and add selector if slot is full then write it to storage "_selectorSlot >> 3" is a gas efficient division by 8 "_selectorSlot / 8" only useful if immutable functions exist replace old fac... | function addReplaceRemoveFacetSelectors(
uint256 _selectorCount,
bytes32 _selectorSlot,
address _newFacetAddress,
IDiamondCut.FacetCutAction _action,
bytes4[] memory _selectors
) internal returns (uint256, bytes32) {
DiamondStorage storage ds = diamondStorage();
... | 8,366,598 |
pragma solidity ^0.4.4;
import "Marketplace.sol";
contract StandardMarketplace is Marketplace {
/* Fields */
address private owner;
Token public token;
/* Mappings */
mapping(address => Offer) public offers; //Tradeable => Offer
mapping(address => mapping(address => uint)) private balance; //T... | If the offer is not added then the state is initial / | function revokeOffer(Tradeable _item) isOwnerOf(_item) returns (bool success) {
var offer = offers[_item];
if(offers[_item].state == OfferStates.Initial) return false;
var amount = balance[_item][offer.buyer];
if(offer.state == OfferStates.Accepted && amount > 0) {
bala... | 12,965,202 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.2;
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "./FEEVMembershipNFT.sol";
import "hardhat/console.sol";
/// @dev Smart contr... | Getter for total amount of sold NFT from specific collection nftCollectionAddress Address of NFT collection contract return uint256 Amount of sold NFTs | function getSoldNFTs(address nftCollectionAddress) external view returns (uint256) {
return soldNFTs[nftCollectionAddress];
}
| 12,191,755 |
// 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... | See {IController-payOutRewards}/ Load state Validate state Update state | function payOutRewards(address recipient, uint256 amount) external override {
Farm storage farm = farms[_msgSender()];
require(farm.farmStartedAtBlock > 0, 'Caller not a farm');
require(recipient != address(0), 'Recipient 0 address');
require(!farm.paused, 'Farm paused');
require(
amount.ad... | 11,739,315 |
// SPDX-License-Identifier: No License
pragma solidity ^0.8.0;
import "./ERC20/IERC20.sol";
import "./ERC20/IERC20Permit.sol";
import "./ERC20/SafeERC20.sol";
import "./interfaces/IERC3156FlashBorrower.sol";
import "./interfaces/IERC3156FlashLender.sol";
import "./interfaces/IRERC20.sol";
import "./interfaces/IRToken... | Returns the address where a contract will be stored if deployed via {deploy} from a contract located at `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}./ | function computeAddress(bytes32 salt, bytes32 bytecodeHash, address deployer) internal pure returns (address) {
bytes32 _data = keccak256(
abi.encodePacked(bytes1(0xff), deployer, salt, bytecodeHash)
);
return address(uint160(uint256(_data)));
}
| 509,781 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Address.sol";
/**
* @title Splitter
* @dev This contract allows to split Ether payments among a group of accounts. The sender does not need to be aware
* that the Ether... | Update a payee to the contract (for only owner). payeeId The payee Id in array of the payee to update. newPayee The address of the payee to update. newShares_ The number of shares owned by the payee./ | function updatePayee(uint256 payeeId, address payable newPayee, uint256 newShares_) public onlyOwner {
require(newPayee != address(0), "PaymentSplitter: newPayee is the zero address");
require(payeeId < _payees.length, "PaymentSplitter: payeeId is more than payees length");
address payable ... | 12,711,354 |
/// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '@openzeppelin/contracts/utils/Address.sol';
import './libraries/Operable.sol';
// import "@nomiclabs/buidler/console.sol";
// SousSummoner is the summoner of new tokens. She can summon any soul... | View function to see pending Tokens on frontend. | function pendingReward(address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo;
UserInfo storage user = userInfo[_user];
uint256 accRewardPerShare = pool.accRewardPerShare;
uint256 stakedSupply = seance.balanceOf(address(this));
if (block.timestamp >... | 12,906,808 |
./partial_match/1/0x6efA260a268e4AfAcf7fb91A6BF5f5B37379BF61/sources/BasketManager.sol | Removes a specific Asset from the Basket, given that its target/collateral level is already 0, throws if invalid. _assetToRemove The asset to remove from the basket/ | function removeBasset(address _assetToRemove)
external
whenBasketIsHealthy
whenNotRecolling
managerOrGovernor
{
_removeBasset(_assetToRemove);
}
| 4,466,150 |
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/GSN/Context.sol
pragma solidity ^0.6.0;
/*
* 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 acces... | Returns all addresses accepted by this token vault | function underlyingDepositAssets() public view returns (address[] memory) {
address[] memory addresses = new address[](tokenList.length);
uint256 length = tokenList.length;
for(uint256 i = 0; i < length; i++){
addresses[i] = address(tokenList[i].token);
}
return a... | 481,487 |
pragma solidity >=0.4.24;
import "openzeppelin-solidity/contracts/utils/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/********************************************************************************************/
/* CONSTANTS ... | Transfers eligible payout funds to insuree/ | function pay(address passenger, address airline, bytes32 flightCode, uint256 amount) external
payable
{
Insurance[] storage ip = insurancePoliciesPassenger[passenger];
for (uint j = 0; j < ip.length; j++) {... | 12,972,324 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.8;
import "../node_modules/openzeppelin-solidity/contracts/utils/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/********************************************************************************************/
/* ... | Credits payouts to insurees/ | function creditInsurees(
string memory flightCode,
address airline,
uint256 timestamp
) internal requireIsOperational requireCallerAuthorized {
Flight storage flightData = flights[
keccak256(abi.encodePacked(airline, flightCode, timestamp))
];
for (ui... | 5,370,349 |
pragma solidity 0.5.15;
pragma experimental ABIEncoderV2;
// YAM rebaser V2 - Uses sushiswap for rebase sales, purchases ETH, uses two hop oracle pricing
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily ... | Calculates current TWAP from uniswap/ no period check as is done in isRebaseWindow BASE is on order of 1e18, which takes 2^60 bits multiplication will revert if priceAverage > 2^196 (which it can because it overflows intentially) eat loss of precision effectively: (x / 2112) 1e18 cant overflow effectively: (x 1e18 / ... | function getCurrentTWAP()
public
view
returns (uint256)
{
(uint priceCumulative, uint32 blockTimestamp) =
UniswapV2OracleLibrary.currentCumulativePrices(trade_pair, isToken0);
(uint priceCumulativeETH, ) =
UniswapV2OracleLibrary.currentCumulativePric... | 14,820,205 |
pragma solidity ^0.4.15;
import 'zeppelin-solidity/contracts/token/MintableToken.sol';
/// @title The token for the Home Ethereum's acommodation platform. The totalSupply
/// of tokens gets incremented when tokens are bought
/// @author Merunas Grincalaitis
contract HomeToken is MintableToken {
// Name of the tok... | Constructor to generate the HomeToken. The `totalSupply` of tokens gets incremented whenever someone buys tokens on the crowdsale _name The name of the token _symbol The symbol of the token _decimals The decimals of the token initialSupply The initial amount of tokens created that will go to the creator of the toke... | function HomeToken(string _name, string _symbol, uint8 _decimals, uint initialSupply) {
require(bytes(_name).length > 0);
require(bytes(_symbol).length > 0);
require(_decimals > 0);
require(initialSupply > 0);
name = _name;
symbol = _symbol;
decimals = _decimals;
tota... | 7,231,740 |
pragma solidity ^0.5.0;
library SafeMath {
function sub(uint a, uint b) internal pure returns (uint) {
require(b <= a);
return a - b;
}
function add(uint a, uint b) internal pure returns (uint) {
uint c = a + b;
require(c >= a);
return c;
}
/*function mul(uint a, uint b) inter... | 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 uint the amount of tokens to be transfered/ | function transferFrom(address _from, address _to, uint _value) public onlyPayloadSize(3 * 32) {
uint _allowance = allowed[_from][msg.sender];
commitDividend(_from);
commitDividend(_to);
allowed[_from][msg.sender] = _allowance.sub(_value);
users[_from].tokens = uint120(uint(users[_from].tokens).sub... | 906,956 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.sol";
/**
* @dev External interface of AccessControl declared to support ERC165 detection.
*/
interface IAccessControl {
function hasRole(bytes32 role, add... | Since tokens are not stored at contract address after any tx - it's safe to give unlimited approval | function _allowTokenIfNecessary(address token) internal {
if (IERC20(token).allowance(address(positionManager), address(this)) < type(uint256).max / 2) {
IERC20(token).approve(address(positionManager), type(uint256).max);
}
}
| 6,996,309 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.18;
pragma experimental ABIEncoderV2;
/// @title Data zipping functions
/// @author Giovanni Rescinito
/// @notice implements the zipping operations used to compress lists of values in a single data location
library Zipper {
/// @notice checks that the wid... | zips an array of values using two different widths in an alternate manner, including the size at the end array the values to zip width the number of bits used for each value return the zipped version of the array | function zipArrayWithSize(uint[] memory array, uint width) pure public checkWidth(width) returns (uint){
uint size = array.length;
require(size<=(256/width - 1), "Too many values");
uint zipped = zip(array,width);
zipped = zipped << width;
zipped += size;
return zippe... | 14,058,667 |
pragma solidity ^0.4.18;
contract owned {
/* Owner definition. */
address public owner; // Owner address.
function owned() internal {
owner = msg.sender ;
}
modifier onlyOwner {
require(msg.sender == owner); _;
}
function transferOwnership(address newOwner) onlyOwner pub... | Buy tokens from contract by sending Ether. | function buy() public payable {
}
| 12,123,734 |
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity 0.7.6;
import {ERC721} from "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {IFactory} from "../factory/IFactory.sol";
import {IInstanceRegistry} from "../factory/InstanceRegistry.sol... | Add funds to the Hypervisor access control: only admin state machine: - can be called multiple times - only online state scope: - increase _hypervisor.rewardSharesOutstanding - append to _hypervisor.rewardSchedules token transfer: transfer staking tokens from msg.sender to reward pool amount uint256 Amount of ... | function fund(uint256 amount, uint256 duration) external onlyOwner onlyOnline {
require(duration != 0, "Hypervisor: invalid duration");
uint256 newRewardShares;
if (_hypervisor.rewardSharesOutstanding > 0) {
uint256 remainingRewards = IERC20(_hypervisor.rewardToken).balanceOf(_h... | 184,081 |
./full_match/80001/0xe7Ebc638409b8f4f0DAde04c16e843a94bBc667e/sources/src/Access.sol | Revokes role from an account. Caller must have admin role for the `role`. Emits {RoleRevoked Event}. role keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE") account Address of the account from which the role is being revoked./ | function revokeRole(bytes32 role, address account)
public
virtual
override
onlyRole(DEFAULT_ADMIN_ROLE)
{
if (role == ADMIN_ROLE()) {
removeAddr(admins, account);
}
_revokeRole(role, account);
}
| 5,606,042 |
./full_match/1/0xAAf570aAB5B578D84441E9269d2953B5b2759b4a/sources/contracts/VitalFusion.sol | Airdrop functionality for the contract owner. Owner airdrop with no checks other than those included in _internalMint() | function ownerAirdrop(address[] memory wallets, uint[] calldata tokens) external onlyOwner nonReentrant {
require(wallets.length == tokens.length, "Airdrop wallets must have assocaited token assignment.");
uint256 w;
for (w = 0; w < wallets.length; w++) {
_internalMint(wallets[w]... | 4,977,792 |
./full_match/137/0x74E7ACAfC758caC65910e5C38E6Ef9ade5fA87A8/sources/contracts/SpotTradingRewardDistributor/SpotTradingRewardDistributor.sol | @inheritdoc ISpotTradingRewardDistributor/ | function setRewardPerPeriod(uint256 _rewardPerPeriod) external override onlyRole(MEDIUM_TIMELOCK_ADMIN) {
rewardPerPeriod = _rewardPerPeriod;
emit RewardPerPeriodChanged(_rewardPerPeriod);
}
| 4,721,650 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "./ERC721A.sol";
import ".... | Transfers `tokenId` from `from` to `to`. Requirements: - `to` cannot be the zero address. - `tokenId` token must be owned by `from`. Emits a {Transfer} event./ Clear approvals from the previous owner If the ownership slot of tokenId+1 is not explicitly set, that means the transfer initiator owns it. Set the slot of tok... | function _transfer(
address from,
address to,
uint256 tokenId
) private {
TokenOwnership memory prevOwnership = ownershipOf(tokenId);
bool isApprovedOrOwner = (_msgSender() == prevOwnership.addr ||
getApproved(tokenId) == _msgSender() ||
isApprovedForAll(prevOwnership.addr, _msgSend... | 4,005 |
/*
Capital Technologies & Research - Capital (CALL)
*/
pragma solidity ^0.4.19;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a *... | Constructor function to initialize the initial supply of token to the creator of the contract initialSupply The initial supply of tokens which will be fixed through out tokenName The name of the token tokenSymbol The symboll of the token/Emitting transfer event since assigning all tokens to the creator also correspo... | function CALLToken(uint256 initialSupply, string tokenName, string tokenSymbol) public {
totalSupply = initialSupply.mul( 10 ** uint256(decimals));
name = tokenName;
symbol = tokenSymbol;
balances[msg.sender] = totalSupply;
emit Transfer(address(0), msg.sender... | 60,181 |
pragma solidity ^0.8.3;
import "./IPassify.sol";
// Needs to implement all functions of IPassify
contract Passify is IPassify {
constructor() IPassify() {}
uint _price = 0.29 ether; // $100, Sep 18, 2021
uint _stake = 0.0029 ether; // $1, Sep 18, 2021
struct Record {
uint8 min;
addr... | User calls this function when they wish to unlock their password (after verifying their identity). Emits a {Pay} event/ | function pay(uint256 recordId) external payable override {
uint numCustodians = _records[recordId].custodians.length;
require(msg.value > (_price * numCustodians));
emit Pay(msg.sender, recordId);
}
| 1,801,581 |
./full_match/42/0x22056E4687Ed374921317bc9372b7b03daEC346d/sources/craft.sol | Need to cheeck possiblity to vaildate the tokenId; | function setCreatorFeeRate(uint256 tokenId, uint256 feeRate) external onlyOwner {
require( feeRate > 0, "CreatorFeeRateFeeRate should be grether than zero");
require(tokens[tokenId].creator != address(0), "Token with provided tokenId not available");
tokens[tokenId].creatorFeeRate = feeRate... | 16,220,716 |
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.8.0;
// Sources flattened with hardhat v2.8.4 https://hardhat.org
// File @openzeppelin/contracts/token/ERC20/IERC20.sol@v4.5.0
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol)
/**
* @dev Interface of the ERC20 standard as de... | Appends a byte to the buffer. Resizes if doing so would exceed the capacity of the buffer. buf The buffer to append to. data The data to append. return The original buffer, for chaining./ | function appendUint8(buffer memory buf, uint8 data) internal pure returns (buffer memory) {
return writeUint8(buf, buf.buf.length, data);
}
| 1,301,047 |
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
interface IERC20 {
... | inject NONSTANDARD NAMING | function TRANSFER42(address recipient, uint256 amount) external returns (bool); | 6,449,025 |
pragma solidity 0.4.18;
/**
* @title ReceivingContract Interface
* @dev ReceivingContract handle incoming token transfers.
*/
contract ReceivingContract {
/**
* @dev Handle incoming token transfers.
* @param _from The token sender address.
* @param _value The amount of tokens.
*/
functi... | Change the upgrade master. _newMaster New upgrade master./ | function changeUpgradeMaster(address _newMaster)
public
onlyOwner
{
require(_newMaster != 0);
upgradeMaster = _newMaster;
ChangeUpgradeMaster(_newMaster);
}
| 10,708,875 |
./partial_match/1/0xaCCaaDc4F8448F5f6C6aAf1c639Ec4B8bD1A8aF4/sources/contracts/extensions/NFT/components/BaseNFT.sol | Set NFT metadata base URI. URI must include the trailing slash./ | function setBaseURI(string memory _baseUri, bool _reveal) external onlyRole(REVEALER_ROLE) {
if (isRevealed && !_reveal) {
revert ALREADY_REVEALED();
}
baseUri = _baseUri;
isRevealed = _reveal;
}
| 2,702,206 |
./full_match/44787/0xFcc63A90ca15Cab1da57daaC7F41eA2252e626E8/sources/contracts/StarNFT.sol | See {IERC721-allWithdrawal}./ | function allWithdrawal(address owner) public {
uint256 _amount = 0;
for (uint256 i = 0 ; i < _balances[owner]; i ++) {
uint256 _tokenId = _ownedTokens[owner][i];
ibonus.setBonusWithdrawn(_amount);
ibonus.setTokenWithdraw(_tokenId,_amount);
_amount ... | 13,283,297 |
// File: EpigeonInterfaces.sol
pragma solidity ^0.4.11;
//----------------------------------------------------------------------------------------------------
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
fu... | ---------------------------------------------------------------------------------------------------- | 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)... | 231,187 |
pragma solidity ^0.5.16;
import "./KUSDMinter.sol";
/**
* @title KUSDMinter is responsible to stake/unstake users' Kine MCD (see KMCD) and mint/burn KUSD (see KineUSD) on behalf of users.
* When user want to mint KUSD against their collaterals (see KToken), KUSDMinter will borrow Knie MCD on behalf of user (which w... | Calculate account's earned rewards so far. account Which account to be viewed. return Account's earned rewards so far./ | function earned(address account) public view returns (uint) {
AccountRewardDetail memory detail = accountRewardDetails[account];
uint scaledRewardPerTokenUpdated = detail.rewardPerTokenUpdated;
uint scaledAccruedReward = detail.accruedReward;
for (uint i = detail.scaleParamIndex; i <... | 300,519 |
./full_match/44787/0x66bF67f33c577EeE06AB365Fb63cCf3bA36c20E5/sources/contracts/marketMain/MarketMain.sol | See {INFTKEYMarketPlaceV1-getTokenBids}./ | function getTokenBids(uint256 tokenId) external view returns (Interface.Bid[] memory) {
return _selectedMarketPlaceToken.getTokenBids(tokenId);
}
| 13,246,710 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/access/Ownable.... | mint NFT by batch _number number of NFT to mint | function mintBatch(uint _number) public onlyAuthor
{
require(set,"Metadata not set");
uint current = _tokenIdCounter.current();
uint last = current + _number;
require(last <= max, "Maximum NFT already create");
for (uint i = current; i < last; i++) {
_mintNFT();
}
}
| 12,860,265 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.9;
import { Initializable } from '@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol';
import { IUniswapV3Pool } from '@uniswap/v3-core-0.8-support/contracts/interfaces/IUniswapV3Pool.sol';
import { IUniswapV3MintCallback } from '@uniswap/v3-co... | uses actual price to calculate funding rate uses funding rate override | function getFundingRateAndVirtualPrice() public view returns (int256 fundingRateX128, uint256 virtualPriceX128) {
int256 _fundingRateOverrideX128 = fundingRateOverrideX128;
bool shouldUseActualPrices = _fundingRateOverrideX128 == FUNDING_RATE_OVERRIDE_NULL_VALUE;
uint32 poolId = vToken.trun... | 13,044,067 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;
pragma abicoder v2;
import '@openzeppelin/contracts/math/SafeMath.sol';
import '@openzeppelin/contracts/utils/Address.sol';
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '@openzeppelin/contracts/utils/Counters.sol';
import '../nft/ApexaNFT.sol';
... | Purchase nftContract/ | function purchase() external payable onlyDuringSale onlyWhitelisted {
require(msg.value == price, 'Insufficient or excess funds');
_purchase();
}
| 14,860,117 |
./partial_match/1/0xA17b1712dBA02a7Ba477b5b161Cc526BEd404b66/sources/Axe.sol | Maximum tx size and wallet size exclude from paying fees or having max transaction amount | constructor() ERC20("Axe", "AXE") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswa... | 4,121,224 |
pragma solidity ^0.4.24;
contract Token {
/* This is a slight change to the ERC20 base standard.
function totalSupply() constant returns (uint256 supply);
is replaced with:
uint256 public totalSupply;
This automatically creates a getter function for the totalSupply.
This is moved to the base co... | same as above. Replace this line with the following if you want to protect against wrapping uints.require(balances[_from] >= _value && allowed[_from][msg.sender] >= _value && balances[_to] + _value > balances[_to]); | function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
uint256 allowance = allowed[_from][msg.sender];
require(balances[_from] >= _value && allowance >= _value);
require(transferEnabled);
balances[_to] += _value;
balances[_from] -= _... | 2,209,371 |
pragma solidity ^0.5.0;
contract Administrable {
address private owner;
address[] private admins;
mapping(address => bool) public isAdmin;
/**
* Constructor of the contract
* @param _admins addresses of accounts allowed to administrate the contract
*/
constructor(address[] memory _a... | Updates product price _sku the SKU of the product to update price the new price of the product/ | function updateProductPrice(uint _sku, uint price)
external
onlyActiveOwner
{
require(
storefronts[products[_sku].storefrontId].storeOwner == msg.sender
);
products[_sku].price = price;
}
| 1,080,129 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface AggregatorV3Interface {
function decimals()
external
view
returns (
uint8
);
function description()
external
view
returns (
string memory
);
function version()
external
view
returns (
... | Returns the crypto numbers in the ICO return xifra Returns the Xifra tokens balance in the contract return eth Returns the ETHs balance in the contract return usdt Returns the USDTs balance in the contract return usdc Returns the USDCs balance in the contract/ | function getICOData() external view returns(uint256 xifra, uint256 eth, uint256 usdt, uint256 usdc) {
xifra = IERC20(xifraToken).balanceOf(address(this));
usdt = IERC20(usdtToken).balanceOf(address(this));
usdc = IERC20(usdcToken).balanceOf(address(this));
eth = address(this).balance... | 10,214,168 |
./partial_match/56/0x30E104A187Aa257f92ED497EE73F3b832f6781D1/sources/MainToken.sol | Mint the specified amount of token to the specified address and freeze it until the specified date. Be careful, gas usage is not deterministic, and depends on how many freezes _to address already has. _to Address to which token will be freeze. _amount Amount of token to mint and freeze. _until Release date, must be ... | function mintAndFreeze(address _to, uint _amount, uint64 _until) public onlyOwner canMint returns (bool) {
totalSupply_ = totalSupply_.add(_amount);
bytes32 currentKey = toKey(_to, _until);
freezings[currentKey] = freezings[currentKey].add(_amount);
freezingBalance[_to] = freezingBalance[_to].add(_amount);
freeze(... | 11,163,072 |
/**
*Submitted for verification at Etherscan.io on 2021-09-27
*/
// File: contracts/ISpacePunksTreasureKeys.sol
pragma solidity 0.8.7;
interface ISpacePunksTreasureKeys {
function burnKeyForAddress(uint256 typeId, address burnTokenAddress) external;
function balanceOf(address account, uint256 id) external view... | public method for teammembers for minting multiple tokens if teamsale is enabled and existing tokens amount are less than 100 | function mintTeamMultipleTokens(uint256 _amount) public payable nonReentrant {
require(totalSupply().add(_amount) <= TOKEN_LIMIT - TREASURE_KEYS_LIMIT, "Purchase would exceed max supply of Llamas");
require(teamSale, "Team sale must be active to mint as a team member");
require(totalSupply() < 100, "Excee... | 8,060,843 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.11;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns... | See {ICXN-totalSupply}./ | function totalSupply() public view returns (uint256) {
return _board.totalSupply;
}
| 427,359 |
./full_match/44787/0xFc53Da396CAeEdA7520B5bf7b2D1C993c69014E2/sources/contracts/StarFarm.sol | Withdraw Star NFT from STAKING.PoolInfo storage pool = poolInfo[0]; | function leaveStakingNFT(uint256 _tokenId) public {
UserInfo storage user = userInfo[0][_msgSender()];
require(userNFTs[_msgSender()].length > 0, "no NFT");
updatePool(0);
(uint256 _selfGain, uint256 _parentGain) = starNode.nodeGain();
uint256 _amountGain = user.amount.add(u... | 13,253,425 |
./full_match/5/0x1f0c421312EA02e964Cec73fdC49a350626758D3/sources/contracts/factory/Clones.sol | Deploys and returns the address of a clone that mimics the behaviour of `implementation` This function uses the create2 opcode and a `salt` to deterministically deploy the clone. Using the same `implementation` and `salt` multiple time will revert, since the clones cannot be deployed twice at the same address. init: 0x... | function clone(address implementation) internal returns (address instance) {
assembly {
let ptr := mload(0x40)
mstore(
ptr,
0x3d605d80600a3d3981f336603057343d52307f00000000000000000000000000
)
mstore(
add(ptr, 0x... | 1,949,376 |
./partial_match/1/0xB22efC4432b260225b9f3778dda8C46FFa0E0EA5/sources/src/v1/FiatTokenV1.sol | Get totalSupply of token/ | function totalSupply() external view override returns (uint256) {
return totalSupply_;
}
| 4,007,471 |
//██████╗ █████╗ ██╗ █████╗ ██████╗ ██╗███╗ ██╗
//██╔══██╗██╔══██╗██║ ██╔══██╗██╔══██╗██║████╗ ██║
//██████╔╝███████║██║ ███████║██║ ██║██║██╔██╗ ██║
//██╔═══╝ ██╔══██║██║ ██╔══██║██║ ██║██║██║╚██╗██║
//██║ ██║ ██║███████╗██║ ██║██████╔╝██║██║ ╚████║
//╚═╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝╚═════... | Kill a non-healthy Loan to collect rewards Kill a non-healthy Loan to collect rewards _loan Address of the Loan/Fetch the corresponding BorrowAnd check that the killer is not the Borrower, and the Loan is still activeGet the owner of the Loan through the ERC721 contractCalculate the amount of fee used, and check if t... | function killBorrow(address _loan) public virtual override nonReentrant {
address killer = msg.sender;
Borrow storage _borrow = loanToBorrow[_loan];
require(!_borrow.closed, Errors.LOAN_CLOSED);
require(!isLoanOwner(_loan, killer), Errors.LOAN_OWNER);
require(_updateInterest(... | 548,469 |
./partial_match/3/0xC3B40aca9Ba564948Dfdb90F13D7409766136D1A/sources/MoneyMarket.sol | withdraw `amount` of `asset` from sender's account to sender's address withdraw `amount` of `asset` from msg.sender's account to msg.sender asset The market asset to withdraw requestedAmount The amount to withdraw (or -1 for max) return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/ | function withdraw(address asset, uint requestedAmount) public isKYCVerifiedCustomer returns (uint) {
if (paused) {
return fail(Error.CONTRACT_PAUSED, FailureInfo.WITHDRAW_CONTRACT_PAUSED);
}
Market storage market = markets[asset];
Balance storage supplyBalance = supplyBa... | 5,302,487 |
./partial_match/1/0xcc58b94a56d1788CFfC4Fb7381dF07Fda61Cd90c/sources/OKAMI.sol | exclude from paying fees or having max transaction amount | constructor() ERC20(unicode"Ōkami", unicode"OKAMI") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2... | 4,272,633 |
// Verified using https://dapp.tools
// hevm: flattened sources of /nix/store/jhkj8my1hkpiklhhkl8xyzpxwpzix5fj-geb-uniswap-median/dapp/geb-uniswap-median/src/UniswapV3Medianizer.sol
pragma solidity =0.6.7 >=0.4.0 >=0.5.0 >=0.5.0 <0.8.0;
////// /nix/store/jhkj8my1hkpiklhhkl8xyzpxwpzix5fj-geb-uniswap-median/dapp/geb-un... | Calculates ceil(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 a The multiplicand b The multiplier denominator The divisor return result The 256-bit result | function mulDivRoundingUp(
uint256 a,
uint256 b,
uint256 denominator
) internal pure returns (uint256 result) {
result = mulDiv(a, b, denominator);
if (mulmod(a, b, denominator) > 0) {
require(result < (0 - uint256(1)));
result++;
}
}
| 544,672 |
pragma solidity ^0.4.13;
contract IERC20 {
function balanceOf(
address whom
)
external
view
returns (uint);
function transfer(
address _to,
uint256 _value
)
external
returns (bool);
function transferFrom(
address _from,
address _to,
... | Function to get how much is distributed in cycle cycleId is the ID of that cycle/ | function getTotalDistributedInCycle(
uint cycleId
)
public
view
returns (uint)
{
return getUint(keccak256(_distributionCycleToTotalDistributed, cycleId));
}
| 13,574,471 |
pragma solidity ^0.4.11;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 ... | Creates a new MPKToken instance/ | function MPKToken()public {
totalSupply = 5 * (10 ** 7) * (10 ** 18);
balances[0xc47fe4093c90b4480f8c84928d262207Fc0aDeEB] = totalSupply;
emit Transfer(0, 0xe3Fd212163D4252D4d82cfda607010016ec7F31C, totalSupply );
}
| 1,718,957 |
pragma solidity 0.5.16;
pragma experimental ABIEncoderV2;
contract TransferTrade {
struct TicketInfo {
string concertName;
string day; // 나중에 타입 다시 생각하기
string time; // 나중에 타입 다시 생각하기
Seat seat;
uint32 ticketPrice;
bool isTransferred;
address ... | 양도거래가 끝난 티켓의 정보를 수정한다./ owner change 현재 가나슈를 실행중이 아니라서 ticket info의 owner 정보가 없어서 주석처리함 | function changeTicketInfo() public returns (address) {
defaultTicket.owner = transferee;
return defaultTicket.owner;
}
| 5,368,018 |
./full_match/1/0x2760712092BA61e67043fE04FF3c4f54cd045ca0/sources/contracts/vaults/Drops4626.sol | See {IERC4626-maxWithdraw} | function maxWithdraw(address owner) external view returns (uint256) {
return
_convertToAssets(balanceOf(owner), MathUpgradeable.Rounding.Down);
}
| 2,955,550 |
./full_match/5/0x5c946740441C12510a167B447B7dE565C20b9E3C/sources/contracts/token/GraphToken.sol | Approve token allowance by validating a message signed by the holder. _owner Address of the token holder _spender Address of the approved spender _value Amount of tokens to approve the spender _deadline Expiration time of the signed permit _v Signature version _r Signature r value _s Signature s value/ | function permit(
address _owner,
address _spender,
uint256 _value,
uint256 _deadline,
uint8 _v,
bytes32 _r,
bytes32 _s
) external {
bytes32 digest = keccak256(
abi.encodePacked(
"\x19\x01",
DOMAIN_SEPARAT... | 7,036,677 |
// SPDX-License-Identifier: MIT
pragma solidity =0.8.4;
import {Ownable} from "openzeppelin/contracts/access/Ownable.sol";
import {ConfigContract} from "./ConfigContract.sol";
import {BatcherContract, BatchConfig, TransactionType} from "./BatcherContract.sol";
import {DepositContract} from "./DepositContract.sol";
s... | Execute the cipher portion of a batch. batchIndex The index of the batch cipherBatchHash The hash of the batch (consisting of encrypted transactions) transactions The sequence of (decrypted) transactions to execute. keyperIndex The index of the keyper calling the function. Execution is only performed if `cipherBat... | function executeCipherBatch(
uint64 batchIndex,
bytes32 cipherBatchHash,
bytes[] calldata transactions,
uint64 keyperIndex
) public {
require(
numExecutionHalfSteps / 2 == batchIndex,
"ExecutorContract: unexpected batch index"
);
re... | 12,849,434 |
/**
*Submitted for verification at Etherscan.io on 2021-03-11
*/
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.8.0;
contract ERC20Interface {
/// @return supply total amount of tokens
function totalSupply() public virtual view returns (uint256 supply) {}
/// @param tokenOwner The a... | send `_value` token to `_to` from `_from` on the condition it is approved by `_from` _from The address of the sender _to The address of the recipient _value The amount of token to be transferred return success Whether the transfer was successful or not | function transferFrom(address _from, address _to, uint256 _value) public virtual returns (bool success) {}
| 8,028,514 |
./full_match/11155111/0x7AC9EADa77282c5228f53D4f4338e5f214B30aCf/sources/contracts/CrowdFunding.sol | Campaign storage campaign = campaigns[numberOfCampaigns]; | function isFundSuccess() public view returns(bool) {
if(address(this).balance >= campaign1.target || campaign1.fundsWithdrawn) {
return true;
return false;
}
}
| 3,801,870 |
./full_match/80001/0xe2A518399f115EB2bd590C8f24F10f5Bd38d1cE7/sources/project_/contracts/token/Token.sol | See {ERC20-_burn}./ | function _burn(address _userAddress, uint256 _amount) internal virtual {
require(_userAddress != address(0), 'ERC20: burn from the zero address');
_beforeTokenTransfer(_userAddress, address(0), _amount);
_balances[_userAddress] = _balances[_userAddress] - _amount;
_totalSupply = _t... | 5,693,497 |
// EverOwn Wrapper contract exmaple
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.8;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return payable(msg.sender);
}
function _msgData() internal view virtual returns (bytes memory) {
t... | Function to release tokens trapped in wrapper, can be released when ownership returned | function releaseTrappedTokens(address tokenAddress, address toAddress) external onlyOwner {
require(tokenAddress != address(0), "tokenAddress can not be a zero address");
require(toAddress != address(0), "toAddress can not be a zero address");
require(IERC20(tokenAddress).balanceOf(address(t... | 6,414,693 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.