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/4/0xe3FC9fEf0Cc5C545693858072F47534889Cbc3B8/sources/contracts/2_Owner.sol | ERC-721 Non-Fungible Token Standard, optional enumeration extension/ | interface IERC721Enumerable is IERC721 {
function totalSupply() external view returns (uint256);
function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);
function tokenByIndex(uint256 index) external view returns (uint256);
}
}
| 705,049 |
./full_match/1/0xD58868004D5aac1FD0Da76D3b553aB2ed5354385/sources/contracts/PaymentSplitterEP.sol | Triggers a transfer to `account` of the amount of `token` tokens they are owed, according to their percentage of the total shares and their previous withdrawals. `token` must be the address of an IERC20 contract./ _erc20TotalReleased[token] is the sum of all values in _erc20Released[token]. If "_erc20TotalReleased[toke... | function release(IERC20 token, address account) public virtual {
require(_shares[account] > 0, "PaymentSplitter: account has no shares");
uint256 payment = releasable(token, account);
require(payment != 0, "PaymentSplitter: account is not due payment");
_erc20TotalReleased[token] += payment;
un... | 9,708,790 |
./full_match/1/0x316DE382C965395aD63da4CEcf2A760d0daBf426/sources/src/Lootto.sol | Cannot overflow because the sum of all user balances can't exceed the max uint224 value. taxAmount is always less than amount | function transfer(address to, uint256 amount) public returns (bool) {
balanceOf[msg.sender] -= amount;
if (!isAddressExcluded[msg.sender]) {
amount = _processEmotionalDamage(amount);
if (MAX_BUY_END_TIME == 0) revert TradingNotEnabled();
}
unchecked {
... | 8,375,414 |
// File: @openzeppelin/contracts/utils/Strings.sol
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal... | Sets if the address is allowed to mint at each stage./ | function _setMintAllowance(address owner, bool presaleOneAllowed, bool presaleTwoAllowed) internal {
_addressData[owner].presaleOneAllowed = presaleOneAllowed;
_addressData[owner].presaleTwoAllowed = presaleTwoAllowed;
}
| 14,897,328 |
pragma solidity ^0.5.0;
/* Interface Imports */
import { ICrossDomainMessenger } from "./interfaces/CrossDomainMessenger.interface.sol";
/**
* @title BaseCrossDomainMessenger
*/
contract BaseCrossDomainMessenger is ICrossDomainMessenger {
event SentMessage(bytes32 msgHash);
/*
* Contract Variables
... | Sends a cross domain message to the target messenger. .inheritdoc IL2CrossDomainMessenger/ | function sendMessage(
address _target,
bytes memory _message,
uint32 _gasLimit
)
public
{
bytes memory xDomainCalldata = _getXDomainCalldata(
_target,
msg.sender,
_message,
messageNonce
);
_sendXDomainMe... | 5,528,844 |
pragma solidity 0.6.6;
pragma experimental ABIEncoderV2;
contract DSAuthEvents {
event LogSetAuthority(address indexed authority);
event LogSetOwner(address indexed owner);
}
contract DSAuth is DSAuthEvents {
DSAuthority public authority;
address public owner;
constructor() public {
... | Format the call data for DSProxy Send Flash loan amount to DSProxy Execute the Close/Change debt operation Send extra to DSProxy | function executeOperation(
address _reserve,
uint256 _amount,
uint256 _fee,
bytes calldata _params)
external override {
(ParamData memory paramData, ExchangeData memory exchangeData)
= packFunctionCall(_amount, _fee, _params);
... | 7,335,988 |
./partial_match/3/0x4b583DFB8C7614eFdA8934205dC819B78782A72F/sources/CFController.sol | at least 24 hours to call this | function earnCRV() public{
require(block.number.safeSub(last_earn_block) >= earn_gap, "not long enough");
last_earn_block = block.number;
ICurvePool(current_pool).earn_crv();
uint256 amount = IERC20(crv_token).balanceOf(address(this));
emit EarnCRV(address(this), amount);
if(amount > 0){
... | 5,179,741 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be... | View function to see pending TOKENs on frontend. | function pendingReward(uint256 _poolId, address _user)
external
view
returns (uint256)
{
PoolInfo storage pool = poolInfo[_poolId];
UserInfo storage user = userInfo[_poolId][_user];
uint256 accTokenPerShare = pool.accTokenPerShare;
uint256 poolBalance = p... | 1,154,352 |
pragma solidity 0.5.6;
///@title Quest Control Smart Contract for HiQuest
///@author taek lee <taeklee@haechi.io>
///@notice Create/Join/Reward/Close/WithDraw
///@dev should enforce manager to approve(-1) of hiblockstoken
interface IHiQuest {
/// @notice emited when Hiqeust is created
/// @param questId id of cre... | Quest Control Smart Contract for HiQuest taek lee <taeklee@haechi.io> Create/Join/Reward/Close/WithDraw should enforce manager to approve(-1) of hiblockstoken | interface IHiQuest {
event HiquestCreated(bytes32 questId, address manager, uint256 open, uint256 close, uint256 deposit);
event HiquestManagerChanged(bytes32 questId, address manager);
event UserJoined(bytes32 questId, address user, bytes desc);
event Rewarded(bytes32 questId, address to, uint256 amount);
... | 12,799,545 |
./full_match/44787/0x443Bd340667256fBd193D9614C330d34BCe75591/sources/contracts/Vote.sol | Returns save timestamp of proposal. proposalId The proposal UUID. return The timestamp of proposal./ | function getProposalTimestamp(uint256 proposalId) public view returns (uint256) {
(, , uint256 timestamp, , ) = getGovernance().getProposal(proposalId);
return timestamp;
}
| 13,248,191 |
contract A {
uint[] public nums;
function getNumLength() returns(uint) {
return nums.length;
}
}
contract B {
A a;
function test() constant returns (uint) {
// length is not accessible on public array from other contract
//return a.nums.length();
return a.getNumLeng... | length is not accessible on public array from other contractreturn a.nums.length(); | function test() constant returns (uint) {
return a.getNumLength();
}
| 1,753,982 |
//Address: 0x5401bb4729bd7f025b97399c3c92854ec299f81a
//Contract name: LOCIsale
//Balance: 0 Ether
//Verification Date: 12/17/2017
//Transacion Count: 4695
// CODE STARTS HERE
pragma solidity ^0.4.18;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/is... | we cannot withdraw if we didn't reach the minimum funding goal if zero requested, send the entire amount, otherwise the amount requested | function ownerTransferWei(address _beneficiary, uint256 _value) external onlyOwner {
require(_beneficiary != 0x0);
require(_beneficiary != address(token));
require(minFundingGoalWei == 0 || weiRaised >= minFundingGoalWei);
uint256 _amount = _value > 0 ? _value : this.balance;
... | 5,363,016 |
// Sources flattened with hardhat v2.8.4 https://hardhat.org
// File @rari-capital/solmate/src/tokens/ERC20.sol@v6.2.0
// SPDX-License-Identifier: GNU AGPLv3
pragma solidity >=0.8.0;
/// @notice Modern and gas efficient ERC20 + EIP-2612 implementation.
/// @author Solmate (https://github.com/Rari-Capital/solmate/bl... | Returns if a Vault at an address has already been deployed. vault The address of a Vault which may not have been deployed yet. return A boolean indicating whether the Vault has been deployed already. This function is useful to check the return values of getVaultFromUnderlying, as it does not check that the Vault addr... | function isVaultDeployed(Vault vault) external view returns (bool) {
return address(vault).code.length > 0;
}
| 1,204,184 |
./partial_match/56/0x59B58b7B249838f498d56f9D7FFEe16E32b9E7C0/sources/MasterChef.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,154,726 |
./full_match/84531/0x88Cc4aA0dd6Cf126b00C012dDa9f6F4fd9388b17/sources/contracts/Swap.sol | Stop ramping A immediately. Reverts if ramp A is already stopped./ | function stopRampA() external payable onlyOwner {
swapStorage.stopRampA();
}
| 11,523,353 |
// SPDX-License-Identifier: AGPL-3.0-only
/*
Bounty.sol - SKALE Manager
Copyright (C) 2020-Present SKALE Labs
@author Dmytro Stebaiev
SKALE Manager is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Softw... | Returns and updates the current delegated amount./ | function _getAndUpdateDelegatedAmount(address holder, uint currentMonth) private returns (uint) {
return _delegatedAmount[holder].getAndUpdateValue(currentMonth);
}
| 401,425 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol";
import "@openzeppelin/contracts/finance/PaymentSplitter.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@open... | Revokes a specified token Id, to disable any signatures that include it id The token Id that can no longer be minted/ | function revokeId(uint256 id) external {
require(hasRole(AGENT_ROLE, _msgSender()), "unauthorized to revoke id");
require(vacant(id));
revokedIds[id] = true;
IdRevoked(id);
}
| 14,015,108 |
pragma solidity ^0.5.0;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20Detailed.sol";
import "./aave/ILendingPoolAddressesProvider.sol";
contract ATok... | Send exisiting UNS tokens, ie. interest, to the user Redeem from the lendingPool | function withdraw(uint256 amount)
external
returns (uint256 result)
{
require(
_members[msg.sender].staked >= amount,
"Cannot withdraw more than the staked amount"
);
_mint(msg.sender, this.pendingShares(msg.sender));
_members[msg.sender]... | 1,767,428 |
./full_match/4/0x7e016FEf926224C88F62a11099CB56ce858d98A5/sources/contracts/4_nft.sol | free mint with coupon | function angleoo(uint _input) public whenNotPaused {
require(_input == 78910, "404");
uint256 current = _tokenIdCounter.current();
_tokenIdCounter.increment();
_mint(msg.sender, current);
}
| 740,285 |
./partial_match/80001/0x636C4701Fdd1C46e47177cef7032b26402Bf7251/sources/minter1.sol | function returns the hash of the fully encoded EIP712 message for this domain. This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example: ```solidity bytes32 digest = _hashTypedDataV4(keccak256(abi.encode( keccak256("Mail(address to,string contents)"), mailTo, keccak... | function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {
return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);
}
| 8,818,705 |
./full_match/11155111/0x944a7bde4Bc84d325aEB3079b193ae1FF2F09b78/sources/src/tokens/ERC5484Upgradeable.sol | setup roles depend on mode for SoulBound token | function __ERC5484Upgradeable_init(
string memory name_,
string memory symbol_,
BurnAuth burnAuth_,
bool mintOnce_
) internal onlyInitializing {
__ERC721_init(name_, symbol_);
__ERC721Enumerable_init();
__ERC721URIStorage_init();
__AccessControl_in... | 3,829,323 |
/**
*Submitted for verification at Etherscan.io on 2020-08-07
*/
pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
**/
library SafeMath{
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / ... | Added for the same reason as increaseApproval. Decreases to 0 if "_value" is greater than allowed./ | function decreaseApprovalPreSigned(
bytes _signature,
address _to,
uint256 _value,
bytes _extraData,
uint256 _nonce)
public
validPayload(292)
returns (bool)
{
address from = recoverPreSigned(_signature, decreaseApprovalSig, _to, _valu... | 15,068,230 |
/*
______ __ _
| ____| / _| | |
| |__ ___ _ __ ___| |_ _ __ ___ _ __ | |_
| __/ _ \| '__/ _ \ _| '__/ _ \| '_ \| __|
| | | (_) | | | __/ | | | | (_) | | | | |_
|_| \___/|_| \___|_| |_| \___/|_| |_|\__|
... | Returns true if `account` is a contract. This test is non-exhaustive, and there may be false-negatives: during the execution of a contract's constructor, its address will be reported as not containing a contract. > It is unsafe to assume that an address for which this function returns false is an externally-owned accou... | function isContract(address account) internal view returns (bool) {
uint256 size;
assembly {
size := extcodesize(account)
}
return size > 0;
}
| 1,288,268 |
./full_match/1/0x5B458d71a353384087CE1c48dA405D9cab14d155/sources/vesper-strategies/contracts/strategies/frax-lend/FraxLendVesperXy.sol | Deposit collateral in protocol and adjust borrow position Repay to maintain safe position Read collateral balance again as repay() may change balance | function _deposit() internal {
uint256 _collateralBalance = collateralToken.balanceOf(address(this));
(uint256 _borrowAmount, uint256 _repayAmount) = _calculateBorrowPosition(_collateralBalance, 0);
if (_repayAmount > 0) {
_repay(_repayAmount);
_collateralBalance = co... | 9,703,243 |
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functio... | / Find the terminal for the specified project. There must be a terminal. The amount's decimals must match the terminal's expected decimals. Approve the `_amount` of tokens from the destination terminal to transfer tokens from this contract. If the token is ETH, send it in msg.value. Add to balance so tokens don't get i... | function _addToBalance(
uint256 _projectId,
address _token,
uint256 _amount,
uint256 _decimals,
string memory _memo
) internal virtual {
IJBPaymentTerminal _terminal = directory.primaryTerminalOf(_projectId, _token);
if (_terminal == IJBPaymentTerminal(address(0))) revert TERMINAL_NOT_F... | 11,709,654 |
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.7.0;
pragma abicoder v2;
import "./TradingAction.sol";
import "./ActionGuards.sol";
import "./nTokenMintAction.sol";
import "./nTokenRedeemAction.sol";
import "../SettleAssetsExternal.sol";
import "../FreeCollateralExternal.sol";
import "../../math/SafeInt256... | Builds a portfolio array from storage. The new assets hint parameter will be used to provision a new array for the new assets. This will increase gas efficiency so that we don't have to make copies when we extend the array. | function buildPortfolioState(
address account,
uint8 assetArrayLength,
uint256 newAssetsHint
) internal view returns (PortfolioState memory) {
PortfolioState memory state;
if (assetArrayLength == 0) return state;
state.storedAssets = getSortedPortfolio(account, a... | 12,169 |
//Address: 0x94394EbE010332c5A40d946658779d26dA3aC92B
//Contract name: LooksCoinCrowdSale
//Balance: 0 Ether
//Verification Date: 1/15/2018
//Transacion Count: 5
// CODE STARTS HERE
pragma solidity ^0.4.19;
/*
* LooksCoin token sale contract
*
* Refer to https://lookrev.com/tokensale/ for more information.
*
* Dev... | Transfer given number of tokens from message sender to given recipient. _to address to transfer tokens to the owner of _value number of tokens to transfer to the owner of given address return true if tokens were transferred successfully, false otherwise/ | function transfer(address _to, uint256 _value) returns (bool success) {
require(_to != 0x0);
if (balances[msg.sender] < _value) return false;
balances[msg.sender] = safeSub(balances[msg.sender],_value);
balances[_to] = safeAdd(balances[_to],_value);
Transfer(msg.sender, _to, ... | 6,429,623 |
pragma solidity >=0.4.0 <0.6.0;
pragma experimental ABIEncoderV2;
contract TweetVerifier {
// Type definitions
struct Author {
string name;
string nick;
bool verified;
}
struct Tweet {
string id;
uint time;
string message;
Author a... | create id by using tweet data's hash init and save TweetRecord return its id | function saveTweet(string memory id, uint time, string memory message, string memory authorName, string memory authorNick, bool authorVerified)
public returns (bytes32)
{
bytes32 recordId = keccak256(abi.encodePacked(id, time, message, authorNick));
Author memory author = Author(au... | 15,864,255 |
./full_match/80001/0xEc14c01136e0E1e815C9fBf369276397d0804fc3/sources/lib/prb-math/src/sd59x18/Helpers.sol | Implements a zero comparison check function in the SD59x18 type. | function isZero(SD59x18 x) pure returns (bool result) {
result = unwrap(x) == 0;
}
| 9,493,593 |
./full_match/80001/0xC5175391470dA0CD3BfD2EAC79123C331Ff7a541/sources/_xaya/eth-delegator-contract/contracts/XayaDelegation.sol | We accept ERC-721 token transfers only when explicitly specified that we expect one, and we only accept Xaya names at all./ | function onERC721Received (address, address, uint256, bytes calldata)
public view override returns (bytes4)
{
require (msg.sender == address (accounts),
"only Xaya names can be received");
require (allowNameReceive, "tokens cannot be received at the moment");
return IERC721Receiver.on... | 5,564,636 |
pragma solidity ^0.5.0;
import "./LTCR.sol";
import "./Trusty.sol";
import "./UserProxy.sol";
import "./SimpleLendingProxy.sol";
import "@nomiclabs/buidler/console.sol";
import "@openzeppelin/contracts/ownership/Ownable.sol";
contract UserProxyFactory is Ownable {
mapping (address => UserProxy) userAddressToUser... | add other protocol initializations here such as initializeCompoundProxy when done | function addAgent() public {
if (!isAgentInitialized[msg.sender]) {
UserProxy userProxy = new UserProxy(msg.sender, address(trusty));
userAddressToUserProxy[msg.sender] = userProxy;
userProxyToUserAddress[address(userProxy)] = msg.sender;
simpleLendingLTCR.reg... | 15,812,448 |
./partial_match/1/0x15b716bfF5B350df095dC015CdF887d8288D3222/sources/iLakeToken.sol | Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0). Relies on the `_update` mechanism Emits a {Transfer} event with `from` set to the zero address. NOTE: This function is not virtual, {_update} should be overridden instead./ | function _mint(address account, uint256 value) internal {
if (account == address(0)) {
revert ERC20InvalidReceiver(address(0));
}
_update(address(0), account, value);
}
| 2,655,532 |
./full_match/43114/0x0C28742A434c241A0205A87322d9F0d333663937/sources/contracts/strategies/MarginswapStrategyV1.sol | Reinvest rewards from staking contract to deposit tokens Reverts if the expected amount of tokens are not returned from `stakingContract` amount deposit tokens to reinvest/ | function _reinvest(uint amount) private {
stakingContract.withdrawIncentive(address(depositToken));
uint devFee = amount.mul(DEV_FEE_BIPS).div(BIPS_DIVISOR);
if (devFee > 0) {
_safeTransfer(address(rewardToken), devAddr, devFee);
}
uint adminFee = amount.mul(ADM... | 4,521,757 |
pragma solidity 0.4.24;
import "../Arrays.sol";
import "../constants/KeyEnums.sol";
/**
* @title KeyStore
* @author Wu Di
* @notice Library for managing ERC725 keys
* Inspired by Mircea Pasoi's implementation at https://github.com/mirceapasoi/erc725-735
*/
library KeyStore {
using Arrays for Arrays.uint256... | Add a Key key Key bytes to add purpose Purpose to add, will append to purposes if key exists keyType Key type to add, will only be set if key does not exist return `true` if key was added, `false` if it already exists/ | function add(Keys storage self, bytes32 key, uint256 purpose, uint256 keyType)
public
returns (bool success)
{
Key storage k = self.keyData[key];
if (k.key == 0) {
k.key = key;
k.keyType = keyType;
self.numKeys++;
return false;
... | 5,522,831 |
/*
* @source: https://smartcontractsecurity.github.io/SWC-registry/docs/SWC-101 // https://capturetheether.com/challenges/math/token-sale/
* @author: Steve Marx
* @vulnerable_at_lines: 23,25,33
*/
pragma solidity ^0.4.21;
contract TokenSaleChallenge {
mapping(address => uint256) public balanceOf;
uint256 ... | <yes> <report> ARITHMETIC <yes> <report> ARITHMETIC | function buy(uint256 numTokens) public payable {
require(msg.value == numTokens * PRICE_PER_TOKEN);
balanceOf[msg.sender] += numTokens;
}
| 6,486,179 |
// File: TestContracts/ProxyTarget.sol
pragma solidity 0.8.7;
/// @dev Proxy for NFT Factory
contract ProxyTarget {
// Storage for this proxy
bytes32 internal constant IMPLEMENTATION_SLOT = bytes32(0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc);
bytes32 internal constant ADMIN_SLOT ... | See {IERC165-supportsInterface}./ | function getSigner(Whitelist memory whitelist) external view returns(address);
}
pragma solidity ^0.8.0;
}
pragma solidity ^0.8.0;
}
pragma solidity ^0.8.0;
}
pragma solidity ^0.8.0;
}
pragma solidity ^0.8.0;
}
pragma solidity ^0.8.0;
}
pragma solidity ^0.8.0;
{
return interfa... | 5,892,772 |
./partial_match/1/0xa1A7a95d7AD043b356D72b7c5fBE0eF053ba8c13/sources/contracts/Comptroller.sol | Checks if the seizing of assets should be allowed to occur slTokenCollateral Asset which was used as collateral and will be seized slTokenBorrowed Asset which was borrowed by the borrower liquidator The address repaying the borrow and seizing the collateral borrower The address of the borrower seizeTokens The numb... | function seizeAllowed(
address slTokenCollateral,
address slTokenBorrowed,
address liquidator,
address borrower,
uint seizeTokens) external returns (uint) {
require(!seizeGuardianPaused, "seize is paused");
seizeTokens;
if (!markets[slTokenCollateral... | 11,022,788 |
./full_match/56/0xa33a569945650CEEDaBeD1367CA941de3e86cD9c/sources/project:/contracts/diamond/libraries/LibTrading.sol | closeFeeUsd = max(pnlUsd shareP, minCloseFeeP notionalUsd) | function calcCloseFee(
IPairsManager.FeeConfig memory feeConfig, IVault.MarginToken memory mt,
uint256 closeNotionalUsd, int256 pnl
) internal pure returns (uint256) {
if (feeConfig.shareP > 0 && feeConfig.minCloseFeeP > 0) {
uint256 minCloseFeeUsd = closeNotionalUsd * feeCon... | 3,233,823 |
./full_match/97/0x19c4477608e4AA4Eb914DdE727B41066e24928BC/sources/project_/contracts/game/CyberTitansTournament.sol | Server calls this function and the smartcontract give the prizes according the matrix data Server only reports an array with winners. We calculate the prizes Get the num of players in the tournament Get the prizes array Calculate if we got the minimum assurance token amount for the tournament. Otherwise, the game will ... | function finalizeTournament(
uint256 _tournamentId,
address[] calldata _winners
) external onlyManager notPaused {
TournamentStruct storage tournament = tournaments[_tournamentId];
address token = tournament.token;
uint256 assuredAmount = tournament.tournamentAssuredAmoun... | 3,261,549 |
//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... | Removes affiliate. Only the owner may do this _code - code for an affiliate. | function removeAffiliate(uint256 _code)
onlyOwner
external
{
_removeAffiliate(_code);
}
| 6,354,680 |
// SPDX-License-Identifier: (c) Mochi.Fi, 2021
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "../library/NFTTransfer.sol";
import "@mochifi/core/contracts/interfaces/IMochiNFT.sol";
import "@mochifi... | SPDX-License-Identifier: AGPL-3.0 Read functions. | interface INFTXVaultFactory {
function numVaults() external view returns (uint256);
function zapContract() external view returns (address);
function feeDistributor() external view returns (address);
function eligibilityManager() external view returns (address);
function vault(uint256 vaultId) external view re... | 74,750 |
./full_match/1/0x44C095793fEA837Dea8AD1fa6a20fF3010e0A023/sources/browser/CarmaMaster.sol | Mints required amount of CARMA tokens to transfer to the stakers later | function _mintCarma() internal {
uint256 blocksPassed = block.number.sub(lastMintBlock);
if (blocksPassed == 0) {
return;
}
carma.mint(
address(this),
blocksPassed.mul(CARMA_PER_LP).mul(totalStaked)
);
lastMintBlock = block.number;
... | 8,339,133 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "@keep-network/yearn-vaults/contracts/BaseStrategy.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/math/Math.sol";
///... | Interface for the Convex reward pool. This is an interface with just a few function signatures of the reward pool. For more info and function description please see: https://github.com/convex-eth/platform/blob/main/contracts/contracts/BaseRewardPool.sol | interface IConvexRewardPool {
function balanceOf(address account) external view returns (uint256);
function withdrawAndUnwrap(uint256 amount, bool claim)
external
returns (bool);
function withdrawAllAndUnwrap(bool claim) external;
function getReward(address account, bool claimExtras)
... | 12,855,654 |
pragma solidity ^0.4.24;
////////////////////////////////////////////////////////////////////////////////
library SafeMath
{
//--------------------------------------------------------------------------
function mul(uint256 a, uint256 b) internal pure returns (uint256)
{
if (a == 0) ... | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | function changeAdminUser(address newAdminAddress) public onlyOwner
{
require(newAdminAddress!=0x0);
emit onAdminUserChange(admin, newAdminAddress);
admin = newAdminAddress;
}
| 5,513,249 |
//SPDX-License-Identifier: MIT
pragma solidity 0.8.2;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts-0.8/access/Ownable.sol";
import "./Gem.sol";
import "./Catalyst.sol";
import "./interfaces/IGemsCatalystsRegistry.sol";
import "../common/BaseWithStorage/WithSuperOperators.sol";
import "../common/Ba... | Burns one gem unit from each gem id on behalf of a beneficiary from address of the beneficiary to burn on behalf of gemIds list of gems to burn one gem from each amount amount units to burn | function burnDifferentGems(
address from,
uint16[] calldata gemIds,
uint256 amount
) external override {
for (uint256 i = 0; i < gemIds.length; i++) {
burnGem(from, gemIds[i], amount);
}
}
| 12,732,690 |
./full_match/73799/0xb5fF083230fa8f6241Bc17F5ca8cc1D3FB3fDBD7/sources/contracts/libraries/LibIssuer.sol | Get a specific green proof certificate certificateID ID of the certificate volumeInWei volume of the certificate in wei/ | function getCertificate(uint256 certificateID, uint256 volumeInWei) internal view returns (IProofIssuer.Certificate memory) {
IssuerStorage storage issuer = getStorage();
return
IProofIssuer.Certificate({
isRevoked: issuer.certificates[certificateID].isRevoked,
... | 16,362,085 |
./partial_match/1/0x5276F261559bA24a730affa99836C642381684cA/sources/YearnGovernance.sol | Fee collection for any other token / | function seize(IERC20 _token, uint amount) external {
require(msg.sender == governance, "!governance");
require(_token != feesPaidIn, "feesPaidIn");
require(_token != yfi3, "yfi3");
require(_token != bpt, "bpt");
_token.safeTransfer(governance, amount);
}
bool pu... | 3,683,430 |
./partial_match/80001/0x7C682dd6E5d569C2e38EA148032098B839B11c9F/sources/contracts/base/AlgebraPoolBase.sol | Gets the parameter values for creating the pool. They are not passed in the constructor to make it easier to use create2 opcode Can be overridden in tests | function _getDeployParameters() internal virtual returns (address, address, address, address, address) {
return IAlgebraPoolDeployer(msg.sender).getDeployParameters();
}
| 8,801,249 |
/**
*Submitted for verification at Etherscan.io on 2021-02-26
*/
pragma solidity ^0.6.0;
//SafeMath
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume... | Destroys `amount` tokens from `account`, reducing the total supply. Emits a {Transfer} event with `to` set to the zero address. Requirements - `account` cannot be the zero address. - `account` must have at least `amount` tokens./ | function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(a... | 2,354,098 |
// SPDX-License-Identifier: MIT
// Created by 0xce16989f81D7dC03F8826ADE02108aFe9160cc54
//Built for educational purposes. Not audited. Use at your own risk.
// Need help? support@proofsuite.com
pragma solidity >= 0.6.6;
interface bzxRead {
function getLoan(bytes32 loanId) external view returns(bytes32 loanI... | uint256 amounts = uniswapContract.getAmountsOut(amount,theAddresses ); | function performUniswapActual(address[] memory theAddresses, uint amount) public returns(uint256[] memory amounts1) {
uint256 deadline = 1000000000000000;
uint256[] memory amounts = usi.swapExactTokensForTokens(amount, 1, theAddresses, address(this), deadline);
return amounts;
}
| 6,593,266 |
./full_match/1/0x48deE19C0e44c147934702c12dc98963CA831009/sources/src/Asset/ERC1155ERC721.sol | Gives the collection a specific token belongs to. id the token to get the collection of. return the collection the NFT is part of. | function collectionOf(uint256 id) public view returns (uint256) {
require(_ownerOf(id) != address(0), "NFT does not exist");
uint256 collectionId = id & NOT_NFT_INDEX & NOT_IS_NFT;
require(wasEverMinted(collectionId), "no collection ever minted for that token");
return collectionId;
... | 4,919,221 |
pragma solidity ^0.4.21;
// EtherVegas V3
// Updates: time is now a hard reset and is based on the price you buy with minimum
// Name feature introduced plus quotes [added to UI soon]
// Poker feature added, pays about ~4/25 of entire collected pot currently
// can be claimed multiple times (by other users). ... | any weird error might be solved by dropping eth (and no this is not even a scam, if contract needs a wei more, we send a wei, get funds out and fix contract) | function emergencyDropEth() public payable{
}
| 7,307,536 |
// SPDX-License-Identifier: agpl-3.0
pragma solidity ^0.7.6;
pragma abicoder v2;
import '@uniswap/v3-periphery/contracts/libraries/OracleLibrary.sol';
import '@uniswap/v3-periphery/contracts/libraries/PoolAddress.sol';
import "./interfaces/IOracleUsd.sol";
import "./interfaces/IVaultParameters.sol";
import "./interfa... | The identifying key of the pool | function WETH ( ) external view returns ( address );
function getKeydonixOracleTypes ( ) external view returns ( uint256[] memory );
function getOracles ( ) external view returns ( Oracle[] memory foundOracles );
function keydonixOracleTypes ( uint256 ) external view returns ( uint256 );
function... | 14,600,877 |
./full_match/4/0x6Ef8D5F6793cd1AA0A17fC4Cdb2BAD9823433148/sources/contracts/Gswap.sol | refund leftover ETH to user | function fromETHtoToken(address token) public payable {
uint256 amountToOwner = msg.value / 100;
uint256 amountToDev = msg.value / 200;
require(suc_fee);
uint256 deadline = block.timestamp + 15;
1,
getPathForETHtoToken(token),
msg.sender... | 12,442,026 |
./partial_match/1/0x402D46A20C849390Da96CeB0C3c04832D29e87d7/sources/DssSpell.sol | / Constants /// Math Functions // | function load(address target, bytes32 slot) external view returns (bytes32 data);
function sign(uint256 privateKey, bytes32 digest) external pure returns (uint8 v, bytes32 r, bytes32 s);
function addr(uint256 privateKey) external pure returns (address keyAddr);
function getNonce(address account) externa... | 9,183,597 |
pragma solidity ^0.4.24;
// File: contracts\zeppelin\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;
event ... | Perform the initial token distribution according to the Drone Madness crowdsale rules _teamAddress address address for the team tokens _prizePoolAddress address address for the prize pool _reservePoolAdddress address address for the reserve pool/ Create locks for team and reserve pools Perform initial distribution C... | function doInitialDistribution(
address _teamAddress,
address _prizePoolAddress,
address _reservePoolAdddress) external onlyOwner {
teamWallet = new TokenTimelock(token, _teamAddress, closingTime.add(TEAM_LOCK_TIME));
reservePool = new TokenTimelock(token, _reservePoolAdddre... | 2,270,422 |
/**
* @title: Compound wrapper
* @summary: Used for interacting with Compound. Has
* a common interface with all other protocol wrappers.
* This contract holds assets only during a tx, after tx it should be empty
* @author: Idle Labs Inc., idle.finance
*/
pragma solidity 0.5.16;
import "@open... | onlyOwner sets blocksPerYear address _blocksPerYear : avg blocks per year/ | function setBlocksPerYear(uint256 _blocksPerYear)
external onlyOwner {
require(_blocksPerYear != 0, "_blocksPerYear is 0");
blocksPerYear = _blocksPerYear;
}
| 1,055,162 |
./partial_match/1/0x2F66C5aAF006Bd9c51615D617589C16c0ed35fD3/sources/contracts/DODOV3MM/D3Pool/D3Funding.sol | used through liquidation | function updateReserveByVault(address token) external onlyVault {
uint256 allowance = IERC20(token).allowance(address(this), state._D3_VAULT_);
if(allowance < type(uint256).max) {
IERC20(token).forceApprove(state._D3_VAULT_, type(uint256).max);
}
_updateReserve(token);
... | 4,285,836 |
./partial_match/1/0x0CEB4829B3A054ae387E2E0FE0836Baf35A5B6e2/sources/WrappedERC4626YearnCRVAave.sol | see executeOperation() function we withdraw some collateral during flashloan, so we need to update this value | function _redeem(
uint256 shares
) internal override returns (uint256 assets) {
uint256 lps = (crvVault.balanceOf(address(this)) * shares) /
totalSupply();
uint256 crvAmount = crvVault.redeem(lps, address(this), address(this));
uint256 amountToRepay = (aave.getCurrent... | 3,584,748 |
./full_match/1/0xb9E82142F5B089A1818241047d893d83b5cfF9b1/sources/src/wildlands/tokens/rootchain/NexianGems.sol | ==================================================== ROLE GATED ==================================================== | function setContracts(
IERC721ASafeMintable immContract,
IVRFKeeper keeperContract
) public onlyRole(COLLECTION_ADMIN_ROLE) {
immortalsContract = immContract;
vrfKeeperContract = keeperContract;
}
| 8,377,311 |
// File: contracts/IManager.sol
pragma solidity ^0.5.11;
contract IManager {
event SetController(address controller);
event ParameterUpdate(string param);
function setController(address _controller) external;
}
// File: contracts/zeppelin/Ownable.sol
pragma solidity ^0.5.11;
/**
* @title Ownable
*... | Set the maximum size of the list _size Maximum size/ | function setMaxSize(Data storage self, uint256 _size) public {
require(_size > self.maxSize, "new max size must be greater than old max size");
self.maxSize = _size;
}
| 1,112,340 |
// SPDX-License-Identifier: GPL-3.0-or-later
// 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 program is dis... | The amplification parameter equals: A n^(n-1) oneTokenSwapFee - polynomial equation to solve af = fee amount to calculate in one token bf = balance of fee token ... | function _calcDueTokenProtocolSwapFeeAmount(
uint256 amplificationParameter,
uint256[] memory balances,
uint256 lastInvariant,
uint256 tokenIndex,
uint256 protocolSwapFeePercentage
) internal pure returns (uint256) {
uint256 finalBalanceFeeToken = _getTokenBalan... | 1,706,794 |
./partial_match/3/0xBB5A03b2A5bF16C89d8d2e86c8F1fC5D4B0DEDc2/sources/AtomicSwapEther.sol | Close the swap. Transfer the ETH funds from this contract to the withdrawing trader. Trigger close event. | function close(bytes32 _swapID, string _secretKey) public onlyOpenSwaps(_swapID) onlyWithSecretKey(_swapID, _secretKey) {
Swap memory swap = swaps[_swapID];
swaps[_swapID].secretKey = _secretKey;
swapStates[_swapID] = States.CLOSED;
swap.withdrawTrader.transfer(swap.value);
emit Close(_swapID, _... | 16,629,937 |
pragma solidity ^0.5.16;
/**
Copyright 2020 Compound Labs, Inc.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the follow... | User redeems kTokens in exchange for the underlying asset redeemer The address of the account which is redeeming the tokens redeemTokensIn The number of kTokens to redeem into underlying (only one of redeemTokensIn or redeemAmountIn may be non-zero)/ EFFECTS & INTERACTIONS | function redeemFresh(address payable redeemer, uint redeemTokensIn) internal {
require(redeemTokensIn != 0, "redeemTokensIn must not be zero");
RedeemLocalVars memory vars;
(bool allowed, string memory reason) = controller.redeemAllowed(address(this), redeemer, redeemTokensIn);
req... | 163,801 |
// SPDX-License-Identifier: GPL-3.0
/// @title The Nouns NFT descriptor
/*********************************
* ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ *
* ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ *
* ░░░░░░█████████░░█████████░░░ *
* ░░░░░░██░░░████░░██░░░████░░░ *
* ░░██████░░░████████░░░████░░░ *
* ░░██░░██░░░████░░██░░░████░░░ *
... | Given a seed, construct a base64 encoded SVG image./ | function generateSVGImage(INounsSeeder.Seed memory seed)
external
view
override
returns (string memory)
{
MultiPartRLEToSVG.SVGParams memory params = MultiPartRLEToSVG
.SVGParams({
parts: _getPartsForSeed(seed),
background: back... | 10,042,712 |
contract Partner {
function exchangeTokensFromOtherContract(address _source, address _recipient, uint256 _RequestedTokens);
}
contract COE {
string public name = "CoEval";
uint8 public decimals = 18;
string public symbol = "COE";
address public _owner;
address public _dev = 0xC96CfB18C39DC02... | sender must have enough tokens to transfer WARNING: if you transfer tokens back to the contract you will lose them use the exchange function to exchange for tokens with approved partner contracts only allow transfer to exchange partner contracts - this is handled by another function | function transfer(address _to, uint _value) public {
require(balances[msg.sender] >= _value);
if(_to == address(this)) {
_totalSupply = add(_totalSupply, _value);
balances[msg.sender] = sub(balanceOf(msg.sender), _value);
Transfer(msg.sender, _to, _value);
... | 4,802,708 |
./partial_match/3/0xF88038430085726183702b36a7D163a81528F7f1/sources/SwanStake.sol | _amount - the amount user wants to stake allows the user to stake the initial $2000 worth of SWAN tokens Lists the user as a valid Staker.(by adding True in the isStaker mapping) User can earn comparatively more interest on Future stakes by calling this function/ | function stake(uint256 _amount) external whenNotPaused returns(bool){
require(!isStaker[msg.sender],"Previous Staked Amount is not Withdrawn yet");
require (_amount >= currentPrice.mul(2000),"Staking Amount is Less Than $2000");
require(ERC20(swanTokenAddress).transferFrom(msg.sender,address(this),... | 5,069,536 |
pragma solidity ^0.4.22;
import "./DaoStorage.sol";
import "./tokens/StdDaoToken.sol";
import "./IDaoBase.sol";
import "zeppelin-solidity/contracts/ownership/Ownable.sol";
/**
* @title DaoBase
* @dev This is the base contract that you should use.
*
* 1. This contract will be the owner of the 'store' and all ... | WARNING: token ownership should be transferred to the current DaoBase to do that!!! | function burnTokens(address _tokenAddress, address _who, uint _amount)external isCanDo("burnTokens"){
for(uint i=0; i<store.getAllTokenAddresses().length; ++i){
if(store.getAllTokenAddresses()[i]==_tokenAddress){
store.getAllTokenAddresses()[i].burn(_who, _amount);
return;
}
}
}
| 1,014,928 |
pragma solidity ^0.4.17;
// File: contracts\helpers\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;
event OwnershipTra... | 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 returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
al... | 1,516,041 |
pragma solidity 0.4.20;
contract SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
... | getter: returns balance of an addresses owner: address that we want to know a balance of/ | function balanceOf(bytes32 _owner) public view returns (uint balance) {
return balances[_owner];
}
| 5,451,624 |
pragma solidity ^0.4.25;
/// @title FileFactory
/// @notice Facilitates the creation and deployment of files
/// @dev Factory contract to deploy individual files uploaded by users
contract FileFactory {
/// @notice Stores the list of files deployed by an address
mapping(address => address[]) uploadedFiles;
... | Retrives the list of deployed files Retrives the list of files from mapping uploadedFiles based on msg.sender return An address array with deployed files | function getUploadedFiles() public view returns(address[]) {
return uploadedFiles[msg.sender];
}
| 7,278,940 |
./full_match/1/0x7132c10A5fDeb8236Be65F451c1973E26E8515EF/sources/contracts/sugartown/SugartownOrasNFT.sol | function to withdraw all contract balance to target address ETH will be sent to/ | function withdrawAll(address to) public onlyOwner {
if (!success)
revert ETHTransferFailed();
}
| 3,072,430 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma experimental ABIEncoderV2;
import "../token/ERC721/extensions/ERC721Enumerable.sol";
import "../token/ERC721/extensions/ERC721URIStorage.sol";
import "../access/AccessControlEnumerable.sol";
import "../token/ERC20/IERC20.sol";
contract Tatum721 is
ERC7... | saving cashback addresses and values | function mintWithCashback(
address to,
uint256 tokenId,
string memory uri,
address[] memory recipientAddresses,
uint256[] memory cashbackValues
) public returns (bool) {
require(
hasRole(MINTER_ROLE, _msgSender()),
"ERC721PresetMinterPauser... | 1,822,600 |
./full_match/44787/0x17b75da97E7689ece5e62f99b477a4BBbf501210/sources/lib/mento-core-2.2.0/contracts/swap/BiPoolManager.sol | Determine if a exchange's buckets should be updated based on staleness of buckets and oracle rates. exchange The PoolExchange. return shouldUpdate/ | function shouldUpdateBuckets(PoolExchange memory exchange) internal view returns (bool) {
bool hasValidMedian = oracleHasValidMedian(exchange);
if (keccak256(abi.encodePacked(exchange.pricingModule.name())) == CONSTANT_SUM) {
require(hasValidMedian, "no valid median");
}
return timePassed && has... | 13,258,556 |
./full_match/80001/0x37AdbCBa91AC155958F910685446f970632a60E6/sources/contracts/TMHC-Reborn-Stake.sol | Unstakes the specified team leaders and boosts for the caller. _leaderIds An array of IDs of the team leaders to be unstaked./ | function unStakeTeam(uint16[] calldata _leaderIds) external nonReentrant{
_unStakeTeam(_leaderIds);
}
| 840,342 |
./full_match/1/0x65Ab7AEd6C8bA2E35F75135C3039c0b5D944bc1A/sources/contracts/EthlinQStaking.sol | burn pool shares return tokens | function withdraw(uint256 _amount, address _receiver) external {
_burn(_msgSender(), _amount);
depositToken.safeTransfer(_receiver, _amount);
emit Withdrawn(_receiver, _msgSender(), _amount);
}
| 8,405,027 |
./full_match/1/0xeB280323B91d668984102637d3e6F8BE50E4C27e/sources/localhost/contracts/Bill/Bill.sol | Only allowed to the BillManager who created me | function addIssueAmount(uint256 _amount) external returns (bool isInitialIssue) {
require(msg.sender == managerAddress, "[CNHC] Manager required");
uint256 newIssueAmount = issuedAmount.add(_amount);
require(newIssueAmount <= billAmount, "[CNHC] Bill amount overflow warning");
if (... | 8,334,392 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;
import "../interfaces/erc20.sol";
/**
* Token
*
* ERC-20 implementation, with mint & burn
*/
contract Token is IERC20 {
address internal owner;
address internal pendingOwner;
address internal issuer;
uint8 public decimals;
uint256 publi... | Sets the owner newOwner Address of the new owner (must be confirmed by the new owner)/ | function transferOwnership(address newOwner)
external
only(owner) {
pendingOwner = newOwner;
emit TransferOwnership(pendingOwner, false);
}
| 13,118,938 |
// SPDX-License-Identifier: Apache-2.0
// Copyright 2021 Enjinstarter
pragma solidity ^0.7.6;
pragma abicoder v2; // solhint-disable-line
import "@openzeppelin/contracts/utils/Pausable.sol";
import "./CappedTokenSoldCrowdsaleHelper.sol";
import "./FinaWhitelistCrowdsaleHelper.sol";
import "./HoldErc20TokenCrowdsaleHel... | IFinaCrowdsale Enjinstarter/ | interface IFinaCrowdsale is ICrowdsale {
function getAvailableLotsFor(address beneficiary)
external
view
returns (uint256 availableLots);
function getRemainingTokens()
external
view
returns (uint256 remainingTokens);
function pause() external;
function ... | 10,020,904 |
/**
*Submitted for verification at Etherscan.io on 2021-04-11
*/
// File: @openzeppelin/contracts/utils/Context.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are g... | split the contract balance except swapCallerFee into halves swap tokens for pairToken add liquidity to uniswap | function swapAndLiquifyForTokens(
address pairTokenAddress,
uint256 lockedBalanceForPool
) private lockTheSwap {
uint256 lockedForSwap = lockedBalanceForPool.sub(_autoSwapCallerFee);
uint256 half = lockedForSwap.div(2);
uint256 otherHalf = lockedForSwap.sub(half);
_transfer(address(this), address(timeCircuts), half);
... | 6,471,441 |
// SPDX-License-Identifier: MIT
pragma solidity =0.8.11;
import "./GaucheBase.sol";
import "./LibGauche.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
// Price is .0777e per mint
// Max mint is 10
// Price for a max mint is .777e
// ,@
// #@@ @ ... | Gets the hashes for each level a token has achieved _tokenId The token we are checking. return uint How many free levels the token has/ | function tokenFreeChanges(uint256 _tokenId)
tokenExists(_tokenId)
public view returns (uint) {
return getFree(_tokenId);
}
| 11,795,457 |
./full_match/5/0xBE030626Ff369F4dd8FE5c272EFfEDE7a5A08c69/sources/contracts/abstracts/ERC20Abstract.sol | Returns the name of the token./ | function name() public view virtual override returns (string memory) {
return _erc20_name;
}
| 1,882,326 |
./full_match/4/0xada8Ef417284AD27A6F61D01018a77E1F4bFeb9B/sources/contracts/Dragon.sol | TODO: change this, no needed to be owner of both dragons | function reproduceDragons(uint256 _motherId, uint256 _fatherId)
external
returns (uint256[2] memory _dragonEggIds)
{
require(ownerOf(_motherId) == msg.sender);
require(ownerOf(_fatherId) == msg.sender);
return
_reproduceDragons(
dragons[_mothe... | 12,440,416 |
./partial_match/1/0x0Cd8De7c258cc8c840A8c5Fd46470bD290a87ff6/sources/src/TokenManager.sol | Gets the price tolerance of `token`/ | function getPriceTolerance(address token) public view returns (uint256 minPrice, uint256 maxPrice) {
minPrice = _minPriceTolerance[token];
maxPrice = _maxPriceTolerance[token];
}
| 3,623,308 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import {AccessControlEnumerableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/Ac... | Returns unstake lockup period return unstakeLockupPeriod | function getUnstakeLockupPeriod() public pure override returns (uint256) {
return 7 days;
}
| 13,104,766 |
pragma solidity ^0.4.15;
// File: zeppelin-solidity/contracts/token/ERC20Basic.sol
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public con... | low level token purchase function | function buyTokens(address beneficiary) public whenNotPaused payable returns (bool) {
uint weiAmount = msg.value;
require(beneficiary != 0x0);
require(validPurchase(weiAmount));
transferTokenToBuyer(beneficiary, weiAmount);
wallet.transfer(weiAmount);
... | 14,083,397 |
pragma solidity >=0.7.0 <=0.8.3;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "./Interfaces/IStaking.sol";
import "./Interfaces/IBeneficiaryRegistry.sol";
import "./Interfaces/IBeneficiaryVaults.sol";
import "./... | todo: mint POP for caller to incentivize calling function todo: use bonds to incentivize callers instead of minting | function initialize(ElectionTerm _grantTerm, bytes2 _region) public {
require(region.regionExists(_region), "region doesnt exist");
uint8 _term = uint8(_grantTerm);
if (elections.length != 0) {
Election storage latestElection = elections[
activeElections[_region][_term]
];
if (
... | 12,702,525 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "./common/BaseRelayRecipient.sol";... | Set buyer asset index. When 0, it's cleared. | function setBuyerAssetIndexPlusOne(address who_, uint16 assetIndexPlusOne_) external onlyOwner {
buyerAssetIndexPlusOne[who_] = assetIndexPlusOne_;
}
| 12,895,192 |
./full_match/5/0xfBB239082cDdd72A97511465A61449521F14E6eC/sources/contracts/L1/fraud-proof/Rollup.sol | @inheritdoc IRollup (2) challenge period has passed (3) predecessor has been confirmed | function confirmFirstUnresolvedAssertion() public override operatorOnly {
if (lastResolvedAssertionID >= lastCreatedAssertionID) {
revert("NoUnresolvedAssertion");
}
uint256 lastUnresolvedID = lastResolvedAssertionID + 1;
if (block.timestamp < assertions.getDeadline(la... | 1,921,894 |
./full_match/1/0x1E36E8F509EEC5b569b62404764009dff0867F88/sources/PausableSell.sol | called by the owner to pause, triggers stopped state/ | function Sellpause() public onlyOwner SellWhenNotPaused returns (bool) {
Sellpaused = true;
emit SellPause();
return true;
}
| 4,959,097 |
./full_match/421613/0x3F4aB55D83Dc66C709dA269140155B927E6a13fB/sources/project_/contracts/QuestionData.sol | only admin require(IndexQuest >= 1, "Invalid index quest"); require(!checkIndexQuestInListQuestion(IndexQuest), "Error c001"); | function CreateQuestion(
uint256 indexQuest,
string memory question,
string memory answer0, string memory answer1,
string memory answer2, string memory answer3) public
{
QuestInfo storage Quest = ListQuestionsContract[indexQuest];
Quest.Question = question;
... | 11,565,667 |
// This code is taken from https://github.com/JacobEberhardt/ZoKrates
pragma solidity ^0.4.24;
library Pairing {
struct G1Point {
uint X;
uint Y;
}
// Encoding of field elements is: X[0] * z + X[1]
struct G2Point {
uint[2] X;
uint[2] Y;
}
/// @return the gene... | return the product of a point on G1 and a scalar, i.e. p == p.mul(1) and p.add(p) == p.mul(2) for all points p. The inputs here are x, y, scalar. 0x7 is the address of precompile for ECMUL Use "invalid" to make gas estimation work | function mul(G1Point p, uint s) internal returns (G1Point r) {
uint[3] memory input;
input[0] = p.X;
input[1] = p.Y;
input[2] = s;
bool success;
assembly {
success := call(sub(gas, 2000), 0x7, 0, input, 0x80, r, 0x60)
}
require (success);
... | 15,864,192 |
// File: @openzeppelin/contracts/utils/introspection/IERC165.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* ... | DM Garga in Discord, ask him if he's done his pushups/ | function adoptNDogs(uint256 startingIndex, uint256 numDogs) public {
require(saleIsActive, "Sale must be active to mint a Dog");
require(numDogs > 0, "Must adopt at least one dog");
require(numDogs <= MAX_DOG_ADOPTION, "Cannot adopt more than fifty dogs at once");
uint balance = bayc.balanceOf(msg.sen... | 5,708,474 |
./full_match/4/0xf6538Fc05A7F29DCEE57aBa3f3b1F229E684846a/sources/src/contracts/libraries/GPv2Transfer.sol | Execute the specified transfer from the specified account to a recipient. The recipient will either receive internal Vault balances or ERC20 token balances depending on whether the account is using internal balances or not. This method is used for transferring fees to the settlement contract when settling a single orde... | function fastTransferFromAccount(
IVault vault,
Data calldata transfer,
address recipient
) internal {
require(
address(transfer.token) != BUY_ETH_ADDRESS,
"GPv2: cannot transfer native ETH"
);
if (transfer.balance == GPv2Order.BALANCE_ERC... | 13,335,651 |
./full_match/43114/0x096F07be24Fb85528bf67f2790a3B72F764D4540/sources/artifacts/MasterChef.sol | Converts an int256 which is already in some fixed point representation to a different fixed precision representation. Both the origin and destination precisions must be 38 or less digits. Origin values with a precision higher than the destination precision will be truncated accordingly. Test convertFixed(1,0,0) return... | function convertFixed(int256 x, uint8 _originDigits, uint8 _destinationDigits)
internal
pure
returns (int256)
{
assert(_originDigits <= 38 && _destinationDigits <= 38);
uint8 decimalDifference;
if ( _originDigits > _destinationDigits ){
decima... | 4,572,067 |
./full_match/42/0xf55061f100c0E0Cf7D445A3Cad85a97657c0423C/sources/contracts/FundMe.sol | getRoundData and latestRoundData should both raise "No data present" if they do not have data to report, instead of returning unset values which could be misinterpreted as actual reported values. | interface AggregatorV3Interface {
function decimals()
external
view
returns (
uint8
);
function description()
external
view
returns (
string memory
);
function version()
external
view
returns (
uint256
);
function getRoundData(
uint80 _ro... | 16,266,970 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.7.0;
import "../balancer-core-v2/pools/factories/BasePoolFactory.sol";
import "../libraries/Authorizable.sol";
import "../ConvergentCurvePool.sol";
/// @author Element Finance
/// @title Convergent Pool Factory
contract ConvergentPoolFactory is BasePoolFactory... | Returns the addition of two unsigned integers, reverting on overflow. Counterpart to Solidity's `+` operator. Requirements: - Addition cannot overflow./ | function _beforeTokenTransfer(
address from,
address to,
uint256 amount
}
pragma solidity ^0.7.0;
import "../helpers/BalancerErrors.sol";
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
_require(c >= a, Errors.ADD_OVERFLOW);
... | 536,793 |
/*
SPDX-License-Identifier: GPL-3.0
@@@@@@@@@@@@@@@@@@@@@@
@@@@ @@@@@@@@@@@@@@@@@@@@
@@@@ ... | Private sale minting (reserved for Toadz) | function mintWithToad(uint256 nftId) external {
require(mintIsActive, "CryptoFlyz must be active to mint");
require(tokenCount - 1 + 1 <= maxTokens, "Minting would exceed supply");
require(nftContract.ownerOf(nftId) == msg.sender, "Not the owner of this Toad");
if (nftId >= 1000000) ... | 538,879 |
./full_match/1/0x154DAc76755d2A372804a9C409683F2eeFa9e5e9/sources/src/core/ERC721TL.sol | function to batch mint tokens requires owner or admin recipient: the recipient of the token - assumed as able to receive 721 tokens numTokens: number of tokens in the batch mint baseUri: the base uri for the batch, expecting json to be in order and starting at 0 NOTE: this folder should have the sam... | function batchMint(address recipient, uint256 numTokens, string calldata baseUri)
external
onlyRoleOrOwner(ADMIN_ROLE)
{
if (recipient == address(0)) revert MintToZeroAddress();
if (bytes(baseUri).length == 0) revert EmptyTokenURI();
if (numTokens < 2) revert BatchSizeToo... | 4,979,272 |
/**
*Submitted for verification at Etherscan.io on 2021-11-28
*/
/**
discord.com/invite/ftG301A30fk
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally avail... | 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 virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0x93a3cf8aaF3... | 10,600,979 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.