file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
// Verified by Darwinia Network
// hevm: flattened sources of src/ItemBase.sol
pragma solidity >0.4.13 >=0.4.23 >=0.4.24 <0.7.0 >=0.6.7 <0.7.0;
////// lib/ds-auth/src/auth.sol
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published b... | Same with constructor, but is used and called by storage proxy as logic contract./ trick test lastItemObjectId = 1000000; | function getMetaInfo(uint256 _index)
external
view
returns (
uint16,
uint16,
uint16,
uint128
);
@dev returns canDisenchant of the formula.
function canDisenchant(uint256 _index) external view returns (bool);
}
}
}
}
function initialize(address _registry) public initializer {
o... | 441,371 |
// v7
/**
* Presale.sol
*/
pragma solidity ^0.4.23;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
* @param a First number
* @param b Second number
*/
function mu... | InvestorsStorage InvestorStorage contract interface with newInvestment and getInvestedAmount functions which need to be implemented/ | interface InvestorsStorage {
function newInvestment(address _investor, uint256 _amount) external;
function getInvestedAmount(address _investor) external view returns (uint256);
}
| 6,461,322 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/Addres... | Harvest farm tokens Check if there is any unlocked amount Swap half earned to token0 | function earn() public whenNotPaused {
require(isAutoComp, "iSwapStrategyAlpaca: !isAutoComp");
require(!notPublic || isAuthorised(msg.sender), "iSwapStrategyAlpaca: !authorised");
IFairLaunch(farmContractAddress).harvest(pid);
if (checkForUnlockReward) {
if (IAlpacaToke... | 13,068,890 |
// SPDX-License-Identifier: LGPL-3.0
pragma solidity ^0.8.9;
import "./BDERC1155Tradable.sol";
import "./IWarrior.sol";
import "./IRegion.sol";
//Import ERC1155 standard for utilizing FAME tokens
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Ho... | Get the Base Value (guaranteed FAME contents) of a given chest type chestType The type of chest (1=Bronze,2=Silver,3=Gold,4=Diamond)return value The Value (amount of FAME) included in the chest type/ | function getBaseValue(ChestType chestType) public pure returns (uint value) {
require(chestType > ChestType.NULL && chestType <= ChestType.DIAMOND, "ILLEGAL CHEST TYPE");
value = FIXED_VALUE_BASE * (2**(uint(chestType)-1));
}
| 13,683,517 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.2 <0.8.0;
import "../interface/IERC20.sol";
import "../interface/ILToken.sol";
import "./ERC20.sol";
import "../math/UnsignedSafeMath.sol";
/**
* @title Deri Protocol liquidity provider token implementation
*/
contract LToken is IERC20, ILToken, ERC20 {
us... | See {IERC20}.{transfer}/ | function transfer(address to, uint256 amount) public override returns (bool) {
require(to != address(0), "ERC20: transfer to 0 address");
require(_balances[msg.sender] >= amount, "ERC20: transfer amount exceeds balance");
_transfer(msg.sender, to, amount);
return true;
}
| 10,376,714 |
// File: @openzeppelin/contracts/utils/EnumerableSet.sol
// SPDX-License-Identifier: MIT AND GPL-3.0-or-later
pragma solidity ^0.6.0;
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are ... | Calculate value in tokens the given hash credits are worth/ xyk algorithm x0y0 = x1y1 -> x1 = (x0y0)/y1 NB above require() ensures overflow safety | function get_hash_credits_conversion( uint256 hc )
public view
returns (uint256)
{
require( hc > 1, "HC underflow" );
require( hc < (1 << 128), "HC overflow" );
uint256 x0 = token_reserve;
uint256 y0 = hc_reserve;
require( x0 < (1 << 128), "Token balance overflow" );
... | 11,987,862 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.4;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC... | _rebalanceDuration parameter passes in seconds | function setRebalanceDuration(uint256 _rebalanceDuration) public onlyOwner {
require(_rebalanceDuration <= 7 days, "CP: invalid rebalance duration");
rebalanceDuration = _rebalanceDuration;
}
| 1,171,469 |
pragma solidity ^0.4.8;
import "./SmsCoin.sol";
contract SMSReward {
SMSCoin smscoin; // SMS contract instance
address[] whiteListAddress;
event Log(string, uint);
address owner;
uint public totalSupply;
uint256 public constant decimals = 3;
uint256 public constant UNIT = 10 ** decima... | Constructor which takes address of smart contract | function SMSReward(address smsCoinAddress) public {
owner = msg.sender;
smscoin = SMSCoin(smsCoinAddress);
}
| 5,526,983 |
/**
*Submitted for verification at Etherscan.io on 2022-04-13
*/
// Sources flattened with hardhat v2.8.2 https://hardhat.org
// File @openzeppelin/contracts/token/ERC20/[email protected]
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev ... | Withdraw LP tokens from BaseRewardPool contract and return to user. lpAmount Amount of LP tokens to withdraw Update records: substract withdrawing LP amount from total LP amount staked substract withdrawing LP amount from user's balance Withdraw and unwrap to LP token | function withdrawWithLP(uint256 lpAmount) public nonReentrant notPaused updateReward(msg.sender) {
require(lpAmount > 0, "Cannot withdraw 0");
_totalSupply = (_totalSupply - lpAmount);
_balances[msg.sender] = (_balances[msg.sender] - lpAmount);
convexBaseRewardPool.withdrawAndUnwra... | 10,510,040 |
pragma solidity ^0.5.16;
/**
* @title Careful Math
* @author Compound
* @notice Derived from OpenZeppelin's SafeMath library
* https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/math/SafeMath.sol
*/
contract CarefulMath {
/**
* @dev Possible error codes that we can return... | Divide a scalar by an Exp, then truncate to return an unsigned integer./ | function divScalarByExpTruncate(uint256 scalar, Exp memory divisor)
internal
pure
returns (MathError, uint256)
{
(MathError err, Exp memory fraction) = divScalarByExp(scalar, divisor);
if (err != MathError.NO_ERROR) {
return (err, 0);
}
return... | 1,271,128 |
./partial_match/1/0x102a796Eb323C90Ea233Cf0cf454AfA7D0441252/sources/UiPoolDataProvider.sol | IVariableDebtToken Aave Defines the basic interface for a variable debt token./ | interface IVariableDebtToken is IScaledBalanceToken {
event Mint(address indexed from, address indexed onBehalfOf, uint256 value, uint256 index);
function mint(
address user,
address onBehalfOf,
uint256 amount,
uint256 index
) external returns (bool);
event Burn(address indexed user, uint256 a... | 3,879,268 |
pragma solidity ^0.4.17;
/// @title Interface for contracts conforming to ERC-721: Non-Fungible Tokens
/// @author Dieter Shirley <dete@axiomzen.co> (https://github.com/dete)
contract ERC721 {
// Required methods
function implementsERC721() public pure returns (bool);
function totalSupply() public view ret... | 生成一个从 _min 到 _max 范围内的随机数(不包括 _max) | function _randMod(uint _min, uint _max) private returns(uint) {
randNonce++;
uint modulus = _max - _min;
return uint(keccak256(now, msg.sender, randNonce)) % modulus + _min;
}
| 1,223,217 |
./partial_match/8453/0xb01DB992BFa6f7eC5AA15C93e9e0Ab1077010594/sources/WritingEditions.sol | > [[[[[[[[[[[ Modifiers ]]]]]]]]]]] | function treasuryConfiguration() external view returns (address);
function transferFunds(address payable to, uint256 value) external;
function transferERC20(
address token,
address to,
uint256 value
) external;
function transferERC721(
address token,
addres... | 16,800,919 |
// SPDX-License-Identifier: MIT
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 available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, sinc... | See {ICFolioItemHandler-getRewards} Note: tokenId must be a base SFT card We allow reward pull only for unlocked SFTs./ Validate parameters Verify that tokenId has a valid cFolio address Verify that the tokenId is owned by owner and caller is sftMinter. This also verifies that the token is not locked in TradeFloor. | function getRewards(
address owner,
address recipient,
uint256 tokenId
) external override {
require(recipient != address(0), 'CFIH: Invalid recipient');
require(tokenId.isBaseCard(), 'CFIH: Invalid tokenId');
uint256 sftTokenId = tokenId.toSftTokenId();
address cfolio = sftHolder.token... | 14,368,567 |
/*
Copyright 2021 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... | METHODOLOGIST ONLY: Marks a currently protected module as unprotected and deletes its authorized extension registries. Removes old module from the protected modules list. Called by the methodologist when they want to cede control over a protected module without triggering an emergency (for example, to remove it because... | function unProtectModule(address _module) external onlyMethodologist {
_unProtectModule(_module);
emit ModuleUnprotected(_module);
}
| 280,458 |
pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0 || b == 0) ... | Check if the targeted balance is enough Subtract from the sender Updates totalSupply | function _burn(address _from, uint256 _value)
internal {
require(_balanceOf[_from] >= _value, "Insuffient balance!");
_balanceOf[_from] = _balanceOf[_from].sub(_value);
totalSupply = totalSupply.sub(_value);
emit Burn(msg.sender, _value);
emit Transfer(_from, address(0), ... | 13,031,519 |
./full_match/1/0xDdF499e726Bfde29Ce035F6B355e55757F08B5EF/sources/contracts/amo/Ramos.sol | Rebalance down when `protocolToken` spot price is above TPI. Single-side WITHDRAW `quoteToken` from balancer liquidity pool to lower price. BPT tokens are withdrawn from Aura rewards staking contract and used for balancer pool exit. Ramos rebalance fees are deducted from the amount of `quoteToken` returned from the exi... | function rebalanceDownExit(
uint256 bptAmountIn,
uint256 minQuoteTokenAmountOut
) external override onlyElevatedAccess whenNotPaused enoughCooldown {
_validateParams(minQuoteTokenAmountOut, bptAmountIn, maxRebalanceAmounts.bpt);
lastRebalanceTimeSecs = uint64(block.timestamp);
... | 3,065,504 |
pragma solidity ^0.4.24;
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is als... | Returns array with owner addresses, which confirmed transaction. transactionId Transaction ID. return Returns array of owner addresses. | function getConfirmations(uint transactionId)
public
constant
returns (address[] _confirmations)
{
address[] memory confirmationsTemp = new address[](owners.length);
uint count = 0;
uint i;
for (i=0; i<owners.length; i++)
if (confirmations[transactionId][o... | 951,371 |
./full_match/11155111/0x3f9C6646CCFa4597C45761B3e9a1Da0cF00253D5/sources/src/Streams.sol | Calculate the amount squeezable by a user from a single streams history entry. userId The ID of the user to squeeze streams for. historyEntry The squeezed history entry. squeezeStartCap The squeezed time range start. squeezeEndCap The squeezed time range end. return squeezedAmt The squeezed amount. Binary search fo... | function _squeezedAmt(
uint256 userId,
StreamsHistory memory historyEntry,
uint32 squeezeStartCap,
uint32 squeezeEndCap
) private view returns (uint128 squeezedAmt) {
unchecked {
StreamReceiver[] memory receivers = historyEntry.receivers;
uint256 i... | 3,824,097 |
/*
・
* ★
・ 。
・ ゚☆ 。
* ★ ゚・。 * 。
* ☆ 。・゚*.。
゚ *.。☆。★ ・
` .-:::::-.` `-::---...```
`-:` .:+ssssoooo++//:.` .-/+shhhhhhhhhhhhhyyyssooo:
.--::. .+o... | ERC-721 Non-Fungible Token Standard, optional enumeration extension/ | interface IERC721EnumerableUpgradeable is IERC721Upgradeable {
function totalSupply() external view returns (uint256);
function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);
function tokenByIndex(uint256 index) external view returns (uint256);
}
}
| 93,032 |
./full_match/1/0x66600c4f55527C410D4067b21474c0fa1fe1331D/sources/@metalabel/solmate/src/tokens/ERC721.sol | Ownership check above ensures no underflow. | function _burn(uint256 id) internal virtual {
address owner = _tokenData[id].owner;
require(owner != address(0), "NOT_MINTED");
unchecked {
_balanceOf[owner]--;
}
delete _tokenData[id];
delete getApproved[id];
emit Transfer(owner, address(0), ... | 4,932,384 |
./full_match/42/0xD2830892D28ceFA2cb3aA0D67A38357654b9b16a/sources/browser/KaizenAirdropper.sol | -------------------------------------------------------------------------------------------------------------------------- | {
address private admin;
address private signOwner;
IERC20 private token;
uint256 private defaultTokensAmount;
uint32 private claimedCount;
mapping(uint16 => uint256) private bitmask;
string private constant ERR_MSG_SENDER = "ERR_MSG_SENDER";
string private constant ERR_AM... | 16,203,472 |
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;
/**
* @dev The Ownable constructor sets the orig... | This function is called when crowdsale is successfully finalized./ | function close() onlyOwner {
require(state == State.Active);
state = State.Closed;
uint256 balance = this.balance;
uint256 reserveAmountForEach = div(balance, reserveWallet.length);
for(uint8 i = 0; i < reserveWallet.length; i++){
reserveWallet[i].transfer(reserveAmountForEach);
Transf... | 1,015,755 |
./full_match/1/0x6d8B6B7ce705a13f4C1F82398974F52Df3E4abC9/sources/SmileOfDAO.sol | _voteType = 1 : Up Vote _voteType = 2 : Down Vote _voteType = 3 : Nutral Vote | function voteProposal(uint256 _proposalID, uint256 _voteType) public {
require(token.balanceOf(msg.sender) >= 1, "Not enough NFT in your account");
require(proposalID >= _proposalID, "Proposal not exist");
require(proposal[_proposalID].isApproved, "Proposal not approved");
require(!p... | 8,401,785 |
//Address: 0xA25D01d15fC0e3cDeDE1BEbEE4124394aaE0DB33
//Contract name: FollowCoin
//Balance: 0 Ether
//Verification Date: 10/27/2017
//Transacion Count: 1113
// CODE STARTS HERE
pragma solidity ^0.4.13;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
fu... | Transfer tokens from other address Send `_value` tokens to `_to` in behalf of `_from` _from The address of the sender _to The address of the recipient _value the amount to send/ | function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {
allowance[_from][msg.sender] -= _value;
_transfer(_from, _to, _value);
return true;
}
| 1,014,684 |
/*element14*/
/*CoinFlip 1% of HouseEdge*/
// <ORACLIZE_API>
/*
Copyright (c) 2015-2016 Oraclize SRL
Copyright (c) 2016 Oraclize LTD
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without re... | ConstructorVarsminBet = (5000000000000000 1 wei);adminFee=99; 1% of houseEdgeoraclizeGasLimit = 235000;maxProfitPercentage=1; | function CoinFlip() payable {
adminAddress=msg.sender;
}
| 432,526 |
//Address: 0xdf68995f07882120b44da1d0fabf41ca1681deec
//Contract name: Provide
//Balance: 0 Ether
//Verification Date: 8/30/2017
//Transacion Count: 1
// CODE STARTS HERE
pragma solidity ^0.4.13;
/**
* Provide platform contract.
*/
contract Provide {
using SafeMath for uint;
/** Provide contract owner; has ... | Calculate amount of vested tokens at a specific time. tokens uint256 The amount of tokens granted time uint64 The time to be checked start uint64 A time representing the beginning of the grant cliff uint64 The cliff period vesting uint64 The vesting period return An uint representing the amount of vested tokens fr... | function calculateVestedTokens(uint256 tokens, uint256 time, uint256 start, uint256 cliff, uint256 vesting) constant returns (uint256) {
if (time < cliff) return 0;
if (time >= vesting) return tokens;
uint vestedTokens = tokens.mul(time.sub(start)).div(vesting.sub(start));
return vestedToken... | 7,215,239 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../utils/Context.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 functions.
*
* By default, the owner account will be the on... | IVariety interface Simon Fremaux (@dievardump) | interface IVariety is IERC721 {
function plant(address to, bytes32[] memory seeds)
external
returns (uint256);
function getTokenSeed(uint256 tokenId) external view returns (bytes32);
function requestSeedChange(uint256 tokenId) external;
function changeSeedAfterRequest(uint256 tokenId)... | 9,937,778 |
./full_match/5/0xd752E6bc0ea3cC7c8f0272A2504A0424ABD96734/sources/contracts/DataSharing.sol | Fungsi untuk mengunggah data pasien ke IPFS | function uploadPatientData(string memory ipfsHash) public onlyHospital {
patients[msg.sender].ipfsHash = ipfsHash;
patients[msg.sender].hospital = msg.sender;
}
| 11,621,129 |
./partial_match/1/0x1ab8Ee0cbC2D2A2F0E09a094358f3b0aAc275268/sources/Etherland.sol | Allow any NFT admin to set public prices for record rights _indexedRecordOffers Array of indexed public ELAND prices of record rights return boolean indicating operation success/failure/ | function setRecordRightsOffers(uint[] memory _indexedRecordOffers) public isNftAdmin returns (bool) {
recordRightsOffers = _indexedRecordOffers;
return true;
}
| 3,662,937 |
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.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... | private function utilized by withdrawFund _addr Address of receiver _amt Amount to withdraw/ | function _withdraw(address _addr, uint256 _amt) private {
require(success, "Transfer failed");
}
| 13,708,013 |
./full_match/100/0x58614A66Dcb3A6D120b8d94bE21140aC6FF8842E/sources/contracts/OrbisMain.sol | Interface for the ERC20 contracts created for reputation/ | interface ReputationToken {
function getIsGovernanceActive() external view returns(bool);
function mint(address _member, uint _amount) external;
function burn(address _member, uint _amount) external;
function setMerkleRoot(uint _type, uint _id, bytes32 _merkleRoot) external;
} | 14,270,651 |
// Prop.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/interfaces/IERC2981.sol";
i... | Admin role can allowed un operator _address operator address value true / false/ | function setIsOperatorAllowed(address _address, bool value) external onlyRole(ADMIN_ROLE) {
isOperatorAllowed[_address] = value;
}
| 12,763,218 |
/**
* This smart contract code is Copyright 2017 TokenMarket Ltd. For more information see https://tokenmarket.net
*
* Licensed under the Apache License, version 2.0: https://github.com/TokenMarketNet/ico/blob/master/LICENSE.txt
*/
pragma solidity ^0.4.6;
import "./Crowdsale.sol";
import "./SafeMathLib.sol";
/*... | Load funds to the crowdsale for a single investor./ Crowdsale not yet set | function participateCrowdsaleInvestor(address investor) public {
if(address(crowdsale) == 0) throw;
moving = true;
if(balances[investor] > 0) {
uint amount = balances[investor];
delete balances[investor];
crowdsale.invest.value(amount)(investor);
}
}
| 12,605,157 |
/// SPDX-License-Identifier: MIT
/*
▄▄█ ▄ ██ █▄▄▄▄ ▄█
██ █ █ █ █ ▄▀ ██
██ ██ █ █▄▄█ █▀▀▌ ██
▐█ █ █ █ █ █ █ █ ▐█
▐ █ █ █ █ █ ▐
█ ██ █ ▀
▀ */
/// Special thanks to Keno, Boring and Gonpachi for review and continued inspiration.
pragma solidity 0.6.12;
pr... | / Stake SUSHI `amount` into crXSUSHI and BENTO for benefit of `to` by batching calls to `sushiBar`, `crXSushiToken` and `bento`. | function stakeSushiToCreamToBento(address to, uint256 amount) external {
}
| 44,121 |
./partial_match/1/0xD42a2bB59775694c9Df4c7822BfFAb150e6c699D/sources/src/PRBProxyRegistry.sol | @inheritdoc IPRBProxyRegistry | function getPermissionByOwner(
address owner,
address envoy,
address target
)
external
view
returns (bool permission)
{
permission = _permissions[owner][envoy][target];
}
| 15,704,782 |
./full_match/56/0xE40244Ea8B851137e75638702F5F29e1F0963dA2/sources/goerlitest.sol | claim any tokens from reward wrapper if someone accidently sent it. token: token address to be rescued amount: amount to take out from wrapper | function claimStuckedTokensFromRewardWrapper (address token, uint256 amount) external onlyOwner{
rewardFundManager.claimStuckedTokens(token, amount);
}
| 3,240,386 |
// File: contracts/interfaces/IDelegable.sol
pragma solidity ^0.6.10;
interface IDelegable {
function ADDDELEGATE653(address) external; //inject NONSTANDARD NAMING
function ADDDELEGATEBYSIGNATURE882(address, address, uint, uint8, bytes32, byt... | inject NONSTANDARD NAMING | function TOINT256710(uint256 x) internal pure returns(int256) { | 12,707,208 |
./full_match/3/0x87B6AED8Fc0836950788621c1241446e3946dDdd/sources/CryptoTokens.sol | mint a new crypto token check if thic fucntion caller is not an zero address account increment counter check if a token exists with the above token id => incremented counter check if the token URI already exists or not check if the token name already exists or not mint the token set token URI (bind token id with the pa... | function mintCryptoToken(string memory _name, string memory _tokenURI, uint256 _price, string memory _tokenDesc, uint256 _dateMinted) external {
require(msg.sender != address(0));
cryptoTokenCounter++;
require(!_exists(cryptoTokenCounter));
require(!tokenURIExists[_tokenURI]);
require(!tokenNameE... | 14,231,466 |
./full_match/100/0x2c3DE641b0448FF29f917F9808ce63047A04d83c/sources/contracts/rari-fuse/src/core/CToken.sol | Sender repays their own borrow repayAmount The amount to repay return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount./ accrueInterest emits logs on errors, but we still want to log the fact that an attempted borrow failed | function repayBorrowInternal(uint256 repayAmount)
internal
nonReentrant(false)
returns (uint256, uint256)
{
uint256 error = accrueInterest();
if (error != uint256(Error.NO_ERROR)) {
return (
fail(
Error(error),
... | 14,267,942 |
./partial_match/1/0x6e2A189AdF666C06950169f11197aB0C549d5C42/sources/xETH.sol | burnShares allows for burning xETH tokens this function can only burn tokens if the contract is not paused this function can only be called by the MINTER_ROLE amount amount of xETH to be burned, it cannot be 0 | function burnShares(
uint256 amount
) external onlyRole(MINTER_ROLE) {
if (amount == 0) revert AmountZeroProvided();
_burn(msg.sender, amount);
| 9,220,330 |
./partial_match/1/0xE4764f9cd8ECc9659d3abf35259638B20ac536E4/sources/contracts/protocol/ParticleExchange.sol | @inheritdoc IParticleExchange verify that auction is concluded (i.e., liquidation condition has met) | function withdrawEth(Lien calldata lien, uint256 lienId) external override validateLien(lien, lienId) nonReentrant {
if (msg.sender != lien.lender) {
revert Errors.Unauthorized();
}
if (lien.loanStartTime == 0) {
revert Errors.InactiveLoan();
}
if (l... | 4,052,300 |
/* Copyright (C) 2020 NexusMutual.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 program is distribu... | Returns tokens locked and validity for a specified address and reason _of The address whose tokens are locked _reason The reason to query the lock tokens for/ | function tokensLockedWithValidity(address _of, bytes32 _reason)
public
view
returns (uint256 amount, uint256 validity)
{
bool claimed = locked[_of][_reason].claimed;
amount = locked[_of][_reason].amount;
validity = locked[_of][_reason].validity;
if (claimed) {
amount = 0;
}
}
| 2,577,972 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.4;
import "@openzeppelin/contracts/access/Ownable.sol";
import "./CVNX.sol";
import "./ICVNXGovernance.sol";
/// @notice Governance contract for CVNX token.
contract CVNXGovernance is ICVNXGovernance, Ownable {
CVNX private cvnx;
/// @notice Emit when n... | Mint new CVNX tokens. _account Address that receive tokens _amount Tokens amount | function mint(address _account, uint256 _amount) external override onlyOwner {
require(totalSupply() + _amount <= 60000000000000000000000000, "[E-71] - Can't mint more.");
_mint(_account, _amount);
}
| 10,119,312 |
pragma solidity ^0.4.24;
import "openzeppelin-solidity/contracts/token/ERC20/StandardToken.sol";
/**
* @title Tradeable Token
* @dev Standard Token which can be trade within the contract.
* we support buy() and sell() function in a simpilified bancor algorithm which CW = 50%.
*/
contract TradeableToken is Standard... | Read Only Return the buy price of 1 individual token./ our calculation relies on the token supply, so we need supply. Doh. | function sellPrice()
public
view
returns(uint256)
{
if(totalSupply_ == 0){
return tokenPriceInitial_ - tokenPriceIncremental_;
uint256 _ether = tokensToEther_(1e18);
return _ether;
}
}
| 14,067,035 |
pragma solidity ^0.4.23;
/*
Options Exchange
========================
An Exchange for American Options.
An American Option is a contract between its Buyer and its Seller, giving the Buyer the ability
to buy (or sell) an Asset at a specified Strike Price any time before a specified time (Maturation).
Authors: /u/Cin... | Allows a Taker to fill an offchain Option order created by a Maker. Transitions new Options from Available to Live, depositing its implicitly stored locked funds. Maintains state of existing Options as Live, without affecting their implicitly stored locked funds. Verify offchain order hasn&39;t expired. A hash of the O... | function fillOptionOrder(address[3] assetLocked_assetTraded_firstMaker,
uint256[3] amountLocked_amountTraded_maturation,
uint256[2] amountPremium_expiration,
address assetPremium,
bool makerIsSeller,
... | 10,538,693 |
// Sources flattened with buidler v1.4.3 https://buidler.dev
// File @openzeppelin/contracts/utils/SafeCast.sol@v3.1.0
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow
* checks.
*
* Downcasting from uint256/int256 in ... | Abstract function which validates whether or not an NFT is accepted for staking and retrieves its associated weight. MUST throw if the token is invalid. tokenId uint256 token identifier of the NFT. return uint64 the weight of the NFT./ Interface for the NftStaking whitelisted NFT contract./ | interface IWhitelistedNftContract {
function safeTransferFrom(
address from,
address to,
uint256 id,
uint256 value,
bytes calldata data
) external;
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
}
| 1,557,122 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.3;
// OpenZeppelin
import "./openzeppelin-solidity/contracts/SafeMath.sol";
import "./openzeppelin-solidity/contracts/ReentrancyGuard.sol";
import "./openzeppelin-solidity/contracts/ERC1155/ERC1155.sol";
import "./openzeppelin-solidity/contracts/ERC20/SafeERC20.sol... | Returns the number of rewards available per token for the given position. Scaled by 1e18 to avoid flooring when calculating earned(). _positionID ID of the position NFT. return (uint256) Number of rewards per token./ Prevent division by 0. | function rewardPerToken(uint256 _positionID) public view override returns (uint256) {
if (positions[_positionID].numberOfTokens == 0) {
return positions[_positionID].rewardPerTokenStored;
}
return
positions[_positionID].rewardPerTokenStored.add(
lastT... | 14,125,425 |
pragma solidity ^0.4.16;
pragma experimental "v0.5.0";
pragma experimental "ABIEncoderV2";
import {Bytes} from "../src/bytes/Bytes.sol";
contract BytesExamples {
using Bytes for *;
// Check if bytes are equal.
function bytesEqualsExample() public pure {
bytes memory bts0 = hex"01020304";
... | concatenate Should be equal to bts01 | function bytesConcatExample() public pure {
bytes memory bts0 = hex"01020304";
bytes memory bts1 = hex"05060708";
bytes memory bts01 = hex"0102030405060708";
var cct = bts0.concat(bts1);
assert(cct.equals(bts01));
}
| 12,878,381 |
./full_match/137/0x62B4dbEAd0b60F0070aA10F4ac25D24f1Eaa17BA/sources/contracts/MoeToken.sol | `amount` token getting minted here & equal amount got locked in RootChainManager `_totalSupply` and `_balances` are private. use `_mint()`_totalSupply = _totalSupply.add(amount);_balances[user] = _balances[user].add(amount); | function deposit(address user, bytes calldata depositData) external override {
require(_msgSender() == childChainManagerProxy, "You're not allowed to deposit");
uint256 amount = abi.decode(depositData, (uint256));
_mint(_msgSender(), amount);
emit Transfer(address(0), user, amoun... | 4,676,032 |
/////////////////////////////////////////////////////////////////////////////////////
//version 2.0
//Author: Taurus
//Copyright: tlu4@lsu.edu
//
//NOTE: non-view functions cannot return values, only possible way is event
//Changes from v0.9x. Each node has unique address as identifier. All pools removed
//All req and... | update a provider, you must know the provID and must sent from right addr | function updateProvider(uint64 maxTime, uint16 maxTarget, uint64 minPrice) public returns (bool) {
providerList[msg.sender].blockNumber = block.number;
providerList[msg.sender].maxTime = maxTime;
providerList[msg.sender].maxTarget = maxTarget;... | 6,430,855 |
pragma solidity ^0.4.24;
// <ORACLIZE_API>
/*
Copyright (c) 2015-2016 Oraclize SRL
Copyright (c) 2016 Oraclize LTD
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including wi... | Returns symbol of oracle currency (0x0 for ETH)/ | function getCurrencySymbol() external view returns(bytes32) {
return bytes32("POLY");
}
| 121,849 |
// SPDX-License-Identifier: GPL-3.0
/*
This file is part of the Enzyme Protocol.
(c) Enzyme Council <[email protected]>
For the full license information, please view the LICENSE
file that was distributed with this source code.
*/
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/E... | Provides a constant string identifier for a policy return identifier_ The identifer string | function identifier() external pure override returns (string memory identifier_) {
return "ADAPTER_BLACKLIST";
}
| 1,698,084 |
./full_match/4/0xC16defC75de0586274a508DFFF5D1f28105a299A/sources/contracts/Marsh_Staking_Contract.sol | Fucntion called in the event that an indexer is badly behaving. can only be triggered by an admin, results in a `SlashStakeEvent` than splits the indexer's stake between the reporter and the owner. _indexerAddress address of the indexer getting slashed reporterAddress address of the reporter/ | function RemoveStake(address _indexerAddress, address reporterAddress)
external
onlyAdmin
{
require(
_indexerExists(_indexerAddress),
"Indexer must exist and have staked"
);
approvedIndexers[_indexerAddress].hasStaked = false;
numActiveInde... | 12,390,094 |
./full_match/4/0xbaa0F03c672412f134B8f8B5781fEdb0a949E65A/sources/1.sol | Mints Numbers/ If we haven't set the starting index and this is either 1) the last saleable token or 2) the first token to be sold after the end of pre-sale, set the starting index block | function mintNumber(uint numberOfTokens) public payable {
require(saleIsActive, "Sale must be active to mint Ape");
require(numberOfTokens <= maxnumbersPurchase, "Can only mint 20 tokens at a time");
require(totalSupply().add(numberOfTokens) <= MAX_NUMBERS, "Purchase would exceed max supply ... | 804,593 |
/**
*Submitted for verification at Etherscan.io on 2021-12-14
*/
/**
*Submitted for verification at Etherscan.io on 2021-10-07
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's bu... | Returns the addition of two unsigned integers, with an overflow flag. _Available since v3.4._/ | function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
| 1,274,308 |
./full_match/80001/0x8719eB4713646a91ae18A56F960159225Aa8C725/sources/contracts/Edition.sol | /EK _mintPeriodSeconds The amount of time in seconds after which editions can no longer be minted or purchased. Use 0 to have no expiration _salePrice Sale Price _creatorName Creator Name Set ownership to original sender of contract callEK overflows are not expected to happen for timestamps, and have no security imp... | function initialize(
address _owner,
string memory _name,
string memory _symbol,
string memory _description,
string memory _imageUrl,
uint256 _editionSize,
uint256 _royaltyBPS,
uint256 _mintPeriodSeconds,
uint256 _salePrice,
string memo... | 9,468,407 |
./partial_match/1/0x508efB44A06a64Bd4020e8c5e8Ecf1A9236C75aE/sources/licence.sol | The address of the TKN token return the address of the TKN contract. | function tknContractAddress() external view returns (address) {
return _tknContractAddress;
}
| 3,598,025 |
//Address: 0x2fc5f7b04b1a43a64cfc066530f2bd87e001824d
//Contract name: MilestoneTracker
//Balance: 0 Ether
//Verification Date: 1/20/2017
//Transacion Count: 8
// CODE STARTS HERE
pragma solidity ^0.4.6;
/*
Copyright 2016, Jordi Baylina
This program is free software: you can redistribute it and/or modify
... | Creates an RLPItem from an array of RLP encoded bytes. self The RLP encoded bytes. strict Will throw if the data is not RLP encoded. return An RLPItem | function toRLPItem(bytes memory self, bool strict) internal constant returns (RLPItem memory) {
var item = toRLPItem(self);
if(strict) {
uint len = self.length;
if(_payloadOffset(item) > len)
throw;
if(_itemLength(item._unsafe_memPtr) != len)
throw;
... | 1,752,155 |
pragma solidity ^0.5.0;
import "../proxy/Proxy.sol";
import "../PolymathRegistry.sol";
import "../interfaces/IModule.sol";
import "./SecurityTokenStorage.sol";
import "../libraries/TokenLib.sol";
import "../interfaces/IDataStore.sol";
import "../interfaces/IUpgradableTokenFactory.sol";
import "../interfaces/IModuleFac... | return LOCKED only when the transaction `_value` should be equal to the change in the LOCKED partition balance otherwise return UNLOCKED Returning the same partition UNLOCKED | function _returnPartition(uint256 _beforeBalance, uint256 _afterBalance, uint256 _value) internal pure returns(bytes32 toPartition) {
if (_afterBalance.sub(_beforeBalance) == _value)
toPartition = LOCKED;
toPartition = UNLOCKED;
}
| 5,505,184 |
./full_match/41/0xbB1c15B915171410d9D3269A91A27442a4eDa871/sources/contracts/Coinsino.sol | convert randomness in string to uint/ | function st2num(string memory numString) internal pure returns (uint256) {
uint256 val = 0;
bytes memory stringBytes = bytes(numString);
for (uint256 i = 0; i < stringBytes.length; i++) {
uint256 exp = stringBytes.length - i;
bytes1 ival = stringBytes[i];
... | 16,369,608 |
./full_match/43113/0x5c4714D4ACfC08bF6D12907428dD23DD291afceA/sources/contracts/vault/VaultChef.sol | Withdraw everything from pool for yourself | function withdrawAll(uint256 _pid) external nonReentrant {
_withdraw(_pid, type(uint256).max, msg.sender);
}
| 7,148,893 |
./full_match/42220/0xBd44Fd1339C3B5Cd95E88501b1A6AB7e54cf5622/sources/contracts/community/CommunityImplementation.sol | Unlocks a list of beneficiaries _beneficiaryAddresses addresses of the beneficiaries to be unlocked/ | function unlockBeneficiaries(address[] memory _beneficiaryAddresses)
external
override
whenNotLocked
onlyManagers
{
_unlockBeneficiaries(_beneficiaryAddresses);
}
| 16,317,551 |
./full_match/80001/0x6aE8B5D6AeA27e08B7A7779Fa4aB7aD891127DDA/sources/project_/contracts/Seller.sol | Set Vesting contract. This function allows changing the vesting contract. p_coinPayments: The new payment token address. If it is a zero address (by default), there is no vesting. Requirements: - The caller must have the ADMIN_ROLE to execute the function./ | function setVesting(address p_vesting) public override {
require(IAccessControlUpgradeable(s_manager).hasRole(ADMIN_ROLE, msg.sender), "Seller: without permission");
s_vesting = p_vesting;
}
| 5,558,503 |
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 should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions... | _transfer, _mint and _burn are the only functions where the balances are modified, so it is there that the snapshots are updated. Note that the update happens _before_ the balance change, with the pre-modified value. The same is true for the total supply and _mint and _burn. | function _transfer(
address from,
address to,
uint256 value
) internal virtual override {
_updateAccountSnapshot(from);
_updateAccountSnapshot(to);
super._transfer(from, to, value);
}
| 6,804,854 |
// File: REMIX_FILE_SYNC/openzeppelin-solidity/contracts/math/SafeMath.sol
pragma solidity ^0.4.21;
/**
* @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) intern... | Checks whether a given creator address matches the single creator address. Will always return true if a single creator address was never set./ | function isAllowedSingleCreator(address _creatorAddress) internal view returns (bool) {
require(_creatorAddress != address(0), "0x0 creator addresses are not allowed.");
return singleCreatorAddress == address(0) || singleCreatorAddress == _creatorAddress;
}
| 890,279 |
./partial_match/4/0x41cEF5E8cE8906FDF99Aebd04eA5D2EEcfB140Cf/sources/contracts/PEther.sol | The sender adds to reserves. msg.value The amount of Ether to add as reserves/ | function _addReserves() external payable {
uint err = _addReservesInternal(msg.value);
requireNoError(err, "_addReserves failed");
}
| 8,590,499 |
// File: contracts/erc20/IERC20.sol
pragma solidity >=0.4.21 <0.6.0;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function al... | @_amount: lp token amount | function withdraw_from_curve(uint256 _amount) internal;
function withdraw(uint256 _amount) public onlyController{
withdraw_from_curve(_amount);
lp_balance = lp_balance - _amount;
IERC20(usdc).safeTransfer(msg.sender, IERC20(usdc).balanceOf(address(this)));
}
| 16,933 |
./partial_match/1/0x420D08Dad4fcd7896500d5E183D8BA934c919220/sources/EaselyFixedCollection.sol | See {_getAuctionId}/ | function getAuctionId(uint256 tokenId) external view returns (uint256) {
return _getAuctionId(tokenId);
}
| 2,825,375 |
./full_match/1/0x57556D10E6e9De56d72B9b322D433B9ed06741D0/sources/router.sol | ADD LIQUIDITY create the pair if it doesn't exist yet | function _addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amountBDesired,
uint amountAMin,
uint amountBMin
) internal virtual returns (uint amountA, uint amountB) {
if (IUniswapV2Factory(factory).getPair(tokenA, tokenB) == address(0... | 8,373,744 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, ... | See {IERC1155-balanceOf}. Requirements: - `account` cannot be the zero address./ | function balanceOf(address account, uint256 id)
public
view
virtual
override
returns (uint256)
{
require(
account != address(0),
"GenArtTokenAirdropPass: balance query for the zero address"
);
return _balances[id][account];
... | 11,994,829 |
./full_match/5/0x5cC5B757DC347dDE73d28bB544fA8e3d5228B2d1/sources/src/utils/MinterUtilities.sol | Retrieves the quantity of items remaining that can be minted by the specified recipient. passportHolderMinter The address of the passport holder minter contract. friendsAndFamilyMinter The address of the friends and family minter contract. target The address of the ICre8ors contract. recipient The recipient address... | function quantityLeft(
address passportHolderMinter,
address friendsAndFamilyMinter,
address target,
address recipient
) external view returns (uint256) {
ICre8ors cre8ors = ICre8ors(target);
ICollectionHolderMint passportMinter = ICollectionHolderMint(
... | 7,052,833 |
//Address: 0x5ba12fa4941988e0ce19e0bbb11907ced19d3f0b
//Contract name: Deployer
//Balance: 0 Ether
//Verification Date: 1/20/2018
//Transacion Count: 1
// CODE STARTS HERE
pragma solidity ^0.4.17;
//Slightly modified SafeMath library - includes a min function
library SafeMath {
function mul(uint256 a, uint256 b) ... | Swap factory functions - descriptions can be found in Factory.sol | interface Factory_Interface {
function createToken(uint _supply, address _party, bool _long, uint _start_date) public returns (address created, uint token_ratio);
function payToken(address _party, address _token_add) public;
function deployContract(uint _start_date) public payable returns (address created);
fu... | 7,294,756 |
./full_match/57/0xaA8Bb6F6209Ebef6D160B35134fb0C6775c8D357/sources/contracts/universal/op-nft/Optimist.sol | Disabled for the Optimist NFT (Soul Bound Token)./ | function setApprovalForAll(address, bool) public virtual override {
revert("Optimist: soul bound token");
}
| 13,222,012 |
/**
*Submitted for verification at Etherscan.io on 2022-02-26
*/
// SPDX-License-Identifier: OSL-3.0
pragma solidity 0.8.11;
/*
__ __ __ __ ______ ______ __ __ __ ______
/\ \/\ \ /\ \/ / /\ == \ /\ __ \ /\ \ /\ "-.\ \ /\ ___\
\ \ \_\ \ \ \ _"-. \ \ __< \ \ __ \ \... | Can transfer smart contract ownership to another wallet/smart contract./ | function changeOwner (address newOwner) public onlyOwner {
require(newOwner != address(0), "empty address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
| 6,549,499 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./ABDKMath64x64.sol";... | Enables the deposit window to be changed. Only the smart contract owner is allowed to do this Because blocks are not always found at the same rate, we may need to change the deposit window so events start on time We will only call this so the start time is as accurate as possible We have to recompute the yield start... | function changeDepositWindow(uint _depositStartBlock, uint _depositEndBlock) external onlyOwner {
compound.depositStartBlock = _depositStartBlock;
compound.depositEndBlock = _depositEndBlock;
compound.interestStartBlock = _depositEndBlock.add(1);
compound.interestEndBlock = compound.interestStartBlock... | 1,068,551 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
contract Voting {
// Structures
struct Voter {
bool isRegistered;
bool hasVoted;
uint votedProposalId;
}
struct Proposal {
string description;
uint voteCount;
}
// vote mapping
struc... | Registered address can add any proposition description at multiple times | function newProposal(uint index, string memory description) external onlyRegistered(index){
emit ProposalRegistered(index, votes[index].proposals.length-1);
votes[index].proposals.push(Proposal({description: description, voteCount:0}));
}
| 12,942,832 |
pragma solidity >=0.6.0 <0.8.0;
pragma experimental ABIEncoderV2;
//import "@openzeppelin/contracts/math/Math.sol";
import "../openzeppelin-contracts-v3.3.0/contracts/math/Math.sol";
import "./Token.sol";
// Items, NFTs or resources
interface ERCItem {
function mint(address account, uint256 amount) ext... | Donation must be at least $0.10 to play The Water Project - double check Heifer Cool Earth | function createFarm(address payable _charity) public payable {
require(syncedAt[msg.sender] == 0, "FARM_EXISTS");
uint decimals = token.decimals();
require(
msg.value >= 1 * 10**(decimals - 1),
"INSUFFICIENT_DONATION"
);
require(
_charit... | 2,573,127 |
pragma solidity ^ 0.8.0;
import "hardhat/console.sol";
import { IDiamondCut } from "../interfaces/IDiamondCut.sol";
import { LibDiamond } from "../libraries/LibDiamond.sol";
import "../libraries/AppStorage.sol";
contract SLAInitializing{
AppStorage internal s;
function setBlkNeeded(uint8 _b... | /the unit is Szabo = 0.001 finney | function setCompensationFee(uint _compensationFee)
public
{
require(s.SLAState == State.Fresh);
require(msg.sender == s.Provider);
require(_compensationFee > 0);
uint oneUnit = 1e12;
s.CompensationFee = _compensationFee*oneUnit;
}
| 6,459,886 |
pragma solidity ^0.4.25;
// It's important to avoid vulnerabilities due to numeric overflow bugs
// OpenZeppelin's SafeMath library, when used correctly, protects agains such bugs
// More info: https://www.nccgroup.trust/us/about-us/newsroom-and-events/blog/2018/november/smart-contract-insecurity-bad-arithmetic/
impo... | Called by oracle when a response is available to an outstanding request For the response to be accepted, there must be a pending request that is open and matches one of the three Indexes randomly assigned to the oracle at the time of registration (i.e. uninvited oracles are not welcome) Information isn't considered ver... | function submitOracleResponse(
uint8 index,
address airline,
string flight,
uint256 timestamp,
uint8 statusCode
) external
requireIsOperational() {
require(
(oracles[msg.sender].indexes[0] == index) ||
(oracles[msg.sender].indexes[1... | 6,358,839 |
pragma solidity ^0.4.24;
contract Factory {
address developer = 0x0033F8dAcBc75F53549298100E85102be995CdBF59;
event ContractCreated(address creator, address newcontract, uint timestamp, string contract_type);
function setDeveloper (address _dev) public {
if(developer==address(0) || developer==msg.sende... | Abort the purchase and reclaim the ether. Can only be called by the seller before the contract is locked. validated = false; | function abort()
public
onlySeller
{
returnMoneyToBuyers();
emit AbortedBySeller();
seller.transfer(address(this).balance);
}
| 1,257,578 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.4;
import "./PegStabilityModule.sol";
/// @notice ETH PSM that allows separate pausing of mint and redeem
/// by the guardian and governor
contract MintRedeemPausePSM is PegStabilityModule {
/// @notice boolean switch that indicates whether redemp... | Fei Peg Stability Module Fei Protocol The Fei PSM is a contract which holds a reserve of assets in order to exchange FEI at $1 of underlying assets with a fee. `mint()` - buy FEI for $1 of underlying tokens `redeem()` - sell FEI back for $1 of the same The contract has a reservesThreshold() of underlying meant to st... | interface IPegStabilityModule {
function mint(address to, uint256 amountIn, uint256 minAmountOut) external returns (uint256 amountFeiOut);
function redeem(address to, uint256 amountFeiIn, uint256 minAmountOut) external returns (uint256 amountOut);
function allocateSurplus() external;
function setM... | 292,375 |
/**
*Submitted for verification at Etherscan.io on 2022-03-15
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
// File @openzeppelin/contracts/utils/[email protected]
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While thes... | Function setIsActive to activate/desactivate the smart contract/ | function _beforeTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
function _afterTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
}
{
isActive = _isActive;
}
| 7,647,575 |
pragma solidity 0.5.4;
library SafeMath {
uint256 constant internal MAX_UINT = 2 ** 256 - 1; // max uint256
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 _a, uint256 _b) internal pure returns(uint256) {
if (_a == 0) {
return 0;
... | Transfers tokens from one address to another. If 'from' has releasable tokens, this part of the token will be released automatically. If the target address of transferring is BDR contract, the operation of changing BDR tokens will be executed. from The address which you want to send tokens from to The addr... | function transferFrom(address from, address to, uint value) public returns (bool) {
if(releasableAmount(from) > 0) {
}
if(to == address(BDRInstance)) {
emit ExchangeBDR(from, value);
}
return true;
}
| 7,220,030 |
./partial_match/62320/0xd536b521b542D05533b0AC8fA3018aBe9e03DE1d/sources/redstone-oracles-monorepo-789f66c/packages/on-chain-relayer/contracts/core/RedstoneAdapterBase.sol | Reverts if the proposed timestamp of data packages it too old or too new comparing to the current block timestamp dataPackagesTimestamp The proposed timestamp (usually in milliseconds)/ | function validateDataPackagesTimestampOnce(uint256 dataPackagesTimestamp) public view virtual {
uint256 receivedTimestampSeconds = dataPackagesTimestamp / 1000;
(uint256 maxDataAheadSeconds, uint256 maxDataDelaySeconds) = getAllowedTimestampDiffsInSeconds();
uint256 blockTimestamp = getBlockTimestamp();... | 11,034,319 |
pragma solidity 0.5.10;
contract Context {
constructor () internal { }
function _MSGSENDER793() internal view returns (address payable) { //inject NONSTANDARD NAMING
return msg.sender;
}
function _MSGDATA330() ... | inject NONSTANDARD NAMING | function FEE426(bytes32 fund) public view returns (uint256) { | 1,784,275 |
pragma solidity ^0.4.24;
import "../ERC20/IERC20.sol";
import "../crowdsale/ICrowdsale.sol";
import "./IPresale.sol";
import "../access/roles/ManagerRole.sol";
import "../access/roles/RecoverRole.sol";
import "../math/SafeMath.sol";
/**
* @title Presale module contract
*
*/
contract Presale is IPresale, ManagerRol... | Add presale tokens to an account (internal operation) presaleAccount The account which is assigned presale holdings value The amount of tokens to be assigned to this account/ | function _addPresaleBalance(address presaleAccount, uint256 value) internal {
require(presaleAccount != address(0), "cannot add balance to the 0x0 account");
require(value <= _totalPresaleSupply, "");
_totalPresaleSupply = _totalPresaleSupply.sub(value);
_presaleBalances[presaleAcco... | 14,034,857 |
./partial_match/42/0x4ffADC639B57e864150ff98a55D249fed53fa63B/sources/ZuniBadge.sol | Get the denormalized weight of a token viewlock to prevent calling if it's being updated return token weight/ | function getDenormalizedWeight(address token)
external
view
viewlock
needsBPool
returns (uint256)
{
return bPool.getDenormalizedWeight(token);
}
| 3,449,035 |
./full_match/1/0x0D062790F26947074B27da07346E4FF9FDf946EE/sources/src/Facets/PolygonBridgeFacet.sol | Bridges tokens via Polygon Bridge _bridgeData Data containing core information for bridging | function startBridgeTokensViaPolygonBridge(
ILiFi.BridgeData memory _bridgeData
)
external
payable
nonReentrant
refundExcessNative(payable(msg.sender))
doesNotContainSourceSwaps(_bridgeData)
doesNotContainDestinationCalls(_bridgeData)
validateBridg... | 17,018,344 |
pragma solidity 0.5.8;
import "./OZStorage.sol";
import "./SecurityTokenStorage.sol";
import "../libraries/TokenLib.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "../modules/PermissionManager/IPermissionManager.sol";
contract STGetter is OZStorage, SecurityTokenStorage {
using SafeMath... | Return all partitions return List of partitions/ | function partitionsOf(address /*_tokenHolder*/) external pure returns (bytes32[] memory) {
bytes32[] memory result = new bytes32[](2);
result[0] = UNLOCKED;
result[1] = LOCKED;
return result;
}
| 5,376,736 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
// dependencies
import {AggregatorV3Interface} from "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";
import {SafeCast} from "@openzeppelin/contracts/utils/math/SafeCast.sol";
import {Context} from "@openzeppelin/contracts/utils/Context.sol";
... | get information about position | function _calculatePnL(int256 boughtPrice, int256 soldPrice) internal pure returns (int256) {
return soldPrice - boughtPrice;
}
| 994,504 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/utils/Context.sol";
// ============ ... | Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. The call is not executed if the target address is not a contract./ | function _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
try IERC721Receiver(to).onERC721Received(
_msgSender(), from, tokenId, _data
) returns (bytes4 retval) {
return retval == IERC721Receiver.onERC721Received.sel... | 977,352 |
// SPDX-License-Identifier: GPLv2
pragma solidity 0.6.12;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "../DigitalaxAccessControls.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "./interfaces/IDigitalaxRewards.sol";
import "../EIP2771/BaseRelayRecipient.sol";
import "@openzeppe... | Lets admin set the Mona Token/ | function setMonaToken(
address _addr
)
external
{
require(
accessControls.hasAdminRole(_msgSender()),
"DigitalaxMonaStaking.setMonaToken: Sender must be admin"
);
require(_addr != address(0), "DigitalaxMonaStaking.setMonaToken: Invalid Mona Tok... | 12,801,886 |
./full_match/4/0xB4b58210DC03c1A29021B296D80E17aD46427393/sources/contracts/base/ERC721.sol | Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients are aware of the ERC721 protocol to prevent tokens from being forever locked. `_data` is additional data, it has no specified format and it is sent in call to `to`. This internal function is equivalent to {safeTransferFrom}, a... | function _safeTransfer(
address from,
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_transfer(from, to, tokenId);
require(_checkOnERC721Received(from, to, tokenId, _data), 'ERC721: transfer to non ERC721Receiver implementer');
}
| 769,871 |
pragma solidity 0.5.17; // optimization runs: 200, evm version: istanbul
interface DharmaTradeReserveV5Interface {
event ROLEMODIFIED441(Role indexed role, address account); //inject NONSTANDARD NAMING
event ROLEPAUSED231(Role indexed role); //inj... | inject NONSTANDARD NAMING | function MINT439(uint256 daiAmount) external returns (uint256 dDaiMinted); | 6,408,624 |
pragma solidity ^0.4.23;
/**
* The ENS registry contract.
*/
contract ENS {
struct Record {
address owner;
address resolver;
}
mapping(bytes32=>Record) records;
// Logged when the owner of a node assigns a new owner to a subnode.
event NewOwner(bytes32 indexed node, byte... | Returns true if the specified node has the specified record type. node The ENS node to query. kind The record type name, as specified in EIP137. return True if this resolver has a record of the provided type on the provided node./ | function has(bytes32 node, bytes32 kind) returns (bool) {
return kind == "addr" && addresses[node] != 0;
}
| 1,066,430 |
./full_match/7700/0x6a0fCBe49A75ceD08d4c7791DeCDBE015C30c2c6/sources/contracts/ERC721Testjunk.sol | See {IERC721-approve}./ | function approve(address to, uint256 tokenId) public override {
address owner = ERC721Testjunk.ownerOf(tokenId);
require(to != owner, "ERC721A: approval to current owner");
require(
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721A: approve caller is not owner nor appro... | 4,662,524 |
pragma solidity 0.4.20;
// we use solidity solidity 0.4.20 to work with oraclize (http://www.oraclize.it)
// solidity versions > 0.4.20 are not supported by oraclize
/*
Lucky Strike smart contracts version: 2.0
*/
/*
This smart contract is intended for entertainment purposes only. Cryptocurrency gambling i... | Appends a byte array to the end of the buffer. Reverts if doing so would exceed the capacity of the buffer. buf The buffer to append to. data The data to append. return The original buffer./ Memory address of the buffer data Length of existing buffer data Start address = buffer address + buffer length + sizeof(b... | function append(buffer memory buf, bytes data) internal constant returns (buffer memory) {
if (data.length + buf.buf.length > buf.capacity) {
resize(buf, max(buf.capacity, data.length) * 2);
}
uint dest;
uint src;
uint len = data.length;
assembly {
... | 2,531,127 |
./full_match/10/0x371405Aea16D5916703C74580247196BA9EA531F/sources/home/sol-op/chef/contracts/CthulhuChef.sol | Update the given pool's SUSHI allocation point. Can only be called by the owner. | function set(uint256 _pid, uint256 _allocPoint, bool _withUpdate, uint256 _withdrawFee, IVault _vault) public {
require(msg.sender == owner() || msg.sender == devaddr, "!dev addr");
if (_withUpdate) {
massUpdatePools();
}
totalAllocPoint = totalAllocPoint.sub(poolInfo[_pid].allocPoint).add(_allo... | 3,784,010 |
./full_match/5/0x378a23c0FA0c6E4F9680ae93caC368B5111BfC6F/sources/project_/contracts/managementContract.sol | Set the {nonWhitelistedDepositLimit}. It can be set to 0 to prevent deposits to non-whitelisted users. Requirements: - the caller must have the `DEFAULT_ADMIN_ROLE`./ | function setNonWhitelistedDepositLimit(uint256 _nonWhitelistedDepositLimit) external virtual onlyAdmin {
nonWhitelistedDepositLimit = _nonWhitelistedDepositLimit;
}
| 1,960,319 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.