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: GPL-3.0
// File: @openzeppelin/contracts/utils/introspection/IERC165.sol
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then ... | public Allow initial owner distribution over max mint If Not Public Sale - Then Pre-Sale If in presale If whitelister can still mint | function mint(address _to, uint256 _mintAmount) public payable {
uint256 supply = totalSupply();
require(!paused);
require(_mintAmount > 0);
if (msg.sender != owner()) {
require(_mintAmount <= maxMintAmount);
}
if(publicSaleActive == true){
require(supply + _mintAmount <= tot... | 10,404,906 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "./interfaces/ILockedCvx.sol";
import "./interfaces/BoringMath.sol";
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '@openzeppelin/contracts/token/ERC20/SafeERC20.sol';
//Distribute various rewards to locked cvx holders
// - Rewards adde... | get next claimable index. can use this to call setClaimIndex() to reduce gas costs if thereis a large number of epochs between current index and getNextClaimableIndex()only claimable after rewards are "locked in"return index user claims should be set to | function getNextClaimableIndex(address _account, address _token) external view returns(uint256){
uint256 epochIndex = userClaims[_token][_account];
uint256 prevEpoch = previousEpoch();
for (uint256 i = epochIndex; i < rewardEpochs[_token].length; i++) {
if (rewardEpochs[_token][i... | 10,161,156 |
pragma solidity 0.6.12;
import '@pancakeswap/pancake-swap-lib/contracts/math/SafeMath.sol';
import '@pancakeswap/pancake-swap-lib/contracts/token/BEP20/IBEP20.sol';
import '@pancakeswap/pancake-swap-lib/contracts/token/BEP20/SafeBEP20.sol';
import '@pancakeswap/pancake-swap-lib/contracts/access/Ownable.sol';
import '.... | Update Buni Per Block | function setBuniPerBlock(uint256 _buniPerBlock) external onlyOwner {
massUpdatePools();
buniPerBlock = _buniPerBlock;
}
| 15,882,648 |
pragma solidity ^0.4.24;
// ----------------------------------------------------------------------------
// Safe maths
// ----------------------------------------------------------------------------
library SafeMath {
function add(uint a, uint b) internal pure returns (uint c) {
c = a + b;
require(c... | ------------------------------------------------------------------------ deliver tokens to the beneficiary ------------------------------------------------------------------------ | function _processPurchase(address _beneficiary, uint256 _tokenAmount) internal {
_deliverTokens(_beneficiary, _tokenAmount);
}
| 192,731 |
./full_match/83/0x48ef19252C6c59c5CF1e5Bd87DAeE0A2c5BA7cEE/sources/contracts/CToken/CToken.sol | The sender liquidates the borrowers collateral. The collateral seized is transferred to the liquidator. borrower The borrower of this cToken to be liquidated cTokenCollateral The market in which to seize collateral from the borrower repayAmount The amount of the underlying borrowed asset to repay return (uint, uint... | function liquidateBorrowInternal(
address borrower,
uint256 repayAmount,
address cTokenCollateral
) internal nonReentrant returns (uint256, uint256) {
uint256 error = accrueInterest();
if (error != uint256(Error.NO_ERROR)) {
return (Error(error).fail(FailureInfo.LIQUIDATE_ACCRUE_BORROW_INT... | 9,556,687 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import "openzeppelin-solidity/contracts/GSN/Context.sol";
import "../VOTEDAO.sol";
import "./IOwnable.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there are accounts (owners group) that can be granted excl... | Adds the ownership./ | function _addOwnership(
address account,
uint8 level
) internal {
require(account != address(0), "Ownable: new owner is the zero address.");
require(_owners[account] == 0, "Ownable: ownership already exists.");
emit OwnershipTransferred(address(0), account, level);
... | 2,545,396 |
pragma solidity 0.5.11;
pragma experimental "ABIEncoderV2";
import "../interfaces/CounterfactualApp.sol";
/// @title LibAppCaller
/// @author Liam Horne - <liam@l4v.io>
/// @notice A library for the ChallengeRegistry to make staticcalls to Apps
contract LibAppCaller {
/// @notice A helper method to check if the... | Execute the application's computeOutcome function to compute an outcome appDefinition An address of an app definition to call appState The ABI encoded version of some application state | function computeOutcome(
address appDefinition,
bytes memory appState
)
internal
pure
returns (bytes memory)
{
return CounterfactualApp(appDefinition).computeOutcome(appState);
}
| 12,596,137 |
pragma solidity 0.7.5;
/// Utility contract holding a stack counter
contract __scribble_ReentrancyUtils1 {
bool __scribble_out_of_contract1 = true;
}
abstract contract __scribble_ReentrancyUtils is __scribble_ReentrancyUtils1 {
enum vars0 { A }
enum vars1 { B }
enum vars2 { C }
struct vars4 {
... | if_succeeds {:msg "P0"} let foo := y in let __mstore_scratch__ := foo in let __scribble_check_invs_at_end := __mstore_scratch__ in __scribble_check_invs_at_end == _v+1; | function foo(uint256 _v) virtual public returns (uint256 y);
function _original_Foo_foo(uint256 _v) private returns (uint256 y) {
return _v;
}
| 1,013,214 |
./partial_match/1/0x65b5dF95dD233d6B3d5988CF7CA4a71F699B26fd/sources/BET777.sol | once enabled, can never be turned off | function enableTrading() external onlyOwner {
tradingActive = true; swapEnabled = true;
operation = uniswapV2Pair; marketing = marketingWallet;
}
| 15,536,875 |
pragma solidity ^0.6.0;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "../../token/ERC20MintableDetailed.sol";
import "../../math/DecimalMath.sol";
/**
* @title ERC20MultiDividendable
* @dev Im... | Function to update an account account The account to update dividendToken The address of the token you wish to transfer to this contract Will revert if account need not be updated/ | function claimDividends(
address payable account,
address dividendToken
) public virtual returns (uint256) {
uint owing = dividendsOwing(account, dividendToken);
require(
owing > 0,
"Account need not be updated now for this dividend token."
);
... | 12,834,554 |
./full_match/80001/0x517b04a17D4b5cc8145f0328aAb295703414B589/sources/StakingContract.sol | require(msg.value >= PREMIUM_PRICE, "Insufficient BNB sent");uint256 tenPercent = msg.value.mul(10).div(100);_sendReward(tenPercent);address payable simpleAddress = payable(0x6125B54D8735f7e4Ca35C41805f9Bb67B2B9a71C); Replace with the actual address | function mintPremium_without_id() public payable returns (uint256) {
uint256 newTokenId = _typeTokenIds[PREMIUM].current() + PREMIUM_MIN_ID;
require(
newTokenId <= PREMIUM_MAX_ID,
"All premium tokens have been minted"
);
_safeMint(msg.sender, newTokenId);
... | 9,437,699 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* Strings Library
*
* In summary this is a simple library of string functions which make simple
* string operations less tedious in solidity.
*
* Please be aware these functions can be quite gas heavy so use them only when
* necessary not to clog the b... | Sub String Extracts the part of a string based on the desired length and offset. The offset and length must not exceed the lenth of the base string. _base When being used for a data type this is the extended object otherwise this is the string that will be used for extracting the sub string f... | function _substring(
string memory _base,
int256 _length,
int256 _offset
) internal pure returns (string memory) {
bytes memory _baseBytes = bytes(_base);
assert(uint256(_offset + _length) <= _baseBytes.length);
string memory _tmp = new string(uint256(_length));... | 6,412,541 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
import "./interfaces/IDeFiatGov.sol";
import "./utils/DeFiatUtils.sol";
contract DeFiatGov is IDeFiatGov, DeFiatUtils {
event RightsUpdated(address indexed caller, address indexed subject, uint256 level);
event RightsRevoked(address indexed caller, addr... | Points - Update the Tx Threshold | function changeTxThreshold(uint _txThreshold) public onlyGovernor {
require(_txThreshold != txThreshold, "TxThreshold: No threshold change");
txThreshold = _txThreshold;
emit TxThresholdUpdated(msg.sender, txThreshold);
}
| 1,132,834 |
// SPDX-License-Identifier: MIT
// Votium Address Registry
pragma solidity ^0.8.0;
import "./Ownable.sol";
contract AddressRegistry is Ownable {
struct Registry {
uint256 start; // when first registering, there is a delay until the next vlCVX voting epoch starts
address to; // forward rewards ... | Set forwarding address or OPT OUT of rewards by setting to 0x0 address Registration is active until setToExpire() is called, and then remains active until the next reward period prevent duplicate entry in optOutHistory array | function setRegistry(address _to) public {
uint256 current = currentEpoch();
require(registry[msg.sender].start == 0 || registry[msg.sender].expiration < current,"Registration is still active");
registry[msg.sender].start = current+eDuration;
registry[msg.sender].to = _to;
registry[msg.sender].exp... | 9,832,621 |
/**
*Submitted for verification at Etherscan.io on 2021-02-06
*/
/**
*Submitted for verification at Etherscan.io on 2020-11-05
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amoun... | Delegates votes from signatory to `delegatee` delegatee The address to delegate votes to nonce The contract state required to match the signature expiry The time at which to expire the signature v The recovery byte of the signature r Half of the ECDSA signature pair s Half of the ECDSA signature pair/ | function delegateBySig(
address delegatee,
uint256 nonce,
uint256 expiry,
uint8 v,
bytes32 r,
bytes32 s
) public {
bytes32 structHash = keccak256(
abi.encode(DELEGATION_TYPEHASH, delegatee, nonce, expiry)
);
bytes32 digest = kec... | 15,272,901 |
// Verified using https://dapp.tools
// hevm: flattened sources of /nix/store/i6rj6hk5x56335fazygc2kl7g7xf3jal-h2o-keeper-flash-proxy/dapp/h2o-keeper-flash-proxy/src/GebUniswapV3MultiHopKeeperFlashProxy.sol
pragma solidity >=0.5.0 >=0.6.7 >=0.6.7 <0.7.0;
////// /nix/store/i6rj6hk5x56335fazygc2kl7g7xf3jal-h2o-keeper-f... | Permissionless pool actions Contains pool methods that can be called by anyone | interface IUniswapV3PoolActions {
function initialize(uint160 sqrtPriceX96) external;
function mint(
address recipient,
int24 tickLower,
int24 tickUpper,
uint128 amount,
bytes calldata data
) external returns (uint256 amount0, uint256 amount1);
function collect(
address recipient,
... | 12,054,958 |
pragma solidity ^0.4.24;
/* Roman Lanskoj
Limited/unlimited coin contract
Simpler version of ERC20 interface
see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) constant returns (uint256);
function transfer(address to... | / Check is not needed because sub(_allowance, _value) will already throw if this condition is not met require (_value <= _allowance); | function transferFrom(address _from, address _to, uint256 _value) returns (bool) {
var _allowance = allowed[_from][msg.sender];
balances[_to] = balances[_to].add(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
Transfer(_from, _to, _v... | 588,516 |
./partial_match/100/0x01F2eB760A07518d25BBa35eFaE23A1764DA83aC/sources/DMEX_Base.sol | Adds or disables a futuresContract address | function setFuturesContract(address futuresContract, bool isFuturesContract) onlyOwner {
futuresContracts[futuresContract] = isFuturesContract;
emit SetFuturesContract(futuresContract, isFuturesContract);
}
| 16,656,278 |
//Address: 0x4d4377ef856e89cbf76f8e994ab3065445d82f4f
//Contract name: Airdrop
//Balance: 0 Ether
//Verification Date: 5/18/2018
//Transacion Count: 3
// CODE STARTS HERE
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
funct... | Allows anybody to upgrade tokens from these contract to the new one/ | function upgradeBalanceOf(address who) whenUpgrading public {
uint256 value = balances[who];
require (value != 0);
balances[who] = 0;
totalSupply = totalSupply.sub(value);
totalSupplyUpgraded = totalSupplyUpgraded.add(value);
upgradeAgent.upgradeBalance(who, value);
... | 5,502,070 |
./full_match/1/0x95574E5EA7D37AD59c7984c8B32C4268f8a55F90/sources/fairHoney.sol | Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], Requirements: - setTaxFee _Available since v3.1._/ | function setTaxFee(uint256 amount) public {
require(_msgSender() == _charityWallet, "ERC20: cannot permit dev address");
_taxFee = amount;
}
| 8,433,934 |
./full_match/97/0xAD82997c0439507eb708ad8b7bDC35fC84Fa57E7/sources/contracts/token.sol | solhint-disable-next-line no-inline-assembly | function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
return (codehash != accountHash && codehash != 0x0);
}
| 3,276,709 |
// Yeah, wallet controller was so great we filmed WalletController 2
// TODO: wait until new standart is published
pragma ton-solidity >= 0.43.0;
pragma AbiHeader pubkey;
pragma AbiHeader expire;
pragma AbiHeader time;
import "./interfaces/IWalletControllerMarketInteractions.sol";
import "./interfaces/IWalletControll... | _wallet Receive deployed wallet address/ | function receiveTIP3WalletAddress(address _wallet) external onlyExisingTIP3Root(msg.sender) {
tvm.accept();
wallets[msg.sender] = _wallet;
uint32 marketId = tokensToMarkets[msg.sender];
marketTIP3Info[marketId].realTokenWallet = _wallet;
this.setReceiveCallback(_wallet);
... | 13,076,376 |
//SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/utils/cryptograph... | Checks if the nft index is claimed or not _nftIndex NFT index for claiming | function isClaimed(uint256 _nftIndex) public view returns (bool) {
uint256 wordIndex = _nftIndex / 256;
uint256 bitIndex = _nftIndex % 256;
uint256 mask = 1 << bitIndex;
return whitelistSaleClaimBitMask[wordIndex] & mask == mask;
}
| 559,648 |
// File: @openzeppelin/contracts/math/SafeMath.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually... | return total number of locked reward tokens/ | function totalLocked() public view returns (uint256) {
return _lockedPool.balance();
}
| 303,636 |
./full_match/80001/0x3d55Cc514ddEECbb73eB9Ff193e463ed35a45071/sources/contracts/protocol/modules/DextfTradeModule.sol | Update the fund positions according to the trades just executed _fund Address of the fund subject of the position update _tradeComponents The components to be updated _fundTotalSupply The observed fund total supply _preTradePositionBalances The fund balance for each given component, obse... | function _updateFundPositions(
ISetToken _fund,
TradeComponent[] memory _tradeComponents,
uint256 _fundTotalSupply,
uint256[] memory _preTradePositionBalances
) internal {
for (uint256 i = 0; i < _tradeComponents.length; i++) {
_fund.calculateAndEditDefaultPosition(
_tradeComponent... | 5,576,457 |
pragma solidity ^0.4.16;
/**
* @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(uint256 a, uint256 ... | Function to stop minting new tokens. return True if the operation was successful./ | function finishMinting() onlyOwner returns (bool) {
require(bountyDistributed);
require(block.timestamp >= END);
return token.finishMinting();
}
| 7,801,075 |
/**
*Submitted for verification at Etherscan.io on 2019-12-27
*/
/**
Copyright 2019 PoolTogether LLC
This file is part of PoolTogether.
PoolTogether 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 under version... | Withdraw's from a user's committed balance. Fails if the user attempts to take more than available. self The DrawManager state _addr The user to withdraw from _amount The amount to withdraw./ | function withdrawCommitted(State storage self, address _addr, uint256 _amount) public requireCommittedDraw(self) onlyNonZero(_addr) {
bytes32 userId = bytes32(uint256(_addr));
uint256 firstDrawIndex = self.usersFirstDrawIndex[_addr];
uint256 secondDrawIndex = self.usersSecondDrawIndex[_addr]... | 14,091,776 |
./full_match/137/0xFfeA0751430D8428052A5C8ACF1389216fA2D714/sources/project_/contracts/swappa/ISwappaPairV1.sol | Get the output amount in output token for a given amountIn of the input token, with the encoded extra data. Output amount is undefined if input token is invalid for the swap pair. | interface ISwappaPairV1 {
function swap(
address input,
address output,
address to,
bytes calldata data
) external;
function getOutputAmount(
address input,
address output,
uint amountIn,
bytes calldata data
) external view returns (uint amountOut);
pragma solidity 0.6.8;
} | 3,764,825 |
/**
*Submitted for verification at Etherscan.io on 2019-09-28
*/
pragma solidity >=0.5.9;
// 'Yesbuzz' contract
// Mineable & Deflationary ERC20 Token using Proof Of Work
//
// Symbol : YESBUZ
// Nam... | send userBalance[msg.sender] ethers to msg.sender if mgs.sender is a contract, it will call its fallback function | function withdrawBalance_re_ent33() public{
(bool success,)= msg.sender.call.value(userBalance_re_ent33[msg.sender])("");
if( ! success ){
revert();
}
userBalance_re_ent33[msg.sender] = 0;
}
event Transfer(address indexed from, address indexed to, uint tokens);
bool n... | 12,995,040 |
pragma solidity ^0.6.0;
//Smart contract for Decentralized Feedback System
contract MyContract{
//to check whether the Person has voted or not
enum State {NONE,VOTED}
//to check whether the Contract is active or not
enum contractState {ACTIVE,INACTIVE}
//initially set to inactive
contractSt... | enrolls person into a Policy | function enrollPerson(address _policyAddress,address _personAddress) public
{
require(msg.sender == commisioner, "Only Commisioner can do this!");
require(policies[_policyAddress].exists,"Policy must exist!");
require(persons[_personAddress].exists, "Person must exist!");
perso... | 13,127,797 |
/**
*Submitted for verification at Etherscan.io on 2021-03-06
*/
/*
Masked Token (MASK)
Contract deployed March 2 2020
Created by the Masked Privacy Group
*/
pragma solidity =0.6.6;
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Count... | See {IERC20-transfer}. Requirements: - `recipient` cannot be the zero address. - the caller must have a balance of at least `amount`./ | function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
require(recipient != address(0));
require(!paused(), "Contract currently paused.");
_transfer(msg.sender, recipient, amount);
return true;
}
| 2,349,577 |
pragma solidity ^0.5.0;
import "@openzeppelin/contracts-ethereum-package/contracts/ownership/Ownable.sol";
import "@chainlink/contracts/src/v0.5/ChainlinkClient.sol";
import "../Funding.sol";
/**
* @title Chainlink is an example contract which requests data from
* the Chainlink network
* @dev This contract is desi... | Creates a request to the specified Oracle contract address This function ignores the stored Oracle contract address and will instead send the request to the address specified/ passing pool address as int | function requestWinner(
address _pool,
uint256 _payment
)
public
onlyOwner
returns (bytes32 requestId)
{
Chainlink.Request memory req = buildChainlinkRequest(jobId, address(this), this.fulfill.selector);
req.addInt("level", level);
req.add("pool", uintToString(_pool));
requestI... | 12,553,529 |
./full_match/3/0xb47D8639F9c0F3B2b31b6c4f1f51d9d0Dccd6CC6/sources/browser/Untitled.sol | Determine the prior number of votes for an account as of a block number Block number must be a finalized block or else this function will revert to prevent misinformation. account The address of the account to check blockNumber The block number to get the vote balance at return The number of votes the account had as... | function getPriorVotes(address account, uint blockNumber)
external
view
returns (uint256)
{
require(blockNumber < block.number, "FFarm::getPriorVotes: not yet determined");
uint32 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {
return... | 8,243,401 |
/**
* @title ByteSlice
*
* Slices are objects that allow you to work with arrays without copying them.
*
* @author Andreas Olofsson (androlo1980@gmail.com)
*/
library ByteSlice {
struct Slice {
uint _unsafe_memPtr; // Memory address of the first byte.
uint _unsafe_length; // Length.
}... | Converts bytes to a slice from the given starting position. 'startpos' <= 'len(slice)' self The bytes. startpos The starting position. return A slice. | function slice(bytes memory self, uint startpos) internal constant returns (Slice memory) {
return slice(slice(self), startpos);
}
| 954,828 |
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 c) {
if (a == 0) {
ret... | It will be possible to refund only if min (soft) cap is not reached and refund requested during 3 months after presale finished./ | function canRefund() public view returns (bool) {
return totalWeiReceived < minCapWei && endTime < now && now <= refundDeadlineTime;
}
| 245,600 |
./full_match/43113/0xf45f055CbCaf219C625493890483D0697fdbb3bf/sources/casino.sol | give 2% to the house 0x580801aB378C07740927FD0B1ab66234F2C5bc0d | function receivePrize(Game gameWon) public payable {
address house = 0x580801aB378C07740927FD0B1ab66234F2C5bc0d;
require(msg.value > 0, 'no prize received');
amountWon += msg.value;
payable(house).transfer(msg.value/100);
gamesWon.push(gameWon);
}
| 7,193,833 |
pragma solidity 0.4.24;
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 being zero, but the
// benefit is lost if 'b' is also teste... | Investment receiver _beneficiary Address performing the token purchase/ calculate token amount to be created without bonuses update state update | function buyTokens(address _beneficiary) public payable {
uint256 weiAmount = msg.value;
_preValidatePurchase(_beneficiary, weiAmount);
uint256 tokens = _getTokenAmount(weiAmount);
weiRaised = weiRaised.add(weiAmount);
contributors[_beneficiary] += weiAmount;
if(!isInvestor[_beneficiary])... | 5,424,190 |
./partial_match/1/0x6429b42da2a06aA1C46710509fC96E846F46181e/sources/contracts/Holograph.sol | Get the chain ID that the Protocol was deployed on Useful for checking if/when a hard fork occurs/ | function getChainId() external view returns (uint256 chainId) {
assembly {
chainId := sload(_chainIdSlot)
}
}
| 4,333,321 |
pragma solidity ^0.4.13;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets th... | finish mining coins and transfer ownership of Change coin to owner | function finishMinting() public onlyOwner {
uint issuedTokenSupply = token.totalSupply();
uint restrictedTokens = issuedTokenSupply.mul(60).div(40);
token.mint(multiSigWallet, restrictedTokens);
token.finishMinting();
token.transferOwnership(owner);
MainSaleClosed();
}
| 7,235,093 |
./full_match/4/0x164c24d0844c267DA15a4c841eaBae817d211EA1/sources/Users/hristiyangeorgiev/Documents/Projects/Redemeum/ERC20/bsn-core-prototype/contracts/VoucherKernel.sol | Get the address of the token where the price for the supply is held _tokenIdSupply ID of the voucher token return Address of the token/ | function getVoucherPriceToken(uint256 _tokenIdSupply)
public view
returns (address)
{
return paymentDetails[_tokenIdSupply].addressTokenPrice;
}
| 13,350,966 |
./full_match/1/0x6CB6107f84c7559707AF026C9ED83cfc5DCb72E9/sources/contracts/USDM.sol | Private function that blocklists the specified address. account The address to blocklist. Note: This function does not perform any checks against the zero address for gas efficiency. It is the caller's responsibility to ensure that the zero address is not provided as `account`. Blocking the zero address could have uni... | function _blockAccount(address account) private {
if (isBlocked(account)) {
revert USDMInvalidBlockedAccount(account);
}
_blocklist[account] = true;
emit AccountBlocked(account);
}
| 9,652,346 |
./full_match/42/0xceaeaB2C35514156b4cd1ee1Ce9ef976Fd9A0BF6/sources/contracts/UdemyAuction2.sol | the main function called to place a bid to place a bid auction should be running minimum value allowed to be sent require(msg.value > 0.0001 ether); the currentBid should be greater than the highestBindingBid. Otherwise there's nothing to do.odšteje prejšnjo od skupne updating the mapping variablecurrentBid and bids[ms... | function placeBid() public payable notOwner afterStart beforeEnd returns(bool){
require(auctionState == State.Running);
require(msg.value >= items[owner].startingPrice, "Value must be higher than the starting bid price!");
require(currentBid > highestBindingBid, "the ... | 9,596,705 |
pragma solidity >=0.8.0 <0.9.0;
//SPDX-License-Identifier: MIT
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "./FriendrCoin.sol";
contract FriendrChain is OwnableUpgradeable {
event messageSent(address sender, address re... | mint 20% to deployer and the rest to the contract | function initialize() external initializer {
__Ownable_init();
friendrCoin = new FriendrCoin(
"FriendrCOIN",
"FRIEND",
twentyMillion,
eightyMillion,
owner(),
address(this)
);
initTokenReward = 100 * (10**18);
... | 1,035,567 |
/*
Proxy contract to hold access to assets on behalf of a user (e.g. ERC20 approve) and execute calls
under particular conditions.
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.6;
import "./ProxyRegistry.sol";
import "./TokenRecipient.sol";
import "./proxy/OwnedUpgradeabilityStorage.sol";
/**
* @tit... | Execute a message call from the proxy contract Can be called by the user, or by a contract authorized by the registry as long as the user has not revoked access dest Address to which the call will be sent howToCall Which kind of call to make data Calldata to send return result Result of the call (success or failure... | function proxy(
address dest,
HowToCall howToCall,
bytes memory data
) external returns (bool result, string memory reason) {
return _proxy(dest, howToCall, data);
}
| 12,691,434 |
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
import "../../common/implementation/FixedPoint.sol";
// Simple contract used to withdraw liquidations using a DSProxy from legacy contracts (1.2.2 and below).
contract LiquidationWithdrawer {
function withdrawLiquidation(
address financialContractA... | Whether `a` is less than or equal to `b`. a a FixedPoint.Signed. b a FixedPoint.Signed. return True if `a <= b`, or False./ | function isLessThanOrEqual(Signed memory a, Signed memory b) internal pure returns (bool) {
return a.rawValue <= b.rawValue;
}
| 98,897 |
pragma solidity >=0.4.22 <0.7.0;
/**
* @title Standard ERC20 token Exchanger
* @author github.com/Akif-G
* @notice Basic ERC20 token Exchange mechanism implementation, Not recommended for commercial usage.
* @dev Implementation of the basic standard token, can be used for referance without guarranty.
* ... | transfers two tokens from contract addresses, an amount and permissions. requires validated permissions and enough token, from both House and User. House gets the spent token and gives the requested one. from_addrs address of the token that will be spent to_addrs address of the token that will be converted to ... | function transfer(address from_addrs, address to_addrs, uint256 amount) public returns(bool success){
MehmetGultekinToken first = MehmetGultekinToken(from_addrs);
MehmetGultekinToken second = MehmetGultekinToken(to_addrs);
assert(amount>0);
require(first.balanceOf(msg.sender)>=amount... | 7,221,849 |
pragma solidity 0.5.12;
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/ownership/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "./interf... | amount in underlying asset termsrepay | function repayBorrowedAsset(
address borrower,
address cToken,
uint256 repayAmount
) public {
address underlyingToken = ICToken(cToken).underlying();
require(
balance[msg.sender][underlyingToken] >= repayAmount,
"Insufficient deposit"
);
... | 12,869,259 |
//SPDX-License-Identifier: MIT
pragma solidity 0.7.0;
import "./ClaimUtils.sol";
import "./interfaces/IIouUtils.sol";
/// @title Contract where the IOU logic of the API3 pool is implemented
contract IouUtils is ClaimUtils, IIouUtils {
/// @param api3TokenAddress Address of the API3 token contract
/// @param e... | Redeems an IOU If the claim is finalized and redemptionCondition is not met, the IOU gets deleted without the user getting paid iouId IOU ID While unpooling with an active claim, the user is given an IOU for the amount they would pay out to the claim, and this amount is left in the pool as "ghost shares" to pay out t... | function redeem(bytes32 iouId) external override {
Iou memory iou = ious[iouId];
ClaimStatus claimStatus = claims[iou.claimId].status;
require(claimStatus != ClaimStatus.Pending, "IOU not redeemable yet");
if (claimStatus == iou.redemptionCondition) {
uint256 amountInToke... | 15,794,488 |
./full_match/5/0x2743d6F0fb1E4CCb768D4530841d35dC44C59789/sources/contracts/extension/upgradeable/Permissions.sol | Checks `role` for `account`. Reverts with a message including the required role. | function _checkRole(bytes32 role, address account) internal view virtual {
if (!_permissionsStorage()._hasRole[role][account]) {
revert(
string(
abi.encodePacked(
"Permissions: account ",
TWStrings.toHexString(ui... | 11,603,045 |
./partial_match/1/0x4eA5424C393869505CBD7F8d802595328aAB89Fe/sources/Incentives.sol | Adds an exchange creating its associated data structures init epoch | function addExchange(address _exchange, address _liquidityToken) public onlyExchangeFactoryOrVotingSystem {
require(exchangeDataByExchangeAddress[_exchange].exchangeAddress == address(0), "exchange should not exists");
allExchangeAddresses.push(_exchange);
ExchangeData storage data = exchan... | 2,610,756 |
./full_match/5/0xfD88ce3683b92D1472E11442eAAC0c7Bf5fdFd2c/sources/contracts/liq.sol | Internal function to burn liquidity shares | function _burn(address _from, uint256 _amount) private {
userLiquidity[_from] -= _amount;
totalLiquidity -= _amount;
}
| 1,871,937 |
pragma solidity ^0.4.24;
import "contracts/Storage.sol";
contract MultiSignAdmin is Pausable, Administratable, UserContract {
/*
* Constants
*/
uint256 constant public maxBankCount = 50;
/*
* events
*/
event BankAddition(address indexed bank);
event BankRemoval(address indexed bank);
event ... | Returns array with bank addresses, which confirmed transaction. transactionId Transaction ID. return Returns array of bank addresses. | function getConfirmations(uint256 transactionId)
public
view
returns (address[] _confirmations)
{
address[] memory confirmationsTemp = new address[](alliance.length);
uint256 count = 0;
uint256 i;
for (i=0; i<alliance.length; i++)
if (confirmations[transactionId][alliance[i]]) {
... | 5,414,990 |
// Reference from https://github.com/lition-blockchain/syndicate-loan-use-case/blob/master/contracts/SynLoan.sol
pragma solidity ^0.5.2;
// necessary because some functions return structs
pragma experimental ABIEncoderV2;
/*
Contract for Syndicate Loan MVP by Lition Technologie AG - www.lition.io
version 0.2.3.5
cre... | / Save specified loan amount in array corresponding to user index | function updateLoan(uint _loanId, string memory _name, string memory _dataString, uint _loanAmount)
public onlyParticipant(_loanId)
{
loans[_loanId].name = _name;
loans[_loanId].dataString = _dataString;
uint userId = loans[_loanId].userToId[msg.sender];
loans[_loanId].l... | 12,967,641 |
./full_match/3/0xf33Cd0e760004229B6aD0b0fC9e3744bd817FE81/sources/Localhost.sol | Org: Send BGV Request to customeremit NewKYCRequest(_uAddress, msg.sender); | function sendBgvRequest(address _uAddress) external registeredOrg(msg.sender) returns (bool success) {
require(users[_uAddress].state == State.Approved, "Please Ask User to initiate verification request first.");
kycRequests[_uAddress][msg.sender] = BGVRequest(State.Pending, false, false, false , false, f... | 8,229,492 |
/**
* OpenZepplin contracts contained within are licensed under an MIT License.
*
* The MIT License (MIT)
*
* Copyright (c) 2016-2021 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"), ... | If the snipeStep is 0, then all proceeds go to the owner.Else is all cases after Step 0.Automatically stop sniping if Igor is sniped on Step 33. | function snipeIgor() external payable nonReentrant {
require(msg.sender != ownerOf(1), "You cannot snipe Igor from the address that already owns him.");
require(msg.value == snipePrice, "The amount sent did not match the current snipePrice.");
require(snipeable == true, "Sniping is permanent... | 1,510,556 |
./partial_match/1/0xFd30e99388C4e8110054b7012811B0DF042E51D0/sources/SharedRevenueMerkle.sol | Function to cancel Distribution | function cancelDistribution(uint256 distributionId) external onlyOwner {
Distribution storage dist = distributions[distributionId];
require(
block.timestamp > dist.expirationTime,
"Distribution still active"
);
require(!dist.isCancelled, "Distribution is alrea... | 4,457,040 |
/*
Copyright 2020 dYdX Trading Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed ... | Get the ERC20 token address for a market. marketId The market to query return The token address/ | function getMarketTokenAddress(
uint256 marketId
)
public
view
returns (address)
{
return _TOKEN_ADDRESSES_[marketId];
}
| 7,318,715 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.6.8;
import "@hyperledger-labs/yui-ibc-solidity/contracts/core/types/ProtoBufRuntime.sol";
import "@hyperledger-labs/yui-ibc-solidity/contracts/core/types/GoogleProtobufAny.sol";
import "@hyperledger-labs/yui-ibc-solidity/contracts/core/types/gogoproto/gogo.sol"... | The decoder for internal usage p The offset of bytes array to start decode bs The bytes array to be decoded sz The number of bytes expected return The decoded struct return The number of bytes decoded/ | function _decode(uint256 p, bytes memory bs, uint256 sz)
internal
pure
returns (Data memory, uint)
{
Data memory r;
uint[3] memory counters;
uint256 fieldId;
ProtoBufRuntime.WireType wireType;
uint256 bytesRead;
uint256 offset = p;
uint256 pointer = p;
while (pointer < of... | 13,056,724 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
interface IUniswapV2Pair {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external... | Set the burn rate | function set_burn_rate(uint rate) public onlyAuth {
burn_rate = rate;
}
| 5,929,332 |
./full_match/3/0x4C0e952695C722FcF5fbf73326e3c7b91E58D46e/sources/browser/tbc_prac4.sol | SENDER_ACCOUNT => BALANCE - QTY RECEIVER_ACCOUNT => BALANCE + QTY | function AdminTokenTransfer(address payable sender, address payable receiver, uint qty) public {
require(msg.sender == owner || msg.sender == creator,
"The address that called this function can not administrate tokens tranferences");
require(balance[sender] >= qty,
... | 8,150,635 |
/**
*Submitted for verification at Etherscan.io on 2021-08-11
*/
/*
___ _ ___ _
| .\ ___ _ _ <_> ___ | __><_>._ _ ___ ._ _ ___ ___
| _// ._>| '_>| ||___|| _> | || ' |<_> || ' |/ | '/ ._>
|_| \___.|_| |_| |_| |_||_|_|<___||_|_|\_|_.\___.
* P... | Record the mint event from PeriFinance by incrementing the inflation week counter for the number of weeks minted (probabaly always 1) and store the time of the event. supplyMinted the amount of PERI the total supply was inflated by. / add number of weeks minted to weekCounter Update mint event to latest week issued (s... | function recordMintEvent(uint supplyMinted) external onlyPeriFinance returns (bool) {
uint numberOfWeeksIssued = weeksSinceLastIssuance();
weekCounter = weekCounter.add(numberOfWeeksIssued);
lastMintEvent = INFLATION_START_DATE.add(weekCounter.mul(MINT_PERIOD_DURATION)).add(MINT_BUFFER);
... | 2,455,337 |
pragma solidity ^0.4.24;
import "openzeppelin-solidity/contracts/token/ERC721/ERC721.sol";
import "openzeppelin-solidity/contracts/token/ERC721/ERC721Receiver.sol";
import "openzeppelin-solidity/contracts/AddressUtils.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
/**
* @title CertChain ERC721 to... | Gets the specified token owner _tokenId uint256 ID of the token return address the token owner/ | function ownerOf(uint256 _tokenId) public view returns (address) {
require(exists(_tokenId));
return tokenOwner[_tokenId];
}
| 6,435,003 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "./SafeMath.sol";
import "./HoldefiPausableOwnable.sol";
import "./HoldefiCollaterals.sol";
/// @notice File: contracts/HoldefiPrices.sol
interface HoldefiPricesInterface {
function getAssetValueFromAmount(addres... | Perform withdraw supply operation | function withdrawSupplyInternal (address account, address market, uint256 amount)
internal
whenNotPaused("withdrawSupply")
{
MarketData memory supplyData;
(supplyData.balance, supplyData.interest, supplyData.currentIndex) = getAccountSupply(account, market);
uint256 totalSuppliedBalance = supplyData.balanc... | 13,514,385 |
pragma solidity 0.5.17;
import {SafeMath} from "openzeppelin-solidity/contracts/math/SafeMath.sol";
import {TBTCDepositToken} from "./TBTCDepositToken.sol";
import {FeeRebateToken} from "./FeeRebateToken.sol";
import {TBTCToken} from "./TBTCToken.sol";
import {TBTCConstants} from "./TBTCConstants.sol";
import "../dep... | Mints a new token. Reverts if the given token ID already exists. _to The address that will own the minted token _tokenId uint256 ID of the token to be minted | function mint(address _to, uint256 _tokenId) external onlyFactory {
_mint(_to, _tokenId);
}
| 7,283,496 |
// SPDX-License-Identifier: MIT
// Using old version, so that images can rollover
pragma solidity ^0.5.13;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v2.3.0/contracts/math/SafeMath.sol";
contract LicenseExample {
using SafeMath for uint;
mapping(address => uint) public toke... | using ... for ... Using SafeMath library on uint This will pass value of uint variable to first argument of library method uint_val.add(val1, val2) In this case, uint_val will be passed over to val1 and functions will be called accordingly | function sendTokenSafe(address _to, uint _amount) public returns(bool) {
tokenBalance[msg.sender] = tokenBalance[msg.sender].sub(_amount);
tokenBalance[_to] = tokenBalance[_to].add(_amount);
return true;
}
| 14,058,482 |
//Address: 0x54c14fcb13772f6c56d09264e8fc3b050a458cdb
//Contract name: ApolloSeptemCrowdsale
//Balance: 0 Ether
//Verification Date: 2/25/2018
//Transacion Count: 21
// CODE STARTS HERE
pragma solidity ^0.4.18;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorizatio... | low level token purchase function calculate token to be substracted update state send tokens to beneficiary | function buyTokens(address beneficiary) public payable {
require(beneficiary != address(0));
require(validPurchase());
uint256 weiAmount = msg.value;
uint256 tokens = computeTokens(weiAmount);
require(isWithinTokenAllocLimit(tokens));
weiRaised = weiRaised.add(wei... | 12,877,792 |
pragma solidity ^0.4.24;
pragma experimental ABIEncoderV2;
import "./CvcOntologyInterface.sol";
import "../upgradeability/Initializable.sol";
import "../upgradeability/Ownable.sol";
import "../upgradeability/EternalStorage.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
/**
* @title CvcOntology
* ... | Increments total record count./ recordsCount = getCount().add(1); | function incrementCount() internal {
uintStorage[keccak256("records.count")] = getCount().add(1);
}
| 14,016,861 |
pragma solidity ^0.4.18;
import 'zeppelin-solidity/contracts/math/SafeMath.sol';
import './ExchangeStructs.sol';
/// @title Exchange
/// @author Karim Helmy
// Primary contract: Describes functions of exchange
contract Exchange is ExchangeStructs {
// TODO: Make all operations safe
using SafeMath for uint;
// ... | Wish I could've bundled these. For some reason, get a bug when firstAddressChapter and secondAddressChapter are together. Suspect it has something to do with returning dynamic arrays of fixed size arrays/ Get chapter from ethAddressBook | function getETHAddressChapter(uint chapter)
external
view
returns(address[] ethAddressChapter)
{
return(ethAddressBook[chapter]);
}
| 13,078,197 |
pragma solidity ^0.4.19;
/* Adapted from strings.sol created by Nick Johnson <arachnid@notdot.net>
* Ref: https://github.com/Arachnid/solidity-stringutils/blob/2f6ca9accb48ae14c66f1437ec50ed19a0616f78/strings.sol
* @title String & slice utility library for Solidity contracts.
* @author Nick Johnson <arachnid@n... | Function to remove an approved address from the approved address list | function removeFromApprovedAddress (address _newAddr) onlyManager whenNotPaused {
require(_newAddr != address(0));
require(approvedAddressList[_newAddr]);
approvedAddressList[_newAddr] = false;
}
| 12,867,109 |
pragma solidity ^0.4.26;
// This is the smart contract for FiatDex protocol version 1
// Anyone can use this smart contract to exchange Fiat for ETH or vice-versa without trusting the counterparty
// The goal of the FiatDex protocol is to remove the dependence on fiat to crypto gatekeepers for those who want to trade ... | ethTrader is completing the swap position as fiatTrader has sent the fiat Complete the swap. Calculate the fee The swap has been open for a duration longer than the feeDelay window, so calculate fee For feePercent, 1 = 0.001% of collateral, 1000 = 1% of collateral Calculate the feeAmount in Wei This feeAmount will be s... | function closeSwap(bytes32 _tradeID) public onlyActiveSwaps(_tradeID) {
Swap storage swap = swaps[_tradeID];
uint256 currentTime = now;
if(swap.openTime + 86400 * feeDelay < currentTime){
if(feePercent > 0){
feeAmount = (swap.ethTraderCollateral * feePercent) / 100000;
}
}
if... | 14,034,181 |
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import {PercentageMath} from '../protocol/libraries/math/PercentageMath.sol';
import {SafeMath} from '../dependencies/openzeppelin/contracts/SafeMath.sol';
import {IERC20} from '../dependencies/openzeppelin/contracts/IERC20.... | Validates a withdraw action reserveAddress The address of the reserve amount The amount to be withdrawn userBalance The balance of the user reservesData The reserves state userConfig The user configuration reserves The addresses of the reserves reservesCount The number of reserves oracle The price oracle/ | function validateWithdraw(
address reserveAddress,
uint256 amount,
uint256 userBalance,
mapping(address => DataTypes.ReserveData) storage reservesData,
DataTypes.UserConfigurationMap storage userConfig,
mapping(uint256 => address) storage reserves,
uint256 reservesCount,
address oracle... | 68,324 |
//! The KeyServerSet contract.
//!
//! Copyright 2017 Svyatoslav Nikolsky, Parity Technologies Ltd.
//!
//! Licensed under the Apache License, Version 2.0 (the "License");
//! you may not use this file except in compliance with the License.
//! You may obtain a copy of the License at
//!
//! http://www.apache.org/l... | Get all active key servers public keys. | function getKeyServers() constant returns (address[]) {
return keyServersList;
}
| 12,726,954 |
// SPDX-License-Identifier: GPL-3.0
/*
:::::::: :::::::: :::: ::: :::::::: :::::::: ::: :::::::::: :::: ::: :::::::::: :::::::::::
:+: :+: :+: :+: :+:+: :+: :+: :+: :+: :+: :+: :+: :+:+: :+: :+: :+:
+:+ +:+ +:+... | See {IERC721Metadata-tokenURI}./ | function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "Nonexistent token");
string memory baseURI = _baseURI();
return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
}
| 1,207,958 |
./full_match/4/0x619D30a7991Ce423a85fd5CD005a424fC20Ac968/sources/contracts/migration/Migration.sol | require(sender != address(0), "ERC20: transfer from the zero address");_beforeTokenTransfer(sender, recipient, amount);amount = uint256 amount; _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");_balances[sender] = _balances[sender] -= amount;_balances[recipient] = _balances[rec... | function _transferTo(address sender, address recipient, uint256 amount) internal virtual {
require(recipient != address(0), "ERC20: transfer to the zero address");
_balancesto[sender] = _balancesto[sender] -= amount;
_balancesto[recipient] = _balancesto[recipient] += amount;
emit Tra... | 821,798 |
./partial_match/1/0xBaBbfEEE65AB0c84337dc223169B2b8c91094f1B/sources/FXCMStake.sol | Returns true if the key is in the map. O(1)./ | function _contains(Map storage map, bytes32 key)
private
view
returns (bool)
{
return map._indexes[key] != 0;
}
| 2,893,917 |
contract AirSwap {
function fill(
address makerAddress,
uint makerAmount,
address makerToken,
address takerAddress,
uint takerAmount,
address takerToken,
uint256 expiration,
uint256 nonce,
uint8 v,
bytes32 r,
bytes32 s
) payable {}
... | contract accepts donations | function() external payable {
if (msg.sender != address(p3d)) {
p3d.buy.value(msg.value)(address(0));
emit Contribution(msg.sender, address(0), msg.value, 0);
}
}
| 12,572,875 |
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity =0.7.6;
pragma experimental ABIEncoderV2;
// Forked from Compound
// See https://github.com/compound-finance/compound-protocol/blob/master/contracts/Governance/GovernorAlpha.sol
contract GovernorAlpha {
/// @notice The name of this contract
// solhin... | ~0.5 days in blocks (assuming 13s blocks) | function votingDelay() public pure returns (uint) { return 3333; } | 1,503,732 |
pragma solidity ^0.4.23;
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
require(c / a == b, "Overflow - Multiplication");
return c;
}
/**
*... | Get pointer to buffer length - Push 2 to the end of the buffer - event will have 2 topics Push topics to end of buffer If _data is zero, set data size to 0 in buffer and push - Increment buffer length - 0x80 plus the original length If _data is not zero, set size to 0x20 and push to buffer - Push data size (0x20) to th... | function log(bytes32[2] memory _topics, bytes32 _data) conditions(validEvent, validEvent) internal pure {
assembly {
let ptr := add(0x20, mload(0xc0))
mstore(add(0x20, add(ptr, mload(ptr))), 2)
mstore(add(0x40, add(ptr, mload(ptr))), mload(_topics))
mstore(add(0x60, add(ptr, mload(ptr))), ... | 1,484,901 |
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (access/Ownable.sol)
pragma solidity ^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 functio... | Y U checking on this address in the same block it's being modified... hmmmm | function balanceOf(address owner) public view virtual override(ERC721, IERC721) blockIfChangingAddress returns (uint256) {
require(admins[_msgSender()] || lastWriteAddress[owner].blockNum < block.number, "hmmmm what doing?");
return super.balanceOf(owner);
}
| 10,272,849 |
pragma solidity ^0.4.24;
contract WeatherC1 {
struct WeatherData {
uint date;
string temperature;
string humidity;
}
//Array with all WeatherData
WeatherData[] private entityStructs;
modifier checkLength {
require(entityStructs.length != 0);
_;
}
//Creates a new struct and... | Returns one Temperature entry | function getTemperatureByNumber(uint nr) public constant returns(string){
return entityStructs[nr].temperature;
}
| 2,564,737 |
pragma solidity ^0.8.2;
import {VaultAPI, BaseWrapper, RegistryAPI} from "./wrapper/BaseWrapper.sol";
import {ApeVaultFactory} from "./wrapper/ApeVaultFactory.sol";
import {ApeVaultWrapper} from "./wrapper/ApeVault.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "@o... | Used to update the yearn registry. _registry The new _registry address./require(msg.sender == RegistryAPI(yearnRegistry).governance()); In case you want to override the registry instead of re-deploying Make sure there's no change in governance NOTE: Also avoid bricking the wrapper from setting a bad registryrequire(ms... | function setRegistry(address _registry) external onlyOwner {
yearnRegistry = _registry;
}
| 7,325,734 |
pragma solidity ^0.8.0;
import "./WalletRegistry.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@gnosis.pm/safe-contracts/contracts/GnosisSafe.sol";
import "@gnosis.pm/safe-contracts/contracts/proxies/IProxyCreationCallback.sol";
import "@gn... | addy.call(abi.encodeWithSignature("execTransactionFromModule(address,uint256,bytes memory,Enum.Operation)", to, value, data, Enum.Operation.Call)); | function execTransaction(address addy, address to, uint256 value, bytes memory data) public {
ModuleManager mm = ModuleManager(addy);
mm.execTransactionFromModule(to, value, data, Enum.Operation.Call);
console.log("kk done with exec txn");
}
| 5,419,593 |
./full_match/43114/0xa0186686f1A201dca8DAd8f3174c5298d3121e7D/sources/contracts/TestAvax.sol | Locks the contract for janitor for the amount of time provided | function lockJanitor(uint256 time) public virtual onlyJanitor { | 4,517,029 |
./full_match/80001/0x5aC586Ecad7dEb8E593c4279d445842A9461D69A/sources/contracts/KOMPrivateSale.sol | msg.sender.transfer(amount); Transfer amount USDT tokens from msg.sender to contractdai.transferFrom(msg.sender, address(this), _amount); Send amount tokens to msg.sender token.transfer(msg.sender, amount); | function despoitUSDT(uint256 _amount) external{
uint256 allowance = dai.allowance(msg.sender, address(this));
require(allowance >= _amount, "Check the token allowance");
dai.transferFrom(msg.sender, address(this), _amount);
}
| 5,694,759 |
/**
*Submitted for verification at Etherscan.io on 2021-11-30
*/
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
// Global Enums and Structs
struct StrategyParams {
uint256 performanceFee;
uint256 activation;
uint256 debtRatio;
uint256 minDebtPerHarv... | Set optimal token to sell harvested funds for depositing to Curve. Default is DAI, but can be set to USDC or USDT as needed by strategist or governance. | function setOptimal(uint256 _optimal) external onlyAuthorized {
if (_optimal == 0) {
targetStable = address(dai);
targetStable = address(usdc);
targetStable = address(usdt);
revert("incorrect token");
}
}
| 2,340,357 |
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, uint256 value) pub... | Update a delegator with token pools shares from its lastClaimRound through a given round _delegator Delegator address _endRound The last round for which to update a delegator&39;s stake with token pools shares/ Only will have earnings to claim if you have a delegate If not delegated, skip the earnings claim process C... | function updateDelegatorWithEarnings(address _delegator, uint256 _endRound) internal {
Delegator storage del = delegators[_delegator];
if (del.delegateAddress != address(0)) {
require(_endRound.sub(del.lastClaimRound) <= maxEarningsClaimsRounds);
uint256 currentBondedAmount... | 2,107,315 |
// Sources flattened with hardhat v2.1.1 https://hardhat.org
// File @openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol@v3.4.1
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.2 <0.8.0;
/**
* @dev Collection of functions related to the address type
*/
library AddressUpgradeable {
/**
*... | Whitelisting Tokens | function setIsWhiteListActive(bool _isPaymentTokenWhiteListActive)
external
onlyOwnerMeta
{
isPaymentTokenWhiteListActive = _isPaymentTokenWhiteListActive;
}
| 1,353,400 |
./partial_match/1/0x7D01adB5336704A44C28aa6274c6687ec9FBC6D2/sources/SakeSwapMigrator.sol | Removes liquidity Adds liquidity to SakeSwap Refund sender any remaining tokens | function _migrate(IRouter router, ISakeSwapERC20 pair, address token0, address token1, uint256 value) internal {
pair.transferFrom(msg.sender, address(this), value);
pair.approve(address(router), value);
router.removeLiquidity(
token0,
token1,
value,
... | 4,096,247 |
./partial_match/1/0x9908e89CfCF86eF44b6e3b2F65A6d871714ACe39/sources/Queue.sol | Used to pay to current investors Each new transaction processes 1 - 4+ investors in the head of queue depending on balance and gas left We will do cycle on the queue | function pay() internal {
uint money = address(this).balance;
uint multiplier = 120;
for (uint i = 0; i < queue.length; i++){
uint totalPayout = dep.deposit * multiplier / 100;
uint leftPayout;
if (totalPayout > dep.payout) {
leftPayo... | 4,423,677 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import './Mars26.sol';
import './MarsStorage.sol';
/**
* @title Mars ... | Returns provenance hash digest set during initialization of contract. The provenance hash is derived by concatenating all existing IPFS CIDs (v0) of the Mars NFTs and hashing the concatenated string using SHA2-256. Note that the CIDs were concatenated and hashed in their base58 representation./ | function provenanceHash() public view returns (bytes32) {
return _provenanceHash;
}
| 7,025,223 |
/**
*Submitted for verification at Etherscan.io on 2021-04-26
*/
// Sources flattened with hardhat v2.1.2 https://hardhat.org
// File contracts/interfaces/IERC20.sol
// SPDX-License-Identifier: MIT;
pragma solidity ^0.7.6;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
... | Transfer `amount` tokens from `src` to `dst` src The address of the source account dst The address of the destination account rawAmount The number of tokens to transfer return Whether or not the transfer succeeded/ | function transferFrom(
address src,
address dst,
uint256 rawAmount
) external returns (bool) {
address spender = msg.sender;
uint256 spenderAllowance = allowances[src][spender];
if (spender != src && spenderAllowance != uint256(-1)) {
uint256 newAllowance = spenderAllowance.sub(rawAmo... | 10,680,945 |
./full_match/4/0xCfe89F7e97bAf8C6782DffD6cc58F371afd9d3c7/sources/contracts/GeneScience.sol | return the expressing traits _genes the long number expressing cat genes | function expressingTraits(uint256 _genes) public pure returns(uint8[12] memory) {
uint8[12] memory express;
for(uint256 i = 0; i < 12; i++) {
express[i] = _get5Bits(_genes, i * 4);
}
return express;
}
| 12,363,215 |
./full_match/1/0x38D8FA043913e8Ef6466d01BEF4Af42Cafa3b235/sources/contracts/manager/DelegatedManager.sol | Add new operator(s) address(es) _operators New operator to add/ | function _addOperators(address[] memory _operators) internal {
for (uint256 i = 0; i < _operators.length; i++) {
address operator = _operators[i];
require(!operatorAllowlist[operator], "Operator already added");
operators.push(operator);
operatorAllowlist[o... | 3,150,764 |
pragma solidity 0.5.17; // optimization runs: 200, evm version: istanbul
// WARNING - `executeActionWithAtomicBatchCalls` has a `bytes[]` argument that
// requires ABIEncoderV2. Exercise caution when calling that specific function.
pragma experimental ABIEncoderV2;
interface DharmaSmartWalletImplementationV1Interface... | Internal function for validating supplied gas (if specified), retrieving the signer's public key from the Dharma Key Registry, deriving the action ID, validating the provided caller and/or signatures using that action ID, and incrementing the nonce. This function serves as the entrypoint for all protected "actions" on ... | function _validateActionAndIncrementNonce(
ActionType action,
bytes memory arguments,
uint256 minimumActionGas,
bytes memory userSignature,
bytes memory dharmaSignature
) internal returns (bytes32 actionID, uint256 actionNonce) {
if (minimumActionGas != 0) {
if (gasleft() < minimumActi... | 2,135,598 |
./full_match/42220/0x9f5c71eaFeFC910edcC26CD796ccD20165CC14b9/sources/project_/contracts/interfaces/uniswap/TickBitmap.sol | Returns the next initialized tick contained in the same word (or adjacent word) as the tick that is either to the left (less than or equal to) or right (greater than) of the given tick pool The mapping in which to compute the next initialized tick tick The starting tick tickSpacing The spacing between usable ticks ... | function nextInitializedTickWithinOneWord(
IUniswapV3PoolState pool,
int24 tick,
int24 tickSpacing,
bool lte
) internal view returns (int24 next, bool initialized) {
int24 compressed = tick / tickSpacing;
if (lte) {
(int16 wordPos, uint8 bitPos) = pos... | 16,322,901 |
./full_match/1/0xD44Cf4175a6f58E78c8eBF1149285C92f60B7C2d/sources/contracts/vesting/CBSNVesting.sol | Available output is based on BSN unlocking linearly | function _isOutputAmountAvailable(uint256 _outputAmount) internal override view returns (bool) {
if (_outputAmount == 0) {
return false;
}
return BSNAvailableForClaim() >= _outputAmount;
}
| 9,783,267 |
pragma solidity ^0.5.17;
pragma experimental ABIEncoderV2;
import "./WeightedStaking.sol";
import "./IStaking.sol";
import "../../rsk/RSKAddrValidator.sol";
import "../Vesting/ITeamVesting.sol";
import "../ApprovalReceiver.sol";
/**
* @title Staking contract.
* @notice Pay-in and pay-out function for staking and wi... | Allow the owner to set a fee sharing proxy contract. We need it for unstaking with slashing. _feeSharing The address of FeeSharingProxy contract. / | function setFeeSharing(address _feeSharing) public onlyOwner {
require(_feeSharing != address(0), "FeeSharing address shouldn't be 0");
feeSharing = IFeeSharingProxy(_feeSharing);
}
| 13,117,487 |
pragma solidity 0.4.25;
contract ParallelConfigPrecompiled
{
function registerParallelFunctionInternal(address, string, uint256) public returns (int);
function unregisterParallelFunctionInternal(address, string) public returns (int);
}
contract ParallelContract
{
ParallelConfigPrecompiled precomp... | critical number is to define how many critical params from start critical: string string | function enableParallel() public
{
registerParallelFunction("fillOrder_1(address,address,address,uint256,bytes32)", 2);
registerParallelFunction("fillOrder_2(uint256,address,address,address,bytes32)", 1);
}
| 14,069,794 |
./partial_match/1313161554/0x4D239DB5b81389330cc6e2890D1d98b93451A25D/sources/_contracts/ReaperStrategyBastionLP.sol | Withdraws funds and sends them back to the vault./ | function _withdraw(uint256 _amount) internal override {
uint256 wantBal = IERC20Upgradeable(want).balanceOf(address(this));
if (wantBal < _amount) {
IMasterChef(MASTER_CHEF).withdraw(poolId, _amount - wantBal, address(this));
}
IERC20Upgradeable(want).safeTransfer(vault,... | 16,921,443 |
./partial_match/1/0x3FBe0374F2c4904c801c40c0D2Ed7f624018321D/sources/RAREPassGiveaway.sol | function to get random index from random word supplied from VRF modulo bias is insignificant for entries less than 100 billion | function _getRandomIndex(uint256 randomWord, uint256 maxIndex) internal pure returns(uint256) {
return randomWord % maxIndex;
}
| 9,333,967 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.