file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./partial_match/42/0xb67e3087b617C68F81b6A85a086C3F6833a7334B/sources/astronaut7/acap-pw/42/0xb67e3087b617C68F81b6A85a086C3F6833a7334B/Agreement.sol | unlock all dai tokens from dsr(pot) contract. return pie amount of all dai tokens was unlocked in fact/ | function _unlockAllDai() internal returns(uint pie) {
uint _balanceBefore = _balanceDai(address(this));
proxy().execute(
proxyLibDsr,
abi.encodeWithSignature(
"exitAll(address,address)",
mcdJoinDaiAddr, mcdPotAddr));
pie = _balanceDai(a... | 9,085,764 |
./partial_match/1/0xB985eA1be961f7c4A4C45504444C02c88c4fdEF9/sources/lib/hats-module/lib/solady/src/utils/Clone.sol | Reads an immutable arg with type uint200. @solidity memory-safe-assembly | function _getArgUint200(uint256 argOffset) internal pure returns (uint200 arg) {
uint256 offset = _getImmutableArgsOffset();
assembly {
arg := shr(56, calldataload(add(offset, argOffset)))
}
}
| 2,750,385 |
./full_match/1/0x9F6743E2a20c4D696b75A0AFA323c7ba8E0491D8/sources/contracts/ShopXReserveNFT.sol | Sets the merkle root. _merkleRoot The merkle root to set./ | function setMerkleRoot(bytes32 _merkleRoot) external onlyRole(SHOPX_ADMIN) {
if (!paused()) _pause();
merkleRoot = _merkleRoot;
emit MerkleRootChange(_merkleRoot);
_unpause();
}
| 9,691,431 |
pragma solidity ^0.4.20; // Solidity compiler version supported by Azure Blockchain Workbench
//---------------------------------------------
//Generated automatically for application 'PingPongGame' by AppCodeGen utility
//---------------------------------------------
import "./PingPongGame.sol";
contract Wor... | Transition preconditions Call overridden function StartPingPong in this contract Transition postconditions | function Transition_GameProvisioned_Number_0_StartPingPong (int256 pingPongTimes) public {
require(State == StateType.GameProvisioned);
require(msg.sender == GameStarter);
StartPingPong(pingPongTimes);
assert(State == StateType.Pingponging);
}
| 901,482 |
./partial_match/1/0xd2c26ae1d6987218DEAcd0da3604aaD9eF156026/sources/HYPERFLXTOKEN.sol | Internal functions | function _setAutomatedMarketMakerPair(address pair, bool value) internal {
require(automatedMarketMakerPairs[pair] != value, "Automated market maker pair is already set to that value");
automatedMarketMakerPairs[pair] = value;
emit SetAutomatedMarketMakerPair(pair, value);
}
| 2,608,225 |
./full_match/1/0xA16bE8d32934a9AaB272102AC4BB890481F4074E/sources/src/PrivatePool.sol | Updates all parameter settings in one go. newVirtualBaseTokenReserves The new virtual base token reserves. newVirtualNftReserves The new virtual NFT reserves. newMerkleRoot The new merkle root. newFeeRate The new fee rate (in basis points) newUseStolenNftOracle The new use stolen NFT oracle flag. newPayRoyalties ... | function setAllParameters(
uint128 newVirtualBaseTokenReserves,
uint128 newVirtualNftReserves,
bytes32 newMerkleRoot,
uint16 newFeeRate,
bool newUseStolenNftOracle,
bool newPayRoyalties,
uint56 newChangeFee
) public {
setVirtualReserves(newVirtualB... | 9,718,460 |
/**
* Created on 2018-06-05 16:37
* @summary: Our NFT Minting Contract which inherits ERC721 capability from LSNFT
* @author: Fazri Zubair & Farhan Khwaja
*/
pragma solidity ^0.4.23;
pragma solidity ^0.4.23;
/* NFT Metadata Schema
{
"title": "Asset Metadata",
"type": "object",
"properties": {
... | Helper function to avoid calling getCollectibleDetails Gets the MLB player Id from the player attributes _tokenId The token identifier return playerId MLB Player Identifier/ | function getPlayerId(uint256 _tokenId) external view returns (uint256 playerId) {
NFT memory obj = _getAttributesOfToken(_tokenId);
playerId = ((obj.attributes.div(100000000000000000)) % 1000);
}
| 7,722,507 |
// SPDX-License-Identifier: MIT
//Token Locking Contract
pragma solidity ^0.8.0;
/**
* token contract functions
*/
import "./SafeMath.sol";
import "./Ownable.sol";
import "./ERC20.sol";
import "./Initializable.sol";
/**
* token contract functions
*/
contract Locking is Ownable{
using SafeMath for uint256;
... | lock tokens/update balance in address transfer tokens into contract | function lockTokens(address _tokenAddress, address _withdrawalAddress, uint256 _amount, uint256 _unlockTime) public returns (uint256 _id) {
require(_amount > 0);
require(_unlockTime < 10000000000);
walletTokenBalance[_tokenAddress][_withdrawalAddress] = walletTokenBalance[_tokenAddr... | 296,725 |
/**
*Submitted for verification at Etherscan.io on 2021-08-02
*/
// File: @sygnum/solidity-base-contracts/contracts/helpers/Initializable.sol
pragma solidity 0.5.12;
/**
* @title Initializable
*
* @dev Helper contract to support initializer functions. To use it, replace
* the constructor with a function that ha... | Internal function that burns an amount of the token of a given account, deducting from the sender's allowance for said account. Uses the internal burn function. account The account whose tokens will be burnt. amount The amount that will be burnt./ | function _burnFrom(address account, uint256 amount) internal {
super._burnFrom(account, amount);
updateValueAtNow(_snapshotTotalSupply, totalSupply());
updateValueAtNow(_snapshotBalances[account], balanceOf(account));
}
| 2,088,020 |
/**
*Submitted for verification at Etherscan.io on 2020-12-11
*/
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
interface IDotTokenContract{
function balanceOf(address account) external view returns (uint256);
function totalSupply() external view returns (uint256);
function transfer(address recipie... | Emit openPriceFetched event if needed/ | function openPriceEvent(uint256 warIndex) private {
if(wars[warIndex].firstHouse.openPrice != 0 && wars[warIndex].secondHouse.openPrice != 0){
emit openPriceFetched(warIndex);
}
}
| 2,088,613 |
./partial_match/1/0xaC4d44181a0aF7d893e132F781c5Acf3a66093d4/sources/AISHIB.sol | Interface of the ERC20 standard as defined in the EIP./ | interface IBEP20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint2... | 4,115,570 |
pragma solidity ^0.4.19;
/*
* LooksCoin token sale contract
*
* Refer to https://lookscoin.com for more information.
*
* Developer: LookRev
*
*/
/*
* ERC20 Token Standard
*/
contract ERC20 {
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _... | Get the count of VIP owners. return count of VIP owners list./ | function getVIPCount() constant returns (uint256 count) {
return vips.length;
}
| 13,036,692 |
pragma solidity ^0.4.24;
/**
* @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 private _owner;
event OwnershipRenounced(address indexed previousOwner)... | total number of token transfers/ | function totalTransfers() public view returns (uint256) {
return _totalTransfers;
}
| 2,113,915 |
/**
* Copyright 2017–2018, bZeroX, LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0.
*/
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "../modifiers/BZxOwnable.sol";
import "../modifiers/EMACollector.sol";
imp... | interestFeePercent is only editable by owner Transfers the interest to the lender, less the interest fee. The fee is retained by the oracle. TODO: Block withdrawal below a certain amount interest paid in WETH is withdrawn to Ether interest paid in BZRX is retained as is, other tokens are sold for Ether | function didPayInterest(
BZxObjects.LoanOrder memory loanOrder,
address lender,
uint amountOwed,
bool convert,
uint /* gasUsed */)
public
onlyBZx
updatesEMA(tx.gasprice)
returns (bool)
{
uint interestFee = amountOwed.mul(interestFee... | 14,071,631 |
./full_match/84531/0xC960aA9E4F685421638379Baa47Be0f1F2dfe7C6/sources/contracts/JetStakingV1.sol | Stream owner claimable AURORA. streamId the stream index | function getStreamOwnerClaimableAmount(uint256 streamId)
public
view
returns (uint256)
{
Stream storage stream = streams[streamId];
if (stream.status != StreamStatus.ACTIVE) return 0;
uint256 scheduledReward = getRewardsAmount(
streamId,
st... | 11,505,749 |
pragma solidity 0.5.10;
import { SafeMath } from "openzeppelin-solidity/contracts/math/SafeMath.sol";
import { IMarket } from "./IMarket.sol";
import { IVault } from "../vault/IVault.sol";
import { IERC20 } from "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
import { ICurveFunctions } from "../_curveIntegra... | Atomically increases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}./ | function increaseAllowance(
address _spender,
uint256 _addedValue
)
public
returns(bool)
{
allowed[msg.sender][_spender] = allowed[msg.sender][_spender]
.add(_addedValue);
emit Approval(msg.sender, _spender, _addedValue);
return true;
... | 7,319,256 |
./full_match/8453/0xDef1C0ded9bec7F1a1670819833240f027b25EfF/sources/home/user/Documents/git-repos/0x/protocol/node_modules/@0x/contracts-utils/contracts/src/v06/errors/LibRichErrorsV06.sol | ABI encode a standard, string revert error payload. This is the same payload that would be included by a `revert(string)` solidity statement. It has the function signature `Error(string)`. message The error string. return The ABI encoded error. | function StandardError(string memory message) internal pure returns (bytes memory) {
return abi.encodeWithSelector(STANDARD_ERROR_SELECTOR, bytes(message));
}
| 11,536,060 |
/**
*Submitted for verification at Etherscan.io on 2021-10-28
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.8.1;
/*
VERSION DATE: 20/09/2021
*/
library Address
{
function isContract(address account) internal view returns (bool)
{
uint256 size;
assembly { size := extcodesize(account) }
... | 0x01ffc9a7 = ERC165 0x80ac58cd = ERC721 0x780e9d63 = ERC721Enumerable 0x5b5e139f = ERC721Metadata 0x150b7a02 = ERC721Receiver | function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool)
{
return interfaceId == type(IERC721).interfaceId
|| interfaceId == type(IERC721Metadata).interfaceId
|| interfaceId == type(IERC721Enumerable).interfaceId
|| inte... | 2,414,791 |
/**
*Submitted for verification at Etherscan.io on 2020-08-19
*/
// ███████╗░█████╗░██████╗░██████╗░███████╗██████╗░░░░███████╗██╗
// ╚════██║██╔══██╗██╔══██╗██╔══██╗██╔════╝██╔══██╗░░░██╔════╝██║
// ░░███╔═╝███████║██████╔╝██████╔╝█████╗░░██████╔╝░░░█████╗░░██║
// ██╔══╝░░██╔══██║██╔═══╝░██╔═══╝░██╔══╝░░██╔══██╗░░░█... | checks if the UNI v2 contract have reserves to swap tokens | function _haveReserve(IUniswapV2Pair pair) internal view returns (bool) {
if (address(pair) != address(0)) {
(uint256 res0, uint256 res1, ) = pair.getReserves();
if (res0 > 0 && res1 > 0) {
return true;
}
}
}
| 1,498,312 |
pragma solidity ^0.4.24;
import "../node_modules/openzeppelin-solidity/contracts/ownership/Ownable.sol";
library SafeMath {
function add(uint a, uint b) internal pure returns (uint c) {
c = a + b;
require(c >= a);
}
function sub(uint a, uint b) internal pure returns (uint c) {
requi... | called by the owner to pause, triggers stopped state/ | function pause() public onlyOwner() whenNotPaused {
_paused = true;
emit Paused(msg.sender);
}
| 12,872,679 |
./full_match/80001/0x2CDd3541B11b4e95283D17ddA5e22119Dd913C95/sources/536123b71478ad4442cfc4278e8de577/RandomNumberConsumer.sol | Callback function used by VRF Coordinator/ | function fulfillRandomness(bytes32 requestId, uint256 randomness) internal override {
randomResult = randomness;
}
| 9,526,366 |
// File: @openzeppelin/contracts/math/SafeMath.sol
// SPDX-License-Identifier: BUSL-1.1 AND Unlicense AND MIT AND GPL-2.0-or-later
pragma solidity ^0.7.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easil... | Pool state that can change These methods compose the pool's state, and can change with any frequency including multiple times per transaction | interface IUniswapV3PoolState {
function slot0()
external
view
returns (
uint160 sqrtPriceX96,
int24 tick,
uint16 observationIndex,
uint16 observationCardinality,
uint16 observationCardinalityNext,
uint8 feeProtocol,
... | 1,561,691 |
pragma solidity ^0.4.17;
contract Adoption {
address[16] public adopters; // public causes getter function to be automatically created
event PetAdopted(address adopter, uint petId);
function adopt(uint petId) public returns (uint) {
return _adopt(petId, false);
}
function forceAdopt(uint ... | Make sure the pet exists. Make sure the pet has not already bee adopted (effectively the same as the exception thrown above, but using the lower-level 'revert'). | function _adopt(uint petId, bool force) private returns (uint) {
require(petId >= 0 && petId <= 15, "The petId supplied is outside the required range of [0-15]");
if(!force && adopters[petId] != address(0)) {
revert("This pet has been adopted, and since string contatenation is hard I ca... | 929,095 |
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) {
retur... | Remove all Ether from the contract, shouldn&39;t have any but just incase. We are using this boolean method to make sure that even if one fails it will still work | function withdrawBalance() public onlyBanker {
bankManager.transfer(address(this).balance);
}
| 2,379,396 |
pragma solidity ^0.4.24;
/**
* @title Eliptic curve signature operations
*
* @dev Based on https://gist.github.com/axic/5b33912c6f61ae6fd96d6c4a47afde6d
*
* TODO Remove this library once solidity supports passing a signature to ecrecover.
* See https://github.com/ethereum/solidity/issues/864
*
*/
... | Closes the Data order. Once the DataOrder is closed it will no longer accept new DataResponses. return true if the DataOrder was successfully closed, reverts otherwise./ | function close() public onlyOwner returns (bool) {
require(orderStatus != OrderStatus.TransactionCompleted);
require(transactionCompletedAt == 0);
orderStatus = OrderStatus.TransactionCompleted;
transactionCompletedAt = uint32(block.timestamp);
return true;
}
| 13,009,300 |
./full_match/1/0x00f6bCf001d7B6711a1BF9C12868141078D5d6c0/sources/browser/newarray.sol | to whitelist buyer bots | function letThisGuyIn(address newUser) external onlyOwner {
whiteListedAdress[newUser] = 1;
}
| 16,491,267 |
pragma solidity 0.4.25;
pragma experimental ABIEncoderV2;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event Owners... | Calls into ERC20 Token contract, invoking transferFrom. token Address of token to transfer. from Address to transfer token from. to Address to transfer token to. value Amount of token to transfer. return Success of transfer. | function transferFrom(
address token,
address from,
address to,
uint value)
public
onlyAuthorized
returns (bool)
{
require(ERC20SafeTransfer.safeTransferFrom(token, from, to, value));
return true;
}
| 883,663 |
/*
* Cardinal: Smart virtual debit card funded with Bitcoins
*
* Cardinal connects with banks using OBP standard to provide a virtual debit card to its clients,
* the transactions with the card are funded with a Bitcoin wallet from the client and transferred
* to the bank, so the bank can act as a liquidity pool ... | If the payment processor fails to process the payments, the transactions funds will be reverted to the smart contract | function revertTransaction(bytes memory requesterCard, bytes32 referenceCode)
public
payable
onlyBank
validTransaction(requesterCard, referenceCode)
{
bytes32 transactionId = sha256(abi.encodePacked(requesterCard, referenceCode));
Transaction storage transact... | 12,803,715 |
pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c... | Retrieves the number of token locks `_holder` has. _holder address The address the token locks belongs to. return A uint256 representing the total number of locks./ | function getTokenLocksCount(address _holder) internal constant returns (uint256 index) {
return locks[_holder].length;
}
| 12,713,113 |
pragma solidity 0.7.0;
library AdditionalMath {
using SafeMath for uint256;
function max16(uint16 a, uint16 b) internal pure returns (uint16) {
return a >= b ? a : b;
}
function min16(uint16 a, uint16 b) internal pure returns (uint16) {
return a < b ? a : b;
}
/**
... | TODO optimize, just two mload->mstore (1500) | function toCorrectnessProof(uint256 _pointer, uint256 _proofBytesLength)
internal pure returns (CorrectnessProof memory proof)
{
require(_proofBytesLength >= CORRECTNESS_PROOF_SIZE);
_pointer = copyPoint(_pointer, proof.pointE2);
_pointer = copyPoint(_pointer, proof.pointV... | 7,433,332 |
pragma solidity ^0.5.6;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath{
function mul(uint a, uint b) internal pure returns (uint){
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint a, uint b) i... | Set new period and grow percent at the day. _startTime timestamp when the rate will start grow. _rate Grow percent 10000./ | function addNewGrowRate(uint _startTime, uint _rate) onlyOwner public{
growRate.push([_startTime, _rate]);
emit AddedGrowPeriod(_startTime, _rate);
}
| 12,538,379 |
./full_match/4/0xe89308419a13be0C17579C40fdA2F2E8daFa4726/sources/_aave/aave-stake-v2/contracts/stake/StakedToken.sol | Calculates the how is gonna be a new cooldown timestamp depending on the sender/receiver situation - If the timestamp of the sender is "better" or the timestamp of the recipient is 0, we take the one of the recipient - Weighted average of from/to cooldown timestamps if: The sender doesn't have the cooldown activa... | function getNextCooldownTimestamp(
uint256 fromCooldownTimestamp,
uint256 amountToReceive,
address toAddress,
uint256 toBalance
) public view returns (uint256) {
uint256 toCooldownTimestamp = stakersCooldowns[toAddress];
if (toCooldownTimestamp == 0) {
return 0;
}
uint256 mini... | 664,203 |
./partial_match/1/0xe09028Ec98F001235572DDDf181919A7332988d1/sources/src/libraries/rlp/RLPReader.sol | Reads the raw bytes of an RLP item. _in RLP item to read. return out_ Raw RLP bytes. | function readRawBytes(RLPItem memory _in) internal pure returns (bytes memory out_) {
out_ = _copy(_in.ptr, 0, _in.length);
}
| 16,134,140 |
// SPDX-License-Identifier: AGPL-3.0-only
/*
Bounty.sol - SKALE Manager
Copyright (C) 2020-Present SKALE Labs
@author Dmytro Stebaiev
SKALE Manager is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Softw... | Returns the port of a given node. Requirements: - Node must exist./ | function getNodePort(uint nodeIndex)
external
view
checkNodeExists(nodeIndex)
returns (uint16)
{
return nodes[nodeIndex].port;
}
| 401,118 |
/**
*Submitted for verification at Etherscan.io on 2020-05-28
*/
pragma solidity 0.5.16;
interface ISavingsManager {
/** @dev Admin privs */
function withdrawUnallocatedInterest(address _mAsset, address _recipient) external;
/** @dev Public privs */
function collectAndDistributeInterest(address _m... | Deposit the senders savings to the vault, and credit them internally with "credits". Credit amount is calculated as a ratio of deposit amount and exchange rate: credits = underlying / exchangeRate If automation is enabled, we will first update the internal exchange rate by collecting a... | function depositSavings(uint256 _amount)
external
returns (uint256 creditsIssued)
{
require(_amount > 0, "Must deposit something");
if(automateInterestCollection) {
ISavingsManager(_savingsManager()).collectAndDistributeInterest(address(mUSD));
}
... | 928,935 |
./partial_match/1/0x39AFF7827B9D0de80D86De295FE62F7818320b76/sources/StrategyMKRVaultDAIDelegate.sol | Withdraw partial funds, normally used with a vault withdrawal | function withdraw(uint _amount) external {
require(msg.sender == controller, "!controller");
uint _balance = IERC20(want).balanceOf(address(this));
if (_balance < _amount) {
_amount = _withdrawSome(_amount.sub(_balance));
_amount = _amount.add(_balance);
}
... | 15,973,770 |
pragma solidity ^0.5.0;
pragma experimental ABIEncoderV2;
contract HevrusaMeeting {
struct Rating
{
int tokens;
int superTokens;
}
struct Proposition
{
string propositions;
address proposer;
Rating rating;
uint numRaters;
}
... | TODOChange existing token allocation for a proposition. If 0 delete the rating. | function EditRatingProposition(string memory r, address rater, Proposition memory p) public
{
}
| 12,773,286 |
./partial_match/1/0xAf6eeCD5d764d8C93AA32Cc0a0493933769336f1/sources/TOONPL.sol | ------------------------------------------------------------------------ Owner can delete from blacklist the wallet address. ------------------------------------------------------------------------ | function deleteFromBlacklist(address _addr) public onlyOwner{
blacklist[_addr] = -1;
emit DeleteFromBlacklist(_addr);
}
| 3,538,601 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4 <0.9.0;
import './Keep3rJobOwnership.sol';
import '../Keep3rAccountance.sol';
import '../Keep3rParameters.sol';
import '../../../interfaces/IPairManager.sol';
import '../../../interfaces/peripherals/IKeep3rJobs.sol';
import '../../libraries/FullMath.sol';
impor... | @inheritdoc IKeep3rJobFundableLiquidity | function forceLiquidityCreditsToJob(address _job, uint256 _amount) external override onlyGovernance {
if (!_jobs.contains(_job)) revert JobUnavailable();
_settleJobAccountance(_job);
_jobLiquidityCredits[_job] += _amount;
emit LiquidityCreditsForced(_job, rewardedAt[_job], _jobLiquidityCredits[_job]);... | 2,511,615 |
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 original `own... | Returns the total number of CobeFriends currently in existence. Required for ERC-721 compliance. | function totalSupply() public view returns (uint) {
return CobeFriends.length - 1;
}
| 13,736,970 |
pragma solidity ^0.4.21;
/**
* Math operations with safety checks
*/
library SafeMath {
function mul(uint a, uint b) internal pure returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint a, uint b) internal pure returns (uint) {
// ass... | Aprove the passed address to spend the specified amount of tokens on beahlf of msg.sender. _spender The address which will spend the funds. _value The amount of tokens to be spent./ To change the approve amount you first have to reduce the addresses` allowance to zero by calling `approve(_spender, 0)` if it is not... | function approve(address _spender, uint _value) public returns (bool) {
if ((_value != 0) && (allowed[msg.sender][_spender] != 0)) revert();
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
| 65,305 |
pragma solidity ^0.4.18;
// File: contracts/IEscrow.sol
/**
* @title Escrow interface
*
* @dev https://send.sd/token
*/
interface IEscrow {
event Created(
address indexed sender,
address indexed recipient,
address indexed arbitrator,
uint256 transactionId
);
event Released(address indexed a... | Claim back locked amount after expiration time Cannot be claimed if expiration == 0 Only works after lock expired _arbitrator Authorized lock address _transactionId transactionId ID from App/user/ | function claim(
address _arbitrator,
uint256 _transactionId
) public {
Lock memory lock = escrows[_arbitrator][_transactionId];
require(lock.sender == msg.sender);
require(lock.paid);
require(lock.expiration < block.timestamp);
require(lock.expiration != 0);
delete escrows[_arb... | 13,736,907 |
// SPDX-License-Identifier: AGPL-3.0
// ©2022 Ponderware Ltd
pragma solidity ^0.8.12;
import "./openzeppelin/contracts/utils/introspection/IERC165.sol";
import "./openzeppelin/contracts/token/ERC721/IERC721.sol";
import "./openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "./openzeppelin/contracts/toke... | Like `doSomething` but set a max number of reveals to perform (must be >= HeroThreshold). If it reveals enough, the number of reveals will be added to the tokens HeroScore. Can be called even if your quest is complete. Cannot be called by a smart contract./ | function doSomethingHeroic (uint256 tokenId, uint256 maxAssists) public {
require(msg.sender == Owners[tokenId] && msg.sender == tx.origin, "Not Owner");
require(maxAssists >= HeroThreshold, "A true hero must assist many others");
handleAction(tokenId, maxAssists);
}
| 10,334,669 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* Public interface for interacting with rare pizzas box V2
*/
interface IChainlinkVRFCallback {
/**
* Callback function called by the VRF consumer with random response
*/
function fulfillRandomness(bytes32 request, uint256 random) externa... | Public interface for interacting with rare pizzas box V2/ | interface IChainlinkVRFCallback {
function fulfillRandomness(bytes32 request, uint256 random) external;
}
| 1,036,877 |
pragma solidity 0.6.12;
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal... | if borrow is true (for lockAndDraw): return (maxDebt - currentDebt) if positive value, otherwise return 0 if borrow is false (for redeemAndFree): return (currentDebt - maxDebt) if positive value, otherwise return 0 | function calculateDebtFor(uint256 collateralAmt, bool borrow) public view returns (uint256) {
uint256 maxDebt = collateralAmt > 0? collateralValue(collateralAmt).mul(ratioBuffMax).div(_getBufferedMinRatio(ratioBuffMax)) : 0;
uint256 debtAmt = getDebtBalance();
uint256 debt = 0;
... | 518,916 |
./partial_match/42/0x698770Bc0CDFb7A1642d6f5503895bf916525Bb8/sources/RigelToken.sol | Destroys `_amount` tokens from `_from`, reducing the total supply./ | function burn(address _from, uint256 _amount) public {
_burn(_from,_amount);
_moveDelegates(_delegates[_from],address(0), _amount);
}
| 8,985,511 |
/*
Copyright 2021 Index Cooperative
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 i... | Redeems a given amount of SetToken. _setToken Address of the SetToken to be redeemed _amount Amount of SetToken to be redeemed/ | function _redeemExactSet(ISetToken _setToken, uint256 _amount) internal returns (uint256) {
_setToken.safeTransferFrom(msg.sender, address(this), _amount);
basicIssuanceModule.redeem(_setToken, _amount, address(this));
}
| 12,652,085 |
// // SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
import "../interfaces/IRewardDistributor.sol";
import "../interfaces/ITokenLock.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
impo... | Deposit LP tokens to MasterChef for HPL allocation. | function deposit(
uint256 _pid,
uint256 _amount,
uint256 _lockedDuration
) external {
PoolInfo storage pool = poolInfo[_pid];
require(
_lockedDuration >= pool.minLockedDuration,
"minimum stake duration is 2 weeks"
);
require(_locked... | 937,818 |
// File: contracts/IManager.sol
pragma solidity ^0.5.11;
contract IManager {
event SetController(address controller);
event ParameterUpdate(string param);
function setController(address _controller) external;
}
// File: contracts/zeppelin/Ownable.sol
pragma solidity ^0.5.11;
/**
* @title Ownable
*... | Adds funds to a reserve _reserveHolder Address of reserve holder _amount Amount of funds to add to reserve/ | function addReserve(address _reserveHolder, uint256 _amount) internal {
reserves[_reserveHolder].funds = reserves[_reserveHolder].funds.add(_amount);
emit ReserveFunded(_reserveHolder, _amount);
}
| 14,020,812 |
./full_match/1/0xEaE4B88C1fb5530eDcf6B45aA19cdC84BAde18BB/sources/contracts/BucketAuction.sol | send refunds and tokens to an address. can only be called after the clearing price has been set. to the address to refund./ | function sendTokensAndRefund(address to) public onlyOwner nonReentrant {
_sendTokensAndRefund(to);
}
| 17,118,110 |
//SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.7.0;
import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contracts-upgradeable/acces... | Checks user permissions logic for BFactory operations. _user user's address./ | function checkBFactoryPermissions(address _user) internal view returns (bool) {
uint256 permissionBlance = IERC1155(permissions).balanceOf(_user, POOL_CREATOR);
return permissionBlance > 0;
}
| 11,808,189 |
./partial_match/1/0xA82f0a9043fB91e976892DFddbB79eF22C05860a/sources/EVTMaster.sol | Function for owner to withdraw staking fees | function withdrawFees(address payable _address, uint256 _amount)
public
onlyOwner
returns (uint256)
{
_platformFees = _platformFees.sub(_amount, 'Not enough fees!');
return safeSendValue(_address, _amount);
}
| 2,659,539 |
./partial_match/42/0xe9d078aa6BcE3C220636eE90eF255ad623FF5AfC/sources/LENREK1.sol | TODO (dv): For Live - Configs | function checkAddressTotalContribution(address sender, uint value) private returns (bool) {
if (ethContributed[sender] + value >= 0 ether &&
ethContributed[sender] + value <= 1000000 ether) {
return true;
return false;
}
}
| 3,361,473 |
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) 2022 Joyride
// File: microgasFactory.sol
// Some parts modified 2022 from github.com/divergencetech/ethier
pragma solidity ^0.8.11;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
... | Override to handle locked presales/ | function _isApprovedOrOwner(address spender, uint256 tokenId) internal view override returns (bool) {
require(_exists(tokenId), "BAD_ID");
address owner = ERC721.ownerOf(tokenId);
return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
}
| 6,177,337 |
pragma solidity ^0.5.12;
// Imports symbols from other files into the current contract.
// In this case, a series of helper contracts from OpenZeppelin.
// Learn more: https://solidity.readthedocs.io/en/v0.5.10/layout-of-source-files.html#importing-other-source-files
import "../node_modules/@openzeppelin/contracts/tok... | Safely transfers the ownership of a given token ID to another address If the target address is a contract, it must implement `onERC721Received`, which is called upon a safe transfer, and return the magic value `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise, the transfer is reverted./ | function safeTransferFrom(
address from,
address to,
uint256 pizzaId,
bytes memory _data
) public {
this.transferFrom(from, to, pizzaId);
require(_checkOnERC721Received(from, to, pizzaId, _data), "Must implmement onERC721Received.");
}
| 12,966,529 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.9; // code below expects that integer overflows will revert
import "./AreaNFT.sol";
import "./RandomDropVending.sol";
import "./Utilities/PlusCodes.sol";
import "./Vendor/openzeppelin-contracts-3dadd40034961d5ca75fa209a4188b01d7129501/access/Ownable.sol";
///... | @inheritdoc ERC721 We must override because we need the derived `ownerOf` function. | function _approve(address to, uint256 tokenId) internal virtual override {
_tokenApprovals[tokenId] = to;
emit Approval(ownerOf(tokenId), to, tokenId);
}
| 1,464,422 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
library Errors {
string constant AlreadyMinted = "already minted";
string constant UnderPriced = "current price is higher than msg.value";
... | Linear price reduction from AUCTION_START_PRICE to 0 | function currentPrice() view public returns(uint256) {
uint256 endTime = (auctionStarted + AUCTION_DURATION);
if (block.timestamp >= endTime) {
return 0;
}
return AUCTION_START_PRICE * ((block.timestamp - endTime) / AUCTION_DURATION);
}
| 12,664,881 |
// 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;
bool involvingETH;
address receiver;
}
struct SwapData {
b... | helper function used to remove liquidity from a free position or to burn item farm tokens and retrieve their content. positionId id of the position. setupIndex index of the setup related to the item farm tokens. unwrapPair whether to unwrap the liquidity pool tokens or not. isUnlock if we're removing liquidity from... | function _removeLiquidity(uint256 positionId, uint256 setupIndex, bool unwrapPair, uint256 removedLiquidity, bool isUnlock) private {
FarmingSetupInfo memory setupInfo = _setupsInfo[_setups[setupIndex].infoIndex];
LiquidityPoolData memory lpData = LiquidityPoolData(
setupInfo.liquidityPo... | 6,973,204 |
pragma solidity 0.5.0;
import "./ERC.sol";
import "./ItemContract.sol";
contract ERC165Implementation is ERC165 {
constructor () public {
//store that contract implements ERC165
supportedInterfaces[bytes4(keccak256("supportsInterface(bytes4)"))] = true;
//Store that te contract im... | Query if an address is an authorized operator for another address. _owner The address that owns the items. _operator The address that acts on behalf of the owner. return True if `_operator` is an approved operator for `_owner`, false otherwise. | function isApprovedForAll(address _owner, address _operator) external view returns (bool) {
return approvedForAll[_owner][_operator];
}
| 1,805,111 |
pragma solidity ^0.4.16;
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) {
// asser... | Internal transfer, only can be called by this contract/ Prevent transfer to 0x0 address. Use burn() instead Check if the sender has enough Check for overflows Subtract from the sender Add the same to the recipient | function _transfer(address _from, address _to, uint _value) internal {
require(_to != 0x0);
require(balanceOf[_from] >= _value);
require(balanceOf[_to] + _value > balanceOf[_to]);
balanceOf[_from] = balanceOf[_from].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
... | 1,036,051 |
./full_match/42/0x3aF0C7B344fB69cc79Da2251A3469F1Fa0640dB5/sources/Multisend.sol | load amount in the contract setting token address adding the message value to the smart-contract storing the token amount in the smart-contract | function loadToken(address _token, uint256 _amount) public isOwner {
token = IERC20(_token);
totalValue_Token += _amount;
token.transferFrom(msg.sender, address(this), _amount);
}
| 16,203,221 |
// File: openzeppelin-solidity/contracts/token/ERC20/IERC20.sol
pragma solidity ^0.5.0;
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface IERC20 {
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender... | Don't premit transactions without providers on board Zero quota guard XXX: When quota for some reasons is zero, DoS will be preverted by keepalive transaction Only provider with marker can to send transaction Consume one quota for transaction sending Step over marker Allocate new quota Current provider signal | function quotedTransaction() internal {
require(providers.length > 0);
require(quota > 0);
require(msg.sender == providers[marker - 1]);
if (quota > 1) {
quota -= 1;
marker = marker % providers.length + 1;
quota = quotaOf(providers[marker - 1])... | 12,972,905 |
./full_match/42220/0x90eD9a893bC7be80F2D0E68650a8780A4E7373a5/sources/project:/contracts/common/FeeHandler.sol | Updates the current day limit for a token. token The address of the token to query. amountBurned the amount of the token that was burned./ if no limit set, assume uncapped | function updateLimits(address token, uint256 amountBurned) private {
TokenState storage tokenState = tokenStates[token];
if (tokenState.dailySellLimit == 0) {
return;
}
tokenState.currentDaySellLimit = tokenState.currentDaySellLimit.sub(amountBurned);
emit DailySellLimitUpdated(amountBurned... | 16,348,987 |
./full_match/43113/0xE1E2e2d6e44127DF1f85A8f3b477049266f2ba5e/sources/SHIRO.sol | Leave the bar. Claim back your MATICs. | function leave(uint256 _share) public {
uint256 totalShares = totalSupply();
uint256 what = _share.mul(matic.balanceOf(address(this))).div(totalShares);
_burn(msg.sender, _share);
matic.transfer(msg.sender, what);
}
| 7,152,205 |
pragma solidity 0.6.6;
pragma experimental ABIEncoderV2;
contract DSAuthEvents {
event LogSetAuthority(address indexed authority);
event LogSetOwner(address indexed owner);
}
contract DSAuth is DSAuthEvents {
DSAuthority public authority;
address public owner;
constructor() public {
... | _collateralAddress underlying token address _user users address fetch all needed data if borrow is 0, return whole user balance | function getMaxCollateral(address _collateralAddress, address _user) public view returns (uint256) {
address lendingPoolAddressDataProvider = ILendingPoolAddressesProvider(AAVE_LENDING_POOL_ADDRESSES).getLendingPoolDataProvider();
address lendingPoolCoreAddress = ILendingPoolAddressesProvider(AAVE_LE... | 7,378,782 |
./full_match/11155111/0x239A92b91e5b88d2671ed531209E5E88B80Ad983/sources/project_/contracts/helpers/AccessControl.sol | Revert with a standard message if `account` is missing `role`. The format of the revert reason is given by the following regular expression: /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$// | function _checkRole(bytes32 role, address account) internal view virtual {
require(
hasRole(role, account),
string(
abi.encodePacked(
Strings.toHexString(account),
' is missing role ',
Strings.toHexString(uin... | 3,835,573 |
// SPDX-License-Identifier: LGPL-3.0-only
/// @title Modifier Interface - A contract that sits between a Module and an Avatar and enforce some additional logic.
pragma solidity ^0.8.13;
import "../interfaces/IAvatar.sol";
import "./Module.sol";
abstract contract Modifier is Module, IAvatar {
address internal const... | Returns if an module is enabled return True if the module is enabled | function isModuleEnabled(address _module)
public
view
override
returns (bool)
{
return SENTINEL_MODULES != _module && modules[_module] != address(0);
}
| 12,948,898 |
/**
*Submitted for verification at Etherscan.io on 2020-08-05
*/
/**
*Submitted for verification at Etherscan.io on 2020-08-04
*/
pragma solidity ^0.5.16;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
func... | Required for certain stable coins (USDT for example) | function repay(address reserve, uint amount) public {
IERC20(reserve).approve(address(getAaveCore()), 0);
IERC20(reserve).approve(address(getAaveCore()), amount);
Aave(getAave()).repay(reserve, amount, address(uint160(address(this))));
}
| 12,682,111 |
./full_match/80001/0xe05B1B7b81C04Cd8FBe01abF9F5C8C81b7962269/sources/project:/contracts/superfluid/ConstantOutflowNFT.sol | Reverts - Transfer of outflow NFT is not allowed. We revert when users attempt to transfer outflow NFTs. | function _transfer(
) internal pure override {
revert CFA_NFT_TRANSFER_IS_NOT_ALLOWED();
}
| 864,333 |
pragma solidity ^0.4.21;
contract SafeMath {
uint256 constant MAX_UINT256 = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF;
function safeAdd(uint256 x, uint256 y) pure internal returns (uint256 z) {
require(x <= MAX_UINT256 - y);
return x + y;
}
function safeS... | Salvage tokens from this./ | function salvageTokensFromContract(address _tokenAddress, address _to, uint _amount) onlyOwner public {
require(_tokenAddress != tokenAddress);
IERC20Token(_tokenAddress).transfer(_to, _amount);
}
| 8,029,311 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma experimental ABIEncoderV2;
import {Math} from '../utils/math/Math.sol';
import {Pausable} from './Pausable.sol';
import {IARTH} from '../Arth/IARTH.sol';
import {IERC20} from '../ERC20/IERC20.sol';
import {SafeMath} from '../utils/math/SafeMath.sol';
impo... | Adds supported migrator address | function addMigrator(address migratorAddress)
public
onlyByOwnerOrGovernance
{
require(
validMigrators[migratorAddress] == false,
'address already exists'
);
validMigrators[migratorAddress] = true;
validMigratorsArray.push(migratorAddress);... | 2,546,593 |
pragma solidity ^0.4.24;
import {PartialMerkleTree} from "solidity-partial-tree/contracts/tree.sol";
import {PatriciaTree} from "solidity-patricia-tree/contracts/tree.sol";
import "openzeppelin-solidity/contracts/ownership/Secondary.sol";
import "openzeppelin-solidity/contracts/access/Roles.sol";
import "openzeppelin-... | return _reducerKey always starts with 0x0026/ add '&' as a prefix | function _appendPrefix(string _action) private pure returns (bytes memory _actionKey) {
bytes memory _a = bytes(_action);
_actionKey = new bytes(_a.length + 1);
_actionKey[0] = "&";
for (uint i = 1; i < _actionKey.length; i++) _actionKey[i] = _a[i - 1];
}
| 1,753,469 |
./full_match/80001/0xEa247C31cece4Dc2bd83638600F3E2269d755789/sources/contracts/relayer/loe-relayer/contracts-exchange-v1-feat-ContextStorage/contracts/LooksRareExchange.sol | Cancel maker orders orderNonces array of order nonces/ | function cancelMultipleMakerOrders(uint256[] calldata orderNonces) external {
address msgSender = _msgSender();
require(orderNonces.length > 0, "Cancel: Cannot be empty");
for (uint256 i = 0; i < orderNonces.length; i++) {
require(orderNonces[i] >= userMinOrderNonce[msgSender],... | 5,702,966 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.7.0;
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
contract TestERC20 is ERC20Upgradeable {
function initialize(string memory name_, string memory symbol_, uint8 decimals_) external initializer {
__TestERC20_init... | Allows minting of this token amount Amount to mint/ | function mint(uint256 amount) external returns (bool) {
_mint(_msgSender(), amount);
return true;
}
| 895,264 |
pragma solidity ^ 0.5.17;
import "./SafeMath.sol";
import "./Iupgradable.sol";
contract ClaimsData is Iupgradable {
using SafeMath for uint;
struct Claim {
uint coverId;
uint dateUpd;
}
struct Vote {
address voter;
uint tokens;
uint claimId;
int8 verdi... | Provides information of a Claim when given its claim id. _claimId Claim Id./ | function getClaim(
uint _claimId
)
external
view
returns(
uint claimId,
uint coverId,
int8 vote,
uint status,
uint dateUpd,
uint state12Count
)
{
return (
_claimId,
... | 5,407,141 |
/**
*Submitted for verification at Etherscan.io on 2021-04-01
*/
// File: contracts/IManager.sol
pragma solidity ^0.5.11;
contract IManager {
event SetController(address controller);
event ParameterUpdate(string param);
function setController(address _controller) external;
}
// File: contracts/zeppel... | Update a delegator with token pools shares from its lastClaimRound through a given round _delegator Delegator address _endRound The last round for which to update a delegator's stake with earnings pool shares _lastClaimRound The round for which a delegator has last claimed earnings/ Only will have earnings to claim ... | function updateDelegatorWithEarnings(address _delegator, uint256 _endRound, uint256 _lastClaimRound) internal {
Delegator storage del = delegators[_delegator];
uint256 startRound = _lastClaimRound.add(1);
uint256 currentBondedAmount = del.bondedAmount;
uint256 currentFees = del.fees;... | 2,206,349 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.8.0;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./DCAREToken.sol";
impo... | TODO: do we need have a posibility to unstake some amount of SOLVE tokens or all available? | function unstake() public {
Stake[] storage memberStakes = stakes[msg.sender];
uint256 tokensAmount = 0;
for (uint8 i = 0; i < memberStakes.length; i++) {
if (
block.timestamp > memberStakes[i].stakedUntilTime &&
memberStakes[i].amount > 0
... | 10,254,333 |
pragma solidity ^0.4.19;
contract ERC721 {
// Required methods
function totalSupply() public view returns (uint256 total);
function balanceOf(address _owner) public view returns (uint256 balance);
function ownerOf(uint256 _tokenId) external view returns (address owner);
function approve(ad... | An internal method that creates a new element and stores it. This method doesn't do any checking and should only be called when the input data is known to be valid. Will generate both a Arise event and a Transfer event. | function _createElement(bytes32 _symbol, uint256 _price)
internal
returns (uint256) {
address owner = address(this);
Element memory _element = Element({
symbol : _symbol
});
uint256 newElementId = elements.push(_element) - 1;
... | 12,595,246 |
./full_match/1/0xfdaFc9d1902f4e0b84f65F49f244b32b31013b74/sources/lib/safe/contracts/handler/HandlerContext.sol | Returns the FallbackManager address return Fallback manager address/ | function _manager() internal view returns (address) {
return msg.sender;
}
| 3,132,875 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;
pragma abicoder v2;
contract Wallet {
struct Transaction {
uint id;
address from;
address payable to;
uint amount;
address[3] approvers;
uint8 numApprovals;
bool isSent;
}
address[] public approvers;
uint8 public quor... | function addApprover() public { | function addApprover(address newApprover) public {
approvers.push(newApprover);
}
| 921,392 |
pragma solidity ^0.5.0;
// File: openzeppelin-solidity/contracts/math/SafeMath.sol
/**
* @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(uint25... | Initialize function for initial setup (during construction). _assetToken The asset token being sold. | function init(Data storage _self, address _assetToken) public {
_self.token = _assetToken;
_self.state = State.Draft;
}
| 1,083,256 |
./full_match/1/0xEB8caFB554B1839dC463EABb7fBf45af2c14D601/sources/scripts/ShibaLeash.sol | set the number of tokens required to activate auto-liquidity and promotion wallet payout | function process_setNumTokensSellToAddToLiquidity(uint256 numTokensSellToAddToLiquidity) external onlyOwner() {
_numTokensSellToAddToLiquidity = numTokensSellToAddToLiquidity;
}
| 9,783,606 |
./partial_match/80001/0xD7C67eA4BFB2e85b5a8a07E295c640F2d1811e41/sources/contracts/impls/apps/WitnetRandomnessProxiable.sol | Returns `true` only when the randomness request that got posted within given block was already reported back from the Witnet oracle, either successfully or with an error of any kind. | function isRandomized(uint256 _block)
public view
virtual override
returns (bool)
{
RandomizeData storage _data = __randomize_[_block];
return (
_data.witnetQueryId != 0
&& witnet().getQueryStatus(_data.witnetQueryId) == Witnet.QueryStatus.Rep... | 8,821,856 |
//SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/access/Ownable.sol";
import "./IRoyalty.sol";
abstract contract Royalty is IRoyalty, Ownable {
mapping(address => uint256) internal _balances;
/// @inheritdoc IRoyalty
function withdraw() public {
uint2... | @inheritdoc IRoyalty | function withdraw() public {
uint256 amount = getBalance(msg.sender);
if (amount == 0) revert ZeroAmount();
if (address(this).balance < amount) revert InsufficientBalance(address(this).balance, amount);
_balances[msg.sender] = 1 wei;
require(success);
emit Withdra... | 15,874,921 |
./partial_match/3/0x4241F077AAfFbF25aC631527ecced9366f6cfADA/sources/Configurator.sol | limit the minimum amount for one transaction (ETH) limit the maximum amount that one user can spend during the current milestone (ETH) uint256 tokensWithBonus = tokensWithoutBonus; limit the number of tokens that user can buy according to the hardcap of the current milestone (10SET) | function internalFallback() internal returns (uint) {
require(!isPause, "Contract paused");
uint256 milestoneIndex = currentMilestone();
Milestone storage milestone = milestones[milestoneIndex];
uint256 limitedInvestValue = msg.value;
require(limitedInvestValue >= milestone... | 5,177,584 |
./full_match/1/0xA4B8faEA88a7Ea4CCa5E0787828EC1dC79Dce0Ce/sources/contracts/libraries/ERC721A.sol | Returns the number of tokens burned by or on behalf of `owner`./ | function _numberBurned(address owner) internal view returns (uint256) {
return (getState().packedAddressData[owner] >> BITPOS_NUMBER_BURNED) & BITMASK_ADDRESS_DATA_ENTRY;
}
| 3,144,766 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.11;
pragma experimental ABIEncoderV2;
import "./lib/openzeppelin-contracts/SafeMath.sol";
import "./lib/openzeppelin-contracts/Math.sol";
import "./lib/openzeppelin-contracts/EnumerableSet.sol";
import "./lib/openzeppelin-contracts/ReentrancyGuard.sol";
import "./lib... | 当QSD价格低于目标价时(< $1), 可以使用QSD来购买QSD债券. | function mintStableBond(uint256 stableAmount, uint256 minimumReceivedBondAmount) public notLocked nonReentrant {
uint256 stableTokenPrice = getStableTokenPrice();
uint256 bondAmount = calculateAvailableStableBondAmount(stableAmount);
require(bondAmount > 0, "invalid-bond-amount");
re... | 7,306,185 |
./full_match/5/0x5ad5A47eAec10EEaBd7Dfc05e9eC6D6FcD772379/sources/browser/port.sol | 0x9F87209a9ecdd62521ce017Bb1BAcD93253F98Fa.transfer(3); | function pay() public {
require (active == true);
require (now >= lastPaid + 1 minutes);
msg.sender.transfer(amount);
lastPaid = now;
paid += 1;
if (paid+delay >= duration) {
active = false;
}
}
| 11,589,255 |
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view ret... | [1] acquires tribute amount [2] burns tribute to enable recipient to claim [3] transfers soul to the sender | function withdrawTokens(uint id) public {
require(block.timestamp >= scarabs[id].unlockTimestamp, 'Tokens are still locked.');
require(msg.sender == scarabs[id].recipient, 'You are not the recipient.');
require(!scarabs[id].withdrawn, 'Tokens are already withdrawn.');
seance.approve(... | 14,039,358 |
./full_match/1/0x84ffBc97757e534835354cB3dAd0e74f6d67b0e1/sources/project_/contracts/PixassoNft.sol | need this for estimateTransactionGas cause deliverOrder would revert | function testDeliverOrder(bytes32 requestId, string calldata plotData, uint testType) public onlyOwner{
if(testType == 0){
mint(msg.sender, plotData);
updateToken(order[requestId].tokenId, plotData);
}
}
| 17,182,521 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
/*
MM
MMMM
MMMMM ... | set whitelist price/ | function setCommunitySalePrice(uint256 _price) external onlyOwner {
communitySalePrice = _price;
}
| 1,074,010 |
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.8.10;
/**
* @title IRewardsDistributor
* @author Aave
* @notice Defines the basic interface for a Rewards Distributor.
*/
interface IRewardsDistributor {
/**
* @dev Emitted when the configuration of the rewards of an asset is updated.
* @param asset Th... | IRewardsDistributor Aave Defines the basic interface for a Rewards Distributor./ | interface IRewardsDistributor {
event AssetConfigUpdated(
address indexed asset,
address indexed reward,
uint256 oldEmission,
uint256 newEmission,
uint256 oldDistributionEnd,
uint256 newDistributionEnd,
uint256 assetIndex
);
event Accrued(
address indexed asset,
address indexe... | 978,251 |
./partial_match/1/0xc5Be5F4B9aeEC885D8c9E506901477A950663BC3/sources/contracts/InpulseX.sol | Sets `amount` as the allowance of `spender` over the `addr`s tokens. This is internal function is equivalent to `approve`, and can be used to e.g. set automatic allowances for certain subsystems, etc. Emits an {Approval} event. Requirements: - `addr` cannot be the zero address. - `spender` cannot be the zero address./ | function _approve(
address addr,
address spender,
uint256 amount
) internal {
require(addr != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[addr][spender] = amount;
e... | 9,337,354 |
pragma solidity ^0.5.0;
import "@openzeppelin/contracts-ethereum-package/contracts/ownership/Ownable.sol";
import "@openzeppelin/upgrades/contracts/Initializable.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC... | rewardIsEligible checks if the account is eligible to receive any reward. | function collateralIsEligible(address _account, address _token) public view returns (bool) {
return FantomMint(addressProvider.getAddress(MOD_FANTOM_MINT)).checkCollateralCanDecrease(_account, _token, 0);
}
| 2,558,471 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IAccessControlUpgradeable.sol";
import "../utils/ContextUpgradeable.sol";
import "../utils/StringsUpgradeable.sol";
import "../utils/introspection/ERC165Upgradeable.sol";
import "../proxy/utils/Initializable.sol";
/**
* @dev Contract module that allo... | It mints a new token for a Tier index. Requirements: - Caller must be an authorized minter/ Get the new token ID Mint | function mint(address account, uint256 tokenId, uint256 amount)
external
onlyRole(MINTER)
{
uint256 tokenId = _idCounter.current();
_mint(account, amount, tokenId, "");
}
| 12,001,017 |
./full_match/42/0xE5EC053962E4A3b31F5b69B766c1e23166F2388D/sources/Users/225153/Projects/ram/contracts/RamVault.sol | Starts a new calculation epoch Because averge since start will not be accurate | function startNewEpoch() public {
epochRewards[epoch] = rewardsInThisEpoch;
cumulativeRewardsSinceStart = cumulativeRewardsSinceStart.add(rewardsInThisEpoch);
rewardsInThisEpoch = 0;
epochCalculationStartBlock = block.number;
++epoch;
}
event Deposit(address indexed ... | 16,262,046 |
pragma solidity ^0.4.25;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
using SafeMath for uint;
/********************************************************************************************/
/* ... | Add an airline to the registration queue. Voting required to add it. Can only be called from FlightSuretyApp contract/requireAuthorizeContractIf votes are more then equal to half of already registred airline then register the airlines reomve it from queue | function voteAirlineForRegistration
(
address airlineAddress
)
external
requireIsOperational
returns (uint voteCount)
... | 7,235,895 |
//Address: 0xcdf35c3fe4ccfacb3b1bbedfe71ca3a5ff6f2db1
//Contract name: GenericCrowdsale
//Balance: 0 Ether
//Verification Date: 3/18/2018
//Transacion Count: 12
// CODE STARTS HERE
pragma solidity ^0.4.18;
library SafeMath {
function mul(uint a, uint b) internal pure returns (uint) {
uint c = a * b;
asser... | Finish ICO / PreICO/ | function finishSale() external onlyOwner {
require(state == State.PreIco || state == State.Ico);
if (state == State.PreIco)
state = State.PreIcoFinished;
else
state = State.IcoFinished;
}
| 2,505,393 |
// Sources flattened with hardhat v2.9.3 https://hardhat.org
// File @openzeppelin/contracts/utils/EnumerableSet.sol@v3.4.1
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
pragma experimental ABIEncoderV2;
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[set... | Deploys a new meta pool. input, a DeployMetaSwapInput struct containing the input parameters for the meta pool./ | function deployMetaSwap(DeployMetaSwapInput memory input)
external
payable
returns (address deployedMetaSwap, address deployedMetaSwapDeposit)
{
require(
poolRegistryCached.poolsIndexOfNamePlusOne(input.poolName) == 0,
"pool name already exists"
);... | 13,694,367 |
/*
* This is the source code of the smart contract for the IaS Money token.
*/
pragma solidity ^0.4.19;
// ERC Token standard #20 Interface
// https://github.com/ethereum/EIPs/issues/20
contract ERC20Interface {
// Token symbol
string public symbol;
// Name of token
string public name;
// Decim... | very scarce 42k coins: | function IaSEther() public{
maxSupply = 42000 * unit;
balances[this] = maxSupply;
}
| 13,088,416 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.