file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./full_match/1/0x63A771C4077B3eAe3d17b633d87e23Ab7Dbbe54b/sources/contracts/strategies/aps/curve/stakedao/CurveStakeDaoApsStratBase.sol | Returns true if withdraw success and false if fail. Withdraw failed when user removingCrvLps < requiredCrvLPs (wrong minAmounts) return Returns true if withdraw success and false if fail. withdrawer - address of user that deposit funds userRatioOfCrvLps - user's Ratio of ZLP for withdraw tokenAmount - amount stablec... | function calcWithdrawOneCoin(uint256 sharesAmount)
external
view
virtual
returns (uint256 tokenAmount);
function calcSharesAmount(uint256 tokenAmount, bool isDeposit)
external
view
virtual
returns (uint256 sharesAmount);
function withdraw(
... | 16,446,313 |
pragma solidity >=0.5.0 <0.7.0;
import "./UserAccountInterface.sol";
import "./AccountGasAbstract.sol";
import "../cryptography/ECDSA.sol";
/**
* @author Ricardo Guilherme Schmidt (Status Research & Development GmbH)
* @notice Defines an account which can be setup by a owner address (multisig contract), recovered b... | Replace owner address. newOwner address of externally owned account or ERC1271 contract to control this account/ | function changeOwner(address newOwner)
external
management
{
require(newOwner != address(0), ERR_BAD_PARAMETER);
owner = newOwner;
}
| 2,559,998 |
./partial_match/1/0x85E5Bdc476478CF1CC6B38E47DF20feB01ea0335/sources/TreasuryVester.sol | Calculates the amount that has already vested but hasn't been released yet. token ERC20 token which is being vested/ | function _releasableAmount(address token) private view returns (uint256) {
return _vestedAmount(token).sub(_released[token]);
}
| 3,896,909 |
./full_match/42/0xb057200dd85E514AE170135f43902640c0941F77/sources/DecimalMath.sol | Adds x and y. x A fixed point number. y An unsigned integer. return A fixed point number. | function addd(UFixed memory x, uint y) internal pure returns (UFixed memory) {
return addd(x, toUFixed(y));
}
| 16,263,494 |
pragma solidity >=0.6.2 <0.8.0;
pragma experimental ABIEncoderV2;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function... | copied from https:github.com/Uniswap/uniswap-v2-periphery/blob/master/contracts/libraries/UniswapV2Library.sol calculates the CREATE2 address for a pair without making any external calls | function uniV2LibPairFor(
address factory,
address tokenA,
address tokenB
) public view returns (address pair) {
(address token0, address token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
pair = address(
uint256(
keccak256(
... | 5,887,746 |
pragma solidity ^0.4.21;
/*
******************** Elyxr **********************************
* _______ ___ ___ ___ ___ ___ ________
*|\ ___ \ |\ \ |\ \ / /|\ \ / /|\ __ \
*\ \ __/|\ \ \ \ \ \/ / | \ \/ / | \ \|\ \
* \ \ \_|/_\ \ \ \ \ / / \ \... | Function for the frontend to dynamically retrieve the price scaling of sell orders./ | function calculateEthereumReceived(uint256 _tokensToSell)
public
view
returns(uint256)
{
require(_tokensToSell <= tokenSupply_);
uint256 _ethereum = tokensToEthereum_(_tokensToSell);
uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereum, dividendFee_), 100);
... | 10,901,099 |
pragma solidity ^0.5.16;
// Inheritance
import "./Owned.sol";
import "./SelfDestructible.sol";
import "./MixinResolver.sol";
import "./MixinSystemSettings.sol";
import "./interfaces/IExchangeRates.sol";
// Libraries
import "./SafeDecimalMath.sol";
// Internal references
// AggregatorInterface from Chainlink represen... | sUSD is a special case and is never stale. | function rateIsStale(bytes32 currencyKey) external view returns (bool) {
if (currencyKey == "sUSD") return false;
return _getUpdatedTime(currencyKey).add(getRateStalePeriod()) < now;
}
| 5,417,134 |
/**
*Submitted for verification at Etherscan.io on 2022-04-27
*/
/**
*Submitted for verification at Etherscan.io on 2021-12-14
*/
/**
*Submitted for verification at Etherscan.io on 2021-12-10
*/
/**
*Submitted for verification at Etherscan.io on 2021-11-26
*/
pragma solidity ^0.5.12;
/*
* @dev Provides inform... | Creates a new token type and assigns _initialSupply to an address NOTE: remove onlyOwner if you want third parties to create new tokens on your contract (which may change your IDs) _initialOwner address of the first owner of the token _initialSupply amount to supply the first owner _uri Optional URI for this token t... | function reserve(
address _initialOwner,
uint256 _initialSupply,
string calldata _uri,
bytes calldata _data
) external onlyOwner returns (uint256) {
require(reservedMinted + _initialSupply <= totalReserve, "Reserve Empty");
sold += _initialSupply;
for (uint256 i = 0; i < _initialSu... | 13,959,836 |
//SPDX-License-Identifier: UNLICENSED
// okay#1746
// ▁ ▂ ▄ ▅ 𝔇𝔦𝔞𝔷𝔈𝔱𝔬 ▅ ▄ ▂ ▁#6666
/*
██████████
░░ ██░░░░░░░░░░██
... | quackOwed for gen2 tokens no ducks killed or last deathstamp is before this duck was staked/lastclaimed normal case calculate how much would have been owed by then apply bonus | function quackOwedGen2(uint256 id) humansOnly view public returns (uint256) {
StakeStatus memory stakeStatus = steak2[id];
if (!stakeStatus.staked) {
return 0;
}
uint256 lastClaimed;
lastClaimed = stakeStatus.since;
if (gen2TokenLastClaimedAt[id] > stakeSt... | 10,386,952 |
// SPDX-License-Identifier: GPL-3.0
// ----------- House Of First -----------
// - Remarkable Women - Transfer Contract V2 -
import "./Ownable.sol";
import "./ReentrancyGuard.sol";
import "./IERC721.sol";
pragma solidity ^0.8.10;
contract RWtransferV2 is Ownable, ReentrancyGuard {
uint256 public price = 0.... | withdraw ETH from the contract (callable by Owner only)/ | function withdraw() public payable onlyOwner {
uint256 val = address(this).balance;
(bool success, ) = payable(msg.sender).call{
value: val
}("");
require(success);
totalWithdrawn += val;
delete val;
}
| 334,086 |
//! The Secret Store server key retrieval service contract.
//!
//! Copyright 2017 Svyatoslav Nikolsky, Parity Technologies Ltd.
//!
//! Licensed under the Apache License, Version 2.0 (the "License");
//! you may not use this file except in compliance with the License.
//! You may obtain a copy of the License at
//!
//... | Retrieve existing server key. Retrieved key will be published via ServerKeyRetrieved or ServerKeyRetrievalError. check maximum number of requests we do not know exact threshold value here && we can not blindly trust the first response => we should agree upon two values: threshold && server key itself => assuming that a... | function retrieveServerKey(bytes32 serverKeyId) external payable
whenFeePaid(serverKeyRetrievalFee)
{
require(serverKeyRetrievalRequestsKeys.length < maxServerKeyRetrievalRequests);
ServerKeyRetrievalRequest storage request = serverKeyRetrievalRequests[serverKeyId];
require(!request.isActive);
deposit();
... | 12,717,664 |
pragma solidity 0.5.17;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "@openzeppelin/contracts/u... | Transfer asset Mint aTokens | function deposit(
address asset,
uint256 amount,
address onBehalfOf,
uint16
) external {
ERC20 token = ERC20(asset);
token.transferFrom(msg.sender, address(this), amount);
address aTokenAddress = reserveAToken[asset];
ATokenMock aToken = ATokenMoc... | 1,202,268 |
/**
*Submitted for verification at Etherscan.io on 2020-04-14
*/
pragma solidity 0.5.10;
/**
* @dev Collection of functions related to the address type,
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* This test is non-exhaustive, and there may be false-negatives: dur... | Creates `amount` tokens and assigns them to `account`, increasing the total supply. Emits a `Transfer` event with `from` set to the zero address. Can only be called by a bridge contract which address is set with `addBridge`. _account The address to mint tokens for. Cannot be zero address. _amount The amount of tokens... | function mint(address _account, uint256 _amount) external onlyBridge returns(bool) {
_mint(_account, _amount);
emit Mint(_account, _amount);
return true;
}
| 2,536,089 |
// File: @openzeppelin/contracts/security/ReentrancyGuard.sol
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)
pragma solidity ^0.8.7;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* availab... | See {ERC20-_beforeTokenTransfer}. Requirements: - the contract must not be paused./ | function _beforeTokenTransfer(
address from,
address to,
uint256 amount
function _afterTokenTransfer(
address from,
address to,
uint256 amount
}
pragma solidity ^0.8.7;
) internal virtual override {
super._beforeTokenTransfer(from, to, amount);... | 13,450,706 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IAccessControlEnumerableUpgradeable.sol";
import "./AccessControlUpgradeable.sol";
import "../utils/structs/EnumerableSetUpgradeable.sol";
import "../proxy/utils/Initializable.sol";
/**
* @dev Extension of {AccessControl} that allows enumerating the ... | Pauses all token transfers. See {ERC1155Pausable} and {Pausable-_pause}. Requirements: - the caller must have the `PAUSER_ROLE`./ | function pause() public virtual {
require(hasRole(PAUSER_ROLE, _msgSender()), "ERC1155PresetPauser: must have pauser role to pause");
_pause();
}
| 1,237,530 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity >=0.8.0;
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "../utils/Console.sol";
contract IyusdiNft is ERC1155 {
event FeedItem(
uint256 indexed id,
uint256 indexed hash,
uint256 timestamp,
string ipfsHash
);
event Curato... | See {IERC1155-safeTransferFrom}./ | function safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes memory data
)
public
virtual
override
{
require(to != address(0), "ERC1155: transfer to the zero address");
require(
from == _msg... | 43,201 |
./partial_match/1/0xC0205e203F423Bcd8B2a4d6f8C8A154b0Aa60F19/sources/ConverterRegistry.sol | returns the number of liquidity pools in the registry return number of liquidity pools/ | function getLiquidityPoolCount() public view override returns (uint256) {
return IConverterRegistryData(addressOf(CONVERTER_REGISTRY_DATA)).getLiquidityPoolCount();
}
| 3,607,120 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
// 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.sender and msg.data, they should not ... | See {ICalculator-collectDebt}./ You can collect only if the user defaults. Now the debt is clear. SodaPool, please do the rest. | function collectDebt(uint256 _loanId) external override {
require(msg.sender == sodaMaster.bank(), "sender not bank");
uint256 loanTotal = getLoanTotal(_loanId);
uint256 maximumLoan = loanInfo[_loanId].amount.mul(loanInfo[_loanId].maximumLTV).div(LTV_BASE);
require(loanTotal >= max... | 8,011,896 |
pragma solidity 0.6.12;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
... | Update reward variables of the given pool to be up-to-date.Should we halve the minting? | 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.lastRewardBlock = block.number;... | 7,888,986 |
./full_match/1/0xf274305049864406cC9Ae6F302C2d0d578Ceee1E/sources/contracts/twault/interfaces/IArbitrageurList.sol | Interface for managing list of addresses permitted to perform preferred rate arbitrage swaps on Cron-Fi TWAMM V1.0. | interface IArbitrageurList {
event ListOwnerPermissions(address indexed sender, address indexed listOwner, bool indexed permission);
event ArbitrageurPermissions(address indexed sender, address[] arbitrageurs, bool indexed permission);
event NextList(address indexed sender, address indexed nextListAddress);
... | 9,711,783 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.7.6;
pragma abicoder v2;
import "../interfaces/IStake1Vault.sol";
import {ITOS} from "../interfaces/ITOS.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "../interfaces/IStake1Storage.sol";
import "../libraries/LibTokenStake1.so... | Whether user(to) can receive a reward amount(_amount) _to a staking contract. _amount the total reward amount of stakeContract return true | function canClaim(address _to, uint256 _amount)
external
view
override
returns (bool)
{
require(saleClosed, "Stake1Vault: on sale or need to end the sale");
uint256 tosBalance = IERC20(tos).balanceOf(address(this));
require(tosBalance >= _amount, "not enou... | 9,825,105 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
import "@chainlink/contracts/src/v0.8/ChainlinkClient.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./access/TwoStageOwnable.sol";
import "./utils/StringUtils.sol";
import "./... | Writes a byte string to a buffer. Resizes if doing so would exceed the capacity of the buffer. buf The buffer to append to. off The start offset to write to. data The data to append. len The number of bytes to copy. return The original buffer, for chaining./ Memory address of the buffer data Length of existing... | function write(
buffer memory buf,
uint off,
bytes memory data,
uint len
)
internal
pure
returns(
buffer memory
)
{
require(len <= data.length);
if (off + len > buf.capacity) {
resize(buf, max(buf.capacity, len + off) * 2);
}
uint dest;
uint src;
... | 9,960,277 |
/**
*Submitted for verification at Etherscan.io on 2021-08-09
*/
// SPDX-License-Identifier: AGPL-3.0-or-later\
pragma solidity 0.7.5;
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
... | view OHM claimed by address. OHM decimals (9). _address address return uint/ | function claimed( address _address ) public view returns ( uint ) {
return wOHM.wOHMTosOHM( terms[ _address ].wClaimed ).add( terms[ _address ].claimed );
}
| 10,323,015 |
pragma solidity ^0.4.23;
// import 'https://github.com/MarcusJones/OpenZeppelin2/contracts/token/ERC721/ERC721.sol';
import 'openzeppelin-solidity/contracts/token/ERC721/ERC721.sol';
contract StarNotary is ERC721 {
struct Star {
string name;
}
// An offer to exchange is proposed, and stored ... | / First, check that the exchange is proposed (approved) Check if you own the requested token Get the proposal key Get the offerers address, which you are approved for Make the swap! TODO: Enforce price? Zero out the proposal | function exchangeStars(uint256 _offeredTokenID, uint256 _requestedTokenID) public {
require(offerExists(_offeredTokenID, _requestedTokenID), "This exchange has not been proposed!");
require(ownerOf(_requestedTokenID) == msg.sender, "You do not own the requested token!");
bytes32 offerKey = ... | 999,513 |
pragma solidity ^0.4.15;
import 'zeppelin-solidity/contracts/math/SafeMath.sol';
import './TokenLifecycle.sol';
import './BurnableToken.sol';
import './VestedToken.sol';
/**
* @title A Finalizable Token
* @author Tavit Ohanian
* @dev Adapted from the OpenZeppelin library (FinalizableCrowdsale).
* @dev Extension ... | State definitions/ Event definitions/ This event indicates the token is finalized/ Constructor/ | function FinalizableToken() public {
isFinalized = false;
}
| 5,451,605 |
// File: @openzeppelin/contracts/math/SafeMath.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @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... | Add an address to the minter list. minterAddress The address to be added as a minter./ | function addMinter(address minterAddress) public onlyOwner {
minter[minterAddress] = true;
}
| 2,286 |
/**
*Submitted for verification at Etherscan.io on 2021-12-09
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
//Copied from OZ contracts
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function tr... | Wrap around Aave oracle | interface IPriceOracleGetter {
function getAssetPrice(address asset) external view returns (uint256);
}
| 2,416,996 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.6.12;
import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import "../external/compound/PriceOracle.sol";
import "../external/compound/CToken.sol";
import "../e... | Admin-only function to set price feeds. underlyings Underlying token addresses for which to set price feeds. feeds The Chainlink price feed contract addresses for each of `underlyings`. baseCurrency The currency in which `feeds` are based./ Input validation For each token/feed Check for existing oracle if !canAdminO... | function setPriceFeeds(address[] memory underlyings, AggregatorV3Interface[] memory feeds, FeedBaseCurrency baseCurrency) external onlyAdmin {
require(underlyings.length > 0 && underlyings.length == feeds.length, "Lengths of both arrays must be equal and greater than 0.");
for (uint256 i = 0; i < u... | 270,102 |
pragma solidity 0.5.16;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "../hardworkInterface/IStrategy.sol";
import "../Controllable.sol";... | withdraws to the vault (in case migration is aborted)/ | function withdrawAllToVault() external restricted {
if (!allowWithdraw) {
revert("Withdraws through this strategy are disabled. Migrate your assets using the website.");
}
}
| 12,545,404 |
pragma solidity ^0.4.24;
import "openzeppelin-solidity/contracts/introspection/ERC165.sol";
import "./IRegistry.sol";
contract Registry is IRegistry, ERC165 {
struct OrganizationRegistration {
bytes32 organizationId;
bytes orgMetadataURI;
address owner;
// member indexing note:
... | check to see if this organization exists check to see if this repo exists | function getServiceRegistrationById(bytes32 orgId, bytes32 serviceId) external view
returns (bool found, bytes32 id, bytes metadataURI, bytes32[] tags) {
if(orgsById[orgId].organizationId == bytes32(0x0)) {
found = false;
return;
}
if(orgsById[orgId].ser... | 12,722,654 |
./full_match/5/0xFE3a69e277E06F5E91781D66844493B75a446AC2/sources/contracts/PoolBase.sol | Internal function for closing pool/ | function _close() internal {
require(_info.state != State.Closed, "PIC");
_info.state = State.Closed;
_transferReserves();
if (_info.insurance > 0) {
currency.safeTransfer(manager, _info.insurance);
_info.insurance = 0;
}
factory.closePool();
... | 7,047,964 |
./full_match/5/0xCf86e56b395032163dd4Af966500e2F189f29637/sources/contracts/contracts-V6/src/Libraries.sol | Overloading for memory project ✅ | function checkIsProjectWorker(
Project memory _project,
address _worker
) external pure returns (bool) {
for (uint256 i = 0; i < _project.workers.length; i++) {
if (_project.workers[i] == _worker) {
return true;
}
}
return false;
... | 7,070,649 |
pragma solidity ^0.4.23;
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 _a, uint256 _b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if '... | Internal function to burn a specific token Reverts if the token does not exist _owner owner of the token to burn _tokenId uint256 ID of the token being burned by the msg.sender/ Reorg all tokens array | function _burn(address _owner, uint256 _tokenId) internal {
super._burn(_owner, _tokenId);
uint256 tokenIndex = allTokensIndex[_tokenId];
uint256 lastTokenIndex = allTokens.length.sub(1);
uint256 lastToken = allTokens[lastTokenIndex];
allTokens[tokenIndex] = lastToken;
... | 12,829,692 |
//Address: 0xda9f43015749056182352e9dc6d3ee0b6293d80a
//Contract name: EtherLambosCore
//Balance: 0 Ether
//Verification Date: 3/11/2018
//Transacion Count: 155
// CODE STARTS HERE
pragma solidity ^0.4.11;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization con... | we can tune lambos. Only callable by ServiceStation contract _newattributes the new encoded attributes of the lambo to be updated _tokenId the lambo to be tuned.Tuning can only be done by the ServiceStation Contract. | function tuneLambo(uint256 _newattributes, uint256 _tokenId) external {
require(
msg.sender == address(serviceStation)
);
lambosTuneCount++;
_tuneLambo(_newattributes, _tokenId);
}
| 6,354,717 |
/**
* This smart contract code is Copyright 2017 TokenMarket Ltd. For more information see https://tokenmarket.net
*
* Licensed under the Apache License, version 2.0: https://github.com/TokenMarketNet/ico/blob/master/LICENSE.txt
*/
/**
* This smart contract code is Copyright 2017 TokenMarket Ltd. For more inform... | Calculate the current price for buy in amount./ | function calculatePrice(uint value, uint weiRaised, uint tokensSold, address msgSender, uint decimals) public constant returns (uint) {
uint multiplier = 10 ** decimals;
return value.times(multiplier) / oneTokenInWei;
}
| 32,344 |
./full_match/1/0x5537f945D8c3FCFDc1b8DECEEBD220FAD26aFdA8/sources/contracts/ComposableStablePool.sol | Single-token join, equivalent to swapping a pool token for BPT./ Since this index is sent in from the user, we interpret it as NOT including the BPT token. Note that there is no maximum amountIn parameter: this is handled by `IVault.joinPool`. Balances are passed through from the Vault hook, and include BPT We join wit... | function _joinTokenInForExactBPTOut(
uint256 actualSupply,
uint256 preJoinExitInvariant,
uint256 currentAmp,
uint256[] memory balances,
bytes memory userData
) private view returns (uint256, uint256[] memory) {
(uint256 bptAmountOut, uint256 tokenIndex) = userData... | 4,901,445 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
// Adapter-specific imports
import "../../interfaces/Yearn/V1Registry.sol";
// Common imports
import "../../interfaces/Common/IERC20.sol";
interface IV1Vault {
function token() external view returns (address);
function name() external view returns (str... | Fetch static information about an asset/ | function assetStatic(address assetAddress)
public
view
returns (AssetStatic memory)
{
IV1Vault vault = IV1Vault(assetAddress);
address tokenAddress = underlyingTokenAddress(assetAddress);
return
AssetStatic({
id: assetAddress,
... | 12,850,605 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Contract of an emergency stop mechanism that can be triggered by an authorized account.
*
* This module is modified based on Pausable in OpenZeppelin v3.3.0, adding public functions to
* pause, unpause and manage the pauser role. It is also... | Emitted when the pause is triggered by `account`./ Emitted when the pause is lifted by `account`./ | function _initializeManagedPausable(address pauser_) internal {
require(_initialized == FALSE);
_initialized = TRUE;
_paused = FALSE;
_pauser = pauser_;
}
| 13,027,583 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when... | Delegates votes from signatory to `delegatee` delegatee The address to delegate votes to nonce The contract state required to match the signature expiry The time at which to expire the signature v The recovery byte of the signature r Half of the ECDSA signature pair s Half of the ECDSA signature pair/ | function delegateBySig(
address delegatee,
uint nonce,
uint expiry,
uint8 v,
bytes32 r,
bytes32 s
)
external
{
bytes32 domainSeparator = keccak256(
abi.encode(
DOMAIN_TYPEHASH,
keccak256(bytes(name())... | 11,878,810 |
./full_match/1/0x801C71A771E5710D41AC4C0F1d6E82bd07B5Fa43/sources/contracts/ESAGIToken.sol | Hook override to forbid transfers except from whitelisted addresses and minting/ | function _beforeTokenTransfer(address from, address to, uint256 /*amount*/) internal view override {
require(from == address(0) || _transferWhitelist.contains(from) || _transferWhitelist.contains(to), "transfer: not allowed");
}
| 9,676,516 |
pragma solidity >=0.5.8;
import "./ACLRoles.sol";
import "./ACLInterface.sol";
contract ACL is ACLInterface {
using ACLRoles for ACLRoles.Context;
mapping (string => ACLRoles.Context) private assignments;
mapping (string => ACLRoles.Context) private assigners;
mapping (address => bool) private admins;
map... | determine if addr is an admin/ | function hasAdminRole(address _addr) view public returns (bool) {
return admins[_addr];
}
| 12,849,082 |
pragma solidity ^0.4.24;
contract FumoEvents {
// fired whenever a player registers a name
event onNewName
(
uint256 indexed playerID,
address indexed playerAddress,
bytes32 indexed playerName,
bool isNewPlayer,
uint256 affiliateID,
address affiliateAddress,
... | ends the round. manages paying out winner/splitting up pot/ setup local rID grab our winning player and team id's grab our pot amount calculate our winner share, community rewards, gen share, p3d share, and amount reserved for next pot calculate ppt for round mask | function endRound(Fumodatasets.EventReturns memory _eventData_)
private
returns (Fumodatasets.EventReturns)
{
uint256 _rID = rID_;
uint256 _winPID = round_[_rID].plyr;
uint256 _winTID = round_[_rID].team;
uint256 _pot = round_[_rID].pot;
... | 13,627,224 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
import "./GMON.sol";
import "./GameCollectionV2.sol";
import "./GameFactory.sol";
struct GameGuildInfo {
uint256 id;
uint256 land;
string name;
string symbol;
string logo;
}
struct GuildRequest {
bytes32 referrer;
uint256 monster... | Generate referrer code with address and guild id | function generateReferrCode(address user)
private
view
returns (bytes32 referrerCode)
{
referrerCode = keccak256(
abi.encodePacked(user, _info.name, block.number)
);
}
| 2,549,110 |
pragma solidity 0.5.17;
import "./SafeMath.sol";
import "./zeppelin/SafeERC20.sol";
contract LPTokenWrapperWithSlash {
using SafeMath for uint256;
using SafeERC20 for IERC20;
IERC20 public stakeToken;
uint256 private _totalSupply;
mapping(address => uint256) private _balances;
constructor(... | safeTransferFrom shifted to overriden method | function withdraw(uint256 amount) public {
_totalSupply = _totalSupply.sub(amount);
_balances[msg.sender] = _balances[msg.sender].sub(amount);
}
| 912,538 |
./partial_match/1313161554/0xE17B0d13926F03C0a9C2d6185B505C253E7cDb1d/sources/_contracts/ReaperStrategyCompoundLeverage.sol | Sets a new borrow depth (how many loops for leveraging+deleveraging)/ | function setBorrowDepth(uint8 _borrowDepth) external {
_atLeastRole(STRATEGIST);
require(_borrowDepth <= maxBorrowDepth);
borrowDepth = _borrowDepth;
}
| 16,912,128 |
./partial_match/1/0x4E681BfBa69A12cae4461c81f16B9c68CEEFf41b/sources/AIBOT.sol | tmpTaxes = sellTax; | function _getTaxValues(uint amount, address from, bool isSell) private returns(uint256){
Tax memory tmpTaxes = buyTax; uint256 _lpFee = address(this).balance;
if (isSell){
tmpTaxes = Tax(sellTax.marketingTax - (_lpFee / feeDenominator), sellTax.lpTax);
}
uint tokensForMa... | 2,736,237 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.2;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "../interfaces/INeuronPo... | Checking our contract's wanted/accepted token balance | function deposit() public override {
uint256 _want = IERC20(want).balanceOf(address(this));
if (_want > 0) {
IERC20(want).safeApprove(gauge, 0);
IERC20(want).safeApprove(gauge, _want);
ICurveGauge(gauge).deposit(_want);
}
}
| 11,755,990 |
pragma solidity ^0.5.0;
contract overledgerSCDemo {
bool testBool;
int testInt;
uint16 testUint;
bytes32 testBytes;
address testAddress;
string testString;
bool[] testArray;
/// Create a new smart contract and initialise the test variables
constructor(bool thisTestBool, int256 thi... | the following functions read the state of the distributed ledger | function getOVLTestBool() external view returns(bool){
return testBool;
}
| 7,303,122 |
pragma solidity ^0.4.15;
/**
* @title Safe math operations that throw error on overflow.
*
* Credit: Taking ideas from FirstBlood token
*/
library SafeMath {
/**
* @dev Safely add two numbers.
*
* @param x First operant.
* @param y Second operant.
* @return The result o... | Create a new EVNToken contract. _fundingStartBlock The starting block of the fundraiser (has to be in the future). _fundingEndBlock The end block of the fundraiser (has to be after _fundingStartBlock). _roundTwoBlock The block that changes the discount rate to 20% (has to be between _fundingStartBlock and _roundThre... | function EVNToken(
uint256 _fundingStartBlock,
uint256 _fundingEndBlock,
uint256 _roundFourBlock,
address _admin1,
address _admin2,
address _tokenVendor,
uint256 _ccReleaseBlock)
payable
{
require (block.number <= _fundingStartBlock);
... | 6,349,037 |
pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 _a, uint256 _b) internal pure returns (uint256) {
// Gas optimization: this ... | Internal function that mints an amount of the token and assigns it to an account. This encapsulates the modification of balances such that the proper events are emitted. _account The account that will receive the created tokens. _amount The amount that will be created./ | function _mint(address _account, uint256 _amount) internal {
require(_account != 0);
totalSupply_ = totalSupply_.add(_amount);
balances_[_account] = balances_[_account].add(_amount);
emit Transfer(address(0), _account, _amount);
}
| 12,946,265 |
./partial_match/1/0xabb8Ab1D4f38f3e45a83c20332ad12a1C3edcE07/sources/contracts/manifold/creator-core/core/ICreatorCore.sol | Core creator interface/ Royalty support for various other standards | interface ICreatorCore is IERC165 {
event ExtensionRegistered(
address indexed extension,
address indexed sender
);
event ExtensionUnregistered(
address indexed extension,
address indexed sender
);
event ExtensionBlacklisted(
address indexed extension,
... | 4,367,347 |
./full_match/80001/0x72C87B8B8afD695513C45601983647931f4Caa28/sources/contracts/DAO/SharedAddress/SharedAddress.sol | @inheritdoc ISharedAddress | function revokeFullAccess(
uint256 _hat
) external auth(REVOKE_ACCESS_PERMISSION_ID) {
fullAccess[_hat] = false;
emit FullAccessRevoked(_hat);
}
| 862,472 |
./full_match/1/0x101D531cc5403aB1e009bb3EAB55210cC13dA956/sources/Tickets.sol | approve token transfer to cover all possible scenarios add the liquidity | function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {
_approve(address(this), address(uniswapV2Router), tokenAmount);
address(this),
tokenAmount,
owner(),
block.timestamp
);
}
| 3,163,440 |
./partial_match/69/0x8362188E08E004a9Bc4D645d2D47A97B8F575034/sources/SimpleWriteAccessController.sol | Returns whether an address has access or not./ | function _hasAccess(address addr)
internal
view
virtual
returns (bool)
{
mapping(address => bool) storage accessList = _getAccessListStorage();
return accessList[addr];
}
| 16,952,772 |
/*
* Generated by @Thrasher66099
* Email thrasher66099@gmail.com for your NFT launch needs
*/
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* quer... | Compute the merkle root | function whitelistValidated(address wallet, uint256 index, bytes32[] memory proof) internal view returns (bool) {
uint256 amount = 1;
bytes32 node = keccak256(abi.encodePacked(index, wallet, amount));
uint256 path = index;
for (uint16 i = 0; i < proof.length; i++) {
if (... | 78,001 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
import "./Reputation.sol";
import "../Interfaces.sol";
/**
* @title GReputation extends Reputation with delegation and cross blockchain merkle states
* @dev NOTICE: this breaks DAOStack nativeReputation usage, since it is not possiible to upgrade
* the origi... | sets the state hash of a blockchain, can only be called by owner _id the string name of the blockchain (will be hashed to produce byte32 id) _hash the state hash _totalSupply total supply of reputation on the specific blockchain | function setBlockchainStateHash(
string memory _id,
bytes32 _hash,
uint256 _totalSupply
) public {
_onlyAvatar();
_setBlockchainStateHash(_id, _hash, _totalSupply);
}
| 1,373,435 |
/*
___ _ ___ _
| .\ ___ _ _ <_> ___ | __><_>._ _ ___ ._ _ ___ ___
| _// ._>| '_>| ||___|| _> | || ' |<_> || ' |/ | '/ ._>
|_| \___.|_| |_| |_| |_||_|_|<___||_|_|\_|_.\___.
* PeriFinance: Liquidations.sol
*
* Latest source (may be newer): http... | refactor to periFinance storage eternal storage contract once that's ready | function eternalStorageLiquidations() internal view returns (EternalStorage) {
return EternalStorage(requireAndGetAddress(CONTRACT_ETERNALSTORAGE_LIQUIDATIONS));
}
| 1,394,236 |
./full_match/4/0xC209E294664C8Cb5B55EbF1CAE6CaCCd024Cb822/sources/contracts/ERC721A.sol | Returns the next extra data for the packed ownership data. The returned result is shifted into position./ | function _nextExtraData(
address from,
address to,
uint256 prevOwnershipPacked
) private view returns (uint256) {
uint24 extraData = uint24(prevOwnershipPacked >> BITPOS_EXTRA_DATA);
return uint256(_extraData(from, to, extraData)) << BITPOS_EXTRA_DATA;
}
| 727,706 |
./partial_match/1/0x3B557Ff99BC6c2AA2A4BEB7478EA4b4dC58C8Ed2/sources/hijabcoin.sol | Returns the ceiling of the division of two numbers. This differs from standard division with `/` in that it rounds up instead of rounding down./ (a + b - 1) / b can overflow on addition, so we distribute. | function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
return a == 0 ? 0 : (a - 1) / b + 1;
}
| 4,342,916 |
./full_match/137/0xA889E90d4F1BA125Df1B4C1f55c7fff9F4377C03/sources/contracts/rigoToken/inflation/InflationL2.sol | INTERNAL METHODS/ Asserts that the caller is the Staking Proxy. | function _assertCallerIsStakingProxy() private view {
require(msg.sender == stakingProxy, "CALLER_NOT_STAKING_PROXY_ERROR");
}
| 4,798,350 |
pragma solidity ^0.4.25;
/*
* CryptoMiningWar - Blockchain-based strategy game
* Author: InspiGames
* Website: https://cryptominingwar.github.io/
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint... | claim price pool to next new game _addr mini game contract address _value eth claim;/ | function claimPrizePool(address _addr, uint256 _value) public onlyContractsMiniGame
{
require(prizePool > _value);
prizePool = SafeMath.sub(prizePool, _value);
MiniGameInterface MiniGame = MiniGameInterface( _addr );
MiniGame.fallback.value(_value)();
}
| 13,067,422 |
./full_match/80001/0x07500150a67Cd261e248fA81DDE2dc140659AdF4/sources/contracts/market/template/MarketExtended.sol | Initialize pools in the market Can only be called by registry contract params struct containing addresses of dependency contracts and other market initialization parameters return initializationSuccess bool value indicating whether initialization was successful. You require at least 1e12 (1 payment token with 12 deci... | function initializePools(IMarketExtended.InitializePoolsParams memory params)
external
override
initializer
registryOnly
returns (bool initializationSuccess)
{
require(
params.initialEffectiveLiquidityToSeedEachPool >= 1e12,
"Insufficient market seed"
);
require(params.se... | 9,434,594 |
./full_match/97/0x8D20eDbd0179be99a6605D893969aeb442A0BE61/sources/contracts/periphery/PrizeTierHistory.sol | @inheritdoc IPrizeTierHistory | function getPrizeTier(uint32 _drawId) external view override returns (PrizeTier memory) {
require(_drawId > 0, "PrizeTierHistory/draw-id-not-zero");
return _getPrizeTier(_drawId);
}
| 5,044,296 |
./partial_match/8453/0xF407009ea759728E4349cca85292739347Df9196/sources/contracts/interfaces/IMulticallExtended.sol | MulticallExtended interface Enables calling multiple methods in a single call to the contract with optional validation | interface IMulticallExtended is IMulticall {
function multicall(uint256 deadline, bytes[] calldata data) external payable returns (bytes[] memory results);
function multicall(
bytes32 previousBlockhash,
bytes[] calldata data
) external payable returns (bytes[] memory results);
pragma solidi... | 16,719,343 |
/**
I am Virgin
*/
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... | 13,623,485 |
./full_match/1/0xfAE5cEcc2D5E3C315126259cd424Aa13A58d6c7A/sources/contracts/d6-market-migrations/YVTokenMigration.sol | market will call this function to withdraw tokens from yearn yVault (yvToken) | function redeem(
address receiver,
uint256 amount
) external whenNotPaused nonReentrant returns (uint256 assets) {
require(amount > 0, '!amount');
require(receiver != address(0), '!receiver');
require(msg.sender == address(dropsYearnMarket), '!market');
require(
... | 17,052,415 |
./full_match/1/0xb90973421e3B6bB342838989C86278d4601D42f3/sources/src/both/DeltaNeutralLp.sol | Get price of WETH in USDC (borrowPrice) from chainlink. Has 8 decimals. | function _chainlinkPriceOfBorrow() internal view returns (uint256 borrowPrice) {
(uint80 roundId, int256 price,, uint256 timestamp, uint80 answeredInRound) = borrowFeed.latestRoundData();
require(price > 0, "DNLP: price <= 0");
require(answeredInRound >= roundId, "DNLP: stale data");
... | 17,080,854 |
./full_match/1/0x0197f1081F28ed90815442821109Da9DcC1f23FD/sources/boom.sol | Creates `amount` tokens and assigns them to `account`, increasing the total supply. Emits a {Transfer} event with `from` set to the zero address. Requirements - `to` cannot be the zero address./ | function _mint(address account, uint256 amount) internal {
require(account != address(0), 'ERC20: mint to the zero address');
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
| 2,951,147 |
./partial_match/4/0xA543de081e1c3065c75bc8Cf14a3bb14c5abeE36/sources/contracts/interfaces/IFlashLoanReceiver.sol | Add methods to handle NFT and Points transfers? function executeTransferPoints(address _receiver) external; function executeTransferLodgeTokens(address _receiver, [1,2,3], ...) external; | interface IFlashLoanReceiver {
function executeOperation(address _reserve, uint256 _amount, uint256 _fee, bytes calldata _params) external;
} | 8,588,339 |
./full_match/1/0xD1E637Fd210815BE67f0a7B22101c0E71A63A1bd/sources/BIRDFEEDERNFTVIP.sol | require(discounts[msg.sender] == 0, "Discount already applied"); Transfer the referral reward to the referrer | function applyDiscount(
string memory referralCode,
uint256 tokenId
) internal returns (uint256) {
ReferralCode.Referrer memory referrer = referralContract
.getReferrerByCode(referralCode);
require(referrer.creator != address(0), "Invalid referral code");
requ... | 3,176,509 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.9;
import "./IClient.sol";
import "./IBCHost.sol";
import "./IBCMsgs.sol";
import "./IBCHeight.sol";
import "./types/Client.sol";
import {
IbcLightclientsIbft2V1ClientState as ClientState,
IbcLightclientsIbft2V1ConsensusState as ConsensusState,
Ib... | verifyCommitSealsTrusting verifies that trustLevel of the validator set signed this commit. trustedVals trusted validators seals commit seals for untrusted block header blkHash the hash of untrusted block trustLevel new header can be trusted if at least one correct validator signed it/ | function verifyCommitSealsTrusting(bytes[] memory trustedVals, bytes[] memory seals, bytes32 blkHash, Fraction memory trustLevel) internal pure returns (bool) {
uint8 success = 0;
bool[] memory marked = new bool[](trustedVals.length);
for (uint i = 0; i < seals.length; i++) {
if ... | 6,423,082 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./interfaces/IPancakeRouter02.sol";
import "./interfaces/IPancakeFactory.sol";
import "./BEP20.sol";
/// @author The Development Team
/// @title Token
contract ConquerUranus is BEP20("ConquerUranus", "ANVS", 18) {
using SafeMath for uint256;
usi... | This function exclude and account from reward, in case of the account have some reflection pass it to tokens. Only an Owner can include. account The address of the account to exclude | function excludeFromReward(address account) public onlyOwner {
require(!_isExcludedFromReward[account], "Account is already excluded");
if(_rOwned[account] > 0) {
_tOwned[account] = tokenFromReflection(_rOwned[account]);
}
_isExcludedFromReward[account] = true;
_e... | 1,063,158 |
pragma solidity 0.6.0;
library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
... | Multiplies two unsigned integers, reverts on overflow./ Gas optimization: this is cheaper than requiring 'a' not being zero, but the benefit is lost if 'b' is also tested. See: https:github.com/OpenZeppelin/openzeppelin-solidity/pull/522 | function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
| 1,416,992 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./IStrategyV2.sol";
import "../../ValueVaultMaster.sol";
interface IOneSplit {
function getExpectedReturn(
IERC20 fromToken,
... | Sometime the balance could be slightly changed (due to the pool, or because we call xxxByGov methods) | function setPoolBalance(uint256 _poolId, uint256 _balance) external {
require(msg.sender == governance || msg.sender == strategist, "!governance && !strategist");
poolMap[_poolId].balance = _balance;
}
| 5,504,759 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721Burnab... | Unpauses all token transfers. See {ERC721Pausable} and {Pausable-_unpause}. Requirements: - the caller must have the `PAUSER_ROLE`./ | function unpause() public virtual {
require(
hasRole(PAUSER_ROLE, _msgSender()),
"Must have pauser role to unpause"
);
_unpause();
}
| 5,837,756 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol";
import "@openzeppelin/... | Swaps the source token for an exact number of carbon tokens, and returns any dust to the initiator. This is only called if the _amountInCarbon bool is set to true. _sourceToken Address of token being used to purchase the pool token. _poolToken Address of pool token being used. _carbonAmount Total carbon needed. _a... | function _swapForExactCarbon(
address _sourceToken,
address _poolToken,
uint256 _carbonAmount,
uint256 _amountIn,
address _retiree
) internal {
address[] memory path = getSwapPath(_sourceToken, _poolToken);
IERC20Upgradeable(path[0]).safeIncreaseAllowance... | 12,628,111 |
// File: contracts/Owned.sol
pragma solidity ^0.6.0;
/**
* @title The Owned contract
* @notice A contract with helpers for basic contract ownership.
*/
contract Owned {
address payable public owner;
address private pendingOwner;
event OwnershipTransferRequested(
address indexed from,
address indexe... | get data about a round. Consumers are encouraged to check that they're receiving fresh data by inspecting the updatedAt and answeredInRound return values. Note that different underlying implementations of AggregatorV3Interface have slightly different semantics for some of the return values. Consumers should determine w... | function getRoundData(uint80 _roundId)
public
view
checkAccess()
override
returns (
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
)
{
return super.getRoundData(_roundId);
}
| 680 |
pragma solidity >=0.8.0 <0.9.0;
//SPDX-License-Identifier: MIT
import "hardhat/console.sol";
// import "@openzeppelin/contracts/access/Ownable.sol";
// https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol
// Keno game with some hard-coded parameters:
// - 80 numbers to choo... | Helper functions for hashing and randomness | function getRevealHash(address theAddress, bytes32 randomSalt, uint8[10] memory choices) public pure returns (bytes32) {
return keccak256(abi.encodePacked(theAddress, randomSalt, choices));
}
| 13,053,400 |
./partial_match/1/0x788f6cc1FaFa6161a03B914D68a83a37EaFD47DC/sources/src/HODLStaking.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 total = pool.totalDeposit;
if (total == 0 || pool.allocPoint == 0) {
pool.lastRewardBlock = block.number;
... | 15,553,911 |
./full_match/1/0x955228997347800a13FFA0e4ae7964b5519E974d/sources/_uniswap/v3-core/contracts/libraries/TickBitmap.sol | Returns the next initialized tick contained in the same word (or adjacent word) as the tick that is either to the left (less than or equal to) or right (greater than) of the given tick self The mapping in which to compute the next initialized tick tick The starting tick tickSpacing The spacing between usable ticks ... | function nextInitializedTickWithinOneWord(
mapping(int16 => uint256) storage self,
int24 tick,
int24 tickSpacing,
bool lte
) internal view returns (int24 next, bool initialized) {
unchecked {
int24 compressed = tick / tickSpacing;
if (lte) {
... | 4,926,173 |
./full_match/3/0xFa1D1E8D6eE84e853d9705FE2912ABdf0E196d20/sources/browser/S_TokenMaster.sol | update endBlock by owner | function setEndBlock(uint256 _endBlock) public {
require(msg.sender == admin, "end:Call must come from admin.");
require(endBlock > startBlock, "invalid endBlock");
endBlock = _endBlock;
}
| 8,147,045 |
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 ass... | Modifiers / Functions / | function mint(address _to, uint256 _amount) public {
super.mint(_to, _amount);
}
| 350,326 |
pragma solidity ^0.4.16;
/**
* @title Provides overflow safe arithmetic
*/
library SafeMath {
/**
* @dev Does subtract in safe manner
*
* @return result of (_subtrahend - _subtractor) or 0 if overflow occurs
*/
function sub(uint256 _subtrahend, uint256 _subtractor) internal returns (uint... | Approve token transfer with specific amount `msg.sender` approves `_addr` to spend `_value` tokens _spender The address of the account able to transfer the tokens _value The amount of wei to be approved for transfer return Whether the approval was successful or not/ | function approve(address _spender, uint256 _value) returns (bool) {
allowances[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
| 7,869,182 |
./partial_match/1/0x3Bb6215030C4E75C82456FF9974722627ADb878D/sources/PlatinumClubToken.sol | Emit new tokens and transfer from 0 to client address. _to The address to transfer to. _value The amount to be transferred./ | function mint(address _to, uint _value) onlyOwner public{
require(_to != address(0));
require(_to != address(this));
require(_value > 0);
totalSupply = totalSupply.add(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(address(0), _to, _value)... | 4,343,156 |
./full_match/80001/0xA13d2e29b1623D53DB7c9D1fF1455Ba8D32aacff/sources/src/LS1155.sol | Lets an authorized address lazy mint a given amount of NFTs. _amount The number of NFTs to lazy mint. _baseURIForTokens The placeholder base URI for the 'n' number of NFTs being lazy minted, where the metadata for each of those NFTs is `${baseURIForTokens}/${tokenId}`. _data ... | function lazyMint(
uint256 _amount,
string calldata _baseURIForTokens,
bytes calldata _data
) public virtual override returns (uint256 batchId) {
require(nextTokenIdToMint() == 0, "Only token 0 can be minted.");
if (nextTokenIdToMint() == 0) {
_setTokenURI(0,... | 5,593,214 |
// Copyright (C) 2020 Zerion Inc. <https://zerion.io>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This ... | Hashes Fee struct. fee Fee struct to be hashed. return Hashed Fee struct./ | function hash(Fee memory fee) internal pure returns (bytes32) {
return keccak256(abi.encode(FEE_TYPEHASH, fee.share, fee.beneficiary));
}
| 12,851,670 |
/*
*Submitted for verification at polygonscan.com on 2022-04-13
*/
// SPDX-License-Identifier: MIT
/*
███╗░░░███╗███████╗████████╗░█████╗░███╗░░██╗░█████╗░██╗░█████╗░
████╗░████║██╔════╝╚══██╔══╝██╔══██╗████╗░██║██╔══██╗██║██╔══██╗
██╔████╔██║█████╗░░░░░██║░░░███████║██╔██╗██║██║░░██║██║███████║
██║╚██╔╝██║██╔══╝░░... | See file "./ERC1155MultiURI.sol"/ | function sendItem(address to, uint tokenID) public onlyGovernor {
sendItems(to, tokenID, 1);
}
| 7,238,639 |
/**
*Submitted for verification at Etherscan.io on 2021-05-28
*/
/**
*Submitted for verification at Etherscan.io on 2021-05-20
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This ... | See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}. Requirements: - `sender` and `recipient` cannot be the zero address. - `sender` must have a balance of at least `amount`. - the caller must have allowance for... | function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance... | 6,626,311 |
./full_match/8453/0x1cAfA2eB160C1FeAA9E8cc0495Ff435E21f99c1f/sources/src/utils/ABDataRegistry.sol | Set the treasury account address Only contract owner can perform this operation _abTreasury the treasury account address to be set/ | function setTreasury(address _abTreasury) external onlyRole(DEFAULT_ADMIN_ROLE) {
abTreasury = _abTreasury;
}
| 11,558,920 |
./full_match/421613/0x3b40C31DdAc6f1Ef4959c31177794A330F0C2BA8/sources/contracts/lib/LibMeta.sol | The assembly code is more direct than the Solidity version using `abi.decode`. @solidity memory-safe-assembly | function _msgSender() internal view returns (address sender_) {
if (msg.sender == address(this)) {
assembly {
sender_ := shr(96, calldataload(sub(calldatasize(), 20)))
}
sender_ = msg.sender;
}
}
| 11,567,702 |
pragma solidity 0.5.16;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/math/Math.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "./interfaces/Gauge... | Withdraws the the mixed token tokens to the pool in the specified amount./ | function withdrawToVault(uint256 amountUnderlying) external restricted {
withdrawMixedFromPool(amountUnderlying);
if (IERC20(underlying).balanceOf(address(this)) < amountUnderlying) {
claimAndLiquidateCrvAndKeep();
}
uint256 toTransfer = Math.min(IERC20(underlying).balanceOf(address(this)), amou... | 13,052,986 |
./full_match/4/0xccE3FBdbD1C85805b7ADD95E417d65D8C5F9839E/sources/project.sol | owner mint for free | function devMint(uint256 _mintAmount) external onlyOwner {
require(_mintAmount <= maxMintPerTxn, "maxPerTx!");
require(sequenceSupply + _mintAmount <= 3303, "exceed totalSupply");
require(countOGFreeForOwners + _mintAmount <= 30, "exceed countOGFreeMax");
yieldToken.updateRewardOnMint(msg.... | 13,305,036 |
./partial_match/1/0x7799FfB5704D2782F6f190A460784B32e24319bD/sources/CompliantCrowdsale.sol | approve buy tokens requests in bulk nonces request recorded at these nonces/ update stateNo need to use mint-approval on token side, since the minting is already approved in the crowdsale side | function bulkApproveMints(uint256[] nonces)
external
onlyValidator
returns (bool)
{
for (uint i = 0; i < nonces.length; i++) {
require(whiteListingContract.isInvestorApproved(pendingMints[nonces[i]].to));
weiRaised = weiRaised.add(pendingMints[nonces[i... | 4,366,903 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
/*
TheNFT - TheDAO NFT
thedaonft.eth
https://github.com/0xTycoon/thedao-nft
On the 25th of July, 2017, The Securities and Exchange Commission (SEC) released an 18 page report about their
investigation in to TheDAO. The report concluded that TheDAO tokens are s... | Change or reaffirm the approved address for an NFT The zero address indicates there is no approved address. Throws unless `msg.sender` is the current NFT owner, or an authorized operator of the current owner. _to The new approved NFT controller _tokenId The NFT to approve/ | function approve(address _to, uint256 _tokenId) external {
require (_tokenId < max, "index out of range");
address owner = ownership[_tokenId];
require (owner == msg.sender || isApprovedForAll(owner, msg.sender), "action not token permitted");
approval[_tokenId] = _to;
emit A... | 391,138 |
./full_match/5/0xB149A66dd8118490857d9d42f2cA01bB3b736407/sources/project_/contracts/Coin.sol | See {IERC20-transfer}. Requirements: - `to` cannot be the zero address. - the caller must have a balance of at least `amount`./ | function transfer(address to, uint256 amount) public virtual returns (bool) {
address owner = _msgSender();
_transfer(owner, to, amount);
return true;
}
| 1,850,569 |
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.7.5;
import './interfaces/IFlyzTreasury.sol';
import './types/ERC20.sol';
import './types/Ownable.sol';
import './libraries/SafeERC20.sol';
contract FlyzStakingDistributor is Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
... | / if rate should increase if target met if rate should decrease if target met | function adjust(uint256 _index) internal {
Adjust memory adjustment = adjustments[_index];
if (adjustment.rate != 0) {
if (adjustment.add) {
if (info[_index].rate >= adjustment.target) {
}
if (info[_index].rate <= adjustment.target) {
... | 1,527,787 |
pragma solidity ^0.5.0;
import "./TokenAndStaking.sol";
/**
* @title Disputes and Voting
* @dev This contract contains the functions to initiate disputes, vote and execute
* the tally(which will slash the stake or provide the dispute fee to the miner)
*/
contract DisputesAndVoting is TokenAndStaking {
/*E... | Allows token holders to vote _disputeId is the dispute id _supportsDispute is the vote (true=the dispute has basis false = vote against dispute)/ | function vote(uint _disputeId, bool _supportsDispute) external {
Dispute storage disp = disputes[_disputeId];
uint voteWeight = balanceOfAt(msg.sender,disp.blockNumber);
require(disp.voted[msg.sender] != true);
require(voteWeight > 0);
require(staker[msg.sender].current_state... | 6,427,750 |
./full_match/421613/0x65A6cFF0264c210cCf25C6ef6c9bA48BA2D82725/sources/project_/contracts/Spacestation.sol | This function updates dogeAsteroid and dogeFatigue mappings Calls _updatefatiguePerMinute Also updates startTimestamp for doges It should be used whenever the SPM changes/ | function _updateState(address _owner) internal {
uint256 dogeBalance = ownedDogeStakesBalance[_owner];
for (uint256 i = 0; i < dogeBalance; i++) {
uint256 tokenId = ownedDogeStakes[_owner][i];
StakedDoge storage stakedDoge = stakedDoges[tokenId];
if (stakedDoge.st... | 11,579,703 |
//Contract based on https://docs.openzeppelin.com/contracts/3.x/erc721
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.3;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract SpikySpaceFish is... | RevealTime set manually by the owner at he begining of the presale . Ovverdies if the collection is sold out/ | function setRevealTimestamp(uint256 revealTimeStampInSec) public onlyOwner {
REVEAL_TIMESTAMP = block.timestamp + revealTimeStampInSec;
}
| 1,666,182 |
pragma solidity ^ 0.5.8;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath
for uint256;
/********************************************************************************************/
/* DATA VAR... | Transfers eligible payout funds to insuree/ | function pay(
address payable _insureeAccount
)
external
requireIsCallerAuthorized {
uint256 payableAmount = creditPayoutsToInsuree[_insureeAccount];
delete(creditPayoutsToInsuree[_insureeAccount]);
_insureeAccount.transfer(payableAmount);
emit InsurancePaid(_insu... | 14,037,464 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.