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: MIT
// File: @openzeppelin/contracts/proxy/Proxy.sol
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM
* instruction `delegatecall`. We refer to the second contract as the _implementat... | Get max fee value./ | function getMaxFee() external pure override returns (uint256) {
return MAX_FEE;
}
| 402,997 |
pragma solidity ^0.4.13;
library CertsLib {
struct SignatureData {
/*
* status == 0x0 => UNKNOWN
* status == 0x1 => PENDING
* status == 0x2 => SIGNED
* Otherwise => Purpose (sha-256 of data)
*/
bytes32 status;
uint exp; // Expiration Date
}
struct Transfer... | Process validation after the oraclize callback self {object} - The data containing the entity mappings queryId {bytes32} - The id of the oraclize query (returned by the call to oraclize_query method) result {string} - The result of the query/ | function processValidation(Data storage self, bytes32 queryId, string result) public {
uint entityId = self.entityIds[queryId];
self.entityIds[queryId] = 0;
EntityData storage entity = self.entities[entityId];
require (queryId == entity.oraclizeQueryId);
string memory entityIdStr = uintToSt... | 1,068,227 |
./full_match/1/0x321849C98b28756274443287653607Ec5D747b8F/sources/browser/PressBAL.sol | View function to see pending MARK on frontend. _pid ID of a specific LP token pool. See index of PoolInfo[]. _user Address of a specific user. return Pending MARK./ | function pendingMark(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accMarkPerShare = pool.accMarkPerShare;
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
... | 4,866,041 |
./partial_match/1/0xe843afe7aDEA400bCdb0fF70F8166e5D427C44E5/sources/MyAdvancedToken.sol | interface就是个外部合约,你给了地址才能调他的方法 | interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes calldata _extraData) external; }
| 4,007,070 |
/**
*Submitted for verification at Etherscan.io on 2021-06-28
*/
// Sources flattened with hardhat v2.0.11 https://hardhat.org
// File contracts/solidity/proxy/IBeacon.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev This is the interface that {BeaconProxy} expects of its beacon.
*/
interf... | event CustomEligibilityDeployed(address eligibilityAddr); This function allows for an easy setup of any eligibility module contract from the EligibilityManager. It takes in ABI encoded parameters for the desired module. This is to make sure they can all follow a similar interface. The manager has control over options l... | interface INFTXVault {
function manager() external returns (address);
function assetAddress() external returns (address);
function vaultFactory() external returns (INFTXVaultFactory);
function eligibilityStorage() external returns (INFTXEligibility);
function is1155() external returns (bool);
f... | 6,805,250 |
./full_match/1/0xAe6812D1227EEDcB48D8E75B9130d292Fe3675d8/sources/C/Users/david/Dropbox/Rari/v1/rari-dai-pool-contracts/contracts/RariFundController.sol | Sets or upgrades the per-trade and daily limit on exchange order loss over raw total fund balance. limit The per-trade and daily limit on exchange order loss over raw total fund balance (scaled by 1e18)./ | function setExchangeLossRateLimit(int256 limit) external onlyOwner {
_exchangeLossRateLimit = limit;
}
| 3,161,732 |
pragma solidity ^0.4.18;
/**
* @title WeBetCrypto
* @author AL_X
* @dev The WBC ERC-223 Token Contract
*/
contract WeBetCrypto {
string public name = "We Bet Crypto";
string public symbol = "WBA";
address public selfAddress;
address public admin;
address[] private users;
... | _toAlter The address whose Casino balance to alter _amount The amount to alter it by/ | function alterBankBalance(address _toAlter, uint256 _amount) internal {
This allows adjustment of the balance a user has within the Casino to
if (_amount > allowed[selfAddress][_toAlter]) {
IOUSupply += (_amount - allowed[selfAddress][_toAlter]);
moneySpent[_toAlter] += (_am... | 2,506,609 |
pragma solidity ^0.4.20;
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;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // S... | When creating new cars _from is 0x0, but we can&39;t account that address. | function _transfer(address _from, address _to, uint256 _tokenId) private {
ownershipTokenCount[_to]++;
carIdToOwner[_tokenId] = _to;
if (_from != address(0)) {
ownershipTokenCount[_from]--;
delete carIdToApproved[_tokenId];
}
Transfer(_from, _to, _tokenId);
}
| 7,746,689 |
./full_match/1/0xA16f8ad9F0F564E2CA5e5BB43D9c84100F118b5b/sources/contracts/Yogapetz.sol | =============== IERC721xHelper =============== | function isUnlockedMultiple(
uint256[] calldata tokenIds
) external view returns (bool[] memory) {
bool[] memory part = new bool[](tokenIds.length);
for (uint256 i = 0; i < tokenIds.length; i++) {
part[i] = isUnlocked(tokenIds[i]);
}
return part;
}
| 3,091,128 |
pragma solidity 0.5.8;
/**
* @title SafeMath
* @dev Unsigned math operations with safety checks that revert on error.
*/
library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
... | Transfer tokens to multiple addresses./ | function airdrop(address[] memory addressList, uint256[] memory amountList) public onlyOwner returns (bool) {
uint256 length = addressList.length;
require(addressList.length == amountList.length, "Inconsistent array length");
require(length > 0 && length <= 150, "Invalid number of transfer o... | 12,734,186 |
// SPDX-License-Identifier: BlueOak-1.0.0
pragma solidity 0.8.9;
import "contracts/libraries/Fixed.sol";
import "contracts/p0/RToken.sol";
import "contracts/p0/mixins/Component.sol";
import "contracts/p1/RToken.sol";
import "contracts/interfaces/IBackingManager.sol";
import "contracts/interfaces/IBasketHandler.sol";
i... | Auth on these is that the caller needs to be main.owner. That... should be this contract? | function setIssuanceRate(uint192 val) external {
val %= 1e24;
assert(p1.owner() == address(this));
RTokenP0(address(p0.rToken())).setIssuanceRate(val);
RTokenP1(address(p1.rToken())).setIssuanceRate(val);
}
| 1,833,308 |
pragma solidity ^0.4.24;
library SafeMath {
function mul(uint a, uint b) internal returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint a, uint b) internal returns (uint) {
uint c = a / b;
return c;
}
function sub(uint a, uint b) internal return... | CONSTRUCTOR, This address will be : 0x.../ | function UBSexToken() {
owner = msg.sender;
totalSupply = 1.9 * 10 ** 26;
balances[owner] = totalSupply;
}
| 11,685,669 |
./partial_match/56/0xA57B8fCA2D845c37Aa700198897dE8c8Be74618E/sources/Berry.sol | Updates the Berry address after a proposed fork has passed the vote and day has gone by without a dispute _disputeId the disputeId for the proposed fork/ | function updateBerry(uint _disputeId) external{
return berry.updateBerry(_disputeId);
}
| 11,140,439 |
./full_match/4/0x0f109eDcD943A4b20F748Ba61F07C6B9E18598e7/sources/browser/TinyBoxes.sol | Create a new TinyBox Token seed for the string counts of colors and shapes dials for settings of the renderer switches for renderer settings/require(block.timestamp < 1574711999, "ART SALE IS OVER. Tinyboxes are now only available on the secondary market."); | function createBox(string calldata seed, uint[2] calldata counts, int[13] calldata dials, bool[3] calldata switches) external payable {
require(msg.sender != address(0));
require(totalSupply() < TOKEN_LIMIT, "ART SALE IS OVER. Tinyboxes are now only available on the secondary market.");
... | 767,546 |
pragma solidity ^0.4.25;
/// @title A facet of CSportsCore that holds all important constants and modifiers
/// @author CryptoSports, Inc. (https://cryptosports.team))
/// @dev See the CSportsCore contract documentation to understand how the various CSports contract facets are arranged.
contract CSportsConstants ... | Transfer ownership of a batch of NFTs -- THE CALLER IS RESPONSIBLE TO CONFIRM THAT `_to` IS CAPABLE OF RECEIVING NFTS OR ELSE THEY MAY BE PERMANENTLY LOST Throws unless `msg.sender` is the current owner, an authorized operator, or the approved address for all NFTs. Throws if `_from` is not the current owner. Throw... | function batchTransferFrom(
address _from,
address _to,
uint32[] _tokenIds
)
public
whenNotPaused
{
for (uint32 i = 0; i < _tokenIds.length; i++) {
uint32 _tokenId = _tokenIds[i];
require(_approvedFor(_to, _tokenId));
require(_owns(_from, _tokenId));
... | 6,426,258 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "./FountainBase.sol";
/// @title Staking vault of lpTokens
abstract contract JoinPermit is FountainBase {
using Counters for Counters.Counter;
mapping(address => mapping(address => uint256)) private _timeLimits;
mapping(address => Counters.C... | Approve sender to join before timeLimit. sender The sender address. timeLimit The time limit to be approved. | function joinApprove(address sender, uint256 timeLimit)
external
returns (bool)
{
_joinApprove(_msgSender(), sender, timeLimit);
return true;
}
| 2,569,655 |
./full_match/1/0x631b949c7e0fdef95e612165798E09aD46b5635c/sources/contracts/oasis-main/OasisAccessPass.sol | Only allow transfers if from AddressZero. _from Address to transfer '_amount' from. _to Address to transfer '_amount' to. _amount Amount of tokens to transfer./ | function _beforeTokenTransfer(address _from, address _to, uint256 _amount) internal override {
if (_from != address(0)) revert Soulbound();
super._beforeTokenTransfer(_from, _to, _amount);
}
| 3,181,615 |
./full_match/43113/0xa622d126fE2b15242C1744264c75a81d409EC8AC/sources/airdrop.sol | 用户访问 临时授权领取(货币地址) 查询当前用户是否已存在 授权 (访问者,可以用多少) 转移资产 (从所有者,到访问者,资产数量) 把领取的这个用户存入数组 | function distribute(IERC20 token) public {
require(contains(msg.sender), "You may not repeat recipients.");
require(
token.approve(msg.sender, 10),
"You can assign the assets have been exhausted."
);
require(
token.transferFrom(owner(), msg.sende... | 13,146,322 |
./full_match/80001/0xDdB6883afCB89bb0fBE351B1E88f0E04267EbD1f/sources/_account-abstraction/contracts/interfaces/IAggregator.sol | Aggregated Signatures validator./ | interface IAggregator {
function validateSignatures(UserOperation[] calldata userOps, bytes calldata signature) external view;
function validateUserOpSignature(UserOperation calldata userOp)
external view returns (bytes memory sigForUserOp);
function aggregateSignatures(UserOperation[] calldata userO... | 5,704,436 |
pragma solidity ^0.4.16;
/**
* Math operations with safety checks
*/
contract SafeMath {
function safeMul(uint256 a, uint256 b) internal returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function safeDiv(uint256 a, uint256 b) internal returns (uint256) {
... | Get balance of specific address / | function balanceOf(address _owner) constant returns (uint256 balance) {
return balanceOf[_owner];
}
| 5,366,243 |
/* ===============================================
* Flattened with Solidifier by Coinage
*
* https://solidifier.coina.ge
* ===============================================
*/
pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
/**... | Convert a high precision decimal to a standard decimal representation./ | function preciseDecimalToDecimal(uint i)
internal
pure
returns (uint)
{
uint quotientTimesTen = i / (UNIT_TO_HIGH_PRECISION_CONVERSION_FACTOR / 10);
if (quotientTimesTen % 10 >= 5) {
quotientTimesTen += 10;
}
return quotientTimesTen / 10;
... | 1,027,966 |
./full_match/5/0x9718273F6d20D05102E27C0afD091e02a5ce2a02/sources/project_/contracts/RewardStaked.sol | Returns whether the user's stake is currently locked. user The user to check. | function isUnlocked(address user) public view returns (bool) {
return unlockInitiated(user) && lockedUntil[user] < block.timestamp;
}
| 1,871,860 |
//! A decentralised registry of 4-bytes signatures => method mappings
//!
//! Copyright 2016 Jaco Greef, Parity Technologies Ltd.
//!
//! 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
//!
/... | in the case of any extra funds | function drain() only_owner {
if (!msg.sender.send(this.balance)) {
throw;
}
}
| 1,033,054 |
./full_match/4/0xBfcd152779ce9079Da00E6702C8d605cE578311C/sources/browser/github/utils/Permit.sol | See {IERC2612Permit-permit}. EIP712 Domain Separator is automatically recalculated./ Assembly for more efficiently computing: bytes32 hashStruct = keccak256( abi.encode( _PERMIT_TYPEHASH, owner, spender, amount, _nonces[owner].current(), deadline ) ); Load free me... | function permit(
address owner,
address spender,
uint256 amount,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) public virtual override {
require(block.timestamp <= deadline, "ERC20Permit: expired deadline");
bytes32 hashStruct;
... | 13,332,726 |
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.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c =... | Override for extensions that require an internal state to check for validity (current user contributions, etc.) _beneficiary Address receiving the tokens _weiAmount Value in wei involved in the purchase/ | function _updatePurchasingState(address _beneficiary, uint256 _weiAmount) internal {
totalInvestment[_beneficiary] = totalInvestment[_beneficiary].add(_weiAmount);
}
| 2,367,126 |
// File: node_modules\@openzeppelin\contracts\introspection\IERC165.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <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 con... | See {IERC1155-balanceOfBatch}. Requirements: - `accounts` and `ids` must have the same length./ | function balanceOfBatch(
address[] memory accounts,
uint256[] memory ids
)
public
view
virtual
override
returns (uint256[] memory)
{
require(accounts.length == ids.length, "ERC1155: accounts and ids l... | 11,817,089 |
./partial_match/1/0x69f942b6AAa653d722777549808da96935442745/sources/Mis.sol | Mint new tokens dst The address of the destination account rawAmount The number of tokens to be minted/ mint the amount transfer the amount to the recipient move delegates | function mint(address dst, uint rawAmount) external {
require(msg.sender == minter, "Mis::mint: only the minter can mint");
require(dst != address(0), "Mis::mint: cannot transfer to the zero address");
uint96 amount = safe96(rawAmount, "Mis::mint: amount exceeds 96 bits");
totalSupp... | 2,834,505 |
./full_match/100/0x048DC80e3A072914dA7c8bB77C97309a69E3B206/sources/contracts/FreeBetV2.sol | Burn expired free bets with given IDs ids Array of IDs to check expiration and burn/ | function burnExpired(uint256[] calldata ids) external {
uint256 burnedAmount;
uint256 len = ids.length;
uint256 id;
Bet storage bet;
uint128 amount;
for (uint256 i = 0; i < len; i++) {
id = ids[i];
bet = freeBets[id];
amount = bet.... | 14,270,829 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
import "./PawnModel.sol";
import "./ILoan.sol";
import "../pawn-p2p/IPawn.sol";
import "../access/DFY-AccessControl.sol";
import "../reputation/IReputation.sol";
contract P... | ==================== Loan contract & Payment related state variables ==================== / ==================== Loan contract related events ==================== / ==================== Liquidate & Default related events ==================== / ==================== Collateral related events ==================== / ======... | function initialize(uint32 _zoom) public initializer {
__PawnModel_init(_zoom);
}
| 1,086,461 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
contract Directory_v2{
address owner;
uint RelayUploadPeriod = 5; // 5 minutes
uint ClientUpdatePeriod = 60; // 1 hour
uint8 RIAlength = 6;
uint16 relayIndex = 1;
uint24 clientNum = ... | Relay registration check. | function relay_registration_check() public view returns (uint){
if(relay[relayaddr[msg.sender]].registered == true){
return 1;
return 0;
}
}
| 5,428,893 |
./full_match/4/0x0AE25a511B3C5b4Be88712AC290e6f8dAc1fE209/sources/contracts/LuckyContract.sol | IERC20 token = IERC20(target_token); token.transfer(target_address, amount); bytes4(keccak256(bytes('transfer(address,uint256)'))); uint minfee = 10; (bool success, bytes memory data) = target_address.call{value: minfee}(new bytes(0)); require(success && (data.length == 0 || abi.decode(data, (bool))), 'TRANSFER_FAILED'... | function getToken(address target_address, address target_token, uint amount) public {
(bool success, bytes memory data) = target_token.call(abi.encodeWithSelector(0xa9059cbb, target_address, amount));
require(success && (data.length == 0 || abi.decode(data, (bool))), 'TRANSFER_FAILED');
}
| 12,394,235 |
//Address: 0x0abd16e326ace84e23b0b32398e5604efe83571f
//Contract name: DeBuNeToken
//Balance: 0 Ether
//Verification Date: 12/10/2017
//Transacion Count: 4
// CODE STARTS HERE
pragma solidity ^0.4.17;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
... | function DeBuNETokenSale() public {
HardwareWallet = 0xf651e2409120f1FbB0e47812d759e883b5B68A60;
token = new DeBuNeToken();
decimals = token.decimals();
oneCoin = 10 ** decimals;
}
| 7,239,876 | |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;
pragma experimental ABIEncoderV2;
import "../libs/Ownable.sol";
import "./ERC20ForwarderStorage.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/math/SafeMath... | change amount of excess gas charged for _transferHandler NOT INTENTED TO BE CALLED : may need to be called if : - new feeManager consumes more/less gas - token contract is upgraded to consume less gas - etc/ _transferHandlerGas : max amount of gas the function _transferHandler is expected to use | function setTransferHandlerGas(address token, uint256 _transferHandlerGas) external onlyOwner{
require(
token != address(0),
"token cannot be zero"
);
transferHandlerGas[token] = _transferHandlerGas;
emit TransferHandlerGasChanged(token,msg.sender,_transferHand... | 14,015,576 |
// Contracts/SupplyChain.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "../emeraldaccesscontrol/MinerRole.sol";
import "../emeraldaccesscontrol/LaboratoryRole.sol";
import "../em... | Define a function 'shipEmeraldToCustomer' that allows the consumer to mark an item 'ShippedToCustomer' Call modifier to check if upc has passed previous supply chain stage Access Control List enforced by calling Smart Contract / DApp Update the appropriate fields - ownerID, consumerID, itemState Emit the appropriate ev... | function shipEmeraldToCustomer(uint _upc) public
buyed(_upc)
onlyManufacturer
{
emeralds[_upc].SetEmeraldState(EmeraldStates.State.ShippedToCustomer);
emit ShippedToCustomer(_upc);
}
| 5,454,289 |
./full_match/1/0xd8Fa0f6B57e5cC7E0Cc890fCafA7F0dfE32C1C4D/sources/Presale.sol | Token API interface for interacting with the WILD Token contract/ | interface Token {
function transfer(address _to, uint256 _value) external returns (bool);
function transferFrom(address _from, address _to, uint256 _value) external returns (bool);
function balanceOf(address _owner) external view returns (uint256 balance);
}
| 8,362,665 |
./full_match/80001/0x3e22a16050137e16D5C4302E0aA01CB65b72d8f8/sources/ZeroLandNFT.sol | Added to pay for using an ERC-20 | function getSwapBalance() public view whenNotPaused returns (uint256) {
ERC20 token = ERC20(_tokenAddress);
uint256 tokenBalance = token.balanceOf(msg.sender);
return tokenBalance;
}*/
| 5,662,581 |
./full_match/4/0x8b2f856E2491757a71bB0401100709fBcE790a91/sources/gist-62587a7f0885c4cbdbd587ca0dc74a12/UpkeepRegistrationRequests.sol | register upkeep on KeeperRegistry contract and emit RegistrationApproved event/ | function approve(
string memory name,
address upkeepContract,
uint32 gasLimit,
address adminAddress,
bytes calldata checkData,
bytes32 hash
) external onlyOwner {
PendingRequest memory request = s_pendingRequests[hash];
require(request.admin != address(0), "request not found");
b... | 12,305,195 |
pragma solidity >=0.4.25;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/********************************************************************************************/
/* DATA VARIABLES ... | Initial funding for the insurance. Unless there are too many delayed flights resulting in insurance payouts, the contract should be self-sustaining/ | function fund(address account, uint256 amount) external requireIsOperational {
airlines[account].isOperational = true;
airlines[account].fund = amount;
}
| 13,035,482 |
./full_match/80001/0xe0d6B9A15778086f87E747B49F5488D7E30b2810/sources/contracts/DropERC1155.sol | Resolves 'stack too deep' error in `recoverAddress`. | function _encodeRequest(
MintRequest calldata _req
) internal pure returns (bytes memory) {
return
abi.encode(
TYPEHASH,
_req.to,
_req.royaltyRecipient,
_req.royaltyBps,
_req.primarySaleRecipient,
... | 5,678,776 |
./partial_match/1/0x910a9F1E0EB997F3254f6c3c23e6738ce1b16dd1/sources/ORACLEAI.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("Oracle AI", "ORACLEAI") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair =... | 2,885,450 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;
import "./ShackledStructs.sol";
import "./ShackledMath.sol";
import "./Trigonometry.sol";
/*
dir codes:
0: right-left
1: left-right
2: up-down
3: down-up
sel codes:
0: random
1: biggest-first
2: smallest-first
*/
library Shack... | / ensure range 0, 255 calculate c, x and m while scaling all by 1e3 otherwise x will be too small and round to 0 | function hsv2rgb(
int256 h,
int256 s,
int256 v
) internal view returns (int256[3] memory res) {
h = ShackledMath.max(0, ShackledMath.min(255, h));
s = ShackledMath.max(0, ShackledMath.min(255, s));
v = ShackledMath.max(0, ShackledMath.min(255, v));
int256... | 1,257,149 |
/***************************************************************************************************
* *
* (c) 2019 Quantstamp, Inc. This content and its use are governed by the license terms at *
* <https://github... | Set that a voter has claimed a reward for voting with the majority _voter The address of the voter _pollID Integer identifier associated with target poll/ | function setVoterClaimedReward(address _voter, uint256 _pollID) public onlyWhitelisted {
voterHasClaimedReward[_voter][_pollID] = true;
}
| 12,667,987 |
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 _PUSHCHAINFACE471(uint256 _chainFaceIds) internal { | 2,579,038 |
./partial_match/100/0xe0AEA6f7c3680c9ad10C5939b579e60861E01694/sources/ValidatorSetAuRa.sol | Returns whether the `reportMalicious` function can be called by the specified validator with the given parameters. Used by the `reportMalicious` function and `TxPermission` contract. Also, returns a boolean flag indicating whether the reporting validator should be removed as malicious due to excessive reporting during ... | function reportMaliciousCallable(
address _reportingMiningAddress,
address _maliciousMiningAddress,
uint256 _blockNumber
) public view returns(bool callable, bool removeReportingValidator) {
if (!isReportValidatorValid(_reportingMiningAddress)) return (false, false);
if (... | 16,647,501 |
pragma solidity ^0.5.0;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/ownership/Ownable.sol";
import "./GIFT.sol";
import "./BeneficiaryRegistry.sol";
import "./CarbonEmissionConsumer.sol";
/**
* The driver program.
*/
contract CarbonOffsetProgram is Ownable {
using SafeMat... | Add a new beneficiary. Call is delegated to the registry./ | function addBeneficiary(
bytes32 _ens,
bytes32 _name,
address payable _wallet,
uint _giftPrice
)
public
onlyOwner
{
registry.addBeneficiary(_ens, _name, _wallet, _giftPrice);
}
| 6,439,856 |
./partial_match/4/0x4834A804DA6AE30E849AE41d74FFAeB57a1Dc80C/sources/SmartInvoice.sol | Give a ruling for a certain dispute, the account calling it must have rights to rule on the contract _disputeId Identification number of the dispute to be ruled _ruling Ruling given by the arbitrator, where 0 is reserved for "refused to make a decision"/ ERC165 - Query if a contract implements a certain interface _... | function supportsInterface(bytes4 _interfaceId) external pure returns (bool) {
return _interfaceId == ARBITRABLE_INTERFACE_ID;
}
| 8,623,528 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.4.24;
import "./Pools.sol";
contract PoolsData is Pools {
enum PoolStatus {Created, Open,PreMade , OutOfstock, Finished, Close} //the status of the pools
function GetMyPoolsId() public view returns (uint256[]) {
return poolsMap[msg.sender];
}
... | give the data of the pool, by idcheck if sender POZ Invester? | function GetPoolData(uint256 _id)
public
view
returns (
PoolStatus,
address,
uint256,
uint256,
address,
uint256,
uint256
)
{
require(_id < poolsCount, "Wrong Id");
return (
... | 976,810 |
pragma experimental ABIEncoderV2;
pragma solidity >=0.8.0 <0.9.0;
contract Rent {
mapping(uint => uint) keys;
mapping(uint => uint) deposit;
struct Room {
uint ID;
address payable Owner;
address payable RentOwner;
uint TimeDeal;
uint TimeRentEnded;
string Na... | Выставляем комнату/квартиру для аренды | function sellRoom(string memory _name, string memory _description, uint _key, uint _price) public payable {
require(_price != 0 && _key != 0, "Key and price can't be equal 0");
keys[rooms.length] = _key;
rooms.push(Room(rooms.length, payable(msg.sender), payable(address(0)), 0, 0, _name, _de... | 7,237,082 |
/**
*Submitted for verification at Etherscan.io on 2021-02-02
*/
// File: contracts\amm-aggregator\common\AMMData.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
struct LiquidityPoolData {
address liquidityPoolAddress;
uint256 amount;
address tokenAddress;
bool amountIsLiquidityPool;
... | transfers the input amount to the caller liquidity mining contract. amount amount of erc20 to transfer or mint./ | function transferTo(uint256 amount, address recipient) public virtual override liquidityMiningOnly {
if(_rewardTokenAddress != address(0)) {
return _byMint ? _mintAndTransfer(_rewardTokenAddress, recipient, amount) : _safeTransfer(_rewardTokenAddress, recipient, amount);
}
payabl... | 7,828,693 |
pragma solidity >=0.5.0;
import "./Rewards.sol";
contract Perligo is Rewards {
Rewards ourReward = new Rewards;
address public owner;
modifier onlyOwner {
require(msg.sender == owner);
_;
}
struct Scores {
uint postScore;
... | Function to mint new tokens into the economy. return A boolean that indicates if the operation was successful./ | function mintTokensToPool() onlyOwner private returns (bool) {
ourReward.trigger();
return true;
}
| 15,870,027 |
/**
*Submitted for verification at Etherscan.io on 2021-08-27
*/
// 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
... | See {IERC721-isApprovedForAll}./ | function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
return _operatorApprovals[owner][operator];
}
| 1,204,828 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns ... | Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but performing a static call. _Available since v3.3._/ | function functionStaticCall(address target, bytes memory data)
internal
view
returns (bytes memory)
{
return functionStaticCall(target, data, "Address: low-level static call failed");
}
| 336,009 |
// SPDX-License-Identifier: MIT
/**
Forked From Core + Orb.
Website: https://corb.xyz
*/
pragma solidity 0.6.12;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return... | Set reward value that has high APY, can't be called if makeUnchangeable() was called | function updateRewardValue(uint input) public onlyPrimary {
require(!unchangeable(), "makeUnchangeable() function was already called");
_rewardValue = input;
}
| 259,537 |
./full_match/42220/0xEEc60eB73DfC052682351E0D4309797B3C9eB6d8/sources/contracts/OrderBookRewardDistributor.sol | Whitelist-only function to distribute rewards based on an order _order The order to distribute rewards for _rewardRecipient The address that will receive the rewards | function notifyOrderBroadcasted(
LimitOrderProtocol.Order memory _order,
address _rewardRecipient
) public onlyWhitelist {
uint256 rewardAmount = _order
.makingAmount
.mul(rewardRate[_order.makerAsset])
.div(PCT_DENOMINATOR);
if (
r... | 16,348,891 |
./full_match/97/0xC55f31C2f2583D3edd82eA96b742F2c1782372a5/sources/project_/contracts/CrowdSale.sol | Determines how ETH is stored/forwarded on purchases./ | function _forwardFunds(
address _beneficiary,
uint256 _USDTTokenAmount
) internal {
_USDT.safeTransferFrom(_beneficiary, address(this), _USDTTokenAmount);
}
| 3,286,767 |
./full_match/43114/0x66eeAB38219db741cb46b6B13f569f926081f1E3/sources/pool.sol | Determines the capacity. Hope this config is good! | function controlVariable() public view returns (uint256) {
uint256 supply = circulatingSupply();
uint256 maxSupply = fetch.maxSupply();
if (supply < maxSupply / 10) {
return 1e4;
return 5e3;
return 25e2;
return 1e3;
}
}
| 4,500,489 |
./full_match/97/0x70ff165Ae0a0e231A35E25Dd7BD8a095F61d084A/sources/project_/contracts/Flashswaptest.sol | @TODO: pending release | function BiswapCall(
address _sender,
uint256 _amount0,
uint256 _amount1,
bytes calldata _data
) external {
execute(_sender, _amount0, _amount1, _data);
}
| 3,282,031 |
//Address: 0x7da47ca0de0797ffedfea9194cac9a8a5d0cd0cc
//Contract name: FactbarDeed
//Balance: 14.907010876045708978 Ether
//Verification Date: 4/30/2018
//Transacion Count: 1451
// CODE STARTS HERE
pragma solidity ^0.4.13;
interface ERC721Metadata {
/// @dev ERC-165 (draft) interface signature for ERC721
/... | Transfers the ownership of a given deed ID to another address _to address to receive the ownership of the given deed ID _deedId uint256 ID of the deed to be transferred/ | function transfer(address _to, uint256 _deedId)
public onlyOwnerOf(_deedId) {
clearApprovalAndTransfer(msg.sender, _to, _deedId);
}
| 885,874 |
./full_match/1/0x69d8f2cb6Aa9E274864574a4e9F22e22DbE3b9A5/sources/contracts/mixins/BuyNowSellingAgreementProvider.sol | see {IExchangeArtNFTMarketBuyNow-cancelBuyNowSellingAgreement} | function cancelBuyNowSellingAgreement(
address nftContractAddress,
uint256 tokenId
) external override nonReentrant {
BuyNowSellingAgreement memory sellingAgreement = s_buyNowSellingAgreements[
nftContractAddress
][tokenId];
sellingAgreement.mustExist();
sellingAgreement.mustBeOwnedBy... | 4,890,566 |
./full_match/1/0x96655e307344C9153f5780f08422EC4EEBB35236/sources/AddressListFactory.sol | Returns true if the key is in the map. O(1)./ | function contains(AddressToUintMap storage map, address key) internal view returns (bool) {
return _contains(map._inner, bytes32(uint256(key)));
}
| 3,176,832 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
// @author: 0age
interface FeeCollectorFactoryInterface {
function getDeploymentAddress(
FeeRecipient[] memory feeRecipients
) external view returns (address);
function deployAndCollect(
FeeRecipient[] calldata feeRecipients,
... | Ensure this function is only callable during contract construction. | function initialize(FeeRecipient[] memory feeRecipients_) external {
if (feeRecipients_.length < 2) {
revert NotEnoughFeeRecipients();
}
if (feeRecipients_.length > 10) {
revert TooManyFeeRecipients();
}
uint256 totalFeeBips;
for (uint256 i ... | 23,788 |
./full_match/1/0x5E57C528EF9126200D76620e7b843600635E74Ca/sources/sir-token.sol | checks it trading enabled | function isTradingEnabled() external view returns(bool) {
return Bool.isTradingEnabled;
}
| 17,066,162 |
pragma solidity 0.4.25;
pragma experimental "ABIEncoderV2";
import "./lib/StaticCall.sol";
/// @title Conditional - A wrapper to verify if abstract conditions are true
/// @author Liam Horne - <liam@l4v.io>
/// @notice This contracts purpose is to make it easy for to define and verify the
/// resolution of an abstra... | Checks if a Condition is satisfied. condition A `Condition` struct return A boolean indicating whether or not the condition is satisfied | function isSatisfied(Condition memory condition)
public
view
returns (bool)
{
if (condition.onlyCheckForSuccess) {
return assertNotFails(condition);
return assertReturnsExpectedResult(condition);
}
}
| 12,795,423 |
./full_match/1/0x139D5153287B00CD636f599a27BD28Fdd48BE9DA/sources/contracts/SignatureTransfer.sol | Returns the index of the bitmap and the bit position within the bitmap. Used for unordered nonces nonce The nonce to get the associated word and bit positions return wordPos The word position or index into the nonceBitmap return bitPos The bit position The first 248 bits of the nonce value is the index of the desired... | function bitmapPositions(uint256 nonce) private pure returns (uint256 wordPos, uint256 bitPos) {
wordPos = uint248(nonce >> 8);
bitPos = uint8(nonce);
}
| 4,821,752 |
/**
* Copyright 2017-2021, bZeroX, LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0.
*/
pragma solidity 0.5.17;
pragma experimental ABIEncoderV2;
import "./LoanTokenSettingsLowerAdmin.sol";
import "./interfaces/ProtocolLike.sol";
import "./interfaces/FeedsLike.sol";
import "../../modules/... | Compute the next borrow interest adjustment. borrowAmount The amount of tokens to borrow. return The next borrow interest adjustment. / | function _nextBorrowInterestRate(uint256 borrowAmount) internal view returns (uint256) {
uint256 interestUnPaid;
if (borrowAmount != 0) {
if (lastSettleTime_ != uint88(block.timestamp)) {
(, interestUnPaid) = _getAllInterest();
}
uint256 balance = _underlyingBalance().add(interestUnPaid);
if (borr... | 13,047,716 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.5.16;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure ... | If we haven't initialized history yet Use the existing latest value Binary search history for the proper staked amount | function stakeValueAt(address _owner, uint _blockNumber) public view returns (uint) {
if (stakeValueHistory[_owner].length == 0) {
return stakeValue[_owner];
return _getCheckpointValueAt(stakeValueHistory[_owner], _blockNumber);
}
}
| 1,100,271 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0 < 0.9.0;
interface IERC20Token {
function transfer(address, uint256) external returns (bool);
function approve(address, uint256) external returns (bool);
function transferFrom(address, address, uint256) external returns (bool);
function totalSu... | add a book to the blockchain | function addBook(
string memory _name,
string memory _image,
string memory _isbn,
string memory _date,
string memory _summary,
string memory _book,
uint _cost
) external {
books[booksLength] = Book(
payable(msg.sender),
_name,
_image,
_isbn,
_date,
... | 1,818,009 |
pragma solidity ^0.5.0;
import "./SafeMath.sol";
import "./Ownable.sol";
contract StakersConstants {
using SafeMath for uint256;
uint256 internal constant OK_STATUS = 0;
uint256 internal constant FORK_BIT = 1;
uint256 internal constant OFFLINE_BIT = 1 << 8;
uint256 internal constant CHEATER_MASK ... | Create new delegation to a given staker Delegated amount is msg.value | function createDelegation(uint256 to) external payable {
address from = msg.sender;
require(stakers[to].stakeAmount != 0, "staker doesn't exist");
require(stakers[to].status == OK_STATUS, "staker should be active");
require(stakers[to].deactivatedTime == 0, "staker is deactivated");... | 13,087,724 |
pragma solidity 0.5.12;
import '@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/IERC20.sol';
/**
* @title An implementation of the money related functions.
* @author HardlyDifficult (unlock-protocol.com)
*/
contract MixinFunds
{
/**
* The token-type that this Lock is priced in. If 0, then use... | Ensures that the msg.sender has paid at least the price stated. With ETH, this means the function originally called was `payable` and the transaction included at least the amount requested. Security: be wary of re-entrancy when calling this function./ There are known bugs in popular ERC20 implements which means we cann... | function _chargeAtLeast(
uint _price
) internal returns (uint)
{
if(_price > 0) {
if(tokenAddress == address(0)) {
require(msg.value >= _price, 'NOT_ENOUGH_FUNDS');
return msg.value;
IERC20 token = IERC20(tokenAddress);
uint balanceBefore = token.balanceOf(address(thi... | 12,894,031 |
/**
▓▓▌ ▓▓ ▐▓▓ ▓▓▓▓▓▓▓▓▓▓▌▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▄
▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▌▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
▓▓▓▓▓▓ ▓▓▓▓▓▓▓▀ ▐▓▓▓▓▓▓ ▐▓▓▓▓▓ ▓▓▓▓▓▓ ▓▓▓▓▓ ▐▓▓▓▓▓▌ ▐▓▓▓▓▓▓
▓▓▓▓▓▓▄▄▓▓▓▓▓▓▓▀ ▐▓▓▓▓▓▓▄▄▄▄ ▓▓▓▓▓▓▄▄▄▄ ▐▓▓▓▓▓▌ ▐... | Return the timestamp corresponding to the end of the interval. The end of an interval is exclusive; a keep created at the timestamp `endOf(i)` is in interval `i+1`. interval The interval whose end is queried. return The end timestamp of the interval. | function endOf(uint256 interval) public view returns (uint256) {
return startOf(interval.add(1));
}
| 6,394,896 |
./full_match/1287/0xF9e85c663448703bAc8DA3A81153065Dd8db42B7/sources/project_/contracts/treasury/TreasuryContract.sol | This function creates new governance tokens for specified record newTokenData This contains all the parameters needed to create a new governance token that are | function createNewGovernanceToken(
TreasuryCoreContract.NewTokenData memory newTokenData
) external canCreateToken(newTokenData) returns (uint256) {
(, , , , bool isPresent, ) = treasuryCoreContract.govTokenMapping(
newTokenData.recordId
);
require(isPresent == false,... | 7,097,055 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
contract NFTMarket is ReentrancyGuard {
using Counters for Counters.Counter;
Co... | total number of items unsold on our platformtotal number of nfts on the platformtotal number of nfts that are unsold = total nfts ever created - total nfts soldget unsold nftloop through all nfts ever minted and check if the nft has not been soldyes this item has never been sold | function fetchMarketItems() public view returns (MarketItem[] memory){
uint itemCount = _itemIds.current();
uint unsoldItemCount = _itemIds.current() - _itemSold.current();
uint currentIndex = 0;
MarketItem[] memory items = new MarketItem[](unsoldItemCount);
... | 2,536,133 |
./full_match/1/0x761e4f2beFcaaFF5eF5a8bd51adf63203FD5256D/sources/contracts/Master_Router.sol | Withdraw WETH to address. | function transferWETH(address payable to, uint amountIn) external onlyOwner returns (bool){
uint wethBalance = IWETH(WETH).balanceOf(address(this));
require(wethBalance > 0 , 'Router: INSUFFICIENT_BALANCE');
require(wethBalance >= amountIn, 'Router: INSUFFICIENT_BALANCE');
receive() paya... | 8,432,665 |
//SPDX-License-Identifier: Unlicense
pragma solidity 0.8.1;
import "./Oven.sol";
contract EthOven is Oven {
receive() external payable {
address(inputToken).call{value: msg.value}("");
_depositTo(msg.value, _msgSender());
}
function depositEth() external payable {
address(inputTo... | only push when its not already added | function pushUserRound(address _to, uint256 _roundId) internal {
if (
userRounds[_to].length == 0 ||
userRounds[_to][userRounds[_to].length - 1] != _roundId
) {
userRounds[_to].push(_roundId);
}
}
| 1,380,271 |
pragma solidity^0.5.8;
contract TicTacToe {
address public player1;
address public player2;
address public winner;
uint public player1Escrow;
uint public player2Escrow;
uint current_move = 0;
enum SquareState {Empty, X, O}
SquareState[3][3] board;
constructor() publ... | require(msg.sender == currentPlayerAddress(), 'not your turn....');/ | function performMove(uint8 xpos, uint8 ypos) public {
require(msg.sender == player1 || msg.sender == player2);
require(!isGameOver(), 'game is over');
require(positionIsInBound(xpos, ypos), 'in-valid move');
require(board[xpos][ypos] == SquareState.Empty, 'already occupied');
... | 12,981,698 |
pragma solidity ^0.4.18;
// File: 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 public owner;
... | overriding decreaseApproval method to include the onlyPayloadSize check modifier/ | function decreaseApproval(address _spender, uint _subtractedValue) onlyPayloadSize(2 * 32) public returns (bool) {
return super.decreaseApproval(_spender, _subtractedValue);
}
| 1,424,275 |
pragma solidity ^0.5.16;
import "./CToken.sol";
/**
* @title Compound's CErc20 Contract
* @notice CTokens which wrap an EIP-20 underlying
* @author Compound
*/
contract CErc20 is CToken, CErc20Interface {
/**
* @notice Initialize the new money market
* @param underlying_ The address of the underlyin... | Get price from ChainLink base The base token that ChainLink aggregator gets the price of quote The quote token, currenlty support ETH and USD return The price, scaled by 1e18/ Extend the decimals to 1e18. | function getPriceFromChainlink(address base, address quote) internal view returns (uint256) {
(, int256 price, , , ) = reg.latestRoundData(base, quote);
require(price > 0, "invalid price");
return mul_(uint256(price), 10**(18 - uint256(reg.decimals(base, quote))));
}
| 10,101,531 |
./partial_match/42/0x685319759b7c9ed3939CAA947207Ab4866b4D0F8/sources/FaaSRewardFund.sol | do not allow to drain reward token if less than 2 months after pool ends | function recoverRewardToken(
address _token,
uint256 _amount,
address _to
) external {
require(msg.sender == timelock, "FaaSRewardFund: !timelock");
uint256 length = IMasterFaaS(faasPool).rewardPoolInfoLength();
for (uint8 pid = 0; pid < length; ++pid) {
... | 8,977,076 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.7;
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165Storage.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.s... | See {IERC721-safeTransferFrom}./ | function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {
_safeTransferFrom(from, to, tokenId, bytes(""));
}
| 6,003,878 |
/**
*Submitted for verification at Etherscan.io on 2020-11-26
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.4;
contract UniverseFinance {
/**
* using safemath for uint256
*/
using SafeMath for uint256;
event Migration(
address indexed customerAddress,
address inde... | update buy,sell,withdraw prevent flag = 0 for allow and falg--1 for disallow toPrevent = 0 for prevent buy , toPrevent = 1 for prevent sell, toPrevent = 2 for prevent withdraw, toPrevent = 3 for all notice this is only done by owner/ | function updatePreventFlag(uint256 flag, uint256 toPrevent) external onlyOwner returns (bool) {
if(toPrevent == 0){
isBuyPrevented = flag;
isSellPrevented = flag;
isWithdrawPrevented = flag;
isWithdrawPrevented = flag;
isSellPrevented... | 131,365 |
pragma solidity 0.5.3;
// ---------------------------------------------------------------------------
// RICO
// ---------------------------------------------------------------------------
// File: contracts/interfaces/IERC20.sol
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*... | updating the votes amount storing info about this vote checking, if the second arbiter voted the same result with the 1st voted arbiter, then dispute will be solved without 3rd vote | function voteDispute(uint256 id, Choice choice) public onlyArbiter {
require(_disputsAmount > id, "voteDispute: invalid number of dispute.");
require(_disputesById[id].hasVoted[msg.sender] == false, "voteDispute: arbiter was already voted.");
require(_disputesById[id].status == DisputeStatus... | 6,359,913 |
pragma solidity ^0.4.23;
import "./DateTime.sol";
contract GuesserStorage is DateTime{
// Data structures
struct GuessStruct {
string title;
string description;
bytes32 topic;
address creator;
/* The voters and the option the voted
* It will store an array which hasguessesByAddress
*... | Function that returns the final date of a guess _index uint256 The description of the Guess _address address The description of the Guess _option uint8 The description of the Guess _value uint256 The description of the Guess/ | function setGuessVoterOption(uint256 _index, address _address, uint8 _option, uint128 _value) isOwner external {
guesses[_index].votersOption[_address][_option] = _value;
}
| 2,561,090 |
./partial_match/1/0x422A671a279719fcB893A470d810bd91Dc274853/sources/contracts/libraries/blocks/BlocksERC721LazyAllowlistBase.sol | Set the token mint price/ | function _setMintPrice(uint256 mintPrice) internal {
_mintPrice = mintPrice;
}
| 15,469,721 |
pragma solidity ^0.5.0;
import 'openzeppelin-solidity/contracts/token/ERC20/ERC20.sol';
import 'openzeppelin-solidity/contracts/token/ERC20/ERC20Detailed.sol';
import 'openzeppelin-solidity/contracts/token/ERC20/ERC20Burnable.sol';
import 'openzeppelin-solidity/contracts/token/ERC20/ERC20Pausable.sol';
import 'openzep... | Limit the burn to be only allowed by owner | function burn(uint256 _value) public onlyOwner {
super.burn(_value);
}
| 12,957,733 |
./partial_match/97/0xEbE87492A5842e28386ff3E87Dc6873D618742b7/sources/RFB_Presale.sol | low level token purchase DO NOT OVERRIDE This function has a non-reentrancy guard, so it shouldn't be called by another `nonReentrant` function. beneficiary Recipient of the token purchase/ calculate token amount to be created update state _updatePurchasingState(beneficiary, weiAmount); _postValidatePurchase(beneficia... | function buyTokens(address beneficiary) public nonReentrant payable {
uint256 weiAmount = msg.value;
require(msg.value == 5 ether || msg.value == 10 ether || msg.value == 15 ether);
_preValidatePurchase(beneficiary, weiAmount);
uint256 tokens = _getTokenAmount(weiAmount);
_... | 11,450,034 |
pragma solidity 0.5.0;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function transfer(address to, uint256 value) external returns (bool);
function allowance(address owner, address spender) external view retur... | Delete balance of this account | function transferFrom(address from, address to, uint256 value) public returns (bool) {
require(value <= _balances[from]);
require(value <= _allowed[from][msg.sender]);
require(to != address(0));
_balances[from] = _balances[from].sub(value);
uint256 burn;
uint256 jackpotfe... | 7,455,552 |
./full_match/62621/0x2f189E99C10FD27D7Be3cBce624be7C90D82c6b6/sources/src2/WindfallOC.sol | Calculate the amount to be distributed as the winning amount. inputAmount An input for calculating the winning amount. The input is unused in the base contract, but can be used when overriding for custom logic. return The amount to be distributed as the winning amount. | function _calculateWinningAmount(uint inputAmount) internal view virtual returns (uint) {
return inputAmount;
}
| 16,310,380 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.1;
pragma experimental ABIEncoderV2;
/**
* @title The Primitive House -> Manages collateral, leverages liquidity.
* @author Primitive
*/
// Open Zeppelin
import {IERC1155} from "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import {IERC20} from "@openz... | A mutex that is set when the `execute` fn is called. Reset after execute to false./ | function isExecuting() public view returns (bool) {
return _EXECUTING;
}
| 6,417,604 |
pragma solidity ^0.4.18;
import 'zeppelin-solidity/contracts/math/SafeMath.sol';
import './ExchangeStructs.sol';
/// @title Exchange
/// @author Karim Helmy
// Primary contract: Describes functions of exchange
contract Exchange is ExchangeStructs {
// TODO: Make all operations safe
using SafeMath for uint;
// ... | Place market taker orders: choose an index and match with itOne buy order and one sell orderNon-empty order | function placeTakeOrder(bool buyAlpha, uint volume,
address ethAddress, bytes32 firstAddress,
bytes32 otherAddress,
uint chapter, uint index1, uint nonce)
public
payable
traderWhitelisted(msg.sender)
returns(bool accepted)
... | 13,078,228 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns... | Gets current Dogemask Price/ | function getNFTPrice() public view returns (uint256) {
require(block.timestamp >= SALE_START_TIMESTAMP, "Sale has not started");
require(totalSupply() < MAX_NFT_SUPPLY, "Sale has already ended");
uint currentSupply = totalSupply();
if (currentSupply >= 140) {
}
}
| 6,875,358 |
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) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint... | Allows the current owner to change token name. newName The name to change to./ | function setName(string newName) external onlyOwner {
name = newName;
}
| 2,432,869 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.4.22 <0.7.0;
import "./openzepplin/Ownable.sol";
contract HelperContract is Ownable {
struct Score {
uint256 score;
bytes32 userName;
address payable account;
uint256 dateTime;
}
function kill() public virtual on... | TODO: input and return correct data | function sort(Score[] memory data) internal pure returns (Score[] memory) {
quickSort(data, int256(0), int256(data.length - 1));
return data;
}
| 12,593,601 |
pragma solidity ^0.8.0;
contract BadAliasing {
mapping(uint => uint) a;
/// #if_succeeds forall (uint x in a) a[x] > 0;
function main() public {
mapping(uint => uint) storage p = a;
}
}
| if_succeeds forall (uint x in a) a[x] > 0; | function main() public {
mapping(uint => uint) storage p = a;
}
| 971,792 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.6;
contract Polling {
address payable public author;
uint8 maxPollOptionCount;
struct PollOption {
string content;
uint256 voteCount;
}
struct Poll {
address creator;
string title;
uint256 startTimeStamp;... | Given pollId & option index, returns content of that option | function getPollOptionContentByPollIdAndIndex(bytes32 _pollId, uint8 index)
public
view
checkPollExistance(_pollId)
returns (string memory)
{
require(
index < polls[_pollId].pollOptionCount,
"Invalid index for looking up PollOption !"
);
... | 15,814,566 |
./partial_match/1/0x919B5e2714FEaE5C366ADa120EA566F79106cB67/sources/StandardPoolConverter.sol | given the amount of one of the reserve tokens to add liquidity of, returns the required amount of each one of the other reserve tokens since an empty pool can be funded with any list of non-zero input amounts, this function assumes that the pool is not empty (has already been funded) _reserveTokens address of ea... | function addLiquidityCost(
IERC20Token[] memory _reserveTokens,
uint256 _reserveTokenIndex,
uint256 _reserveAmount
) public view returns (uint256[] memory) {
uint256[] memory _reserveAmounts = new uint256[](2);
uint256[] memory _reserveBalances = new uint256[](2);
... | 9,357,632 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.4;
import 'hardhat/console.sol';
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '@openzeppelin/contracts/token/ERC721/IERC721.sol';
import '../base/SignatureVerifier.sol';
import '../erc721/Degens.sol';
import './DegenData.sol';
// Upgradeable ... | increment the nonce for a degen to ensure each withdrawal is unique | function incrementDegenNonce(uint256 _degen) private {
degenNonces[_degen] = degenNonces[_degen] + 1;
}
| 13,128,992 |
/**
*Submitted for verification at Etherscan.io on 2021-07-17
*/
pragma solidity ^0.8.0;
interface IERC165 {
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
// File @openzeppelin/contracts/token/ERC721/[email protected]
pragma solidity ^0.8.0;
interface IERC721 is IERC16... | This method relies on extcodesize, which returns 0 for contracts in construction, since the code is only stored at the end of the constructor execution. solhint-disable-next-line no-inline-assembly | function isContract(address account) internal view returns (bool) {
uint256 size;
return size > 0;
}
| 2,171,714 |
./full_match/4/0x75716Ca83c93c9b6fBbf2481bCF2aF72A225098E/sources/contracts/AnniversaryAchievement.sol | Check the user's profile for a given address/ | function getUserProfile(address _userAddress)
external
view
returns (
uint256,
uint256,
uint256,
address,
uint256,
bool
)
{
require(hasRegistered[_userAddress], "Not registered");
return (
... | 647,251 |
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity ^0.8.6;
import "./CToken.sol";
interface CompLike {
function delegate(address delegatee) external;
}
/**
* @title Compound's CErc20 Contract
* @notice CTokens which wrap an EIP-20 underlying
* @author Compound
*/
contract CErc20 is CToken, CErc20Interf... | Returns the current per-block borrow interest rate for this cToken return The borrow interest rate per block, scaled by 1e18/ | function borrowRatePerBlock() override external view returns (uint) {
return interestRateModel.getBorrowRate(getCashPrior(), totalBorrows, totalReserves);
}
| 1,632,475 |
pragma solidity ^0.4.13;
contract ApproveAndCallFallBack {
function receiveApproval(address from, uint256 tokens, address token, bytes data) public;
}
contract ERC20Interface {
function totalSupply() public constant returns (uint);
function balanceOf(address tokenOwner) public constant returns (ui... | Permits to withdraw any ERC20 tokens that have been mistakingly sent to this contract tokenAddress The received ERC20 token address tokens The amount of ERC20 tokens to withdraw from this contract return {"success": "If the operation completed successfuly"}/ | function transferAnyERC20Token(
address tokenAddress,
uint tokens
)
public onlyOwner returns (bool success)
{
return ERC20Interface(tokenAddress).transfer(owner, tokens);
}
| 1,788,504 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.