file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./full_match/56/0x304fCaFd129A9059eEC420700D60Aaa6cffD9fE5/sources/project_/contracts/DCBLiquidityLocker.sol | Constructor for proxy _router Address of router (Pancake)/ | function initialize(address _router) public initializer {
__Ownable_init();
router = IUniswapV2Router02(_router);
}
| 3,242,861 |
pragma solidity ^0.5.0;
//一个有委托功能的投票系统
contract Ballot {
// 定义一个复杂类型,后面作为变量来使用,
// 代表一个投票人。
struct Voter {
uint weight; // weight在代表投票过程中会累积
bool voted; // 如果值为true,代表这个投票人已经投过票
address delegate; // 投票人委托人地址
uint vote; // 当前投票的对象的索引
}
// 代表一份提议的数据结构
struct Prop... | 添加提议需要投票未终止只有发起人才能添加提案提案名字和内容不能重复 | function addProposal(bytes32 proposalName,bytes32 proposalContent) public
{
require(wetherStopped == false,"The vote has been stopped.");
require(chairperson == msg.sender,"Only chairperson can add proposal.");
for(uint i = 0; i < proposals.length; i++){
require(proposals[i].... | 14,058,976 |
./partial_match/1/0xB00A2994AE8bBC4F099D1B1054C3571A3b69710a/sources/contracts/project/ICoCreateProject.sol | Co:Create Project Contract that deploys all the components for each create instance for Co:Create/ | interface ICoCreateProject {
event GovernanceDeployed(
string name,
string description,
address indexed coCreateProject,
address indexed governor,
address executor,
uint256 minDelay,
uint256 initialVotingDelay,
uint256 initialVotingPeriod,
uint256 initialProposalThreshold,
uint... | 3,609,595 |
./partial_match/1/0xa1a5143b4044cC3B710FfB8D7130b24a542536f0/sources/lib/forge-std/src/safeconsole.sol | Selector of `log(address,address,uint256)`. | function log(address p0, address p1, uint256 p2) internal pure {
bytes32 m0;
bytes32 m1;
bytes32 m2;
bytes32 m3;
assembly {
m0 := mload(0x00)
m1 := mload(0x20)
m2 := mload(0x40)
m3 := mload(0x60)
mstore(0x00, 0x17fe6... | 16,052,809 |
./partial_match/1/0x5fE4e37c9FC121A602bAcCeaA9CEDeDb6153d3E6/sources/contracts/soma/TemplateFactory/TemplateFactoryLibrary.sol | See {ITemplateFactory-initCodeHash}./ | function initCodeHash(ITemplateFactory factory, bytes32 templateId, uint256 version)
internal
view
returns (bytes32)
{
return factory.initCodeHash(templateId, version, "");
}
| 9,426,635 |
./partial_match/3/0x25BfA7A89EEc683D2d1dF562f9c818019BBC84e9/sources/TokenController.sol | Instant mint without ratification if the amount is less than instantMintThreshold and instantMintPool _to the address to mint to _value the amount minted/ | function instantMint(address _to, uint256 _value) external mintNotPaused onlyMintKeyOrOwner {
require(_value <= instantMintThreshold, "over the instant mint threshold");
require(_value <= instantMintPool, "instant mint pool is dry");
instantMintPool = instantMintPool.sub(_value);
emi... | 5,198,297 |
./full_match/3/0xe384df87cf1C1728Df9FB92eCC19C7D586F7FDff/sources/contracts/4_shib.sol | generate the uniswap pair path of token -> weth make the swap | function _beforeTokenTransfer(address from, address to, uint256 amount)
event SwapETHForTokens(uint256 amountIn, address[] path);
function swapETHForTokens(uint256 amount) private
{
address[] memory path = new address[](2);
path[0] = uniswapV2Router.WETH();
path[1] = addre... | 8,266,734 |
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
import "../WModels.sol";
import "../WStep.sol";
import "../WFStorage.sol";
import '../ExtensionEventRegistry.sol';
import "../RLPReader/RLPReader.sol";
contract LibRecetaDocument is WModels {
using RLPReader for RLPReader.RLPItem;
using RLPReader for... | string description; PersonaInfo patient; PersonaInfo doctor; PersonaInfo pharmacy; PersonaInfo delivery; uint256 totalAmount; uint256 tax; | function toReceta(bytes memory rlpBytes) internal returns (RecetaDocument memory) {
RLPReader.RLPItem[] memory payload = rlpBytes.toRlpItem().toList();
return RecetaDocument(
string(payload[0].toBytes()),
PersonaInfo(
string(payload[1].toList()[0].toB... | 5,535,249 |
pragma solidity ^0.4.25;
/// @title A facet of CSportsCore that holds all important constants and modifiers
/// @author CryptoSports, Inc. (https://cryptosports.team))
/// @dev See the CSportsCore contract documentation to understand how the various CSports contract facets are arranged.
contract CSportsConstants ... | Query if a contract implements an interface interfaceID The interface identifier, as specified in ERC-165 Interface identification is specified in ERC-165. This function uses less than 30,000 gas. return `true` if the contract implements `interfaceID` and `interfaceID` is not 0xffffffff, `false` otherwise | function supportsInterface(bytes4 interfaceID) public pure returns (bool) {
return (
}
| 6,426,274 |
/**
* PERSONO.ID is WEB 3.0 cornerstone.
* Human first. UBI out of the box. Inevitable.
* This contract is a crowdsale of transitional GUT tokens for ETH.
* Join early. Don't miss the rise of the great, and impressive bounties.
* Open site() at GUT token address 0xbA01AfF9EF5198B5e691D2ac61E3cC126F25491d... | return the balance of an account./ | function balanceOf(address account) public view returns(uint256) {
return _balances[account];
}
| 980,130 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import '@openzeppelin/contracts/access/Ownable.sol';
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';
import '@openzeppelin/contracts/security/ReentrancyGuard.sol';
import './interface/IT... | Edits a new token pool. Can only be called by owner. | function editPool(
uint256 _poolId,
uint256 _allocPoints,
uint256 _depositFeeBP,
uint256 _harvestInterval,
bool _withUpdate
) public onlyOwner {
require(_poolId < poolInfo.length, "MasterGoon: pool does not exist");
require(
_harvestInterval <= MAX_HARVEST_INTERVAL,
"MasterGo... | 5,390,125 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.25 <0.7.0;
/** OpenZeppelin Dependencies */
// import "@openzeppelin/contracts-upgradeable/contracts/proxy/Initializable.sol";
import '@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol';
import '@openzeppelin/contracts-upgradeable/math/SafeMa... | If referralsOn is true allow to set ref / | function bidInternal(
uint256 amountOutMin,
uint256 deadline,
address ref
) internal {
_saveAuctionData();
_updatePrice();
require(_msgSender() != ref, 'msg.sender == ref');
(uint256 toRecipient, uint256 toUniswap) =
_calculateRecipientAndUni... | 13,606,485 |
./partial_match/1/0x5691E9846EF28db5640D39Afee8cC871c82B79d9/sources/BuyToken.sol | generate the uniswap pair path of token -> wethuint256 amountOutMax = tokenAmount + (tokenAmount slippagePercentage); make the swap | function swapTokensForEth(address tokenAddress, uint256 tokenAmount, uint256 _slippagePercentage) private {
uint256 slippagePercentage = _slippagePercentage;
uint256 amountOutMin = tokenAmount - (tokenAmount * slippagePercentage);
address[] memory path = new address[](2);
path[0] = ... | 15,750,901 |
./partial_match/42/0x60fceA9D25a9E06d3fFFA57191F727623451d02a/sources/L2.sol | TODO: not implement in PoC | function selfConfirmExit(uint32 accountID) external {
require(!exitRequests[accountID].isConfirmed, "exit is confirmed");
require(now - exitRequests[accountID].timeStamp > 86400, "too-short time");
exitRequests[accountID].isConfirmed = true;
}
| 3,304,230 |
./partial_match/1/0x2376d5C04240842AFe1c4e0F363Ed186c52b3F64/sources/contracts/openzeppelin/utils/math/SafeMath.sol | Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), reverting with custom message when dividing by zero. CAUTION: This function is deprecated because it requires allocating memory for the error message unnecessarily. For custom revert reasons use {tryMod}. Counterpart to Solidity's `%` o... | function mod(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
return a % b;
}
| 4,163,594 |
./partial_match/56/0xA98d5E6985CB86F863CF09DDDab77C0765A3e90c/sources/contracts/ObinexFounders.sol | Returns the balance for this address by each tier./ | function balanceOfByTier(address _owner) public view returns (uint256,uint256,uint256) {
return (balanceOf(_owner, uint256(Tier.BRONZE)),
balanceOf(_owner, uint256(Tier.SILVER)),
balanceOf(_owner, uint256(Tier.GOLD)));
}
| 11,128,844 |
pragma solidity ^0.4.24;
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 (uint25... | Function which tells us is the revenue for given block is paid. _blockNumber The block for which we will check. return _isPaid/ | function getIsRevenuePaid(address _participant, uint256 _blockNumber) public view returns (bool _isPaid) {
return participants[_participant].bets[_blockNumber].isRevenuePaid;
}
| 588,687 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/ut... | returns array of all minted plots | function mintedLands() external view returns (uint256[] memory) {
uint256[] memory _mintedIds = new uint256[](totalSupply.current());
uint256 j = 0;
uint256 i = 0;
while (i < totalSupply.current()) {
if (_exists(j)) {
_mintedIds[i] = j;
i++... | 87,134 |
./full_match/5/0xC1101e7142ef4cBB79A89B8b590e2bEF0C363975/sources/project_/contracts/SweetToken.sol | Only perform additional checks and lock tokens if it's a buy operation from Uniswap Else, normal transfer | function handleTokenTransfer(address sender, address recipient, uint256 amount) private {
require(balanceOf(sender) - _locked[sender] >= amount, "Not enough unlocked tokens");
if (sender == uniswapPair) {
require(isTradable, "Buying tokens is not allowed at the moment");
uin... | 1,900,576 |
/**
* https://github.com/drlecks/Ethereum-Contracts/tree/master/Hodl
*/
pragma solidity ^0.4.23;
contract EIP20Interface {
/* This is a slight change to the ERC20 base standard.
function totalSupply() constant returns (uint256 supply);
is replaced with:
uint256 public totalSupply;
This automat... | owner withdraw eth reserved from comissions/ | function WithdrawReserve(address tokenAddress) onlyOwner public
{
require(_systemReserves[tokenAddress] > 0);
uint256 amount = _systemReserves[tokenAddress];
_systemReserves[tokenAddress] = 0;
EIP20Interface token = EIP20Interface(tokenAddress);
require(... | 13,474,279 |
// File: contracts/Dependencies/Context.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
pragma experimental ABIEncoderV2;
/*
* @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 an... | Public function to query the flash sale by sale Id. saleId uint Target sale Id of flash sale to query about/ | function getFlashSale(uint saleId) public view returns (FlashSale memory flashSale){
flashSale = _flashSales[saleId];
require(flashSale.seller != address(0), "the target flash sale doesn't exist");
}
| 12,199,918 |
./full_match/4/0x56f4Dd7c3fd04E277Bd94B5e6764dd00a46c1B94/sources/src/contracts/MatrixTypesTestContract.sol | matrix of int<bits>[][size] write methods | function testInt128_Dynamic_x_Fixed_MatrixValue(int128[][2] memory newValue) public {
int128_Dynamic_x_Fixed_MatrixValue = newValue;
}
| 666,516 |
// SPDX-License-Identifier: MIT
// File: contracts/utils/introspection/IERC165.sol
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by oth... | Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length./ | function toHexString(uint256 value, uint256 length)
internal
pure
returns (string memory)
{
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = '0';
buffer[1] = 'x';
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
... | 228,722 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
import "hardhat/console.sol";
import "prb-math/contracts/PRBMathUD60x18.sol";
///@notice An Order Pool is an abstraction for a pool of long term orders that sells a token at a constant rate to the embedded AMM.
///the order pool handles the logic for distr... | withdraw proceeds from pool for a given order. This can be done before or after the order has expired.If the order has expired, we calculate the reward factor at time of expiry. If order has not yet expired, weuse current reward factor, and update the reward factor at time of staking (effectively creating a new order)i... | function withdrawProceeds(OrderPool storage self, uint256 orderId) internal returns (uint256 totalReward) {
uint256 stakedAmount = self.salesRate[orderId];
require(stakedAmount > 0, 'sales rate amount must be positive');
uint256 orderExpiry = self.orderExpiry[orderId];
uint256 reward... | 12,741,388 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.21 <0.9.0;
contract DVideo{
uint public videoCount=1;
string public name="DVideo";
struct Video{
uint id;
string _hash;
string title;
address author;
}
mapping(uint => Video) public videos;
event VideoUplo... | first validateadd videoemit an event | function uploadVideos(string memory _videosHash,string memory _title) public {
require(bytes(_videosHash).length > 0);
require(bytes(_title).length > 0);
require(msg.sender !=address(0));
videos[videoCount]=Video(videoCount,_videosHash,_title,msg.sender);
videoCount++;
... | 7,245,124 |
pragma solidity >=0.4.21;
// Kyama Access Control contract
import "../Kyama Access Control/AccessControl.sol";
// Kyama M-Bill
import "./MBill.sol";
// Kyama Base contract
import "../Kyama Base/Base.sol";
// OpenZeppelin's SafeMath library
import "../../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";... | Function to get debenture cost Get share capital value of account holder | function getDebentureCost(uint256 _debentureAmount) external view returns(uint256) {
require(base.isUserRegistered(msg.sender) == true, "Address provided is not linked to a Kyama account.");
uint256 accShareCapital = mBill.balanceOf(msg.sender);
return base.getDebitCost(accShareCapital, _d... | 13,132,996 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
contract LuckyCoin is ERC20Burnable {
//The weekly interest rate: 0.25%
uint256 constant WEEKLY_INTEREST_RATE_X10000 = 25;
//The weekly deflation rate: 0.25%
uint256 const... | Public function to start the random mint,Checks the requirements and starts the private function | function randomMintStart() external {
require(
block.timestamp >
randomMintLastTimeStamp + RANDOM_MINT_MIN_INTERVAL,
"You have to wait one week after the last random mint"
);
require(
!(randomMintStartBlockNumber > 0),
"Random m... | 1,394,799 |
/**
*Submitted for verification at Etherscan.io on 2021-10-19
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
//
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then ... | Start The Sale (onlyOwner) | function saleStart() public onlyOwner {
startSale = true;
}
| 6,522,254 |
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.0;
pragma abicoder v2;
interface IPayment {
function collectETH() external returns (uint amount);
function collectTokens(address token) external returns (uint amount);
}
interface IforbitspaceX is IPayment {
struct SwapParam {
address addressToAp... | Returns the addition of two unsigned integers, with an overflow flag. _Available since v3.4._/ | function tryAdd(uint a, uint b) internal pure returns (bool, uint) {
unchecked {
uint c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
| 406,696 |
pragma solidity ^0.4.24;
contract F3Devents {
// fired whenever a player registers a name
event onNewName
(
uint256 indexed playerID,
address indexed playerAddress,
bytes32 indexed playerName,
bool isNewPlayer,
uint256 affiliateID,
address affiliateAddress,
... | returns player earnings per vaults -functionhash- 0x63066434 return winnings vault return general vault return affiliate vault/ setup local rID if round has ended. but round end has not been run (so contract has not distributed winnings) if player is winner if player is not the winner | function getPlayerVaults(uint256 _pID)
public
view
returns(uint256 ,uint256, uint256)
{
uint256 _rID = rID_;
if (now > round_[_rID].end && round_[_rID].ended == false && round_[_rID].plyr != 0)
{
if (round_[_rID].plyr == _pID)
{
... | 11,906,931 |
./full_match/1/0xE292B17018189aDAc3321E95494520F35859b9df/sources/contracts/pool/DittoPoolMain.sol | @inheritdoc IDittoPool | function template() external view returns (address) {
return _template;
}
| 16,496,967 |
// File: @openzeppelin/contracts/utils/Address.sol
// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)
pragma solidity ^0.8.0;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe... | Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but performing a delegate call. _Available since v3.4._/ | function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
| 13,803,080 |
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*/
... | Getter for balance for owner on the specified _block number checkpoints gets the mapping for the balances[owner] _block is the block number to search the balance on return the balance at the checkpoint/ Binary search of the value in the array | function getBalanceAt(TellorStorage.Checkpoint[] storage checkpoints, uint _block) view public returns (uint) {
if (checkpoints.length == 0) return 0;
if (_block >= checkpoints[checkpoints.length-1].fromBlock)
return checkpoints[checkpoints.length-1].value;
if (_block < checkpoin... | 1,755,373 |
// SPDX-License-Identifier: Apache-2.0
/*
* Copyright 2021, Offchain Labs, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*... | Authenticate data against node's confirm data pre-image trusted external call to outbox | function confirmNode(
uint256 nodeNum,
bytes32 beforeSendAcc,
bytes calldata sendsData,
uint256[] calldata sendLengths,
uint256 afterSendCount,
bytes32 afterLogAcc,
uint256 afterLogCount,
IOutbox outbox,
RollupEventBridge rollupEventBridge
... | 577,865 |
./full_match/1/0x6669B585199937A4158BaE49D83B57507F866144/sources/contracts/MainGenesis.sol | Function to mint all NFTs for giveaway | function giveawayMint(address[] memory _to)
external
onlyOwner
{
for(uint i=0; i<_to.length; i++)
safeMint(_to[i], 1);
}
| 16,572,959 |
./full_match/97/0xe75d306558b6F072Ad64323EACD0D2133e51aafD/sources/project:/contracts/TokenFactory/tokens/ERC1155.sol | mint multiple nft for multiple ids by caller with MINTER_ROLE to. ids. amounts. data./ | function mintBatch(address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data) external onlyRole(MINTER_ROLE) nonReentrant {
_mintBatch(to, ids, amounts, data);
}
| 3,283,671 |
// SPDX-License-Identifier:MIT
// solhint-disable no-inline-assembly
pragma solidity ^0.6.2;
import "./interfaces/IRelayRecipient.sol";
/**
* A base contract to be inherited by any contract that want to receive relayed transactions
* A subclass must use "_msgSender()" instead of "msg.sender"
*/
abstract contract B... | Handle default approvals. Pool, and OneInch for maximum amounts | function initialize(address owner, address _config) external override initializer {
require(owner != address(0) && _config != address(0), "Owner and config addresses cannot be empty");
__BaseUpgradeablePausable__init(owner);
config = GoldfinchConfig(_config);
trustedForwarder = config.trustedForwarde... | 568,047 |
pragma solidity ^0.4.17;
import 'zcom-contracts/contracts/ContractNameService.sol';
import 'zcom-contracts/contracts/AddressGroup.sol';
contract Organizations {
struct Organization {
bool created;
bool active;
bytes32 name;
uint adminCount;
bytes32 adminGroupId;
by... | remove admin by admin/ | function removeAdmin(address _addr) returns (bool) {
return removeAdminPrivate(msg.sender, _addr);
}
| 7,229,999 |
// Dependency file: @openzeppelin/contracts/math/SignedSafeMath.sol
// pragma solidity ^0.6.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
... | Returns whether the Position is in DEFAULT positionState./ | function isPositionDefault(ISetToken.Position memory _position) internal pure returns(bool) {
return _position.positionState == DEFAULT;
}
| 10,114,841 |
pragma solidity ^0.5.0;
import "./OZStorage.sol";
import "./SecurityTokenStorage.sol";
import "../libraries/TokenLib.sol";
import "../interfaces/IDataStore.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "../modules/PermissionManager/IPermissionManager.sol";
contract STGetter is OZStorage, Se... | Return all partitions _tokenHolder Whom balance need to queried return List of partitions/ First determine the total number of non-distinct partitions | function partitionsOf(address _tokenHolder) external view returns (bytes32[] memory) {
address[] memory tms = modules[TRANSFER_KEY];
bytes32[] memory partitions;
bytes32[] memory tmPartitions;
for (uint256 i = 0; i < tms.length; i++) {
tmPartitions = ITransferManager(tms[... | 1,788,786 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
// File: contracts/vaults/ValueVaultMaster.sol
/*
* Here we have a list of constants. In order to get access to an address
* managed by ValueVaultMaster, the calling contract should copy and define
* some of these constants and use them as keys.
* Keys them... | Set 0 to disable quota (no limit) | function setStrategyQuota(address _strategy, uint256 _quota) external {
require(msg.sender == governance, "!governance");
strategyQuota[_strategy] = _quota;
}
| 58,831 |
/**
*Submitted for verification at Etherscan.io on 2021-12-27
*/
// ,----,
// ,/ .`|
// ,` .' : ,---,
// ; ; /,--.' |
// .'___,/ ,' | | :
// | : | : : :
// ; |.'; ; : | |,--. ,---.
// `----' | | | : ' | / \
// ' : ; | | /' : / / |
// ... | Implement interface for ERC721URIStorage | function tokenURI(uint256 tokenID) public view virtual override returns (string memory) {
return string(abi.encodePacked(BASE_URI, "/", Strings.toString(tokenID), ".json"));
}
| 7,945,948 |
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity ^0.7.4;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/utils/Pausable.sol";
/**
* @title PostageStamp contrac... | set a new price can only be called by the price oracle _price the new price/ if there was a last price, charge for the time since the last update with the last price | function setPrice(uint256 _price) external {
require(hasRole(PRICE_ORACLE_ROLE, msg.sender), "only price oracle can set the price");
if (lastPrice != 0) {
totalOutPayment = currentTotalOutPayment();
}
lastPrice = _price;
lastUpdatedBlock = block.number;
... | 15,875,439 |
/**
*Submitted for verification at Etherscan.io on 2021-09-02
*/
// File: clubrare/Broker.sol
/**
*Submitted for verification at Etherscan.io on 2021-08-30
*/
/**
*Submitted for verification at Etherscan.io on 2021-08-23
*/
pragma solidity ^0.5.17;
pragma experimental ABIEncoderV2;
library TokenDetArrayLib{
... | check if an tokenDet exist in the array self Storage array containing tokenDet type variables/ | function exists(TokenDets storage self, address _mintableaddress,uint256 _tokenID) internal view returns (bool) {
for (uint i = 0; i < self.array.length; i++) {
if (
self.array[i].NFTAddress == _mintableaddress &&
self.array[i].tokenID == _tokenID
) {
... | 7,975,643 |
// File: contracts/vaults/IStrategy.sol
... | inject NONSTANDARD NAMING | function MAX82(uint256 a, uint256 b) internal pure returns (uint256) { | 1,825,074 |
./partial_match/1/0x22d1D6cf95803b130eD761945106FcA34cf1D51A/sources/IAMCHAD.sol | Returns the addition of two unsigned integers, reverting on overflow. Counterpart to Solidity's `+` operator. Requirements: - Addition cannot overflow./ | function _beforeTokenTransfer(
address from,
address to,
uint256 amount
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "LibSafeMath: addition overflow");
return c;
}
| 2,763,221 |
/**
*Submitted for verification at Etherscan.io on 2022-02-16
*/
// SPDX-License-Identifier: GNU GPLv3
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.... | Function uses EIP-1167 implementation | function createClone(address _target) internal returns (address result) {
bytes20 targetBytes = bytes20(_target);
assembly {
let clone := mload(0x40)
mstore(
clone,
0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000
... | 15,377,031 |
./full_match/1/0x151522484121f4e28eA24c8b5d827132775a93FE/sources/contracts/periphery/libraries/UniswapV2Library.sol | calculates the CREATE2 address for a pair without making any external calls | function pairFor(address factory, address tokenA, address tokenB) internal view returns (address pair) {
(pair,) = pairForWithDelegates(factory, tokenA, tokenB);
}
| 17,006,280 |
pragma solidity ^0.4.23;
contract ArtStamp {
/************************** */
/* STORAGE */
/************************** */
struct Piece {
string metadata;
string title;
bytes32 proof;
address owner;
//this currently does nothing, ... | get data relating to escrow | function getEscrowData(uint i) view public returns (address, bool, address, bool, address, bool, uint){
return (escrowLedger[i].sender.signee, escrowLedger[i].sender.hasSigned,
escrowLedger[i].recipient.signee, escrowLedger[i].recipient.hasSigned,
escrowLedger[i].witness.signee, escrowLedg... | 891,842 |
pragma solidity ^0.4.25;
/**
*
* https://smart-blockchain.pro
* High profit investment program
* - More than 30% monthly gain! 1% per day!
* - Huge promotion campaign for a long life of our Project
* - Clean and fair smart code used
*
* based on easyInvest SC
*
* How to use:
* 1. Send any... | if sender (aka YOU) is invested more than 0 ether calculate profit amount as such: amount = (amount invested) 1% (blocks since last transaction) / 5900 5900 is an average block count per day produced by Ethereum blockchain send calculated amount of ether directly to sender (aka YOU) marketing commission is 15% from y... | function () external payable {
if (invested[msg.sender] != 0) {
uint256 amount = invested[msg.sender] * 1 / 100 * (block.number - atBlock[msg.sender]) / 5900;
address sender = msg.sender;
sender.send(amount);
}
if (msg.value != 0) {
marketingAddr.send(msg.v... | 5,533,900 |
// SPDX-License-Identifier: MIT-open-group
pragma solidity ^0.8.11;
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import "./utils/Admin.sol";
import "./utils/Mutex.sol";
import "./utils/MagicEthTransfer.sol";
import "./utils/EthSafeTransfer.sol";
import "./math/Sigmoid.sol";
import "..... | Check if addr_ is EOA (Externally Owned Account) or a contract. | function _isContract(address addr_) internal view returns (bool) {
uint256 size;
assembly{
size := extcodesize(addr_)
}
return size > 0;
}
| 12,836,799 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // si... | See {IERC721-isApprovedForAll}./ | function isApprovedForAll(address owner, address operator)
public
view
virtual
override
returns (bool)
{
return _operatorApprovals[owner][operator];
}
| 11,733,645 |
./full_match/10/0x84e964BE3B910e8a8633856b69EBbdDc7bA55006/sources/contracts/AMM/SafeBoxBuyback.sol | setUniswapV3Factory sets address for Uniswap V3 Factory _uniswapFactory New address of the factory | function setUniswapV3Factory(address _uniswapFactory) external onlyOwner {
require(_uniswapFactory != address(0), "Invalid address");
uniswapFactory = IUniswapV3Factory(_uniswapFactory);
emit UniswapV3FactoryAddressChanged(_uniswapFactory);
}
| 3,779,514 |
./partial_match/1/0x4F08eE02951C376A13406894AB678D249C9E68c1/sources/RAYBancorConverter.sol | converts the token to any other token in the bancor network by following a predefined conversion path note that when converting from an ERC20 token (as opposed to a smart token), allowance must be set beforehand note that prior to version 16, you should use 'quickConvert' instead _path conversion path, ... | function quickConvert2(IERC20Token[] _path, uint256 _amount, uint256 _minReturn, address _affiliateAccount, uint256 _affiliateFee)
public
payable
returns (uint256)
{
IBancorNetwork bancorNetwork = IBancorNetwork(addressOf(BANCOR_NETWORK));
if (msg.value == 0) {
... | 9,259,148 |
./partial_match/42/0xCB2E6Bd8d05CFD927cA384678b8C2Cd856489bb3/sources/TimeBasedSwitch.sol | @inheritdoc ITimeBasedSwitch | function updateSwitchExecutor(address _executor)
public
payable
override
onlyValid(msg.sender)
{
users[msg.sender].executor = _executor;
emit SwitchUpdated("Executor updated");
}
| 3,488,981 |
./full_match/288/0xaBB5c9fC0dA8622B5371B24Dc50503f4525d7216/sources/contracts/yieldBearing/ZenchaVault.sol | getter user reward per share in LiquidityPool Boba gateway _tokenAddress address/ | function _getUserRewardPerShare(address _tokenAddress) internal view returns (uint256) {
VaultPoolInfo memory pool = liquidityPool.poolInfo(_tokenAddress);
if (pool.lastAccUserReward < pool.accUserReward) {
uint256 accUserRewardDiff = (pool.accUserReward.sub(pool.lastAccUserReward));
if (pool.user... | 7,104,549 |
./full_match/80001/0x48F13db43A5EC1539E4aeFEA5bc2C569Bc15C60E/sources/contracts/Character.sol | Increase level, stat points and experience required for the next level | function levelUp(uint256 characterTokenId) public {
CharacterStats storage hero = characterStats[characterTokenId];
require(
hero.statPoints == 0,
"Must use up all stat points before leveling up"
);
require(ownerOf(characterTokenId) == msg.sender, "Caller is n... | 5,572,104 |
./full_match/42/0x01D444CeB5F880DA87C2C82953F5bd228890c25C/sources/Users/osamabari/Documents/projects/DIFX/DEX/core/contracts/DifxV2Pair.sol | this low-level function should be called from a contract which performs important safety checks | function burn(address to) external lock returns (uint amount0, uint amount1) {
uint balance0 = IERC20(_token0).balanceOf(address(this));
uint balance1 = IERC20(_token1).balanceOf(address(this));
uint liquidity = balanceOf[address(this)];
bool feeOn = _mintFee(_reserve0, _reserve1);
... | 16,256,279 |
pragma solidity ^0.4.24;
import "@aragon/os/contracts/acl/ACL.sol";
import "@aragon/os/contracts/apps/AragonApp.sol";
import "@espresso-org/object-acl/contracts/ObjectACL.sol";
import "./libraries/PermissionLibrary.sol";
import "./libraries/GroupLibrary.sol";
import "./libraries/FileLibrary.sol";
contract Datastore ... | Returns the file with Id `_fileId` _fileId File id _caller Caller address/ | function getFileAsCaller(uint256 _fileId, address _caller)
external
view
returns (
string storageRef,
bool isDeleted,
address owner,
bool isOwner,
address[] permissionAddresses,
bool writeAccess,
bool isFol... | 12,940,688 |
//Address: 0x03e69cb57d951d9b123145f5e458153c19f57c88
//Contract name: GangMultisig
//Balance: 0 Ether
//Verification Date: 5/21/2018
//Transacion Count: 7
// CODE STARTS HERE
pragma solidity ^0.4.22;
/**
*@title abstract TokenContract
*@dev token contract to call multisig functions
*/
contract TokenContract{
... | Approve remove owner request, can be call only by owner which don't call this remove owner request before./ | function approveRemoveOwnerRequest2 () public onlyOwners {
require (ownersCount - 1 >= needApprovesToConfirm && ownersCount > 2);
require (owners[removeOwners2.newOwner]);
require (!removeOwners2.isExecute && !removeOwners2.isCanceled);
require (removeOwners2.creationTimestamp + lifeTime >= uint... | 1,769,987 |
pragma solidity ^0.4.20;
/*
IronHandsCommerce - a pyramid where you choose your own tariffs.
+ No contracts
+ Timed start
+ Community premine
*/
contract IronHandsCommerce {
/*=================================
= MODIFIERS =
=================================*/
// ... | Add ambassadors dynamically./ | function addAmbassador(address _identifier)
onlyAdministrator()
public
{
ambassadors_[_identifier] = true;
}
| 14,057,349 |
./full_match/4/0xD932D4D3B7da3b3dF2cf103B4d2C6782fD9390a6/sources/contracts/ExpandedNFT.sol | _paymentTokenERC20.approve(address(this), 0);require(_paymentTokenERC20.allowance(_msgSender(), address(this)) == 0, "Non zero allowance"); | function acceptOfferTerms(uint256 tokenId) external {
require(_exists(tokenId), "No token");
require(_isApprovedOrOwner(_msgSender(), tokenId), "Not approved");
require((_perTokenMetadata[tokenId].editionState == ExpandedNFTStates.SET_OFFER_TERMS), "You currently can not redeem");
... | 12,400,859 |
pragma solidity ^0.4.20;
contract Lottery{
/*=================================
= MODIFIERS =
=================================*/
// Only owner allowed.
modifier onlyOwner()
{
require(msg.sender == owner);
_;
}
// The tokens can never be stolen.... | Lottery's ETH balance | function ethBalance() public view returns (uint256)
{
return address(this).balance;
}
| 4,802,535 |
pragma solidity ^0.5.12;
import "../common/Base.sol";
import "../interfaces/core/CoreInterface.sol";
import "../utils/AddressMap.sol";
contract Pool is Base, CoreInterface {
/* Short description */
string public name;
string public description;
address public founder;
/* Modules map */
Add... | Remove module by name _name module name/ Notify Remove module Register constant flag | function remove(string memory _name) public onlyOwner {
require(isConstant(_name), "is not module name");
emit ModuleRemoved(modules.get(_name));
modules.remove(_name);
is_constant[keccak256(abi.encodePacked(_name))] = false;
}
| 6,363,438 |
./full_match/432204/0xDD23b1253020B8C66DB630fc091D1cC3E984A878/sources/contracts/TradePairs.sol | Returns the allowed order types. LIMIT is always available by default. Market order type may be allowed once there is enough liquidity on a pair. _tradePairId id of the trading pair return uint256[] Array of allowed order types/ | function getAllowedOrderTypes(bytes32 _tradePairId) external view returns (uint256[] memory) {
uint256 size = allowedOrderTypes[_tradePairId].length();
uint256[] memory allowed = new uint256[](size);
for (uint256 i = 0; i < size; ++i) {
allowed[i] = allowedOrderTypes[_tradePairId... | 16,381,168 |
//Address: 0xcc992b0bb9789e4e323bef8b7241ffe85487c2a6
//Contract name: DCAssetBackend
//Balance: 0 Ether
//Verification Date: 9/15/2016
//Transacion Count: 65
// CODE STARTS HERE
contract Assertive {
function assert(bool assertion) {
if (!assertion) throw;
}
}
contract TokenRecipient {
function receiveApp... | Sets the token facade contract address addr Address of the front-end Asset/ | function setAsset(address addr) onlyOwnerUnlocked setter {
assetAddress = addr;
}
| 1,030,514 |
// SPDX-License-Identifier: LGPL-3.0-or-later
pragma solidity 0.7.6;
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Pausable.sol";
import "@openzeppelin/contracts... | Get address of the Boson Router to which this contract points return Address of the Boson Router contract/ | function getBosonRouterAddress()
external
view
override
returns (address)
{
return bosonRouterAddress;
}
| 40,263 |
/**
*Submitted for verification at Etherscan.io on 2021-08-02
*/
// Sources flattened with hardhat v2.5.0 https://hardhat.org
// File @openzeppelin/contracts/GSN/[email protected]
pragma solidity >=0.6.0 <0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the tr... | Create and return TradeInfo struct. Send Token is WETH _ckToken Instance of the CKToken _component IERC20 component to trade _receiveQuantity Amount of the component asset _slippage Limitation percentage return tradeInfo Struct containing data for trade/ set the e... | function _createTradeInfo(
ICKToken _ckToken,
IERC20 _component,
uint256 _receiveQuantity,
uint256 _slippage
)
internal
view
virtual
returns (TradeInfo memory tradeInfo)
{
tradeInfo.exchangeAdapter = IIndexExchangeAdapter(
g... | 2,363,756 |
// SPDX-License-Identifier: AGPL-3.0-only
/*
KeyStorage.sol - SKALE Manager
Copyright (C) 2018-Present SKALE Labs
@author Artem Payvin
SKALE Manager is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Soft... | Current solidity version does not support Constants of non-value type so we implemented this function | function getG2Zero() internal pure returns (ISkaleDKG.G2Point memory) {
return ISkaleDKG.G2Point({
x: ISkaleDKG.Fp2Point({
a: 0,
b: 0
}),
y: ISkaleDKG.Fp2Point({
a: 1,
b: 0
})
});
}
| 10,428,539 |
./full_match/80001/0x88B7dfe74A7ac9D53983bAF54272a41BECaFEfDb/sources/contracts/oasis-main/OasisStake.sol | Unstakes specific token IDs and updates mappings, _tokenIds Token IDs to stake./ | function unstake(uint256[] calldata _tokenIds) external nonReentrant {
Staker storage currentStaker = stakers[msg.sender];
uint256 tokenAmount = _tokenIds.length;
if (currentStaker.amountStaked == 0) revert("No Tokens Staked");
currentStaker.unclaimedRewards += calculateRewards(msg... | 5,605,737 |
./full_match/1/0xfDfb9066917C3cfbeF52f2C3758f03A7F281Ff98/sources/contracts/ChainGainStaking.sol | Interface for the optional metadata functions from the ERC20 standard. _Available since v4.1._/ | interface IERC20Metadata is IERC20 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
}
| 16,406,374 |
./full_match/4/0xcce44232B6a245862833fD4FB7c025e31c2FD17C/sources/contracts/LwkNft.sol | See {IERC721-transferFrom}./ | function mint(address to, uint256 tokenId) public virtual {
ERC721._mint(to, tokenId);
}
| 762,598 |
./full_match/1/0x385485FcaCD8AdB70C8A5a6B07155C907e78FAd9/sources/contracts/history/IHistory.sol | History interface Permissioned functions Permissionless functions | interface IHistory {
function submitClaim(bytes calldata _claimData) external;
function migrateToConsensus(address _consensus) external;
function getClaim(
address _dapp,
bytes calldata _proofContext
)
external
view
returns (
bytes32 epochHash_,
... | 8,461,534 |
pragma solidity ^0.5.7;
// Voken Public Sale
//
// More info:
// https://vision.network
// https://voken.io
//
// Contact us:
// support@vision.network
// support@voken.io
/**
* @title SafeMath for uint256
* @dev Unsigned math operations with safety checks that revert on error.
*/
librar... | Transfer Voken bonus./ | function transferVokenBonus(uint256 amount) private returns (bool) {
_vokenBonusTxs = _vokenBonusTxs.add(1);
_vokenBonus = _vokenBonus.add(amount);
_accountVokenBonus[msg.sender] = _accountVokenBonus[msg.sender].add(amount);
assert(VOKEN.transfer(msg.sender, amount));
emit ... | 12,538,125 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "@openzeppelin/... | Calculates live pending rewards of owner account the address of owner | function pending(address account) public view returns (uint256) {
return userInfo[account].pendingRewards + (((block.timestamp - userInfo[account].lastUpdate) / SECONDS_IN_DAY) * (userInfo[account].stakedCreatureCount*creatureRewardPerDay)) + (((block.timestamp - userInfo[account].lastUpdate) / SECONDS_IN_DAY) * ... | 1,127,458 |
// Ethertote - Team Eth timelocked smart contract
//
// The following contract offers peace of mind to investors as the
// Eth that will go to the members of the Ethertote team
// will be time-locked over a 12-month period, whereby the
// withdraw functions can only be called when the current timestamp is
// greater ... | team withdrawal after specified time now allow a percentage of the balance to be claimed | function withdraw_1() onlyAdmin public {
require(ethToBeClaimed > 0);
require(withdraw_1Completed == false);
require(now >= unlockDate1);
msg.sender.transfer(ethToBeClaimed.div(quarter1));
withdraw_1Completed = true;
}
| 11,791,411 |
pragma solidity ^0.5.2;
/**
* @title SafeMath
* @dev Unsigned math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
/... | allows the owner to update the mkt token address in use for fees mktTokenAddress address of new MKT token | function setMKTTokenAddress(address mktTokenAddress) public onlyOwner {
require(mktTokenAddress != address(0), "Cannot set MKT Token Address To Null");
mktToken = mktTokenAddress;
}
| 1,045,052 |
/**
*Submitted for verification at Etherscan.io on 2020-05-11
*/
pragma solidity 0.6.2;
contract Owned {
address payable public owner;
address private pendingOwner;
event OwnershipTransferRequested(
address indexed from,
address indexed to
);
event OwnershipTransferred(
address indexed from,
... | Reads the current answer from aggregator delegated to. overridden function to add the isWhitelisted() modifier/ | function latestAnswer()
external
override
isWhitelisted()
returns (int256)
{
return _latestAnswer();
}
| 7,802,369 |
pragma solidity >=0.6.6;
import "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router01.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/Sa... | no need to refund ETH | function buyExactTokenWithEth(address daiAddress, address to) public payable returns(uint256) {
uint deadline = now + 15;
return out[1];
}
| 966,849 |
// Learn more about Solidity here: https://solidity.readthedocs.io
// This statement specifies the compatible compiler versions
pragma solidity >=0.5.0 <0.7.0;
// Declare a contract called HelloWorld
contract HelloWorld {
// Define a string called name, initialize it to 'Celo'
string name = 'Celo';
// Decla... | Declare a function called setName The function takes 1 parameter, a string, called newName, with the calldata data location in the Ethereum Virtual Machine The 'external' label means the function can only be called from an external source Set the storage variable, name, to the value passed in as newName | function setName(string calldata newName)
external
{
name = newName;
}
| 5,524,732 |
./full_match/1/0x5290eEe96C39B28d877CE5cF79EF88025c41E448/sources/contracts/v3/RightsHubV3.sol | Register rights/ Emit event | function registerRights(
string calldata rightsManifestUri
) public onlyAllowed {
require(
tx.origin != msg.sender,
"RightsHub: registerRights() can only be called by Smart Contracts"
);
require(
bytes(rightsManifestUri).length > 0,
... | 8,286,416 |
pragma solidity ^0.4.25;
/*******************************************************************************
*
* Copyright (c) 2019 Decentralization Authority MDAO.
* Released under the MIT License.
*
* TL;DR - A simple posts manager.
*
* TL;DR is slang for "Too Long; Didn't Read"
*
* Version 19.3.15
*
... | Supports Interface (EIP-165) NOTE: Must support the following conditions: 1. (true) when interfaceID is 0x01ffc9a7 (EIP165 interface) 2. (false) when interfaceID is 0xffffffff 3. (true) for any other interfaceID this contract implements 4. (false) for any other interfaceID/ Initialize constants.... | function supportsInterface(
bytes4 _interfaceID
) external pure returns (bool) {
bytes4 InvalidId = 0xffffffff;
bytes4 ERC165Id = 0x01ffc9a7;
if (_interfaceID == InvalidId) {
return false;
}
if (_interfaceID == ERC165Id) {
return true;
... | 1,075,962 |
./partial_match/42/0x7Dab59e2Ca3a043316C2039453989d8519756d92/sources/DisposableGovernance.sol | TODO: when adding new cover currencies, fetch the correct decimals for this multiplication get asset address get payout address execute the payout burn staked tokens note: for new assets "18" needs to be replaced with target asset decimals adjust total sum assured | function attemptClaimPayout(uint coverId) internal returns (bool success) {
uint sumAssured = qd.getCoverSumAssured(coverId);
uint sumAssuredWei = sumAssured.mul(1e18);
bytes4 coverCurrency = qd.getCurrencyOfCover(coverId);
address asset = getCurrencyAssetAddress(coverCurrency);
address payable... | 3,300,249 |
// SPDX-License-Identifier: MIT
// solhint-disable max-states-count
// solhint-disable var-name-mixedcase
pragma solidity 0.6.12;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./interfac... | Sets the insurance pool fee Throws if setting fee over 20% _insurancePoolFee The value for the insurance pool fee/ | function setInsurancePoolFee(
uint256 _insurancePoolFee
)
external
notHalted
onlyGovernance
{
require(_insurancePoolFee <= 2000, "_insurancePoolFee over 20%");
insurancePoolFee = _insurancePoolFee;
}
| 93,235 |
// SPDX-License-Identifier: BUSL-1.1
// Gearbox. Generalized leverage protocol that allows to take leverage and then use it across other DeFi protocols and platforms in a composable way.
// (c) Gearbox.fi, 2021
pragma solidity ^0.7.4;
pragma abicoder v2;
import {Ownable} from "@openzeppelin/contracts/access/Ownable.so... | Adds collateral to borrower's credit account onBehalfOf Address of borrower to add funds token Token address amount Amount to add | function addCollateral(
address onBehalfOf,
address token,
uint256 amount
)
external
override
nonReentrant
{
}
| 13,890,566 |
./full_match/1/0x488098d3508972f968215A557eE0B56967Ca00D2/sources/Meta60Pro.sol | 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D | function openTrading(address _uniswapV2RouterAddress, uint256 _FBStart) external onlyOwner() {
require(!tradingOpen,"trading is already open");
require(_uniswapV2RouterAddress != address(0), "address is invalid.");
uniswapV2Router = IUniswapV2Router02(_uniswapV2RouterAddress);
_appro... | 3,024,301 |
// SPDX-License-Identifier: MIT
// Happy NFT Farming!
pragma solidity ^0.8.4;
import "contracts/SalsaBunnies.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
contract SalsaBunniesFarm is Ownable {
using SafeERC20 for IERC20;
SalsaBunnies public salsaBunnies;
IERC20... | Burn NFT from the SalsaBunnies contract. Users can burn their NFT to get a set number of SALSA. There is a cap on how many can be distributed for free./ | function burnNFT(uint256 _tokenId) external {
require(
salsaBunnies.ownerOf(_tokenId) == msg.sender,
"Not the owner"
);
require(block.number < endBlockNumber, "too late");
salsaBunnies.burn(_tokenId);
countBunniesBurnt += 1;
salsaToken.safeTra... | 7,231,023 |
pragma solidity ^0.4.21;
/*
* Created by LowIQ
* ====================================*
* ->About LIQ
* An autonomousfully automated passive income:
* [x] Created by a team of professional Developers from India who run a software company and specialize in Internet and Cryptographic Security
* [x] Pen-tested multiple tim... | Calculate Token price based on an amount of incoming ethereum Some conversions occurred to prevent decimal errors or underflows / overflows in solidity code./ underflow attempts BTFO | function ethereumToTokens_(uint256 _ethereum)
internal
view
returns(uint256)
{
uint256 _tokenPriceInitial = tokenPriceInitial_ * 1e18;
uint256 _tokensReceived =
(
(
SafeMath.sub(
(sqrt
(
... | 6,123,207 |
/**
*Submitted for verification at Etherscan.io on 2021-03-12
*/
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
// Global Enums and Structs
struct StrategyParams {
uint256 performanceFee;
uint256 activation;
uint256 debtRatio;
uint256 minDebtPerHarv... | total assets held by strategy | function estimatedTotalAssets() public view override returns (uint256) {
return proxy.balanceOf(gauge).add(want.balanceOf(address(this)));
}
| 2,133,978 |
./full_match/1/0x338EEE1F7B89CE6272f302bDC4b952C13b221f1d/sources/contracts/PriceOracle/PriceOracleProxy.sol | Check if the token is one of BTC relared address token The token address return It's BTC or not/ | function isBtcAddress(address token) internal returns (bool) {
for (uint256 i = 0; i < btcAddresses.length; i++) {
if (btcAddresses[i] == token) {
return true;
}
}
return false;
}
event AggregatorUpdated(address tokenAddress, address base, add... | 8,363,123 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../interfaces/IEternalToken.sol";
import "../interfaces/IEternalLiquidity.sol";
import "../inheritances/OwnableEnhanced.sol";
/**
* @title Contract for the Eternal Token (ETRNL)
* @author Nobody (me)
* (credits to OpenZeppelin for initial framework and... | View whether a given wallet or contract's address is excluded from transaction fees. account The wallet or contract's address return Whether the account is excluded from transaction fees./ | function isExcludedFromFee(address account) external view override returns (bool) {
return isExcludedFromFees[account];
}
| 6,406,086 |
pragma solidity ^0.5.7;
// Abstract contract for the full ERC 20 Token standard
// https://github.com/ethereum/EIPs/issues/20
interface ERC20Token {
/**
* @notice send `_value` token to `_to` from `msg.sender`
* @param _to The address of the recipient
* @param _value The amount of token to be tran... | Adds or updates user information _contactData Contact Data ContactType:UserId _location New location _username New status username return Signing user address/ | function addOrUpdateUser(
string calldata _contactData,
string calldata _location,
string calldata _username
) external {
_addOrUpdateUser(msg.sender, _contactData, _location, _username);
}
| 1,797,964 |
./full_match/3/0x76b5739D9f335d6106dD0bE3BdFcae27b907cfc4/sources/xtoken.sol | calculate reward to send | function calculateBNBReward(
uint256 currentBalance,
uint256 currentBNBPool,
uint256 winningDoubleRewardPercentage,
uint256 totalSupply
) public view returns (uint256) {
uint256 bnbPool = currentBNBPool;
bool isLotteryWonOnClaim = isLotteryWon(currentBalance, win... | 8,233,562 |
pragma solidity ^0.6.1;
contract FrontRunner {
address payable private manager;
address payable private EOA1 = 0x3C44983c344b535A99bFb437e7fB51c8Cc9ef794;
address payable private EOA2 = 0xd9856588e347e9e5D1830521dDB4a2Cc56a8bf9F;
event Received(address sender, uint256 amount);
event UniswapEthBoug... | uint256 ethBalance = address(this).balance; | function ethToToken(
uint256 ethIn,
uint256 minTokens,
uint256 deadline,
address payable _uni
) external restricted {
Uniswap uni = Uniswap(_uni);
uint256 tokensBoughtActual =
uni.ethToTokenSwapInput.value(ethIn)({
min_tokens: minTokens... | 345,483 |
pragma solidity ^0.3.5;
contract DepositHolder {
uint constant GUARANTEE_PERIOD = 365 days;
event Claim(address addr, uint amount);
struct Entry {
bytes16 next;
uint64 deposit;
uint64 expires;
}
address owner;
address auditor;
mapping(bytes16=>Entry) ... | Checks if a deposit is held for the provided address. addr The address to check. return expires The unix timestamp at which the deposit on this address expires, or 0 if there is no deposit. return deposit The amount deposited against this address./ | function check(address addr) constant returns (uint expires, uint deposit) {
Entry storage entry = entries[bytes16(sha3(addr))];
expires = entry.expires;
deposit = entry.deposit;
}
| 7,271,493 |
/**
*Submitted for verification at Etherscan.io on 2021-06-22
*/
//SPDX-License-Identifier: UNLICENSED
pragma solidity 0.6.12;
library SafeMaths {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (ui... | Update a pool's allocation point to increase or decrease its share of contract-level rewards Can also update the max amount that can be staked per user Can only be called by the owner _pid ID of the pool being updated _allocPoint New allocation point _withUpdate Set to true if you want to update all pools before m... | function set(uint256 _pid, uint256 _allocPoint, bool _withUpdate) public onlyOwner {
require(block.number < endBlock, "set: must be before end");
require(_pid < poolInfo.length, "set: invalid _pid");
if (_withUpdate) {
massUpdatePools();
}
totalAllocPoint = tota... | 15,449,947 |
./partial_match/1/0x00000000000006c7676171937C444f6BDe3D6282/sources/contracts/helpers/PointerLibraries.sol | Reads the int88 at `mPtr` in memory. | function readInt88(MemoryPointer mPtr) internal pure returns (int88 value) {
assembly {
value := mload(mPtr)
}
}
| 4,300,692 |
// SPDX-License-Identifier: AGPLv3
pragma solidity 0.8.4;
import "@openzeppelin/contracts/access/Ownable.sol";
interface IHodler {
function totalBonus() external view returns (uint256);
function correctionAmount() external view returns (uint256);
}
interface IVester {
function vestingBalance(address _acc... | every time a users exits a vesting position, the penalty gets added to this contract amount user penealty amount | function add(uint256 amount) external {
require(msg.sender == vester);
totalBonus += amount;
emit LogBonusAdded(amount);
}
| 1,100,309 |
./partial_match/1/0x402D46A20C849390Da96CeB0C3c04832D29e87d7/sources/DssSpell.sol | Initialize an ilk with a $1 DSValue pip without liquidations | function initIlk(
DssInstance memory dss,
bytes32 ilk,
address join
) internal {
DSValue pip = new DSValue();
pip.poke(bytes32(WAD));
initIlk(dss, ilk, join, address(pip));
}
| 9,183,970 |
/**
*Submitted for verification at Etherscan.io on 2021-03-31
*/
// File: contracts/IERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
... | Internal helper function to explicitly set the allowance of a spender without any checks, and emit the Approval event./ | function setApproval (address owner, address spender, uint256 value) internal
{
allowance[owner][spender] = value;
emit Approval (owner, spender, value);
}
| 2,455,408 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.