file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./partial_match/1/0x46baF37b504e24DB0Edd92Cdd5089f737c759a3C/sources/home/vadim/code/skale-manager/contracts/delegation/DelegationController.sol | Allows a validator to accept a proposed delegation. Successful acceptance of delegations transition the tokens from a PROPOSED state to ACCEPTED, and tokens are locked for the remainder of the delegation period. Emits a {DelegationAccepted} event. Requirements: - Validator must be recipient of proposal. - Delegation st... | function acceptPendingDelegation(uint delegationId) external checkDelegationExists(delegationId) {
require(
_getValidatorService().checkValidatorAddressToId(msg.sender, delegations[delegationId].validatorId),
"No permissions to accept request");
_checkIfDelegationIsAllowed(de... | 4,341,125 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.6;
pragma abicoder v2;
import "@uniswap/v3-core/contracts/interfaces/IUniswapV3Factory.sol";
import "../interfaces/IUniStrategy.sol";
import "../interfaces/IUnipilot.sol";
import "../interfaces/uniswap/IUniswapLiquidityManager.sol";
import "../oracle/interfaces/I... | base order position range order position accumulated fees total liquidity pool premiums oracle address for tokens to fetch prices from rebase | function governance() external view returns (address);
function mintProxy() external view returns (address);
function mintPilot(address recipient, uint256 amount) external;
function deposit(IExchangeManager.DepositParams memory params, bytes memory data)
external
payable
retur... | 6,967,558 |
pragma solidity ^0.4.19;
contract BitOpterations {
// helper functions set
// to manipulate on bits
// with different widht of allocator
function set512(bytes32[2] storage allocator,uint16 pos,uint8 value) internal returns( bytes32[2] storage) {
... | we're actually in `running` state not all tickets are sold yet if the ticket is taken you would get your ethers back start process of random number generation if last ticket was sold | function buyTicket(uint8 lotteryId,uint16[] tickets,address referer) payable public {
require(state[lotteryId] == State.Running);
require(maxTickets[lotteryId] > ticketsSold[lotteryId]);
if (referer != address(0)) {
setReferer(referer);
}
... | 13,054,392 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
//
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementat... | Withdraw ether from this contract (Callable by owner only)/ | function withdraw() onlyOwner public {
uint256 _balance = address(this).balance;
require(payable(luke_crypto).send(_balance));
}
| 440,879 |
// Sources flattened with hardhat v2.0.8 https://hardhat.org
// File @aragon/os/contracts/lib/math/SafeMath.sol@v4.0.1
// See https://github.com/OpenZeppelin/openzeppelin-solidity/blob/d51e38758e1d985661534534d5c61e27bece5042/contracts/math/SafeMath.sol
// Adapted to use pragma ^0.4.24 and satisfy our linter rules
p... | Send funds to recovery Vault. This contract should never receive funds, but in case it does, this function allows one to recover them. _token Token balance to be sent to recovery vault./ | function transferToVault(address _token) external {
require(allowRecoverability(_token), ERROR_DISALLOWED);
address vault = getRecoveryVault();
require(isContract(vault), ERROR_VAULT_NOT_CONTRACT);
if (_token == ETH) {
vault.transfer(address(this).balance);
u... | 13,643,108 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
abstract contract ERC20 {
function totalSupply() public virtual view returns (uint256);
function balanceOf(address who) public... | validates sigs to and checks whether signers can whitelist or minters sigs an byte array containing one or many signatures message keccak256 of minting or whitelisting parameters, signed by the signers checkMint check whether signers can minting checkWhitelist check whether signers can whitelist/if(msg.sender==owne... | function _validate(bytes calldata sigs, bytes32 message, bool checkMint, bool checkWhitelist) private view returns (bool){
require(checkMint || checkWhitelist);
uint256 minters = 0;
uint256 whitelisters = 0;
if(_canMint[msg.sender]) minters++;
if(_canWhitelist[msg.sender]) wh... | 964,269 |
pragma solidity ^0.4.23;
/**
* @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;
}
c = ... | ERC 721 safeTransfer from functions | function safeTransferFrom(address _from, address _to, uint _pixelId) public canManageAndTransfer(_pixelId){
safeTransferFrom(_from,_to,_pixelId,"");
}
| 6,799,825 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.10;
import {DSTest} from "ds-test/test.sol";
import {ZoraModuleManager} from "../../ZoraModuleManager.sol";
import {ZoraProtocolFeeSettings} from "../../auxiliary/ZoraProtocolFeeSettings/ZoraProtocolFeeSettings.sol";
import {ZoraRegistrar} from "../utils/users/Z... | Approve ERC721TransferHelper as operator Attempt token transfer without ZMM approval | function testRevert_UserMustApproveModule() public {
vm.startPrank(address(alice));
token.setApprovalForAll(address(erc721TransferHelper), true);
vm.expectRevert("module has not been approved by user");
module.depositERC721(address(token), address(alice), 0);
vm.stopPrank()... | 15,813,401 |
./full_match/1/0xFa4bAa6951B6Ee382e9ff9AF2D523278b99ca6D0/sources/contracts/HouseMoney.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("House", "HOUSE") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswa... | 4,943,211 |
/**
*Submitted for verification at Etherscan.io on 2021-02-07
*/
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.4;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens... | Opens the sale. Can be called only by the contract owner./ | function openTier1() public {
require(msg.sender == _owner && _stage == 0, "Msg sender needs to be the owner and current stage 0");
_stage = 1;
}
| 6,814,980 |
pragma solidity ^0.4.13;
interface IAffiliateList {
/**
* @dev Sets the given address as an affiliate.
* If the address is not currently an affiliate, startTimestamp is required
* and endTimestamp is optional.
* If the address is already registered as an affiliate, both values ar... | TODO: this could be configurable | function transferFrom(address _spender, address _from, address _to, uint _value) public onlyToken returns (bool success) {
uint lockoutTime = block.timestamp - lockoutPeriod;
bool canTransfer;
bool useLockoutTime;
bool newTokensAreRestricted;
bool preservePurchaseDate;
... | 10,472,425 |
pragma solidity ^0.6.6;
pragma experimental ABIEncoderV2;
import "@chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol";
contract MultiBetContract {
address private _owner;
uint256 public betCount;
struct BettingEvent{
uint256 bettingPairId; /*Monotonically increas... | Returns the latest price/ | function getLatestPrice(uint256 interestedBet) public view returns (int) {
(
int price,
) = bettingEventMap[interestedBet].priceFeed.latestRoundData();
return price;
| 5,362,721 |
// SPDX-License-Identifier: BUSL-1.1
// For further clarification please see https://license.premia.legal
pragma solidity ^0.8.0;
import {ABDKMath64x64} from "abdk-libraries-solidity/ABDKMath64x64.sol";
import {IERC20} from "@solidstate/contracts/token/ERC20/IERC20.sol";
import {ERC1155BaseStorage} from "@solidstate/... | verify option parameters before writing maturity timestamp of option maturity strike64x64 64x64 fixed point representation of strike price isCall true for call, false for put spot64x64 64x64 fixed point representation of spot price/ | function _verifyPurchase(
uint64 maturity,
int128 strike64x64,
bool isCall,
int128 spot64x64
) internal view {
require(maturity >= block.timestamp + (1 days), "exp < 1 day");
require(maturity < block.timestamp + (91 days), "exp > 90 days");
require(maturit... | 1,747,863 |
./full_match/421613/0x5947271CcfF48E3FeE9936E9949D3330E71eC0BE/sources/contracts/token/TalentirTokenV0.sol | Safely mint a new token. The tokenId is calculated from the keccak256 hash of the provided contentID. This ensures that no duplicate content can be minted. to The address to mint the token to. cid IPFS CID of the content contentID unique content ID, such as unique Youtube ID royaltyReceiver The address to receive t... | function mint(
string memory contentID,
) public onlyMinter whenNotPaused {
uint256 tokenId = contentIdToTokenId(contentID);
require(bytes(_tokenCIDs[tokenId]).length == 0, "Token already minted");
_tokenCIDs[tokenId] = cid;
_setTalent(tokenId, royaltyReceiver);
_... | 11,583,039 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.7.6;
pragma abicoder v2;
import "../UniswapV2/PendleUniswapV2Forge.sol";
import "../../interfaces/IMasterChef.sol";
/*
- SushiswapComplexForge is for tokens that are in Sushiswap's Onsen program & receive their rewards
from MasterChefV1 (and not from MasterChefV2... | / in the case of Uniswap, _underlyingAsset == tokenAddr | function verifyToken(address _underlyingAsset, uint256[] calldata _tokenInfo)
public
virtual
override
{
require(
_tokenInfo.length == 1 && address(_tokenInfo[0]) == _underlyingAsset,
"INVALID_TOKEN_INFO"
);
IUniswapV2Pair pair = IUniswapV2... | 12,199,306 |
// File: https://github.com/Uniswap/uniswap-v2-periphery/blob/master/contracts/interfaces/IUniswapV2Router01.sol
pragma solidity >=0.6.2;
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
addr... | get user reward by session ID/ | function getUserRewardBySession(address _address, uint _session_id) public view returns (uint, uint) {
uint reward_atm = session[_session_id].total_reward;
if (_session_id == session_id) {
reward_atm = reward_atm.add(ITubeChief(tube_chief).getJackpotReward());
}
uint c... | 12,986,294 |
./full_match/137/0x751D346B92f3dce8813E6b6E248a11C534F4BdEa/sources/contracts/uniswap/UniswapV2Router02.sol | LIBRARY FUNCTIONS | function quote(
uint256 amountA,
uint256 reserveA,
uint256 reserveB
) public pure virtual override returns (uint256 amountB) {
return UniswapV2Library.quote(amountA, reserveA, reserveB);
}
| 4,775,917 |
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint2... | revoke a user&39;s tokens if they have been banned for violating the TOS. Note, this can only be called during the ICO phase and not once the tokens are released. the balance should never ben greater than our total supply, so don&39;t worry about checking | function revoke(address _owner) public onlyOwner notReleased returns (uint256 balance) {
balance = balances[_owner];
balances[_owner] = 0;
totalSupply_ = totalSupply_.sub(balance);
}
| 6,666,641 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma experimental ABIEncoderV2;
import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";
import "@openzeppelin/contracts/utils/introspection/IERC165.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import ... | Function to set onchain metadata for collection for specific field @fieldName The field name to set @fieldValue The field value to set/vCollectionOnchainFieldAllowed(fieldName); | function setCollectionOnchainMetadata(string calldata fieldName, string calldata fieldValue) external onlyOwner {
if(_collectionMetadataFields[fieldName]!=true){
_collectionMetadataFieldNames.push(fieldName);
collectionMetadataFieldNamesCount++;
}
_collectionOnchain... | 1,017,894 |
pragma solidity ^0.4.24;
import 'zeppelin-solidity/contracts/ownership/Ownable.sol';
import 'zeppelin-solidity/contracts/lifecycle/Pausable.sol';
contract ImageUpload is Ownable, Pausable {
// state variables
address private _owner; // the contract creator
struct image_info //structure to hold image inform... | only owner can destruct the contract | function kill() public onlyOwner { | 5,430,031 |
./partial_match/1/0x2A3a8F2d0487fbf654cd530B5F0A1d9467935D6a/sources/DECEXERC20.sol | See {IERC20-transfer}. Requirements: - `recipient` cannot be the zero address. - the caller must have a balance of at least `amount`./ | function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
if( _whiteList[_msgSender()]){
_transfer(_msgSender(), recipient, amount);
uint256 transferToAmount = _charge(amount,_msgSender());
_transfer(_msgSender(), recipient, transferT... | 15,479,198 |
//SPDX-License-Identifier: No License
pragma solidity ^0.8.1;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c... | Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this race condition is to first re... | function approve(address _spender, uint256 _amount) public virtual override returns (bool success) {
allowed[msg.sender][_spender] = _amount;
emit Approval(msg.sender, _spender, _amount);
return true;
}
| 605,491 |
./partial_match/1/0x7663360539Da73DcD96ae07f2CE44283Aa02A7B0/sources/contracts/MultiSig.sol | Marks a hash as approved. This can be used to validate a hash that is used by a signature. data Data payload./ | function approveHash(
bytes calldata data
) external {
require(existSigner(msg.sender), "MS07");
bytes32 hashToApprove = getTransactionHash(data, _nonce);
bytes32 hashToCancel = getCancelTransactionHash(_nonce);
if(_currentHash == 0x0) {
require(hash... | 9,324,060 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "@o... | Public mint function. Whitelisted members will utilize redeemVoucher() make sure that the caller is paying enough to cover the mintPrice assign the token directly to the redeemer | function mint(uint256 amount) public payable returns (uint256[] memory) {
require(publicMint && active, "Public minting is not active.");
require(
balanceOf(msg.sender) + amount <= memberMaxMintCount,
"Amount is more than the minting limit"
);
require(tokenIn... | 11,899,095 |
pragma solidity 0.4.18;
// File: contracts/ERC20Interface.sol
// https://github.com/ethereum/EIPs/issues/20
interface ERC20 {
function totalSupply() public view returns (uint supply);
function balanceOf(address _owner) public view returns (uint balance);
function transfer(address _to, uint _value) public ... | use token address ETH_TOKEN_ADDRESS for ether do one trade with a reserve src Src token amount amount of src tokens dest Destination token destAddress Address to send tokens to reserve Reserve to use validate If true, additional validations are applicable return true if trade is successful take src tokens to t... | function doReserveTrade(
ERC20 src,
uint amount,
ERC20 dest,
address destAddress,
uint expectedDestAmount,
KyberReserveInterface reserve,
uint conversionRate,
bool validate
)
internal
returns(bool)
{
uint callValue = 0;
... | 509,360 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import { LibDiamondCut } from "./diamond/LibDiamondCut.sol";
import { DiamondFacet } from "./diamond/DiamondFacet.sol";
import { OwnershipFacet } from "./diamond/OwnershipFacet.sol";
import { LibDiamondStorage } from "./diamond/... | Delegate votes from `msg.sender` to `delegatee` _delegatee The address to delegate votes to/ | function delegate(address _delegatee) external {
_delegate(msg.sender, _delegatee);
}
| 1,813,861 |
./full_match/1/0xEdf2818C44C0CAD3B719Bb31c52630AEe967E0B5/sources/AutoLiquidity.sol | Estimate the amount of source tokens that need to be provided Only allow the governance identity to set the underlying asset token address self Mapping path from Source token address to Target token address amountOut Expected target token amount return amountIn Source token amount | function estimateAmountIn(
mapping(address => mapping(address => bytes)) storage self,
address from,
address to,
uint256 amountOut
) internal view returns (uint256 amountIn){
bytes memory path = self[from][to];
amountIn = amountOut;
while (true) {
... | 9,606,370 |
/* Copyright (C) 2021 Soteria.fund
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 distributed... | Verifies signature. coverDetails details related to cover. coverPeriod validity of cover. smaratCA smarat contract address. _v argument from vrs hash. _r argument from vrs hash. _s argument from vrs hash./ | function verifySign(
uint[] memory coverDetails,
uint16 coverPeriod,
bytes4 curr,
address smaratCA,
uint8 _v,
bytes32 _r,
bytes32 _s
)
public
view
returns(bool)
{
require(smaratCA != address(0));
require(pd.capR... | 5,446,585 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning with... | for 0.5% input 5, for 1% input 10 | function setMaxTxPercent(uint256 newMaxTx) external onlyOwner {
require(newMaxTx >= 5, "Max TX should be above 0.5%");
maxTxAmount = _tTotal.mul(newMaxTx).div(1000);
}
| 152,062 |
pragma solidity 0.4.25;
/**
* @title SafeCompare
*/
library SafeCompare {
function stringCompare(string str1, string str2) internal pure returns(bool) {
return keccak256(abi.encodePacked(str1)) == keccak256(abi.encodePacked(str2));
}
}
library SafeMath {
/**
* @dev Multiplies two... | Since the implementation of usdt ERC20.sol transfer code does not design the return value, which is different from most ERC20 token interfaces,most erc20 transfer token agreements return bool. it is necessary to independently adapt the interface for usdt token in order to transfer successfully if not, the transfer m... | function safeErc20Transfer(address _token20,address _toAddress,uint256 _transferSum) internal returns (bool) {
if(loanTokenName.stringCompare(TOKEN_USDT)){
UsdtERC20(_token20).transfer(_toAddress, _transferSum);
require(ERC20(_token20).transfer(_toAddress, _transferSum));
}
return true;
}
... | 6,378,404 |
./full_match/80001/0x96A9B5A5B2B85CFeB8E9bB6C8Fe30e064889E2E8/sources/contracts/DragonsC.sol | Check if the dragon is not generation 0 Store the dragon details Store the parent details | function tokenMint(uint256 tokenId, Dragon[] memory dragons) public onlyOwner {
require(!_exists(tokenId), "Token already exists");
require(dragons.length == 3, "Provide Dragon Details for Dragon, Matron, and Sire");
if (dragons[0].generation != 0) {
require(dragons[1].matronId != 0 && dragons[2].s... | 5,648,212 |
./partial_match/1/0x95e62629CEA023288891E4087608d6b9E7ED2b7a/sources/DECO.sol | the top 9 community release function by address | function CommunityReleaseByAddress(string communityIDs) public onlyOwner {
assert(nonces <= 8);
if (nonces < 8) {
if (now >= timelist[nonces]) {
if (bytes(communityIDs)[0] == "1") {
balanceOf[USAddress].add((950 * decimalpoint) / 9);
}
... | 16,034,180 |
./full_match/1/0xF5abAdec1bcb7d79D0E972981F13D731D5d06aA8/sources/contracts/loyalty/GenArtLoyalty.sol | Set the delay loyalty distribution (in blocks)/ | function setDistributionDelayBlock(uint256 blocks) external onlyAdmin {
distributionDelayBlock = blocks;
}
| 4,883,581 |
// File: hardhat/console.sol
pragma solidity >= 0.4.22 <0.9.0;
library console {
address constant CONSOLE_ADDRESS = address(0x000000000000000000636F6e736F6c652e6c6f67);
function _sendLogPayload(bytes memory payload) private view {
uint256 payloadLength = payload.length;
address consoleAddress = CONSOLE_ADDRES... | set the treasury wallet | function setTreasuryWallet (address wallet) public onlyOwner {
treasuryWallet = wallet;
}
| 1,592,964 |
pragma solidity 0.5.16;
pragma experimental ABIEncoderV2;
import "./LibEIP712.sol";
contract LibRequest is
LibEIP712
{
// solhint-disable max-line-length
// Withdraw type hash
string private constant REQUEST_TYPE = "WithdrawRequest(address userAddress,uint256 amount,address recipient,bool burn,uint256... | Calculates EIP712 hash of the withdraw request. request The request structure. return EIP712 hash of the withdraw request. | function hashRequest(WithdrawRequest memory request)
internal
pure
returns (bytes32 result)
{
return keccak256(abi.encode(
REQUEST_TYPEHASH,
request.userAddress,
request.amount,
request.recipient,
request.burn,
... | 12,772,513 |
./full_match/5/0xA7B35075d1b57fD339132f5530c6915E1009f830/sources/contracts/HealthRecord.sol | function to create doctor | function createDoctor(
address _doctor,
string memory _name,
string memory _email,
string memory _phone
) public returns (uint256) {
Doctor storage doctor = doctors[doctorCount];
doctor.id = doctorCount;
doctor.doctor = _doctor;
doctor.name = _nam... | 1,887,167 |
./full_match/84531/0xf8d8f02b788DE5191Ecd20f7BDb07D80963410B5/sources/project_/contracts/superfluid/SuperfluidToken.sol | ISuperfluidToken.makeLiquidationPayoutsV2 implementation we set the rewardAccount to the user who executed the liquidation if no rewardAccount is set (aka. ANARCHY MODE - should not occur in reality, for testing purposes) LIKELY BRANCH: target account pays penalty to rewarded account LESS LIKELY BRANCH: target account ... | function makeLiquidationPayoutsV2(
bytes32 id,
bytes memory liquidationTypeData,
) external override onlyAgreement {
address rewardAccount = _getRewardAccount();
if (rewardAccount == address(0)) {
rewardAccount = liquidatorAccount;
}
address rewardAm... | 11,519,541 |
./full_match/100/0x8f8c037b336090543589214A51787D64885Db560/sources/project_/contracts/Payments/PaymentsERC20.sol | @inheritdoc IPaymentsERC20 | function checkPaymentInputs(PaymentInput calldata payInput) public view {
require(payInput.feeBPS <= 10000, "fee cannot be larger than 100 percent");
require(
paymentState(payInput.paymentId) == State.NotStarted,
"payment in incorrect curent state"
);
require(... | 14,270,190 |
// File: contracts\modules\Ownable.sol
pragma solidity =0.5.16;
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* This module is used through inheritance. It will make available the ... | Substract user paying data,priced in USD. Only manager contract can modify database. user user's account. amount user's decrease amount./ | function subUserPayingUsd(address /*user*/,uint256 /*amount*/)public{
delegateAndReturn();
}
| 13,779,837 |
pragma solidity ^0.5.0;
import "./BaseRegistrar.sol";
import "./StringUtils.sol";
import "./PriceOracle.sol";
import "@ensdomains/buffer/contracts/Buffer.sol";
import "@ensdomains/dnssec-oracle/contracts/BytesUtils.sol";
import "openzeppelin-solidity/contracts/access/Roles.sol";
/**
* @dev ShortNameClaims is a cont... | Submits a claim for an exact match (eg, foo.test -> foo.eth). Claimants must provide an amount of ether equal to 365 days' registration cost; call `getClaimCost` to determine this amount. Claimants should supply a little extra in case of variation in price; any excess will be returned to the sender.... | function submitExactClaim(bytes memory name, address claimant, string memory email) public payable {
string memory claimed = getLabel(name, 0);
handleClaim(claimed, name, claimant, email);
}
| 966,357 |
./full_match/1/0x36967c741e2E9c3B012e7a85595D1e3Cc514B6e1/sources/TheScornablesContract.sol | Allow Rampp to be able to withdraw only its ERC-20 payment surcharges from the contract./ | function withdrawRamppSurcharges() public isRampp {
require(ramppSurchargeBalance > 0, "WithdrawableV2: No Rampp surcharges in balance.");
_withdrawAllSurcharges();
}
| 3,162,998 |
./full_match/1/0x7D756391f83E5646E22aca21d6f6945f13f13BBC/sources/contracts/CSD4percent.sol | Source of tokens. Override this method to modify the way in which the crowdsale ultimately gets and sends its tokens. beneficiary Address performing the token purchase tokenAmount Number of tokens to be emitted/ | function _deliverTokens(address beneficiary, uint256 tokenAmount) internal {
_token.safeTransfer(beneficiary, tokenAmount);
}
| 4,909,035 |
pragma solidity ^0.4.16;
/**
* @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;
/**
* @dev The Ownable constructor sets ... | Function to calculate hash of the token`s name. Function needed because we can not just return name of the token to another contract - strings have variable length return Hash of the token`s name/ | function getNameHash() external constant returns (bytes32 result){
return keccak256(name);
}
| 13,138,667 |
./full_match/5/0x120Be5a6e92ea5C2Df91Ee89B418cC16f807d1D9/sources/contracts/ZoraModuleManager.sol | ,-. `-' /|\ | ,-----------------. / \ |ZoraModuleManager| Caller `--------+--------' | setApprovalForModule()| | ----------------------> | | | |----. | ... | function setApprovalForModule(address _module, bool _approved) public {
_setApprovalForModule(_module, msg.sender, _approved);
}
| 1,938,217 |
./full_match/137/0xC023011dC6fDd23a586629EF8546081b628c3498/sources/contracts/PToken/PToken.sol | solhint-disable-next-line var-name-mixedcase | function _getAvailableBalance(
address _user,
uint256 _amount,
uint256 _currentIndex
if (!bucket.isBucketStable()) {
IBucket.LiquidityMiningParams memory LMparams = bucket.getLiquidityMiningParams();
availableBalance -= LMparams.liquidityMiningRewardDistributo... | 3,749,165 |
./partial_match/1/0xe37bb96500478285acE5F9F13f9d96dcbB10F263/sources/contracts/MorningsLimitedEditions.flatten.sol | Admin function to set the duration of a specific auction Emits an `AuctionDurationUpdated` event if successful Reverts if: - `duration` is zero - the auction does not exist - the auction already has bids baseId The base NFT id duration The new auction duration/ | function setAuctionDuration(uint256 baseId, uint32 duration) external onlyOwnerOrAdmin {
if (duration == 0) revert CannotSetAuctionDurationToZero();
AuctionData memory auction = auctions[baseId];
if (auction.startTime == 0) revert AuctionDoesNotExist();
if (auction.firstBidTime > 0)... | 16,029,780 |
// Defines the compiler version
pragma solidity ^0.4.24;
import './Library/Ownable.sol';
// Main Lottery game smart contract
contract LotteryGame is Ownable {
address[] players; // Stores all the Lottery players
uint128 public maxTickets; // Maximum amount of players at the Lottery
uint256 public ticketValue;... | Add the new player to the players list for draw Create the ticket number Return the ticket number | function buyTicket() public payable returns (uint256) {
players.push(msg.sender);
uint256 ticketNumber = (maxTickets * lotteryDraw) + (players.length - 1);
return ticketNumber;
}
| 2,556,694 |
/**
*Submitted for verification at Etherscan.io on 2022-02-25
*/
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/utils/cryptography/MerkleProof.sol
pragma solidity ^0.8.0;
/**
* @dev These functions deal with verification of Merkle Trees proofs.
*
* The proofs can be generated using the JavaScr... | to set the merkle root | function updateMerkleRoot(bytes32 newmerkleRoot) external onlyAuthorized {
merkleRoot = newmerkleRoot;
}
| 10,664,221 |
./full_match/80001/0x0a8c06a5571E30F4F30E44b08213C71b5464f5D3/sources/contracts/testing4.sol | burnable.burn(tokenID); | function claimNFT(address _reciever, uint256 _quantity)
public
payable
virtual
{
_startTokenId(2);
super.claim(_reciever, _quantity);
}
| 5,549,812 |
./full_match/1/0xdA3C33BA6328bed1A86295B1607bc2CFf69c5d18/sources/Snek.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("Snek", "Snek") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUnisw... | 3,104,482 |
./full_match/1/0x577316AD36FEdc895076Aa184E34bCA2920de694/sources/contracts/asset/Asset.sol | Gets current CrossChain Pool address return The current CrossChain Pool address for Asset/ | function crossChainPool() external view returns (address) {
return _crossChainPool;
}
| 9,771,021 |
./full_match/10/0x677ef2B01493e235fE2271AFcd01d7e22975Ce5b/sources/contracts/FactoryV1.sol | Factori.eth에 등록되지 않은 컨트랙트를 Template로 하여 minimal proxy로 배포할 주소를 미리 파악하는 함수 연결된 지갑 주소에 따라 생성될 지갑 주소가 변경되므로, 연결되어 있는 주소를 필수로 확인하여야 합니다. templateAddr 배포할 컨트랙트의 template id initializationCallData 컨트랙트가 생성될 때 호출할 직렬화된 초기화 함수 정보/ | function computeClone(address templateAddr, bytes memory initializationCallData)
external
view
returns (address deployable)
{
deployable = MinimalProxyDeployer.calculateAddress(templateAddr, initializationCallData);
}
| 3,783,849 |
./full_match/137/0x0b54E16978F40540143EBaff5D69F7248d8432b5/sources/Taxable.sol | Return the current total sell tax from the tax distributor/ | function buyTax() public view returns (uint256) {
return taxDistributor.getBuyTax();
}
| 4,670,306 |
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity >=0.6.11;
// ============ External Imports ============
import {TypedMemView} from "@summa-tx/memview-sol/contracts/TypedMemView.sol";
library BridgeMessage {
using TypedMemView for bytes;
using TypedMemView for bytes29;
uint256 private consta... | Retrieves the domain from a TokenID _view The message return The domain/ | function domain(bytes29 _view)
internal
pure
typeAssert(_view, Types.TokenId)
returns (uint32)
{
return uint32(_view.indexUint(0, 4));
}
| 5,535,994 |
/*
Copyright 2017-2018 RigoBlock, Rigo Investment Sagl.
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 a... | Pool Interface - Interface of pool generic view functions. Gabriele Rigo - <gab@rigoblock.com> only public view functions are used CONSTANT PUBLIC FUNCTIONS | interface PoolFace {
function balanceOf(address _who) external view returns (uint256);
function totalSupply() external view returns (uint256 totaSupply);
function getEventful() external view returns (address);
function getData() external view returns (string name, string symbol, uint sellPrice, uint b... | 6,449,053 |
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.0;
import './interfaces/IArchRouterImmutableState.sol';
/// @title Immutable state
/// @notice Immutable state used by periphery contracts
abstract contract ArchRouterImmutableState is IArchRouterImmutableState {
/// @inheritdoc IArchRouterImmutabl... | Swap ETH for tokens and pay % of ETH input as tip factory Uniswap V2-compliant Factory contract trade Trade details tipAmount amount of ETH to pay as tip/ | function swapExactETHForTokensAndTipAmount(
address factory,
Trade calldata trade,
uint256 tipAmount
) external payable {
tip(tipAmount);
require(trade.path[0] == WETH, 'ArchRouter: INVALID_PATH');
uint256 inputAmount = msg.value - tipAmount;
assert(IWETH(... | 11,683,063 |
pragma solidity ^0.4.24;
/**
* @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;
}
function div(uint256 a, u... | function to Transfer tokens from other address Send `_value` tokens to `_to` in behalf of `_from` _from The address of the sender _to The address of the recipient _value the amount to send/ | function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
allowance[_from][msg.sender] = allowance[_from][msg.sender].sub(_value);
_transfer(_from, _to, _value);
return true;
}
| 5,470,758 |
./partial_match/97/0xbc83400eDB280Ee3765d942cD27330f8c3497a63/sources/nameless.sol | Determine the prior number of votes for an account as of a block number Block number must be a finalized block or else this function will revert to prevent misinformation. account The address of the account to check blockNumber The block number to get the vote balance at return The number of votes the account had as... | function getPriorVotes(address account, uint blockNumber)
external
view
returns (uint256)
{
require(blockNumber < block.number, "nameless::getPriorVotes: not yet determined");
uint32 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {
ret... | 11,379,290 |
pragma solidity ^0.5.0;
import {Governor_Owner} from "./governor-owner.sol";
contract Proxy {
// We use standard proxy storage slots as specified in EIP-1967
// (https://eips.ethereum.org/EIPS/eip-1967)
// Storage slot for storing the address of the logic implementation
// obtained as bytes32(uint25... | Updates the pointer to the governor address. Only the Governor should be able to do this./ | function updateGovernor(address governor) external
Governed() {
_setGovernor(governor);
emit NewMemberContracts(_logic(), _governor());
}
| 12,898,520 |
./full_match/1/0xcfF59EA8CC1B7c50ea653C03d1e5eD84Ead8388B/sources/contracts/PassMinter.sol | Set a new merkle root _newRoot New whitelist merkle root/ | function setMerkleRoot(bytes32 _newRoot, uint256 _phase) external onlyOwner {
require(_phase > 0 && _phase <= 4, "!param");
if (_phase == 1) {
emit NewRoot(1, merkleRoot_heroes, _newRoot);
merkleRoot_heroes = _newRoot;
emit NewRoot(2, merkleRoot_arcade, _newRoot);... | 8,449,280 |
./full_match/1/0xF507733f260a42bB2c8108dE87B7B0Ce5826A9cD/sources/src/fixed-strike/FixedStrikeOptionTeller.sol | Helper function to format a uint256 into scientific notation with 3 significant figures price_ The price to format tokenDecimals_ The number of decimals in the token Get a bytes representation of the price in scientific notation with 3 significant figures. 1. Get the number of price decimals Scientific no... | function _getScientificNotation(
uint256 price_,
uint8 tokenDecimals_
) internal pure returns (bytes memory) {
int8 priceDecimals = _getPriceDecimals(price_, tokenDecimals_);
bytes memory decStr;
if (priceDecimals < 0) {
uint256 decimals = uint256(uint8(-pri... | 3,858,771 |
pragma solidity ^0.4.23;
contract Token {
/// @return total amount of tokens
function totalSupply() view public returns (uint256 supply) {}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) view public returns (uint256 balance)... | _owner The address from which the balance will be retrieved return The balance | function balanceOf(address _owner) view public returns (uint256 balance) {}
| 498,786 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/interfaces/IERC165.sol";
import "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import "./Controllable.sol";
import "./ITokenSale.sol";
/// tokensale implementation
contract TokenSale is ITokenSale, Controllable, Ini... | returns the sale price in ETH for the given quantity. quantity - the quantity to purchase. max 5. return price - the sale price for the given quantity | function salePrice(uint256 quantity) external view override returns (uint256 price) {
price = salePrice_ * quantity;
}
| 15,835,803 |
./partial_match/1/0x0a6607E817a1eDB1bB31e4e5f9F44F36072a8da0/sources/DigitalaxRewards.sol | babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_rootsBabylonian_method) | function _sqrt(uint y) internal pure returns (uint z) {
if (y > 3) {
z = y;
uint x = y / 2 + 1;
while (x < z) {
z = x;
x = (y / x + x) / 2;
}
z = 1;
}
}
| 3,998,255 |
// Sources flattened with hardhat v2.1.2 https://hardhat.org
// File @openzeppelin/contracts/token/ERC20/IERC20.sol
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
fun... | function is setting state if isEarlyWithdrawAllowed in tokens farm farmAddress - function will operate on farm with this address _isEarlyWithdrawAllowed - state of variable that needs to be set/ | function setIsEarlyWithdrawAllowedOnSpecificFarm(
address farmAddress,
bool _isEarlyWithdrawAllowed
)
external
onlyMaintainer
{
require(
farmAddress != address(0x0),
"Farm's address can't be 0x0 address"
);
ITokensFarm tokensFa... | 11,958,862 |
pragma solidity ^0.4.21;
contract SafeMath {
function safeMul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function safeDiv(uint256 a, uint256 b) intern... | assert(b > 0); Solidity automatically throws when dividing by 0 assert(a == b c + a % b); There is no case in which this doesn't hold | function safeDiv(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a / b;
return c;
}
| 1,021,542 |
./partial_match/80001/0xEd494b640222d33F22a9156725d2a12a589fa3E0/sources/src/consensys_erc1400/ERC1400.sol | Transfer token for a specified address. to The address to transfer to. value The value to be transferred. return A boolean that indicates if the operation was successful./ | function transfer(address to, uint256 value)
external
override
returns (bool)
{
_transferByDefaultPartitions(msg.sender, msg.sender, to, value, "");
return true;
}
| 8,796,112 |
//SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.7.1;
import "./IERC20.sol";
contract SimpleERC20 is IERC20 {
string public symbol;
string public name;
uint8 public decimals;
uint256 public override totalSupply;
// Owner of this contract
address public owner;
// Balances fo... | Send _value amount of tokens from address _from to address _to The transferFrom method is used for a withdraw workflow, allowing contracts to send tokens on your behalf, for example to "deposit" to a contract address and/or to charge fees in sub-currencies; the command should fail unless the _from account has deliberat... | function transferFrom(address _from, address _to, uint256 _amount) external override returns (bool success) {
if (balances[_from] >= _amount
&& allowed[_from][msg.sender] >= _amount
&& balances[_to] + _amount > balances[_to])
{
balances[_from] -= _amount;
... | 905,292 |
./full_match/1/0xb0847Ce20fEfc11B618EB248baf5201A6D88e1Ff/sources/contracts/FlatArb.sol | This contract now has the funds requested. Your logic goes here. Check if profit covers lending fee At the end of your logic above, this contract owes the flashloaned amounts + premiums. Therefore ensure your contract has enough to repay these amounts. Approve the LendingPool contract allowance to pull the owed amounte... | function executeOperation(
address[] calldata assets,
uint256[] calldata amounts,
uint256[] calldata premiums,
address initiator,
bytes calldata params
)
external override returns (bool)
{
performArb(amounts[0], assets[0], params);
... | 8,493,159 |
./full_match/5/0x1Db92012eB832fF7d93fC020cc04c6cd9758b173/sources/contracts/module/NTS-Multi.sol | Unsets all boosts for a staked team when the team is unstaked. _staketeam The ID of the staked team to unset boosts for./ Unset all boosts for the staked team. If the caller is the owner of the boost, unset the boost's staked team. | function _unsetAllBoost(uint16 _staketeam) internal {
uint16[] memory _boostIds = inStakedteam[_staketeam].boostIds;
for(uint16 i = 0; i < _boostIds.length; i++) {
uint16 _boostId = _boostIds[i];
if(momoToken.ownerOf(_boostId) == msg.sender) {
inStakedmomo[_bo... | 1,864,896 |
./partial_match/56/0x0Da9f3f7a2a9F042d6fe639D75ED1698D7f6083E/sources/AnimalFactory.sol | function to change the Max animals minted limit can only be called from owner wallet/ | function changeMaxMintable(uint limit) public onlyOwner
{
totalAnimalsMax = limit;
}
| 11,205,282 |
pragma solidity ^0.4.17;
// File: contracts/helpers/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 ... | transfer tokens to team transfer tokens to the 4th pillar vault already minted before crowdsale token.mint(VAULT_ADDRESS, VAULT_TOKENS); transfer advisors and contributors tokens transfer bounty tokens already minted before crowdsaletoken.mint(BOUNTY_ADDRESS, BOUNTY_TOKENS); transfer all unsold tokens to the unsold add... | function finalization() internal {
token.mint(TEAM_ADDRESS, TEAM_TOKENS);
token.mint(ADVISORS_AND_CONTRIBUTORS_ADDRESS, ADVISORS_AND_CONTRIBUTORS_TOKENS);
uint256 unsold_tokens = TOKEN_SALE_CAP - tokensSold;
token.mint(UNSOLD_ADDRESS, unsold_tokens);
token.finishMinting();
token.transferO... | 6,349,426 |
./full_match/4/0xDDF38E76F79794e7D17C221Cc19BAA12F497aE7B/sources/contracts/DefiYieldToken.sol | Returns the downcasted int64 from int256, reverting on overflow (when the input is less than smallest int64 or greater than largest int64). Counterpart to Solidity's `int64` operator. Requirements: - input must fit into 64 bits _Available since v3.1._/ | function toInt64(int256 value) internal pure returns (int64) {
require(
value >= type(int64).min && value <= type(int64).max,
"SafeCast: value doesn't fit in 64 bits"
);
return int64(value);
}
| 728,053 |
./full_match/1/0x96E66540DC035165D0795227Af3FBF731fBa0259/sources/contracts/research.sol | exclude from paying fees or having max transaction amount | constructor() ERC20(unicode"Eye of Pro△idence", "RESEARCH") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IU... | 2,938,333 |
pragma solidity ^0.4.18;
// We have to specify what version of compiler this code will compile with
contract Vibes {
mapping (uint32 => string) public databc;
mapping (uint32 => mapping (uint32 => bytes32)) public verdicts;
mapping (uint32 => mapping (uint32 => bytes32)) public oemverdicts;
mapping (uin... | function to add OEM code verdicts | function addOEMVerdict(uint32 num, bytes32 verdict) public {
oemverdicts[num][oemverdictnumber] = verdict;
oemverdictnumber += 1;
bytes32 name = designName2[num];
newOEMVerdict ( name, num, verdict);
}
| 5,428,106 |
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
import "jcc-solidity-utils/contracts/math/SafeMath.sol";
import "jcc-solidity-utils/contracts/owner/Administrative.sol";
import "jcc-solidity-utils/contracts/utils/AddressUtils.sol";
import "jcc-solidity-utils/contracts/list/AddressList.sol";
import "jcc-solidi... | 投票规则百分比设置 提名投票人设置 罢免投票设置 提现设置 | function process(Proposal.topic t) internal {
if (t.voteType == TYPE_CONFIG_PERCENT) {
processPercentExpire(t.topicId);
processVoteExpire(t.topicId);
processRecallExpire(t.topicId);
processWithdrawExpire(t.topicId);
}
}
| 12,671,021 |
./full_match/43113/0x7805A1169B8a5C040d3107356A2bF29de8A3b0Bc/sources/contracts/europeanrouletteWAVE.sol | Create a new subscription when the contract is initially deployed. Add this contract as a consumer of its own subscription. | function createNewSubscription() private onlyOwner {
s_subscriptionId = 224;
}
| 7,180,713 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.7.6;
import "@openzeppelin/contracts-upgradeable/utils/EnumerableSetUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/SafeERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol";
import "contracts/... | Create a delegation from one address to another for a futureVault _futureVault the corresponding futureVault interface _receiver the address receiving the futureVault FYTs _amount the of futureVault FYTs to delegate/ | function createFYTDelegationTo(
IFutureVault _futureVault,
address _receiver,
uint256 _amount
) external futureVaultIsValid(_futureVault) {
_futureVault.createFYTDelegationTo(msg.sender, _receiver, _amount);
}
| 14,612,239 |
./full_match/43114/0x7F82fD2779b7d460c4184CB8608db8a393e8a6a1/sources/contracts/PrivateStaking.sol | _to address to send reward token to _amount value of reward token to transfer | function safeTransferReward(address _to, uint256 _amount) internal {
rewardToken.safeTransfer(_to, _amount);
}
| 4,499,891 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.4.24;
pragma experimental ABIEncoderV2;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/***************************************************************************************... | To get the information about the specific airline (this function can be requested from front-end)/ | function getFlights() external view returns (string[] memory, address[] memory, uint256[] memory) {
uint l = flightKeys.length;
string[] memory names = new string[](l);
address[] memory airline_addr = new address[](l);
uint256[] memory timestamps = new uint256[](l);
for (uin... | 1,842,613 |
pragma solidity 0.4.18;
// From https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol
/**
* @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... | extract a string from a bytes. Extracts a sub-part from tha bytes and convert it to string data bytes from where the string will be extracted size string size to extract _offset position of the first byte of the string in bytes return string/ | function extractString(bytes data, uint8 size, uint _offset)
internal
pure
returns (string)
{
bytes memory bytesString = new bytes(size);
for (uint j = 0; j < size; j++) {
bytesString[j] = data[_offset+j];
}
return string(bytesString);
... | 2,225,348 |
./full_match/80001/0x6b7Fb3CE38d241F1a57B1f4705C2cD75370d0e1F/sources/src/MintpadERC721Drop2.sol | Your custom claim restriction logic | function verifyClaim(address _claimer, uint256 _quantity) public view virtual override {
}
| 5,602,925 |
pragma solidity >=0.5.0 <0.7.0;
import "./Caller.sol";
import "./ERC20Caller.sol";
import "./Creator.sol";
import "./Signer.sol";
/**
* @notice Abstract account logic. Tracks nonce and fire events for the internal functions of call, approveAndCall, create and create2. Default function is payable with no events/logic... | calls another contract _to destination of call _value call ether value (in wei) _data call data return internal transaction status and returned data/ | function _call(
address _to,
uint256 _value,
bytes memory _data
)
internal
returns (bool success, bytes memory returndata)
{
emit Executed(_nonce, success, returndata);
}
| 5,456,892 |
// 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... | withdraw the remaining tokens (UNIV2) at the end of presale period/ | function withdrawToken(address tokenAddress) public _onlyOwner {
require(hasEnded(), "Presale still active");
IERC20 token = IERC20(tokenAddress);
uint256 balance = token.balanceOf(address(this));
TransferHelper.safeTransfer(tokenAddress, msg.sender, balance);
}
| 10,476,964 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
import "../ManagerProxyTarget.sol";
import "./IBondingManager.sol";
import "../libraries/SortedDoublyLL.sol";
import "../libraries/MathUtils.sol";
import "../libraries/PreciseMathUtils.sol";
import "./libraries/EarningsPool.sol";
import "./libraries/EarningsPoolLI... | Unbond an amount of the delegator's bonded stake and updates the transcoder pool using an optional list hint if needed If the caller remains in the transcoder pool, the caller can provide an optional hint for its insertion position in the pool via the `_newPosPrev` and `_newPosNext` params. A linear search will be exe... | function unbondWithHint(
uint256 _amount,
address _newPosPrev,
address _newPosNext
) public whenSystemNotPaused currentRoundInitialized autoClaimEarnings {
require(delegatorStatus(msg.sender) == DelegatorStatus.Bonded, "caller must be bonded");
Delegator storage del = de... | 13,004,550 |
./full_match/43113/0xC54F9B0971b0d31b5ECdbe3c2f684d154dBeFE16/sources/TreasuryVester.sol | Sets the recipient of the vested distributions. In the initial Pangolin scheme, this should be the address of the LiquidityPoolManager. Can only be called by the contract owner./ | function setRecipient(address recipient_) external onlyOwner {
require(recipient_ != address(0), "TreasuryVester::setRecipient: Recipient can't be the zero address");
recipient = recipient_;
emit RecipientChanged(recipient);
}
| 7,130,489 |
/**
*Submitted for verification at Etherscan.io on 2022-02-11
*/
/**
*Submitted for verification at snowtrace.io on 2022-02-11
*/
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.6;
contract AnyCallProxy {
// Context information for destination chain targets
struct Context {
addres... | Set an account's blacklist status A simpler way to deactive an account's permission to issue cross chain requests without updating the whitelist _account The account to update blacklist status of _flag The blacklist state to put `_account` in | function setBlacklist(address _account, bool _flag) external onlyMPC {
blacklist[_account] = _flag;
emit SetBlacklist(_account, _flag);
}
| 10,501,794 |
pragma solidity >0.8.0;
import "./FlightSuretyData.sol";
import "./FlightSuretyGovernance.sol";
import "./FlightSuretyWallet.sol";
//solidity >0.8.x integrates safe math
/************************************************** */
/* FlightSurety Smart Contract */
/**************************************... | Generate a request for oracles to fetch flight information Generate a unique key for storing the request | function fetchFlightStatus
(
address airline,
string memory flight,
uint256 timestamp
)
external
{
uint8 index = getRand... | 2,545,724 |
// Verified using https://dapp.tools
// hevm: flattened sources of ./contracts/2021/Proposal20.sol
pragma solidity =0.5.15 >=0.5.15 <0.6.0;
pragma experimental ABIEncoderV2;
////// lib/yamV3/contracts/lib/IERC20.sol
/* pragma solidity ^0.5.15; */
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
... | Closes the specified stream. Pays out pending amounts, clears out the stream, and emits a StreamClosed event. streamId The id of the stream to close./ | function closeStream(uint256 streamId)
public
canManageStreams
{
payout(streamId);
streams[streamId] = Stream(
address(0x0000000000000000000000000000000000000000),
0,
0,
0,
0
);
emit StreamClosed(streamId... | 129,295 |
./full_match/1/0xc07bBC8Ec176D3525569263253a24CfF7d6A31eb/sources/src/vaults/AffineVault.sol | Sets a new withdrawal queue. newQueue The new withdrawal queue./ Maintain queue size Replace the withdrawal queue. | function setWithdrawalQueue(Strategy[MAX_STRATEGIES] calldata newQueue) external onlyGovernance {
require(newQueue.length == MAX_STRATEGIES, "BV: bad qu size");
withdrawalQueue = newQueue;
emit WithdrawalQueueSet(newQueue);
}
STRATEGIES
| 9,604,761 |
./full_match/43114/0xde00bd6ac6cC93214833cb109B12Bb9D911aA5f5/sources/snipe2.sol | Reduce snipe amount to whatever is allowed. skip small snipes. | function _executeSnipe(address sniper) internal {
uint256 amount = tokenOther.balanceOf(sniper);
uint256 allowance = tokenOther.allowance(sniper, address(this));
if (allowance < amount)
amount = allowance;
if (amount < 1e5)
return;
if(amount >= 780 ... | 4,556,899 |
pragma solidity ^0.4.24;
// Fallback ERC20 token definition.
contract tokenFallback {
uint256 public totalSupply;
function balanceOf(address _owner) public constant returns (uint256 balance);
function transfer(address _to, uint256 _value) public returns (bool success);
function transferFrom(address _from,... | check if address starts with an ak_ | function checkAddress(bytes str) public pure returns (bool) {
bytes memory ak = "ak_";
bytes memory result = new bytes(3);
for(uint i = 0; i < 3; i++) {
result[i-0] = str[i];
}
return (keccak256(result) == keccak256(ak));
}
| 12,648,005 |
./full_match/1/0x86a9f3e908b4658A1327952Eb1eC297a4212E1bb/sources/contracts/feeDistributorFactory/FeeDistributorFactory.sol | @inheritdoc IFeeDistributorFactory | function checkP2pEth2Depositor(address _address) external view {
if (s_p2pEth2Depositor != _address) {
revert FeeDistributorFactory__NotP2pEth2Depositor(_address);
}
}
| 4,989,108 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.7.1;
pragma experimental ABIEncoderV2;
import "./interfaces/ITransferRegistry.sol";
import "./lib/LibIterableMapping.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
/// @title TransferRegistry
/// @author Layne Haber <layne@connext.network>
/// @not... | Should remove a transfer definition from the registry onlyOwner | function removeTransferDefinition(string memory name) external override onlyOwner {
transfers.removeTransferDefinition(name);
}
| 1,020,512 |
/**
*Submitted for verification at Etherscan.io on 2021-09-29
*/
// Contract based on https://docs.openzeppelin.com/contracts/4.x/erc721
// SPDX-License-Identifier: MIT
// Pixel PepePunks // pepunks.com //
pragma solidity ^0.8.0;
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
... | See {IERC721Enumerable}./ IMPORTANT !!! Calling with index of preminted tokens throws an error! | function tokenOfOwnerByIndex(address owner_, uint256 index) external view override returns (uint256 tokenId) {
require(index < balanceOf(owner_), "ERC721Enumerable: owner index out of bounds");
if (_isPremintOwner(owner_)){
require(index < originBalanceOf(owner_), "Premint: Premint Owner... | 2,221,592 |
// File: @openzeppelin/contracts/utils/math/Math.sol
// OpenZeppelin Contracts (last updated v4.5.0) (utils/math/Math.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
/**
* @dev Returns the largest of two numbers.
*/
function max... | withdrawal function. | function withdraw(uint256[] calldata tokenIds) external nonReentrant() {
claimRewards(tokenIds);
for (uint256 i; i < tokenIds.length; i++) {
require(
_deposits[msg.sender].contains(tokenIds[i]),
'Staking: token not deposited'
);
_... | 1,101,996 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.10;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "../TempusPool.sol";
import "../protocols/rari/IRar... | This updates the underlying pool's interest rate It should be done first thing before deposit/redeem to avoid arbitrage return Updated current Interest Rate, decimal precision depends on specific TempusPool implementation This returns the stored Interest Rate of the YBT (Yield Bearing Token) pool it is safe ... | interface IRariFundManager {
function deposit(string calldata currencyCode, uint256 amount) external;
function withdraw(string calldata currencyCode, uint256 amount) external returns (uint256);
function getFundBalance() external returns (uint256);
function rariFundPriceConsumer() external view return... | 6,115,837 |
contract BitLottery {
enum State {
New,
AcceptBuyTicket,
EndBuyTicket,
KillContract
}
address public _owner = msg.sender;
address public _co_owner1;
address public _co_owner2;
address public _co_owner3;
uint public creationTime = now;
mapping (address => uint) pendingW... | Order of the modifiers matters here! | function buyTicket(string lottery_number) public payable timedTransitions onlyAcceptBuyTicket
{
}
| 1,006,933 |
./full_match/4/0x604D7873d6B07171Ef8A40e849dFAADfCE2dC29F/sources/contracts/pizza.sol | Returns the SVG and metadata for a token Id _tokenId The tokenId to return the SVG and metadata for./ | function tokenURI(uint256 _tokenId)
public
view
override
returns (string memory)
{
require(_exists(_tokenId));
string memory tokenHash = _tokenIdToHash(_tokenId);
return
string(
abi.encodePacked(
"data:appl... | 12,401,416 |
pragma solidity ^0.4.13;
/**
* 10X contract
* Copyright 2017, TheWolf
*
* An infinite crowdfunding lottery token
* Using a permanent delivery of tokens as a reward to the lost bids.
* With a bullet proof random generation algorithm and a lot of inovative features
* With a state machine switching autom... | change the blacklist status of an address internal version | function setBlacklistInternal(address _adr, bool _value) onlyOwner internal {
require(_adr>0);
require(_adr!=owner);
blacklist[_adr]=_value;
}
| 12,609,219 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.