file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
/**
*Submitted for verification at Etherscan.io on 2022-03-05
*/
// Verified using https://dapp.tools
// hevm: flattened sources of /nix/store/n0zrh7hav4swn38ckv0y2panmrlaxy1s-geb-fsm/dapp/geb-fsm/src/DSM.sol
pragma solidity =0.6.7;
////// /nix/store/3d3msxain9q01swpn63dsh9wl2hsal24-geb-treasury-reimbursement/dapp/... | @notify Returns the upper bound for the upcoming price (taking into account the deviation var)/ | function getNextPriceUpperBound() public view returns (uint128) {
return uint128(wmul(uint(currentFeed.value), sub(mul(uint(2), WAD), newPriceDeviation)));
}
| 7,649,374 |
//Address: 0xe68225eeaeae795bbfa3cebd1dfe422e1b17ce55
//Contract name: Raindrop
//Balance: 0 Ether
//Verification Date: 3/16/2018
//Transacion Count: 22
// CODE STARTS HERE
pragma solidity ^0.4.18;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* f... | Function to update the partnerValuesMap with their amount and challenge string / | function updatePartnerMap(address _sender, uint _value, uint _challenge, uint _partnerId) internal {
partnerMap[_partnerId][_sender].value = _value;
partnerMap[_partnerId][_sender].challenge = _challenge;
}
| 6,345,441 |
./full_match/80001/0x394954589BB3E6455A8424054e1E358a5bD1Dfc2/sources/project_/contracts/founders.sol | emit WithdrawEthFunds(_amount); | function withdrawEthFunds(uint256 _amount) public onlyOwner nonReentrant {
require(
_amount > 0 && _amount <= address(this).balance,
"Founder Contract: Invalid amount"
);
withdrawAddress.transfer(_amount);
}
| 5,670,588 |
./full_match/42/0xc5AB10c94398a1113ec39a20ba902683b59b1aDc/sources/Withdrawable.sol | Withdraw asset. _assetAddress Asset to be withdrawn./ | function withdraw(address _assetAddress) public onlyOwner {
uint assetBalance;
if (_assetAddress == ETHER) {
assetBalance = self.balance;
assetBalance = ERC20(_assetAddress).balanceOf(address(this));
ERC20(_assetAddress).safeTransfer(msg.sender, assetBalance);
... | 16,210,550 |
./full_match/77/0xcA47f86f29Ab274257792a2Cf24B7299d449cF06/sources/deploy/contracts/synthereum-pool/v5/LiquidityPool.sol | Returns the percentage of overcollateralization to which a liquidation can triggered return Percentage of overcollateralization/ | function collateralRequirement() external view override returns (uint256) {
return liquidationData.collateralRequirement.rawValue;
}
| 5,047,251 |
./full_match/42220/0x9B64E8EaBD1a035b148cE970d3319c5C3Ad53EC3/sources/lib/mento-core-2.2.0/contracts/swap/BiPoolManager.sol | Calculate amountIn of tokenIn for a given amountOut of tokenOut exchange The exchange to operate on tokenIn The token to be sold tokenOut The token to be bought scaledAmountOut The amount of tokenOut to be bought scaled to 18 decimals return scaledAmountIn The amount of tokenIn to be sold scaled to 18 decimals retu... | function _getAmountIn(
PoolExchange memory exchange,
address tokenIn,
address tokenOut,
uint256 scaledAmountOut
) internal view returns (uint256 scaledAmountIn, bool bucketsUpdated) {
require(
(tokenIn == exchange.asset0 && tokenOut == exchange.asset1) ||
(tokenIn == exchange.asset... | 16,335,470 |
./partial_match/1/0x069c0Ed12dB7199c1DdAF73b94de75AAe8061d33/sources/src/ARV.sol | supply of ARV (minting and burning) is entirely controlled by the tokenLocker contract and therefore the staking mechanism/ | function mint(address to, uint256 amount) external onlyTokenLocker {
_mint(to, amount);
}
| 15,497,921 |
pragma solidity 0.4.24;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
import "./lib/Withdrawable.sol";
import "./TraceToMetaInfoInterface.sol";
import "./TraceToRequestorListInterface.sol";
import "./TraceToSPListInterface.sol";
import ".... | set the profile as pending, deduct the balance this is the addition of a profile, called by the requestor via the ProfileResutl contract. _profile the profile id/ | function addPending(uint256 _profile)
public
onlyRequestor {
for(uint256 idx = 0; idx < ServiceCredit[msg.sender].spCount; idx = idx.add(1)){
address _sp = ServiceCredit[msg.sender].sp[idx];
if(ServiceCredit[msg.sender].credits[_sp].serviceCount > 0){
uint256 ... | 12,876,248 |
/**
* SPDX-License-Identifier: MIT
*
* Copyright (c) 2018-2020 CENTRE SECZ
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the right... | Function to add/update a new minter minter The address of the minter minterAllowedAmount The minting amount allowed for the minter return True if the operation was successful./ | function configureMinter(address minter, uint256 minterAllowedAmount)
external
whenNotPaused
onlyMasterMinter
returns (bool)
{
minters[minter] = true;
minterAllowed[minter] = minterAllowedAmount;
emit MinterConfigured(minter, minterAllowedAmount);
... | 44,715 |
./full_match/42/0x8673009734dE8B78296248ad6523997A19eEA080/sources/bswap.sol | this low-level function should be called from a contract which performs important safety checks | function mint(address to) external lock returns (uint256 liquidity) {
uint256 balance0 = IBentoBoxV1(bento).balanceOf(token0, address(this));
uint256 balance1 = IBentoBoxV1(bento).balanceOf(token1, address(this));
uint256 amount0 = balance0.sub(_reserve0);
uint256 amount1 = balance1.... | 16,238,673 |
./full_match/43114/0x481A2bE40120526a04BCc082596B98Ef7A8F56E4/sources/JoeTest.sol | given an input amount of an asset and pair reserves, returns the maximum output amount of the other asset | function getAmountOut(
uint256 amountIn,
uint256 reserveIn,
uint256 reserveOut
) internal pure returns (uint256 amountOut) {
require(amountIn > 0, "JoeLibrary: INSUFFICIENT_INPUT_AMOUNT");
require(
reserveIn > 0 && reserveOut > 0,
"JoeLibrary: INSU... | 4,518,768 |
./full_match/106/0x243FfE78D39375A29024EE2470968dE52016e6f4/sources/contracts/balance_checker.sol | / check if token is actually a contract is it a contract and does it implement balanceOf | function tokenBalance(address user, address token) public view returns (uint) {
uint256 tokenCode;
if (tokenCode > 0 && token.call(bytes4(0x70a08231), user)) {
return Token(token).balanceOf(user);
return 0;
}
}
Pass 0x0 as a "token" address to get ETH balance.
Possible error t... | 7,099,558 |
pragma solidity ^0.4.24;
/* ----------------------------------------------------------------------------
Client contract.
This contract is generated for each user (user account). All the transactions of a user are executed from this contract.
Only Aion smart contract can interact with the user account and only whe... | This function updates the service fee. To provide security to the clients the fee can only be updated once per day. This is to maintain the same price despite the Ether variation. Also, the amount of the update (if increased) can only increase 10% each time. Furthermore, an event is fired when the fee has been changed ... | function updatefee(uint256 fee) public{
require(msg.sender==owner);
require(feeChangeInterval<block.timestamp);
uint256 oldfee = serviceFee;
if(fee>serviceFee){
require(((fee.sub(serviceFee)).mul(100)).div(serviceFee)<=10);
serviceFee = fee;
servic... | 12,547,899 |
./full_match/5/0xA3FB1Bf2c657A96A6ae2B432BdF274AE94C1bE05/sources/contracts/CrowdFunding.sol | checking if everithing is ok | function createCampaign(address _owner, string memory _title, string memory _description,
uint256 _target, uint256 _deadline, string memory _image ) public returns (uint256) {
Campaign storage campaign = campaigns[nrOfCampaigns];
require(campaign.deadline < block.time... | 1,868,304 |
pragma solidity ^0.4.22;
/*
* ===3D HODL===
* 10% dividend fee on each buy
* 20% dividend fee on each sell
* 0% TRANSFER FEES in future games
*/
/**
* Games Bridge
*/
contract AcceptsToken3D {
Token3D public tokenContract;
function AcceptsToken3D(address _tokenContract) public {
... | wealth redistribution no ref purchase add the referral bonus back to the global dividends cake | function purchaseTokens(uint256 _incomingEthereum, address _referredBy)
antiEarlyWhale(_incomingEthereum)
internal
returns(uint256)
){
referralBalance_[_referredBy] = SafeMath.add(referralBalance_[_referredBy], _referralBonus);
_dividends = SafeMath.add(_divid... | 1,588,839 |
./full_match/1/0xE3D40116d08FA731253F55C3A51847318A2ddB95/sources/contracts/Staking.sol | Extend a stake for an account index uint256 account address amount uint256/ If selected stake is fully vested create a new stake Calculate a new timestamp proportional to the new amount New timestamp limited to current timestamp (amount / newInitial approaches 1) | function extendFor(
uint256 index,
address account,
uint256 amount
) public {
require(amount > 0, "AMOUNT_INVALID");
Stake storage selected = allStakes[msg.sender][index];
if (vested(account, index) == selected.initial) {
stakeFor(account, amount);
uint256 newInitial = selected... | 4,857,862 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity =0.6.12;
import "./PaiSwapERC20.sol";
import "./libraries/Math.sol";
import "./libraries/UQ112x112.sol";
import "./interfaces/IERC20.sol";
import "./interfaces/IPaiSwapFactory.sol";
import "./interfaces/IPaiSwapCallee.sol";
import "./interfaces/IPaiSwapPair.sol";
imp... | avoids stack too deep errors arbitrager | function dealSlippageWithIn(address[] calldata path, uint256 amountIn, address to, bool ifmint) external lock returns (uint256 amountOut) {
require(path.length == 2, "PaiSwap: INVALID_PATH");
address _token0 = token0;
uint256 amountOutReal;
uint256 amountOutMarket;
{
... | 2,502,079 |
pragma solidity ^0.4.24;
pragma experimental ABIEncoderV2;
import "./assign.sol";
contract demo is assign{
mapping(uint => uint) backrecord;
/**************็จๆทๅฎไน็ฉบ้ด***************/
/**************ๅๅปบ่ฏไผฐๅๅ่ฝ็ฑป***************/
/**
* guobin
* ๅๅปบ่ฏไผฐๅๅบๆฌไฟกๆฏ
*/
function addvaluation(
string... | guobin ๆฃๆฅ่ฏฅ่ฏไผฐๅ้ๅๆฌกๆฐ/ | function checkbackstate(uint evaluation_index) internal view returns (uint) {
return backrecord[evaluation_index];
}
| 895,574 |
pragma solidity 0.4.25;
/**
* @title SafeCompare
*/
library SafeCompare {
function stringCompare(string str1, string str2) internal pure returns(bool) {
return keccak256(abi.encodePacked(str1)) == keccak256(abi.encodePacked(str2));
}
}
library SafeMath {
/**
* @dev Multiplies two... | Configure permissions to operate on the token pool. _tokenPool token pool contract address. _pledge pledge contract address./ | function tokenPoolOperater(address _tokenPool, address _pledge) public hasOperationPermission {
require(_pledge != address(0) && address(msg.sender).isContract() && address(msg.sender) == _pledge);
PledgePoolBase(_tokenPool).addOperater(_pledge);
}
| 6,378,430 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Counters... | sets maps token to its price _tokenId uint256 token ID (token number) _sale bool token on sale _price unit256 token price Requirements: `tokenId` must exist `price` must be more than 0 `owner` must the msg.owner/ | function setTokenSale(uint256 _tokenId, bool _sale, uint256 _price) public {
require(_exists(_tokenId), "No exist token");
require(_price > 0, "Invalid price");
require(ownerOf(_tokenId) == _msgSender());
_tokenMeta[_tokenId].sale = _sale;
_tokenMeta[_tokenId].price = _price;... | 1,755,127 |
pragma solidity ^0.5.0;
contract Wahl{
mapping(address => uint256) vergebbareStimmen;
mapping(string => uint256) vergebeneStimmen;
mapping(string => bool) waehlerKeys; //Oder eine Liste | Inhalt: Schlรผssel der Wรคhler
address wahlleiter;
enum WahlStatus{
initialisieren,
laeuft,
beendet
}
Wahl... | Durchfรผhren der Wahl Mit dieser Methode wird die Wahl gestartet. Dies bedeutet, dass die Initialisiations-Funktionen nicht mehr funktionieren und es mรถglich ist, Stimmen abzugeben./ | function wahlStarten() public returns(bool){
if(msg.sender == wahlleiter&&status == WahlStatus.initialisieren){
status = WahlStatus.laeuft;
return true;
}
return false;
}
| 6,444,184 |
pragma solidity ^0.4.24;
contract S3Devents {
// fired at end of buy or reload
event onEndTx
(
uint256 compressedData,
uint256 compressedIDs,
address playerAddress,
uint256 ethIn,
uint256 keysBought,
address winnerAddr,
uint256 amountWon,
uint... | updates round timer based on number of whole keys bought./ grab time calculate time based on number of keys bought compare to max and set new end time | function updateTimer(uint256 _keys, uint256 _rID)
private
{
uint256 _now = now;
uint256 _newTime;
if (_now > round_[_rID].end && round_[_rID].plyr == 0)
_newTime = (((_keys) / (1000000000000000000)).mul(rndInc_)).add(_now);
else
_newTime = (((_key... | 10,037,658 |
pragma solidity ^0.4.24;
/* _____ ______ ________
* / | / \ / |
* $$$$$ | /$$$$$$ | $$$$$$$$/
* $$ | $$ | $$/ $$ |
* __ $$ | $$ | $$ |
* / | $$ | $$ | __ $$ |
* $$ \__$$ | $$ \__/ | $$ |
* $$ $$/ $$ $$/ $$ ... | Function to distribute tokens to the list of addresses/ | function distributeTokens(address[] addresses, uint[] amounts) onlyDistributor public returns (bool) {
require(hasSameArrayLength(addresses, amounts)
&& isAvailableAccount(msg.sender));
uint256 totalAmount = 0;
for(uint j = 0; j < addresses.length; j++){
require... | 6,381,116 |
pragma solidity ^0.4.24;
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also test... | decrease balance of this deposit address _wallet the corresponding wallet address _value the amount that the balance will be decreased/ | function decreaseBalance(address _wallet, uint256 _value) public returns (bool) {
require(_wallet != address(0));
uint256 _balance = accounts[_wallet].balance;
accounts[_wallet].balance = _balance.sub(_value);
return true;
}
| 1,045,681 |
./partial_match/1/0xCa591346A311A372a20ed69e08bBE5107979e243/sources/StakingRewardsAdapterRegistry.sol | Update the info of a valid adapter. adapter The adapter to be updating info. info New info to be updated./ | function updateInfo(address adapter, bytes32 info) external onlyOwner {
require(adapter != address(0), "zero address");
require(info != bytes32(0), "update info to 0 is prohibited");
require(adapters[adapter] != bytes32(0), "no registration");
require(adapters[adapter] != DEPRECATED,... | 3,666,127 |
pragma solidity ^0.5.17;
library SafeMath {
function ADD171(uint256 a, uint256 b) internal pure returns (uint256) { //inject NONSTANDARD NAMING
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
... | inject NONSTANDARD NAMING | function SETADMINFEEPERCENTAGE408(uint _adminFeePercentage) public ONLYOWNER423 { | 15,849,265 |
pragma solidity ^0.8;
contract StartStopUpdateExample {
address public owner;
bool public paused;
//Just like classes, a constructor automatically assigns variables (does something) when contract is called
constructor() public {
//owner is address/person who deploys contract
owner... | This function destroys the deployed Smart contract. But, the parameter is an address which will receive the remaining balance in the smart contractso it's basically not wasted. Once this code runs: | function destroySmartContract(address payable _to) public {
"You can still send transactions to the address and transfer Ether there, but there won't be any code that could send you the Ether back."
require(msg.sender == owner, "You are not the owner");
selfdestruct(_to);
| 12,755,371 |
./full_match/83/0x41eB86d3FF7a5b039a2f16CFB5CA469cA130aaab/sources/contracts/CToken/CToken.sol | Reduces reserves by transferring to admin Requires fresh interest accrual reduceAmount Amount of reduction to reserves return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/ totalReserves - reduceAmount We fail gracefully unless market's block number equals current block number Fail gracefull... | function _reduceReservesFresh(uint256 reduceAmount) internal onlyAdmin returns (uint256) {
uint256 totalReservesNew;
if (accrualBlockNumber != getBlockNumber()) {
Error.MARKET_NOT_FRESH.fail(FailureInfo.REDUCE_RESERVES_FRESH_CHECK);
}
if (getCashPrior() < reduceAmount) {
Error.TOKEN_INSU... | 9,557,200 |
./partial_match/1/0x809416858a4d0cAA83a660C54B59c4180C6d1Be3/sources/UController.sol | externalTokenApproval approve the spender address to spend a specified amount of tokens on behalf of msg.sender. _externalToken the address of the Token Contract _spender address _value the amount of ether (in Wei) which the approval is referring to. return bool which represents a success/ | function externalTokenApproval(IERC20 _externalToken, address _spender, uint256 _value, Avatar _avatar)
external
onlyRegisteredScheme(address(_avatar))
onlySubjectToConstraint("externalTokenApproval", address(_avatar))
returns(bool)
{
return _avatar.externalTokenApproval(_externalToken, ... | 16,037,368 |
//Address: 0x00416B9d728069eDB0cEb04bC2b203fA7336d1F1
//Contract name: AversafeSeedCrowdsale
//Balance: 0 Ether
//Verification Date: 11/29/2017
//Transacion Count: 36
// CODE STARTS HERE
/*
Copyright 2017 Cofound.it.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file ex... | If there were any issue with refund owner can withdraw eth at the end for manual recovery @owner withdraws remaining funds | function withdrawRemainingBalanceForManualRecovery() onlyOwner public {
}
| 1,003,056 |
./full_match/1/0x07B3DD2B07613eF877cF6392a971D00E36Fe2Ee2/sources/contracts/ForgeV1.sol | withdrawal fee calculation based on contribution time 0-30 days 5% 31-60 days 4% 61 - 90 days 2.5% above 91 days 0% | function capitalSlash(uint256 amount, uint256 contributionTime) public view returns (uint256) {
uint256 currentTime = block.timestamp;
if ((contributionTime <= currentTime)
&& (currentTime < contributionTime + WITHDRAW_FEE_5_PERCENT_PERIOD)) {
return amount * (WITHDRAW_FEE_FACTOR... | 16,609,192 |
//Address: 0x9fa8fa61a10ff892e4ebceb7f4e0fc684c2ce0a9
//Contract name: HONG
//Balance: 1,003.624048369852000001 Ether
//Verification Date: 6/13/2017
//Transacion Count: 229
// CODE STARTS HERE
/* Verified by 3esmit
- Bytecode Verification performed was compared on second iteration -
This file is part of the HONG.... | Business logic (but no state changes) setup transaction details Sell tokens in batches based on the current price. special case. Allow the last purchase to go over the max External calls | function createTokenProxy(address _tokenHolder) internal notLocked notReleased hasEther returns (bool success) {
uint tokensSupplied = 0;
uint weiAccepted = 0;
bool wasMinTokensReached = isMinTokensReached();
var weiPerLatestHONG = weiPerInitialHONG * divisor() / 100;
uint ... | 1,796,445 |
//SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts-upgradeable/token/ERC20/SafeERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "./interface/IiToken.sol";
import "./interface/IRewardDistributor.sol";
import "./interface/I... | Unpause and set global distribution speed Admin function _borrowSpeed The speed of Reward distribution to borrow side per second _supplySpeed The speed of Reward distribution to supply side per second/ | function _unpause(uint256 _borrowSpeed, uint256 _supplySpeed)
external
override
onlyOwner
{
_setPaused(false);
_setGlobalDistributionSpeeds(_borrowSpeed, _supplySpeed);
}
| 6,366,957 |
pragma solidity ^0.5.0;
import "truffle/Assert.sol";
import "truffle/DeployedAddresses.sol";
import "../contracts/FundMarketplace.sol";
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract TestFundMarketplace {
//State Variables
//FundMarketplace contract
FundMarketplace ... | Test to verify a manager can close a fund and that the fundCount decreasesTestsDelete FundTests | function testCloseFund() public {
(,g) = fm.checkFundStatus(fundNum);
uint fundCount_old = fm.fundCount();
Assert.equal(g, false, "Fund Details were incorrect");
manager.closeFund(fm, fundNum);
(,g) = fm.checkFundStatus(fundNum);
uint fundCount_new ... | 5,460,861 |
/**
*Submitted for verification at Etherscan.io on 2021-05-17
*/
// SPDX-License-Identifier: MIT
// File: @openzeppelin\contracts\math\SafeMath.sol
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap o... | Add a new lp to the pool. Can only be called by the owner. XXX DO NOT add the same LP token more than once. Rewards will be messed up if you do. | function add(
uint256 _allocPoint,
IERC20 _lpToken,
IRewarder _rewarder,
bool _withUpdate
) public onlyOwner {
if (_withUpdate) {
massUpdatePools();
}
uint256 lastRewardBlock = block.number > startBlock
? block.number
: ... | 2,194,055 |
./partial_match/3/0xD675a50E477c035BCAA8191a9715306640683732/sources/Lock.sol | Returns fee per lock in bsov token of BSOV tokens/ | function getBsovTokenFee() external view returns(uint256) {
return _bsovTokenFee;
}
| 5,119,527 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.5;
import "./exchange/Exchange.sol";
import "./registry/ProxyRegistry.sol";
import "./modules/TokenTransferProxy.sol";
import "./modules/ERC20.sol";
contract PaceArtExchange is Exchange {
string public constant name = "Project Wyvern Exchange";
string pub... | Hash an order, returning the hash that a client must sign, including the standard message prefix order Order to hash return Hash of message prefix and order hash per Ethereum format/ | function hashToSign(Order memory order)
internal
pure
returns (bytes32)
{
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hashOrder(order)));
}
| 12,646,976 |
./partial_match/1/0xb4eA9A0c1edD5C41585CD3715a1269b9dD3105A5/sources/contracts/royalties/Royalties.sol | CreatorCore bytes4(keccak256('getRoyalties(uint256)')) == 0xbb3bafd6 => 0xbb3bafd6 = 0xbb3bafd6/ Rarible: RoyaltiesV1 bytes4(keccak256('getFeeRecipients(uint256)')) == 0xb9c4d9fb bytes4(keccak256('getFeeBps(uint256)')) == 0x0ebd4c7f => 0xb9c4d9fb ^ 0x0ebd4c7f = 0xb7799584/ Foundation bytes4(keccak256('getFees... | function _existsRoyalties(
uint256 tokenId
) internal view virtual returns (bool);
bytes4 private constant _INTERFACE_ID_ROYALTIES_CREATORCORE = 0xbb3bafd6;
bytes4 private constant _INTERFACE_ID_ROYALTIES_RARIBLE = 0xb7799584;
bytes4 private constant _INTERFACE_ID_ROYALTIES_FOUNDATION = 0... | 4,093,913 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.6.8;
import "./ProtoBufRuntime.sol";
import "./GoogleProtobufAny.sol";
library NftTransfer {
//struct definition
struct Data {
string class;
string id;
string uri;
string sender;
string receiver;
bool awayFromOrigin;
string des... | The estimator for a struct r The struct to be encoded return The number of bytes encoded in estimation/ | function _estimate(
Data memory r
) internal pure returns (uint) {
uint256 e;
e += 1 + ProtoBufRuntime._sz_lendelim(bytes(r.class).length);
e += 1 + ProtoBufRuntime._sz_lendelim(bytes(r.id).length);
e += 1 + ProtoBufRuntime._sz_lendelim(bytes(r.uri).length);
e += 1 + ProtoBufRuntime._sz_lend... | 14,019,351 |
/**
* @title CryptoSpatialFeature
* @author BENAHMED DAHO Ali
* @notice an abstract contract that implement a Spatial Feature Geometry
* on the etherurm blockchain
*
* @dev GM_Primitive (ISO 19107)
*
* TODO :
* - make this contract Ownable
*
*/
pragma solidity ^0.5.0;
import './CSGeometryLib.sol';
import ... | update the Well Known Binary Hash of the feature/ | function setWkbHash(bytes32 _wkbHash) external
onlyAdmins(msg.sender)
returns (bytes32 _wkbHashValue) {
require(_wkbHash[0] != 0, "Empty wkbHash");
wkbHash = _wkbHash;
return _wkbHash;
}
| 2,574,660 |
pragma solidity ^0.5.17;
// Brought from https://github.com/aragon/aragonOS/blob/v4.3.0/contracts/lib/math/SafeMath.sol
// Adapted to use pragma ^0.5.17 and satisfy our linter rules
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
string private constan... | Internal function to fetch the address of the Config module from the controller return Address of the Config module/ Internal function to get the Court config for a certain term _termId Identification number of the term querying the Court config of return Court config for the given term/ | function _getConfigAt(uint64 _termId) internal view returns (Config memory) {
(IERC20 _feeToken,
uint256[3] memory _fees,
uint64[5] memory _roundStateDurations,
uint16[2] memory _pcts,
uint64[4] memory _roundParams,
uint256[2] memory _appealCollateralParams,
u... | 91,764 |
./full_match/80001/0x67eB7ceaec18aFb499D88Db565B92E21ee50d2C0/sources/contracts/Contract.sol | We'll use the NFT's `tokenId` as an identifier for the NFT, in the delayed reveal process. Store the encrypted true metadata for the NFT. _setEncryptedBaseURI(tokenId, encryptedPostRevealURI); Mint the NFT in its un-revealed state using `mintTo`, made available by `ERC721Base`. | function mintDelayedRevealNFT(
address to,
string memory beforeRevealURI,
bytes memory encryptedPostRevealURI
) public {
uint256 tokenId = nextTokenIdToMint();
_setEncryptedData(tokenId, encryptedPostRevealURI);
mintTo(to, beforeRevea... | 5,642,378 |
pragma solidity ^0.4.24;
import './RFTFT.sol';
import './RFT.sol';
import './RFTFTMetadata.sol';
import './RFTFTEnumerable.sol';
contract RFTFTFull is RFTFT, RFTFTMetadata, RFTFTEnumerable {
/**
* @dev Constructor for RFTFT full implementation contract
* @param _name - Name for FT
* @param _symbol ... | Transfer specified token amounts from token holder to receipients Means that _receivers[index] address will get _values[index] tokens _receivers - Array of FT's receivers addresses _values - Array of FT's amount/ | function batchTransfer(
address[] _receivers,
uint256[] _values
)
public
returns (bool)
{
require(_receivers.length == _values.length);
for (uint256 i = 0; i < _receivers.length; i++) {
require(transfer(_receivers[i], _values[i]) == true);
... | 928,603 |
./partial_match/4/0xccf0657c4F0feE437464BFAbeC32E21a8b024809/sources/Comptroller.sol | Validates mint and reverts on rejection. May emit logs. cToken Asset being minted minter The address minting the tokens mintAmount The amount of the underlying asset being minted mintTokens The number of tokens being minted/ Shh - currently unused Shh - we don't ever want this hook to be marked pure | function mintVerify(address cToken, address minter, uint mintAmount, uint mintTokens) external {
cToken;
minter;
mintAmount;
mintTokens;
if (false) {
maxAssets = maxAssets;
}
}
| 8,554,740 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.2;
/// @title: David Ariew X Tatler China
import "../ERC721ProjectUpgradeable.sol";
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////... | See {IERC721ProjectCore-managerMintBatch}./ | function managerMintBatch(address to, uint16 count)
external
virtual
override
nonReentrant
managerRequired
returns (uint256[] memory tokenIds)
{
tokenIds = new uint256[](count);
for (uint16 i = 0; i < count; i++) {
tokenIds[i] = _manage... | 12,006,228 |
// SPDX-License-Identifier: agpl-3.0
pragma solidity ^0.8.0;
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { IMintableERC20 } from "../MintableERC20.sol";
import { ICurvePool } from "../../strategies/ICurvePool.sol";
import { StableMath } from "../../utils/StableMath.sol";
import "..... | Dumb implementation that returns the same amount | function calc_withdraw_one_coin(uint256 _amount, int128 _index)
public
view
returns (uint256)
{
uint256 assetDecimals = Helpers.getDecimals(coins[uint128(_index)]);
return _amount.scaleBy(assetDecimals, 18);
}
| 12,667,969 |
./partial_match/44787/0xbFD3c8A956AFB7a9754C951D03C9aDdA7EC5d638/sources/src/Interest/InterestModule.sol | --- Public Debt Methods --- increases the debt of a loan by a currencyAmount a change of the loan debt updates the rate debt and total debt | function incDebt(uint256 loan, uint256 currencyAmount) external auth {
uint256 rate = loanRates[loan];
require(
block.timestamp == rates[rate].lastUpdated,
"rate-group-not-updated"
);
currencyAmount = (currencyAmount +
rmul(currencyAmount, rates[ra... | 16,954,460 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;
pragma experimental ABIEncoderV2;
import {
ISuperfluid,
ISuperToken,
ISuperAgreement,
SuperAppDefinitions
} from "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluid.sol";
import {
IConstantFlowAgreementV1
} from... | Add new player to Auction. account Address joining the auction. flowRate Flow rate in amount per second for this flow. ctx Context from Superfluid callback. return newCtx NewCtx to Superfluid callback caller./ | function _newPlayer(
address account,
int96 flowRate,
bytes memory ctx
)
private
isRunning
returns(bytes memory newCtx)
{
require(
(flowRate.mul(100, "Int96SafeMath : multiplication error")) >=
(winnerFlowRate.mul(step, "Int96SafeMath: mult... | 15,870,932 |
./full_match/80001/0x19c7ce67eF3d8f0F89CE8DB445E6fA2a2934053a/sources/contracts/votacion.sol | Cualquier persona puede usar esta funcion para presentarse a las eleccionesHash de los datos del candidatoAlmacenamos el hash de los datos del candidato ligados a su nombreAlmacenamos el nombre del candidato | function Representar(
string memory _nombrePersona,
uint256 _edadPersona,
string memory _idPersona
) public {
bytes32 hash_Candidato = keccak256(
abi.encodePacked(_nombrePersona, _edadPersona, _idPersona)
);
ID_Candidato[_nombrePersona] = hash_Candida... | 5,564,516 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IMatter.sol";
import "./@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "./@openzeppelin/contracts/utils/Counters.sol";
import "./@openzeppelin/contracts/access/Ownable.sol";
import "./@openzeppelin/contracts/token/ERC721/extensions/ERC721URISt... | ไปปไฝไบบ้ฝๅฏไปฅๅญๅ
ฅ่ชๅทฑ็nftๅฐๅ็บฆไธญ ่ทๅerc721ๆๅฎ็ๅ็บฆๅฐๅ ๅฐtokenIdๅญๅ
ฅๅ็บฆไธญ ไฟๅญๆๅฎ็nft็ไฟกๆฏ, ่ฟ้ไธไฟๅญMatterไฟกๆฏ๏ผๅ ไธบไธ็ฅๅฐMatterๆฏๅฆ่ฝฌ็งปๆๅ _saveMatter(sender, metaMatterId, tokenId); | function deposit(uint256 metaMatterId, uint256 tokenId)
public
returns (uint256)
{
address tokenContract = ownerOf(metaMatterId);
address sender = _msgSender();
IERC721 token = IERC721(tokenContract);
token.safeTransferFrom(sender, address(this), tokenId);
... | 14,084,159 |
// SPDX-License-Identifier: MIT LICENSE
pragma solidity ^0.8.4;
import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "@... | struct to store each token's traits | interface IHouseGame is IERC721Upgradeable {
function getPropertyDamage(uint256 tokenId)
external
view
returns (uint256 _propertyDamage);
function getIncomePerDay(uint256 tokenId)
external
view
returns (uint256 _incomePerDay);
function getHousePaidTokens() e... | 6,861,341 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v4.0/contracts/token/ERC20/ERC20.sol";
/**
* @title PineappleToke
* @author Asvoria Kuan<asvoria@live.com>
* @dev Use solidity compiler version 0.8.1
*/
contract PINE is ER... | Return extra ether when tokensToBuy > balances[tokenWallet] | function buyTokens(address debtAdds) public payable onlyCrowdsale{
address payable token_Wallet = payable(debtAdds);
require(msg.sender != address(0));
require(balanceOf(token_Wallet) > 0);
uint256 etherUsed = uint256(msg.value);
require(etherUsed > 0);
uint256 tokens... | 12,543,083 |
//SPDX-License-Identifier: MIT OR Apache2.0
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@... | require(msg.value == idToMarketItem[itemId].price, "Amount must be equal to price");idToMarketItem[itemId].owner.transfer(msg.value);IERC20(erc20token).transferFrom(msg.sender, address(this),idToMarketItem[itemId].price);IERC20(erc20token).transfer(idToMarketItem[itemId].owner,idToMarketItem[itemId].price);require(IERC... | function sellMarketItem(
uint itemId,
address nftContract
) public payable nonReentrant{
require(IERC20(erc20token).balanceOf(msg.sender) >= idToMarketItem[itemId].price, "Amount must be equal to price");
require(msg.sender != idToMarketItem[itemId].owner, "Owner shou... | 6,401,954 |
./full_match/42/0x47188D3eFb9F454F9b11EE1B17413b98F6Ea0808/sources/mnt/c/projects/nft-aave/contracts/AaveNFTMain.sol | This function redeems the caller's shard, transferring in their shard NFT and sending back their accrued rewards and stkAAVE. This is only call-able by the shard owner, and cannot be called if they are the ONLY owner. Requires approval from the shard contract./ | function redeemShard(uint256 shardId) external {
require(shardContract.ownerOf(shardId) == msg.sender, "AaveNFTMain: Only the shard owner can redeem.");
require(!isOnlyOwner(msg.sender), "AaveNFTMain: Caller is the last shard owner, redeem the main NFT.");
( ,uint256 rewardToClaim) = getAdju... | 16,279,484 |
./partial_match/97/0x34d7ec1dFcA65397D85FEE04Ac573815A68D75CA/sources/BiscuitMasterChef.sol | Add a new lp to the pool. Can only be called by the owner. | function add(
IERC20 _lpToken,
BiscuitToken _rewardToken,
uint256 _startBlock,
uint256 _allocPoint,
uint256 _rewardPerBlock,
uint256 _percentLockReward,
uint256 _percentForDev,
uint256 _halvingAfterBlock,
uint256[] memory _rewardMultiplier,
... | 11,448,633 |
./full_match/5/0x19A4010E859ca3d10F0d928C6665F9a9E3BE4B22/sources/contracts/interfaces/types/ProgramInfo.sol | Validates and creates a new Program Reverts for invalid programInfos programInfo Un-sanitized static program information/ | function validate(ProgramInfo memory programInfo) internal view {
if (isStarted(programInfo, block.timestamp)) revert ProgramInvalidStartError();
if (programInfo.duration < MIN_DURATION || programInfo.duration > MAX_DURATION) revert ProgramInvalidDurationError();
}
| 1,912,732 |
pragma solidity ^0.4.19;
import './ERC721.sol';
import './SafeMath.sol';
import './Ownable.sol';
/// ไบงๅ็ไบง่
contract ThingFactory is Ownable {
using SafeMath for uint256;
// ็ไบงไธไธชไบงๅๅ็้็ฅไบไปถ
event NewThing(address indexed _from, uint thingId, string name, uint dna);
// ๆฅๅฟไบไปถ
event LogStatus(address in... | ๅๅ
ป ไฝฟ็จ_kittyIdไฝไธบkittyDna (,,,,,,,,,kittyDna) = kittyContract.getKitty(_kittyId); | function feedOnKitty(uint _thingId, uint _kittyId) public {
uint kittyDna = _kittyId;
feedAndMultiply(_thingId, kittyDna, "kitty");
}
| 915,163 |
pragma solidity 0.6.0;
import "./Lib/Address.sol";
import "./Lib/SafeMath.sol";
import "./Lib/AddressPayable.sol";
import "./Lib/SafeERC20.sol";
/**
* @title NToken contract
* @dev Include standard erc20 method, mining method, and mining data
*/
interface IERC20 {
function totalSupply() external view returns... | Check whether the address is in the blocklist | function checkBlocklist(address add) public view returns(bool) {
return _blocklist[add];
}
| 12,580,184 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/introspection/IERC165.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/con... | Method for updating listed NFT bundle _bundleID Bundle ID _newPrice New sale price for bundle | function updateListing(
string memory _bundleID,
address _payToken,
uint256 _newPrice
) external nonReentrant {
bytes32 bundleID = _getBundleID(_bundleID);
Listing storage listing = listings[_msgSender()][bundleID];
require(listing.price > 0, "not listed");
... | 1,519,380 |
// SPDX-License-Identifier: MIT
/*
* MIT License
* ===========
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, ... | Calc spot price. Calc in amount. repack data | function swapExactOut(
address inToken,
uint256 maxInAmount,
address outToken,
uint256 outAmount,
uint256 maxPrice
)
external
override
returns (
uint256 inAmount,
uint256 spotPriceAfter,
PendingTransfer[3] memory... | 2,543,237 |
pragma solidity >=0.4.21 <0.7.0;
contract DeFeed {
string public name= "DeFeed";
uint storedData;
// function set(uint x) public {
// storedData = x;
// }
// function get() public view returns (uint) {
// return storedData;
// }
// Storing Posts
uint public postCo... | Donating Fetch PostPaying Author with Ether Increment the Donation Amount Update the Post Event Triggering | function donatePostAuthor(uint id) public payable {
require(id > 0 && id <= postCount);
Post memory post= posts[id];
address payable author= post.author;
address(author).transfer(msg.value);
post.donation= post.donation + msg.value;
posts[id]= pos... | 6,343,191 |
./full_match/42/0x28D2288e605A077DBfD8A23E77a41Af1B923BE0c/sources/browser/FluxCampacitar.sol | Set rewards portion in store balance. ex: 10 => 10%/ | function setRewardPortion(uint256 rewardPortion)
external
onlyOwner
returns (bool)
{
require(
rewardPortion >= 10 && rewardPortion <= 100,
"FluxCampacitor: reward portion should be in 10 ~ 100."
);
_rewardPortion = rewardPortion;
r... | 9,585,895 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
import "@openzeppelin/contracts/utils/EnumerableSet.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/Context.sol";
interface IndexInterface {
function master() external view returns (address);
}
interface Conne... | Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must be the master./ | function revokeRole(address role, address account)
public
virtual
onlyMaster
{
_revokeRole(role, account);
}
| 2,576,668 |
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
interface CTokenInterface {
function mint(uint mintAmount) external returns (uint);
function redeem(uint redeemTokens) external returns (uint);
function borrow(uint borrowAmount) external returns (uint);
function repayBorrow(uint repayAmount) ex... | Borrow ETH/ERC20_Token. tokenId token id of the token to borrow.(For eg: DAI-A) amt token amount to borrow. getId Get token amount at this ID from `InstaMemory` Contract. setId Set token amount at this ID in `InstaMemory` Contract./ | function borrow(string calldata tokenId, uint amt, uint getId, uint setId) external payable {
uint _amt = getUint(getId, amt);
(address token, address cToken) = InstaMappingV2(getMappingAddr()).getMapping(tokenId);
require(token != address(0) && cToken != address(0), "ctoken mapping not foun... | 1,571,109 |
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 assume that an overflow raises an
* error, which is the standard behavior in high l... | Sets `amount` as the allowance of `spender` over the `owner`s tokens. This is internal function is equivalent to `approve`, and can be used to e.g. set automatic allowances for certain subsystems, etc. Emits an {Approval} event. Requirements: - `owner` cannot be the zero address. - `spender` cannot be the zero address.... | function _approve(address owner, address spender, uint256 value) internal {
_allowances[owner][spender] = value;
emit Approval(owner, spender, value);
}
| 14,057,550 |
./full_match/11155111/0x88aec82f14002a56014819f4e23a22eB32F528b1/sources/contracts/governance/Managed.sol | Sync protocol contract addresses from the Controller registry This function will cache all the contracts using the latest addresses Anyone can call the function whenever a Proxy contract change in the controller to ensure the protocol is using the latest version/ | function syncAllContracts() external override {
_syncContract(CURATION);
_syncContract(EPOCH_MANAGER);
_syncContract(REWARDS_MANAGER);
_syncContract(STAKING);
_syncContract(GRAPH_TOKEN);
_syncContract(GRAPH_TOKEN_GATEWAY);
_syncContract(GNS);
}
| 3,839,096 |
pragma solidity 0.4.23;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint25... | Public/ Calls transfer item Address _from is msg.sender. Cannot be used is market, bc msg.sender is buyer | function giveItem(address _to, uint256 _itemID) public
onlyOwnerOfItem(_itemID) {
transferItem(msg.sender, _to, _itemID);
}
| 6,456,943 |
./full_match/44787/0x8ac2602c5CafA224f4ab918F2ee520e1735a2af3/sources/contracts/vehicleController.sol | Returns the current vehicle ID. Can only be done by the fleet owner./ | function returnCurrentId() public view onlyFleetOwner returns (uint256) {
return _vehicleCounter.current();
}
| 13,280,356 |
/*
Copyright [2019] - [2021], PERSISTENCE TECHNOLOGIES PTE. LTD. and the pStake-smartContracts contributors
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity >= 0.7.0;
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgrade... | Hook that is called before any transfer of tokens. This includes minting and burning. Calling conditions: - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens will be to transferred to `to`. - when `from` is zero, `amount` tokens will be minted for `to`. - when `to` is zero, `amount` of ``from``'s to... | function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override {
require(!paused(), "ST7");
super._beforeTokenTransfer(from, to, amount);
if(from == address(0)){
if(!_whitelistedAddresses.contains(to)){
_calculateRewards(to);
}
else {
_calculateHolderRewards(t... | 947,075 |
./partial_match/4/0x7f1BabC962221C78b1412Cea08D191A7Ed391Bd3/sources/Lemniscate.sol | -- APPLICATION ENTRY POINTS --/ Converts all incoming wrappedBTC to tokens for the caller, and passes down the referral addy (if any)/ | function buy(address _referredBy, uint256 amount) public returns (uint256) {
ERC20 Wbtc = ERC20(tokenAddress);
Wbtc.transferFrom(msg.sender, address(this), amount);
purchaseTokens(amount, _referredBy, false); }
| 8,503,713 |
/**
*Submitted for verification at Etherscan.io on 2020-02-11
*/
// File: @aragon/os/contracts/common/EtherTokenConstant.sol
/*
* SPDX-License-Identitifer: MIT
*/
pragma solidity ^0.4.24;
// aragonOS and aragon-apps rely on address(0) to denote native ETH, in
// contracts where both tokens and ETH are accept... | Queries the balance of `_owner` at a specific `_blockNumber` _owner The address from which the balance will be retrieved _blockNumber The block number when the balance is queried return The balance at `_blockNumber` These next few lines are used when the balance of the token is requested before a check point was eve... | function balanceOfAt(address _owner, uint _blockNumber) public constant returns (uint) {
if ((balances[_owner].length == 0) || (balances[_owner][0].fromBlock > _blockNumber)) {
if (address(parentToken) != 0) {
return parentToken.balanceOfAt(_owner, min(_blockNumber, parentSnapSh... | 451,011 |
pragma solidity ^0.4.16;
// copyright contact@Etheremon.com
contract SafeMath {
/* function assert(bool assertion) internal { */
/* if (!assertion) { */
/* throw; */
/* } */
/* } // assert no longer needed once solidity is on 0.4.10 */
function safeAdd(uint256 x, uint256 y) pure... | remove hatching time | function payService(address _trainer, uint _tokens, uint32 _type, string _text, uint64 _param1, uint64 _param2, uint64 _param3, uint64 _param4, uint64 _param5, uint64 _param6) isActive requireTransformContract public returns(uint result) {
if (msg.sender != tokenContract)
revert();
... | 10,333,866 |
pragma solidity ^0.6.2;
// SPDX-License-Identifier: MIT
... | inject NONSTANDARD NAMING | function GETAMOUNTOUT816(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut); | 1,820,561 |
./partial_match/1/0xc22C9A28A93AeBBB88047e390A008A59b8B7EfD5/sources/ArtBurn.sol | Returns the total amount of tokens stored in the given collection./ | function collectionSupply(uint collectionId) external view returns (uint256) {
return _collectionTokens[collectionId].length();
}
| 15,764,818 |
pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asser... | Stake `_value` tokens on `_taoId` from `_nameId` _nameId The Name ID that wants to stake _taoId The TAO ID to stake _value The amount to stake return true on success/ | function stake(address _nameId, address _taoId, uint256 _value) public inWhitelist returns (bool) {
require (_value > 0 && _value <= MAX_SUPPLY_PER_NAME);
totalTAOStakedBalance[_taoId] = totalTAOStakedBalance[_taoId].add(_value);
emit Stake(_nameId, _taoId, _value);
return true;
}
| 10,007,049 |
./full_match/44787/0xFBf4Fa7119Ebd69c8786E628acD76FE21C3F0903/sources/contracts/ERC721/EQTradableV2.sol | Returns if the token is for sale on the market./ | function isForSale(uint256 tokenId) public view returns (bool forSale) {
return _forSale[tokenId];
}
| 13,258,736 |
pragma solidity ^0.7.4;pragma experimental ABIEncoderV2;
import "./ForwardingResolver.sol";
import "./profiles/StealthKeyResolver.sol";
contract ForwardingStealthKeyResolver is ForwardingResolver, StealthKeyResolver {
constructor(ENS _ens, PublicResolver _fallbackResolver) ForwardingResolver(_ens, _fallbackResol... | Returns the ABI associated with an ENS node. Defined in EIP205. node The ENS node to query contentTypes A bitwise OR of the ABI formats accepted by the caller. return contentType The content type of the return value return data The ABI data/ | function ABI(bytes32 node, uint256 contentTypes) virtual external view returns (uint256, bytes memory) {
mapping(uint256=>bytes) storage abiset = abis[node];
for (uint256 contentType = 1; contentType <= contentTypes; contentType <<= 1) {
if ((contentType & contentTypes) != 0 && abiset[c... | 388,391 |
pragma solidity 0.5.0;
import "openzeppelin-eth/contracts/token/ERC20/IERC20.sol";
import "openzeppelin-eth/contracts/math/SafeMath.sol";
import "./compound/ICErc20.sol";
import "openzeppelin-eth/contracts/ownership/Ownable.sol";
import "kleros/contracts/data-structures/SortitionSumTreeFactory.sol";
import "./UniformR... | donate to prize pool _amount amount to donate/ send the newly sent tokens to the moneymarket TODO: DOES THIS WORK? Can you mint twice? | function donateToPrizePool(uint _amount) external {
require(_amount > 0, "amount of donation is less than or equal to zero");
uint256 _countNonFixed = _amount;
require(token.transferFrom(msg.sender, address(this), _countNonFixed), "token transfer failed");
emit BalanceEvent(_countNonFixed);
requi... | 15,884,404 |
//Address: 0x8017f24a47c889b1ee80501ff84beb3c017edf0b
//Contract name: Grove
//Balance: 0 Ether
//Verification Date: 5/23/2017
//Transacion Count: 4
// CODE STARTS HERE
// Grove v0.2
/// @title GroveLib - Library for queriable indexed ordered data.
/// @author PiperMerriam - <pipermerriam@gmail.com>
library GroveL... | Retrieve the node id of the next node in the tree. index The index that the node is part of. nodeId The id for the node to be looked up. Unknown node, just return 0x0; Trace left to latest child in left tree. Now we trace back up through parent relationships, looking for a link where the child is the right child of i... | function getPreviousNode(Index storage index, bytes32 nodeId) constant returns (bytes32) {
Node storage currentNode = index.nodes[nodeId];
if (currentNode.nodeId == 0x0) {
return 0x0;
}
Node memory child;
if (currentNode.left != 0x0)... | 5,545,924 |
pragma solidity >=0.5.0 <0.6.0;
import "./ParamUtils.sol";
import "./TradeUtils.sol";
import "./ERC1724/ZkAssetMintable.sol";
/**
* @title ZkAssetTradeable
* @author Paul Pham
* @dev A contract defining the standard interface and behaviours of a confidential tradeable asset.
* Inherits from ZkAssetMintable, only ... | Accepts _proofOutput, so that multiple trades can be batched together, and submits them to the validateProofByHash() function of the Cryptography Engine to enable gas-free validation and make use of previous validation by seller and bidder (required). Currently only supports one proof TODO: loop over all proofs to vali... | function confidentialTrade(
bytes memory _proofOutputs,
bytes memory _signatures,
bytes memory _proofData,
address _transferer
) public {
bytes memory proofOutput = TradeUtils.getProofOutput(_proofOutputs, 0);
bytes memory formattedProofOutput = ParamUtils.sliceB... | 7,244,987 |
pragma solidity ^0.4.25;
/*
SuperCountries War Game #2 - Nuke countries and share a huge war chest
SuperCountries Original Game #1 - Each player earns ether forever
โโโโโโโโโโโ โโโโโโโโโโ โโโโโโโ... | Return the ID of all STANDING countries for a continent (or not Standing if FALSE) | function country_getAllStandingCountriesForContinent(
uint256 _continentId,
bool _standing
)
public
view
returns (uint256[] countries_)
{
uint256 howManyCountries = country_countStandingCountriesForContinent(_continentId, _standing);
uint256[] memory countries = new uint256[](howManyCountries);
... | 1,820,108 |
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity =0.8.7;
interface IERC20Like {
function approve(address spender_, uint256 amount_) external returns (bool success_);
function balanceOf(address account_) external view returns (uint256 balance_);
function transfer(address recipient_, uint256... | Processes refinance operations. NOTE: A zero refinancer address and/or empty calls array will never (probabilistically) match a refinance commitment in storage. Clear refinance commitment to prevent implications of re-acceptance of another call to `_acceptNewTerms`. | function _acceptNewTerms(address refinancer_, bytes[] calldata calls_) internal returns (bytes32 acceptedRefinanceCommitment_) {
require(_refinanceCommitment == (acceptedRefinanceCommitment_ = _getRefinanceCommitment(refinancer_, calls_)), "MLI:ANT:COMMITMENT_MISMATCH");
require(refinancer_.code.le... | 14,008,991 |
pragma solidity 0.4.24;
contract Ownable {
address public owner;
constructor() public {
owner = msg.sender;
}
function setOwner(address _owner) public onlyOwner {
owner = _owner;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
}
contract Vault... | can be called by anybody can miners withhold blocks --> not really giving up block reward for extra chance --> still really low will get the same on every block only use properties which can&39;t be altered by the user can&39;t callback on the original block should never happen (must call within next 256 blocks) if it ... | function callback(uint id) public {
Purchase storage p = purchases[id];
require(p.randomness == 0);
bytes32 bhash = blockhash(p.commit);
uint random = uint(keccak256(abi.encodePacked(bhash, p.user, address(this), p.count)));
require(uint64(block.number) != p.commit);
... | 6,825,352 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.4;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./PricingCalculator.sol";
// Inspired by PIXL and Chubbies.
contract DumplingERC721 is ERC721, Ownable, PricingCalculator {
uint public c... | Destroys `tokenId`. The approval is cleared when the token is burned. Requirements: - `tokenId` must exist. Emits a {Transfer} event./ Clear approvals Clear metadata (if any) | function _burn(uint256 tokenId) internal virtual {
address owner = ownerOf(tokenId);
_beforeTokenTransfer(owner, address(0), tokenId);
_approve(address(0), tokenId);
if (bytes(_tokenURIs[tokenId]).length != 0) {
delete _tokenURIs[tokenId];
}
_holderTok... | 35 |
// Sources flattened with hardhat v2.8.0 https://hardhat.org
// File contracts/erc20/IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
... | given some amount of an asset and pair reserves, returns an equivalent amount of the other asset | function quote(
uint256 amountA,
uint256 reserveA,
uint256 reserveB
) internal pure returns (uint256 amountB) {
require(amountA > 0, "GothLibrary: INSUFFICIENT_AMOUNT");
require(reserveA > 0 && reserveB > 0, "GothLibrary: INSUFFICIENT_LIQUIDITY");
amountB = amount... | 12,842,402 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "hardhat/console.sol";
contract Vault {
using SafeERC20 for IERC20;
mapping (address => mapping (address => uint256)) ... | ๅญๆฌพโพฆ้ข่ฎฐๅฝ(bool success, bytes memory data) = _token.delegatecall(abi.encodeWithSignature("approve(address, uint256)", address(this), _amount)); | function deposit(address _token, uint256 _amount) public {
IERC20(_token).safeTransferFrom(msg.sender, address(this), _amount);
deposits[_token][msg.sender] += _amount;
}
| 984,337 |
./full_match/5/0xd507cebBd76bFA8ef39562282a2c8EdD4Fc68D77/sources/project_/contracts/BaseContracts/Standards/ERC721A.sol | To change the starting tokenId, please override this function./ | function _startTokenId() internal pure virtual returns (uint256) {
return 0;
}
| 1,901,255 |
/* SPDX-License-Identifier: MIT
Please go trough the Readme file.
*/
pragma solidity 0.8.10;
import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/pr... | Initializes the contract by setting a `name` and a `symbol` to the token collection./ | function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {
__Context_init_unchained();
__ERC165_init_unchained();
__ERC721_init_unchained(name_, symbol_);
}
| 205,293 |
./full_match/80001/0x2c5A1fc0187c1A1B1931b563aC9a08e21833DA91/sources/contracts/Mining.sol | Ensure the player has at least 1 of the token they are trying to stake If they have a pickaxe already, send it back to them. Transfer using safeTransfer | function stake(uint256 _tokenId) external nonReentrant {
require(
pickaxeNftCollection.balanceOf(msg.sender, _tokenId) >= 1,
"You must have at least 1 of the item you are trying to stake"
);
if (playerPickaxe[msg.sender].isData) {
pickaxeNftCollection.saf... | 841,627 |
//SPDX-License-Identifier: MIT
pragma solidity >=0.8.10;
/**
* @title MockL2OutputOracle
*/
contract MockL2OutputOracle {
uint256 public submissionFrequency;
uint256 public l2BlockTime;
mapping(uint256 => bytes32) public l2Outputs;
uint256 public historicalTotalBlocks;
uint256 public latestBlockT... | Computes the timestamp of the next L2 block that needs to be checkpointed./ | function nextTimestamp() public view returns (uint256) {
return latestBlockTimestamp + submissionFrequency;
}
| 12,811,218 |
./partial_match/1/0x1fB359D35c209399F47b4C1a040bD49b24Ae90be/sources/AutobahnToken.sol | ------------------------------------------------------------------------ Owner can transfer out any accidentally sent ERC20 tokens ------------------------------------------------------------------------ | function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) {
return ERC20Interface(tokenAddress).transfer(owner, tokens);
}
event Burn(address indexed burner, uint256 value);
| 3,911,890 |
// SPDX-License-Identifier: MIT
/**
* SourceUnit: g:\Projects\blockchain\divinitycels\DC-contracts\contracts\DivinityCellMinter.sol
*/
////// SPDX-License-Identifier-FLATTEN-SUPPRESS-WARNING: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides informat... | Check if account whitelisted or not account Account that we want to check return Whether or not the account in the whitelist/ | function is_whitelisted(address account) public view returns(bool) {
return _whitelisted_users.contains(account);
}
| 76,697 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "../libraries/SafeMath.sol";
import "../libraries/SafeERC20.sol";
import "../interfaces/IERC20.sol";
import "./interfaces/IHermesERC20.sol";
import "./interfaces/IHermesPair.sol";
import "./interfaces/IHermesFactory.sol";
... | Get the price of a token in Usd. tokenAddress Address of the token. | function getPriceInUsd(address tokenAddress) public view returns (uint256) {
}
| 6,387,646 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
import "@openzeppelin/contracts/token/ERC20/ERC20Burnable.sol";
import "erc-payable-token/contracts/token/ERC1363/ERC1363.sol";
import "eth-token-recover/contracts/TokenRecover.sol";
import "./behaviours/ERC20Mintable.sol";
import "../../service/ServicePayer... | Function to mint tokens. NOTE: restricting access to addresses with MINTER role. See {ERC20Mintable-mint}. account The address that will receive the minted tokens amount The amount of tokens to mint/ | function _mint(address account, uint256 amount)
internal
override
onlyOwner
{
super._mint(account, amount);
}
| 7,224,060 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.4;
import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import {
OwnableUpgradeable
} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import {
AccessControlUpgradeable
} from "@openzeppelin/contracts-upgr... | RESCUER_ROLE is managed by itself | function __MoneyMarket_init(address rescuer) internal initializer {
__Ownable_init();
__AccessControl_init();
_setupRole(RESCUER_ROLE, rescuer);
_setRoleAdmin(RESCUER_ROLE, RESCUER_ROLE);
}
| 2,535,479 |
./full_match/1/0x5061CDe874f75D119dE3B07E191644097343AB9E/sources/contracts/interfaces/IVault.sol | Governable.sol VaultAdmin.sol VaultCore.sol | interface IVault {
event AssetSupported(address _asset);
event AssetDefaultStrategyUpdated(address _asset, address _strategy);
event AssetAllocated(address _asset, address _strategy, uint256 _amount);
event StrategyApproved(address _addr);
event StrategyRemoved(address _addr);
event Mint(address... | 9,716,582 |
./full_match/73799/0x8048509982987E7ff65C9cf7C7C4997B0ffd3ce6/sources/contracts/dependencies/GreenproofManager.sol | unPause - when called, this function reverts the pausing and unlocks facet function executions only the contract admistrator is allowed to execute this unlocking function if the system is already unpaused, a call to this function will revert with `AlreadyUnpausedContract` error/ | function unPause() external {
LibClaimManager.checkOwnership();
if (!isContractPaused) {
revert AlreadyUnpausedContract();
}
isContractPaused = false;
}
| 16,363,298 |
// SPDX-License-Identifier: Apache-2.0
/*
* Copyright 2021, Offchain Labs, 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
*
*... | Get the address of the staker at the given index stakerNum Index of the staker return Address of the staker/ | function getStakerAddress(uint256 stakerNum) external view override returns (address) {
return _stakerList[stakerNum];
}
| 577,846 |
./full_match/42/0xe0Ab69528526a07c03335B64487cFD5fD7273501/sources/index.sol | Trident pool interface. | interface IPool {
function swap(bytes calldata data) external returns (uint256 finalAmountOut);
function flashSwap(bytes calldata data) external returns (uint256 finalAmountOut);
function mint(bytes calldata data) external returns (uint256 liquidity);
function burn(bytes calldata data) external retur... | 9,572,363 |
./full_match/80001/0xAD552CCAEe30f72E44bb557F058Ceb95fcEE5a3F/sources/project_/contracts/extensions/token-uri/BaseURIUpgradeable.sol | Base uri for generate full token uri baseURI Init value for `_baseURI` | function __BaseURI_init(string memory baseURI) internal {
_setBaseURI(baseURI);
}
| 9,450,964 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.