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
// Code from: https://github.com/kulkarohan/deposit
pragma solidity 0.8.13;
import { ERC20 } from "@rari-capital/solmate/src/tokens/ERC20.sol";
/// @title Deposit
/// @author kulkarohan
/// @notice Mock contract to transfer ERC-20 tokens with a signed approval
contract EIP712 {... | Deposits ERC-20 tokens with a signed approval _tokenContract The ERC-20 token address _amount The number of tokens to transfer _owner The user signing the approval _spender The user to transfer the tokens (ie this contract) _value The number of tokens to appprove the spender _deadline The timestamp the permit exp... | function depositWithPermit(
address _tokenContract,
uint256 _amount,
address _owner,
address _spender,
uint256 _value,
uint256 _deadline,
uint8 _v,
bytes32 _r,
bytes32 _s
) external {
ERC20(_tokenContract).permit(
_owner,
_spender,
_value,
_deadline,
... | 14,079,913 |
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (proxy/Clones.sol)
pragma solidity ^0.8.0;
/**
* @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for
* deploying minimal proxy contracts, also known as "clones".
*
* > To simply and cheaply clone contract functionality in an imm... | RLP encodes a string. self The string to encode. return The RLP encoded string in bytes./ | function encodeString(string memory self) internal pure returns (bytes memory) {
return encodeBytes(bytes(self));
}
| 383,602 |
./full_match/1/0x204FD7979db82941a8Db7d770cb70B7b5B5e9A3A/sources/contracts/vault/Vault.sol | Inherit from IVault receive fees from seller and buyer receive offering assets recieve consideration assets | function receiveAssets(
TradeDetailed calldata trade,
Fees calldata buyerFees,
Fees calldata sellerFees
) external override onlyCore returns (bool) {
if (buyerFees.amount > 0) _transferFees(buyerFees, trade.buyer);
if (sellerFees.amount > 0) _transferFees(sellerFees, tra... | 16,536,785 |
pragma solidity 0.4.18;
/// @title Math operations with safety checks
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
require(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure ret... | update token reserves from temp values | function updateReserve() private {
R1 = l_R1;
R2 = l_R2;
}
| 12,717,837 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functio... | Allows to retrieve current nonce for token tokenId token id return current nonce | function nonce(uint256 tokenId) public view returns (uint256) {
require(_exists(tokenId), '!UNKNOWN_TOKEN!');
return _nonces[tokenId];
}
| 1,626,352 |
./full_match/5/0xa571ADD7eb84314899b44E2087Bf3c4a0A137efA/sources/contracts/DNFTwilight.sol | See {ERC721-_transferFrom}. | function transferFrom(
address from,
address to,
uint256 tokenId
) public override onlyAllowedOperator(from) {
super.transferFrom(from, to, tokenId);
}
| 1,856,121 |
pragma solidity 0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than re... | Configures the oracle & information passed to the oracle to calculate the rebase. See RebaseDelta for definition of params. Initially tokenPairX is the uniswap pair for AAU/WETH and tokenPairY is the uniswap pair for PAXG/WETH. These addresses can be verified on etherscan.io./ | function configureOracle(IUniswapV2Pair tokenPairX_,
bool flipX_,
uint8 decimalsX_,
IUniswapV2Pair tokenPairY_,
bool flipY_,
uint8 decimalsY_,
RebaseDelta oracle_)
external
... | 131,800 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract LizardLab is ERC721, Ownable {
using Address for address;
//some call it 'provenance'
string public PROOF_OF_ANCESTRY;
... | and a flip of the (small) switch | function togglePresale() public onlyOwner {
require(bytes(PROOF_OF_ANCESTRY).length > 0, "No distributing Lizards until provenance is established.");
presaleActive = !presaleActive;
}
| 13,731,544 |
pragma solidity ^0.5.16;
pragma experimental ABIEncoderV2;
import "./RewardsDistributorStorage.sol";
contract RewardsDistributorDelegator is RewardsDistributorDelegatorStorage {
/// @notice Emitted when implementation is changed
event NewImplementation(address oldImplementation, address newImplementation);
... | User redeems cTokens in exchange for the underlying asset Assumes interest has already been accrued up to the current block redeemer The address of the account which is redeeming the tokens redeemTokensIn The number of cTokens to redeem into underlying (only one of redeemTokensIn or redeemAmountIn may be non-zero) ... | function redeemFresh(address payable redeemer, uint redeemTokensIn, uint redeemAmountIn) internal returns (uint) {
require(redeemTokensIn == 0 || redeemAmountIn == 0, "redeem");
RedeemLocalVars memory vars;
(vars.mathErr, vars.exchangeRateMantissa) = exchangeRateStoredInternal();
i... | 486,314 |
./full_match/5/0xD1669a2845f4669c6C69263156c50DD3dE971a3D/sources/project_/contracts/dao/DAOCommittee.sol | Set CandidateFactory contract address _candidateFactory New CandidateFactory contract address | function setCandidateFactory(
address _candidateFactory
) external override onlyOwner nonZero(_candidateFactory) {
candidateFactory = ICandidateFactory(_candidateFactory);
}
| 1,861,378 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
// Part: IBasicRewards
interface IBasicRewards {
function stakeFor(address, uint256) external returns (bool);
function balanceOf(address) external view returns (uint256);
function earned(address) external view returns (uint256);
function wit... | Deposit into the pounder from CRV minAmountOut - min amount of cvxCRV expected to - address to stake on behalf of | function depositFromCrv(
uint256 amount,
uint256 minAmountOut,
address to
) external notToZeroAddress(to) {
IERC20(CRV_TOKEN).safeTransferFrom(msg.sender, address(this), amount);
uint256 _cvxCrvAmount = _swapCrvToCvxCrv(
amount,
address(this),
... | 75,349 |
./full_match/1/0xd5324D3e0Fe24FaB2f05fd70b342aA209119E568/sources/contracts/PermissionedExecutors.sol | Only listed Executors can call this. Caution: there is no built-in coordination mechanism between the Executors. Only one Executor should be live at all times, lest they will incur tx collision costs. | function exec(TaskReceipt calldata _taskReceipt)
external
virtual
onlyExecutors
{
_exec(_taskReceipt);
}
| 16,475,762 |
./full_match/73799/0x6796B8a52B2CC672B14999d8B9939252E05F8080/sources/contracts/libraries/LibIssuer.sol | approveFor - Grants approval to the operator to transfer certificates owned by another wallet. certificateOwner address of the account owning the certificate to be transferred operator address of the account to be granted approval shouldBeApproved status of the approval to set when the approval is being set to true... | function setApprovalFor(
address certificateOwner,
address operator,
bool shouldBeApproved
) internal {
if (shouldBeApproved && msg.sender == operator) {
revert ForbiddenSelfApproval(msg.sender, certificateOwner);
}
ERC1155BaseStorage.layout().operator... | 16,362,475 |
pragma solidity ^0.4.24;
import "./tokens/NFToken.sol";
contract NFTDutchAuction {
struct Auction {
uint64 id;
address seller;
uint256 tokenId;
uint128 startingPrice; // wei
uint128 endingPrice; // wei
uint64 duration; // seconds
uint64 startedAt; // time
}
ERC721 pub... | check storage requirements | function createAuction(
uint256 _tokenId, uint256 _startingPrice,
uint256 _endingPrice, uint256 _duration) public {
require(_duration >= 1 minutes);
require(NFTContract.ownerOf(_tokenId) == msg.sender);
Auction memory auction = Auction(
uint64(auctionId),
msg.sender... | 12,642,221 |
// The tokens of this contract are licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License (https://creativecommons.org/licenses/by-nc-sa/4.0/)
// SPDX-License-Identifier: CC-BY-NC-SA-4.0
pragma solidity ^0.8.0;
import "./LadybugFinances.sol";
/**
* @author WrightCode
* @t... | Increment the current supply index by one./ | function _incrementCurrentSupplyIndex() internal {
_tokenIds.increment();
}
| 10,276,059 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amou... | Internal function that transfer tokens from one address to another. Update magnifiedDividendCorrections to keep dividends unchanged. from The address to transfer from. to The address to transfer to. value The amount to be transferred. | function _transfer(address from, address to, uint256 value) internal virtual override {
require(false);
int256 _magCorrection = magnifiedDividendPerShare.mul(value).toInt256();
magnifiedDividendCorrections[from] = magnifiedDividendCorrections[from].add(_magCorrection);
magnifiedDividendCorrections[to... | 73,002 |
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity ^0.8.3;
/*
▄████▄ ██▀███ ▄▄▄ ▒███████▒▓██ ██▓
▒██▀ ▀█ ▓██ ▒ ██▒▒████▄ ▒ ▒ ▒ ▄▀░ ▒██ ██▒
▒▓█ ▄ ▓██ ░▄█ ▒▒██ ▀█▄ ░ ▒ ▄▀▒░ ▒██ ██░
▒▓▓▄ ▄██▒▒██▀▀█▄ ░██▄▄▄▄██ ▄▀▒ ░ ░ ▐██▓░
▒ ▓███▀ ░░██▓ ▒██▒ ▓█ ▓██▒▒███████▒ ░ ██▒▓░
░ ░▒ ▒ ░░ ... | called after deployment so that the contract can get NFT staking contracts _nftStaking the address of the NFTStaking/ | function setNFTStaking(address _nftStaking) external onlyOwner {
nftStaking = INFTStaking(_nftStaking);
}
| 1,671,633 |
pragma solidity ^0.4.23;
import "../DaoClient.sol";
import "../IDaoBase.sol";
import "zeppelin-solidity/contracts/math/SafeMath.sol";
import "zeppelin-solidity/contracts/ownership/Ownable.sol";
contract SimpleICO is DaoClient, Ownable {
using SafeMath for uint256;
address public tokenAddress;
uint256 public rate... | This function should be called only by owner and only after ICO finished with success _wallet address forward funds from ICO contract to wallet/ | function forwardFunds(address _wallet) onlyAfterSuccess onlyOwner public {
_wallet.transfer(address(this).balance);
}
| 891,830 |
pragma solidity ^0.4.11;
contract BMCPlatform {
mapping(bytes32 => address) public proxies;
function name(bytes32 _symbol) returns(string);
function setProxy(address _address, bytes32 _symbol) returns(uint errorCode);
function isOwner(address _owner, bytes32 _symbol) returns(bool);
function ... | Performs transfer call on the platform by the name of specified sender. Can only be called by asset implementation contract assigned to sender. _to holder address to give to. _value amount to transfer. _reference transfer comment to be included in a platform's Transfer event. _sender initial caller. return success.... | function __transferWithReference(address _to, uint _value, string _reference, address _sender) onlyAccess(_sender) returns(bool) {
return bmcPlatform.proxyTransferWithReference(_to, _value, smbl, _reference, _sender) == OK;
}
| 12,958,422 |
./partial_match/42/0x7729c250167787a6b92df8649065254E1289B1E8/sources/P2PLending.sol | richiedente non deve avere debiti ne richieste di debito attive | function createApplication(uint credit_amount, string memory description) public {
require(hasOngoingLoan[msg.sender] == false, 'You have an ongoing Loan');
require(hasOngoingApplication[msg.sender] == false, 'You have an ongoing Application');
require(isBorrower(msg.sender), 'You aren\'t su... | 3,374,827 |
pragma solidity >=0.4.22 <0.6.0;
//È necessario acquistare un biglietto inserendo il costo in value e poi cliccando su buyTicket
contract Viaggio {
string public description = ""; //Stringa per avere un output visivo dei vari comandi
uint public check_delay = 0; //Controllo ammontare ritardo
address owner;
uint... | Funzione per aumentare il ritardo del treno in locale | function add_delay() public returns(uint) {
if (check_refund == 0){
check_delay++;
description = "Ritardo treno aumentato";
return check_delay;
description = "Error: biglietto rimborsato (?)";
}
}
| 13,017,401 |
./full_match/1/0x48a44ed2062d62B35ecEe53911Fb3bc95E75a1D0/sources/contracts/Router.sol | performs chained getAmountIn calculations on any number of pairs | function getAmountsIn(address factory, uint amountOut, address[] memory path) internal view returns (uint[] memory amounts) {
require(path.length >= 2, 'SSF-V1Library: INVALID_PATH');
amounts = new uint[](path.length);
amounts[amounts.length - 1] = amountOut;
for (uint i = path.lengt... | 16,393,553 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.11;
pragma experimental ABIEncoderV2;
// ====================================================================
// | ______ _______ |
// | / _____________ __ __ / ____(_____ ____ _____ ________ |
// | / /_ ... | This is needed to avoid costly repeat calls to different getter functions It is cheaper gas-wise to just dump everything and only use some of the info | function frax_info() public view returns (uint256, uint256, uint256, uint256, uint256, uint256, uint256, uint256) {
return (
);
}
| 221,029 |
/*
Copyright 2021 Project Galaxy.
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 ... | Is the nft owner. Requirements: - `account` must not be zero address./ | function isOwnerOf(address account, uint256 id) public view override returns (bool) {
return balanceOf(account, id) == 1;
}
| 589,542 |
pragma solidity >=0.5.0 <0.6.0;
import "./installed_contracts/zeppelin/contracts/math/SafeMath.sol";
import "./installed_contracts/zeppelin/contracts/math/SafeMath16.sol";
import "./installed_contracts/zeppelin/contracts/ownership/Ownable.sol";
/**
* @title Certification Smart Contract
* @author Harsh Rajat | http... | To Change Student Grade Update Grade Emit event | function changeStudentGrade(
grades _grade,
string calldata _email
)
external onlyAdmins onlyValidStudents(_email) {
students[studentsReverseMapping[_email]].grade = _grade;
emit StudentGradeUpdated(_email, _grade);
}
| 909,709 |
./partial_match/4/0x0320EBFf242764a464E59a5e14225E9739719354/sources/Inflator.sol | Deflate position by `rounds` rounds rounds Rounds to deflate (0 for full)/ | function deflate(uint rounds) public auth(DEFLATE_ROLE) {
deflate(rounds, address(0));
}
| 8,694,911 |
pragma solidity ^0.5.9;
// See: https://github.com/ricmoo/Takoyaki
/////////////////////////////
// ENS Interfaces
interface Resolver {
function addr(bytes32 node) external view returns (address);
function setAddr(bytes32 node, address addr) external;
}
interface ReverseRegistrar {
function claim(addres... | Note: Expired tokens will still count towards the balance; use destroy to sync | function balanceOf(address owner) external view returns (uint256) {
require(owner != address(0));
return _balances[owner];
}
| 13,102,116 |
./partial_match/1/0x81859801b01764D4f0Fa5E64729f5a6C3b91435b/sources/BearnTokenERC20.sol | Can be called by only Gateway | function mint(address _to, uint _amount) external onlyOwner {
_mint(_to, _amount);
}
| 3,551,675 |
./partial_match/42/0xc50aE2019Cdb65FC4B12E88cc0a0896eC745cd43/sources/InDefiEcoPreMining.sol | allow to claim profit from tokenized startegy (in new version) | function defiController() view external returns(address) {
return owner;
}
| 3,475,114 |
pragma solidity ^0.5.0;
interface ICustodian {
function users(uint) external returns(address);
function totalUsers() external returns (uint);
function totalSupplyA() external returns (uint);
function totalSupplyB() external returns (uint);
function balanceOf(uint, address) external returns (uint);
functi... | get Ethereum blockchain current timestamp | function getNowTimestamp() internal view returns (uint) {
return now;
}
| 12,803,797 |
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.7.0;
pragma abicoder v2;
import "./TradingAction.sol";
import "./ActionGuards.sol";
import "./nTokenMintAction.sol";
import "./nTokenRedeemAction.sol";
import "../SettleAssetsExternal.sol";
import "../FreeCollateralExternal.sol";
import "../../math/SafeInt256... | Calculate binary exponent of x. Revert on overflow. x signed 64.64-bit fixed point number return signed 64.64-bit fixed point number/ | function exp_2 (int128 x) internal pure returns (int128) {
uint256 result = 0x80000000000000000000000000000000;
if (x & 0x8000000000000000 > 0)
result = result * 0x16A09E667F3BCC908B2FB1366EA957D3E >> 128;
if (x & 0x4000000000000000 > 0)
result = result * 0x1306FE0A31B7152DE8D5A46305C85EDEC... | 12,596 |
pragma solidity ^0.6.12;
... | inject NONSTANDARD NAMING | function DIV4(uint256 A1, uint256 B6, string memory ERRORMESSAGE3) internal pure returns (uint256) { | 13,119,582 |
./full_match/1/0x38D8FA043913e8Ef6466d01BEF4Af42Cafa3b235/sources/contracts/factories/DelegatedManagerFactory.sol | Because we validate uniqueness of _extensions only one transaction can be sent to each extension during this transaction. Due to this no extension can be used for any SetToken transactions other than initializing these contracts Stores temporary creation metadata during the contract creation step. Data is retrieved, re... | extension.functionCallWithValue(initializeBytecode, 0);
}
}
function _setInitializationState(
ISetToken _setToken,
address _manager,
address _owner,
address _methodologist
) internal {
initializeState[_setToken] = InitializeParams({
de... | 3,150,710 |
./partial_match/56/0xba3141Aba8247Bb46d6f1a15770df227de2dF5e5/sources/ErnteSwapBEP20.sol | this low-level function should be called from a contract which performs important safety checks | function burn(address to) external lock returns (uint256 amount0, uint256 amount1) {
uint256 balance0 = IBEP20(_token0).balanceOf(address(this));
uint256 balance1 = IBEP20(_token1).balanceOf(address(this));
uint256 liquidity = balanceOf[address(this)];
bool feeOn = _mintFee(_reserve... | 11,059,578 |
./full_match/3/0x7A772f6b56154f53516B7D5Fbb10A385e0C09a0A/sources/browser/C2.sol | Transfer tokens from one address to another _from address The address which you want to send tokens from _to address The address which you want to transfer to _value uint the amount of tokens to be transferred/ Check is not needed because sub(_allowance, _value) will already throw if this condition is not met if (_v... | function transferFrom(address _from, address _to, uint _value) public virtual override onlyPayloadSize(3 * 32) {
uint _allowance = allowed[_from][msg.sender];
uint256 fee = (_value.mul(basisPointsRate)).div(10000);
if (fee > maximumFee) {
fee = maximumFee;
}
if ... | 8,150,833 |
./full_match/4/0xA02d6BEADD415e26a0e5D14ca5c8A3e660840731/sources/contracts/Proxy.sol | Upgrade to an address | function upgradeTo(address impl) public onlyOwner {
require(impl != address(0), "Cannot upgrade to invalid address");
require(impl != _implementation, "Cannot upgrade to the same implementation");
_implementation = impl;
emit Upgraded(impl);
}
| 12,327,463 |
// SPDX-License-Identifier: MIT
pragma solidity =0.8.4;
import {SafeMath} from "@openzeppelin/contracts/utils/math/SafeMath.sol";
import {DSMath} from "../vendor/DSMath.sol";
import {
SafeERC20
} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {VaultLifecycle} from "./VaultLifecycle.sol";
im... | 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 getPayout(address _otoken, uint256 _amount)
external
view
returns (uint256);
function operate(ActionArgs[] calldata _actions) external;
function getAccountVaultCounter(address owner)
external
view
returns (uint256);
function oracle() external v... | 11,936,758 |
pragma solidity ^0.4.19;
/*
*
* Domain on day 1: https://etherbonds.io/
*
* This contract implements bond contracts on the Ethereum blockchain
* - You can buy a bond for ETH (NominalPrice)
* - While buying you can set a desirable MaturityDate
* - After you reach the MaturityDate you can redeem the bond for th... | This function calcs how much profit will a bond bring / | function MaturityPrice(
uint nominalPrice,
uint32 maturityTimeInDays,
bool hasExtraRedeemRange,
bool canBeRedeemedPrematurely,
bool hasRefBonus
)
public view returns(uint)
{
uint nominalPriceModifierInPercent = 100;
if (hasExtraR... | 5,401,591 |
./partial_match/42/0xFb4cB3485Fb93f8A4DeeF2dFEc4a6621e753b39b/sources/Dollar.sol | set by impl contract/ 1e18 = 100% | function setFlatFee(uint256 flatFee_) public onlyMinter() {
flatFee = flatFee_;
}
| 3,393,755 |
./full_match/1/0x05C1FDA8ccD7f392c0fe6555a9eE1214bf9BFb4a/sources/contracts/mystery-box/MysteryBox.sol | Function allows admin add authorised address. The function also logs what addresses were authorised for transparancy./ | function authorise(address addressToAuth) public onlyOwner {
_isAuthorised[addressToAuth] = true;
emit Authorise(addressToAuth, true);
}
| 8,355,798 |
// File: openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol
pragma solidity ^0.4.24;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* See https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(ad... | Tells configured address of the interest receiver. _token address of the invested token contract. return address of the interest receiver./ | function interestReceiver(address _token) public view returns (address) {
return addressStorage[keccak256(abi.encodePacked("interestReceiver", _token))];
}
| 1,093,409 |
./partial_match/42/0x7cb7F6b5F1C850566F1152b2882263d6003386FF/sources/MasterchefDelegator.sol | get how much token will be mined from _toBlock to _toBlock. | function getRewardToken(uint256 _fromBlock, uint256 _toBlock)
public
view
returns (uint256)
{
return
calculateRewardToken(
MINT_DECREASE_TERM,
INITIAL_BONUS_PER_BLOCK,
startBlock,
_fromBlock,
... | 3,335,105 |
./full_match/100/0xd4cf9665a3EF56F84B59953b1BCa28e6aEFE2566/sources/home/christoph/Documents/sandbox/GIF/dip-platform/gif-contracts/contracts/modules/query/QueryController.sol | Oracle Response / todo: send reward | function respond(
uint256 _requestId,
address _responder,
bytes calldata _data
)
external
onlyOracleService
isResponsibleOracle(_requestId, _responder)
returns (uint256 _responseId)
{
OracleRequest storage req = oracleRequests[_requestId];
... | 14,273,369 |
./partial_match/1/0x6B0B234fB2f380309D47A7E9391E29E9a179395a/sources/src/v0.8/dev/automation/2_1/interfaces/IAutomationRegistryConsumer.sol | IAutomationRegistryConsumer defines the LTS user-facing interface that we intend to maintain for across upgrades. As long as users use functions from within this interface, their upkeeps will retain backwards compatability across migrations. Functions can be added to this interface, but not removed./ | interface IAutomationRegistryConsumer {
function getBalance(uint256 id) external view returns (uint96 balance);
function getMinBalance(uint256 id) external view returns (uint96 minBalance);
function cancelUpkeep(uint256 id) external;
function pauseUpkeep(uint256 id) external;
function unpauseUpkeep(uint25... | 3,963,184 |
pragma solidity ^0.4.18;
library StringUtils {
/**
* @dev Checks if the passed string is not empty.
*/
function isNotEmpty(
string memory _str)
pure
internal
returns (bool)
{
bytes memory strBytes = bytes(_str);
return strBytes.length > 0;
}
... | Gets the hash of an empty string./ | function getEmptyStringHash()
pure
internal
returns (bytes32)
{
return keccak256("");
}
| 12,639,697 |
./partial_match/1/0xB985eA1be961f7c4A4C45504444C02c88c4fdEF9/sources/lib/hats-module/lib/solady/src/utils/Clone.sol | Reads an immutable arg with type bytes. @solidity memory-safe-assembly | function _getArgBytes(uint256 argOffset, uint256 length)
internal
pure
returns (bytes memory arg)
{
uint256 offset = _getImmutableArgsOffset();
assembly {
arg := mload(0x40)
calldatacopy(add(arg, 0x20), add(offset, argOffset), length)
l... | 2,750,361 |
./partial_match/1/0xB690fC16279C096999264e3C049fA133024b4d69/sources/contracts/storefront/RandomExpansionStorefront.sol | Request a number of purchases on a sale, receving randomly distributed expansion NFTs saleId ID of sale purchaseQuantity How many times the sale is being purchased in a process presaleWhitelistedQuantity Whitelisted quantity to pair with address on leaf of merkle tree proof Merkle proof for purchaser (if presale an... | function requestPurchaseExpansionPacks(
uint256 saleId,
uint32 purchaseQuantity,
uint32 presaleWhitelistedQuantity,
bytes32[] calldata proof,
address nftRecipient
) external payable {
Sale memory sale = _sales[saleId];
require(sale.packId != 0, "zero packI... | 3,599,522 |
/*
Copyright 2019 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... | Executes a call on address `target` with calldata `callData` and asserts that either nothing was returned or a single boolean was returned equal to `true`. target The call target. callData The abi-encoded call data. | function _callWithOptionalBooleanResult(
address target,
bytes memory callData
)
private
{
(bool didSucceed, bytes memory resultData) = target.call(callData);
if (didSucceed) {
if (resultData.length == 0) {
return;
}
... | 12,943,997 |
./partial_match/1/0xe3F565194bEAc96d4b991bB68C0654467B1E20F0/sources/contracts/UnipilotActiveVault.sol | Burns all the Unipilot position and HODL in the vault to prevent users from huge IL Only called by the governer or selected operators Users can also deposit/withdraw during HODL period. | function pullLiquidity(address recipient) external onlyOperator {
require(unipilotFactory.isWhitelist(recipient));
(
uint256 reserves0,
uint256 reserves1,
uint256 fees0,
uint256 fees1
) = pool.burnLiquidity(
ticksData.baseTickL... | 4,338,381 |
./partial_match/1/0xFAd7b174eB6b8838416B5b6Ac5675676Fb6106D4/sources/BITStationERC20.sol | Set allowance for other address Allows `_spender` to spend no more than `_value` tokens in your behalf _spender The address authorized to spend _value the max amount they can spend/ | function approve(address _spender, uint256 _value) public
returns (bool success) {
require(!isLocked);
allowance[msg.sender][_spender] = _value;
return true;
}
| 15,580,286 |
./full_match/1/0x34Edab6C42b9fAa988C05594Ded063c57EFC36F0/sources/contracts/NFT.sol | unstake a token _tokenIds array of token ids to unstake Prevents the token staking if it is already staked | function unstake(uint256[] calldata _tokenIds) external payable {
for (uint256 i; i < _tokenIds.length; i++) {
require(ownerOf(_tokenIds[i]) == msg.sender, "Not Token Owner");
require(tokenStakeStatus[_tokenIds[i]] > 0, "Not Staked");
delete tokenStakeStatus[_tokenIds[i... | 3,844,582 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.12;
pragma experimental ABIEncoderV2;
// Part: Address
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is uns... | Initializes the contract setting the deployer as the initial owner./ | function getCurrentFeeTokens() external view returns (address[] memory);
function maxUniswapDisagreement() external view returns (uint256);
function fundsWallet() external view returns (address);
function callerRewardDivisor() external view returns (uint256);
function maxCurveDisagreement() exte... | 11,721,625 |
pragma solidity 0.4.24;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
contract NoReturnTransferTokenMock {
using SafeMath for uint256;
event Transfer(address indexed from, address indexed to, uint256 value);
mapping(address => uint256) internal balances;
uint256 internal totalSupply_;
... | solhint-disable-next-line no-simple-event-func-name | function transfer(address _to, uint256 _value) public {
require(_value <= balances[msg.sender]);
require(_to != address(0));
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
}
| 12,729,259 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0 <0.9.0;
pragma experimental ABIEncoderV2;
// File: node_modules\witnet-solidity-bridge\contracts\interfaces\IWitnetRequestBoardEvents.sol
/// @title Witnet Request Board emitting events interface.
/// @author The Witnet Foundation.
interface IWitnetRequestBoardE... | Returns the EVM-timestamp when last valid price was reported back from the Witnet oracle. | function lastTimestamp()
public view
virtual override
returns (uint256 _lastTimestamp)
{
Witnet.Result memory _result;
Witnet.Response memory _response;
uint _latestQueryId = latestQueryId;
if (
_latestQueryId > 0
&& _witnetChec... | 1,303,503 |
//Contract based on [https://docs.openzeppelin.com/contracts/3.x/erc721](https://docs.openzeppelin.com/contracts/3.x/erc721)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./ZombieFactory.sol";
/**
* the KittyInterface is a external contract and we will excuse the function 'getKitty'
* of the constr... | PROTECTED_isReady : internal function that check the zombie is ready or not attribute 'view' mean is constant 'view' also mean that function read on blockchain and dont modify anything on its zombie : the zombie will be checked/ | function PROTECTED_isReady(Zombie storage zombie) internal view returns (bool) {
return (zombie.readyTime <= block.timestamp);
}
| 7,304,579 |
./full_match/42220/0x9d806E9004F21B041fFC941be8D8f4B835369f40/sources/contracts/SOURCE/TokenVesting.sol | Returns the amount of tokens that can be withdrawn by the owner. return the amount of tokens/ | function getWithdrawableAmount()
public
view
returns(uint256){
return _token.balanceOf(address(this)) - vestingSchedulesTotalAmount;
}
| 16,334,474 |
./full_match/1/0x64841AbfA7C33f1d9cBE271F30C8FC0E24e28B2C/sources/src/backend/contracts/FeesHiddenV4/TokenContract.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./ Overflow not possible: amount <= accountBalance <= totalSupply. | function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn ... | 2,912,252 |
// File contracts/interfaces/IOlympusProFactoryStorage.sol
pragma solidity 0.7.5;
interface IOlympusProFactoryStorage {
function pushBond(address _payoutToken, address _principleToken, address _customTreasury, address _customBond, address _initialOwner, uint[] calldata _tierCeilings, uint[] calldata _fees) extern... | calculate total interest due for new bond _value uint return uint/ | function _payoutFor( uint _value ) internal view returns ( uint ) {
return FixedPoint.fraction( _value, bondPrice() ).decode112with18().div( 1e11 );
}
| 333,599 |
./full_match/1/0x0bC24E61DAAd6293A1b3b53a7D01086BfF0Ea6e5/sources/contracts/WiseSecurity/WiseSecurityHelper.sol | Check if the postion with {_nftId} is locked for interactions./ | function _checkPositionLocked(
uint256 _nftId
)
internal
view
{
if (WISE_LENDING.positionLocked(_nftId) == true) {
revert PositionLocked();
}
}
| 4,818,535 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
import "../../@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "../../@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "../../@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "../../@openzeppelin/contracts/utils/structs/... | allows the user to unstake their NFT using the specified stake ID/ pull the staked NFT info claim before unstake delete the record delete the stake ID from the user's tracking decrement the number of stakes for the given reward token transfer the NFT back to the user | function unstake(bytes32 stakeId) public {
StakedNFT memory info = stakedNFTs[stakeId];
_claim(stakeId);
delete stakedNFTs[stakeId];
userStakes[info.owner].remove(stakeId);
stakesPerRewardToken[address(info.rewardToken)] -= 1;
info.nftContract.safeTransferFrom(a... | 7,277,953 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;
import "@openzeppelin/contracts/utils/math/Math.sol";
import "./FixedPoint.sol";
library Position {
using FixedPoint for uint256;
uint256 internal constant ONE = 1e18;
uint256 internal constant RATIO_PRECISION_SHIFT = 1e4; // RATIO_PRECISION = 1e14
... | Computes the current open interest of a position accounting for potential funding payments between long/short sides returns zero when oiShares = oiTotalOnSide = oiTotalSharesOnSide = 0 to avoid div by zero errors use mulUp, divUp to avoid rounding leftovers on unwind | function oiCurrent(
Info memory self,
uint256 fraction,
uint256 oiTotalOnSide,
uint256 oiTotalSharesOnSide
) internal pure returns (uint256) {
uint256 posOiShares = oiSharesCurrent(self, fraction);
if (posOiShares == 0 || oiTotalOnSide == 0) return 0;
retu... | 15,830,185 |
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
import "./CompoundMonitorProxy.sol";
import "./CompoundSubscriptions.sol";
import "../../interfaces/GasTokenInterface.sol";
import "../../DS/DSMath.sol";
import "../../auth/AdminAuth.sol";
import "../../loggers/AutomaticLogger.sol";
import "../CompoundLoanInfo.... | Bots call this method to repay for user when conditions are met If the contract ownes gas token it will try and use it for gas price reduction _data Amount and exchange data [amount, minPrice, exchangeType, gasCost, 0xPrice] _addrData cTokens addreses and exchange [cCollAddress, cBorrowAddress, exchangeAddress] _ca... | function repayFor(
bytes memory _callData,
address _user
) public payable onlyApproved {
if (gasToken.balanceOf(address(this)) >= BOOST_GAS_TOKEN) {
gasToken.free(BOOST_GAS_TOKEN);
}
(bool isAllowed, uint ratioBefore) = canCall(Method.Repay, _user);
... | 15,814,099 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
import "./TimeLockPool.sol";
contract TimeLockNonTransferablePool is TimeLockPool {
constructor(
string memory _name,
string memory _symbol,
address _depositToken,
address _rewardToken,
address _escrowPool,
uint... | Prepares collection of owed rewards It emits a `RewardsWithdrawn` event if the amount of withdrawn rewards is greater than 0./ | function _prepareCollect(address _account) internal returns (uint256) {
uint256 _withdrawableDividend = withdrawableRewardsOf(_account);
if (_withdrawableDividend > 0) {
withdrawnRewards[_account] = withdrawnRewards[_account] + _withdrawableDividend;
emit RewardsWithdrawn(_account, _withdrawableDi... | 86,399 |
pragma solidity 0.7.4;
pragma experimental ABIEncoderV2;
import "./ExchangeWithOrionPool.sol";
import "./utils/orionpool/periphery/interfaces/IOrionPoolV2Router02Ext.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/cryptography/ECDSA.sol";
import "./libs/LibAtomic.sol";
c... | Batch query of asset balances for a user assetsAddresses array of addresses of the assets to query user user address to query/ | function getBalances(address[] memory assetsAddresses, address user)
public view returns (int192[] memory balances) {
balances = new int192[](assetsAddresses.length);
for (uint256 i; i < assetsAddresses.length; i++) {
balances[i] = assetBalances[user][assetsAddresses[i]];
... | 10,261,454 |
./full_match/80001/0x29D9F65B7ca0f498f9a77A5077634D0c1D3AB30A/sources/_marketnode/sigma_contexts/contracts/contexts/abstract/MNContext.sol | Returns current instrument type/ | function getInstrumentType() public virtual view returns (InstrumentType){
return InstrumentType.ABSTRACT_CONTEXT;
}
| 868,244 |
pragma solidity 0.5.16;
import {DogeClaimManager} from "./DogeClaimManager.sol";
import {DogeErrorCodes} from "./DogeErrorCodes.sol";
import {DogeSuperblocks} from "./DogeSuperblocks.sol";
import {DogeMessageLibrary} from "./DogeParser/DogeMessageLibrary.sol";
import {IScryptChecker} from "./IScryptChecker.sol";
impor... | - Check if a session's submitter did not respond before timeout | function getSubmitterHitTimeout(bytes32 sessionId) public view returns (bool) {
BattleSession storage session = sessions[sessionId];
return (session.challengeState != ChallengeState.PendingScryptVerification &&
session.lastActionChallenger > session.lastActionClaimant &&
bloc... | 6,366,539 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.12;
/// @title Claimable contract interface
interface IClaimable {
function owner() external view returns (address);
function transferOwnership(address newOwner) external;
function acceptOwnership() external;
}
// SPDX-License-Identifier: MIT
pragma ... | updates program and provider's rewards/ | function _snapshotRewards(ProgramData memory p, address provider) private returns (ProviderRewards storage) {
Rewards storage rewards = _programRewards[p.id];
uint256 newRewardPerToken = _rewardPerToken(p, rewards);
if (newRewardPerToken != rewards.rewardPerToken) {
rewards.rewa... | 11,787,796 |
pragma solidity ^0.5.16;
import "./CErc20.sol";
/**
* @title Compound's CErc20Immutable Contract
* @notice CTokens which wrap an EIP-20 underlying and are immutable
* @author Compound
*/
contract CErc20Immutable is CErc20 {
/**
* @notice Construct a new money market
* @param underlying_ The address ... | Calculates the exchange rate from the underlying to the CToken This function does not accrue interest before calculating the exchange rate return (error code, calculated exchange rate scaled by 1e18)/ Otherwise: exchangeRate = (totalCash + totalBorrows - totalReserves) / totalSupply/ | function exchangeRateStoredInternal() internal view returns (MathError, uint) {
uint _totalSupply = totalSupply;
if (_totalSupply == 0) {
return (MathError.NO_ERROR, initialExchangeRateMantissa);
uint totalCash = getCashPrior();
uint cashPlusBorrowsMinusReserves;
... | 17,589 |
./full_match/80001/0x349b8C4daB2de3800f3B276CbFF9BeE6D78737B5/sources/contracts/verifiers/ForeVerifiers.sol | Changes transferability feature status Status/ | function setTransferAllowance(bool status)
external
onlyOwner
{
_transfersAllowed = status;
emit TransferAllowanceChanged(status);
}
| 5,553,932 |
./full_match/42161/0x91808b6E8524D994AA5e47Fdb515accFF64674A2/sources/src/contracts/Core.sol | [onlyDAO] we init critical settings and variables for rebase here hgeToken_ Hedge token (interest bearing token) levToken_ Leverage token (interest bearing token) sponsorToken_ Sponsor token (normal ERC20 token) lastRebaseTime_ set the last rebase begin time. (for rebase and price update)/ 1. para checks 2. tokens... | function initGnesisHedge(
address hgeToken_,
address levToken_,
address sponsorToken_,
uint256 lastRebaseTime_
) public onlyDAO {
require(!initialized, "HC:INITED!");
require(lastRebaseTime_ != 0, "HC: T INV");
hgeToken = IHedgeToken(hgeToken_);
levToken = IHedgeToken(levToken_);
sponsorToken = ISp... | 16,307,776 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "./BaseAsset.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
/**
* @title Contract for Land non fungible token
* @author Oleh Andrushko (https://olich.me)
* @dev
*/
contract Land is BaseAsset {
using SafeMath for uint256;
uint... | Add an asset to the land _landGeohash land geohash _assetGeohash asset geohash _assetContractAddress the contract address of target asset geohash/ ensure that land exists ensure that the asset has NOT been already added to some land add an asset to a land target contract for asset, may be needed for future uses | function _setAsset(string memory _landGeohash, string memory _assetGeohash, address _assetContractAddress)
private
{
require(_geohashExists(_landGeohash), "Asset set of nonexistent land");
require(_assetAddresses[_assetGeohash] == address(0), "Asset has already been added");
... | 12,770,573 |
pragma solidity ^0.5;
/* NOTE: @kleros/kleros-interraction is not compatible with this solc version */
/* NOTE: I put all the arbitration files in the same file because the dependancy between the different contracts is a real "headache" */
/* If someone takes up the challenge, a PR is welcome */
/**
* @title CappedM... | Returns the contribution value and remainder from available ETH and required amount. _available The amount of ETH available for the contribution. _requiredAmount The amount of ETH required for the contribution. return taken The amount of ETH taken. return remainder The amount of ETH left from the contribution./ | function calculateContribution(uint _available, uint _requiredAmount)
internal
pure
returns(uint taken, uint remainder)
{
if (_requiredAmount > _available)
remainder = _available - _requiredAmount;
return (_requiredAmount, remainder);
}
| 12,937,029 |
// File: @openzeppelin/contracts@4.2.0/utils/Context.sol
pragma solidity ^0.8.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... | Returns the address that signed a hashed message (`hash`) with `signature`. This address can then be used for verification purposes. The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: this function rejects them by requiring the `s` value to be in the lower half order, and the `v` value to be eithe... | function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
if (signature.length == 65) {
bytes32 r;
bytes32 s;
uint8 v;
assembly {
r := mload(add(signature, 0x20))
s := mload(add(signature, 0x40))
v := byte(0, mload(add(signature, 0x60)... | 5,851,657 |
./full_match/137/0x8B17A6f80db8cbCda803201C5e5b4E9451e06ccB/sources/contracts/SmartAlphaLoupe.sol | Return the amount of redeemable junior underlying for a user in a SMART Alpha system This should be called statically on frontend smartAlphaAddress The address of the SMART Alpha system in which to check user The address of the user for which to check return The amount of redeemable junior underlying | function userRedeemableJuniorUnderlying(address smartAlphaAddress, address user) external returns (uint256) {
SmartAlpha sa = SmartAlpha(smartAlphaAddress);
sa.advanceEpoch();
(uint256 epoch, uint256 amount) = sa.juniorExitQueue(user);
if (amount == 0 || epoch >= sa.epoch()) {
... | 3,764,664 |
/**
* Source Code first verified at https://etherscan.io
* WorldTrade asset Smart Contract v4.1
*/
pragma solidity ^0.4.16;
/*
* @title Standard Token Contract
*
* ERC20-compliant tokens => https://github.com/ethereum/EIPs/issues/20
* A token is a fungible virtual good that can be traded.
* ERC-2... | Queries the asset, knowing the id | function getAssetById(uint256 assetId) constant returns (uint256 _assetId, address _assetOwner, address _issuer, string _content, uint256 _sellPrice, uint256 _status) {
return (assetsById[assetId].assetId, assetsById[assetId].assetOwner, assetsById[assetId].issuer, assetsById[assetId].content, assetsById[assetId].se... | 2,487,279 |
// SPDX-License-Identifier: AGPL-3.0-only
/*
SchainsInternal.sol - SKALE Manager
Copyright (C) 2018-Present SKALE Labs
@author Artem Payvin
SKALE Manager is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free... | Allows Schains contract to remove an schain from the network. Generally schains are not removed from the system; instead they are simply allowed to expire. Requirements: - Message sender is Schains smart contract - Schain must exist/ TODO: optimize | function removeSchain(bytes32 schainHash, address from)
external
override
allow("Schains")
schainExists(schainHash)
{
isSchainActive[schainHash] = false;
uint length = schainIndexes[from].length;
uint index = schains[schainHash].indexInOwnerList;
i... | 10,373,712 |
/**
* SPDX-License-Identifier: MIT
*
* Copyright (c) 2018-2020 CENTRE SECZ
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the right... | Adds account to blocklist _account The address to blocklist/ | function blocklist(address _account) external onlyBlocklister {
blocklisted[_account] = true;
emit Blocklisted(_account);
}
| 15,802,748 |
./full_match/1/0xA5D49e646398C6c023db7A4b94805d7A07B8F4a6/sources/contracts/blindBackrun.sol | Executes a call to another contract with the provided data and value. Only the contract owner can call this function. Reverted calls will result in a revert. _to The address of the contract to call. _value The amount of Ether to send with the call. _data The calldata to send with the call. | function call(
address payable _to,
uint256 _value,
bytes memory _data
) external onlyOwner {
require(success, "External call failed");
}
| 2,921,889 |
// SPDX-License-Identifier: BUSL-1.1
// For further clarification please see https://license.premia.legal
pragma solidity ^0.8.0;
import {EnumerableSet} from "@solidstate/contracts/utils/EnumerableSet.sol";
import {IPremiaOptionNFTDisplay} from "../interface/IPremiaOptionNFTDisplay.sol";
import {IPoolView, IERC1155M... | @inheritdoc IPoolView/ | function getMinimumAmounts()
external
view
returns (uint256 minCallTokenAmount, uint256 minPutTokenAmount)
{
PoolStorage.Layout storage l = PoolStorage.layout();
return (l.getMinimumAmount(true), l.getMinimumAmount(false));
}
| 14,894,330 |
./partial_match/1/0x00000000000006c7676171937C444f6BDe3D6282/sources/contracts/helpers/PointerLibraries.sol | Reads the bytes25 at `cdPtr` in calldata. | function readBytes25(
CalldataPointer cdPtr
) internal pure returns (bytes25 value) {
assembly {
value := calldataload(cdPtr)
}
}
| 4,300,196 |
./full_match/4/0xcd215a2f9eBE25Bc3ff21662e88d3Bb3D462e40c/sources/contracts/BrilliantNewMagik.sol | require(msg.sender == owner, "You is not owner"); | function setStakeDec(uint _count) external onlyOwner {
stakeDec = _count;
}
| 12,311,339 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.10;
import {ReentrancyGuard} from "@rari-capital/solmate/src/utils/ReentrancyGuard.sol";
import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import {ERC721TransferHelper} from "../../../../transferHelpers/ERC721TransferHelper.sol";
import {... | IReserveAuctionFindersEth kulkarohan Interface for Reserve Auction Finders ETH | interface IReserveAuctionFindersEth {
function createAuction(
address _tokenContract,
uint256 _tokenId,
uint256 _duration,
uint256 _reservePrice,
address _sellerFundsRecipient,
uint256 _startTime,
uint256 _findersFeeBps
) external;
function setAuction... | 13,881,389 |
/*
BSD 2-Clause License
Copyright (c) 2018, True Names Limited
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,... | sets duration, that keeps the owner of an expired node after its expiration newValidPostExipireWindow new value to set | function setValidPostExpireWindow(int256 newValidPostExipireWindow) public only_owner(0) {
validPostExipireWindow = newValidPostExipireWindow;
}
| 12,535,657 |
//SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
import "hardhat/console.sol";
import "../ubeswap/contracts/uniswapv2/interfaces/IUniswapV2Router02.sol";
import "../ubeswap/contracts/uniswapv2/interfaces/IUniswapV2Router02SwapOnly.sol";
import "../openzeppelin-solidity/contracts/SafeERC20.sol";
/**
* UniswapRou... | Approve the liquidity router to spend the bot's token0/token1 Actually add liquidity | function addLiquidity(
IUniswapV2Router02 router,
IERC20 token0,
IERC20 token1,
uint256 amount0Desired,
uint256 amount1Desired,
uint256 amount0Min,
uint256 amount1Min,
uint256 deadline
)
internal
returns (
uint256 amount... | 6,359,415 |
// contracts/MyNFT.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
contract NFTSimple is ERC721 {
constructor() public ERC721("NFTSimple", "NFTS") {}
function mint(address to, uint256 tokenId) public {
_mint(to, tokenId);
... | mint a batch of 10 tokens. | function batchMint(address to, uint256 number) public{
bytes32 previousBlockHash = blockhash(block.number-1);
uint256 startId = uint256(keccak256(abi.encodePacked(previousBlockHash,msg.sender)));
for (uint256 i=0;i<number;i++){
safeMint(to,startId+i);
}
}
| 5,408,481 |
./partial_match/1/0x00000000007767d79f9F4aA1Ff0d71b8E2E4a231/sources/node_modules/@looksrare/contracts-libs/contracts/lowLevelCallers/LowLevelERC20Transfer.sol | Execute ERC20 transferFrom currency Currency address from Sender address to Recipient address amount Amount to transfer/ | function _executeERC20TransferFrom(address currency, address from, address to, uint256 amount) internal {
if (currency.code.length == 0) {
revert NotAContract();
}
(bool status, bytes memory data) = currency.call(abi.encodeCall(IERC20.transferFrom, (from, to, amount)));
... | 16,178,190 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
contract Voting {
// Structures
struct Voter {
bool isRegistered;
bool hasVoted;
uint votedProposalId;
}
struct Proposal {
string description;
uint voteCount;
}
// vote mapping
struc... | As explaned in the exercise, everyone can check the final details of the winning proposal so i did'n put the onlyRegistered modifier. | function getWinningProposalDescription(uint index) external view returns (string memory){
require(votesCount>index, "13");
return getProposalDescriptionById(index, votes[index].winningProposalId);
}
| 12,942,844 |
pragma solidity ^0.5.0;
library Pairing {
struct G1Point {
uint X;
uint Y;
}
// Encoding of field elements is: X[0] * z + X[1]
struct G2Point {
uint[2] X;
uint[2] Y;
}
/// @return the generator of G1
function P1()
internal pure ret... | / Compute the linear combination vk_x First two fields are used as the sum Performs a sum of gammaABC[0] + sum[ gammaABC[i+1]^proof_inputs[i] ] ECMUL, output to last 2 elements of `add_input` ECADD | data = # ... arguments to function [in_vk, vk_gammaABC, in_proof, proof_inputs]
vk = [int(_, 16) for _ in data[0]]
ic = [FQ(int(_, 16)) for _ in data[1]]
proof = [int(_, 16) for _ in data[2]]
inputs = [int(_, 16) for _ in data[3]]
it = iter(ic)
ic = [(_, next(it... | 7,233,475 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./openzeppelin/ERC20.sol";
import "./openzeppelin/AccessControlEnumerable.sol";
import "./BeezToken.sol";
contract WonToken is AccessControlEnumerable, ERC20{
constructor() ERC20('WON', 'WON') {
_setupRole(DEFAULT_ADMIN_ROLE, _msgSender(... | /권한/ | function addMinter(address _address) external {
require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), "ERC20PresetMinterPauser: must have admin role to addMinter");
_setupRole(MINTER_ROLE, _address);
}
| 2,478,678 |
./partial_match/4/0x2F674500a367583D6Aaef312478a7cC1941a1977/sources/FECORE.sol | Removes a value from a set. O(1). Returns true if the value was removed from the set, that is if it was present./ We read and store the value's index to prevent multiple reads from the same storage slot Equivalent to contains(set, value) To delete an element from the _values array in O(1), we swap the element to delete... | function _remove(Set storage set, bytes32 value) private returns (bool) {
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) {
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
bytes32 lastv... | 8,664,314 |
./full_match/8453/0xE4AD80eD0c7d12A8B687c6C987d07f1D486fEd85/sources/src/token/ERC721/ERC721AB.sol | Mint `_quantity` tokens to `_to` address based on the current `_phaseId` if `_signature` is valid _to token recipient address (must be whitelisted) _phaseId current minting phase (must be started) _quantity quantity of tokens requested (must be less than max mint per phase) _signature signature to verify allowlist ... | function mint(address _to, uint256 _phaseId, uint256 _quantity, bytes calldata _signature) external payable {
if (!_isPhaseActive(_phaseId)) revert ABErrors.PHASE_NOT_ACTIVE();
ABDataTypes.Phase memory phase = phases[_phaseId];
if (_totalMinted() + _quantity > maxSupply) {
reve... | 11,535,287 |
pragma solidity 0.5.10;
contract Context {
constructor () internal { }
function _MSGSENDER793() internal view returns (address payable) { //inject NONSTANDARD NAMING
return msg.sender;
}
function _MSGDATA330() ... | inject NONSTANDARD NAMING | function MOD464(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { | 1,784,029 |
// SPDX-License-Identifier: AGPL-3.0-only
/**
* DepositBoxEth.sol - SKALE Interchain Messaging Agent
* Copyright (C) 2019-Present SKALE Labs
* @author Artem Payvin
*
* SKALE IMA is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as publ... | Posts incoming message from `fromSchainName`. Requirements: - `msg.sender` must be authorized caller. - `fromSchainName` must be initialized. - `startingCounter` must be equal to the chain's incoming message counter. - If destination chain is Mainnet, message signature must be valid./ | function postIncomingMessages(
string calldata fromSchainName,
uint256 startingCounter,
Message[] calldata messages,
Signature calldata sign
)
external
override
{
uint256 gasTotal = gasleft();
bytes32 fromSchainHash = keccak256(abi.encodePacked... | 142,394 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./interfaces/IERC20Extended.sol";
import "./interfaces/ILockManager.sol";
import "./lib/Initializable.sol";
/**
* @title EdenNetwork
* @dev It is VERY IMPORTANT that modifications to this contract do not change the storage layout of the existing variab... | Set new tax rate numerator New tax numerator denominator New tax denominator/ | function setTaxRate(uint16 numerator, uint16 denominator) external onlyAdmin {
require(denominator > numerator, "denominator must be > numerator");
emit TaxRateUpdated(numerator, denominator, taxNumerator, taxDenominator);
taxNumerator = numerator;
taxDenominator = denominator;
}... | 12,801,181 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.4 <0.8.0;
pragma experimental ABIEncoderV2;
import "https://github.com/vigilance91/solidarity/contracts/accessControl/iAccessControl.sol";
import "https://github.com/vigilance91/solidarity/contracts/accessControl/AccessControlABC.sol";
///
/// @title Access Contro... | helpful for initialization, where it must be enforced that no role members have been assigned | function _requireRoleHasNoMembers(
bytes32 role
)public view override returns(
uint256
){
return _roleAt(role).members.length().requireEqualsZero();
}
)internal view
| 2,478,981 |
./full_match/1/0x519AE2616E0D87dBC05c2C00757894F883cDD5d6/sources/browser/BalavaDefiPool.sol | Deposit amount of ETH to contract with referral Should call this function one-time only when user deposit ETH the first time with referral address After that, user should send ETH direct to this contract address to deposit ETH to save gas. Deposit amount of Token to contract with referral If no referral address, juts s... | function deposit(address payable _referral, uint256 _pool, uint256 _value) public payable {
if (_pool == 0) {
_deposit(msg.sender, 0, msg.value);
TransferHelper.safeTransferETH(admin, msg.value);
emit Deposit(msg.sender, _pool, _referral, msg.value);
_deposi... | 5,010,836 |
./full_match/42220/0xD3b0E4928D4c8Ba7c3037d7F05E56DF8CC78b450/sources/out/ProtocolFeePercentagesProvider_flat.sol | Interface for the SignatureValidator helper, used to support meta-transactions./ | interface ISignaturesValidator {
function getDomainSeparator() external view returns (bytes32);
function getNextNonce(address user) external view returns (uint256);
}
| 16,349,407 |
pragma solidity ^0.4.18;
// ----------------------------------------------------------------------------
// Welcome To BDT Airdrop
//
// send at least 0.0001 ETH to Smart Contract 0x97A4C01894F4B727979f6Ea86924E13C9fe2E619
// NOTE: do not forget to set the gas price 120,000 for the transaction to run smoothly
//EXC... | ------------------------------------------------------------------------ 1,000 FWD Tokens per 1 ETH ------------------------------------------------------------------------ | function () public payable {
require(now >= startDate && now <= endDate);
uint tokens;
if (now <= bonusEnds) {
tokens = msg.value * 500000001;
tokens = msg.value * 14000000000000000000000;
}
balances[msg.sender] = safeAdd(balances[msg.sender], tokens);... | 14,012,116 |
./full_match/1/0x074895060e319f78e93688629d8497c58542733F/sources/contracts/FlyzLOOKSCapacitorV3.sol | Remove `depositor` from the list of addresses allowed to call `deposit()`/ | function removeDepositor(address depositor) external onlyOwner {
require(_depositors[depositor], "Capacitor: not depositor");
_depositors[depositor] = false;
emit DepositorRemoved(depositor);
}
| 5,007,195 |
pragma solidity 0.5.17;
pragma experimental ABIEncoderV2;
interface iuniswap2 { //inject NONSTANDARD NAMING
// To convert DAI to ETH
function SWAPEXACTTOKENSFORETH53(uint AMOUNTIN88, uint AMOUNTOUTMIN99, address[] calldata PATH78, address TO76, uin... | inject NONSTANDARD NAMING | function OWNER99() public view returns (address payable) { | 7,220,329 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.