file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
contract TacoBar is ERC20("TacoBar", "xTACO"){
using SafeMath for uint256;
IERC20 public taco;
constructor(IERC20 _... | Enter the bar. Pay some TACOs. Earn some shares. | function enter(uint256 _amount) public {
uint256 totalTaco = taco.balanceOf(address(this));
uint256 totalShares = totalSupply();
if (totalShares == 0 || totalTaco == 0) {
_mint(msg.sender, _amount);
uint256 what = _amount.mul(totalShares).div(totalTaco);
_... | 7,281,886 |
pragma solidity ^0.4.11;
/**
* @title Owned contract with safe ownership pass.
*
* Note: all the non constant functions return false instead of throwing in case if state change
* didn't happen yet.
*/
contract Owned {
/**
* Contract owner address
*/
address public contractOwner;
... | Revoke trust to perform recovery procedure from an address. _to trustee. return success./ | function distrust(address _to) returns(uint errorCode) {
errorCode = shouldBeTrusted(msg.sender, _to);
if (errorCode != OK) {
return errorCode;
}
holders[getHolderId(msg.sender)].trust[_to] = false;
return OK;
}
| 12,781,370 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./CalStore.sol";
import "./VEventLibrary.sol";
/// @title Forget-me-block: Ethereum Calendar Authentication
... | Returnes events from CalStore as string Called by API, used in Email clients, not react-calendar _user address of user, required as called by Outlook/Thunderbird return string user role | function getEventsIcal(address _user) public view onlyRoleIcal(_user) returns (
string memory) {
AccessWindow memory requestWindow = accessList[_user];
if ((requestWindow.validFrom + requestWindow.expiresBy) == 0) {
return calStore.getEventsIcal(address(this));
return... | 2,537,694 |
pragma solidity ^0.8.6;
import "./FlightSuretyData.sol";
import "@openzeppelin/contracts/utils/math/SafeCast.sol"; // to typecase variable types safely
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
/************************************************** */
/* FlightSurety Smart Contract *... | Returns array of three non-duplicating integers from 0-9 | function generateIndexes(address account) internal returns (uint8[3] memory) {
uint8[3] memory indexes;
indexes[0] = getRandomIndex(account);
indexes[1] = indexes[0];
function getFlightKey(
address airline,
string memory flight,
uint256 timestamp
}
while (indexes[1] == indexes[0]) {
... | 6,486,474 |
./partial_match/1/0xE4dD566b410Fe45db55BD9F5f928269290B0a674/sources/SecurityToken.sol | Archives a module attached to the SecurityToken _module address of module to archive/ | function archiveModule(address _module) external onlyOwner {
TokenLib.archiveModule(modulesToData[_module], _module);
}
| 4,335,568 |
/* Copyright (C) 2020 NexusMutual.io
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 distribu... | sets refund eligible bit. _add user address. status indicates if user have pending kyc. | function setRefundEligible(address _add, bool status) external onlyInternal {
refundEligible[_add] = status;
}
| 2,578,185 |
pragma solidity ^0.5.15;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/********************************************************************************************/
/* DATA VARIABL... | Add an airline to the registration queue Can only be called from FlightSuretyApp contract/ | function registerAirline
(
address newAirline,
address fundedAirline
)
external
isAuthorizedCaller
requireIsO... | 900,975 |
./full_match/1/0x06B374699Ff828C5b2daE5153efbB684969BdcA0/sources/ALPEPENO.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("AL PEPENO", "AP") payable {
uint256 _buyMarketingFee = 10;
uint256 _buyLiquidityFee = 5;
uint256 _buyBuyBackFee = 0;
uint256 _buyDevFee = 10;
uint256 _sellMarketingFee = 15;
uint256 _sellLiquidityFee = 5;
uint256 _sellBuy... | 4,894,626 |
./full_match/1/0x8cfbFae570D673864CD61E1E4543eB7874ca35c2/sources/contracts/core/SoundEditionV1.sol | Helper function for retrieving the name and symbol, unpacking them from a single word in storage if previously packed. return name_ Name of the collection. return symbol_ Symbol of the collection./ Overflow impossible since max block gas limit bounds the length of the strings. If the strings have been previously... | function _loadNameAndSymbol() internal view returns (string memory name_, string memory symbol_) {
unchecked {
bytes32 packed = _shortNameAndSymbol;
if (packed != bytes32(0)) {
bytes memory nameBytes = new bytes(uint8(packed[0]));
bytes memory symbolBy... | 9,687,654 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.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 when ... | only locker can lock account/ | function lock(address account) public onlyLocker whenNotPaused {
_lock(account);
}
| 12,907 |
./partial_match/1/0xf9A2B61517780810c52539cfF4bfa31A32204c11/sources/contracts/CTSIFaucet.sol | Receives ether and sends CTSI back | function drip() payable public {
require(
msg.value >= 0.3 ether,
"Not enough ether sent in the transaction"
);
require(
ctsi.balanceOf(address(this)) >= AMOUNT,
"Contract is out of funds"
);
ctsi.transfer(msg.sender, AMOUNT);
... | 4,364,736 |
/**
*Submitted for verification at Etherscan.io on 2022-04-02
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// ... | This function, while callable by anybody will always ONLY withdraw the contract's balance to: the owner's account the addresses the owner has set up for revenue share the easely payout contract cut - capped at 5% but can be lower for some users This is callable by anybody so that Easely can set up automatic payouts aft... | function withdrawBalance(uint256 withdrawAmount) external {
require(withdrawAmount <= address(this).balance);
IEaselyPayout payoutContract = IEaselyPayout(PAYOUT_CONTRACT_ADDRESS);
owner(),
revenueShare,
revenueShareBPS
);
emit BalanceWithdrawn(wit... | 15,379,545 |
./full_match/42161/0x17337C1A93aAa9512110dC9FDd633b54123BbD3b/sources/contracts/tenderizer/Tenderizer.sol | @inheritdoc ITenderizer Execute state updates to pending withdrawals Unstake tokens | function unstake(uint256 _amount) external override returns (uint256) {
require(_amount > 0, "ZERO_AMOUNT");
require(tenderToken.burn(msg.sender, _amount), "TENDER_BURN_FAILED");
uint256 id = _unstake(msg.sender, node, _amount);
currentPrincipal -= _amount;
return i... | 16,308,504 |
pragma solidity ^0.5.17;
contract ClientReceipt {
event Deposit(
address indexed _from,
bytes32 indexed _id,
uint _value
);
function deposit(bytes32 _id) public payable {
// Events are emitted using `emit`, followed by
// the name of the event and the arguments
... | Events are emitted using `emit`, followed by the name of the event and the arguments (if any) in parentheses. Any such invocation (even deeply nested) can be detected from the JavaScript API by filtering for `Deposit`. | function deposit(bytes32 _id) public payable {
emit Deposit(msg.sender, _id, msg.value);
}
| 12,774,869 |
pragma solidity >= 0.6.2 < 0.7.0;
interface ICToken {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
event BurnTokenSuccess(address indexed _from, address indexed _to, uint256 _value);
function name() ext... | external onlyGovenors1 | function burnToken(address target, uint256 burnAmount) external; | 6,474,584 |
./full_match/5/0xA9ff44eB1231b6147AcEf486afD3B9e18FA06B85/sources/project_/contracts/Erc20DepositLogic2.sol | External function for changing the operatorAddress newOperatorAddress The new address for operatorAddress/ | function changeOperatorAddress(address newOperatorAddress)
external
onlyEthDepositLogic
onlyAlive
onlyAdmin
{
require(newOperatorAddress != address(0), "0x0 is an invalid address");
address oldOperatorAddress = operatorAddress;
operatorAddress = newOperato... | 1,960,074 |
./full_match/11155111/0x418d19d5e18dab22375B076C08F0D67e5867e8F0/sources/project:/libraries/StorageSlot.sol | Returns an `Uint256Slot` with member `value` located at `slot`./ | function getUint256Slot(
bytes32 slot
) internal pure returns (Uint256Slot storage r) {
assembly {
r.slot := slot
}
}
| 3,813,441 |
/*
██╗ ███████╗██╗ ██╗
██║ ██╔════╝╚██╗██╔╝
██║ █████╗ ╚███╔╝
██║ ██╔══╝ ██╔██╗
███████╗███████╗██╔╝ ██╗
╚══════╝╚══════╝╚═╝ ╚═╝
██╗ ██████╗ ██████╗██╗ ██╗███████╗██████╗
██║ ██╔═══██... | General ether payment function for `manager` of LXL contract. details Describes context for ether transfer./ | function tributeToManager(string calldata details) external nonReentrant payable {
require(success, "!ethCall");
emit TributeToManager(msg.sender, msg.value, details);
(bool success, ) = manager.call{value: msg.value}("");
}
| 264,068 |
/**
* Copyright 2017-2020, bZeroX, LLC <https://bzx.network/>. All Rights Reserved.
* Licensed under the Apache License, Version 2.0.
*/
pragma solidity 0.5.17;
pragma experimental ABIEncoderV2;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations i... | Cancels a proposal only if sender is the proposer, or proposer delegates dropped below proposal threshold proposalId The id of the proposal to cancel/ | function cancel(uint proposalId) external {
require(state(proposalId) != ProposalState.Executed, "GovernorBravo::cancel: cannot cancel executed proposal");
Proposal storage proposal = proposals[proposalId];
require(msg.sender == proposal.proposer || staking.votingBalanceOfNow(proposal.propo... | 260,295 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./ContractDataStorage.sol";
import "./SvgParser.sol";
contract CyberBrokersMetadata is Ownable {
using Strings for uint256;
bool private _useOn... | Get the broker DNA -> layers | function getLayers(uint256 tokenId) public view returns (uint256[] memory) {
require(tokenId <= 10000, "Invalid tokenId");
uint256 dna = brokerDna[tokenId];
require(dna > 0, "Broker DNA missing for token");
uint256 layerCount = (dna >> BROKER_LAYER_COUNT_DNA_POSITION) & BROKER_LAYER_COUNT_DNA_BITMAS... | 1,589,621 |
/**
*Submitted for verification at Etherscan.io on 2021-08-19
*/
// File: @openzeppelin/contracts/utils/Context.sol
// 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 the... | Mints Clown NFTs/ If we haven't set the starting index and this is either 1) the last saleable token or 2) the first token to be sold after the end of pre-sale, set the starting index block | function mintClown(uint numberOfTokens) public payable {
require(saleIsActive, "Sale must be active to mint Clowns");
require(numberOfTokens <= maxClownPurchase, "Can only mint 20 tokens at a time");
require(totalSupply().add(numberOfTokens) <= MAX_CLOWN, "Purchase would exceed max supply of... | 7,795,518 |
./partial_match/42/0xe529489f6F238689A4BD861305C106dd457B0743/sources/CompoundNoFoldStrategyUSDTMainnet.sol | Withdraws all assets, liquidates COMP/CREAM, and invests again in the required ratio./ | function doHardWork() public restricted {
if (liquidationAllowed) {
claimComp();
liquidateComp();
emit ProfitNotClaimed();
}
investAllUnderlying();
}
| 3,339,138 |
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.8.0;
// Sources flattened with hardhat v2.6.7 https://hardhat.org
// File contracts/Uniswap/TransferHelper.sol
// helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false
library TransferHelper {
... | Used as a further safety feature | function setMinCooldownSecs(uint256 _min_cooldown_secs) external onlyByOwnGov {
min_cooldown_secs = _min_cooldown_secs;
}
| 400,641 |
./full_match/4/0x653aDEFa1481c5c6F5d65f940472570e7871e2Bd/sources/_solidstate/contracts/proxy/diamond/base/DiamondBaseStorage.sol | add facet for selector clear selector position in slot and add selector if slot is full then write it to storage | function addFacetSelectors(
Layout storage l,
uint256 selectorCount,
bytes32 selectorSlot,
IDiamondWritable.FacetCut memory facetCut
) internal returns (uint256, bytes32) {
unchecked {
require(
facetCut.target == address(this) ||
... | 817,075 |
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/utils/math/SafeMath.sol
pragma solidity ^0.8.0;
// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.
/**
* @dev Wrappers over Solidity's arithmetic opera... | Toggle mintMain | function toggleMintMain() external onlyOwner {
mintMain = !mintMain;
}
| 6,137,194 |
./full_match/44787/0x17b75da97E7689ece5e62f99b477a4BBbf501210/sources/lib/mento-core-2.2.0/contracts/swap/BiPoolManager.sol | Creates a new exchange using the given parameters. _exchange the PoolExchange to create. return exchangeId The id of the newly created exchange./ | function createExchange(PoolExchange calldata _exchange) external onlyOwner returns (bytes32 exchangeId) {
PoolExchange memory exchange = _exchange;
require(address(exchange.pricingModule) != address(0), "pricingModule must be set");
require(exchange.asset0 != address(0), "asset0 must be set");
requir... | 13,258,539 |
./full_match/1/0x7b57d612145FFF7aEb9B232714B64F611fb0c634/sources/github/chiru-labs/ERC721A/contracts/RPG_simple.sol | Resisters, it's time to unite. | {
function summonResisters(uint256 quantity, string calldata inviteCode, bytes32[] calldata proof)
public
payable
isActivated()
isHuman()
nonReentrant
if (getRugpullLP() > 0) {
require(quantity <= _maxMint, "Exceeded max summon limit. There was no res... | 2,952,959 |
pragma solidity ^0.5.16;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/********************************************************************************************/
/* DATA VARIABL... | Returns passenger refunded amount by flight key and passenger/ | function getPayOutAmount(bytes32 flightKey, address passenger)
external
view
requireIsOperational
requireAuthorizedCaller
returns (uint256)
{
return insurances[flightKey].payOutAmount[passenger];
}
| 1,015,021 |
pragma solidity 0.5.8;
import "./ZampToken.sol";
contract ZampTokenSale {
using SafeMath for uint256;
ZampToken public tokenContract;
address payable adminSale;
uint256 public tokenPrice;
uint256 public tokensSold;
event Sell(address _buyer, uint256 _amount);
constructor(ZampToken _tok... | There was no need to enable this function to be time constrained since it is only for demo purposes. This implementation enables the contract to be live at all times. When the sales is ended, the remaining tokens are been trafered to the admin. Just transfer the balance to the admin | function endSale() public {
require(msg.sender == adminSale);
tokenContract.transfer(
adminSale,
tokenContract.balanceOf(address(this))
);
}
| 5,404,251 |
./full_match/137/0xD6e87CE87382854e4817c9a8331C8F2341bc7264/sources/hh.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 {_s... | ... | 3,755,735 |
./partial_match/1/0xEd40834A13129509A89be39a9bE9C0E96A0DDd71/sources/MiniMeToken.sol | _owner The address that's balance is being requested return The balance of `_owner` at the current block | function balanceOf(address _owner)
public
constant
returns (uint256 balance)
{
return balanceOfAt(_owner, block.number);
}
| 4,436,918 |
pragma solidity ^0.4.18;
/**
* ICrowdsale
*
* Base crowdsale interface to manage the sale of
* an ERC20 token
*
* #created 09/09/2017
* #author Frank Bonnet
*/
interface ICrowdsale {
/**
* Returns true if the contract is currently in the presale phase
*
* @return True if in... | ICrowdsaleProxy created 23/11/2017 author Frank Bonnet/ | interface ICrowdsaleProxy {
function () public payable;
function contribute() public payable returns (uint);
function contributeFor(address _beneficiary) public payable returns (uint);
}
}
| 13,019,905 |
// SPDX-License-Identifier: UNLICENSED
/*
▄▄█ ▄ ██ █▄▄▄▄ ▄█
██ █ █ █ █ ▄▀ ██
██ ██ █ █▄▄█ █▀▀▌ ██
▐█ █ █ █ █ █ █ █ ▐█
▐ █ █ █ █ █ ▐
█ ██ █ ▀
▀ */
/// 🦊🌾 Special thanks to Keno / Boring / Gonpachi / Karbon for review and continued inspiration.
pragma ... | returning residue in token0, if any returning residue in token1, if any | function _sushiDeposit(
address _ToUnipoolToken0,
address _ToUnipoolToken1,
uint256 token0Bought,
uint256 token1Bought
) private returns (uint256) {
IERC20(_ToUnipoolToken0).approve(address(sushiSwapRouter), 0);
IERC20(_ToUnipoolToken1).approve(address(sushiSwapRo... | 11,704,142 |
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import 'OpenZeppelin/openzeppelin-contracts@3.2.0/contracts/token/ERC20/IERC20.sol';
import 'OpenZeppelin/openzeppelin-contracts@3.2.0/contracts/math/SafeMath.sol';
import './BasicSpell.sol';
import '../utils/HomoraMath.sol';
import '../../interfaces/ICurvePoo... | add liquidity for pools with 2 underlying tokens 0. Take out collateral | function addLiquidity2(
address lp,
uint[2] calldata amtsUser,
uint amtLPUser,
uint[2] calldata amtsBorrow,
uint amtLPBorrow,
uint minLPMint,
uint pid,
uint gid
) external {
address pool = getPool(lp);
require(ulTokens[lp].length == 2, 'incorrect pool length');
require(wg... | 12,582,153 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
import '@openzeppelin/contracts/token/ERC20/SafeERC20.sol';
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '@openzeppelin/contracts/access/Ownable.sol';
import "./interface/IPremiaBondingCurveUpgrade.sol";
import "./interface/IERC2612Permit.sol... | Calculate the amount of tokens purchasable with a known eth amount _ethAmount The eth amount to use for the purchase return The amount of tokens purchasable with _ethAmount x0 = soldAmount | function getTokensPurchasable(uint256 _ethAmount) public view returns(uint256) {
uint256 x1 = _sqrt(
_ethAmount.mul(2e18).mul(k)
.add(k.mul(k).mul(startPrice).mul(startPrice))
.add(k.mul(2).mul(startPrice).mul(soldAmount))
.add(soldAmount.mul(soldAmount)))
... | 1,320,903 |
/*
Copyright 2020 VTD team, based on the works of Dynamic Dollar Devs and Empty Set Squad
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-... | Trades/Liquidity: (1) Initializes reserve and blockTimestampLast (can calculate a price) (2) Has non-zero cumulative prices Steps: (1) Captures a reference blockTimestampLast (2) First reported value/ | function capture() public onlyDao returns (Decimal.D256 memory, bool) {
if (_initialized) {
return updateOracle();
initializeOracle();
_isValid = false;
return (Decimal.one(), _isValid);
}
}
| 5,431,941 |
pragma solidity ^0.4.25;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint... | Must be called after crowdsale ends, to do some extra finalization work. Calls the contract's finalization function./ | function finalize() onlyOwner {
require(!isFinalized);
require(hasEnded());
finalization();
Finalized();
isFinalized = true;
}
| 923,485 |
./full_match/97/0xD88fFBD7b3F1643d7BedB9035319A7f9Fc71C90F/sources/project_/contracts/strf-token-staker/STRFStaker.sol | Adds new reward tokens and updates reward token data. Add new rewards and update all added reward data. feeType SWAP or PENALTY fee type declaration./ | function _addRewards(FeeType feeType) public {
address[] memory rewardsTokens = feeType == FeeType.SWAP
? feeDistributor.getSwapTokens()
: feeDistributor.getPenaltyTokens();
uint256[] memory rewardsAmounts = feeType == FeeType.SWAP
? feeDistributor.getSwapRewardsA... | 5,043,509 |
/*
Copyright 2019 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,... | Tests the `batchFillOrders` function's payment of protocol fees. testProtocolFees The TestProtocolFees that should be tested against. protocolFeeMultiplier The protocol fee multiplier that should be registered in the test suite before executing `batchFillOrders`. numberOfOrders The number of orders that shoul... | function testBatchFillOrdersProtocolFees(
TestProtocolFees testProtocolFees,
uint256 protocolFeeMultiplier,
uint256 numberOfOrders,
bool shouldSetProtocolFeeCollector
)
external
payable
handleState(testProtocolFees, protocolFeeMultiplier, shouldSetProtocol... | 1,007,637 |
./partial_match/1/0x95F6FC8511675a30BEA4Eda1a797FEb0ac619468/sources/PendulumArt.sol | See {IERC721Metadata-tokenURI}./ | function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
string memory baseURI = _baseURI();
return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString()... | 3,919,935 |
./full_match/1/0x7c804b088109C23d9129366a8C069448A4b219F8/sources/src/cores/ERC721/interface/IERC721.sol | events errors views | interface IERC721Internal {
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
error ApprovalCa... | 8,351,523 |
./partial_match/4/0x64fD3aea4Df3b76348a8cC9F2A18930fD6927738/sources/RAYv2.sol | pre-emptively check totalLent to see if we need to transfer funds to this contract from the specified RoboToken. loop through lOpportunityIds over lValues to avoid the potential case where have lValues, but less or no lOpportunityIds. This exposes the possibility to withdraw values into RAYv2 and never re-lend them out... | {
uint totalLent;
uint totalWithdrawn;
function executeWithdraw(
bytes32 opportunityId,
address opportunity,
address underlying,
address roboTokenAddress,
bool isERC20,
uint amountToRedeem,
uint opportunityNav
)
internal
}
function _rebalance(
address roboTokenA... | 8,750,833 |
pragma solidity 0.4.21;
// ----------------------------------------------------------------------------
// Safe maths
// ----------------------------------------------------------------------------
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
... | ------------------------------------------------------------------------ Transfer `tokens` from the `from` account to the `to` account The calling account must already have sufficient tokens approve(...) for spending from the `from` account and - From account must have sufficient balance to transfer - Spender must have... | function transferFrom(address from, address to, uint256 tokens) public returns (bool success) {
require(to != address(0));
require(tokens != 0);
require(tokens <= balances[from]);
require(tokens <= allowed[from][msg.sender]);
balances[from] = balances[from].sub(token... | 2,173,524 |
./full_match/42/0xe0Ab69528526a07c03335B64487cFD5fD7273501/sources/index.sol | This is safe from under/overflow - only logged amounts handled. | ) internal view returns (uint256 amountOut) {
uint256 weightRatio = _div(tokenInWeight, tokenOutWeight);
function _getAmountOut(
uint256 tokenInAmount,
uint256 tokenInBalance,
uint256 tokenInWeight,
uint256 tokenOutBalance,
uint256 tokenOutWeight
unchecked... | 9,572,396 |
contract DAO {
function balanceOf(address addr) returns (uint);
function transferFrom(address from, address to, uint balance) returns (bool);
function getNewDAOAddress(uint _proposalID) constant returns(address _newDAO);
uint public totalSupply;
}
/**
* @title trustedChildRefund
* @author Pa... | Function call to refund ETH by burning childDao tokens. proposalId The split proposal ID which created the childDao This requires that the token-holder authorizes this contract&39;s address using the approve() function./Check the token balance Transfer childDao tokens first, then send Ether back in return | function refund(uint proposalId) {
uint balance = whiteList[proposalId].balanceOf(msg.sender);
if (!whiteList[proposalId].transferFrom(msg.sender, this, balance) || !msg.sender.send(balance))
throw;
}
| 6,345,165 |
pragma solidity 0.4.25;
/*
* https://EtheriumToken.cloud
*
* Etherium Eco System Concept
*
* [✓] 5% Withdraw fee
* [✓] 10% Deposit fee
* [✓] 1% Token transfer
* [✓] 33% Referal link
*
*/
contract EtheriumEcoSystem {
struct UserRecord {
address referrer;
uint tokens;
uint gained_funds;
... | Gives square root from number/ | function sqrt(uint x) internal pure returns (uint y) {
uint z = add(x, 1) / 2;
y = x;
while (z < y) {
y = z;
z = add(x / z, z) / 2;
}
}
| 432,813 |
./partial_match/1/0xFccc39Ffd6002a60e7582f10F6E6C94BEaeaA73c/sources/contracts/option/Distributions.sol | Only the contract owner can call this function. Sets the redeem fee ratio. _feeRatio The new redeem fee ratio./ | function setRedeemFee(uint16 _feeRatio) external onlyOwner {
require(0 <= _feeRatio && _feeRatio < 10000, "Distributions: Illegal value range");
uint16 oldFeeRatio = redeemFeeRatio;
redeemFeeRatio = _feeRatio;
emit RedeemFeeRatioChanged(oldFeeRatio, redeemFeeRatio);
}
| 15,668,563 |
./full_match/1/0x5AbC8E25999e9a18309F9AF05295cEF88808cD8B/sources/BagSwap/bagSwapBridge/bscBridge.sol | This function has a non-reentrancy guard, so it shouldn't be called by another `nonReentrant` function. _beneficiary Recipient of the tokens _tokenAmount Number of tokens/ | function releaseTokens(address _beneficiary, uint _tokenAmount, uint _fromChainId, uint _toChainId) public nonReentrant onlyOwner {
require(_toChainId > 0, "Bridge: chain id cannot be less than 0");
require(_fromChainId > 0, "Bridge: chain id cannot be less than 0");
uint amount = (100 - _f... | 9,800,849 |
./full_match/1/0x84ffBc97757e534835354cB3dAd0e74f6d67b0e1/sources/project_/contracts/PixassoNft.sol | returns (bytes32 requestId) | function mint(address proudOwner, string calldata pixelData) internal { | 17,182,519 |
pragma solidity ^0.4.18;
import './Genbby-Token.sol';
/**
* @title Test New Token
* @dev A simple test contract that simulates how can a token contract can be upgraded
*/
contract TestNewToken is GenbbyToken {
address public last_token;
/**
* @dev Modifier that checks that `msg.sender` is the addres... | Function that the last token can use to move balance of `_owner` to this contract/ | function upgradeBalance(address who, uint256 amount) onlyLastToken public {
balances[who] = balances[who].add(amount);
totalSupply = totalSupply.add(amount);
}
| 892,090 |
./full_match/5/0x5137ABFf24ad5b7f8079F7f9BfCDB5645e490526/sources/project_/contracts/ERC1410/ERC1410Basic.sol | Return the symbol of the token | function symbol() public view returns (string memory) {
return tokenSymbol;
}
| 11,594,582 |
pragma solidity ^0.5.0;
/**
* @title SafeMath
* @dev Unsigned math operations with safety checks that revert on error.
*
* Subtraction and addition only here.
*/
library SafeMath {
/**
* @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).
... | METHOD: generate a new identifier. 3 parameters as inputs: 1. blockhash of previous block; 2. the address of the initialized contract which is requested; 3. the value of counter. return a 32-byte uid./ | function generateRequestUid() internal returns (bytes32 uid) {
return keccak256(abi.encodePacked(blockhash(block.number - uint256(1)), address(this), ++requestCount));
}
| 2,479,098 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.4;
pragma experimental ABIEncoderV2;
import "../libraries/LibAppStorage.sol";
import "../../shared/interfaces/IERC20.sol";
import "../libraries/LibStrings.sol";
import "../libraries/LibSVG.sol";
import "../../shared/libraries/LibDiamond.sol";
import "../../shared/lib... | Prevnts assets and items from being moved from Aavegotchi during lock period, except by gameManager. / | function lockAavegotchi(uint256 _tokenId, uint256 _lockDuration) external onlyUnlocked(_tokenId) {
require(s.aavegotchis[_tokenId].status == LibAppStorage.STATUS_AAVEGOTCHI, "AavegotchiFacet: Must be claimed");
require(msg.sender == s.aavegotchis[_tokenId].owner, "AavegotchiFacet: Only owner can loc... | 7,305,968 |
./full_match/56/0xF10582E78f4B7879AF5244827f1190D21162F964/sources/project_/contracts/StrategyCommonChefLP.sol | uint256 _callFee = IERC20(output).balanceOf(address(this)).mul(callFee).div(MAX_CALL_FEE); IERC20(output).safeTransfer(msg.sender, _callFee); IUniswapV2Router02 pancakeRouter = IUniswapV2Router02(unirouter); add the liquidity | function addLiquidity() internal {
uint256 toBNB = IERC20(output).balanceOf(address(this)).mul(25).div(100000);
IPancakeRouter01(unirouter).swapExactTokensForETH(toBNB, 0, outputToBnbRoute, address(this), now);
uint256 _callFee = IERC20(output).balanceOf(address(this)).mul(25).div(100000);... | 3,234,851 |
./full_match/1/0x2923A537546443AdcF47c7351b51Da6E423d3e58/sources/contracts/AuctionMarketplace.sol | Calculates The Minimum Valid Bid And Seeds The Leaderboard SaleIndex The Sale Index To Calculate The Minimum Valid Bid For MsgValue The Message Value (In WEI) To Calculate The Minimum Valid Bid For/ | function __FinalizeNewBid(uint SaleIndex, uint MsgValue) internal
{
(uint MinBid, uint LeaderboardIndex) = _ViewMinimumValidBidAndIndex(SaleIndex);
bool Valid = (SaleState[SaleIndex]._GlobalUniqueBids >= AuctionParams[SaleIndex]._LeaderboardSize);
}
| 17,090,051 |
./partial_match/3/0xE05FDD0806CA346Ad792Bf0b4bb8d4b1b8acA7Fb/sources/Nexon.sol | function to withdraw referral amount | function withdrawReferral(address add) external returns(bool){
require(_ReferalList[add] != msg.sender && _ReferalStatus[msg.sender] != true && add != msg.sender,"Either already withdrawn or not valid");
_transfer(_referralAddress, msg.sender, _referralAmount);
_transfer(_referralAddress, add, _referralAm... | 5,115,215 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;
import "./manager/WeightedBalancerPoolManager.sol";
import "./IVault.sol";
import "../../utils/Timed.sol";
import "../../refs/OracleRef.sol";
import "../IPCVSwapper.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
/// @title B... | / Ensures no actor can change the pool contents earlier in the block Balancer locks a small amount of bptTotal after init, so 0 bpt means pool needs initializing | function _swap() internal {
(,, uint256 lastChangeBlock) = vault.getPoolTokens(pid);
require(lastChangeBlock < block.number, "BalancerLBPSwapper: pool changed this block");
uint256 bptTotal = pool.totalSupply();
if (bptTotal == 0) {
_initializePool();
retur... | 5,935,637 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/uti... | implements ERC2981 `royaltyInfo()`/ | function royaltyInfo(uint256, uint256 salePrice)
external
view
returns(address receiver, uint256 royaltyAmount)
{
return (
payable(address(ROYALTY_RECIPIENT)),
(salePrice * ROYALTY_PERCENT) / 10000
);
}
| 14,365,835 |
/**
* The edgeless casino contract 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: Julia Altenried
**/
pragma solidity ^0.4.17... | updates the maximum deposit. newMax the new maximum deposit (5 decimals)/ | function setMaxDeposit(uint newMax) public onlyOwner{
maxDeposit = newMax;
}
| 12,781,950 |
./full_match/80001/0x179f6dFF6FbCC6616004fa5f3024cee684F70440/sources/src/paymaster/EtherspotPaymaster.sol | verify our external signer signed this request. the "paymasterAndData" is expected to be the paymaster and a signature over the entire request params paymasterAndData[:20] : address(this) paymasterAndData[20:84] : abi.encode(validUntil, validAfter) paymasterAndData[84:] : signature/ ECDSA library supports both 64 and 6... | function _validatePaymasterUserOp(
UserOperation calldata userOp,
bytes32 /*userOpHash*/,
uint256 requiredPreFund
) internal override returns (bytes memory context, uint256 validationData) {
(requiredPreFund);
(
uint48 validUntil,
uint48 validAfte... | 9,493,151 |
./partial_match/8453/0x0d92704267f93c0D369554cCec4377653951D1D5/sources/contracts/NFTMarketGasless.sol | validate new text-based listing signature validate old text-based listing signature check if old listing with legacy digest | function checkListingSignature(SignedListing calldata listing) internal view {
string memory serializedListing = serializeListingStruct(listing);
bytes32 serializedHash = keccak256(abi.encodePacked(serializedListing));
if (serializedHash == listing.digest) {
require(checkStringS... | 16,741,015 |
./partial_match/1/0x2b95b49ECec323AD6836Cc7A224BcDa984A2517A/sources/KIBBLEStake.sol | Sets the contract address for LP staking | function setDistributor(address _distributor) external onlyOwner {
distributor = IDistributor(_distributor);
emit DistributorSet(_distributor);
}
| 2,765,205 |
./partial_match/1/0x8d25b3843e3918D0F8d1687f0D3C733065D8d32f/sources/oToken.sol | This function returns the maximum amount of collateral liquidatable if the given vault is unsafe vaultOwner The index of the vault to be liquidated/ | function maxOTokensLiquidatable(address payable vaultOwner)
public
view
returns (uint256)
{
if (isUnsafe(vaultOwner)) {
Vault storage vault = vaults[vaultOwner];
uint256 maxCollateralLiquidatable = vault
.collateral
.mul(liq... | 16,155,346 |
./partial_match/1/0xEbb54967C52A39c21CbD3a91a4e6c3e175d88630/sources/Treasury.sol | BDIP02: 14 first epochs with 9% max expansion Expansion ($BSD Price > 1$): there is some seigniorage to be allocated saved enough to pay dept, mint as usual rate | function allocateSeigniorage() external onlyOneBlock checkCondition checkEpoch checkOperator {
_updateDollarPrice();
uint256 dollarSupply = IERC20(dollar).totalSupply().sub(seigniorageSaved);
if (epoch < bdip02BootstrapEpochs) {
_sendToBoardRoom(dollarSupply.mul(bdip02BootstrapSu... | 4,050,744 |
/**
*Submitted for verification at Etherscan.io on 2020-07-01
*/
pragma solidity ^0.5.0;
/**
* @title Tellor Transfer
* @dev Contais the methods related to transfers and ERC20. Tellor.sol and TellorGetters.sol
* reference this library for function's logic.
* Many of the functions have been commented out for simplici... | This function calculates the percent of the given numerator, denominator to the specified precision return _quotient/ | function _percent(uint numerator, uint denominator, uint precision) private pure returns(uint256 _quotient) {
_quotient = ((numerator * 10 ** (precision+1) / denominator) + 5) / 10;
}
| 12,897,426 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
library EnumerableSet {
struct Set {
bytes32[] _values;
mapping (bytes32 => uint256) _indexes;
}
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(... | if(!takeFee) removeAllFee(); | function _tokenTransfer(address sender, address recipient, uint256 amount,bool takeFee) private {
calculateAllFee();
if (isExcludedFromReward(sender) && !isExcludedFromReward(recipient)) {
_transferFromExcluded(sender, recipient, amount);
_transferToExcluded(sender, recipient... | 15,829,004 |
pragma solidity ^0.4.18;
import "../node_modules/openzeppelin-solidity/contracts/payment/PullPayment.sol";
//function asyncTransfer(address dest, uint256 amount) internal;
//function withdrawPayments() public;
contract ConnectFour is PullPayment {
enum BoardPiece {NONE, RED, BLACK}
//Encapsulates total game lea... | Player that is currently going | function getActivePlayer(uint gameId) constant internal returns(address){
BoardPiece player = games[gameId].whoseTurn;
if (player == BoardPiece.RED) {
return games[gameId].playerOneRed;
return games[gameId].playerTwoBlack;
revert();
}
}
| 15,871,325 |
./partial_match/42/0xE230251D53D04DA2DbaBaEcA92F59E1E8d7c7064/sources/_contracts/JoysNFTMinning.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 nftPoint = pool.point;
if (nftPoint == 0) {
pool.lastRewardBlock = block.number;
return;
... | 3,475,732 |
./partial_match/9001/0x91c483FDe16Ef79c38918a305F363B329156d1db/sources/contracts/ComplexRewarderTime.sol | Add a new LP to the pool. Can only be called by the owner. DO NOT add the same LP token more than once. Rewards will be messed up if you do. allocPoint AP of the new pool. _pid Pid on MCV2 | function add(uint256 allocPoint, uint256 _pid) public onlyOwner {
require(poolInfo[_pid].lastRewardTime == 0, "Pool already exists");
uint256 lastRewardTime = block.timestamp;
totalAllocPoint = totalAllocPoint.add(allocPoint);
poolInfo[_pid] = PoolInfo({
allocPoint: allo... | 16,688,934 |
./partial_match/1/0x575a9E386c33732880DEF8BE1BAD9dbc5dDDf7D7/sources/src/pickle-jar-univ3.sol | Determine Trade DirectionDetermine Amount to swapDetermine Token to swapSwap the token imbalanced | function _balanceProportion(int24 _tickLower, int24 _tickUpper) internal {
PoolVariables.Info memory _cache;
_cache.amount0Desired = token0.balanceOf(address(this));
_cache.amount1Desired = token1.balanceOf(address(this));
(uint160 sqrtPriceX96, , , , , , ) = pool.slot0();
... | 3,587,531 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity >=0.8.4;
import "@hifi/protocol/contracts/core/h-token/IHToken.sol";
import "@prb/contracts/token/erc20/Erc20.sol";
import "@prb/contracts/token/erc20/IErc20.sol";
import "@prb/contracts/token/erc20/Erc20Permit.sol";
import "@prb/contracts/token/erc20/SafeErc20.sol"... | Safe cast from uint256 to int256 | function toInt256(uint256 x) internal pure returns (int256 result) {
if (x > uint256(type(int256).max)) {
revert HifiPool__ToInt256CastOverflow(x);
}
result = int256(x);
}
| 12,549,755 |
pragma solidity >=0.4.22 <0.7.0;
//declare contract
contract Election {
//creating smoke test
//model a candidate
struct Candidate {
uint id;
string name;
uint voteCount;
}
//store accounts that have voted
mapping(address => bool) public voters;
//store candidate
... | Give your vote (including votes delegated to you) to proposal `proposals[proposal].name`. If `proposal` is out of the range of the array, this will throw automatically and revert all changes. | function vote(uint proposal) public {
Voter storage sender = voters[msg.sender];
require(sender.weight != 0, "Has no right to vote");
require(!sender.voted, "Already voted.");
sender.voted = true;
sender.vote = proposal;
proposals[proposal].voteCount += sender.weight... | 6,463,392 |
./full_match/42/0x69A2f1906E7d8D66AB8656F542c17Fe530eA6906/sources/r.sol | Interface of the ERC20 standard as defined in the EIP./ | interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint2... | 16,274,618 |
pragma solidity ^0.4.24;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* See https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address ... | Deposit depositor's origin token from privateToken _depositor address The address of whom deposit the token./ | function adminDeposit(address _depositor) public onlyAdmin returns (bool){
isDepositAllowed();
uint256 _value;
_value = balances[_depositor];
require(_value > 0);
balances[_depositor] = 0;
require(originToken.deposit(_depositor, _value));
emit Deposit(_depositor, _value);
... | 244,142 |
./full_match/11155111/0xf90bA889C8f993Fd625D05D8aB0459dbFE46C3FD/sources/contracts/fee-distribution/FeeDistributor.sol | Calculate the amount of `token` to be distributed to `_votingEscrow` holders since the last checkpoint./ If it's the first time we're checkpointing this token then start distributing from now. Also mark at which timestamp users should start attempts to claim this token from. Prevent someone from assigning tokens to an ... | function _checkpointToken(IERC20 token, bool force) internal {
TokenState storage tokenState = _tokenState[token];
uint256 lastTokenTime = tokenState.timeCursor;
uint256 timeSinceLastCheckpoint;
if (lastTokenTime == 0) {
lastTokenTime = block.timestamp;
tokenS... | 3,839,416 |
// SPDX-License-Identifier: BlueOak-1.0.0
pragma solidity 0.8.9;
import "@openzeppelin/contracts/governance/Governor.sol";
import "@openzeppelin/contracts/governance/extensions/GovernorCountingSimple.sol";
import "@openzeppelin/contracts/governance/extensions/GovernorSettings.sol";
import "@openzeppelin/contracts/gove... | return The percent of the StRSR supply the account has in terms of micro %: 1e5 = 0.1% | function _getVotes(
address account,
uint256 blockNumber,
bytes memory /*params*/
) internal view override(Governor, GovernorVotes) returns (uint256) {
uint256 bal = token.getPastVotes(account, blockNumber);
uint256 totalSupply = token.getPastTotalSupply(blockNumber);
... | 13,033,976 |
./full_match/3/0x05fec37806A042bB7bA0762905fF33D53c1292dd/sources/browser/cadastre.sol | hľadanie správneho miesta v poli pozemkov | function checkEstate(uint id) view internal returns(uint) {
for(uint i = 0; i < estates.length; i++) {
if(estates[i].id == id) {
return i;
}
}
revert('Daný pozemok neexistuje!');
}
| 8,121,591 |
./full_match/1/0x99a9B7c1116f9ceEB1652de04d5969CcE509B069/sources/contracts/GenArt721CoreV3.sol | View function returning Artist's additional payee address for primary sales, for project `_projectId`. _projectId Project ID to be queried. return address Artist's additional payee address for primary sales./ | function projectIdToAdditionalPayeePrimarySales(uint256 _projectId)
external
view
returns (address payable)
{
return projectIdToFinancials[_projectId].additionalPayeePrimarySales;
}
| 17,012,466 |
contract BEXP {
/* This creates an array with all balances */
mapping (address => uint256) public balanceOf;
string public name;
string public symbol;
uint8 public decimals;
event Transfer(address indexed from, address indexed to, uint256 value);
/* Ini... | This creates an array with all balances / Initializes contract with initial supply tokens to the creator of the contract / | function BEXP () public {
}
| 4,814,724 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.3;
// OpenZeppelin
import "./openzeppelin-solidity/contracts/SafeMath.sol";
import "./openzeppelin-solidity/contracts/ReentrancyGuard.sol";
import "./openzeppelin-solidity/contracts/ERC1155/ERC1155.sol";
import "./openzeppelin-solidity/contracts/ERC20/SafeERC20.sol... | Returns the latest timestamp to use when calculating available rewards. _positionID ID of the position NFT. return (uint256) The latest timestamp to use for rewards calculations./ | function lastTimeRewardApplicable(uint256 _positionID) public view override returns (uint256) {
return block.timestamp > positions[_positionID].rewardsEndOn ? positions[_positionID].rewardsEndOn : block.timestamp;
}
| 14,125,422 |
// SPDX-License-Identifier: AGPL-3.0-or-later
// File: interfaces/IOlympusAuthority.sol
pragma solidity =0.7.5;
interface IOlympusAuthority {
/* ========== EVENTS ========== */
event GovernorPushed(address indexed from, address indexed to, bool _effectiveImmediately);
event GuardianPushed(address i... | / if rate should increase if target met if target met | function adjust(uint256 _index) internal {
Adjust memory adjustment = adjustments[_index];
if (adjustment.rate != 0) {
if (adjustment.add) {
if (info[_index].rate >= adjustment.target) {
}
info[_index].rate = 0;
}
... | 221,462 |
./partial_match/1/0x0158346788758DB976E7108BAbdFD23660E14EaA/sources/IAToken.sol | send `_value` token to `_to` from `msg.sender` _to The address of the recipient _value The amount of token to be transferred return Whether the transfer was successful or not | function transfer(address _to, uint256 _value) public returns (bool success) {
require(_to != 0);
require(balanceOf[msg.sender] >= _value);
require(balanceOf[_to] + _value >= balanceOf[_to]);
balanceOf[msg.sender] -= _value;
balanceOf[_to] += _value;
emit Transfer(msg... | 3,956,327 |
// File: contracts/SafeMath.sol
/**
* MIT License
*
* Copyright (c) 2016-2019 zOS Global Limited
*
* 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 witho... | Signals that the indicated tokens have been declared invalid (e.g. by a court ruling in accordance with article 973g of the planned adjustments to the Swiss Code of Obligations) and got detached from the underlying shares. Invalid tokens do not carry any shareholder rights any more./ | function declareInvalid(address holder, uint256 amount, string calldata message) external onlyOwner() {
uint256 holderBalance = balanceOf(holder);
require(amount <= holderBalance, "Cannot invalidate more tokens than held by address");
invalidTokens = invalidTokens.add(amount);
emit T... | 926,102 |
./full_match/1/0x3C6FBc94288f5af5201085948DdB18aDED2E6879/sources/contracts/ApeFiNFT.sol | Get the public mint price./ | function getPublicMintPrice() public view returns (uint256) {
uint256 timeElapsed = getBlockTimestamp() - getPublicMintStartTime();
uint256 price = MINT_START_PRICE -
(timeElapsed / MINT_PRICE_DROP_INTERVAL) *
MINT_PRICE_DROP_DEGREE;
if (price < MIN_MINT_PRICE) {
... | 3,053,459 |
pragma solidity ^0.4.23;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256)... | Source of tokens. Override this method to modify the way in which the crowdsale ultimately gets and sends its tokens. _beneficiary Address performing the token purchase _tokenAmount Number of tokens to be emitted/ | function _deliverTokens(address _beneficiary, uint256 _tokenAmount) internal {
token.transfer(_beneficiary, _tokenAmount);
}
| 170,770 |
./full_match/77/0xbB642E83699392B0DfdfCd5cF5D27fb1EC33A6D1/sources/contracts/Stays.sol | Hook that is called before any token transfer. This includes minting and burning. Calling conditions: - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be transferred to `to`. - When `from` is zero, `tokenId` will be minted for `to`. - When `to` is zero, ``from``'s `tokenId` will be burned. - `from` a... | function _beforeTokenTransfer(address from, address to, uint256 tokenId)
internal
override(ERC721Upgradeable, ERC721EnumerableUpgradeable)
{
super._beforeTokenTransfer(from, to, tokenId);
if (from != address(0) && to != address(0)) {
bytes32 spaceId = _stays[tokenId].spaceId;
uint256 dep... | 5,049,012 |
./full_match/80001/0x93606Db8e1340eBa115633Cc8a031D379D7638C6/sources/contracts/dev/vendor/openzeppelin-solidity/v.4.8.0/contracts/utils/SafeCast.sol | Returns the downcasted int248 from int256, reverting on overflow (when the input is less than smallest int248 or greater than largest int248). Counterpart to Solidity's `int248` operator. Requirements: - input must fit into 248 bits _Available since v4.7._/ | function toInt248(int256 value) internal pure returns (int248 downcasted) {
downcasted = int248(value);
require(downcasted == value, "SafeCast: value doesn't fit in 248 bits");
}
| 5,640,071 |
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not... | Takes actions on state change, un-pause tokens and disable minting on Crowdsale success _state Crowdsale.State | function onStateChange(Crowdsale.State _state) public onlyCrowdsale() {
if (_state == Crowdsale.State.Success) {
token.disableMinting();
}
}
| 5,374,354 |
pragma solidity >=0.4.22 <0.6.0;
import './common/Ownable.sol';
import './libs/SafeMath.sol';
contract DDNSService is Ownable {
/** USINGS */
using SafeMath for uint256;
/** STRUCTS */
struct DomainDetails {
bytes name;
bytes12 topLevel;
address owner;
bytes15 ip;
uint256 expires;
}
... | - Get ip of domain domain topLevel/ calculate the hash of the domain return the ip property of the domain from storage | function getIP(bytes memory domain, bytes12 topLevel)
public
view
returns (bytes15)
{
bytes32 domainHash = getDomainHash(domain, topLevel);
return domainNames[domainHash].ip;
}
| 5,454,046 |
/**
*Submitted for verification at Etherscan.io on 2021-07-28
*/
// File: @openzeppelin/upgrades/contracts/Initializable.sol
pragma solidity 0.5.1;
/**
* @title Initializable
*
* @dev Helper contract to support initializer functions. To use it, replace
* the constructor with a function that has the 'initialize... | Appends an integer to a string s String to be processed x Integer to be appended/ | function concatStringDec(string memory s, uint256 x) private pure returns (string memory) {
return string(abi.encodePacked(s, itod(x)));
}
| 6,494,226 |
//Address: 0x5102791ca02fc3595398400bfe0e33d7b6c82267
//Contract name: LeadcoinSmartToken
//Balance: 0 Ether
//Verification Date: 2/27/2018
//Transacion Count: 18179
// CODE STARTS HERE
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMa... | deletes entries from the grants list. _grantee address The address of the token grantee.delete from the map:delete from the array (keys): | function deleteGrantee(address _grantee) external onlyOwner notBeforeSaleStarts beforeFinzalized {
require(_grantee != address(0));
require(presaleGranteesMap[_grantee] != 0);
delete presaleGranteesMap[_grantee];
uint256 index;
for (uint256 i = 0; i < presaleGranteesMapKeys... | 12,540,433 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.3;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol";
contract StartAppBank is ERC20 {
constructor( ) ERC20("StartAppToken", "SAT") {
}
function getFreeTokens(uint256 value) public ... | Function used internally by the registerFinancier function and also for the initializatation of the marketplace/ | function saveFinancier(address _financierAddres, string memory _name) private {
financiers[_financierAddres].name = _name;
}
| 12,704,629 |
./partial_match/1/0xa5E0163f778B05a522dF8fe374f15D4ffbe54C2a/sources/wstACME.sol | inlines syncRewards with mints when able | function mint(uint256 shares, address receiver) public override returns (uint256 assets) {
return super.mint(shares, receiver);
}
| 16,142,303 |
pragma solidity 0.6.6;
import "./BaseLeague.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
contract WeeklyLeague is BaseLeague {
using SafeMath for uint256;
uint256 public totalWeeks;
uint256 public currentWeek;
constructor(
address _commish,
uint256 _yahooLeagueId,
... | checks we want to leave enough for the last week... effects interacts | function payOutWeek(uint256 _winningTeamId) public onlyCommish {
require(
isValidAddress(teams[_winningTeamId].payoutAddress),
"Not a valid user"
);
uint256 totalWeeksIncludingLastWeek = totalWeeks.add(1);
uint256 weeksLeft = totalWeeksIncludingLastWeek.sub(c... | 13,052,824 |
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint2... | prevent transfers until trading allowed | function transfer(address _to, uint256 _value) isTradeable public returns (bool success) {
return super.transfer(_to, _value);
}
| 224,773 |
/**
*Submitted for verification at Etherscan.io on 2021-09-01
*/
// File: contracts/IERC165.sol
// 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 ... | Allow to mint tokens for giveaways at any time (but limited count) / | function mintGiveaway(uint256 numTokens, address to) public onlyOwner {
require(countMintedGiveawayTokens.add(numTokens) <= MAX_GIVEAWAY_TOKENS, "Only 100 tokens max");
for (uint i = 0; i < numTokens; i++) {
countMintedGiveawayTokens++;
nextTokenId++;
_safeMint(to, nextTokenId);
}
}
| 150,766 |
./full_match/5/0xB71f4764b82A8b98953cf42A8f18946e1aeae688/sources/docs.chain.link/samples/PriceFeeds/PriceConsumerV3.sol | Returns the latest price/ | function getLatestPrice() public view returns (int) {
(
,
,
,
) = priceFeed.latestRoundData();
return price;
| 1,917,731 |
./full_match/42/0x725DDa8A778B507bA02a7F56146a2D5D7f5740CE/sources/home/didi/src/sf/streaming-faucet/contracts/StreamingFaucet.sol | lets the sponsor withdraw remaining tokens. This may trigger a mass liquidation of open streams | function withdrawTokens() external {
require(msg.sender == sponsor, "only the sponsor can withdraw");
token.send(msg.sender, token.balanceOf(address(this)), new bytes(0));
}
| 9,598,163 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/interfaces/IERC2981.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";
import "@openz... | Get items with pagination supported _startIndex Start with index number _endIndex End with index number return uint256 Total of items return bytes32[] Array of item ids/ | function getItems(
uint _startIndex,
uint _endIndex
) public view returns(uint256, bytes32[] memory) {
bytes32[] memory itemData = new bytes32[](_itemIndex.length);
if (_startIndex >= _itemIndex.length) {
_startIndex = 0;
}
if (_endIndex >= _itemIndex.length) {
_endIndex = ... | 7,212,236 |
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/utils/Strings.sol
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint25... | 2% set aside for other parties Remaining amount goes to owner | function withdraw() public payable onlyOwner {
require(ds);
require(os);
}
| 13,990,932 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.