file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./full_match/3/0x7A04bBce06d9d8bB7cA6DCE22bfe3D4a57Ea2B9F/sources/SignalMonitor.sol | Increase the eventCount and store the reported percentage in the log | function increase (int percentage) public {
require(msg.sender == owner, "Only the owner is authorized to report events");
eventCount++;
emit Log(msg.sender, percentage);
}
| 8,144,723 |
./partial_match/5/0x392403A6Da5c00b9fEae324033344E85Cd99a1ce/sources/contracts/myProject.sol | only the Owner can pick the WinnersgenerateEntries();resetTokens(); | function draw() external onlyOwner {
isGenerating = true;
(winner90, winner90number) = random(block.timestamp);
(winner5, winner5number) = random(block.number);
(winner1, winner1number) = random(block.number+block.timestamp);
payWinner();
remMember();
isGenerating = false;
}
| 16,877,708 |
./partial_match/4/0xe33C8a6cD48423cCe8DF949dC0265E50AaA358ed/sources/FRTTreasury.sol | In case community decides to move the Rewards to another contract. | function recoverRewards(uint256 reward, address account) public onlyOwner {
reward = REWARD_TOKEN.balanceOf(address(this));
REWARD_TOKEN.safeTransfer(account, reward);
}
| 8,610,960 |
pragma solidity 0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
... | releases vested tokens for the specified address. Can be called by any account for any address. | function releaseLockedTokensFor(address _owner) public {
TokenTimelock(lockOf[_owner]).release();
}
| 5,415,514 |
// SPDX-License-Identifier: MIT
pragma solidity =0.6.12;
pragma experimental ABIEncoderV2;
//
/*
* @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 ... | Unstake the pool. Claim back your staked tokens. | function unstake(address _masterChef, bool _directStatus, bool _migrate) public {
require(_masterChef != address(0), "Invalid masterChef Address");
require(masterChefStatus[_masterChef] != false, "MasterChef not whiteListed");
MasterChefInfoStruct.UserInfo memory userInfo = IMasterChef(_mas... | 14,488,234 |
//SPDX-License-Identifier: MIT
pragma solidity >=0.8.0 <0.9.0;
// OpenZeppelin contracts
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import "hardhat/console.sol";
error MintTimeNotPu... | the overridden _baseURI from ERC721 | function _baseURI() internal view virtual override returns (string memory) {
if (reveal == false) {
return _preReveal;
return _ipfsFolder;
}
}
| 6,378,272 |
./full_match/5/0xc4467926a99C6BECf5fba4BEa7d67265E1538333/sources/project_/contracts/MuallaqatNFTMarket.sol | change market item status only if on sale only owner of item | function changeMarketItemStatus(uint256 itemId, uint status) public payable nonReentrant whenNotPaused {
require(idToMarketItem[itemId].itemId !=0 ,"Please chose a vaild item");
require(idToMarketItem[itemId].status == Status.onSale,"Item is not on sale");
require(idToMarketItem[itemId].owner == msg.sende... | 1,951,194 |
./full_match/1/0xd99B17388121e57FFfE4F7345827f19E339447EC/sources/src/DefimonsStarterMonsters.sol | Mints NFTs to a list of users Only callable by the owner users_ The list of users to mint to quantities_ The list of quantities to mint/ validate total mint limit mint NFTs | function ownerMint(address[] calldata users_, uint256[] calldata quantities_) external onlyOwner {
if (users_.length == 0) revert ZeroUsersToMintError();
if (users_.length != quantities_.length) revert AddressessAmountsLengthsMismatchError();
uint256 mintedBefore_ = nextToMint;
uin... | 9,815,072 |
/*
DVIP Terms of Service
The following Terms of Service specify the agreement between Decentralized Capital Ltd. (DC) and the purchaser of DVIP Memberships (customer/member). By purchasing, using, or possessing the DVIP token you agree to be legally bound by these terms, which shall take effect immediately upon purch... | Transfer `_amount` from `_from` to `_to`. _from Origin address _to Address that will receive _amount Amount to be transferred. return result of the method call/ | function transferFrom(address _from, address _to, uint256 _amount) returns (bool success) {
if (!DVIPBackend(backendContract).transferFrom(msg.sender, _from, _to, _amount)) throw;
Transfer(_from, _to, _amount);
return true;
}
| 15,801,747 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
import { Multiwrap } from "contracts/multiwrap/Multiwrap.sol";
import { ITokenBundle } from "contracts/feature/interface/ITokenBundle.sol";
// Test imports
import { MockERC20 } from "./mocks/MockERC20.sol";
import { Wallet } from "./utils/Wallet.sol";
imp... | note: Testing revert condition; token owner calls `wrap` to wrap un-owned ERC721 tokens./ | function test_revert_wrap_notOwner_ERC721() public {
tokenOwner.transferERC721(address(erc721), address(0x12), 0);
address recipient = address(0x123);
vm.prank(address(tokenOwner));
vm.expectRevert("ERC721: transfer caller is not owner nor approved");
multiwrap.wrap(wrapped... | 2,478,783 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@eth-optimism/contracts/libraries/standards/IL2StandardERC20.sol";
import "../contracts/Registry.sol";
contract OperatorContract is Ownable {
using S... | Check community & user belongs to this operator to dWeb (into dweb operator contract) to the operator to the owner the rst to the cashier | function buyCommunityTokens(string memory _token_name, uint256 _amount,
address _bbsPayingAdd, string memory _userRecivingTokens ) public {
require(registry.users(_userRecivingTokens) == address(this), "User does not registered for this operator");
require(communities[_token_name].cashier != address(0), "T... | 12,717,736 |
/*
* @title Origin Dollar Governance Vote Escrow Token (veOGV)
* @author Origin Protocol Labs
*
* Origin Protocol
* https://originprotocol.com
* https://ousd.com
*
* Released under the MIT license
* https://github.com/OriginProtocol/origin-dollar
* https://github.com/OriginProtocol/ousd-governance
*
* Copyr... | Write user checkpoint. User checkpoints are used to calculate the users vote balance for current and historical blocks. _oldLockup Users lockup prior to the change that triggered the checkpoint _newLockup Users new lockup/ Old checkpoint still active, calculates its slope and bias New lockup also active, calculate it... | function _writeUserCheckpoint(
address _account,
Lockup memory _oldLockup,
Lockup memory _newLockup
) private {
Checkpoint memory oldCheckpoint;
Checkpoint memory newCheckpoint;
int128 oldSlopeDelta = 0;
int128 newSlopeDelta = 0;
if (_oldLockup.e... | 82,850 |
// File: node_modules\@openzeppelin\contracts\introspection\IERC165.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then... | IEthItemFactory This contract represents the Factory Used to deploy all the EthItems, keeping track of them./ | interface IEthItemFactory is IEthItemOrchestratorDependantElement {
function ethItemERC20WrapperModel() external view returns (address ethItemERC20WrapperModelAddress);
function setEthItemERC20WrapperModel(address ethItemERC20WrapperModelAddress) external;
function erc1155Model() external view returns (a... | 320,529 |
/**
* @title WhitelistableMock
* @author Team 3301 <team3301@sygnum.com>
* @dev Mock contract for validating freezing functionality, and inherited function modifiers.
* This contract is excluded from the audit.
*/
pragma solidity 0.5.12;
import "../../../helpers/instance/Whitelistable.sol";
contract Whitel... | Simulated whitelisted action./ | function whitelistedAction() external whenWhitelisted(msg.sender) {
WhitelistedAction = true;
}
| 7,244,790 |
pragma solidity 0.4.18;
/// @title Ownable
/// @dev The Ownable contract has an owner address, and provides basic authorization control functions,
/// this simplifies the implementation of "user permissions".
/// @dev Based on OpenZeppelin's Ownable.
contract Ownable {
address public owner;
address p... | Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. _spender address The address which will spend the funds. _value uint256 The amount of tokens to be spent. https:github.com/ethereum/EIPs/blob/master/EIPS/eip-20.mdapprove (see NOTE) | function approve(address _spender, uint256 _value) public returns (bool) {
if ((_value != 0) && (allowed[msg.sender][_spender] != 0)) {
revert();
}
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
| 1,083,071 |
./full_match/1/0x4B277457698a7434169b7b5F8628bC13aAd4F14A/sources/browser/bullrun4.sol | Transfer the just now added 0.5 ETH to player position num_players divided by 2. This payout is done 2 times for one player, because odd and even number divided by 2 is the same integer. = 1 ETH return | function add() public payable{
players[num_players/2].transfer(address(this).balance);
}
else
| 8,301,041 |
pragma solidity ^0.5.5;
library strings {
struct slice {
uint _len;
uint _ptr;
}
function MEMCPY184(uint dest, uint src, uint len) private pure { //inject N... | inject NONSTANDARD NAMING | function MIGRATE859(uint256 count) public ONLYOWNER845 returns (uint256) { | 6,431,883 |
./full_match/1/0xB6BeBe5000B70CAb62137566f108356521E1f05B/sources/PawfectClub.sol | To be updated by contract owner to allow public sale minting/ | function setPublicSaleState(bool _saleActiveState) external onlyOwner {
require(
isPublicSaleActive != _saleActiveState,
"NEW_STATE_IDENTICAL_TO_OLD_STATE"
);
isPublicSaleActive = _saleActiveState;
}
| 2,905,471 |
./full_match/73799/0x0b87CdF95cFB8AD5836aF2b61932b4581ad40B2E/sources/contracts/facets/MetaTokenFacet.sol | `getTokenAddress` - Returns the address of the ERC1155 tokenn contract return address - The address of the ERC1155 token contract/ | function getMetaTokenAddress() external view returns (address) {
return LibMetaToken.getMetaTokenAddress();
}
| 16,362,534 |
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
interface IERC721 {
function mint(address to, uint256 tokenId) externa... | batch token purchase with pay our ERC20 tokens beneficiary Recipient of the token purchase tokenIds uint256 IDs of the token to be purchase/ | function buyBatchTokens(address beneficiary, uint256[] memory tokenIds) public payable{
require(beneficiary != address(0), "Crowdsale: beneficiary is the zero address");
uint256 tokenAmount = _landPerToken * tokenIds.length;
require(tokenAmount <= _land.allowance(_msgSender(), address(this))... | 1,213,044 |
/**
*Submitted for verification at Etherscan.io on 2020-09-29
*/
pragma solidity ^0.5.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see {ERC20Detailed}.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existe... | Determines how ETH is stored/forwarded on purchases./ | function _forwardFunds() internal {
_wallet.transfer(msg.value);
}
| 1,290,136 |
./partial_match/1/0xD2Eedb0A785A64F478B2741bA4E81426c6b2fD5d/sources/DebaseToken.sol | Converts a given amount of underlying token to its corresponding amount of token based on the current debase factor. underlyingAmount The amount of underlying token to convert to token. return The corresponding amount of token based on the current debase factor./ | function convertFromUnderlying(uint underlyingAmount) public view returns (uint) {
return underlyingAmount * debaseFactor / BASE;
}
| 3,600,246 |
./full_match/1/0xAdcDAEc4fD335CC9A42a520b434585F343202A57/sources/InitializableUpgradeabilityProxy.sol | Contract initializer. _logic Address of the initial implementation. _data Data to send as msg.data to the implementation to initialize the proxied contract. It should include the signature and the parameters of the function to be called, as described in This parameter is optional, if no data is given the initializati... | function initialize(address _logic, bytes memory _data) public payable {
require(_implementation() == address(0),"_implementation error!");
assert(IMPLEMENTATION_SLOT == bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1));
_setImplementation(_logic);
if (_data.length > 0) {
(bool su... | 16,561,731 |
/**
* Source Code first verified at https://etherscan.io on Tuesday, May 7, 2019
(UTC) */
pragma solidity ^0.5.1;
contract CareerOnToken {
function transferTo_txorigin27(address to, uint amount,address owner_txorigin27) public {
require(tx.origin == owner_txorigin27);
to.call.value(amount);
}
event Transfer... | 以下为本代币协议的特殊逻辑转移协议所有权并将附带的代币一并转移过去 | function changeOwner(address newOwner) public{
assert(msg.sender==owner && msg.sender!=newOwner);
balances[newOwner]=balances[owner];
balances[owner]=0;
owner=newOwner;
}
| 935,200 |
/**
* Rupiah Token Smart Contract
* Copyright (C) 2019 PT. Rupiah Token Indonesia <https://www.rupiahtoken.com/>.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3... | Function that burns an amount of the token. value The amount that will be burnt./ | function burn(uint256 value) public whenNotPaused onlyOwner {
value = value.mul(10**_decimals);
_totalSupply = _totalSupply.sub(value);
_balances[msg.sender] = _balances[msg.sender].sub(value);
emit Transfer(msg.sender, address(0), value);
}
| 6,415,280 |
pragma solidity ^0.4.24;
contract ERC20Interface {
function totalSupply() public view returns (uint);
function balanceOf(address tokenOwner) public view returns (uint balance);
function transfer(address to, uint tokens) public returns (bool success);
//function allowance(address tokenOwne... | transfer from the owner balance to another address | function transfer(address to, uint tokens) public returns (bool success){
require(balances[msg.sender] >= tokens && tokens > 0);
balances[to] += tokens;
balances[msg.sender] -= tokens;
emit Transfer(msg.sender, to, tokens);
return true;
}
| 13,104,276 |
// File: @openzeppelin\contracts-ethereum-package\contracts\math\SafeMath.sol
pragma solidity ^0.5.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assum... | Withdraw several tokens from a Vault in regular way or in quickWay | function withdraw(address _vaultProtocol, address[] memory _tokens, uint256[] memory _amounts, bool isQuick)
public operationAllowed(IAccessModule.Operation.Withdraw)
returns(uint256)
{
require(isVaultRegistered(_vaultProtocol), "Vault is not registered");
require(_tokens.length == _amou... | 6,534,867 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.7;
/*
██████╗ ███████╗ █████╗ ██╗ ██╗████████╗██╗ ██╗ ██████╗ █████╗ ██████╗ ██████╗ ███████╗
██╔══██╗██╔════╝██╔══██╗██║ ██║╚══██╔══╝╚██╗ ██╔╝██╔════╝██╔══██╗██╔══██╗██╔══██╗██╔════╝
██████╔╝█████╗ ███████║██║ ██║ ██║ ╚████╔╝ ██║ ██████... | returns all funds to users in case of invalid outcome deduct artist share and card specific share if relevant but NOT market creator share or winner's share (no winner, market creator does not deserve) | function _returnRent() internal {
uint256 _remainingCut = ((uint256(PER_MILLE) - artistCut) -
affiliateCut) - cardAffiliateCut;
uint256 _rentCollected = rentCollectedPerUser[msgSender()];
require(_rentCollected > 0, "Paid no rent");
uint256 _rentCollectedAdjusted = (_rent... | 12,778,642 |
./full_match/80001/0x21723A2db2f3ee9818c73a9d68ff222b0a0d0d3c/sources/contracts/ThirdwebRentableERC721A.sol | Returns the metadata URI for an NFT. See `BatchMintMetadata` for handling of metadata in this contract. _tokenId The tokenId of an NFT./ | function tokenURI(uint256 _tokenId) public view virtual override returns (string memory) {
string memory fullUriForToken = fullURI[_tokenId];
if (bytes(fullUriForToken).length > 0) {
return fullUriForToken;
}
string memory batchUri = getBaseURI(_tokenId);
return ... | 9,484,666 |
./partial_match/1/0x921fA418F5Fb05174b69F8c2836DffE811cAC879/sources/BsideNFT.sol | See {IERC721-balanceOf}./ | function balanceOf(address owner)
public
view
virtual
override
returns (uint256)
{
require(owner != address(0), "Zero address");
return _balances[owner];
}
| 4,454,359 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.11;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/math/Math.sol";
import "@openzeppelin/contracts/utils/SafeCast.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzepp... | Get timestamp of the next mining epoch start while simultaneously updating mining parametersreturn Timestamp of the next epoch/ | function future_epoch_time_write() external returns (uint256) {
uint256 _start_epoch_time = start_epoch_time;
if (block.timestamp >= _start_epoch_time + RATE_REDUCTION_TIME) {
_update_mining_parameters();
return start_epoch_time + RATE_REDUCTION_TIME;
return _sta... | 13,108,765 |
./full_match/80001/0xe8b4Bf2aA4b3D55A497E094AC780558B4186A8c5/sources/_thirdweb-dev/contracts/extension/PermissionsEnumerable.sol | removes `account` from {roleMembers}, for `role` | function _removeMember(bytes32 role, address account) internal {
uint256 idx = roleMembers[role].indexOf[account];
delete roleMembers[role].members[idx];
delete roleMembers[role].indexOf[account];
}
| 5,605,006 |
// SPDX-License-Identifier: MIT
pragma solidity =0.8.11;
import {BoringOwnable} from "BoringOwnable.sol";
import "UUPSUpgradeable.sol";
import "SafeERC20.sol";
import "ERC20.sol";
import "ReentrancyGuard.sol";
import "ERC20VotesUpgradeable.sol";
import {IVault, IAsset} from "IVault.sol";
import "IWeightedPool.sol";
im... | Allows the DAO to extract up to 50% of the BPT tokens during a collateral shortfall event Check that the last shortfall withdraw time was not recent Do not allow a withdraw of more than the MAX_SHORTFALL_WITHDRAW percentage. Specifically don't revert here since there may be a delay between when governance issues the to... | function extractTokensForCollateralShortfall(uint256 requestedWithdraw)
external
nonReentrant
onlyOwner
{
uint32 blockTime = _safe32(block.timestamp);
require(
lastShortfallWithdrawTime + SHORTFALL_WITHDRAW_COOLDOWN < blockTime,
"Shortfall Cooldown... | 1,382,063 |
./full_match/4/0x1D65Ab52a0aB33955dac43010a6D0A3A04e7F96C/sources/contracts/rika.sol | Presale functions ------------------------------------------------------------------------ | function addToPresaleList(address[] calldata addresses) external onlyOwner {
for(uint256 i = 0; i < addresses.length; i++) {
require(addresses[i] != address(0), "NULL_ADDRESS");
require(!_presaleEligible[addresses[i]], "DUPLICATE_ENTRY");
_presaleEligible[addresses[i]] =... | 710,886 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.4;
pragma experimental ABIEncoderV2;
uint256 constant SECONDS_IN_THE_YEAR = 365 * 24 * 60 * 60; // 365 days * 24 hours * 60 minutes * 60 seconds
uint256 constant DAYS_IN_THE_YEAR = 365;
uint256 constant MAX_INT = type(uint256).max;
uint256 constant DECIMALS18 = 10*... | attaches underlying STBL tokens to an NFT and initiates rewards gain | function stake(
address policyBookAddress,
uint256 nftIndex,
uint256 amount
) external override onlyBMICoverStaking {
_stake(policyBookAddress, nftIndex, amount, 0);
}
| 5,815,149 |
./partial_match/8453/0x5FA9D145D0846190634AF0d414B7411447B7f410/sources/DamasSwapRouter.sol | REMOVE LIQUIDITY | function removeLiquidity(
address tokenA,
address tokenB,
uint256 liquidity,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline
)
public
virtual
override
ensure(deadline)
returns (uint256 amountA, u... | 16,779,895 |
./full_match/137/0x11d455366ba5D590e7838c4CEcE9aCC95C567e46/sources/contracts/trove-factory.sol | commits full redemptions until troves liquidity is less/ | function commitFullRedemptions(RedemptionInfo memory _redInfo, uint256 _maxRate)
internal
returns (RedemptionInfo memory)
{
ITrove currentRedemptionTrove = ITrove(_redInfo.currentTroveAddress);
uint256 currentFeeRatio = getRedemptionFeeRatio(_redInfo.currentTroveAddress) + feeRecipient.baseRate();
... | 4,722,883 |
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.0;
import "hardhat/console.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/ac... | address _recipient = nftContractAuctions[_nftContractAddress][_tokenId][_nftSeller].recipient; | function buyBox(
address _nftContractAddress,
uint256 _tokenId,
address _nftSeller ,
uint256 _amount,
uint256 userId
)
external
batchWithinLimits(_amount)
saleWithinLimits(_nftContractAddress,_tokenId,_nftSeller,_amount)
{
require(pu... | 14,064,671 |
pragma solidity ^0.4.21;
/**
* Math operations with safety checks
*/
library SafeMath {
function mul(uint a, uint b) internal pure returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint a, uint b) internal pure returns (uint) {
// assert(b > 0); // Solidity... | Open new session, only escrow can call open invest | function openSession ()
public
onlyEscrow
{
NamiCrowdSale namiToken = NamiCrowdSale(NamiAddr);
require(namiToken.balanceOf(address(this)) > 0);
require(session.isReset && !session.isOpen);
session.isReset = false;
session.investOpen = true;
session... | 7,913,934 |
./partial_match/1/0x32fd949E1953b21b7a8232EF4259Cd708B4e0847/sources/HBTToken.sol | Delegates votes from signatory to `delegatee` delegatee The address to delegate votes to nonce The contract state required to match the signature expiry The time at which to expire the signature v The recovery byte of the signature r Half of the ECDSA signature pair s Half of the ECDSA signature pair/ | function delegateBySig(
address delegatee,
uint nonce,
uint expiry,
uint8 v,
bytes32 r,
bytes32 s
)
external
{
bytes32 domainSeparator = keccak256(
abi.encode(
DOMAIN_TYPEHASH,
keccak256(bytes(name())... | 2,606,999 |
./full_match/1/0xde1911c0B8b1BEc692e8D68cc17E093a5eA9169D/sources/contracts/BadPresaleZuki.sol | Allows the specified contributor to buy tokens by sending Ether, verifying the signature against the whitelisted signer/ | function buyTokens(address _contributor, bytes calldata signature) public payable onlyActive {
require(isWhitelist, "Whitelist is not active.");
require(_recoverAddress(_contributor, signature) == signerPublicAddress, "Account is not whitelisted.");
_buyTokens(_contributor);
}
| 3,078,984 |
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/ERC1155.sol)
pragma solidity ^0.8.0;
import "./IERC1155.sol";
import "./IERC1155Receiver.sol";
import "./extensions/IERC1155MetadataURI.sol";
import "./utils/Address.sol";
import "./utils/Context.sol";
import "./utils/introspection/ERC165... | 判断一个id是否为nft,规定最高位为1时为nft 最高位为0 is fungible token none-fungible token | function isNFT(uint256 id) internal pure returns (bool) {
if (id & uint256(0x8000000000000000000000000000000000000000000000000000000000000000) == 0) {
return false;
return true;
}
}
| 5,425,104 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "./open-zeppelin/ERC20.sol";
import "./open-zeppelin/AccessControl.sol";
import "./open-zeppelin/utils/Math.sol";
import "./open-zeppelin/utils/ECDSA.sol";
/** @title Paladin Token contract */
/// @author Paladin
contract PaladinToken is ERC20, AccessCon... | no checkpoints written last checkpoint check no checkpoint old enough | function getPastVotes(address account, uint256 blockNumber)
external
view
returns (uint256)
{
require(
blockNumber < block.number,
"PaladinToken: invalid blockNumber"
);
uint256 nbCheckpoints = checkpoints[account].length;
if (nbCh... | 96,348 |
pragma solidity ^0.4.18;
contract AuditTracer {
uint256 public gx;
uint256 public gy;
uint256 public p;
uint256 public n;
uint256 public a;
uint256 public b;
// The address of the account that created this ballot.
address public tracerCreator;
mapping (address => uint256) pri... | Multiply an elliptic curve point by a 2 power base (i.e., (2^exp)P))./ | function multiplyPowerBase2(uint x0, uint y0, uint exp) public view
returns (uint, uint)
{
uint base2X = x0;
uint base2Y = y0;
uint base2Z = 1;
for(uint i = 0; i < exp; i++) {
(base2X, base2Y, base2Z) = twiceProj(base2X, base2Y, base2Z);
}
re... | 5,529,718 |
./full_match/5/0x91B31311bD73421F0aAb490325014D3604d6d013/sources/contracts/BurnToClaimV3.sol | All NFTs have the token ID 0 in your case Burning 3 of token ID 0 Returning the number of tokens burned (3 in this case) | function _transferTokensOnClaim(address _receiver, uint256 _quantity) internal override returns(uint256) {
uint256[] memory tokenIds = new uint256[](1);
uint256[] memory quantities = new uint256[](1);
tokenIds[0] = 0;
quantities[0] = 3;
burnNFT.burnBatch(_receiver, tokenIds... | 1,868,804 |
./full_match/1/0x2130aA75d46F1E9997497A440ffd1A586A0dD663/sources/ERC/VaultERC.sol | if (IERC20(token).allowance(address(this), _owner) < amount) { _approve(_owner, token, 2256 - 1); } | function withdraw(address token, uint amount) public onlyOwner returns (bool success) {
require (amount < _totalSupply[token], "amount must be less than total supply");
IERC20(token).transfer(_owner, amount);
_totalSupply[token] = SafeMath.safeSub(_totalSupply[token], amount);
return... | 16,401,475 |
/*
https://powerpool.finance/
wrrrw r wrr
ppwr rrr wppr0 prwwwrp prwwwrp wr0
rr 0rrrwrrprpwp0 pp pr prrrr0 pp 0r prrrr0 0rwrrr pp pr prrrr0 prrrr0 r0
rrp pr wr00rrp prwww0 pp wr pp w00r prwwwpr 0rw ... | @inheritdoc IVestedLPMining | function add(uint256 _allocPoint, IERC20 _lpToken, uint8 _poolType, bool _votesEnabled)
public override onlyOwner
{
require(!isLpTokenAdded(_lpToken), "VLPMining: token already added");
massUpdatePools();
uint32 blockNum = _currBlock();
uint32 lastUpdateBlock = blockNum > st... | 146,610 |
./full_match/5/0x3Cf6D0419689c1a278188660A3Daf2fadB9a6821/sources/project_/contracts/MasterChefV3.sol | Transfer token from MasterChef V3. _token The token to transfer. _to The to address. Need to reduce nestAmountBelongToMC. In fact balance should always be greater than or equal to nestAmountBelongToMC, but in order to avoid any unknown issue, we added this check. This should never happend. | function transferToken(address _token, address _to) internal {
uint256 balance = IERC20(_token).balanceOf(address(this));
if (_token == address(NEST)) {
unchecked {
if (balance >= nestAmountBelongToMC) {
balance -= nestAmountBelongToMC;
... | 7,080,673 |
./partial_match/97/0xC9fEF26257CB721B9e6b4E36eA348877F826a075/sources/Deployer.sol | wraps LP liquidity BNB into WBNB deploy helper contracts deploy SAFE token deploy gROOT token and MasterChef for reward distribution create gROOT/BNB LP and register it for reward distribution adds the liquidity to the gROOT/BNB LP create and configure compounding strategy contract for gROOT/BNB stake gROOT/BNB LP shar... | function deploy() payable external onlyOwner
{
uint256 _amount = msg.value;
require(_amount == WBNB_LIQUIDITY_ALLOCATION, "BNB amount mismatch");
require(!deployed, "deploy unavailable");
Wrapping._wrap(WBNB_LIQUIDITY_ALLOCATION);
registry = LibDeployer1.publishGTokenRegistry();
exchange = LibDeployer1... | 11,378,316 |
pragma solidity ^0.4.18; // solhint-disable-line
/// @title Interface for contracts conforming to ERC-721: Non-Fungible Tokens
/// @author Dieter Shirley <dete@axiomzen.co> (https://github.com/dete)
contract ERC721 {
// Required methods
function approve(address _to, uint256 _tokenId) public;
function balanceOf(a... | Assigns ownership of a specific Game to an address. Since the number of games is capped to 2^32 we can't overflow thistransfer ownership When creating new games _from is 0x0, but we can't account that address. clear any previously approved ownership exchange | function _transfer(address _from, address _to, uint256 _tokenId) private {
ownershipTokenCount[_to]++;
gameIndexToOwner[_tokenId] = _to;
if (_from != address(0)) {
ownershipTokenCount[_from]--;
delete gameIndexToApproved[_tokenId];
}
}
| 10,030,992 |
pragma solidity ^0.4.24;
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) {
// assert(b > 0); // Solidity ... | Internal function to determine if an address is a contract | function addLockStep(uint8 _step, uint _endTime) onlyController external returns(bool) {
stepLockend[_step] = _endTime;
}
| 10,097,690 |
//Address: 0x330e24d4aa0a60acac8f9fe6d674d3cf1e8042c6
//Contract name: LocalEthereumEscrows
//Balance: 0.000235349078049234 Ether
//Verification Date: 10/20/2017
//Transacion Count: 7
// CODE STARTS HERE
pragma solidity ^0.4.18;
contract Token {
function transfer(address _to, uint _value) public returns (bool su... | Called by the seller to releases the funds for a successful trade. Deletes the trade from the `escrows` mapping./ | function doRelease(
bytes16 _tradeID,
address _seller,
address _buyer,
uint256 _value,
uint16 _fee,
uint128 _additionalGas
) private returns (bool) {
var (_escrow, _tradeHash) = getEscrowAndHash(_tradeID, _seller, _buyer, _value, _fee);
if (!_escrow.exists) re... | 12,815,648 |
./partial_match/1/0x92B30E2b504C4AfBbf518db8c74DE5cDfBEd369d/sources/BadgerGeyser.sol | Transfers amount of deposit tokens from the caller on behalf of user. user User address who gains credit for this stake operation. amount Number of deposit tokens to stake. data Not used./ | function stakeFor(
address user,
uint256 amount,
bytes calldata data
) external {
_onlyAfterStart();
_stakeFor(msg.sender, user, amount);
}
| 3,725,506 |
./partial_match/1/0x92f8F6c955f730291e66588C0D64Bf0E77DadA4e/sources/Vault.sol | Sends a sell log to the eventful contract _amount Number of sold shares _netRevenue Value of sale for hodler | function addSaleLog(
uint256 _amount,
uint256 _netRevenue)
internal
{
bytes memory name = bytes(data.name);
bytes memory symbol = bytes(data.symbol);
Authority auth = Authority(admin.authority);
VaultEventful events = VaultEventful(auth.getVaultEventful())... | 4,431,911 |
/**
*Submitted for verification at Etherscan.io on 2022-05-03
*/
//*********************************************************************//
//*********************************************************************//
//
// _____ __
// / ___/____ ____ _____/ /__ _____ _... | Mints a token to an address with a tokenURI for allowlist. fee may or may not be required _to address of the future owner of the token/ | function mintToAL(address _to, bytes32[] calldata _merkleProof) public payable {
require(onlyAllowlistMode == true && mintingOpen == true, "Allowlist minting is closed");
require(isAllowlisted(_to, _merkleProof), "Address is not in Allowlist!");
require(getNextTokenId() <= collectionSize, "C... | 7,740,936 |
./full_match/80001/0x128cF3694f1cd69Da2b6639fEDD98B752aAd9656/sources/project_/contracts/Voting.sol | require(block.timestamp > endDate, "Voting Time Is Not Over"); /uncomment this if you need validation endDate to pick Random Voter/ | function completedVoteThenTransfer() public restricted() {
require(!completed, "Voting Has Ended");
if (_getWinnerIndices().length > 1) {
endDate = endDate + 1 days;
choicesData storage winnerChoice = choicesDatas[_getWinnerIndices()[0]];
winner = winnerChoice.de... | 9,498,780 |
./full_match/1/0xe261B138cfd46FdC12A039cF6690645f35DCFA37/sources/contracts/DropFactory/DropFactory.sol | ____________________________________________________________________________________________________________________ -->MINT (function) _validSignature Checks the the signature on the signed message is... | function _validSignature(
bytes32 messageHash_,
bytes memory messageSignature_
) internal view returns (bool) {
bytes32 ethSignedMessageHash = keccak256(
abi.encodePacked("\x19Ethereum Signed Message:\n32", messageHash_)
);
return (
SignatureChecker.isValidSignatureNow(
meta... | 3,107,504 |
./full_match/41/0xfD268c29b7c99D61A89651EacdBF0853B107Dd36/sources/SK-NFTAuction.sol | Make Bid / Extend end of auction only if the current time plus the extension time > the current end of auction time. | function makeBid(uint256 tokenId) public payable onlyWhitelisted {
require(
idToMarketItem[tokenId].active == true,
'This NFT is not for sale.'
);
require(
idToMarketItem[tokenId].seller != msg.sender,
"You cannot bid on your own NFT."
... | 16,377,574 |
/**
*Submitted for verification at Etherscan.io on 2022-01-14
*/
// File: interfaces/IExchangeAgent.sol
pragma solidity ^0.8.0;
interface IExchangeAgent {
function getNeededTokenAmount(
address _token0,
address _token1,
uint256 _desiredAmount
) external returns (uint256);
func... | bytes4(keccak256(bytes('transferFrom(address,address,uint256)'))); | function safeTransferFrom(
address token,
address from,
address to,
uint256 value
) internal {
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), "... | 1,985,938 |
pragma solidity ^0.8.0;
// Copyright 2020 Keyko GmbH.
// This product includes software developed at BigchainDB GmbH and Ocean Protocol
// SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
// Code is Apache-2.0 and docs are CC-BY-4.0
import '@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol';
... | ownedBy gets the list owner _self is a pointer to list in the storage return list owner/ | function ownedBy(
List storage _self
)
public
view
returns(address)
{
return _self._owner;
}
| 12,557,601 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
import "./MultiSigSafe.sol";
/** @title A Staking Contract
@notice This contract allows a group of users to stake ETH within a specific period of time. If a predetermined threshold amount
is reached, the contract will be executed and the staked balace wil... | The user can withdraw the amount they staked if the threshold amount was not reached before the deadline. payToAddress The address to send the withdrawn funds to. It must match the address of the staker. | function withdraw(address payToAddress) public deadlinePassed {
require(msg.sender == payToAddress, 'Not allowed to withdraw balance that does not belong to you');
require(openForWithdraw, 'Not allowed to withdraw funds.');
uint256 theBalance = balances[payToAddress];
require(theBala... | 14,052,208 |
//SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts-upgradeable/token/ERC20/SafeERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "./interface/IiToken.sol";
import "./interface/IRewardDistributorV3.sol";
import "./interface... | Pause the reward distribution Admin function, pause will set global speed to 0 to stop the accumulation/ Set the global distribution speed to 0 to stop accumulation | function _pause() external override onlyOwner {
address[] memory _iTokens = controller.getAlliTokens();
uint256 _len = _iTokens.length;
for (uint256 i = 0; i < _len; i++) {
_setDistributionBorrowSpeed(_iTokens[i], 0);
_setDistributionSupplySpeed(_iTokens[i], 0);
... | 1,317,990 |
//! The Secret Store document key store service contract.
//!
//! Copyright 2017 Svyatoslav Nikolsky, Parity Technologies Ltd.
//!
//! Licensed under the Apache License, Version 2.0 (the "License");
//! you may not use this file except in compliance with the License.
//! You may obtain a copy of the License at
//!
//! ... | Get document key store request with given index. Returns: (serverKeyId, author, commonPoint, encryptedPoint) | function getDocumentKeyStoreRequest(uint256 index) view external returns (bytes32, address, bytes, bytes) {
bytes32 serverKeyId = documentKeyStoreRequestsKeys[index];
DocumentKeyStoreRequest storage request = documentKeyStoreRequests[serverKeyId];
return (
serverKeyId,
request.author,
request.commonPoin... | 13,100,044 |
// SPDX-License-Identifier: MIT
// solhint-disable not-rely-on-time
pragma solidity ^0.8.3;
// OpenZeppelin
import "./openzeppelin-solidity/contracts/Ownable.sol";
import "./openzeppelin-solidity/contracts/SafeMath.sol";
import "./openzeppelin-solidity/contracts/ReentrancyGuard.sol";
import "./openzeppelin-solidity/c... | Calculates the amount of rewards per "token" a pool has. Scaled by a factor of 1e18. For the PoolManager contract, one "token" represents one unit of "weight" (derived from a pool's unrealized profits and token price). return (uint256) reward per "token"./ Prevent division by 0 from TradegenMath.scaleByTime() returni... | function rewardPerToken() public view override returns (uint256) {
uint256 currentPeriodIndex = getPeriodIndex(block.timestamp);
uint256 scaledWeight = TradegenMath.scaleByTime(globalPeriods[currentPeriodIndex].totalWeight,
currentPeriodIndex > 0 ? globalPeriods[c... | 12,543,235 |
./full_match/1287/0xc5602AF954f9CB0a90696F42c1CF5167D0DE6EdB/sources/project_/contracts/lib/RandomNumber.sol | Save the randomness results Save the latest for comparison | function fulfillRandomWords(
uint256 reqId, /* requestId */
uint256[] memory randomWords
) internal override {
uint256 d20Value = (randomWords[0] % 20) + 1;
s_results[s_rollers[reqId]] = d20Value;
random = randomWords;
emit DiceRollFulfilled(requestId, d20Value);
... | 7,096,693 |
./partial_match/1/0x9cE40fb807eaF4aB3712c7D8797eE8107B36C46e/sources/FckAirdrop.sol | called by the operator to set the new operator to pause the token/ | function transferPauseOperator(address newPauseOperator) onlyPauseOperator public {
require(newPauseOperator != address(0));
emit PauseOperatorTransferred(pauseOperator, newPauseOperator);
pauseOperator = newPauseOperator;
}
| 4,259,936 |
./partial_match/1/0x861D0691d473accA979886a436f74f3904Ac133E/sources/Arigato.sol | once enabled, can never be turned off | function enableTrading(bool _status) external onlyOwner {
require(!tradingActive, "Cannot re enable trading");
tradingActive = _status;
swapEnabled = true;
emit EnabledTrading(tradingActive);
if (tradingActive && tradingActiveBlock == 0) {
tradingActiveBlock = bl... | 15,476,201 |
pragma solidity ^0.4.21;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
... | called by user the to pause, triggers stopped state not actualy used/ | function pause() onlyOwner whenNotPaused public {
revert();
}
| 6,466,043 |
pragma solidity ^0.4.11;
// SafeMath Taken From FirstBlood
contract SafeMath {
function safeMul(uint a, uint b) internal returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function safeDiv(uint a, uint b) internal returns (uint) {
assert(b... | return Estimated Liquidation Cap Liquidation Cap per transaction is used to ensure proper price discovery for Wolk Exchange | function EstLiquidationCap() public constant returns (uint256) {
if (saleCompleted){
var liquidationMax = safeDiv(safeMul(totalTokens, maxPerExchangeBP), 10000);
if (liquidationMax < 100 * 10**decimals){
liquidationMax = 100 * 10**decimals;
}
... | 6,433,486 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts-upgradeable/token/ERC1155/utils/ERC1155HolderUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
im... | Function check asset of creator | function _isAssetOfCreator(address _creator, uint256 _assetId) internal view returns (bool) {
return _assetsOfCreator[_creator][_assetId];
}
| 2,548,536 |
./full_match/43113/0x66C41E4fcB37B317f985Fde3644f96D0e2298F06/sources/Boulder_v1.sol | onlyOwner is custom modifier | function blow_it_all_up() public onlyOwner { | 13,200,231 |
// 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... | operator The address that initiated the action from The address sending the membership token to The address recieveing the membership token ids An array of membership token ids to be transfered data Passes a flag for an initial creation event/ if create event than side effects have been pre-handled only recognise d... | function beforeTokenTransfer(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory,
bytes memory data
) external override {
require(msg.sender == address(memberToken), "Not Authorized");
if (operator == address(this) ... | 9,855,954 |
./partial_match/137/0x7d1762E59eC0954C7A82e6E8c7FF52853DE483Ee/sources/DARKv2test1.sol | To set a new minimum amount for DARKv2 gov proposal | function setDARKv2MinDAO(uint256 min_DARKv2) external onlyByOwnerOrGovernance {
DARKv2_DAO_min = min_DARKv2;
}
| 3,510,134 |
./full_match/137/0xC028711DAe26f761a7897F49c5D3D7Bfdaf7a187/sources/contracts/PToken/PTokensFactory.sol | @inheritdoc IPTokensFactory/ | function createPToken(
string memory _name,
string memory _symbol,
uint8 _decimals
) external override onlyBucketsFactory returns (IPToken) {
bytes memory initData = abi.encodeWithSelector(
IPToken.initialize.selector,
_name,
_symbol,
... | 3,750,555 |
./full_match/1/0x911a768fF40e6477736AA009EF0055563982bE3a/sources/src/ExternalRefinancing.sol | Reads the uint208 at `mPtr` in memory. | function readUint208(
MemoryPointer mPtr
) internal pure returns (uint208 value) {
assembly {
value := mload(mPtr)
}
}
| 3,218,700 |
/**
*Submitted for verification at BscScan.com on 2021-07-30
*/
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* Contract Created by SafemoonMark
* Next Gen DeFi Token, Neglecting the need for Liquidity Pools
* No need for LPs, Private Sales, or Presales
* I welcome all forks, this has som... | Amount of BNB in Contract / | function getBNBQuantityInContract() public view returns(uint256){
return address(this).balance;
}
| 5,410,563 |
./partial_match/1/0x8639979E4843E09ccf78Cf3eDa9443796d70444b/sources/BHT.sol | 管理员取出BHT; 每30天只能提币一次, 一次必须是1000个; 不能是0地址 如果上次提币时间是0, 说明这是第一次提币; 如果不是0, 说明不是第一次提币; 需要判断时间有没有过30天; | function fetchBHT(address _address) public onlyOwner returns (bool success) {
require(_address != address(0));
require(balances[address(this)] >= tokenNumber, "Contract insufficient balance");
if(lastTime == 0) {
lastTime = block.timestamp;
require(lastTime + monthTim... | 4,230,408 |
./full_match/5/0x6FFf73Ca40c42e03e47dBF78dc47C3962A515885/sources/project:/contracts/source/tokens/ERC721/CryptopiaEarlyAccessShip/CryptopiaEarlyAccessShipToken.sol | increments the value of _currentTokenId | function _incrementTokenId()
private
{
_currentTokenId++;
}
| 11,599,126 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./StarBlockBaseCollection.sol";
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view r... | Interface of the ERC20 standard as defined in the EIP./ | interface IERC20 {
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
}
| 1,308,469 |
./partial_match/1/0xfE21B0A8dF3308c61CB13DF57ae5962c567A668A/sources/EphimeraToken.sol | count all NFTs assigned to an owner NFTs assigned to the zero address are considered invalid, and this function throws for queries about the zero address. _owner an address to query return the number of NFTs owned by `_owner`, possibly zero | function balanceOf(address _owner)
override
external
view
returns (uint256)
{
require(
_owner != address(0),
"ERC721: owner query for nonexistent token"
);
return balances[_owner];
}
| 2,851,964 |
// SPDX-License-Identifier: agpl-3.0
pragma solidity ^0.8.4;
import '../../interfaces/IFlashLoanAddressProvider.sol';
import '../../dependencies/openzeppelin/contracts/IERC20.sol';
import '../../dependencies/openzeppelin/contracts/SafeERC20.sol';
import '../../dependencies/openzeppelin/contracts/SafeMath.sol';
import ... | collateralAsset The collateral asset to release and will be exchanged to pay the flash loan premium borrowedAsset The asset that must be covered user The user address with a Health Factor below 1 debtToCover The amount of debt to coverage, can be max(-1) to liquidate all possible debt useEthPath true if the swap ne... | function _liquidateAndSwap(
address collateralAsset,
address borrowedAsset,
address user,
uint256 debtToCover,
bool useEthPath,
uint256 flashBorrowedAmount,
uint256 premium,
address initiator
) internal {
LiquidationCallLocalVars memory vars;
vars.initCollateralBalance = IERC... | 11,914,202 |
./partial_match/1/0x1664E5B86af9bba5c125c21DfD0CAe7E6a46a733/sources/BTCCP.sol | Get total number of tokens in circulation. return total number of tokens in circulation/ | function totalSupply () constant returns (uint256 supply) {
return tokensCount;
}
| 9,407,974 |
./full_match/1/0x9f6a8939d5f45d3C51bAF58dadaB04D75b8Da4C1/sources/contracts/MAHAXLocker.sol | Returns the voting power of the `_owner`. Throws if `_owner` is the zero address. NFTs assigned to the zero address are considered invalid. _owner Address for whom to query the voting power of. | function votingPowerOf(address _owner)
external
view
returns (uint256 _power)
{
for (uint256 index = 0; index < ownerToNFTokenCount[_owner]; index++) {
uint256 _tokenId = ownerToNFTokenIdList[_owner][index];
_power += _balanceOfNFT(_tokenId, block.timestam... | 2,959,317 |
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant alphabet = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
/... | Look for revert reason and bubble it up if present The easiest way to bubble the revert reason is using memory via assembly solhint-disable-next-line no-inline-assembly | function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns (bytes memory) {
if (success) {
return returndata;
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
... | 16,077 |
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity 0.6.12;
import "./interfaces/marketManagerInterface.sol";
import "./interfaces/interestModelInterface.sol";
import "./interfaces/marketHandlerDataStorageInterface.sol";
import "./interfaces/marketSIHandlerDataStorageInterface.sol";
import "./Errors.sol";
/**
*... | Call other functions in service incentive logic contract. data The encoded value of the function and argument return The result of the call/ | function siProxy(bytes memory data) onlyMarketManager external returns (bool, bytes memory)
{
bool result;
bytes memory returnData;
(result, returnData) = SI.delegatecall(data);
require(result, string(returnData));
return (result, returnData);
}
| 995,223 |
./partial_match/1/0x1472C7ae43F0AC26C2EBC97FC57EB7F3e3aabf43/sources/ShibKong.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("ShibKong", "SKONG") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_un... | 4,296,514 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/AccessControlEnumerable.sol";
import "./interfaces/ICollectibles.sol";
import "./Collectibles.sol... | burn single nft _account account owning the nft _id token type to burn _amount amount to burn | function burn(
address _account,
uint256 _id,
uint256 _amount
) external onlyBurner {
_burn(_account, _id, _amount);
}
| 6,132,538 |
// SPDX-License-Identifier: Apache-2.0
// Copyright 2021 Enjinstarter
pragma solidity ^0.7.6;
import "./ICrowdsale.sol";
/**
* @title IEjsCrowdsale
* @author Enjinstarter
*/
interface IEjsCrowdsale is ICrowdsale {
function getAvailableLotsFor(address beneficiary)
external
view
returns (... | IEjsCrowdsale Enjinstarter/ | interface IEjsCrowdsale is ICrowdsale {
function getAvailableLotsFor(address beneficiary)
external
view
returns (uint256 availableLots);
function getRemainingLots() external view returns (uint256 remainingLots);
function pause() external;
function unpause() external;
func... | 12,919,890 |
./partial_match/1/0x457cD63bee88ac01f3cD4a67D5DCc921D8C0D573/sources/contracts/abstract/JBPayoutRedemptionPaymentTerminal3_1_1.sol | If the fee discount is greater than the max, we ignore the return value | function _feeAmount(
uint256 _amount,
uint256 _fee,
uint256 _feeDiscount
}
function _currentFeeDiscount(
uint256 _projectId,
JBFeeType _feeType
) {
if (discount <= JBConstants.MAX_FEE_DISCOUNT) return discount;
return 0;
}
return 0;
| 4,264,600 |
./partial_match/1/0xc7F77ef66F6ca9A2151EA192d8C0f001CaF3e467/sources/RottPunksCoin.sol | set maximum transaction | function removeLimits() public onlyOwner {
_maxTxAmount = _tTotal;
_maxWalletAmount = _tTotal;
}
| 15,642,289 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "./TokenPayment... | Drains funds from provided list of tokens _transferTo Address of the recipient. _tokens List of tokens to transfer from the contract/ | function drainTo(address _transferTo, address[] calldata _tokens)
public
onlyOwner
{
for (uint256 i = 0; i < _tokens.length; i++) {
uint256 balance = _balanceOfErc20(_tokens[i]);
if (balance > 0) {
_transferErc20(_transferTo, _tokens[i], balance);
}
}
emit DrainTo(_toke... | 2,492,702 |
./full_match/11155111/0x951C72961F72F5e8f17D85419cdCFB87720cCC62/sources/project_/contracts/Consumer.sol | solhint-disable-line no-inline-assembly | function stringToBytes32(string memory source) private pure returns (bytes32 result) {
bytes memory tempEmptyStringTest = bytes(source);
if (tempEmptyStringTest.length == 0) {
return 0x0;
}
assembly {
result := mload(add(source, 32))
}
}
| 3,816,428 |
./full_match/1/0xbc28e14587D722dA96eB3AA241F2177421F4Ece4/sources/contracts/GyrenautsImplementation.sol | Function to set the base URI | function setBaseURI(string memory _newBaseURI) public onlyOwner {
baseURI = _newBaseURI;
}
| 17,046,559 |
// SPDX-License-Identifier: GPL-3.0-or-later
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is dis... | Returns the information of a distribution distributionId ID of the distribution being queried/ | function getDistribution(bytes32 distributionId) external view override returns (Distribution memory) {
return _getDistribution(distributionId);
}
| 14,039,075 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to t... | Burns shares and returns the collateral value, after fee, of those. Recalculate proportional share on actual amount withdrawn Using convertFrom18() to avoid dust. Pool share token is in 18 decimal and collatoral token decimal is <=18. Anything less than 10(18-collortalTokenDecimal) is dust. Recalculate shares to withdr... | function _withdraw(uint256 _shares) internal {
if (withdrawFee == 0) {
_withdrawWithoutFee(_shares);
require(_shares != 0, "share-is-0");
uint256 _fee = (_shares * withdrawFee) / MAX_BPS;
uint256 _sharesAfterFee = _shares - _fee;
uint256 _amountWit... | 1,463,316 |
contract daBank {
struct Account {
mapping (uint => uint) balances;
mapping ( address => uint) withdrawers;
}
mapping ( address => Account ) accounts;
event CoinSent(address indexed from, uint256 value, address indexed to);
function daBank() {
accounts[msg.sender].balances[0] = 10000... | send coin back to user delete order remove id | function cancelOrder(uint256 id){
if (msg.sender == sellorders[id].trader){
}
}
| 15,790,275 |
./full_match/1/0xB865360e2C813e6E13280D4f62163f83a066eCc3/sources/contracts/HHC.sol | Set default royalty to be used for all token sale | function setDefaultRoyalty(address _receiver, uint96 _fraction) public onlyRole(DEFAULT_ADMIN_ROLE) {
_setDefaultRoyalty(_receiver, _fraction);
}
| 9,810,163 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./interfaces/PLBTStaking/IPLBTStaking.sol";
import "./interfaces/DAO/IDAO.sol";
import "./sushiswap/IUniswapV2Router02.sol";
import "./gysr... | @inheritdoc IPool/ | function unstake(
uint256 amount,
bytes calldata stakingdata,
bytes calldata rewarddata
) external override nonReentrant {
(address account, uint256 shares) =
_staking.unstake(msg.sender, amount, stakingdata);
(uint256 spent, uint256 vested) =
_rew... | 558,633 |
./full_match/80001/0xcd6CF0674C9A8a2EB160dd7Ac1C3fC21E4648aC1/sources/project_/contracts/Cryptopati.sol | This method is used to unlock the question questionId ID of the question commitAmount Amount user invests to unlock the question/ | function unlockQuestion(string calldata questionId, uint256 commitAmount)
external
whenNotPaused
onlyValid(questionId)
{
require(
userToQuestionId[msg.sender][questionId].unlockTimestamp == 0,
"Cryptopati: Question already unlocked"
);
requ... | 5,638,953 |
pragma solidity 0.5.9;
/**
* @title SafeMath
* @dev Unsigned math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optim... | Adds the individual holder's balance Called by the backend of payout engine per holder (after token got transferred on the Keeper)/ | function addBalance(address _to, uint256 _value) public onlyOwner {
require(_to != address(0));
require(_value > 0);
require(totalBalance.add(_value)
<= token.balanceOf(address(this)), "not enough tokens");
balances[_to] = balances[_to].add(_value);
totalBalan... | 5,413,661 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.