file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
// SPDX-License-Identifier: Apache-2.0
/*
Copyright 2021 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 a... | Approves an ERC1155 order on-chain. After pre-signing the order, the `PRESIGNED` signature type will become valid for that order and signer. order An ERC1155 order. Set `preSigned` to true on the order state variable to indicate that the order has been pre-signed. | function preSignERC1155Order(LibNFTOrder.ERC1155Order memory order)
public
override
{
require(
order.maker == msg.sender,
"ERC1155OrdersFeature::preSignERC1155Order/MAKER_MISMATCH"
);
bytes32 orderHash = getERC1155OrderHash(order);
LibERC1... | 13,001,164 |
./full_match/3/0x48DA764A354C2da32a85D9244E419830236Ba7A5/sources/browser/MiniswapMiner.sol | issue mini to liquilidity && user | function issueMini(uint256 issueAmount,address feeTemp,address originSender) internal {
uint durationDay = (block.number.sub(firstTxHeight)).div(6000);
uint256 issueAmountLimit = MiniswapLibrary.getIssueAmountLimit(durationDay);
if( mineInfo[durationDay].add(issueAmount).add(issueAmount) > i... | 8,284,129 |
// File: @openzeppelin/upgrades/contracts/Initializable.sol
pragma solidity >=0.4.24 <0.7.0;
/**
* @title Initializable
*
* @dev Helper contract to support initializer functions. To use it, replace
* the constructor with a function that has the `initializer` modifier.
* WARNING: Unlike constructors, initializer... | Set the Governance address Only callable by Governance address _governanceAddress - address for new Governance contract/ | function setGovernanceAddress(address _governanceAddress) external {
_requireIsInitialized();
require(msg.sender == governanceAddress, ERROR_ONLY_GOVERNANCE);
_updateGovernanceAddress(_governanceAddress);
governanceAddress = _governanceAddress;
emit GovernanceAddressUpdated... | 1,231,973 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
import "./IERC20.sol";
import "./IERC20Metadata.sol";
import "./SafeMath.sol";
import "./Context.sol";
import "./Ownable.sol";
import "./Address.sol";
import "./IUniswapV2Router02.sol";
import "./IUniswapV2Factory.sol";
import "./IUniswapV2Pair.sol";
contract ... | Get the exchange rate between the no-reward balance and the actual balance | function exRate() private view returns(uint256) {
return _totalReward.div(_totalSupply) + 1;
}
| 13,043,228 |
pragma solidity ^0.5.8;
/// @title ERC20 Token Interface
/// @author Hoard Team
/// @notice See https://github.com/ethereum/EIPs/issues/20
contract ERC20Token {
// PUBLIC INTERFACE
// /// @dev Returns total amount of tokens
// /// @notice params -> (uint256 totalSupply)
// It's implamented as a vari... | inject PUBLIC FUNC TO EXTERNAL | function changeMigrationMaster (address _address) onlyHoard public { migrationMaster = _address; } | 6,447,308 |
pragma solidity ^0.4.23;
// https://www.pennyether.com
/******* USING Registry **************************
Gives the inherting contract access to:
.addressOf(bytes32): returns current address mapped to the name.
[modifier] .fromOwner(): requires the sender is owner.
******************************************... | Allows admin to change minBet, maxBet, and curPayTableId | function changeSettings(uint64 _minBet, uint64 _maxBet, uint8 _payTableId)
public
fromAdmin
{
require(_maxBet <= .375 ether);
require(_payTableId < settings.numPayTables);
settings.minBet = _minBet;
settings.maxBet = _maxBet;
settings.curPayTableId = _payT... | 14,009,314 |
pragma solidity ^0.5.0;
import "./interfaces/ITokensFactory.sol";
import "./interfaces/ITokenStrategy.sol";
import "./interfaces/ITFStorage.sol";
import "./TokensFactoryMetadata.sol";
import "../symbol-registry/interfaces/ISymbolRegistry.sol";
import "../../common/libraries/BytesHelper.sol";
import "../../request-veri... | Returns tokens factory eternal storge instance/ | function TFStorage() internal view returns (ITFStorage) {
return ITFStorage(tfStorage);
}
| 1,764,194 |
// to test issue with nodes breaking with large clients over WS
// fixed in web3 with fragmentationThreshold: 8192
pragma solidity ^0.4.17;
contract BigFreakingContract {
event Transfer(address indexed from, address indexed to, uint value);
event Approval( address indexed owner, address indexed spender, uint valu... | TODO: should increase instead | function approve_10(address spender, uint value) public returns (bool ok) {
_approvals[msg.sender][spender] = value;
emit Approval( msg.sender, spender, value );
return true;
}
| 6,453,723 |
pragma solidity ^0.4.8;
contract MarketBank {
//
// Author : Skryptek
// email : RealmKoin@gmail.com
// Version : 1.0 - initial release
// GitHub : https://github.com/RealmKoin
//
//
// This smart contract requires a fee to use to use but donations to the RK project are always welcome... | -------- Shop functions -------- / | function Place_Listing_Ethereum(string _Item_Name, string _Description, uint _Rate) public echo_post_modifier_doesSenderHaveAMarketAccount() {
_Seller_Address = msg.sender;
_Currency_Used = 'Ethereum';
seller = _Seller_Address;
value = _Rate;
_Id_Number = Data.length;
... | 12,550,397 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.3;
import './lib/Crowdsale.sol';
import './lib/CappedCrowdsale.sol';
import './lib/TimedCrowdsale.sol';
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
/**
* @title Echo Token Crowdsale
* @dev This is the Echo Token crowdsale.
*/
contract EchoCrowdsale... | low level token purchase DO NOT OVERRIDE This function has a non-reentrancy guard, so it shouldn't be called by another `nonReentrant` function. beneficiary Recipient of the token purchase/ calculate token amount to be created update state Send ETH directly to issuer after token purchase | function buyTokens(address beneficiary) public nonReentrant payable {
uint256 weiAmount = msg.value;
_preValidatePurchase(beneficiary, weiAmount);
uint256 tokens = _getTokenAmount(weiAmount);
_weiRaised = _weiRaised.add(weiAmount);
_processPurchase(beneficiary, tokens);
... | 11,798,979 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeabl... | Initializes simpleBTCB+./ | function initialize() public initializer {
SinglePlus.initialize(BTCB, "Simple BTCB Plus", "simpleBTCB+");
}
| 12,686,056 |
pragma solidity 0.6.6;
import "../../node_modules/@openzeppelin/contracts/math/SafeMath.sol";
import "../interfaces/IConstraintModule.sol";
import "../interfaces/ISecurityToken.sol";
/**
* @author Simon Dosch
* @title SpendingLimitsConstraintModule
* @dev ConstraintModule
* Set spending limits like:
* Not more... | Returns module name return bytes32 name of the constraint module/ | function getModuleName() public override view returns (bytes32) {
return _module_name;
}
| 2,475,394 |
./partial_match/1/0x7B63C1b7AAF2aF34e148f4c7371CF03fAC2d6f61/sources/CFTToken.sol | Public variables of the token / | function CFTToken(uint256 _initialAmount, string _tokenName, uint8 _decimalUnits, string _tokenSymbol) {
}
| 2,894,092 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IAccessControl.sol";
import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.sol";
/**
* @dev Contract module that allows children to implement role-based access
* control mechanisms. This is a lightweight... | If Gold token is required If Basic token is required | function mintWithTokens(uint256 _numGoldTokens, uint256 _basicGoldTokens) public payable whenNotPaused nonReentrant {
require(mintWindows[currentMintWindow].tokenRequirement != TokenRequirementType.NONE, "Mint tokens are required to mint.");
uint256 _tokens;
if(mintWindows[currentMintWindow].tokenRequir... | 1,455,773 |
contract CAVAsset {
function __transferWithReference(address _to, uint _value, string _reference, address _sender) returns(bool);
function __transferFromWithReference(address _from, address _to, uint _value, string _reference, address _sender) returns(bool);
function __approve(address _spender, uint _value,... | Performs allowance setting call on the platform by the name of specified sender. Can only be called by asset implementation contract assigned to sender. _spender holder address to set allowance to. _value amount to allow. _sender initial caller. return success./ | function __approve(address _spender, uint _value, address _sender) onlyAccess(_sender) returns(bool) {
return platform.proxyApprove(_spender, _value, smbl, _sender) == OK;
}
| 1,488,229 |
pragma solidity ^0.4.21;
import './fund/ICrowdsaleFund.sol';
import './math/SafeMath.sol';
import './ownership/MultiOwnable.sol';
import './token/ManagedToken.sol';
import './ISimpleCrowdsale.sol';
contract Fund is ICrowdsaleFund, SafeMath, MultiOwnable {
enum FundState {
Crowdsale,
CrowdsaleRefu... | Function is called by contributor to refund Buy user tokens for refundTokenPrice and destroy them/ | function refundTokenHolder() public {
require(state == FundState.Refund);
uint256 tokenBalance = token.balanceOf(msg.sender);
require(tokenBalance > 0);
uint256 refundAmount = safeDiv(safeMul(tokenBalance, address(this).balance), token.totalSupply());
require(refundAmount > ... | 12,569,173 |
pragma solidity ^0.4.19;
/**
* @title ERC20
* @dev ERC20 interface
*/
contract ERC20 {
function balanceOf(address who) public constant returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
function allowance(address owner, address spender) public constant returns (uint25... | send ether to the fund collection wallet override to create custom fund forwarding mechanisms | function forwardFunds(uint256 weiAmount) internal {
multisigwallet.transfer(weiAmount);
}
| 1,347,168 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.5;
contract RequestForQuotations {
/* ------------- RFQ Model ------------- */
enum RFQStatus {Received, Declined, QuoteProvided}
struct RequestForQuotation {
bytes16 id; // Useful for presence verification
uint issuedAt;
stri... | Make sure the RFQ exists Make sure the quote is submitted only once Create the quote and store it Update the corresponding RFQ | function submitQuote(bytes16 id, bytes16 rfqId, uint issuedAt, string memory ubl) public returns (bool) {
require(rfqs[rfqId].id == rfqId);
require(quotes[id].id == 0x0);
address supplier = msg.sender;
quotes[id] = Quote(id, issuedAt, ubl, QuoteStatus.Offer, rfqId, supplier);
... | 6,357,121 |
./partial_match/3/0x4737790434817A0108a844aFd71d17737A0319A2/sources/XYZSwapPair.sol | this low-level function should be called from a contract which performs important safety checks user must transfer LP token to this contract before call burn | function burn(address to)
external
override
nonReentrant
returns (uint256 amount0, uint256 amount1)
{
uint256 balance0 = _token0.balanceOf(address(this));
uint256 balance1 = _token1.balanceOf(address(this));
uint256 liquidity = balanceOf(address(this));
... | 5,194,093 |
pragma solidity 0.5.17;
pragma experimental ABIEncoderV2;
// Libraries
import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol";
// Interfaces
import "../../interfaces/loans/ILoanData.sol";
import "../../interfaces/SettingsInterface.sol";
import "../../interfaces/escrow/IEscrow.sol";
import "../.... | Returns the minimum collateral value threshold, in the lending token, needed to take out the loan or for it be liquidated. If the loan status is TermsSet, then the value is whats needed to take out the loan. If the loan status is Active, then the value is the threshold at which the loan can be liquidated at. loanID ... | function getCollateralNeededInTokens(uint256 loanID)
public
view
returns (int256 neededInLendingTokens, uint256 escrowLoanValue)
{
if (
!isActiveOrSet(loanID) ||
loans[loanID].loanTerms.collateralRatio == 0
) {
return (0, 0);
}
... | 12,676,673 |
./full_match/1/0x2fC246149B4B8d7bcEF6188A10AF1791380227f1/sources/src/StarterPack/StarterPackV1.sol | Enable / disable ETH payment for StarterPacks enabled Whether to enable or disable | function setETHEnabled(bool enabled) external {
require(msg.sender == _admin, "NOT_AUTHORIZED");
_etherEnabled = enabled;
}
| 8,434,651 |
// SPDX-License-Identifier: BlueOak-1.0.0
pragma solidity 0.8.9;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
struct GnosisAuctionData {
IERC20 auctioningToken;
IERC20 biddingToken;
uint256 orderCancellationEndDate;
uint256 auctionEndDate;
bytes32 initialAuctionOrder;
uint256 minim... | The relevant portion of the interface of the live Gnosis EasyAuction contract https://github.com/gnosis/ido-contracts/blob/main/contracts/EasyAuction.sol | interface IGnosis {
function initiateAuction(
IERC20 auctioningToken,
IERC20 biddingToken,
uint256 orderCancellationEndDate,
uint256 auctionEndDate,
uint96 auctionedSellAmount,
uint96 minBuyAmount,
uint256 minimumBiddingAmountPerOrder,
uint256 minFundi... | 12,682,443 |
pragma solidity 0.5.6;
// * xether.io - is a gambling ecosystem, which makes a difference by caring about its users.
// Itβs our passion for perfection, as well as finding and creating neat solutions,
// that keeps us driven towards our goals.
//
// * Uses hybrid commit-reveal + block hash random number generati... | We guarantee that dividends will be minimum 0.5% Total percentages not greater then 3% | function setNewPercents(
uint8 newHouseEdgePercent,
uint8 newDividendsPercent,
uint8 newAdvertPercent
) external onlyOwner {
require(newDividendsPercent >= 5);
require(newHouseEdgePercent + newDividendsPercent + newAdvertPercent <= 30);
HOUSE_EDGE_PERCENT = newHouseEdg... | 14,096,197 |
./partial_match/4/0x42A91727E808DBCD74eAC68C22aaA2aE004C70d9/sources/Depot.sol | Allows a user to withdraw all of their previously deposited synths from this contract if needed. Developer note: We could keep an index of address to deposits to make this operation more efficient but then all the other operations on the queue become less efficient. It's expected that this funct... | function withdrawMyDepositedSynths() external {
uint256 synthsToSend = 0;
for (uint256 i = depositStartIndex; i < depositEndIndex; i++) {
SynthDepositEntry memory deposit = deposits[i];
if (deposit.user == msg.sender) {
synthsToSend = synthsToSend.add(deposi... | 8,641,103 |
./partial_match/1/0x305c6a08d0662efC3721C076651B5Be773b5355F/sources/PepeFanClub.sol | remove limits after token is stable | function liftLimits() external onlyOwner returns (bool){
limitsInEffect = false;
transferDelayEnabled = false;
return true;
}
| 2,891,419 |
./full_match/40/0x4b7CfCB288D811cF68d32d1abcE3c621ed69Dce0/sources/src/Libraries/LibAsset.sol | Check that msg value greater than sending amount + fixed native fees + extra fees sending to bridge getERC20proxy().transferFrom( assetId, msg.sender, address(this), amount ); | function _depositAndAccrueTokenFee(
address assetId,
uint256 amount,
uint256 accruedFixedNativeFee,
uint256 extraNativeAmount,
address integrator
) private returns (uint256 amountWithoutFees) {
if (isNativeAsset(assetId)) {
if (msg.value < amount + acc... | 9,541,961 |
pragma solidity ^0.4.10;
contract tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData); }
/// @title ICONOMI Daa token
contract DaaToken {
//
// events
//
// ERC20 events
event Transfer(address indexed _from, address indexed _to, uint256 _value... | Replace current owner with new one | function replaceOwner(address _newOwner)
public
onlyOwner
returns (bool success)
{
owner = _newOwner;
NewOwner(_newOwner);
return true;
}
| 12,703,437 |
pragma solidity 0.8.7;
// SPDX-License-Identifier: MIT
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an
* external initializer fu... | Resets pausable state/ | function unpause() public onlyOwner {
_unpause();
}
uint256[50] private ______gap;
| 6,918,418 |
// SPDX-License-Identifier: AGPL-3.0
pragma solidity ^0.8.11;
import "./ERC1155.sol";
import "./MerkleProof.sol";
/// @notice Struct containing infos about airdrop
/// @param root Root hash of the merkle tree
/// @param expiry Max date to claim the airdrop
/// @param price Price in wei to pay per token
struct DropDa... | View function to get token dropData id Id of the token/airdrop return data Returns the DropData struct | function dropData(uint id) external view returns (DropData memory data) {
return drop[id];
}
| 15,875,373 |
./full_match/3/0x34D2bE96659A83935489a7c2d883bEaba21dFC4f/sources/browser/contracts/DickSize.sol | Size without decimals | function mySizeInInch() public view virtual returns (uint256) {
return balanceOf(_msgSender()).div(10**_decimals);
}
| 8,166,044 |
// SPDX-License-Identifier: MIT
/* Defiat 2021
*
* This is the contract locking the UNISWAP liquidity.
* Notes 24th Feb 2021: This contract adds a functionality to prolong the lock period if required.
* This will avoid having to wait for the maturity to reach to reload the UNIv2 tokens into a new lock-contract.
*
* ... | Interface of the ERC20 standard as defined in the EIP. Does not include the optional functions; to access them see {ERC20Detailed}./ | 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 (uint256)... | 12,788,945 |
./full_match/25/0x1bC2AD563De122ef9a4aae43f665c42E287D267e/sources/contracts/staking/FlexibleStaking/FlexibleStaking.sol | Used to get the summary of data in the contract return token rewards per block return amount of tokens staked return accumulated reward per share return last reward block return start timestamp return end timestamp/ | function getSummary()
external
view
returns (uint256, uint256, uint256, uint256, uint256, uint256, address)
{
return (
rewardTokensPerSecond,
amountOfTokensStaked,
accRewardPerShare,
lastAccRewardPerShareTimestamp,
start... | 16,382,559 |
./full_match/11155111/0x780528f04cb5749E9428CAe02ae47E991a81f147/sources/project_/contracts/FundMe.sol | require(PriceConverter.getConversionRate(msg.value) >= MINIMUM_USD, "You need to spend more ETH!"); | function fund() public payable {
require(msg.value.getConversionRate(s_priceFeed) >= MINIMUM_USD, "You need to spend more ETH!");
s_addressToAmountFunded[msg.sender] += msg.value;
s_funders.push(msg.sender);
}
| 3,830,783 |
./partial_match/1/0xf5A8365F82419A36E313b3368559a07Ee5CdB847/sources/TOSHI.sol | Atomically decreases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {ERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. - `spender` must have a... | function decreaseAllowance(address spender, uint256 subtractedValue) external returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
| 2,766,591 |
// SPDX-License-Identifier: Apache-2.0-with-puul-exception
pragma solidity >=0.6.12;
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
contract PuulAccessControl is AccessControl {
using Safe... | Console.log('pricePerShare < min', pricePerShare); Console.log('rounded', tokenSupply - rounded); | function _updateRewardSharePrice(IERC20 token, uint256 tokenSupply) internal {
uint256 supply = totalSupply();
uint256 extra = _rewardExtra[token];
if (extra > 0) {
tokenSupply = tokenSupply.add(extra);
_rewardExtra[token] = 0;
}
uint256 pricePerShare = supply > 0 ? (tokenSupply * prec... | 13,474,952 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
imp... | Additional check for deflationary tokens deposit to the convex booster | function deposit(uint256 _amount) external nonReentrant {
require(_amount != 0, Errors.ZERO_AMOUNT);
_updateAccPerShare();
uint256 _before = IERC20(lpToken).balanceOf(address(this));
IERC20Upgradeable(lpToken).safeTransferFrom(
msg.sender,
address(this),
... | 13,985,677 |
/*
* Origin Protocol
* https://originprotocol.com
*
* Released under the MIT license
* https://github.com/OriginProtocol/origin-dollar
*
* Copyright 2020 Origin Protocol, Inc
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files ... | Approve the spending of all assets by their corresponding pool tokens, if for some reason is it necessary./ This strategy is a special case since it only supports one asset | function safeApproveAllTokens() external {
address assetAddress = assetsMapped[0];
_abstractSetPToken(assetAddress, assetToPToken[assetAddress]);
}
| 2,280,379 |
./partial_match/1/0xd8Fd6Bd5D24dbeFfC5DB80c2488b52d8b34CbAbe/sources/Fltc.sol | uint256 d = sub(c,1); | function ceil(uint256 a) internal pure returns (uint256) {
uint256 c = div(a,100);
return c;
}
| 4,095,784 |
./full_match/1/0x960093a8cc1bbeE3767C1d4A0345e18fa510606c/sources/browser/AssGuarD.sol | 10% compensation fee since dev doesn't hold any initial supply If eth amount = 0 then set initial price to 1 ETH = 2 ASS Mint borrowed ASS Add liquidity in uniswap Add LP token to total supply Add to balance Set peak balance Set stake timestamp as withdraw timestamp to prevent withdraw immediately after first staking | function stake() external payable nonReentrant {
_checkFarming();
_updateReward(msg.sender);
_flooding();
require(farmingStartTimestamp + 15 days >= block.timestamp, 'Farming has ended');
require(msg.value > 0, 'Cannot stake 0');
require(!address(msg.sender).isContra... | 3,098,494 |
pragma solidity ^0.4.11;
contract ERC20Interface {
function totalSupply() constant returns (uint256 total); // Get the total token supply
function balanceOf(address _owner) constant returns (uint256 balance); // Get the account balance of another account with address _owner
function transfer(address _to, uint2... | Send _value amount of tokens from address _from to address _to | function transferFrom(address _from, address _to, uint256 _value) returns (bool success); | 946,751 |
// SPDX-License-Identifier: CC-BY-4.0
pragma solidity ^0.5.11;
/**
* Rule 506(b)
* -----------
* https://www.sec.gov/smallbusiness/exemptofferings/
*
* Rule 506(b) of Regulation D is considered a βsafe harborβ under Section 4(a)(2). It provides objective standards that a company can rely on to meet the requiremen... | The `transferFrom` function MUST NOT allow transfers to addresses that have not been verified and added to the contract. If the `to` address is not currently a shareholder then it MUST become one. If the transfer will reduce `from`'s balance to 0 then that address MUST be removed from the list of shareholders./ | function transferFrom(address from, address to, uint256 value)
public
isActive
isVerifiedAddress(to)
isPriceBelowParValue(value)
returns (bool)
{
pruneShareholders(from, value);
Transaction memory trans = Transaction(to, value, now);
transactions[t... | 13,060,173 |
pragma solidity ^0.4.24;
import "./Owned.sol";
import "./Stash.sol";
import "./StashFactory.sol";
import "./RedeemAgent.sol";
import "./PledgeAgent.sol";
contract Bank is Owned {// Regulator node (MAS) should be the owner
function Bank() {
owner = msg.sender;
}
StashFactory public sf;
Redeem... | / non-owner will not update salt unless it invoked by MAS-regulator when cb are setting salt, banks should not update its salt | function setCurrentSalt(bytes16 _salt) {
bytes32 _stashName = acc2stash[msg.sender];
require(checkOwnedStash(_stashName), "not owned stash");
require(msg.sender == owner || !isCentralBankNode());
require(isCentralBankNode());
during LSM / confirming pmt: banks and cb... | 13,102,799 |
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
import "./zksync/ReentrancyGuard.sol";
import "./Storage.sol";
import "./zksync/Events.sol";
import "./zksync/UpgradeableMaster.sol";
import "./zksync/SafeMath.sol";
import "./zksync/SafeMathUInt128.sol";
import "... | Execute withdraw operation nonce > 0 means fast withdraw receiver act as a accepter just increase the pending balance of accepter | function executeWithdraw(Operations.Withdraw memory op) internal {
if (op.nonce > 0) {
bytes32 fwHash = keccak256(abi.encodePacked(op.owner, op.tokenId, op.amount, op.fastWithdrawFeeRate, op.nonce));
address accepter = accepts[op.accountId][fwHash];
if (accepter == addres... | 1,809,171 |
./partial_match/4/0x49A618CD8170a7bEDbe70584212E29910289F3BE/sources/DiscoverSpaceX.sol | Deposit LP tokens to MasterChef for FBT allocation. uint256 pending = user.amount.mul(pool.accFbtPerShare).div(1e12).sub(user.rewardDebt); safeFbtTransfer(msg.sender, pending); | function deposit(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
updatePool(_pid);
if (user.amount > 0) {
pool.lpToken.safeTransferFrom(address(msg.sender), address(this), _amount);
... | 8,754,865 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.12;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
/// @title Spread Dapp, Edition Ethereum.
/// @author @dadogg80, Viken Blockchain Solutions.
/// @notice Transfer your cryptocurrency to multiple acco... | This will allow you to batch transfers of an mainnet asset like Ethereum, Matic, etc, to multiple accounts. recipients List with the recipient accounts. values List with the values to transfer to the corresponding recipient. Address example: ["address","address","address"]. Value example: ["value","value","value"]. | function spreadAsset(address[] calldata recipients, uint256[] calldata values) external payable noZeroValues(recipients, values) {
for (uint256 i = 0; i < recipients.length; i++)
payable(recipients[i]).transfer(values[i]);
}
| 12,965,523 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.6.12 <0.7.0;
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an
* externa... | Get the next epoch start | function getNextEpochStart() public view returns (uint256) {
uint256 epoch = getCurrentEpoch();
if (epoch == 0) {
return getGracePeriodEnd();
return getGracePeriodEnd().add(epochDuration.mul(epoch));
}
}
| 495,860 |
./partial_match/42/0x8E845b08319e3203701bCBC1e457F5377403b765/sources/MigratedReserve.sol | balance handles currency requests from the borrower side currency is moved between shelf and reserve if needed | function balance() public {
(bool requestWant, uint256 currencyAmount) = shelf.balanceRequest();
if (requestWant) {
require(
currencyAvailable >= currencyAmount,
"not-enough-currency-reserve"
);
currencyAvailable = safeSub(currenc... | 8,840,393 |
./full_match/5/0xee220256216E4A40BaAE2bBe1cF069aB71E87A50/sources/contracts/CrowdFunding.sol | check if everything is okay if condtion is meant then.. | function createCampaign(address _owner, string memory _title,
string memory _description, uint256 _target, uint256 _deadline, string memory _image ) public returns (uint256){
Campaign storage campaign = campaigns[numberOfCampaigns];
require(campaign.deadline < block.timestamp, "The deadline sh... | 7,075,676 |
./full_match/43114/0xD5d0f5d872ed4eB74AA3E8fa6D833d6f7603D2EC/sources/contracts/oracles/LPChainlinkOracle.sol | Calculates the lastest exchange rate | function latestAnswer() external view override returns (int256) {
(uint256 reserve0, uint256 reserve1, ) = IUniswapV2Pair(pair).getReserves();
uint256 totalSupply = pair.totalSupply();
uint256 normalizedReserve0 = reserve0 * (10**(WAD - token0Decimals));
uint256 normalizedReserve1 =... | 4,524,270 |
//Address: 0x6b31a898F7E711b323A6212EaC4AE250E0D6624F
//Contract name: EthLendToken
//Balance: 0 Ether
//Verification Date: 12/25/2017
//Transacion Count: 14
// CODE STARTS HERE
pragma solidity ^0.4.19;
/// @title EthLend Token internal presale - https://ethlend.io (LEND) - crowdfunding code
/// Whitepaper:
/// ... | Transfer `_value` tokens from sender's account `msg.sender` to provided account address `_to`. This function is disabled during the funding. Required state: Operational _to The address of the tokens recipient _value The amount of token to be transferred return Whether the transfer was successful or not Abort if not... | function transfer(address _to, uint256 _value) public returns (bool) {
var senderBalance = balances[msg.sender];
if (senderBalance >= _value && _value > 0) {
senderBalance -= _value;
balances[msg.sender] = senderBalance;
balances[_to] += _value;
... | 5,355,096 |
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... | Change founder address./ | function changeFounder(address newFounder) public onlyAdmin {
founder = newFounder;
}
| 1,132,030 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.4;
library Bitmaps {
struct Bitmap {
// This variable should never be directly accessed by users of the library: interactions must be restricted to
// the library's function.
// bitmaps length should be maxSupply / 256.
uint25... | Computes the bitwise AND of the bit at the given 'index' in 'self', and the corresponding bit in 'other', and returns the value. | function bitAnd(
uint256 self,
uint256 other,
uint256 index
) internal pure returns (uint256) {
return uint256(((self & other) >> index) & 1);
}
| 12,697,752 |
pragma solidity 0.4.26;
// import "./OraclizeAPI.sol"; // MAINNET
import "../test/OraclizeAPITesting.sol"; // TESTING
import "../Oracle.sol";
import "../WETH.sol";
/**
* @title Atomic Loans Oraclize Contract
* @author Atomic Loans
*/
contract Oraclize is usingOraclize, Oracle {
WETH weth;
MedianizerInterfa... | Sets Max Reward for Chainlink Contracts/ | function setMaxReward(uint256) public {
require(msg.sender == address(med), "Oraclize.setMaxReward: msg.sender isn't medianizer address");
}
| 14,079,874 |
// File: @openzeppelin/upgrades/contracts/Initializable.sol
pragma solidity >=0.4.24 <0.6.0;
/**
* @title Initializable
*
* @dev Helper contract to support initializer functions. To use it, replace
* the constructor with a function that has the `initializer` modifier.
* WARNING: Unlike constructors, initializer... | internal method for registering an interface/ | function _registerInterface(bytes4 interfaceId) internal {
require(interfaceId != 0xffffffff);
_supportedInterfaces[interfaceId] = true;
}
uint256[50] private ______gap;
| 12,899,330 |
pragma solidity ^0.5.16;
import "./KToken.sol";
import "./KMCD.sol";
import "./ErrorReporter.sol";
import "./Exponential.sol";
import "./KineControllerInterface.sol";
import "./ControllerStorage.sol";
import "./Unitroller.sol";
import "./KineOracleInterface.sol";
import "./KineSafeMath.sol";
import "./Math.sol";
/**
... | Admin function to change the Pause Guardian newPauseGuardian The address of the new Pause Guardian/ | function _setPauseGuardian(address newPauseGuardian) external onlyAdmin() {
address oldPauseGuardian = pauseGuardian;
pauseGuardian = newPauseGuardian;
emit NewPauseGuardian(oldPauseGuardian, pauseGuardian);
}
| 6,376,644 |
./partial_match/1/0x031AA05Da8bf778dFC36D8D25cA68CBB2fC447c6/sources/contracts/BlurExchange.sol | Verify the validity of oracle signature orderHash hash of the order signatureVersion signature version extraSignature packed oracle signature blockNumber block number used in oracle signature/ | function _validateOracleAuthorization(
bytes32 orderHash,
SignatureVersion signatureVersion,
bytes calldata extraSignature,
uint256 blockNumber
) internal view returns (bool) {
bytes32 oracleHash = _hashToSignOracle(orderHash, blockNumber);
uint8 v; bytes32 r; by... | 4,340,336 |
// Sources flattened with buidler v1.4.3 https://buidler.dev
// File @openzeppelin/contracts/utils/SafeCast.sol@v3.1.0
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow
* checks.
*
* Downcasting from uint256/int256 in ... | there is an existing snapshot update the snapshot if it starts on the current cycle | function _updateHistories(
address staker,
int128 stakeDelta,
uint16 currentCycle
}
function _updateHistory(
Snapshot[] storage history,
int128 stakeDelta,
uint16 currentCycle
if (historyLength != 0) {
snapshotIndex = historyLength - 1;
... | 1,557,112 |
./partial_match/1/0x8AFcf740d3aD36A597BCF0b00aABc045A8Ef2033/sources/BetrockStake.sol | Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but with `errorMessage` as a fallback revert reason when `target` reverts. _Available since v3.1._/ | function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns(bytes memory) {
require(address(this).balance >= value, 'Address: insufficient balance for call');
return _functionCallWithValue(target,... | 2,599,746 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import '@openzeppelin/contracts/utils/Strings.sol';
import './CAIC.sol';
import './Randomize.sol';
import "./IBMP.sol";
/// @title Grids
/// @author tfs128 (@trickerfs128)
contract Grids is CAIC {
using Strings for uint256;
using Strings for uint32;
u... | this function returns the seed associated to a tokenId tokenId to get the seed of | function getTokenSeed(uint256 tokenId) external view returns (bytes32) {
require(_exists(tokenId), 'TokenSeed query for nonexistent token');
return _tokenSeed[tokenId];
}
| 534,070 |
./partial_match/3/0xd3aAcdb826aB31fe96Fb9033654c001D4c22E4df/sources/NEONVault.sol | API to get the epoch rewards/ | function getEpochRewards(uint256 epoch) external view returns (uint256) {
return _epochRewards[epoch];
}
| 5,174,082 |
pragma solidity >=0.4.25 <0.7.0;
contract pnlp {
struct Publication {
string ipnsHash;
address publisher;
uint256 timestamp;
}
struct Article {
address publisher;
uint256 timestamp;
}
mapping (string => Publication) public publications;
mapping (string ... | Unsure about this following line. If we add it in, we need to make sure that we support it. We may want to require that the hash and the publication not be reused? Need to talk to team to figure out what we want to do... require(articles[ipfsHash].publisher == address(0), "ipfsHash is already in use"); | function publishArticle(string memory publicationName, string memory ipfsHash) public {
require(publications[publicationName].publisher == msg.sender, "articles can only be added to a publication by the publication creator");
emit PublishedArticle(publicationName, msg.sender, block.timestamp);
... | 12,551,085 |
pragma solidity ^0.4.25;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/********************************************************************************************/
/* DATA VARIABL... | / UTILITY FUNCTIONS // Get operating status of contract return A bool that is the current operating status/ | require(!isDuplicate, "Caller has already called this function.");
_;
}
function isOperational() public view returns (bool) {
return operational;
}
| 12,661,624 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.8;
import "./PodOption.sol";
import "./interfaces/IUniswapV1.sol";
/**
* Represents a tokenized american put option series for some
* long/short token pair.
*
* It is fungible and it is meant to be freely tradable until its
* expiration time, when its transfer... | Gets the amount of strikeAsset necessary to mint a given amount of options`. amount of options that protect 1:1 underlying asset. return strikeAmount amount of strike asset./ | function strikeToTransfer(uint256 amount) external view returns (uint256) {
return _strikeToTransfer(amount);
}
| 5,540,671 |
pragma solidity 0.5.16;
/// @title Opium.Helpers.HasCommission contract helps to syntheticId development and responsible for commission and author address
contract HasCommission {
// Address of syntheticId author
address internal author;
// Commission is in Opium.Lib.LibCommission.COMMISSION_BASE base
... | Getter for syntheticId author commission return uint26 syntheticId author commission | function getAuthorCommission() public view returns (uint256) {
return AUTHOR_COMMISSION;
}
| 5,429,636 |
pragma solidity ^0.5.16;
interface IERC20 {
function TOTALSUPPLY53() external view returns (uint256); //inject NONSTANDARD NAMING
function BALANCEOF768(address account) external view returns (uint256); //inject NONSTANDARD NAMING
function T... | inject NONSTANDARD NAMING | function MOD580(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { | 1,054,364 |
// SPDX-License-Identifier: GPL-3.0-or-later
// Copyright (C) 2015, 2016, 2017 Dapphub
// Adapted by Ethereum Community 2020
pragma solidity 0.7.6;
import './openzeppelin/IERC20.sol';
interface IERC2612 {
/**
* @dev Sets `amount` as the allowance of `spender` over `owner`'s tokens,
* given `owner`'s sign... | Records amount of WETH10 token owned by account. Records current ERC2612 nonce for account. This value must be included whenever signature is generated for {permit}. Every successful call to {permit} increases account's nonce by one. This prevents signature from being used multiple times. Records number of WETH10 tok... | function totalSupply() external view override returns(uint256) {
return address(this).balance + flashMinted;
}
| 6,435,128 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be... | Updates the upkeep minimum interval blocks _upkeepMinimumBlockInterval New upkeepMinimumBlockInterval | function updateUpkeepMinimumBlockInterval(uint256 _upkeepMinimumBlockInterval) external onlyOwner {
upkeepMinimumBlockInterval = _upkeepMinimumBlockInterval;
emit UpkeepMinimumBlockIntervalUpdated(_upkeepMinimumBlockInterval);
}
| 630,942 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
pragma experimental ABIEncoderV2;
library Merkle_Library_ICBS {
// Hashes a and b in the order they are passed
function hash_node(bytes32 a, bytes32 b) internal pure returns (bytes32 hash) {
assembly {
mstore(0x00, a)
mstore(0x20, b)
... | Try to update one element at an index, given a Single Proof and an element to update | function try_update_one(
bytes32 root,
uint256 index,
bytes calldata element,
bytes calldata update_element,
bytes32[] calldata proof
) internal pure returns (bytes32 new_element_root) {
bytes32 total_element_count = proof[0];
require(root != bytes32(0) || total_element_count == bytes32... | 15,873,605 |
pragma solidity ^0.4.21;
/// @title Endorsements
/// @author AlmavivA S.p.A. (Enrica D'Agostini, Giuseppe Bertone, et al.)
/// @notice This contract add external/internal endorsement to supply chain actors and operations
/// @dev This contract is part of the WineSupplyChain contract, and it is not meant to be used... | Add new endorsement to an actor user Actor&39;s on-chain identity positive True if it is a `positive` endorsement title Endorsment&39;s short description description Endorsement&39;s full description | function addUserEndorsement(
address user,
bool positive,
string title,
string description
)
external
returns (bool success)
{
userEndorsements[user].push(Endorsement(positive, title, description, msg.sender));
return true;
}
| 2,414,134 |
./full_match/1/0x22AeBd24D0A9F74A84422ee6904E146d61dC3b70/sources/Users/kroll/Dev/StakingDeployment3/contracts/StakingRewardsFactory.sol | deploy a staking reward contract for the staking token, and store the reward amount the reward will be distributed to the staking reward contract no sooner than the genesis | function deploy(
address _stakingToken,
uint256 _yflRewardAmount,
uint256 _extraRewardTokenAmount,
uint256 _rewardsDuration
) external onlyOwner {
require(_stakingToken != address(0), "stakingToken=0x0");
require(_stakingToken != yflToken, "stakingToken=yflToken")... | 4,977,838 |
pragma solidity ^0.5.17;
interface IERC20 {
function totalSupply() external view returns (uint);
function balanceOf(address account) external view returns (uint);
function transfer(address recipient, uint amount) external returns (bool);
function allowance(address owner, address spender) external view ... | UNSAFE: No slippage protection, should not be called directly | function _withdraw(address token, uint amount) internal {
uint _credit = credit[msg.sender][token];
uint _uni = balances[msg.sender][token];
if (_credit < amount) {
amount = _credit;
}
_burn(msg.sender, amount);
credit[msg.sender... | 1,738,328 |
pragma ton-solidity >= 0.47.0;
import './interfaces/IModule.sol';
contract BorrowModule is ACModule, IBorrowModule, IUpgradableContract {
using FPO for fraction;
using UFO for uint256;
event TokenBorrow(uint32 marketId, MarketDelta marketDelta, address tonWallet, uint256 tokensBorrowed);
constructor... | Borrow: 1. Check that market has enough tokens for lending 2. Calculate user account health 3. Calculate USD value of tokens to borrow 4. Check if there is enough (collateral - borrowed) for new token borrow 5. Increase user's borrowed amount | function borrowTokensFromMarket(
address tonWallet,
address userTip3Wallet,
uint256 tokensToBorrow,
uint32 marketId,
mapping (uint32 => uint256) supplyInfo,
mapping (uint32 => BorrowInfo) borrowInfo
) external override onlyUserAccountManager {
tvm.rawReser... | 908,654 |
pragma solidity ^0.7.0;
//SPDX-License-Identifier: UNLICENSED
// access to brad@icon.gold PW Whistler69.
// web site is www.icon.gold
// outside contact address is reservations@icon.gold
interface IERC223Recipient {
function tokenFallback(address _from, uint _value, bytes memory _data) external;
}
contract To... | See {ERC20-_mint}. Requirements: - the caller must have the {MinterRole}./ | function mint( uint256 amount) view public onlyMinter returns (bool) {
_totalSupply.add(amount);
balances[msg.sender].add(amount);
return true;
}
| 6,746,041 |
pragma solidity ^0.4.17;
import "../../contracts/test/EarningsPoolFixture.sol";
import "truffle/Assert.sol";
contract TestEarningsPool {
EarningsPoolFixture fixture;
function beforeEach() public {
fixture = new EarningsPoolFixture();
fixture.init(1000, 500000, 500000);
}
function te... | feeShare = 0% - no delegator fees | function test_addToFeePool_noDelegatorFees() public {
fixture.init(1000, 500000, 0);
fixture.addToFeePool(1000);
Assert.equal(fixture.getFeePool(), 0, "should put 0 fees in delegator fee pool");
Assert.equal(fixture.getTranscoderFeePool(), 1000, "should put all fees in transcoder fee... | 13,043,991 |
pragma solidity 0.4.18;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint25... | event for token purchase logging purchaser who paid for the tokens beneficiary who got the tokens value weis paid for purchase amount amount of tokens purchased/ | function Crowdsale(uint256 _startTime, uint256 _endTime, uint256 _rate, address _wallet, address _token) public {
require(_startTime >= now);
require(_endTime >= _startTime);
require(_rate > 0);
require(_wallet != address(0));
token = ERC20(_token);
startTime = _startTime;
endTime = _endT... | 926,347 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.5 <0.9.0;
contract Hacker {
address public hacker;
modifier onlyHacker {
require(msg.sender == hacker, "caller is not the hacker");
_;
}
constructor() {
hacker = payable(msg.sender);
}
function attack(address _target) public onlyHacker {
... | (bool result, ) = address(_target).call{gas: 1000000}(sig); if (result) { this; } Assembly version Load the length (first 32 bytes) Skip over the length field. discard result | function attack(address _target) public onlyHacker {
bytes memory sig = abi.encodeWithSignature("pwn()");
assembly {
let len := mload(sig)
let data := add(sig, 0x20)
pop(
call(
)
)
}
}
| 15,797,656 |
// CryptoRabbit Source code
pragma solidity ^0.4.18;
/// @title A base contract to control ownership
/// @author cuilichen
contract OwnerBase {
// The addresses of the accounts that can execute actions within each roles.
address public ceoAddress;
address public cfoAddress;
address public cooAddr... | Used to mark the smart contract as upgraded. _v2Address new address | function upgradeContract(address _v2Address) external onlyCOO whenPaused {
newContractAddress = _v2Address;
emit ContractUpgrade(_v2Address);
}
| 6,149,457 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/**************************************************************************************... | writeset airline into mapping but keep registration as false | function setAirlinePendingRegister
(
address airlineAddress,
string memory name
)
external
... | 996,735 |
./full_match/1/0x78FDE77737d5b9ab32fC718C9535c7f1B8ce84dB/sources/contracts/GiversPFPRoyalties.sol | allows the owner to mint NFTs for free to a specified address - the purpose of this function is for the owner to be able to gift NFTs for promotional purposes mintAmount_ the amount of NFTs to mint in a single transaction recipient the recipient of the minted NFT(s) | function mintTo(uint256 mintAmount_, address recipient) external whenNotPaused onlyOwner {
_safeMintMany(mintAmount_, recipient);
}
| 4,935,160 |
// SPDX-License-Identifier: AGPL V3.0
pragma solidity 0.6.12;
// Part: AddressUpgradeable
/**
* @dev Collection of functions related to the address type
*/
library AddressUpgradeable {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume... | Redeem all already unlocked vAKRO return Amount redeemed/ | function redeemAllUnlocked() public returns(uint256){
address beneficiary = _msgSender();
require(!isSender(beneficiary), "VestedAkro: VestedAkroSender is not allowed to redeem");
uint256 amount = holders[beneficiary].unlocked;
if(amount == 0) return 0;
require(akro.balanceOf... | 1,449,402 |
/**
*Submitted for verification at Etherscan.io on 2020-10-21
*/
// File: openzeppelin-solidity/contracts/math/SafeMath.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.6.8;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap o... | calculate the dividend between a time range start start of dividend phase end end of dividend phase USDPerSecondInRay dividend accrual rate return amount of USD accrued per second in 1e27/ | function calculatePhaseDividend(uint256 start, uint256 end, uint256 USDPerSecondInRay) public pure returns (uint256) {
return end
.sub(start, "Phase start end mismatch")
.mul(USDPerSecondInRay);
}
| 7,233,001 |
./partial_match/1/0x9F2fAcC8a376b6b592c471f08C67Cd84B1c51208/sources/FRENZ.sol | Maximum tx size and wallet size exclude from paying fees or having max transaction amount | constructor() ERC20("Friendzone", "FRENZ") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uint256 _buyMa... | 3,946,589 |
./full_match/5/0x2CD7d3d0a75cc3633fD6900C093f6Dab7A37c24A/sources/contracts/NewContracts/721AV2(R,PS,A).sol | Mints a batch of new tokens. The sender must send enough ether to cover the minting cost. | function batchMint(uint256 amount, uint256 mintId, bool useAlternativeToken) external payable {
if (mintLive == false || presaleActive[mintId] == false) {
revert("Minting is not currently enabled");
}
if(amount + _numberMinted(msg.sender) > maxMintPerWallet){
... | 11,592,536 |
pragma solidity >=0.5.0;
contract CrypticLegendsToken {
address private _owner;
uint8 private constant levelDefault = 5;
uint8 private constant levelMax = 20;
//median value is used to restrict the median value of abilities given. Also this is the default value
uint8 private constant levelMedian = 12;
u... | return the address of the owner./ | function owner() public view returns (address) {
return _owner;
}
| 886,121 |
/**
* @author Sushant Kumar
* @title CampaignFactory
* @section DESCRIPTION
* This smart contract is an implementation of Kickstarter using Solidity.
* It is used to create Campaigns to raise funds and then request the backers of
* the Campagin to approve the usage of the raised funds for various purposes.
* Ad... | To retrieve list of campaigns. Uses filterCampaigns() to filter user address of the user code If 0 -> shows a general list. 1 -> Filters through campaign creators list. 2 -> Filters through campaign backers list return ongoingCampaigns List of addresses of Ongoing Campaigns return completedCampaigns List of address... | function getCampaigns(address user, uint code) public view returns(address[] ongoingCampaigns, address[] completedCampaigns) {
CampaignStatus[] memory listOfCampaigns;
if(code == 0) {
listOfCampaigns = deployedCampaigns;
}
else if(code == 1) {
listOfCampaign... | 12,737,808 |
pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 _a, uint256 _b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than ... | low level token purchase DO NOT OVERRIDE _beneficiary Address performing the token purchase/ calculate token amount to be created update state | function buyTokens(address _beneficiary) payable public{
uint256 weiAmount = msg.value;
_preValidatePurchase(_beneficiary, weiAmount);
uint256 tokens = _getTokenAmount(weiAmount);
tokensRaised = tokensRaised.add(tokens);
minterContract.mint(_beneficiary, tokens);
emit TokenPurchase(
... | 15,075,363 |
./full_match/1/0xd920556b0f3522bB1257923292A256F1e3023e07/sources/SimpleFarm.sol | Performs withdrawal of staked token from the farm/ | function farmWithdraw(
uint256 _withdrawAmount
)
public
updateFarm()
updateUser()
{
if (block.timestamp < periodFinished) {
require(
_totalStaked > _withdrawAmount,
"SimpleFarm: STILL_EARNING"
);
}
... | 9,746,326 |
./full_match/5/0x7FE3Ec7892f99A5AEFFaA0eB9081a531Ca2B69F9/sources/gist-97999f538dc28ae96ae5fc69a9464c31/contracts/RedirectAll.sol | According to the app basic law, we should never revert in a termination callback | function afterAgreementTerminated(
ISuperToken _superToken,
address _agreementClass,
bytes calldata /*_agreementData*/,
bytes calldata _ctx
)
external override
onlyHost
returns (bytes memory newCtx)
{
if (!_isSameToken(_superToken) || !_isCFAv1... | 7,062,743 |
./partial_match/288/0x6AAfC01751A13031A4CA87aF5aA432423021176A/sources/contracts/Ola/Peripheral/PriceOracle/open-oracle/Uniswap/UniswapAnchoredView.sol | Get the array of symbols that can be auto poked./ | function getAllAutoPokingSymbols() external view returns (string[] memory) {
return autoPokingSymbols;
}
| 16,906,886 |
/**
Broge
βββββββ βββββββ βββββββ βββββββ ββββββββ
βββββββββββββββββββββββββββββββββ ββββββββ
βββββββββββββββββββ ββββββ ββββββββββ
βββββββββββββββββββ ββββββ βββββββββ
βββββββββββ βββββββββββββββββββββββββββββ
... | Adds Liquidity directly to the contract where LP are locked(unlike safemoon forks, that transfer it to the owner) | function _addLiquidity(uint256 tokenamount, uint256 ethamount) private {
totalLPETH+=ethamount;
_approve(address(this), address(_uniswapRouter), tokenamount);
address(this),
tokenamount,
0,
0,
address(this),
block.timestamp
... | 10,021,382 |
pragma solidity ^0.4.25;
contract token {
function transfer(address receiver, uint256 amount) public;
function balanceOf(address _owner) public pure returns (uint256 balance);
function burnFrom(address from, uint256 value) public;
}
library SafeMath {
function mul(uint256 a, uint256 b) inte... | Add User to Whitelist with ether amount _address User Wallet address amount The amount of ether user Whitelisted/ | function addWhiteListAddress(address _address, uint256 amount)
public {
require(!isAddressWhiteListed(_address));
uint256 val = SafeMath.mul(amount, decimals);
Whitelist.addUserWithValue(_list, _address, val);
emit AddressAdded(_address);
}
| 5,461,672 |
./partial_match/56/0x2b28688e290aF66Fbf67280937399140B5F1Dda3/sources/BerryMaster.sol | Checks if an address voted in a dispute _disputeId to look up _address of voting party to look up return bool of whether or not party voted/ | function didVote(BerryStorage.BerryStorageStruct storage self, uint256 _disputeId, address _address) internal view returns (bool) {
return self.disputesById[_disputeId].voted[_address];
}
| 11,056,966 |
./full_match/3/0x7cE0ca69e0ecf339c97700c305E63dD7A654BAe5/sources/browser/MF2_Stacking_AUTO.sol | Update_Global_Data(); | function Do_Update_User(address user) public returns(bool){
require(msg.sender==m_Updater_Address,"DISQUALIFIED");
require(m_User_Map[user].Registered==true);
Update_User(user,false);
return true;
}
| 8,093,819 |
pragma solidity ^0.7.3;
// import 'Token.sol';
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract Proposal is ERC20 {
// uint256 public poolTokenSupply;
address admin;
IERC20 DAI;
// Proposal spec
// address[] tokenAddresses;
... | days -> unixtimestamps elapse time in unixtimestamps N possible claims Total possible claim amounts Eligible claim amount Claim the eligible amount DAI.transfer(msg.sender, eligibleClaimAmount); | function claimPremium() public {
require(optionSellerPortionMap[msg.sender] > 0);
uint256 optionIntervalUnixtimestamp = optionInterval * 60 * 60 * 24;
uint256 diff = block.timestamp - endDate;
uint256 mult = diff / optionIntervalUnixtimestamp;
uint256 premium = (mult *
... | 14,029,926 |
./full_match/7700/0x865dE7F1Bf53B71b296e88E213cBD0503B7913cb/sources/contracts/external/cantolp/CErc20Delegator.sol | Get the underlying balance of the `owner` This also accrues interest in a transaction owner The address of the account to query return The amount of underlying owned by `owner`/ | function balanceOfUnderlying(address owner)
external
override
returns (uint256)
{
bytes memory data = delegateToImplementation(
abi.encodeWithSignature("balanceOfUnderlying(address)", owner)
);
return abi.decode(data, (uint256));
}
| 4,657,772 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.9; // code below expects that integer overflows will revert
import "./AreaNFT.sol";
import "./RandomDropVending.sol";
import "./Utilities/PlusCodes.sol";
import "./Vendor/openzeppelin-contracts-3dadd40034961d5ca75fa209a4188b01d7129501/access/Ownable.sol";
///... | Start the sale | function _beginSale() internal {
_saleDidNotBeginYet = false;
}
| 1,464,393 |
pragma solidity ^0.4.18;
/** ----------------------------------------------------------------------------------------------
* ZJLTToken by ZJLT Distributed Factoring Network Limited.
* An ERC20 standard
*
* author: ZJLT Distributed Factoring Network Team
*/
/**
* @title SafeMath
* @dev Math operations with safe... | if ether is sent to this address, send it back.throw; | function () payable public {
require(false);
}
| 197,920 |
//Address: 0x52035f001502d5f4b0555d699d448da4a20f67cb
//Contract name: DevCoin
//Balance: 0 Ether
//Verification Date: 2/24/2018
//Transacion Count: 2
// CODE STARTS HERE
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function... | Send _value amount of tokens to address _to Only the owner can call this function No need to protect balances because only sender balance is accessed here/ SafeMath.sub will throw if there is not enough balance of if there is an overflow notify | function transfer(address _to, uint256 _amount) public returns (bool success) {
require(_to != address(0));
require(_amount <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_amount);
balances[_to] = balances[_to].add(_amount);
Transfer(msg.sender, _to, _amount);
retu... | 12,967,882 |
./partial_match/1/0x818bab157DA988549F570E6E71aC8C6C68719B26/sources/DeadBears.sol | Verify merkle proof, or revert if not in tree Set address to claimed Mint tokens to address | function mintWhitelist(bytes32[] calldata proof) external {
require(open);
require(freeClaimed < MAX_FREE_SUPPLY);
if (hasClaimed[msg.sender]) revert();
bytes32 leaf = keccak256(abi.encodePacked(msg.sender, uint256(1)));
bool isValidLeaf = MerkleProof.verify(proof, merkleRo... | 16,090,638 |
// SPDX-License-Identifier: MIT
pragma experimental ABIEncoderV2;
pragma solidity ^0.6.12;
import "./Interfaces/LiquidityMathModelInterface.sol";
import "./MToken.sol";
import "./Utils/ErrorReporter.sol";
import "./Utils/ExponentialNoError.sol";
import "./Utils/AssetHelpers.sol";
import "./Moartroller.sol";
import "./... | Whether or not this market is listed Multiplier representing the most one can borrow against their collateral in this market. For instance, 0.9 to allow borrowing 90% of collateral value. Must be between 0 and 1, and stored as a mantissa. Per-market mapping of "accounts in this asset" Whether or not this market receive... | function enterMarkets(address[] calldata mTokens) external returns (uint[] memory);
function exitMarket(address mToken) external returns (uint);
function mintAllowed(address mToken, address minter, uint mintAmount) external returns (uint);
function redeemAllowed(address mToken, address redeemer, uint... | 11,818,443 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.