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
pragma solidity ^0.8.7;
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "@openzeppelin/cont... | Claim Rewards User who harvest can claim their rewards in MPWR for 1 year/ | function claimReward() external whenNotPaused nonReentrant {
UserInfo storage uInfo = userInfo[_msgSender()];
require(uInfo.isDone, "You are not eligible to claim this rewards!");
require(uInfo.endTime > uInfo.lastClaimedTime, "You already claimed!");
uint256 endTime = block.timest... | 14,785,000 |
./full_match/1/0x977D360c3FbE1533eFEde3619dC74Ad0950FFc4f/sources/contracts/BondSwap/Exchange/BondsMarketplace.sol | Check whether user order nonce is executed or cancelled user address of user orderNonce nonce of the order/ | function isUserOrderNonceExecutedOrCancelled(address user, uint256 orderNonce) external view returns (bool) {
return _isUserOrderNonceExecutedOrCancelled[user][orderNonce];
}
| 16,426,676 |
./partial_match/1/0x5cD48e98bd39b3C3E1586687B3eA7F54D9e465a9/sources/ERC20Token.sol | Interface of the ERC20 standard as defined in the EIP./ | interface IERC20 {
function balanceOf(address account) external view returns (uint256);
function totalSupply() external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256... | 3,901,955 |
pragma solidity ^0.4.0;
/**
* @title Multi Sender, support ETH and ERC20 Tokens
* @dev To Use this Dapp: http://multisender.phizhub.com
*/
library SafeMath {
function mul(uint a, uint b) internal pure returns (uint) {
uint c = a * b;
require(a == 0 || c / a == b);
return c;
}
function div(uint a... | set receiver address/ | function setReceiverAddress(address _addr) onlyOwner public {
require(_addr != address(0));
receiverAddress = _addr;
}
| 65,367 |
pragma solidity ^0.4.18;
import "../ownership/Ownable.sol";
import "../math/SafeMath.sol";
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
using SafeMath for uint256;
event Pause();
event Unpause();
bool... | called by the owner to pause, triggers stopped state/ | function pause() onlyOwner whenNotPaused public {
require(msg.sender != address(0));
paused = true;
emit Pause();
}
| 2,555,008 |
/**
Chip
*/
pragma solidity ^0.8.9;
// SPDX-License-Identifier: Unlicensed
interface IERC20 {
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
... | SPDX-License-Identifier: Unlicensed | interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint... | 10,228,169 |
./full_match/9001/0xb31c8f06F99Be1285Cb1998949F47E1988f38b23/sources/src/token/ERC721/facets/minting/ERC721MintableOwnable.sol | @inheritdoc IERC721MintableOwnable/ | function mintByOwner(address[] calldata tos, uint256[] calldata amounts) public virtual onlyOwner {
IERC721MintableExtension(address(this)).mintByFacet(tos, amounts);
}
| 11,533,999 |
./full_match/42220/0x63aFE99b010208EE07673C0CF31Cc4026eD90FF7/sources/contracts/UniswapLiquiditySwapAdapter.sol | Swaps an exact `amountToSwap` of an asset to another assetToSwapFromPrice Origin asset to get price assetToSwapToPrice Destination asset to get pricce assetToSwapFrom Origin asset assetToSwapTo Destination asset amountToSwap Exact amount of `assetToSwapFrom` to be swapped minAmountOut the min amount of `assetToSw... | function _swapExactTokensForTokens(
address assetToSwapFromPrice,
address assetToSwapToPrice,
address assetToSwapFrom,
address assetToSwapTo,
uint256 amountToSwap,
uint256 minAmountOut,
bool useEthPath
) internal returns (uint256) {
uint256 fromAssetDecimals = _getDecimals(assetToSwa... | 16,315,829 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
import "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import ... | The maximum flash loan amount - 90% of available funds/ if the token address is zero then get the FTM balance other wise get the token balance of the given token address | function maxFlashLoan(address tokenAddress)
external
view
override
returns (uint256)
{
return
tokenAddress == address(0)
? address(this).balance
: IERC20(tokenAddress).balanceOf(address(this));
}
| 888,468 |
pragma solidity ^0.4.24;
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also test... | get the wallet address for the deposit address _deposit the deposit address _ind the wallet index in the list/ | function wallet(address _deposit, uint256 _ind) public view returns (address) {
require(_deposit != address(0));
WithdrawWallet[] storage withdrawWalletList = depositRepos[_deposit].withdrawWallets;
return withdrawWalletList[_ind].walletAddr;
}
| 13,077,061 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Supply.sol"; //Track Token Supply //This might be an overkill... //TODO: Get rid of this!
import "@openzeppelin/contracts/utils/C... | Make a Request for Service -- Order (Single)/Validate Credit (Spendable Balance)Mark UsedIncrement Order IDNew Order ID[DEV] Double Check that Order Doesn't ExistInit New Order request_uri: request_uri, delivery_uri: '', review_uri: '' | function order(uint256 token_id, string memory request_uri) public {
require(creditOf(msg.sender, token_id) > 0, "INSUFFICIENT_CREDIT");
_used[token_id][msg.sender] += 1;
_orderCount[token_id] += 1;
uint256 order_id = _orderCount[token_id];
require(!existsOrder(token_id, or... | 5,374,050 |
pragma solidity 0.4.25;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "./SafeDecimalMath.sol";
import "./SelfDestructible.sol";
// AggregatorInterface from Chainlink represents a decentralized pricing network for a single currency key
import "chainlink/contracts/interfaces/AggregatorInterface.sol... | Retrieve the rates for a list of currencies/ | function ratesForCurrencies(bytes32[] currencyKeys) external view returns (uint[]) {
uint[] memory _localRates = new uint[](currencyKeys.length);
for (uint i = 0; i < currencyKeys.length; i++) {
_localRates[i] = getRate(currencyKeys[i]);
}
return _localRates;
}
| 914,256 |
/**
*Submitted for verification at Etherscan.io on 2021-08-19
*/
// SPDX-License-Identifier: Apache License, Version 2.0
pragma solidity 0.7.6;
// Part: Address
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
... | See {IERC1155-safeTransferFrom}./ | function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes memory data) external override {
require(to != address(0), "Transfer to must not be null address");
require(amount == 1, "Invalid amount");
require(
from == msg.sender || isApprovedForAll(from, ... | 2,410,905 |
./full_match/43113/0x1371314364F0E998f2E9667dF1a0702DEAA73E66/sources/contracts/ftso/priceProviderMockContracts/PriceProviderMockContracts.sol | Get the active FTSOs for given indices return _ftsos the array of FTSOs/ Invalid index, revert if address is zero address | function getFtsos(uint256[] memory _assetIndices) external view override returns(IFtsoGenesis[] memory _ftsos) {
uint256 ftsoLength = ftsoHistory.length;
uint256 len = _assetIndices.length;
_ftsos = new IFtsoGenesis[](len);
while (len > 0) {
--len;
uint256 ass... | 7,109,262 |
./full_match/1/0x90574634C09a4A4E6e2B7Ce2BbecE1A609751048/sources/browser/CompoundMonitor.sol | Calcualted the ratio of debt / adjusted collateral _user Address of the user For each asset the account is in Sum up collateral in Eth Sum up debt in Eth | function getSafetyRatio(address _user) public view returns (uint) {
address[] memory assets = comp.getAssetsIn(_user);
uint sumCollateral = 0;
uint sumBorrow = 0;
for (uint i = 0; i < assets.length; i++) {
address asset = assets[i];
(, uint cTokenBalance, u... | 2,963,034 |
pragma solidity >=0.4.22 <0.6.0;
//-----------------------------------------------------------------------------
/// @title Ownable
/// @dev The Ownable contract has an owner address, and provides basic
/// authorization control functions, this simplifies the implementation of
/// "user permissions".
//-----... | ------------------------------------------------------------------------- Get the number of colored tokens with color index `_colorIndex` owned by AAC `_uid`. _uid The AAC with deposited color tokens. _colorIndex Index of the colored token to query. return The number of colored tokens with color index `_colorIndex`... | function getColoredTokenBalance(uint _uid, uint _colorIndex)
external
view
returns(uint)
{
return coloredTokens[_colorIndex].balances[_uid];
}
| 13,104,908 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.9;
import '@openzeppelin/contracts/security/PullPayment.sol';
import './Governed.sol';
import './OwnerBalanceContributor.sol';
import './Macabris.sol';
import './Bank.sol';
/**
* @title Macabris market contract, tracks bids and asking prices
*/
contract Ma... | Returns total available balance in all contributing contracts return Balance in wei/ | function getBalance() external view returns (uint) {
uint balance;
balance += release.ownerBalanceDeposits();
balance += bank.ownerBalanceDeposits();
balance += market.ownerBalanceDeposits();
return balance;
}
| 10,435,054 |
./partial_match/42/0x6D81f1929Ccec3B392c370b9D7fF49D00E9Ef6a8/sources/Option.sol | this is the exercise alternative for ppl who want to receive payment currency instead of the underlying assetthe trick is using the uniswap conversion, but if the amount received back (after slippage and uni fees)is not sufficient to cover the total purchase, then the transaction will failfirst we need to swap some amo... | function cashCloseCall(uint _c, bool cashBack) payable public {
require(call.open, "This isnt open");
require(call.expiry >= now, "This call is already expired");
require(call.exercised == false, "This has already been exercised!");
uint assetIn = estAssetIn(call.totalPurch);
... | 3,452,607 |
./full_match/42220/0x77744692A673EF93370E996AeC1DD04d10fed190/sources/contracts/SpecificGroupStrategy.sol | Blocks a group from being added as voted group. group The group address./ | function _blockGroup(address group) private {
if (defaultStrategy.getNumberOfGroups() == 0) {
revert NoActiveGroups();
}
if (blockedGroups.contains(group)) {
revert GroupAlreadyBlocked(group);
}
blockedGroups.add(group);
emit GroupBlocked(gr... | 16,329,121 |
pragma solidity ^ 0.4 .6;
contract Campaign {
address public JohanNygren;
bool campaignOpen;
function Campaign() {
JohanNygren = 0x948176cb42b65d835ee4324914b104b66fb93b52;
campaignOpen = true;
}
modifier onlyJohan {
if (msg.sen... | Public variables of the token / This creates an array with all balances / This generates a public event on the blockchain that will notify clients / Bought or sold / Initializes contract with name, symbol and decimals / | function RES() {
name = "RES";
symbol = "RES";
decimals = 18;
}
| 979,644 |
./full_match/5/0xCf7e38a7d731CF1F6AF870C05A079BcF3c0A93EB/sources/contracts/Contract.sol | Set the deadline timestamp contract and his state. | function setDeadline(uint256 _Deadline) public onlyOwner() {
Deadline = _Deadline;
}
| 1,902,379 |
./full_match/137/0xCc533b8d17d9D289a8A521c1832672aA5d4bA3e2/sources/project_/contracts/RC.sol | the weight of the validator's vote in case of repetition of the address in _validators increases/ reset current voting state | function setValidators(
address[] calldata _validators,
uint256 _voteQuorum
) external {
require(_validators.length <= MAX_VALIDATORS, "too many validators");
require(_validators.length >= _voteQuorum, "bad quorum value");
Insurance memory userInsurance = checkInsurance(m... | 3,749,335 |
./partial_match/9000/0xBd7BAE48164F376c12D8e47152c35d5912A06672/sources/contracts/interface/CLV3Interface.sol | getRoundData and latestRoundData should both raise "No data present" if they do not have data to report, instead of returning unset values which could be misinterpreted as actual reported values. | interface CLV3Interface {
function decimals() external view returns (uint8);
function description() external view returns (string memory);
function version() external view returns (uint256);
function getRoundData(uint80 _roundId)
external
view
returns (
uint80 roun... | 11,342,622 |
pragma solidity ^0.5.16;
contract Initializable {
/**
* @dev Indicates that the contract has been initialized.
*/
bool private initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool private initializing;
/**
* @dev Modifier to... | Contract initializer. _logic Address of the initial implementation. _data Data to send as msg.data to the implementation to initialize the proxied contract. It should include the signature and the parameters of the function to be called, as described in This parameter is optional, if no data is given the initializati... | function initialize(address _logic, bytes memory _data) public payable {
require(_implementation() == address(0));
assert(IMPLEMENTATION_SLOT == bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1));
_setImplementation(_logic);
if(_data.length > 0) {
(bool succ... | 1,984,700 |
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.8.0;
// Sources flattened with hardhat v2.8.4 https://hardhat.org
// File @openzeppelin/contracts/token/ERC20/IERC20.sol@v4.5.0
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol)
/**
* @dev Interface of the ERC20 standard as de... | Lend the FRAX collateral to an AMO Update the balances first Give the FRAX to the AMO | function giveFRAXToAMO(address destination_amo, uint256 frax_amount) external onlyByOwnGov validAMO(destination_amo) {
int256 frax_amount_i256 = int256(frax_amount);
require((frax_borrowed_sum + frax_amount_i256) <= frax_borrow_cap, "Borrow cap");
frax_borrowed_balances[destination_amo] += ... | 1,301,284 |
pragma solidity 0.4.24;
import "./SafeMath.sol";
import "./Ownable.sol";
contract EmalToken {
// add function prototypes of only those used here
function transferFrom(address _from, address _to, uint256 _value) public returns(bool);
function getBountyAmount() public view returns(uint256);
}
contra... | Remove tokens from a bounty user's allocation. Used in game based bounty allocation, automatically called from the Sails app beneficiary The address of the bounty user tokenCount The number of tokens to be deallocated to this address/ | function deductAllocatedTokens(address beneficiary, uint256 tokenCount) public onlyOwner returns(bool success) {
require(beneficiary != address(0));
require(tokenCount>0 && tokenCount<=allocatedTokens[beneficiary]);
allocatedTokens[beneficiary] = allocatedTokens[beneficiary].sub(tokenCount)... | 7,279,254 |
pragma solidity ^0.5.11;
import "./EarningsPool.sol";
import "../../libraries/PreciseMathUtils.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
library EarningsPoolLIP36 {
using SafeMath for uint256;
/**
* @notice Update the cumulative fee factor stored in an earnings pool with new fee... | Update the cumulative reward factor stored in an earnings pool with new rewards earningsPool Storage pointer to EarningsPool.Data struct _prevEarningsPool Storage pointer to EarningsPool.Data struct that stores the previous cumulative reward factor _rewards Amount of new rewards/ | function updateCumulativeRewardFactor(
EarningsPool.Data storage earningsPool,
EarningsPool.Data memory _prevEarningsPool,
uint256 _rewards
) internal {
uint256 prevCumulativeRewardFactor = _prevEarningsPool.cumulativeRewardFactor != 0
? _prevEarningsPool.cumulativeRe... | 14,059,178 |
./partial_match/3/0xf03518534Ec76AEb697C99cFE0CDA08077091c7B/sources/Heroes.sol | calculates the next token ID based on value of _currenttokenID return uint256 for the next token ID/ | function _getNextTokenID() private view returns (uint256) {
return _currenttokenID.add(1);
}
| 5,226,239 |
pragma solidity ^0.5.0;
contract MemEthereum { //1
string public name;
uint public imageCount = 0;
mapping(uint => Image) public images;
struct Image {
uint id;
string hash;
string description;
uint tipAmount;
address payable author;
}
event ImageCreated(
uint id,
... | tip the meme Make sure the id is valid Fetch the image Fetch the author Pay the author by sending them Ether Increment the tip amount Update the image Trigger an event | function tipImageOwner(uint _id) public payable {
require(_id > 0 && _id <= imageCount);
Image memory _image = images[_id];
address payable _author = _image.author;
address(_author).transfer(msg.value);
_image.tipAmount = _image.tipAmount + msg.value;
images[_id] = _image;
emit ImageTipped... | 2,556,722 |
pragma solidity ^0.4.24;
contract owned {
address public owner;
function owned() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) onlyOwner public {
// Prevent transfer to 0x0 a... | Sell `amount` tokens to contract amount amount of tokens to be sold | function sell(uint256 amount) public {
}
| 38,934 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../base/ISWLToken.sol";
import "../base/ERC20.sol";
import "../base/ERC20Capped.sol";
import "../base/ERC20PresetMinterPauser.sol";
import "../erc/utils/SafeMath.sol";
import "../erc/access/Ownable.sol";
/**
* SWL is Sweet Love Token which will used to... | pickupWinner for stake KevinNguyen/ | function _pickupWinner() internal view returns (uint256) {
return uint256(_random()%stakeholders.length);
}
| 15,830,992 |
./partial_match/1/0xb0849647424573358B9ECc9EA4DAb4Bb32399def/sources/contracts/testContracts/EnumerableERC1155.sol | Update the end time for public mint for a given token/ | function setTokenPublicSaleEndTime(
uint256 _tokenId,
uint256 _publicSaleEndTime
) external onlyOwner {
require(_publicSaleEndTime > block.timestamp, "TIME_IN_PAST");
tokenPublicSaleEndTime[_tokenId] = _publicSaleEndTime;
}
| 2,690,658 |
pragma solidity ^0.4.18;
/**
* @title ERC721 interface
* @dev see https://github.com/ethereum/eips/issues/721
*/
contract ERC721 {
event Transfer(address indexed _from, address indexed _to, uint256 _tokenId);
event Approval(address indexed _owner, address indexed _approved, uint256 _tokenId);
f... | Set the maintainer Percentage. Needs to be 10 target percentage _percentage uint256 percentage 10./ | function setMaintainerPercentage(uint256 _percentage) public onlyOwner() {
maintainerPercentage = _percentage;
}
| 896,978 |
./full_match/80001/0x3EEc09B5188E76ca7B2bFe12C8c53574a241aFFc/sources/contracts/CrowdFunding.sol | Donating to the campaignmake a trasection | function donateToCampaing(uint256 _id) public payable {
uint256 amount = msg.value;
Campaign storage campaign = campaigns[_id];
campaign.donatirs.push(msg.sender);
campaign.donations.push(amount);
if(sent){
campaign.amountCollected= campaign.amountCollected + ... | 9,537,974 |
// SPDX-License-Identifier: MIT
//
// Copyright (c) 2021 Kentaro Hara
//
// This software is released under the MIT License.
// http://opensource.org/licenses/mit-license.php
pragma solidity ^0.8.11;
import "./JohnLawCoin_v2.sol";
//------------------------------------------------------------------------------
// [O... | Deprecate the ACB. Only the genesis account can call this method. | function deprecate()
public onlyOwner {
coin_v2_.transferOwnership(msg.sender);
oracle_v3_.transferOwnership(msg.sender);
bond_operation_v2_.transferOwnership(msg.sender);
open_market_operation_v2_.transferOwnership(msg.sender);
eth_pool_v2_.transferOwnership(msg.sender);
logging_v2_.tra... | 6,358,424 |
./full_match/4/0x44F204c9BDA27fcc5bCe918c550b6E5554272771/sources/browser/OroNetwork.sol | Set swap pool Percentage for fee for swap/ Updated percentage will be deducted for further swaps | function setSwapFee(uint256 percentage) public onlyOwner {
swapFee = percentage;
}
| 757,252 |
// Sources flattened with hardhat v2.6.1 https://hardhat.org
// File @openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol@v4.5.1
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address... | Execute withdrawal fee decrease period update (with time delay enforced). Needs to be called after the update was prepraed. Fails if called before time delay is met. return New withdrawal fee decrease period./ | function executeNewWithdrawalFeeDecreasePeriod() external returns (uint256) {
return _executeUInt256(_WITHDRAWAL_FEE_DECREASE_PERIOD_KEY);
}
| 10,436,080 |
./full_match/5/0x61474Ec2b66fd4b6206BACC5795DD8Bf5813c476/sources/localhost/contracts/libraries/GatebridgeV2Library.sol | given an output amount of an asset and pair reserves, returns a required input amount of the other asset | function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) internal pure returns (uint amountIn) {
require(amountOut > 0, 'GatebridgeV2Library: INSUFFICIENT_OUTPUT_AMOUNT');
require(reserveIn > 0 && reserveOut > 0, 'GatebridgeV2Library: INSUFFICIENT_LIQUIDITY');
uint numerator = r... | 1,945,281 |
./partial_match/1/0x8AD2512819A7eae1dd398973EFfaE48dafBe8255/sources/veBalFeeInjector.sol | Injects new veBAL performData required by chainlink keeper interface but not used in this contract, can be 0x0 or anything else. return upkeepNeeded signals if upkeep is needed/ | function performUpkeep(bytes calldata performData) external onlyKeeperRegistry whenNotPaused {
uint256 timeCursor = FeeDistributor.getTimeCursor();
require(LastRunTimeCurser < timeCursor, "Not ready");
uint counter = 0;
for(uint i=0; i< ManagedTokens.length; i++){
if (ManagedTokens[i].balanceO... | 2,781,100 |
./full_match/80001/0xcFd3E772338EE65193E74eb0E70eCb228AfB5Df7/sources/project_/contracts/MetaNftV2.sol | setting this will allow buy with one click | function _mintInternal(uint32 _quantity) internal returns (uint256)
}
}
if (_buyNowPrice > 0) {
_sailingBox[_tokenId][msg.sender] = Sale(1, _minPrice, msg.sender, resell);
}
_auctionState[_tokenId] = AuctionState(true, _minPrice, msg.sender, resell);
emit Auct... | 9,482,731 |
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) {
// assert(b > 0); // Solidity... | close invest for escrow _priceOpen price ETH in USD | function closeInvest (uint _priceOpen)
public
onlyEscrow
{
require(_priceOpen != 0 && session.investOpen);
require(now > (session.timeOpen + timeInvestInMinute * 1 minutes));
session.investOpen = false;
session.priceOpen = _priceOpen;
emit InvestClose(now... | 7,913,906 |
pragma solidity ^0.5.0;
import "./UsingTellor.sol";
/**
* @title Optimistic
* This contracts allows users to use Tellor as a fallback oracle. It allows two parties to centrally
* enter the data used to settle a contract but allows either party to dispute the data. If a dispute is
* initiated their contract will sett... | Get the first undisputed value after the timestamp specified. This function is used within the getTellorValues but can be used on its own. _timestamp to search the first undisputed value there after/ | function getFirstUndisputedValueAfter(uint256 _timestamp) public view returns (bool, uint256, uint256 _timestampRetrieved) {
uint256 _count = timestamps.length;
if (_count > 0) {
for (uint256 i = _count; i > 0; i--) {
if (timestamps[i - 1] >= _timestamp && disputedValues[... | 12,965,503 |
pragma solidity ^0.4.24;
// File: contracts/math/SafeMath.sol
/**
* Copyright (c) 2016 Smart Contract Solutions, Inc.
* Released under the MIT license.
* https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/LICENSE
*/
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on err... | Change the phase from "Tokensale" to "Public". This function will be cahnged in the future to receive an address of voting contract as an argument in order to handle the result of minting proposal. return True if the change of the phase is successful, revert otherwise. | function closeTokensale () external returns (bool) {
require(state == State.Tokensale && msg.sender == tokensaleManagerAddr);
state = State.Public;
return true;
}
| 354,718 |
/*
-----------------------------------------------------------------
FILE INFORMATION
-----------------------------------------------------------------
file: Owned.sol
version: 1.1
author: Anton Jurisevic
Dominic Romanowski
date: 2018-2-26
----------------------------------------------... | The total havvens owned by this account, both escrowed and unescrowed, against which nomins can be issued. This includes those already being used as collateral (locked), and those available for further issuance (unlocked)./ | function collateral(address account)
public
view
returns (uint)
{
uint bal = tokenState.balanceOf(account);
if (escrow != address(0)) {
bal = safeAdd(bal, escrow.balanceOf(account));
}
return bal;
}
| 2,140,204 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.5.16 <0.7.0;
library TokenFlags {
uint32 internal constant BIT_PAUSABLE = 0;
uint32 internal constant BIT_MINTABLE = 1;
uint32 internal constant BIT_BURNABLE = 2;
uint32 internal constant BIT_ETH_REFUNDABLE = 3;
uint32 internal constant BIT_ERC2... | See {IERC20-allowance}./ | function allowance(address from, address spender) public virtual override view returns (uint256) {
return _allowances[from][spender];
}
| 13,669,156 |
pragma solidity 0.5.17;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "../../utils/BytesLib.sol";
import "../../cryptography/AltBn128.sol";
import "../../cryptography/BLS.sol";
import "../../TokenStaking.sol";
library Groups {
using SafeMath for uint256;
using BytesLib for bytes;
str... | Returns addresses of all the members in the provided group./ | function membersOf(
Storage storage self,
bytes memory groupPubKey
) public view returns (address[] memory members) {
return self.groupMembers[groupPubKey];
}
| 12,536,065 |
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity ^0.7.0;
import "./lib/ReEncryptionValidator.sol";
import "./lib/SignatureVerifier.sol";
import "./StakingEscrow.sol";
import "./proxy/Upgradeable.sol";
import "../zeppelin/math/SafeMath.sol";
import "../zeppelin/math/Math.sol";
/**
* @title Adjudicator
*... | Call "getter" with two parameters. Result should not exceed 32 bytes/ | function delegateGet(
address _target,
bytes4 _selector,
bytes32 _argument1,
bytes32 _argument2
)
internal returns (uint256 result)
{
bytes32 memoryAddress = delegateGetData(_target, _selector, 2, _argument1, _argument2);
assembly {
result ... | 1,393,257 |
./full_match/1/0x99a9B7c1116f9ceEB1652de04d5969CcE509B069/sources/contracts/GenArt721CoreV3.sol | Updates artist name for project `_projectId` to be `_projectArtistName`. _projectId Project ID. _projectArtistName New artist name./ | function updateProjectArtistName(
uint256 _projectId,
string memory _projectArtistName
)
external
onlyUnlocked(_projectId)
onlyArtistOrAdminACL(_projectId, this.updateProjectArtistName.selector)
onlyNonEmptyString(_projectArtistName)
{
projects[_projec... | 17,012,441 |
pragma solidity ^0.4.15;
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
/// @author Stefan George - <stefan.george@consensys.net>
contract MultiSigWallet {
/*
* Events
*/
event Confirmation(address indexed sender, uint indexed transactionId);
event ... | Allows to remove an owner. Transaction has to be sent by wallet. owner Address of owner. | function removeOwner(address owner)
public
onlyWallet
ownerExists(owner)
{
isOwner[owner] = false;
for (uint i=0; i<owners.length - 1; i++)
if (owners[i] == owner) {
owners[i] = owners[owners.length - 1];
break;
}
owners.length -= 1;
if (required > owners.length)
... | 10,044,326 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.7.4;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts-upgradeable/math/SignedSafeMathUpgradeable.sol";
import "../interface/IOracle.sol";
import "../libraries/OrderData.sol";
import "../libraries/SafeMathExt.sol";
import "../libraries/Utils.sol"... | open interest will increase, check limit | function doTrade(
LiquidityPoolStorage storage liquidityPool,
uint256 perpetualIndex,
address trader,
int256 deltaCash,
int256 deltaPosition
) internal {
PerpetualStorage storage perpetual = liquidityPool.perpetuals[perpetualIndex];
int256 deltaOpenInteres... | 12,615,773 |
./full_match/3/0xD6c9DfFd4b84E23347491E340060808f815F8B0c/sources/contracts/10_Deposit.sol | Create a reference to the underlying asset contract, like DAI. Create a reference to the corresponding cToken contract, like cDAI Amount of current exchange rate from cToken to underlying Amount added to you supply balance this block Approve transfer on the ERC20 contract Mint cTokens | function supplyErc20ToCompound(
address token,
address c_token,
uint256 amount
) private returns (uint) {
IERC20 underlying = IERC20(token);
CERC20 cToken = CERC20(c_token);
uint256 exchangeRateMantissa = cToken.exchangeRateCurrent();
emit MyLog("Exchang... | 8,122,634 |
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
/**
* @title Token Staking.
* @dev Stake ERC20 for earning rewards.
*/
import { TokenInterface } from "../../common/interfaces.sol";
import { Stores } from "../../common/stores.sol";
import { Helpers } from "./helpers.sol";
import { Events } from "./events.... | Claim Reward. Claim Pending Rewards of tokens staked. stakingPoolName staking pool name. setId ID stores the amount of reward tokens claimed./ | function claimReward(
string calldata stakingPoolName,
uint setId
) external payable returns (string memory _eventName, bytes memory _eventParam) {
(
IStakingRewards stakingContract,
,
TokenInterface rewardToken,
bytes32 stakingType
) = getStakingData(stakingPoolName);
... | 5,775,446 |
pragma solidity ^0.4.16;
contract TokenERC20 {
/* Begin Owned Contract Members */
// An array of owners
mapping (address => bool) public owners;
// Has the next action been authorised by another owner
bool public nextActionIsAuthorised = false;
address public actionAuthorisedBy;
// Does ... | Check if the amount the owners are attempting to withdraw is within their current allowance | function amountIsWithinOwnersAllowance(uint256 amountToWithdraw) internal view returns (bool) {
if (now - icoEndDate >= yearLength * 2)
return true;
uint256 totalFundsWithdrawnAfterThisTransaction = fundsWithdrawnByOwners + amountToWithdraw;
bool withinAllowance = totalFundsWithdrawnAfterThisTransac... | 6,343,629 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.11;
pragma experimental ABIEncoderV2;
import "../../Math/SafeMath.sol";
import "../../XUS/XUS.sol";
import "../../XUSD/XUSD.sol";
import "../../ERC20/ERC20.sol";
import "../../Oracle/UniswapPairOracle.sol";
import "./XUSDPoolLibrary.sol";
contract XUSDPool {
usi... | Returns the price of the pool collateral in USD ( , , , , , , , uint256 eth_usd_price) = XUSD.xusd_info(); return eth_usd_price.mul(PRICE_PRECISION).div(collatEthOracle.consult(weth_address, PRICE_PRECISION (10 missing_decimals))); | function getCollateralPrice() public view returns (uint256) {
if(collateralPricePaused == true) {
return pausedPrice;
}
}
| 6,416,057 |
./full_match/1/0xefaCa6Fc316B3B2Aa6c55FF5E02a62A85d4391e8/sources/contracts/storage/AccountRBAC.sol | Revokes all permissions for the specified target address. only removes permissions for the given address, not for the entire account/ | function revokeAllPermissions(Data storage self, address target) internal {
bytes32[] memory permissions = self.permissions[target].values();
if (permissions.length == 0) {
return;
}
for (uint256 i = 0; i < permissions.length; i++) {
self.permissions[target]... | 16,517,166 |
pragma solidity ^0.4.25;
// File: openzeppelin-solidity/contracts/token/ERC20/IERC20.sol
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view ret... | return the number of remaining tokens to distribute return uint256/ | function remainingTokens() public view returns (uint256) {
return _token.balanceOf(this);
}
| 12,706,628 |
./full_match/1/0x2923A537546443AdcF47c7351b51Da6E423d3e58/sources/contracts/Marketplace.sol | Returns The Sale Info For A Fixed Price Sale/ | function ViewSaleInfoFixedPrice (
uint SaleIndex,
address Wallet,
uint MaxAmount,
bytes32[] calldata ProofEligibility,
bytes32[] calldata ProofAmount
) public view returns (FixedPriceSaleInfo memory) {
uint Price = FixedPriceSales[SaleIndex]._Price;
uint A... | 17,089,878 |
pragma solidity ^0.4.18;
contract DataSourceInterface {
function isDataSource() public pure returns (bool);
function getGroupResult(uint matchId) external;
function getRoundOfSixteenTeams(uint index) external;
function getRoundOfSixteenResult(uint matchId) external;
function getQuarterResult(uin... | checks if a user owns a token userAddress - The address to check. tokenId - ID of the token that needs to be verified. return true if the userAddress provided owns the token./ | function _userOwnsToken(address userAddress, uint256 tokenId) internal view returns (bool){
return ownerOfTokenMap[tokenId] == userAddress;
}
| 7,712,450 |
// SPDX-License-Identifier: NONE
pragma solidity 0.7.6;
// Part: IERC20Permit
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account'... | Silence state mutability warning without generating bytecode. See https:github.com/ethereum/solidity/issues/10090issuecomment-741789128 and https:github.com/ethereum/solidity/issues/2691 solhint-disable-next-line no-inline-assembly | function _getChainId() private view returns (uint256 chainId) {
this;
assembly {
chainId := chainid()
}
}
| 327,156 |
./partial_match/4/0xa5d9C34950DB1199BE5b7f8C0e5C13b7471af00B/sources/GenesisPool.sol | 重写了TopTokenWrapper的stake方法,加入了一些约束合约精度为18 require(amount.add(balanceOf(msg.sender)) <= 100000000000000000000, "Cannot stake more than 100");更新数组,如果是刚加入的时候积分肯定为0初始化积分有效期 | function stake(uint256 amount) public calBonus {
require(amount.add(balanceOf(msg.sender)) >= 1000000000000000000, "Cannot stake less than 1");
require(amount % 1000000000000000000 == 0, "Cannot stake float coin");
super.stake(amount);
if(points[msg.sender]==0){
ownerAddress.push(msg.sender);... | 8,522,787 |
./full_match/1/0x51b898efAf8366b494b917d51839a4E015DCde3A/sources/lib/geb/src/single/CollateralAuctionHouse.sol | Settle/finish an auction id ID of the auction to settle/ | function settleAuction(uint256 id) external {
require(bids[id].bidExpiry != 0 && (bids[id].bidExpiry < now || bids[id].auctionDeadline < now), "EnglishCollateralAuctionHouse/not-finished");
safeEngine.transferCollateral(collateralType, address(this), bids[id].highBidder, bids[id].amountToSell);
... | 8,439,159 |
/**
*Submitted for verification at Etherscan.io on 2021-09-04
*/
/**
*Submitted for verification at Etherscan.io on 2021-09-01
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its ... | Allows the DAO to set a season for new First Gold claims season_ The season to use for claiming first | function daoSetSeason(uint256 season_) public onlyOwner {
season = season_;
}
| 124,231 |
./full_match/1/0xDd5097FC3f68958649cE70F42B7c1CF0067a3545/sources/cache/solpp-generated-contracts/Storage.sol | Return accept record hash for fast withdraw | function getFastWithdrawHash(uint32 accountIdOfNonce, uint8 subAccountIdOfNonce, uint32 nonce, address owner, uint16 tokenId, uint128 amount, uint16 fastWithdrawFeeRate) internal pure returns (bytes32) {
return keccak256(abi.encodePacked(accountIdOfNonce, subAccountIdOfNonce, nonce, owner, tokenId, amount, ... | 16,530,461 |
pragma solidity 0.5.3;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high le... | digital secretary can convert entity type | function convertEntityType(uint256 fileNumber, uint8 newType) public onlySecretary {
Entity storage entity = entities[fileNumber];
entity.entityType = newType;
}
| 12,550,536 |
./partial_match/1/0xc8024fB5C7beD98CcE0e498E54B7D89816B3521B/sources/GenesisLiquidityPool.sol | Swaps Collateral for GEX. Mints a percentage of the amount of GEX tokens as new supply. | function mintSwap(uint256 inCollatAmount, uint256 minOutGEXAmount) external virtual whenMintNotPaused {
uint256 outGEXAmount = amountOutGEX(inCollatAmount);
uint256 fee = amountFeeMint(outGEXAmount);
require(outGEXAmount - fee >= minOutGEXAmount, "Max slippage");
uint256 amo... | 3,668,737 |
/* SPDX-License-Identifier: LGPL-3.0-or-later */
pragma solidity ^0.7.0;
import "./Admin.sol";
import "./CarefulMath.sol";
import "./Erc20.sol";
import "./Erc20Interface.sol";
import "./Erc20Permit.sol";
import "./Erc20Recover.sol";
import "./ReentrancyGuard.sol";
import "./BalanceSheetInterface.sol";
import "./Fintr... | Deletes the borrower account's debt from the registry and take the fyTokens out of circulation. Emits a {Burn}, {Transfer} and {RepayBorrow} event. Requirements: - The vault must be open. - The amount to repay cannot be zero. - The Fintroller must allow this action to be performed. - The caller must have at least `rep... | function repayBorrow(uint256 repayAmount) external override isVaultOpen(msg.sender) nonReentrant returns (bool) {
repayBorrowInternal(msg.sender, msg.sender, repayAmount);
return true;
}
| 14,900,291 |
./partial_match/42/0x7dFdB85E6775E3082Ec30298Fa3a46c9Dfdf7b7a/sources/ThirdContract.sol | && anx.balanceOf(address(0)) > 0 anx.transferFrom(address(this), msg.sender, decimalValue); | function giveANXToUser(uint256 value) public {
uint256 decimalValue = value * 100;
require(
usdt.allowance(msg.sender, address(this)) >= decimalValue &&
usdt.allowance(msg.sender, address(this)) > 0
);
usdt.transferFrom(msg.sender, address(this), decimalVa... | 9,091,633 |
contract NoxonFund {
address public owner;
string public name;
string public symbol;
uint8 public decimals;
uint256 public totalSupply; //18160ddd for rpc call https://api.etherscan.io/api?module=proxy&data=0x18160ddd&to=0xContractAdress&apikey={eserscan api}&action=eth_call
uint256 publ... | This creates an array with all balances / This generates a public event on the blockchain that will notify clients / Initializes cont ract with initial supply tokens to the creator of the contract / | function token() {
if (owner!=0) throw;
buyPrice = msg.value;
Entropy = 1;
owner = msg.sender;
setPrices();
}
| 13,032,781 |
/*
https://t.me/CryptoListingOfficial
https://cryptolisting.com/
https://twitter.com/cryptolisting_
https://www.reddit.com/r/cryptolistingcom/
https://cryptolisting.medium.com/
// SPDX-License-Identifier: MIT
*/
pragma solidity ^0.8.4;
interface IUniswapV2Router01
{
function factory() external pure returns (ad... | capture the contract's current ETH balance. this is so that we can capture exactly the amount of ETH that the swap creates, and not make the liquidity event include any ETH that has been manually sent to the contract swap tokens for ETH how much ETH did we just swap into? | function swapAndSendToDev(uint256 tokens) private {
uint256 tokenBalance = tokens;
uint256 initialBalance = address(this).balance;
uint256 newBalance = address(this).balance.sub(initialBalance);
sendEthToDev(newBalance);
emit SwapAndSendToDev(tokens, newBalance);
... | 107,848 |
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
pragma solidity ^0.5.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see {ERC20Detailed}.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
... | ---------- STAKES ---------- A method for a stakeholder to create a stake. _stake The size of the stake to be created./ | function createStake(uint256 _stake) external isvalidStakePeriod {
require(transfer(address(this), _stake), "Token transfer failed");
if(stakes[msg.sender] == 0) _addStakeholder(msg.sender);
stakes[msg.sender] = stakes[msg.sender].add(_stake);
emit Staked(msg.sender,_stake);
}
| 5,500,715 |
pragma solidity 0.5.11;
/**
* @title OUSD Vault Contract
* @notice The Vault contract stores assets. On a deposit, OUSD will be minted
and sent to the depositor. On a withdrawal, OUSD will be burned and
assets will be sent to the withdrawer. The Vault accepts deposits of
interest for... | Set the weights for multiple strategies. _strategyAddresses Array of strategy addresses _weights Array of corresponding weights, with 18 decimals. For ex. 100%=1e18, 30%=3e17./ | function setStrategyWeights(
address[] calldata _strategyAddresses,
uint256[] calldata _weights
) external onlyGovernor {
require(
_strategyAddresses.length == _weights.length,
"Parameter length mismatch"
);
for (uint256 i = 0; i < _strategyAddres... | 1,233,148 |
./full_match/5/0x285633333615b13e665Be0e714d85C1cEf0A19F1/sources/browser/Symbio.sol | The fallback function: If the contract's controller has not been set to 0, then the `proxyPayment` method is called which relays the ether and creates tokens as described in the token controller contract | function () external payable {
require(isContract(controller));
require(TokenController(controller).proxyPayment.value(msg.value)(msg.sender));
}
event Transfer(address indexed _from, address indexed _to, uint256 _amount);
event NewCloneToken(address indexed _cloneToken, uint _snapshot... | 1,952,616 |
pragma solidity ^0.5.10;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "../interfaces/IERC223ReceivingContract.sol";
import "../interfaces/IDetherToken.sol";
import "../interfaces/IZoneFactory.sol";
import "../interfaces/IZone.sol";
import "../interfaces/ITeller.sol";
contract Zone is IERC223Rec... | get current zone owner data | function getZoneOwner()
external
view
returns (address, uint, uint, uint, uint, uint)
{
return (
);
}
| 5,454,348 |
//Address: 0x5f391f8253475bffa27b2f8544994f9717ab310d
//Contract name: CromIco
//Balance: 0.94901046 Ether
//Verification Date: 11/16/2017
//Transacion Count: 27
// CODE STARTS HERE
pragma solidity ^0.4.15;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/E... | return true if the public ICO is in progress | function isPublicIcoActive() public constant returns (bool) {
bool isPayable = Stages.Payable == getCurrentStage();
bool isPublic = PayableStages.PublicIco == getPayableStage();
return isPayable && isPublic;
}
| 1,031,418 |
./full_match/42220/0xaBb380Bd683971BDB426F0aa2BF2f111aA7824c2/sources/contracts/MarketPlace/MarketPlaceNFTAPI.sol | check if this contract has approved to transfer this erc721 token/ | function _isTokenApproved(uint256 tokenId) public view returns (bool) {
if(isSupport1555 == false){
try _erc721.getApproved(tokenId) returns (address tokenOperator) {
return tokenOperator == address(this);
return false;
}
return true;
... | 16,314,874 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6 <0.7.0;
import "@openzeppelin/contracts-ethereum-package/contracts/access/Ownable.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20Snapshot.sol";
/**
... | Mints tokens to the owner account (external) amount The amount of tokens to mint Requirements: the caller must be the owner See {ERC20-_mint}./ | function mint(uint256 amount) external onlyOwner
{
_mint(_msgSender(), amount);
}
| 13,094,848 |
/*
Copyright 2021 Set Labs Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in... | Converts a uint256 PRECISE_UNIT quote quantity into an alternative decimal format. In Perp all assets are 18 decimal quantities we need to represent as 6 decimal USDC quantities when setting position units or withdrawing from Perp's Vault contract. This method is borrowed from PerpProtocol's `lushan` repo in lib/Settle... | function _fromPreciseUnitToDecimals(uint256 amount, uint8 decimals) internal pure returns (uint256) {
return amount.div(10**(18 - uint(decimals)));
}
| 7,220,975 |
./full_match/43113/0x0bC8cc281561e2b64B4027437A9E20A53c0F70E7/sources/contracts/sol.sol | first 32 bytes, after the length prefix second 32 bytes final byte (first byte of the next 32 bytes) | function splitSignature(bytes memory sig)
public
pure
returns (
bytes32 r,
bytes32 s,
uint8 v
)
{
require(sig.length == 66, "invalid signature length");
assembly {
First 32 bytes stores the length of the signature
... | 7,137,776 |
./full_match/42220/0x9F4116AdFd83c30dBAA5146D17d1f5A9a56b1502/sources/contracts/lbp/LBPManagerFactory.sol | Set LBPManager contract which works as a base for clones. _masterCopy The address of the new LBPManager basis./ | function setMasterCopy(address _masterCopy)
external
onlyOwner
validAddress(_masterCopy)
{
emit MastercopyChanged(masterCopy, _masterCopy);
masterCopy = _masterCopy;
}
| 16,336,753 |
./full_match/11155111/0x1b502402EB8fD08e657a4a2Bd6424AEc899D3c38/sources/contracts/libraries/InteractionLogic.sol | Emits the `Collected` event that signals that a successful collect action has occurred. This is done through this function to prevent stack too deep compilation error. collector The address collecting the publication. profileId The token ID of the profile that the collect was initiated towards, useful to differentia... | function _emitCollectedEvent(
address collector,
uint256 profileId,
uint256 pubId,
uint256 rootProfileId,
uint256 rootPubId,
bytes calldata data
) private {
emit Events.Collected(
collector,
profileId,
pubId,
... | 3,800,459 |
./full_match/1/0x467a2B91f231D930F5eeB6B982C7666E81DA8626/sources/contracts/nft/ZKSeaNFT.sol | Update withdrawal info, while the caller need deal with the transfer | function onWithdraw(address target, uint64 globalId) external onlyZksCore returns (address, uint256) {
require(globalId > 0, "ZKSeaNFT: invalid withdraw id");
bytes28 key = packWithdrawKey(target, globalId);
require(toWithdraw[key], "ZKSeaNFT: invalid withdraw key");
toWithdraw[key] ... | 3,857,727 |
./partial_match/97/0x8F299669251f2b7828de18046829Daca7b7406a0/sources/MFXToken.sol | Destroys `amount` tokens from `account`, deducting from the caller's allowance. See {BEP20-_burn} and {BEP20-allowance}. Requirements: - the caller must have allowance for ``accounts``'s tokens of at least `amount`./ | function burnFrom(address account, uint256 amount) public virtual returns (bool) {
uint256 decreasedAllowance = allowance(account, _msgSender()).sub(amount, "BEP20: burn amount exceeds allowance");
_approve(account, _msgSender(), decreasedAllowance);
_burn(account, amount);
return t... | 11,488,532 |
pragma solidity ^0.5.2;
contract ModExp {
// address constant MODEXP_BUILTIN = 0x0000000000000000000000000000000000000005;
function modexp(uint256 b, uint256 e, uint256 m) internal returns(uint256 result) {
assembly {
let freemem := mload(0x40)
mstore(freemem, 0x20)
... | point addition for elliptic curve in jacobian coordinates formula from https:en.wikibooks.org/wiki/Cryptography/Prime_Curve/Jacobian_Coordinates if (_q[0] == 0 && _q[1] == 0 && _q[2] == 0) { return _p; } | function ecadd(uint256[3] memory _p, uint256[3] memory _q) private pure returns(uint256[3] memory R) {
uint256 z2 = mulmod(_q[2], _q[2], P);
uint256 u1 = mulmod(_p[0], z2, P);
uint256 s1 = mulmod(_p[1], mulmod(z2, _q[2], P), P);
z2 = mulmod(_p[2], _p[2], P);
uint256 u2 = mu... | 13,113,487 |
./full_match/421611/0xA58a23d4846617807e43420d21EA0127d9d9Fa0e/sources/contracts-link/test/TestPaymasterConfigurableMisbehavior.sol | leaving withdrawal public and unprotected | function withdrawAllBalance() public returns (uint256) {
require(address(relayHub) != address(0), "relay hub address not set");
uint256 balance = relayHub.balanceOf(address(this));
relayHub.withdraw(balance, payable(address(this)));
return balance;
}
IPaymaster.GasAndDataLim... | 13,220,861 |
import "Rounder.sol";
contract Rebalancer is Rounder {
uint constant cheapRebGas = 6969;
uint constant rebGas = 13830;
//automated rebalance function
function rebalance(address _sendRemainderTo) external {
//need at least 1 eth to ensure balance is properly rounded
//need to specify a ... | 'safer' variant of the automated rebalance functionensures the set remainder account has a balance before sendingshould help avoid mistyping addressessame initial checks + ensure the remainder balance isnt empty | function saferRebalance(address _sendRemainderTo) external {
if(msg.value < 1 ether || _sendRemainderTo == 0 || _sendRemainderTo.balance == 0)
throw;
uint amtToSendForRounding = calcAmtToSend(rebGas);
if(! msg.sender.send(amtToSendForRounding))
throw;
if(! _... | 956,874 |
// File: contracts/TrueReward/utilities/FractionalExponents.sol
... | inject NONSTANDARD NAMING | function GENERALEXP531(uint256 _x, uint8 _precision) internal pure returns (uint256) { | 5,410,459 |
/**
Copyright 2019 PoolTogether LLC
This file is part of PoolTogether.
PoolTogether is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation under version 3 of the License.
PoolTogether is distributed in the hope that it... | Sets the fee beneficiary for subsequent Draws. Can only be called by admins. _feeBeneficiary The beneficiary for the fee fraction. Cannot be the 0 address./ | function setNextFeeBeneficiary(address _feeBeneficiary) public onlyAdmin {
_setNextFeeBeneficiary(_feeBeneficiary);
}
| 930,211 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;
contract Kyc {
address public admin;
struct Customer {
address custAddress;
string jsonHash;
string photoHash;
string citizenship_front_hash;
string citizenship_back_hash;
uint d;
uint n;
address[] orga... | Return Array of all pending request of the orgs | function listRequest() public isOrgValid view returns(kycRequestList[] memory){
kycRequestList[] memory ret = new kycRequestList[](kycrequestsbyorg[msg.sender].req_count);
uint j = 0;
for (uint i = 0; i < kycrequestsbyorg[msg.sender].req_count; i++) {
ret[j] = kycrequestsbyorg[msg.sen... | 13,026,463 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
import "@op... | Claim voting reward for `proposalId`./ | function claimVotingReward(uint256 proposalId) external virtual {
require(
!_claimed[_msgSender()][proposalId],
"Rewards: already claimed"
);
require(
_rewardsStart <= _governance.proposalSnapshot(proposalId),
"Rewards: not qualified"
)... | 12,957,515 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
import "../utilities/Initializable.sol";
import "../utilities/Context.sol";
import "../access/Ownable.sol";
import "../security/Pausable.sol";
import "../interfaces/IBEP20.sol";
import "../libraries/Address.sol";
// Implementation of the IBEP20 Interface, using... | Atomically increases the allowance granted to `spender` by the caller. | function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(_msgSender(), spender, (_allowances[_msgSender()][spender] + addedValue));
return true;
}
| 12,752,679 |
/*
Copyright 2020 dYdX Trading Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed ... | Copy to memory, modify in place, and return the memory object. | function setPosition(
P1Types.Balance calldata balance,
SignedMath.Int calldata newPosition
)
external
pure
returns (P1Types.Balance memory)
{
P1Types.Balance memory _balance = balance;
P1BalanceMath.setPosition(_balance, newPosition);
return _... | 6,456,092 |
pragma solidity ^0.5.16;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/********************************************************************************************/
/* DATA VARIABLES ... | Add an airline to the registration queue Can only be called from FlightSuretyApp contract/ | function registerAirline(address newAirline, address registeringAirline)
external
requireIsOperational
requireIsCallerAuthorized
requireAirlineIsNotRegistered(newAirline)
requireAirlineIsFunded(registeringAirline)
{
airlines[newAirline] = Airline(0, true, false);
registeredAirlineCount =... | 5,537,537 |
// Sources flattened with hardhat v2.8.2 https://hardhat.org
// File @openzeppelin/contracts/utils/math/SafeMath.sol@v4.4.2
//
// OpenZeppelin Contracts v4.4.1 (utils/math/SafeMath.sol)
pragma solidity ^0.8.0;
// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it reli... | interface to get data from the Scaling Price Oracle ----------- Getters ----------- ----------- Governor only state changing api ----------- | interface IOraclePassThrough {
function scalingPriceOracle() external view returns (IScalingPriceOracle);
function read()
external
view
returns (Decimal.D256 memory price, bool valid);
function getCurrentOraclePrice() external view returns (uint256);
function updateScalingPr... | 10,354,473 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openze... | Reserve some zines for giveaways Only allow one-time reservation | function reserveZines() public onlyOwner {
if (!reservedZines) {
_mintZines(20);
reservedZines = true;
}
}
| 6,254,149 |
//SPDX-License-Identifier: MIT
pragma solidity 0.7.5;
import "@openzeppelin/contracts/math/Math.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
// Inheritance
import "../interfaces/ISt... | amount tokens to withdraw user address recipient address, where to send tokens, if we migrating token address can be zero not using safe math, because there is no way to overflow if stake tokens not overflow not using safe transfer, because we working with trusted tokens | function _withdraw(uint256 amount, address user, address recipient) internal nonReentrant updateReward(user) {
require(amount != 0, "Cannot withdraw 0");
_totalSupply = _totalSupply - amount;
_balances[user] = _balances[user] - amount;
require(stakingToken.transfer(recipient, amount... | 405,900 |
./partial_match/3/0xD701E3ed119715390f0260F5103885ED6A8586EF/sources/UniMexMargin.sol | stack too deep: uint256 loss = owed.sub(swap);uint256 leftover = commitmentInTokens.sub(owed.sub(swap));IERC20(position.token).approve(address(uniswap_router), leftover);uint256 leftoverInEth = swapTokens(position.token, leftover, true, slippage);uint256 fees = (leftoverInEth.mul(8e15)).div(1e18);IERC20(position.token)... | function closePosition(bytes32 tradeId, uint256 slippage) public {
Position storage position = positionInfo[tradeId];
require(msg.sender == position.owner, 'UNIMEX: BORROWER_ONLY');
bool isShort = position.owedTokens > 0 ? true : false;
uint256 inp... | 5,225,299 |
./partial_match/56/0x306d649856A746FfCF788f06c7a783a1ae581658/sources/WojakFarming.sol | require((user_blocks_before_claim(_pid, msg.sender) == 0, "Not long enough time staked.") | function withdraw_LP(uint256 _pid, uint amount) public nonReentrant {
uint256 countPool = poolList.length;
require(_pid < countPool, "Not a valid Pool");
_updatePool(_pid);
UserList storage user = userList[_pid][msg.sender];
PoolList storage pool = poolList[_pid];
require(user.stakingAmount > 0, "no ba... | 11,107,029 |
./full_match/421613/0x152cA8Fa9B9d1B147C821f1b8d2D0D81D6893548/sources/contracts/facets/ItemsFacet.sol | Admin Functions | function mintGameItem(
uint8 amount,
address to,
LibToken.ItemType itemType
) external pausable roleOnly(LibAccessControl.Roles.MINTER) {
require(_token().requestedNftConversions[to] >= amount, 'Not enough requested NFT conversions');
if (itemType == LibToken.ItemType.EQU... | 11,575,342 |
// Dependency file: @openzeppelin/contracts/utils/Address.sol
// SPDX-License-Identifier: MIT
// pragma solidity >=0.6.2 <0.8.0;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [// importANT]
* ====
... | Runs all the necessary approval functions required for a list of ERC20 tokens. _tokens Addresses of the tokens which need approval/ | function approveTokens(IERC20[] calldata _tokens) external {
for (uint256 i = 0; i < _tokens.length; i++) {
approveToken(_tokens[i]);
}
}
| 2,571,863 |
//pragma solidity ^0.5.2;
pragma solidity >=0.4.22 <0.6.0;
/**
* @title IERC165
* @dev https://eips.ethereum.org/EIPS/eip-165
*/
interface IERC165 {
/**
* @notice Query if a contract implements an interface
* @param interfaceId The interface identifier, as specified in ERC-165
* @dev Interface i... | This is it folks, the main event! The way for the world to get new Wizards! Does pretty much what it says on the box: Let's you conjure a new Wizard with a specified elemental affinity. The call must include enough eth to cover the cost of the new Wizard, and any excess is refunded. The power of... | function conjureWizard(uint8 affinity) external payable onlyDuringSale returns (uint256 wizardId) {
wizardId = nextWizardId;
nextWizardId++;
uint256 wizardCost;
(wizardCost, elementalWizardCost) = _conjureWizard(wizardId, msg.sender, affinity, elementalWizardCost);
requir... | 2,529,610 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.