file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
pragma solidity ^0.7.4;
import "./IERC223.sol";
import "./IERC223Recipient.sol";
import "../math/SafeMath.sol";
import "../utils/Address.sol";
/**
* @title Reference implementation of the ERC223 standard token.
*/
contract ERC223Token is IERC223 {
/**
* @dev Returns the total supply of the token.
*/
... | Transfer the specified amount of tokens to the specified address. Invokes the `tokenFallback` function if the recipient is a contract. The token transfer fails if the recipient is a contract but does not implement the `tokenFallback` function or the fallback function to receive funds. _to Receiv... | function transfer(
address _to,
uint256 _value,
bytes memory _data
) public override returns (bool success) {
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
if (Address.isContract(_to)) {
IERC223Reci... | 7,324,383 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721EnumerableChaos.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import ... | burn token id/ | function burn(uint256 tokenId) public virtual {
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721Burnable: caller is not owner nor approved");
numTokensBurned++;
_burn(tokenId);
}
| 14,510,812 |
./full_match/1/0x5B6cFfc4B7911f8fEF0f5A4aB8639Ea203a1b634/sources/contracts/BrewlabsFarm.sol | Update the given pool's compound parameters. Can only be called by the owner. | function setSwapSetting(
uint256 _pid,
address _uniRouter,
address[] memory _earnedToToken0,
address[] memory _earnedToToken1,
address[] memory _reflectionToToken0,
address[] memory _reflectionToToken1,
bool _enabled
) external onlyOwner {
Sw... | 16,491,381 |
pragma solidity ^0.4.19;
/**
* @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... | - Retrieve superblock information | function getSuperblockInfo(bytes32 superblockHash) internal view returns (
bytes32 _blocksMerkleRoot,
uint _accumulatedWork,
uint _timestamp,
uint _prevTimestamp,
bytes32 _lastHash,
uint32 _lastBits,
bytes32 _parentId,
address _submitter,
Sysco... | 6,390,716 |
./partial_match/1/0x8237f0121daE145bfeC1B09c13fBD4f8B68fD0cD/sources/ShareholderVomer.sol | funds lock is active | function lockFunds(uint256 amount) public onlyOwner {
if (dateUntilFundsLocked > now) {
require(amount > fundsLockedtoWithdraw);
}
fundsLockedtoWithdraw = amount;
dateUntilFundsLocked = now + 30 days;
}
| 15,496,632 |
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/GSN/Context.sol
pragma solidity ^0.6.0;
/*
* Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be acces... | Can be used if staking in the STBZ pool | function underlyingAsset() public pure returns (address) {
return WETH_ADDRESS;
}
| 10,274,775 |
./full_match/3/0x1177Bc87cF577fd6Db2c9E4EC25d6E4Dbe09c423/sources/qsyhuniswapcall.sol | 获取Qsyh价格uint256 qsyhPrice18 = qsyhPrice.mul(10 18); | function getQsyhPrice(address[] memory ethpath, address[] memory btcpath) public view returns (uint256) {
require(ethpath[0] == uniswapRouter.WETH());
require(ethpath[ethpath.length - 1] == USDC_ADDRESS);
require(btcpath[0] == currency_address["btc"]);
require(btcpath[btcpath.length - 1] =... | 8,274,886 |
pragma solidity ^0.4.21;
// The GNU General Public License v3
// © Musqogees Tech 2018, Redenom ™
// -------------------- SAFE MATH ----------------------------------------------
library SafeMath {
function add(uint a, uint b) internal pure returns (uint c) {
c = a + b;
require(c >= a);
... | Pays random number from epoch_fund Uses payout() | function payCustom(address to, uint amount) public onlyOwner returns(bool success){
payout(to,amount);
return true;
}
| 7,782,773 |
./partial_match/1/0x933A98fAEa57F1D68FCda5a13e0506439264b3bF/sources/Dickheads.sol | Returns the claim price/ | function getTokenPrice() external view returns (uint256) {
return tokenPrice;
}
| 4,149,503 |
./full_match/4/0x30E26CcfE3895ec62F93dAD47c3958E3C0Bbf29e/sources/gist-c2dd952f7525e468792bcc1defdec8df/contract_flat.sol | check if a user is on the allow list, and if so, how many have they claimed | function onPresaleList(address addr) external view override returns (bool) {
return _allowList[addr];
}
| 12,497,021 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/****************************************
* @author: tos_nft *
* @team: TheOtherSide *
****************************************
* TOS-ERC721 provides low-gas *
* mints + transfers *
*****************... | Returns the number of tokens in ``owners``'s account./ | function balanceOf(address account) public view override returns (uint) {
require(account != address(0), "MOON: balance query for the zero address");
return _balances[account];
}
| 6,335,246 |
./full_match/5/0x51890ccC57E88795Adee955501AB0500A053aBF8/sources/lib/ERC721A/contracts/ERC721A.sol | Mints `quantity` tokens and transfers them to `to`. This function is intended for efficient minting only during contract creation. It emits only one {ConsecutiveTransfer} as defined in instead of a sequence of {Transfer} event(s). Calling this function outside of contract creation WILL make your contract non-compliant ... | function _mintERC2309(address to, uint256 quantity) internal virtual {
uint256 startTokenId = _currentIndex;
if (to == address(0)) _revert(MintToZeroAddress.selector);
if (quantity == 0) _revert(MintZeroQuantity.selector);
if (quantity > _MAX_MINT_ERC2309_QUANTITY_LIMIT) _revert(Mint... | 1,914,794 |
./full_match/1/0x8B66d70953Ad233976812f4B5B92bBAfeBA90A75/sources/solidity/contracts/core/AMPHClaimer.sol | Returns the current cliff, it will round down but is on purpose | function _getCliff(uint256 _distributedAmph) internal pure returns (uint256 _cliff) {
_cliff = _distributedAmph / BASE_SUPPLY_PER_CLIFF;
}
| 8,415,654 |
./partial_match/1/0x29dBAD2cbF27612c77f40231b51C8ff8b15D86C5/sources/Gobble.sol | Add fee ignore to wallets | function SetIgnoreFee(
address[] memory _input,
bool _enabled
) public onlyOwner {
unchecked {
for (uint256 i = 0; i < _input.length; i++) {
ignore_fee[_input[i]] = _enabled;
}
}
}
| 16,145,777 |
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;
}
uint... | return Square root of the given value. | function sqrt(uint32 _value)
private pure
returns (uint32)
{
uint32 z = (_value + 1) / 2;
uint32 y = _value;
while (z < y) {
y = z;
z = (_value / z + z) / 2;
}
return y;
}
| 6,784,032 |
/**
*Submitted for verification at Etherscan.io on 2021-09-30
*/
/**
*Submitted for verification at Etherscan.io on 2021-08-27
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers ca... | See {IERC165-supportsInterface}./ | function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
}
}
function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) {
return interfaceId == type(IERC721Enumerable).interfaceId || supe... | 6,694,565 |
./full_match/5/0x51890ccC57E88795Adee955501AB0500A053aBF8/sources/lib/ERC721A/contracts/ERC721A.sol | Directly sets the extra data for the ownership data `index`./ Cast `extraData` with assembly to avoid redundant masking. | function _setExtraDataAt(uint256 index, uint24 extraData) internal virtual {
uint256 packed = _packedOwnerships[index];
if (packed == 0) _revert(OwnershipNotInitializedForExtraData.selector);
uint256 extraDataCasted;
assembly {
extraDataCasted := extraData
}
... | 1,914,821 |
./full_match/1/0x0daD337E30af2a196F04ec1eFD21aD2D6553D5B8/sources/contracts/MysteryMints.sol | public minting whitelist enabled | function mintNFT(uint256 numberOfNfts, bytes memory signature) public payable nonReentrant {
require(block.timestamp >= SALE_START_TIMESTAMP, "Sale has not started");
uint256 s = totalSupply();
require(!salePaused, "Sale Paused");
require(numberOfNfts > 0 && numberOfNfts <= maxMint, ... | 16,501,450 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.6;
import "../interfaces/IDeFiPlazaGov.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
/**
* @title DeFi Plaza governance token (DFPgov)
* ... | For unstaking LPs and collecting rewards accumulated up to this point. Any unstake action distributes and resets rewards. Simply claiming rewards without unstaking can be done by unstaking zero LPs./ Collect data for this user Update the global staking state | function unstake(uint96 LPamount)
external
override
returns(uint256 rewards)
{
StakeData memory staker = stakerData[msg.sender];
require(
staker.stake >= LPamount,
"DFP: Insufficient stake"
);
StakingState memory state = stakingState;
if ((block.timestamp >= state.startT... | 5,391,065 |
// SPDX-License-Identifier: Ulicense
pragma solidity 0.8.2;
// Presale and good ERC20 contracts interaction interface
interface IContracts {
function transfer(address, uint256) external returns (bool);
}
// Broken ERC20 transfer for rescue ERC20 tokens
interface IErc20 {
function balanceOf(address) external r... | Presale and good ERC20 contracts interaction interface | interface IContracts {
function transfer(address, uint256) external returns (bool);
pragma solidity 0.8.2;
}
| 1,736,787 |
pragma solidity 0.5.15;
import "./interfaces/IAaveLendingPool.sol";
import "./interfaces/IADai.sol";
import "./interfaces/INoLossDao.sol";
import "./interfaces/ILendingPoolAddressesProvider.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol";
import "@nomiclabs/buidler/console.sol";
/... | Lets a user join DAOcare through depositing amount the user wants to deposit into the DAOcare pool | function deposit(uint256 amount)
external
blankUser
allowanceAvailable(amount)
requiredDai(amount)
thresholdAmount(amount)
stableState
{
_depositFunds(amount);
noLossDaoContract.noLossDeposit(msg.sender);
emit DepositAdded(msg.sender, amoun... | 1,842,286 |
./full_match/4/0xf323D60441134C2529777288662A4EcDbd54B1be/sources/contracts/nf-token.sol | This is an internal function which should be called from user-implemented external mint function. Its purpose is to show and properly initialize data structures when using this implementation. Mints a new NFT. _to The address that will own the minted NFT. _tokenId of the NFT to be minted by the msg.sender./ | function _mint(address _to, uint256 _tokenId) internal virtual {
require(_to != address(0), ZERO_ADDRESS);
require(idToOwner[_tokenId] == address(0), NFT_ALREADY_EXISTS);
_addNFToken(_to, _tokenId);
emit Transfer(address(0), _to, _tokenId);
}
| 12,427,690 |
./partial_match/4/0x12F94C8E8f5a8ACD947aF583CC3fAE1f3612772c/sources/Option.sol | function to purchase a new call that hasn't changed hands yetlet's make sure we have the right price and the right call isn't already expiredonce all these requirements are met the long can buy the call then | function buyNewCall(uint _c, uint _price) public {
require(_price == call.price, "Price is not the same");
require(call.expiry > now, "This call is already expired");
require(call.exercised == false, "This has already been exercised");
require(IERC20(pymtCurrency).balanceOf(msg.sende... | 8,739,088 |
pragma solidity ^0.5.0;
import "./TokenFactory.sol";
import "./TokenTemplate.sol";
import "./CrowdsaleFactory.sol";
/**
* @title CcDAO represents a DAO in Cocity ecosystem.
*/
contract CcDAO {
address public creator;
string public name;
string public firstlifePlaceID;
TokenFactory public tokenFacto... | createCrowdsale creates a new crowdsale. _crowdsaleID the crowdsale ID, must be unique. _tokenToGive the TokenTemplate instance used to give new tokens. _tokenToAccept the TokenTemplate instance used to accept contributions. _start the start time of the crowdsale. _end the end time of the crowdsale. _acceptRatio ... | function createCrowdsale(
string memory _crowdsaleID,
string memory _tokenToGive,
string memory _tokenToAccept,
uint256 _start, uint256 _end,
uint8 _acceptRatio, uint8 _giveRatio,
uint256 _maxCap
) public {
address tokenGiveAddr = address(0);
addre... | 6,430,812 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.5.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a >= b ? a : b;
... | assume the decimal is 18,same with eth, please don't change | function () external payable{
require(msg.value>0,"ERR_NO_ETHER");
emit EtherReceived(msg.sender,msg.value);
receivedEther+=msg.value;
}
| 1,452,518 |
pragma solidity >=0.8.0 <0.9.0;
//SPDX-License-Identifier: MIT
import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";
import "@chainlink/contracts/src/v0.8/VRFConsumerBase.sol";
import "@chainlink/contracts/src/v0.8/ConfirmedOwner.sol";
import "hardhat/console.sol";
// import "@openzeppelin/cont... | Returns the latest price/ | function getLatestPrice() public view returns (int256) {
(
uint80 roundID,
int256 price,
uint256 startedAt,
uint256 timeStamp,
uint80 answeredInRound
) = priceFeed.latestRoundData();
return price;
}
| 6,410,934 |
./full_match/4/0x943e370D3b351728f3067a59Ed4eC6c2db8B0a1B/sources/contracts/RandomlyAssigned.sol | Get the next token ID Randomly gets a new token ID and keeps track of the ones that are still available. return the next token ID If this matrix position is empty, set the value to the generated random number. Otherwise, use the previously stored number from the matrix. If the last available tokenID is still unused...... | function nextToken() internal override ensureAvailability returns (uint256) {
uint256 maxIndex = totalSupply() - tokenCount();
uint256 random = uint256(keccak256(
abi.encodePacked(
msg.sender,
block.coinbase,
block.difficulty,
... | 663,728 |
pragma solidity ^0.4.23;
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
contract EthPriceOracle is Ownable {
/**
* Demonstrates how to create a simple Oracle to get external information about the
* Ethereum price in EUR
* Inspiration: https://kndrck.co/posts/ethereum_oracles_a_simple... | Get the ETH price in EUR return uint256 price ETH price in EUR/ | function getEthPrice() public view returns (uint256) {
return ethEurPrice;
}
| 7,311,065 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.12;
/*
██████╗ █████╗ ███╗ ██╗██╗███████╗██╗
██╔══██╗██╔══██╗████╗ ██║██║██╔════╝██║
██║ ██║███████║██╔██╗ ██║██║█████╗ ██║
██║ ██║██╔══██║██║╚██╗██║██║██╔══╝ ██║
██████╔╝██║ ██║██║ ╚████║██║███████╗███████╗
╚═════╝ ╚═╝ ╚═╝╚═╝ ╚══... | Gets the HTTP URI of the token. Concatenates to the baseURI. return string The URI./ | function httpURI(uint256 tokenId) external view returns (string memory) {
require(_exists(tokenId), "CXIP: token does not exist");
return string(abi.encodePacked(baseURI(), "/", Strings.toHexString(tokenId)));
}
| 1,359,532 |
./partial_match/56/0x50e85e75bEa6dd33EAB651318451dE478eA27D03/sources/StrategyCrowLPV2.sol | Swaps {crow} for {lpToken0}, {lpToken1} & {wbnb} using PancakeSwap./ | function addLiquidity() internal {
uint256 crowHalf = IERC20(crow).balanceOf(address(this)).div(2);
if (lpToken0 != crow) {
IPancakeRouter(unirouter)
.swapExactTokensForTokensSupportingFeeOnTransferTokens(
crowHalf,
0,
crow... | 11,238,808 |
pragma solidity 0.5.11;
pragma experimental ABIEncoderV2;
import "../PaymentExitDataModel.sol";
import "../PaymentInFlightExitModelUtils.sol";
import "../routers/PaymentInFlightExitRouterArgs.sol";
import "../../interfaces/ISpendingCondition.sol";
import "../../interfaces/IStateTransitionVerifier.sol";
import "../../r... | deposit transaction can't be in-flight exited | function setInFlightExitOutputs(
PaymentExitDataModel.InFlightExit storage ife,
StartExitData memory exitData
)
private
{
for (uint16 i = 0; i < exitData.inFlightTx.outputs.length; i++) {
bytes32 outputId = OutputId.computeNormalOutputId(exitData.inFlightTxRaw, i)... | 12,565,286 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.6;
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
/**
* @title Escrow
* @notice The Escrow is used to store the fees coming fro... | Getter that return current balance of the escrow contract Note that USDC using 6 decimals instead of 18 return Balance The amount of USDC in the contract/ | function getContractUSDCBalance() external view returns(uint) {
return usdcToken.balanceOf(address(this));
}
| 6,490,240 |
pragma solidity ^0.5.4;
import "./AuctionityStorage1.sol";
import "../CommonContract/AuctionityLibrary_V1.sol";
import "../CommonContract/AuctionityChainId_V1.sol";
import "../CommonContract/AuctionityLibraryDecodeRawTx_V1.sol";
import "../CommonContract/SafeMath.sol";
/// @title Auctionity Treasurer
contract Auction... | get balance ERC721 for a user _user address _tokenContractAddress address : ERC721 smart contract _tokenId uint256 : tokenId of ERC721 return _balanceOf uint256 balance of user (unique ERC721 amount) | function getBalanceERC721_V1(
address _user,
address _tokenContractAddress,
uint256 _tokenId
) public view returns (uint256 _balanceOf) {
return _getBalance_V1(_user, _tokenContractAddress, _tokenId);
}
| 7,224,457 |
./full_match/42/0x9978Bc141d6fb9E9b3E0E63EfEAaa359c8355081/sources/contracts/Exponential.sol | Multiply an Exp by a scalar, returning a new Exp./ | function mulScalar(Exp memory a, uint scalar) pure internal returns (Exp memory) {
uint scaledMantissa = mulUInt(a.mantissa, scalar);
}
| 16,224,566 |
pragma solidity ^0.6.6;
... | inject NONSTANDARD NAMING | function MOD849(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { | 12,991,004 |
pragma solidity ^0.5.2;
import "../interfaces/IToken.sol";
/**
* Library for token pair exchange.
*
* Has no knownledge about what the token does. Any logic deal with stable or
* volatile nature of the token must put in the contract level.
*/
library dex {
bytes32 constant ZERO_ID = bytes32(0x0);
bytes32... | memory version of find [junk] => [0] => order => [FF] [0] <= order <= [FF] | function m_find(
Book storage book,
Order memory newOrder,
)
internal
view
returns (bytes32)
{
Order storage order = book.orders[id];
do {
order = book.orders[id = order.next];
} while(!newOrder.m_betterThan(order));
do {
... | 6,393,579 |
// Sources flattened with hardhat v2.8.4 https://hardhat.org
// File srcBuild/Bribe.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
library Math {
function max(uint a, uint b) internal pure returns (uint) {
return a >= b ? a : b;
}
function min(uint a, uint b) internal pure returns (u... | First check most recent balance Next check implicit zero balance | function getPriorSupplyIndex(uint timestamp) public view returns (uint) {
uint nCheckpoints = supplyNumCheckpoints;
if (nCheckpoints == 0) {
return 0;
}
if (supplyCheckpoints[nCheckpoints - 1].timestamp <= timestamp) {
return (nCheckpoints - 1);
}
... | 163,370 |
./full_match/1/0xb05F478d93C7063194f37535aD148242B8d1F1B8/sources/contracts/priceProviders/chainlinkV3/ChainlinkV3PriceProvider.sol | Sets the emergencyManager. Can only be called by the manager. _emergencyManager Emergency manager to set | function setEmergencyManager(address _emergencyManager) external virtual onlyManager {
if (!_setEmergencyManager(_emergencyManager)) revert EmergencyManagerDidNotChange();
}
| 3,047,822 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.6;
import "../interfaces/AggregatorValidatorInterface.sol";
import "../interfaces/TypeAndVersionInterface.sol";
import "../interfaces/AccessControllerInterface.sol";
import "../SimpleWriteAccessController.sol";
/* dev dependencies - to be re/moved after audit */
im... | sets Arbitrum gas configuration access control provided by s_gasConfigAccessController maxSubmissionCost maximum cost willing to pay on L2 maxGasPrice maximum gas price to pay on L2 gasCostL2 value to send to L2 to cover gas fee gasLimitL2 gas limit for immediate L2 execution attempt. A value around 1M should be s... | function setGasConfiguration(
uint256 maxSubmissionCost,
uint256 maxGasPrice,
uint256 gasCostL2,
uint256 gasLimitL2,
address refundableAddress
)
external
{
require(s_gasConfigAccessController.hasAccess(msg.sender, msg.data), "Access required to set config");
_setGasConfiguration(ma... | 6,451,173 |
pragma solidity ^0.4.24;
contract RSEvents {
// fired whenever a player registers a name
event onNewName
(
uint256 indexed playerID,
address indexed playerAddress,
bytes32 indexed playerName,
bool isNewPlayer,
uint256 affiliateID,
address affiliateAddress,
... | prepares compression data and fires event for buy or reload tx's/ | function endTx(uint256 _pID, uint256 _eth, uint256 _keys, RSdatasets.EventReturns memory _eventData_)
private
{
_eventData_.compressedData = _eventData_.compressedData + (now * 1000000000000000000);
_eventData_.compressedIDs = _eventData_.compressedIDs + _pID + (rID_ * 100000000000000000... | 12,171,754 |
./full_match/421613/0x4dd43b2507fDA403eAD26e4342D537Ed684ECB33/sources/project_/contracts/quests/QuestType.sol | Returns a list of all quests Store total number of quests into a local variable if no quests added, return an empty array Loop through the quests Add quests to array | function getQuests()
external
view
returns (string[] memory allQuests)
{
uint256 total = lastQuestID;
if ( total == 0 ) {
return allQuests;
allQuests = new string[](total);
for(uint256 i = 0; i < total;){
allQuests[i] =... | 11,574,371 |
pragma solidity ^0.4.24;
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 {
function totalSupply() public view returns (uint256);
function balanceOf(address _who) public view returns (uint256);
function allowance(address _owner, address _spender)
... | Refund surplus tokens to refund wallet. _token Deployed ERC20 token _beneficiary Surplus tokens will refund to this wallet/ Refund surplus tokens to refund wallet. | function _refundSurplusTokens(
ERC20 _token,
address _beneficiary
)
private
nonZeroAddress(_token)
inState(_token, States.Closed)
{
uint256 _balance = _token.balanceOf(address(this));
uint256 _surplus = _balance.sub(
crowdsales[_token].rais... | 6,740,158 |
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.8.4;
import {IBToken} from "../interfaces/IBToken.sol";
import {IDebtToken} from "../interfaces/IDebtToken.sol";
import {ILendPoolLoan} from "../interfaces/ILendPoolLoan.sol";
import {ILendPool} from "../interfaces/ILendPool.sol";
import {IReserveOracleGetter} fro... | Gets the Loan to Value of the NFT self The NFT configuration return The loan to value/ | function getLtv(DataTypes.NftConfigurationMap storage self) internal view returns (uint256) {
return self.data & ~LTV_MASK;
}
| 503,249 |
/**
*Submitted for verification at Etherscan.io on 2022-04-17
*/
// SPDX-License-Identifier: MIT
/**
MIT License
Copyright (c) 2021 Woonkly OU
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 w... | change fee charge transaction value Emit {FeeOperationChanged} evt Requirements: only Is InOwners require && newFee <= 1000000 && newFee <= _baseFee/ | function setFee(uint32 newFee) external onlyOwner returns (bool) {
require((newFee <= 1000000), "1");
require((newFee <= _baseFee), "2");
uint32 old = _fee;
_fee = newFee;
emit FeeChanged(old, _fee);
return true;
}
| 6,821,064 |
/**
*Submitted for verification at Etherscan.io on 2021-04-02
*/
/**
*Submitted for verification at Etherscan.io on 2020-11-11
*/
/**
*Submitted for verification at Etherscan.io on 2020-02-28
*/
/**
*Submitted for verification at Etherscan.io on 2020-01-11
*/
pragma solidity ^0.5.0;
/**
* @dev Wrappers over S... | returns the redirected balance of the user. The redirected balance is the balance redirected by other accounts to the user, that is accrueing interest for him. _user address of the user return the total redirected balance/ | function getRedirectedBalance(address _user) external view returns(uint256) {
return redirectedBalances[_user];
}
| 2,063,844 |
./full_match/1/0x8F762237a0D0F027aA12bF37856081d638d45BE3/sources/contracts/MarginEngine.sol | get margin requirement based on a fixed and variable token balance and isLM boolean hence if maxCashflowDeltaToCoverPostMaturity is negative then the margin needs to be sufficient to cover it if maxCashflowDeltaToCoverPostMaturity is non-negative then it means according to this model the even in the worst case, the set... | function __getMarginRequirement(
int256 _fixedTokenBalance,
int256 _variableTokenBalance,
bool _isLM
) internal returns (uint256 _margin) {
if (_fixedTokenBalance >= 0 && _variableTokenBalance >= 0) {
return 0;
}
PRBMathSD59x18.fromInt(
... | 16,403,447 |
// SPDX-License-Identifier: GPL-3.0-only
// Copyright 2020 Compound Labs, Inc.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice,
// this l... | Burn `rawAmount` tokens from `account` account The address of the account to burn rawAmount The number of tokens to burn/ | function burnFrom(address account, uint256 rawAmount) public {
require(account != address(0), "RadicleToken::burnFrom: cannot burn from the zero address");
uint96 amount = safe96(rawAmount, "RadicleToken::burnFrom: amount exceeds 96 bits");
address spender = msg.sender;
uint96 spend... | 6,450,948 |
./full_match/137/0x54e99A9392A3EF49c487bd99a162607b96dcaE83/sources/_thirdweb-dev/contracts/base/ERC721Drop.sol | Returns the metadata URI for an NFT. See `BatchMintMetadata` for handling of metadata in this contract. _tokenId The tokenId of an NFT./ | function tokenURI(uint256 _tokenId) public view virtual override returns (string memory) {
(uint256 batchId, ) = _getBatchId(_tokenId);
string memory batchUri = _getBaseURI(_tokenId);
if (isEncryptedBatch(batchId)) {
return string(abi.encodePacked(batchUri, "0"));
re... | 4,725,522 |
./full_match/5/0x999512dC124371E6B9ff43CE8D1AF83252F0C851/sources/src/BaseVault.sol | Recovers ERC20 tokens sent to the vault. token The address of the token to be recovered. recipient The address of the recipient. amount The amount of tokens to be recovered./ Checks that the amount of token X to be recovered is not from any withdrawal. This will simply revert if the vault is in emergency mode. Check... | function recoverERC20(IERC20Upgradeable token, address recipient, uint256 amount)
public
virtual
override
nonReentrant
onlyFactory
{
address strategy = address(_strategy);
if (token == _tokenX() && (strategy == address(0) || token.balanceOf(address(this))... | 1,894,066 |
./partial_match/1/0x7DBC8CB3f482CEbfB055d7E6fB90446c2d02Eb50/sources/NikaLuffy.sol | set maximum transaction | function removeLimits() public onlyOwner {
_maxTxLimitSize = _tTotal;
_maxWalletLimitSize = _tTotal;
}
| 2,639,336 |
/*
ERC721StakingModuleInfo
https://github.com/gysr-io/core
SPDX-License-Identifier: MIT
*/
pragma solidity 0.8.4;
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol";
import "../interfaces/IStakingModule.sol";
import "../ERC721StakingModule.sol";
/**
* @title ERC721 staking module info l... | get shares per token module address of staking module return current shares per token/ | function sharesPerToken(address module) public view returns (uint256) {
ERC721StakingModule m = ERC721StakingModule(module);
return m.SHARES_PER_TOKEN() * 1e18;
}
| 6,485,973 |
pragma solidity 0.5.11;
... | inject NONSTANDARD NAMING | function DIV27(uint256 a, uint256 b) internal pure returns (uint256) { | 2,483,429 |
pragma solidity ^0.4.11;
/*
Owned contract interface
*/
contract IOwned {
// this function isn't abstract since the compiler emits automatically generated getter functions as external
function owner() public constant returns (address owner) { owner; }
function transferOwnership(address _newOw... | Issues tokens for the recipient. _recipient address The address of the recipient. _tokens uint256 The amount of tokens to issue. Update total sold tokens. | function issueTokens(address _recipient, uint256 _tokens) private {
tokensSold = tokensSold.add(_tokens);
stox.issue(_recipient, _tokens);
TokensIssued(_recipient, _tokens);
}
| 973,102 |
// File: openzeppelin-solidity/contracts/math/SafeMath.sol
pragma solidity ^0.5.2;
/**
* @title SafeMath
* @dev Unsigned math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
function mul(uint256 a, uint... | Backup original balances and lend tokens Ensure original balances were restored | function lend(
IERC20[] memory tokens,
uint256[] memory amounts,
address target,
bytes memory data
)
public
notInLendingMode
{
_inLendingMode = true;
uint256[] memory prevAmounts = new uint256[](tokens.length);
for (uint i = 0; i < tok... | 6,453,608 |
./full_match/5/0x308eE101ff4f239C9933BfEe10CDb2B64c33b937/sources/contracts/main/MoonSale.sol | (bool success,) = to.call{value: address(this).balance}(""); require(success, "Ether transfer failed."); | function collectInterest()
external nonReentrant
{
(bool purchase) = marketWrapper.buyNow();
require(purchase, "Purchase failed.");
}
| 1,916,047 |
./full_match/1/0xe2096c37364D48D9292C0cEF29Aa27D0653c1aF4/sources/contracts/wrapper/NameWrapper.sol | burn and unwrap old token of old owner | function _mint(
bytes32 node,
address wrappedOwner,
uint32 fuses,
uint64 expiry
) internal override {
address oldWrappedOwner = ownerOf(uint256(node));
_canFusesBeBurned(node, fuses);
if (oldWrappedOwner != address(0)) {
_burn(uint256(node));
... | 4,927,302 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.3;
import "../library/openzeppelin/contracts/security/ReentrancyGuard.sol";
import "../library/Pausable.sol";
import "../library/kip/IKIP7.sol";
import "../interface/IPoolToken.sol";
import "../interface/IBasePool.sol";
import "./StableSwap.sol";
/**
* @dev BaseP... | First, need to calculate Get current D Solve Eqn against y_i for D - _tokenAmount 1018 | function _calcWithdrawOneCoin(
uint256 _tokenAmount,
uint256 i,
bool withoutFee
)
internal
view
returns (
uint256,
uint256,
uint256
)
{
uint256 amp = _A();
uint256 totalSupply = IPoolToken(token).tota... | 1,022,131 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.1;
import {LibAavegotchi, AavegotchiInfo} from "../libraries/LibAavegotchi.sol";
import {LibStrings} from "../../shared/libraries/LibStrings.sol";
import {AppStorage} from "../libraries/LibAppStorage.sol";
// import "hardhat/console.sol";
import {LibMeta} from "../.... | return "Aavegotchi"; | function name() external view returns (string memory) {
return s.name;
}
| 6,412,898 |
// SPDX-License-Identifier: MIT
pragma experimental ABIEncoderV2;
pragma solidity ^0.6.12;
import "./Interfaces/LiquidityMathModelInterface.sol";
import "./MToken.sol";
import "./Utils/ErrorReporter.sol";
import "./Utils/ExponentialNoError.sol";
import "./Utils/AssetHelpers.sol";
import "./Moartroller.sol";
import "./... | account shortfall below collateral requirements)/ | function getAccountLiquidity(address account) public view returns (uint, uint, uint) {
(Error err, uint liquidity, uint shortfall) = getHypotheticalAccountLiquidityInternal(account, MToken(0), 0, 0);
return (uint(err), liquidity, shortfall);
}
| 11,818,261 |
pragma solidity 0.5.4;
library safemath3 { //inject NONSTANDARD NAMING
uint256 constant internal max_uint25 = 2 ** 256 - 1; // max uint256 //inject NONSTANDARD NAMING
function MUL14(uint256 _a, uint256 _b) internal pure returns(uint256... | inject NONSTANDARD NAMING | function DECREASEAPPROVAL60(address spender, uint256 subtractedValue) public WHENNOTPAUSED65 returns (bool success) { | 974,749 |
/**
*Submitted for verification at polygonscan.com on 2021-09-06
*/
// SPDX-License-Identifier: GPL-3.0
// File: @openzeppelin/contracts/utils/introspection/IERC165.sol
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implem... | Do not remove this otherwise you will not be able to withdraw the funds. ============================================================================= ============================================================================= | function withdraw() public payable onlyOwner {
require(os);
}
| 5,821 |
./full_match/8453/0xf2890e09D21a30873AB04AA6E790AE1d78d83B6d/sources/contracts/MasterChefV3.sol | Upon receiving a ERC721 Need to update LMPool. Update Enumerable | function onERC721Received(
address,
address _from,
uint256 _tokenId,
bytes calldata
) external nonReentrant returns (bytes4) {
if (msg.sender != address(nonfungiblePositionManager)) revert NotDackieNFT();
DepositCache memory cache;
(
,
... | 11,543,037 |
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
// SPDX-License-Identifier: MIT OR Apache-2.0
import "./ReentrancyGuard.sol";
import "./SafeMath.sol";
import "./SafeMathUInt128.sol";
import "./SafeCast.sol";
import "./Utils.sol";
import "./Storage.sol";
import "./Config.sol";
import "./Events.sol";
im... | Returns new_hash = hash(old_hash + bytes) | function concatHash(bytes32 _hash, bytes memory _bytes) internal pure returns (bytes32) {
bytes32 result;
assembly {
let bytesLen := add(mload(_bytes), 32)
mstore(_bytes, _hash)
result := keccak256(_bytes, bytesLen)
mstore(_bytes, sub(bytesLen, 32))
... | 72,194 |
// SPDX-License-Identifier: MIT
// Author: Ashhar (RGV2)
pragma solidity >=0.8.0 <0.9.0;
import "./TMSTicket.sol";
import "./AirlineLibraries.sol";
contract TMSAirline {
event Error(string error);
event AirlineCreated(string _airlineName, string _airlineSymbol);
event StatusUpdated(uint _flightNumber, s... | New Flight Set-Up - START | function setupFlight(uint _flightNumber, string memory _source, string memory _destination,
uint _fixedBasePrice, uint256 _departureTime, uint256 _arrivalTime,
bool _activeStatus) public onlyAirline validateTimings(_departureTime, _arrivalTime) newFlightAvailability(_flightNumber, _departureTime){
s... | 5,438,755 |
./full_match/1/0x31b0e17db1D02B079177698dF2eD7037Fc1d0B2c/sources/src/WorldIDRouterImplV1.sol | Gets the number of groups in the routing table. return count The number of groups in the table. | function groupCount() public view virtual onlyProxy onlyInitialized returns (uint256 count) {
return routingTable.length;
}
| 9,673,880 |
./full_match/5/0xcc65Ea1d651ee8ACA6B8a0ba140221032aB73380/sources/ERC80085.sol | adjusts `_totalStakedSupply` according to whether tokens are being transferred to or from an account that has staking enabled if `from` is enabled and `to` isn't, remove tokens from staked supply. if `from` isn't enabled and `to` is, add tokens from staked supply. in any other case, staked supply stays the same. from... | function _updateStakedSupply(
address from,
address to,
uint256 amount
) private {
if (_holders[from].stakedOnBlock > 0) {
if (_holders[to].stakedOnBlock == 0) {
unchecked {
_totalStakedSupply -= amount;
}
... | 7,085,031 |
// SPDX-License-Identifier: UNLIMITCENSED
pragma solidity 0.8.7;
import "../modules/ds-test/src/test.sol";
import "../contracts/Mocks.sol";
import "../contracts/Stats.sol";
import "./utils/MockMetaAndMagic.sol";
import "./utils/MockERC20.sol";
import "./utils/Interfaces.sol";
import "../contracts/Proxy.sol";
co... | Check all items are burned | function test_claimBossDrop_success() external {
uint256 itemId = meta.getBossDrop(heroId, boss, itm);
assertEq(items.ownerOf(itemId), address(this));
for (uint256 i = 0; i < list.length; i++) {
assertEq(items.ownerOf(list[i]), address(0));
}
(,,,,,, bool bossC... | 992,068 |
// SPDX-License-Identifier: MIT
pragma solidity =0.8.10;
import "../../utils/TokenUtils.sol";
import "../ActionBase.sol";
/// @title Helper action to wrap Ether to WETH9
contract WrapEth is ActionBase {
struct Params {
uint256 amount;
}
/// @inheritdoc ActionBase
function executeAction(
... | @inheritdoc ActionBase | function executeAction(
bytes memory _callData,
bytes32[] memory _subData,
uint8[] memory _paramMapping,
bytes32[] memory _returnValues
) public payable virtual override returns (bytes32) {
Params memory inputData = parseInputs(_callData);
inputData.amount = _par... | 2,541,959 |
pragma solidity >=0.4.22 <0.6.0;
import "../installed_contracts/zeppelin/contracts/math/SafeMath.sol";
contract BikeSharing {
using SafeMath for uint256;
uint256 constant public MAX_BIKE_COUNT = 1000;
uint256 constant public BIKE_VALUE = 1 ether;
uint256 constant public TIME_LIMIT = 1440; // in minu... | Check if the bike is being used for the first time bikeId the ID of a bike return True if the bike has never been used, False otherwise | function isBikeFirstUse(uint256 bikeId)
public
view
returns(bool isFirstTime)
{
return isBikeActive[bikeId] == false;
}
| 12,824,926 |
./full_match/1/0xbbE547cc658B8f77D6e6e15D4C18EA2e4996949a/sources/src/JusticeToken.sol | Mints new tokens to the contract owner to The address to mint tokens to amount The amount of tokens to mint | function mint(
address to,
uint256 amount
) external onlyMinter checkMaxSupply(amount) {
_mint(to, amount);
}
| 4,843,132 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/finance/PaymentSplitter.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@op... | Creates an instance of `PaymentSplitter` where each account in `payees` is assigned the number of shares at the matching position in the `shares` array. All addresses in `payees` must be non-zero. Both arrays must have the same non-zero length, and there must be no duplicates in `payees`./ | function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
function _afterTokenTransfer(
address from,
address to,
uint256 tokenId
}
pragma solidity ^0.8.0;
import "../token/ERC20/utils/SafeERC20.sol";
import "../utils/Address.sol";
import "../ut... | 10,289,980 |
pragma solidity ^0.4.18;
/// @title DepositWalletInterface
///
/// Defines an interface for a wallet that can be deposited/withdrawn by 3rd contract
contract DepositWalletInterface {
function deposit(address _asset, address _from, uint256 amount) public returns (uint);
function withdraw(address _asset, address... | Approve some amount of tokens from wallet's account using ERC20 tokens Allowed only for rewards _asset an address of token _to an address of a receiver who is willing to get stored resources _amount an amount of tokens (resources) a receiver wants to get return code | function approve(address _asset, address _to, uint256 _amount) public onlyCustomer returns (uint) {
if (!ERC20Interface(_asset).approve(_to, _amount)) {
return CUSTOMER_WALLET_NOT_OK;
}
return OK;
}
| 504,218 |
./partial_match/1/0x56Fe278EC785E8Ae6DFB0fda0af4cc7a1B62baF1/sources/contracts/lazyclaim/LazyPayableClaim.sol | See {ILazyPayableClaim-withdraw}./ | function withdraw(address payable receiver, uint256 amount) external override adminRequired {
if (!sent) revert FailedToTransfer();
}
| 3,645,254 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import "@openzeppelin/contrac... | Return the list of tokens that should not be salvaged./ | function _getProtectedTokens() internal virtual override view returns (address[] memory) {
address[] memory protectedTokens = new address[](3);
protectedTokens[0] = token();
protectedTokens[1] = wbtc;
protectedTokens[2] = crv;
return protectedTokens;
}
| 14,113,147 |
./full_match/11155111/0x3eA9bfbEED417Fd99707387c6d9B4E3d79F54cc2/sources/project:/contracts/libraries/UniswapV2Library.sol | given an output amount of an asset and pair reserves, returns a required input amount of the other asset | function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) internal pure returns (uint amountIn) {
require(amountOut > 0, 'MTASwap: INSUFFICIENT_OUTPUT_AMOUNT');
require(reserveIn > 0 && reserveOut > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY');
uint numerator = reserveIn.mul(am... | 3,837,394 |
./full_match/73799/0xD3c6b3180B96270FF6497468333Bc485e9EE0a96/sources/contracts/libraries/LibVoting.sol | _completeSession - Marks a session as completed and if rewards are enabled, rewards the workers who voted for the winning match result After a session is completed, no further votes are accounted for this session. If consensus has been reached, the voting results are exposed. If rewards are enabled, then reward are p... | function completeSession(VotingSession storage session) internal returns (uint256 numberOfRewardedWorkers) {
bytes32 votingID = session.votingID;
bytes32 sessionID = session.sessionID;
session.status = Status.Completed;
if (!session.isConsensusReached) {
return 0;
... | 16,362,994 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/utils/Context.sol";
// ============ ... | Approve or remove `operator` as an operator for the caller. Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller./ | function _setApprovalForAll(
address owner,
address operator,
bool approved
) internal virtual {
if (owner == operator) revert InvalidCall();
_operatorApprovals[owner][operator] = approved;
emit ApprovalForAll(owner, operator, approved);
}
| 977,340 |
//*********************************************************************//
//*********************************************************************//
//
// __/\\\\\\\\\\\\\\\__/\\\______________________________________/\\\\\\\\\\\\______________________/\\\\\\___________________/\\\____________/\\\\\____________/\\\\\___... | Update the maximum amount of tokens that can be minted by a unique wallet _newWalletMax the new max of tokens a wallet can mint. Must be >= 1/ | function setWalletMax(uint256 _newWalletMax) public onlyOwner {
require(_newWalletMax >= 1, "Max mints per wallet must be at least 1");
MAX_WALLET_MINTS = _newWalletMax;
}
| 1,643,483 |
./partial_match/1/0x33E9342B1bFfE3802A12cab164c532a83d00D7FB/sources/fuckftx.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("Fuck SAM Caroline Alameda FTX", "fuckftx") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
... | 16,191,692 |
pragma solidity ^0.4.2;
contract Token {
uint256 public totalSupply;
function balanceOf(address _owner) public constant returns (uint256 balance);
function transfer(address _to, uint256 _value) public returns (bool success);
function transferFrom(address _from, address _to, uint256 _value) public retur... | If we have a trade offerWe already deposited ETH. Return it backWe already deposited PPC. Return it back | function cancelTradeOffer() public {
TradeOffer storage tradeOffer = ppcTradeStatus[msg.sender];
if (tradeOffer.ethPer > 0 || tradeOffer.ppcAmount > 0) {
if (tradeOffer.buyingPPC) {
msg.sender.transfer(tradeOffer.ethPer * tradeOffer.ppcAmount);
}
e... | 2,569,755 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one... | Returns ceil(x / y) x The numerator y The denominator return z The quotient of x and y | function divCeil(uint256 x, uint256 y) internal pure returns (uint256 z) {
z = x % y == 0 ? x / y : (x/y) + 1;
}
| 1,353,061 |
pragma solidity 0.5.11;
pragma experimental ABIEncoderV2;
import "../../src/utils/RLPReader.sol";
library DexMockPreimageModel {
struct Preimage {
address venue;
address trader;
uint256 nonce;
}
/**
* For simplicity, uses abi encode/decode for the preimage for DEX mock in tes... | For simplicity, uses abi encode/decode for the preimage for DEX mock in tests./ | function decode(bytes memory preimage) internal pure returns (Preimage memory) {
(address venue, address trader, uint256 nonce) = abi.decode(preimage, (address, address, uint256));
return Preimage(venue, trader, nonce);
}
| 12,846,128 |
pragma solidity ^0.6.0;
import "./BeaconContract.sol";
contract Beacon{
function getLatestRandomness()external view returns(uint256,bytes32){}
}
contract FusionLedgerTimeSeriesOracle {
address public oracleAddress;
address public BeaconContractAddress=0x79474439753C7c70011C3b00e06e559378bAD040;
... | function setting Time Series Avarge from the Data Source | function setTimeSeriesAverage(uint _number) public {
time_series_average_number = block.timestamp + _number;
}
| 13,077,578 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;
import {MemberToken} from "@orcaprotocol/contracts/contracts/MemberToken.sol";
import {ControllerV1} from "@orcaprotocol/contracts/contracts/ControllerV1.sol";
import {TimelockController} from "@openzeppelin/contracts/governance/TimelockController.so... | Internal method to toggle a pod membership transfer lock | function _setMembershipTransferLock(uint256 _podId, bool _lock) internal {
ControllerV1 podController = ControllerV1(memberToken.memberController(_podId));
podController.setPodTransferLock(_podId, _lock);
emit PodMembershipTransferLock(_podId, _lock);
}
| 9,855,915 |
pragma solidity ^0.4.24;
// File: contracts\CloneFactory.sol
/**
*This contracts helps clone factories and swaps through the Deployer.sol and MasterDeployer.sol.
*The address of the targeted contract to clone has to be provided.
*/
contract CloneFactory {
/*Variables*/
address internal owner;
... | Swap factory functions - descriptions can be found in Factory.sol | interface Factory_Interface {
function createToken(uint _supply, address _party, uint _start_date) external returns (address,address, uint);
function payToken(address _party, address _token_add) external;
function deployContract(uint _start_date) external payable returns (address);
function getBase() external ... | 13,073,004 |
./full_match/1/0xAb1aAB90b5524ABACD1DB9bc04e4B8d44807485A/sources/Qamar.sol | Override the renounceOwnership function to disable it | function renounceOwnership() public override onlyOwner {
revert("Renouncing ownership is disabled");
}
| 8,442,640 |
./full_match/5/0x303D88278BeA4e04cA3BBa2001A1EdB509488F03/sources/contracts/CrowdFunding.sol | is everything okay? | function createCampaign(address _owner, string memory _title, string memory _description, uint256 _target, uint256 _deadline, string memory _image) public returns (uint256){
Campaign storage campaign = campaigns[numberOfCampaigns];
require(campaign.deadline < block.timestamp, "The deadline should b... | 11,594,029 |
./full_match/56/0x1C5C0E1B96E7ADDC14AED3688E547A6103A244d9/sources/project_/contracts/Router1.sol | Restores all previously set fees by iterating through the `fees` array and setting the values to the corresponding values in the `previousFees` array./ Set the current fee to its previous non-zero value | function restoreAllFee() private {
for (uint256 i = 0; i < fees.length; i++) {
fees[i] = previousFees[i];
}
}
| 3,227,197 |
./full_match/8453/0x02F55D53DcE23B4AA962CC68b0f685f26143Bdb2/sources/contracts/Swap.sol | Callback for swapX2Y and swapX2YDesireY, in order to pay tokenX from trader. x amount of tokenX need to pay from trader y amount of tokenY trader acquired data encoded SwapCallbackData token0 is x, amount of token0 is input param called from swapX2Y(...) token1 is x, amount of token1 is calculated param called from ... | function swapX2YCallback(
uint256 x,
uint256 y,
bytes calldata data
) external override {
SwapCallbackData memory dt = abi.decode(data, (SwapCallbackData));
(address token0, address token1, uint24 fee) = dt.path.decodeFirstPool();
verify(token0, token1, fee);
... | 11,552,111 |
pragma solidity ^0.4.24;
contract Token {
function transfer(address _to, uint _value) public returns (bool success);
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
function allowance(address _owner, address _spender) public view returns (uint256 remaining);... | / Only the owner of the mortgage and if the mortgage is pending Transfer the deposit back to the borrower | function cancelMortgage(uint256 id) external returns (bool) {
Mortgage storage mortgage = mortgages[id];
require(msg.sender == mortgage.owner, "Only the owner can cancel the mortgage");
require(mortgage.status == Status.Pending, "The mortgage is not pending");
mortg... | 323,680 |
// SPDX-License-Identifier: AGPL-3.0-only
/*
Bounty.sol - SKALE Manager
Copyright (C) 2020-Present SKALE Labs
@author Dmytro Stebaiev
SKALE Manager is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Softw... | Returns rotation details for a given schain./ | function getRotation(bytes32 schainIndex) external view returns (Rotation memory) {
return rotations[schainIndex];
}
| 401,070 |
./full_match/1/0x06091717521c2002f2859c75f53987eaF1E5aa2f/sources/contracts/CEther.sol | The sender liquidates the borrowers collateral. The collateral seized is transferred to the liquidator. Reverts upon any failure borrower The borrower of this cToken to be liquidated cTokenCollateral The market in which to seize collateral from the borrower/ | function liquidateBorrow(address borrower, CTokenDeprecated cTokenCollateral) external payable {
(uint err,) = liquidateBorrowInternal(borrower, msg.value, cTokenCollateral);
requireNoError(err, "liquidateBorrow failed");
}
| 9,695,985 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
/**
* @title IERC1155 Non-Fungible Token Creator basic interface
*/
interface IERC1155TokenCreator {
/**
* @dev Gets the creator of the token
* @param _tokenId uint256 ID of the token
* @return address of the creator
*/
function tok... | / currentBidDetailsOfToken/ Function to get current bid and bidder of a token. _tokenId uin256 id of the token. _owner address of the token owner/ | function currentBidDetailsOfToken(uint256 _tokenId, address _owner)
public
view
returns (uint256, address)
{
return (
activeBid[_tokenId][_owner].amount,
activeBid[_tokenId][_owner].bidder
);
}
| 1,455,519 |
./partial_match/1/0xe50424Df644BC6d7f623c3Dcf4B2C3F38e339063/sources/IModuleRegistry.sol | IModuleRegistry Interface for the registry of authorised modules./ | interface IModuleRegistry {
function registerModule(address _module, bytes32 _name) external;
function deregisterModule(address _module) external;
function registerUpgrader(address _upgrader, bytes32 _name) external;
function deregisterUpgrader(address _upgrader) external;
function recoverToken(... | 9,321,106 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/****************************************
* A GOLDENX CONTRACT
* @author: hammm.eth
****************************************/
import './ERC721B/ERC721EnumerableLite.sol';
import './ERC721B/Delegated.sol';
import "@openzeppelin/contracts/... | SPDX-License-Identifier: BSD-3-Clause | interface IBatch {
function isOwnerOf( address account, uint[] calldata tokenIds ) external view returns( bool );
function transferBatch( address from, address to, uint[] calldata tokenIds, bytes calldata data ) external;
function walletOfOwner( address account ) external view returns( uint[] memory );
}
| 1,646,352 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import { LibDiamondCut } from "./diamond/LibDiamondCut.sol";
import { DiamondFacet } from "./diamond/DiamondFacet.sol";
import { OwnershipFacet } from "./diamond/OwnershipFacet.sol";
import { LibDiamondStorage } from "./diamond/... | Determine the prior number of values for an account as of a block number Block number must be a finalized block or else this function will revert to prevent misinformation. _blockNumber The block number to get the vote balance at return The number of values the account had as of the given block/ First check most rece... | function getTotalPriorValues(uint256 _blockNumber) external view returns (uint96) {
require(_blockNumber < block.number, "DIFT: block not yet determined.");
if (numTotalCheckpoints == 0) {
return 0;
}
if (totalCheckpoints[numTotalCheckpoints - 1].id <= _blockNumber) {
... | 1,813,719 |
/**
*Submitted for verification at Etherscan.io on 2022-04-
*/
/**
RETURN TO SPACE v2
SPACE
https://t.me/return_to_space_ETH
THE NEW NETLFIX DOCUMETARY
Return to Space is an upcoming American documentary film made for Netflix.
Its story follows Elon Musk's and SpaceX engineers' two-decade mission to send NASA... | once enabled, can never be turned off | function enableTrading() external onlyOwner {
tradingActive = true;
swapEnabled = true;
lastLpBurnTime = block.timestamp;
launchedAt = block.number;
}
| 83,360 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
import "hardhat/console.sol";
import "usingtellor/contracts/UsingTellor.sol";
import "./interfaces/IERC20.sol";
import "./interfaces/IAutoPay.sol";
contract CrowdFund is UsingTellor {
//token interface
IERC20 public token;
IAutoPay public autoP... | artist proposes funding and scedules Tellor oracle accountability check-insgenerate Tellor query idcreate new Agreement structfill in Agreement struct from method argsempty funders mappingtotal donation in TRB = 0terminated = Falsetellor query id = hmmm.... (generated elsewhere?)url to additional agreement detailsappen... | function requestFunding(string memory _agreementURI) external {
bytes memory queryData = abi.encode(queryType, abi.encode(_agreementURI));
bytes32 queryId = keccak256(
abi.encode(queryData)
);
Agreement storage newAgreement = agreements[msg.sender];
newAgree... | 1,806,558 |
pragma solidity >=0.6.0 <0.8.0;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode... | Changes the {taxMan}./ | function transferTaxman(address taxMan_) external {
require(msg.sender == taxMan, "!taxMan");
taxMan = taxMan_;
}
| 63,731 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
pragma abicoder v2;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/utils/EnumerableSet.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openze... | View function to see pending REWARDs on frontend. | function getUserPendingRewardInfo(
AMMFactory _ammFactory,
AbstractMarketFactoryV3 _marketFactory,
uint256 _marketId,
address _userAddress
) external view returns (PendingRewardInfo memory _pendingRewardInfo) {
RewardPoolLookupInfo memory _rewardPoolLookupInfo =
... | 2,505,257 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.