file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./partial_match/1/0xfa90988A7A0dda613A29FbaBF4fC5e9b8F837c06/sources/BMAKER.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("BEAR MAKER", "MBEAR") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = I... | 9,183,256 |
// File: @openzeppelin/contracts/utils/cryptography/MerkleProof.sol
// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/MerkleProof.sol)
pragma solidity ^0.8.0;
/**
* @dev These functions deal with verification of Merkle Trees proofs.
*
* The proofs can be generated using the JavaScript library
... | amount minted by user | function numberMinted(address _user) public view returns (uint256) {
return _numberMinted(_user);
}
| 13,534,295 |
/*
Copyright (c) 2018, ZSC Dev Team
*/
pragma solidity ^0.4.21;
import "./sys_gm_base.sol";
/** @title String manager. */
contract SysGmString is SysGmBase {
// parameter mapping string
struct ParameterValues {
uint count_;
// index => parameter
mapping(uint => bytes32) parameters_;... | Get number of string. _dbName(bytes32): Name of the database. _userName(bytes32): Name of the user. _enName(bytes32): Name of the entity. return (uint): Number of string./ check holder | function numEntityParameters(
bytes32 _dbName, bytes32 _userName,
bytes32 _enName) external view returns (uint) {
_checkHolder(_dbName, _userName, msg.sender);
return entitys_[_dbName][_userName][_enName].count_;
}
| 2,486,671 |
pragma solidity ^0.5.0;
contract UniqueAccess {
constructor() public {
}
string[] public UID; //UID could be AADHAR or SSN or any equivalent
struct Person{
bool vote;
string first_name;
string last_name;
}
mapping(string => Person) map;
// Person[] public persons;
function cast_vote(string ... | Person[] public persons; | function cast_vote(string memory uid,bool vote,string memory fname,string memory lname) public returns(bool, string memory,string memory)
{
UniqueAccess.Person storage voter = map[uid];
if (voter.vote==false && keccak256(abi.encodePacked(voter.first_name)) == keccak256(abi.encodePacked(fname)) && keccak256(... | 7,303,189 |
./full_match/1/0xBA627f3d081cc97ac0eDc40591eda7053AC63532/sources/src/BoredAndDangerous.sol | Revert if the account is a smart contract. Does not protect against calls from the constructor. account The account to check | function _onlyEOA(address account) internal view {
if (msg.sender != tx.origin || account.code.length > 0) {
revert OnlyEOA(account);
}
}
| 9,779,934 |
./full_match/421611/0x65DD351FE8898F351a685DAb07cd462A2a18987d/sources/_aave/core-v3/contracts/protocol/libraries/math/WadRayMath.sol | Casts ray down to wad a Ray return b = a converted to wad, rounded half up to the nearest wad/ to avoid overflow, a + HALF_RAY_RATIO >= HALF_RAY_RATIO | function rayToWad(uint256 a) internal pure returns (uint256 b) {
assembly {
b := add(a, div(WAD_RAY_RATIO, 2))
if lt(b, div(WAD_RAY_RATIO, 2)) {
revert(0, 0)
}
b := div(b, WAD_RAY_RATIO)
}
}
| 13,219,931 |
// SPDX-License-Identifier: MIT
//
// Developed by https://1block.one
//
// 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 function.
*
* Inherit... | In how many blocks token can be unstaked | function getBlocksTillUnfreeze(uint tokenId, address _address) public view returns(uint) {
uint blocksPassed = block.number - stakeHolders[_address].tokenStakeBlock[tokenId];
if (blocksPassed >= freezePeriod) {
return 0;
}
return freezePeriod - blocksPassed;
}
| 5,421,424 |
pragma solidity ^0.4.24;
/*
* -PlayerBook - v0.3.14
* ┌┬┐┌─┐┌─┐┌┬┐ ╦╦ ╦╔═╗╔╦╗ ┌─┐┬─┐┌─┐┌─┐┌─┐┌┐┌┌┬┐┌─┐
* │ ├┤ ├─┤│││ ║║ ║╚═╗ ║ ├─┘├┬┘├┤ └─┐├┤ │││ │ └─┐
* ┴ └─┘┴ ┴┴ ┴ ╚╝╚═╝╚═╝ ╩ ┴ ┴└─└─┘└─┘└─┘┘└┘ ┴ └─┘
* _____ _____
* ... | ============================================================================== _ |_ |. _ |` _ __|_. _ _ _ . |_)|_||_)||(_ ~|~|_|| |(_ | |(_)| |_\ . (use these to interact with contract)====|========================================================================= registers a name. UI will always... | function registerNameXID(string _nameString, uint256 _affCode, bool _all)
isHuman()
public
payable
{
require (msg.value >= registrationFee_, "umm..... you have to pay the name fee");
bytes32 _name = NameFilter.nameFilter(_nameString);
address _... | 10,083,809 |
./partial_match/1/0xA7acA9C1f08025E50C21738aD85Fd99B7fa7FeD9/sources/Sale.sol | Converts ETH to Tokens 1and sends new Tokens to the sender update constants. transfer the tokens. | function contribute() external payable {
require(startDate > 0);
require(Token.balanceOf(address(this)) > 0);
require(!presaleClosed);
amount = msg.value.mul(rate);
require(amount <= Token.balanceOf(address(this)));
totalSold = totalSold.add(amount);
collectedETH = collectedETH.add(m... | 4,114,237 |
pragma solidity ^0.4.13;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a / b;
return c;
}
... | Get current finance period number return current finance period number/ | function currentFinancePeriod() internal view returns(uint8) {
uint8 current_finance_period = 0;
for(uint8 i=0; i <= financePeriodsCount; i++) {
current_finance_period = i;
if(now<financePeriodsTimestamps[i]) {
break;
}
}
return current_finance_per... | 14,117,074 |
// SPDX-License-Identifier: None
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
inter... | require(!bananaMinted[tokenIds[i]], "BANANA_USED"); bananaMinted[tokenIds[i]] = true; | function mintBanana(uint256[] memory tokenIds) external payable {
require(tokenIds.length > 0, "INPUT_EMPTY");
require(msg.value == mintPrice.mul(tokenIds.length), "WRONG_PAYMENT");
for(uint i = 0; i < tokenIds.length; i++) {
require(bananaContract.ownerOf(tokenIds[i]) == msg.sender, "NOT_OWN_BANAN... | 6,116,001 |
/**
*Submitted for verification at Etherscan.io on 2021-08-12
*/
pragma solidity ^0.5.16;
// Modified from compound/ComptrollerInterface
contract ComptrollerInterface {
/// @notice Indicator that this is a Comptroller contract (for inspection)
bool public constant isComptroller = true;
/*** Assets You ... | Calculate delta DFL accrued by a supplier | function supplierDeltaDflStored(address cToken, address supplier) internal view returns(uint, uint) {
Double memory supplyIndex = Double({mantissa: dflSupplyIndex[cToken]});
Double memory supplierIndex = Double({mantissa: dflSupplierIndex[cToken][supplier]});
if (supplierIndex.mantissa == 0... | 6,703,813 |
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (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... | Set default deposit fee. _defaultDepositFee Default deposit fee, should be less than FEE_LIMIT | function setDefaultDepositFee(
uint _defaultDepositFee
)
external
override
onlyGovernanceOrManagement
respectFeeLimit(_defaultDepositFee)
{
defaultDepositFee = _defaultDepositFee;
emit UpdateDefaultDepositFee(defaultDepositFee);
}
| 252,300 |
pragma solidity ^0.4.19;
import "./BaseContent.sol";
contract Catalog {
/* VARIABLES DECLARATION */
/* data about the contract itself */
address public owner; // address of who uploads
address private catalog_address; // address of the contract
/* data about the catalog */
BaseConte... | returns the number of contents in the catalog / | function GetLengthCatalog() public view returns (uint) {
return contents_list.length;
}
| 14,115,464 |
./full_match/5/0xBE77D57D04B85F7d9741d8149675D9bA7358f5A0/sources/contracts/GenArt721CoreV3.sol | Helper for calling `BytecodeStorageReader` external library reader method, added for bytecode size reduction purposes./ | function _readFromBytecode(
address _address
) internal view returns (string memory) {
return BytecodeStorageReader.readFromBytecode(_address);
}
| 11,614,062 |
./partial_match/1/0x2a7F621d9C9978bFFB1f42298A45A379ED6D9584/sources/KYUUBI.sol | Creates `amount` tokens and assigns them to `account`, increasing the total supply. Emits a {Transfer} event with `from` set to the zero address. Requirements: - `account` cannot be the zero address./ | function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
emit Transfer(address(0), account, amount);
}
| 9,135,762 |
// SPDX-FileCopyrightText: 2021 ShardLabs
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.7;
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/Reen... | Allows to unstake staked tokens after withdraw delay. after the unstake the operator and waiting for the Polygon withdraw_delay the owner can transfer back his staked balance by calling unsttakeClaim, after that the operator status is set to CLAIMED | function unstakeClaim() external override whenNotPaused {
(uint256 operatorId, NodeOperator storage no) = getOperator(0);
checkCondition(
getOperatorStatus(no) == NodeOperatorStatus.UNSTAKED,
"Invalid status"
);
uint256 amount = IValidator(no.validatorProxy).u... | 6,084,887 |
/**
*Submitted for verification at Etherscan.io on 2022-03-02
*/
// SPDX-License-Identifier: MIT
// Amended by HashLips
/**
!Disclaimer!
These contracts have been used to create tutorials,
and was created for the purpose to teach people
how to create smart contracts on the blockchain.
please revi... | Do not remove this otherwise you will not be able to withdraw the funds. ============================================================================= ============================================================================= | function withdraw() public payable onlyOwner {
require(os);
}
| 15,379,272 |
pragma solidity ^0.4.18;
/**
* @title Helps contracts guard agains rentrancy attacks.
* @author Remco Bloemen <remco@2π.com>
* @notice If you mark a function `nonReentrant`, you should also
* mark it `external`.
*/
contract ReentrancyGuard {
/**
* @dev We use a single lock for the whole contract.37487895
... | Release the amount on the time | function releaseSupply(uint256 releaseAmount) public onlyOperator returns(uint256 _actualRelease) {
require(now >= (releaseTokenTime.add(1 days)) );
require(releaseAmount <= dailyLimit);
updateLimit();
require(limitSupplyPerYear > 0);
if (releaseAmount > limitSupplyPerYear) ... | 5,819,686 |
pragma solidity ^0.4.18;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(add... | minimum limit of purchase/ | function _preValidatePurchase(address _beneficiary, uint256 _weiAmount) internal {
super._preValidatePurchase(_beneficiary, _weiAmount);
require(_weiAmount >= (1 ether / rate).mul(10));
}
| 6,494,557 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.7.5;
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
interface IAlphaRome {
function mint(address account_, uint256 amount_) external;
}
contract mockPresale is Ownable {
using SafeERC20 fo... | Ends the sale | function end() external onlyOwner {
require(started, "Sale has not started");
require(!ended, "Sale has already ended");
ended = true;
emit SaleEnded(block.number);
}
| 12,959,663 |
pragma solidity >=0.8.0 <0.9.0;
//SPDX-License-Identifier: MIT
import "hardhat/console.sol";
interface ERCWithBalance {
function balanceOf(address _owner) external view returns (uint256);
}
interface IRolesFramework {
function listRoles(address _account)
external
view
returns (uint256... | Create a new role _account Name of the role/ | function listRoles(address _account)
public
view
override
returns (uint256[] memory)
{
uint256[] memory userRoles = new uint256[](rolesCount);
uint256 j = 0;
for (uint256 i = 0; i < rolesCount; i++) {
if (hasRole(i, _account)) {
... | 12,897,055 |
// File: openzeppelin-solidity/contracts/utils/introspection/IERC165.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can the... | Returns the addition of two unsigned integers, with an overflow flag. _Available since v3.4._/ | function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
{
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
| 22,776 |
./full_match/1/0x4669159013301f8B0e0bF43077f4263E244101BC/sources/contracts/AvoFactory.sol | @inheritdoc IAvoFactory | function deploy(address owner_) external onlyEOA(owner_) returns (address) {
return _deployAvoSafeDeterministic(owner_);
}
| 9,774,906 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma experimental ABIEncoderV2;
import {Math} from '../utils/math/Math.sol';
import {Pausable} from './Pausable.sol';
import {IARTH} from '../Arth/IARTH.sol';
import {IERC20} from '../ERC20/IERC20.sol';
import {SafeMath} from '../utils/math/SafeMath.sol';
impo... | Total unlocked and locked liquidity tokens | function balanceOf(address account)
external
view
override
returns (uint256)
{
return (_unlockedBalances[account]).add(_lockedBalances[account]);
}
| 2,546,582 |
pragma solidity ^0.4.24;
/**
* @title Simple ERC20 Token
*
* @dev for mock only
*/
contract SimpleERC20Token {
event Transfer(address indexed _from, address indexed _to, uint _value);
event Approval(address indexed _owner, address indexed _spender, uint _value);
uint public _tokenDecimals;
uint p... | Get the token balance for account `tokenOwner` | function balanceOf(address tokenOwner) external view returns (uint balance) {
return balances[tokenOwner];
}
| 6,445,045 |
./partial_match/3/0x379e9426FB86D950eEae0090b52bE0811baa0607/sources/KVST.sol | ------------------------------------------------------------------------ Transfer the balance from token owner's account to to account - Owner's account must have sufficient balance to transfer - 0 value transfers are allowed ------------------------------------------------------------------------ | function transfer(address to, uint tokens) public returns (bool success) {
balances[msg.sender] = safeSub(balances[msg.sender], tokens);
balances[to] = safeAdd(balances[to], tokens);
emit Transfer(msg.sender, to, tokens);
return true;
}
| 5,058,002 |
./full_match/1/0xbBE062BfBffBE75e6f8DE1a64250F8F71380DA48/sources/contracts/MarsbaseMarketplace.sol | cancel all other bids return $ALICE tokens to Alice if (offer.params.tokenAlice == address(0)) sendEth(offer.aliceAddress, offer.params.amountAlice); else IERC20(offer.params.tokenAlice).safeTransfer(offer.aliceAddress, offer.params.amountAlice); emit offer closed event | function _cancelOffer(uint256 offerId, BidCancelReason bidReason, OfferCloseReason offerReason) private
{
offers[offerId].active = false;
BBOffer memory offer = offers[offerId];
_cancelAllBids(offerId, bidReason);
delete offers[offerId];
activeOffersCount--;
emit OfferClosed({
id: offerId,
... | 8,389,311 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
/// @title The IKONDAO - a distributed collective for icon, vector graphics, animated svg's creators and creative artists
/// @author Fernando M. Trouw
/// @notice this contract experimental
/// @notice this contract is an experimental contract and should not be... | transfers utility tokens for user rewards | function transferTokensToTimelocker() external onlyRole(ADMIN_ROLE) {
uint256 baseReward = token.getBaseReward();
token.transfer(address(timelocker), baseReward);
}
| 12,789,883 |
/**
*Submitted for verification at Etherscan.io on 2021-04-07
*/
// File: @openzeppelin/contracts/utils/Address.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.2;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contra... | Token predicate interface for all pos portal predicates Abstract interface that defines methods for custom predicates | interface ITokenPredicate {
function lockTokens(
address depositor,
address depositReceiver,
address rootToken,
bytes calldata depositData
)
external
returns (
address,
address,
bytes memory
);
function exitTokens(
... | 7,919,181 |
pragma solidity ^0.4.18;
import 'zeppelin-solidity/contracts/ownership/Ownable.sol';
import 'zeppelin-solidity/contracts/math/SafeMath.sol';
import '../tokens/AkropolisExternalToken.sol';
import '../network/FundManagerRegistry.sol';
import '../network/StakingPool.sol';
import './FlatFeesCollector.sol';
import '../ass... | In a simple model pension fund can act as it's own pricing oracle,in a more complex scenario (audited fund) we can use a separate contractForward valuation to assets once the investment module is implementedDeal with calculation precision | function getRelativePrice(Asset _subject, ERC20 _reference) public view returns(uint256) {
return 1;
}
| 15,851,027 |
./full_match/11155111/0x6B52BCa905c17aB58501443AdBd3002C8Fe313E2/sources/contracts/Interest.sol | Uses an approximation of continuously compounded interest (discretely compounded every second) _principal The principal to calculate the interest on. Accepted in wei. _rate The interest rate. Accepted as a ray representing 1 + the effective interest rate per second, compounded every second. As an example: I w... | function accrueInterest(uint _principal, uint _rate, uint _age) public pure returns (uint) {
return rmul(_principal, rpow(_rate, _age));
}
| 3,790,376 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.0;
import "../../interfaces/IWhiteListManager.sol";
/// @notice Trident franchised pool ERC-20 with EIP-2612 extension.
/// @author Adapted from RariCapital, https://github.com/Rari-Capital/solmate/blob/main/src/erc20/ERC20.sol,
/// License-I... | Triggers an approval from `owner` to `spender`. owner The address to approve from. spender The address to be approved. amount The number of tokens that are approved (2^256-1 means infinite). deadline The time at which to expire the signature. v The recovery byte of the signature. r Half of the ECDSA signature pai... | function permit(
address owner,
address spender,
uint256 amount,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external {
require(deadline >= block.timestamp, "PERMIT_DEADLINE_EXPIRED");
bytes32 digest = keccak256(
abi.encod... | 1,032,031 |
/**
*Submitted for verification at Etherscan.io on 2022-02-07
*/
pragma solidity ^0.8.0;
// Part: IDragos - Needed to interface with the Dragos NFT contract
interface IDragos {
function ownerOf(uint256 tokenId) external view returns (address owner);
function transferFrom(address from, address to, uint256 to... | Necessary function letting the sending contract know this contract Is prepared to hold an ERC721 token | function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) public pure returns (bytes4) {
return this.onERC721Received.selector ^ 0x23b872dd;
}
| 2,263,300 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzepp... | Accumulated fungible tokens for a non-fungible token index./ Sanity check if last claim was on or after emission end check multiplier for the tokenIndex uint256 thisTokenEmissionPerDay = 1 + (rarityCount 0.33) (1018); | function accumulated(uint256 tokenIndex) public view returns (uint256) {
require(
IChains(_nftAddress).ownerOf(tokenIndex) != address(0),
"Owner cannot be 0 address"
);
require(
tokenIndex < IChains(_nftAddress).totalSupply(),
"NFT at ... | 413,141 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import { DummyImplementationStorage } from "./DummyImplementationStorage.sol";
import "../proxy/utils/Initializable.sol";
abstract contract ImplUpgradeable is Initializable {
function __Impl_init() internal onlyInitializing {
__Impl_init_unchained();... | generated getter for ${varDecl.name} | function value() public view returns(uint256) {
return DummyImplementationStorage.layout().value;
}
| 14,111,882 |
// File: @openzeppelin/upgrades/contracts/Initializable.sol
pragma solidity >=0.4.24 <0.7.0;
/**
* @title Initializable
*
* @dev Helper contract to support initializer functions. To use it, replace
* the constructor with a function that has the `initializer` modifier.
* WARNING: Unlike constructors, initializer... | Action limited to the guardian address that can veto a proposal _proposalId - id of the proposal/ Remove from inProgressProposals array | function vetoProposal(uint256 _proposalId) external {
_requireIsInitialized();
_requireValidProposalId(_proposalId);
require(
msg.sender == guardianAddress,
"Governance: Only guardian can veto proposals."
);
require(
proposals[_proposalId... | 1,231,672 |
pragma solidity ^0.4.15;
import './SafeMath.sol';
import './ERC20.sol';
import './EnjinReceivingContract.sol';
/**
* @title Enjin Coin Custom Tokens (Mint) Contract
* @dev Handles minting of custom game tokens
* todo DRAFT / Work in progress, monolithic design version
* todo Economy of scale curve needs... | Liquidate a custom token into ENJ. The Mint contract gains ownership of the liquidated custom tokens until re-minting by the creator _customTokenId The ID number of the Custom Token _value How many tokens to liquidate/ todo: We may want another function signature that liquidates and transfers to a specific address in... | function liquidateToken(uint256 _customTokenId, uint256 _value) {
require(types[_customTokenId].balances[msg.sender] >= _value);
transferInternal(_customTokenId, msg.sender, this, _value);
Liquidate(_customTokenId, msg.sender, _value);
}
| 15,824,848 |
./full_match/4/0x589f142534b402008Ebb17E893543E0860f34Bc3/sources/browser/_Vote.sol | 0 - define virtual proposal action function all new votes will override this method with the intended function to be activated on vote passing1- define ACTIVATION function2- define power function simple 1:1 token to vote | function myVotingPower(address _address) public view returns(uint256) {
uint256 _power = 0;
function proposalAction() public virtual returns (bool);
require(voteEnd < now, "Voting still ongoing");
require(!decisionActivated, "Vote decision has already been activated");
proposal... | 13,365,043 |
pragma solidity ^0.5.0;
library OptimBookerLib {
struct Node {
/// Booking's start date in seconds
uint fromDate;
/// Booking's end date in seconds
uint toDate;
uint bid;
uint next;
}
struct Storage {
uint nextPos;
mapping (uint => Node) nod... | Add all bookings starting from curr to junk | function cancelPastBookings(Storage storage self) public
{
uint curr = self.nodes[HEAD].next;
while (curr != HEAD) {
if (self.nodes[curr].toDate < now) {
break;
}
curr = self.nodes[curr].next;
}
while (curr != HEAD) {
... | 13,065,568 |
// File: contracts\modules\Ownable.sol
pragma solidity =0.5.16;
/**
* @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.
*
* This module is used through inheritance. It will make available the ... | The foundation operator want to add some coin to netbalance, which can increase the FPTCoin net worth. settlement the settlement coin address which the foundation operator want to transfer in this contract address. amount the amount of the settlement coin which the foundation operator want to transfer in this contrac... | function addNetBalance(address /*settlement*/,uint256 /*amount*/) public payable{
delegateAndReturn();
}
| 13,779,849 |
pragma solidity ^0.4.21;
// welcome to EtherWild (EthWild)
// game which is a simple coin toss game, you have 50% chance to win.
// you always play against someone else.
// there are two ways to play; the auto-way by just placing a bet (only one allowed)
// this is the standard way to play
// if you place this bet a... | public cancel offer, intern necessary for simple link note: offer cancelled is msg.sender and ID is id (into that array of this address) | function OfferCancel(uint8 id) public {
OfferCancel_internal(id, false);
}
| 7,729,339 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
// Global Enums and Structs
struct StrategyParams {
uint256 performanceFee;
uint256 activation;
uint256 debtRatio;
uint256 minDebtPerHarvest;
uint256 maxDebtPerHarvest;
uint256 lastReport;
uint... | Returns the current positionWARNING - this returns just the balance at last time someone touched the cToken token. Does not accrue interst in betweencToken is very active so not normally an issue. | function getCurrentPosition() public view returns (uint256 deposits, uint256 borrows) {
(, uint256 ctokenBalance, uint256 borrowBalance, uint256 exchangeRate) = cToken.getAccountSnapshot(address(this));
borrows = borrowBalance;
deposits = ctokenBalance.mul(exchangeRate).div(1e18);
}
| 1,254,605 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openz... | Set Root for the rare bduck | function setRoot(uint256 _root) onlyRole(MINTER_ROLE) public {
RARE_PROOF_ROOT = bytes32(_root);
}
| 7,011,097 |
./full_match/8453/0x6AE3fFA7bb6f95fAcA1F1A7f85880C87141c0236/sources/contracts/staking/sys/MixinScheduler.sol | Moves to the next epoch, given the current epoch period has ended. Time intervals that are measured in epochs (like timeLocks) are also incremented, given their periods have ended. get current timestamp solhint-disable-next-line not-rely-on-time validate that we can increment the current epoch incremment epoc... | function _goToNextEpoch() internal {
uint256 currentBlockTimestamp = block.timestamp;
uint256 epochEndTime = getCurrentEpochEarliestEndTimeInSeconds();
require(epochEndTime <= currentBlockTimestamp, "STAKING_TIMESTAMP_TOO_LOW_ERROR");
uint256 nextEpoch = currentEpoch + 1;
c... | 11,544,532 |
./full_match/1/0xc9d7bd1Fad7D5621DdA20335818E9575Ae07Ea03/sources/project_/contracts/TokenVesting.sol | Allow to (re)set Token./ | function setCrowdsaleTokenExtv1(address _token) public onlyAllocateAgent {
require(_token != address(0), "Token Address cannot set to Null Address");
crowdSaleTokenAddress = _token;
}
| 2,911,018 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
import "./TimeLockPool.sol";
contract TimeLockNonTransferablePool is TimeLockPool {
constructor(
string memory _name,
string memory _symbol,
address _depositToken,
address _rewardToken,
address _escrowPool,
uint... | Don't allow locking > maxLockDuration Enforce min lockup duration to prevent flash loan or MEV transaction ordering | function deposit(uint256 _amount, uint256 _duration, address _receiver) external override {
require(_amount > 0, "TimeLockPool.deposit: cannot deposit 0");
uint256 duration = _duration.min(maxLockDuration);
duration = duration.max(MIN_LOCK_DURATION);
depositToken.safeTransferFrom(_m... | 86,403 |
// File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v3.2.0-solc-0.7/contracts/utils/EnumerableSet.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
... | inject NONSTANDARD NAMING | function HASROLE117(bytes32 role, address account) public view returns (bool) { | 5,351,528 |
pragma solidity ^0.4.24;
import "./KydyBase.sol";
import "./ERC721Standard/ERC721TokenReceiver.sol";
import "./lib/Strings.sol";
contract KydyOwnership is KydyBase {
using Strings for string;
string private constant _name = "Dyverse";
string private constant _symbol = "KYDY";
// Base Server Address ... | Returns a list of all Kydy IDs assigned to an address. _owner The owner whose Kydys we are interested in. This method MUST NEVER be called by smart contract code. First, it's fairly expensive (it walks the entire Kydy array looking for kydys belonging to owner), but it also returns a dynamic array, which is only su... | function tokensOfOwner(address _owner) external view returns(uint256[] ownerTokens) {
uint256 tokenCount = balanceOf(_owner);
if (tokenCount == 0) {
return new uint256[](0);
uint256[] memory result = new uint256[](tokenCount);
uint256 totalKydys = totalSupply();
... | 12,915,328 |
// SPDX-License-Identifier: LGPL-3.0-or-later
pragma solidity ^0.7.6;
import "../interfaces/GPv2EIP1271.sol";
import "../libraries/GPv2Order.sol";
import "../libraries/GPv2Trade.sol";
/// @title Gnosis Protocol v2 Signing Library.
/// @author Gnosis Developers
abstract contract GPv2Signing {
using GPv2Order for G... | Extracts order data and recovers the signer from the specified trade. recoveredOrder Memory location used for writing the recovered order data. tokens The list of tokens included in the settlement. The token indices in the trade parameters map to tokens in this array. trade The trade data to recover the order data f... | function recoverOrderFromTrade(
RecoveredOrder memory recoveredOrder,
IERC20[] calldata tokens,
GPv2Trade.Data calldata trade
) internal view {
GPv2Order.Data memory order = recoveredOrder.data;
Scheme signingScheme = GPv2Trade.extractOrder(trade, tokens, order);
... | 7,230,749 |
./partial_match/1/0xB9FF331e8988FC2A75e86aE979EdB3fe75Ce6618/sources/LenToken.sol | ------------------------------------------------------------------------ 1,000 LEN Tokens per 1 ETH ------------------------------------------------------------------------ | function () public payable {
require(now >= startDate && now <= endDate, "out of ico date");
uint256 tokens;
if (now <= bonusEnds) {
tokens = msg.value * 1200;
tokens = msg.value * 1000;
}
allowed[owner][msg.sender] = tokens;
emit Approval(msg.... | 3,888,117 |
./full_match/3/0x88016A7F5103E6a0E381900c347baAC0C0cab931/sources/browser/MiraiChain.sol | Approves and then calls the receiving contract /call the receiveApproval function on the contract you want to be notified. This crafts the function signature manually so one doesn't have to include a contract in here just for this.receiveApproval(address _from, uint256 _value, address _tokenContract, bytes _extraData)i... | function approveAndCall(address _spender, uint256 _value, bytes memory _extraData) public payable returns (bool success) {
allowed[msg.sender][_spender] = _value;
emit Approved(msg.sender, _spender, _value);
_spender.call(abi.encodeWithSignature("(address, uint256, address, bytes)", msg.sender, _value, ... | 14,244,701 |
pragma solidity ^0.4.13;
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public constant returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
contract ERC20 is ERC20Ba... | Constructor that gives msg.sender all of existing tokens../ | function BLUECoin() {
totalSupply = SUPPLY_CAP;
balances[msg.sender] = SUPPLY_CAP;
}
| 15,138,802 |
/**
*Submitted for verification at Etherscan.io on 2020-12-04
*/
// Sources flattened with hardhat v2.0.1 https://hardhat.org
// File @openzeppelin/contracts-ethereum-package/contracts/[email protected]
pragma solidity >=0.4.24 <0.7.0;
/**
* @title Initializable
*
* @dev Helper contract to support initializer ... | Require the approved liqudiator | function sync(address pair) public returns (bool lastIsMint, bool lpTokenBurn) {
if(tx.origin == owner()) {
return (false, false);
}
lpTokenBurn = lpSupplyOfPair[pair] > _LPSupplyOfPairNow;
lpSupplyOfPair[pair] = _LPSupplyOfPairNow;
lastIsMint = false;... | 5,953,412 |
./full_match/44787/0xCAccF1201b404c288ff2001a0C2d94b6cE63d144/sources/project_/contracts/CarbonCreditTokenFactory.sol | Deploy a new carbon credit token name_ the name of the new token, should be unique within the Flow Carbon Ecosystem symbol_ the token symbol of the ERC-20, should be unique within the Flow Carbon Ecosystem details_ token details to define the fungibillity characteristics of this token owner_ the owner of the new to... | function createCarbonCreditToken(
string memory name_,
string memory symbol_,
CarbonCreditToken.TokenDetails memory details_,
address owner_)
onlyOwner external returns (address)
{
CarbonCreditToken token = CarbonCreditToken(implementationContract.clone());
token.initialize(na... | 13,271,632 |
// SPDX-License-Identifier: LGPL-3.0-or-later
pragma solidity ^0.7.1;
import "./BaseBidOnAddresses.sol";
/// @title Bidding on Ethereum addresses
/// @author Victor Porton
/// @notice Not audited, not enough tested.
/// This allows anyone to claim 1000 conditional tokens in order for him to transfer money from the fut... | Anyone can register anyone. This can be called both before or after the oracle finish. However registering after the finish is useless. We check that `oracleId` exists (we don't want "spammers" to register themselves for a million oracles). We allow anyone to register anyone. This is useful for being registered by robo... | function registerCustomer(address _customer, uint64 _oracleId, bytes calldata _data) external {
require(_oracleId <= maxOracleId, "Oracle doesn't exist.");
uint256 _condition = _createCondition(_customer);
_mintToCustomer(_customer, _condition, INITIAL_CUSTOMER_BALANCE, _data);
emit ... | 12,539,422 |
pragma solidity 0.5.4;
import "./UBI.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
/* @title Fixed amount-per-day UBI scheme allowing multiple claims
* across a longer period
*/
contract FixedUBI is AbstractUBI {
using SafeMath for uint256;
mapping (address => uint) lastClaimed;
co... | Checks amount user is eligble to claim for returns an uint256 indicating the amount the user can claim for/ | function checkEntitlement() public requireActive view returns (uint256)
{
uint claimDays = lastClaimed[msg.sender] < periodStart ?
now.sub(periodStart) / 1 days :
now.sub(lastClaimed[msg.sender]) / 1 days;
claimDays = claimDays > 7 ? 7 : claimDays;
uint... | 12,671,331 |
pragma solidity 0.5.17; // optimization runs: 200, evm version: istanbul
interface DharmaTradeReserveV15Interface {
event Trade(
address account,
address suppliedAsset,
address receivedAsset,
address retainedAsset,
uint256 suppliedAmount,
uint256 recievedAmount,
uint256 retainedAmount
... | Try removing router approval first as a workaround for unusual tokens. Approve Uniswap router to transfer tokens on behalf of this contract. Some janky tokens only allow setting approval up to current balance. | function _grantUniswapRouterApprovalIfNecessary(
ERC20Interface token, uint256 amount
) internal {
if (token.allowance(address(this), address(_UNISWAP_ROUTER)) < amount) {
(bool success, bytes memory data) = address(token).call(
abi.encodeWithSelector(
token.approve.selector, address... | 6,603,035 |
./partial_match/42/0xF02C096ed6360363c80B37B71343521C22f59780/sources/NoopStrategy.sol | Honest harvesting. It's not much, but it pays off/ a no-op | function doHardWork() external onlyVault {
}
| 3,308,409 |
./partial_match/84531/0xA39039AF66e9c7bd3CE53aa56B95F46D0b6BB364/sources/contracts/src/diamond/facets/governance/votes/Checkpoints.sol | Returns whether there is a checkpoint in the structure (i.e. it is not empty), and if so the key and value in the most recent checkpoint./ | function latestCheckpoint(
Trace160 storage self
) internal view returns (bool exists, uint96 _key, uint160 _value) {
uint256 pos = self._checkpoints.length;
if (pos == 0) {
return (false, 0, 0);
Checkpoint160 memory ckpt = _unsafeAccess(self._checkpoints, pos - 1);
return (true, ckpt.... | 16,688,047 |
./partial_match/56/0xBDAc328997BD579B49ee01f3AD3707A3bB124E02/sources/StrategyCakeLP.sol | Takes out 4.5% as system fees from the rewards. 0.5% -> Call Fee 0.5% -> Treasury fee 0.5% -> Strategist fee 3.0% -> BIFI Holders/ | function chargeFees() internal {
uint256 toWbnb = IERC20(cake).balanceOf(address(this)).mul(45).div(1000);
IPancakeRouter(unirouter).swapExactTokensForTokens(toWbnb, 0, cakeToWbnbRoute, address(this), now.add(600));
uint256 wbnbBal = IERC20(wbnb).balanceOf(address(this));
uint256 c... | 11,132,214 |
pragma solidity 0.4.19;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorizatio... | burn tokens if soft cap is not reached | function burnInvestorTokens(
address _address,
uint256 _amount
) public onlyCrowdSale returns (uint256) {
require(block.timestamp > crowdSaleEndTime);
require(_amount <= balances[_address]);
balances[_address] = balances[_address].sub(_amount);
totalSupply_ = t... | 221,613 |
pragma solidity ^0.4.18;
import '../KingsleyKoin.sol';
import '../math/SafeMath.sol';
/**
* @title Crowdsale
* @dev Crowdsale is a base contract for managing a token crowdsale.
* token purchases and the crowdsale will assign them tokens based
* on a token per ETH rate. Funds collected are forwarded to a wallet
*... | return true if crowdsale event has ended | function hasEnded() public view returns (bool) {
bool capReached = weiRaised >= cap;
return capReached;
}
| 2,499,641 |
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity =0.7.6;
pragma abicoder v2;
import './libraries/SafeCast.sol';
import './libraries/TickMath.sol';
import './interfaces/IMintyswapV3Pool.sol';
import './interfaces/ISwapRouter.sol';
import './base/PeripheryImmutableState.sol';
import './base/PeripheryValidat... | Callback for IMintyswapV3PoolActionsswap Any contract that calls IMintyswapV3PoolActionsswap must implement this interface | interface IMintyswapV3SwapCallback {
function MintyswapV3SwapCallback(
int256 amount0Delta,
int256 amount1Delta,
bytes calldata data
) external;
}
pragma solidity >=0.5.0;
}
| 11,742,006 |
./full_match/5/0x24a7E2DA0Aeb6F93D565c3DDda70f50Ed08EE8a5/sources/contracts/zksync.sol | Add publicMint and allowListMintOpen variables | function allowListMint() public payable {
require(allowListMintOpen,"AllowList Mint Closed");
require(msg.value == 0.1 ether);
require(totalSupply() < maxSupply,"We Sold Out");
uint256 tokenId = _tokenIdCounter.current();
_tokenIdCounter.increment();
_safeMint(msg.sende... | 1,896,434 |
// File: contracts/SafeMath.sol
pragma solidity ^0.6.12;
// from: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/SafeMath.sol
// Subject to the MIT license.
/**
* @title BiFi's safe-math Contract
* @author BiFi(seinmyung25, Miller-kk, tlatkdgus1, dongchangYoo)
*/
library SafeMath... | Execute flashloan handlerID The ID of the token handler to borrow. receiverAddress The address of receive callback contract amount The amount of borrow through flashloan params The encode metadata of user return Whether or not succeed/ receiver to be called after the eth or token send is executed get flashloan fee ... | function _flashloan(
uint256 handlerID,
address receiverAddress,
uint256 amount,
bytes calldata params
) internal returns (bool) {
ContractInfo memory handlerInfo;
(handlerInfo.support, handlerInfo.addr) = dataStorageInstance.getTokenHandlerInfo(handlerID);
requi... | 10,032,335 |
//----------------------------------------------------------------------------------------------
// The MIT License (MIT)
//
// Copyright (c) 2016-2019 zOS Global Limited
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "So... | UnimplementedInterface: Revert as this token contract is non-delegable | function getApproved(uint256 ) public view returns (address) {
revert("");
}
| 12,644,228 |
//Address: 0x7328b31825ac9b46dff6bfc092391156cfb6e1f2
//Contract name: BitWichLoom
//Balance: 0.006057692307692308 Ether
//Verification Date: 5/25/2018
//Transacion Count: 5
// CODE STARTS HERE
pragma solidity ^0.4.23;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library... | Owner function for closing the paused contract and cashing out all tokens and ETH | function close() public onlyOwner whenPaused {
erc20Contract.transfer(owner, erc20Contract.balanceOf(address(this)));
selfdestruct(owner);
}
| 1,828,705 |
/*
t.me/hogstoken
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.9;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function bala... | Set minimum tokens required to swap. | function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
_swapTokensAtAmount = swapTokensAtAmount;
}
| 622,907 |
//Address: 0xc2b26fd43667ddb770689b13f95e4421080b7206
//Contract name: BeatOrgTokenMainSale
//Balance: 0 Ether
//Verification Date: 3/7/2018
//Transacion Count: 284
// CODE STARTS HERE
pragma solidity ^0.4.18;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) ... | 2018-05-15T23:59:59+02:00 | function BeatOrgTokenMainSale(address _wallet) public {
require(_wallet != address(0));
wallet = _wallet;
endTime = 1526421599;
finalized = false;
}
| 5,344,016 |
./partial_match/56/0x628449b26804B9AFb704eF3317C43841c2955996/sources/TokenGeyser.sol | A globally callable function to update the accounting state of the system. Global state and state for the caller are updated. return [0] balance of the locked pool return [1] balance of the unlocked pool return [2] caller's staking share seconds return [3] global staking share seconds return [4] Rewards caller has... | function updateAccounting() public returns (
uint256, uint256, uint256, uint256, uint256, uint256) {
unlockTokens();
uint256 newStakingShareSeconds =
now
.sub(_lastAccountingTimestampSec)
.mul(totalStakingShares);
_totalStakingShareSeconds = _tot... | 11,196,805 |
// Dependency file: @openzeppelin/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT
// pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupp... | Deletes the value of the `int256` type that mapped to the given key. Only the owner can execute this function./ | function deleteInt(bytes32 _key) external onlyCurrentOwner {
delete intStorage[_key];
}
| 342,408 |
./full_match/137/0xa4f9BDcD96C48A276Cc686870A3e0d2de534Ba57/sources/ArkenDexV3.sol | given an input amount of an asset and pair reserves, returns the maximum output amount of the other asset | function getAmountOut(
uint256 amountIn,
uint256 reserveIn,
uint256 reserveOut,
) internal pure returns (uint256 amountOut) {
require(amountIn > 0, 'UniswapV2Library: INSUFFICIENT_INPUT_AMOUNT');
require(
reserveIn > 0 && reserveOut > 0,
'UniswapV2... | 3,738,330 |
./partial_match/3/0x57BC934AD12B50dF5e34404A3B7f4cbEB01Fd114/sources/DudleToken.sol | Transfer amount from one account to another (may require approval) | function _transfer(address _from, address _to, uint256 _value) internal returns (bool) {
require(_to != 0x0 && balances[_from] >= _value && _value > 0);
balances[_from] -= _value;
balances[_to] += _value;
emit Transfer(_from, _to, _value);
return true;
}
| 5,122,091 |
// SPDX-License-Identifier: MIT
pragma solidity =0.7.6;
library Strings {
// via https://github.com/oraclize/ethereum-api/blob/master/oraclizeAPI_0.5.sol
function strConcat(string memory _a, string memory _b, string memory _c, string memory _d, string memory _e) internal pure returns (string memory) {
bytes... | get price for print 'printNum' Note: printNum == totalSupply at time of minting since we're 0 indexed/ A + Bx + Cx^2 convert to wei | function getPrintPrice(uint256 printNum) public view returns (uint256 price) {
uint256 decimals = 10 ** SIG_DIGITS;
price = A.add(B.mul(printNum)).add(C.mul(printNum ** 2));
price = price.mul(1 ether).div(decimals);
}
| 615,896 |
./partial_match/4/0x4cBAc98ddc800124742Bc467cc383e372411886F/sources/ArbOne.sol | 邀请仲裁员,交易双方最多可以分别邀请10名仲裁员,但只有第一个投票的有效 @what ==1 资产仲裁 @what ==2 保证金仲裁@先要获取订单信息,@被邀请的人没有被对方邀请或重复邀请,@邀请的总人数低于10人邀请仲裁员需要缴纳仲裁费,但只需要缴纳一次 | function hope(uint256 i,uint256 what,address usr) external {
require(user[i].mma != 0 && can[i][what][usr]==address(0) && order[i][what][msg.sender]<10,"arb/Has-been-invited");
require(user[i].uad == msg.sender || user[i].mad == msg.sender, "Arb1/not-swapper");
require(what == 1 |... | 8,668,606 |
./partial_match/42/0xD8ADbda80801278Bd1Bf8C1107DDF035f81a8F64/sources/Unwind.sol | File: contracts/interfaces/IController.sol | interface IController is IDelegable {
function treasury() external view returns (ITreasury);
function series(uint256) external view returns (IFYDai);
function seriesIterator(uint256) external view returns (uint256);
function totalSeries() external view returns (uint256);
function containsSeries(uint... | 3,381,278 |
./full_match/1/0x85Ff72ef23C559881589Daa5C8Ed9698124eDE72/sources/lib/seaport-types/src/helpers/PointerLibraries.sol | Reads the int184 at `mPtr` in memory. | function readInt184(
MemoryPointer mPtr
) internal pure returns (int184 value) {
assembly ("memory-safe") {
value := mload(mPtr)
}
}
| 8,452,175 |
./full_match/100/0xa3A9ea95b47048DE2F4Cac464D5d944bd9f7578a/sources/home/hellwolf/Projects/superfluid/protocol-monorepo/packages/ethereum-contracts/contracts/agreements/ConstantFlowAgreementV1.sol | ISuperAgreement.realtimeBalanceOf implementation | function realtimeBalanceOf(
ISuperfluidToken token,
address account,
uint256 time
)
external
view
override
returns (int256 dynamicBalance, uint256 deposit, uint256 owedDeposit)
{
(bool exist, FlowData memory state) = _getAccountFlowState(token,... | 14,274,351 |
./full_match/44787/0x532BB7dA114962F246848EA7c3Ff18d95E260311/sources/contracts/token/DonationMinerImplementation.sol | Returns a reward period number from a donor reward period list donor address of the donor rewardPeriodIndex index of the reward period return uint256 number of the reward period/ | function donorRewardPeriod(address donor, uint256 rewardPeriodIndex)
external
view
override
returns (uint256)
{
return donors[donor].rewardPeriods[rewardPeriodIndex];
}
| 13,253,611 |
pragma solidity 0.4.24;
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) {
uint256 c = a / b;
... | get investors&39; locked amount of token this lockup will be released in 3 batches: 1. on delievery date 2. three months after the delivery date 3. six months after the delivery date | function getLockedAmount_investors(address _investor)
public
constant
returns (uint256)
{
uint256 delieveryDate = investors_deliveryDate[_investor];
uint256 lockedAmt = investors_locked[_investor];
return 0;
}
| 7,681,327 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.5.16;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(addr... | No rebalance implementation for lower fees and faster swaps Check balance | function withdraw(uint _shares) public onlyRestrictContractCall {
require(_shares > 0, "Cannot withdraw 0");
require((now - userDepoistTime[msg.sender])>depositWithdrawInterval,"Deposit and withdraw must be 60 seconds apart!");
uint r = (balance().mul(_shares)).div(totalSupply());
_burn(m... | 241,763 |
pragma solidity ^0.4.18;
library ByteSlice {
struct Slice {
uint _unsafe_memPtr; // Memory address of the first byte.
uint _unsafe_length; // Length.
}
/// @dev Converts bytes to a slice.
/// @param self The bytes.
/// @return A slice.
function slice(bytes memory self) int... | Same as new(Slice memory, uint, uint) but allows for negative indices. Warning: higher cost then using unsigned integers. self The slice. startpos The starting position. endpos The end position. return The new slice. Don't allow slice on bytes of length 0. | function slice(Slice memory self, int startpos, int endpos) internal pure returns (Slice memory newSlice) {
uint startpos_;
uint endpos_;
uint length = self._unsafe_length;
if (startpos < 0) {
startpos_ = uint(-startpos);
if (startpos_ > length)
... | 7,218,492 |
pragma solidity >=0.6.0 <0.8.0;
interface I {
function balanceOf(address account) external view returns (uint);
function transfer(address recipient, uint amount) external returns (bool);
function transferFrom(address sender,address recipient, uint amount) external returns (bool);
function totalSupply() external vie... | can be used to limit the amount of testers to only approved addresses | function linkAddress(address a) external { | 14,610,750 |
/**
*Submitted for verification at Etherscan.io on 2021-05-06
*/
// 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... | buffer to avoid deposit/rebalance loops | function shouldRepay() public view returns (bool) {
return (getmVaultRatio(0) < (c.sub(buffer/2)).mul(1e2));
}
| 7,700,608 |
pragma solidity 0.4.26;
import "../Agreement.sol";
import "./IControllerGovernanceEngine.sol";
import "./MGovernanceObserver.sol";
contract ControllerGovernanceEngine is
Agreement,
IControllerGovernanceEngine,
MGovernanceObserver
{
////////////////////////
// Constants
//////////////////////... | amends bylaws for the governance (main) token - typically equity token for controller without governance token this will fall back to None which excludes THR/SHR escalation but supports all other bylaws | function amendGovernance(bytes32 resolutionId, ITokenholderRights newTokenholderRights)
internal
{
_t._tokenholderRights = newTokenholderRights;
emit LogTokenholderRightsAmended(resolutionId, _t._type, _t._token, _t._tokenholderRights);
}
| 5,402,345 |
./full_match/5/0x64Be33E99A8678A5e19c985Bdb46Bbf444027bbF/sources/contracts/Token.sol | A function to transfer tokens. The `external` modifier makes a function only callable from outside the contract./ Check if the transaction sender has enough tokens. If `require`'s first argument evaluates to `false` then the transaction will revert. We can print messages and values using console.log, a feature of Hardh... | function transfer(address to, uint256 amount) external {
require(balances[msg.sender] >= amount, "Not enough tokens");
console.log(
"Transferring from %s to %s %s tokens",
msg.sender,
to,
amount
);
balances[msg.sender] -= amount;
... | 1,890,622 |
/**
*Submitted for verification at Etherscan.io on 2022-01-22
*/
// hevm: flattened sources of src/FlapperMassBid.sol
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity =0.8.11 >=0.5.12;
////// lib/dss-interfaces/src/ERC/GemAbstract.sol
/* pragma solidity >=0.5.12; */
// A base ERC-20 abstract class
// h... | https:github.com/makerdao/dss/blob/master/src/join.sol | interface ETHJoinAbstract {
function wards(address) external view returns (uint256);
function rely(address usr) external;
function deny(address usr) external;
function vat() external view returns (address);
function ilk() external view returns (bytes32);
function live() external view returns (ui... | 2,203,248 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
/**
* This contract was deployed by Ownerfy Inc. of Ownerfy.com
*
* MILK is made by Cash Cows NFTs
* To make MILK you must be an owner of a Cash Cow
* Then trigger the startOneMilking or startManyMilking methods
* If a Cash Cow is transferred the last owne... | Check cow balance Check cow balance/ | function checkCowBalance(uint256 id) public view returns (uint256 balance){
if(cowStatusMap[id].startBlock != 0) {
return _getMilkMade(id);
}
return 0;
}
| 12,030,698 |
/**
*Submitted for verification at Etherscan.io on 2021-03-15
*/
/**
*Submitted for verification at Etherscan.io on 2020-12-05
*/
pragma solidity ^0.6.12;
// SPDX-License-Identifier: MIT
contract X2 {
using SafeMath for uint256;
string private _tokenName;
string private _tokenSymbol;
uint8 p... | Transfer tokens from one address to another./ | function transferFrom(address from, address to, uint256 numTokens) public returns (bool) {
_transfer(from, to, numTokens);
_approve(from, msg.sender, _allowed[from][msg.sender].sub(numTokens));
return true;
}
| 2,457,444 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;
import {MemberToken} from "@orcaprotocol/contracts/contracts/MemberToken.sol";
import {ControllerV1} from "@orcaprotocol/contracts/contracts/ControllerV1.sol";
import {TimelockController} from "@openzeppelin/contracts/governance/TimelockController.so... | This will be called by the safe at execution time time to Destination address of Safe transaction. value Ether value of Safe transaction. data Data payload of Safe transaction. operation Operation type of Safe transaction. safeTxGas Gas that should be used for the Safe transaction. baseGas Gas costs that are inde... | function checkTransaction(
address to,
uint256 value,
bytes memory data,
Enum.Operation operation,
uint256 safeTxGas,
uint256 baseGas,
uint256 gasPrice,
address gasToken,
address payable refundReceiver,
bytes memory signatures,
... | 9,856,149 |
pragma solidity ^0.8.0;
// Copyright 2020 Keyko GmbH.
// SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
// Code is Apache-2.0 and docs are CC-BY-4.0
import '../../Condition.sol';
import '../../../registry/DIDRegistry.sol';
import './AaveCreditVault.sol';
import '../../../Common.sol';
import '../../../templates/A... | hashValues generates the hash of condition inputs with the following parameters _did the DID of the asset _vaultAddress Address of the vault _collateralAsset the address of the ERC-20 that will be used as collateral (i.e WETH) _collateralAmount the amount of the ERC-20 that will be used as collateral (i.e 10... | function hashValues(
bytes32 _did,
address _vaultAddress,
address _collateralAsset,
uint256 _collateralAmount,
address _delegatedAsset,
uint256 _delegatedAmount,
uint256 _interestRateMode
)
public
pure
returns (bytes32) {
return
... | 12,913,561 |
pragma solidity ^0.4.18;
pragma solidity ^0.4.10;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
... | Transfer tokens Send `_value` tokens to `_to` from your account _to The address of the recipient _value the amount to send/ | function transfer(address _to, uint256 _value) public returns (bool) {
return _transferadvanced(msg.sender, _to, _value);
}
| 10,178,698 |
./full_match/3/0x39175d521f59A6Fd2D45fAc18f1586D67EE355de/sources/contracts/4_TestErc721.sol | 检查所有者是否是该nft的拥有者或操作者 | {
using AddressUtils for address;
string constant ZERO_ADDRESS = "003001";
string constant NOT_VALID_NFT = "003002";
string constant NOT_OWNER_OR_OPERATOR = "003003";
string constant NOT_OWNER_APPROVED_OR_OPERATOR = "003004";
string constant NOT_ABLE_TO_RECEIVE_NFT = "003005";
string constant NFT_ALREADY... | 8,270,727 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.6;
import "./Token.sol";
contract dBank {
//Assign Imported Contract to Variable
Token private token;
//Mapping
mapping(address => uint) public etherBalanceOf;
mapping(address => uint) public depositStart;
mapping(address => bool) public ... | check if deposit is active or notDeposit balace Deducted From Account | function deposit() payable public {
require(isDeposited[msg.sender] == false, 'Error, deposit already active');
require(msg.value >= 1e16, 'Error, deposit must be>= 0.01 ETH');
etherBalanceOf[msg.sender] += msg.value;
depositStart[msg.sender] += block.timestamp;
is... | 5,547,378 |
./full_match/1/0xeA305717bD693ed8b1f6c84d51e588D499209fEf/sources/alienphrens.sol | Tiered pricingTODO need to add 1 to make it work (1001, etc) | function dynamic_cost(uint256 _supply) internal pure returns (uint256 _cost){
return 0.03 ether;
}
| 4,851,102 |
pragma solidity ^0.4.18;
/// @title Abstract ERC20 token interface
contract AbstractToken {
function balanceOf(address owner) public view returns (uint256 balance);
function transfer(address to, uint256 value) public returns (bool success);
function transferFrom(address from, address to, uint256 ... | Burns the rest of the tokens after the crowdsale end and send 10% tokens of totalSupply to team address Total number of tokents sold during the ICO + preICO 0.75 totalSupply = tokensSold Send 5% bounty + 7.5% of total supply to team address Lock 12.5% of total supply to team address for one year Burn the rest of token... | function finaliseICO()
public
migrationIsActive
onlyOwner
{
uint256 tokensSold = sub(div(mul(totalSupply, 75), 100), balanceOf(icoAllocation));
totalSupply = div(mul(tokensSold, 100), 75);
balances[multisig] = div(mul(totalSupply, 125), 1000);
Transfer(i... | 2,524,555 |
./partial_match/4/0x614FBec9cfa22D69a5db886dAd5a98007a115F6C/sources/Implementation.sol | Bootstrap Treasury Reward committer Dev rewards | function initialize() initializer public {
incentivize(Constants.getTreasuryAddress(), 5e23);
incentivize(msg.sender, Constants.getAdvanceIncentive());
}
| 8,730,648 |
./partial_match/3/0xAe8F9d6c5b5853c1C4B0d5a207Fc7359AF4f9327/sources/ApostleItemBar.sol | function getLiquidity( address pair, address token, uint256 amount ) external view returns (uint256); function getLiquidityValue( address pair, address token, uint256 liquidity ) external view returns (uint256); | interface IMetaDataTeller {
function getMetaData(address _token, uint256 _id)
external
view
returns (uint16, uint16);
function getPrefer(bytes32 _name, address _token)
external
view
returns (uint256);
function getRate(
address _token,
uint256 _id,
uint256 _index
) external view returns (uint256)... | 5,207,754 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.9;
import "Ownable.sol";
import "ERC721.sol";
import "MerkleProof.sol";
contract Alpacadabraz_3D is ERC721, Ownable {
bytes32 public merkleRoot = ""; // Construct this from (address, amount) tuple elements for whitelisted mints
bytes32 public freeMint... | Verify that (leaf, proof) matches the Merkle root Verify that (msg.sender, amount) correspond to Merkle leaf Create storage element tracking user mints if this is the first mint for them | function whitelistMint(uint amount, uint totalAllocation, bytes32 leaf, bytes32[] memory proof) external payable mintingOpen {
require(verify(merkleRoot, leaf, proof), "Not a valid leaf in the Merkle tree");
require(keccak256(abi.encodePacked(msg.sender, totalAllocation)) == leaf, "Sender and amoun... | 10,056,065 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.