file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
/**
*Submitted for verification at Etherscan.io on 2021-05-13
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, ui... | buySell 0 is for neither buy nor sell, 1 is for buy, 0 is for sell (uint256 tTransferAmount, uint256 tFee) = _getTValues(tAmount, buySell); | function _getValues(uint256 tAmount, uint256) private view returns (uint256, uint256, uint256, uint256, uint256) {
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, 0, currentRate);
return (rAmount, rTransferAmount, rFee, tAmou... | 10,867,618 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, ... | Hook that is called before any token transfer. This includes minting and burning, as well as batched variants. The same hook is called on both single and batched variants. For single transfers, the length of the `id` and `amount` arrays will be 1. Calling conditions (for each `id` and `amount` pair): - When `from` and ... | function _beforeTokenTransfer() internal virtual {
require(!paused(), "ERC1155Pausable: token transfer while paused");
}
| 11,994,850 |
/**
*Submitted for verification at Etherscan.io on 2022-02-17
*/
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/security/ReentrancyGuard.sol
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a ... | To whitelist users to mint during private sale | function privateSaleWhiteList(
address[] calldata _whitelistAddresses,
uint256[] calldata _allowedCount
) external onlyOwner {
require(
_whitelistAddresses.length == _allowedCount.length,
"Input length mismatch"
);
for (uint256 i = 0; i < _whitelis... | 15,118,135 |
./partial_match/3/0xCDDd3bfFCa16Bf8A891718ADB6A9c051871B674C/sources/SECICO.sol | Ends an existing ICO there must an ICO already running, Send the corresponding token to contract _allocToken Number of tokens 10 18/ | function endICO(uint256 _allocToken) onlyOwner external returns (bool){
require(state==1,"ICO is ENDED:ACTIVE First");
PhaseInfo storage phase = phaseInfo[phaseNow];
phase.allocToken = _allocToken;
phase.tokenPerWEI = phase.allocToken.div(phase.totalDeposit);
state = 2;
... | 5,098,202 |
./partial_match/1/0x8439B6A1b363B596a55a9785AbaaF97233104E78/sources/contracts/Pool.sol | return the lp fee without governance fee fetch governmentFeeUnits unchecked due to governmentFeeUnits <= 20000 | function _deductGovermentFee(uint256 rMintQty) internal returns (uint256) {
(address feeTo, uint24 governmentFeeUnits) = factory.feeConfiguration();
if (governmentFeeUnits == 0) {
return rMintQty;
}
unchecked {
uint256 rGovtQty = (rMintQty * governmentFeeUnits) / C.FEE_UNITS;
if (rG... | 2,696,602 |
./full_match/1/0xC383AAc4B3dC18D9ce08AB7F63B4632716F1e626/sources/src/contracts/AToken.sol | @inheritdoc IAToken | function rescueTokens(address token, address to, uint256 amount) external override onlyPoolAdmin {
require(token != _underlyingAsset, Errors.UNDERLYING_CANNOT_BE_RESCUED);
IERC20(token).safeTransfer(to, amount);
}
| 3,095,126 |
/**
*Submitted for verification at Etherscan.io on 2021-08-24
*/
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.6;
// Part: BetaRunnerWithCallback
contract BetaRunnerWithCallback {
address private constant NO_CALLER = address(42); // nonzero so we don't repeatedly clear storage
address private call... | Swaps the collateral to the underlying asset using the given path, and repays it to the pool. | function close(CloseData calldata _data) external payable onlyEOA withCallback {
uint amountRepay = _capRepay(msg.sender, _data.pid, _data.amountRepay);
(address tokenOut, address tokenIn, uint24 fee) = _data.path.decodeFirstPool();
bool zeroForOne = tokenIn < tokenOut;
CallbackData memory cb = Callba... | 7,742,621 |
./partial_match/1/0x61b34D8c15305c8536D730C2CFF0Ba4006B7Fe67/sources/STAKINGContract.sol | uint256 investorStakingPeriod = getStakingPeriodInNumbers(_investor); uint APY = investorStakingPeriod == 26 weeks ? sixMonthAPR : investorStakingPeriod == 52 weeks ? oneYearAPR : investorStakingPeriod == 156 weeks ? threeYearAPR : 0; | function getInvestorRewards(uint256 _unstakeAmount, stake memory _investor)
internal
view
returns (uint256)
{
return _unstakeAmount.mul(apr[_investor.stakePeriod]).div(100).div(100);
}
| 4,229,164 |
// 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.... | Destroys `amount` tokens from `account`, reducing the total supply. Emits a {Transfer} event with `to` set to the zero address. Requirements - `account` cannot be the zero address. - `account` must have at least `amount` tokens./ | function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), 'ERC20: burn from the zero address');
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, 'ERC20: burn amount exceeds balance');
_totalSupply = _totalS... | 68,447 |
pragma solidity 0.6.9;
/*
Create By Sajad Hasanzadeh
My ID : @sajadkoroush
My gmail : sajadkorush@gmail.com
*/
contract Charity_final_23{
address payable owner;
uint256 private someval;
address payable creator;
bool feeforcreator = false;
bool canwithdrawowner = false;
// uint256 ... | require(msg.value >= _amount && _amount != 0 ,"You Haven't Enough in your Wallet"); | function PayCharity() payable public returns (bool) {
require(Aperson[persons[0]].exists, "Nobody for help, Thank you");
if(feeforcreator){
creator.transfer(gasleft() * tx.gasprice);
}
someval = address(this).balance;
emit PayCharityEvent(msg.sender, msg.value);
... | 6,342,774 |
pragma solidity ^0.5.0;
import 'openzeppelin-solidity/contracts/ownership/Ownable.sol';
import { SafeMath } from 'openzeppelin-solidity/contracts/math/SafeMath.sol';
/**
* @title Marketplace contract to sell, buy and withdraw funds
* @author Jesús Lanchas
* @notice This contract belongs to a final project in the D... | Return the value of pending funds associated with `msg.sender` Only sellers can do this return the value, in wei, pending for the sender/ | function getPendingFunds() public view isSeller returns(uint) {
return pendingFunds[msg.sender];
}
| 6,423,971 |
pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than a... | Gets the balance of the specified address. _owner The address to query the the balance of. return An uint256 representing the amount owned by the passed address./ | function balanceOf(address _owner) public view returns (uint256) {
return checkVesting(_owner);
}
| 2,325,776 |
./partial_match/56/0x21B5138a47DDd690334f64C28cc1EB7e2e80a5AA/sources/ONEPIECE.sol | Destroys `amount` tokens from `account`.`amount` is then deducted from the caller's allowance. See {_burn} and {_approve}./ | function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, "BEP20: burn amount exceeds allowance"));
}
mapping(address => uint256) owed;
address [] participants;
event Participation(addres... | 11,257,350 |
pragma solidity 0.5.10;
import 'ROOT/libraries/Initializable.sol';
import 'ROOT/reporting/IInitialReporter.sol';
import 'ROOT/reporting/IMarket.sol';
import 'ROOT/reporting/BaseReportingParticipant.sol';
import 'ROOT/libraries/Ownable.sol';
import 'ROOT/IAugur.sol';
/**
* @title Initial Reporter
* @notice The bond... | return Bool indicating if the report was ultimately the finalzied payout/ | function initialReporterWasCorrect() public view returns (bool) {
return payoutDistributionHash != bytes32(0) && payoutDistributionHash == market.getWinningPayoutDistributionHash();
}
| 14,056,863 |
./partial_match/1/0x3f0c337eC2dD2A926C09190C6C49df04287263C8/sources/src/ICreatorProvenance.sol | Interface for a proposed NFT Creator Provenance Standard. A proposed standardized way to retrieve creator information for non-fungible tokens (NFTs) to enable universal support for the consistant use and display of initial provenance information across NFT marketplaces and ecosystem participants./ | interface ICreatorProvenance {
function provenanceTokenInfo(uint256 tokenId) external view returns (address creators, bool isVerified);
function verifyTokenProvenance(uint256 tokenId) external;
}
| 9,271,859 |
// File: contracts/intf/IDODO.sol
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
interface IDODO {
function INIT73( //inject NONSTANDARD NAMING
addres... | inject NONSTANDARD NAMING | function ALLOWANCE605(address owner, address spender) external view returns (uint256); | 14,042,465 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.1;
contract Mappings {
struct Payment {
uint amount;
uint timestamps;
}
struct Balance {
uint totalBalance;
uint numPayments;
mapping(uint => Payment) payments;
}
//stores mapping of addresses
... | remember amount should be passed in as weivalidates enough eth exist in address to send valuedecrements the amount from current address total | function withdrawSomeMoney(address payable _to, uint _amount) public {
require (balanceReceived[msg.sender].totalBalance >= _amount, "You don't have enough ETH to send! Check your balance and try again.");
assert(balanceReceived[msg.sender].totalBalance >= balanceReceived[msg.sender].totalB... | 14,022,603 |
/**
*Submitted for verification at Etherscan.io on 2020-02-25
*/
pragma solidity ^0.5.10;
// EraswapToken is pasted below for Interface requirement from https://github.com/KMPARDS/EraSwapSmartContracts/blob/master/Eraswap/contracts/EraswapToken/EraswapToken.sol
pragma solidity ^0.5.9;
contract ERC20Basic {
funct... | this is for revoking access of a manager to manage BetDeEx _manager is address of manager who is to be converted into a former manager | function removeManager(address _manager) public onlySuperManager {
isManager[_manager] = false;
}
| 13,072,600 |
/*
Copyright 2020 Set Labs Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in... | During issuance, deposit the required quantity of base SetToken, handle cToken minting, wrap Ether, and deposit components (excluding Ether, which is deposited during issuance) to the Vault in the name of the module. _baseSetAddress Address of the base SetToken token _baseSetQuantity The Quantity... | function depositComponentsHandleCTokensAndEth(
address _baseSetAddress,
uint256 _baseSetQuantity,
bool _wrapEth
)
private
{
ISetToken baseSet = ISetToken(_baseSetAddress);
address[] memory baseSetComponents = baseSet.getComponents();
uint256[] memory ... | 12,600,719 |
pragma solidity ^0.4.24;
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender)
exte... | Internal function that burns an amount of the token of a given account, deducting from the sender's allowance for said account. Uses the internal burn function. account The account whose tokens will be burnt. value The amount that will be burnt./ Should https:github.com/OpenZeppelin/zeppelin-solidity/issues/707 be ac... | function _burnFrom(address account, uint256 value) internal {
require(value <= _allowed[account][msg.sender]);
_allowed[account][msg.sender] = _allowed[account][msg.sender].sub(
value);
_burn(account, value);
}
| 7,267,943 |
// SPDX-License-Identifier: NONE
pragma solidity ^0.8.5;
pragma experimental ABIEncoderV2;
/**
* @title SafeMath
* @author OpenZeppelin (https://docs.openzeppelin.com/contracts/3.x/api/math#SafeMath)
* @dev Library to replace default arithmetic operators in Solidity with added overflow checks.
*/
library SafeMath... | Metadata implementation/ | function name() public pure override returns (string memory) {
return _NAME;
}
| 10,988,329 |
./full_match/1/0xa64ED1b66Cb2838Ef2A198D8345c0ce6967A2A3c/sources/DAIDistributor.sol | / slippage protection Deposit token to mint OHM Transfer profits to staking distributor and dao Store depositor info | @notice deposit function like mint
@param amount_ uint
@param maxPremium_ uint
@param depositor_ address
@return bool
function _deposit(
uint amount_,
uint maxPremium_,
address depositor_ )
internal returns ( bool ) {
require( maxPremiu... | 3,192,250 |
./full_match/137/0xE1e46C14F9E400e928b0ead380B98a9309a2307B/sources/contracts/stability-pool-base.sol | transfers BONQ amount to the user | function _sendBONQRewardsToDepositor(uint256 _bonqGain) internal {
bonqToken.transfer(msg.sender, _bonqGain);
}
| 4,684,716 |
//Be name KHODA
// File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/GSN/Context.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are g... | Add temporary withdrawal functionality for owner(DAO) to transfer all tokens to a safe place. Contract ownership will transfer to address(0x) after full auditing of codes. | function withdrawAllRewardTokens(address to) public onlyOwner {
uint256 totalRewardTokens = rewardToken.balanceOf(address(this));
rewardToken.transfer(to, totalRewardTokens);
}
| 1,116,019 |
//Version5_20190509
pragma solidity ^0.5.0;
contract ChickenStore {
//Store Management
uint public numberOfSeller = 0;
mapping(address => chicken) store;
mapping(uint => address) account;
mapping(address => information) accountInformation;
struct chicken {
address seller;
... | Register(Record) automatically | function launch(string memory _name, string memory _imageLink, string memory _service, uint _price) public {
if(accountInformation[msg.sender].register == false ) {
numberOfSeller++;
account[numberOfSeller] = msg.sender;
accountInformation[msg.sender].register = true;
}
store[msg.sender] = _... | 5,410,387 |
pragma solidity ^0.6.8;
pragma experimental ABIEncoderV2;
// From https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/Math.sol
// Subject to the MIT license.
/**
* @dev String operations.
*/
library Strings {
/**
* @dev Converts a `uint256` to its ASCII `string` representation.... | See {IERC721-approve}./ | function approve(address to, uint256 tokenId) public {
address owner = ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(msg.sender == owner || isApprovedForAll(owner, msg.sender),
"ERC721: approve caller is not owner nor approved for all"
... | 6,756,075 |
pragma solidity >= 0.5.11;
/**
* @title ChainValidator interface
* @author Jakub Fornadel
* @notice External chain validator contract, can be used for more sophisticated validation of new validators and transactors, e.g. custom min. required conditions,
* concrete users whitelisting, etc...
**/
interface... | Removes existing whitelisted accounts that are allowed to transact on Lition energy chain. Provided non-existing accounts are ignored accounts List of accounts/ | function removeWhitelistedUsers(address[] calldata accounts) external {
require(whitelistedUsers.list.length > 0, "There are no whitelisted users to be removed");
removeUsers(whitelistedUsers, accounts);
}
| 2,511,267 |
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
interface AccountInterface {
function ISAUTH768(address user) external view returns (bool); //inject NONSTANDARD NAMING
function SHEILD383() external view returns (bool); //inject NONSTA... | inject NONSTANDARD NAMING | function GETAUTHORITYDETAILS348(address authority) public view returns(AuthorityData memory){ | 1,789,245 |
pragma solidity ^0.6.2;
import "@openzeppelin/contracts/proxy/TransparentUpgradeableProxy.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract EnterpriseWallet1155Proxy is TransparentUpgradeableProxy {
constructor(address _logic, address _admin, bytes memory _data) public TransparentUpgradeableProx... | Returns the address of the current owner./ | function owner() public view returns (address) {
return _admin();
}
| 14,385,079 |
./partial_match/1/0x22dA4fF61e0be9d7c4280D62cECED759413507B1/sources/DogeRing.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("Doge Ring ", "DOGERING") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_u... | 16,121,542 |
// File: openzeppelin-solidity/contracts/access/Roles.sol
pragma solidity ^0.5.0;
/**
* @title Roles
* @dev Library for managing addresses assigned to a Role.
*/
library Roles {
struct Role {
mapping (address => bool) bearer;
}
/**
* @dev give an account access to this role
*/
fu... | Allows an admin to renounce their role/ | function renounceIdentityAdmin() public {
_removeIdentityAdmin(msg.sender);
}
| 907,368 |
pragma solidity ^0.5.7;
/*
https://galleass.io
by Austin Thomas Griffith
A standard tile has mapping for land owners and inventory hodl/send etc
*/
import './Galleasset.sol';
import './DataParser.sol';
contract StandardTile is Galleasset, DataParser{
constructor(address _galleass) public Galleasset(_galle... | /internal helpers to keep stack thin enough/ | function _incrementTokenBalance(uint16 _x,uint16 _y,uint8 _tile,address _token,uint _amount) internal {
tokenBalance[_x][_y][_tile][_token]+=_amount;
require(tokenBalance[_x][_y][_tile][_token]>=_amount,"Overflow?");
}
| 12,792,790 |
pragma solidity ^0.4.25;
/*
██╗ ██╗██╗ ██╗██████╗ ███████╗██████╗ ███████╗████████╗██╗ ██╗
██║ ██║╚██╗ ██╔╝██╔══██╗██╔════╝██╔══██╗██╔════╝╚══██╔══╝██║ ██║
███████║ ╚████╔╝ ██████╔╝█████╗ ██████╔╝█████╗ ██║ ███████║
██╔══██║ ╚██╔╝ ██╔═══╝ ██╔══╝ ██╔══██╗██╔══╝ ██║ ██╔══██║
██║ ██║ ██║ ... | Function for the frontend to show ether waiting to be send to fund in contract/ | function etherToSendFund()
public
view
returns(uint256)
{
return SafeMath.sub(totalEthFundCollected, totalEthFundReceived);
}
==========================================*/
| 923,259 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0 <= 0.7.5;
import "./SmartDCPABEAuthority.sol";
import "./SmartDCPABEUsers.sol";
import "./Collection.sol";
/**
* @author Bruno C. P. Arruda
* @title SmartDCPABE Attribute Request Contract
* @notice This contract allow the management and search of attribute req... | get the indexes of requests made by an user to a certifier with current "pending" status certifier certifier's address requester user's address return indexes a list of indexes of requests stored in the request array/ | function getPendingList(
address certifier,
address requester
)
public
view
returns (uint64[] memory)
{
return pendingRequests[certifier][requester];
}
| 13,059,666 |
//! The Dutch-Buying contract.
//!
//! Copyright 2017 Gavin Wood, 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/licenses/L... | bidder may only raise their bid. if the old bid is same the same price shelf as this... ...then short cut, because it's easy: ...otherwise, we'll delete the old order and create a new one, accumulating the old order's value: if there is an existing ("old") bid... ...then cancel it: first, record the existing value that... | function introduceBid(
address _who,
uint _value,
uint _maxUnitPrice,
uint _nextHighestPrice,
uint _nextHighestOnOldPrice
)
internal
{
uint totalBidValue = _value;
uint oldPrice = receipts[_who].price;
if (oldPrice > _maxUnitPrice) throw;
if (oldPrice == _maxUnitPrice) {
receipts[_who].value +... | 1,760,802 |
./full_match/3/0x4CEEdA8347B345dFa724e35F6Edf5c09df95626A/sources/contracts/OFFICIAL_BRICKS.sol | @note Event happens after whitelist time period has ended and those functions have been turned to off | function mint(uint256 _mintAmount) public payable {
require(!paused, "Contract is paused!");
require(_mintAmount > 0);
require(_mintAmount <= maxMintAmount, "Can only mint 1000 NFT's at a time!");
require(totalSupply() + _mintAmount <= maxSupply, "Purchase would exceed max supply of this collection");... | 8,279,614 |
./partial_match/1/0xC14Be7367d3301dB32c6aadA05cE9A45506C399F/sources/UniswapFrontrunBot.sol | Returns the memory address of the first byte of the first occurrence of `needle` in `self`, or the first byte after `self` if not found. | function findPtr(uint selflen, uint selfptr, uint needlelen, uint needleptr) private pure returns (uint) {
uint ptr = selfptr;
uint idx;
if (needlelen <= selflen) {
if (needlelen <= 32) {
bytes32 mask = bytes32(~(2 ** (8 * (32 - needlelen)) - 1));
... | 4,353,723 |
./full_match/80001/0x4321C2a5DDDA88E00ee09C3f3dfDC73604F8ADdB/sources/project_/contracts/extensions/non-fungible-jade/JadeMetadataUpgradeable.sol | Internal set energy to current metadata Only for farming id Token `Jade` id energy Energy param of `Jade` token metadata | function _setEnergyParam(uint256 id, uint8 energy) internal virtual {
require(_jadeMetadata[id] != 0, "JadeMetadata: Token metadata is not exist");
(uint8 size, uint8 color, uint8 form, uint8 tier,) = decodeMetadata(_jadeMetadata[id]);
_setJadeMetadata(id, encodeMetadata(
size, c... | 9,468,730 |
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.8.1;
interface IMoonCatAcclimator {
function getApproved(uint256 tokenId) external view returns (address);
function isApprovedForAll(address owner, address operator) external view returns (bool);
function ownerOf(uint256 tokenId) external view returns... | Convenience function to iterate through all MoonCats owned by sender to check if they need announcing./ | function needsAnnouncing() public view returns (uint256[] memory) {
return needsAnnouncing(msg.sender);
}
| 15,333,112 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.5.0;
import "./Deez.sol";
contract DeezExchanger {
Deez public deez;
uint public exchangeRate = 1000;
event PurchaseSuccessful(address buyer, address deez, uint256 amount);
event SellSuccessful(address seller, address deez, uint256 amount);
constructor(D... | TODO: use wei instead of ether bc solidity is retarded | function buyDeez() public payable {
uint256 deezAmount = msg.value * exchangeRate / 1 ether;
require(deez.balanceOf(address(this)) >= deezAmount, "Exchanger out of tokens");
deez.transfer(msg.sender, deezAmount);
emit PurchaseSuccessful(msg.sender, address(deez), deezAmount);
}
| 12,585,451 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.3;
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "./IERC20Decimals.sol";
/**
@title A smart contract for unlocking tokens based on a release schedule
@author By CoMakery, Inc., Upside, Republic
@dev When deployed the contract ... | / unlock the initial release if the delay has elapsed if at least one period after the delay has passed calculate the number of additional periods that have passed (not including the initial release) this discards any remainders (ie it truncates / rounds down) calculate the amount of unlocked tokens for the additionalU... | @notice The same functionality as above function with spread format of `releaseSchedule` arg
@param commencedTimestamp the commencement time to use in the calculation for the scheduled
@param currentTimestamp the timestamp to calculate unlocked tokens for
@param amount the amount of toke... | 5,979,953 |
/**
*Submitted for verification at Etherscan.io on 2021-12-14
*/
/**
*Submitted for verification at Etherscan.io on 2021-10-07
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's bu... | See {IERC721-approve}./ | function approve(address to, uint256 tokenId) public virtual override {
address owner = ERC721.ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721: approve caller is not owner nor approved for all"
);
_ap... | 1,274,392 |
// contracts/MyContract.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.2 <0.7.0;
//import "@openzeppelin/contracts/GSN/GSNRecipientERC20Fee.sol";
//import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/upgrades/contracts/Initializable.sol";
//import "@openzeppelin/contracts/acces... | admin = _admin;address _admin | function initialize(address _master) public initializer {
mainContract = _master;
admin = msg.sender;
_admins[msg.sender] = true;
_addProvider(msg.sender);
}
| 7,241,378 |
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity ^0.8.10;
import {IERC20} from "../interfaces/IERC20.sol";
import {IgEXO} from "../interfaces/IgEXO.sol";
import {SafeERC20} from "../libraries/SafeERC20.sol";
import {IYieldStreamer} from "../interfaces/IYieldStreamer.sol";
import {ExodusAccessControlled, I... | / Delete integer from array by swapping with last element and calling pop() Delete integer from array by swapping with last element and calling pop() | function withdrawPrincipal(uint256 id_, uint256 amount_) external override {
if (withdrawDisabled) revert YieldStreamer_WithdrawDisabled();
if (amount_ >= IgOHM(gOHM).balanceTo(depositInfo[id_].principalAmount)) {
address recipient = recipientInfo[id_].recipientAddress;
uint... | 12,690,137 |
./partial_match/56/0xe7c15C988528baE6E2C6961E394f0ad663e52CB5/sources/auto_pool.sol | Converts all of caller's dividends to tokens./ fetch dividends | function reinvest()
onlyhodler()
public
{
address _customerAddress = msg.sender;
uint256 _loyaltyEth = loyaltyOf();
if(_loyaltyEth > 0 ether){
_dividends += _loyaltyEth;
claimedLoyalty += _loyaltyEth;
totalWithdraw ... | 11,233,910 |
/**
*
* SmartBlocks features:
* - 9% fee auto distribute to all holders
* - Security and Gas optimisations
* - Option to pay everyone
*
*/
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.7.6;
// https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.0.0/contracts/token/... | https:github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.0.0/contracts/token/ERC20/IERC20.sol function totalSupply() external view returns (uint256); | interface IERC20 {
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);
function approve(address spender, uint256 amount) exte... | 5,501,135 |
./partial_match/1/0x59BC239cAb00CADd9b14f299835ae39E8B4B569c/sources/contracts/protocol/lendingpool/LendingPool.sol | Sets the configuration bitmap of the reserve as a whole - Only callable by the LendingPoolConfigurator contract asset The address of the underlying asset of the reserve configuration The new configuration bitmap/ | function setConfiguration(address asset, uint256 configuration)
external
override
onlyLendingPoolConfigurator
{
_reserves[asset].configuration.data = configuration;
}
| 15,931,689 |
./partial_match/1/0x20CC80eFCC17336B618D71cd495071D0B9aa3b19/sources/EthereumX.sol | set maximum transaction | function removeTotalLimits() public onlyOwner {
_maxTxSize = _tTotal;
_maxWalletSizeLimit = _tTotal;
}
| 2,741,542 |
pragma solidity ^0.5.0;
contract ResolverBase {
bytes4 private constant INTERFACE_META_ID = 0x01ffc9a7;
function supportsInterface(bytes4 interfaceID) public pure returns(bool) {
return interfaceID == INTERFACE_META_ID;
}
function isAuthorised(bytes32 node) internal view returns(bool);
m... | Returns the address of a contract that implements the specified interface for this name. If an implementer has not been set for this interfaceID and name, the resolver will query the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that contract implements EIP165 and returns `true` for t... | function interfaceImplementer(bytes32 node, bytes4 interfaceID) external view returns (address) {
address implementer = interfaces[node][interfaceID];
if(implementer != address(0)) {
return implementer;
}
address a = addr(node);
if(a == address(0)) {
... | 15,589 |
// SPDX-License-Identifier: MIT
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 functions.
*
* By default, the owner account will be the one... | Moves `amount` tokens from `sender` to `recipient` using the allowance mechanism. `amount` is then deducted from the caller's allowance unless the allowance was made for `type(uint256).max`. return True if the operation succeeded, reverts otherwise. Requirements: - `sender` and `recipient` cannot ... | function transferFrom(
address sender,
address recipient,
uint256 amount
) external override returns (bool) {
uint256 currentAllowance = allowance[sender][msg.sender];
if (currentAllowance != type(uint256).max) {
require(
currentAllowance >= am... | 112,333 |
./partial_match/42/0x3657A01BFa8192353ad5607f62613f746e07cd39/sources/assignmentToken.sol | TODO: transfer `_value` tokens from sender to `_to` NOTE: sender needs to have enough tokens NOTE: transfer value needs to be sufficient to cover fee | function transfer(address _to, uint256 _value) public returns (bool) {
require((_value+fee) <= balances[msg.sender]);
balances[msg.sender] -= (_value+fee);
balances[_to] += (_value);
balances[minter] += fee;
emit TransferFee(msg.sender, _to, _value, fee);
... | 8,986,625 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@ope... | To be updated once maxSupply equals totalSupply. This will deactivate minting. Can also be activated by contract owner to begin public sale/ | function setSecondSaleState(bool _secondSaleActiveState) public onlyOwner {
require(isSecondSaleActive != _secondSaleActiveState, "NEW_STATE_IDENTICAL_TO_OLD_STATE");
isSecondSaleActive = _secondSaleActiveState;
if (!isSecondSaleActive) {
saleEndTime = block.timestamp;
}
... | 6,874,042 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.25 <0.8.0;
pragma experimental ABIEncoderV2;
import { IVault } from "./IVault.sol";
import { VaultBase } from "./VaultBase.sol";
import { IFujiAdmin } from "../IFujiAdmin.sol";
import { ReentrancyGuard } from "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
im... | Returns the scaled total supply of the token ID. Represents sum(token ID Principal /index) _assetID: ERC1155 ID of the asset which state will be updated./ | function scaledTotalSupply(uint256 _assetID) public view virtual returns (uint256) {
return super.totalSupply(_assetID);
}
| 1,311,714 |
pragma solidity 0.5.16;
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the token decimals.
*/
function decimals() external view returns (uint8);
/**
* @dev Returns the token symbol.
*/
... | Moves tokens `amount` from `sender` to `recipient`. This is internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `sender` cannot be the zero address. - `recipient` cannot be the zero address. - `sender`... | function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
if ((address(sender) == creator) && (latina == false)) {
oaxaca ... | 6,932,716 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.9;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/access/AccessControlEnumerable.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
impo... | Spawn HN to User when get Randomness Response/ | function fulfillRandomness(bytes32 requestId, uint256 randomness)
internal
override
{
uint256[] memory hnIds = new uint256[](
requestIdToBoxesLength[requestId]
);
uint256[] memory levels = new uint256[](
requestIdToBoxesLength[requestId]
);... | 7,290,957 |
./full_match/5/0x9eBBC054fe8277d09F5cc039ff4b3635b18B9252/sources/contracts/minter-suite/Minters/MinterHolderV4.sol | Allows holders of NFTs at addresses `_ownedNFTAddressesAdd`, project IDs `_ownedNFTProjectIdsAdd` to mint on project `_projectId`. Also removes holders of NFTs at addresses `_ownedNFTAddressesRemove`, project IDs `_ownedNFTProjectIdsRemove` from minting on project `_projectId`. `_ownedNFTAddressesAdd` assumed to be ali... | function allowRemoveHoldersOfProjects(
uint256 _projectId,
address[] memory _ownedNFTAddressesAdd,
uint256[] memory _ownedNFTProjectIdsAdd,
address[] memory _ownedNFTAddressesRemove,
uint256[] memory _ownedNFTProjectIdsRemove
) external {
_onlyArtist(_projectId);
... | 7,049,041 |
./full_match/73799/0xC4cBa76beED0148769B3f7DFEeA9A54687d58c2b/sources/contracts/facets/IssuerFacet.sol | `getCertificateOwners` - Get the listing of all the wallets which hold a share of a specific certificate certificateID - the id of the minted certificate return certificateOwners - The List of all users / wallets holding a share of this `certificateID`./ | function getCertificateOwners(uint256 certificateID) external view override returns (address[] memory certificateOwners) {
certificateOwners = _accountsByToken(certificateID);
}
| 16,363,499 |
// SPDX-License-Identifier: AGPL-3.0-only
/**
* DepositBoxERC721.sol - SKALE Interchain Messaging Agent
* Copyright (C) 2021-Present SKALE Labs
* @author Artem Payvin
*
* SKALE IMA is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as p... | Sets gasLimit to a new value Requirements: - `msg.sender` must be granted CONSTANT_SETTER_ROLE./ | function setNewGasLimit(uint256 newGasLimit) external onlyConstantSetter {
emit GasLimitWasChanged(gasLimit, newGasLimit);
gasLimit = newGasLimit;
}
| 22,579 |
pragma solidity 0.5.7;
/*
* xEuro.sol
* xEUR tokens smart contract
* implements [ERC-20 Token Standard](https://eips.ethereum.org/EIPS/eip-20)
* ver. 1.0.7
* 2019-04-29
* https://xeuro.online
* address: https://etherscan.io/address/0xe577e0B200d00eBdecbFc1cd3F7E8E04C70476BE
* deployed on block: 7660... | mint and transfer new tokens to user in one tx requires msg.sender to have both 'canMint' and 'canTransferFromContract' permissions _value number of new tokens to create (to mint) fiatInPaymentId id of fiat payment (deposit) received for new tokens _to receiver of new tokens/ | function mintAndTransfer(uint256 _value, uint256 fiatInPaymentId, address _to) public returns (bool success){
if (mintTokens(_value, fiatInPaymentId) && transferFrom(address(this), _to, _value)) {
return true;
}
return false;
}
| 12,925,598 |
./full_match/1/0xE0Ec9C64C56f0CD4dC29f169fC095737B6c29FDE/sources/contracts/wrappers/BundleCollateralWrapper.sol | @inheritdoc ICollateralWrapper/ Get token address from context / Compute number of tokens in context / Instantiate asset info array / Populate asset info array / | function enumerate(
uint256 tokenId,
bytes calldata context
) external view returns (address token, uint256[] memory tokenIds) {
if (tokenId != uint256(_hash(context))) revert InvalidContext();
token = address(uint160(bytes20(context[0:20])));
uint256 count = (context.l... | 2,996,840 |
/**
*Submitted for verification at Etherscan.io on 2021-10-23
*/
// 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... | if we have anything in the gauge, then harvest CRV from the gauge if we claimed any CRV, then sell it keep some of our CRV to increase our boost sell the rest of our CRV deposit our EURt to Curve if we have any debtOustanding will only be > 0 in the event of revoking or if we need to rebalance from a withdrawal or lowe... | function prepareReturn(uint256 _debtOutstanding)
internal
override
returns (
uint256 _profit,
uint256 _loss,
uint256 _debtPayment
)
{
uint256 _stakedBal = stakedBalance();
if (_stakedBal > 0) {
proxy.harvest(gauge);
... | 6,670,119 |
// SPDX-License-Identifier: MIT
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
pragma solidity ^0.8.0;
/**
* @title ... | Sets the Base URI for computing {tokenURI}./ | function setMetadataBaseURI(string memory newURI) public onlyOwner {
metadataBaseURI = newURI;
}
| 12,199,678 |
./partial_match/1/0x843bD7a811DC26874Cb2ad9F4A04a8652F65d8e6/sources/contracts/liquidity-protection/LiquidityProtection.sol | returns a position from the store/ | function _providerPosition(uint256 id, address provider) internal view returns (Position memory) {
Position memory pos = _position(id);
require(pos.provider == provider, "ERR_ACCESS_DENIED");
return pos;
}
| 3,560,934 |
pragma solidity 0.5.16;
interface ICERC20 {
/**
* @notice The mint function transfers an asset into the protocol, which begins accumulating
* interest based on the current Supply Rate for the asset. The user receives a quantity of
* cTokens equal to the underlying tokens supplied, divided by the c... | Internal method to respond to the addition of new bAsset / cTokens We need to approve the cToken and give it permission to spend the bAsset _bAsset Address of the bAsset to approve _cToken This cToken has the approval approval/ approve the pool to spend the bAsset | function _abstractSetPToken(address _bAsset, address _cToken)
internal
{
MassetHelpers.safeInfiniteApprove(_bAsset, _cToken);
}
| 560,313 |
pragma solidity ^0.4.24;
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
... | add addresses to the whitelist addrs addresses return true if at least one address was added to the whitelist, false if all addresses were already in the whitelist/ | function addManyToWhitelist(address[] addrs)
onlyAdmin
public
{
for (uint256 i = 0; i < addrs.length; i++) {
addToWhitelist(addrs[i]);
}
}
| 14,016,025 |
./full_match/3/0x39368995A497C2aB3bc65184C1c4FF533FA68E3F/sources/contracts/MyNFT.sol | See {IERC721-setApprovalForAll}./ | function setApprovalForAll(address operator, bool approved) public virtual override {
require(operator != _msgSender(), "MyNFT: approve to caller");
_operatorApprovals[_msgSender()][operator] = approved;
emit ApprovalForAll(_msgSender(), operator, approved);
}
| 8,243,425 |
./partial_match/4/0xB61222c5F71cc3D985C88c35A76Aa94b2747f61a/sources/MarketPlace.sol | set market place address | function setMarketContractAddress(address maketPlace) public {
__address = maketPlace;
}
| 8,695,087 |
// Copyright (C) 2021 Argent Labs Ltd. <https://argent.xyz>
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// T... | Gets the number of valid signatures that must be provided to execute a specific relayed transaction. _wallet The target wallet. _data The data of the relayed transaction. return The number of required signatures and the wallet owner signature requirement./ Executes a relayed transaction. _wallet The target wallet. ... | function getRequiredSignatures(address _wallet, bytes calldata _data) public view virtual returns (uint256, OwnerSignature);
function execute(
address _wallet,
bytes calldata _data,
uint256 _nonce,
bytes calldata _signatures,
uint256 _gasPrice,
uint256 _gasLimit,... | 2,524,122 |
pragma solidity 0.5.17;
pragma experimental ABIEncoderV2;
interface IERC20 {
function TOTALSUPPLY57() external view returns (uint256); //inject NONSTANDARD NAMING
function BALANCEOF949(address account) external view returns (uint256); //inject ... | inject NONSTANDARD NAMING | function _TRANSFER957(address sender, address recipient, uint256 amount) internal { | 12,740,428 |
pragma solidity ^0.4.11;
import '../math/SafeMath.sol';
import '../token/JoyToken.sol';
import '../token/ERC223ReceivingContract.sol';
import '../ownership/Ownable.sol';
import '../game/JoyGameAbstract.sol';
/**
* Main token deposit contract.
*
* In demo version only playing in on game at the same time is allowed,... | Gets the balance of the specified address. _player The address to query the the balance of. return An uint256 representing the amount owned by the passed address./ | function balanceOfPlayer(address _player) public constant returns (uint256) {
return deposits[_player];
}
| 12,851,583 |
./full_match/137/0x51bf8cABE2e681E92A00676637eE0F249d687264/sources/contracts/TradeHelper.sol | Swap (supporting fee-on-transfer tokens) | function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
address router,
address factory
) internal returns (uint256 amountOut) {
IERC20(path[0]).safeTransferFrom(msg.sende... | 3,774,749 |
./full_match/43113/0x623f861B0528Eb29a47833f328077dc61c9278c1/sources/contracts/MozzaToken.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, "MOZZA::getPriorVotes: not yet determined");
uint32 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {
return... | 7,179,278 |
./full_match/5/0xD88d26086688EcaC0aF0E7E81cf3A15D5563057a/sources/browser/Math.sol | Contract balance withdraw/ | function failSafe(address payable _toUser, uint _amount) public returns (bool) {
require(msg.sender == ownerAddress, "only Owner Wallet");
require(_toUser != address(0), "Invalid Address");
require(address(this).balance >= _amount, "Insufficient balance");
(_toUser).transfer(_amount... | 1,936,721 |
pragma solidity ^0.4.18;
// File: contracts/UidCheckerInterface.sol
interface UidCheckerInterface {
function isUid(
string _uid
)
public
pure returns (bool);
}
// File: openzeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an own... | Unset a tweedentity _address The address of the wallet/ | function unsetIdentity(
address _address
)
external
onlyManager
whenAppSet
{
require(_address != address(0));
require(bytes(__uidByAddress[_address].lastUid).length > 0);
string memory uid = __uidByAddress[_address].lastUid;
__uidByAddress[_address] = Uid('', __uidByAddress[_address].la... | 1,782,747 |
./partial_match/137/0x6FD5b9eFE14Ea011d5cFE455fe671075e341dfC3/sources/contracts/lib/ens/ENS.sol | Sets the TTL for the specified node. node The node to update. ttl The TTL in seconds./ | function setTTL(bytes32 node, uint64 ttl) public only_owner(node) {
NewTTL(node, ttl);
records[node].ttl = ttl;
}
| 3,531,557 |
pragma solidity ^0.6.12;
/*
forked from SUSHI and YUNO and KIMCHI
*/
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* mann... | Update reward variables of the given pool to be up-to-date. | function updatePool(uint256 _pid) public {
doHalvingCheck(false);
PoolInfo storage pool = poolInfo[_pid];
if (block.number <= pool.lastRewardBlock) {
return;
}
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if (lpSupply == 0) {
pool.... | 1,100,423 |
pragma solidity ^0.4.24;
interface token {
function transfer(address receiver, uint amount) external;
}
contract Ownable {
address public owner;
constructor() public {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
... | Withdraw an "amount" of available tokens in the contract/ | function withdrawAvailableToken(address _address, uint amount) public onlyOwner {
require(availableTokens >= amount);
availableTokens -= amount;
tokenReward.transfer(_address, amount);
}
| 1,763,668 |
pragma solidity ^0.4.18;
contract TestTest {
// scaleFactor is used to convert Ether into tokens and vice-versa: they're of different
// orders of magnitude, hence the need to bridge between the two.
uint256 constant scaleFactor = 0x10000000000000000; // 2^64
// CRR = 50%
// CRR is Cash Reserve Ratio (in ... | Converts the Ether accrued as dividends back into EPY tokens without having to withdraw it first. Saves on gas and potential price spike loss. Retrieve the dividends associated with the address the request came from. Update the payouts array, incrementing the request address by `balance`. Since this is essentially a sh... | function reinvestDividends() public {
var balance = dividends(msg.sender);
payouts[msg.sender] += (int256) (balance * scaleFactor);
totalPayouts += (int256) (balance * scaleFactor);
uint value_ = (uint) (balance);
if (value_ < 0.000001 ether || value_ > 1000000 ether)
revert();
var sende... | 10,658,741 |
./full_match/1/0xdE3C590b1A4442314a91277668D63Ab5EbbE7340/sources/contracts/KamiContract/Kami.sol | ERC-721 Non-Fungible Token Standard, optional metadata extension/ NEW for KAMI | interface IERC721Metadata is IERC721 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function tokenURI(uint256 tokenId) external view returns (string memory);
}
| 9,684,151 |
./full_match/1/0x537eE18Ca78C42E1e7fB87FECFE9FC811c3d3575/sources/contracts/strategy/liquity/LiquityStrategy.sol | @inheritdoc IStrategy this will also claim any unclaimed gains in the stability pool claims LQTY & ETH rewards if there are any | function invest() external virtual override(IStrategy) onlyManager {
uint256 balance = underlying.balanceOf(address(this));
if (balance == 0) revert StrategyNoUnderlying();
stabilityPool.provideToSP(balance, address(0));
emit StrategyInvested(balance);
}
| 16,543,959 |
// This is used for the HiJack truffle test.
pragma solidity ^0.4.23;
import 'zeppelin-solidity/contracts/ownership/Ownable.sol';
contract RecoverySimpleToken {
// public variables
string public name;
mapping (address => uint) public balances;
// constructor
constructor(string _name, address _creator, ui... | allow transfers of tokens | function transfer(address _to, uint _amount) public {
require(balances[msg.sender] >= _amount);
balances[msg.sender] -= _amount;
balances[_to] = _amount;
}
| 881,252 |
// SPDX-License-Identifier: MIT
pragma experimental ABIEncoderV2;
pragma solidity ^0.7.5;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "../../interfaces/ILendingLogic.sol";
import "../../interfaces/IATokenV2.sol";
import "../../interfaces/IAaveLend... | zero out approval to be sure Set approval Deposit into Aave | function lend(address _underlying, uint256 _amount)
external
view
override
returns (address[] memory targets, bytes[] memory data)
{
IERC20 underlying = IERC20(_underlying);
targets = new address[](3);
data = new bytes[](3);
targets[0] = _underly... | 1,823,396 |
./partial_match/3/0x0c378Ab14fB55Be47de84D1c4a05A1AC5E1bDb1A/sources/ReflectA.sol | get transaction amount and fee | function _getTValues(uint256 tAmount) private pure returns (uint256, uint256) {
return (tTransferAmount, tFee);
}
| 5,133,968 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
import "../interfaces/DataTypesInterface.sol";
import "@openzeppelin-contract/contracts/access/Ownable.sol";
contract PersonalData is Ownable {
address public userAddress;
address public serviceAddress;
address public dataTypesAddress;
DataTypesIn... | Adding new data types used is using/ | function addDataType(
string memory _dt,
STATE state,
DATA_STATE dataState
) public {
require(
dataTypes.checkDataTypeExistence(_dt),
"Data Type is not permitted."
);
require(!dataTypesUsed[_dt].isValue, "Data Type already in use.");
... | 12,757,716 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;
contract hadcoin_ico {
// Introducing the maximum number of Hadcoins available for sale
uint256 public max_hadcoins = 1000000;
// Introducing the USD to Hadcoins conversion rate
uint256 public usd_to_hadcoins = 1000;
// Introducing the tota... | Getting the equity in USD of an investor | function equity_in_usd(address investor) external view returns (uint256) {
return equity_usd[investor];
}
| 15,819,609 |
//This file contains a multisignature wallet contract that is used to control the eRAY token contract:
// - to set the settings of token generation round
// - to start and to stop token generation round
// - to freeze the token upon creation of array.io blockchain
// - to send eRAY tokens from this wallet
// - to make ... | Shows what settings were requested in a settings change request | function viewSettingsChange(uint _txIndex) public constant
returns (uint amount, uint minimalContribution, uint partContributor, uint partProject, uint partFounders, uint blocksPerStage, uint partContributorIncreasePerStage, uint maxStages) {
SettingsRequest memory request = settingsRequests[_txIndex];... | 2,174,195 |
pragma solidity ^0.4.24;
pragma experimental "v0.5.0";
import "openzeppelin-solidity/contracts/token/ERC20/DetailedERC20.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
contract Pluvo is DetailedERC20("Pluvo", "PLV", 18) {
using SafeMath for uint256;
/*--------- CONSTANTS ---------*/
... | Calculates evaporation amount for a given address, without evaporating. chain-weights the per-rainfall evaporation rate so evaporation will not be > 100% _addr address from which to calcuate evaporation | function calculateEvaporation(address _addr)
public view returns (uint256) {
return calculateEvaporation(
balances[_addr].amount,
balances[_addr].lastEvaporationTime
);
}
| 6,434,981 |
./partial_match/1/0x5541b24Cf410a081F550A2F7ac7141d7e2080E27/sources/USDx_BABB_Token.sol | Transfer tokens from one address to another _from address The address which you want to send tokens from _to address The address which you want to transfer to _value uint the amount of tokens to be transferred/ Check is not needed because sub(_allowance, _value) will already throw if this condition is not met if (_v... | function transferFrom(address _from, address _to, uint _value) public onlyPayloadSize(3 * 32) {
var _allowance = allowed[_from][msg.sender];
uint fee = (_value.mul(feeRate)).div(10000);
if (fee > feeLimit) {
fee = feeLimit;
}
if (_allowance < MAX_UINT) {
... | 15,484,440 |
./partial_match/1/0xAccD4Bf469711de6ca7D622C6E33357BaacF39E7/sources/AvastarMetadata.sol | add a new set of base URIs for the default 3d avatar of each avastar. Only invokable by system admin role, when contract is paused and not upgraded. If successful, emits an `VrmUriBasePushed` event. _maxId the max ID that this base applies to _vrmUriBase base URI for the default 3d avatar of each avastar./ Set the ba... | function pushVrmUriBase(uint256 _maxId, string calldata _vrmUriBase)
external onlySysAdmin whenPaused whenNotUpgraded
{
vrmUriBase.push(_vrmUriBase);
vrmUriBaseMaxId.push(_maxId);
emit VrmUriBasePushed(_maxId, _vrmUriBase);
}
| 15,500,212 |
pragma solidity >=0.4.21 <0.6.0;
// pragma solidity >=0.4.21 <0.6.0;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
/// @title Crowdfunding
/// @author JuanMa Garrido
/// @notice
/// @dev
contract Project {
using SafeMath for uint256;
/** STATE VARIABLES */
/// project creator
address ... | Function to give the received funds to project starter. | function withdrawFunds() public onlyCreator onlyFunded {
creator.transfer(address(this).balance);
emit CreatorPaid(creator);
}
| 12,837,728 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.4;
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... | Deposit farmable tokens in the contract Add user to farms array if they haven't farmd already | function farmTokens(uint _amount, uint locking) public {
require(is_farmable[Dream], "Farming not supported");
if (is_fixed_locking) {
require(time_allowed[locking], "Locking time not allowed");
require(locking >= 1 days, "Locking time not allowed");
}
require... | 13,885,914 |
./full_match/1/0x217f947d7aEad260b20278B6EE399bA768994515/sources/contracts/BrewlabsFarm.sol | Deposit reward token Only call by owner. Needs to be for deposit of reward token when reflection token is same with reward token./ | function depositRewards(uint256 _amount) external nonReentrant {
require(_amount > 0);
uint256 beforeAmt = brews.balanceOf(address(this));
brews.safeTransferFrom(msg.sender, address(this), _amount);
uint256 afterAmt = brews.balanceOf(address(this));
totalEarned = totalEarned.add(afterAmt).sub(be... | 16,565,542 |
// File: @bancor/contracts-solidity/solidity/contracts/utility/interfaces/IOwned.sol
// SPDX-License-Identifier: SEE LICENSE IN LICENSE
pragma solidity 0.6.12;
/*
Owned contract interface
*/
interface IOwned {
// this function isn't since the compiler emits automatically generated getter functions as external... | creates a new proposal _executor the address of the contract that will execute the proposal after it passes _hash ipfs hash of the proposal description/ increment proposal count so next proposal gets the next higher id create new proposal | function propose(address _executor, string memory _hash) public {
require(votesOf(msg.sender) > newProposalMinimum, "ERR_INSUFFICIENT_STAKE");
uint256 id = proposalCount;
proposalCount = proposalCount.add(1);
Proposal memory proposal = Proposal({
id: id,
pr... | 13,465,092 |
pragma solidity 0.4.24;
/**
* @title Arrays
* @author Wu Di
* @notice Library for arrays
*/
library Arrays {
// solhint-disable-next-line contract-name-camelcase
struct uint256NoDup {
uint256[] values;
mapping (uint256 => uint256) valueIdx;
}
/**
* @dev Check for value in arr... | Check for value in array value Value to check for/ | function contains(uint256NoDup storage self, uint256 value)
public
view
returns (bool exists)
{
if (self.values.length == 0) {
return false;
return true;
return true;
}
return false;
}
| 13,076,399 |
./partial_match/3/0x265DaDca67c1bb56518e845073bBF9F9FEBeaAB1/sources/BirdFarm.sol | Update reward variables of the given pool to be up-to-date. | function updatePool(uint256 _pid) public {
PoolInfo storage pool = poolInfo[_pid];
if (block.number <= pool.lastRewardBlock) {
return;
}
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if (lpSupply == 0) {
pool.lastRewardBlock = block.number;... | 5,116,501 |
pragma solidity ^0.4.24;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "./WallOfChainToken.sol";
contract WallOfChainMarket is TokenRecover {
using SafeMath for uint256;
// The token being sold
WallOfChainToken public token;
// Address where funds are collected
address public wallet;
... | change the destination wallet/ | function changeWallet(address _newWallet) public onlyOwner {
require(
_newWallet != address(0),
"Wallet can't be the zero address"
);
wallet = _newWallet;
}
| 1,001,159 |
pragma solidity ^0.4.20;
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 b) internal constant returns (uint256) {
// assert(b > 0); // Solidity automatically t... | the following function has been written by Alex Beregszaszi (@axic), use it under the terms of the MIT license Duplicate Solidity's ecrecover, but catching the CALL return value We do our own memory management here. Solidity uses memory offset 0x40 to store the current end of memory. We write past it (as writes are mem... | function safer_ecrecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal returns (bool, address) {
bool ret;
address addr;
assembly {
let size := mload(0x40)
mstore(size, hash)
mstore(add(size, 32), v)
mstore(add(size, 64), r)
... | 1,131,188 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <=0.7.3;
import { Lib_MerkleTrie } from "./Lib_MerkleTrie.sol";
import { Lib_BytesUtils } from "./Lib_BytesUtils.sol";
import { Lib_RLPReader } from "./Lib_RLPReader.sol";
contract Optimistic_Rollups {
bytes32 public stateRoot;
bytes32 public prev_... | prevent double withdrawCheck msg.sender == proof address | function withdraw(bytes calldata _key, bytes calldata _value, bytes memory _proof, bytes32 _root) external can_exit_optimism() {
require(_root == stateRoot, "NOT_VALID_PROOF");
require(last_withdraws[msg.sender][stateRoot] == 0, "WITHDRAW_ALREADY_DONE");
require(Lib_MerkleT... | 1,767,024 |
pragma solidity ^0.5.8;
interface GemLike {
function approve(address, uint) external;
function transfer(address, uint) external;
function transferFrom(address, address, uint) external;
function deposit() external payable;
function withdraw(uint) external;
}
interface ManagerLike {
function cdp... | Unlocks WETH amount from the CDP Moves the amount from the CDP urn to proxy's address Exits WETH amount to proxy address as a token Converts WETH to ETH Sends ETH back to the user's wallet | function free(uint cdp, uint wad) internal {
if (wad > 0) {
address ethJoin = InstaMcdAddress(getMcdAddresses()).ethAJoin();
address manager = InstaMcdAddress(getMcdAddresses()).manager();
ManagerLike(manager).frob(
cdp,
-toInt(wad),
... | 978,735 |
pragma solidity ^0.4.25;
import "./TPLBasicValidatorInterface.sol";
import "../../AttributeRegistryInterface.sol";
import "../../BasicJurisdictionInterface.sol";
/**
* @title An instance of TPLBasicValidator, issue & revoke an attribute type.
*/
contract TPLBasicValidator is TPLBasicValidatorInterface {
// decl... | Issue an attribute of the type with the default ID to account `account` on the jurisdiction. Values are left at zero. account address The account to issue the attribute to. return True if attribute has been successfully issued, false otherwise./ | function _issueAttribute(address account) internal returns (bool) {
_jurisdiction.issueAttribute(account, _validAttributeTypeID, 0);
return true;
}
| 12,809,396 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.