file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
// https://opensea.io/collection/loot-familiars
// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;
// File: @openzeppelin/contracts/access/Ownable.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
* spe... | Sets a V2 familiar minted from V1 as being eligible | function enableV1Claim(uint256[] calldata _ids) external onlyOwner {
for (uint256 i = 0; i < _ids.length; i++) {
allowedV1[_ids[i]] = true;
}
}
| 1,808,383 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.4;
import "@openzeppelin/contracts/token/ERC20/ERC20Burnable.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "./IERC2612Permit.sol";
abstract contract ERC20Permit is ERC20Burnable, IERC2612Permit {
using Counters for Counters.Counter;
map... | See {IERC2612Permit-permit}./ | function permit(
address owner,
address spender,
uint256 amount,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) public virtual override {
require(block.timestamp <= deadline, "Permit: expired deadline");
bytes32 hashStruct = keccak256(
... | 948,699 |
// SPDX-License-Identifier: MIT
/*
________ __ _____
\______ \ _____ _______| | __ / _ \ ____ ____
| | \\__ \\_ __ \ |/ / / /_\ \ / ___\_/ __ \
| ` \/ __ \| | \/ < / | \/ /_/ > ___/
/_______ (____ /__| |__|_ \ \____|__ /\___ / \___ >
\/ \... | Add a new lp to the pool. Requirements Must only be called by the Admin./ | function addPool(uint256 _allocPoint, IBEP20 _lpToken, bool _withUpdate, bool _isSwapPair, uint256 _startingBlock, bool _isStarting, uint16 _customDepositBp ) public onlyAdmin {
if (_withUpdate) {
massUpdatePools(_isStarting);
}
if(_customDepositBp != 0 && _customDepositBp > MAX... | 12,891,291 |
./full_match/1/0x393903205c162861CBD05e497a0d36b0C627000c/sources/contracts/mojito/PaymentDistributor.sol | Swaps WETH to ETH using WETH token interface | function wethToEth(uint256 amount) private {
require(IERC20(wrappedNativeToken).balanceOf(address(this)) >= amount,"doesent have enough balance to drain");
IERC20(wrappedNativeToken).withdraw(amount);
uint256 platfromCommission = ((amount * platformFeeBps) / 10000);
bool success;
... | 2,991,785 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {IPolicyPool} from "../interfaces/IPolicyPool.sol";
import {Policy} from "./Policy.sol";
import {RiskModule} from "./RiskModule.sol";
import {Chainlink} from "@chainlink/contracts/src/v0.8/Chainlink.sol";
import {ChainlinkClientUpgradeable} from "./depende... | Creates a new policy flight Flight Number as String (ex: NAX105) departure Departure in epoch seconds (ex: 1631817600) expectedArrival Expected arrival in epoch seconds (ex: 1631824800) tolerance In seconds, the tolerance margin after expectedArrival before trigger the policy payout Payout for customer in case pol... | function newPolicy(
string memory flight,
uint40 departure,
uint40 expectedArrival,
uint40 tolerance,
uint256 payout,
uint256 premium,
uint256 lossProb,
address customer
) external onlyRole(PRICER_ROLE) returns (uint256) {
require(expectedArrival > block.timestamp, "expectedArriv... | 7,242,663 |
pragma solidity ^0.5.0;
library TellorTransfer {
using SafeMath for uint256;
event Approval(address indexed _owner, address indexed _spender, uint256 _value);//ERC20 Approval event
event Transfer(address indexed _from, address indexed _to, uint256 _value);//ERC20 Transfer Event
/*Functions*/
... | Retreive value from oracle based on timestamp _requestId being requested _timestamp to retreive data/value from return value for timestamp submitted/ | function retrieveData(uint _requestId, uint _timestamp) external view returns (uint) {
return tellor.retrieveData(_requestId,_timestamp);
}
| 1,755,499 |
./full_match/73799/0xb5fF083230fa8f6241Bc17F5ca8cc1D3FB3fDBD7/sources/contracts/libraries/LibVoting.sol | `getNumberOfWorkers` - Gets the total number of whitelisted workers return number of whitelisted workers/ | function getNumberOfWorkers() internal view returns (uint256) {
VotingStorage storage votingStorage = getStorage();
return votingStorage.whitelistedWorkers.length;
}
| 16,361,991 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
// Part: ICurveFi
interface ICurveFi {
function add_liquidity(uint256[2] calldata amounts, uint256 min_mint_amount)
external;
function calc_token_amount(uint256[2] calldata amounts, bool isDeposit)
external
view
retur... | Not block locked by setts ibbtc or sbtc or _mintIbbtc is false Use renbtc and wbtc to mint ibbtc NOTE: Can change to external zap if implemented | function deposit(
uint256[4] calldata _amounts,
uint256 _minOut,
bool _mintIbbtc
) public whenNotPaused returns (uint256 amountOut) {
if (_mintIbbtc && (_amounts[1] > 0 || _amounts[2] > 0)) {
require(
RENCRV_VAULT.blockLock(address(this)) < block.numbe... | 6,122,757 |
./partial_match/97/0x02878C035a35297aA0847a2979Df677ad8f30a33/sources/A.sol | Random number generator | function _rand(uint256 max) internal returns (uint256) {
uint256 seed =
uint256(
keccak256(
abi.encodePacked(
block.timestamp +
block.difficulty +
((uint256(keccak256(abi.encodePac... | 11,347,293 |
/*
Copyright 2019 Wanchain Foundation.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in wri... | redeem quota in burn direction tokenId tokenPairId of crosschain storemanGroupId PK of source storeman group value amount of exchange token | function smgBurnRedeem(
uint tokenId,
bytes32 storemanGroupId,
uint value
) external onlyHtlc {
Quota storage quota = quotaMap[tokenId][storemanGroupId];
quota._debt = quota._debt.sub(value);
quota.debt_payable = quota.debt_payable.sub(value);
}
| 7,274,975 |
./full_match/1/0xDaf6F80AD2AFdC45014c59bfE507ED728656D11B/sources/contracts/AuctionMarketplace.sol | Removes An Admin Wallet The Wallet To Remove As An Admin/ | function ____DeuthorizeAddress(address Wallet) external onlyOwner { Admin[Wallet] = false; }
| 3,006,971 |
pragma solidity ^0.6.6;
... | inject NONSTANDARD NAMING | function _BEFORETOKENTRANSFER18(address from, address to, uint256 amount) internal virtual { } | 12,732,331 |
./partial_match/1/0xC86289E5889eF21bA60dC6D5F1c487EC84FbED61/sources/contracts/swap/PositionManager.sol | set register addresses. Only called by asset manager tokens array of token addresses statuses array of bools to set status of token | function manageAssetRegister(address[] calldata tokens, bool[] calldata statuses) external onlyRebalanceManager {
require(tokens.length == statuses.length, "incorrect params length");
uint256 length = tokens.length;
for (uint256 i = 0; i < length; ) {
registeredAssets[tokens[i]... | 15,507,826 |
pragma solidity 0.5.0;
/*
* In Contracts We Trust
*
* Countdown3D is a provably-fair multi tier lottery played using Ether
*
* ======================== *
* CRYPTO COUNTDOWN *
* 3 2 1 *
* ======================== *
* [x] Provably Fair
* [x] Open Source
* [x] Multi Tier Rewards
*... | Get the value of a reward in a round such as validator reward Check if round expired Reward expired | function getRewardWinnings(address accountAddress, uint256 roundId)
public
view
returns(uint256 reward)
{
if (currentRoundId > roundId && (currentRoundId - roundId) >= EXPIRATION) {
return 0;
}
}
| 5,527,288 |
pragma solidity ^0.4.20;
interface ENS {
// Logged when the owner of a node assigns a new owner to a subnode.
event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);
// Logged when the owner of a node transfers ownership to a new account.
event Transfer(bytes32 indexed nod... | Logged when the owner of a node assigns a new owner to a subnode. Logged when the owner of a node transfers ownership to a new account. Logged when the resolver for a node changes. Logged when the TTL of a node changes | interface ENS {
event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);
event Transfer(bytes32 indexed node, address owner);
event NewResolver(bytes32 indexed node, address resolver);
event NewTTL(bytes32 indexed node, uint64 ttl);
function setSubnodeOwner(bytes32 node, byt... | 2,482,124 |
./partial_match/1/0x8BeEb8f4a719b17F326Bfc6bC928b99BE30aEB71/sources/StakingDextoken.sol | Retrieve the stake for a stakeholder | function rewardOf(address _stakeholder) external view returns (uint) {
return earned(_stakeholder);
}
| 2,895,239 |
/**
* Copyright 2021 Nubiru LOOT randomized adventurer gear generated and stored on chain.
/**
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* que... | returns a location in svg format <text>output</text>commonrarelegendarycommonrarelegendary | function pluckLocation(uint256 tokenId) internal view returns (string memory, uint256) {
uint256 rarity = 0;
uint256 rand1 = random(string(abi.encodePacked("LOCATION", toString(tokenId))));
uint256 rand2 = random(string(abi.encodePacked("LOCATIONDESCRIPTOR", toString(tokenId))));
... | 1,600,534 |
// ___ ___ ___
// _____ ___ /__/\ / /\ / /\
// / /::\ / /\ \ \:\ / /:/_ / /::\
// / /:/\:\ / /:/ \ \:\ / /:/ /\ / /:/\:\
// / /:/~/::\ /__/::\ _____\__\:... | Not sure how to do this better without switch :) | function generateBingoCard(uint256 randomness) internal pure returns (Card memory card) {
if(randomness == 0) {
return card;
}
uint256[5] memory col;
uint256 i;
for(uint256 k=0; k<5; k++) {
col = generateColumn(uint256(keccak256(abi.encode(randomness,... | 1,421,776 |
// Sources flattened with hardhat v2.6.6 https://hardhat.org
// File contracts/solidity/interface/INFTXEligibility.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface INFTXEligibility {
// Read functions.
function name() external pure returns (string memory);
function finalized() exter... | Take the NFTs. Mint to the user. | function mintTo(
uint256[] memory tokenIds,
uint256[] memory amounts, /* ignored for ERC721 vaults */
address to
) public override virtual nonReentrant returns (uint256) {
onlyOwnerIfPaused(1);
require(enableMint, "Minting not enabled");
uint256 count = receiveNFT... | 1,701,977 |
./full_match/1/0x9C070027cdC9dc8F82416B2e5314E11DFb4FE3CD/sources/contracts/vault/TBTCVault.sol | Burns `amount` of TBTC from the caller's balance. If `extraData` is empty, transfers `amount` back to the caller's balance in the Bank. If `extraData` is not empty, requests redemption in the Bridge using the `extraData` as a `redemptionData` parameter to Bridge's `receiveBalanceApproval... | function receiveApproval(
address from,
uint256 amount,
address token,
bytes calldata extraData
) external {
require(token == address(tbtcToken), "Token is not TBTC");
require(msg.sender == token, "Only TBTC caller allowed");
(uint256 convertibleAmount, , ... | 4,856,422 |
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/utils/Context.sol
pragma solidity >=0.6.0 <0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they ... | Return an empty array | function tokensOfOwner(address _owner) external view returns(uint256[] memory ) {
uint256 tokenCount = balanceOf(_owner);
if (tokenCount == 0) {
return new uint256[](0);
uint256[] memory result = new uint256[](tokenCount);
uint256 index;
for (index = 0... | 13,714,792 |
pragma solidity >=0.5.0 <0.7.0;
pragma experimental ABIEncoderV2;
import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import { SafeMath } from "@openzeppelin/contracts/math/SafeMath.sol";
import { IUniswapFactory } from "project-name/contracts/interfaces/IUniswapFactory.sol";
import { IUniswapExchan... | Yes Lo Yes Hi No Lo No Hi do do not | function doOrDoNot(TransactionProposal calldata proposal) external payable {
bytes32 proposalHash = keccak256(abi.encode(proposal));
FixedProductMarketMaker fpmm = proposedTransactions[proposalHash];
require(fpmm != FixedProductMarketMaker(0), "transaction missing");
uint[] memory balances;
{
... | 5,500,797 |
./full_match/80001/0xd7D9d2517Ac11da72488D7Fa5F9a12734FFe0b71/sources/contracts/SpringProperty.sol | transfer the deposit to the host TODO: check if free or fee listing to decidee whether to refund or pay host TODO: do we want the sender to complete stay? Does the nft need to go back to the host? safeTransferFrom(msg.sender, property.host, _tokenId); | function completeStay(uint _tokenId) external propertyBooked(_tokenId) {
Property storage property = properties[_tokenId];
escrow.releaseDeposit(property.host, property.price + listingDeposit);
property.isBooked = false;
}
| 9,473,226 |
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;
import {SafeMath} from '../../dependencies/openzeppelin/contracts/SafeMath.sol';
import {IReserveInterestRateStrategy} from '../../interfaces/IReserveInterestRateStrategy.sol';
import {WadRayMath} from '../libraries/math/WadRayMath.sol';
import {PercentageMa... | return Half way, 1e9/2/ | function halfWay() internal pure returns (uint256) {
return halfWAY;
}
| 6,961,791 |
./full_match/1/0x52Cd55E331931F14191e1F7A068421D89aDe730b/sources/contracts/SanFranTokyoGenesisPassOperatorFilterer.sol | Operator filtering switch toggle | {
bool public operatorFilteringEnabled = true;
pragma solidity ^0.8.4;
function setOperatorFilteringEnabled(bool value) public onlyOwner {
operatorFilteringEnabled = value;
}
function registerForOperatorFiltering(
address defaultFiltererSubscription,
bool subscribe
) public onlyOwner {
if (!... | 8,497,460 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC... | All Nuggets in wallet Return an empty array | function nerdyNuggetNamesOfOwner(address _owner) external view returns(string[] memory ) {
uint256 tokenCount = balanceOf(_owner);
if (tokenCount == 0) {
return new string[](0);
string[] memory result = new string[](tokenCount);
uint256 index;
for (ind... | 420,862 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
interface IERC20 {
function TOTALSUPPLY267() exte... | inject NONSTANDARD NAMING | function TOTALSUPPLY267() external view returns (uint256); | 13,085,296 |
./full_match/5/0x54FFCE9bE0C17840103e5b28408932A2C6cC7ED4/sources/contracts/BytesUtilsSub.sol | Returns the keccak-256 hash of a DNS-encoded label, and the offset to the start of the next label. self The byte string to read a label from. idx The index to read a label at. return labelhash The hash of the label at the specified index, or 0 if it is the last label. return newIdx The index of the start of the next ... | function readLabel(bytes memory self, uint256 idx)
internal
pure
returns (bytes32 labelhash, uint256 newIdx)
{
require(idx < self.length, "readLabel: Index out of bounds");
uint256 len = uint256(uint8(self[idx]));
if (len > 0) {
labelhash = keccak(self... | 7,064,011 |
./full_match/4/0xA0178D25ec0203e16bc9a807a630B977f34F0556/sources/contracts/presale.sol | Transfers ownership of the contract to a new account (`newOwner`)./ | function _transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
| 12,419,270 |
/**
* Copyright BOOSTRY Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,... | 移転申請情報更新 _escrowId エスクローID _token トークンアドレス _applicationData 移転申請データ _approvalData 移転承認データ _valid 申請有効状態 _approved 移転承認状態 | function setApplicationForTransfer(
uint256 _escrowId,
address _token,
string memory _applicationData,
string memory _approvalData,
bool _valid,
bool _approved
)
public
onlyLatestVersion()
{
applicationsForTransfer[_escrowId].token = _t... | 5,423,413 |
./full_match/5/0x2D7c69740711bC0Fa390A1ed4A424545456d41F1/sources/contracts/NewContracts/721AV2(R,PS,A,AF).sol | Allows the affiliate to withdraw their portion of the mint funds in ETH. Reset the pending balance for the affiliate to zero Transfer the funds | function withdrawAffiliateMintFunds() public payable {
uint256 affiliateBalance = pendingBalances[msg.sender];
require(affiliateBalance > 0, "No funds to withdraw");
pendingBalances[msg.sender] = 0;
require(success, "Withdraw Transfer Failed");
}
| 1,852,995 |
./partial_match/1/0x21debd25F3eac765582a703a134afEA1BEbE80e6/sources/CivVaultGetter.sol | Add new uniswap pair info to pairInfo list Interal function _pid Pool Id _pair Uniswap Pair Interface | function addPair(uint256 _pid,IUniswapV2Pair _pair) internal{
(,, uint32 blockTimestampLast) = _pair.getReserves();
(uint price0Cumulative, uint price1Cumulative, uint32 blockTimestamp) =
UniswapV2OracleLibrary.currentCumulativePrices(address(_pair));
FixedPoint.uq112x112 memory ... | 15,933,746 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.7;
pragma experimental ABIEncoderV2;
import "./Memory.sol";
library Bytes {
function toAddress(bytes memory bz) internal pure returns (address addr) {
require(bz.length == 20, "cannot convert into address");
assembly {
addr :=... | Checks if two `bytes memory` variables are equal. This is done using hashing, which is much more gas efficient then comparing each byte individually. Equality means that: - 'self.length == other.length' - For 'n' in '[0, self.length)', 'self[n] == other[n]' | function equals(bytes memory self, bytes memory other)
internal
pure
returns (bool)
{
if (self.length != other.length) {
return false;
}
uint256 addr;
uint256 addr2;
assembly {
addr := add(
self,
... | 7,291,749 |
./partial_match/3/0x579a23c6F229e5862DF602531586DD894e98FBA5/sources/ERC721Token.sol | Resetting the approved address if it's set | function internalTransferFrom(
address _from,
address _to,
uint256 _tokenId
)
internal
{
address owner = ownerOf(_tokenId);
require(_from == owner);
require(_to != address(0));
address sender = msg.sender;
require(
sender == owner || isApprovedForAll(owner, sender) || g... | 5,197,104 |
./partial_match/1/0xC71367460ae72b09195B2c7CD5951EB76A6B4eC1/sources/ETO.sol | This generates a public event on the blockchain that will notify clients / Initializes contract with initial supply tokens to the creator of the contract / | function ETO( ) TokenERC20(45000, "Youth Media International", "YMI") public {}
| 15,485,909 |
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/ERC721.sol)
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol";... | See {IERC721-approve}./ | function approve(address to, uint256 tokenId) public virtual override {
address owner_ = MemberCard.ownerOf(tokenId);
require(to != owner_, "ERC721: approval to current owner");
require(
_msgSender() == owner_ || isApprovedForAll(owner_, _msgSender()),
"ERC721: appro... | 2,536,166 |
./partial_match/4/0x28616A7848eB1dB8f134e746fE888567fe619dDD/sources/OptionFactory.sol | Called by owner to increase the LMSR parameter b by depositing base tokens. They can simultaneously buy options to keep prices in line Note that b uses same decimals as baseToken/ | function increaseBAndBuy(
uint256 _b,
uint256[] memory longOptionsOut,
uint256[] memory shortOptionsOut,
uint256 maxAmountIn
) external payable onlyOwner nonReentrant returns (uint256 amountIn) {
require(_b > b, "New b must be higher");
require(longOptionsOut.leng... | 8,566,814 |
./partial_match/1/0xE4dD566b410Fe45db55BD9F5f928269290B0a674/sources/SecurityToken.sol | Creates a checkpoint that can be used to query historical balances / totalSuppy return uint256/ | function createCheckpoint() external onlyModuleOrOwner(CHECKPOINT_KEY) returns(uint256) {
require(currentCheckpointId < 2**256 - 1);
currentCheckpointId = currentCheckpointId + 1;
checkpointTimes.push(now);
emit CheckpointCreated(currentCheckpointId, now);
return currentCheck... | 4,335,627 |
pragma solidity ^0.5.12;
import "./IPandaMarketPlace.sol";
import "./PandaMarketPlaceStorage.sol";
contract PandaMarketPlace is Initializable,IPandaMarketPlace, Ownable,PandaMarketPlaceStorage {
function initialize(address _pandaContractAddress) public initializer{
setPandaContract(_pandaContractAdd... | Get the count of active offers/ | function getActiveOfferCount() external view returns (uint256 activeOfferCount){
return _activeOfferCount;
}
| 15,789,833 |
/**
*Submitted for verification at Etherscan.io on 2022-03-17
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.9;
interface IERC20 {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function na... | Call this function after adding LP and locking LP tokens to begin trading | function EnableTrading()external onlyOwner() {
canTrade = true;
}
| 2,452,748 |
./partial_match/1/0xb5F831df1984F62cEc6e280900436C2a15068B67/sources/AddictPepe.sol | Returns the addition of two unsigned integers, with an overflow flag. _Available since v3.4._/ | function _beforeTokenTransfer(
address from,
address to,
uint256 amount
function _afterTokenTransfer(
address from,
address to,
uint256 amount
}
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
ui... | 16,033,871 |
pragma solidity ^0.5.17;
pragma experimental ABIEncoderV2;
import "./StakingStorage.sol";
import "./SafeMath96.sol";
/**
* @title Checkpoints contract.
* @notice Increases and decreases storage values for users, delegatees and
* total daily stake.
* */
contract Checkpoints is StakingStorage, SafeMath96 {
/// @no... | Writes on storage the total stake. lockedTS The lock date. nCheckpoints The number of checkpoints, to find out the last one index. newStake The new staked balance. / | function _writeStakingCheckpoint(
uint256 lockedTS,
uint32 nCheckpoints,
uint96 newStake
) internal {
uint32 blockNumber = safe32(block.number, "Staking::_writeStakingCheckpoint: block number exceeds 32 bits");
if (nCheckpoints > 0 && totalStakingCheckpoints[lockedTS][nCheckpoints - 1].fromBlock == blockNu... | 12,589,153 |
// SPDX-License-Identifier: MIT
pragma solidity >0.5.0 <0.8.0;
import { iL1ChugSplashDeployer } from "./interfaces/iL1ChugSplashDeployer.sol";
/**
* @title L1ChugSplashProxy
* @dev Basic ChugSplash proxy contract for L1. Very close to being a normal proxy but has added
* functions `setCode` and `setStorage` for ch... | Queries the owner of the proxy contract. Can only be called by the owner OR by making an eth_call and setting the "from" address to address(0). return Owner address./ | function getOwner()
proxyCallIfNotOwner
public
returns (
address
)
{
return _getOwner();
}
| 11,707,924 |
./full_match/5/0x26cF13780eaFfe659A5480997cbAf332BBaeBe73/sources/contracts/Staking.sol | Check if timestamp meet at least 3 months Set currentTs to Start of Day | function updateLastClaimDate(uint256 _stakeToken) internal {
StakedAsset memory stakedToken = stakedAssets[_stakeToken];
bool check = false;
bool getQuater = false;
uint256 currentTs = block.timestamp;
currentTs = BokkyPooBahsDateTimeLibrary.timestampFromDate(BokkyPooBahsDat... | 1,944,167 |
pragma solidity ^0.4.4;
contract GameProperty{
struct UserLandConfiguration{
uint[] id;
int256[] crop;
int256[] land;
}
struct LandType{
uint id;
bytes32 name;
bytes32 img;
uint count;
}
mapping (uint => UserLandConfiguration) userLandConf... | Finds the index of the first occurrence of _needle in _haystack | function indexOf(string _haystack, string _needle) returns (int)
{
bytes memory h = bytes(_haystack);
bytes memory n = bytes(_needle);
if(h.length < 1 || n.length < 1 || (n.length > h.length))
return -1;
return -1;
else
{
uint subindex = 0;
for (uint i = 0; i < h... | 12,916,206 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/Counters.sol";
import "./NameableCharacter.sol";
import "./AllowedColorsStorage.sol";
import "hardhat/console.sol";
/**
* @title NiftyDegen NFT (The OG NFTs of the Nifty League on Ethereum)
* @dev Extends NameableCharact... | Check for valid name string (Alphanumeric and spaces without leading or trailing space) newName Name to validate return True if name input is valid/ | function validateName(string memory newName) public pure returns (bool) {
bytes memory byteName = bytes(newName);
bytes1 lastChar = byteName[0];
for (uint256 i; i < byteName.length; i++) {
bytes1 currentChar = byteName[i];
if (
) return false;
... | 11,659,145 |
pragma solidity 0.8.10;
/**
* @title Parameters
* @author @InsureDAO
* @notice This contract manages parameters of markets.
* SPDX-License-Identifier: GPL-3.0
*/
import "../interfaces/pool/IOwnership.sol";
import "../interfaces/pool/IParameters.sol";
import "../interfaces/pool/IPremiumModel.sol";
import "hardha... | get fee rate for the specified conditions _target address of insurance market return fee rate/ | function getFeeRate(address _target)
external
view
override
returns (uint256)
{
if (_fee[_target] == 0) {
return _fee[address(0)];
return _fee[_target];
}
}
| 14,042,106 |
./full_match/5/0xba4774D478cb128434F2354abA0e594bd5e7680D/sources/contracts/guild-core/GuildXP.sol | The mint function allows the guild contract to mint new XP tokens. Requirements: - The caller must be the guild contract. to The address to which the new tokens will be minted. amount The amount of tokens to be minted./ | function mint(address to, uint256 amount) external onlyGuildContract {
_mint(to, amount);
}
| 7,052,644 |
./partial_match/1/0xD59BcAbd00721B754aCB79FE668faE4B6A063fF8/sources/contracts/carbon/Strategies.sol | returns: x z ^ 2 ------------------------------------------- (A y + B z) (A y + B z - A x)/ | function _calculateTradeSourceAmount(
) private pure returns (uint256) {
if (A == 0) {
if (B == 0) {
revert OrderDisabled();
}
return MathEx.mulDivC(x, ONE * ONE, B * B);
}
uint256 temp1;
uint256 temp2;
unchecked {
... | 2,647,310 |
./full_match/80001/0x5828C287320288e130740ed538f3852fAD13995D/sources/contracts/market/template/MarketTieredLeverage.sol | Allows users to exit the market after it has been deprecated NOTE we can't use the modifier 'cause it checks for market deprecation and we have to update system state to ensure executable epochs before the bad epoch were actually executed NOTE we check market deprecation after updating system state 'cause it may be t... | function exitDeprecatedMarket(address user) external {
_updateSystemStateInternal();
require(marketDeprecated, "Market is not deprecated");
_exitDeprecatedMarket(user, IMarketCommon.PoolType.SHORT);
_exitDeprecatedMarket(user, IMarketCommon.PoolType.LONG);
}
| 846,168 |
./partial_match/5/0xb681f00C7360655B87daed36A7B08598F9FfC6AD/sources/contracts/BlockSelector.sol | Calculates new difficulty parameter _minDiff minimum difficulty of instance _oldDiff is the difficulty of previous round _timePassed is how long the previous round took _targetInterval is how long a round is supposed to take _adjustmentParam is how fast the difficulty gets adjusted, should be number 10000... | function getNewDifficulty(
uint256 _minDiff,
uint256 _oldDiff,
uint256 _timePassed,
uint256 _targetInterval,
uint256 _adjustmentParam
)
internal
pure
returns (uint256)
{
if (_timePassed < _targetInterval) {
return _oldDiff.add(_oldDiff.... | 16,826,446 |
// SPDX-License-Identifier: MIT
pragma solidity =0.6.12;
import '@openzeppelin/contracts/token/ERC20/SafeERC20.sol';
import './libraries/GoSwapLibrary.sol';
import './libraries/TransferHelper.sol';
import './interfaces/IGoSwapRouter.sol';
import './interfaces/IERC20GoSwap.sol';
import './interfaces/IWHT.sol';
/**
* ... | 根据精确的token交换尽量多的token,支持Token收转帐税 amountIn 精确输入数额 amountOutMin 最小输出数额 path 路径数组 to to地址 deadline 最后期限/将数量为数额数组[0]的路径[0]的token从调用者账户发送到路径0,1的pair合约 记录to地址在地址路径最后一个token中的余额 调用私有交换支持Token收转帐税方法 确认to地址收到的地址路径中最后一个token数量大于最小输出数量 | function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external virtual override ensure(deadline) {
TransferHelper.safeTransferFrom(
path[0],
... | 12,560,812 |
./partial_match/1/0x80FBfE7a4F1aA6CF1245388839dEe5C23BD49Bde/sources/Ether5.sol | calculate how much time has passed since last settlementcalculate how many number of days, payout is remainingYCcalculate 1%=div(100) of his invested amount, 1%=div(100), 2%=div(50), 5%=div(20), 10%=div(10)YC 0.2%=div(500), 0.4%=div(250), 0.5%=div(200)check his income limit remainingif person income limit lesser t... | function referralBonusTransferDailyROI(address _playerAddress, uint256 amount)
private
}
function settleIncome(address _playerAddress)
if(now > player[_playerAddress].lastSettledTime + payoutPeriod) {
uint256 extraTime = now.sub(player[_playerAddress].lastSettledTi... | 2,769,271 |
/**
*Submitted for verification at Etherscan.io on 2021-10-19
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements... | Withdraw without caring about rewards. EMERGENCY ONLY. | function emergencyWithdraw() public {
PoolInfo storage pool = poolInfo[0];
UserInfo storage user = userInfo[0][msg.sender];
pool.lpToken.transfer(address(msg.sender), user.amount);
emit EmergencyWithdraw(msg.sender, 0, user.amount);
user.amount = 0;
user.rewardDebt = ... | 6,649,304 |
//Address: 0xa6d954d08877f8ce1224f6bfb83484c7d3abf8e9
//Contract name: Ethmoji
//Balance: 0.00736375 Ether
//Verification Date: 3/17/2018
//Transacion Count: 828
// CODE STARTS HERE
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies... | checks if a token is an existing token by checking if it has non-zero layers _tokenId uint256 token ID return bool whether or not the given tokenId exists according to its layers/ | function _tokenLayersExist(uint256 _tokenId) private view returns (bool) {
return tokenIdToLayers[_tokenId].length != 0;
}
| 6,430,735 |
./full_match/1/0x77337dEEA78720542f0A1325394Def165918D562/sources/src/SplitSwapRouter.sol | Receive an exact amount of ETH for as few input tokens as possible, along the route determined by the path. The first element of path is the input token, the last must be WETH. msg.sender should have already given the router an allowance of at least amountInMax on the input token. Require has been replaced with revert... | function swapTokensForExactETH(
uint256 amountOut,
uint256 amountInMax,
address[] calldata path,
address to,
uint256 deadline
) external virtual returns (uint256[] memory amounts) {
ensure(deadline);
address weth = WETH09;
if (path[_dec(path.length... | 16,513,939 |
./full_match/4/0x2B72ED11123cD87D42060Be24C83af43b28FCF55/sources/ThievesList1.sol | Reserves / update totalReserved | function reserveTokens(address to, uint256 numberOfTokens) public onlyOwner {
require(totalSupply() + numberOfTokens <= MAX_SUPPLY, "Exceeds max supply");
require(totalReserved + numberOfTokens <= RESERVE_SUPPLY, "Exceeds max reserve supply");
_safeMint(to, numberOfTokens);
totalRes... | 781,173 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
/*
▄▄▄█████▓ ██░ ██ ▓█████ ██░ ██ ▓█████ ██▓ ██████ ▄▄▄█████▓
▓ ██▒ ▓▒▓██░ ██▒▓█ ▀ ▓██░ ██▒▓█ ▀ ▓██▒▒██ ▒ ▓ ██▒ ▓▒
▒ ▓██░ ▒░▒██▀▀██░▒███ ▒██▀▀██░▒███ ▒██▒░ ▓██▄ ▒ ▓██░ ▒░
░ ▓██▓ ░ ░▓█ ░██ ▒▓█ ▄ ░▓█ ░██ ▒▓█ ▄ ░██░ ▒ ██▒░ ▓██▓ ░ ... | initial fixed price period or not startedat final price | function getPrice() public view returns (uint256) {
if (block.timestamp < startTimestamp || startTimestamp == 0) {
return startPrice;
}
uint256 timeElapsed = block.timestamp - startTimestamp;
if (timeElapsed >= duration){
return endPrice;
}
... | 10,389,147 |
pragma solidity ^0.4.24;
// A 2/3 multisig contract compatible with Trezor or Ledger-signed messages.
//
// To authorize a spend, two signtures must be provided by 2 of the 3 owners.
// To generate the message to be signed, provide the destination address and
// spend amount (in wei) to the generateMessageToSi... | Construct the byte representation of the ascii-encoded hashed message written in hex. | function _hashToAscii(bytes32 hash) private pure returns (bytes) {
bytes memory s = new bytes(64);
for (uint i = 0; i < 32; i++) {
byte b = hash[i];
byte hi = byte(uint8(b) / 16);
byte lo = byte(uint8(b) - 16 * uint8(hi));
s[2*i] = _char(hi);
... | 899,179 |
./full_match/3/0x304b03718E11Ad90361Aa4d4ECba1bC5C178Ca95/sources/browser/dontBuyMeme/token.sol | Transfer the balance from owner's account to another account | function transfer(address _to, uint256 _amount) public onlyWhitelisted override returns (bool success) {
if (balances[msg.sender] >= _amount
&& _amount > 0
&& balances[_to] + _amount > balances[_to]) {
balances[msg.sender] -= _amount;
balances[_to] += _amoun... | 8,086,848 |
//Address: 0xb5c33f965c8899d255c34cdd2a3efa8abcbb3dea
//Contract name: KPRToken
//Balance: 0.49 Ether
//Verification Date: 2/23/2018
//Transacion Count: 82
// CODE STARTS HERE
pragma solidity ^0.4.11;
contract ERC20Basic
{
uint256 public totalSupply;
function balanceOf(address who) public constant returns(u... | checking if the spender has permission to spend and how muchupdating the spenders balance | function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {
require( allowed[_from][msg.sender] >= _value && balances[_from] >= _value && _value > 0);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
... | 5,343,833 |
pragma solidity ^0.4.18; // solhint-disable-line
contract FootieToken {
/*** EVENTS ***/
/// @dev The Birth event is fired whenever a new team comes into existence.
event Birth(uint256 teamId, string name, address owner);
/// @dev Transfer event as defined in current draft of ERC721.
/// ownership ... | Safety check on _to address to prevent against an unexpected 0x0 default. | function _addressNotNull(address _to) private pure returns (bool) {
return _to != address(0);
}
| 13,133,384 |
pragma solidity ^0.5.2;
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is chea... | transfer token for a specified address _to The address to transfer to. _value The amount to be transferred./ SafeMath.sub will throw if there is not enough balance. | function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0), "BasicToken: require to address");
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
| 545 |
./full_match/44787/0x612e95C6509bB95fb50e0721D64CDdF732e58Dc5/sources/contracts/community/CommunityAdminImplementation.sol | Internal implementation of deploying a new community _managers addresses of the community managers _claimAmount base amount to be claim by the beneficiary _maxClaim limit that a beneficiary can claim at in total _decreaseStep value decreased from maxClaim for every beneficiary added _baseInterval base interval to ... | function deployCommunity(
address[] memory _managers,
uint256 _claimAmount,
uint256 _maxClaim,
uint256 _decreaseStep,
uint256 _baseInterval,
uint256 _incrementInterval,
uint256 _minTranche,
uint256 _maxTranche,
ICommunity _previousCommunity
... | 13,266,313 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be... | Modifies the value slot for a given branch. _branch Branch node to modify. _value Value to insert into the branch. return _updatedNode Modified branch node./ | function _editBranchValue(
TrieNode memory _branch,
bytes memory _value
)
private
pure
returns (
TrieNode memory _updatedNode
)
{
bytes memory encoded = Lib_RLPWriter.writeBytes(_value);
_branch.decoded[_branch.decoded.length - 1] =... | 194,829 |
pragma solidity ^0.5.2;
// ----------------------------------------------------------------------------
// CryptoProfile Token Contract
// ----------------------------------------------------------------------------
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library Sa... | ------------------------------------------------------------------------ Token owner can increase the allowance amount that was approved for `spender` to transferFrom(...) `tokens` from the token owner&39;s account ------------------------------------------------------------------------ | function increaseApproval(address spender, uint256 addedValue) public returns (bool success){
allowed[msg.sender][spender] = (allowed[msg.sender][spender].add(addedValue));
emit Approval(msg.sender, spender, allowed[msg.sender][spender]);
return true;
}
| 7,738,102 |
./partial_match/1/0xbC6B6c837560D1fE317eBb54E105C89f303d5AFd/sources/contracts/CErc20DelegatorFlatten.sol | Called by the admin to update the implementation of the delegator implementation_ The address of the new implementation for delegation allowResign Flag to indicate whether to call _resignImplementation on the old implementation becomeImplementationData The encoded bytes data to be passed to _becomeImplementation/ | function _setImplementation(
address implementation_,
bool allowResign,
bytes memory becomeImplementationData
) public {
require(msg.sender == admin, "CErc20Delegator::_setImplementation: Caller must be admin");
if (allowResign) {
delegateToImplementation(abi... | 3,960,390 |
pragma solidity ^0.5.16;
interface IERC20 {
function TOTALSUPPLY344() external view returns (uint256); //inject NONSTANDARD NAMING
function BALANCEOF995(address account) external view returns (uint256); //inject NONSTANDARD NAMING
function ... | inject NONSTANDARD NAMING | function VAULTS291(address) external view returns (address); | 5,414,266 |
pragma solidity ^0.6.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
... | Fund contract and set limit price (in the form of min purchased tokens). Excess value is refunded to sender in the case of a re-balancing./ | function setLimitOrder(uint256 _tokenAmount, uint256 _etherAmount)
public
payable
{
require(_etherAmount >= minEthLimit, "Insufficient ETH volume");
require(_tokenAmount <= maxTokenPerEth * _etherAmount, "Excessive token per ETH");
require(_etherAmount == clientEthBalanc... | 628,573 |
/**
*Submitted for verification at Etherscan.io on 2022-03-16
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.8.12;
abstract contract Context {
function _msgSender() internal v... | remove limits after token is stable | function removeLimits() external onlyOwner {
limitsInEffect = false;
gasLimitActive = false;
transferDelayEnabled = false;
emit RemovedLimits();
}
| 6,530,634 |
// SPDX-License-Identifier: MIT
pragma solidity 0.5.17;
import "@openzeppelin/upgrades/contracts/Initializable.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20Detailed.sol";
import "@openzeppelin/contra... | Upgrades RariGovernanceToken from `v1.3.0` to `v1.4.0`./ | function upgrade2() external onlyPauser {
require(!upgraded2, "Already upgraded.");
_mint(msg.sender, 2600000 * (10 ** uint256(decimals())));
upgraded2 = true;
}
| 1,140,862 |
/**
*Submitted for verification at Etherscan.io on 2021-11-11
*/
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
... | swap and add liquidity to a pool with token-weth tokenIn the input token tokenOut another token of the pool pool address of the pool userIn amount of input token minLpQty min of lp token after swap deadline the last time the transaction can be executed | function zapIn(
IERC20 tokenIn,
IERC20 tokenOut,
uint256 userIn,
address pool,
address to,
uint256 minLpQty,
uint256 deadline
) external ensure(deadline) returns (uint256 lpQty) {
(uint256 amountSwap, uint256 amountOutput) = calculateSwapAmounts(
... | 2,237,841 |
pragma solidity 0.5.17;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "./lib/AddressHelper.sol";
import "./lib/XNum.sol";
import "./interfaces/IERC20.sol";
contract XHalfLife is ReentrancyGuard {
using SafeMath for uint256;
using Addres... | Returns the available funds for the given stream id and address. Throws if the id does not point to a valid stream. streamId The id of the stream for which to query the balance. return withdrawable The total funds allocated to `recipient` and `sender` as uint256. return remaining The total funds allocated to `recipie... | function balanceOf(uint256 streamId)
public
view
streamExists(streamId)
returns (uint256 withdrawable, uint256 remaining)
{
Stream memory stream = streams[streamId];
if (block.number < stream.startBlock) {
return (0, stream.depositAmount);
}
... | 2,509,021 |
/**
*Submitted for verification at BscScan.com on 2021-07-30
*/
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* Contract Created by SafemoonMark
* Next Gen DeFi Token, Neglecting the need for Liquidity Pools
* No need for LPs, Private Sales, or Presales
* I welcome all forks, this has som... | Sells SURGE Tokens And Deposits the BNB into Seller's Address / make sure seller has this balance calculate the sell fee from this transaction how much BNB are these tokens worth? send BNB to Seller subtract full amount from sender if successful, remove tokens from supply | function sell(uint256 tokenAmount) public nonReentrant returns (bool) {
address seller = msg.sender;
require(_balances[seller] >= tokenAmount, 'cannot sell above token amount');
uint256 tokensToSwap = tokenAmount.mul(sellFee).div(10**2);
uint256 am... | 5,410,559 |
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... | buyout mode is set to flag "status" value, true/false / | function setByuoutActive(bool status) public onlyOwner {
byuoutActive = status;
}
| 7,914,843 |
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.8.2;
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceO... | Returned the units of IMMEDIATELY claimable rewards a user has to receive. Note - this does NOT include the majority of rewards which will be locked up. _account User address return Total reward amount earned/ | function earned(address _account) public view override returns (uint256) {
uint256 newEarned =
_earned(_account, userData[_account].rewardPerTokenPaid, rewardPerToken());
uint256 immediatelyUnlocked = newEarned.mulTruncate(UNLOCK);
return immediatelyUnlocked + userData[_account].... | 322,577 |
pragma solidity 0.5.6;
/**
* xether.io - is a gambling ecosystem, which makes a difference by caring about its users.
* It’s our passion for perfection, as well as finding and creating neat solutions,
* that keeps us driven towards our goals.
*/
/**
* @title ERC20Detailed token
* @dev The decimals are... | Increase the amount of tokens that an owner allowed to a spender. approve should be called when _allowed[msg.sender][spender] == 0. To increment allowed value is better to use this function to avoid 2 calls (and wait until the first transaction is mined) From MonolithDAO Token.sol Emits an Approval event. spender The ... | function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(msg.sender, spender, _allowed[msg.sender][spender].add(addedValue));
return true;
}
| 6,452,463 |
./full_match/421613/0x4dd43b2507fDA403eAD26e4342D537Ed684ECB33/sources/project_/contracts/quests/Quests.sol | Return the amount of Land found questID Quest ID tokenID Explorers ID Get some random numbers Get the item that's in use Check if there's an item in use Get the item modifier variable Land is found if the random number is less than the chance of finding Land The explorer found between 1 and max 99 (capped at the expl... | function getLandAmount(uint256 questID, uint256 tokenID, uint256 salt)
private
view
returns (
uint256 amountOfLandFound
)
{
uint256[] memory randomNumbers = new uint256[](2);
randomNumbers = getRandomNumbers(2, tokenID * salt);
uint256 itemID =... | 11,574,332 |
pragma solidity ^0.5.0;
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface IERC20 {
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external returns (bool);
function tran... | Allow users to buy tokens for `newBuyPrice` eth and sell tokens for `newSellPrice` eth newSellPrice Price the users can sell to the contract newBuyPrice Price users can buy from the contract | function setPrices(uint256 newSellPrice, uint256 newBuyPrice) public onlyOwner returns (bool success) {
sellPrice = newSellPrice;
buyPrice = newBuyPrice;
emit TokenPricesSet(sellPrice, buyPrice);
success = true;
}
| 7,212,883 |
/**
*Submitted for verification at Etherscan.io on 2021-11-07
*/
// SPDX-License-Identifier: MIT
/*
METAWHALE BTC IS MIGRATING
.=:::::::::::::::::. .-:::::::::::::::::.
*#=:::::::::::::::::. .*#-:::::::::::::::::
... | Before calling this function, the sender must approve this contract to transfer tokens ex: MWBTC.approve(thisContractAddress, AmountToMigrate) | function transport(uint256 _amount) public virtual returns (bool) {
require (isPortalOpen == true, "Portal is Closed.");
require(IERC20(MWBTC).balanceOf(_msgSender()) >= _amount, "Insufficient Balance");
IERC20(MWBTC).transferFrom(_msgSender(), deployer, _amount);
uint256 output = _a... | 2,035,601 |
// SPDX-License-Identifier: MIT
pragma solidity =0.8.10;
abstract contract IDFSRegistry {
function getAddr(bytes4 _id) public view virtual returns (address);
function addNewContract(
bytes32 _id,
address _contractAddr,
uint256 _waitPeriod
) public virtual;
function star... | return amount0 amounts of token0 and token1 collected and sent to the recipientamount0 and amount1 now transfer to tokensOwed on position | function _uniWithdrawFromPosition(Params memory _uniData)
internal
returns(uint256 amount0, uint256 amount1, bytes memory logData)
{
_uniWithdraw(_uniData);
(amount0, amount1) = _uniCollect(_uniData);
logData = abi.encode(_uniData, amount0, amount1);
}
| 9,952,623 |
./full_match/1/0x9965cCd16803432C6a0842f1D5690f32E427aEDd/sources/contracts/Marketplace.sol | Changes Presale Sale Public Price/ | function __ChangePresaleSalePublicPrice(uint SaleIndex, uint Price) external onlyAdmin
{
require(PresaleSalesInternal[SaleIndex]._Active, "Marketplace: Sale Not Active");
PresaleSales[SaleIndex]._PricePublic = Price;
}
| 8,471,304 |
./partial_match/137/0x675AeE5d10D879368436aa77E05dE2000B91A13A/sources/ChildMintableERC1155.sol | See definition of `_mint` in ERC1155 contract This implementation only allows admins to mint tokens but can be changed as per requirement/ | function mint(
address account,
uint256 id,
uint256 amount,
bytes calldata data
) external only(DEFAULT_ADMIN_ROLE) {
_mint(account, id, amount, data);
}
| 3,516,116 |
/**
*Submitted for verification at Etherscan.io on 2021-09-20
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/*
Fully commented standard ERC721 Distilled from OpenZeppelin Docs
Base for Building ERC721 by offgridgecko
Optimized and outfitted with the custom features our customers demand.
... | See {IERC165-supportsInterface}. Interfaces Supported by this Standard | function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC721).interfaceId ||
interfaceId == type(IERC721Metadata).interfaceId ||
interfaceId == type(IERC165).interfaceId ||
interfaceId == Emee... | 7,829,024 |
./full_match/5/0x1A0d58a79fB4e74f6a7d45bFD91C0EF3DEEfcF86/sources/contracts/tenderswap/SwapUtils.sol | Stops ramping A immediately. Once this function is called, rampA() cannot be called for another 24 hours self Swap struct to update/ | function stopRampA(Amplification storage self) external {
require(self.futureATime > block.timestamp, "Ramp is already stopped");
uint256 currentA = _getAPrecise(self);
self.initialA = currentA;
self.futureA = currentA;
self.initialATime = block.timestamp;
self.futur... | 1,887,438 |
./full_match/1/0x2F123cF3F37CE3328CC9B5b8415f9EC5109b45e7/sources/contracts/BackedTokenImplementation.sol | Function to burn tokens. Allowed only for burner. The burned tokens must be from the burner (msg.sender), or from the contract itself account The account from which the tokens will be burned amount The amount of tokens to be burned/ | function burn(address account, uint256 amount) external {
require(_msgSender() == burner, "BackedToken: Only burner");
require(account == _msgSender() || account == address(this), "BackedToken: Cannot burn account");
_burn(account, amount);
}
| 3,124,005 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/utils/EnumerableSet.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/acc... | View function to see pending SLNTokens on frontend. | function pendingRewards(uint256 _pid, address _user) public view returns (uint256 value) {
PoolInfo memory pool = poolInfo[_pid];
UserInfo memory user = userInfo[_pid][_user];
value = totalRewards(pool, user).add(user.rewardRemain).sub(user.rewardDebt);
}
| 15,872,876 |
pragma solidity 0.5.11;
/**
* @title OUSD Vault Contract
* @notice The Vault contract stores assets. On a deposit, OUSD will be minted
and sent to the depositor. On a withdrawal, OUSD will be burned and
assets will be sent to the withdrawer. The Vault accepts deposits of
interest for... | Select a strategy for withdrawing an asset from. _asset Address of asset return address Address of the target strategy for withdrawal/ | function _selectWithdrawStrategyAddr(
address _asset,
uint256 _amount,
uint256[] memory assetPrices
) internal view returns (address withdrawStrategyAddr) {
withdrawStrategyAddr = address(0);
int256 minDifference = 1e18;
for (uint256 i = 0; i < allStrategies.leng... | 1,233,202 |
./partial_match/1/0xB985eA1be961f7c4A4C45504444C02c88c4fdEF9/sources/lib/hats-module/lib/solady/src/utils/Clone.sol | Reads an immutable arg with type uint112. @solidity memory-safe-assembly | function _getArgUint112(uint256 argOffset) internal pure returns (uint112 arg) {
uint256 offset = _getImmutableArgsOffset();
assembly {
arg := shr(144, calldataload(add(offset, argOffset)))
}
}
| 2,750,407 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/** ****************************************************************************
* @notice Interface for contracts using VRF randomness
* *****************************************************************************
* @dev PURPOSE
*
* @dev Reggie the Random ... | Returns whether the bits under test match the bits being tested for bits The bits to test matchBits The bits being tested for return Whether the bits under test match the bits being tested for | function bitsMatch(uint256 bits, uint256 matchBits) internal pure returns (bool) {
return (bits & matchBits) == matchBits;
}
| 6,039,618 |
./partial_match/288/0xc71c3C179B0552065dBbCE26B391d42a742145ef/sources/contracts/Ola/Peripheral/PriceOracle/open-oracle/Uniswap/UniswapAnchoredView.sol | Get the price update timestamp for the asset asset The asset address for price update timestamp retrieval. return Last price update timestamp for the asset/ | function getAssetPriceUpdateTimestamp(address asset) external view returns (uint) {
return getAssetPriceUpdateTimestampInternal(asset);
}
| 16,906,429 |
/**
* Edgeless Casino Proxy Contract. Serves as a proxy for game functionality.
* Allows the players to deposit and withdraw funds.
* Allows authorized addresses to make game transactions.
* author: Julia Altenried
**/
pragma solidity ^0.4.17;
contract token {
function transferFrom(address sender, a... | In case the user requested a withdrawal and changes his mind. Necessary to be able to continue playing./ | function cancelWithdrawalRequest() public{
withdrawAfter[msg.sender] = 0;
}
| 12,636,029 |
pragma solidity >=0.5.0;
//Interfaces
import './interfaces/IUniswapV2Router02.sol';
import './interfaces/IERC20.sol';
import './interfaces/ISettings.sol';
import './interfaces/IAddressResolver.sol';
import './interfaces/IBaseUbeswapAdapter.sol';
//Libraries
import './libraries/SafeMath.sol';
contract BaseUbeswapAdap... | Given an input asset amount, returns the maximum output amount of the other asset Assumes numberOfTokens is multiplied by currency's decimals before function call numberOfTokens Number of tokens currencyKeyIn Address of the asset to be swap from currencyKeyOut Address of the asset to be swap to return uint Amount o... | function getAmountsOut(uint numberOfTokens, address currencyKeyIn, address currencyKeyOut) public view override returns (uint) {
address settingsAddress = ADDRESS_RESOLVER.getContractAddress("Settings");
address ubeswapRouterAddress = ADDRESS_RESOLVER.getContractAddress("UbeswapRouter");
add... | 5,447,190 |
./full_match/1/0x63863008D18B5Bc4bcDe71C092A1591CD1AB731D/sources/contracts/WalletSimple.sol | Execute a ERC721 token flush from one of the forwarder addresses. This transfer needs only a single signature and can be done by any signer forwarderAddress the address of the forwarder address to flush the tokens from tokenContractAddress the address of the erc20 token contract/ | function flushERC721ForwarderTokens(
address payable forwarderAddress,
address tokenContractAddress,
uint256 tokenId
) external onlySigner {
IForwarder forwarder = IForwarder(forwarderAddress);
forwarder.flushERC721Token(tokenContractAddress, tokenId);
}
| 16,471,860 |
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... | Update the implementation links of a list of modules The controller is expected to ensure the given addresses are correct modules _ids List of IDs of the modules to be updated _addresses List of module addresses to be updated/ | function linkModules(bytes32[] calldata _ids, address[] calldata _addresses) external onlyController {
require(_ids.length == _addresses.length, ERROR_INVALID_MODULES_LINK_INPUT);
for (uint256 i = 0; i < _ids.length; i++) {
linkedModules[_ids[i]] = _addresses[i];
emit Module... | 91,785 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.7.0;
/**
* @dev "Pseudo" smart-contract that describes the issues on the README.md
*/
contract OpynTogether {
/**
* @dev Struct that outlines the "Participant" in the liquidity program
*/
struct Participant {
address user;
ui... | ERC20 transferFrom from msg.sender to liquidity pool | function depositIntoPosition(
address _oToken,
uint256 _oTokenDeposit
)
external onlyParticipant(_oToken)
{
Position storage position = positions[_oToken];
position.participants[msg.sender].liquidityAmount += _oTokenDeposit;
}
| 15,829,762 |
// File: @openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol
pragma solidity ^0.6.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assum... | validate enough days have passed from initiating the withdrawalcalculate withdrawed rewards in single distribution cycle | function executeWithdrawal()
external
nonReentrant
whenNotPaused
{
StakeDeposit memory stakeDeposit = _stakeDeposits[msg.sender];
WithdrawalState memory withdrawState = _withdrawStates[msg.sender];
require(stakeDeposit.endDate != 0 || withdrawState.amount != 0, "[Withdraw] W... | 5,942,155 |
./partial_match/1/0x1b6a205358e9378Bf9d6cb75F4D3cCcab38cA796/sources/src/ZeroLiquid.sol | Issues shares of `yieldToken` for `amount` of its underlying token to `recipient`. IMPORTANT: `amount` must never be 0. recipient The address of the recipient. yieldToken The address of the yield token. amount The amount of the underlying token. return The amount of shares issued to `recipient`. | function _issueSharesForAmount(address recipient, address yieldToken, uint256 amount) internal returns (uint256) {
uint256 shares = convertYieldTokensToShares(yieldToken, amount);
if (_accounts[recipient].balances[yieldToken] == 0) {
_accounts[recipient].depositedTokens.add(yieldToken);... | 15,484,965 |
./full_match/1/0x41CEAe393db3720A848103d7769f31457D5246F3/sources/contracts/Configuration.sol | @inheritdoc IConfiguration/ | function setAddress(
bytes32 key,
address value
) external override onlyController {
_data[key] = uint256(uint160(value));
emit ParameterUpdated(key, value);
}
| 4,835,218 |
pragma solidity ^0.4.25;
/*
* CryptoMiningWar - Build your own empire on Blockchain
* Author: InspiGames
* Website: https://cryptominingwar.github.io/
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns ... | -------------------------------------------------------------------------------------------------------------- CALL FUNCTION -------------------------------------------------------------------------------------------------------------- engineer mingin war | function getData(address _addr)
public
view
returns(
uint256 _virusDef,
uint256 _nextTimeAtk,
uint256 _endTimeUnequalledDef,
bool _canAtk,
uint256 _currentVirus,
uint256 _currentCrystals
) {
Player memory p = players[_addr];
_... | 6,387,996 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.