file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
/*
Copyright 2019 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,... | Constructs an order with a specified maker address. makerAddress The maker address of the order. | function createOrder(address makerAddress)
internal
pure
returns (LibOrder.Order memory order)
{
order.makerAddress = makerAddress;
}
| 1,007,657 |
/**
*Submitted for verification at Etherscan.io on 2021-04-01
*/
// Sources flattened with hardhat v2.1.2 https://hardhat.org
// File @animoca/ethereum-contracts-erc20_base-4.0.0/contracts/token/ERC20/[email protected]
/*
https://github.com/OpenZeppelin/openzeppelin-contracts
The MIT License (MIT)
Copyright (c) 2... | IPurchaseNotificationsReceiver Interface for any contract that wants to support purchase notifications from a Sale contract./ | interface IPurchaseNotificationsReceiver {
function onPurchaseNotificationReceived(
address purchaser,
address recipient,
address token,
bytes32 sku,
uint256 quantity,
bytes calldata userData,
uint256 totalPrice,
bytes32[] calldata pricingData,
... | 2,027,216 |
./full_match/1/0x2fC246149B4B8d7bcEF6188A10AF1791380227f1/sources/src/Estate/EstateBaseToken.sol | create an Estate from a set of Lands, these need to be adjacent so they form a connected whole sender address perforing the operation that will create an Estate from its land token to the estate will belong to that address ids set of Land to add to the estate junctions list of indexes (the index at which the land/q... | function createFromMultipleLands(
address sender,
address to,
uint256[] calldata ids,
uint256[] calldata junctions
) external returns (uint256) {
require(to != address(0), "DESTINATION_ZERO_ADDRESS");
require(to != address(this), "DESTINATION_ESTATE_CONTRACT");
... | 8,434,831 |
./full_match/80001/0x71F9bDB3C54f8Fc91D314eA3295e3BECbD30A993/sources/project_/contracts/MysticGalacticMission1.sol | Returns the current price for minting a token in USD. return The current price in USD./ | function getPriceInUSD() public view returns (uint256) {
return usdPrice;
}
| 5,672,578 |
./full_match/5/0xcBd48b75f63860bD2E260291BB3E843F7C2377BB/sources/contracts/XChainController.sol | Guardian setter to tick up stage 2: | function setUnderlyingReceivedGuard(
uint256 _vaultNumber,
uint256 _underlyingReceived
) external onlyGuardian {
vaultStage[_vaultNumber].underlyingReceived = _underlyingReceived;
}
| 7,056,773 |
// KpopArena lets users play with their Kpop cards against other
// players on Kpop.io
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint25... | _a wins if score > 0 and _b wins if score < 0. Otherwise, draw. | function computeWinner(
address _host, uint _hostCelebId, uint _hostItemId,
address _challenger, uint _challengerCelebId, uint _challengerItemId,
uint _selectedTraitIdx
) private view returns(address winner)
{
uint hostTraitScore = computeTraitScore(_hostCelebId, _hostItemId, _selectedTraitIdx);
... | 601,584 |
./full_match/137/0x19CCFC1b66De84C26664892FDaD08548248E3964/sources/contracts/invest/Invest.sol | user fiat balance per currency | function getFiatPayment(uint16 tokenId, uint8 currency) external view returns (uint256) {
return userInvestmentImplementer.getFiatPayment(tokenId, currency);
}
| 3,759,931 |
./full_match/5/0x44c389877Fea739fC10636226A4D1b7DB3FDc67d/sources/browser/TestNFT_all.sol | Required interface of an ERC721 compliant contract./ | interface IERC721 is IERC165 {
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
function bala... | 1,851,851 |
pragma solidity ^0.4.23;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
int256 constant private INT256_MIN = -2**255;
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) ... | Computes the price and transfers winnings. Does NOT transfer ownership of token. Get a reference to the auction struct Explicitly check that this auction is currently live. (Because of how Ethereum mappings work, we can't just count on the lookup above failing. An invalid _tokenId will just return an auction object tha... | function _bidEth(uint256 _tokenId, uint256 _bidAmount)
internal
returns (uint256)
{
Auction storage auction = tokenIdToAuction[_tokenId];
require(!auction.allowPayDekla);
require(_isOnAuction(auction));
uint256 price = auction.price;
require(_bidAmount >= price)... | 6,389,644 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
// import "hardhat/console.sol";
import "./facades/LimboDAOLike.sol";
import "./facades/... | accumulated flan rewards from staking can be claimed token The soul for which to claim rewards index souls no longer listed may still have unclaimed rewards. | function claimReward(address token, uint256 index) public enabled {
Soul storage soul = souls[token][index];
updateSoul(token, soul);
User storage user = userInfo[token][msg.sender][index];
uint256 pending = getPending(user, soul);
if (pending > 0) {
rewardAdjustDebt(msg.sender, pending, s... | 5,521,298 |
./partial_match/80001/0xB2904746B58761f26607411F118e2E82c9978fa2/sources/contracts/openzepplin/ERC1155.sol | See {IERC1155-safeBatchTransferFrom}./ | function safeBatchTransferFrom(
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
)
public
virtual
override
{
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
require(to != address(0), "ERC1155: transfer ... | 8,795,286 |
./full_match/56/0x501e582E569938EEB4649bbc77EE2B9977ADb2E1/sources/contracts/Main_merged.sol | Returns the amount out received for a given exact input but for a swap of a single pool params The params for the quote, encoded as `QuoteExactInputSingleParams` tokenIn The token being swapped in tokenOut The token being swapped out fee The fee of the token pool to consider for the pair amountIn The desired input amo... | function quoteExactInputSingle(QuoteExactInputSingleParams memory params)
external
returns (
uint256 amountOut,
uint160 sqrtPriceX96After,
uint32 initializedTicksCrossed,
uint256 gasEstimate
);
function quoteExactOutput(bytes memory path, ... | 3,245,073 |
pragma solidity 0.5.16;
/// @title Ownable Contract
/// @author Anton Grigorev (@BaldyAsh)
contract Ownable {
/// @notice Storage position of the owner address
/// @dev The address of the current owner is stored in a
/// constant pseudorandom slot of the contract storage
/// (slot number obtained as a... | Transfers the control of the contract to new owner msg.sender must be the current owner _newOwner New owner address | function transferOwnership(address _newOwner) external {
requireOwner();
setOwner(_newOwner);
}
| 5,419,998 |
pragma solidity ^0.6.10;
// Inheritance
import "./Owned.sol";
import "./interfaces/IAddressResolver.sol";
import "./interfaces/IEtherWrapper.sol";
import "./interfaces/ISynth.sol";
import "./interfaces/IERC20.sol";
import "./interfaces/IWETH.sol";
// Internal references
import "./Pausable.sol";
import "./interfaces/I... | capacity = max(maxETH - balance, 0) | function capacity() public view override returns (uint _capacity) {
uint balance = getReserves();
if (balance >= maxETH()) {
return 0;
}
return maxETH().sub(balance);
}
| 12,734,626 |
// SPDX-License-Identifier: GPL v3
// README: https://github.com/daqnext/msn_contracts/blob/main/assets/koa_static/contracts/v2/MSN.md
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract MSN is ERC20 {
uint256 payable_amount;
address contract_owner;
bool exchange_ope... | //overwrite to inject the modifer | function _approve(
address owner,
address spender,
uint256 amount
) internal override {
require(
exchange_open == true ||
(special_list[owner] > 0) ||
(special_list[spender] > 0),
"exchange closed && not special"
);
... | 992,409 |
./full_match/1/0x13Bdb00E3Ad547aD392E9B4f1f91EDE8ACDb77CF/sources/contracts/CIV-Vault.sol | Add new strategy to our vault Only Owner can call this function addStrategyParam Parameters for new strategy deploy new CIVFundShare contract | function addStrategy(
AddStrategyParam memory addStrategyParam
) external virtual nonReentrant onlyOwner {
require(addStrategyParam._withdrawAddresses.length == 2, "ERR_V.3");
require(
address(addStrategyParam._guaranteeToken) != address(0),
"ERR_V.5"
);
... | 9,693,312 |
pragma solidity ^0.5.0;
contract StaticOpcodes {
function runBlockhash(uint _block) public view returns (uint _resp) {
assembly {
_resp := blockhash(_block)
}
}
function runCoinbase() public view returns (uint _resp) {
assembly {
_resp := coinbase()
... | Counterexample to test non-zero return | function runAdd() public pure returns (uint _resp) {
assembly {
_resp := add(2, 4)
}
}
| 7,294,666 |
./full_match/1/0x0BbE1D2c0BB0a2b7F2E3c3D59358193C9d2b0301/sources/contracts/staking/ResourceFieldV2.sol | See {IERC721-isApprovedForAll}./ | function isApprovedForAll(address, address) external pure override returns (bool) {
return false;
}
| 4,829,602 |
pragma solidity 0.4.24;
import "openzeppelin-solidity/contracts/lifecycle/Pausable.sol";
pragma experimental ABIEncoderV2;
/**
* @title AssetTracker
*/
contract AssetTracker is Pausable {
/**
* @dev Event types that can be created.
*/
enum EventTypes {CREATED, LOCATION, QUALITY, TEMPERATURE, HU... | Gets the data for an asset. id The id of the asset. return string The name of the asset. return bytes32 The id of the asset. return uint256 The timestamp of the asset. return bytes32 The event ids of the asset./ | function fetchAsset(bytes32 id) public view returns (string, bytes32, uint256, bytes32[]) {
uint arrayLength = assets[msg.sender].length;
for(uint i = 0; i < arrayLength; i++){
if(equal(assets[msg.sender][i].id, id)) {
return (assets[msg.sender][i].name, assets[msg.sende... | 13,012,549 |
/**
*Submitted for verification at Etherscan.io on 2021-09-13
*/
// SPDX-License-Identifier: NONE
pragma solidity 0.6.12;
// Part: OpenZeppelin/[email protected]/Address
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contra... | share = (total holder_score / total_score) | function claimNanas() external syncScore(msg.sender, address(0)) syncGlobalScore() {
uint256 totalFarmed = globalClaimed + BANANA.getTotalClaimable(address(this));
uint256 userShare = totalFarmed.mul(holderScores[msg.sender]).div(globalScore);
uint256 toSend = userShare.sub(holderClaimed[msg.sender]);
holderCl... | 7,954,365 |
/**
The software and documentation available in this repository (the "Software") is
protected by copyright law and accessible pursuant to the license set forth below.
Copyright © 2019 Staked Securely, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person or organizatio... | Get the Opportunities this portfolio is allowed to be in portfolioId - the id of the portfolio return Array of valid opportunity id's | function getOpportunities(bytes32 portfolioId) external view returns (bytes32[]) {
return _portfolioStorage[portfolioId].opportunities;
}
| 12,906,370 |
./full_match/3/0x81AC30a6E8f69f06cD508CA5bCa7EFE98e48C63E/sources/browser/tests/ALL/register.sol | 0x0000000000000000000000000000000080000000000000000000000000000001["0xCde02658383348b0103A89438c05395a4586B548","0xCde02658383348b0103A89438c05395a4586B548"]["100","1"] | interface IRep{
function init(address[] memory _initMember,uint256[] memory _initRep) external;
}
}
| 14,131,304 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
import "../interfaces/ERC1363Spec.sol";
import "../interfaces/EIP2612.sol";
import "../interfaces/EIP3009.sol";
import "../utils/AccessControl.sol";
import "../lib/AddressUtils.sol";
import "../lib/ECDSA.sol";
/**
* @title Artificial Liquid Intelligence ERC20 T... | Transfers some tokens and then executes `onTransferReceived` callback on the receiver @inheritdoc ERC1363 Called by token owner (an address which has a positive token balance tracked by this smart contract) Throws on any error like insufficient token balance or incorrect `_to` address: zero... | function transferAndCall(address _to, uint256 _value, bytes memory _data) public override returns (bool) {
return transferFromAndCall(msg.sender, _to, _value, _data);
}
| 1,075,647 |
./partial_match/1/0x45eDb535942a8C84D9f4b5D37e1b25F91Ea4804c/sources/RAOToken.sol | Change ETH/Token exchange rate | function changeTokenRate(uint _tokenPrice) public onlyOwner isActive {
RATE = _tokenPrice;
}
| 4,424,872 |
pragma solidity ^0.4.24;
/**
* @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
*/
function add(Role storage role, address account) internal {
r... | Decrease the amount of coins that an owner allowed to a spender. approve should be called when allowed_[_spender] == 0. To decrement allowed value is better to use this function to avoid 2 calls (and wait until the first transaction is mined) From MonolithDAO coin.sol spender The address which will spend the funds. s... | function decreaseAllowance(
address spender,
uint256 subtractedValue
)
public
returns (bool)
{
require(spender != address(0));
subtractedValue = SafeMath.mul(subtractedValue, 1 ether);
_allowed[msg.sender][spender] = (
_allowed[msg.sender][spender].sub(subtractedValue));
emit... | 6,484,767 |
/*
Copyright (c) 2019 WhaleChat
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, subl... | Allows token holders to confirm a transaction. The transaction must have been submitted and not yet confirmed by the sender. _transactionId Transaction ID. | function confirmTransaction(uint256 _transactionId) external
transactionExists(_transactionId)
notConfirmed(_transactionId, msg.sender)
{
confirmations[_transactionId][msg.sender] = true;
emit Confirmation(msg.sender, _transactionId);
}
| 1,037,101 |
pragma solidity 0.5.10;
contract Context {
constructor () internal { }
function _MSGSENDER793() internal view returns (address payable) { //inject NONSTANDARD NAMING
return msg.sender;
}
function _MSGDATA330() ... | inject NONSTANDARD NAMING | function POKE561(bytes32) external; | 1,784,135 |
pragma solidity ^0.4.22;
contract ERC721 {
// Required methods
function totalSupply() public view returns (uint256 total);
function balanceOf(address _owner) public view returns (uint256 balance);
function ownerOf(uint256 _tokenId) external view returns (address owner);
function approve(addr... | Crossing two of owner flowers | function breedOwn(uint256 _matronId, uint256 _sireId) external payable whenNotStopped {
require(msg.value >= autoBirthFee);
require(_owns(msg.sender, _matronId));
require(_owns(msg.sender, _sireId));
Flower storage matron = flowers[_matronId];
require(_isReadyToAction(matron... | 984,638 |
./full_match/77/0xDcBdf7bD80318d0f65a7d307524f9A0a5c36B281/sources/contracts/official/WEB3TES3/WEB3TES3Token.sol | Invokes the payDividends function multiple times Invoca a função payDividends count vezes/ | function payDividendsMultiple(uint256 _count) public onlyOwner {
for (uint256 i = 0; i < _count; i++) {
payDividends();
}
}
| 5,048,105 |
./full_match/1/0xf6324B299906dB5060EaD5109eaF18bb69982b74/sources/browser/myaccount.sol | solhint-disable-next-line max-line-length | function spell1(address _target, bytes memory _data) internal {
require(_target != address(0), "target-invalid");
bytes memory returndata = address(_target).functionCall(_data, "low-level call failed");
require(abi.decode(returndata, (bool)), "ERC20 operation did not succeed");
... | 9,687,586 |
/**
*Submitted for verification at Etherscan.io on 2021-07-16
*/
/**
......''''......
.',:cldxxkOOO0kddk0OOOkxxdlc:;'.
.,:lxkO00000000000k, .;k00000000000Okxl:,.
... | the actual live price - this price is used in maxTimeSellAmount and sellForBase/ | function currentPrice() public view returns (uint256) {
uint256 currentTimeStamp = block.timestamp;
return _computePriceInfo(currentTimeStamp).computedPrice;
}
| 8,009,733 |
./full_match/5/0x204Bc468cc9333A7Aac12aC2dBe03DcCFe9f03d0/sources/contracts/protocol/interfaces/pool/IRigoblockV3PoolState.sol | Returns the struct containing pool tokens info. return PoolTokens struct. Returns the aggregate pool generic storage. return poolInitParams The pool's initialization parameters. return poolVariables The pool's variables. return poolTokensInfo The pool's tokens info. Pool holder account. userBalance Number of tokens ... | function getPoolTokens() external view returns (PoolTokens memory);
function getPoolStorage()
external
view
returns (
ReturnedPool memory poolInitParams,
PoolParams memory poolVariables,
PoolTokens memory poolTokensInfo
);
struct UserAcco... | 7,040,089 |
./full_match/1/0x1a5C169Fbcbfb00B2c20c6746681aA774d8A613A/sources/contracts/TermPool.sol | List or delist pool in TermPoolFactory Callable only by TermPoolFactory | function setListed(bool _isListed) external onlyFactory {
emit PoolListingChanged(isListed);
}
| 2,935,170 |
/**
*Submitted for verification at Etherscan.io on 2022-03-07
*/
// SPDX-License-Identifier: GPL-3.0-or-later
/// CurveLPOracle.sol
// Copyright (C) 2021 Dai Foundation
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as publishe... | For consistency with other oracles | function zzz() external view returns (uint256) {
return zph - hop;
}
| 6,681,689 |
./full_match/42/0x7d0621fb7f6228Ac6af66506eeE3EeAD081389a4/sources/Users/danmeixu/woodstock/src/github.com/woodstock-tokyo/decentralized-video-community/src/contracts/Images.sol | Make sure the image hash exists Make sure image title exists Make sure image description exists Make sure uploader address exists address(0) means empty address (msg.sender != null) Increment image id like console.log() | function uploadImage(
string memory _imgHash,
string memory _title,
string memory _description
) public {
require(bytes(_imgHash).length > 0, "image hash does not exist");
require(bytes(_title).length > 0, "image title does not exist");
require(
bytes(... | 16,272,788 |
pragma solidity >=0.4.18 <0.7.0;
import '../solidity-lib/openzeppelin-solidity-112/contracts/lifecycle/TokenDestructible.sol';
import '../solidity-lib/openzeppelin-solidity-112/contracts/token/ERC20/ERC20.sol';
import '../solidity-lib/openzeppelin-solidity-112/contracts/math/SafeMath.sol';
import './OwnerContract.sol... | deposit a value of funds to the deposit address _deposit the deposit address _increase increase or decrease the value _value the deposit funds value/ | function doDeposit(address payable _deposit, bool _increase, uint256 _value) onlyOwner public returns(bool) {
return (_increase ?
walletStorage.increaseBalance(_deposit, _value) :
walletStorage.decreaseBalance(_deposit, _value));
}
| 6,415,872 |
pragma solidity 0.5.10;
import "./base/BanReasons.sol";
import "./interfaces/IBlockRewardAuRa.sol";
import "./interfaces/IGovernance.sol";
import "./interfaces/IRandomAuRa.sol";
import "./interfaces/IStakingAuRa.sol";
import "./interfaces/IValidatorSetAuRa.sol";
import "./upgradeability/UpgradeabilityAdmin.sol";
impor... | Stores previous validators. Used by the `finalizeChange` function. Save the previous validator set | function _savePreviousValidators() internal {
uint256 length;
uint256 i;
length = _previousValidators.length;
for (i = 0; i < length; i++) {
_isValidatorPrevious[_previousValidators[i]] = false;
}
length = _currentValidators.length;
for (i = 0; i ... | 2,495,725 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
... | See {IERC721-getApproved}./ | function getApproved(uint256 tokenId) public view virtual override returns (address) {
require(_exists(tokenId), ERROR_QUERY_FOR_NONEXISTENT_TOKEN);
return tokenApprovals[tokenId];
}
| 5,974,291 |
// SPDX-License-Identifier: MIT LICENSE
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "./interfaces/IWnDGame.sol";
import "./interfaces/ITrainingGrounds.sol";
imp... | $GP exchange amount handled within alter contract | function sellTreasureChests(uint16 qty) external whenNotPaused {
require(tx.origin == _msgSender(), "Only EOA");
alter.burn(TREASURE_CHEST, qty, _msgSender());
}
| 71,912 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.12;
/*
██████╗ █████╗ ███╗ ██╗██╗███████╗██╗
██╔══██╗██╔══██╗████╗ ██║██║██╔════╝██║
██║ ██║███████║██╔██╗ ██║██║█████╗ ██║
██║ ██║██╔══██║██║╚██╗██║██║██╔══╝ ██║
██████╔╝██║ ██║██║ ╚████║██║███████╗███████╗
╚═════╝ ╚═╝ ╚═╝╚═╝ ╚══... | Gets the URI of the NFT on Arweave. Concatenates 2 sections of the arweave URI. return string The URI./ | function arweaveURI(uint256 tokenId) external view returns (string memory) {
require(_exists(tokenId), "CXIP: token does not exist");
uint256 index = _calculateRotation(tokenId);
}
| 1,359,529 |
//Address: 0x938358f6f7786735cffbac3a218f3be16e496cf4
//Contract name: HODLwin
//Balance: 1.26244574 Ether
//Verification Date: 2/8/2018
//Transacion Count: 10
// CODE STARTS HERE
pragma solidity ^0.4.16;
// ----------------------------------------------------------------------------
//
// HODLwin sale contract
//... | Initialize (owner is set to msg.sender by Owned.Owned() / | function HODLwin () public {
require(TOKEN_SUPPLY_ICO + TOKEN_SUPPLY_AIR == TOKEN_SUPPLY_TOTAL);
wallet = owner;
adminWallet = owner;
}
| 14,073,524 |
/**
*Submitted for verification at Etherscan.io on 2021-02-12
*/
pragma solidity 0.8.0;
pragma abicoder v2;
interface MassetStructs {
struct BassetPersonal {
// Address of the bAsset
address addr;
// Address of the bAsset
address integrator;
// An ERC20 can charge transfe... | Mint Single / Transfer collateral to the platform integration address and call deposit Validation should be after token transfer, as bAssetQty is unknown before Log the Vault increase - can only be done when basket is healthy Mint the Masset | function _mintTo(
address _input,
uint256 _inputQuantity,
uint256 _minMassetQuantity,
address _recipient
) internal returns (uint256 mAssetMinted) {
require(_recipient != address(0), "Invalid recipient");
require(_inputQuantity > 0, "Qty==0");
BassetData[]... | 2,378,753 |
./full_match/83/0x8E2466c3a951aeDef136F7bd37EB6Ed7cE92eC70/sources/contracts/crowdFunding.sol | The function was implemented to prevent a project broken The admins of the pools can close it when they need but never taking the funding balance | function closePool() external override onlyRole(DEFAULT_ADMIN_ROLE) {
funding_.state = 3;
emit ClosePool(block.timestamp);
}
| 9,560,206 |
./partial_match/1/0x6601d3f885D1A91FfE63B4b4A834Cf9E2490C2D8/sources/src/settled-physical/AccountPhysicalEngine.sol | burn option token from account decrease short position (debt) in the current account decrease long position another account's storage _data bytes data to decode/ decode parameters token being burn must come from caller or the primary account for this subAccount update the account in state update the account in state... | function _burnOptionFromAccount(address _subAccount, bytes calldata _data) internal virtual {
(uint256 tokenId, address from, uint64 amount) = abi.decode(_data, (uint256, address, uint64));
if (from != msg.sender && !_isPrimaryAccountFor(from, _subAccount)) revert BM_InvalidFromAddress();
... | 4,198,893 |
//Address: 0xd754ee6a9e8964602f48e11971e79d0b2f6452d5
//Contract name: FixBet31
//Balance: 0.5 Ether
//Verification Date: 5/18/2018
//Transacion Count: 4
// CODE STARTS HERE
pragma solidity ^0.4.21;
contract Etherwow{
function userRollDice(uint, address) payable {uint;address;}
}
/**
* @title FixBet31
* @dev... | add funds or bet. if bet == false, add funds to this contract for cover the txn gas fee/ | function () payable{
if (bet == true){
require(msg.value == 1000000000000000000);
etherwow.userRollDice.value(msg.value)(31, msg.sender);
}
else return;
}
| 14,107,450 |
pragma solidity ^0.5.0;
/**
* @title FixidityLib
* @author Gadi Guy, Alberto Cuesta Canada
* @notice This library provides fixed point arithmetic with protection against
* overflow.
* All operations are done with uint256 and the operands must have been created
* with any of the newFrom* functions, which shift th... | x/y. If the dividend is higher than maxFixedDividend() it might overflow. You can use multiply(x,reciprocal(y)) instead. Test divide(fixed1(),0) fails Test divide(maxFixedDividend(),1) = maxFixedDividend()(10^digits()) Test divide(maxFixedDividend()+1,1) throws/ | function divide(Fraction memory x, Fraction memory y) internal pure returns (Fraction memory) {
require(y.value != 0);
uint256 X = x.value * FIXED1_UINT;
require(X / FIXED1_UINT == x.value);
return Fraction(X / y.value);
}
| 12,781,000 |
./full_match/11155111/0x2822d11D55E7Fff7e3Dc42a1d2986041Dd31b994/sources/contracts/Contract.sol | Validate usage of tokenids/ Mark candy and pebble nfts as used/ Mint all nfts to tokenids/ | function mintWithSignature(
MintRequest calldata _req,
bytes calldata _signature
) external returns (address signer) {
signer = _processRequest(_req, _signature);
validateTokensUsage(_req);
for (uint256 i = 0; i < _req.candyTokenIds.length; i++) {
candyNftsC... | 3,833,539 |
./full_match/4/0xC8DABB0558c937C043322C51E31153B572d69f99/sources/HATVaults.sol | Returns the addition of two unsigned integers, reverting on overflow. Counterpart to Solidity's `+` operator. Requirements: - Addition cannot overflow./ | function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
}
| 819,094 |
pragma solidity ^0.4.11;
import './SafeMath.sol';
import './Halt.sol';
import './WBTC.sol';
contract WBTCManager is Halt {
using SafeMath for uint;
/************************************************************
**
** VARIABLES
**
************************************************************/
/// WBT... | Register a storemanGroup Register a storemanGroup storemanGroup Address of the storemanGroup to be registered quota This storemanGroup's quota in WBTC/BTC pair return Result of registering the provided address, true if successful | function registerStoremanGroup(address storemanGroup, uint quota)
public
notHalted
onlyStoremanGroupAdmin
onlyMeaningfulValue(quota)
returns (bool)
{
require(storemanGroup != address(0));
require(!isStoremanGroup(storemanGroup));
mapStoremanGroup[storemanGroup] = StoremanGroup(quo... | 5,345,609 |
// SPDX-License-Identifier: MIT
pragma solidity =0.7.6;
import './provableAPI_0.6.sol';
// Interfaces
interface ISwappToken {
function currentSwappDay() external view returns (uint64);
function approve(address _spender, uint256 _value) external returns (bool success);
function mintSupply(address _investo... | Tracks investorTotalBalance used in _reserveSwapp() internal function _investorAddress address of the investor _value ETH amount invested (with bonus)/ | function _trackInvestors(address _investorAddress, uint256 _value) private {
if (investorTotalBalance[_investorAddress] == 0) {
totalInvestorCount++;
}
investorTotalBalance[_investorAddress] += _value;
}
| 6,013,256 |
./partial_match/1/0x1701ad6a252E24dee1D71DC1cAd6dA5426e0A3f1/sources/Users/petr/ankr/stakefi-smart-contract/legacy/contracts/upgrades/GlobalPool_R45.sol | Push 32 ETH x count to allowed vault, where ETH going to Deposit Contract | function pushToVault(address vault, uint256 count) external nonReentrant onlyOperator {
require(_allowedVaults[vault], "GlobalPool: vault not allowed");
require(count > 0, "GlobalPool: count is zero");
uint256 amount = count.mul(32 ether);
require(address(this).balance >= amount, "Gl... | 4,114,266 |
//
// ALLAH SMART CONTRACT
//
// Earn on investment 3% daily!
// Receive your 3% cash-back when invest with referrer!
// Earn 3% from each referral deposit!
//
//
// HOW TO TAKE PARTICIPANT:
// Just send ETH to contract address (min. 0.01 ETH)
//
//
// HOW TO RECEIVE MY DIVIDENDS?
// Send 0 ETH... | set date which enables control of growing function (limitation of investments per day) | function setGrowingControlStartAt(uint startAt) onlyOwner public {
growingControl.startAt = startAt;
}
| 6,362,029 |
./full_match/1/0x9965cCd16803432C6a0842f1D5690f32E427aEDd/sources/contracts/MerkleClaimer.sol | Claims TokenID(s) With Merkle note: This Is For 1:1 Mapping Burn To Redeem. Ex. Burn (NFT A TokenID 1) for (NFT B TokenID 90069420) note: transferFrom Implementation For NFT Burn & Transfer/ | function MerkleClaimAndBurnLive (
uint ClaimIndex,
uint[] calldata BurnTokenIDs,
uint[] calldata ClaimTokenIDs,
bytes32[][] calldata Proof
) external payable nonReentrant {
require(msg.value == (Claims[ClaimIndex]._ClaimCost * ClaimTokenIDs.length), "Claimer: Invalid Mess... | 8,470,505 |
./partial_match/1/0x488130618BF46CD904fdfE1E2f94d377d73f5Eb9/sources/FlyingCopper.sol | Allows a whitelisted address to mint one copy of the "Flying Copper" token. This function can only be called during the whitelist phase. _merkleProof The Merkle proof to verify the caller's whitelisted status. Ensure mint is in the whitelist phase. | function whitelistMint(bytes32[] calldata _merkleProof) external payable {
if (mintPhase != MintPhase.WHITELIST_PHASE) {
revert NotWhitelistPhase();
}
!MerkleProof.verify(
_merkleProof,
merkleRoot,
keccak256(abi.encodePacked(ms... | 15,497,195 |
pragma solidity 0.5.0;
import "./checkingContract.sol";
interface RegistrarStorage {
function resolveSafleId(string calldata) external view returns(address);
function transferSafleId (string calldata , address , address ) external returns (bool);
function auctionInProcess (address, string calldata) extern... | Return the bids of other bidders except the winner/ | function refundOtherBidders() external returns (bool) {
require(auction[msg.sender].returnBidsOfOther == false);
require(auction[msg.sender].auctionConductor == msg.sender);
require(auction[msg.sender].biddersArray.length > 0);
for (uint i = 0; i < auction[msg.sender].bid... | 1,087,951 |
./full_match/42220/0xf511A69b328FcfF1c24d0d5a25b5ae36b2D56844/sources/contracts/spaceswap-celoalfa/Factory.sol | update reserves and, on the first call per block, price accumulators overflow is desired never overflows, and + overflow is desired | function _update(uint balance0, uint balance1, uint112 _reserve0, uint112 _reserve1) private {
require(balance0 <= uint112(- 1) && balance1 <= uint112(- 1), 'UniswapV2: OVERFLOW');
uint32 blockTimestamp = uint32(block.timestamp % 2 ** 32);
uint32 timeElapsed = blockTimestamp - blockTimestamp... | 16,333,798 |
./full_match/1/0xCC4037C7C2D644c14cfc3Ec65d3635b4533b544b/sources/contracts/MangaGenesis.sol | ======================================================================= [external/onlyOwnerOrManager] for ERC2981======================================================================= | function setDefaultRoyalty( address receiver, uint96 feeNumerator ) external onlyOwner { _setDefaultRoyalty( receiver, feeNumerator ); }
| 16,535,445 |
./partial_match/1/0x1F3BAD0bBf6188CaCCA024d09a1475d6c88fA5B1/sources/GST.sol | Create `mintedAmount` tokens and send it to `target` target Address to receive the tokens mintedAmount the amount of tokens it will receive | function mintToken(address target, uint256 mintedAmount) onlyOwner public {
balanceOf[target] += mintedAmount;
totalSupply += mintedAmount;
emit Transfer(0, this, mintedAmount);
emit Transfer(this, target, mintedAmount);
}
| 15,474,894 |
pragma solidity ^0.4.23;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transf... | Extend parent behavior requiring purchase to respect the funding cap. _beneficiary Token purchaser _weiAmount Amount of wei contributed/ | function _preValidatePurchase(
address _beneficiary,
uint256 _weiAmount
)
internal
{
super._preValidatePurchase(_beneficiary, _weiAmount);
require(weiRaised.add(_weiAmount) <= cap);
}
| 10,170,616 |
./partial_match/1/0xd8Ce07E7FcE3fd901a458C9f2778f00bB07DB108/sources/MintplexOpenEditionPlusFactory.sol | Returns the address of the current owner./ | function owner() public view virtual returns(address) {
return _owner;
}
| 15,618,111 |
pragma solidity 0.4.25;
/*
* https://EtheriumToken.cloud
*
* Crypto Etherium token concept
*
* [✓] 5% Withdraw fee
* [✓] 10% Deposit fee
* [✓] 1% Token transfer
* [✓] 33% Referal link
*
*/
contract EtheriumEcoSystem {
struct UserRecord {
address referrer;
uint tokens;
uint gained_funds;
... | Total amount of tokens ERC20/ | function totalSupply() public view returns (uint) {
return total_supply;
}
| 6,576,508 |
// full contract sources : https://github.com/DigixGlobal/dao-contracts
pragma solidity 0.4.25;
// File: @digix/solidity-collections/contracts/abstract/AddressIteratorInteractive.sol
/**
@title Address Iterator Interactive
@author DigixGlobal Pte Ltd
*/
contract AddressIteratorInteractive {
/**
... | read all information and details of proposal _proposalId Proposal ID, i.e. hash of IPFS doc Proposal ID, i.e. hash of IPFS doc return { "_doc": "Original IPFS doc of proposal, also ID of proposal", "_proposer": "Address of the proposer", "_endorser": "Address of the moderator that endorsed the proposal", "_sta... | function readProposal(bytes32 _proposalId)
public
view
returns (
bytes32 _doc,
address _proposer,
address _endorser,
bytes32 _state,
uint256 _timeCreated,
uint256 _nVersions,
bytes32 _latestVersionDoc,
... | 6,489,478 |
/*
* Cardinal: Smart virtual debit card funded with Bitcoins
*
* Cardinal connects with banks using OBP standard to provide a virtual debit card to its clients,
* the transactions with the card are funded with a Bitcoin wallet from the client and transferred
* to the bank, so the bank can act as a liquidity pool ... | If the payment processor succesfully charges the smart card, the transaction funds will be transfered to the bankTransfer funds to the bank | function completeTransaction(bytes memory requesterCard, bytes32 referenceCode)
public
payable
onlyBank
validTransaction(requesterCard, referenceCode)
{
bytes32 transactionId = sha256(abi.encodePacked(requesterCard, referenceCode));
Transaction storage transa... | 12,803,714 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.5;
import "@openzeppelin/contracts/access/Ownable.sol";
interface IERC20 {
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
}
/**
* @... | The absolute amount that's claimable. | function claim(
uint256 window,
address account,
uint256 scaledPercentageAllocation,
bytes32[] calldata merkleProof
) external {
require(currentWindow > window, "Cannot claim for a future window");
require(
!isClaimed(window, account),
"Acc... | 5,507,942 |
./full_match/1/0x978217C022B8aCF346376f3488BC3CFE656cf811/sources/contracts/augur.sol | Allows owner to send aribitrary amounts of tokens to arbitrary adresses in last stage recipient Array of addresses of which recipient[i] will recieve amount [i] amount Array of integers of which amount[i] will be airdropped to recipient[i]/ | function airdrop(
address[] memory recipient,
uint256[] memory amount
)
public onlyOwner
{
require(burnState == 4, "Be patient.");
for(uint i = 0; i < recipient.length; ++i)
{
require(totalSupply() + (amount[i]) <= MAX_SUPPLY, "705 no more token availa... | 4,965,452 |
./partial_match/1/0x8183703E9DF90ed76bec0b0b8fAD33f2c024Be59/sources/KingOfEthResourcesInterface.sol | Lookup the number of resource points for a certain player _player The player in question | function lookupResourcePoints(address _player)
public
view
returns(uint)
{
uint result = 0;
result += KingOfEthResource(bronzeContract).balanceOf(_player);
result += KingOfEthResource(goldContract).balanceOf(_player) * 3;
result += KingOfEthResource(st... | 4,454,670 |
./full_match/1/0x0c7119c4241c603c4CE3320866e0768DC45A40b5/sources/Users/berthelotsylvain/dossier-dev/Moonstarter PoolContract Template/contracts/LaunchPadNakamotoPrivate.sol | Add from LaunchPad initial contract initiate vesting timestamp | function initVestingsTimestamp(
uint256 _first,
uint256 _second,
uint256 _third
) external onlyOwner {
require(
_third > _second && _second > _first && _first > block.timestamp,
"No good timestamp"
);
firstVestingUnlockTimestamp = _first;
... | 17,126,788 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when d... | Set maximum nft supply/ | function setMaxNftSupply(uint256 _maxValue) external onlyOwner {
require(_maxValue > maxNftSupply, "Invalid new max value");
maxNftSupply = _maxValue;
}
| 5,909,906 |
pragma solidity ^0.5.0;
import "../core/Ownable.sol";
import "../../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData is Ownable {
using SafeMath for uint256; // Allow SafeMath functions to be called for all uint256 types (similar to "prototype" in Javascript)
using Sa... | Buy insurance for a flight/ Add Insurance data struct | function buyInsurance
(
address passenger,
uint256 amountPaid,
bytes32 flightCode
)
external
payable
requireIsCallerAuthorized()
requireIsOperational()
requireExistFlight(flightCode)
preProcessIfPassengerNotExist... | 12,553,242 |
./full_match/42/0xF22B03E07043A0332DDE01cAb564d8d67B8339e3/sources/browser/GoalBet.sol | r = bet.ratio[0] / bet.ratio[1] maxAmountToBet = x / (r-1) - y maxAmountToBet = xx / (rx-x) - y | function take(
uint _id
) external payable {
require(msg.value > 0);
Bet storage bet = bets[_id];
require(now < bet.period[0], "Should bet before the end period bet.");
require(bet.amount[0] > bet.amount[1]);
address payable taker = msg.sender;
uint maxAmountToBet = bet.amount[0]*bet... | 16,289,348 |
pragma solidity ^0.5.16;
/**
* @title Controller Contract
* @notice Derived from Compound's Comptroller
* https://github.com/compound-finance/compound-protocol/tree/master/contracts
*/
/**
* @title Careful Math
* @notice Derived from OpenZeppelin's SafeMath library
* https://github.com/OpenZeppe... | Checks if the account should be allowed to mint tokens in the given market aToken The market to verify the mint against minter The account which would get the minted tokens mintAmount The amount of underlying being supplied to the market in exchange for tokens return 0 if the mint is allowed, otherwise a semi-opaque... | function mintAllowed(address aToken, address minter, uint mintAmount) external returns (uint) {
require(!mintGuardianPaused[aToken], "mint is paused");
if (!markets[aToken].isListed) {
return uint(Error.MARKET_NOT_LISTED);
}
distributeSupplierArtem(aToken, minter, fals... | 7,696,050 |
pragma solidity ^0.4.8;
/**
* @title KittyItemToken interface
*/
contract KittyItemToken {
function transfer(address, uint256) public pure returns (bool) {}
function transferAndApply(address, uint256) public pure returns (bool) {}
function balanceOf(address) public pure returns (uint256) {}
}
/**
... | KittyItemMarket constructor/ | function KittyItemMarket() public {
owner = msg.sender;
}
| 6,477,561 |
./full_match/1/0x4361b1B8aE2E4f96bFB7A2BC95D6aB748882fdbB/sources/src/Fiefdoms.sol | Override the standard isApprovedForAll function to return false for un-ALed operators owner Address of owner operator Address of operator | function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
if (useOperatorAllowList && !operatorAllowList[operator]) {
return false;
return super.isApprovedForAll(owner, operator);
}
}
| 4,962,757 |
pragma solidity ^0.5.6;
import "../token/HiblocksIERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
contract RewardSupplier {
using SafeMath for uint256;
/**
* @dev ERC20 Token under lockable functionality
*/
HiblocksIERC20 private _token;
/**
* @dev constant of reward
*... | Change new beneficiary newBeneficiary address of new beneficiary/ | function setBeneficiary(address newBeneficiary) external onlyWhitelistAdmin returns (bool) {
_const.beneficiary = newBeneficiary;
emit RewardLocked(newBeneficiary, _const.releaseTime);
return true;
}
| 1,828,621 |
./partial_match/56/0xEBcA288C044Feaa56aB4C17bB9E52170870ed013/sources/GKEYMasterFarmer.sol | Safe gkey transfer function, just in case if rounding error causes pool to not have enough GKEYs. | function safeGKEYTransfer(address _to, uint256 _amount) internal {
uint256 gkeyBal = gkey.balanceOf(address(this));
if (_amount > gkeyBal) {
gkey.transfer(_to, gkeyBal);
gkey.transfer(_to, _amount);
}
}
| 11,078,815 |
./full_match/1/0xD243629A94c657cB415cFfbfB4f84fb8b98496ec/sources/contracts/TipJarManager.sol | Initialize contract _tipJar TipJar proxy contract address _admin Admin address _timelock TimelockController contract address/ | function initialize(
address _tipJar,
address _admin,
address payable _timelock,
uint256 _criticalDelay,
uint256 _regularDelay
) external initializer onlyAdmin {
emit AdminChanged(admin, _admin);
admin = _admin;
tipJar = _tipJar;
emit TipJ... | 9,784,571 |
pragma solidity ^0.4.24;
/// 使用0.4.24是为了moac链 - www.moac.io
/// @title 红包合约
/// @author yelvabaoji - xfshen@moacfoundation.cn
contract Redpack {
address public owner;
uint public minPackAmount = 1 * (10 ** 18); // 最低参与金额, 1 moac/mfc
uint public maxPackAmount = 10000 * (10 ** 18); // 最高参与金额, 10000 moac/mfc
... | 抢红包。注意:抢完红包以后,抢的数据还保留着,以备查询 id 抢的是哪一个红包 先检查该红包有没有余额 按照随机因子计算抢到的金额,这里可能有细微的误差 考虑到计算的误差,最后一次抢红包,把余额全部发送出去 考虑到计算的误差 (比如100块钱发给3个人红包平均分),最后一次抢红包,把余额全部发送出去 如果余额 > 1份,但是小于2份,则一次发送完毕 如果余额 > 2份,则发送一份 | function hunting(uint id) public payable {
require(playerInfo[id].balance > 0, "redpack is empty");
require(playerInfo[id].count > playerInfo[id].hunterList.length, "exceed number of redpacks");
require(!checkHunterExists(id, msg.sender), 'already grabbed');
if(playerInfo[id].isRandom) {
... | 12,644,569 |
/**
*Submitted for verification at Etherscan.io on 2021-12-22
*/
/**
*Submitted for verification at Etherscan.io on 2021-12-21
*/
// SPDX-License-Identifier: MIT
pragma solidity ^ 0.8.7;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its dat... | Returns whether `spender` is allowed to manage `tokenId`. Requirements: - `tokenId` must exist./ | function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns(bool) {
require(_exists(tokenId), "ERC721: operator query for nonexistent token");
address owner = ERC721.ownerOf(tokenId);
return (spender == owner || getApproved(tokenId) == spender || isApprovedFor... | 1,647,401 |
... | inject NONSTANDARD NAMING | function GETBIDDINGPARAMETERS33() external view returns (uint256[] memory); | 2,477,886 |
// SPDX-License-Identifier: MIT
pragma solidity ^ 0.8.4;
//----Important Imports----//
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
i... | If There Is Claimable SOULSets Temp ValueRequires That There Is Enough SOUL ERC-20 Balance In Smart ContractRequires That Transaction Makes SenseModifies User BalanceLogs TransactionTransfers ERC-20 SafelyIf There Is Claimable KCALSets Temp ValueRequires That There Is Enough KCAL ERC-20 Balance In Smart ContractRequire... | function _claimTokens(address _userAddress) private returns (bool){
if(claimableBalance[_userAddress].soulBalance > 0){
uint tempBalance = claimableBalance[_userAddress].soulBalance;
require(addressSOUL.balanceOf(address(this)) >= totalUnclaimedSOUL, "Not Enough Balance"... | 12,017,187 |
./partial_match/1/0xc92AB2DfF994dd77c0D2fe09F21d5CF9ea2BcC0a/sources/contracts/artist/common/WildNFT.sol | updates the deny list flaggedOperator The address to be approved. status True if the operator is approved, false to revoke approval./ | function _updateDenyList(address flaggedOperator, bool status) internal virtual {
blockList[flaggedOperator] = status;
}
| 9,393,074 |
/**
* Copyright 2017-2020, bZeroX, LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0.
*/
pragma solidity 0.5.17;
pragma experimental ABIEncoderV2;
import "../core/State.sol";
import "../events/LoanSettingsEvents.sol";
import "../mixins/ModuleCommonFunctionalities.sol";
/**
* @title Loan ... | Set function selectors on target contract. target The address of the target contract. / | function initialize(address target) external onlyOwner {
address prevModuleContractAddress = logicTargets[this.setupLoanParams.selector];
_setTarget(this.setupLoanParams.selector, target);
_setTarget(this.disableLoanParams.selector, target);
_setTarget(this.getLoanParams.selector, ta... | 15,828,222 |
//Address: 0x7b7e5d448b8e1daab71eee0bd828d2798cfa4ae8
//Contract name: TokenMoney
//Balance: 0 Ether
//Verification Date: 12/29/2017
//Transacion Count: 1
// CODE STARTS HERE
pragma solidity ^0.4.18;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * ... | Allow spender to withdraw from your account, multiple times, up to the value amount. If this function is called again it overwrites the current allowance with value. spender The address of the sender value The amount to be approved return the transaction address and send the event as Approval | function approve(address spender, uint256 value) public {
require (
balances[msg.sender] >= value && value > 0
);
allowed[msg.sender][spender] = value;
Approval(msg.sender, spender, value);
}
| 12,650,062 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "./SafeMath.sol";
import "./Ownable.sol";
contract VintageShop is ERC721URIStorage, Ownable {
using SafeMath fo... | Checks if User exists before signing in user/ emit NewUser("this is a new user"); | function checkUser() view external returns (bool _exists) {
if(users[msg.sender].userExists == 1){
_exists = true;
_exists = false;
}
return _exists;
}
| 12,592,720 |
pragma solidity ^0.4.24;
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is als... | Allows to replace an owner with a new owner. Transaction has to be sent by wallet. owner Address of owner to be replaced. newOwner Address of new owner. | function replaceOwner(address owner, address newOwner)
public
onlyWallet
ownerExists(owner)
ownerDoesNotExist(newOwner)
{
for (uint i=0; i<owners.length; i++)
if (owners[i] == owner) {
owners[i] = newOwner;
break;
}
isOwner[... | 951,349 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.9.0;
import "../utils/Context.sol";
import "../token/ERC20/IERC20.sol";
import "../math/SafeMath.sol";
import "../token/ERC20/SafeERC20.sol";
import "../utils/ReentrancyGuard.sol";
/**
* @title Crowdsale for ERC20
* @dev Crowdsale is a base contract for ma... | Source of tokens. Override this method to modify the way in which the crowdsale ultimately gets and sends its tokens. beneficiary Address performing the token purchase tokenAmount Number of tokens to be emitted/ | function _postValidatePurchase(address beneficiary, uint256 weiAmount)
internal
view
function _deliverTokens(address beneficiary, uint256 tokenAmount)
internal
virtual
{
_token.safeTransfer(beneficiary, tokenAmount);
}
| 1,782,993 |
./partial_match/42/0x403cF41BD4Ee41A04f09761e363799ed55c8cE57/sources/ProofOfHumanity.sol | Returns the information of the submission. Includes length of requests array. _submissionID The address of the queried submission. return The information of the submission./ | function getSubmissionInfo(address _submissionID)
external
view
returns (
Status status,
uint submissionTime,
uint renewalTimestamp,
uint numberOfRequests,
bool registered
)
{
Submission storage submission = subm... | 9,000,254 |
//SPDX-License-Identifier: open-source
pragma solidity ^0.8.2;
import "./Certificate_NFT.sol";
contract quanly{
CertificateNFT NFT;
Certificate[] AllCert;
event issueCert(string title, string signature, string tokenUrl ,uint tokenID,address userAddress);
modifier onlyOwner {
requi... | hàm thực hiện việc cấp chứng nhận. Chỉ những người được cấp quyền mới có thể chạystudent[_student].push(AllCert.length); | function addCert( string memory title, string memory tokenUrl, string memory signature) public{
uint tokenID = NFT.safeMint(msg.sender,tokenUrl);
AllCert.push(Certificate(title,tokenUrl,block.timestamp,signature,tokenID,msg.sender));
emit issueCert(title, signature, tokenUrl , to... | 992,837 |
./full_match/4/0xf50f0537768cAFc267f38eC536a081D53ea09bB1/sources/browser/DataManagement.sol | update the acl_keeper no need to update the acl_keeper retrieve the Access Token | function grantAccess (address _owner, address _thirdparty, uint8 _permission) public {
require(msg.sender == _owner);
bytes32 token;
token = aclists[_owner][_thirdparty].token;
if (aclists[_owner][_thirdparty].permission != _permission){
aclists[_owner][_thirdparty].permission = _permission;
tokenl... | 13,337,596 |
./partial_match/3/0x0CDa1f86B7C416643489BA118c9A62B7e911953e/sources/NEW_Exchange.sol | Liquifies tokens to ethereum./ | function sell(uint256 _amountOfTokens)
onlyBagholders()
public
{
address payable _customerAddress = msg.sender;
require(_amountOfTokens <= tokenBalanceLedger_[_customerAddress]);
uint256 _tokens = _amountOfTokens;
uint256 _ethereum = tokensToEthereum_(_tokens);
... | 5,104,089 |
pragma solidity ^0.4.24; contract OraclizeI {
address public cbAddress;
function query(uint _timestamp, string _datasource, string _arg) external payable returns (bytes32 _id);
function query_withGasLimit(uint _timestamp, string _datasource, string _arg, uint _gaslimit) external payable returns (bytes32 _id... | FIXME: enable oraclize_setProof is production oraclize_setProof(proofType_TLSNotary | proofStorage_IPFS); | function ExchangeRate(uint256 weiValue) public view returns (uint256 exchanged, uint256 remainder);
}
function Ticker() public {
}
| 12,047,538 |
// File: @openzeppelin/contracts/token/ERC777/IERC777.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @dev Interface of the ERC777Token standard as defined in the EIP.
*
* This contract uses the
* https://eips.ethereum.org/EIPS/eip-1820[ERC1820 registry standard] to let
* token holders and rec... | Interface of the ERC20 standard as defined in the EIP./ | interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint2... | 95,922 |
pragma solidity ^0.4.11;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
f... | _tokenAddress address of a HQX token contract _bankAddress address for remain HQX tokens accumulation _beneficiaryAddress accepted ETH go to this address _tokenRate rate HQX per 1 ETH _minBuyableAmount min ETH per each buy action (in ETH wei) _maxTokensAmount ICO HQX capacity (in HQX wei) _endDate the date when I... | function ChangeableRateCrowdsale(
address _tokenAddress,
address _bankAddress,
address _beneficiaryAddress,
uint256 _tokenRate,
uint256 _minBuyableAmount,
uint256 _maxTokensAmount,
uint256 _endDate
) ClaimableCrowdsale(
_tokenAddress,
_bank... | 12,814,343 |
./partial_match/1/0xdDc2c27eA8a42b35B329c4e0216600F12EED13d1/sources/contracts/wombat-governance/rewarders/BoostedMultiRewarder.sol | Function called by Master Wombat when factor is updated Assume lpSupply and sumOfFactors isn't updated yet when this function is called user.unpaidRewards will be updated base partition only rewardDebt > 0 indicates the user has activated the pool and we should calculate rewards | function onUpdateFactor(address _user, uint256 _newFactor) external override onlyMasterWombat {
if (basePartition() == TOTAL_PARTITION) {
return;
}
updateReward();
uint256 length = rewardInfos.length;
for (uint256 i; i < length; ++i) {
RewardInfo sto... | 2,762,767 |
/**
Source code of Opium Protocol
Web https://opium.network
Telegram https://t.me/opium_network
Twitter https://twitter.com/opium_network
*/
// File: LICENSE
/**
The software and documentation available in this repository (the "Software") is protected by copyright law and accessible pursuant to the licens... | This function creates pooled positions _derivative Derivative Derivative definition _quantity uint256 Quantity of positions to create _address address Address of position receiver Local variables Create instance of Opium.SyntheticAggregator Create instance of Opium.IDerivativeLogic Create instance of margin token Cr... | function _createPooled(Derivative memory _derivative, uint256 _quantity, address _address) private {
CreatePooledLocalVars memory vars;
vars.syntheticAggregator = SyntheticAggregator(registry.getSyntheticAggregator());
vars.derivativeLogic = IDerivativeLogic(_derivative.syntheticId);
... | 1,368,153 |
./full_match/1/0x2CF4abb70f2732B522DC59cb644b560eE2BF43e6/sources/foraging-contracts/Nom.sol | View balance of tokens not yet withdrawn | function viewBalance(address owner) external view returns (uint256) {
return balances[owner];
}
| 3,029,844 |
// SPDX-License-Identifier: BUSL-1.1
// For further clarification please see https://license.premia.legal
pragma solidity ^0.8.0;
import {EnumerableSet} from "@solidstate/contracts/utils/EnumerableSet.sol";
import {ABDKMath64x64} from "abdk-libraries-solidity/ABDKMath64x64.sol";
import {IPoolIO} from "./IPoolIO.sol"... | Value to add to negative numbers to cast them to int256 Value equal to -1 Check if value is a negative number and needs casting | function parseVolatilitySurfaceCoefficients(bytes32 input)
internal
pure
returns (int256[] memory coefficients)
{
coefficients = new int256[](COEFF_AMOUNT);
int256 toAdd = (int256(-1) >> COEFF_BITS) << COEFF_BITS;
assembly {
let i := 0
le... | 104,132 |
./full_match/1/0x361384A0d755f972E5Eea26e4F4efBAf976B6461/sources/contracts/external/aave/incentives/base/BaseIncentivesController.sol | @inheritdoc IAaveIncentivesController | function getUserUnclaimedRewards(address _user) external view override returns (uint256) {
return _usersUnclaimedRewards[_user];
}
| 4,835,743 |
./partial_match/1/0x7d000609a3c0C6Ba13DD318E56934CB5523Ba431/sources/SolomonSale.sol | Get the maximum amount of ETH (wei) each address can exchange return Maximum ETH (wei) per address | function maximum() public view returns (uint256) {
return _maximum;
}
| 4,344,246 |
/**
*Submitted for verification at Etherscan.io on 2021-04-22
*/
// File: @openzeppelin/contracts/utils/Context.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While th... | Set the starting index block for the collection, essentially unblocking setting starting index/ | function emergencySetStartingIndexBlock() public onlyOwner {
require(startingIndex == 0, "Starting index is already set");
startingIndexBlock = block.number;
}
| 1,187,838 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.