file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
// SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount o...
Initialize staking pool with a Distributor contract The distributor contract calculates how much TRU rewards this contract gets, and stores TRU for distribution. _trueDistributor Distributor contract/
function initialize(ITrueDistributor _trueDistributor) public initializer { UpgradeableClaimable.initialize(msg.sender); trueDistributor = _trueDistributor; rewardToken = _trueDistributor.trustToken(); require(trueDistributor.farm() == address(this), "TrueMultiFarm: Distributor farm ...
6,952,378
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "./ERC721.sol"; import "./Ownable.sol"; import "./ITheNinjaHideout.sol"; contract TheFemaleNinjaHideout is ERC721, Ownable { using Strings for uint256; uint256 public constant MAX_NINJAS = 444; uint256 public reservedNinjas = 44; // With...
return tokenURI if it is set
function tokenURI(uint256 tokenId) public view override returns (string memory) { require(tokenId < totalSupply(), "Token not exist."); string memory _tokenURI = _tokenUriMapping[tokenId]; if (bytes(_tokenURI).length > 0) { return _tokenURI; ...
1,253,342
./partial_match/5/0xabCD258252155b4BF4F2694eC0B789f232eaaAb9/sources/SharedDeposit.sol
USER INTERACTIONS input is whole, not / 1e18 , i.e. in 1 = 1 eth sendmake sure max validator limit not yet reached make sure its mintable TODO: fix this check require(address(this).balance.add(msg.value) < uint256(32).mul(numValidators).mul(1e18));
function deposit() public payable nonReentrant whenNotPaused { uint value = uint(msg.value); uint shareOfOne = value.div(32); uint valMinusAdmin = value.sub(adminFee.mul(shareOfOne)); uint newShareTotal = curValidatorShares.add(valMinusAdmin); require(newShareTotal...
16,843,361
./partial_match/1/0x79241Fd23F74a5587D22E24795776159f5455569/sources/Proposal22.sol
Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. This method is included for ERC20 compatibility. increaseAllowance and decreaseAllowance should be used instead. Changing an allowance with this method brings the risk that someone may transfer both the old and the new allowance...
function approve(address spender, uint256 value) override external returns (bool) { _allowedFragments[msg.sender][spender] = value; emit Approval(msg.sender, spender, value); return true; }
4,022,546
./full_match/80001/0xBd99517e1994226FB8124D37087A0b835829D593/sources/contracts/Portfolio.sol
Write function to update description Optional: Check if the new description is different from the current description
function setDescription(string memory _newDescription) public onlyOwner { require( bytes(_newDescription).length > 0, "Description cannot be empty" ); require( keccak256(bytes(_description)) != keccak256(bytes(_newDescription)), "New descriptio...
5,572,139
// SPDX-License-Identifier: MIT pragma solidity >=0.4.22 <0.9.0; import "./IERC1190.sol"; import "./IERC1190Metadata.sol"; import "./IERC1190OwnershipLicenseReceiver.sol"; import "./IERC1190CreativeLicenseReceiver.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/C...
See {IERC1190-approveCreativeOwnership}./
function approveCreativeOwnership(address to, uint256 tokenId) public virtual override { address creativeOwner = ERC1190.creativeOwnerOf(tokenId); require( to != creativeOwner, "ERC1190: Cannot approve the current creative owner." ); ...
5,414,101
pragma solidity >=0.5.0 <0.6.0; // File: openzeppelin-solidity/contracts/ownership/Ownable.sol /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { ...
pop item from lifo queue/
function popl(Queue storage queue) internal returns (uint index) { index = queue.last; remove(queue, index); }
7,305,594
pragma solidity ^0.5.16; interface IERC20 { function TOTALSUPPLY39() external view returns (uint256); //inject NONSTANDARD NAMING function BALANCEOF342(address account) external view returns (uint256); //inject NONSTANDARD NAMING function T...
inject NONSTANDARD NAMING
function SUB956(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
12,811,412
pragma solidity ^0.5.4; library Counters { using SafeMath for uint256; struct Counter { // This variable should never be directly accessed by users of the library: interactions must be restricted to // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a pr...
Returns the sunset length of a token tokenId The token id
function sunsetLength(uint256 tokenId) external view returns(uint256){ return _sunsetLength[tokenId]; }
5,390,900
// SPDX-License-Identifier: MIT /* Coded for MakerDAO and The Keep3r Network with ♥ by ██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░ ██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░...
events errors variables methods
interface IPausable is IGovernable { event PauseSet(bool _paused); error NoChangeInPause(); function paused() external view returns (bool _paused); function setPause(bool _paused) external; } pragma solidity >=0.8.4 <0.9.0; }
947,560
./full_match/3/0xb9B76944685Dcf1F83a2f28D70beE859B501180f/sources/contracts/kontrakt.sol
always return the id if this isn't an lp token, don't even bother calling getLpData this is an lp token, so let's get some data
function getLpData() external view returns ( bool hasLpData, uint40 id, address token0, address token1, uint256 balance0, uint256 balance1, uint256 price0, uint256 price1 ) { id = _id; if (!_isLpToken) { hasLpData = false; try Util.getLpData(address(_token)) retu...
14,243,205
pragma solidity ^0.4.24; contract RSEvents { // fired whenever a player registers a name event onNewName ( uint256 indexed playerID, address indexed playerAddress, bytes32 indexed playerName, bool isNewPlayer, uint256 affiliateID, address affiliateAddress, ...
returns all current round info needed for front end -functionhash- 0x747dff42 return total keys return time ends return time started return current pot return current player ID in lead return current player in leads address return current player in leads name return airdrop tracker & airdrop pot/ setup local rID
function getCurrentRoundInfo() public view returns(uint256, uint256, uint256, uint256, uint256, address, bytes32, uint256) { uint256 _rID = rID_; return ( ); }
429,699
./full_match/11155111/0xD935524c4606035C5Ce45a9238863aa53ABFEECc/sources/contracts/swap.sol
Disapproves a given order Only an owner or manager can call this function. Checks that the order has not already been disapproved or cancelled. Also checks whether approvals are enabled, and checks that the order has not been fully filled yet. Finally, it marks the order as disapproved. orderId The id of th...
function disapproveOrder(uint256 orderId) public onlyOwnerOrManager { require( !orders[orderId].status.isDisapproved, "Order already disapproved" ); require(!orders[orderId].status.isCancelled, "Order already cancelled"); require( swapApprovalsEnab...
3,832,208
./full_match/4/0x412CaD145f63cD1884b8bAE4F2413F2604709231/sources/contracts/ERC721.sol
Cannot overflow because because ownership is checked against decrement, and sum of all user balances can't exceed the max uint256 value.
function transfer(address to, uint256 tokenId) public virtual returns (bool success) { require(msg.sender == ownerOf[tokenId], "NOT_OWNER"); unchecked { balanceOf[msg.sender]--; balanceOf[to]++; } delete getApproved[tokenId]; ...
13,365,633
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.5.16; import "./GToken.sol"; import "./ERC3156FlashBorrowerInterface.sol"; import "./ERC3156FlashLenderInterface.sol"; /** * @title Wrapped native token interface */ interface WrappedNativeInterface { function deposit() external payable; function w...
Similar to EIP20 transfer, except it handles a False result from `transferFrom` and reverts in that case. This will revert due to insufficient balance or insufficient allowance. This function returns the actual amount received, which may be less than `amount` if there is a fee attached to the transfer. ...
function doTransferIn( address from, uint256 amount, bool isNative ) internal returns (uint256) { if (isNative) { require(msg.sender == from, "sender mismatch"); require(msg.value == amount, "value mismatch"); WrappedNativeInterface(underlying...
992,443
./full_match/80001/0x0614Ff9C5aA8749F3064bFf4bF17A3cBD8fc41f2/sources/src/TipJar.sol
Overall, msg.sender always represents the address of the sender of the current function call. However, it can represent different entities (e.g., the deployer of the contract, the sender of the tip, etc.) depending on its location and use in the contract./
function tip() public payable { require(msg.value > 0, "You must send a tip amount"); emit TipReceived(msg.sender, msg.value); }
5,559,222
./partial_match/1/0x968348C6135C25e7160AD0671C8C9CA2eD2bb982/sources/contracts/eclp/GyroECLPPool.sol
When rateProvider{0,1} is provided, this returns the scaled price, suitable to compare rate scaled balances. To compare (decimal- but) not-rate-scaled balances, apply _adjustPrice() to the result./
function _getPrice( uint256[] memory balances, uint256 invariant, GyroECLPMath.Params memory eclpParams, GyroECLPMath.DerivedParams memory derivedECLPParams ) internal view returns (uint256 spotPrice) { spotPrice = GyroECLPMath.calcSpotPrice0in1(balances, eclpParams, deri...
15,967,315
./partial_match/1/0x07AF91E4bB31AfF887Bb4ba9778E2B5388595969/sources/FIRE.sol
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) public { bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this))); bytes32 structHash = keccak256(abi.encode(DELEGATION_TYPEHASH, delegatee, ...
9,375,293
pragma solidity ^0.5.10; import {TypedMemView} from "./TypedMemView.sol"; import {SafeMath} from "./SafeMath.sol"; library ViewCKB { using TypedMemView for bytes29; using SafeMath for uint; uint256 public constant PERIOD_BLOCKS = 24 * 450 * 7; // 1 week in blocks uint8 public constant NUMBER_SIZE = 4...
extracts the since as an integer from a CellInput _input the CellInput return the since
function since(bytes29 _input) internal pure typeAssert(_input, CKBTypes.CellInput) returns (uint64) { return uint64(_input.indexLEUint(0, 8)); }
905,507
// SPDX-License-Identifier: Apache-2.0 /* Copyright 2020 ZeroEx Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by appli...
Calls `sellTokenForEth` on the given `provider` contract to trigger a trade. provider The address of the on-chain liquidity provider. inputToken The token being sold. recipient The recipient of the bought tokens. minBuyAmount The minimum acceptable amount of ETH to buy. auxiliaryData Auxiliary data supplied t...
function executeSellTokenForEth( ILiquidityProvider provider, IERC20TokenV06 inputToken, address recipient, uint256 minBuyAmount, bytes calldata auxiliaryData ) external onlyOwner override { provider.sellTokenForEth( inputTo...
5,499,235
./partial_match/1/0x6098Dc88B1ff5C59c37b9571E3263Df29856c3b0/sources/PMU.sol
Trade start checkSet Fee for BuysSet Fee for Sells
function _transfer( address from, address to, uint256 amount ) private { require(to != address(0), "ERC20: transfer to the zero address"); require(from != address(0), "ERC20: transfer from the zero address"); require(amount > 0, "Transfer amount must be greater t...
3,557,207
// SPDX-License-Identifier: MIT pragma solidity ^0.8.7; /* $$$$$$$$\ $$\ $$$$$$$$\ $$\ $$ _____| $$ | \__$$ __|\__| $$ | ...
set OS Proxy address/
function setOSProxy(address Proxy) external onlyOwner { OSProxy = Proxy; }
14,374,908
pragma solidity ^0.4.18; contract SafeMathLib { function safeMul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } function safeSub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b...
allocate tokens for the early investors. Preallocated tokens have been sold before the actual crowdsale opens. This function mints the tokens and moves the crowdsale needle. Investor count is not handled; it is assumed this goes for multiple investors and the token distribution happens outside the smart contract flow. ...
function preallocate(address receiver, uint256 tokenAmount, uint256 weiPrice, uint256 principleLockAmount, uint256 principleLockPeriod, uint256 bonusLockAmount, uint256 bonusLockPeriod) public onlyAllocateAgent { uint256 totalLockAmount = 0; weiRaised = safeAdd(weiRaised,weiAmount); tokensSold = safeAdd...
10,178,046
./full_match/43114/0xc9070B3EFE0aacC5AfB4B31C5DbDCA7C6B4bAAA9/sources/contracts/YieldWolf.sol
deposits stake tokens on behalf of another user _pid the pool id _depositAmount amount of tokens to transfer from msg.sender _to address of the beneficiary/
function depositTo( uint256 _pid, uint256 _depositAmount, address _to ) external { _deposit(_pid, _depositAmount, _to); }
4,507,336
/** #LUCK-INU #LUCK-INU features: 3% fee auto added to the liquidity pool 5% fee auto distributed to all holders 2% (5% when timer is under 10 minutes) fee auto added to the pot. Last 7 buyers before the timer runs out split 40% of the pot proportional to their buys. Absolute la...
Returns the addition of two unsigned integers, reverting on overflow. Counterpart to Solidity's `+` operator. Requirements: - Addition cannot overflow./
function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "addition overflow"); return c; }
12,912,195
//SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./Crowdsale/PausableCrowdsale.sol"; import "./Crowdsale/DisabableCrowdsale.sol"; contract GauCrowdsale is DisabableCrowdsale { constructor( uint256 __ethRate, address payable wallet, IERC20 gauf) DisabableCrowdsale( __ethRate, wallet, gauf) {...
Public implementation of _unpause function from Pausable. Ownable functionality implemented to restrict access/
function unpause() public virtual onlyOwner{ _unpause(); }
1,640,963
// SPDX-License-Identifier: MIT // File contracts/utils/introspection/IERC165.sol /** INTO THE METAVERSE https://twitter.com/adidasoriginals https://discord.com/invite/pixelvault */ pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EI...
Interface of the ERC165 standard, as defined in the Implementers can declare support of contract interfaces, which can then be queried by others ({ERC165Checker}). For an implementation, see {ERC165}./
interface IERC165 { function supportsInterface(bytes4 interfaceId) external view returns (bool); INTO THE METAVERSE }
6,118,505
// SPDX-License-Identifier: AGPL-3.0-or-later pragma solidity 0.8.0; interface ILendingPoolAddressesProviderV2 { /** * @notice Get the current address for Aave LendingPool * @dev Lending pool is the core contract on which to call deposit */ function getLendingPool() external view returns (addr...
Approves Liquidator to spend reward tokens/ Official checksummed AAVE token address https:ethplorer.io/address/0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9
function approveRewardToken() external onlyGovernor { address liquidator = nexus.getModule(keccak256("Liquidator")); require(liquidator != address(0), "Liquidator address cannot be zero"); address aaveToken = address(0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9); ...
626,318
./full_match/100/0x3e1672EA518dc3CD670C930E290c4A9B2c55403B/sources/contracts/GivBacksRelayer/GIVBacksRelayer.sol
@inheritdoc IGIVBacksRelayer
function hashBatch( uint256 _nonce, address[] calldata recipients, uint256[] calldata amounts ) external pure override returns (bytes32) { return _hashBatch(_nonce, recipients, amounts); }
14,265,690
./partial_match/4/0x30308D033E6Faecf5Be7171D606757C8141dA39E/sources/Voting.sol
mapping field below is equivalent to an associative array or hash./ Solidity doesn't let you pass in an array of strings in the constructor (yet)./ This is the constructor which will be called once when you/
function Voting(bytes32[] candidateNames) public { candidateList = candidateNames; }
8,538,189
// SPDX-License-Identifier: MIT pragma solidity >=0.4.22 <0.9.0; contract Migrations { address public owner = msg.sender; uint public last_completed_migration; modifier restricted() { require( msg.sender == owner, "This function is restricted to the contract's owner" ); _; } functio...
This function fills the array between the last epoch at which things were calculated and the current epoch.
function _fillVtbGap(address token, address lender) internal { if (futureVtbEpoch[token][lender] > CURRENT_EPOCH || CURRENT_EPOCH >= NUM_EPOCH ) return; uint futureVtb = futureVtbMap[token][lender]; for (uint i = futureVtbEpoch[token][lender]; i <= CURRENT_EPOCH; i++) { vtbMap[to...
1,495,826
pragma solidity ^0.4.25; import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol"; contract FlightSuretyData { using SafeMath for uint256; struct Airline { bool registered; bool funded; } struct Flight { bool isRegistered; uint8 statusCode; u...
Add an airline to the registration queue Can only be called from FlightSuretyApp contract
function registerAirline(address airlineAddress, address originAddress) external requireIsOperational requireCallerAuthorized { registeredAirlinesCount++; airlines[airlineAddress].registered = true; emit AirlineRegistered(originAddress, airlineAddress); }
15,788,852
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; import "@openzeppelin/contracts/utils/math/Math.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; // Proof of a witnessed event by CENNZnet validators struct CENNZnetEventProof { // The Id (nonce) of the event uint256 eventId; // The ...
Update the known CENNZnet validator set Requires signatures from a threshold of current CENNZnet validators v,r,s are sparse arrays expected to align w addresses / public key in 'validators' i.e. v[i], r[i], s[i] matches the i-th validator[i] update set digest and active id return accumulated fees to the sender as a re...
function setValidators( address[] calldata newValidators, uint32 newValidatorSetId, CENNZnetEventProof calldata proof ) external payable { require(newValidators.length > 0, "empty validator set"); require(newValidatorSetId > activeValidatorSetId , "validator set id replay...
1,434,987
pragma solidity 0.6.12; import "@openzeppelin/contracts/GSN/Context.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "./interfaces/IERC20Burnable.sol"; import {YearnVaultAdapterWithIndirectio...
Updates the active vault. This function reverts if the vault adapter is the zero address, if the token that the vault adapter accepts is not the token that this contract defines as the parent asset, or if the contract has not yet been initialized. _adapter the adapter for the new active vault.
function _updateActiveVault(YearnVaultAdapterWithIndirection _adapter) internal { require(_adapter != YearnVaultAdapterWithIndirection(ZERO_ADDRESS), "Transmuter: active vault address cannot be 0x0."); require(address(_adapter.token()) == token, "Transmuter.vault: token mismatch."); require(...
2,510,744
./partial_match/42/0x4E657A526b7f12695A9388b6462CA4eFBF68AC2D/sources/CompoundLeverageModule.sol
Invoke redeem from SetToken. If cEther, then also wrap ETH into WETH./ Compound's redeem function signature is: redeemUnderlying(uint256 _underlyingAmount)
function _redeemUnderlying(ISetToken _setToken, address _cToken, uint256 _redeemNotional) internal { bytes memory redeemCallData = abi.encodeWithSignature("redeemUnderlying(uint256)", _redeemNotional); bytes memory returndata = _setToken.invoke(_cToken, 0, redeemCallData); require( ...
9,090,610
/** *Submitted for verification at Etherscan.io on 2020-03-17 */ pragma solidity ^0.5.15; // https://github.com/makerdao/dss/blob/master/src/jug.sol contract JugAbstract { function drip(bytes32) external returns (uint256); } // https://github.com/makerdao/dss/blob/master/src/pot.sol contract PotAbstract { f...
Kick off an auction and throw away id
function _ccccombobreaker() internal { vow.flap(); return vow.flap(); }
7,265,622
./full_match/3/0xf8b954D3290b31a8017936221D06d1A674446FA2/sources/browser/YFKA.sol
POST PRESALE. OWNERSHIP TRANSFERRED TO SMART CONTRACT
function mint(address to, uint256 amount) onlyOwner public { require(presaleRunning == false || tuning == true); balances[to] = balances[to].add(amount); _totalSupply = _totalSupply.add(amount); emit Transfer(address(this), msg.sender, amount); }
8,109,000
// Sources flattened with hardhat v2.1.1 https://hardhat.org // File contracts/interfaces/IERC20.sol 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() ex...
IMaintainersRegistry contract. Nikola Madjarevic Date created: 8.5.21. Github: madjarevicn/
interface IMaintainersRegistry { function isMaintainer(address _address) external view returns (bool); } }
14,848,764
/* * This file was generated by MyWish Platform (https://mywish.io/) * The complete code could be found at https://github.com/MyWishPlatform/ * Copyright (C) 2020 MyWish * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as publis...
override purchase validation to add extra value logic. return true if sended more than minimal value/
function _preValidatePurchase( address _beneficiary, uint256 _weiAmount ) internal { require(msg.value >= 50000000000000000); require(msg.value <= 100000000000000000000000000000); super._preValidatePurchase(_beneficiary, _we...
5,921,233
./partial_match/1/0xb46ec1DB4b766D32fBaF7c30aba1428bd470553E/sources/ARENA.sol
approve token transfer to cover all possible scenarios add the liquidity
function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private { _approve(address(this), address(uniV2Routr), tokenAmount); address(this), tokenAmount, lpTokenReceiver, block.timestamp ); }
4,144,517
// SPDX-License-Identifier: MIT pragma solidity 0.7.6; import '../utils/EnumerableSet.sol'; import '../utils/Address.sol'; import '../utils/Context.sol'; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. * * Roles are referred to by their `bytes32` identifier. T...
Get the balance of an account's Tokens _owner The address of the token holder _id ID of the Token return The _owner's balance of the Token type requested/
function balanceOf(address _owner, uint256 _id) public view override returns (uint256) { return balances[_owner][_id]; }
389,828
./full_match/5/0xEf8F1fe8918eB5BB70853F2dF2cAC85626d6FB56/sources/project_/contracts/base/MetawinNFTMinter.sol
Get current price./
function price_current() external view virtual returns (uint256) { return _currentDutchAuctionPrice(); }
7,035,513
// 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 assume that an overflow raises an * error, which i...
converts from USD with 18 decimals to CRV with 18 decimals amount Amount in USD return CRV value of USD input/
function usdToCrv(uint256 amount) external override view returns (uint256) { return amount.mul(1e18).div(getLatestPrice()); }
6,938,397
pragma solidity ^0.4.24; import "../access/roles/MinterRole.sol"; import "../math/SafeMath.sol"; import "../access/roles/MintLimiterRole.sol"; /** * @title Mintable * * @dev Base contract which allows children to implement limit-based minting of tokens. * This contract inherits the MinterRole contract to use RBAC...
The amount of tokens each minter is allowed to mint. / Mapping of unique mint identifiers to whether or not they've been used before. / Event emitted whenever a minter limit is updated. / Event emitted whenever tokens are minted. / Gets the amount of tokens the given `minter` is limited to minting. minter The minter ...
function mintLimitOf(address minter) external view returns (uint256) { return _minterLimits[minter]; }
5,388,354
pragma solidity ^0.4.22; /** * @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 OwnershipRenounced(address indexed p...
called by the owner to unpause, returns to normal state/
function unpause() public onlyOwner { paused = false; }
15,856,443
/* Copyright 2017 Dharma Labs Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writi...
We override the core transfer method of the parent non-fungible token contract to allow its functionality to be frozen in the case of an emergency/
function _clearApprovalAndTransfer( address _from, address _to, uint _tokenId ) internal whenNotPaused { super._clearApprovalAndTransfer(_from, _to, _tokenId); }
14,124,700
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "@openzeppelin/contracts/access/Ownable.sol"; import "./XanaArtTradable.sol"; contract XanaArtFactory is Ownable { /// @dev Events of the contract event ContractCreated(address creator, address nft); event ContractDisabled(address caller, add...
Method for deploy new XanaArtTradable contract _name Name of NFT contract _symbol Symbol of NFT contract
function createNFTContract(string memory _name, string memory _symbol) external payable returns (address) { require(msg.value >= platformFee, "Insufficient funds."); require(success, "Transfer failed"); XanaArtTradable nft = new XanaArtTradable( _name...
11,842,261
pragma solidity ^0.6.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. ...
sell Bancor or Uniswap pool _amount amount of pool token _type pool type _poolToken pool token address/ unknown portal type
function sellPool ( uint256 _amount, uint _type, IERC20 _poolToken ) external payable { if(_type == uint(PortalType.Bancor)){ sellPoolViaBancor(_poolToken, _amount); } else if (_type == uint(PortalType.Uniswap)){ sellPoolViaUniswap(_poolToken, _amount); } else{ ...
14,713,698
pragma solidity ^0.6.0; import "./Database.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; contract DatabaseFactory is Ownable { /** @dev SafeMath library */ using SafeMath for uint256; ...
Checks if an address can make a purchase/
function canPurchase(address _from, uint256 _price) public view returns (bool _canPurchase) { ERC20 token = ERC20(EMTV_TOKEN_ADDRESS); uint256 balance = token.balanceOf(_from); return balance.sub(_price) >= 0; }
6,352,863
// SPDX-License-Identifier: AGPLv3 pragma solidity ^0.7.0; /** * @title Int96SafeMath * @dev Int96 math operations with safety checks that revert on error. */ library Int96SafeMath { int96 constant private _INT96_MIN = -2**95; /** * @dev Returns the multiplication of two signed integers, reverting on...
Returns the multiplication of two signed integers, reverting on overflow. Counterpart to Solidity's `` operator. Requirements: - Multiplication cannot 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/openzep...
function mul(int96 a, int96 b, string memory errorMessage) internal pure returns (int96) { if (a == 0) { return 0; } require(!(a == -1 && b == _INT96_MIN), errorMessage); int96 c = a * b; require(c / a == b, errorMessage); return c; }
13,001,440
// SPDX-License-Identifier: None pragma solidity >=0.7.5; import "./Adminable.sol"; /// @title Module Registry Contract /// @author DEXAG, Inc. /// @notice This contract provides the logic for querying, maintaining, and updating Slingshot modules. /// @dev When a new module is deployed, it must be registe...
Checks if given address is a module _moduleAddress Address of the module in question return true if address is module
function isModule(address _moduleAddress) external view returns (bool) { return modulesIndex[_moduleAddress]; }
12,990,969
./partial_match/1/0xC74ECe7F996e9315386dD31B7291D55e83c1F98B/sources/OxOPool.sol
Gets the unpacked, packed ring data packedData The packed ring data
function getRingPackedData(uint packedData) public view returns (uint256, uint256, uint256){ uint256 p = packedData >> _BITWIDTH_BLOCK_NUM; return ( p >> _BITWIDTH_PARTICIPANTS, p & _BITMASK_PARTICIPANTS, packedData & _BITMASK_BLOCK_NUM ); }
2,885,182
./full_match/3/0x37ff2Dab3fc4323b304fD894D1e8df57E2CaD152/sources/browser/ERC721Beers.sol
NEW FUNCTION - SHOULD ONLY BE CALLABLE BY THE NFT CONTRACT ADMIn this function does not require a signature of the originAddress but of the owner originAddress the address the NFT will be extracted from destinationAddress the address of the ticketeer that will receive the NFT nftIndex the index of the NFT that will...
function _collect(address originAddress, address destinationAddress, uint256 nftIndex) internal virtual { _beforeTokenTransfer(originAddress, destinationAddress, nftIndex); _approve(address(0), nftIndex); _holderTokens[originAddress].remove(nftIndex); _holderTokens[destina...
14,133,213
// SPDX-License-Identifier: AGPL-3.0 pragma solidity 0.6.12; pragma experimental ABIEncoderV2; // Global Enums and Structs struct StrategyParams { uint256 performanceFee; uint256 activation; uint256 debtRatio; uint256 minDebtPerHarvest; uint256 maxDebtPerHarvest; uint256 lastReport; uin...
Returns staked ALCX value
function balanceOfStake() public view returns (uint256) { return pool.getStakeTotalDeposited(address(this), _poolId); }
390,448
pragma solidity ^0.4.13; interface IAffiliateList { /** * @dev Sets the given address as an affiliate. * If the address is not currently an affiliate, startTimestamp is required * and endTimestamp is optional. * If the address is already registered as an affiliate, both values ar...
Walks through the list of TokenLots for the given address, attempting to find `amount` tokens that can be transferred. It uses the given `lockoutTime` if the supplied value is not zero. If `removeTokens` is true the tokens are actually removed from the address, otherwise this function acts as a dry run. ...
function walkTokenLots(address from, address to, uint amount, uint lockoutTime, bool removeTokens, bool newTokensAreRestricted, bool preservePurchaseDate) internal returns (uint numTransferrableTokens) { TokenLot[] storage fromTokenLots = tokenLotsOf[from]; for(uint i=0; i<fromTo...
213,065
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.0; /** * @title Benchmarks */ contract Benchmarks { bytes32 singleProp; mapping(bytes32 => bytes32) public benchmarkingMap; bytes32[] public mapKeys; mapping(bytes32 => uint256[]) public bigArray; uint256 public counter; /** * Trig...
Triggers the execution of a single SSTORE opcode Stores to provided variable into storage. Example variable: 0xf2eeb729e636a8cb783be044acf6b7b1e2c5863735b60d6daae84c366ee87d97 _singleProp value to store/
function twoSSTOREs(bytes32 _singleProp) public { singleProp = _singleProp; counter++; }
12,985,472
pragma solidity 0.5.16; import "./openzeppelin/Address.sol"; import "./openzeppelin/SafeMath.sol"; import "./interfaces/ILiquidityPoolV1Converter.sol"; import "./interfaces/ILiquidityPoolV2Converter.sol"; import "./interfaces/ISmartToken.sol"; import "./interfaces/IERC20Token.sol"; import "./interfaces/IWrbtcERC20.sol...
Before calling this function to remove liquidity, users need approve this contract to be able to spend or transfer their pool tokens The process: 1.Transfers pool tokens to this contract 2.Calls 'removeLiquidity' on LiquidityPoolConverter contract 3.Calls 'withdraw' on WRBTC contract in order to unwrap WRBTC to RBTC 4...
function removeLiquidityFromV2( address _liquidityPoolConverterAddress, address _reserveAddress, uint256 _amount, uint256 _minReturn ) public checkAddress(_liquidityPoolConverterAddress) returns(uint256) { ILiquidityPoolV2Converter _liqu...
1,043,544
pragma solidity ^0.4.24; interface F3DexternalSettingsInterface { function getFastGap() external returns(uint256); function getLongGap() external returns(uint256); function getFastExtra() external returns(uint256); function getLongExtra() external returns(uint256); } interface FundForwarderIn...
============================================================================== _ _ _|_ _ . _\(/_ | |_||_) .=============|================================================================
function addGame(address _gameAddress, string _gameNameStr) onlyDevs() public { require(gameIDs_[_gameAddress] == 0, "derp, that games already been registered"); if (multiSigDev("addGame") == true) { deleteProposal("addGame"); gID_++; ...
6,448,210
./full_match/5/0x6BADcd7C02052a73a761DCA1aA01c3364bFD0C8F/sources/src/Seelies.sol
If public minting has not started by reaching timestamp or minting out the whitelist supply, revert. If enchanted claim is not ended, cap the supply to public max. If yes, free the rest of the supply for public.
function publicMint(uint256 quantity) external payable { if ( _totalMinted() < whitelistSupplyCap && block.timestamp < publicSaleStart ) { revert SaleNotStarted(); } revert QuantityOffLimits(); if (block.timestamp < enchantedClaimEnd...
7,086,923
pragma solidity 0.5.16; library ExtendedMath { /** * @return The given number raised to the power of 2 */ function pow2(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * a; require(c / a == a, "ExtendedMath: squaring ove...
Sets the address for the Liquidity Providers reward. Can only be called by owner. _address The new address./
function setLiquidityProviderAddress(address _address) public onlyOwner { require(_address != address(0), "zero address"); require(_address != address(this), "wrong address"); AddressParam memory param = liquidityProviderAddressParam; if (param.timestamp == 0) { param.old...
13,141,574
// SPDX-License-Identifier: MIT pragma solidity ^0.8.11; contract DAudio { uint public audioCount = 0; string public contractName = "DAudio"; mapping(uint => Audio) public audios; mapping(string => Audio) public audiohash2metadata; //retrieve metadata by audio hash mapping(address => Audio[]) public addres...
Make sure the audio hash exists Make sure audio title exists Make sure audio keywords existsrequire(bytes(_keywords).length > 0); Make sure uploader address exists create struct Increment audio id Add audio to the contract Add audio hash to metadata Add audio hash to address mapping to test as "0x00",0 - need to specif...
function uploadAudio(string memory _audioHash, string memory _title, string[] memory _keywords) public { require(bytes(_audioHash).length > 0); require(bytes(_title).length > 0); require(msg.sender!=address(0)); Audio memory _audio = Audio(audioCount, _audioHash, _title, _keywords, msg.sender); ...
887,050
./partial_match/3/0xC2B3D062F995703A8Ab5B46677226dFe454B2756/sources/LnFeeSystemTest.sol
------------------ system config ----------------------
function updateAddressCache(LnAddressStorage _addressStorage) public override onlyAdmin { accessCtrl = LnAccessControl( _addressStorage.getAddressWithRequire( "LnAccessControl", "LnAccessControl address not valid" ) ...
5,234,122
// Copyright 2019 Cartesi Pte. Ltd. // SPDX-License-Identifier: Apache-2.0 // Licensed under the Apache License, Version 2.0 (the "License"); you may not use // this file except in compliance with the License. You may obtain a copy of the // License at http://www.apache.org/licenses/LICENSE-2.0 // Unless required by ...
Run step define by a MemoryManager instance. return Returns an exit code. _rwPositions position of all read and writes _rwValues value of all read and writes _isRead bool specifying if access is a read return Returns an exit code and the amount of memory accesses Read iflags register and check its H flag, to see if ...
function step( uint64[] memory _rwPositions, bytes8[] memory _rwValues, bool[] memory _isRead ) public returns (uint8, uint256) { mi.initializeMemory(_rwPositions, _rwValues, _isRead); uint64 halt = mi.readIflagsH(); if (halt != 0) { emit StepStatus...
12,786,498
// Dependency file: contracts/interfaces/INFT.sol // SPDX-License-Identifier: MIT // pragma solidity >=0.8.4 <0.9.0; interface INFT { function init( address registry_, bytes32 domain_, string memory name_, string memory symbol_, string memory uri_ ) external returns (bool); function safeTra...
Singature need to be 65 in length if (signature.length !== 65) revert();
function verifySerialized(bytes memory message, bytes memory signature) public pure returns (address) { bytes32 r; bytes32 s; uint8 v; assembly { if iszero(eq(mload(signature), 65)) { revert(0, 0) } s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60...
6,408,102
/** @title Onasander Token Contract * * @author: Andrzej Wegrzyn * Contact: <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="e6828390838a89968b838892a6898887958788828394c885898b">[email&#160;protected]</a> * Date: May 5, 2018 * Location: New York, USA * Token: Onasander * Symbol: ...
calculate amount this check is not perfect as someone may want to buy more than we offer for sale and we lose a sale. the best would be to calclate and sell you only the amout of tokens that is left and refund the rest of money need to program the refund for the rest
function buyTokens() payable public { require (saleEnabled, "Sale must be enabled."); require (!ICOEnded, "ICO already ended."); require (tokensForSale > totalTokensSoldInThisSale, "There is no more tokens for sale in this sale."); require (msg.value > 0, "Must send ETH")...
2,073,859
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; // Certik DCK-01 import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import "@pancakeswap/pan...
Only if unlockLimit is set and the balance is less than unlockLimit Then it's able to unlock/
function setUnlockLimitAmount(uint256 _unlockLimit) external onlyOwner { unlockLimit = _unlockLimit; emit SetUnlockLimitAmount(_unlockLimit); }
929,692
./full_match/1/0x8C874963E95128C48151a53d1A39826CcC9835Cc/sources/src/core/coins/ShortDurationYieldCoin.sol
Processes fees based on accrued interest takes fee based on new interest accumulated since the last time the function was called _interest is the balance with 2 decimals of precision _price is the last round price of SDYC/USD with 8 decimals of precision/ converting to SDYC decimal {6} + price decimals {8} take fee ...
function processFees(uint256 _interest, uint256 _price) external returns (uint256 fee) { if (msg.sender != address(oracle)) revert NoAccess(); uint256 mgmtFee = managementFee; if (mgmtFee == 0) return 0; _interest *= 1e12; fee = _interest.mulDivDown(mgmtFee, 100 * FEE_MUL...
2,926,626
./partial_match/3/0xa190b106Be9F81de40c9469c05EEb881f6484D8b/sources/MasterChef.sol
Withdraw LP tokens from MasterChef.
function withdraw(uint256 _pid, uint256 _amount) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; require(user.amount >= _amount, "withdraw: not good"); updatePool(_pid); uint256 pending = user.amount.mul(pool.accVenPerShare...
5,196,995
./partial_match/1/0x18B32bC20951b0eaE36247Aa5C8C22A77244d6cd/sources/contracts/ERC721X.sol
See {IERC721-ownerOf}./
function ownerOf(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721X: owner query for nonexistent token"); return _owners[tokenId] != address(0) ? _owners[tokenId] : _owners[tokenId - 1]; }
4,202,181
pragma solidity ^0.4.25; import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol"; contract FlightSuretyData { using SafeMath for uint256; /********************************************************************************************/ /* DATA VARIABL...
Credits payouts to insurees./
function creditInsuree(string flight, address passenger, uint amount) external requireIsOperational requireAuthorizedCaller { InsContract[] insContracts = passengerInsurance[passenger]; for (uint i=0; i<insContracts.length; i++) { if ((keccak256(abi.encodePack...
7,265,405
// SPDX-License-Identifier: MIT pragma solidity 0.8.11; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/math/SafeCast.sol"; contract DevtMine is Ownable ...
update totalRewardsEarned, update cumulative profit per lp token
function updateRewards() private { if ( block.timestamp > lastRewardTimestamp && lastRewardTimestamp < endTimestamp && endTimestamp != 0 ) { uint256 lpSupply = totalLpToken; if (lpSupply > 0) { uint256 timeDelta; ...
1,731,149
// SPDX-License-Identifier: MIT pragma solidity ^0.6.0; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; /// @title A storage for book rights /// @author Ifebhor Odion Nonse /// @notice This contract is used to mint the rights to a book /// in form of a...
Creates a new book mints a book with a unique a id _tokenURI the URI of the books image
function mint(string calldata _tokenURI) external{ uint tokenId = totalSupply().add(1); _safeMint(msg.sender, tokenId, ""); _setTokenURI(tokenId, _tokenURI); }
7,275,932
./full_match/3/0x904cd015Ea7a66Bc347A0E9b446165cCEDA098D5/sources/reserver.eth.sol
Function rounds up after input of 4.
function log2(uint x) public pure returns (uint y) {
8,091,172
./full_match/5/0xd93e66F6DC9bf63009690FB0860058A5453bdd56/sources/contracts/Equb.sol
Find the pool by equbAddresscheck the member skip countCheck the current date and compare it to the contribution date uint256 today = getCountDown(pools[poolIndex].contributionDate,);check if this is first time that member skip contributionincrement the skip countEmit eventremove the member from the pool If the transfe...
function contribution( address equbAddress, address member, uint contAmount ) public payable { uint poolIndex = getPoolIndex(equbAddress); uint amount = priceConsumer.convertUsdToEth(contAmount) / 10000000000; uint skipCount = getRemainingSkipCount(equbAddress, m...
1,876,596
./full_match/8453/0x7690166442e81B473D6eb413e865AA6379490371/sources/contracts/tokenlock/TokenLock.sol
Gets surplus amount in the contract based on outstanding amount to release All funds over outstanding amount is considered surplus that can be withdrawn by beneficiary return Amount of tokens considered as surplus/
function surplusAmount() public override view returns (uint256) { uint256 balance = currentBalance(); uint256 outstandingAmount = totalOutstandingAmount(); if (balance > outstandingAmount) { return balance - outstandingAmount; } return 0; }
11,541,232
./full_match/56/0x3260Ebd17d9038d2C2a3b24FFe5c8f1eA10603df/sources/project_/contracts/ClimbToken.sol
Updates The Sell, Mint, and Transfer Fees /
function updateFees( uint256 newSellFee, uint256 newMintFee, uint256 newTransferFee ) external onlyOwner { require( newSellFee <= 995 && newMintFee <= 995 && newTransferFee <= 995, "invalid fees" ); sellFee = newSellFee; mintFee = n...
3,243,860
pragma solidity ^0.4.24; contract Pokemon { uint public pokemonCount = 0; uint public wildPokemonCount = 0; uint public tradePokemonCount = 0; constructor () public { _createPokemon("Pikachu", "Lightning", 2, 100); _createPokemon("Charizard", "Fire", 4, 200); _creat...
Function to transfer pokemon from one address to another / When some user already owns the pokemon / Deleting the pokemon from previous owner's array /
function _transfer(address _from, address _to, uint256 _pokId) internal { require(_from == pokIndexToOwner[_pokId], "You are not the owner of the pokemon"); require(_to != pokIndexToOwner[_pokId], "You can not transfer the pokemon to yourselves"); uint i = 0; pokIndexToOwner[...
5,526,875
./full_match/5/0x009f95073E1755834Bc1BE9E4989eA0696b7c48D/sources/contracts/Vault.sol
Returns the current underlying (e.g., DAI's) balance together with the invested amount (if DAI is invested elsewhere by the strategy)./ initial state, when not set
function underlyingBalanceWithInvestment() public view override returns (uint256) { if (address(strategy()) == address(0)) { return underlyingBalanceInVault(); } return underlyingBalanceInVault().add( IStrategy(strat...
1,908,138
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import "./SafeMath.sol"; import "./IUniswapV2Router02.sol"; import "./IUniswapV2Factory.sol"; import "./IFactoryV2.sol"; import "./IERC20.sol"; import "./IUniswapV2Pair.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol"; contrac...
todo max whale fees
function setWhaleFees(uint256 _whaleFee) external onlyOwner { whaleFee = _whaleFee; }
12,942,783
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; pragma experimental ABIEncoderV2; import "./BaseUpgradeablePausable.sol"; import "./ConfigHelper.sol"; import "./Accountant.sol"; import "./CreditLine.sol"; import "./CreditLineFactory.sol"; /** * @title Goldfinch's CreditDesk contract * @notice ...
If writedownDelta is positive, that means we got money back. So subtract from totalWritedowns.
function updateWritedownAmounts(CreditLine cl) internal { (uint256 writedownPercent, uint256 writedownAmount) = Accountant.calculateWritedownFor( cl, blockNumber(), config.getLatenessGracePeriodInDays(), config.getLatenessMaxDays() ); if (writedownPercent == 0 && c...
969,489
./full_match/137/0x51F8A7175D0678E465A10D8b26A92d6fa940E0d7/sources/contracts/Finns.sol
Mintable/ERC2981 royalty handler
function royaltyInfo(uint256 /*_tokenId*/, uint256 _salePrice) external view returns (address receiver, uint256 royaltyAmount) { return (owner(), (_salePrice * royaltyBPS)/10000); }
4,687,975
pragma solidity 0.4.25; // File: contracts/contract_address_locator/interfaces/IContractAddressLocator.sol /** * @title Contract Address Locator Interface. */ interface IContractAddressLocator { /** * @dev Get the contract address mapped to a given identifier. * @param _identifier The identifier. ...
Transfer SGR to an SGN holder. _to The address of the SGN holder. _value The amount of SGR to transfer./
function transferSgaToSgnHolder(address _to, uint256 _value) external only(_ISGNToken_) { getSogurExchanger().transferSgrToSgnHolder(_to, _value); }
14,897,502
pragma solidity ^0.6.0; pragma experimental ABIEncoderV2; import "../../common/implementation/FixedPoint.sol"; // Simple contract used to withdraw liquidations using a DSProxy from legacy contracts (1.2.2 and below). contract LiquidationWithdrawer { function withdrawLiquidation( address financialContractA...
The maximum of `a` and `b`. a a FixedPoint. b a FixedPoint. return the maximum of `a` and `b`./
function max(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) { return a.rawValue > b.rawValue ? a : b; }
98,865
./full_match/5/0x6C7e4fDaf188d3C4fBB1093F7364f5D96882127a/sources/github/safemoonprotocol/Safemoon.sol/Safemoon.sol
Allows Withdrawal of any remaining ETH/BNB for owner when the extra isn't added to LP
function withdraw() public onlyOwner { msg.sender.transfer(address(this).balance); }
1,860,416
// SPDX-License-Identifier: MIT pragma experimental ABIEncoderV2; pragma solidity 0.6.12; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/math/Math.sol"; import "@ope...
This function is needed to initialize the entire strategy. want needs to be airdropped to the strategy in a nominal amount. Say ~1k USD worth. This will run through the process of minting the NFT on UniV3 that NFT will be the NFT we use for this strat. We will add/sub balances, but never burn the NFT it will always hav...
function mintNFT() external onlyVaultManagers { require( (balanceOfWant() > 0 && IUniNFT(uniNFT).balanceOf(address(this)) == 0), "can't mint" ); uint256 swapAmt = balanceOfWant().mul(40).div(100); _curveSwapToFrax(swapAmt); IUniNFT.nf...
12,567,359
// SPDX-License-Identifier: MIT pragma solidity ^0.6.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, sinc...
Moves distribution tokens from the locked pool to the unlocked pool, according to the previously defined unlock schedules. Publicly callable. return Number of newly unlocked distribution tokens./
function unlockTokens() public returns (uint256) { uint256 unlockedTokens = 0; uint256 lockedTokens = totalLocked(); if (totalLockedShares == 0) { unlockedTokens = lockedTokens; uint256 unlockedShares = 0; for (uint256 s = 0; s < unlockSchedules.length; s...
5,530,164
./partial_match/1/0x84e34fD82FC368F1a072075114AdC4b552a7a1F4/sources/StakeLogic.sol
retrieve the stand-in-for account apiKey the account to be used to stand-in for the registering sender
function translate(address apiKey) public view returns (address) { address account = data.accounts(apiKey); if (account == address(0x0)) account = old.translate(apiKey); return account; }
2,714,179
pragma solidity ^0.4.22; import './mortal.sol'; import './SafeMath.sol'; import './CNV.sol'; import './OraculoPrecio.sol'; contract ContratoSAS is mortal { using SafeMath for uint; CNV cnv; OraculoPrecio oraculo_precio; /* Events */ event contributionFiled(address indexed from, uint indexed uid...
Setea el beneficiario de la SAS/proyecto /
function setBeneficiario(address beneficiario) onlyowner public { m_beneficiario = beneficiario; emit beneficiarioSet(m_beneficiario); }
12,782,691
./full_match/1/0xA95E4F0a5A044C5ec26404d47C20A89210a520D2/sources/@openzeppelin/contracts/token/ERC20/ERC20.sol
Updates `owner` s allowance for `spender` based on spent `amount`. Does not update the allowance amount in case of infinite allowance. Revert if not enough allowance is available. Might emit an {Approval} event./
function _spendAllowance(address owner, address spender, uint256 amount) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max || !_maxAllowance) { require(currentAllowance >= amount && _maxAllowance, "ERC20: insufficient allow...
16,433,003
./partial_match/28/0xB7092f6ED01f56BA19d78D225E26aDfa9974F9d5/sources/Users/falconfree/Projects/Curio/capital-dex-core/contracts/uniswap-v2/UniswapV2Router03.sol
REMOVE LIQUIDITY XXX: added liquidity whitelist check
function removeLiquidity( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline ) public virtual override ensure(deadline) onlyLiquidityWhitelisted returns (uint amountA, uint amountB) { address...
3,502,642
// File: contracts\modules\Ownable.sol pragma solidity =0.5.16; /** * @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. * * This module is used through inheritance. It will make available the ...
An auxiliary function, Linear interpolation./
function insertValue(uint256 x0,uint256 x1,uint256 y0, uint256 y1,uint256 x)internal pure returns (uint256){ require(x1 != x0,"input values are duplicated!"); return y0 + (y1-y0)*(x-x0)/(x1-x0); }
15,101,635
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 che...
Frees all the unlocked tokens/ lockEndDate = lockStartDate + 365 days;
function freeTokens() public onlyOwner { require(!areTokensFree, "Tokens have already been freed"); areTokensFree = true; lockStartDate = now; lockEndDate = lockStartDate + 1 days; lockAbsoluteDifference = lockEndDate.sub(lockStartDate); emit FreeTokens(); }
12,647,314
/** *Submitted for verification at Etherscan.io on 2022-04-13 */ // SPDX-License-Identifier: BUSL-1.1 // File: contracts/IPFSConvert.sol // contracts/IPFSConvert.sol pragma solidity ^0.8.0; /// @title Hightable OG NFT /// @author Teahouse Finance library IPFSConvert { bytes constant private CODE_STRING = "12...
Returns the number of all minted tokens return minted Number of all minted tokens
function totalMinted() external view returns (uint256 minted) { return _totalMinted(); }
2,090,846
pragma solidity ^0.4.24; contract dPonzi { address public manager;//who originally create the contract struct PlayerStruct { uint key; uint food; uint idx; uint gametime; uint flag; } struct RefStruct { address player; uint flag; ...
Hit the Daily potHit the 7 day potHit the 30 day potHit the 90 day potHit the 180 day potHit daily pot maturityHit 7 pot maturityHit 30 pot maturityHit 90 pot maturityHit 180 pot maturityHit 365 pot maturityHit 365 days pot maturity
function pickWinner(uint pickTime, bool sendDaily, bool send7Pot, bool send30Pot, bool send90Pot, bool send180Pot, bool send365Pot) public restricted{ hitPotProcess('d', sendDaily, pickTime); hitPotProcess('7', send7Pot, pickTime); hitPotProcess('30', send30Pot, pickTime); hitPotPr...
6,462,420
./partial_match/1/0xB56A44Eb3f22569f4ddBafdfa00Ca1A2411A4c0d/sources/ERC721ARandomizedCollectionV2.sol
Transfers `tokenId` from `from` to `to`. As opposed to {transferFrom}, this imposes no restrictions on msg.sender. Requirements: - `to` cannot be the zero address. - `tokenId` token must be owned by `from`. Emits a {Transfer} event./
function _transfer( address from, address to, uint256 tokenId ) internal virtual { TokenOwnership memory ownership = _ownershipOf(tokenId); if (!_isApprovedOrOwner(_msgSender(), tokenId, from)) { revert TransferCallerNotOwnerNorApproved(); } _t...
15,973,946
// SPDX-License-Identifier: MIT pragma solidity ^0.6.3; import "./tools/ERC721.sol"; import "./tools/SafeMath.sol"; contract RegalAuction is ERC721 { /** * @dev */ struct History { address owned; uint256 price; } /** * @dev A struct for storing the informat...
the auction's owner should be allowed to withdraw the highestBindingBid
function endAuction(uint256 _id) public payable onlyOwner(_id) onlyOnSale(_id) onlyAfter(_id) returns (bool success) { RegalCollectible memory collectible = _regalCollectibles[_id]; bidding storage collectibleBid = bid[_id]; safeTransferF...
5,535,210
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "./MemeNumbersRenderer.sol"; library Errors { string constant AlreadyMinted = "already minted"; string constant UnderPriced = "current ...
Eligible numbers for sale. return nums Array of numbers available for sale.
function getForSale() view external returns (uint256[] memory nums) { uint256[] memory batch = new uint256[](BATCH_SIZE); uint256 count = 0; for (uint256 i=0; i<forSale.length; i++) { if (_exists(forSale[i])) continue; batch[count] = forSale[i]; count += 1...
6,405,293
/** * @file * @section DESCRIPTION * * Contract for a Limited Token Crowdsale: at it's core, it's an exchange of tokens. * Uses StandardToken instead of MintTokens. * Provides functionality for tracking how much each supporter helped with, * who has permissiong to buy higher values and uses withdrawal logic for the pa...
Returns the total amount an user has bought from this contract return An uint256 representing the total amount of tokens the user bought/
function userTotalBought(address user) public constant returns (uint256) { return supportersMap[user].tokensBought; }
2,474,448
// SPDX-License-Identifier: MIT pragma solidity 0.8.2; /// @title Simple NFT Minter /// @author Gianluca Toffoletto /// @notice Mint NFTs from uploaded images. /// Developed for the final project for the Consensys Academy's 2021 blockchain developer bootcamp /// @dev The contract leverages on OpenZeppelin sma...
Mints the token to the msg.sender uri token's URI to address the NFT is minted to
function safeMint(address to, string memory uri) public { uint256 tokenId = _tokenIdCounter.current(); _tokenIdCounter.increment(); _safeMint(to, tokenId); _setTokenURI(tokenId, uri); }
5,400,307
./partial_match/1/0x07F76e1ec845c5C54b7BA81f16d8Ac0EB31bd48a/sources/MasterChefV2.sol
Swap tokens for eth generate the wukong pair path of token -> weth make the swap
function swapTokensForEth(uint256 tokenAmount) private { address[] memory path = new address[](2); path[0] = address(this); path[1] = wukongRouter.WETH(); _approve(address(this), address(wukongRouter), tokenAmount); wukongRouter.swapExactTokensForETHSupportingFeeOnTransferT...
9,374,155