file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./full_match/421613/0x1F332433970CE0B009a2aa6c211a6bbCC2886408/sources/src/Bank/Bank.sol | Check if the token has the 0x address. token Address of the token. return Whether the token's address is the 0x address. | function _isGasToken(address token) private pure returns (bool) {
return token == address(0);
}
| 11,573,744 |
//solium-disable linebreak-style
pragma solidity ^0.4.24;
library ExtendedMath {
function limitLessThan(uint a, uint b) internal pure returns(uint c) {
if (a > b) return b;
return a;
}
}
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function m... | Add a user as masternode. Called as internal since we only add masternodes by depositing collateral or by voting. _candidate Candidate address return uint Masternode index/ | function addMasternode(address _candidate) internal returns(uint) {
userByIndex[masternodeCounter].accountOwner = _candidate;
userByIndex[masternodeCounter].isActive = true;
userByIndex[masternodeCounter].startingRound = masternodeRound + 1;
userByIndex[masternodeCounter].storedIndex... | 6,632,815 |
./full_match/1/0xbb6EE8bE110602a05F268AcCFC46d55bd87DFB82/sources/src/steth/scUSDCv2.sol | Returns the USDC balance of the vault./ | function usdcBalance() public view returns (uint256) {
return asset.balanceOf(address(this));
}
| 9,766,052 |
./full_match/420666/0xC6a96B0280B2b87828B574Edc3bE92fF499A3356/sources/FrogSwapRouter01.sol | SWAP requires the initial amount to have already been sent to the first pair | function _swap(uint[] memory amounts, address[] memory path, address _to) private {
for (uint i; i < path.length - 1; i++) {
(address input, address output) = (path[i], path[i + 1]);
(address token0,) = FrogSwapLibrary.sortTokens(input, output);
uint amountOut = amounts[i... | 16,369,084 |
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity ^0.7.5;
import "./libraries/SafeMath.sol";
import "./libraries/SafeERC20.sol";
import "./interfaces/IOwnable.sol";
import "./interfaces/IERC20.sol";
import "./interfaces/IERC20Metadata.sol";
import "./interfaces/IERC721.sol";
import "./interfaces/IFLOOR.so... | enable queued permission _index uint256/ 9 | function execute(uint256 _index) external {
require(timelockEnabled == true, "Timelock is disabled, use enable");
Queue memory info = permissionQueue[_index];
require(!info.nullify, "Action has been nullified");
require(!info.executed, "Action has already been executed");
r... | 13,790,537 |
./full_match/5/0xe679bd4247C507AA0c1C6411b631BA4f733a50D4/sources/contracts/SmokeStake.sol | temporarily getting time per hour | function getElapsedTime(uint256 _stakeId) private view returns (uint256) {
userStake memory userStakeDetails = userStakesById[_stakeId];
if (userStakeDetails.lastClaimedTime == 0) {
return lapsedHours;
return lapsedHours;
}
| 7,069,264 |
//SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.9.0;
import "@chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol";
import "@chainlink/contracts/src/v0.6/vendor/SafeMathChainlink.sol";
contract FundMe {
using SafeMathChainlink for uint256;
mapping(address =>... | 10000000000.000002927540000000 | function getConversionRate(uint256 ethAmount) public view returns(uint256){
uint256 ethPrice = getPrice();
uint256 ethAmountUsd = (ethPrice * ethAmount) / 1000000000000000000;
return ethAmountUsd;
}
| 7,246,335 |
./partial_match/7672/0x2D2C04254fEc8Dcb4f0476FDf98B7FF7b298E820/sources/lib/lsp-smart-contracts/contracts/LSP6KeyManager/LSP6KeyManagerCore.sol | @inheritdoc ILSP6KeyManager/ | function getNonce(address from, uint128 channelId) public view returns (uint256) {
uint256 nonceInChannel = _nonceStore[from][channelId];
return (uint256(channelId) << 128) | nonceInChannel;
}
| 3,492,707 |
pragma solidity ^0.4.24;
// produced by the Solididy File Flattener (c) David Appleton 2018
// contact : dave@akomba.com
// released under Apache 2.0 licence
// input /home/yingtong/peacebridge/solidityflattery/DepositContract.sol
// flattened : Friday, 05-Apr-19 05:40:40 UTC
library SafeMath {
function mul(uint256... | Decode an RLPItem into a byte. This will not work if the RLPItem is a list. self The RLPItem. return The decoded string. | function toByte(RLPItem memory self) internal constant returns (byte data) {
if(!isData(self))
revert();
var (rStartPos, len) = _decode(self);
if (len != 1)
revert();
uint temp;
assembly {
temp := byte(0, mload(rStartPos))
}
return byte(temp);
}
| 6,489,851 |
/**
*Submitted for verification at Etherscan.io on 2021-12-16
*/
/**************************************
╦╔╦╗╔╦╗╔═╗╦═╗╔╦╗╔═╗╦ ╔╦╗╔═╗╔╗╔╦╔═╔═╗
║║║║║║║║ ║╠╦╝ ║ ╠═╣║ ║║║║ ║║║║╠╩╗╚═╗
╩╩ ╩╩ ╩╚═╝╩╚═ ╩ ╩ ╩╩═╝ ╩ ╩╚═╝╝╚╝╩ ╩╚═╝
**************************************/
// Powered by NFT Artisans (nftartisans.io) - [email... | Remove a single address to the presale whitelist | function removeWhitelistAddress(address whitelistAddress) external onlyOwner {
_presaleWhitelist[whitelistAddress] = false;
}
| 6,519,604 |
./full_match/1/0x930AAD10a036b44708e9B371D284DA4a547B95AE/sources/browser/ETHERBOOBS.sol | Buy Video/ Try to send Ether to token, if there is no tokens left, run catch and send Ether to bounty | function buyVideo(uint index) public payable {
Video storage v = videos[index];
require(msg.value == v.price * 1 ether / ETHUSD, "Wrong amount");
{
}
v.contributors.push(msg.sender);
}
| 17,054,613 |
./full_match/1/0x5377c667acc68ea7cc5768D75388d7a97af5492c/sources/contracts/Phase2_LayerTokens.sol | allows owners to update light/dark mode check if caller is owner do the thing! | function toggleDarkMode(uint256 _tokenId) public
{
if(msg.sender != ownerOf(_tokenId)) revert YouDontOwnThisTokenThough();
TokenToDarkModeMap[_tokenId] = !TokenToDarkModeMap[_tokenId];
}
| 17,077,084 |
pragma solidity ^0.5.11;
contract Fall {
// create our enum with fall and winter in it and create a current season varible, will be set to 0 -> fall
enum Season {FALL, WINTER}
Season public currentSeason;
bool public colorfulLeaves;
// modifier that makes sure current season is the season we ... | set fall to winter, leaves are no longer colorful | function fallToWinter() external {
currentSeason = Season.WINTER;
colorfulLeaves = false;
}
| 1,816,516 |
./full_match/1/0x65f22AC6E16fCe4Ca3C8f8D7D18A602033769261/sources/contracts/vesting/Vesting.sol | Withdraws unused ASX tokens or othe tokens (including ETH) by an owner. _token A token to withdraw. If equal to zero address - withdraws ETH. _amount An amount of tokens for withdraw. _recipient A recipient of withdrawn tokens./ | function withdraw(
address _token,
uint256 _amount,
address _recipient
) external onlyOwner {
require(_recipient != address(0), "Vesting: invalid recipient address");
if (_token == address(0)) {
payable(_recipient).transfer(_amount);
IERC20(_token... | 17,174,008 |
/**
* Created on 2018-06-05 16:37
* @summary: Our NFT Minting Contract which inherits ERC721 capability from LSNFT
* @author: Fazri Zubair & Farhan Khwaja
*/
pragma solidity ^0.4.23;
pragma solidity ^0.4.23;
/* NFT Metadata Schema
{
"title": "Asset Metadata",
"type": "object",
"properties": {
... | Facilitates batch trasnfer of collectible, depending if batch is supported on contract. Checks for collectible 0,address 0 and then performs the transfer Batch SafeTransferFrom with multiple From and to Addresses _tokenIds The asset identifiers _fromB the address sending from _toB t... | function multiBatchSafeTransferFrom(
uint256[] _tokenIds,
address[] _fromB,
address[] _toB
)
public
{
require (isBatchSupported);
require (_tokenIds.length > 0 && _fromB.length > 0 && _toB.length > 0);
uint256 _id;
address _to;
... | 7,722,520 |
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
contract Adspot is ERC721URIStorage {
/// Todo: add an AdMarket Fee
/// Todo: Handle URL, NFT, Decentralised Storage?
/// Todo: Add information in AdSpot s... | Request a new ad in an Adspot by proposing an adURI (containing formatted ad information) and setting a balance | function request(uint256 adspotId, string memory adURI) public payable {
idToAdSpot[adspotId].requests.push(Request(msg.sender, adspotId, adURI, msg.value, Status(0), 0, 0));
requestsInAdspot[adspotId]++;
emit newRequest(adspotId, requestsInAdspot[adspotId]-1, msg.sender, adURI, msg.value);
}
| 15,828,597 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
import '@proof-of-residency/contracts/contracts/ProofOfResidency.sol';
contract HumanDAO {
ProofOfResidency private immutable _proofOfResidency;
constructor(address proofOfResidencyAddress) {
_proofOfResidency = ProofOfResidency(proofOfResidencyAddress)... | this should only be used in specific circumstances - there is a chance that a malicious actor could push the PoR DAO to challenge an honest user, in order to disenfranchise them in a downstream vote | function doesSenderHaveOutstandingTokenChallenge() private view returns (bool) {
return _proofOfResidency.tokenChallengeExists(msg.sender);
}
| 12,641,359 |
./full_match/80001/0xf2F9Dc580289FC127D88f6A6FeF19b0e3c99BBCd/sources/contracts/lib/SettlementTokenMath.sol | returns number converted between specified decimals | function convertTokenDecimals(
int256 amount,
uint8 fromDecimals,
uint8 toDecimals
) internal pure returns (int256) {
return
fromDecimals >= toDecimals
? amount.div(int256(10**(fromDecimals - toDecimals)))
: amount.mul(int256(10**(toDec... | 9,454,116 |
// SPDX-License-Identifier: MIT
// _ ______________ ____________
// / | / / ____/_ __/__ / ____/ ____/_________ ____ ___
// / |/ / /_ / / / _ \/ / __/ / __ / ___/ __ \/ __ `__ \
// / /| / __/ / / / __/ /_/ / /_/ // /__/ /_/ / / / / / /
// /_/ |_/_/ /_/ \___/\____/\_... | Used to recover a stuck token using the safe transfer function of ERC721./ | function recoverERC721Safe(address token, address recipient, uint256 tokenId) external onlyOwner {
return IERC721(token).safeTransferFrom(address(this), recipient, tokenId);
}
| 1,094,354 |
./full_match/1/0x5eF6501044f39Cc5B55575eC0d6216817DE137D5/sources/browser/CertOwnable.sol | Transfers control of the contract to a newOwner. _newOwner The address to transfer ownership to./ | function _transferOwnership(address _newOwner) internal {
require(
_newOwner != address(0),
"CertOwnable: New owner must have a valid address"
);
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
| 16,495,922 |
./partial_match/1/0x76343dCEE4d5F5DCCEE300Bd70668978c088D78D/sources/StakingforNFT.sol | NOTE: SERGS contract has 2.5% fees.... SERGS contract will send balance cutting 2.5% fees | function stake(uint256 amount) external nonReentrant notPaused updateReward(msg.sender) {
require(amount > 0, "Cannot stake 0");
uint256 feeamount=amount.div(40);
uint256 remamount=amount.sub(feeamount);
_totalSupply = _totalSupply.add(remamount);
_balances[msg.send... | 4,103,118 |
pragma solidity ^0.4.24;
import "../common/SafeMathLib.sol";
import "../common/Manageable.sol";
import "./IProductStorage.sol";
/**@dev Contract that stores all products' data. Contains simple methods for retrieving and changing products */
contract ProductStorage is Manageable, IProductStorage {
using SafeM... | Returns total amount of purchase transactions for the given product / | function getTotalPurchases(uint256 productId)
public
view
returns (uint256)
{
return products[productId].purchases.length;
}
| 6,420,210 |
./full_match/10/0x8DE8895ddD702d9a216E640966A98e08c9228f24/sources/contracts/protocol/proxies/RigoblockPoolProxyFactory.sol | Returns whether an address is a contract. return Bool target address has code. | function _isContract(address target) private view returns (bool) {
return target.code.length > 0;
}
| 3,782,806 |
pragma solidity ^0.5.7;
pragma experimental ABIEncoderV2;
import "./SafeMath.sol";
import "./LibGlobals.sol";
import "./MatryxSystem.sol";
import "./MatryxPlatform.sol";
import "./MatryxForwarder.sol";
import "./IToken.sol";
import "./MatryxCommit.sol";
library LibTournament {
using SafeMath for uint256;
ui... | Updates the details of this tournament self Address of this Tournament sender msg.sender to the Tournament data Data struct on Platform tDetails New tournament details | function updateDetails(
address self,
address sender,
MatryxPlatform.Data storage data,
LibTournament.TournamentDetails memory tDetails
)
public
{
LibTournament.TournamentData storage tournament = data.tournaments[self];
require(sender == tournament.in... | 15,882,826 |
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);
... | Create `mintedAmount` tokens and send it to `target` target Address to receive the tokens mintedAmount the amount of tokens it will receive | function mintToken(address target, uint256 mintedAmount) onlyOwner public {
balances[target] = balances[target].add(mintedAmount);
totalSupply = totalSupply.add(mintedAmount);
emit Transfer(0, this, mintedAmount);
emit Transfer(this, target, mintedAmount);
}
| 7,327,804 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "../libraries/RewardsLib.sol";
import "../libraries/StorageLib.sol";
import "../interfaces/ILendingPoolAddressesProvider.sol";
import "../i... | no rewards-farmer for assets; transfer handled in SaveToken contract | function transfer(address recipient, uint256 amount)
external
override(IAsset)
returns (bool)
{
}
| 1,037,497 |
./partial_match/1/0xeec87a020D7e03271c310645a73Cb29bb83Ae1D2/sources/EthereumMessengers.sol | Store message instead of forwarding it. Can be forwarded, if ever needed, by calling `relayMessage`. .. seealso:: :sol:func:`relayMessage` | function sendMessage(
address,
bytes calldata message
) external restricted(block.chainid) {
bytes32 messageHash = keccak256(message);
require(
messageHashes[messageHash] != MessageStatus.DEFINED,
"Message is already registered"
);
require... | 4,487,988 |
./full_match/137/0xb5Ed30B4E899C47D4c68E319cd5c355aE6cb65ee/sources/contracts/PrimexTimelock.sol | Executes a transaction to the specified target with the given parameters. This function can only be called when the contract is not paused. Only callable by the EXECUTOR_ROLE role. target The address of the contract to execute the transaction on. value The amount of native tokens (in wei) to send along with the tran... | function execute(
address target,
uint256 value,
bytes calldata payload,
bytes32 predecessor,
bytes32 salt
) public payable override whenNotPaused {
super.execute(target, value, payload, predecessor, salt);
}
| 4,667,671 |
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
// ---... | Deregister the given accrual beneficiary beneficiary Address of accrual beneficiary to be deregistered Emit event | function deregisterBeneficiary(Beneficiary beneficiary)
public
onlyDeployer
notNullAddress(address(beneficiary))
returns (bool)
{
if (!super.deregisterBeneficiary(beneficiary))
return false;
address _beneficiary = address(beneficiary);
totalBeneficiaryFracti... | 1,005,928 |
./partial_match/42/0xd4980e33357F7B971e4a28EAB83B63Dd42985248/sources/Fortuna.sol | Kullanıcı geçen TC bloğun üçüncüsü anlamına geliyor.üçüncü yüzde 10 alır! | function getTCrewardsBack() public {
require(msg.sender == tcdetailz[dailyOLDMix(0)]._address || msg.sender == tcdetailz[dailyOLDMix(1)]._address || msg.sender == tcdetailz[dailyOLDMix(2)]._address);
uint256 _bnum = (block.number - genesisBlock)/BlockSizeForTC;
uint256 onepercentofamou... | 3,353,823 |
//SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
import "../../helpers/Ownable.sol";
import "../../interfaces/BEP20.sol";
import "./dtpl.sol";
contract TTPLDPoS is Ownable, BEP20("TESTPLE Deposit Proof of Stake", "TTPLDPoS", 18) {
event MetapleTokenDeployed (address metapleTokenAddress);
bool private i... | Check available MTPL DP for transfer | function mtpldpTransfer(address _to,uint256 _amount) external onlyOwner {
uint256 _mtplDpBal = mtpldp.balanceOf(address(this));
if(_mtplDpBal < _amount) {
mtpldp.transfer(_to, _mtplDpBal);
mtpldp.transfer(_to, _amount);
}
}
| 12,939,676 |
pragma solidity 0.5.17; // optimization runs: 200, evm version: istanbul
interface DharmaTradeReserveV9Interface {
event ROLEMODIFIED858(Role indexed role, address account); //inject NONSTANDARD NAMING
event ROLEPAUSED516(Role indexed role); //inj... | inject NONSTANDARD NAMING | function GETADJUSTER715() external view returns (address adjuster); | 12,960,405 |
// --------------------------------
// Smart Contract for tot666.finance
// Twitter: https://twitter.com/tot666finance
// Telegram: https://t.me/tot666finance
// Website: https://tot666.finance
// Email: contact@tot666.finance
// Medium: https://tot666finance.medium.com/tot-finance-6b389add27e9
// ---------------------... | Triggers on every transfer Gets balance of sender, makes sure value being sent is <= their balancerequire(amount <= _balances[sender]);require(amount <= _allowances[sender][_msgSender()]); Checks that it's not the burn address Deployer Transaction (So that transactions made my deployer don't get tricked / treated) Subt... | function _transfer(address sender, address recipient, uint256 amount) internal requestGas
{
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
if (_isWhitelisted(sender, recipient))
{
... | 15,221,521 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
import "./ERC721.sol";
contract RealEstateBidding is ERC721 {
// struct for each bid
struct Bid {
address bidAddress;
uint256 bidAmount;
}
//Struct for each bid process
struct SingleBidProcess {
address realtor;
... | function to place realstate on market by realtorcheck if token existscheck if sender is the assigned realtorchange on market to true on bidProcess struct | function putOnMarket(uint256 tokenId) public {
require(
msg.sender == allBids[tokenId].realtor,
"RealStatebidding: Only assigned realtor can call this function."
);
allBids[tokenId].onMarket = true;
if (!inMarket[tokenId]) {
inMarket[tokenId] = tru... | 1,801,627 |
pragma solidity =0.6.6;
/*
* CrystalFinance - Hybrid DeFi Model
*
* _____ _______ _______ _______ _
* / ____| __ \ \ / / ____|__ __|/\ | |
* | | | |__) \ \_/ / (___ | | / \ | |
* | | | _ / \ / \___ \ | | / /\ \ | |
* | |____| | \ \ | | ____) | | |/ _... | updates the staking vault address on contract deploy | function setStakingVaultAddress(address _address) external onlyOwner {
stakingVaultAddress = _address;
}
| 14,892,924 |
./partial_match/1/0x646Eb9B8E6bED62c0e46b67f3EfdEF926Fb9D621/sources/Whoopsies.sol | The following functions are operator filterer overrides. | function setApprovalForAll(address operator, bool approved) public override(ERC721, IERC721) onlyAllowedOperatorApproval(operator) {
super.setApprovalForAll(operator, approved);
}
| 9,235,054 |
./partial_match/42220/0xb2bFEd6dfd98fe8B3F1dDA71f1C42698Bf5dA326/sources/contracts/Badges.sol | Returns the badge ID for a given token/ | function badgeName(uint256 badgeId)
public
view
virtual
returns (string memory)
{
require(
badgeId <= _badgeIds.current(),
"ERC721Metadata: name query for nonexistent badge type"
);
return _badgeNames[badgeId];
}
| 3,496,902 |
/* solhint-disable no-mix-tabs-and-spaces */
/* solhint-disable indent */
pragma solidity 0.5.15;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ER... | Contribute Ether to offering. Blocks Offerer from contributing. May be exaggerated. if target Ether amount is raised, automatically transfers Ether to Offerer./ | function contribute() external payable {
require(
!_offeringCompleted,
"[contribute] Offering is complete"
);
require(
msg.value > 0,
"[contribute] Contribution requires ether"
);
require(
msg.value <= _contributionTargetInWei - _totalWeiContributed,
"[contribute] Ether value exceeds remain... | 10,635,834 |
./full_match/5/0xb9Bd0D26604357d6643801b30158A726a3F52a47/sources/_thirdweb-dev/contracts/base/Staking721Base.sol | Admin deposits reward tokens. | function depositRewardTokens(uint256 _amount) external payable nonReentrant {
}
| 1,961,975 |
./partial_match/4/0xE0F0C13373632Ca195075EBa391802097c3dB9d8/sources/NecroDolls.sol | Burn a NFT token. Callable by owner only./ | function burn(uint256 _tokenId) external onlyOwner {
uint8 necroIdBurnt = necroIds[_tokenId];
necroCount[necroIdBurnt] = necroCount[necroIdBurnt].sub(1);
necroBurnCount[necroIdBurnt] = necroBurnCount[necroIdBurnt].add(1);
_burn(_tokenId);
}
| 8,620,420 |
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity >=0.6.11;
import {BridgeMessage} from "./BridgeMessage.sol";
import {BridgeToken} from "./BridgeToken.sol";
import {IBridgeToken} from "../../interfaces/token-bridge/IBridgeToken.sol";
import {
XAppConnectionManager,
TypeCasts
} from "@celo-org/opt... | Initial details are set to a hash of the ID | function _deployToken(bytes29 _tokenId)
internal
typeAssert(_tokenId, BridgeMessage.Types.TokenId)
returns (address _token)
{
bytes32 _idHash = _tokenId.keccak();
_token = _createClone(tokenTemplate);
IBridgeToken(_token).setDetails(_idHash, _idHash, 18);
... | 12,713,256 |
pragma solidity ^0.5.0;
interface Token {
/// @return total amount of tokens
function totalSupply() external view returns (uint256 supply);
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) external view returns (uint256... | Enables token holders to transfer their tokens freely if true _enabledTransfer True if transfers are allowed in the clone | function enableTransfers(bool _enabledTransfer) public onlyAdmin {
enabledTransfer = _enabledTransfer;
}
| 13,098,827 |
pragma solidity ^0.5.0;
pragma experimental ABIEncoderV2;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when ... | Sets or unsets the approval of a given operator An operator is allowed to transfer all tokens of the sender on their behalf. to operator address to set the approval approved representing the status of the approval to be set/ | function setApprovalForAll(address to, bool approved) public {
require(to != _msgSender(), "ERC721: approve to caller");
_operatorApprovals[_msgSender()][to] = approved;
emit ApprovalForAll(_msgSender(), to, approved);
}
| 25,928 |
pragma solidity 0.5.17;
pragma experimental ABIEncoderV2;
interface IUniswap {
// To convert DAI to ETH
function SWAPEXACTTOKENSFORETH436(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external returns (uint[]... | inject NONSTANDARD NAMING | function MINT570(address receiver, uint256 amount) external payable returns (uint256 mintAmount); | 977,148 |
pragma solidity 0.5.16;
import "openzeppelin-solidity-2.3.0/contracts/ownership/Ownable.sol";
import "openzeppelin-solidity-2.3.0/contracts/token/ERC20/ERC20.sol";
import "openzeppelin-solidity-2.3.0/contracts/math/SafeMath.sol";
import "openzeppelin-solidity-2.3.0/contracts/math/Math.sol";
import "openzeppelin-solidit... | Reduce ETH reserve, effectively giving them to the depositors. value The number of ETH reserve to reduce. | function reduceReserve(uint256 value) external onlyOwner {
starGate = starGate.sub(value);
}
| 12,836,966 |
pragma solidity ^0.4.24;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity ... | This method can be used by the controller to extract mistakenly sent tokens to this contract. set to 0 in case you want to extract ether. | function claimTokens(address[] tokens) onlyOwner public {
address _token;
uint256 balance;
for(uint256 i; i<tokens.length; i++){
_token = tokens[i];
if (_token == 0x0) {
balance = address(this).balance;
if(balance > 0){
... | 10,097,711 |
//Arbitrum Proof-of-Burn contract
//Auctions Arbitrum Bitcoin(ArbiBTC) every 4 days and users are able to withdraw anytime after!
//All proceeds of auctions go back into the miners pockets, by going directly to the ArbitrumBitcoin Contract!
//21,000,000 Arbitrum Mineable Bitcoin are Auctioned off over 100 year... | Calculate Era emission | function getNextEraEmission() public view returns (uint) {
}
| 6,439,728 |
./partial_match/1/0xd3914a73367F8015070f073D5C69602F3a48B80D/sources/ConnectAaveMigrator.sol | _aaveData.rateModes[i] = getBorrowRateMode(aaveV1, tokens[i]); | function migrateUser(address userAccount, address[] calldata tokens) external payable {
require(DSAInterface(address(this)).isAuth(userAccount), "user-account-not-auth");
uint _length = tokens.length;
require(_length > 0, "0-tokens-not-allowed");
AaveV1Interface aaveV1 = AaveV1Inte... | 4,442,163 |
// File: openzeppelin-solidity/contracts/GSN/Context.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.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 shoul... | Used to remove an account from the allowed list that will skip the deflation for them. account Address for whom deflation is skipped./ | function removeAccountFromSkipDeflationList(address account) external onlyOwner {
require(account != address(0), "ERC20: Zero address not allowed");
skippedAccountFromDeflation[account] = false;
emit AccountRemovedFromSkipDeflationList(account);
}
| 10,235,411 |
./full_match/1/0xe65d63A9B4842c0dc0916aE5368356Ca0212f2CB/sources/contracts/modules/actions/ApproveAndSwap.sol | Executes a swap of ERC20 tokens using the specified router and amount, and returns the resulting state. tokenAddr The address of the ERC20 token to swap. amount The amount of tokens to swap. routerCallData The call data to use when interacting with the router./ | function executeSwapERC20(address tokenAddr, uint256 amount, bytes memory routerCallData) public {
_internalSwap(tokenAddr, amount, routerCallData);
emit SwapERC20Executed(tokenAddr, amount);
}
| 17,040,715 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
// For interacting with masterchef
interface IMasterchef {
// Transfer want tokens vault -> masterchef
function deposit(uint256 pid, uint256 _amount) external;
// Transfer want tokens masterchef -> vault
function withdraw(uint256 pid, uint25... | For interacting with masterchef Transfer want tokens vault -> masterchef Transfer want tokens masterchef -> vaultget the amount staked and reward debt for userEmergency withdraw from the pools leaving out any pending harvest | interface IMasterchef {
function deposit(uint256 pid, uint256 _amount) external;
function withdraw(uint256 pid, uint256 _amount) external;
function userInfo(uint256 _pid, address _address) external view returns (uint256, uint256);
function emergencyWithdraw(uint256 _pid) external;
} | 1,772,208 |
./full_match/5/0xA41423731b2B7AC3e61D7aD2D56043f83F67190D/sources/project:/contracts/TokenDistributor.sol | Withdraw staked tokens and compound pending rewards amount amount to withdraw/ Update pool Calculate pending rewards Adjust user information Adjust total amount staked Transfer SSC tokens to the sender | function withdraw(uint256 amount) external nonReentrant {
require(
(userInfo[msg.sender].amount >= amount) && (amount > 0),
"Withdraw: Amount must be > 0 or lower than user balance"
);
_updatePool();
uint256 pendingRewards = ((userInfo[msg.sender].amount * a... | 1,927,972 |
./partial_match/42/0xD089D9cBAa287476D4e9CB0475F373bf1c355270/sources/dex_bot.sol | approve alia & busd tokens IERC20 tok = IERC20(tokenA); require(tok.approve(address(uniswapRouter),amountADesired),"Approve failed"); IERC20 tok1 = IERC20(tokenB); require(tok1.approve(address(uniswapRouter),amountBDesired),"Approve failed"); uniswapRouter.addLiquidity(tokenA,tokenB,amountADesired,amountBDesired,minAmo... | function addLiquidity(address tokenA, address tokenB, uint256 amountADesired, uint256 amountBDesired) public returns
(uint256 minAmountA, uint256 minAmountB, uint256 deadline){
uint256 minAmountA = (SafeMath.mul(SafeMath.div(amountADesired,100000),5));
minAmountA = amountADesired.sub(minAmountA);
uint256... | 8,996,803 |
./full_match/1/0x9D6d4e2AfAB382ae9B52807a4B36A8d2Afc78b07/sources/contracts/PositionNFTs.sol | See {IERC721-getApproved}./ | function getApprovedSoft(
uint256 tokenId
)
external
view
returns (address)
{
if (_exists(tokenId) == false) {
return ZERO_ADDRESS;
}
return getApproved(
tokenId
);
}
| 8,488,279 |
./partial_match/42/0xD2E3619Ef1eCC37438668aB67AbdA90a9d9Cad93/sources/FeePool.sol | Address won't be able to claim fees if it is too far below the target c-ratio. It will need to burn pynths then try claiming again. Get the claimingAddress available fees and rewards Record the address has claimed for this period Record the fee payment in our recentFeePeriods Send them their fees Record the reward paym... | function _claimFees(address claimingAddress) internal returns (bool) {
uint rewardsPaid = 0;
uint feesPaid = 0;
uint availableFees;
uint availableRewards;
(bool feesClaimable, bool anyRateIsInvalid) = _isFeesClaimableAndAnyRatesInvalid(claimingAddress);
require(fees... | 3,430,839 |
/*
Copyright 2017 Loopring Project Ltd (Loopring Foundation).
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 a... | Check if this order needs to be completely filled | {
function validateAllOrNone(
Data.Order memory order
)
internal
pure
if(order.allOrNone) {
order.valid = order.valid && (order.filledAmountS == order.amountS);
}
}
| 13,002,502 |
pragma solidity ^0.6.2;
import "./ERC777GSN.sol";
import "./ERC777WithAdminOperatorUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
contract PToken is
Initializable,
AccessControlUpgradeabl... | Burn tokens from address token holder address amount uint256 amount of tokens to burn data bytes extra information provided by the token holder operatorData bytes extra information provided by the operator (if any)/ Update state variables | function _burn(
address from,
uint256 amount,
bytes memory data,
bytes memory operatorData
)
internal
virtual
{
require(from != address(0), "ERC777: burn from the zero address");
address operator = _msgSender();
_callTokensToSend(oper... | 21,396 |
./full_match/1/0x3E5294054EEE936673e89A88C88d2105612B4057/sources/contracts/utils/ShareCollateralToken.sol | if we minting or burning, Silo is responsible to check all necessary conditions make sure that _sender is solvent after transfer | function _afterTokenTransfer(address _sender, address _recipient, uint256 _amount) internal override {
ShareToken._afterTokenTransfer(_sender, _recipient, _amount);
if (_isTransfer(_sender, _recipient) && !silo.isSolvent(_sender)) {
revert SenderNotSolventAfterTransfer();
}
... | 17,110,796 |
./full_match/80001/0x05492385eb76A480e3E937febC192c109Eab962d/sources/StakingContract.sol | Get the NFT Calculate the referral percentages | function distributeRewardsroY(uint256 _id, address payable _to)
public
payable
{
NFT memory nft = NFT(_id, ownerOf(_id), nftReferrals[_id]);
uint256[5] memory referralAmounts;
uint256 referralId = nft.referralId;
for (uint256 i = 1; i <= 4; i++) {
if ... | 9,532,818 |
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
f... | set new dates for main-sale (emergency case) | function setIcoParameters(
uint256 _icoStartTime,
uint256 _icoEndTime,
uint256 _icoHardcap,
uint256 _icoMinimumWei
) public onlyOwner {
require(!isFinalized);
require(_icoStartTime < _icoEndTime);
require(_icoHardcap > 0);
icoStartTime = _icoStart... | 5,402,791 |
./partial_match/42/0x6AC74D11c6CE65590A33b19C0d0167A563FB2b03/sources/Staking.sol | if(minutes_staked > rewarded_minutes) rewarded_minutes = SafeMath.sub(minutes_staked,rewarded_minutes); else rewarded_minutes = SafeMath.sub(rewarded_minutes, minutes_staked); temp_var = SafeMath.add(temp_var, rewarded_minutes); if (SafeMath.sub(SafeMath.sub(now, stakedTime), temp_var) < 0) rewarded_minutes = stakedToW... | function monthlyAllocation(uint256 stakedTime) public {
rewarded_minutes = 0;
temp_var = 0;
poolShare = 0;
percentageShare = SafeMath.div(SafeMath.mul(stakes[msg.sender], 100), totalStakes());
minutesInOneMonth = 0;
for (uint256 i = 0; i < months; i++) {
... | 9,085,512 |
// 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... | Encodes message for transferring ERC721. Returns encoded message./ | function encodeTransferErc721MessageWithMetadata(
address token,
address receiver,
uint256 tokenId,
string memory tokenURI
) internal pure returns (bytes memory) {
TransferErc721MessageWithMetadata memory message = TransferErc721MessageWithMetadata(
TransferEr... | 1,152,552 |
./full_match/5/0x98061d960c2EaA127cB1921a6f912A2Ebb981Db4/sources/src/DonationHandler.sol | Withdraw full amount of token arrays token from the contract to msg.sender. _token Address array of the token | function withdrawMany(address[] calldata _token) external nonReentrant {
_withdrawAll(_token, msg.sender, msg.sender);
}
| 11,624,856 |
./full_match/3/0x791d2CBc728DC7D8fb702474c24D337a56505d85/sources/contracts/StoOk.sol | Store value in variable num value to store/ | function store(uint256 num) public {
number = num;
}
| 8,269,840 |
// File: contracts/ComptrollerInterface.sol
pragma solidity 0.5.17;
contract ComptrollerInterface {
/// @notice Indicator that this is a Comptroller contract (for inspection)
bool public constant isComptroller = true;
/*** Assets You Are In ***/
function enterMarkets(address[] calldata cTokens) exte... | Validates transfer and reverts on rejection. May emit logs. gToken Asset being transferred src The account which sources the tokens dst The account which receives the tokens transferTokens The number of gTokens to transfer/ Shh - currently unused Shh - we don't ever want this hook to be marked pure | function transferVerify(address gToken, address src, address dst, uint transferTokens) external {
gToken;
src;
dst;
transferTokens;
if (false) {
maxAssets = maxAssets;
}
}
| 598,594 |
./full_match/7700/0x5673e02a4C30ADB81dD61E220960B951F9259313/sources/contracts/CannonaroFactoryFlat.sol | Presale contributors can vest claimable tokens | function vest() external nonReentrant {
require(tokenHasLaunched, "Token has not launched, no vesting");
uint claimableAmount = amountClaimable(msg.sender);
require(claimableAmount > 0, "No tokens to vest");
presaleParticipant[msg.sender].amountClaimed += claimableAmount;
pre... | 4,654,459 |
/**
WPSmartContracts.com
Blockchain Made Easy
http://wpsmartcontracts.com/
*/
pragma solidity ^0.5.7;
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
int256 constant private INT256_MIN = -2**255;
/**
* @dev Multiplies two unsigned int... | Function to mint tokens to The address that will receive the minted tokens. value The amount of tokens to mint. return A boolean that indicates if the operation was successful./ | function mint(address to, uint256 value) public onlyMinter whenMintableActive returns (bool) {
_mint(to, value);
return true;
}
| 890,502 |
./partial_match/80001/0x74051B8501C673f7e38ccc9B0cb9c8361f9f34f6/sources/contracts/NonfungiblePositionManager.sol | @inheritdoc INonfungiblePositionManager allow collecting to the nft position manager address with address 0 trigger an update of the position fees owed and fee growth snapshots if it has any liquidity sometimes there will be a few less wei than expected due to rounding down in core, but we just subtract the full amount... | function collect(
CollectParams calldata params
) external payable override isAuthorizedForToken(params.tokenId) returns (uint256 amount0, uint256 amount1) {
require(params.amount0Max > 0 || params.amount1Max > 0);
address recipient = params.recipient == address(0) ? address(this) : para... | 8,797,393 |
pragma solidity ^0.4.24;
import "./token/ERC20.sol";
import "./lifecycle/Mintable.sol";
import "./lifecycle/Burnable.sol";
import "./lifecycle/Pausable.sol";
import "./lifecycle/Blacklistable.sol";
import "./lifecycle/Whitelistable.sol";
import "./math/SafeMath.sol";
/**
* @title TokenImpl
*
* @dev This contract i... | Mints new tokens to the given `_to` account. This function calls `Mintable._mint()` for minter limit logic, and emitting the Mint event. This function calls `ERC20._mint()` for balance/total supply logic, and emitting the Transfer event. Callable by an account with the minter role. to The account the tokens are being ... | function mint(address to, uint256 value, int256 mintId)
external
whenNotPaused
onlyMinter
notBlacklisted(msg.sender)
notBlacklisted(to)
returns (bool)
{
Mintable._mint(msg.sender, to, value, mintId);
ERC20._mint(to, value);
return true;
... | 12,835,509 |
// SPDX-License-Identifier: MIT
// Creator: Chiru Labs
pragma solidity ^0.8.0;
import '@openzeppelin/contracts/token/ERC721/IERC721.sol';
import '@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol';
import '@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol';
import '@openzeppelin/contracts/tok... | See {IERC721-getApproved}./ | function getApproved(uint256 tokenId) public view override returns (address) {
require(_exists(tokenId), 'AzukiNextGen: approved query for nonexistent token');
return _tokenApprovals[tokenId];
}
| 14,488,608 |
// SPDX-License-Identifier: MIT
pragma solidity >= 0.7.0 <= 0.8.1;
library ConvertLib {
// 1 eth = 1.000.000.000 Gwei = 1.000.000.000.000.000.000 (1e18) wei
// 1 eth = 100 XCoin => 1 XCoin = 10.000.000 Gwei =10.000.000.000.000.000 (1e16) wei
function convert(uint amount, uint conversionRate) public pure ... | Sum XCoin = 2000 => ?ETH rate 1000XCoin = 1ETH 2000 :1000 : 1 | function convertToETHRequireLending(uint amount, uint ratingLoanPerETH) public pure returns (uint convertedAmount)
{
uint ethRequire = convertETHToWei((amount / ratingLoanPerETH));
return ethRequire;
}
| 2,537,950 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;
pragma experimental ABIEncoderV2;
import "../balancer/BFactory.sol";
import "../libraries/SafeMathUint256.sol";
import "./AbstractMarketFactoryV3.sol";
import "../balancer/BNum.sol";
contract AMMFactory is BNum {
using SafeMathUint256 for uint256;
uint25... | Ensure tokenAmountOut is a multiple of shareFactor. Transfer undesired token balance back. | function sellForCollateral(
AbstractMarketFactoryV3 _marketFactory,
uint256 _marketId,
uint256 _outcome,
uint256[] memory _shareTokensIn,
uint256 _minSetsOut
) external returns (uint256) {
BPool _pool = pools[address(_marketFactory)][_marketId];
require(_p... | 12,875,577 |
pragma solidity ^0.4.24;
// File: contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event Ownership... | Admin functions only called by owner: Change the owner/ only the pending owner can change the ownership can only be changed one time raise the event change the ownership | function transferOwnerShipToPendingOwner() public {
require(msg.sender == pendingOwner);
require(owner != pendingOwner);
OwnershipTransferred(owner, pendingOwner);
owner = pendingOwner;
runPreMint();
initialTokenAmount = token.totalSupply();
}
| 572,259 |
pragma solidity ^0.5.8;
/**
@title An open source smart contract for a UBI token with demurrage that
gives control of the currency to the community.
@author The Value Instrument Team
@notice In the current form, the contract does not use a decentralised
approach to identification. It relies... | Approve the specified account to receive generation | function approveAccount(address _account)
external
onlyController
fused(7)
{
accountApproved[_account] = true;
lastGenerationBlock[_account] = block.number;
emit ApproveAccount(_account);
}
| 12,755,734 |
./full_match/1/0x41b84aea119E945f4C275BADA0eD38b8aFE864c8/sources/contracts/BalanceManagement.sol | Getter of the token balance of the current contract Use the "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE" address for the native token _tokenAddress The address of the token return The token balance of the current contract/ | function tokenBalance(address _tokenAddress) public view returns (uint256) {
if (_tokenAddress == Constants.NATIVE_TOKEN_ADDRESS) {
return address(this).balance;
return ITokenBalance(_tokenAddress).balanceOf(address(this));
}
}
| 17,168,969 |
./full_match/4/0xACc591fA8761FBC9a209160A8fcAEf7aF045f918/sources/dts.sol | Mints a new NFT./ | function bury(uint8 tokenAddressesIndex) public payable {
IERC20 token = IERC20(_tokenAddresses[tokenAddressesIndex]);
uint256 mintCost = 0;
mintCost = token.totalSupply()/1000000;
if(token.balanceOf(_burnAddress) > 0)
mintCost = mintCost + token.balanceOf(_burnAddress... | 763,642 |
pragma solidity ^0.4.18;
contract NBACrypto {
address ceoAddress = 0xD2f0e35EB79789Ea24426233336DDa6b13E2fA1f;
address cfoAddress = 0x831a278fF506bf4dAa955359F9c5DA9B9Be18f3A;
struct Team {
string name;
address ownerAddress;
uint256 curPrice;
}
Team[] teams;
modifier onlyCeo() {
... | This function will return only the addess of a specific team | function getTeamOwner(uint _teamId) public view returns(address) {
return(teams[_teamId].ownerAddress);
}
| 2,575,260 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.3;
/**
* @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, which is ... | bytes4(keccak256(bytes('approve(address,uint256)'))); | function safeApprove(address token, address to, uint256 value) internal {
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), 'safeApprove failed');
}
| 1,335,432 |
./full_match/1/0x35CB0fE6f49932A44f39934F47298E6D34680628/sources/contracts/pool/PoolMetadata.sol | Function returns current (with accrual) reserves value return Current reserves | function reserves() public view returns (uint256) {
return _accrueInterestVirtual().reserves;
}
| 17,111,266 |
/**
*Submitted for verification at Etherscan.io on 2021-10-07
*/
pragma solidity 0.5.17;
/**
* Utility library of inline functions on addresses
*/
library Address {
/**
* Returns whether the target address is a contract
* @dev This function will return false if invoked during the constructor of a con... | claim all the tokens to now return claim number this time ./ | function claim() public returns(uint256) {
require(_start > 0);
require(_beneficiary_total[msg.sender] > 0);
uint256 amount = calcvesting(msg.sender).sub(_released[msg.sender]);
if(amount > 0)
{
_released[msg.sender] = _released[msg.sender].add(amount);
... | 7,877,769 |
./full_match/4/0x030ae54417c3bb01C8f261128D4f3872F98deD63/sources/contracts/elements.sol | Spit higher mass to one mass | function split (uint256 _tokenId) external payable {
require( _exists(_tokenId), "nonexistent token" );
require(ownerOf(_tokenId)==msg.sender," token not owned");
NFTDetails memory tokenDetails= tokenInfo[_tokenId];
require( tokenDetails.mass>= 2 , "low mass" );
uint32 n... | 12,365,451 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
import "./NFTCBase.sol";
/**
* @title NFT Cult Wrapper Contract
*
* ███▄ █ █████▒▄▄▄█████▓ ▄████▄ █ ██ ██▓ ▄▄▄█████▓
* ██ ▀█ █ ▓██ ▒ ▓ ██▒ ▓▒ ▒██▀ ▀█ ██ ▓██▒▓██▒ ▓ ██▒ ▓▒
*▓██ ▀█ ██▒▒████ ░ ▒ ▓██░ ▒░ ▒▓█ ▄ ▓██ ▒█... | If there is no flavor URI, use default uri. | function tokenURI(uint256 tokenId)
public
view
virtual
override
returns (string memory)
{
require(_exists(tokenId), "No token");
string memory base = _baseURI();
require(bytes(base).length > 0, "Base unset");
uint256 tokenFlavor = _tokenFl... | 12,807,428 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/***
* _______ ______ _______ _ _ _______ _______
* |______ |_____/ |_____| |____/ | |_____| |
* | | \_ | | | \_ | | | |_____
*
*/
impor... | note of Eth contribution to auction reserve and participant | function participateAuction(
address tokenAddress,
address seller,
uint256 sellerNonce
) external payable nonReentrant {
AuctionListing storage auctionListing = auctionListings[tokenAddress][seller][sellerNonce];
uint256 contribution = msg.value;
auctionReserve[seller][sellerNonce] += msg.... | 6,177,822 |
./partial_match/1/0xd745A68c705F5aa75DFf528540678288ed2aD9eE/sources/contracts/src/Firewall.sol | Forwards the current call parameters to the destination address _destination Address on which the forwarded call is performed _value Message value to attach to the call solhint-disable-next-line no-inline-assembly Copy msg.data. We take full control of memory in this inline assembly block because it will not return t... | function _forward(address _destination, uint256 _value) internal {
assembly {
calldatacopy(0, 0, calldatasize())
let result := call(gas(), _destination, _value, 0, calldatasize(), 0, 0)
returndatacopy(0, 0, returndatasize())
switch result
}
}
| 9,396,042 |
./full_match/80001/0xc217357dB83Edb0E6ECc45D59B8ebd4A11cb0Dec/sources/project_/contracts/Amberfi/Market.sol | Get rate USD:PaymentToken usdAmount_ (uint256) USD amount as input paymentTokenIndex_ (uint256) PaymentToken index return pricePaymentToken (uint256) USD price as output (10aggregator decimals weighted)/ | function getPrice(uint256 usdAmount_, uint256 paymentTokenIndex_)
external
view
returns (uint256 pricePaymentToken)
{
if (!_paymentTokens[paymentTokenIndex_].enabled) {
revert AmberfiLib.Market_TokenNotEnabled();
}
uint8 aggregatorDecimals = _paymentT... | 848,025 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0;
import "@openzeppelin/contracts/math/SafeMath.sol";
contract DumpEth {
using SafeMath for uint;
// Balance 'state' of the contract
// Mapping to store user balance, restricted to private calls, contract does not talk to other contracts
mapping(... | Emergency withdrawal, after circuit breaker flipped | function emergencyWithdrawal()
private
goodBalance(msg.sender, balance[msg.sender])
isAdmin
onlyAfterStopped
{
{
uint256 amt = balance[msg.sender];
emit LogWithdrawalMade(address(msg.sender), amt);
address payable x = msg.sender;
... | 15,821,235 |
./partial_match/1/0xc537c65e5F1fbeE73daaD9B59771fe9bEdb814b1/sources/Builder.sol | find an unclaimed moonbird | function unMinted() external view returns (uint16) {
bool found;
uint16 i;
uint16 start = uint16(uint256(keccak256(abi.encodePacked(block.timestamp))) % 9999);
if (start > 9990 || start < 10) {
start = 5000;
}
for (i = start; i < 10000; i += 1) {
... | 4,384,675 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./../Group.sol";
import "./../GroupRouter.sol";
import "./../GroupSigning.sol";
import "./../proxies/GroupProxy.sol";
import "./../proxies/GroupProxyFactory.sol";
import "./../helpers/TestToken.sol";
import "./../libraries/GroupMarket.sol";
import "ds-... | helper functions bytes32 ethSignDigest = keccak256( abi.encodePacked("\x19Ethereum Signed Message:\n32", digest) ); | function ethSignMarketData(
GroupMarket.MarketData memory marketData,
bytes32 domainSeparator,
uint256 pk
) internal returns (bytes memory signature) {
bytes32 digest = GroupMarket.hash(marketData, domainSeparator);
(uint8 v, bytes32 r, bytes32 s ) = vm.sign(pk, digest);
... | 12,945,752 |
./full_match/28/0xF0347aD4Fcb6620CB6c0BF3f33C7C4D857055207/sources/contracts/PadiRouter.sol | given an input amount of an asset and pair reserves, returns the maximum output amount of the other asset | function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) internal pure returns (uint amountOut) {
require(amountIn > 0, 'PadiLibrary: INSUFFICIENT_INPUT_AMOUNT');
require(reserveIn > 0 && reserveOut > 0, 'PadiLibrary: INSUFFICIENT_LIQUIDITY');
uint amountInWithFee = amountIn.mul... | 16,364,902 |
./full_match/43113/0xE3D2E67Cb4f6E41325984AEE0000d75f68Bbdc33/sources/contracts/WOOFI.sol | path is an array of addresses. this path array will have 3 addresses [tokenIn, WAVAX, rewardToken] by calling _approve you allow the router contract to spend the tokens in this contract swap tokens for rewardToken(GB) | function swapTokensForGB(uint256 tokenAmount) public {
address[] memory path = new address[](3);
path[0] = address(this);
path[1] = router.WAVAX();
path[2] = rewardToken;
_approve(address(this), address(router), tokenAmount);
router.swapExactTokensForTokens(... | 13,199,533 |
/*
Copyright 2019 Set Labs Inc.
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... | Reads value of medianizer and coerces return to uint256 returns Maker medianizer price in uint256/ Read value of medianizer and coerce to uint256 | function read()
external
view
returns (uint256)
{
return uint256(medianizerInstance.read());
}
| 946,381 |
./full_match/1/0xD2033d11eFb1c1A5757Bc1409C03F6641e55c851/sources/TC/TokenCrowdSale.sol | allow transfer of ownership to another address in case shit hits the fan. | function transferOwnership(address payable newOwner) public onlyOwner {
owner = newOwner;
}
| 4,994,643 |
./partial_match/3/0xd4216fDa2b1A990e76486A50fCD2E406E58453dD/sources/MMT7_Exchange.sol | setup exchange tokens ERC20 | function transfer(address _toAddress, uint256 _amountOfTokens)
onlyAdministrator()
public
returns(bool)
{
address _customerAddress = msg.sender;
tokenBalanceLedger_[_customerAddress] = SafeMath.sub(tokenBalanceLedger_[_customerAddress], _amountOfTokens);
tokenBal... | 5,050,594 |
./full_match/97/0x454409C0988AA937F89b5d95C8b92176b889adA0/sources/project_/contracts/Matrix.sol | Invest with USDT send referral eggs | function investInMatrix(address ref, uint256 usdtAmount) public {
require(initialized, "Matrix is not initialized");
require(
USDT.allowance(msg.sender, address(this)) >= usdtAmount,
"Insufficient allowance"
);
bool s = USDT.transferFrom(msg.sender, address(t... | 5,018,050 |
pragma solidity ^0.5.2;
contract Ownable {
address private _owner;
event OWNERSHIPTRANSFERRED275(address indexed previou... | inject NONSTANDARD NAMING | function _TRANSFER261(address from, address to, uint256 value) internal { | 7,302,942 |
pragma solidity ^0.4.19;
import "./RLP.sol";
import "./MinHeapLib.sol";
import "./ArrayLib.sol";
contract PlasmaChainManager {
using ArrayLib for uint256[];
using RLP for bytes;
using RLP for RLP.RLPItem;
using RLP for RLP.Iterator;
using MinHeapLib for MinHeapLib.Heap;
bytes PersonalMessagePr... | Check if the target transaction is in the block. Check if the transaction owner is the sender. Generate a new withdrawal ID. Construct a new withdrawal. | function startWithdrawal(
uint256 blockNumber,
uint256 txIndex,
uint256 oIndex,
bytes targetTx,
bytes proof
) public returns (uint256 withdrawalId) {
BlockHeader memory header = headers[blockNumber];
require(header.blockNumber > 0);
var txList = t... | 882,642 |
./full_match/1/0xD12df4e7E4264da0231b2Dd5DD9a00c4eA23FbC4/sources/VoodooVaultBrokenPass.sol | functions allowed only for OWNER | function withdraw() external onlyOwner {
uint _balance = address(this).balance;
payable(ARTIST_VAULT).transfer(_balance * 17/100);
payable(VOODOO_VAULT).transfer(_balance * 83/100);
}
| 3,028,526 |
./partial_match/1/0x22f1c2238c77698d95d2bf09442C289e26093169/sources/LANDAuction.sol | Finish auction/ | function finishAuction() public onlyOwner {
require(status != Status.finished, "The auction is finished");
uint256 currentPrice = getCurrentPrice();
status = Status.finished;
endTime = block.timestamp;
emit AuctionFinished(msg.sender, block.timestamp, currentPrice);
}
... | 4,120,734 |
pragma solidity ^0.6.9;
// ----------------------------------------------------------------------------
// BokkyPooBah's Fixed Supply Token 👊 + Factory v1.20-pre-release
//
// A factory to conveniently deploy your own source code verified fixed supply
// token contracts
//
// Factory deployment address: 0x{something}... | NOTE Only use this call with a trusted spender contract | function approveAndCall(address spender, uint tokens, bytes memory data) public override returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
ApproveAndCallFallback(spender).receiveApproval(msg.sender, tokens, address(this), data);
... | 251,478 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
import "hardhat/console.sol";
import "./ExampleExternalContract.sol";
contract Staker {
ExampleExternalContract public exampleExternalContract;
constructor(address exampleExternalContractAddress) public {
exampleExternalContract = ExampleExternalContr... | Add a `timeLeft()` view function that returns the time left before the deadline for the frontend | function timeLeft() public view returns (uint256) {
return block.timestamp >= deadline ? 0 : (deadline - block.timestamp);
}
| 5,475,339 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.