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/56/0x5C351CE0194759904d6B40E3b2B8751A1fBf876D/sources/SuperFarm.sol | Update reward variables of the given pool to be up-to-date. | function updatePool(uint256 _pid) public {
PoolInfo storage pool = poolInfo[_pid];
if (block.number <= pool.lastRewardBlock) {
return;
}
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if (lpSupply == 0 || pool.allocPoint == 0) {
pool.lastRew... | 11,155,584 |
pragma solidity 0.5.7;
/*
* xEuro.sol
* xEUR tokens smart contract
* implements [ERC-20 Token Standard](https://eips.ethereum.org/EIPS/eip-20)
* ver. 1.0.7
* 2019-04-29
* https://xeuro.online
* address: https://etherscan.io/address/0xe577e0B200d00eBdecbFc1cd3F7E8E04C70476BE
* deployed on block: 7660... | _minExchangeAmount new value of minimum amount of tokens that can be exchanged to fiat only admin can make this change/ | function changeMinExchangeAmount(uint256 _minExchangeAmount) public returns (bool success){
require(isAdmin[msg.sender], "Only admin can do that");
uint256 from = minExchangeAmount;
minExchangeAmount = _minExchangeAmount;
emit MinExchangeAmountChanged(msg.sender, from, minExchang... | 12,925,573 |
./full_match/4/0x396729a951ac329a7dd36B52745B1701E0eF8879/sources/contracts/BalanceLogicContract.sol | Getter for the initialFees. | function getInitialFees() external view returns (uint256) {
return initialFees;
}
| 680,459 |
./full_match/4/0x632a2a5B51f17CE7e0fee110aC401525DF2E5Ce1/sources/contracts/OmnimorphsRinkeby.sol | fuse two tokens together | function fuseTokens(uint toFuse, uint toBurn) public {
require(isFusionActive, "Fusing is not currently active");
require(ownerOf(toFuse) == msg.sender && ownerOf(toBurn) == msg.sender, "Tokens not owned by sender");
require(fusedTokensMap[toFuse] == 0, "Token has already been fused");
... | 13,324,030 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';
import '@openzeppelin/contracts/access/Ownable.sol';
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "./libs/IUniRouter02.sol";
import "./libs/IWETH.sol";
interface IToken {
... | Withdraw staked tokens and collect reward tokens _amount: amount to withdraw (in earnedToken)/ | function withdraw(uint256 _amount, uint8 _stakeType) external nonReentrant {
require(_amount > 0, "Amount should be greator than 0");
require(_stakeType < lockups.length, "Invalid stake type");
_updatePool(_stakeType);
UserInfo storage user = userStaked[msg.sender];
Stake[]... | 5,923,584 |
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.8.9;
import { IERC20, IPool, IPoolAddressesProvider, IWETHGateway} from './Interfaces.sol';
import { SafeERC20 } from './Libraries.sol';
import "@openzeppelin/contracts/proxy/utils/Initializable.sol";
/**
* @title JustCausePoolAaveV3 contract
* @author JustCaus... | _assetAddress The address of the underlying asset of the reserve return unclaimedInterest accrued interest that has not yet been claimed/ | function getUnclaimedInterest(address _assetAddress) public view returns (uint256){
address aTokenAddress = getATokenAddress(_assetAddress);
uint256 aTokenBalance = IERC20(aTokenAddress).balanceOf(address(this));
return aTokenBalance - totalDeposits[_assetAddress];
}
| 1,759,689 |
pragma solidity ^0.5.0;
pragma experimental ABIEncoderV2;
/* External Imports */
import "openzeppelin-solidity/contracts/math/Math.sol";
import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";
/* Internal Imports */
import {DataTypes as types} from "./DataTypes.sol";
import {CommitmentChain} from "./Commitmen... | Verify that the challenge may be added Add the challenge | function challengeCheckpoint(Challenge memory _challenge) public {
bytes32 challengedCheckpointId = getCheckpointId(_challenge.challengedCheckpoint);
bytes32 challengingCheckpointId = getCheckpointId(_challenge.challengingCheckpoint);
bytes32 challengeId = getChallengeId(_challenge);
... | 1,003,763 |
./full_match/4/0xd44Df3CBB560beca8186660DE61652ee3EA6eBEd/sources/tests/tpFunny.sol | See {IERC20-transfer}. Requirements: - `recipient` cannot be the zero address. - the caller must have a balance of at least `amount`./ | function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
require (amount <= _balances[msg.sender] );
_balances[msg.sender] = _balances[msg.sender] - amount;
_balances[recipient] = _balances[recipient] + amount;
emit Transfer(msg.sender , recipient... | 12,520,617 |
pragma solidity ^0.4.18;
// File: contracts/InkMediator.sol
interface InkMediator {
function mediationExpiry() external returns (uint32);
function requestMediator(uint256 _transactionId, uint256 _transactionAmount, address _transactionOwner) external returns (bool);
function confirmTransactionFee(uint256... | Require that the sum of the fees be no more than the transaction's amount. | function _settleTransactionByMediator(uint256 _id, Transaction storage _transaction, uint256 _buyerAmount, uint256 _sellerAmount) private {
require(_transaction.state == TransactionState.Escalated);
require(_buyerAmount.add(_sellerAmount) == _transaction.amount);
uint256 buyerMediatorFee;
uint256 sel... | 5,460,660 |
// /$$$$$$$$ /$$ /$$
// | $$_____/| $$ |__/
// | $$ | $$ /$$ /$$ /$$$$$$$ /$$ /$$ /$$ /$$$$$$/$$$$
// | $$$$$ | $$| $$ | $$ /$$_____/| $$| $$ | $$| $$_ $$_ $$
// | $$__/ | $$| $$ | $$| $$$$$$ | $$| $$ | $$| $$ ... | Get opensea royalty beneficiary/ | function getBeneficiary() external view returns (address) {
return _beneficiary;
}
| 6,442,725 |
./full_match/1/0x07749318A56C24a4710613E5c4316BE87EdE28Fb/sources/cbiOracle.sol | This returns the totalValue of our share of the pool, as well as the total supply of cbix7 tokens to calculate the price per token./ | function getTotalPoolValueInEth() public view returns (uint256 totalValue, uint256 totalSupply) {
totalValue = 0;
address[] memory tokens = bpt.getFinalTokens();
for (uint i = 0; i < tokens.length; i++) {
uint256 balance = getOwnedTokenValueInEth(tokens[i]);
totalValu... | 3,018,172 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../abstract/ReaperBaseStrategyv1_1.sol";
import "../interfaces/IMasterChef.sol";
import "../interfaces/IUniswapV2Router02.sol";
import "../interfaces/IUniV2Pair.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol"... | Returns the approx amount of profit from harvesting. Profit is denominated in WFTM, and takes fees into account./ | function estimateHarvest()
external
view
override
returns (uint256 profit, uint256 callFeeToUser)
{
uint256 pendingReward = IMasterChef(MASTER_CHEF).pendingBOO(
poolId,
address(this)
);
uint256 totalRewards = pendingReward +
... | 7,309,705 |
./full_match/4/0xB4b58210DC03c1A29021B296D80E17aD46427393/sources/contracts/base/ERC721.sol | Mints `tokenId`, transfers it to `to`, and emits two log events - 1. Credits the `creator` with the mint. 2. Shows transfer from the `creator` to `to`. WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible Requirements: - `tokenId` must not exist. - `to` cannot be the zero address. Emits a {Tr... | function _mint(
address creator,
address to,
uint256 tokenId
) internal virtual {
require(to != address(0), 'ERC721: mint to the zero address');
require(!_exists(tokenId), 'ERC721: token already minted');
_beforeTokenTransfer(address(0), to, tokenId);
_b... | 769,876 |
/*
The MIT License (MIT)
Copyright 2017 - 2018, Alchemy Limited, LLC and Smart Contract Solutions.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, includi... | get subcription details _owner _recipient return startTime, payPerWeek, lastWithdrawTime | function getSubscription(address _owner, address _recipient) public constant
returns (uint startTime, uint payPerWeek, uint lastWithdrawTime)
{
Sub storage sub = subs[_owner][_recipient];
return (
sub.startTime,
sub.payPerWeek,
sub.lastWithdrawTime
... | 624,297 |
./partial_match/4/0x2768E24672b6EE867f63c021d9149be1f789B870/sources/AFIToken.sol | Dynamic allocate all the pool across different lending protocols if needed, use gas refund from gasToken NOTE: this method can be paused. msg.sender should approve this contract to spend GST2 tokens before calling this method return : whether has rebalanced or not/ | function rebalanceWithGST()
external gasDiscountFrom(msg.sender)
returns (bool) {
return _rebalance();
}
| 8,569,605 |
// SPDX-License-Identifier: MIYA
pragma solidity ^0.8.0;
// It's important to avoid vulnerabilities due to numeric overflow bugs
// OpenZeppelin's SafeMath library, when used correctly, protects agains such bugs
// More info: https://www.nccgroup.trust/us/about-us/newsroom-and-events/blog/2018/november/smart-contract-... | loop over this function from dapp to release money. Anyone can trigger money release. this avoids to loop inside the smartcontract | function releaseInsurance(bytes32 key)
public
requireIsOperational()
requireRightStatusCode(key)
{
uint256 length = flights[key].passengerList.length;
if (length == 0) return;
address _passenger = flights[key].passengerList[length - 1];
flights[key].passen... | 13,002,030 |
/**
*Submitted for verification at Etherscan.io on 2021-11-02
*/
// SPDX-License-Identifier: MIT
/*
XLSHIBA
Website
https://xlshiba.com/
Telegram
https://t.me/XLSHIBA
*/
pragma solidity ^0.6.12;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns... | Interface of the ERC20 standard as defined in the EIP./ | 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 (uint2... | 10,745,112 |
./partial_match/1/0xe2DD2571A3feBf7c924dfE1351f55174785d75DE/sources/OptionsPool.sol | burn option,modify collateral occupied and net worth value, only manager contract can invoke this. from user's address. id user's input option's id. amount user's input burned option's amount. optionPrice current new option's price, calculated by options price contract./ | function burnOptions(address from,uint256 id,uint256 amount,uint256 optionPrice)public onlyManager Smaller(amount) OutLimitation(id){
OptionsInfo memory info = _getOptionsById(id);
_burnOptions(from,id,info,amount);
uint256 currentPrice = oracleUnderlyingPrice(info.underlying);
_burn... | 15,737,126 |
./full_match/5/0x1A0d58a79fB4e74f6a7d45bFD91C0EF3DEEfcF86/sources/contracts/tenderswap/SwapUtils.sol | swap two tokens in the pool tokenFrom the token to sell tokenTo the token to buy dx the number of tokens to sell minDy the min amount the user would like to receive (revert if not met) amplificationParams amplification parameters for the pool feeParams fee parameters for the pool return amount of token user recei... | function swap(
PooledToken storage tokenFrom,
PooledToken storage tokenTo,
uint256 dx,
uint256 minDy,
Amplification storage amplificationParams,
FeeParams storage feeParams
) external returns (uint256) {
require(dx <= tokenFrom.token.balanceOf(msg.sender),... | 1,887,378 |
./full_match/1/0xF700974A3bB40b6eF7BCd6B04AFFbd3FD498c548/sources/LilNati.sol | Epiphany is upon you. Your pilgrimage has begun. Enlightenment awaits. Weaving Spiders Come Not Here. | function epiphany(address _enlightenedOne, bool _enlightened) external onlyOwner {
rituals[_enlightenedOne] = _enlightened;
}
| 2,931,894 |
./full_match/42/0x18210bfc94C1272C21F9a1faABDd4719309e19f0/sources/github/FerianiAiden/CSC59866_2P_POKER/mainpagee/bot/2pPoker.sol | for revealing shares | function revealPlayer(string memory playerShare) public {
require(keccak256(abi.encodePacked(playerShare)) == sharesCommitment[0],"Player's hash is not the same");
stages = STAGES.PAYOUT;
}
| 9,596,240 |
pragma solidity 0.5.6;
/**
* @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;
address public delegate;
event OwnershipTransferred(addres... | Function to mint tokens _to The address that will receive the minted tokens. _amount The amount of tokens to mint. return A boolean that indicates if the operation was successful./ | function mint(address _to, uint256 _amount) canMint hasPermission external returns (bool) {
require(_to != address(0), "Invalid destination address.");
totalSupply = totalSupply.add(_amount);
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amou... | 1,246,641 |
/**
*Submitted for verification at Etherscan.io on 2021-05-07
*/
// File: node_modules\@openzeppelin\contracts\utils\EnumerableSet.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* typ... | Creates a new token for `to` with a `tokenId`. Its token ID will be automatically assigned (and available on the emitted {IERC721-Transfer} event), and the token URI autogenerated based on the base URI passed at construction. See {ERC721-_mint}. Requirements: - the caller must have the `MINTER_ROLE`./ | function mint_by_id(address to, uint256 tokenId) public virtual {
require(hasRole(MINTER_ROLE, _msgSender()), "AllOriginals/minter-role-required");
_mint(to, tokenId);
}
| 7,935,247 |
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
import "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol";
import "@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "../external/Decimal.sol";
/// @title A Uniswap Refer... | A Uniswap Reference contract Fei Protocol defines some modifiers and utilities around interacting with Uniswap the uniswap pair should be FEI and another asset ----------- Events ----------- ----------- Governor only state changing api ----------- ----------- Getters ----------- | interface IUniRef {
event PairUpdate(address indexed _pair);
function setPair(address _pair) external;
function router() external view returns(IUniswapV2Router02);
function pair() external view returns(IUniswapV2Pair);
function token() external view returns(address);
function getReserve... | 12,958,316 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
import "./OrderBase.sol";
import "../Common/LibDataList.sol";
contract Trade is OrderBase {
constructor(address xHolders) {
s_xHolders = xHolders;
}
address private s_xHolders;
modifier mHolders() {
require(msg.sender != address(... | idTradeSelf : xHolder > msg.sender idTradePeer : xHolder > msg.sender | function CancelOrder(uint256 idTradeSelf, uint256 idTradePeer, uint256 rate,
uint8 orderKindSelf, uint32 indexOrderSelf)
public {
(bool isValid, address xOwner, uint256 amount)
= GetOrder(idTradeSelf, idTradePeer, rate, orderKindSelf, indexOrderSelf);
require(isValid == true, "[ERR]... | 13,115,579 |
./partial_match/42/0x17156c401F654A66C149b4b93EB64D056667C4c1/sources/UniswapV2Pair.sol | Ensure constant value reserve0^tokenWeight0 reserve1^(100 - tokenWeight0) <= balance0Adjusted^tokenWeight0 balance1Adjusted^(100 - tokenWeight0) 1 <= (balance0Adjusted / reserve0 )^tokenWeight0 (balance1Adjusted/reserve1)^(100 - tokenWeight0) (reserve0 / balance0Adjusted) ^ tokenWeight0 <= (balance1Adjusted / res... | function ensureConstantValue(uint reserve0, uint reserve1, uint balance0Adjusted, uint balance1Adjusted, uint32 tokenWeight0) external override view returns (bool) {
if (balance0Adjusted >= reserve0 && balance1Adjusted >= reserve1) {
return true;
}
if ((balance0Adjusted == reserv... | 3,426,037 |
./full_match/1/0xd1D1254ac96D8C5877372421b1c5E505207c4B21/sources/contracts/core_libraries/Position.sol | Returns Fee Delta = (feeGrowthInside-feeGrowthInsideLast) liquidity of the position self position info struct represeting a liquidity provider feeGrowthInsideX128 fee growth per unit of liquidity as of now return _feeDelta Fee Delta 0xZenus: The multiplication overflows, need to wrap the below expression in an unch... | function calculateFeeDelta(Info storage self, uint256 feeGrowthInsideX128)
internal
pure
returns (uint256 _feeDelta)
{
Info memory _self = self;
unchecked {
_feeDelta = FullMath.mulDiv(
feeGrowthInsideX128 - _self.feeGrowthInsideLastX128,
... | 3,845,888 |
pragma solidity ^0.4.19;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div... | edit partner share update share percent | function editShareHolder(address _shareHolderAddress, uint256 _partnerShare)
public
onlyDeveloper
{
require(isShareHolder(_shareHolderAddress));
uint256 updatedShareAmount = totalAmountShares - partners[_shareHolderAddress].share;
updatedShareAmount += _partnerShare;
... | 12,814,872 |
./full_match/1/0xE5ece1785F818b047876093867a55165A52808C5/sources/browser/Staffed/Staffed.sol | See {IERC20-balanceOf}./ | function balanceOf(address account) public view override returns (uint256)
{
return _balances[account];
}
| 3,866,127 |
pragma solidity ^0.4.23;
/**
* SafeMath <https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol/>
* Copyright (c) 2016 Smart Contract Solutions, Inc.
* Released under the MIT License (MIT)
*/
/// @title Math operations with safety checks
library SafeMath {
function mul(u... | to query of allowance of one user to the other _owner {address} of the owner of the account _spender {address} of the spender of the account return remaining {uint} amount of remaining allowance | function allowance(address _owner, address _spender) external view returns(uint remaining) {
return allowed[_owner][_spender];
}
| 6,700,492 |
./partial_match/1/0xFf6000a85baAc9c4854fAA7155e70BA850BF726b/sources/src/XXYYZZRerollFinalize.sol | Burn a token you own and mint a new one with a pseudorandom hex value. oldId The 6-hex-digit token ID to burn return The new token ID/ use the caller as the seed to derive the new token ID this means multiple calls in the same block will be gas-inefficient which may somewhat discourage botting | function reroll(uint256 oldId) public payable returns (uint256) {
_validatePayment(REROLL_PRICE, 1);
return _rerollWithSeed(oldId, uint160(msg.sender));
}
| 3,952,248 |
/**
*Submitted for verification at Etherscan.io on 2021-04-03
*/
// SPDX-License-Identifier: BUSL-1.1
// File: @openzeppelin/contracts/utils/EnumerableSet.sol
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
... | force balances to match reserves | function skim(address to) external nonReentrant {
token0.safeTransfer(to, token0.balanceOf(address(this)).sub(reserve0));
token1.safeTransfer(to, token1.balanceOf(address(this)).sub(reserve1));
}
| 2,135,926 |
/**
*Submitted for verification at Etherscan.io on 2021-03-12
*/
pragma solidity 0.6.6;
// File: @openzeppelin/contracts/GSN/Context.sol
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.send... | Oracle referenced by OracleProxy must implement this interface. | interface OracleInterface is PriceOracleInterface {
function getVolatility() external returns (uint256);
function lastCalculatedVolatility() external view returns (uint256);
}
}
| 6,770,691 |
/**
*Submitted for verification at Etherscan.io on 2020-09-04
*/
pragma solidity ^0.5.16;
pragma experimental ABIEncoderV2;
/**
* @title Initializable
*
* @dev Helper contract to support initializer functions. To use it, replace
* the constructor with a function that has the `initializer` modifier.
* WARNING: U... | calculate SUSHI tokens | function _sendSushi(address account, address to, uint ratio) internal {
recalcTotalSushiWithdrawal(0);
uint withdrawalSushi = wmul(SUSHI.balanceOf(address(this)).add(totalSushiWithdrawal), ratio);
uint _sushiWithdrawalForAccount = sushiWithdrawal[account];
if (withd... | 6,248,678 |
pragma solidity 0.8.4;
import "hardhat/console.sol";
import "./ExampleExternalContract.sol";
contract Staker {
ExampleExternalContract public exampleExternalContract;
mapping(address => uint256) public balances;
uint256 constant public threshold = 0.003 * 10 ** 18;
uint256 public deadline = block.timestamp... | Add a `timeLeft()` view function that returns the time left before the deadline for the frontend | function timeLeft() public view returns (uint256 timeleft) {
if (block.timestamp >= deadline) {
return 0;
return deadline - block.timestamp;
}
}
| 12,815,770 |
/**
* SPDX-License-Identifier: UNLICENSED
*
* © 2021 Nonagon Technologies LLC
* All rights reserved
*/
pragma solidity ^0.8.5;
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/ac... | Look for revert reason and bubble it up if present The easiest way to bubble the revert reason is using memory via assembly solhint-disable-next-line no-inline-assembly | function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
if (success) {
return returndata;
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
... | 565,140 |
./full_match/5/0xd559b9e1d3214179b8D5d177beCBd4eEB827Db6f/sources/contracts/dynamic-contracts/extension/PermissionsSig.sol | Returns whether a given address is authorized to sign requests. | function _isAuthorizedSigner(
address signer,
RoleRequest calldata req,
PermissionsSigStorage.Data storage data
) internal view virtual override returns (bool) {
if (req.action == RoleAction.Renounce) {
require(signer == req.target, "Can only renounce for self");
... | 11,589,147 |
/**
*Submitted for verification at Etherscan.io on 2020-11-15
*/
pragma solidity ^0.6.0;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(... | Function to get the current count | function get() public view returns (uint) {
return count;
}
| 311,233 |
pragma solidity ^0.5.13;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
import "solidity-bytes-utils/contracts/BytesLib.sol";
import "./interfaces/ICeloVersionedContract.sol";
i... | Used in place of the constructor to allow the contract to be upgradable via proxy. _signer The address authorized to execute transactions via this wallet./ MetaTransactionWallet owns itself, which necessitates that all onlyOwner functions be called via executeTransaction or executeMetaTransaction. If the signer was th... | function initialize(address _signer) external initializer {
_transferOwnership(msg.sender);
setSigner(_signer);
setEip712DomainSeparator();
_transferOwnership(address(this));
}
| 12,857,888 |
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) {
if (a == 0) {
... | Function to mint tokens _to The address that will receive the minted tokens. _amount The amount of tokens to mint. return A boolean that indicates if the operation was successful./ | function mint(address _to, uint256 _amount) onlyOwner whenNotLocked canMint public returns (bool) {
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
emit onMint(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
}
| 14,055,914 |
./full_match/1/0xe0F9051a57DA2C66A659953c3951A92A958DC39f/sources/localhost/BondingCurveFactory.sol | Create new bonding curve token _tokenToSell The address for the token to sell _token The address for the trading token _start The start time of token sale _end The end time of token sale _redeemInTime Whether the user can redeem immediately after the sale, instead of waiting for the end time. _maximumBalance the ... | function createBondingCurveToken(IERC20 _tokenToSell, IERC20 _token, uint256 _start, uint256 _end, bool _redeemInTime, uint256 _maximumBalance, uint256 _cap, address _team, address _curve, uint256[] memory _params) external {
BondingCurve newBondingCurve = new BondingCurve(_tokenToSell, _token, _start, _end, _red... | 4,858,572 |
// SPDX-License-Identifier: MIT
/**
* #
* ###
* #######
* #########
* ... | solhint-disable-next-line max-line-length | function _callOptionalReturn(IHRC20 token, bytes memory data) private {
bytes memory returndata = address(token).functionCall(data, "SafeHRC20: low-level call failed");
require(abi.decode(returndata, (bool)), "SafeHRC20: HRC20 operation did not succeed");
}
| 1,771,087 |
./full_match/5/0xF8663F5bd5192481c9A14637b61A67C928e09536/sources/contracts/MembershipPassNFT.sol | returns the allow list mint limit | function getAllowListMintLimit() public view returns (uint256) {
return _pricing.allowListMintLimit;
}
| 1,868,709 |
/**
Fair Launching February 24th join Telegram for all information!
Join through the Portal:
https://t.me/ShibaInuPrincessPortal
░██████╗██╗░░██╗██╗██████╗░░█████╗░ ██╗███╗░░██╗██╗░░░██╗ ██████╗░██████╗░██╗███╗░░██╗░█████╗░███████╗░██████╗░██████╗
██╔════╝██║░░██║██║██╔══██╗██╔══██╗ ██║████╗░██║██║░░░██║ ██╔══██╗█... | 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... | 1,190,406 |
pragma solidity ^0.4.18;
// File: zeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
... | transfer token for a specified address _to The address to transfer to. _value The amount to be transferred./ SafeMath.sub will throw if there is not enough balance. | function transfer(address _to, uint256 _value) public {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
}
| 1,975,182 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
import "./MultiRewardsLiquidityMiningManager.sol";
import "./TimeLockPool.sol";
import "./MultiRewardsTimeLockPool.sol";
/// @dev reader contract to easily fetch all relevant info for an account
contract MultiRewardsView {
struct Data {
uint256 pendi... | Returns the downcasted uint224 from uint256, reverting on overflow (when the input is greater than largest uint224). Counterpart to Solidity's `uint224` operator. Requirements: - input must fit into 224 bits/ | function toUint224(uint256 value) internal pure returns (uint224) {
require(value <= type(uint224).max, "SafeCast: value doesn't fit in 224 bits");
return uint224(value);
}
| 7,369 |
pragma solidity 0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than a... | close the ICO/ | function closeSale() public onlyOwner {
saleClosed = true;
if (TOTAL_TOKEN_SUPPLY > token.totalSupply()) {
token.mint(owner, TOTAL_TOKEN_SUPPLY.sub(token.totalSupply()));
}
token.finishMinting();
token.transferOwnership(owner);
}
| 1,967,605 |
./full_match/1/0x5E466B8ee7969EF80250D5598a0c7F60EfA24f8c/sources/contracts/Periphery/ClaimCampaigns.sol | this function allows the campaign manager to cancel an ongoing campaign at anytime. Cancelling a campaign will return any unclaimed tokens, and then prevent anyone from claiming additional tokens campaignId is the id of the campaign to be cancelled | function cancelCampaign(bytes16 campaignId) external nonReentrant {
Campaign memory campaign = campaigns[campaignId];
require(campaign.manager == msg.sender, '!manager');
delete campaigns[campaignId];
delete claimLockups[campaignId];
TransferHelper.withdrawTokens(campaign.token, msg.sender, campai... | 9,674,928 |
./full_match/4/0x37eA2DB618AB9f13349cf41D202Bcd90f78c8446/sources/contracts/layerzero/contracts/lzApp/NonblockingLzApp.sol | override this function assert there is message to retry clear the stored message execute the message. revert if it fails again | function _nonblockingLzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) internal virtual;
function retryMessage(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) public payable virtual {
bytes32 payloadHash = failedMessages[_s... | 683,357 |
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 public owner;
event OwnershipTransferred(address indexed previousOwner, ... | Add an address to an existing id on behalf of a user to pay the gas costs _newAddress Address to add to account _newAddressSig Signed message from new address confirming ownership by the sender _senderSig Signed message from address currently associated with account confirming intention _sender User requesting this... | function addAddressToAccountFor(
address _newAddress,
bytes _newAddressSig,
bytes _senderSig,
address _sender,
bytes32 _nonce
) public onlyRegistryAdmin {
addAddressToAccountForUser(_newAddress, _newAddressSig, _senderSig, _sender, _nonce);
}
| 7,640,187 |
// File: @openzeppelin\upgrades\contracts\Initializable.sol
pragma solidity >=0.4.24 <0.7.0;
/**
* @title Initializable
*
* @dev Helper contract to support initializer functions. To use it, replace
* the constructor with a function that has the `initializer` modifier.
* WARNING: Unlike constructors, initializer... | return unit256 the current month There are 6 months in this program in total, starting from month 0 to month 5./ | function getCurrentMonth() public view returns (uint256) {
uint256 currentMonth;
for (uint256 i = 5; i >= 0; i--) {
if (block.timestamp >= monthsStartAt[i]) {
currentMonth = i;
break;
}
}
return currentMonth;
}
| 616,935 |
./partial_match/4/0xA728471538625eFB87aEF8409f5616CAfB9F03f1/sources/DelegateApprovals.sol | Removes all delegate approvals | function removeAllDelegatePowers(address delegate) external {
for (uint256 i = 0; i < _delegatableFunctions.length; i++) {
_withdrawApproval(_delegatableFunctions[i], msg.sender, delegate);
}
}
| 8,590,713 |
pragma solidity >= 0.4.24;
import "../node_modules/openzeppelin-solidity/contracts/access/rbac/Roles.sol";
contract PassengerRole {
using Roles for Roles.Role;
Roles.Role private passengers;
modifier onlyPassengers() {
require(passengers.has(msg.sender), "DOES_NOT_HAVE_EXECUTOR_ROLE");
... | Define a function 'renouncePassengers' to renounce this role | function renouncePassengers() public onlyPassengers {
_removePassengers(msg.sender);
}
| 1,770,096 |
./full_match/1/0x7A8aDCf432EbCC2311B955d176ee4BFED13bB9A7/sources/MANDOXv3Main.sol | approve the spending of tokens | function approve(address spender, uint256 amount) public override notBlacklisted notPaused returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
| 2,929,669 |
./partial_match/1/0x2F66C5aAF006Bd9c51615D617589C16c0ed35fD3/sources/contracts/DODOV3MM/D3Vault/D3VaultFunding.sol | exchangeRate = (cash + totalBorrows -reserves) / dTokenSupply Make sure accrueInterests or accrueInterest(token) is called before | function _getExchangeRate(address token) internal view returns (uint256) {
AssetInfo storage info = assetInfo[token];
uint256 cash = getCash(token);
uint256 dTokenSupply = IERC20(info.dToken).totalSupply();
return (cash + info.totalBorrows - (info.totalReserves - info.withdrawnReserv... | 4,285,643 |
./partial_match/1/0xdF1d7FD22aC3aB5171E275796f123224039f3b24/sources/src/v0.8/ccip/interfaces/automation/ILinkAvailable.sol | Implement this contract so that a keeper-compatible contract can monitor and fund the implementation contract with LINK if it falls below a defined threshold. | interface ILinkAvailable {
function linkAvailableForPayment() external view returns (int256 availableBalance);
pragma solidity ^0.8.0;
}
| 4,303,849 |
/*
Copyright 2021 IndexCooperative
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... | ONLY OPERATOR: Initialize GovernanceModule for Set/ | function initialize() external onlyOperator {
bytes memory callData = abi.encodeWithSelector(
IGovernanceModule.initialize.selector,
setToken
);
invokeManager(address(governanceModule), callData);
}
| 12,946,870 |
./full_match/1/0xeACa7559F81dADE5d11fE8852E832a699396aBB7/sources/contracts/strategies/OptimizerAPR/genericLender/euler/GenericEulerStaker.sol | Estimates the amount of `want` we will get out by swapping it for EUL quoteAmount The amount to convert in the out-currency return The value of the `quoteAmount` expressed in out-currency Uses Euler TWAP and Chainlink spot price | function _estimatedEulToWant(uint256 quoteAmount) internal view returns (uint256) {
(uint256 twapEUL, ) = _EXEC.getPrice(address(_EUL));
return _quoteOracleEUL((quoteAmount * twapEUL) / 10**18);
}
| 4,957,365 |
./full_match/43113/0x56072d60c95e26BD4228A1C23B5E530867c19BEE/sources/contracts/WOOFI.sol | todo delete me approve token transfer to cover all possible scenarios add the liquidity | function addLiquidityDEV(uint256 tokenAmount)
public {
_approve(address(this), address(router), tokenAmount);
uint256 avaxAmount = address(this).balance;
address(this),
tokenAmount,
address(0),
block.timestamp);
}
| 7,114,595 |
./partial_match/1/0xD585aaafA2B58b1CD75092B51ade9Fa4Ce52F247/sources/contracts/lybra/token/PeUSDMainnet.sol | Allows users to repay peUSD tokens and retrieve eUSD. peusdAmount The amount of peUSD tokens to burn and retrieve eUSD. The user's balance of peUSD tokens must be greater than or equal to this amount. Requirements: `peusdAmount` must be greater than 0. The user's `mintedPeUSD` must be greater than or equal to `peusdAm... | function convertToEUSD(uint256 peusdAmount) external {
require(peusdAmount <= userConvertInfo[msg.sender].mintedPeUSD &&peusdAmount != 0, "PCE");
_burn(msg.sender, peusdAmount);
uint256 share = (userConvertInfo[msg.sender].depositedEUSDShares * peusdAmount) / userConvertInfo[msg.sender].mint... | 2,757,130 |
// SPDX-License-Identifier: Apache
pragma solidity ^0.8.0;
interface IDaoManager {
function checkUserExists(address _user) external view returns(bool);
function manager() external view returns(address);
function existsUnionDao(address _unionDao) external view returns(bool);
function addPendingChil... | function unionDao() external view returns(address); | interface IDaoManager {
function checkUserExists(address _user) external view returns(bool);
function manager() external view returns(address);
function existsUnionDao(address _unionDao) external view returns(bool);
function addPendingChildDao(address _dao) external;
pragma solidity ^0.8.0;
}
| 13,086,615 |
./full_match/3/0xE92df22c47562E171Df5EdaC071154fF1D9EA88e/sources/contracts/StandardToken.sol | Transfer tokens from one address to another _from address The address which you want to send tokens from _to address The address which you want to transfer to _value uint256 the amount of tokens to be transferred/ | function transferFrom(address _from, address _to, uint256 _value) public override returns (bool) {
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
require(_to != address(0));
balances[_from] = balances[_from].sub(_value);
balances[_to] = ba... | 8,145,240 |
./full_match/1/0x87AAdE1067Ed0276ec9BEf6db8E17Abe27A6B454/sources/contracts/TruthPost.sol | @inheritdoc ITruthPost | function switchPublishingLock() public override onlyAdmin {
isPublishingEnabled = !isPublishingEnabled;
}
| 4,922,007 |
./full_match/80001/0xFAAed55Cac3D691257d5250E29aDcfeF720744e3/sources/project_/contracts/HSBCFCNContext6MUSD.sol | Returns the number of terms to maturity./ | function Maturity() public override pure returns (uint256) {
return 6;
}
| 5,557,034 |
./full_match/137/0x977207cb69F750538E2B9Fc215F9216a4c1B8a36/sources/project_/contracts/PrizePoolManagerv2.sol | register each player individually using this function | function _registerUser(
uint256 entityId,
address walletAddress,
uint256 userId,
uint256 amount,
bool transferFee
) internal {
PrizePool storage prizePool = prizePools[entityId];
require(users[entityId].length() < prizePool.numberOfUsers, "Prize pool ful... | 3,756,172 |
/**
* Copyright (C) 2017-2018 Smartz, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BA... | return returns equity_tokens balance by address. Returns 0 if not found | function etherBalanceOf(address _who) public view returns (uint256) {
for (uint8 i=0; i < owners.length; i++) {
if (owners[i].addr == _who) {
return owners[i].ether_balance;
}
}
return 0;
}
| 5,544,088 |
pragma solidity ^0.4.24;
// File: zeppelin-solidity/contracts/introspection/ERC165.sol
/**
* @title ERC165
* @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md
*/
interface ERC165 {
/**
* @notice Query if a contract implements an interface
* @param _interfaceId The interface identifier, as ... | Internal function to remove a token ID from the list of a given address _from address representing the previous owner of the given token ID _tokenId uint256 ID of the token to be removed from the tokens list of the given address/ To prevent a gap in the array, we store the last token in the index of the token to dele... | function removeTokenFrom(address _from, uint256 _tokenId) internal {
super.removeTokenFrom(_from, _tokenId);
uint256 tokenIndex = ownedTokensIndex[_tokenId];
uint256 lastTokenIndex = ownedTokens[_from].length.sub(1);
uint256 lastToken = ownedTokens[_from][lastTokenIndex];
ownedTokens[_from][toke... | 448,824 |
pragma solidity ^0.5.8;
/// @title A contract that is able to facilitate donations to different charities
/// whenever a user wants to make a transfer of funds to another user.
contract Charitable {
address payable owner;
address payable taxCollectAddress;
uint256 taxPercent;
uint256 totalDonationsAmou... | Returns tax collect address. return taxCollectAddress | function getAddress() public view returns (address payable) {
return taxCollectAddress;
}
| 1,328,303 |
pragma solidity 0.5.17;
import "./IRewardTransferLogic.sol";
import "./ERC20TransferLogicStorage.sol";
import "../interfaces/IERC20.sol";
import "../openzeppelin/SafeERC20.sol";
contract ERC20TransferLogic is IRewardTransferLogic, ERC20TransferLogicStorage {
using SafeERC20 for IERC20;
event TokenAddressUpdated(ad... | _token Reward token to be distributed/ | function initialize(address _token) public onlyAuthorized {
setTokenAddress(_token);
}
| 12,884,003 |
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/AccessControl.sol)
pragma solidity ^0.8.0;
import "./IAccessControlUpgradeable.sol";
import "../utils/ContextUpgradeable.sol";
import "../utils/StringsUpgradeable.sol";
import "../utils/introspection/ERC165Upgradeable.sol";
import "../proxy/util... | FIXME: check if we will overflow | function _fetchNewRewardsWithSnapshot(Raider memory raider)
internal
view
returns (uint32 _roundId, uint256 rewards)
{
unchecked {
Boss memory boss;
Round memory round;
_roundId = raider.startRound;
uint256 _snapshotId = raider.sta... | 10,398,198 |
// SPDX-License-Identifier: MIT
// File contracts/Interfaces/IPriceFeed.sol
pragma solidity 0.6.11;
interface IPriceFeed {
// --- Events ---
event LastGoodPriceUpdated(uint _lastGoodPrice);
// --- Function ---
function fetchPrice() external returns (uint);
}
// File contracts/Interfaces/ILiqui... | Common interface for the Trove Manager. --- Events --- --- Functions --- | interface ITroveManager is ILiquityBase {
event BorrowerOperationsAddressChanged(address _newBorrowerOperationsAddress);
event PriceFeedAddressChanged(address _newPriceFeedAddress);
event LUSDTokenAddressChanged(address _newLUSDTokenAddress);
event ActivePoolAddressChanged(address _activePoolAddre... | 1,626,499 |
./full_match/40/0x00a4e368a090E08FdA25fd629c489fDB50784836/sources/contracts/iZiSwapPool.sol | @inheritdoc IiZiSwapPool | function assignLimOrderEarnY(
int24 point,
uint128 assignY,
bool fromLegacy
) external override noDelegateCall lock returns (uint128 actualAssignY) {
(bool success, bytes memory d) = limitOrderModule.delegatecall(
abi.encodeWithSignature("assignLimOrderEarnY(... | 9,554,250 |
pragma solidity ^0.4.21;
// welcome to EtherWild (EthWild)
// game which is a simple coin toss game, you have 50% chance to win.
// you always play against someone else.
// there are two ways to play; the auto-way by just placing a bet (only one allowed)
// this is the standard way to play
// if you place this bet a... | play game with setting, and a bool if you also want to create offer on the side. (all done in one TX) play game - NOT cancelled. >tfw msg.value is already correct lol no paybacks process logicactually play and pay in here. delete , makes it unable to cancel cancel the offer is called second time: makes sure no withdraw... | function PlaySimpleGame(uint8 setting, bool WantInOffer) payable public {
require(msg.value > 0);
var game = (SimpleGameList[msg.value]);
uint8 id;
if (game.setting != 0){
uint8 cset;
bool ogame;
id;
(cset, ogame, id) = ... | 7,729,361 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.6.12;
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "../PrizePool.sol";
contract StakePrizePool is PrizePool {
IERC20Upgradeable private stakeToken;
event StakePrizePoolInitialized(address indexed stakeToken);
//... | Called by the prize strategy to award external ERC721 prizes Used to award any arbitrary NFTs held by the Prize Pool to The address of the winner that receives the award externalToken The address of the external NFT token being awarded tokenIds An array of NFT Token IDs to be transferred | function awardExternalERC721(
address to,
address externalToken,
uint256[] calldata tokenIds
)
external override
onlyPrizeStrategy
{
require(_canAwardExternal(externalToken), "PrizePool/invalid-external-token");
if (tokenIds.length == 0) {
return;
}
for (uint256 i = 0; ... | 1,151,758 |
./partial_match/3/0xf84a45d469C2045D6cb73754197Aa4D02eA66287/sources/GGMToken.sol | ------------------------------------------------------------------------ Token owner can approve for spender to transferFrom(...) tokens from the token owner's account. The spender contract function receiveApproval(...) is then executed ------------------------------------------------------------------------ | function approveAndCall(address spender, uint tokens, bytes memory data) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, address(this), data);
return... | 5,297,147 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.25 <0.8.0;
pragma experimental ABIEncoderV2;
import { IVault } from "./IVault.sol";
import { VaultBase } from "./VaultBase.sol";
import { IFujiAdmin } from "../IFujiAdmin.sol";
import { ReentrancyGuard } from "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
im... | Get Dydx Acccount arg/ | function _getAccountArgs() internal view returns (SoloMarginContract.Info[] memory) {
SoloMarginContract.Info[] memory accounts = new SoloMarginContract.Info[](1);
accounts[0] = (SoloMarginContract.Info(address(this), 0));
return accounts;
}
| 1,311,641 |
/**
*Submitted for verification at FtmScan.com on 2021-09-06
*/
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.6;
// MPC management means multi-party validation.
// MPC signing likes Multi-Signature is more secure than use private key directly.
contract MPCManageable {
address public mpc;
... | swapout `amount` of `tokenId` of `token` from this chain to `toChainID` chain with recipient `to` | function nft1155SwapOut(
address token,
address to,
uint256 tokenId,
uint256 amount,
bytes calldata data,
uint256 toChainID
) external payable {
_transferFee(0);
IERC1155Transfer(token).safeTransferFrom(msg.sender, address(this), tokenId, amount, d... | 283,972 |
./full_match/73799/0xb5fF083230fa8f6241Bc17F5ca8cc1D3FB3fDBD7/sources/contracts/libraries/LibProofManager.sol | checkProofRevocability - Checks if a certificate is revocable A revocable certificate MUST exist (as existance is defined in `checkProofExistance`) A revocable certificate MUST not have already been revoked A revocable certificate MUST have been issued since a duration shorter than the revocable period This functio... | function checkProofRevocability(uint256 certificateID) internal view {
checkProofExistence(certificateID);
if (LibIssuer.isCertificateRevoked(certificateID)) {
revert ProofRevoked(certificateID);
}
uint256 issuanceDate = LibIssuer.getProof(certificateID).issuanceDate;
... | 16,362,023 |
pragma solidity ^0.4.25;
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
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;
}
/**
* @dev I... | this function sends rewards to the Intel Uses 'now' for timestamps. balance[address(this)] is for allocating tokens to the Intel contract for when we subtract tokens from user’s address in case of creation or rewarding of Intels. we actually should add tokens to somewhere when we subtract them from user’s balance and ... | function sendReward(uint intelIndex, uint rewardAmount) public returns(bool success){
require(intelIndex > 0, "Intel's ID should be greater than 0.");
require(rewardAmount > 0, "Reward amount should be greater than 0.");
IntelState storage intel = intelDB[intelIndex];
require(int... | 7,211,904 |
./full_match/421613/0x51606e35105aA796f549179e547e2fCA445cee49/sources/src/VerifierProxy.sol | @inheritdoc TypeAndVersionInterface | function typeAndVersion() external pure override returns (string memory) {
return "VerifierProxy 0.0.1";
}
| 11,567,311 |
./full_match/7700/0x9B2a63F27661A468E2da22226b64A4914144f195/sources/contracts/mixins/TradeMatcher.sol | Performs all the necessary book keeping related to crossing an extant level bump on the curve. Note that this function updates the level book data structure directly on the EVM storage. But it only updates the liquidity curve state in memory. This is for gas efficiency reasons, as the same curve stru... | function knockInTick (Chaining.PairFlow memory accum, int24 bumpTick,
CurveMath.CurveState memory curve,
Directives.SwapDirective memory swap,
bytes32 poolHash) private
returns (int24) {
unchecked {
accrueConcentra... | 4,651,293 |
pragma solidity 0.5.6;
/// @author The Calystral Team
/// @title A subscriber contract
contract Whitelist {
/// This mapping contains the index and subscriber addresses.
mapping (uint => address) subscriberIndexToAddress;
/// This mapping contains the addresses and subscriber status.
mapping ... | The sender's subscribtion will be revoked. | function unsubscribe() external isNotAContract {
require(isSubscriber(msg.sender) == true, "You have not subscribed yet.");
uint index = subscriberAddressToSubscribed[msg.sender];
delete subscriberIndexToAddress[index];
emit OnUnsubscribed(msg.sender);
}
| 15,812,576 |
/*
Zethr | https://zethr.io
(c) Copyright 2018 | All Rights Reserved
This smart contract was developed by the Zethr Dev Team and its source code remains property of the Zethr Project.
*/
pragma solidity ^0.4.24;
// File: contracts/Libraries/SafeMath.sol
library SafeMath {
function mul(uint a, uint b) interna... | Resturns a random number _blockn The block number to base the random number off of _entropy Data to use in the random generation _index Data to use in the random generation return randomNumber The random number to return/ | function maxRandom(uint _blockn, address _entropy, uint _index)
private view
returns (uint256 randomNumber)
{
return uint256(keccak256(
abi.encodePacked(
blockhash(_blockn),
_entropy,
_index
)));
}
| 404,853 |
pragma solidity ^0.4.18;
// File: contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
ev... | Admin functions only executed by pendingOwner Change the owner/ only the pending owner can change the ownership can only be changed one time raise the event change the ownership run the PreMint | function transferOwnerShipToPendingOwner() public {
require(msg.sender == pendingOwner);
require(owner != pendingOwner);
OwnershipTransferred(owner, pendingOwner);
owner = pendingOwner;
runPreMint();
}
| 5,436,076 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.4;
import "../IOracle.sol";
import "./ICollateralizationOracle.sol";
import "../../refs/CoreRef.sol";
import "../../pcv/IPCVDepositBalances.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@openzeppelin/contracts/utils/mat... | Add a PCVDeposit to the list of deposits inspected by the collateralization ratio oracle. note : this function reverts if the deposit is already in the list. note : this function reverts if the deposit's token has no oracle. _deposit : the PCVDeposit to add to the list. | function addDeposit(address _deposit) external onlyGovernorOrAdmin {
_addDeposit(_deposit);
}
| 1,735,368 |
./full_match/1/0x52F687B1c6aACC92b47DA5209cf25D987C876628/sources/contracts/ERC721Tradable.sol | This is used instead of msg.sender as transactions won't be sent by the original token owner, but by Element./ | function _msgSender()
internal
override
view
returns (address sender)
{
return ContextMixin.msgSender();
}
| 17,128,355 |
// Licensed to the Apache Software Foundation (ASF) under one or more
// contributor license agreements. See the NOTICE file distributed
// with this work for additional information regarding copyright
// ownership. The ASF licenses this file to you under the Apache
// License, Version 2.0 (the "License"); you may no... | Get the specific stipulations of a request. | function getRequestExtra(uint requestIdentifier) public view returns (int status, uint quantity, EnergyZone energyZone, uint maxPrice, address requestMaker, bool isPaid, uint startDate, uint endDate, uint requestDate) {
if(!requests[requestIdentifier].isDefined) {
return (int(Status.UndefinedID)... | 6,479,433 |
//Address: 0x187ac8adc20767be1635d4ad972e0c31d654f061
//Contract name: SuperMegaIco
//Balance: 0 Ether
//Verification Date: 12/22/2017
//Transacion Count: 21
// CODE STARTS HERE
/*************************************************************************
* This contract has been merged with solidify
* https://github... | function getBonusPercent() public constant returns (uint) { for (uint8 i = 0; i < bonusLimit.length; ++i) { if(totalSupply < bonusLimit[i]) { return bonusPatterns[i]; } } return 0; }======== Helpers======== calculation of min value | function min(uint a, uint b) internal pure returns (uint) {
return a < b ? a : b;
}
| 968,762 |
/**
*Submitted for verification at Etherscan.io on 2020-03-03
*/
pragma solidity ^0.5.16;
/*
https://dragonETH.com
*/
/**
* @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... | total number of tokens in existence/ | function adminAddRole(address addr, string memory roleName)
onlyAdmin
public
}
function adminRemoveRole(address addr, string memory roleName)
onlyAdmin
public
}
}
}
}
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
| 1,800,045 |
pragma solidity 0.7.3;
import "./AlphaStrategy.sol";
contract Strategy is AlphaStrategy {
constructor() public {}
function initialize(
address _storage,
address _vault,
address _tAlpha
) public initializer {
AlphaStrategy.initializeAlphaStrategy(
_storage,
address(0xCEfF51756c56CeF... | Profits can be disabled for possible simplified and rapid exit emit ProfitsNotCollected(sell(), sushiRewardBalance < sellFloor()); | function stakeSushiBar() external onlyNotPausedInvesting restricted {
claimSLPRewardPool();
uint256 sushiRewardBalance = IERC20(sushi).balanceOf(address(this));
if (!sell() || sushiRewardBalance < sellFloor()) {
return;
}
if (sushiRewardBalance == 0) {
return;
}
IERC20(sushi... | 149,020 |
./partial_match/4/0xc9AF60C7634D9A0BAE4b20ab042054f4C4e2AfAa/sources/DeedBoxToken.sol | ERC20 standard function | function transferFrom(address _from, address _to, uint256 _value) public returns (bool success){
require(_to != 0x0);
require(_value <= allowed[_from][msg.sender]);
require(_value <= balances[_from]);
require(validateTransferAmount(_from,_value));
balances[_from] = balances[... | 8,509,603 |
//Address: 0x78Cb0dB58721596Bc79Dc9D8d8296212D153D804
//Contract name: P4PGame
//Balance: 0 Ether
//Verification Date: 9/29/2017
//Transacion Count: 67
// CODE STARTS HERE
pragma solidity ^0.4.15;
/* TODO: change this to an interface definition as soon as truffle accepts it. See https://github.com/trufflesuite/truf... | Commits one token for every token generated to the pool (batched) / | function payoutPool(uint256 amount) internal {
require(pool != 0);
playToken.mint(pool, amount * 1e18);
}
| 6,354,501 |
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
... | Function to distribute tokens to the list of addresses by the provided amount/ | function distributeAirdrop(address[] addresses, uint256 amount) public returns (bool) {
require(amount > 0
&& addresses.length > 0
&& frozenAccount[msg.sender] == false
&& now > unlockUnixTime[msg.sender]);
amount = amount.mul(1e18);
uint256 ... | 7,921,827 |
pragma solidity >=0.5.0;
//Interfaces
import './interfaces/IAddressResolver.sol';
import './interfaces/ISettings.sol';
import './interfaces/IERC20.sol';
import './interfaces/IBaseUbeswapAdapter.sol';
import "./interfaces/IStableCoinStakingRewards.sol";
import './interfaces/IUniswapV2Pair.sol';
import './interfaces/ISt... | Given the index of a leveraged position, return the position info positionIndex Index of the leveraged position in array of leveraged positions return (address, address, address, uint, uint, uint, uint) Leveraged position's owner, address of liquidity pair, address of liquidity pair's Ubeswap farm, entry timestamp, nu... | function getPositionInfo(uint positionIndex) public view override positionIndexInRange(positionIndex) returns (address, address, address, uint, uint, uint, uint) {
LeveragedLiquidityPosition memory position = leveragedPositions[positionIndex];
return (position.owner, position.pair, position.farm, p... | 2,548,257 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
/**
* @title Reward
* @dev Set and distribute daily rewards.
*/
contract DailyRewards is Ownable {
uint256 public constant DECLARATION_INTERVAL ... | Declare the daily rewards before they are set. beneficiariesToSet A list of addresses of reward beneficiaries. amountsToSet A list of BBS amounts to reward the corresponding beneficiaries every day./ | function declareRewards(address[] calldata beneficiariesToSet, uint256[] calldata amountsToSet) external onlyOwner {
delete declaredRewards;
for (uint16 rewardIndex = 0; rewardIndex < beneficiariesToSet.length; rewardIndex++) {
declaredRewards.push(Reward(beneficiariesToSet[rewardIndex],... | 1,795,352 |
./full_match/80001/0xe0447a241340CA71DDE73fBCE506F2ea03f2a745/sources/project_/contracts/VendingMachine.sol | Let the owner restock the vending machine | function restock(uint amount) public {
require(msg.sender == owner, "Only the owner can restock.");
donutBalances[address(this)] += amount;
}
| 846,892 |
// SPDX-License-Identifier: AGPL-3.0-or-later
/// MultiplyProxyActions.sol
// Copyright (C) 2021-2021 Oazo Apps Limited
// This program 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 Software Foundation, either versio... | Updates stability fee rate Gets DAI balance of the urn in the vat If there was already enough DAI in the vat balance, just exits it without adding more debt Calculates the needed dart so together with the existing dai in the vat is enough to exit wad amount of DAI tokens This is neeeded due lack of precision. It might ... | function _getDrawDart(
address vat,
address jug,
address urn,
bytes32 ilk,
uint256 wad
) internal returns (int256 dart) {
uint256 rate = IJug(jug).drip(ilk);
uint256 dai = IVat(vat).dai(urn);
if (dai < wad.mul(RAY)) {
dart = toInt256(wad.mul(RAY).sub(dai) / rate);
dart ... | 10,329,495 |
./full_match/1/0x35B62Cb442A3b67082080a1e8F5c377811A45613/sources/browser/DPiggy.sol | Forwarding function to dPiggy asset to get the minimum time for the next Compound redeem execution. tokenAddress The ERC20 token address on the chain or '0x0' for Ethereum. return The minimum time in Unix for the next Compound redeem execution./ | function getMinimumTimeForNextExecution(address tokenAddress) external view returns(uint256) {
return _getValueFromAsset(tokenAddress, abi.encodeWithSignature("getMinimumTimeForNextExecution()"));
}
| 8,369,326 |
pragma solidity 0.5.17;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) in... | Transfer tokens from one address to another _from address The address which you want to send tokens from _to address The address which you want to transfer to _value uint256 the amount of tokens to be transferred/ Check is not needed because sub(_allowance, _value) will already throw if this condition is not met req... | function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0) && _to != address(this));
uint256 _allowance = allowed[_from][msg.sender];
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from]... | 50,775 |
./partial_match/137/0x7709Af1E8DF26beb881d16DB3614112824359c64/sources/Trio/DappManager.sol | address[] memory path = new address[](2); path[0] = address(USDToken); path[1] = router.WETH(); Swap the USD to token router.swapExactTokensForETH( taxes/3, 0, path, msg.sender, block.timestamp ); | function sellHTG(uint256 tokens) public returns (bool) {
require(tokens > 0, "Usd amount can't be zero");
require(HTGToken.balanceOf(msg.sender) >= tokens, "Token not enough");
require(price > 0, "Price has not been define");
uint256 usd = mul(div(tokens, price), 1000);
ui... | 3,516,973 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.