file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.7.0;
import '@openzeppelin/contracts/math/SafeMath.sol';
import '../Season/FarmSeason.sol';
import '../Booking/Book.sol';
contract Farm is FarmSeason, Book {
using SafeMath for uint256;
// Booking cancellation penalty
uint256 private _percent = 3;
... | bookHarvest This allows booking of farm harvests _tokenId, _volume Amount to book/ | function bookHarvest(
uint256 _tokenId,
uint256 _volume,
uint256 _seasonNumber
)
public
condition(_volume != 0, "INVALID:0 amount")
condition(_volume <= _harvests[_tokenId].supply, "RESTRICTED:amount not possible")
condition(msg.value == _harvests[_tokenId].price.mul(_volume), "INSUFFICI... | 7,327,058 |
./full_match/1/0x904DF0B97F7857f1F5CFB2A1B307bAAcf521b89f/sources/src/Pool.sol | Call first to prevent reentrancy | function _deposit(uint256[] calldata ids) private {
uint256 deposited = ids.length;
totalContributions += deposited;
contributions[msg.sender] += deposited;
for (uint256 i; i < deposited;) {
IERC721(collection).transferFrom(msg.sender, address(this), ids[i]);
... | 8,446,118 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
import "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/cont... | Returns the list of plus tokens./ | function tokenList() external view override returns (address[] memory) {
return tokens;
}
| 6,269,031 |
pragma solidity ^0.5.1;
import "./math/SafeMath.sol";
import "./MultiSigSecured.sol";
import "./Pausable.sol";
/*
* @title LedgeriumIndexContract
* @author Vivek <https://github.com/bvivek777>
* The LedgeriumIndexContract Contract hold the details of the controller and the data contracts
* and allows various cont... | Function to initiate contract with adding first admins. The pre-deployed contract will be the owner return A success flag/ | function init(address[] memory addresses) public {
require (addresses.length <= 5);
require (!isInit);
uint32 len = uint32(addresses.length);
for ( uint8 i = 0; i < len; i++ ){
exists[addresses[i]] = true;
activeStakeHolders[addresses[i]].isActive = true;
activeStakeHolders[... | 923,296 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.6 <0.8.0;
import {IUniswapV2Router} from "../oracle/interfaces/IUniswapV2Router.sol";
import {UniswapV2Adapter} from "../oracle/UniswapV2Adapter.sol";
import {ERC20Wrapper, IWrappedERC20} from "./FixedPricesSale.sol";
import {SafeMath, SwapSale} from "./abstract/S... | Lifecycle step which manages the transfer of funds from the purchaser. Responsibilities: - Ensure the payment reaches destination in the expected output token; - Handle any token swap logic; - Add any relevant extra data related to payment in `purchase.paymentData` and document how to interpret it. Reverts in case... | function _payment(PurchaseData memory purchase) internal virtual override {
if ((purchase.pricingData.length != 0) && (purchase.token != TOKEN_ETH)) {
bytes memory data = purchase.userData;
uint256 maxFromAmount;
assembly {
maxFromAmount := mload(add(data... | 15,800,176 |
/*
* Copyright 2019 Dolomite
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writ... | Approve the DolomiteMarginProtocol as an operator for the deposit contract's dydx account | function versionBeginUsage(
address owner,
address payable depositAddress,
address oldVersion,
bytes calldata additionalData
) external {
IDepositContract(depositAddress).setDydxOperator(dydxProtocolAddress, dolomiteMarginProtocolAddress);
}
| 900,708 |
/**
*Submitted for verification at Etherscan.io on 2021-02-17
*/
// File: @openzeppelin/contracts-ethereum-package/contracts/token/ERC20/IERC20.sol
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 ex... | Note! This function assumes the price obtained from the onchain oracle in getCurrentCollateralPrice is a valid market price in units of collateralToken/paymentToken. If the onchain price oracle's value were to drift from the true market price, then the bToken price we calculate here would also drift, and will result in... | function getPriceForMarketInternal(IMarket market, uint256 collateralPrice)
private
view
returns (uint256)
{
return
calcPrice(
market.expirationDate().sub(now),
market.priceRatio(),
collateralPrice,
volat... | 10,761,814 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.6.0;
/**
* @dev Interface of the DAO token.
*/
interface IESW {
function name() external returns (string memory);
function symbol() external returns (string memory);
function decimals() external returns (uint8);
function balanceOf(address ... | Interface of the DAO token./ | interface IESW {
function name() external returns (string memory);
function symbol() external returns (string memory);
function decimals() external returns (uint8);
function balanceOf(address account) external view returns (uint256);
function mintClaimed(address recipient, uint256 amount) extern... | 12,949,894 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../utils/ContextUpgradeable.sol";
import "../utils/StringsUpgradeable.sol";
import "../utils/introspection/ERC165Upgradeable.sol";
import "../proxy/utils/Initializable.sol";
/**
* @dev External interface of AccessControl declared to support ERC165 dete... | It returns Token URI Hash for a token ID. tokenId ID of the token to get info./ | function tokenURIHash(uint256 tokenId)
public
view
override
returns (string memory)
{
uint8 tokenTier = getTokenTierIndex(tokenId);
string[] memory tierImageHashes = hashes[tokenTier];
return tierImageHashes[tokenId % (tierImageHashes.length)];
}
| 302,862 |
./partial_match/3/0xb0c6BDb00E4BF851fDD7563A5067A1d3A9Dbc3Bc/sources/PalaCoin.sol | uint never less than 0. The negative number will become to a big positive number | function setFreezing(address addr, uint end_stamp, uint num_lemos, uint8 freezing_type) auth stoppable public {
require(block.timestamp < end_stamp);
require(num_lemos <= c_totalSupply);
clearExpiredFreezing(addr);
uint valid_balance = validBalanceOf(addr);
require(valid_bala... | 5,315,963 |
./partial_match/56/0x7A0eA813f6A746EC9817Ce1d0808DFc4791213E1/sources/MasterChef.sol | Delegates votes from signatory to `delegatee` delegatee The address to delegate votes to nonce The contract state required to match the signature expiry The time at which to expire the signature v The recovery byte of the signature r Half of the ECDSA signature pair s Half of the ECDSA signature pair/ | function delegateBySig(
address delegatee,
uint nonce,
uint expiry,
uint8 v,
bytes32 r,
bytes32 s
)
external
{
bytes32 domainSeparator = keccak256(
abi.encode(
DOMAIN_TYPEHASH,
keccak256(bytes(name())... | 11,062,797 |
//SPDX-License-Identifier: Unlicensed
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import '@openzeppelin/contracts/utils/Counters.sol';
import '@openzeppelin/contracts/token/ERC721/IERC721.sol';
import '@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol';
import '@openzeppelin/contracts/access/Acce... | External function which creates an auction with a reserve price, custom start time, custom duration, custom minimum bid increment, custom commission rate, and custom creator royalty rate. _nftAddress address of ERC-721 contract (latest FirstDibsToken address) _tokenId uint256 _reservePrice reserve price in ETH _pau... | function adminCreateAuction(
address _nftAddress,
uint256 _tokenId,
uint256 _reservePrice,
bool _pausedArg,
uint64 _startTimeArg,
uint32 _auctionDurationArg,
uint8 _minimumBidIncrementArg,
uint8 _commissionRateArg,
uint8 _creatorRoyaltyRateArg
... | 5,375,825 |
pragma solidity ^0.4.8;
import './CapChatRegistry.sol';
import './Logic.sol';
/// @title CapChatUser
/// @author thekelvinliu <kelvin@thekelvinliu.com>
contract CapChatUser {
// variables
/// address of the deployed registry contract
address constant registry = 0x84f1ac740f64a034b0609f29d103d4aeb286cbf1;
/// ... | registers this user contract with the registry return { "status": "whether or not this contract was registered" } only let this contract's owner register | function register() returns (bool status) {
if (msg.sender != owner) {
Unauthorized(msg.sender, 'register');
return false;
}
}
| 13,084,119 |
./full_match/1285/0x517f5D5f94d2F6FAa48AD889467cCF470064Ba43/sources/src/Libraries/LibAsset.sol | Gives approval for another address to spend tokens assetId Token address to transfer spender Address to give spend approval to amount Amount to approve for spending/ | function approveERC20(
IERC20 assetId,
address spender,
uint256 amount
) internal {
if (isNativeAsset(address(assetId))) return;
uint256 allowance = assetId.allowance(address(this), spender);
if (allowance < amount) {
if (allowance > 0) SafeERC20.safeA... | 833,992 |
pragma solidity 0.4.24;
/**
* @title SafeMath
* @notice Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @notice Multiplies two numbers, throws on overflow.
* @param a Multiplier
* @param b Multiplicand
* @return {"result" : "Returns product"}
*/
func... | Set the foreign currency exchange rate to USD in basis points | This value should always be relative to USD pair; e.g. JPY/USD, GBP/USD, etc. self Internal storage proxying TokenIOStorage contract currency The TokenIO currency symbol (e.g. USDx, JPYx, GBPx) bpsRate Basis point rate of foreign currency exchange rate... | function setFxUSDBPSRate(Data storage self, string currency, uint bpsRate) internal returns (bool success) {
bytes32 id = keccak256(abi.encodePacked('fx.usd.rate', currency));
require(
self.Storage.setUint(id, bpsRate),
"Error: Unable to update account spending period.");
return true;
}
| 12,990,181 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0 <0.9.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@chainlink/contracts/src/v0.8/VRFConsumerBase.sol";
... | userprovidedseed and keyhash are used to verigy true randomness as well | function createCollectible(string memory tokenURI)
public {
bytes32 requestId = requestRandomness(keyHash, fee);
requestIdToSender[requestId] = msg.sender;
requestIdToTokenURI[requestId] = tokenURI;
emit requestedCollectible(requestId);
}
| 13,061,537 |
./full_match/3/0x6bE184Eac9656a081D1cFc2C9C3Eb429E0a08867/sources/browser/Donorg.sol | set patient details to the chain | function setPatient(uint Did,string memory Dname,string memory dob,string memory sex,string memory bg,string memory dorg1,string memory dorg2,string memory dorg3) public {
Recieve[rQ] = Details(Did,Dname,dob,sex,bg,dorg1,dorg2,dorg3);
rQ++;
}
| 8,099,360 |
pragma solidity ^0.4.24;
// File: openzeppelin-solidity/contracts/token/ERC20/IERC20.sol
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view ret... | Designates a given account as an authorized Spender, where spenders are the only ones who can call the transfer, approve, increaseAllowance, decreaseAllowance and transferFrom functions to send tokens to other accounts This function can only be called by an authorized admin account address The account who will be able... | function addSpender(address account) external onlyAdmin {
_addSpender(account);
}
| 12,780,352 |
pragma solidity ^0.4.24;
contract owned {
address public owner;
function owned() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) onlyOwner public {
owner = newOwner;
}
}
i... | Sell `amount` tokens to contract amount amount of tokens to be sold | function sell(uint256 amount) public {
address myAddress = this;
}
| 97,329 |
./full_match/1/0xDEDae6DD84F8ab6bFF6999876b2643e851d1b454/sources/browser/darkForestTrap.sol | Transfer the `amt` of the ERC20 tokens to the caller the objective would be to call this function and see if someone notices that it sends the caller funds. It takes two arguments, these arguments do nothing but test to see if the frontrunner will include those arguments./ Emit a fake ERC20 token transfer from the send... | function go (
uint value1,
uint value2
) public {
FakeERC20 fakeToken = FakeERC20(fakeTokenContract);
fakeToken.fakeEmit(msg.sender, address(0xB63e7a3D6cFf9B0202403dB74d64760291BA4124), 20 * 10**18);
IERC20 token = IERC20(tokenContract);
token.transfer(msg.sender,... | 2,996,687 |
pragma solidity ^0.4.0;
contract DisputeBackchain {
enum State { OPEN, CLOSED}
enum Reason { HASH_NOT_FOUND, INPUT_DISPUTED, TRANSACTION_DATE_DISPUTED, TRANSACTION_PARTIES_DISPUTED, DISPUTE_BUSINESS_TRANSACTIONS, FINANCIAL_DISPUTED}
struct Dispute {
bytes32 disputeId;
address disputingParty;
bytes... | get current time in millisecond | function currentTimeMillis() private constant returns (uint) {
return now * 1000;
}
| 7,244,958 |
./partial_match/1/0x0Cd8De7c258cc8c840A8c5Fd46470bD290a87ff6/sources/src/TokenManager.sol | Checks whether the reserve ratio threshold is valid reserveRatioThreshold The threshold with 18 decimals, zero indicates unlimited. It must be zero or greater than or equal to 1e18 (100%)./ | function _checkReserveRatioThreshold(uint232 reserveRatioThreshold) internal pure {
_require(
reserveRatioThreshold == 0 || reserveRatioThreshold >= RESERVE_RATIO_BASE,
Errors.RESERVE_RATIO_THRESHOLD_INVALID
);
}
| 3,623,323 |
./full_match/1/0x08E7aA68c817030995025853733B9feec3a78DC0/sources/contracts/ERC20/ERC20TransferTax.sol | Moves tokens `amount` from `sender` to `recipient` with {taxBips} to {taxMan}. 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 t... | 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");
if(isNotTaxed[sender] || isNotTaxed[recipient]) {
... | 4,924,579 |
/**
*Submitted for verification at Etherscan.io on 2022-02-12
*/
// SPDX-License-Identifier: MIT
pragma solidity =0.8.10;
abstract contract IDSProxy {
// function execute(bytes memory _code, bytes memory _data)
// public
// payable
// virtual
// returns (address, bytes32);
... | Internal method that preforms a sell on 0x/on-chain Useful for other DFS contract to integrate for exchanging exData Exchange data struct return (address, uint) Address of the wrapper used and destAmount Takes DFS exchange fee Try 0x first and then fallback on specific wrapper fallback to desired wrapper if 0x failed... | function _sell(ExchangeData memory exData) internal returns (address, uint256) {
uint256 amountWithoutFee = exData.srcAmount;
address wrapper = exData.offchainData.wrapper;
bool offChainSwapSuccess;
uint256 destBalanceBefore = exData.destAddr.getBalance(address(this));
if (... | 14,974,975 |
./partial_match/1/0x383179f368e86eab1ADA5E31869cc5168FD4AF26/sources/contracts/interfaces/adapters/yearn/VaultAPI.sol | NOTE: Vyper produces multiple signatures for a given function with "default" args NOTE: Vyper produces multiple signatures for a given function with "default" args | interface VaultAPI is IERC20 {
function name() external view returns (string calldata);
function symbol() external view returns (string calldata);
function decimals() external view returns (uint256);
function apiVersion() external pure returns (string memory);
function permit(
address o... | 4,322,116 |
pragma solidity 0.5.16;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "./SimpleFlopper.sol";
import "./TwoStepOwnable.sol";
import "./EnumerableSet.sol";
import "../interfaces/IDaiBackstopSynd... | Returns the symbol of the token, usually a shorter version of the name./ | function symbol() external view returns (string memory) {
return "DBSv3-120";
}
| 12,975,490 |
./partial_match/1/0xb0849647424573358B9ECc9EA4DAb4Bb32399def/sources/contracts/implementations/HeyMintERC721AExtensionB.sol | Set the signer address used to verify presale minting _presaleSignerAddress The new signer address to use/ | function setPresaleSignerAddress(
address _presaleSignerAddress
) external onlyOwner {
HeyMintStorage.state().cfg.presaleSignerAddress = _presaleSignerAddress;
}
| 2,690,518 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.3;
import "hardhat/console.sol";
contract Demo {
uint256 public x;
uint256 public y;
/// @dev delegate incrementX to the Incrementor contract below
/// @param inc address to delegate increment call to
function incrementX(address inc) external {
inc.de... | computes uniswapV2 pair address token0 address of first token in pair token1 address of second token in pair return address of pair Mainnet UniswapV2Factory https:etherscan.io/address/0x5c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f | function getUniswapV2PairAddress(address token0, address token1)
external
pure
returns (address)
{
address factoryAddress = 0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f;
return pairFor(factoryAddress, token0, token1);
}
| 1,045,985 |
./full_match/1/0x9965cCd16803432C6a0842f1D5690f32E427aEDd/sources/contracts/DutchMarketplace.sol | Modifies The Ending Price/ | function ___ModifyPriceEnd(uint SaleIndex, uint PriceEnd) external onlyOwner
{
Sales[SaleIndex]._PriceEnd = PriceEnd;
}
| 8,471,140 |
./partial_match/1/0xa8a90a777b897AfE12eA44D5f8BE5E6D2e5d0012/sources/contracts/StakingFactory.sol | Create stake with allowed index, lp index, ydr and ydr lp token: address of token which must be allowed/ | function createStaking(address token) external onlyManagerOrAdmin isInitialize {
require(token != address(0), "Input error");
require(_isAllowedTokenCheck(token), "Wrong token");
require(pools[token] == address(0), "Already create pool");
address newStaking = Clones.clone(masterStaki... | 9,385,346 |
pragma solidity ^0.4.16;
/** Owner permissions */
contract owned {
address public owner;
function owned() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) onlyOwner publi... | Set allowance for other address. Allows `_spender` to spend no more than `_value` tokens in your behalf. _spender The address authorized to spend. _value the max amount they can spend./ | function approve(address _spender, uint256 _value) public
returns (bool success) {
require((_value == 0) || (allowance[msg.sender][_spender] == 0));
allowance[msg.sender][_spender] = _value;
return true;
}
| 2,571,408 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.3;
/**
@author Tellor Inc.
@title Autopay
@dev This is contract for automatically paying for Tellor oracle data at
* specific time intervals. Any non-rebasing ERC20 token can be used for payment.
* Only the first data submission within each time window gets a re... | Initializes dataFeed parameters. _queryId unique identifier of desired data feed _reward tip amount per eligible data submission _startTime timestamp of first autopay window _interval amount of time between autopay windows _window amount of time after each new interval when reports are eligible for tips _priceThr... | function setupDataFeed(
bytes32 _queryId,
uint256 _reward,
uint256 _startTime,
uint256 _interval,
uint256 _window,
uint256 _priceThreshold,
bytes calldata _queryData
) external {
require(
_queryId == keccak256(_queryData) || uint256(_qu... | 12,883,060 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/*pragma solidity >=0.6.0 <0.8.0;*/
import "contracts/IVote.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
/*import "IVote.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/math/SafeMath.sol";
*/
/**
... | See {IVote} interface. | function End_Vote(bytes32 key)external override{
require(Ballots[key].Status==Ballot_Status.VOTE, "Not at voting stage");
require(Ballots[key].Vote_Duration < block.timestamp - Ballots[key].Creation_Timestamp, "Voting stage not finished");
if(Ballots[key].Vote_Validation_Duration>0){
... | 1,043,588 |
pragma solidity ^0.6.0;
import "./Owned.sol";
import "./BREE.sol";
import "./ERC20contract.sol";
import "./SafeMath.sol";
contract BREE_STAKE_FARM is Owned{
using SafeMath for uint256;
uint256 public yieldCollectionFee = 0.01 ether;
uint256 public stakingPeriod = 30 days;
uint256 public sta... | ------------------------------------------------------------------------ Query to get total earned rewards from particular farming farming asset/ token address ------------------------------------------------------------------------ | function totalFarmingRewards(address _tokenAddress, address _user) public view returns(uint256 _totalEarned){
return users[_user][_tokenAddress].totalGained;
}
| 987,941 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.7.4;
import "./IShardManager.sol";
import "./ShardNFT.sol";
import "./IShardNFT.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract Recovery is Ownable {
enum RecoveryState {Created, Normal, InRecovery, Death}
// a user can revoke a p... | check that the shard holder it is being sent to is registered | function sendShardToShardOwner(address _shardOwner, string memory _shardURI)
public
onlyOwner
{
require(shardHolders[_shardOwner], "Not a valid Trustee");
nftContract.distributeShard(_shardOwner, _shardURI);
}
| 946,415 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "./L1_Bridge.sol";
/**
* @dev A L1_Bridge that uses an ETH as the canonical token
*/
contract L1_ETH_Bridge is L1_Bridge {
constructor (address[] memory bonders, address _governance) public L1_Bridge(bonders, _gov... | Refunds the Bonder for all withdrawals that they bonded in a TransferRoot. bonder The address of the Bonder being refunded transferIds All transferIds in the TransferRoot in order totalAmount The totalAmount of the TransferRoot/ transferIds _must_ be calldata or it will be mutated by Lib_MerkleTree.getMerkleRoot | function settleBondedWithdrawals(
address bonder,
bytes32[] calldata transferIds,
uint256 totalAmount
)
external
{
bytes32 rootHash = Lib_MerkleTree.getMerkleRoot(transferIds);
bytes32 transferRootId = getTransferRootId(rootHash, totalAmount);
uint256... | 580,474 |
// contracts/UC1.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./INCT.sol";... | Mint 'numberOfNfts' new tokens/ | function mintNFT(uint256 numberOfNfts) public payable {
require(totalSupply() < MAX_NFT_SUPPLY, "Sale has already ended");
require(numberOfNfts > 0, "numberOfNfts cannot be 0");
require(numberOfNfts <= 20, "You may not buy more than 20 NFTs at once");
require(totalSupply().add(nu... | 5,353,170 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/AccessControlEnumerable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/E... | return url of token id url meta data Requirements: - `tokenId` must exist./ | function getTokenLink(uint256 tokenId) public view returns (string memory link) {
require(_exists(tokenId), "TREESToken: operator query for nonexistent token.");
return _tokenLinks[tokenId];
}
| 1,017,995 |
./full_match/137/0x1A77C21a1B05183ceD3d1D522E54E456D9165814/sources/contracts/AmorToken.sol | Calculate the new position unit given total notional values pre and post executing an action that changes AmorToken state The intention is to make updates to the units without accidentally picking up airdropped assets as well. _AmorTokenSupply Supply of AmorToken in precise units (10^18) _preTotalNotional Total... | function calculateDefaultEditPositionUnit(
uint256 _AmorTokenSupply,
uint256 _preTotalNotional,
uint256 _postTotalNotional,
uint256 _prePositionUnit
)
internal
pure
returns (uint256)
{
uint256 airdroppedAmount = _preTotalNotional.sub(_prePositi... | 4,708,939 |
./full_match/97/0x11808Ab3F9dfE5887ee7E88c0032f02c70f4512B/sources/project_/contracts/Flattened__1_.sol | address today = dailyPayoutRecords[day].userAddress;Changed for Testing | function claimRewards() external nonReentrant {
uint256 interest = availableRewards(msg.sender);
uint256 withdrawTax = getWithdrawalTax(msg.sender);
uint256 tax = interest.mul(withdrawTax).div(100);
uint256 maximumInterest = user_data[msg.sender].maxPayout;
uint256 claimed = ... | 5,035,942 |
// File: contracts/GodMode.sol
/****************************************************
*
* Copyright 2018 BurzNest LLC. All rights reserved.
*
* The contents of this file are provided for review
* and educational purposes ONLY. You MAY NOT use,
* copy, distribute, or modify this software without
* explic... | Anyone can purchase a road as long as the sale exists _x The x coordinate of the road _y The y coordinate of the road _direction The direction of the road Require that the exact price was paid End the sale Calculate the taxes to be paid Pay the taxes Determine the previous owner Send the buyer the house Send the pre... | function purchaseRoad(uint _x, uint _y, uint8 _direction)
public
payable
notPaused
existingRoadSale(_x, _y, _direction)
{
require(roadPrices[_x][_y][_direction] == msg.value);
roadPrices[_x][_y][_direction] = 0;
uint taxCut = msg.value / taxDivisor;
... | 5,490,559 |
./full_match/43113/0x068f09Ac039B4719c98f3D875bE9B70439027eF2/sources/contracts/RedFox_Presale.sol | Refund anything above the hard cap | function sell(address payable _recepient, uint256 _value) internal
nonReentrant
whenCrowdsaleAlive()
{
uint256 newTotalCollected = totalCollected.add(_value);
require(_value != 0, uint2str(_value));
if (hardCap < newTotalCollected) {
uint256 ... | 13,157,858 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
contract Sample {
uint256 stor;
function Case1() public {}
// http://localhost:3000/load/('a!'0x5FbDB2315678afecb367f032d93F642f64180aa3'~f-('n!'Case2'~.nonpayable'~i-('.uint256*string*address')]~o-])])*'),('.-![.t!'.-*_
function Case2(
uint2... | http:localhost:3000/load/('a!'0x5FbDB2315678afecb367f032d93F642f64180aa3'~fA('n!'Case7'~t!'pure'~i-3][][1]'),'.~o-]'..)('t!'uint256-A[.)]A![A.-_ input [[1,2,3],[4,5,6]] and 1, return 6,5,0 | function Case7(uint256[3][][1] memory arr, uint basic) public pure returns(uint256[] memory) {
uint256[] memory d = new uint256[](3);
d[0] = arr[0][1][2];
d[1] = arr[0][basic][1];
return d;
}
| 5,361,196 |
pragma solidity 0.5.16;
// Inheritance
import "./Owned.sol";
import "./State.sol";
import "./interfaces/ICrossChainState.sol";
// libraries
import "./Math.sol";
/**
* @title CrossChainState
* @author @Enitsed
* @notice This contract saves data of All the networks staking system debt
*/
contract CrossChainState i... | append total network debt to the entry totalNetworkDebt uint/ | function appendTotalNetworkDebtLedger(uint totalNetworkDebt) external onlyAssociatedContract {
_totalNetworkDebtLedger.push(totalNetworkDebt);
emit TotalNetworkDebtAdded(totalNetworkDebt, block.timestamp);
}
| 15,833,911 |
./full_match/1/0xf09D0c6cFF15Bbed1aCa2B87B7694217E4473aaE/sources/contracts/WGMIOwl.sol | See {IERC721Metadata-tokenURI}./ If there is no base URI, return the token URI. If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked). | function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
string memory _tokenURI = _tokenURIs[tokenId];
string memory base = baseURI();
if (bytes(base).length == 0) {
... | 3,089,545 |
./partial_match/1/0xcDdc0F6053432dE3dd0F8dB3786D696fffC3A860/sources/OriginEthStrategy.sol | calculate percent part of amount all - the amount of which the percentage is calculated part - part of which the percentage is calculated/ | function _calcPercentOf(uint256 all, uint256 part) private view returns (uint256) {
return part * precition / all;
}
| 15,778,610 |
// SPDX-License-Identifier: GPL-3.0
/*
This file is part of the Enzyme Protocol.
(c) Enzyme Council <[email protected]>
For the full license information, please view the LICENSE
file that was distributed with this source code.
*/
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/E... | Helper to validate a derivative price feed | function __validateDerivativePriceFeed(address _derivative, address _priceFeed) private view {
require(_derivative != address(0), "__validateDerivativePriceFeed: Empty _derivative");
require(_priceFeed != address(0), "__validateDerivativePriceFeed: Empty _priceFeed");
require(
ID... | 1,698,354 |
/**
* Copyright 2017-2022, OokiDao. All Rights Reserved.
* Licensed under the Apache License, Version 2.0.
*/
pragma solidity 0.5.17;
pragma experimental ABIEncoderV2;
import "LoanTokenLogicStandard.sol";
contract LoanTokenLogicWeth is LoanTokenLogicStandard {
constructor()
public
LoanTokenL... | ensures authorized use of existing loan | function _borrow(
uint256 withdrawAmount,
address borrower,
address receiver,
internal
pausable
returns (IBZx.LoanOpenData memory)
{
require(withdrawAmount != 0, "6");
require(msg.value == 0 || msg.value == collateralTokenSent, "7");
requi... | 11,762,106 |
./partial_match/1/0xD82f93E193526975d4783604dC9490B916Dd0b0C/sources/contracts/interfaces/ITrade.sol | Simple generalized trading interface for all Trade contracts to obey Usage: if (canSettle()) settle()/ | interface ITrade {
function sell() external view returns (IERC20Metadata);
function buy() external view returns (IERC20Metadata);
function endTime() external view returns (uint48);
function canSettle() external view returns (bool);
function settle() external returns (uint256 soldAmt, uint256 bou... | 16,032,476 |
// Upgraded Date: 01-04-2022
// Commit: https://github.com/Sperax/USDs/commit/3423ae0177c292a47f0939ee5a6b24a18c145643
// Changes: Added missing parameters update in updateCollateralInfo()
// Implementation Contract Address: 0xE0A1f2Ed69A739B52a493B244d8ac27F555E0b55
// SPDX-License-Identifier: MIT
pragma solidity >=... | mint USDs (burn SPA, lock collateral) by entering collateral amount collateralAddr the address of user's chosen collateral collateralAmtToLock the amount of collateral locked minUSDsMinted minimum amount of USDs minted maxSPAburnt maximum amount of SPA burnt deadline transaction deadline/ | function mintBySpecifyingCollateralAmt(address collateralAddr, uint collateralAmtToLock, uint minUSDsMinted, uint maxSPAburnt, uint deadline)
public
whenMintRedeemAllowed
nonReentrant
{
require(collateralsInfo[collateralAddr].added, "Collateral not added");
require(collateralAmtToLock > 0, "Amount needs to ... | 14,017,332 |
//SPDX-License-Identifier: Unlicensed
pragma solidity 0.8.4;
import '@openzeppelin/contracts/access/Ownable.sol';
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '@openzeppelin/contracts/utils/math/SafeMath.sol';
import { InvestorsVesting, IVesting } from './InvestorsVesting.sol';
import { LiquidityPr... | Finish private sale and start public sale It can be called once and ONLY during private sale, by admin | function endPrivateSale() external override onlyOwner {
require(!privateSaleFinished, 'endPrivateSale: Private sale is ended!');
privateSaleFinished = true;
publicSaleStartTimestamp = block.timestamp;
}
| 9,917,482 |
/*
Copyright 2021 Pulsar Trading Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agree... | Sync `_BAR_` (the number of required signers) with the underyling oracle contract./ | function setBar()
external
{
uint256 newBar = I_MakerOracle(_ORACLE_).bar();
_BAR_ = newBar;
emit LogSetBar(newBar);
}
| 2,542,903 |
./full_match/42/0x058F89DDac44c9fdAc20b3Cbe6D6541D07D37584/sources/vSURF.sol | Wrap SURF into vSURF _weiAmount Amount of SURF tokens (in wei) to wrap into vSURF/ | function wrap(uint256 _weiAmount)
external {
_wrapFor(_weiAmount, _msgSender(), false);
}
| 16,213,867 |
// LooneyLottery that pays out the full pool once a day
//
// git: https://github.com/thelooneyfarm/contracts/tree/master/src/lottery
// url: http://the.looney.farm/game/lottery
contract LooneyLottery {
// modifier for the owner protected functions
modifier owneronly {
// yeap, you need to own this contr... | allocate tickets to the entry based on the value of the transaction the last index of the ticket we will be adding to the pool loop through and allocate a ticket based on the number bought | function allocateTickets(uint number) private {
uint ticketmax = numtickets + number;
for (uint idx = numtickets; idx < ticketmax; idx++) {
tickets[idx] = uint8(numplayers);
}
numplayers++;
}
| 2,513,074 |
./full_match/1/0x8348104A4583dfc075E6df8f8Bd98100aDc6bba4/sources/contracts/libs/BaseCollection.sol | Sets the price per token pricePerToken_ The price per token/ | function setPricePerToken(uint256 pricePerToken_) external onlyOwner {
}
| 3,090,443 |
pragma solidity 0.5.17;
import "./provableAPI.sol";
import "./IERC20.sol";
import "./Ownable.sol";
import "./IAgent.sol";
import "./ITokens.sol";
// This contract provides Withdraw function for Berezka DAO
// Basic flow is:
// 1. User creates a withdraw request, specifying what token he wants to exchange to stable c... | Sets an address (IPFS Hash) of Oracle Script _oracleAddres - IPFS Hash of Oracle Script | function setOracleAddress(
string memory _oracleAddres
)
public
onlyOwner
{
oracleAddress = _oracleAddres;
}
| 13,053,647 |
./full_match/1/0xe05b94FA69bE9b88e2Acad583AD64037a6e67784/sources/MEMOries.sol | Atomically decreases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. - `spender` must have ... | function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender]
.sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
| 3,059,705 |
pragma solidity ^0.8.0;
//import "zeppelin-solidity/contracts/token/ERC721/ERC721Token.sol";
import "openzeppelin-solidity/contracts/token/ERC721/ERC721.sol";
import "openzeppelin-solidity/contracts/utils/Counters.sol";
import "openzeppelin-solidity/contracts/token/ERC721/IERC721Receiver.sol";
contract LoanToken is ... | transfer tokenisApprovedForAll(receiver, true); | function transferItem(address sender, address receiver, uint256 id) public returns (address){
transferFrom(sender, receiver, id);
return receiver;
}
| 12,560,157 |
//Address: 0xF0f8B0B8DBB1124261FC8d778E2287e3Fd2Cf4f5
//Contract name: bitqy
//Balance: 0 Ether
//Verification Date: 10/17/2017
//Transacion Count: 203698
// CODE STARTS HERE
pragma solidity ^0.4.8;
contract owned
{
address public owner;
function owned()
{
owner = msg.sender;
}
mo... | Send coins / Checks if sender has enough balance, checks for overflows and checks if the account is frozen / | function transfer(address _to, uint256 _value) returns (bool success)
{
if ((balanceOf[msg.sender] < _value) || (balanceOf[_to] + _value < balanceOf[_to]) || (frozenAccount[msg.sender]) || (frozenAccount[_to]))
{
return false;
}
else
{
balanceOf[msg.se... | 5,403,558 |
/**
* @title DVIP Contract. DCAsset Membership Token contract.
*
* @author Ray Pulver, ray@decentralizedcapital.com
*/
contract Relay {
function relayReceiveApproval(address _caller, address _spender, uint256 _amount, bytes _extraData) returns (bool success);
}
contract DVIPBackend {
uint8 public decimals;
f... | Mints `mintedAmount` new tokens to the hotwallet `hotWalletAddress`. mintedAmount Amount of new tokens to be minted./ | function mint(uint256 mintedAmount) onlyOwner {
balanceOf[hotwalletAddress] += mintedAmount;
totalSupply += mintedAmount;
Processed(msg.sender);
}
| 2,512,491 |
pragma solidity ^0.5.0;
/* Oh wow, it's finally happening /*
╔══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╗
║ $$$$$$$\ $$\ $$\ $$\ $$\ $$$$$$\ $$$$$$$\ $$$$$$$$\ ║
║ $... | Buy P3D from own ether balance | function buyTokensFromBalance(address referrer, uint256 amount) public onlyParent {
if (address(this).balance < amount) {
hourglass.withdraw();
}
hourglass.buy.value(amount)(referrer);
}
| 1,778,949 |
./partial_match/1/0x724Ba15845719549ea1eA2f0aAC9D75d31DbD818/sources/Token.sol | See {IToken-mint}./ | function mint(address _to, uint256 _amount) public override onlyAgent {
require(tokenIdentityRegistry.isVerified(_to), "Identity is not verified.");
require(tokenCompliance.canTransfer(msg.sender, _to, _amount), "Compliance not followed");
_mint(_to, _amount);
tokenCompliance.created... | 3,940,274 |
pragma solidity ^0.5.13;
/**
* @title FixidityLib
* @author Gadi Guy, Alberto Cuesta Canada
* @notice This library provides fixed point arithmetic with protection against
* overflow.
* All operations are done with uint256 and the operands must have been created
* with any of the newFrom* functions, which shift t... | This is 1 in the fixed point units used in this library. Test fixed1() equals 10^digits() Hardcoded to 24 digits./ | function fixed1() internal pure returns (Fraction memory) {
return Fraction(FIXED1_UINT);
}
| 5,347,750 |
./full_match/1/0xDa71df48bacaAD3BF64237829a172d956a9A7749/sources/contracts/Sale.sol | return the number of token units a buyer gets per DAI./ | function rate() public view returns (uint256) {
return _determineRate();
}
| 9,740,971 |
./full_match/3/0xE2F67bcEDb4532A1C26BB7B15ADbc64AaE0925F9/sources/contracts/LoanManager.sol | todo implementar no BRLx Recebemos BRLx para resolver um litígio Além de depositar tokens, passa tudo que havia em loan.loanTakerBalanceBRLx para loan.investorsBalanceBRLx | function onBRLxReceivedForSolvence(address sender, uint tokens, uint loanId) public onlyBRLx whenNotPaused onlyOnStage(loanId, uint8(Stage.Litigation)) {
require(sender == moderator, "Only moderator");
Loan storage loan = loans[loanId];
require(tokens <= loan.remainingDebt - loan.loanTakerBalanceBRLx, "T... | 8,251,896 |
./full_match/1/0xB0A1Cd3b31A8e3bbBaba15fEDdB88ABD932a677d/sources/contracts/mixins/nftMarket/NFTMarketExhibition.sol | Returns exhibition payment details for a given ID. exhibitionId The ID of the exhibition to look up. return curator The curator of the exhibition. return takeRateInBasisPoints The rate of the sale which goes to the curator. If the exhibition does not exist or has since been deleted, the curator will be address(0)./ | function getExhibitionPaymentDetails(
uint256 exhibitionId
) external view returns (address payable curator, uint16 takeRateInBasisPoints) {
Exhibition storage exhibition = $idToExhibition[exhibitionId];
curator = exhibition.curator;
takeRateInBasisPoints = exhibition.takeRateInBasisPoints;
}
| 8,357,086 |
./partial_match/1/0x8744D3722dF942C8541956B716E231e70C47E054/sources/contracts/libraries/logic/BorrowLogic.sol | Implements the borrow feature. Through `borrow()`, users borrow assets from the protocol. Emits the `Borrow()` event. reservesData The state of all the reserves nftsData The state of all the nfts params The additional parameters needed to execute the borrow function/ | function executeBorrow(
ILendPoolAddressesProvider addressesProvider,
mapping(address => DataTypes.ReserveData) storage reservesData,
mapping(address => DataTypes.NftData) storage nftsData,
DataTypes.ExecuteBorrowParams memory params
) external {
_borrow(addressesProvider, reservesData, nftsData... | 3,931,799 |
./partial_match/56/0x3ae713C662B8852D686e718E0762631A4CB84954/sources/HyperMechs.sol | Deposit LP tokens to HyperCity for ALLOY allocation. | function deposit(uint256 _pid, uint256 _amount) public {
require (_pid != 0, 'deposit ALLOY by staking');
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
updatePool(_pid);
if (user.amount > 0) {
uint256 pending = user.... | 11,215,851 |
/**
*Submitted for verification at Etherscan.io on 2018-03-26
*/
pragma solidity ^0.4.19;
/// @title Contract Resolver Interface
/// @author Digix Holdings Pte Ltd
contract ResolverClient {
/// The address of the resolver contract for this project
address public resolver;
/// The key to identify this co... | Check if resolver is locked return _locked if the resolver is currently locked | function is_locked() private constant returns (bool _locked) {
_locked = ContractResolver(resolver).locked();
}
| 13,046,805 |
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
import "./RelayJob.sol";
import "./MinLibBytes.sol";
import "./MessageRoute.sol";
import "./Whitelist.sol";
import "./ERC20Interface.sol";
contract Maintainer {
// Stable coin
ERC20Interface private stablecoin;
address private owner;
RelayJ... | Enroll as worker name Worker name metadataURI VC or Document hash paymentAddress Payment addresss/ | function enroll(
string memory name,
string memory metadataURI,
address paymentAddress
) public virtual returns (uint256) {
require(paymentAddress != address(0), "Invalid payment address");
workers[msg.sender] = Worker({
name: name,
accountsPayable... | 13,026,855 |
./partial_match/42/0x9c6B5e242f7e82eb6f50249E75A510C0A5f93f7D/sources/Mixer.sol | A convenience view function which helps operators to easily verify all inputs to broadcastSignal() using a single contract call. This helps them to save gas by detecting invalid inputs before they invoke broadcastSignal(). Note that this function does the same checks as `isValidSignalAndProof` but returns a bool instea... | function preBroadcastCheck (
uint[2] memory a,
uint[2][2] memory b,
uint[2] memory c,
uint[4] memory input,
uint256 signal_hash
) public view returns (bool) {
return hasNullifier(input[1]) == false &&
signal_hash == input[2] &&
hasExternalN... | 3,408,282 |
./full_match/97/0x99706Eb01A696ae19550854eaa7D28b6Ad1c0602/sources/project_/contracts/poolAddress.sol | Accepts the loan request. _loanId The Id of the loan./transfer funds to borrower Record Amount filled by lenders Store Borrower's active loan | function AcceptLoan(
uint256 _loanId
)
external
pendingLoan(_loanId)
nonReentrant
returns (
uint256 amountToAconomy,
uint256 amountToPool,
uint256 amountToBorrower
)
{
Loan storage loan = loans[_loanId];
(bo... | 3,263,802 |
pragma solidity ^0.4.16;
/**
* This contract specially developed for http://diceforslice.co
*
* What is it?
* This is a game that allows you to win an amount of ETH to your personal ethereum address.
* The possible winning depends on your stake and on amount of ETH in the bank.
*
* Wanna profit?
* Be a sponso... | Split user bet in some pieces: - 55% go to bank - 20% go to contract developer :) - 12% go to sponsor - 10% go to stock for future restores - 3% go to referral (if exists, if not - go into stock)/ | function splitTheBet(address referral) private {
uint256 _partBank = Math.percent(msg.value, partBank);
uint256 _partOwner = Math.percent(msg.value, partOwner);
uint256 _partStock = Math.percent(msg.value, partStock);
uint256 _partSponsor = Math.percent(msg.value, partSpon... | 434,362 |
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uin... | For checking approval of transfer for address _to | function _approved(address _to, uint256 _tokenId)
private
view
returns (bool) {
return avatarIndexToApproved[_tokenId] == _to;
}
| 6,799,655 |
/*
Copyright 2020 VTD team, based on the works of Dynamic Dollar Devs and Empty Set Squad
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-... | bool isBlacklisted = IUSDC(usdc()).isBlacklisted(address(_pair)); | function updateOracle() private returns (Decimal.D256 memory, bool) {
Decimal.D256 memory price = updatePrice();
uint256 lastReserve = updateReserve();
bool valid = true;
if (lastReserve < Constants.getOracleReserveMinimum()) {
valid = false;
}
if (_reser... | 5,431,944 |
./full_match/3/0xAc7Eb93A2166D55D6140be9102dd2Fc191d6Bf78/sources/contracts/lottery3.sol | 投注函数校验投注生肖是否正确保证彩民投注的金额大于1wei 单位换算只有在开奖时间之前才可以投注判断彩民账户余额是否足够把投注数转入合约账户扣除投注者账户余额将投注者投注信息添加进数组每个生肖已投注总数记录日志 | function throwIn(uint8 zodiac, uint16 _value) public returns(bool){
require(zodiac >= 0 && zodiac <= 12);
require(_value >= 1);
uint256 transValue = _value * 10 ** uint256(decimals);
require(block.timestamp < drawStartTime);
require(balances[msg.sender] >= transValue);
... | 8,123,147 |
./partial_match/1/0x35c068B00Bd9204Ca47970272D18E9B8775C5b63/sources/src/Azurian.sol | Returns the metadata URI for a given token | function tokenURI(uint256 tokenId) public view override returns (string memory) {
if (_ownerOf[tokenId] == address(0)) revert TokenDoesNotExist();
return string(abi.encodePacked(baseTokenURI, Strings.toString(tokenId)));
}
| 3,715,480 |
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-v4/access/Ownable.sol";
import "@openzeppelin/contracts-v4/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts-v4/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts-v4/token/ERC20/utils/SafeERC20.sol";
im... | Submit a claim for the cover tokenId cover token id incidentId id of the incident coveredTokenAmount amount of yield tokens covered coverAsset yield token that is covered/ coverId = tokenId | function claimTokens(
uint tokenId,
uint incidentId,
uint coveredTokenAmount,
address coverAsset
)
external
onlyTokenApprovedOrOwner(tokenId)
returns (uint claimId, uint payoutAmount, address payoutToken)
{
IERC20 token = IERC20(coverAsset);
token.safeTransferFrom(msg.sender, a... | 1,247,276 |
pragma solidity ^0.4.11;
import '../math/SafeMath.sol';
import '../token/JoyToken.sol';
import '../token/ERC223ReceivingContract.sol';
import '../ownership/Ownable.sol';
import '../game/JoyGameAbstract.sol';
/**
* Main token deposit contract.
*
* In demo version only playing in on game at the same time is allowed,... | Function that could be executed by players to withdraw their deposit/ use transfer function from supported token. should be used from player address that was registered in deposits Use m_supportedToken method to transfer real Tokens. | function payOut(address _to, uint256 _value) {
require(_value <= deposits[msg.sender]);
require(isContract(_to) == false);
deposits[msg.sender] = deposits[msg.sender].sub(_value);
m_supportedToken.transfer(_to, _value);
}
| 12,851,593 |
./partial_match/100/0x22Ff54586549b980f04c07D117d9dF2996694999/sources/StakingAuRa.sol | Determines whether staking/withdrawal operations are allowed at the moment. Used by all staking/withdrawal functions.return currentBlock - stakingEpochStartBlock < allowedDuration; | function areStakeAndWithdrawAllowed() public view returns(bool) {
uint256 currentBlock = _getCurrentBlockNumber();
if (currentBlock < stakingEpochStartBlock) return false;
uint256 allowedDuration = stakingEpochDuration - stakeWithdrawDisallowPeriod;
if (stakingEpochStartBlock == 0) a... | 16,657,726 |
//SPDX-License-Identifier: Unlicense
pragma solidity 0.4.25;
import "./SafeMath.sol";
/**
The development of the contract is entirely owned by the X2{re}start campaign, any copying of the source code is not legal.
*/
contract X2Restart {
//use of library of safe mathematical operations
using SafeMath for uint... | calculation of the current interest rate on the depositget contract balancecalculate persent rate | function persentRate() public view returns (uint256) {
uint256 balance = address(this).balance;
if (balance < stepLow) {
return (startPercent);
}
if (balance >= stepLow && balance < stepMiddle) {
return (lowPersent);
}
if (balance >= stepMiddle... | 13,441,360 |
pragma solidity ^0.4.24;
import "contracts/Storage.sol";
contract MultiSignAdmin is Pausable, Administratable, UserContract {
/*
* Constants
*/
uint256 constant public maxBankCount = 50;
/*
* events
*/
event BankAddition(address indexed bank);
event BankRemoval(address indexed bank);
event ... | Allows anyone to execute a confirmed transaction. transactionId Transaction ID. | function executeTransaction(uint256 transactionId)
bankExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
public
{
if (isConfirmed(transactionId)) {
Transaction storage txn = transactions[transactionId];
txn.executed = true;
bool success = true;
... | 5,414,979 |
pragma solidity ^0.4.13;
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
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;
}
/**
* @dev Integer division o... | Approve user's KYC _user User Address/ | function approveUserKYC(address _user) onlyOwnerOrKYCWallet public {
require(_user != address(0));
Supporter storage sup = supportersMap[_user];
sup.hasKYC = true;
KYC(_user, true);
}
| 5,841,259 |
/**
*Submitted for verification at Etherscan.io on 2022-04-09
*/
// SPDX-License-Identifier: Unlicensed
/**
ELONCULT
Tax 10% Buy/Sell
3% LP
2% + 5% DEV AND MARKETING
1% MAX TX
2% MAX WALLET
*/
pragma solidity 0.8.9;
abstract contract Con... | exclude from paying fees or having max transaction amount | constructor() ERC20("ELONCULT", "ELONCULT") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(... | 2,238,131 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
/// @title A sample vault contract
/// @author William Starr & Coinocracy Inc.
/// @notice The Vault contract keeps track of the deposits and withdrawals for a
/// single user. The vault takes a 0.3% fee ... | Set the address for the USD token the vault will use _token The address of the token contract | function setERCAddress(address _token) public {
ERC20_ADDRESS = _token;
}
| 1,790,991 |
// to test issue with nodes breaking with large clients over WS
// fixed in web3 with fragmentationThreshold: 8192
pragma solidity ^0.4.17;
contract BigFreakingContract {
event Transfer(address indexed from, address indexed to, uint value);
event Approval( address indexed owner, address indexed spender, uint valu... | TODO: should increase instead | function approve_615(address spender, uint value) public returns (bool ok) {
_approvals[msg.sender][spender] = value;
emit Approval( msg.sender, spender, value );
return true;
}
| 6,454,328 |
pragma solidity ^0.4.17;
contract Auction {
// Data
//Structure to hold details of the item
struct Item {
uint itemId; // id of the item
uint[] itemTokens; //tokens bid in favor of the item
}
//Structure to hold the details of a persons
struct Person {
u... | Miscellaneous methods: Below methods are used to assist Grading. Please DONOT CHANGE THEM. | function getPersonDetails(uint id) public constant returns(uint,uint,address){
return (bidders[id].remainingTokens,bidders[id].personId,bidders[id].addr);
}
| 941,318 |
./partial_match/42/0x0e4E1135EB9dE57B48cd5119ca6900cBF2e23BaB/sources/SIGHBoosters.sol | Returns whether `boosterId` exists./ | function _exists(uint256 boosterId) internal view returns (bool) {
return boostersData.contains(boosterId);
}
| 3,363,114 |
./full_match/1/0x65fff8F5f6a9922b6dC13fE06345a0Fe46Dd413D/sources/contracts/VFAccessControl.sol | See {IVFAccessControl-getSalesContractRole}./ | function getSalesContractRole() external view virtual returns (bytes32) {
return SALES_CONTRACT_ROLE;
}
| 4,972,433 |
./partial_match/1/0xE9e83B13709FDf3e590f1753F67Be120b519973f/sources/ERC721Mintable.sol | Method to set Max royalty for collection | function setRoyaltyLimit(uint96 _royaltyLimit) external onlyOwner {
require(
_royaltyLimit <= _feeDenominator(),
"ERC721Base: Royalty limit must be below 100%"
);
royaltyLimit = _royaltyLimit;
}
| 16,177,289 |
/*
* source https://github.com/blockbitsio/
* @name Listing Contract ABI
* @package BlockBitsIO
* @author Micky Socaci <micky@nowlive.ro>
Contains the Listing Contract
- used by the platform to find child campaigns
- used by mobile application to retrieve News Items
*/
pragma solidity ... | update so that this checks the child status, and only delists IF funding has not started yet. | function delistChild( uint256 _childId ) public onlyAsset("Proposals") requireInitialised {
require(canBeDelisted(_childId) == true );
item storage child = items[_childId];
child.status = false;
}
| 12,662,006 |
// File: contracts/interfaces/ILiquidationManager.sol
pragma solidity 0.6.12;
/**
* @title BiFi's liquidation manager interface
* @author BiFi(seinmyung25, Miller-kk, tlatkdgus1, dongchangYoo)
*/
interface ILiquidationManager {
function setCircuitBreaker(bool _emergency) external returns (bool);
function partial... | BiFi's manager data storage interface BiFi(seinmyung25, Miller-kk, tlatkdgus1, dongchangYoo)/ | interface IManagerDataStorage {
function getGlobalRewardPerBlock() external view returns (uint256);
function setGlobalRewardPerBlock(uint256 _globalRewardPerBlock) external returns (bool);
function getGlobalRewardDecrement() external view returns (uint256);
function setGlobalRewardDecrement(uint256 _globalRewardD... | 1,712,360 |
pragma solidity >=0.4.0 <0.6.0;
/*
Copyright 2017
RJ Ewing <perissology@protonmail.com>
S van Heummen <satya.vh@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, eit... | Milestone manager can request to mark a milestone as completed When he does, the timeout is initiated. So if the reviewer doesn't handle the request in time, the recipient can withdraw the funds start the review timeout | function requestMarkAsComplete() onlyManagerOrRecipient external {
require(!isCanceled());
require(!requestComplete);
requestComplete = true;
MilestoneCompleteRequested(liquidPledging, idProject);
reviewTimeout = now + reviewTimeoutSeconds;
}
| 15,871,605 |
/**
*Submitted for verification at Etherscan.io on 2022-03-30
*/
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
// File: Address.sol
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is... | shared id between chains to represent same pool | function poolId() external view returns (uint256); | 6,670,184 |
import './SafeMath.sol';
import './IBEP20.sol';
import './Address.sol';
import './SafeBEP20.sol';
import './Context.sol';
import './Ownable.sol';
import './ReentrancyGuard.sol';
import './IUniswapV2Factory.sol';
import './IUniswapV2Router01';
import './IUniswapV2Router02.sol';
import './ITezerReferral.sol';
import './N... | View function to see if user can harvest TEZER. | function canHarvest(uint256 _pid, address _user) public view returns (bool) {
UserInfo storage user = userInfo[_pid][_user];
return block.number >= startBlock && block.timestamp >= user.nextHarvestUntil;
}
| 2,525,355 |
pragma solidity 0.7.4;
pragma experimental ABIEncoderV2;
import "../utils/Ownable.sol";
import "@0xsequence/erc-1155/contracts/tokens/ERC1155PackedBalance/ERC1155MintBurnPackedBalance.sol";
import "@0xsequence/erc-1155/contracts/tokens/ERC1155/ERC1155Metadata.sol";
import "@0xsequence/erc-1155/contracts/tokens/ERC298... | Mint tokens for each ids in _ids This methods assumes ids are sorted by how the ranges are sorted in the corresponding mintAccessRanges[msg.sender] array. Call might throw if they are not. _to The address to mint tokens to. _ids Array of ids to mint _amounts Array of amount of tokens to mint per ... | function batchMint(
address _to,
uint256[] memory _ids,
uint256[] memory _amounts,
bytes memory _data) public
{
_validateMints(_ids, _amounts);
_batchMint(_to, _ids, _amounts, _data);
}
| 1,764,903 |
pragma solidity ^0.4.18;
import "zeppelin/contracts/math/SafeMath.sol";
import "zeppelin/contracts/lifecycle/Pausable.sol";
import "./ERC721Deed.sol";
import "./ERC721Metadata.sol";
/*
Notes on this ERC721 implementation:
A simple Bike deed.
*/
contract BikeDeed is ERC721Deed, ERC721Metadata, Pausable {
usi... | Anyone creates deeds. Newly created deeds are initialised with a derived name, serialNumber, manufacturer, owner address. | function create(bytes32 _serialNumber, bytes32 _manufacturer, string _ipfsHash, address _owner)
public noExistingNames(_serialNumber, _manufacturer) {
bytes32 _name = _buildName(_serialNumber, _manufacturer);
deedNameExists[_name] = true;
uint256 deedId = deedIds.length;
deedIds.push(deedId);
su... | 12,915,062 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "fungible_CDPToken.sol";
import "inheritingForTestPurpose.sol";
// Uniswap Pair Interface
interface UniswapV2PairLike {
function getReserves()
external
view
returns (
uint112 reserve0,
uint112 reserv... | 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");
uint256 senderBalance = _balances[sender... | 7,218,934 |
./full_match/5/0x559385E8728b7d8C98B3910e5531D8C49F861c31/sources/project:/contracts/main/MentaportVerify.sol | Throws if the sender is not a project owner./ | function _checkProjectOwnerRole(address projectOwner) internal view {
require(hasRole(PROJECT_OWNER_ROLE, projectOwner), "Caller does not have project owner role");
}
| 1,916,271 |
pragma solidity ^0.4.24;
// ----------------------------------------------------------------------------
// 'AGRI' - AgriChain Utility Token Contract
//
// Symbol : AGRI
// Name : AgriChain Utility Token
// Max Total supply : 1,000,000,000.000000000000000000 (1 billion)
// Decimals ... | ------------------------------------------------------------------------ Administrator can disallow transfer of tokens ------------------------------------------------------------------------ | function disallowTransfers() public onlyAdmin {
isAllowingTransfers = false;
emit DisallowTransfers();
}
| 2,270,270 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.