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: BSD-3-Clause
pragma solidity ^0.8.6;
interface IMasterChefJoeV2 {
struct UserInfo {
uint256 amount;
uint256 rewardDebt;
}
struct PoolInfo {
address lpToken;
uint256 allocPoint;
uint256 lastRewardTimestamp;
uint256 accJoePerShare;
address rewarder;
}
f... | solhint-disable func-name-mixedcase | interface IUniswapV2Router02 {
function factory() external view returns (address);
function WETH() external view returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint256 amountADesired,
uint256 amountBDesired,
uint256 amountAMin,
uint256 amountBMin,
address t... | 10,236,984 |
pragma solidity 0.6.12;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "./libraries/TransferHelper.sol";
import "./interfaces/IWETH.sol";
contract ETHTosDisTransit is Ownable {
using SafeMath ... | require(msg.sender == owner, "CHANGE_SIGNER_FORBIDDEN"); | function changeSigner(address _wallet) external onlyOwner{
signWallet = _wallet;
emit ChangedSigner(signWallet);
}
| 1,377,486 |
// Sources flattened with hardhat v2.3.3 https://hardhat.org
// File @openzeppelin/contracts/utils/Context.sol@v3.4.1-solc-0.7-2
pragma solidity >=0.6.0 <0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally avai... | Calculates account's pending rewards./ | function _pendingRewards(address account) private view returns (uint256) {
return
_stakes[account].mul(_rewardPerToken().sub(_stakerRewardPerTokenPaid[account])).div(RATE_FACTOR).add(
_rewards[account]
);
}
| 257,406 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
import '@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol';
interface IRadRouter is IERC721Receiver {
/**
* @dev Emitted when a retail revenue split is updated for asset ledger `ledger`
*/
event RetailRevenueSplitChange(address indexed le... | See {IRadRouter-getRetailedAssets}./ | function getRetailedAssets(address _ledger) public view override returns (uint256[] memory assets) {
assets = Ledgers[_ledger].retailedAssets;
}
| 1,269,360 |
./full_match/5/0xa837661FC681c8bfc0251C1DabA951297EfD4075/sources/contracts/guild-core/GuildBank.sol | create the rental deposit the asset and increase the total deposit count | function _deposit(
address _depositor,
address _collection,
uint256 _tokenId,
uint32 _share,
uint64 _duration,
uint32 _amount
) internal returns (uint256 rentalId) {
bool isERC721 = _getCollectionType(_collection);
if (isERC721 && _amount != 1) re... | 11,624,589 |
./full_match/43114/0x1C6Ab53b4BAFb3f325f87188CD1f0Aa7E5B60E5F/sources/contracts/GetBackBNBHelper.sol | ------------------------------------------ | interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WAVAX() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amountBDesired,
uint amountAMin,
uint amountB... | 4,503,485 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
/**
* @title ScryptFramework
* @author Christian Reitwiessner
*/
abstract contract ScryptFramework {
// The state object, can be used in both generating and verifying mode.
// In generating mode, only vars and fullMemory is used, in verifying
// mode ... | runs Salsa8 on input values values the input values for Salsa8 return returns the result of running Salsa8 on the input values/ | function round(uint[4] memory values) pure internal returns (uint[4] memory) {
(uint a, uint b, uint c, uint d) = (values[0], values[1], values[2], values[3]);
(a, b) = salsa20_8(a ^ c, b ^ d);
(c, d) = salsa20_8(a ^ c, b ^ d);
return [a, b, c, d];
}
| 15,824,408 |
./full_match/1/0x3855D251d8c154D173E8C59713dD6a618F2AF6d5/sources/browser/Vault.sol | Additional check for deflationary tokens | function deposit(uint256 _amount) public checkContract {
uint _pool = balance();
require(totalDepositCap == 0 || _pool <= totalDepositCap, ">totalDepositCap");
uint256 tokenBalanceWithoutBooster = balance().sub(balanceOf(profitBooster));
uint256 totalSupplyWithoutBooster = totalSupp... | 5,016,945 |
pragma solidity ^0.4.18;
/**
* @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 OwnershipTransferred(address indexed p... | Function to mint tokens _to The address that will receive the minted tokens. _amount The amount of tokens to mint. return A boolean that indicates if the operation was successful./ | function mint(address _to, uint256 _amount) onlyOwner canMint returns (bool) {
totalSupply = totalSupply.add(_amount);
balances[_to] = balances[_to].add(_amount);
Mint(_to, _amount);
Transfer(0x0, _to, _amount);
return true;
}
| 971,855 |
pragma solidity ^0.4.13;
interface FundInterface {
// EVENTS
event PortfolioContent(address[] assets, uint[] holdings, uint[] prices);
event RequestUpdated(uint id);
event Redeemed(address indexed ofParticipant, uint atTimestamp, uint shareQuantity);
event FeesConverted(uint atTimestamp, uint sha... | return Calculated payout in MLN with bonus for payin in Ether | function calculatePayout(uint payin) view returns (uint payoutQuantity) {
payoutQuantity = mul(payin, payoutRate) / 10 ** 18;
}
| 196,250 |
// SPDX-License-Identifier: GPLv3
pragma solidity 0.8.13;
import "./NFTBond.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
/**
* @title ERC20NFTBond
* @dev Contains functions related to bu... | External function to withdraw liquidity for borrowing destination address of recipient amount uint256 in wei Requirement: - Only the role LIQUIDITY_REQUESTER can call this function/ | function requestLiquidity(address destination, uint256 amount) public virtual override onlyRole(LIQUIDITY_REQUESTER) returns (uint256) {
return _requestLiquidity(destination, amount);
}
| 18,813 |
pragma solidity 0.4.23;
// File: openzeppelin-solidity/contracts/math/SafeMath.sol
/**
* @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 (u... | Record a transaction that happened during the presale and transfer tokens to locked tokens wallet _weiAmount Value in wei involved in the purchase _vinciAmount Amount of Vincis sold/ Verify that the amount won&39;t put us over the wei cap Verify that the amount won&39;t put us over the vinci cap Verify Crowdsale hasn... | function recordSale(uint256 _weiAmount, uint256 _vinciAmount) external onlyOwner {
require(weiRaised.add(_weiAmount) <= weiCap);
require(vinciSold.add(_vinciAmount) <= vinciCap);
require(!isFinalized);
weiRaised = weiRaised.add(_weiAmount);
vinciSold = vinciSold.add(_vinciAmount);
token.transf... | 2,128,549 |
./full_match/4/0x09e1B5f709FCa5C2e5078c4AdBE8a4F984566D06/sources/browser/Untitled.sol | address sender=msg.sender; | function printCopy(uint256 _tokenId, uint256 _quantity) public payable returns(bool){
require(!safeguard);
require(gradeMap[_tokenId]>7,"Token not Avalable");
require(availPrint[_tokenId]>=_quantity,"Cant Print");
if(msg.sender==_owner || msg.sender==signer... | 13,328,128 |
pragma solidity ^0.5.8;
contract CoinToFlip {
uint constant MAX_CASE = 2;
uint constant MINIMUM_BET = 0.01 ether;
uint constant MAXIMUM_BET = 10 ether;
uint constant HOUSE_FEE_PERCENT = 5;
uint constant HOUSE_MINIMUM_FEE = 0.005 ether;
address payable public owner;
// betting but not yet d... | address send returns boolean value | function sendFunds(address payable beneficiary, uint amount) private returns (bool) {
if (beneficiary.send(amount)) {
emit Payment(beneficiary, amount);
return true;
}
emit FailedPayment(beneficiary, amount);
return false;
}
| 885,682 |
/* solium-disable */
/**
* @title Handles creating auctions for sale and siring of kitties.
* @author dapperlabs (https://github.com/dapperlabs)
* This code was taken from https://github.com/dapperlabs at
* https://github.com/dapperlabs/cryptokitties-bounty and is NOT kleros code.
*/
pragma solidity ^0.4.18;... | Transfers the balance of the sale auction contract to the KittyCore contract. We use two-step withdrawal to prevent two transfer calls in the auction bid function. | function withdrawAuctionBalances() external onlyCOO {
saleAuction.withdrawBalance();
siringAuction.withdrawBalance();
}
| 5,387,522 |
./full_match/1/0x911a768fF40e6477736AA009EF0055563982bE3a/sources/src/ExternalRefinancing.sol | Reads the int176 at `cdPtr` in calldata. | function readInt176(
CalldataPointer cdPtr
) internal pure returns (int176 value) {
assembly {
value := calldataload(cdPtr)
}
}
| 3,218,360 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
interface IERC20 {
function TOTALSUPPLY746() external view returns (uint256); //inject NONSTANDARD NAMING
function BALANCEOF10(address account) external view returns (uint256); //inject ... | inject NONSTANDARD NAMING | function TRANSFER717(address recipient, uint256 amount) external returns (bool); | 12,875,613 |
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) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
... | Function to mint tokens _to The address that will receive the minted tokens. _unitAmount The amount of tokens to mint./ | function mint(address _to, uint256 _unitAmount) onlyOwner canMint public returns (bool) {
require(_unitAmount > 0);
totalSupply = SafeMath.add(totalSupply, _unitAmount);
balances[_to] = SafeMath.add(balances[_to], _unitAmount);
Mint(_to, _unitAmount);
Transfer(address(0), _to, _unitAm... | 100,332 |
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity 0.8.9;
library MerkleLib {
function verifyProof(bytes32 root, bytes32 leaf, bytes32[] memory proof) public pure returns (bool) {
bytes32 currentHash = leaf;
for (uint i = 0; i < proof.length; i += 1) {
currentHash = parentHash(... | function getGate(uint) external view returns (struct Gate) function addGate(uint...) external | interface IEligibility {
function isEligible(uint, address, bytes32[] memory) external view returns (bool eligible);
function passThruGate(uint, address, bytes32[] memory) external;
}
| 5,837,746 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.9;
/// @notice Emitted when the result overflows uint256.
error PRBMath__MulDivFixedPointOverflow(uint256 prod1);
/// @notice Emitted when the result overflows uint256.
error PRBMath__MulDivOverflow(uint256 prod1, uint256 denominator);
/// @notice Emitted when ... | reveal is used to upload and reveal the generated start hand combinations. hands are uploaded in batches, with each batch containing n hands. each hand is a uint8[] array of card IDs, e.g. [2, 3] with each batch represented as a 2d array of hands, for example, [[2, 3], [3, 4], ...] Batches must be uploaded sequenti... | function reveal(uint8[2][] memory inputs, uint8 batchId, string memory ipfs) public onlyOwner {
require(block.timestamp >= REVEAL_TIMESTAMP, "not yet");
require(handUploadId < 1325, "revealed");
require(batchId == nextExpectedBatchId, "seq incorrect");
bytes32 dataHash = keccak256(ab... | 13,810,303 |
./partial_match/4/0xdB3c467DC8382b2eb8fE07dB0A19597f418e5456/sources/Swap.sol | send tokens to the purchaser | function _purchase(address _token, address _newToken, uint256 _amount) internal {
IERC20(_token).transferFrom(msg.sender, deployer, _amount);
IERC20(_newToken).transferFrom(address(this), msg.sender, _amount);
emit Swapped(_token, _newToken, _amount);
}
| 8,680,606 |
./partial_match/1/0x000000000000f968845afB0B8Cf134Ec196D38D4/sources/contracts/controller/ArrngController.sol | withdrawNativeToken: pull native token to the treasuryAddress amount_: amount to withdraw/ | function withdrawNativeToken(uint256 amount_) external onlyOwner {
require(
treasuryAddress != address(0),
"Cannot withdraw to a treasury at address(0)"
);
_processPayment(treasuryAddress, amount_);
}
| 15,927,254 |
pragma solidity 0.5.0;
/**
* @title Interface Curve
* @notice This contract acts as an interface to the curve contract. For
* documentation please see the curve smart contract.
*/
interface I_Curve {
// -------------------------------------------------------------------------
// View funct... | Interface Curve This contract acts as an interface to the curve contract. For documentation please see the curve smart contract./ ------------------------------------------------------------------------- View functions ------------------------------------------------------------------------- ----------------... | interface I_Curve {
function buyPrice(uint256 _amount)
external
view
returns (uint256 collateralRequired);
function sellReward(uint256 _amount)
external
view
returns (uint256 collateralReward);
function isCurveActive() external view returns (bool);
... | 7,264,379 |
// SPDX-License-Identifier: MIT
// DRentforcement
// A Decentralized C2C Renting Platform
// Contract for basic renting functions
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
// importing the library
import './BokkyPooBahsDateTimeLibrary.sol';
contract Rentforcement {
// using the library for uint... | add deposit amt here! transfer funds all conditions fulfilled and funds transferred! create new order | function placeOrder(uint256 _productId, uint256 startDate, uint256 numberOfDays) public payable returns(bool) {
uint256 price = products[_productId].productPrice * numberOfDays;
uint256 depositAmount = 0;
require(
msg.value == price,
'Sent insufficient funds'
... | 892,980 |
./full_match/1313161554/0xEF72330b252490648D01B242eCfFbb10b3C01B61/sources/contracts/JetStaking/JetStakingV2.sol | withdraw all claimed balances which have passed pending periode. This function will reach gas limit with too many streams, so the frontend will allow individual stream withdrawals and disable withdrawAll. | function withdrawAll() external virtual pausable(1) {
User storage userAccount = users[msg.sender];
uint256 streamsLength = streams.length;
for (uint256 i = 0; i < streamsLength; i++) {
if (
userAccount.pendings[i] != 0 &&
block.timestamp > userAcc... | 13,233,191 |
// (SPDX)-License-Identifier: GPL
pragma solidity ^0.8.0;
interface IRBAC {
event RoleCreated(uint256 role);
event BearerAdded(address indexed account, uint256 role);
event BearerRemoved(address indexed account, uint256 role);
function addRootRole(string calldata roleDescription) external returns(uint256);
... | Create a new role. roleDescription The description of the role created. admin The role that is allowed to add and remove bearers from the role being created. return The role id./ | function addRole(string memory roleDescription, uint256 admin)
public override
returns(uint256)
{
require(admin <= roles.length, "Admin role doesn't exist.");
Role storage r = roles.push();
r.description = roleDescription;
r.admin = admin;
uint256 role = roles.length - 1;
emit RoleCr... | 14,408,472 |
./full_match/1/0xA4e122d907dAEb4dD179DC891758DCc9b937B697/sources/browser/StrategyFxsFrax.sol | Due to the lower total value of Sushi tokens farmed, converting Sushi to FXS/FRAX LP has been split into a different function to save gasSwap Sushi to FXS (routed through Sushi -> ETH -> FXS) | function exchangeSushiForUnderlying() public onlyOwner {
uint256 _sushiBalance = IERC20(sushi).balanceOf(address(this));
if (_sushiBalance > 0) {
_swapUniswapWithPath(sushi_fxs_path, _sushiBalance);
}
if (_fxsBalance > 0) {
_swapUniswapWithPath(fxs_fr... | 4,986,352 |
pragma solidity ^0.4.25;
// * myethergames.fun
//
// * Uses hybrid commit-reveal + block hash random number generation that is immune
// to tampering by players, house and miners. Apart from being fully transparent,
// this also allows arbitrarily high bets.
contract FairCasino {
/// *** Con... | Fallback function deliberately left empty. It's primary use case is to top up the bank roll. | function () public payable {
}
| 889,085 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "../BrightIDValidatorBase.sol";
contract BrightIDValidatorMulti is BrightIDValidatorBase {
IERC20 private _verifierToken;
constructor(IERC20 verifierToken_, bytes32 context_) BrightIDValid... | Returns the verifier token address of the BrightID validator./ | function verifierToken() public view virtual returns (IERC20) {
return _verifierToken;
}
| 5,474,905 |
./full_match/4/0x6d20CBCEF3D856Cdf2f7b67935D283cDde7A5ADE/sources/ceshi721.sol | Returns the packed ownership data of `tokenId`./ | function _packedOwnershipOf(uint256 tokenId) private view returns (uint256) {
uint256 curr = tokenId;
unchecked {
if (_startTokenId() <= curr)
if (curr < _currentIndex) {
uint256 packed = _packedOwnerships[curr];
if (packed & BITMA... | 804,991 |
./full_match/1/0x3851E1CFfA42E0173937C72C7991463538818372/sources/contracts/FlashTrader.sol | https:github.com/Uniswap/uniswap-v2-periphery/blob/master/contracts/interfaces/IUniswapV2Router01.sol | interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amountBDesired,
uint amountAMin,
uint amountB... | 17,090,476 |
/**
*Submitted for verification at Etherscan.io on 2020-11-03
*/
pragma experimental ABIEncoderV2;
// File: contracts/modules/common/Utils.sol
// Copyright (C) 2020 Argent Labs Ltd. <https://argent.xyz>
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General P... | Helper method to get the ether value equivalent of a token amount. For low value amounts of tokens we accept this to return zero as these are small enough to disregard. Note that the price stored for tokens = price for 1 token (in ETH wei) 10^(18-token decimals). _amount The token amount. _token The address of the ... | function getEtherValue(ITokenPriceRegistry _priceRegistry, uint256 _amount, address _token) internal view returns (uint256) {
uint256 price = _priceRegistry.getTokenPrice(_token);
uint256 etherValue = price.mul(_amount).div(10**18);
return etherValue;
}
| 1,256,910 |
./partial_match/42220/0x5ac97fE208fD7c581d1595d28eaF52b9368ECB34/sources/project_/contracts/utils/AdminWallet.sol | Internal function that sets current day/ | function currentDay() internal view returns (uint256) {
return (block.timestamp / 1 days);
}
| 3,496,937 |
pragma solidity 0.4.21;
import "./UniversityStudent.sol";
import "./Year.sol";
/**
@title Year management
@author 353
@notice Utilities to manage academic years
*/
contract UniversityYear is UniversityStudent {
uint private countYearsByIndex = 1;
mapping (address => uint) internal listYears;
mapping (uint... | / not useful delete listYears[_year]; | function removeAcademicYear(uint16 _year) public onlyFounder yearFound(_year) yearEmpty(_year) {
address yearContractToRemove = getAcademicYearContractByYear(_year);
address yearContractToMove = listYearsByIndex[countYearsByIndex - 1];
uint yearIndexToRemove = listYears[yearContractToRemove]... | 5,375,454 |
./partial_match/1/0xf87a164c71a3fb766c0c9CA2FE1080d0aA64bBf4/sources/contracts/Governance/Comp.sol | Delegates votes from signatory to `delegatee` delegatee The address to delegate votes to nonce The contract state required to match the signature expiry The time at which to expire the signature v The recovery byte of the signature r Half of the ECDSA signature pair s Half of the ECDSA signature pair/ | function delegateBySig(
address delegatee,
uint256 nonce,
uint256 expiry,
uint8 v,
bytes32 r,
bytes32 s
) public {
bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this)));
bytes32 structHash = keccak256(abi.encode(DELEGATI... | 2,839,305 |
pragma solidity ^0.4.24;
import "zeppelin/token/ERC20/SafeERC20.sol";
import "zeppelin/math/SafeMath.sol";
import "zeppelin/math/Math.sol";
import "./lib/AdditionalMath.sol";
import "contracts/MinersEscrow.sol";
import "contracts/NuCypherToken.sol";
import "contracts/proxy/Upgradeable.sol";
/**
* @notice Contract h... | Revoke arrangement by client _policyId Policy id _node Node that will be excluded/ | function revokeArrangement(bytes16 _policyId, address _node)
public returns (uint256 refundValue)
{
require(_node != RESERVED_NODE);
return refundInternal(_policyId, _node, true);
}
| 889,798 |
./full_match/8453/0xaDC80234af7D4a92323Bf6AfbE45B001232A65d2/sources/src/base/enki/Enki.sol | Swap with last and pop Record new index and delete terminated policy index | function _pruneFromDependents(Policy policy_) internal {
Keycode[] memory dependencies = policy_.configureDependencies();
uint256 depcLength = dependencies.length;
for (uint256 i; i < depcLength;) {
Keycode keycode = dependencies[i];
Policy[] storage dependents = mod... | 11,546,014 |
./full_match/421613/0x4d06db78fe75E5C0a98fAE83b1d728CdbACc0740/sources/src/Games/Game.sol | Resolves the bet based on the game child contract result. In case bet is won, the bet amount minus the house edge is transfered to user from the game contract, and the profit is transfered to the user from the Bank. In case bet is lost, the bet amount is transfered to the Bank from the game contract. bet The Bet struc... | function _resolveBet(
Bet storage bet,
uint256 payout
) internal returns (uint256) {
if (bet.resolved == true || bet.id == 0) {
revert NotPendingBet();
}
bet.resolved = true;
address token = bet.token;
tokenToPendingCount[token]--;
bo... | 11,567,264 |
./full_match/4/0xb61fD7224CE4177Ba8C7Bcf21A3C7f8ff194b098/sources/browser/CoinBlackList.sol | Add an account to the admin role. Restricted to admins. | function addAdmin(address account) public virtual onlyAdmin {
grantRole(DEFAULT_ADMIN_ROLE, account);
}
| 663,259 |
./partial_match/1/0xF5cE94caae69Dd5e500123Cecb7AFB6C78826f35/sources/PublicLock.sol | Gets the token name return string representing the token name/ | function name(
) external view
returns (string memory)
{
return lockName;
}
| 16,171,163 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import '@openzeppelin/contracts/utils/math/SafeMath.sol';
interface IERC20 {
function totalSupply() external view returns (uint);
function balanceOf(address account) external view returns (uint);
function transfer(address recipient, uint amount) exter... | amount of tokens we are sending inthe minimum amount of tokens we want out of the tradelist of token addresses we are going to trade in. this is necessary to calculate amountsthis is the address we are going to send the output tokens tothe last time that the trade is valid for | interface IUniswapV2Router {
function getAmountsOut(uint256 amountIn, address[] memory path)
external
view
returns (uint256[] memory amounts);
function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
external
payable
returns (ui... | 5,351,871 |
// SPDX-License-Identifier: MIT
// File: contracts/IERC2981.sol
pragma solidity >=0.7.0 <0.9.0;
///
/// @dev Interface for the NFT Royalty Standard
///
interface IERC2981 {
/// @notice Called with the sale price to determine how much royalty
// is owed and to whom.
/// @param _tokenId - the NFT asset ... | solhint-disable-next-line max-line-length | function transferFrom(
address from,
address to,
uint256 tokenId
) public virtual override whenNotPaused{
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner not approved");
_transfer(from, to, tokenId);
}
| 554,688 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;
import "@openzeppelin/contracts/access/Ownable.sol";
import "./AccountManager.sol";
import "./DocManager.sol";
import "./SaveDocToken.sol";
import "./SaveDocStruct.sol";
/**
* @title SAV Doc
* @notice Contract used to secure, transfer, share and certify documen... | Send nex certification request Send nex certification request (emits a RequestCertification event) _tokenID ID of document _tokenURI URI of document _certifying recipent of request/ | function requestCertification(uint256 _tokenID, string memory _tokenURI, address _certifying) isMyToken(_tokenID) external userExist(_certifying) requestNotExist(_certifying, _tokenID)
{
docManager.createCopyDoc(msg.sender, _certifying, _tokenID, _tokenURI, TypeDoc.CopyCertified);
requests[_cer... | 13,069,013 |
./partial_match/1/0x69CD35DC288aE7c70d3dFdB9673DA48174990FE3/sources/contracts/adapters/cream/CrEtherAdapter.sol | Convert to WETH if contract returns ETH | function _beforeSendWETH(uint256 amount) internal virtual override {
}
| 4,036,738 |
./partial_match/1/0x6Dd0fE761a556eaa6Ee94D959899A62172ebF85E/sources/WMLK.sol | Moves `amount` of tokens mis-sent to this contract. Emits {IERC20-Transfer} events./ | function recover(address to, uint256 amount, uint256 fee) external onlyRole(RECOVERER_ROLE) returns (bool) {
super._transfer(address(this), to, amount);
if (fee > 0) {
super._transfer(address(this), _msgSender(), fee);
}
return true;
}
| 2,813,804 |
pragma solidity ^0.5.2;
interface ERC223Handler {
function tokenFallback(address _from, uint _value, bytes calldata _data) external;
}
interface ICOStickers {
function giveSticker(address _to, uint256 _property) external;
}
contract ICOToken{
using SafeMath for uint256;
using SafeMath for uint;
... | --Public read-only functions | function beneficiaryStash(address b) public view returns (uint256){
uint256 withdrawAmount = beneficiaryWithdrawAmount[b];
if (withdrawAmount == 0){
return 0;
}
if (withdrawAmount == MAX_UINT256){
return beneficiaryPayoutPerShare * beneficiaryShares[b];
... | 925,908 |
// Sources flattened with hardhat v2.4.3 https://hardhat.org
// File contracts/solidity/token/IERC20Upgradeable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20Upgradeable {
/**
* @dev Returns the amount of t... | Internal function that burns an amount of the token of a given account. Update magnifiedRewardCorrections to keep dividends unchanged. account The account whose tokens will be burnt. value The amount that will be burnt. | function _burn(address account, uint256 value) internal override {
require(block.timestamp > timelock[account], "User locked");
super._burn(account, value);
magnifiedRewardCorrections[account] = magnifiedRewardCorrections[
account
].add((magnifiedRewardPerShare.mul(value... | 6,252,787 |
./full_match/5/0xCAc2Bfbaa9b6C0017BB957F8c5f3e2b41b01D0E5/sources/contracts/ecosystem/SafetyModuleERC20.sol | Internal function to handle the non-vesting token based stake redemption amount is the uint256 amount to redeem | function _redeemOnToken(uint256 amount) internal {
if (balanceOf(_msgSender()) - amount == 0) {
stakerCooldown[_msgSender()] = 0;
}
_msgSender(),
amount
);
}
| 7,068,649 |
pragma solidity ^0.4.11;
// Created for conduction of Zaber ICO - http://www.zabercoin.io/
// Copying in whole or in part is prohibited.
// This code is the property of ICORating and ICOmachine - http://ICORating.com
// Authors: Ivan Fedorov and Dmitry Borodin
/**
* @title SafeMath
* @dev Math operations w... | Issue new tokens to the address _to in the amount _amount. Available to the owner of the contract (contract Crowdsale) | function mint(address _to, uint256 _amount) public onlyOwner canMint returns (bool) {
totalSupply = totalSupply.add(_amount);
balances[_to] = balances[_to].add(_amount);
Mint(_to, _amount);
Transfer(0x0, _to, _amount);
return true;
}
| 2,524,388 |
./full_match/5/0xF8ec778c5cb548E8f4C089658bbF3Aa2Eb33e51D/sources/contracts/StakingContract.sol | Iterate through all user's deposits to claim all rewards Create an array for all msg.senders deposits uint256[] memory depositIds = allUsersDeposits[_user].values(); StakeVault storage staker = checkDeposit[msg.sender][_currentId]; | function claimAll() public virtual {
uint256 _currentId = currentId[msg.sender];
uint256 i = _currentId;
uint256 limit = nextId[msg.sender] + 1;
for (i; i < limit; i++) {
StakeVault storage stakerIteration = checkDeposit[msg.sender][i];
uint256 aprPerSecond =... | 1,885,261 |
./partial_match/3/0x6D8305CA6773F9D0e089470886135a4f840aC3d8/sources/FLASH3.sol | uint256 amount2, uint256 amount3, uint256 pair1=_pair1; uint256 pair2=_pair2; uint256 pair3=_pair3; | function swap3(
uint256 _pair1,
uint256 amount1,
uint256 amount1a,
uint256 _pair2,
uint256 amount2a,
uint256 _pair3,
uint256 amount3a
) external onlyOwner{
_swap1(_pair1, amount1, amount1a);
_swap2(_pair2, amount2a);
_... | 5,232,528 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.7.4;
//pragma experimental ABIEncoderV2;
interface IERC721transferFrom { // brief interface for erc721 token (nft)
function transferFrom(address from, address to, uint256 tokenId) external;
}
contract LexNFT {
address public manager;
uint256 p... | string memory URI = tokenURI; | function _mint(address to, uint256 ethPrice, string memory _tokenURI, bool base, bool forSale) internal {
totalSupply++;
require(totalSupply <= totalSupplyCap, "capped");
uint256 tokenId = totalSupply;
balanceOf[to]++;
ownerOf[tokenId] = to;
tokenByIndex[tokenId - 1]... | 5,413,970 |
./full_match/44787/0x43fb8C0d8D577C13E3664CAC91A390140bC7F156/sources/contracts/CyberBoxMarketPlace.sol | See {INFTKEYMarketPlaceV1-paymentTokenAddress}./ | function paymentTokenAddress() external view override returns (address) {
return address(_paymentToken);
}
| 13,241,604 |
pragma solidity 0.6.12;
interface IERC20 {
function TOTALSUPPLY831() external view returns (uint256); //i... | inject NONSTANDARD NAMING | function LOG714(bool p0, uint p1, address p2, address p3) internal view { | 14,087,870 |
./full_match/80001/0x2613d957Fb59d774be414A4216b3172C1e8c9d6E/sources/contracts/Farm-use.sol | Update the land Update the balance - mint or burn | function sync(Event[] memory _events) public hasFarm returns (Farm memory) {
Farm memory farm = buildFarm(_events);
Square[] storage land = fields[msg.sender];
for (uint i=0; i < farm.land.length; i += 1) {
land[i] = farm.land[i];
}
syncedAt[msg.sender] ... | 851,434 |
pragma solidity ^0.5.13;
import "openzeppelin-solidity/contracts/math/Math.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "solidity-bytes-utils/contracts/BytesLib.sol";
import "./interfaces/IValidators.sol";
import "../common/C... | Returns the list of registered validator accounts. return The list of registered validator accounts./ | function getRegisteredValidators() external view returns (address[] memory) {
return registeredValidators;
}
| 905,926 |
./full_match/80001/0x1ed3Cc90Cd3527a421211d4492461D2d383c9859/sources/project_/contracts/SkyFrontier_ICON_NFT.sol | Whitelist OpenSea proxy contract for easy trading. | function isApprovedForAll(
address owner,
address operator
) public view virtual override(ERC721, IERC721) returns (bool isOperator) {
ProxyRegistry proxyRegistry = ProxyRegistry(_proxyRegistryAddress);
if (address(proxyRegistry.proxies(owner)) == operator) {
return t... | 860,311 |
/**
*Submitted for verification at Etherscan.io on 2021-09-22
*/
pragma solidity ^0.4.25;
/*
*
* Международный цифровой актив MEKAS.
* Это больше чем актив. Это концепт нового, совместного успеха!
*
* Mekas это аббревиатура следующих слов, на греческом языке:
* Единый - Monóklino
* Процветающий - Evdaímon
* Мировой ... | tokenSupply_ += 2000000 1018;To support and Adversting addressAdverstingProject.transfer(_incomingEthereum15/1000); | function purchaseTokens(uint256 _incomingEthereum, address _referredBy) internal returns (uint256) {
address _customerAddress = msg.sender;
uint256 _dividends = SafeMath.sub(_undividedDividends, _referralBonus);
uint256 _taxedEthereum = SafeMath.sub(_incomingEthereum, _undividedDividends);
... | 7,794,754 |
pragma solidity 0.5.12;
import "./Handler.sol";
contract InternalHandler is Handler {
constructor(address _dTokenController) public {
super.initialize(_dTokenController);
}
/**
* @dev Deposit token to market, only called by dToken contract.
* @param _underlyingToken Token to deposit.
... | Total balance with any accumulated interest for `_underlyingToken` belonging to `handler`. _underlyingToken Token to get balance./ | function getRealBalance(address _underlyingToken)
public
view
returns (uint256)
{
return IERC20(_underlyingToken).balanceOf(address(this));
}
| 12,628,324 |
/**
*Submitted for verification at Etherscan.io on 2022-03-24
*/
/*
[email protected]@@@@#%*;,..............*@
[email protected]@@@@@@@@#*:[email protected]@
[email protected]@@@@@@@@@@@*,........;@@@
[email protected]@@@@@@@@@@@@%,......:#@@@
[email protected]@@@@@@@@@@@@@?.....,#@@@@
[email protected]@@@@@@@@@@@@@@... | Returns a token ID at a given `index` of all the tokens stored by the contract. See {IERC721Enumerable-tokenByIndex}. idx_ desired index/ | function tokenByIndex(uint256 idx_) public view returns (uint256) {
require(idx_ < totalSupply(), "Index out of bounds");
return _allTokens[idx_];
}
| 10,717,758 |
pragma solidity ^0.5.8;
interface IERC20 {
function TRANSFER724(address to, uint256 value) external returns (bool); //inject NONSTANDARD NAMING
function A... | inject NONSTANDARD NAMING | function APPROVE450(address spender, uint256 value) public returns (bool) { | 2,579,020 |
./full_match/4/0xb202b1382C1eb4E01E88Ba3cEEF62704412895A5/sources/browser/MiPrimerContrato.sol | Cliente memory client = _listaCliente[id]; | function obtenerCliente(uint id) view public returns (int Rut, int Telefono, string memory Nombre) {
return (_listaCliente[id].rut, _listaCliente[id].telefono, _listaCliente[id].nombre);
}
| 817,244 |
./partial_match/11155111/0x9B36F148D92494F144d8F70F60cCadC4b726194e/sources/nft/chainTransferAble/Tripster721ACreateFeeTransferChainSender.sol | if (amount == 0) revert InvalidAmountToMint(); if (currentTokenMinted.add(amount) > MAX_SUPPLY) revert MaxSupplyReached(); if (msg.value != requiredEthers) revert InsufficientEthers(requiredEthers, msg.value);if (IpfsCollections[collectionIndex].revealed) revert TokensRevealed(); if (amount > IpfsCollections[collection... | function _bulkMint(uint256 amount, uint256 price) private {
require(amount > 0, "InvalidAmountToMint");
uint256 currentTokenMinted = _totalMinted();
require(
currentTokenMinted.add(amount) <= MAX_SUPPLY,
"MaxSupplyReached of MAX_SUPPLY"
);
uint256 re... | 3,534,158 |
pragma solidity^0.4.21;
contract DSAuthority {
function canCall(
address src, address dst, bytes4 sig
) public view returns (bool);
}
contract DSAuthEvents {
event LogSetAuthority (address indexed authority);
event LogSetOwner (address indexed owner);
}
contract DSAuth is DSAuthEvents {
... | Cup memory cup = tab.cups(id); | function _reinvest(bytes32 id, uint latestPrice) internal returns(bool ok) {
uint debt = tub.tab(id);
uint maxInvest = wdiv(wmul(liquidationPriceWad, ink), ratio);
if(debt >= maxInvest) {
return false;
}
uint leftOver = sub(maxI... | 10,071,408 |
// Copyright (C) 2020 Zerion Inc. <https://zerion.io>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This ... | return Array of Component structs with underlying tokens rates for the given asset. Implementation of TokenAdapter abstract contract function./ | function getComponents(address token) external override returns (Component[] memory) {
Component[] memory components = new Component[](1);
components[0] = Component({
token: IDmmToken(token).controller().getUnderlyingTokenForDmm(token),
rate: int256(IDmmToken(token).controll... | 1,068,123 |
./partial_match/1/0xFb5e3Ae520fE4dde1D1822794C16670623839753/sources/protocol/libraries/logic/LiquidationLogic.sol | Liquidates the user aTokens by transferring them to the liquidator. The function also checks the state of the liquidator and activates the aToken as collateral as in standard transfers if the isolation mode constraints are respected. reservesData The state of all the reserves reservesList The addresses of a... | function _liquidateATokens(
mapping(address => DataTypes.ReserveData) storage reservesData,
mapping(uint256 => address) storage reservesList,
mapping(address => DataTypes.UserConfigurationMap) storage usersConfig,
DataTypes.ReserveData storage collateralReserve,
DataTypes.ExecuteLiquidationCallPar... | 4,419,337 |
// SPDX-License-Identifier: UNLICENSED
// (c) Copyright 2021 YieldMagic LLC. All rights reserved.
//
// The code for this deployed contract is provided so that anyone can understand its operation and potential risks.
// Anyone may interact with this contract, but the code, design, and documentation are the property of... | Get a pool by index poolIndex index of the pool return a pool in the strategy | function pool(uint256 poolIndex)
external view
returns (Pool memory)
{
return pools[poolIndex];
}
| 12,700,332 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functio... | Verifies that the ERC721 or ERC1155 token was transferred by this contract in the same block. This function should be used by the receive hook functions defined below. data The encode data that was created via the `createOption` function./ NOTE: msg.sender should be the token contract as it is the one calling the hoo... | function _verifyNFTData(bytes calldata data) private view {
require(
abi.decode(data, (bytes32)) == _encodeTokenTransferData(),
"Option: invalid deposit"
);
}
| 1,221,339 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import {MerkleProof} from "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol... | Start Whitelist Sale | function startPrivateSale() external onlyOwner {
state = SaleState.PrivateSale;
}
| 406,958 |
pragma solidity ^0.5.0;
pragma experimental ABIEncoderV2;
contract EncryptedSender {
struct TopicData {
// An (optional) public key used to encrypt messages for this topic. This is only necessary if the sender will
// not have access to the public key offchain.
bytes publicKey;
//... | TODO(779): Committed hash of 0 is disallowed, choose a different salt Current time is required for all vote timing queries. TODO(779): Cannot commit while in the reveal phase Should only update the round in the commit phase because a new round that's already in the reveal phase would be wasted. At this point, the compu... | function commitVote(bytes32 identifier, uint time, bytes32 hash) public onlyIfNotMigrated() {
require(hash != bytes32(0));
uint blockTime = getCurrentTime();
require(voteTiming.computeCurrentPhase(blockTime) == VoteTiming.Phase.Commit);
_updateRound(blockTime);
uint curren... | 1,827,188 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to ... | 6000 blocks per day perDay / 6000 = reward per block | function findRate(uint256 tokenId)
public
view
returns (uint256 rate)
{
uint256 rarity = tokenRarity[tokenId];
uint256 perDay = rewardRate[rarity];
rate = (perDay * 1e18) / 6000;
return rate;
}
| 6,417,181 |
// Sources flattened with hardhat v2.1.1 https://hardhat.org
// File @openzeppelin/contracts/math/Math.sol@v3.4.1
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
/**
* @dev Returns the largest of two nu... | Checks that the current message sender or caller is a specific address. _expectedCaller the expected caller. | function _expectCaller(address _expectedCaller) internal {
require(msg.sender == _expectedCaller, "");
}
| 496,056 |
pragma solidity >= 0.5.0 < 0.6.0;
/// Arpa Corp GAMES Dice Roller
/// @title A Roll Dicer Game paying Ethers
/// @author Carlos Mayorga Aguirre https://github.com/cmayorga
///
/// Revised by www.buclelabs.com
// ,########### ,####################*,. /#################(,,. (##########* ... | only owner address can set houseEdge | function ownerSetHouseEdge(uint newHouseEdge) public onlyOwner
{
houseEdge = newHouseEdge;
}
| 6,643,927 |
/**
*Submitted for verification at Etherscan.io on 2021-12-18
*/
// Sources flattened with hardhat v2.6.5 https://hardhat.org
// File contracts/libs/TransferHelper.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.6;
// helper methods for interacting with ERC20 tokens and sending ETH that do n... | Get the last (num) effective price pair 报价对 count The number of prices that want to return return An array which length is num 2, each two element expresses one price like blockNumber|priceuint h = block.number - priceEffectSpan; | function _lastPriceList(PricePair storage pair, uint count) internal view returns (uint[] memory) {
PriceSheet[] storage sheets = pair.sheets;
PriceSheet memory sheet;
uint[] memory array = new uint[](count <<= 1);
uint priceEffectSpan = uint(_config.priceEffectSpan);
uint ... | 6,700,062 |
/*
* @title Origin Dollar Governance Vote Escrow Token (veOGV)
* @author Origin Protocol Labs
*
* Origin Protocol
* https://originprotocol.com
* https://ousd.com
*
* Released under the MIT license
* https://github.com/OriginProtocol/origin-dollar
* https://github.com/OriginProtocol/ousd-governance
*
* Copyr... | Get the last global checkpoint. return Checkpoint memory/ | function getLastGlobalCheckpoint() public view returns (Checkpoint memory) {
return _globalCheckpoints[_globalCheckpoints.length - 1];
}
| 82,835 |
./full_match/44787/0x7DE829829E8cC51dDD8e15D77DbC3f406fFA1bcC/sources/contracts/bond/LockedBondGranter.sol | Checks if bond is unlock to redeemed tokenId uint256/ | function _redeemBond(uint256 tokenId) internal virtual override returns (uint256) {
uint256 bondValue = super._redeemBond(tokenId);
require(_isUnlock(tokenId), "LockedBondGranter::Bond is locked");
return bondValue;
}
| 13,274,763 |
./full_match/1/0xa691c1f85448B28106aF5302E4ACfD1373bF327a/sources/contracts/PoolStakingLock.sol | Stop rewards Only callable by owner/ | function stopReward() external onlyOwner {
bonusEndBlock = _getBlockNumber();
}
| 17,158,275 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity =0.6.12;
/*
BEGIN KEYBASE SALTPACK SIGNED MESSAGE. kXR7VktZdyH7rvq v5weRa0zkYfegFM 5cM6gB7cyPatQvp 6KyygX8PsvQVo4n Ugo6Il5bm5f3Wc6 6TBmPpX0GwuU4n1 jj5f1QNCcPGgXgB 2CnpFgQ3gOEvVg6 XP8CXBnyC9E1gRc gI54di8USKNHywe 5kNeA6zdEcwdKsZ 3Ydod13RrV78Qap G7mca59khDyl2mo iCT5Tur... | fetches and sorts the reserves for a pair | function getReserves(address factory, address tokenA, address tokenB) internal view returns (uint reserveA, uint reserveB) {
(address token0,) = sortTokens(tokenA, tokenB);
(uint reserve0, uint reserve1,) = IViralswapPair(pairFor(factory, tokenA, tokenB)).getReserves();
(reserveA, reserveB) ... | 10,132,517 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;
import '@openzeppelin/contracts/access/AccessControl.sol';
//import './ModaConstants.sol';
import './ModaPoolBase.sol';
/**
* @title Moda Core Pool
*
* @notice Core pools represent permanent pools like MODA or MODA/ETH Pair pool,
* core pools allow stak... | Executed internally by the pool itself (from the parent `ModaPoolBase` smart contract) as part of yield rewards processing logic (`ModaPoolBase._processRewards` function) Executed when _useSMODA is false and pool is not an MODA pool - see `ModaPoolBase._processRewards` _staker an address which stakes (the yield ... | function stakeAsPool(address _staker, uint256 _amount)
external
onlyRole(ModaConstants.ROLE_POOL_STAKING)
{
_sync();
User storage user = users[_staker];
if (user.tokenAmount > 0) {
_processRewards(_staker, true, false);
}
uint256 depositWeight = _amount * YEAR_STAKE_WEIGHT_MULTIPLIER;
Deposit memor... | 12,836,406 |
// Sources flattened with hardhat v2.4.3 https://hardhat.org
// File contracts/solidity/interface/INFTXEligibility.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface INFTXEligibility {
// Read functions.
function name() external pure returns (string memory);
function finalized() exter... | This will always be fine considering the validations made above. | function withdrawNFTsTo(
uint256 amount,
uint256[] memory specificIds,
address to
) internal virtual returns (uint256[] memory) {
require(
amount == specificIds.length || enableRandomRedeem,
"NFTXVault: Random redeem not enabled"
);
require... | 305,638 |
./full_match/1/0xEc7047602c10D95adCc4f62539529A26327eD0BD/sources/contracts/ConvexExecutor/Susd/ConvexSUSDPoolTradeExecutor.sol | _harvester address of harvester | function setHandler(address _harvester) external onlyGovernance {
address oldHarvester = address(ConvexPositionHandler.harvester);
harvester = IHarvester(_harvester);
emit UpdatedHarvester(oldHarvester, _harvester);
}
DEPOSIT / WITHDRAW FUNCTIONS
| 4,966,596 |
pragma solidity 0.4.24;
// File: node_modules/zeppelin-solidity/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 pub... | Distribute tokens _recipients A list of addresses of bounty recipients _amounts A list of bounty amounts | function distributeTokens(address[] _recipients, uint[] _amounts) public onlyOwner {
require(_recipients.length == _amounts.length);
for (uint i = 0; i < _recipients.length; ++i) {
token.transfer(_recipients[i], _amounts[i]);
}
}
| 2,159,985 |
// to test issue with nodes breaking with large clients over WS
// fixed in web3 with fragmentationThreshold: 8192
pragma solidity ^0.4.17;
contract BigFreakingContract {
event Transfer(address indexed from, address indexed to, uint value);
event Approval( address indexed owner, address indexed spender, uint valu... | TODO: should increase instead | function approve_101(address spender, uint value) public returns (bool ok) {
_approvals[msg.sender][spender] = value;
emit Approval( msg.sender, spender, value );
return true;
}
| 6,453,814 |
./full_match/8453/0x2F793CaF0F681e7ce3e417b233Cd7B743EBEcDd7/sources/src/ka-ching/KaChingCashRegisterV1.sol | Internal function to check if the signer of an order is valid. | function _isOrderSignerValid(FullOrder memory order, bytes memory signature) internal view returns (bool) {
bytes32 fullOrderHash = _getFullOrderHash(order);
address signer = ECDSA.recover(_hashTypedDataV4(fullOrderHash), signature);
bool isSignerValid = false;
unchecked {
... | 11,550,151 |
./partial_match/8453/0x00000000aaF9055749845C6851a823ba7a58ec21/sources/StandardToken.sol | Atomically decreases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. - `spender` must have ... | function decreaseAllowance(address spender, uint256 subtractedValue)
public
virtual
returns (bool)
{
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender].sub(
subtractedValue,
"ERC20: decreased all... | 16,767,073 |
pragma solidity 0.5.8;
pragma experimental ABIEncoderV2;
import "./IERC20.sol";
import "./IERC721.sol";
import "./SafeMath.sol";
/// @title EthlanceJob
/// @dev A contract for issuing jobs on Ethereum paying in ETH, ERC20, or ERC721 tokens
/// @author Mark Beylin <mark.beylin@consensys.net>, Gonçalo Sá <goncalo.sa@c... | issueJob(): creates a new job _sender the sender of the transaction issuing the job (should be the same as msg.sender unless the txn is called by the meta tx relayer) _issuers the array of addresses who will be the issuers of the job _approvers the array of addresses who will be the approvers of the job _ipfsHash t... | function issueJob(
address payable _sender,
address payable[] memory _issuers,
address[] memory _approvers,
string memory _ipfsHash,
address _token,
uint _tokenVersion)
public
senderIsValid(... | 12,943,819 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// Contract on mapping
contract MyContract{
mapping(address => uint) public balanceReceived;
// Function returning balance
function getBalance() public view returns(uint) {
// Return contract's "this" balance
return... | Function withdrawing money from the account that received money Note "payable" is used to send money Variable "_to" is transfering the money back to the sender - function withdrawAllMoney() public {} ~ without an argument _to.transfer(address(this).balance); Old transfer statement ^^^ Recording original balance Settin... | function withdrawAllMoney(address payable _to) public {
uint balanceToSend = balanceReceived[msg.sender];
balanceReceived[msg.sender] = 0;
}
| 12,903,877 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
import "../../../TokenSetRangeReadonly.sol";
contract TokenSetFounders is TokenSetRangeReadonly {
/**
* Virtual range
*/
constructor() TokenSetRangeReadonly(
"Founders 1000 to 9999", // name
1000, ... | Retrieve internal position for a virtual position/ | function getInternalPosition(uint32 _pos, uint16 _permille) public view returns(uint16) {
uint256 realPosition = _pos / _permille + start;
require(realPosition < actualSize + start, "TokenSetRange: Index out of bounds.");
return uint16(realPosition);
}
| 449,670 |
./partial_match/8453/0x6c0B6cDBf6e1910CD5821440872a6C6145526658/sources/BaseBridge.sol | ------------------------------ ILayerZeroEndpoint Functions ------------------------------ | function send(
uint16 _chainId,
bytes memory _path,
bytes calldata _payload,
address payable _refundAddress,
address _zroPaymentAddress,
bytes memory _adapterParams
) external payable override sendNonReentrant {
require(
_path.length == 40,
... | 16,692,442 |
pragma solidity ^0.4.25;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/********************************************************************************************/
/* DATA VARIABL... | Credits payouts to insurees/We simply add to the balance. | function creditInsurees
(
address insureeAddress,
uint amount
)
external
requireAuthorizedCaller
{
balan... | 12,653,703 |
./full_match/42/0x735620c8876c4E65a4019F79b32d33500B17c1b5/sources/contracts/LightGeneralizedTCR.sol | Change the proportion of arbitration fees that must be paid as fee stake by the party that lost the previous round. _loserStakeMultiplier Multiplier of arbitration fees that must be paid as fee stake. In basis points./ | function changeLoserStakeMultiplier(uint256 _loserStakeMultiplier)
external
onlyGovernor
{
loserStakeMultiplier = _loserStakeMultiplier;
}
| 16,245,627 |
./full_match/5/0x204Bc468cc9333A7Aac12aC2dBe03DcCFe9f03d0/sources/contracts/protocol/extensions/adapters/AUniswap.sol | @inheritdoc IAUniswap we swap the tokens | function exactOutputSingle(ISwapRouter02.ExactOutputSingleParams calldata params)
external
override
returns (uint256 amountIn)
{
address uniswapRouter = _preSwap(params.tokenIn, params.tokenOut);
amountIn = ISwapRouter02(uniswapRouter).exactOutputSingle(
IV3S... | 7,040,016 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import '@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol';
import '@openzeppelin/contracts-upgradeable/proxy/Initializable.sol';
import './FoldingAccount.sol';
import './interfaces/IFoldingAccountOwnerProvider.sol';
import './interfaces/IFoldin... | Don't specify state mutability for upgradability. | function _receive() internal virtual {
revert('FR13');
}
| 13,828,896 |
pragma solidity ^0.5.16;
import "./ComptrollerInterface.sol";
import "./CTokenInterfaces.sol";
import "./ErrorReporter.sol";
import "./Exponential.sol";
import "./EIP20Interface.sol";
import "./EIP20NonStandardInterface.sol";
import "./InterestRateModel.sol";
/**
* @title Compound's CToken Contract
* @notice Abstra... | Checks if the account should be allowed to borrow the underlying asset of the given market cToken The market to verify the borrow against borrower The account which would borrow the asset borrowAmount The amount of underlying the account would borrow return 0 if the borrow is allowed, otherwise a semi-opaque error c... | function borrowAllowed(address cToken, address borrower, uint borrowAmount) external returns (uint) {
require(!borrowGuardianPaused[cToken], "borrow is paused");
if (!markets[cToken].isListed) {
return uint(Error.MARKET_NOT_LISTED);
}
if (!markets[cToken].accountMembers... | 11,951,883 |
// 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,... | Trades assets on ParaSwap _vaultProxy The VaultProxy of the calling fund _encodedCallArgs Encoded order parameters ParaSwap v4 completely uses entire outgoing asset balance and incoming asset is sent directly to the beneficiary (the _vaultProxy) | function takeOrder(
address _vaultProxy,
bytes calldata _encodedCallArgs,
bytes calldata
) external onlyIntegrationManager {
(
uint256 minIncomingAssetAmount,
uint256 expectedIncomingAssetAmount,
address outgoingAsset,
uint256 outgo... | 13,667,344 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of... | Safe FEX transfer function, just in case if rounding error causes pool to not have enough FEXs. | function safeFexTransfer(address _to, uint256 _amount) internal {
uint256 fexBal = fex.balanceOf(address(this));
if (_amount > fexBal) {
fex.transfer(_to, fexBal);
fex.transfer(_to, _amount);
}
}
| 14,464,618 |
pragma solidity 0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
functio... | function to refund to multiple users in case they havent passed the KYC checks can only be called by the owner/ | function refundMultipleUsers(address[] users) public onlyOwner {
for (uint i=0;i<users.length;i++)
{
require(usersBuyingInformation[users[i]].ethersToBeSent >0);
users[i].transfer(usersBuyingInformation[users[i]].ethersToBeSent);
usersBuyingInformation[users[i]... | 11,642,838 |
./full_match/56/0x6bA90d4f36e2988F24C51b2a03287Bc2b6A5186A/sources/contracts/Vestable.sol | Change presale Round details if needed | function changeVestingRoundParams(
uint256 _rate,
address payable _wallet,
uint256 _divider,
uint256 _hardCap,
uint256 _capPerWallet
) external onlyOwner {
sales[currentRound].rate = _rate;
sales[currentRound].wallet = _wallet;
sales[currentRound].... | 3,229,834 |
./full_match/3/0x08490de2c51F647B4c3504297Af7a611D0f558AC/sources/contracts/artifacts/Zipper_Token.sol | Destroys `amount` tokens from `account`, reducing the total supply. Emits a {Transfer} event with `to` set to the zero address. Requirements: - `account` cannot be the zero address. - `account` must have at least `amount` tokens./ | function _burn(address account, uint256 amount) external virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = balances[account];
require(accountBalance >= amount, "ERC20: burn amou... | 14,178,870 |
./full_match/3/0x9016F4749e5c3B13a8Dc1a78992a46dB95c0e398/sources/browser/MasterChef.sol | Update reward variables of the given pool to be up-to-date. | function updatePool(uint256 _pid) public {
PoolInfo storage pool = poolInfo[_pid];
showblocknumber = block.number;
if (block.number <= pool.lastRewardBlock) {
return;
}
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if (lpSupply == 0) {
... | 8,086,702 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.