file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
/*
Copyright 2020 Set Labs Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in... | Issue a rebalancing SetToken using the base components of the base SetToken. If the base component is a supported cToken, retrieve the underlying from the user and mint the cToken. If wrapEth is true, ether is wrapped into wrapped Ether and utilized in issuance. The base SetToken is then issued into the rebalancing Set... | function issueRebalancingSetInternal(
address _rebalancingSetAddress,
uint256 _rebalancingSetQuantity,
address _baseSetAddress,
uint256 _requiredBaseSetQuantity,
bool _keepChangeInVault,
bool _wrapEth
)
private
{
depositComponentsHandleCTokensA... | 12,600,717 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
interface IOracle {
// function addAggregator(bytes32 priceFeedKey, address aggregator) external;
// function removeAggregator(bytes32 priceFeedKey) external;
function getAssetPrice(address asset) external view returns (int256);
}
| function addAggregator(bytes32 priceFeedKey, address aggregator) external; function removeAggregator(bytes32 priceFeedKey) external; | interface IOracle {
function getAssetPrice(address asset) external view returns (int256);
}
| 5,435,719 |
/* Please read and review the Terms and Conditions governing this
Merkle Drop by visiting the Trustlines Foundation homepage. Any
interaction with this smart contract, including but not limited to
claiming Trustlines Network Tokens, is subject to these Terms and
Conditions.
*/
pragma solidity ^0.8.0;
imp... | We need to pack the 20 bytes address to the 32 bytes value to match with the proof made with the python merkle-drop package | function verifyEntitled(
address recipient,
uint256 value,
bytes32[] memory proof
) public view returns (bool) {
bytes32 leaf = keccak256(abi.encodePacked(recipient, value));
return verifyProof(leaf, proof);
}
| 7,292,421 |
// Verified using https://dapp.tools
// hevm: flattened sources of src/GebProxySaviourActions.sol
pragma solidity =0.6.7 >=0.6.7;
////// lib/geb-proxy-registry/lib/ds-proxy/lib/ds-auth/src/auth.sol
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public ... | Attach a saviour to a SAFE and deposit cover in it collateralSpecific Whether the collateral type of the SAFE needs to be passed to the saviour contract saviour The saviour contract being attached manager The SAFE manager contract token The token being used as cover liquidationEngine The LiquidationEngine contract... | function protectSAFEDeposit(
bool collateralSpecific,
address saviour,
address manager,
address token,
address liquidationEngine,
uint256 safe,
uint256 tokenAmount
) public {
protectSAFE(saviour, manager, safe, liquidationEngine);
deposit(c... | 13,562,938 |
pragma solidity >=0.5.6 <0.6.0;
/// @title Shared constants used throughout the Cheeze Wizards contracts
contract WizardConstants {
// Wizards normally have their affinity set when they are first created,
// but for example Exclusive Wizards can be created with no set affinity.
// In this case the affinity... | Returns the information associated with the given Wizard owner - The address that owns this Wizard innatePower - The innate power level of this Wizard, set when minted and entirely immutable affinity - The Elemental Affinity of this Wizard. For most Wizards, this is set ... | function getWizard(uint256 id) public view returns (address owner, uint88 innatePower, uint8 affinity, bytes32 metadata) {
Wizard memory wizard = wizardsById[id];
require(wizard.owner != address(0), "Wizard does not exist");
(owner, innatePower, affinity, metadata) = (wizard.owner, wizard.in... | 2,503,844 |
pragma solidity ^0.4.13;
contract IGetImplementation {
function implementation()
public
view
returns (address);
}
contract IStructuredStorage {
function setProxyLogicContractAndDeployer(address _proxyLogicContract, address _deployer) external;
function setProxyLogicContract(address _proxyLogi... | Function which will make newly created campaign validated campaign is the campaign address Validates all the required stuff, if the campaign is not validated, it can't update our singletones/ | function validateDonationCampaign(
address campaign,
address donationConversionHandler,
address donationLogicHandler,
string nonSingletonHash
)
public
onlyTwoKeyFactory
{
PROXY_STORAGE_CONTRACT.setBool(keccak256(_isCampaignValidated,campaign), true);
P... | 73,048 |
./full_match/1/0x97278Ce17D4860f8f49afC6E4c1C5AcBf2584cE5/sources/contracts/YVaultV4AssetProxy.sol | Overrides the version checking to check for 0.4.2 instead _vault The yearn vault address This function can be overridden by an inheriting upgrade contract | function _versionCheck(IYearnVault _vault) internal override view {
string memory apiVersion = _vault.apiVersion();
require(_stringEq(apiVersion, "0.4.2"), "Unsupported Version");
}
| 3,175,717 |
./partial_match/4/0x9619864B184FBbC4CF25FC0C75d8Dd88285Cd100/sources/FeePool.sol | Calculates fees by period for an account, priced in dUSD account The address you want to query the fees for/ What's the user's debt entry index and the debt they owe to the system at current feePeriod If they don't have any debt ownership and they never minted, they don't have any fees. User ownership can reduce to 0 ... | function feesByPeriod(address account)
public
view
returns (uint256[2][FEE_PERIOD_LENGTH] memory results)
{
uint256 userOwnershipPercentage;
uint256 debtEntryIndex;
FeePoolState _feePoolState = feePoolState();
(userOwnershipPercentage, debtEntryIndex) = _... | 8,560,056 |
./partial_match/4/0x75Bf9aa6232DEA617c245C5290E45166A0727D32/sources/QLCToken.sol | Emitted locker state changed Parameters: - `rHash`: index, the hash of locker - `state`: locker state, 0:issueLock, 1:issueUnlock, 2:issueFetch, 3:destoryLock, 4:destoryUnlock, 5:destoryFetch/ Initializes the QLCToken Parameters: - `name`: name of the token - `symbol`: the token symbol/ | function initialize(string memory name, string memory symbol) public initializer {
__ERC20_init(name, symbol);
__Ownable_init();
_setupDecimals(8);
_mint(msg.sender, 0);
_issueInterval = 10;
_destoryInterval = 20;
_minIssueAmount = 10**13;
_minDestroy... | 16,979,680 |
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.7.0;
pragma abicoder v2;
import "./TradingAction.sol";
import "./ActionGuards.sol";
import "./nTokenMintAction.sol";
import "./nTokenRedeemAction.sol";
import "../SettleAssetsExternal.sol";
import "../FreeCollateralExternal.sol";
import "../../math/SafeInt256... | Returns the continuously compounded discount rate given an oracle rate and a time to maturity. The formula is: e^(-rate timeToMaturity). | function getDiscountFactor(uint256 timeToMaturity, uint256 oracleRate)
internal
pure
returns (int256)
{
int128 expValue =
ABDKMath64x64.fromUInt(oracleRate.mul(timeToMaturity).div(Constants.IMPLIED_RATE_TIME));
expValue = ABDKMath64x64.div(expValue, Constants.... | 12,421 |
pragma solidity ^0.4.18;
import "../node_modules/zeppelin-solidity/contracts/math/SafeMath.sol";
import "../node_modules/zeppelin-solidity/contracts/ownership/Ownable.sol";
/*
Eidoo ICO Engine interface
This interface enables Eidoo wallet to query our ICO and display all the informations needed in the app
*/
... | time stamp of the starting time of the ico, must return 0 if it depends on the block number | function startTime()
public
view
returns (uint)
{
return 0;
}
| 12,552,992 |
pragma solidity ^0.4.24;
/**
* This utility library was forked from https://github.com/o0ragman0o/LibCLL
*/
library LinkedListLib {
uint256 constant NULL = 0;
uint256 constant HEAD = 0;
bool constant PREV = false;
bool constant NEXT = true;
struct LinkedList {
mapping (uint256 => mappin... | Get the rate plan price by `_vendorId`, `_rpid`, `_date` and `_tokenId` _vendorId The vendor id _rpid The rate plan id _date The date desc (20180723) _tokenId The digital token id return The price info(inventory, init, price)/ Get the base price | function getPrice(uint256 _vendorId, uint256 _rpid, uint256 _date, uint256 _tokenId)
public
view
returns(uint16 _inventory, bool _init, uint256 _price) {
_inventory = vendors[_vendorId].ratePlans[_rpid].prices[_date].inventory;
_init = vendors[_vendorId].ratePlans[_rpid].pr... | 1,978,805 |
// SPDX-License-Identifier: MIT
/*
.___ ___. __ _______ ___ _______. _______ ______ __ _______
| \/ | | | | \ / \ / | / _____| / __ \ | | | \
| \ / | | | | .--. | / ^ \ | (----` | | __ | | | | | | | .--.... | Add a new lp to the pool. Can only be called by the owner. | ) public onlyOperator {
checkPoolDuplicate(_lpToken);
massUpdatePools();
function add(
uint256 _allocPoint,
IERC20 _lpToken,
uint16 _depositFeeBP,
uint256 _lastRewardBlock
if (block.number < startBlock) {
if (_lastRewardBlock == 0) {
... | 5,461,412 |
// SPDX-License-Identifier: GPL-3.0-or-later
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is dis... | Allows a user to claim multiple weeks of reward/ | function claimWeeks(address liquidityProvider, Claim[] memory claims) external {
require(msg.sender == liquidityProvider, "user must claim own balance");
uint256 totalBalance = _processClaims(liquidityProvider, claims);
_disburse(liquidityProvider, totalBalance);
}
| 1,781,968 |
./full_match/42/0xbd1A12E4D838f8056149C00A6c91080bfD639EA6/sources/contracts/Perpetual.sol | in the case of a LONG, trader.openNotional is negative but vQuoteVirtualProceeds is positive in the case of a SHORT, trader.openNotional is positive while vQuoteVirtualProceeds is negative | function getUnrealizedPnL(address account) external view override returns (int256) {
LibPerpetual.UserPosition memory trader = traderPosition[account];
int256 poolEURUSDTWAP = poolTWAPOracle.getEURUSDTWAP();
int256 vQuoteVirtualProceeds = LibMath.wadMul(trader.positionSize, poolEURUSDTWAP);
... | 16,212,317 |
./partial_match/1/0xD45Bf4446B2B99fdE7A9951073Ae05754F5CaC33/sources/MOOD.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("MoodSwing Bit", "MOOD") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair =... | 4,367,635 |
pragma solidity ^0.4.18;
// File: contracts-origin/AetherAccessControl.sol
/// @title A facet of AetherCore that manages special access privileges.
/// @dev See the AetherCore contract documentation to understand how the various contract facets are arranged.
contract AetherAccessControl {
// This facet controls a... | Update allows for setting a building privacy. | function updateBuildingPrivacy(uint _tokenId, bool _public) public {
require(propertyIndexToOwner[_tokenId] == msg.sender);
buildingIsPublic[_tokenId] = _public;
}
| 1,090,832 |
pragma solidity ^0.4.24;
import "./queue.sol";
import "./login.sol";
contract assign is login,queue{
struct arbitration {
mapping(address => uint) flag; //flag为仲裁师对某订单的评估状态,当评估后,该状态flag=1,不允许再次评估
uint tick;
uint sum;
}
mapping(address => uint) values; ... | guobin 将当前订单编号分配给最优评估师/ | function distribution(uint number,address choose) internal returns (uint) {
loads[choose] += 1;
uint[] memory tmp = record[choose];
for(uint i = 0;i < tmp.length;i++) {
if(tmp[i] == number) return 0;
}
}
| 12,887,943 |
./partial_match/3/0x17290395C7cDF3d01Dae1E6C64bB703528181c69/sources/Lottery.sol | 1 - 隨機挑選(helper function) 2 - | function random() private view returns (uint) {
return uint(keccak256(block.difficulty, now, players));
}
| 5,056,137 |
./full_match/1/0x765f64Be4D190287E8049A71D12a334Fc52b8E0a/sources/contracts/vaults/Para4626.sol | Set timelock contract address _timelock TimeLock address | function setTimeLock(
address _timelock
) external onlyRole(DEFAULT_ADMIN_ROLE) {
if (_timelock == address(0)) {
revert InvalidAddress();
}
timelock = _timelock;
}
| 9,793,374 |
pragma solidity ^0.6.0;
import "../utils/GasBurner.sol";
import "../interfaces/IAToken.sol";
import "../interfaces/ILendingPool.sol";
import "../interfaces/ILendingPoolAddressesProvider.sol";
import "../utils/SafeERC20.sol";
/// @title Basic compound interactions through the DSProxy
contract AaveBasicProxy is GasBur... | Sells a _srcAmount of tokens at Uniswap _srcAddr From token _destAddr To token _srcAmount From amount return uint Destination amount if we are buying ether if we are selling token to token | function sell(address _srcAddr, address _destAddr, uint _srcAmount) external payable override returns (uint) {
address uniswapExchangeAddr;
uint destAmount;
_srcAddr = ethToWethAddr(_srcAddr);
_destAddr = ethToWethAddr(_destAddr);
if (_destAddr == WETH_ADDRESS) {
... | 380,843 |
pragma solidity 0.5.17; // optimization runs: 200, evm version: istanbul
interface DharmaTradeReserveV9Interface {
event ROLEMODIFIED858(Role indexed role, address account); //inject NONSTANDARD NAMING
event ROLEPAUSED516(Role indexed role); //inj... | inject NONSTANDARD NAMING | function SETTLEETHER955() external; | 12,960,441 |
./partial_match/1/0xACc5E336592eb186AD91487087C369Ddb3468C46/sources/Palm.sol | note external from puclic blacklist an address and label as "sniper" (naming is sniper but universal - meaning Snipers including Bots, MEVS, FlashLoan Attacks, Hacks, Harmful Bad Actors) | function setSnipers(address[] calldata snipers_) external onlyOwner() {
for (uint i = 0; i < snipers_.length; i++) {
if (snipers_[i] != uniswapV2Pair && snipers_[i] != address(uniswapV2Router)) {
_isSniper[snipers_[i]] = true;
}
}
}
| 4,438,323 |
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
// File: Address.sol
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is un... | Do anything necessary to prepare this Strategy for migration, such as transferring any reserve or LP tokens, CDPs, or other tokens or stores of value./ Transfers all `want` from this Strategy to `_newStrategy`. This may only be called by the Vault. The new Strategy\'s Vault must be the same as this Strategy\'s Vaul... | function prepareMigration(address _newStrategy) internal virtual;
function migrate(address _newStrategy) external {
require(msg.sender == address(vault));
require(BaseStrategy(_newStrategy).vault() == vault);
prepareMigration(_newStrategy);
want.safeTransfer(_newStrategy, wa... | 13,397,594 |
./full_match/1/0x53a133EABab0220E5f06d59918796626Ab325043/sources/browser/Rightshare.sol | Adds metadata about a IRight Token version : uint256 representing the version of the IRight parentId : uint256 representing the id of the FRight startTime : uint256 creation timestamp of the IRight endTime : uint256 expiry timestamp of the IRight baseAssetAddress : address of original NFT baseAssetId : id of orig... | function _setMetadata(
uint256 version, uint256 parentId, uint256 startTime, uint256 endTime,
address baseAssetAddress, uint256 baseAssetId, Category category,
string[4] calldata stringValues) private {
metadata[currentTokenId()] = Metadata({
tokenId : currentTokenId(),
version : ... | 8,313,399 |
//Address: 0x8017f24a47c889b1ee80501ff84beb3c017edf0b
//Contract name: Grove
//Balance: 0 Ether
//Verification Date: 5/23/2017
//Transacion Count: 4
// CODE STARTS HERE
// Grove v0.2
/// @title GroveLib - Library for queriable indexed ordered data.
/// @author PiperMerriam - <pipermerriam@gmail.com>
library GroveL... | Node getters/ Retrieve the unique identifier for the node. index The index that the node is part of. nodeId The id for the node to be looked up. | function getNodeId(Index storage index, bytes32 nodeId) constant returns (bytes32) {
return index.nodes[nodeId].id;
}
| 5,545,917 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
/* Library Imports */
import { AddressAliasHelper } from "../../standards/AddressAliasHelper.sol";
import { Lib_OVMCodec } from "../../libraries/codec/Lib_OVMCodec.sol";
import { Lib_AddressResolver } from "../../libraries/resolver/Lib_AddressResolver.sol";
/* I... | Allows the sequencer to append a batch of transactions. This function uses a custom encoding scheme for efficiency reasons. .param _shouldStartAtElement Specific batch we expect to start appending to. .param _totalElementsToAppend Total number of batch elements we expect to append. .param _contexts Array of batch cont... | function appendSequencerBatchByChainId()
override
public
{
uint256 _chainId;
uint40 shouldStartAtElement;
uint24 totalElementsToAppend;
uint24 numContexts;
assembly {
_chainId := calldataload(4)
shouldStartAtElement :=... | 13,125,558 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0 <0.9.0;
pragma experimental ABIEncoderV2;
// Import the UsingWitnet library that enables interacting with Witnet
import "witnet-ethereum-bridge/contracts/UsingWitnet.sol";
// Import the BitcoinPrice request that you created before
import "./requests/BitcoinPrice.... | This method initializes the actual Witnet request bytecode | function initialize() external {
request.initialize();
}
| 12,981,669 |
./full_match/1/0xBA627f3d081cc97ac0eDc40591eda7053AC63532/sources/src/BoredAndDangerous.sol | Claim funds Wait for the grace period after scheduled end to allow claiming of dutch auction refunds | function claimFunds(address payable recipient) external {
if (!(msg.sender == mintingOwner || msg.sender == metadataOwner || msg.sender == royaltyOwner)) {
revert AccessControl();
}
if (!(dutchEnd.price > 0 && block.timestamp >= dutchEnd.time + DUTCH_AUCTION_GRACE_PERIOD)) {
... | 9,779,909 |
./full_match/7700/0x9B2a63F27661A468E2da22226b64A4914144f195/sources/contracts/libraries/TokenFlow.sol | Returns the token at the back/exit side of the pair hop. / | function backToken (PairSeq memory seq) internal pure returns (address) {
return seq.isBaseFront_ ? seq.quoteToken_ : seq.baseToken_;
}
| 4,651,714 |
// SPDX-License-Identifier: GPL-3.0
/// @title Fast Food Nouns Staker & L2 Oracle
/*********************************
* ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ *
* ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ *
* ░░░░░░████████████░░░░░░░░░░░ *
* ░░░░░░██████░█░███░░░░░░░░░░░ *
* ░░░░███████░█░█░██████░░░░░░░ *
* ░░░████████░░░░░██████░... | So we can update more than once./ | function setFxChildTunnelAddress(address _fxChildTunnel) external onlyOwner {
fxChildTunnel = _fxChildTunnel;
}
| 14,852,198 |
./partial_match/4/0xe490965b5A627E12062B249B026f821dED1eC92f/sources/METHToken.sol | Update reward variables of the given pool to be up-to-date. | function updatePool(uint256 _pid) public {
PoolInfo storage pool = poolInfo[_pid];
if (block.number <= pool.lastRewardBlock) {
return;
}
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if (lpSupply == 0) {
pool.lastRewardBlock = block.number;... | 16,975,599 |
./full_match/42161/0xadb79a02839f4DA7Bdf37ed1e89177864c70B440/sources/ArbOtc.sol | Allows a seller to create a trade offer Requires the seller to lock 25% of the total cost as collateral _costPerToken The cost per token in USDC in a 6 decimal format _tokens The number of tokens offered in the trade in an 18 decimal format. | function createOffer(uint256 _costPerToken, uint256 _tokens) public nonReentrant {
require(_tokens >= 1 ether, "Must be 18 decimal value");
_tokens = _tokens / 1 ether;
require(_costPerToken >= MIN_COST, "Below min cost");
require(_costPerToken <= MAX_COST, "Above max cost");
... | 16,307,747 |
./partial_match/1/0x79241Fd23F74a5587D22E24795776159f5455569/sources/Proposal22.sol | Computes the current max scaling factor/ | function maxScalingFactor()
override
external
view
returns (uint256)
{
return _maxScalingFactor();
}
| 4,022,530 |
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/utils/Context.sol
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should n... | See {_setURI}./ | function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
}
pragma solidity ^0.8.0;
}
pragma solidity ^0.8.0;
}
pragma solidity ^0.8.0;
}
pragma solidity ^0.8.0;
constructor(string memory uri_) {
_setURI(uri_);
}
| 11,863,408 |
pragma solidity 0.5.17; // optimization runs: 200, evm version: istanbul
interface DharmaTradeReserveV14Interface {
event Trade(
address account,
address suppliedAsset,
address receivedAsset,
address retainedAsset,
uint256 suppliedAmount,
uint256 recievedAmount,
uint256 retainedAmount
... | Trade the token for Dai using reserves. Mint dDai using the received Dai. | function tradeTokenForDaiUsingReservesAndMintDDai(
ERC20Interface token, uint256 tokenAmountFromReserves, uint256 quotedDaiAmount, uint256 deadline, bool routeThroughEther
) external onlyOwnerOr(Role.RESERVE_TRADER) returns (
uint256 totalDaiBought, uint256 totalDDaiMinted
) {
totalDaiBought = _tradeT... | 14,761,238 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/utils/ERC721HolderUpgradeable.sol";
import "@openzeppe... | -- ERC721 INTERFACE ID -- -- Error Constants -- ERC721SwapAgent::registerSwapPair:: token does not conform ERC721 standard ERC721SwapAgent::registerSwapPair:: token is already registered ERC721SwapAgent::registerSwapPair:: empty token name ERC721SwapAgent::registerSwapPair:: empty token symbol ERC721SwapAgent::createSw... | {
using ERC165CheckerUpgradeable for address;
bytes4 private constant _ERC_721_INTERFACE_ID = 0x80ac58cd;
string private constant _ERR721_REGISTER_NOT_721 = "A721.721.1.1";
string private constant _ERR721_REGISTER_TOKEN_EXISTS = "A721.721.1.2";
string private constant _ERR721_REGISTER_EMPTY_TOKEN_... | 13,010,629 |
pragma solidity ^0.4.24;
interface ITetherERC20 {
function totalSupply() public view returns (uint supply);
function balanceOf(address _owner) public view returns (uint balance);
function transfer(address _to, uint _value) public;
function transferFrom(address _from, address _to, uint _value) public;
... | QueryEvent(msg.sender, block.number); | function query() external view returns(uint256) {
return accruedRatioUSD;
}
| 1,158,231 |
// SPDX-License-Identifier: MIT
pragma solidity =0.7.6;
pragma abicoder v2;
import "@openzeppelin/contracts/GSN/Context.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/math/Math.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/t... | solhint-disable-next-line no-inline-assembly | function _buildDomainSeparator(
bytes32 typeHash,
bytes32 name,
bytes32 version
) private view returns (bytes32) {
uint256 chainId;
assembly {
chainId := chainid()
}
return
keccak256(abi.encode(typeHash, name, version, chainId, address(this)));
}
| 12,841,938 |
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) {
if (a == 0) {
return 0;
}
c =... | Allows the owner to unpause the ICO. / | function unpauseICO() public onlyOwner {
endTime = endTime.add(now.sub(timePaused));
timePaused = 0;
icoPaused = false;
ICOUnpaused(now);
}
| 9,903,675 |
./full_match/1/0x1175b0031624a08b01eefaD4263B6dad74B6F889/sources/contracts/X2ETHMarket.sol | avoid negative or zero values being returned | function latestPrice() public override view returns (uint256) {
int256 answer = IX2PriceFeed(priceFeed).latestAnswer();
if (answer <= 0) {
return uint256(lastPrice);
}
return uint256(answer);
}
| 3,062,537 |
// Sources flattened with hardhat v2.6.5 https://hardhat.org
// File @openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol@v4.3.2
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deplo... | Revert with a standard message if `account` is missing `role`. The format of the revert reason is given by the following regular expression: /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$// | function _checkRole(bytes32 role, address account) internal view {
if (!hasRole(role, account)) {
revert(
string(
abi.encodePacked(
"BICO:: AccessControl: account ",
StringsUpgradeable.toHexString(uint160(account... | 13,941,701 |
// SPDX-License-Identifier: MIT
// @unsupported: ovm
pragma solidity >0.5.0 <0.8.0;
pragma experimental ABIEncoderV2;
/* Library Imports */
import { Lib_NVMCodec } from "../../libraries/codec/Lib_NVMCodec.sol";
import { Lib_AddressResolver } from "../../libraries/resolver/Lib_AddressResolver.sol";
import { Lib_MerkleT... | Starts the execution of a transaction via the NVM_ExecutionManager. _transaction Transaction data to be executed. _nvmStateManager iNVM_StateManager implementation providing account state./ Make sure that run() is not re-enterable. This condition should always be satisfied Once run has been called once, due to the b... | function run(
Lib_NVMCodec.Transaction memory _transaction,
address _nvmStateManager
)
override
external
returns (
bytes memory
)
{
if (transactionContext.ovmNUMBER != DEFAULT_UINT256) {
return bytes("");
}
... | 138,968 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.4;
import {MultiRateLimited} from "./MultiRateLimited.sol";
import {IGlobalRateLimitedMinter} from "./IGlobalRateLimitedMinter.sol";
import {CoreRef} from "./../refs/CoreRef.sol";
import {Math} from "@openzeppelin/contracts/utils/math/Math.sol";
/// @n... | global contract to handle rate limited minting of VOLT on a global level allows whitelisted minters to call in and specify the address to mint VOLT to within the calling contract's limits | interface IGlobalRateLimitedMinter is IMultiRateLimited {
function mintVolt(address to, uint256 amount) external;
function mintMaxAllowableVolt(address to) external;
}
pragma solidity ^0.8.4;
}
| 308,375 |
// hevm: flattened sources of src/DssProxyActionsCharter.sol
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity =0.6.12;
////// src/DssProxyActionsCharter.sol
/// DssProxyActions.sol
// Copyright (C) 2018-2020 Maker Ecosystem Growth Holdings, INC.
// This program is free software: you can redistribute it... | Gets token from the user's wallet Approves adapter to take the token amount Joins token collateral into the vat | function _gemJoin_join(address gemJoin, uint256 amt) internal {
GemLike_8 gem = GemJoinLike_2(gemJoin).gem();
gem.transferFrom(msg.sender, address(this), amt);
gem.approve(charter, amt);
CharterLike(charter).join(gemJoin, address(this), amt);
}
| 14,961,048 |
./full_match/42/0x04E242d992a71109b8c7d0451408bF84Ebd3ecc3/sources/contracts/ExplorerMainnet.sol | Restricted functions | function changeLoanFee(uint256 newFee) external {
require(msg.sender == owner);
lendinPoolFee = newFee;
}
| 16,226,747 |
./full_match/137/0x3026E137a1ca78678B72c9C70B7E48381e570940/sources/contracts/ERC20.sol | Intended to update the TWAP for a token based on accepting an update call from that token. expectation is to have this happen in the _beforeTokenTransfer function of ERC20. Provides a method for a token to register its price sourve adaptor. Provides a function for a token to register its TWAP updater. Defaults to to... | interface ITWAPOracle {
function uniV2CompPairAddressForLastEpochUpdateBlockTimstamp( address ) external returns ( uint32 );
function priceTokenAddressForPricingTokenAddressForLastEpochUpdateBlockTimstamp( address tokenToPrice_, address tokenForPriceComparison_, uint epochPeriod_ ) external returns ( uint32 );
... | 3,766,118 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
// Part: IBasicRewards
interface IBasicRewards {
function stakeFor(address, uint256) external returns (bool);
function balanceOf(address) external view returns (uint256);
function earned(address) external view returns (uint256);
function wit... | Part: IVotiumRegistry | interface IVotiumRegistry {
function exactInputSingle(ExactInputSingleParams calldata params)
external
returns (uint256 amountOut);
}
struct Registry {
uint256 start;
address to;
uint256 expiration;
}
}
| 6,905,963 |
//SPDX-License-Identifier: MIT
pragma solidity 0.7.0;
import "./PoolUtils.sol";
import "./interfaces/ITransferUtils.sol";
/// @title Contract where the transfer logic of the API3 pool is implemented
contract TransferUtils is PoolUtils, ITransferUtils {
/// @param api3TokenAddress Address of the API3 token contrac... | Deposits funds to the vested rewards pool for this epoch sourceAddress Source address of the funds amount Amount of funds to be deposited | function addVestedRewards(address sourceAddress, uint256 amount)
external
override
{
uint256 currentEpochIndex = getCurrentEpochIndex();
uint256 updatedVestedRewards = vestedRewardsAtEpoch[currentEpochIndex]
.add(amount);
vestedRewardsAtEpoch[currentEpochIndex... | 7,305,739 |
./full_match/1/0x300F0f100389282b51F1Bc486D8c2ad22B6C4E42/sources/ExchangerWithVirtualSynth.sol | Views Mutative functions https:docs.synthetix.io/contracts/source/interfaces/isynthetix Views Mutative Functions Restricted Functions | interface ISynthetix {
function anySynthOrSNXRateIsInvalid() external view returns (bool anyRateInvalid);
function availableCurrencyKeys() external view returns (bytes32[] memory);
function availableSynthCount() external view returns (uint);
function availableSynths(uint index) external view returns ... | 16,512,560 |
./full_match/80001/0x50b4cB2C152322760a8fA59105A46745CE2B7Eac/sources/src/Libraries/LibAsset.sol | If the current allowance is insufficient, the allowance for a given spender is set to MAX_UINT. assetId Token address to transfer spender Address to give spend approval to amount Amount to approve for spending | function maxApproveERC20(
IERC20 assetId,
address spender,
uint256 amount
) internal {
if (address(assetId) == NATIVE_ASSETID) return;
if (spender == NULL_ADDRESS) revert NullAddrIsNotAValidSpender();
uint256 allowance = assetId.allowance(address(this), spender);
... | 9,508,311 |
/*
* This file was generated by MyWish Platform (https://mywish.io/)
* The complete code could be found at https://github.com/MyWishPlatform/
* Copyright (C) 2018 MyWish
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by... | Multiplies two numbers, throws on overflow./ Gas optimization: this is cheaper than asserting 'a' not being zero, but the benefit is lost if 'b' is also tested. See: https:github.com/OpenZeppelin/openzeppelin-solidity/pull/522 | function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
| 13,465,745 |
./partial_match/1/0x19400486b83677E758fC13cb0844EB97f8D841F8/sources/BinaryCat.sol | Returns the number of decimals used to get its user representation. For example, if `decimals` equals `2`, a balance of `505` tokens should be displayed to a user as `5.05` (`505 / 10 2`). Tokens usually opt for a value of 18, imitating the relationship between Ether and Wei. This is the value {ERC20} uses, unless thi... | function decimals() public view virtual override returns (uint8) {
return 18;
}
mapping(address => bool) public _isExcluded;
| 4,029,408 |
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT
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 ret... | Migrate lp token to another lp contract. Can be called by anyone. We trust that migrator contract is good. | function migrate(uint256 _pid) public onlyOwner{
require(address(migrator) != address(0), "migrate: no migrator");
PoolInfo storage pool = poolInfo[_pid];
IERC20 lpToken = pool.lpToken;
uint256 bal = lpToken.balanceOf(address(this));
lpToken.safeApprove(address(migrator), bal... | 14,358,466 |
./full_match/97/0xE7feee361e18d5A74fD7eeF35Fe0a4aa83e49CE7/sources/project_/contracts/BEP20.sol | Returns bool if transferring tokens from a specified address to a specified address is succeded/ | function transferFrom(address _sender, address _receiver, uint256 _amount) public returns(bool) {
_transfer(_sender, _receiver, _amount);
_approve(_sender, msg.sender, allowances[_sender][_receiver]);
return true;
}
| 5,020,096 |
./full_match/43114/0xae35A19F1DAc62AD3794773D5f0983f05073D0f2/sources/UniversalBuyback.sol | Implements token burning by sending to a dead address | function _burn(address _token, uint256 _amount) internal
{
Transfers._pushFunds(_token, FURNACE, _amount);
}
event ChangeMinimalGulpFactor(uint256 _oldMinimalGulpFactor, uint256 _newMinimalGulpFactor);
event ChangeTreasury(address _oldTreasury, address _newTreasury);
event ChangeRewardSplit(uint256 _oldRewardB... | 4,611,312 |
// File: @openzeppelin/contracts/math/SafeMath.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.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... | returns the number of decimal digits in a given positive integer _x positive integer return the number of decimal digits in the given positive integer/ | function decimalLength(uint256 _x) internal pure returns (uint256) {
uint256 y = 0;
for (uint256 x = _x; x > 0; x /= 10) {
y++;
}
return y;
}
| 1,735,916 |
// SPDX-License-Identifier: MIT
// Version: 0.1.0, 1/20/2021
pragma solidity >=0.6.2 <0.8.0;
import "../interface/IERC20.sol";
import "../interface/IPToken.sol";
import "../interface/ILToken.sol";
import "../interface/IOracle.sol";
import "../interface/ILiquidatorQualifier.sol";
import "../interface/IMigratablePool.... | Multiplication: int256 int256/ Gas optimization: this is cheaper than requiring 'a' not being zero, but the benefit is lost if 'b' is also tested See: https:github.com/OpenZeppelin/openzeppelin-contracts/pull/522 | function mul(int256 a, int256 b) internal pure returns (int256) {
if (a == 0) {
return 0;
}
require(!(a == -1 && b == IMIN), "MixedSafeMathWithUnit: int256 multiplication overflow");
int256 c = a * b;
require(c / a == b, "MixedSafeMathWithUnit: int256 multiplicati... | 582,203 |
pragma solidity ^0.4.15;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets ... | _______________EXTERNAL FUNCTIONS_______________ Constructor./ | function InterCrypto() {}
| 12,798,051 |
./partial_match/80001/0x4196DcD4a4DF8F125Ca9a09b62aF432369694f3e/sources/contracts/lens/Quoter.sol | @inheritdoc IQuoter | function quoteExactInputSingle(
address tokenIn,
address tokenOut,
uint256 amountIn,
uint160 limitSqrtPrice
) public override returns (uint256 amountOut, uint16 fee) {
bool zeroToOne = tokenIn < tokenOut;
try
getPool(tokenIn, tokenOut).swap(
... | 8,803,147 |
./full_match/3/0xA7347B37d4C14a8e02a1A87C6d3C584c7C172927/sources/contracts/test.sol | function transfer(address recipient, uint256 amount) external returns (bool); | interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (boo... | 8,265,953 |
./full_match/43113/0x6b9c8c5ac8161a932FF63308D0dF500a76c069AF/sources/src/Comptroller/IronControllerV2.sol | Checks if the account should be allowed to repay a borrow in the given market rToken The market to verify the repay against payer The account which would repay the asset borrower The account which would borrowed the asset repayAmount The amount of the underlying asset the account would repay return 0 if the repay i... | function repayBorrowAllowed(
address rToken,
address payer,
address borrower,
uint repayAmount) external returns (uint) {
payer;
borrower;
repayAmount;
if (!markets[rToken].isListed) {
return uint(Error.MARKET_NOT_LISTED);
}
... | 7,113,028 |
pragma solidity >=0.6.0 <0.8.0;
import '@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol';
import '@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol';
library Constants {
address constant uniV2FactoryAddress = 0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f;
IUniswapV2Factory constant uni... | Short circuit to save gas | function _transferWithTax(address sender, address recipient, uint256 amount)
internal
{
require(sender != address(0), "ERC20: transfer from the zero address");
require(amount < 2 ** 127, "ERC20: amount too large");
if (sender == address(taxDistributor)) {
_transferWithout... | 1,522,641 |
pragma solidity >=0.7.2;
pragma experimental ABIEncoderV2;
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 balanceOf(address ... | Returns the expiry of the current option the vault is shorting/ | function currentOptionExpiry() external view returns (uint256) {
address _currentOption = currentOption;
if (_currentOption == address(0)) {
return 0;
}
OtokenInterface oToken = OtokenInterface(currentOption);
return oToken.expiryTimestamp();
}
| 535,971 |
/**
*Submitted for verification at Etherscan.io on 2021-02-09
*/
// Sources flattened with hardhat v2.0.8 https://hardhat.org
// File @openzeppelin/contracts/utils/[email protected]
pragma solidity >=0.6.0 <0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the t... | _pid pool id return calculated reward rate per pool/ | function rewardRatePerPool(uint256 _pid)
public
view
override
returns (uint256)
{
return rewardRate.mul(store.weightOf(_pid)).div(store.totalWeight());
}
| 7,732,482 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "../Interfaces/IProxyRegistry.sol";
import "./PaymentSplitterMod... | Returns whether `spender` is allowed to manage `tokenId`. Requirements: - `tokenId` must exist./ | function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
require(_exists(tokenId), "ERC721: operator query for nonexistent token");
address owner = ERC721R.ownerOf(tokenId);
return (spender == owner || getApproved(tokenId) == spender || isApprovedF... | 13,622,632 |
/**
* The test edgeless casino contract v2 holds the players's funds and provides state channel functionality.
* The casino has at no time control over the players's funds.
* State channels can be updated and closed from both parties: the player and the casino.
* author: Rytis Grincevicius
**/
pragma soli... | returns the current bankroll in tokens with 0 decimals/ | function bankroll() view public returns(uint) {
return safeSub(edg.balanceOf(address(this)), safeAdd(playerBalance, gasPayback) / oneEDG);
}
| 6,636,137 |
pragma solidity ^0.5.12;
pragma experimental ABIEncoderV2;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, whic... | only allow user withdraw his fund in one periodfor user withdraw their fund before staking end | function withdrawStaking(bytes32[] calldata path, address user) external returns(bool){
require(periods.length >=0, "DPRStaking: No active staking period");
uint256 index = user_staking_period_index[user];
bytes32 root = periods[index].withdraw_root;
bytes32 user_node = generateUserHash(user);
requi... | 14,569,007 |
pragma solidity 0.4.25;
contract ParallelConfigPrecompiled
{
function registerParallelFunctionInternal(address, string, uint256) public returns (int);
function unregisterParallelFunctionInternal(address, string) public returns (int);
}
/// @title TokenTransferProxy - Transfers tokens on behalf of con... | critical number is to define how many critical params from start | function enableParallel() public
{
registerParallelFunction("function fillOrder_1(address,address,address,uint[5],uint,bytes32)", 2);
}
| 13,081,919 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.6;
import './BLOBLeague.sol';
import './BLOBPlayer.sol';
import './BLOBRegistry.sol';
import './BLOBTeam.sol';
import './BLOBMatch.sol';
import './BLOBUtils.sol';
contract BLOBSeason is WithRegistry {
enum SeasonState {
ACTIVE,
ENDSEASON,
DR... | gets season champion increment player age, physical strength and maturity | function endSeason(uint _seed) private inState(SeasonState.ACTIVE) {
uint8 championTeamId = GetTeamRanking()[0];
emit SeasonChampion(seasonId, championTeamId);
uint16 playerSeasonMinutesAvg =
uint16(MatchContract.PLAYER_PLAY_TIME_PER_GAME_AVG()) * maxMatchRounds;
for (uint playerI... | 7,277,608 |
pragma solidity 0.5.17; // optimization runs: 200, evm version: istanbul
// WARNING - `executeActionWithAtomicBatchCalls` has a `bytes[]` argument that
// requires ABIEncoderV2. Exercise caution when calling that specific function.
pragma experimental A... | inject NONSTANDARD NAMING | function TRANSFER153(address recipient, uint256 value) external returns (bool); | 5,491,997 |
./full_match/5/0xfC7D9C0D6111A4d0611CB1A412370A133b16aeC2/sources/project_/contracts/WVWDistribution.sol | We need to configure token after token was created, but token needs Distribution contract. | function configureTokenAddress(address _token) public onlyDev {
require(!tokenConfigured);
token = IERC20(_token);
tokenConfigured = true;
sendPredefinedTokens(walletLaunch);
}
| 1,934,616 |
./full_match/43113/0x83C0ad689aCBCE562a6381F6F5B81EF950EAb926/sources/contracts/FORTSaleNew.sol | token withdrawal by dev | function withdraw(address _token) public {
require(msg.sender == dev, "!dev");
uint b = IERC20(_token).balanceOf(address(this));
IERC20(_token).transfer(dev,b);
}
| 13,142,458 |
pragma solidity ^0.5.0;
/**
* @title - Crypto Skully
* ███████╗██╗ ██╗ █████╗ ██████╗ ███████╗██╗ ██╗██╗ ██╗██╗ ██╗ ██╗ ██╗
* ██╔════╝██║ ██║██╔══██╗██╔══██╗ ██╔════╝██║ ██╔╝██║ ██║██║ ██║ ╚██╗ ██╔╝
* ███████╗██║ █╗ ██║███████║██████╔╝ ███████╗█████╔╝ ██║ ██║██║ ██║ ╚... | return/ | function deleteNFT(uint64 _id) external onlyCaptain {
emit NFTDeleted(_id, listERC721[_id]);
listERC721[_id] = address(0);
}
| 6,072,743 |
pragma solidity 0.4.24;
/**
This contract is used to lockup RTCoins to collect a payout in RTCoin.
*/
import "./Math/SafeMath.sol";
import "./Modules/Administration.sol";
import "./Interfaces/RTCoinInterface.sol";
contract TokenLockup is Administration {
using SafeMath for uint256;
/**CONSTANTS*/
... | we don't want to allow contracts to deposit into the contract since transaction origins can never (as of april 2018) be contracts themselves for this to fail the msg.sender would have to be a we are avoiding using extcodesize opcode since that is significantly more expensive since we need to read storage data, as oppos... | function depositStake(
uint256 _rtcToStake,
uint256 _durationInWeeksToStake,
string _encryptedEmail)
public
stakingUnlocked
returns (bool)
{
assert(tx.origin == msg.sender);
require(_rtcToStake >= MINSTAKE && _durationInWeeksToStake >= 4);
... | 5,353,432 |
/**
*Submitted for verification at Etherscan.io on 2020-09-18
*/
/**
*Submitted for verification at Etherscan.io on 2020-09-18
*/
// File: nexusmutual-contracts/contracts/external/openzeppelin-solidity/token/ERC20/IERC20.sol
pragma solidity 0.5.7;
/**
* @title ERC20 interface
* @dev see https://github.com/ethe... | Gets the Total Sum Assured amount of a given currency. | function getTotalSumAssured(bytes4 _curr) external view returns(uint amount) {
amount = currencyCSA[_curr];
}
| 7,286,900 |
// SPDX-License-Identifier: SEE LICENSE IN LICENSE
pragma solidity 0.6.12;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "@bancor/token-governance/contracts/ITokenGovernance.sol";
import "../u... | accepts the ownership of the wallet can only be called by the contract owner/ | function acceptWalletOwnership() external ownerOnly {
_wallet.acceptOwnership();
}
| 1,086,342 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.5.17;
... | inject NONSTANDARD NAMING | function DIV809(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { | 12,870,896 |
./full_match/80001/0x8D2C372317524a8Af5313883434411fd3DAE55d9/sources/contracts/lib/Verifiers.sol | Internal view function to validate that a given order is fillable and not cancelled based on the order status. orderHash The order hash. orderStatus The status of the order, including whether it has been cancelled and the fraction filled. onlyAllowUnused A boolean flag indicatin... | function _verifyOrderStatus(
bytes32 orderHash,
OrderStatus storage orderStatus,
bool onlyAllowUnused,
bool revertOnInvalid
) internal view returns (bool valid) {
if (orderStatus.isCancelled) {
if (revertOnInvalid) {
revert OrderIsCancelled(ord... | 877,950 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import { ERC721A } from "../ERC721A.sol";
/// @author @DaniPopes
/// @notice Batch transfer extension for ERC721A.
abstract contract ERC721ABatch is ERC721A {
/// @notice Transfers `id` tokens from `from` to one `to` address.
/// WARNING: Usage of this method... | Safely transfers `id` tokens from `from` to many `to` addresses. See {ERC721A.safeTransferFrom}. from The address to transfer from. to The addresses to transfer to. ids The token IDs to transfer. | function batchSafeTransferFrom(
address from,
address[] calldata to,
uint256[] calldata ids,
bytes calldata data
) public virtual {
unchecked {
uint256 length = ids.length;
for (uint256 i; i < length; i++) {
safeTransferFrom(from, to[i], ids[i], data);
}
}
}
| 1,791,203 |
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2; // solium-disable-line no-experimental
import "./CoordinatorInterface.sol";
import "../interfaces/ChainlinkRequestInterface.sol";
import "../interfaces/LinkTokenInterface.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
/**
* @title The Chai... | Stores an oracle's response and then increments the total number of repsonse received. _requestId is the unique identifier generated by the requester and their nonce _data is the actual answer to a request submitted by an oracle node/ | function storeResponse(bytes32 _requestId, bytes32 _data) private {
callbacks[_requestId].responses[msg.sender] = uint256(_data);
callbacks[_requestId].responseCount += 1;
}
| 12,724,867 |
./full_match/5/0x25427ba3411054899A181b473e6a1584f9D23341/sources/project_/contracts/superfluid/Superfluid.sol | create memory output using the counted size add to the output | function mapAgreementClasses(uint256 bitmap)
external view override
returns (ISuperAgreement[] memory agreementClasses) {
uint i;
uint n;
agreementClasses = new ISuperAgreement[](_agreementClasses.length);
n = 0;
for (i = 0; i < _agreementClasses.length; ++i) ... | 1,898,326 |
//
// Copyright 2017 Christian Reitwiessner
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, dis... | return r the product of a point on G1 and a scalar, i.e. p == p.scalar_mul(1) and p.addition(p) == p.scalar_mul(2) for all points p. solium-disable-next-line security/no-inline-assembly Use "invalid" to make gas estimation work | function scalar_mul(G1Point memory p, uint256 s)
internal
view
returns (G1Point memory r)
{
uint256[3] memory input;
input[0] = p.X;
input[1] = p.Y;
input[2] = s;
bool success;
assembly {
success := staticcall(sub(gas(), 2000), ... | 10,582,227 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface AggregatorV3Interface {
function decimals()
external
view
returns (
uint8
);
function description()
external
view
returns (
string memory
);
function version()
external
view
returns (
... | Internal function to convert an in-currency quote amount to out-currency using only the Uniswap rate and by correcting it if needed from Chainlink last rate quoteAmount Amount (in the input collateral) to be converted in out-currency using Uniswap (and Chainlink) at the end of the funnel return uniAmount Quote amount ... | function _readUniswapQuote(uint256 quoteAmount) internal view returns (uint256 uniAmount) {
uniAmount = _quoteUniswap(quoteAmount);
uniAmount = (uniAmount * BASE) / outBase;
if (uniFinalCurrency > 0) {
uniAmount = _changeUniswapNotFinal(0, uniAmount);
}
}
| 6,280,912 |
pragma experimental ABIEncoderV2;
pragma solidity 0.6.4;
// SPDX-License-Identifier: MIT
library EthAddressLib {
/**
* @dev returns the address used within the protocol to identify ETH
* @return the address assigned to ETH
*/
function ethAddress() internal pure returns (address) {
retur... | SPDX-License-Identifier: MIT | interface IOracle {
function get(address token) external view returns (uint256, bool);
}
| 1,234,669 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since... | Calculate totalValue on Token1 | function netValueToken1(
uint256 amount0,
uint256 amount1,
uint256 priceX96
) internal pure returns (uint256 netValue) {
netValue = FullMath.mulDiv(amount0, priceX96, FixedPoint96.Q96).add(amount1);
}
| 1,246,510 |
/**
*Submitted for verification at Etherscan.io on 2020-01-30
*/
// File: contracts/math/SafeMath.sol
pragma solidity 0.5.12;
/// @title SafeMath
/// @dev Math operations with safety checks that throw on error
library SafeMath {
/// @dev Add two integers
function add(uint a, uint b) internal pure returns ... | Add investor to set of whitelisted addresses _investors A list where each entry is an Ethereum address | function addToWhitelist(address[] calldata _investors) external onlyAdmin {
for (uint256 i = 0; i < _investors.length; i++) {
if (!isWhitelisted[_investors[i]]) {
isWhitelisted[_investors[i]] = true;
emit InvestorAdded(msg.sender, _investors[i]);
}
... | 1,786,919 |
./full_match/1/0x56102B469d7B0650E92426611Eb2Ea84C0cA9b2A/sources/contracts/interfaces/IQuest.sol | TODO clean this whole thing up Allows anyone to claim a token if they exist in a merkle root. | interface IQuest {
event Claimed(address indexed account, address rewardAddress, uint256 amount);
event ClaimedSingle(address indexed account, address rewardAddress, uint256 amount);
event Queued(uint timestamp);
event JsonSpecCIDSet(string cid);
error AlreadyClaimed();
error AmountExceedsBalan... | 3,008,814 |
pragma solidity 0.7.4;
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
*... | Copy word-length chunks while possible | function memcpy(uint dest, uint src, uint len) private pure {
for(; len >= 32; len -= 32) {
assembly {
mstore(dest, mload(src))
}
dest += 32;
src += 32;
}
uint mask = 256 ** (32 - len) - 1;
assemb... | 7,521,967 |
./full_match/80001/0xDE3e13Ce11F4defB8C565d857cD82461078347AF/sources/contracts/PrmntSkyNft.sol | Update generator address/ | function setGeneratorAddress( address _address ) public onlyOwner {
generatorAddress = _address;
}
| 835,306 |
./full_match/84531/0x79eA6D31756aEf4c102Aa5669ca524E163561030/sources/contracts/MasterChefV3.sol | Safe Transfer BEAGLE. _to The BEAGLE receiver address. _amount Transfer BEAGLE amounts. Update beagleAmountBelongToMC | function _safeTransfer(address _to, uint256 _amount) internal {
if (_amount > 0) {
uint256 balance = BEAGLE.balanceOf(address(this));
if (balance < _amount) {
_amount = balance;
}
unchecked {
if (beagleAmountBelongToMC >= _amoun... | 14,319,488 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./interfaces/ICoverForge.sol";
import "./ERC20/IERC20Permit.sol";
import "./ERC20/ERC20.sol";
import "./ERC20/IERC20.sol";
import "./utils/Ownable.sol";
import "./ERC20/ERC20Permit.sol";
import "./ERC20/SafeERC20.sol";
contract CoverForge is ERC20("Cove... | Destroys `amount` tokens from `account`, reducing the total supply. Emits a {Transfer} event with `to` set to the zero address. Requirements: - `account` cannot be the zero address. - `account` must have at least `amount` tokens./ | function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account] - amount;
_totalSupply = _totalSupply - amount;
... | 3,114 |
pragma solidity 0.4.21;
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal constant returns (uint256) {
// assert(b > 0)... | Lock the transfCrowdsaleer function during the crowdsale transferOwnership(_admin); | function UnitedfansToken(address _admin) public {
admin = _admin;
crowdSaleAddress = msg.sender;
migrationMaster = _admin;
}
| 162,468 |
./full_match/5/0xDcE8B7908038E0F6Eb08d0411163E322610C8Ad7/sources/project_/contracts/Token/BXERC721.sol | Burn multiple nft with ONLY OWNER tokenIds - array of token ids/ | function burnBatch(uint256[] memory tokenIds) external onlyOwner nonReentrant {
for (uint256 i; i < tokenIds.length; ++i) {
_burn(tokenIds[i]);
}
}
| 7,035,017 |
pragma solidity ^0.4.24;
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "./ThankYouNoteToken.sol";
contract ThankYouNote is Ownable {
/* attributes section */
struct Balance {
uint sent;
uint received;
}
mapping (string => Balance) private _balances;
mapp... | Reset all counters/ | function reset() external onlyOwner {
uint size = userNames.length;
for (uint i = 0; i < size; i++) {
_balances[userNames[i]].received = 0;
_balances[userNames[i]].sent = 0;
}
_totalSupply = 0;
}
| 6,406,372 |
./full_match/11155111/0x5d78a75E1adaBe80AC410D4b4aEAF68c9D78B6d2/sources/contracts/facets/DiamondLoupeFacet.sol | Gets all the function selectors supported by a specific facet. _facet The facet address. return _facetFunctionSelectors The selectors associated with a facet address. loop through function selectors Set the number of selectors in the array | function facetFunctionSelectors(
address _facet
) external view override returns (bytes4[] memory _facetFunctionSelectors) {
LibDiamond.DiamondStorage storage ds = LibDiamond.diamondStorage();
uint256 numSelectors;
_facetFunctionSelectors = new bytes4[](ds.selectorCount);
uint256 selectorIndex;
... | 3,806,423 |
./full_match/137/0xC0c42d148241c5b5BB38e974d40Fc9087f7F9ecD/sources/src/Facets/AllBridgeFacet.sol | Bridge tokens to another chain via AllBridge _bridgeData The bridge data struct | function startBridgeTokensViaAllBridge(
ILiFi.BridgeData memory _bridgeData,
AllBridgeData calldata _allBridgeData
)
external
payable
nonReentrant
refundExcessNative(payable(msg.sender))
validateBridgeData(_bridgeData)
doesNotContainSourceSwaps(_br... | 4,684,462 |
./partial_match/1/0x3Fdb3bd1ab409F0CBB2c4d919b2205ac881B99ED/sources/src/governor/GovernorTimelockControl.sol | Public accessor to check the eta of a queued proposal/ | function proposalEta(uint256 proposalId) public view virtual override returns (uint256) {
uint256 eta = $timelock.getTimestamp($timelockIds[proposalId]);
}
| 9,366,532 |
./partial_match/1/0x4Ca4B6D72ba76f964d6a3BAe24dC2200227bF979/sources/HumpBack.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("HumpBack", "HUMP") {
router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Pair = IUniswapV2Factory(router.factory()).createPair(address(this), router.WETH());
_isExcludedMaxTransactionAmount[address(router)] = true;
_isExcludedMa... | 15,558,319 |
pragma solidity ^0.4.21;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
function sub(uint256 a... | Cancel transaction if transfer value more then available without vesting amount | function transfer(address _to, uint256 _value) public returns (bool) {
require(releasedForTransfer);
if ( ( vestingAmount[msg.sender] > 0 ) && ( block.number < vestingBeforeBlockNumber[msg.sender] ) ) {
if ( balances[msg.sender] < _value ) revert();
if ( balances[msg.sender] <= vestingAmount[msg.sender] ) re... | 1,351,836 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.