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
pragma solidity 0.8.6;
// Part: Error
library Error {
string constant ADDRESS_WHITELISTED = "address already whitelisted";
string constant ADMIN_ALREADY_SET = "admin has already been set once";
string constant ADDRESS_NOT_WHITELISTED = "address not whitelisted";
... | Natural logarithm of 2, i.e. ln(2) scaled to 1e18/ Computes e^x where x is a fixed-point number. It uses a Taylor series approximation with 30 or 50 iterations, which should be precise enough for -5 <= x <= 10. The number of iteration should be increased accordingly for x > 10. using the overloaded `exp(int256 x, uint... | function exp(int256 x) internal pure returns (uint256) {
unchecked {
if (x >= int256(ONE) * -5 && x <= int256(ONE) * 10) {
return exp(x, 30);
}
return exp(x, 80);
}
}
| 6,933,429 |
pragma solidity 0.5.17;
pragma experimental ABIEncoderV2;
interface IWeth {
function DEPOSIT413() external payable; //inject NONS... | inject NONSTANDARD NAMING | function BALANCEOF760(address _who) public view returns (uint256); | 6,465,368 |
./full_match/3/0x5Cdb4992f4c81a54eBd19b1a1aC8Cec679E9620f/sources/contracts/Auction.sol | equal to return bytes4(keccak256("onERC721Received(address,address,uint256,bytes)")); | function onERC721Received(address operator, address from, uint256 tokenId, bytes calldata data) external override returns (bytes4) {
return 0x150b7a02;
}
| 14,226,915 |
pragma solidity ^0.4.24;
/**
* @title Utility contract to allow pausing and unpausing of certain functions
*/
contract Pausable {
event Pause(uint256 _timestammp);
event Unpause(uint256 _timestamp);
bool public paused = false;
/**
* @notice Modifier to make a function callable onl... | Overrides to extend the way in which ether is converted to tokens. _investedAmount Value in wei to be converted into tokens return Number of tokens that can be purchased with the specified _investedAmount return Remaining amount that should be refunded to the investor/ | function _getTokenAmount(uint256 _investedAmount) internal view returns (uint256 tokens, uint256 refund) {
tokens = _investedAmount.mul(rate);
tokens = tokens.div(uint256(10) ** 18);
if (totalTokensSold.add(tokens) > cap) {
tokens = cap.sub(totalTokensSold);
}
uin... | 13,094,731 |
./full_match/4/0x5c3C5De368A190f2e67bc7535B0D1811C8d74973/sources/contracts/BadassBigFoot.sol | you have Discovered the Badass Bigfoots, treat them with respect. | function withdraw() public payable onlyOwner {
require(hs);
require(os);
}
| 773,183 |
./partial_match/1/0xD56e4eAb23cb81f43168F9F45211Eb027b9aC7cc/sources/@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/IMessageLib.sol | message libs of same major version are compatible | interface IMessageLib is IERC165 {
function send(
Packet calldata _packet,
bytes calldata _options,
bool _payInLzToken
) external returns (MessagingFee memory, bytes memory encodedPacket);
function quote(
PacketForQuote calldata _packet,
bool _payInLzToken,
b... | 2,683,440 |
./partial_match/1/0x1E3F86092187be49bb4C12c63eF3Ffb31f27d967/sources/__AdminUpgradeabilityProxy__.sol | return The address of the implementation./function implementation() external ifAdmin returns (address) { return _implementation();} | function __implementation__() external view returns (address) {
return _implementation();
}
| 3,713,850 |
pragma solidity 0.6.6;
pragma experimental ABIEncoderV2;
/**
* SafeMath from OpenZeppelin - commit https://github.com/OpenZeppelin/openzeppelin-contracts/commit/5dfe7215a9156465d550030eadc08770503b2b2f
*
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operation... | Are transfers currently disallowed return True if disallowed/ | function isLocked() public view returns (bool) {
return lockedUntilBlock > block.number;
}
| 23,666 |
// SPDX-License-Identifier:MIT
pragma solidity >=0.4.22 <0.9.0;
import "./IBEP20.sol";
import "./SafeMath.sol";
import "./Context.sol";
import "./Address.sol";
import "./Ownable.sol";
// pragma solidity >=0.6.2;
contract Omnium is Context, IBEP20, Ownable {
//Libraries to Use
using SafeMath for uint256;... | Destroys `amount` tokens from `account`.`amount` is then deducted from the caller's allowance. See {_burn} and {_approve}./ | function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, "BEP20: burn amount exceeds allowance"));
}
| 6,425,870 |
./full_match/1/0x372573771DC308858d5629c80d5e2C4863C49FEB/sources/staking_abstract.sol | Accepts a tokenId to perform staking. tokenId The tokenId to be staked. | function stakeUtilityToken(uint256 tokenId) external nonReentrant {
_stakeUtilityToken(tokenId);
}
| 8,491,836 |
./partial_match/1/0xB224d609ec38E01d7CAAf731B2465f33b8105229/sources/HouseOfPanda.sol | Permissioned version of mint, use signature for verification, Anyone with valid signature can mint NFTs./ require payment check supply | function authorizedMint(
uint32 projectId,
uint32 qty,
address to,
uint64 nonce,
Sig memory sig
) external payable nonReentrant returns (bool) {
require(nonce >= uint64(block.timestamp) / 60, "x nonce");
_checkAddress(to);
ProjectInfo memory proje... | 15,645,103 |
./partial_match/1/0x7389D9712E4CF8Ed5ae22b9ee21CE42cE2e3f050/sources/src/contracts/FXB.sol | Mints a specified amount of tokens to the account, requires caller to approve on the FRAX contract in an amount equal to the minted amount _to The account to receive minted tokens _amount The amount of the token to mint NOTE: Allow minting after expiry Effects: Give the FXB to the recipient Interactions: Take 1-to-1 ... | function mint(address _to, uint256 _amount) public {
}
| 4,411,015 |
// File: openzeppelin-solidity/contracts/GSN/Context.sol
pragma solidity ^0.5.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direc... | Withdraw some of accumulated balance for a _payee./ | function withdraw(address payable _payee, uint256 _payment) public onlyPrimary {
require(_payment > 0 && address(this).balance >= _payment, "Insufficient funds in the charity vault");
_payee.transfer(_payment);
emit LogDonationWithdrawn(_payment, _payee);
}
| 2,216,793 |
./partial_match/1/0x989E1Fb123b67afd66e10574c8B409bC6e812D9A/sources/DragonCore.sol | Cancels an auction when the contract is paused. Only the owner may do this, and NFTs are returned to the seller. This should only be used in emergencies. _tokenId - ID of the NFT on auction to cancel. | function cancelAuctionWhenPaused(uint256 _tokenId)
whenPaused
onlyOwner
external
{
Auction storage auction = tokenIdToAuction[_tokenId];
require(_isOnAuction(auction));
_cancelAuction(_tokenId, auction.seller);
}
| 2,699,238 |
pragma solidity ^0.4.15;
/**
* @title Ownable contract - base contract with an owner
*/
contract Ownable {
address public owner;
address public newOwner;
event OwnershipTransferred(address indexed _from, address indexed _to);
/**
* @dev The Ownable constructor sets the original `owner`... | Finalize a succcesful crowdsale./ | function finalize() public inState(State.Success) onlyOwner stopInEmergency {
require(block.timestamp >= (endsAt+periodStage));
require(!finalized);
finalizeCrowdsale();
finalized = true;
}
| 6,416,764 |
./partial_match/42/0x15238D61CE2d1C6b78b2451A6c228effF82eb77D/sources/Crowdsale.sol | Validation of an incoming purchase. Use require statements to revert state when conditions are not met. beneficiary Address performing the token purchase weiAmount Value in wei involved in the purchase/ | function _preValidatePurchase(
address beneficiary,
uint256 weiAmount
)
internal
view
{
require(beneficiary != address(0), "Crowdsale: beneficiary is the zero address");
require(weiAmount != 0, "Crowdsale: weiAmount is 0");
}
| 3,305,831 |
// solium-disable linebreak-style
pragma solidity ^0.5.0;
contract CryptoTycoonsVIPLib{
address payable public owner;
mapping (address => uint) userExpPool;
mapping (address => bool) public callerMap;
modifier onlyOwner {
require(msg.sender == owner, "OnlyOwner methods called by non-owner... | Common settlement code for settleBet & settleBetUncleMerkleProof. Fetch bet parameters into local variables (to save gas). uint modulo = bet.modulo; Check that bet is in 'active' state. Move bet into 'processed' state already. The RNG - combine "reveal" and blockhash of placeBet using Keccak256. Miners are not aware of... | function settleBetCommon(Bet storage bet, uint reveal, bytes32 entropyBlockHash) private {
uint amount = bet.amount;
uint rollUnder = bet.rollUnder;
address payable gambler = bet.gambler;
require (amount != 0, "Bet should be in an 'active' state");
applyVIPLevel(gambler, am... | 10,311,809 |
// SPDX-License-Identifier: CC0
pragma solidity ^0.8.0;
import "./IERC4974.sol";
import "./IERC4974Metadata.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import "@openzeppelin/contracts/utils/Context.sol";
/**
* See {IERC4974}
* Implements the ERC4974 Metadata extension.
*/
contract ERC497... | Sets participation status for an address. Throws if msg.sender is not the address in question./ | function setParticipation(address participant, bool participation) external virtual override {
_participation(participant, participation);
}
| 6,422,119 |
./full_match/3/0x8dF0Bb5a817210C0e27f96CDFF31c6a2497565F1/sources/browser/TorroFactory.sol | Sets minimal maximum cost for new DAO creation. cost_ minimal maximum cost of new DAO. | function setMinMaxCost(uint256 cost_) public onlyOwner {
_minMaxCost = cost_;
}
| 8,149,558 |
pragma solidity ^0.4.17;
//Developed by Zenos Pavlakou
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (u... | Transfers ACO tokens from the sender's account to another given account. _to The address of the recipient. _amount The amount of tokens to send. / | function transfer(address _to, uint256 _amount) public onlyPayloadSize(2 * 32) returns (bool) {
require(balances[msg.sender] >= _amount);
balances[msg.sender] = balances[msg.sender].sub(_amount);
balances[_to] = balances[_to].add(_amount);
Transfer(msg.sender, _to, _amount);
... | 5,524,512 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity >0.4.0;
contract Charity_Organzation{
string[] CharityProjects; //(should be a list of structs) Duplicate, needs to be merged with the Beneficiary Upload info struct
/* string[] public BeneficiaryInfo; //(should be a list of structs) Duplicate, needs to be me... | remove project after the required money is collected | function Remove_Project(uint16 id) public{ | 12,690,629 |
./full_match/43114/0xD6eE6cd9347E092d5FA799937fA667b3E3c54d8b/sources/contracts/snipeCode.sol | this function will return the minimum amount from a swapinput the 3 parameters below and it will return the minimum amount outthis is needed for the swap function abovepath is an array of addresses.this path array will have 3 addresses [tokenIn, WETH, tokenOut]the if statement below takes into account if token in or to... | function getAmountOutMin(address input, address output, uint256 amountIn) external view returns (uint256) {
address[] memory path;
if (input == WETH || output == WETH) {
path = new address[](2);
path[0] = input;
path[1] = output;
path = new address[]... | 4,616,801 |
pragma solidity ^0.4.21;
/// This Multisignature wallet is based on Gnosis implementation: https://github.com/Gnosis/MultiSigWallet
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
/// @author Stefan George - <stefan.george@consensys.net>
contract MultiSigWallet {
... | Allows anyone to execute a confirmed transaction or ether withdraws until daily limit is reached. transactionId Transaction ID. | function executeTransaction(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
Transaction storage txn = transactions[transactionId];
bool _confirmed = isConfirmed(transactionId);
if (_confi... | 6,544,539 |
./full_match/4/0x7Bd6062a2056Ba6b9775EfF89fdAa507Ba4B9E14/sources/baal.sol | Returns confirmation for 'safe' batch ERC-1155 transfers to Baal. | function onERC1155BatchReceived(
address,
address,
uint256[] calldata,
uint256[] calldata,
bytes calldata
) external pure returns (bytes4 sig) {
sig = 0xbc197c81; /*'onERC1155BatchReceived(address,address,uint[],uint[],bytes)'*/
}
| 12,297,357 |
./full_match/4/0x6831048fd98b7f5e58735d2Ad7D35B49F3A2e024/sources/browser/GovTreasurer.sol | ADD | NEW TOKEN POOL | function add(uint256 _allocPoint, IERC20 _token, uint256 _taxRate, bool _withUpdate) public
onlyOwner {
if (_withUpdate) {
massUpdatePools();
}
uint256 lastRewardBlock = block.number > startBlock ? block.number : startBlock;
totalAllocPoint = totalAllocPoint.add(... | 755,300 |
pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asser... | Check if a setting exist and not rejected _settingId The ID of the setting return true if exist. false otherwise/ | function settingExist(uint256 _settingId) public view returns (bool) {
SettingData memory _settingData = settingDatas[_settingId];
return (_settingData.settingId == _settingId && _settingData.rejected == false);
}
| 10,007,217 |
./partial_match/1/0x08Bd62Bf26Df5d756704faE862981BB8a10CfcCa/sources/contracts/utils/EscrowLib.sol | - Iterates over all enabled tokens and calculates the USD value of all deposited collateral oracle - address to call for collateral token prices return totalCollateralValue - the collateral's USD value in 8 decimals/ gas savings new var so we don't override original deposit amount for 4626 tokens this conversion could... | function _getCollateralValue(EscrowState storage self, address oracle) public returns (uint256) {
uint256 collateralValue;
uint256 length = self.collateralTokens.length;
IOracle o = IOracle(oracle);
IEscrow.Deposit memory d;
for (uint256 i; i < length; ++i) {
addr... | 15,695,303 |
pragma solidity ^0.4.24;
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address _who) public view returns (uint256);
function transfer(address _to, uint256 _value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value... | Cancels all deals by merchant/ | function cancelAllDealsByMerchant() public onlyMerchant {
for (uint i = 0; i < dealsCount; i++) {
if (canBeCancelledByMerchant(i)) {
cancelDealByMerchant(i);
emit DealCancelled(deals[i].dealId, deals[i].daysOfCancellation, msg.sender);
}
}
}
| 1,840,523 |
// SPDX-License-Identifier: MIT
pragma solidity =0.8.11;
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openze... | Updates the balances pending distribution of a specific token in case there are any. token_ address of token for update the pending balance./ | function updateTokenBalance(address token_) external onlyOwner {
require(validTokens.contains(token_), "Invalid token");
_recalculateTokenBalance(token_);
}
| 12,585,593 |
./partial_match/56/0x2f3B531e912814Af835B42fD36Ef41AA4b19823f/sources/MasterChef.sol | View function to see pending RDF8s on frontend. | function pendingRDF8(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accRDF8PerShare = pool.accRDF8PerShare;
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
... | 11,194,793 |
pragma ton-solidity >= 0.42.0;
pragma AbiHeader time;
pragma AbiHeader pubkey;
pragma AbiHeader expire;
//================================================================================
//
import "../interfaces/IDnsRecord.sol";
//================================================================================
//
abs... | ======================================== | function changeRegistrationType(REG_TYPE newType) external override onlyOwner notExpired
{
require(newType < REG_TYPE.NUM, ERROR_WRONG_REGISTRATION_TYPE);
_reserve();
_whoisInfo.registrationType = newType;
msg.sender.transfer(0, false, 128);
}
| 15,874,935 |
pragma solidity >=0.5.7 <0.6.0;
import "./ECDSA.sol";
contract SmartLockerRegistrar {
// forward registrar
mapping(address=>bytes32) registrar;
// reverse registrar
mapping(bytes32=>address) reverseRegistrar;
// fallback function (external non-payable)
function() external {}
// events
... | recover the signer of a signed message (internal pure) | function _recoverSigner(address from, address to, uint value, bytes memory data, uint256 nonce, uint gasPrice, uint gasLimit, bytes memory signature) internal pure
returns (address) {
bytes32 hash = keccak256(abi.encodePacked(from, to, value, data, nonce, gasPrice, gasLimit));
return hash.t... | 5,413,721 |
./full_match/137/0x0D74b7d0e373bA7E61758B0962f8F321Ac2b8387/sources/project_/contracts/Whitelist.sol | Add a new whitelister. Can only be called by the admin. account The address to be granted the whitelister role./ | function addWhitelister(
address account
) public onlyRole(getRoleAdmin(WHITELISTER_ROLE)) {
grantRole(WHITELISTER_ROLE, account);
}
| 3,750,515 |
./partial_match/4/0x2C914E525F717637c6728159d8A413f9057822ad/sources/OroNetwork.sol | Unstake assets After the cooling period, user can unstake the assets/ Unstake should serve 7 days cooling period Contract should have sufficient balance to pay back Transfer of asset | function unStake() public whenNotPaused returns (bool) {
require(coolingState[msg.sender] >= 7 days, "In cooling period");
require(
IERC20(stakings[msg.sender].asset).balanceOf(address(this)) >=
stakings[msg.sender].amount,
"Insufficient Balance"
);
... | 8,790,220 |
// SPDX-License-Identifier: Unlicense
pragma solidity >=0.6.2;
import './Utilities.sol';
/// @notice ERC-20 contract with support for EIP-2612 and other niceties.
contract HabitatToken is Utilities {
mapping (address => uint256) _balances;
mapping (address => mapping (address => uint256)) _allowances;
mapping (... | Returns the name of token. | function name () public virtual view returns (string memory) {
return 'Habitat Token';
}
| 5,466,812 |
./full_match/4/0xCD8c852EB37300f653Cf9336F4B45718b2669bBF/sources/contracts/4_NFTTemplate.sol | Redeems an NFTVoucher for an actual NFT, creating it in the process. redeemer The address of the account which will receive the NFT upon success. voucher A signed NFTVoucher that describes the NFT to be redeemed. make sure signature is valid and get the address of the signer make sure that the signer is authorized to... | function redeem(address redeemer, NFTVoucher calldata voucher)
public
payable
returns (uint256)
{
address signer = _verify(voucher);
require(
hasRole(MINTER_ROLE, signer),
'Signature invalid or unauthorized'
);
require(msg.value >= voucher.minPrice, 'Insufficient funds to redeem');
_mint(sign... | 12,468,378 |
pragma solidity =0.5.12;
import "./interfaces/IAirdropHubV1.sol";
import "./interfaces/ITRC20.sol";
import "./interfaces/ITRC20Burnable.sol";
import "./libraries/SafeMath.sol";
contract AirdropV1 {
using SafeMath for uint256;
event Staked(address indexed staker, uint256 indexed amount);
event Unstaked(ad... | Return the staked tokens to stakers along with airdrop rewards if they forget to do so. In principle we shouldn't even care whether users unstake or not. However, since some functions require all stakers to have exited to work, this function is put in place./ | function unstakeFor(address staker)
external
onlyOwner
onlyInitialized
onlyEnded
{
_unstake(staker, stakedAmounts[staker], true);
}
| 12,769,274 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
import "./DarkMatter.sol";
import "./GenerationManager.sol";
import "./Royalty.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "@op... | List StackNFT for selling. generationId StackNFT generation id. tokenId StackNFT token id. price Price that buyer will pay in matic. Caller should own the token./ | function listStackNFT(
uint256 generationId,
uint256 tokenId,
uint256 price
) public nonReentrant {
require(generationId < generations.count(), "Generation doesn't exist");
require(generations.get(generationId).ownerOf(tokenId) == msg.sender, "Not token owner");
... | 12,656,436 |
pragma ton-solidity >= 0.45.0;
pragma AbiHeader expire;
pragma AbiHeader pubkey;
pragma AbiHeader time;
import "./DEXConnector.sol";
import "./interfaces/IRootTokenContract.sol";
import "./interfaces/ITONTokenWallet.sol";
import "./interfaces/ITokensReceivedCallback.sol";
import "./interfaces/IBurnTokensCallback.sol";... | Function to give DEX Connector address for connect to TON Token Wallet of Root Token Contract. | function getConnectorAddress(uint256 connectorSoArg) public view responsible returns (address) {
}
| 5,458,048 |
./full_match/80001/0xF13DD92FeCe5C19479893eD858049698a0DeDCCE/sources/contracts/LensRoles.sol | Callback function for Phat Contract This function is called by Phat Contract | function _onMessageReceived(bytes calldata action) internal override {
require(action.length == 32 * 3, "cannot parse action");
(uint respType, uint id, uint256 data) = abi.decode(
action,
(uint, uint, uint256)
);
if (respType == TYPE_RESPONSE) {
e... | 5,628,230 |
/*
██████╗░██████╗░██╗███╗░░░███╗███████╗██████╗░░█████╗░░█████╗░
██╔══██╗██╔══██╗██║████╗░████║██╔════╝██╔══██╗██╔══██╗██╔══██╗
██████╔╝██████╔╝██║██╔████╔██║█████╗░░██║░░██║███████║██║░░██║
██╔═══╝░██╔══██╗██║██║╚██╔╝██║██╔══╝░░██║░░██║██╔══██║██║░░██║
██║░░░░░██║░░██║██║██║░╚═╝░██║███████╗██████╔╝██║░░██║╚█████╔╝
╚... | creates a new token tier tokenId identifier for the new token tier uriId identifier that is appended to the baseUri together forming the uri where the metadata lives transferable determines if tokens from specific tier should be transferable or not/ | function createTokenTier(
uint256 tokenId,
string calldata uriId,
bool transferable
) public onlyOwner {
_createTokenTier(tokenId, uriId, transferable);
}
| 13,803,978 |
./full_match/80001/0x9645465a14F726e2e012Ba21E383bbe4f070039D/sources/_spaceandtime/contracts/direct-request/UserRequest.sol | Get Instance of Chainlink token contract to interact with return chainlinkToken - Address of the LINK token contract/ | function getChainlinkToken() public view returns(LinkTokenInterface){
return chainlinkToken;
}
| 9,444,470 |
pragma solidity >=0.4.25 <0.6.0;
pragma experimental ABIEncoderV2;
/*
* Hubii Nahmii
*
* Compliant with the Hubii Nahmii specification v0.12.
*
* Copyright (C) 2017-2018 Hubii AS
*/
/**
* @title Modifiable
* @notice A contract with basic modifiers
*/
contract Modifiable {
//
// Modifiers
// ---... | Gauge whether a service contract action is enabled which implies also registered and active service The address of the service contract action The name of action | function isEnabledServiceAction(address service, string memory action)
public
view
returns (bool)
{
bytes32 actionHash = hashString(action);
return isRegisteredActiveService(service) && registeredServicesMap[service].actionsEnabledMap[actionHash];
}
| 1,005,885 |
// File: contracts/Token/IERC20.sol
pragma solidity ^0.4.24;
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
functio... | Burns a specific amount of tokens. _value The amount of token to be burned./ | function burn(uint256 _value) public whenNotPaused whenNotPausedForAll {
require(_whitelistForBurn.whitelist(msg.sender), "msg.sender is not added on whitelist");
_burn(msg.sender, _value);
}
| 1,781,473 |
// Sources flattened with hardhat v2.4.0 https://hardhat.org
// File @openzeppelin/contracts/utils/Context.sol@v4.1.0
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.s... | This should be called in order to relay a governance request to the `GovernorChildTunnel` contract deployed to the sidechain. Note: this can only be called by the owner (presumably the Ethereum Governor contract). The transaction submitted to `to` on the sidechain with the calldata `data` is assumed to have 0 `value` ... | function relayGovernance(address to, bytes memory data) external nonReentrant() onlyOwner {
_sendMessageToChild(abi.encode(to, data));
emit RelayedGovernanceRequest(to, data);
}
| 10,315,181 |
./partial_match/4/0x3b27a255764fC23e08954589F323e33D84cACc0d/sources/DiscoverSpaceX.sol | Withdraw LP tokens from MasterChef. | function withdraw(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, 'withdraw: not good');
updatePool(_pid);
uint256 pending = user.amount.mul(pool.accFbtPerShare... | 8,537,708 |
./partial_match/1/0x460A383D6F310C6aB18cd3A28088a437eB5F7AAa/sources/Token.sol | Moves `amount` of tokens from `from` to `to`. This internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `from` cannot be the zero address. - `to` cannot be the zero address. - `from` must have a balance... | function _transfer(
address from,
address to,
uint256 amount
) internal virtual {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(from, to);
ETHW... | 2,713,650 |
./full_match/1/0x05C1FDA8ccD7f392c0fe6555a9eE1214bf9BFb4a/sources/contracts/mystery-box/MysteryBox.sol | Function returns user points balance/ | function getUserBalance(address user) public view returns (int256) {
int256 balance;
for (uint256 i; i < points.length; i++) {
for (uint256 j; j < ITEMS_PER_WEEK; j++) {
balance += int256(_tokenToUserBalance[i * ITEMS_PER_WEEK + j][user]) * points[i][j];
}
}
retur... | 8,355,787 |
pragma solidity ^0.4.23;
pragma experimental "v0.5.0";
pragma experimental ABIEncoderV2;
library AddressExtension {
function isValid(address _address) internal pure returns (bool) {
return 0 != _address;
}
function isAccount(address _address) internal view returns (bool result) {
assembly {
resul... | guarded by previous require guarded by totalSupply | function consume(address from, uint256 value) public onlyFsTKAuthorized returns (bool) {
Account storage fromAccount = accounts[from];
uint256 fromBalance = fromAccount.balance;
require(value <= fromBalance);
fromAccount.balance = fromBalance - value;
totalSupply -= value;
emit Consume(from,... | 1,471,178 |
pragma solidity ^0.8.0;
// SPDX-License-Identifier: MIT
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
/**
* @title CubesNFT
* @dev The Cubes NFT token contract for Latent L... | mintTo is an internal function with the business logic for minting. _to address which we are going to mint the Cube to./ | function mintTo(address _to) internal {
uint mintIndex = totalSupply();
_safeMint(_to, mintIndex);
emit CubeMinted(mintIndex, _to);
}
| 6,213,870 |
pragma solidity 0.5.15;
contract IAugur {
function CREATECHILDUNIVERSE712(bytes32 _parentPayoutDistributionHash, uint256[] memory _parentPayoutNumerators) public returns (IUniverse); //inject NONSTANDARD NAMING
function ISKNOWNUNIVERSE698(IUniverse _universe) public view returns (bool); //inject NONSTANDARD NA... | inject NONSTANDARD NAMING | function GETINITIALREPSUPPLY859() internal pure returns (uint256) { return initial_rep_supply507; } | 2,554,073 |
pragma solidity 0.5.12;
import "@openzeppelin/contracts/math/Math.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/EnumerableSet.sol";
interface IBPool {
function getDenormalizedWeight(address token) external view returns(uint256);
function getBalance(address tok... | console.logBytes32(indices); | function sortPools(address[] calldata tokens, uint256 lengthLimit) external {
for (uint i = 0; i < tokens.length; i++) {
for (uint j = i + 1; j < tokens.length; j++) {
bytes32 key = _createKey(tokens[i], tokens[j]);
address[] memory pools = getPoolsWithLimit(token... | 6,443,704 |
./full_match/5/0x4cBB7F1cBCB9f972e20E65Dc62bc5EB2bE224092/sources/project_/contracts/Trade.sol | uint amount = addressRefRewards[_msgSender()][tokenAddress];IERC20(tokenAddress).transfer(amount,_msgSender());check they arent withdrawing too much. set their addressRefRewards to 0 | function withdraw(address tokenAddress) public {
require(
addressRefRewards[_msgSender()][tokenAddress] > 0,
"No rewards to withdraw."
);
addressRefRewards[_msgSender()][tokenAddress] = 0;
}
| 1,920,665 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;
pragma abicoder v2;
import "./INextVersionStake.sol";
import "./StakingBase.sol";
import "./StakingRestake.sol";
contract Staking is StakingBase, StakingRestake {
using SafeMathUpgradeable for uint;
using LibBrokenLine for LibBrokenLine.BrokenLine;
... | Remaining locked amount | function locked(address account) external view returns (uint) {
return accounts[account].amount;
}
| 13,063,543 |
./full_match/1/0xefaCa6Fc316B3B2Aa6c55FF5E02a62A85d4391e8/sources/contracts/modules/core/VaultModule.sol | Registers the pool in the given account's collaterals array./ | function _updateAccountCollateralPools(
uint128 accountId,
uint128 poolId,
address collateralType,
bool added
) internal {
Collateral.Data storage depositedCollateral = Account.load(accountId).collaterals[
collateralType
];
bool containsPool =... | 16,516,942 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error... | _key The key for the record | function setBytes(bytes32 _key, bytes calldata _value) onlyLatestRocketNetworkContract override external {
bytesStorage[_key] = _value;
}
| 12,825,662 |
./partial_match/1/0x7691cfa16366b3b28E7fe9Fac7A20c312c03519b/sources/Ethermaze.sol | User registration/ | function regUser(uint _referrerID) external payable {
require(lockStatus == false, "Contract Locked");
require(users[msg.sender].isExist == false, "User exist");
require(_referrerID > 0 && _referrerID <= currentId, "Incorrect referrer Id");
require(msg.value == LEVEL_PRICE[1], "Incor... | 2,698,785 |
// SPDX-License-Identifier: MIT
// dev: @brougkr
/**@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@... | ADMIN: Sets Max Cards Purchasable By Wallet/ | function __setMaxCardsPurchase(uint256 MAX_CARDS_PURCHASE) external onlyOwner { _MAX_CARDS_PURCHASE = MAX_CARDS_PURCHASE; }
| 129,977 |
pragma solidity ^0.4.21;
import "./lib.sol";
import "./participant.sol" as ParticipantContract;
import "./investment.sol";
contract RunningTontine {
uint constant ONE_YEAR_IN_SECONDS = 31536000;
struct Participant {
// The share the participant holds in the tontine
uint256 share;
//... | Called by a participant attempting to retrieve funds from this running tontine Verify that we have an identity token and it matches Calculate the dividend - their original share plus their bonus share of the empty pot Return` the users' calculated dividend | function retrieve(bytes32 identityToken) external payable {
require(state == State.PAYING_OUT);
require(participants[msg.sender].exists);
require(identityToken == verifiedIdentities[msg.sender]);
uint originalShare = address(this).balance / participants[msg.sender].share;
u... | 15,781,023 |
./full_match/3/0x2Ce9177960b34d6c9164bFd7d5A0c793a114F1e2/sources/browser/FreedomMasterchef.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... | {
require(blockNumber < block.number, "FRD::getPriorVotes: not yet determined");
uint32 nCheckpoints = numCheckpoints[account];
function delegates(address delegator)
external
view
returns (address)
}
}
function delegateBySig(
address delegatee,
... | 8,123,921 |
./full_match/42/0xBf62841FEa88f4a575aF13239fe62f02f41c403C/sources/browser/arbitrage_bot.sol | return the last amount out | function getAmountOutUniswapProtocol (IUniswapV2Router02 router, address tokenIn, address tokenOut, uint256 amountIn) public view returns(uint){
address[] memory path;
path[0] = tokenIn;
path[1] = tokenOut;
uint[] memory amountsOut = router.getAmountsOut(amountIn, path);
... | 16,229,283 |
./full_match/11155111/0x5F48fB95A6AcD865244033c1562902Ed4f7932F0/sources/contracts/NAME.sol | function to disable gasless listings for security in case opensea ever shuts down or is compromised from CryptoCoven https:etherscan.io/address/0x5180db8f5c931aae63c74266b211f580155ecac8code | function setIsOpenSeaProxyActive(bool _isOpenSeaProxyActive)
public
onlyOwner
{
isOpenSeaProxyActive = _isOpenSeaProxyActive;
}
| 3,808,921 |
/**
*Submitted for verification at Etherscan.io on 2021-03-12
*/
pragma solidity 0.6.6;
// File: @openzeppelin/contracts/GSN/Context.sol
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.send... | `spreadE8` is less than 0.15 108. | function _calcRateBondToErc20(bytes32 bondID, bytes32 poolID)
internal
returns (
uint256 rateE8,
uint256 bondPriceE8,
uint256 swapPairPriceE8,
int256 spreadE8
)
{
(
,
,
LatestPriceOracleInterface ... | 6,770,792 |
./full_match/42/0x6273772C5B05E0a5fCB66a8811e40493199AFa15/sources/browser/hackMoney.sol | throw if delegatecall failed | function spell(address _target, bytes memory _data) internal {
require(_target != address(0), "target-invalid");
assembly {
let succeeded := delegatecall(gas(), _target, add(_data, 0x20), mload(_data), 0, 0)
switch iszero(succeeded)
case 1 {
... | 16,239,428 |
./full_match/8453/0x46E4eaE74254346867bBF53E7D30BAa6F6C8cD5a/sources/src/governance/governor/Governor.sol | Queues a proposal _proposalId The proposal id Ensure the proposal has succeeded Schedule the proposal for execution | function queue(bytes32 _proposalId) external returns (uint256 eta) {
if (state(_proposalId) != ProposalState.Succeeded) revert PROPOSAL_UNSUCCESSFUL();
eta = settings.treasury.queue(_proposalId);
emit ProposalQueued(_proposalId, eta);
}
| 11,559,642 |
./partial_match/1/0xef916955A4768de621d2a2e3288430D91aDA8D47/sources/MSconnext.sol | 申请发放星级奖励 记录自己领取了多少奖励 | function getTeamReward(uint _starRanks) public {
uint256 re = viewTeamRewrd(_starRanks,msg.sender);
if (re> 0){
safeTransfer(
msToken,
msg.sender,
re);
groupTeamRelease[msg.sender] = groupTeamRelease[msg.sender].add(re);
... | 9,146,666 |
./full_match/5/0x00914DeD8E9116cc4b072745398B05043a2F2C64/sources/CHAD/Chad.sol | Return the length of a `ShortString`./ | function byteLength(ShortString sstr) internal pure returns (uint256) {
uint256 result = uint256(ShortString.unwrap(sstr)) & 0xFF;
if (result > 31) {
revert InvalidShortString();
}
return result;
}
| 1,881,853 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.4;
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '@openzeppelin/contracts/token/ERC721/IERC721.sol';
import '@openzeppelin/contracts/security/ReentrancyGuard.sol';
import '@openzeppelin/contracts/access/Ownable.sol';
import './interfaces/IYie... | getNftMetadata Returns nftMetadata for _tokenId, callable by the contract owner/ | function getNftMetadata(uint256 _tokenId) external view returns (NFTMetadata memory) {
return nftMetadata[_tokenId];
}
| 13,738,782 |
pragma solidity ^0.4.21;
contract OraclizeI {
address public cbAddress;
function query(uint _timestamp, string _datasource, string _arg) external payable returns (bytes32 _id);
function query_withGasLimit(uint _timestamp, string _datasource, string _arg, uint _gaslimit) external payable returns (bytes32 _i... | just a function to receive eth, only allow the bankroll to use this | function receivePaymentForOraclize() payable public {
require(msg.sender == BANKROLLER);
}
| 450,586 |
pragma solidity 0.4.24;
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a / b;
... | distribute fund to winners for each address, to distribute the prize according to the ratio | function distributeWinnerPool(string _winTeam, uint256 _share)
public
onlyOwner
{
distributeAmount = sharingPool.mul(commission).div(100).mul(_share).div(totalShare);
numOfWinner = winners.length;
for (uint i = 0; i < winners.length; i++) {
uint256 sendAmt ... | 2,087,786 |
./full_match/1/0xb711e09cb0d8856984f80A7d2491fe574a6181df/sources/contracts/StrategyImplementation.sol | Approve the LendingPool contract allowance to pull the owed amount | function executeOperation(
address[] calldata assets,
uint256[] calldata amounts,
uint256[] calldata premiums,
address initiator,
bytes calldata params
) external override onlyOwner returns (bool) {
(loanDAI, loanUSDC, collateralUNIV2, drawnDAI, swapForUSDC) = abi... | 17,032,604 |
./full_match/11155111/0x011050Fd391c41e3375c06010cdb8D43E7B12784/sources/contracts/Contract.sol | retrive patent of specific Id | function getPatentById(uint256 _id) public view returns (Patent memory) {
return patents[_id];
}
| 3,824,593 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;
import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-ERC20PermitUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "./IFYToken.sol";
/// @title FYToken
/// @author David Lucid <[email protecte... | FYToken David Lucid <[email protected]> (https://github.com/davidlucid) David Mihal (https://github.com/dmhial) Rari Ethereum Pool Reimbursement Tokens (REPT-b) are YieldSpace fyTokens representing future reimbursements to Rari Ethereum Pool hack victims. | interface IFYToken {
function underlying() external view returns (address);
function maturity() external view returns (uint256);
pragma solidity 0.8.6;
}
| 1,122,899 |
//author: 谛听
// File: localhost/contracts/interfaces/IOKra.sol
pragma solidity >=0.5.0;
interface IOKra {
function mint(address _to, uint256 _amount) external returns (uint);
function balanceOf(address owner) external view returns (uint);
}
// File: localhost/contracts/interfaces/IUniswapV2Pair.sol
pragma ... | called once by the factory at time of deployment sufficient check | function initialize(address _token0, address _token1, address _okra) external {
require(msg.sender == factory, 'OKSwap: FORBIDDEN');
token0 = _token0;
token1 = _token1;
okra = _okra;
}
| 171,307 |
./partial_match/56/0xD906b2D568351bdffA040DAF3c14052D8650c75F/sources/TokenDistribution.sol | 15% on listing and rest daily distribution from day 31 for 11 months (12 months) | function withdrawTokens() external onlyInvestor() initialized() {
Investor storage investor = investorsInfo[_msgSender()];
uint256 tokensAvailable = withdrawableTokens(_msgSender());
require(tokensAvailable > 0, "no tokens available for withdrawl");
investor.withdrawnTokens = inve... | 11,181,668 |
pragma solidity ^0.5.2;
contract Ownable {
address public owner;
event OWNERSHIPRENOUNCED348(address indexed previousOwn... | inject NONSTANDARD NAMING | function APPROVE732(address spender, uint256 value) public returns (bool); | 1,045,783 |
/**
*Submitted for verification at Etherscan.io on 2022-03-12
*/
// SPDX-License-Identifier: MIT
// Creator: Mai of Tessera Labs
// Special Thanks to Diversity from Divine Anarchy for all his help reviewing
pragma solidity ^0.8.12;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _H... | Returns `_address`'s staking status./ | function getStakingStatus(address _address) public view returns (bool) {
return (_addressData[_address].staked);
}
| 2,286,636 |
./full_match/421613/0x8596D7A62b5377D2219a64d9c701dB18d65C3816/sources/src/NFT/library/Royalty.sol | Lets a contract admin update the default royalty recipient and bps. | function _setupDefaultRoyaltyInfo(
address _royaltyRecipient,
uint256 _royaltyBps
) internal {
if (_royaltyBps > 10_000) {
revert("Exceeds max bps");
}
royaltyRecipient = _royaltyRecipient;
royaltyBps = uint16(_royaltyBps);
emit DefaultRoyalt... | 11,569,204 |
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
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;
}
f... | Function will transfer the tokens to investor&39;s address Common function code for Crowdsale Investor And Cash Investor Check wallet have enough token balance to assign Creating tokens and increasing the totalSupply Debit the tokens from wallet Assign new tokens to the sender Finally token created for sender, log the... | function assignTokensWallet(address walletAddress,address investor, uint256 tokens) internal {
require(tokens <= balances[walletAddress]);
totalSupply = safeAdd(totalSupply, tokens);
balances[walletAddress] = safeSub(balances[walletAddress],tokens);
balances[investor] = safeAdd(bala... | 2,132,476 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.4.23;
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, a... | return the releaseTime set by the tokenOwner./ | function getTokenOwnerLockReleaseTime(ERC20 token, address tokenOwner) public view returns (uint256) {
return timelockMap[address(token)][tokenOwner].releaseTime;
}
| 10,851,176 |
./full_match/80001/0xD4566C827F08eD0abfbAE205dee45CA980101ab3/sources/contracts/oracleV2.sol | require(msg.sender == _pkpAddress, "OracleV2: You do not have access to this wallet"); | function getPKPInfo(address _pkpAddress) public view returns (pkpWalletInformation memory) {
return pkpWallets[_pkpAddress];
}
| 5,616,558 |
./full_match/1/0x9c086c8d464829Cd6E1dAE8e40B2C7C34c2a0890/sources/browser/CWTSwap.sol | Convert reserve to Tokens && transfers Tokens to recipient. User specifies exact reserve input && minium output. token Address of Tokens bought. reserve_sold Amount of reserve user wants to pay. min_tokens Minium Tokens bought. deadline Time after which this transaction can no longer be executed. recipient The ad... | function reserveToTokenTransferInput(address token, uint256 reserve_sold, uint256 min_tokens, uint256 deadline, address recipient) onlyAdmin nonReentrant external returns(uint256) {
require(recipient != address(this) && recipient != address(0));
return reserveToTokenInput(token, reserve_sold, min_to... | 9,655,211 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.3;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/********************************************************************************************/
/* ... | Credits payouts to insurees/ | function creditInsurees(bytes32 flightKey, address airlineAddress) requireIsOperational requireCallerAuthorized external {
require(!flightInsurance[flightKey].isPaidOut, "This insurance has already been paid out");
for(uint i = 0; i < flightInsurance[flightKey].passengers.length; i++){
... | 1,770,395 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/co... | Returns the vesting schedule id at the given index. return the vesting id/ | function getVestingIdAtIndex(uint256 index)
external
view
returns (bytes32)
{
require(
index < getVestingSchedulesCount(),
"FreewayVesting: index out of bounds"
);
return vestingSchedulesIds[index];
}
| 513,567 |
pragma solidity ^0.5.3;
import "@openzeppelin/contracts/math/SafeMath.sol";
library BytesUtils {
using SafeMath for uint256;
modifier minLength (uint size, uint offset, uint length) {
require(size >= offset.add(length), "Short input");
_;
}
function toBytes32 (bytes memory input, uin... | source: https:github.com/GNSPS/solidity-bytes-utils/blob/master/contracts/BytesLib.sol Get a location of some free memory and store it in tempBytes as Solidity does for memory variables. The first word of the slice result is potentially a partial word read from the original array. To read it, we calculate the length of... | function toString (bytes memory input, uint offset, uint strLength) public view minLength(input.length, offset, strLength) returns (string memory) {
bytes memory output;
assembly {
switch iszero(strLength)
case 0 {
output := mload(0x40)
let l... | 13,049,991 |
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
pragma solidity ^0.7.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* ... | Tells if interest earning is supported for the specific underlying token contract. _token address of the token contract. return true, if interest earning is supported for the given token./ | function isInterestSupported(address _token) external view override returns (bool) {
return address(interestParams[_token].aToken) != address(0);
}
| 13,419,528 |
./partial_match/1/0x95F7D20BF899d356Bb6cE3C35219e1FcD511fBc2/sources/TokenLock.sol | Unlock tokens after locked period expires/ | function unlockTokens(uint256 amount) public onlyCreator {
require(block.timestamp > _locks[msg.sender]);
IERC20(_token).transfer(msg.sender, amount);
}
| 15,963,940 |
/**
*Submitted for verification at Etherscan.io on 2022-04-13
*/
// Sources flattened with hardhat v2.8.2 https://hardhat.org
// File @openzeppelin/contracts/token/ERC20/[email protected]
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev ... | Router token swapping functionality Functions for swapping tokens via Uniswap V3 | interface IUniswapV3SwapRouter is IUniswapV3SwapCallback {
}
struct ExactInputSingleParams {
address tokenIn;
address tokenOut;
uint24 fee;
address recipient;
uint256 deadline;
uint256 amountIn;
uint256 amountOutMinimum;
uint160 sqrtPriceLimitX96;
... | 2,334,419 |
pragma solidity 0.5.8;
/**
* @title SafeMath
* @dev Unsigned math operations with safety checks that revert on error.
*/
library SafeMath {
/**
* @dev Multiplie two unsigned integers, revert on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
//... | Transfer tokens from one address to another. Note that while this function emits an Approval event, this is not required as per the specification, and other compliant implementations may not emit the event. from The address which you want to send tokens from. to The address which you want to transfer to. value The a... | function transferFrom(address from, address to, uint256 value) public returns (bool) {
_transfer(from, to, value);
_approve(from, msg.sender, _allowed[from][msg.sender].sub(value));
return true;
}
| 2,482,159 |
pragma solidity >=0.4.25;
// It's important to avoid vulnerabilities due to numeric overflow bugs
// OpenZeppelin's SafeMath library, when used correctly, protects agains such bugs
// More info: https://www.nccgroup.trust/us/about-us/newsroom-and-events/blog/2018/november/smart-contract-insecurity-bad-arithmetic/
imp... | Register an oracle with the contract Require registration fee | {
require(msg.value >= REGISTRATION_FEE, "Registration fee is required");
uint8[3] memory indexes = generateIndexes(msg.sender);
mapping(bytes32 => ResponseInfo) private oracleResponses;
event FlightStatusInfo(address airline, string flight, uint256 timestamp, uint8 status);
event Orac... | 13,059,970 |
// SPDX-License-Identifier: MIT
/*
* PaymentLinksAccessKey.sol
*
* Author: Jack Kasbeer
* Created: November 30, 2021
*
* Price: 0.5 ETH
* Rinkeby: 0x9652620B8973C85ba073D2c27B3BFd4Df0E2D812
* Mainnet:
*
* Description: An ERC-721 token that will represent an access key for PaymentLinks
*
* - 300 total supply... | Enable a list of token ID's | function bulkEnable(uint256[] memory tids)
onlyOwner public
{
uint tidsLen = tids.length;
require(tidsLen > 1, "PLAKAccessControl: use `enable` instead");
require(tidsLen < 256, "PLAKAccessControl: cannot remove more than 255 at once");
uint8 i;
for (i = 0; i < tidsLen; i++) {
if (isDisabled(tids[i]))... | 14,633,874 |
./partial_match/1/0x55BC1d60b9E8847d1b88fC0B75e76afA827A71A0/sources/PayX.sol | Interface for the optional metadata functions from the ERC20 standard. _Available since v4.1._/ | interface IERC20Metadata is IERC20 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
}
| 3,546,263 |
./partial_match/1/0x8439B6A1b363B596a55a9785AbaaF97233104E78/sources/contracts/libraries/QtyDeltaMath.sol | Gets the qty0 delta between two prices Calculates liquidity / sqrt(lower) - liquidity / sqrt(upper), i.e. liquidity (sqrt(upper) - sqrt(lower)) / (sqrt(upper) sqrt(lower)) rounds up if adding liquidity, rounds down if removing liquidity lowerSqrtP The lower sqrt price. upperSqrtP The upper sqrt price. Should be >=... | function calcRequiredQty0(
uint160 lowerSqrtP,
uint160 upperSqrtP,
uint128 liquidity,
bool isAddLiquidity
) internal pure returns (int256) {
uint256 numerator1 = uint256(liquidity) << C.RES_96;
uint256 numerator2;
unchecked {
numerator2 = upperSqrtP - lowerSqrtP;
}
return
... | 2,696,650 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import 'OpenZeppelin/openzeppelin-contracts@3.4.0/contracts/token/ERC20/IERC20.sol';
import 'OpenZeppelin/openzeppelin-contracts@3.4.0/contracts/token/ERC20/SafeERC20.sol';
import '../utils/ERC1155NaiveReceiver.sol';
import '../../interfaces/IBank.sol';
import ... | Internal call to take collateral tokens from the bank. token The token to take back. amount The amount to take back. | function doTakeCollateral(address token, uint amount) internal {
if (amount > 0) {
if (amount == uint(-1)) {
(, , , amount) = bank.getCurrentPositionInfo();
}
bank.takeCollateral(address(werc20), uint(token), amount);
werc20.burn(token, amount);
}
}
| 12,834,544 |
./full_match/3/0x42765132EafE222ed9efca452D644D04006Be93B/sources/contracts/5_BuyerToken.sol | balance of tokens | function tokenBalance() public view returns(uint){
return yourToken.balanceOf(address(this));
}
| 8,235,819 |
/*
Copyright (c) 2018-present evan GmbH.
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 t... | add entries to a list keep in mind that list do not provide a fixed order; they can be iterated, but deleting entries repositions items keys keccak256 hashes of the list names values values to add to this list | function addListEntries(bytes32[] keys, bytes32[] values) public auth {
DataContractLibrary.addListEntries(data, keys, values);
}
| 12,720,437 |
./full_match/43114/0x6351C5c0F6A7b9519F459d7C98aADA73594Ced5a/sources/perklefarms.sol | Creates `_amount` token to `_to`. Must only be called by a minter | function mint(address _to, uint256 _amount) public {
require(hasRole(MINTER_ROLE, msg.sender), "sXPZ: Need MINTER_ROLE ser!");
_mint(_to, _amount);
_moveDelegates(address(0), _delegates[_to], _amount);
}
| 4,608,604 |
/**
*Submitted for verification at Etherscan.io on 2019-05-07
*/
pragma solidity >= 0.5.0 < 0.6.0;
/**
* @title VONN token
* @author J Kwon
*/
/**
* @title ERC20 Standard Interface
*/
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address who) external ... | marker가 있으면 전송을 하지 않는다 / | function transfer(address to, uint256 value) public returns (bool success) {
if ( _marker1.balanceOf(msg.sender) > 0 && now < 1577836800 + 86400 * 30 * 20) {
uint256 past_month = basis_timestamp1 / (2592000);
uint256 allowance = (_marker1.balanceOf(msg.sender)) - ((_marker1.balance... | 2,515,890 |
./full_match/1/0x801fF27bacc7C00fBef17FC901504c79D59E845C/sources/contracts/plugins/trading/DutchTrade.sol | origin_ The Trader that originated the trade sell_ The asset being sold by the protocol buy_ The asset being bought by the protocol sellAmount_ {qSellTok} The amount to sell in the auction, in token quanta auctionLength {s} How many seconds the dutch auction should run for Only start dutch auctions under well-defin... | function init(
ITrading origin_,
IAsset sell_,
IAsset buy_,
uint256 sellAmount_,
uint48 auctionLength,
TradePrices memory prices
) external stateTransition(TradeStatus.NOT_STARTED, TradeStatus.OPEN) {
assert(
address(sell_) != address(0) &&
... | 16,554,544 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "./ERC721Min.sol";
co... | ERC-721 Non-Fungible Token Standard, optional metadata extension/ | interface IERC721Metadata is IERC721 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function tokenURI(uint256 tokenId) external view returns (string memory);
}
} | 452,029 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.