file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
/// SPDX-License-Identifier: UNLICENSED
/**
................
..',,;;::::::::ccccc:;,'..
..',;;;;::::::::::::cccccllllc;..
.';;;;;;;,'..............'... | Verify the signature approving the transaction. _user User that is being minted to. _amount Amount of underlying tokens being deposited. _expiry Time (Unix timestamp) that this request expires. _v The recovery byte of the signature. _r Half of the ECDSA signature pair. _s Half of the ECDSA signature pair./ | function verifyCapacitySig(
address _user,
uint256 _amount,
uint256 _expiry,
uint8 _v,
bytes32 _r,
bytes32 _s
) internal {
bytes32 digest = keccak256(
abi.encodePacked(
"EASE_RCA_CONTROLLER_1.0",
block.chainid,
... | 10,309,569 |
./partial_match/1313161554/0x796146F750f25bcC047e16dc533c5e8e70ce688A/sources/ParadoxStaking.sol | set IDO contract address _IDOContract address/ | function setIDOContract(address _IDOContract) external onlyOwner {
require (IDOContract == address(0), 'IDOContract cannot be set more than once');
IDOContract = _IDOContract;
}
| 16,946,023 |
pragma solidity >=0.5.0 <0.7.0;
import "../cryptography/ECDSA.sol";
import "../token/ERC20Token.sol";
import "./Actor.sol";
import "../common/Controlled.sol";
interface PaymentNetwork {
function process(ERC20Token token, address from, address to, uint256 value) external;
}
/**
* @notice Payment Network Actor f... | check that a keycard address has been set check that the _hashToSign has been produced with the nonce, to, and value check that the _hashToSign has been signed by the keycard check that the nonce is valid check that _value is not greater than settings.maxTxValue increment noncecalls identity to execute approval of toke... | function requestPayment(
bytes32 _hashToSign,
bytes memory _signature,
uint256 _nonce,
ERC20Token _token,
address payable _to,
uint256 _value
) public {
require(keycard != address(0), "keycard address not set");
bytes32 expectedHash = ECDSA.toERC1... | 5,498,460 |
./full_match/4/0x71aDb425cC2aC83319FFBE30664916Fddc106588/sources/kali.sol | this is safe from underflow because decrement only occurs if `nCheckpoints` is positive this is reasonably safe from overflow because incrementing `nCheckpoints` beyond 'type(uint256).max' is exceedingly unlikely compared to optimization benefits | function _writeCheckpoint(address delegatee, uint256 nCheckpoints, uint256 oldVotes, uint256 newVotes) internal virtual {
unchecked {
if (nCheckpoints > 0 && checkpoints[delegatee][nCheckpoints - 1].fromTimestamp == block.timestamp) {
checkpoints[delegatee][nCheckpoints - 1].vote... | 693,292 |
/**
*Submitted for verification at Etherscan.io on 2020-03-13
*/
pragma solidity 0.5.11; // optimization runs: 200, evm version: petersburg
// WARNING - `executeActionWithAtomicBatchCalls` has a `bytes[]` argument that
// requires ABIEncoderV2. Exercise caution when calling that specific function.
pragma experimental... | Internal function to determine whether a call to a given dToken succeeded, and to emit a relevant ExternalError event if it failed. asset uint256 The ID of the asset, either Dai (0) or USDC (1). functionSelector bytes4 The function selector that was called on the corresponding dToken of the asset type. ok bool A boo... | ) internal returns (bool success) {
require(dToken.mintViaCToken(balance) > 0, _revertReason(24));
function _checkDharmaTokenInteractionAndLogAnyErrors(
AssetType asset,
bytes4 functionSelector,
bool ok,
bytes memory data
if (ok) {
uint256 amount = abi.decode(data, (uint256));
... | 985,308 |
./partial_match/1/0x10b7aDF57D60e0b33aCb0De99aFDa4471EA989E3/sources/Core.sol | deconverting is mostly for LP tokens back to another token, as these cant be simply swapped on uniswap | function deconvert(address sourceToken, address destinationToken, uint256 amount) public payable returns(bool){
(bool succeeded, bytes memory result) = address(converterAddress).delegatecall(abi.encodeWithSignature("unwrap(address,address,uint256)", sourceToken, destinationToken,amount));
return succe... | 16,098,034 |
//*********************************************************************//
//*********************************************************************//
// v2.0.0
//
//
// This project and smart co... | 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 _amount number of tokens to mint/ | function mintToMultipleAL(address _to, uint256 _amount, bytes32[] calldata _merkleProof) public payable {
require(onlyAllowlistMode == true && mintingOpen == true, "Allowlist minting is closed");
require(isAllowlisted(_to, _merkleProof), "Address is not in Allowlist!");
require(_amount >= 1,... | 10,278,334 |
./partial_match/1/0x1A963Df363D01EEBB2816b366d61C917F20e1EbE/sources/src/CEther.sol | Perform the actual transfer in, which is a no-op from Address sending the Ether amount Amount of Ether being sent return The actual amount of Ether transferred/ Sanity checks | function doTransferIn(address from, uint amount) override internal returns (uint) {
require(msg.sender == from, "sender mismatch");
require(msg.value == amount, "value mismatch");
return amount;
}
| 2,594,845 |
./full_match/56/0xF54f107D5A152DCE881601ff4Cdc7cf4fD2dE96b/sources/Users/chun/Desktop/other/lottery-contract/contracts/LotteryUpgradeProxy.sol | Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}./ | function changeAdmin(address newAdmin) external ifAdmin {
require(
newAdmin != address(0),
"TransparentUpgradeableProxy: new admin is the zero address"
);
emit AdminChanged(_admin(), newAdmin);
_setAdmin(newAdmin);
}
| 3,233,920 |
pragma solidity 0.4.23;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
func... | Helper function actually performing the sending of tokens. _from The address holding the tokens being sent _to The address of the recipient _amount The number of tokens to be sent _userData Data generated by the user to be passed to the recipient _operatorData Data generated by the operator to be passed to the rec... | function doSend(
address _from,
address _to,
uint256 _amount,
bytes _userData,
address _operator,
bytes _operatorData,
bool _preventLocking
)
internal
{
requireMultiple(_amount);
callSender(_operator, _from, _to, _amount, _userData... | 1,825,397 |
pragma solidity 0.4.26; // optimization enabled, runs: 500
/************** TPL Extended Jurisdiction - YES token integration *************
* This digital jurisdiction supports assigning YES token, or other contracts *
* with a similar validation mechanism, as additional attribute validators. *
* https://gi... | Invalidate a signed attribute approval before it has been set by supplying the hash of the approval `hash` and the signature `signature`. hash bytes32 The hash of the attribute approval. signature bytes The hash's signature, resolving to the signing key. Attribute approvals can only be removed by issuing validators ... | function invalidateAttributeApproval(
bytes32 hash,
bytes signature
) external {
address validator = _signingKeys[
];
require(
msg.sender == validator || msg.sender == owner(),
"only jurisdiction or issuing validator may invalidate attribute approval"
);
_invalidAttribu... | 1,829,726 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount o... | Helper function to know if the draw ring buffer has been initialized. since draws start at 1 and are monotonically increased, we know we are uninitialized if nextIndex = 0 and lastDrawId = 0. _buffer The buffer to check. | function isInitialized(Buffer memory _buffer) internal pure returns (bool) {
return !(_buffer.nextIndex == 0 && _buffer.lastDrawId == 0);
}
| 623,695 |
./partial_match/1/0xAe8eEB1f92F0F76D3F21d5887096999254F06EA5/sources/SBCToken.sol | Same as {get}, with a custom error message when `key` is not in the map. CAUTION: This function is deprecated because it requires allocating memory for the error message unnecessarily. For custom revert reasons use {tryGet}./ | function get(
Bytes32ToUintMap storage map,
bytes32 key,
string memory errorMessage
) internal view returns (uint256) {
return uint256(get(map._inner, key, errorMessage));
}
| 2,781,452 |
./full_match/80001/0x7976d3d810953a343dac576b42F58382922cbA54/sources/contracts/GotMintedERC1155.sol | Mapping from account to operator approvalsdefault to dynamic uri with assumption that all (initial) tokens will reside at the same ipfs CID | {
bytes32 public constant ADMIN_ROLE = keccak256("URI_SETTER_ROLE");
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
uint256 private constant VERSION = 1;
mapping(address => mapping(address => bool)) private _operatorApprovals;
string public name;
string public symbol;
uin... | 5,589,962 |
pragma solidity =0.6.6;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Pausable.sol";
import "./libraries/TransferHelper.sol";
import "./interfaces/IPancakeRouter02.s... | execute swap directly on Uniswap/Pancake/... swapData stores the swapData information amountIn amount if tokens In amountOutMin minimum tokens to receive path Sell path. return amounts | function swapExactTokensForTokens(
SwapData calldata swapData,
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path
)
external
whenNotPaused
isValidFork(swapData.fork)
isValidReferee(swapData.referee)
returns (uint256[] memory am... | 600,856 |
pragma solidity ^0.5.16;
import "./SToken.sol";
import "./ErrorReporter.sol";
import "./Exponential.sol";
import "./PriceOracle.sol";
import "./ComptrollerInterface.sol";
import "./ComptrollerStorage.sol";
import "./Unitroller.sol";
import "./STRK.sol";
/**
* @title Strike's Comptroller Contract
* @author Strike
*... | Claim all strike accrued by the holders holders The addresses to claim STRK for sTokens The list of markets to claim STRK in borrowers Whether or not to claim STRK earned by borrowing suppliers Whether or not to claim STRK earned by supplying/ | function claimStrike(address[] memory holders, SToken[] memory sTokens, bool borrowers, bool suppliers) public {
for (uint i = 0; i < sTokens.length; i++) {
SToken sToken = sTokens[i];
require(markets[address(sToken)].isListed, "market must be listed");
if (borrowers) {
... | 9,973,834 |
./full_match/1/0x0000000304aAD016bA7a745da3cE64f6198B76B3/sources/src/Platform.sol | Checks for an upgrade and update the bribe. Check if there is an upgrade in queue. Save new values. | function _checkForUpgrade(uint256 bribeId) internal {
Upgrade storage upgradedBribe = upgradeBribeQueue[bribeId];
if (upgradedBribe.totalRewardAmount != 0) {
bribes[bribeId].endTimestamp = upgradedBribe.endTimestamp;
bribes[bribeId].numberOfPeriods = upgradedBribe.numberOfPe... | 3,200,410 |
./full_match/42220/0xFb823aB5Ac7E3dab9dF3B484E06da352451f88c6/sources/contracts/LendingPoolWrapper.sol | Gets the address of the aToken assocated with the reserve./ helper to make sure we can always get the reserve | function getReserveATokenAddress(address _reserve)
public
view
override
returns (address)
{
if (_reserve == goldToken) {
_reserve = CELO_ADDRESS;
}
return core.getReserveATokenAddress(_reserve);
}
| 16,338,078 |
// MEE Pair
pragma solidity 0.5.12;
interface IERC20 {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external view returns (string memory);
function symbol() external view returns (string... | init setup add new gp filter gpInfo find out which gp need to remove | function updateGPInfo(address[] calldata gps, uint256[] calldata amounts) external {
require(msg.sender == address(_pool), "ERR_POOL_ONLY");
require(_gpRate > 0, "ERR_NO_GP_SHARE_REMAIN");
require(gps.length == amounts.length, "ERR_INVALID_PARAM");
if (_totalGpSupply == 0) {
... | 6,308,443 |
pragma solidity 0.5.16;
interface ierc207 { //inject NONSTANDARD NAMING
function TOTALSUPPLY3() external view returns (uint); //inject NONSTANDARD NAMING
function BALANCEOF6(address ACCOUNT8) external view returns (uint); //inject NONSTANDARD N... | inject NONSTANDARD NAMING | function _MSGSENDER8() internal view returns (address payable) { | 5,469,212 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.4.25;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/********************************************************************************************/
/* ... | Initial funding for the insurance. Unless there are too many delayed flights resulting in insurance payouts, the contract should be self-sustaining/ when airline has the required funds to Vote, set hasFunds to true | function fund
(
address airline
)
public
payable
{
airlines[airline].funds += msg.value;
airlines[airline].hasFunds = true;
}
| 14,034,092 |
// Based loosely on galaxyEggs
// https://etherscan.io/address/0xa08126f5e1ed91a635987071e6ff5eb2aeb67c48#code
/**
* Generic Mintable NFT Sale contract
* Create a collection with the following variables
* - max supply - max number of nfts
* - price - per nft
* - Max items per mint
* - pre mint - number of NFTs t... | For admins/governance Allow preminting a batch for compensation or giveaways | function pre_mint_batch(uint256 num)
public
payable
whenPreMintNotPaused
preMintAllowedAccount(msg.sender)
onlyAdminOrGovernance
noContractAllowed
nonReentrant
{
require(pre_mint_reserved > 0, "VL0:pre_mint_reserved");
uint256 supply = tota... | 6,432,756 |
./full_match/5/0xf0b88b2a01473B40422d9fddE1015979a52330eb/sources/_thirdweb-dev/contracts/extension/Staking1155Upgradeable.sol | View amount staked and rewards for a user, for a given token-id. _staker Address for which to calculated rewards. return _tokensStaked Amount of tokens staked for given token-id. return _rewards Available reward amount./ | function getStakeInfoForToken(uint256 _tokenId, address _staker)
public
view
virtual
returns (uint256 _tokensStaked, uint256 _rewards)
{
_tokensStaked = stakers[_tokenId][_staker].amountStaked;
_rewards = _availableRewards(_tokenId, _staker);
}
| 1,879,865 |
./full_match/1/0x92A9f26e825161858C470A24211A1BA186dcCdC8/sources/contracts/Nft/Address.sol | Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but with `errorMessage` as a fallback revert reason when `target` reverts. _Available since v3.1._/ solhint-disable-next-line avoid-low-level-calls | function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value);
require(isContract(target));
return _verifyCallResult(success, returndata, errorMessage);
}
| 2,970,644 |
./full_match/1/0x8a907De47E00830a2b742db65e938a3ea1070A2E/sources/src/lib/GovernorTimelockCompound.sol | Public accessor to check the address of the timelock/ | function timelock() public view virtual override returns (address) {
return address(_timelock);
}
| 16,538,553 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.5.0;
pragma experimental ABIEncoderV2;
contract UserContract {
address public owner;
// struct User {
// address DireccionUser;
// string name;
// string password;
// }
struct User {
string userName;
string ful... | for(uint i = 0; i < users.length; i++){ User memory user = users[i]; if (keccak256(abi.encodePacked(user.userName)) == keccak256(abi.encodePacked(username)) ) { return user; } } | function getUser(string memory username) public view returns (User memory) {
return usuarios[username];
}
| 929,361 |
./partial_match/4/0x1D48Ff980B8AaD8e8CCC563eF7cd162720d88ff1/sources/MultiSigWallet.sol | Returns array with owner addresses, which confirmed transaction. transactionId Transaction ID. return Returns array of owner addresses. | function getConfirmations(uint256 transactionId)
public
constant
returns (address[] _confirmations)
{
address[] memory confirmationsTemp = new address[](owners.length);
uint256 count = 0;
uint256 i;
for (i = 0; i < owners.length; i++)
if (confi... | 8,635,227 |
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity >=0.6.11;
// ============ Internal Imports ============
import {IBridgeToken} from "../../interfaces/bridge/IBridgeToken.sol";
import {ERC20} from "./vendored/OZERC20.sol";
// ============ External Imports ============
import {Version0} from "@celo-org/opti... | Sets approval from owner to spender to value as long as deadline has not passed by submitting a valid signature from owner Uses EIP 712 structured data hashing & signing _owner The account setting approval & signing the message _spender The account receiving approval to spend owner's tokens _value The amount to set ... | function permit(
address _owner,
address _spender,
uint256 _value,
uint256 _deadline,
uint8 _v,
bytes32 _r,
bytes32 _s
) external {
require(block.timestamp <= _deadline, "ERC20Permit: expired deadline");
require(_owner != address(0), "ERC20... | 1,230,189 |
pragma solidity ^0.5.3;
import "./PermissionsImplementation.sol";
import "./PermissionsUpgradable.sol";
/** @title Permissions Interface Contract
* @notice This contract is the interface for permissions implementation
contract. for any call, it forwards the call to the implementation
contract
*/
contract... | interface to add sub org under an org _pOrgId parent org id under which the sub org is being added _orgId unique id for the sub organization _enodeId full enode id linked to the sjb organization/ | function addSubOrg(string calldata _pOrgId, string calldata _orgId,
string calldata _enodeId) external {
permImplementation.addSubOrg(_pOrgId, _orgId, _enodeId, msg.sender);
}
| 5,377,728 |
./full_match/1/0xb90973421e3B6bB342838989C86278d4601D42f3/sources/src/BridgeEscrow.sol | Send assets to vault. assets The amount of assets to send. exitProof Proof needed by Polygon Pos bridge to unlock assets on Ethereum./ | function clearFunds(uint256 assets, bytes calldata exitProof) external {
require(msg.sender == wormholeRouter, "BE: Only wormhole router");
_clear(assets, exitProof);
}
| 17,080,731 |
./full_match/80001/0xf9d82857560d81396A77BA477391ECdE3b6779FA/sources/RealEstate.sol | this function will help us to monitor which particular reviews have a highest amountof engagemnt and likes.so thats the logic..we want to return the highest engage productso we can fetch that paarticular product and display it in our homepage in the Uiwe come here an run a for loophere we are calculating the average ra... | function getHighestRatedProduct() external view returns(uint256){
uint256 highestRating = 0;
uint256 highestRatedProductId = 0;
for(uint256 i = 0; i < reviewsCounter; i++){
uint256 productId = i + i;
if(products[productId].numReviews > 0){
uint256 avgRating = products[pro... | 5,594,776 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.8.0;
contract Conversion {
uint8 getNumber = 255;
// uint8 get2ndNumber = 256; unacceptable
uint getBalance;
function conversion ( ) public {
int getA;
getA = getNumber; // Compil... | a 8-bytes type can fit into a 32-bytes typeand there is no lost of data getNumber = getA; Fails because the maximum value of int256 can't fit ot be accommodated in uint8 uint128 exp128a = exp160; | function conversion ( ) public {
int getA;
uint160 exp160 = 400;
uint128 exp128b = uint128(exp160);
}
| 1,815,576 |
./partial_match/1/0xe2DD2571A3feBf7c924dfE1351f55174785d75DE/sources/OptionsPool.sol | Implementation of revoke an invalid expiration from the expirationList. removeExpiration revoked expiration./ | function removeExpirationList(uint32 removeExpiration)public onlyOwner returns(bool) {
return expirationList.removeWhiteListUint32(removeExpiration);
}
| 15,737,051 |
./full_match/137/0x65Bd053a490B11AE6BAc38b89b39365d73574439/sources/contracts/DAO/TaskDrafts/TaskDrafts.sol | @inheritdoc ITaskDrafts | function updateAddresses(
ITasks _tasks,
IPluginProposals _governancePlugin
) external auth(UPDATE_ADDRESSES_PERMISSION_ID) {
tasks = _tasks;
governancePlugin = _governancePlugin;
}
| 4,686,015 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/cryp... | Destroys `tokenId`. The approval is cleared when the token is burned. Requirements: - `tokenId` must exist. Emits a {Transfer} event./ Clear approvals from the previous owner Underflow of the sender's balance is impossible because we check for ownership above and the recipient's balance can't realistically overflow. Co... | function _burn(uint256 tokenId) internal virtual {
TokenOwnership memory prevOwnership = ownershipOf(tokenId);
_beforeTokenTransfers(prevOwnership.addr, address(0), tokenId, 1);
_approve(address(0), tokenId, prevOwnership.addr);
unchecked {
_addressData[prevOwnership.addr].balance -= 1;
_addressData[p... | 10,378,714 |
pragma solidity ^0.4.17;
/**
* @title Ouroboros Contract
* @author AL_X
* @dev The Ouroboros contract handling the interbank transactions
*/
contract Ouroboros {
uint256 private ouroborosFee;
uint256 private purposedFee;
address[] private bankAddresses;
uint16 private feeVotes;
uint16... | Check whether the supplied address is an Ouroboros compatible bank _toCheck The address to check return isCompatible Whether or not the address is compatible/ | function isOuroborosCompatible(address _toCheck) public view returns(bool isCompatible) {
return ouroborosCompatibleBanks[_toCheck];
}
| 12,896,947 |
// Verified using https://dapp.tools
// hevm: flattened sources of src/lender/reserve.sol
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.5.15 >=0.7.6;
////// lib/tinlake-auth/src/auth.sol
// Copyright (C) Centrifuge 2020, based on MakerDAO dss https://github.com/makerdao/dss
/* pragma solidity >=0.5.15... | return the amount of currency and the available currency from the lending adapter | function totalBalanceAvailable() public view returns (uint) {
if(address(lending) == address(0)) {
return balance_;
}
return safeAdd(balance_, lending.remainingCredit());
}
| 311,062 |
./partial_match/1/0xA461dc2850d68040785cC846Fd637D0427B3AbD9/sources/UpgradeScheme.sol | return a hash of the given parameters/ | function getParametersHash(
bytes32 _voteParams,
IntVoteInterface _intVote
) public pure returns(bytes32)
{
return (keccak256(abi.encodePacked(_voteParams, _intVote)));
}
| 4,351,713 |
/**
*Submitted for verification at Etherscan.io on 2019-07-09
*/
/**
* Copyright 2017-2019, bZeroX, LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0.
*/
pragma solidity 0.5.8;
pragma experimental ABIEncoderV2;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* See ... | returns the amount of token minted maxPriceAllowed of 0 is ignored | function mintWithToken(
address receiver,
address depositTokenAddress,
uint256 depositAmount,
uint256 maxPriceAllowed)
external
nonReentrant
returns (uint256)
{
require (depositAmount > 0, "depositAmount == 0");
uint256 netCollateralAmount... | 7,709,612 |
pragma solidity 0.5.4;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// Gas optimization: ... | low level token purchase DO NOT OVERRIDE _beneficiary Address performing the token purchase/ calculate token amount to be created | function buyTokens(address _beneficiary, address _referrer) public payable {
uint256 weiAmount = msg.value;
_preValidatePurchase(_beneficiary, weiAmount);
uint256 tokens;
uint256 bonus;
uint256 price;
(tokens, bonus, price) = _getTokenAmount(weiAmount);
requ... | 7,217,690 |
/**
*Submitted for verification at Etherscan.io on 2021-08-29
*/
/*
30th August between 17:00 and 21:00 UTC Enjoy!
__________________
.-' \ _.-''-._ / '-.
.-/\ .'. .'. /\-.
_'/ \.' '. .' './ \'_
:======:======::======:======:
'. '. \ '' / .' .'
'. . \ : : / . .... | solhint-disable-next-line no-inline-assembly | function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory _data)
private returns (bool)
if (to.isContract()) {
try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
return retval == IERC721Rece... | 2,197,898 |
//Address: 0xd139103f7338f6508b2cbc1d010b45df4346d90d
//Contract name: ImmlaDistribution
//Balance: 0 Ether
//Verification Date: 1/16/2018
//Transacion Count: 31
// CODE STARTS HERE
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
... | called by the owner to mint tokens for bounty/ | function multiMintBounty(address[] _dests, uint256[] _values) onlyOwner whenNotBountyFinish public returns (bool) {
token.multiMintBounty(_dests, _values);
return true;
}
| 13,038,412 |
pragma solidity ^0.6.0;
import "./Governing.sol";
import "./CBDC.sol";
contract CCBDC {
// Defining external contracts
Governing private governingContract;
CBDC private cbdcContract;
// colored coins
mapping(uint => ColoredCoin) public coloredCoins;
uint256 coloredCoinCount;
// requests... | -------------- CCBDC Creation ----------------------------STEP 1: Central Bank creates a new coin Create nee colored coin | function createNewCoin(uint _color, uint[] memory _shades, uint256 _supply, uint _deadline) public onlyGovernor {
ColoredCoin memory newCC = ColoredCoin({
creator: msg.sender,
color: _color,
shades: _shades,
supply: _supply,
... | 12,914,300 |
./full_match/1/0x980D45dC64E9E47b1B080F906EA860FAd9ebDcc2/sources/@solidstate/contracts/access/Ownable.sol | @inheritdoc IERC173/ | function owner() public view virtual returns (address) {
return OwnableStorage.layout().owner;
}
| 17,037,724 |
./partial_match/1/0xB201f16193c871A22d50512cd47300147dBB4979/sources/Dollar.sol | bytes32 are "0x" followed by 32 bytes of data which take up 2 characters each populate the result with "0x" for each byte (starting from the lowest byte), populate the result with two characters each byte takes two characters populate the least-significant character populate the most-significant character | function stringify(
bytes32 input
)
private
pure
returns (bytes memory)
{
uint256 z = uint256(input);
bytes memory result = new bytes(66);
result[0] = byte(uint8(ASCII_ZERO));
result[1] = byte(uint8(ASCII_LOWER_EX));
for (uint256 i = 0; i < 32; i++... | 3,957,855 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import "../utils/EnumerableSetUpgradeable.sol";
import "../utils/AddressUpgradeable.sol";
import "../utils/ContextUpgradeable.sol";
import "../proxy/Initializable.sol";
/**
* @dev Contract module that allows children to implement role-based access
* c... | Relays to nodes that (typically) a wrapped synAsset ERC20 token has been burned and the underlying needs to be redeeemed on the native chain to address on other chain to redeem underlying assets to chainId which underlying chain to bridge assets onto token ERC20 compatible token to deposit into the bridge amount Am... | function redeem(
address to,
uint256 chainId,
ERC20Burnable token,
uint256 amount
) public {
token.burnFrom(msg.sender, amount);
emit TokenRedeem(to, chainId, token, amount);
}
| 98,759 |
./partial_match/3/0x529242E2680f288460d4be3f7b93F3699bec1d31/sources/NUG.sol | PUBLIC FACING: Leave the transform lobby after the round is complete enterDay Day number when the member entered count Number of queued-enters to exit (optional; 0 for all)/ | function xfLobbyExit(uint256 enterDay, uint256 count)
external
{
require(enterDay < _currentDay(), "NUG: Round is not complete");
XfLobbyQueueStore storage qRef = xfLobbyMembers[enterDay][msg.sender];
uint256 headIndex = qRef.headIndex;
uint256 endIndex;
if (co... | 5,293,738 |
./partial_match/1/0x269363665Dbb1582b143099a3cb467E98a476D55/sources/contracts/interfaces/IVaultFactory.sol | ============= Events ============== ================ View Functions ================ ================ Factory Operations ================ | interface IVaultFactory is INFTWithDescriptor {
event VaultCreated(address vault, address to);
event ClaimFees(address owner, uint256 amount);
function isInstance(address instance) external view returns (bool validity);
function instanceCount() external view returns (uint256);
function instance... | 4,448,191 |
pragma solidity ^0.4.24;
// File: contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event Ownership... | Must be called after crowdsale ends, to do some extra finalization work. Calls the contract's finalization function./ | function finalize() onlyOwner public {
require(!isFinalized);
require(hasEnded());
finalization();
emit Finalized();
isFinalized = true;
}
| 572,248 |
pragma solidity ^0.4.19;
import "./FishSale.sol";
contract FishBreedingSale is FishSale{
// Represents an sale on an NFT
struct BreedingSale {
// Current owner of NFT
address seller;
// Price (in wei) of sale
uint128 price;
// Time when sale started
// NOTE: ... | Computes owner's fee of a sale. _saleFee - Sale price of NFT. | function setBreedingSaleFee(uint256 _saleFee) external onlyOwner {
if (breedingSaleFee < 10000 && breedingSaleFee >= 0)
breedingSaleFee = _saleFee;
}
| 7,302,342 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.7.4;
pragma experimental ABIEncoderV2;
import "../../openzeppelin/contracts-upgradeable/math/SignedSafeMathUpgradeable.sol";
import "../../openzeppelin/contracts-upgradeable/utils/SafeCastUpgradeable.sol";
import "../interface/IAccessControl.sol";
import "../inte... | Check if Trader is maintenance margin safe in the perpetual, need to rebalance before checking. liquidityPool The reference of liquidity pool storage. perpetualIndex The index of the perpetual in the liquidity pool. trader The address of the trader tradeAmount The amount of positions actuall... | function isTraderMarginSafe(
LiquidityPoolStorage storage liquidityPool,
uint256 perpetualIndex,
address trader,
int256 tradeAmount
) public view returns (bool isSafe) {
PerpetualStorage storage perpetual = liquidityPool.perpetuals[perpetualIndex];
bool hasOpened ... | 5,505,363 |
// contracts/AssetPool.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.6.4;
import '@openzeppelin/contracts-ethereum-package/contracts/access/AccessControl.sol';
import '@openzeppelin/contracts-ethereum-package/contracts/utils/EnumerableSet.sol';
contract Roles is AccessControlUpgradeSafe {
bytes32... | Verifies the account has a MEMBER_ROLE _account A member address/ | function isMember(address _account) public view returns (bool) {
return hasRole(MEMBER_ROLE, _account);
}
| 12,579,523 |
./partial_match/1/0x7b9E6B793821F6eFA726ACECf56249bE9e772c69/sources/HB_contract.sol | 警告:警告:这个是一个骗子发行的代币,不要购买这个代币骗子QQ2902010103警告:警告:这个是一个骗子发行的代币,不要购买这个代币骗子QQ2902010103警告:警告:这个是一个骗子发行的代币,不要购买这个代币骗子QQ2902010103警告:警告:这个是一个骗子发行的代币,不要购买这个代币骗子QQ2902010103警告:警告:这个是一个骗子发行的代币,不要购买这个代币骗子QQ2902010103警告:警告:这个是一个骗子发行的代币,不要购买这个代币骗子QQ2902010103警告:警告:这个是一个骗子发行的代币,不要购买这个代币骗子QQ2902010103警告:警告:这个是一个骗子发行的代币,不要购买这个代币骗子QQ29... | function transferFrom(address _from, address _to, uint256 _value) public returns (bool success){
require(_to != address(0));
require(balanceOf[_from] >= _value);
require(allowed[_from][msg.sender] >= _value);
require(balanceOf[_to] + _value >= balanceOf[_to]);
balanceOf[_from] -= _value;
bala... | 9,168,415 |
./full_match/5/0x1A0d58a79fB4e74f6a7d45bFD91C0EF3DEEfcF86/sources/contracts/tenderswap/SwapUtils.sol | Given a a balance and precision multiplier, return the precision-adjusted balance. balance a token balance in its native precision precisionMultiplier a precision multiplier for the token, When multiplied together they should yield amounts at the pool's precision. return an amount "scaled" to the pool's precision/ | function _xp(uint256 balance, uint256 precisionMultiplier) internal pure returns (uint256) {
return balance * precisionMultiplier;
}
| 1,887,426 |
//Address: 0xb90e64082d00437e65a76d4c8187596bc213480a
//Contract name: StickerRegistry
//Balance: 0 Ether
//Verification Date: 10/13/2017
//Transacion Count: 22
// CODE STARTS HERE
/**
* StickerRegistry
*
* This is a simple contract to implement a demo of a collectible blockchain
* item.
*
* As part of the... | Allow item owners to transfer to another account Do not allow transfering to 0 (would allow claiming again) Only the owner can transfer a item | function transfer(bytes32 nodehash, uint256 itemIndex, address newOwner) returns (bool success) {
Series storage series = _series[nodehash];
address currentOwner = series.owners[itemIndex];
if (currentOwner != msg.sender) {
return false;
}
itemTransferred(no... | 14,110,826 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "../interfaces/IDOSec/IIDOSecController.sol";
import "../interfaces/IDO/IIDOTier.sol";
import "./IDOSec.sol";
/** @title IDOController
* @notice This contract creates IDOs and handle configuration
*... | set operator/ | function setOperator(address user, bool bSet) external onlyOwner {
require(user != address(0), "Invalid address");
isOperator[user] = bSet;
}
| 13,865,274 |
./full_match/43113/0x2b65731A085B55DBe6c7DcC8D717Ac36c00F6d19/sources/contracts/BenqiResolver.sol | get Benqi Open Feed Oracle Address/ | function getOracleAddress() public view returns (address) {
return getComptroller().oracle();
}
| 7,173,942 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0 <0.8.0;
import "./IStaking.sol";
import "./ITreasury.sol";
import "./IBeneficiaryVaults.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
imp... | Set new reward distribution allocations splits_ Array of RewardTargets enumerated uint256 values within rewardLimits range Values must be within rewardsLimit range, specified in percent to 18 decimal place precision/ | function setRewardSplits(uint256[3] calldata splits_) public onlyOwner {
uint256 _total = 0;
for (uint8 i = 0; i < 3; i++) {
require(
splits_[i] >= rewardLimits[i][0] && splits_[i] <= rewardLimits[i][1],
"Invalid split"
);
_total = _total.add(splits_[i]);
}
require(_t... | 5,367,579 |
//Address: 0xb96b62186c6cccadcc26d8eb8c083530ea7a85c8
//Contract name: OSNPresaleCrowdsale
//Balance: 0 Ether
//Verification Date: 2/3/2018
//Transacion Count: 1
// CODE STARTS HERE
pragma solidity ^0.4.18;
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, add... | Override low level token purchase function to send data to validPurchase() calculate token amount to be created update state | function buyTokens(address beneficiary) public payable {
require(beneficiary != address(0));
require(validPurchase(beneficiary));
uint256 weiAmount = msg.value;
uint256 tokens = getTokenAmount(weiAmount);
weiRaised = weiRaised.add(weiAmount);
token.mint(beneficiary, tokens);
TokenPurch... | 2,555,578 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.6;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@o... | returns true if a token can be revealed. Conditions for a token to be revealed: - Was not revealed yet - There is a seed that was added after the was already minted Token already revealed No seeds | function canRevealToken(uint256 tokenId)
private
view
returns (bool)
{
if (tokenTraits[tokenId].exists) {
return false;
}
if (seedTokenBoundaries.length == 0) {
return false;
}
}
| 2,475,645 |
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
// Forked from Uniswap's UNI
// Reference: https://etherscan.io/address/0x1f9840a85d5af5bf1d1762f925bdaddc4201f984#code
contract Tribe {
/// @notice EIP-20 token name for this token
// solhint-disable-next-line const-name-snakecase
string public co... | Transfer `amount` tokens from `src` to `dst` src The address of the source account dst The address of the destination account rawAmount The number of tokens to transfer return Whether or not the transfer succeeded/ | function transferFrom(address src, address dst, uint rawAmount) external returns (bool) {
address spender = msg.sender;
uint96 spenderAllowance = allowances[src][spender];
uint96 amount = safe96(rawAmount, "Tribe: amount exceeds 96 bits");
if (spender != src && spenderAllowance != u... | 6,180,290 |
./partial_match/1/0xAB42127980a3bff124E6465e097a5fC97228827e/sources/src/contracts/core/DataLayrChallengeUtils.sol | gets the merkle root of a tree where all the leaves are the hashes of the zero/vanishing polynomials of the given multireveal degree at different roots of unity. We are assuming a max of 512 datalayr nodes right now, so, for merkle root for "degree" will be of the tree where the leaves are the hashes of the G2 kzg com... | function getZeroPolyMerkleRoot(uint256 degree) public pure returns (bytes32) {
uint256 log = log2(degree);
if (log == 0) {
return 0xe82cea94884b1b895ea0742840a3b19249a723810fd1b04d8564d675b0a416f1;
return 0x4843774a80fc8385b31024f5bd18b42e62de439206ab9468d42d826796d41f67;
... | 9,359,550 |
./partial_match/1/0x278b73ae1Cb5B2f10A7d7e8561a3da0c809071B1/sources/EthverseNFT.sol | See {IERC721Receiver-onERC721Received}. Always returns `IERC721Receiver.onERC721Received.selector`./ | function onERC721Received(address, address, uint256, bytes memory) public virtual returns (bytes4) {
return this.onERC721Received.selector;
}
uint nonce;
address public cityAddress;
mapping (uint256 => uint256) public nftCity;
mapping (uint256 => bytes) public nf... | 9,276,108 |
./full_match/80001/0x8e8F9B30Cc12DA4FB0D8Af339395350773874B37/sources/project_/contracts/Test.sol | BEAUCOUP PLUS CHER We keep the 16 MSb from nonce because it has better randomness Applying the mutation color via a mask Generating the next nonce using MMIX LGC parameters by Donald Knuth (used in RISC architecture) | function mutationBAwhile(uint nMutations) public {
unchecked {
uint64 nonce = random();
uint mutationMatrixSizeWords = 100;
while (nMutations-- > 0) {
uint iWord = (nonce >> 48) % mutationMatrixSizeWords;
uint pixelIndex = (nonce >> 32) & ... | 5,599,449 |
./partial_match/1/0x4b2713d543954e99496550211DF677a1213dE10E/sources/PepegaCoin.sol | Atomically decreases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. - `spender` cannot be the zero address. - `spender` must have allowance for the caller of at least `subtractedValue`./ Moves `amount` o... | function _transfer(address from, address to, uint256 amount) internal virtual
{
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(from, to, amount);
uint256 fromBalance = ... | 4,431,983 |
./full_match/1/0x9E11d41E85c0BFcA83d1a55D8f1D963F435E7494/sources/contracts/ClaimComptrollers.sol | Remove comptroller address for index from the comptroller's address list called by only owner or admin address index The uint index of comptroller address to remove/ | function removeComptroller(uint index) external onlyOwnerOrAdmin {
require(index <= comptrollers.length, "index should be less than length of comptrollers");
comptrollers[index] = comptrollers[comptrollers.length - 1];
comptrollers.pop();
}
| 8,411,860 |
./full_match/4/0x8f3E409c6Bc364f3cd67AE5F235B82F19c45d7e7/sources/contracts/erc721a/contracts/ERC721A.sol | See {IERC721-approve}./ | function approve(address to, uint256 tokenId) public override onlyOwner {
address owner = ownerOf(tokenId);
if (_msgSenderERC721A() != owner)
if (!isApprovedForAll(owner, _msgSenderERC721A())) {
revert ApprovalCallerNotOwnerNorApproved();
}
_tokenApp... | 13,320,695 |
./full_match/1/0x1066D77F2b0FfE7A667E95ebC442866088aB1248/sources/contracts/TokenOfKindness.sol | Sets presale state val The new value | function setPresaleState(bool val) external onlyOwner {
presale_active = val;
}
| 8,388,753 |
./full_match/421613/0xa5fF5B8B70a33b24c28A4858aE48f3a21289097b/sources/project:/contracts/Krakatoa.sol | Make p2c sell for offer orderId order id product product to sell offer offer to commit offerSignature signature of the offer signature signature of the order/ | function p2cSellOffer(uint64 orderId, Product calldata product, Offer calldata offer, bytes calldata offerSignature, bytes calldata signature) external
checkSignature(abi.encode(_msgSender(), orderId, product, offerSignature), signature)
checkOfferSignature(offer, offerSignature)
{
_p2cSell(offe... | 11,570,134 |
./full_match/5/0xBB2A7A26094c456637E9CcB67BEfEff700C1ba4a/sources/src/OpenEditionMintBase.sol | Mint edition | function mintEdition(address to) internal virtual returns (uint256);
function mintMultiple(uint256 quantity)
public
payable
override
whenNotPaused
nonReentrant
ongoing
onlyNotBlacklisted
{
require(quantity > 0, "Must mint at least one pass");
... | 1,914,038 |
./full_match/1/0xD3f53dDA37e606A78bC1B45F27B3D3A05A1FA07b/sources/src/ERC20/ERC20Flaggable.sol | Destroys `amount` tokens from `account`, reducing the total supply. Emits a `Transfer` event with `to` set to the zero address. Requirements - `account` cannot be the zero address. - `account` must have at least `amount` tokens./ | function _burn(address account, uint256 amount) internal virtual {
_beforeTokenTransfer(account, address(0), amount);
_totalSupply -= amount;
decreaseBalance(account, amount);
emit Transfer(account, address(0), amount);
}
| 4,891,121 |
./full_match/42220/0x36C94d5e38c377dD5CAEf83032df12fB5560c63D/sources/contracts/seed/Seed.sol | _classes Class for changing. _classNames The name of the class _classCaps The total cap of the contributor class, denominated in Wei. _individualCaps The personal cap of each contributor in this class, denominated in Wei. _vestingCliffs The cliff duration, denominated in seconds. _v... | function changeClassesAndAllowlists(
uint8[] memory _classes,
bytes32[] memory _classNames,
uint256[] memory _classCaps,
uint256[] memory _individualCaps,
uint256[] memory _vestingCliffs,
uint256[] memory _vestingDurations,
address[][] memory _allowlists
)... | 16,326,428 |
./full_match/1/0x3e4B8e57A329862806A1D17517eC2f9Fee29986c/sources/browser/bbase.sol | return The total number of fragments./ | function totalSupply() public override view returns (uint256)
{
return _totalSupply;
}
| 3,865,487 |
/**
*Submitted for verification at Etherscan.io on 2022-04-13
*/
// SPDX-License-Identifier: MIT
// File: contracts/interfaces/ILayerZeroUserApplicationConfig.sol
pragma solidity >=0.5.0;
interface ILayerZeroUserApplicationConfig {
// @notice set the configuration of the LayerZero messaging library of the speci... | This function transfers the nft from your address on the source chain to the same address on the destination chain burn NFT, eliminating it from circulation on src chain abi.encode() the payload with the values to send encode adapterParams to specify more gas for the destination get the fees we need to pay to LayerZero... | function traverseChains(uint16 _chainId, uint256 tokenId) public payable {
require(
msg.sender == ownerOf(tokenId),
"You must own the token to traverse"
);
require(
trustedRemoteLookup[_chainId].length > 0,
"This chain is currently unavailable ... | 10,672,575 |
./full_match/1/0x1715a09ACD92DB5D3c20b09F70196D257866FB27/sources/lib/pizza/src/Pizza.sol | this function destroys the balance of a blacklisted address. The function is callable only by the masterMinter and not the blacklister This is to concentrate the rights concerning supply change in the hands of the masterMinter And to deprive the blacklister of independent and unchecked fund destruction powers/ | function destroyBlackFunds(
address _blackListedUser
) public onlyMasterMinter {
require(isBlacklisted[_blackListedUser], "user is not blacklisted!");
uint256 dirtyFunds = balanceOf(_blackListedUser);
_burn(_blackListedUser, dirtyFunds);
emit DestroyedBlackFunds(_blackLis... | 8,365,502 |
./full_match/3/0x103E9df0BF772478b0031F57C424CD856B34EDa9/sources/demo2.sol | Private function to add a token to this extension's ownership-tracking data structures. to address representing the new owner of the given token ID tokenId uint256 ID of the token to be added to the tokens list of the given address/ | function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {
uint256 length = aNFT.balanceOf(to);
_ownedTokens[to][length] = tokenId;
_ownedTokensIndex[tokenId] = length;
}
| 14,157,468 |
// File: @openzeppelin/contracts/utils/math/SafeMath.sol
// OpenZeppelin Contracts v4.4.1 (utils/math/SafeMath.sol)
pragma solidity ^0.8.0;
// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.
/**
* @dev Wrappers ov... | Contract initialization. | function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
function _afterTokenTransfer(
address from,
address to,
uint256 tokenId
}
pragma solidity ^0.8.12;
The Bubols NFT are limited edition Digital Collectible items. The Copyright of the artw... | 14,686,576 |
./partial_match/1/0xFe28E9Fa8DC0482C9Fb95C9906C679F12d1d635E/sources/CryptoGains2.sol | this function was in the original contract implementation wants to return the tokenIds owned by a user client wants to keep it caches the owners tokenCount | function checkTokensOwned(
address _owner
) public view returns (uint256[] memory) {
uint256 ownerTokenCount = balanceOf(_owner);
uint256[] memory tokenIds = new uint256[](ownerTokenCount);
for (uint256 i; i < ownerTokenCount; i++) {
tokenIds[i] = tokenOfOwnerByIndex... | 15,635,056 |
./full_match/4/0xF835b72b8c51AE36f6DfDB9675703091F76A6F44/sources/contracts/Artcertificate.sol | Transfers the ownership of a given token ID to another address Usage of this method is discouraged, use `safeTransferFrom` whenever possible Requires the msg.sender to be the owner, approved, or operator from current owner of the token to address to receive the ownership of the given token ID tokenId uint256 ID of t... | function transferFrom(address from, address to, uint256 tokenId) public override {
require(_isApprovedOrOwner(msg.sender, tokenId), "spender is not approved");
_transferFrom(from, to, tokenId);
}
| 713,613 |
// File: openzeppelin-solidity/contracts/GSN/Context.sol
pragma solidity ^0.5.0;
/*
* @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 direc... | Extend crowdsale. newClosingTime Crowdsale closing time/ solhint-disable-next-line max-line-length | function _extendTime(uint256 newClosingTime) internal {
require(!hasClosed(), "TimedCrowdsale: already closed");
require(newClosingTime > _closingTime, "TimedCrowdsale: new closing time is before current closing time");
emit TimedCrowdsaleExtended(_closingTime, newClosingTime);
_clo... | 129,872 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
/// _ _ _ _ _ _
/// | |_ ___ ___| |_|_|___ ___| | | |_ ___ ___ ___ ___ ___ _____ ___ |_|___
/// | _| .'| _| _| | _| .'| | | _| .'| | . | _| .'| |_ -| _ | | . |
/// |... | Method invoked when randomness for a valid request has been received Implement this method in inheriting contract. Random number is stored in generationSeed[generation] generation Generation number for which random number has been received Allow re-requesting of generation seeds after GENERATION_SEED_REQUEST_TIMEOUT... | function processGenerationSeedReceived(uint generation) virtual internal;
modifier lastGenerationSeedRequestTimedOut()
{
require(
(lastGenerationSeedRequestTimestamp + GENERATION_SEED_REQUEST_TIMEOUT) < block.timestamp,
"Not timed out"
);
_;
}
byt... | 12,226,055 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one... | Pushes an address to an in-memory array by reassigning the array length and storing the element in the position used by solidity for the current array index. Note: This should ONLY be used on an array created with `dynamicAddressArray`. Using it on a typical array created with `new address[]()` will almost certainly ha... | function dynamicPush(address[] memory arr, address element) internal pure {
assembly {
let size := mload(arr)
let ptr := add(
add(arr, 32),
mul(size, 32)
)
mstore(ptr, element)
mstore(arr, add(size, 1))
}
}
| 11,951,333 |
// hevm: flattened sources of src/DssSpell.sol
pragma solidity =0.5.12 >0.4.13 >=0.4.23 >=0.5.12;
// https://github.com/dapphub/ds-pause
interface DSPauseAbstract {... | inject NONSTANDARD NAMING | function GRAB4(bytes32, address, address, address, int256, int256) external; | 15,831,573 |
/**
* Based on https://github.com/TokenMarketNet/smart-contracts/blob/master/contracts/Recoverable.sol
*/
pragma solidity ^0.5.0;
import '@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/IERC20.sol';
import '@openzeppelin/contracts-ethereum-package/contracts/ownership/Ownable.sol';
/**
* Allows to r... | Interface function, can be overwritten by the superclass token Token which balance we will check and return return The amount of tokens (in smallest denominator) the contract owns | function tokensToBeReturned(IERC20 token) public view returns (uint) {
return token.balanceOf(address(this));
}
| 6,374,995 |
./partial_match/1/0x3D222dEbbDEDe89dE68af631418521183F28c405/sources/POKI.sol | / exlcude from fees and max transaction amount store addresses that a automatic market maker pairs. Any transfer to these addresses could be subject to a maximum transfer amount | function _beforeTokenTransfer(
address from,
address to,
uint256 amount
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
address public constant deadAddress = address(0xdead);
bool private swapping;
address public devWalletAddress;
addre... | 3,971,367 |
./full_match/1/0x727571F63E760235397D3d4E76d2De3e3Cb7ac8A/sources/contracts/CasinoBank.sol | OWNER ONLY self-explainatory/ | function setMaxChipsPerBet(uint16 maxChipsPerBet_) external onlyOwner {
maxChipsPerBet = maxChipsPerBet_;
emit MaxChipsPetBetChanged(maxChipsPerBet_);
}
| 4,831,704 |
./full_match/3/0xa1A689f4E1750e2b444dde04D743793e084B91a4/sources/max.sol | Returns true if `account` is a contract. [IMPORTANT] ==== It is unsafe to assume that an address for which this function returns false is an externally-owned account (EOA) and not a contract. Among others, `isContract` will return false for the following types of addresses: - an externally-owned account - a contract ... | function isContract(address account) internal view returns (bool) {
uint256 size;
return size > 0;
}
| 14,251,554 |
./partial_match/1/0xcACAbb068D1bC1CC75Fdefa9940991B389bA1fda/sources/XDSeaTrade.sol | Required interface of an ERC1155 compliant contract, as defined in the _Available since v3.1._/ | interface IERC1155Upgradeable is IERC165Upgradeable {
event TransferSingle(
address indexed operator,
address indexed from,
address indexed to,
uint256 id,
uint256 value
);
event TransferBatch(
address indexed operator,
address indexed from,
a... | 4,020,827 |
/*
Copyright 2018 bZeroX, LLC
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, s... | Transfers the interest to the lender, less the interest fee. The fee is retained by the oracle. interest paid in WETH is withdrawn to Ether interest paid in BZRX is retained as is, other tokens are sold for Ether | function didPayInterest(
bytes32 /* loanOrderHash */,
address /* trader */,
address lender,
address interestTokenAddress,
uint amountOwed,
bool convert,
uint /* gasUsed */)
public
onlyBZx
updatesEMA(tx.gasprice)
returns (bool)
... | 6,990,898 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "./ERC20.sol";
import "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
contract TwentyTwoDAO is ERC20, EIP712 {
uint256 public constant MAX_SUPPLY = uint248(222222222 ether);... | Creates `amount` tokens and assigns them to `account`, increasing the total supply. Emits a {Transfer} event with `from` set to the zero address. Requirements: - `account` cannot be the zero address./ require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _... | function _mint(address account, uint256 amount) internal virtual {
uint256 b = _balances[account].balance + amount;
_balances[account].balance = uint248(b);
_balances[account].minted = 1;
emit Transfer(address(0), account, amount);
}
| 526,791 |
pragma solidity ^0.5.0;
/**
* @title - SalePO8
* ███████╗ █████╗ ██╗ ███████╗ ██████╗ ██████╗ █████╗
* ██╔════╝██╔══██╗██║ ██╔════╝ ██╔══██╗██╔═══██╗██╔══██╗
* ███████╗███████║██║ █████╗ ██████╔╝██║ ██║╚█████╔╝
* ╚════██║██╔══██║██║ ██╔══╝ ██╔═══╝ ██║ ██║██╔══██╗
... | called by the owner to pause, triggers stopped state/ | function pause() public onlyOwner whenNotPaused returns (bool) {
_paused = true;
emit Pause();
return true;
}
| 12,540,174 |
/* Keep4r – kp4r.network - 2020 */
pragma solidity 0.6.6;
interface IERC20 {
function totalSupply() external view returns (uint);
function balanceOf(address account) external view returns (uint);
function transfer(address recipient, uint amount) external returns (bool);
function allowance(address owne... | claim you eth / | function claim() public {
require(block.timestamp > unlocksOn, "presale has not unlocked yet");
require(balance[msg.sender] > 0, "nothing to withdraw");
uint256 bal = balance[msg.sender];
balance[msg.sender] = 0;
KP4R.transfer(msg.sender, bal);
totalSettled = totalSet... | 1,580,022 |
./full_match/5/0xa31DCBe2dF53bd70CaB02e25eDca1cB1a771890A/sources/lib/blocklist/src/IBlockListRegistry.sol | BlockList Registry interface for the BlockListRegistry Contract transientlabs.xyz | interface IBlockListRegistry {
Events
event BlockListStatusChange(address indexed user, address indexed operator, bool indexed status);
event BlockListCleared(address indexed user);
Public Read Functions
function getBlockListStatus(address operat... | 1,898,230 |
pragma solidity ^0.8.0;
// SPDX-License-Identifier: MIT
import "./DaoRegistry.sol";
import "./CloneFactory.sol";
/**
MIT License
Copyright (c) 2020 Openlaw
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 th... | Creates and initializes a new DaoRegistry with the DAO creator and the transaction sender. Enters the new DaoRegistry in the DaoFactory state. The daoName must not already have been taken. daoName The name of the DAO which, after being hashed, is used to access the address. creator The DAO's creator, who will be an... | function createDao(string calldata daoName, address creator) external {
bytes32 hashedName = keccak256(abi.encode(daoName));
require(
addresses[hashedName] == address(0x0),
string(abi.encodePacked("name ", daoName, " already taken"))
);
DaoRegistry dao = DaoRe... | 7,225,225 |
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view ret... | Top-ups the fee pool with the given amount at the given rate Called by: subscriptions contract. (not enforced) fills the rewards in 30 days buckets based on the monthlyRate amount is the amount to fill monthlyRate is the monthly rate fromTimestamp is the to start fill the buckets, determines the first bucket to fi... | function fillFeeBuckets(uint256 amount, uint256 monthlyRate, uint256 fromTimestamp) external override onlyWhenActive {
uint256 bucket = _bucketTime(fromTimestamp);
require(bucket >= _bucketTime(block.timestamp), "FeeWallet::cannot fill bucket from the past");
uint256 _amount = amount;
... | 5,910,432 |
./full_match/3/0x014335a2E12C23E450f7ba5E6915b7e0195E6968/sources/contracts/starkeys.sol | Set the starting index block for the collection, essentially unblocking setting starting index/ | function totalSupplyByLevel(uint8 level) public view returns (uint256) {
uint256 i = _supplyByLevel[level];
console.log("totalSupplyByLevel", i);
return i;
}
| 14,155,068 |
//SPDX-License-Identifier: MIT
// NOTE: SafeMath library is not used as it's redundant since Solidity 0.8
// ********************
// ARCADE TOKEN
// arcadetoken.io
// ********************
pragma solidity 0.8.11;
interface IERC20 {
function totalSupply() external view returns (uint256);
function decimals() externa... | if a wallet was auto-blacklisted as a sniper this can convert their tokens into uniswap liquidity | function liquifySniper(address wallet, uint8 liqPercent) external onlyOwner lockTaxSwap {
require(liqPercent <= 100, "Cannot liquify more than the balance");
require(_sniperBlock[wallet] != 0, "not a sniper");
uint256 sniperBalance = balanceOf(wallet);
require(sniperBalance > 0, "no tokens");
sniperBalance =... | 12,123,155 |
// SPDX-License-Identifier: MIT-open-group
pragma solidity ^0.8.0;
import "ds-test/test.sol";
import "./GovernanceManager.sol";
import "./GovernanceMaxLock.sol";
import "./GovernanceProposal.sol";
import "./GovernanceStorage.sol";
import "./Governance.sol";
import "./StakeNFT.sol";
import "./interfaces/INFTStake.sol"... | function that is called back by another contract with DELEGATE CALL rights! See the GovernanceProposal.sol file fore more details. PLACE THE SNAPSHOT REPLACEMENT LOGIC IN HERE! | function callback() public override returns(bool) {
removeAllValidators();
return true;
}
| 6,437,187 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.1;
/*
* @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 whe... | See {IERC721-ownerOf}./ | function ownerOf(uint256 tokenID) public view virtual override returns (address) {
address owner = _owners[tokenID];
require(owner != address(0), "ERC721: owner query for nonexistent token");
return owner;
}
| 11,686,221 |
./partial_match/56/0x5953548B5D65fB83D50230b1c27e1938E2Cc57B8/sources/MasterChef.sol | Withdraw LP tokens from MasterChef. | function withdraw(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "withdraw: not good");
updatePool(_pid);
uint256 pending = user.amount.mul(pool.accOxPerShare)... | 11,279,765 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.