file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
./partial_match/1/0xfDc35A19eC12EFa72e5c7C2eB701cdCf63c2Fbea/sources/contracts/NFTMarketInfo.sol
function to update token info for cancel sell _tokenId id of the token to update info is called from marketplace contract (only managers can call)
function updateForCancelSell(uint256 _tokenId) public onlyManager { TokenStructLib.TokenInfo storage tokenInfo = TokenMarketInfo[_tokenId]; tokenInfo.minPrice = 0; tokenInfo.onSell = false; tokenInfo.USD = false; }
4,354,186
./partial_match/1/0x7BE9c3260f757cd383a176c8F5f9bB46D33Da120/sources/MintableDAO.sol
~14 days in blocks (assuming 15s blocks)
function votingPeriod() public pure returns (uint256) { return 14 days; }
4,135,663
// SPDX-License-Identifier: MIT pragma solidity 0.8.10; import "./IEIP20.sol"; // Implementation of eip20 standard. // https://eips.ethereum.org/EIPS/eip-20. contract EIP20 is IEIP20 { mapping(address => uint256) private _balanceOf; mapping(address => mapping(address => uint256)) private _allowances; string pri...
Minting new token, asign amount to the address and increase totalSupply. check if _to not an zero address. set balance after transaction. set totalSupply after transaction. emit transaction into blockchain.
function _mint(address _to, uint256 _value) internal virtual { require(_to != address(0), "Token minting to zero address"); _balanceOf[_to] += _value; _totalSupply += _value; emit Transfer(address(0), _to, _value); }
6,388,427
./full_match/97/0x99706Eb01A696ae19550854eaa7D28b6Ad1c0602/sources/project_/contracts/FundingPool.sol
Accepts the specified bid to supply to the pool. _poolId The Id of the pool. _ERC20Address The address of the bid funds being accepted. _bidId The Id of the bid. _lender The address of the lender. _receiver The address of the funds receiver./
function AcceptBid( uint256 _poolId, address _ERC20Address, uint256 _bidId, address _lender, address _receiver ) external nonReentrant { require(poolOwner == msg.sender, "You are not the Pool Owner"); FundDetail storage fundDetail = lenderPoolFundDetails[_...
3,263,745
./full_match/80001/0xA6BFBB4d45D1699df93431D1E093Df6B660Fa6A4/sources/project_/contracts/TradingStorage.sol
return all the trade information of a specific closed trade
function getClosedTradeDetails(uint _tradeId, address _trader) public view returns (closedTrade memory) { closedTrade memory _trade = usersClosedTrades[_trader][_tradeId]; return _trade; }
860,898
./full_match/44787/0xa6616Fc321E5Dc0ab8C79324Ca052E33617AD310/sources/contracts/donationMiner/DonationMinerImplementation.sol
Checks if there is any donation or stake between _startPeriod and _endPeriod return bool true if there is any donation or stake/
function hasDonationOrStake(uint256 _startPeriod, uint256 _endPeriod) internal view returns (bool) { while (_startPeriod <= _endPeriod) { if ( rewardPeriods[_startPeriod].donationsAmount + rewardPeriods[_startPeriod].stakesAmount > ...
13,251,949
./full_match/69/0x7B2AD0F401Eac4ec230f2Ecb0541685E327D2f33/sources/contracts/ShineToken.sol
Atomically decreases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. - `spender` must have ...
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { uint256 currentAllowance = allowances[msg.sender][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); _approve(msg.sender, spender, currentAllowance -...
13,239,498
./full_match/1/0x0000000000aec84F5BFc2af15EAfb943bf4e3522/sources/contracts/core/SoundCreatorV2.sol
Override for EIP-712. return name_ The EIP-712 name. return version_ The EIP-712 version./
function _domainNameAndVersion() internal pure virtual override returns (string memory name_, string memory version_) { name_ = "SoundCreator"; version_ = "2"; }
4,875,193
./full_match/80001/0x060da490c7c7123112931716093165b8b25bF33C/sources/contracts/WolfyStreetBetsv1.sol
updateLimitVariables
function updateAssetLimitVariables() internal{ depositLowRisk = 0; depositHighRisk = 0; for(uint i = 0; i < _lowRiskUsers.length ; i++) { depositLowRisk += _poolBalances[_lowRiskUsers[i]][true]; } for(uint i = 0; i < _highRiskUsers.length ; i++) { depo...
865,382
./partial_match/1/0x5e39B70446b04451e55298eC24dce520425704BD/sources/Controller.sol
Only allows to withdraw non-core strategy tokens ~ this is over and above normal yield This contract should never have value in it, but just incase since this is a public call
function yearn(address _strategy, address _token, uint parts) public { uint _before = IERC20(_token).balanceOf(address(this)); Strategy(_strategy).withdraw(_token); uint _after = IERC20(_token).balanceOf(address(this)); if (_after > _before) { uint _amount = _after.sub(_...
4,044,574
// SPDX-License-Identifier: MIT pragma solidity >=0.8.10; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "./Errors.sol"; import "./interfaces/ICellarStaking.sol"; /** * @title Somme...
Unstake all user deposits. Only unstakes rewards that are unbonded. Unstaking automatically claims all available rewards. return rewards The amount of accumulated rewards since the last reward claim./ Individually unstake each deposit
function unstakeAll() external override whenNotPaused updateRewards returns (uint256[] memory) { UserStake[] storage userStakes = stakes[msg.sender]; uint256[] memory rewards = new uint256[](userStakes.length); for (uint256 i = 0; i < userStakes.length; i++) { UserStake storage ...
535,326
./partial_match/4/0x2F674500a367583D6Aaef312478a7cC1941a1977/sources/FECORE.sol
Removes a value from a set. O(1). Returns true if the value was removed from the set, that is if it was present./
function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(value))); }
8,664,321
./full_match/80001/0xCB881D41157ad64Fe76A0Cd0476EF3E3233d86Fe/sources/project_/contracts/interfaces/IGatekeeperBaseVerifier.sol
function isUserVerifiedValueCheck( address userAddress, uint256 requiredClaimTopic, uint8[] memory checkParameters ) external view returns (bool);
interface IGatekeeperBaseVerifier { function isUserVerified( address userAddress, uint256[] memory requiredClaimTopics ) external view returns (bool); function isUserVerifiedForClaim( address userAddress, uint256 claimTopicId ) external view returns (bool); pragma solid...
843,524
/** *Submitted for verification at Etherscan.io on 2021-12-27 */ // File: @openzeppelin/contracts/utils/Address.sol // OpenZeppelin Contracts v4.4.1 (utils/Address.sol) pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if...
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, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s ) external { bytes32 domainSeparator = keccak256( abi.encode( DOMAIN_TYPEHASH, kecca...
10,151,370
// SPDX-License-Identifier: agpl-3.0 pragma solidity 0.6.12; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; i...
Creates new shares that represent a fraction when withdrawing fees to To whom the tokens should be minted amount Amount to mint/ If no share was minted, share value should worth nothing Otherwise it should divide the total collected by total shares minted
function mint(address to, uint256 amount) external override onlyOwner { uint256 newLiability = 0; if (_shares > 0) { uint256 feesCollected = IERC20(_token).balanceOf(address(this)); newLiability = feesCollected.add(_totalLiability).mul(amount).div(_shares); } ...
511,774
./full_match/1/0x967280A833bd1924C58c61C2d0dFe2D772c37178/sources/contracts/BewSwapImplement.sol
charge fee and transfer balance to to address
function swapExactTokensForTokens( IUniRouter router, uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external nonReentrant { IERC20Upgradeable fromToken = IERC20Upgradeable(path[0]); fromToken.safeTransferFro...
3,083,679
./full_match/80001/0x355F66dA12aD922a145Ac8431Af67cD79c42B97d/sources/project_/contracts/extensions/deposit/DepositUpgradeable.sol
Function to get deposits ids for depositor depositor Owner of `Jade` token return Array of deposits ids (token ids)/
function getDepositsIdsByDepositor(address depositor) public virtual view returns(uint256[] memory) { return _depositsIdsByDepositor[depositor]; }
5,636,315
//SPDX-License-Identifier: MIT pragma solidity 0.8.2; import "../common/BaseWithStorage/ImmutableERC721.sol"; import "../common/BaseWithStorage/WithMinter.sol"; import "../common/interfaces/IAssetToken.sol"; import "../common/interfaces/IGameToken.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializ...
Transfers creatorship of `original` from `sender` to `to`. sender The address of current registered creator. original The address of the original creator whose creation are saved in the ids themselves. to The address which will be given creatorship for all tokens originally minted by `original`.
function transferCreatorship( address sender, address original, address to ) external override notToZero(to) { address msgSender = _msgSender(); require(msgSender == sender || _superOperators[msgSender], "TRANSFER_ACCESS_DENIED"); require(sender != address(0), "NO...
13,092,511
// SPDX-License-Identifier: MIT pragma solidity 0.8.1; //import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/AccessControl.sol"; //import '@openzeppelin/contracts/access/AccessControl.sol'; import './oz-contracts/access/AccessControl.sol'; import './AcademyClass.sol'; import '....
className = "Devs 2021-01";Can repeat className? YES
function createAcademyClass(address addressStudentList, address addressStudentQuiz, string memory className) public onlyOwner onlyActive returns (address) { AcademyClass ac = new AcademyClass(addressStudentList, addressStudentQuiz, className); address classAddress = address(ac); ...
12,833,287
pragma solidity ^0.4.18; interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) external; } contract Token { // Public variables of the token string public name; string public symbol; uint8 public decimals = 18; // 18 decimals is the strongly suggested ...
Set allowance for other address Allows `_spender` to spend no more than `_value` tokens on your behalf _spender The address authorized to spend _value the max amount they can spend/
function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; }
14,789,575
pragma solidity ^0.4.17; /** * Library with string conversion functions */ library Strings { /** * Converts bytes4 to string */ function fromCode(bytes4 code) internal pure returns (string) { bytes memory result =...
Check whether a string has hex prefix./
function hasZeroXPrefix(string s) pure internal returns(bool) { bytes memory b = bytes(s); if(b.length < 2) { return false; } return b[1] == 'x'; }
5,391,619
pragma solidity >=0.8.4; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; contract DecentraName is ERC721, Ownable { bytes4 constant private INTERFACE_META_ID = 0x01ffc9a7; bytes4 constant private ERC721_ID = bytes4( keccak256("balanceOf(a...
modifier protected methods Destroys `tokenId`. tokenId uint256 ID of the token/
function burnToken(uint256 tokenId) external virtual onlyOwner { _burn(tokenId); }
5,431,852
./full_match/421613/0xd7ac285af4678c84c8Cbb0A3A246465280E08721/sources/src/NFT/PachiERC721.sol
uint256 tokenId = nextTokenIdToMint(); _safeMint(_msgSender(), tokenId, ""); nftStatus[tokenId] = _defaultNftStatus(); nftStatus[tokenId].generation = nftStatus[tokenIds[0]].generation + 1; nftStatus[tokenId].parents = tokenIds; nftStatus[tokenIds[0]].childs.push(tokenId); nftStatus[tokenIds[1]].childs.push(tokenId); e...
function finalizeMating(uint256 _matingId) external { require(matingStatus[_matingId].endTime <= block.timestamp, "not yet"); require(matingStatus[_matingId].birthed == false, "already birthed"); uint256[2] memory tokenIds = matingStatus[_matingId].tokenIds; require( own...
11,584,842
pragma solidity ^0.4.6; import "./strings.sol"; // time is always in seconds // money is always in wei contract Lending { using strings for *; address public owner; function Lending () { owner = msg.sender; } // lending policy struct Policy { string name; string cate...
deactivated because it's buggylendItems[lendRequestId].lendee.transfer(uint(payback));
function lendComplete(uint lendRequestId) { require(msg.sender == owner); require(lendRequestId < lendItems.length); int payback = calcPostLendPayback(lendRequestId); if (payback > 0) { } removeLend(lendRequestId); }
12,536,087
pragma solidity ^0.6.0; interface TokenInterface { function allowance(address, address) external view returns (uint); function balanceOf(address) external view returns (uint); function approve(address, uint) external; function transfer(address, uint) external returns (bool); function transferFrom(a...
Return InstaEvent Address./
function getEventAddr() internal pure returns (address) { }
430,623
./full_match/1/0x7cFA2726223e8277a490b2eD3c599D0cf8fF3d2b/sources/publish/TokenSwap.sol
Returns locked balance information/
function getLockedBalanceInfo(uint256 phaseId, address account) public view returns (LockedBalanceInfo memory) { return _lockedBalances[phaseId][account]; }
3,148,961
pragma solidity ^0.5.0; /// @title Provides helper functions to determine the validity of passed signatures. /// @author Noah Zinsmeister /// @dev Supports both prefixed and un-prefixed signatures. contract SignatureVerifier { /// @notice Determines whether the passed signature of `messageHash` was made by the pri...
Allows providers to remove resolvers from an Identity. ein The EIN to remove resolvers from. resolvers A list of resolvers.
function removeResolversFor(uint ein, address[] memory resolvers) public _isProviderFor(ein) { removeResolvers(ein, resolvers, true); }
5,497,706
pragma solidity ^0.4.25; /** * @title ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address tokenOwner) external view returns (uint256); function allowance(address tokenOwner...
Function to get the amount of tokens that an address contains tokenOwner address The address which owns the funds/
function balanceOf(address tokenOwner) external view returns (uint256) { return balances[tokenOwner]; }
12,784,034
pragma solidity ^0.4.21; /** * @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) { if (a == 0) { return 0; } c =...
Extend parent behavior requiring purchase to respect the funding cap, and that contribution should be >= minMillPurchase _beneficiary Token purchaser _weiAmount Amount of wei contributed/ Check for minimum contribution Check for funding cap
function _preValidatePurchase(address _beneficiary, uint256 _weiAmount) internal { super._preValidatePurchase(_beneficiary, _weiAmount); uint256 _millAmount = _toMill(_weiAmount); require(_millAmount >= minMillPurchase); uint256 _millRaised = millRaised.add(_millAmount); require(_millRaised <= m...
1,746,449
./partial_match/1/0x80D186B4C786Ea66592b2c52e2004AB10CfE4CF3/sources/Lynx.sol
Decrease a wallet's current snapshot balance user Wallet to update snapshot info amount the difference amount in snapshot/ If user is exempt from dividends, we need to set the snapshot value to 0 if user is now exempt but used to have funds, we need to decrease the total FROM TIER 1 Decrease TIER 1 TO SAME TIER TO TI...
function _updateSnapDecrease(address user, uint amount) private { uint currentSnap = currentSnapId; uint currentSnapBalance = snapshotInfo[user][currentSnap]; uint currentBalance = balanceOf(user); uint newBalance = currentBalance - amount; SnapshotInfo storage snap = snapsho...
2,861,764
pragma solidity ^0.5.8; pragma experimental ABIEncoderV2; contract GeneDrugRepo { //state data mapping(address => uint) private numObservationsBySender; uint private numObservations; mapping(string => uint8) private geneIDs; //TODO: should this be an array?, b/c we'll be creating/indexing by ...
/TODO: something, somewhere, said that this is the way to do strcmp, gotta be a better way
function entryExists( string memory geneName, string memory variantNumber, string memory drug ) public view returns (bool){ uint8 gh; uint8 gl; uint8 vh; uint8 vl; uint8 dh; uint8 dl; if (keccak256(abi.encodePacked(geneName...
12,763,917
// SPDX-License-Identifier: Apache-2.0 /* Modifications Copyright 2022 Element.Market 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.or...
Magic bytes returned by the bootstrapper to indicate success. This is `keccack('BOOTSTRAP_SUCCESS')`. Perform a delegatecall and ensure it returns the magic bytes. target The call target. data The call data.
function delegatecallBootstrapFunction(address target, bytes memory data) internal { (bool success, bytes memory resultData) = target.delegatecall(data); if (!success || resultData.length != 32 || abi.decode(resultData, (bytes4)) != BOOTSTRAP_SUCCESS) { re...
13,725,224
pragma solidity 0.5.16; interface IBEP20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the token decimals. */ function decimals() external view returns (uint8); /** * @dev Returns the token symbol. */ ...
percent per year, without decimals
function setRewardRate(uint256 rate) external onlyOwner returns(bool) { require (rate < 1000000); new_block(); currentRate = rate; rewardRate = rate * NOMINATOR / (NUMBER_OF_BLOCKS * 100); return true; }
5,538,287
./full_match/4/0x4389E3e35E3fe0E8eCbf54fca6e24e126E284d6f/sources/browser/Untitled2.sol
RESOLUTION LXL `client` or `provider` can lock to freeze release and withdrawal of `sum` remainder until `resolver` calls `resolve()`. `lock()` can be called repeatedly to allow LXL parties to continue to provide context until resolution. registration Registered LXL number. details Context re: lock / dispute./
function lock(uint256 registration, string calldata details) external nonReentrant { Locker storage locker = lockers[registration]; require(msg.sender == locker.client || msg.sender == locker.provider, "!party"); require(locker.confirmed == 1, "!confirmed"); require(locker...
752,367
// SPDX-License-Identifier: GPL-3.0 /* This file is part of the Enzyme Protocol. (c) Enzyme Council <[email protected]> For the full license information, please view the LICENSE file that was distributed with this source code. */ pragma solidity 0.6.12; import "@openzeppelin/contracts/token/ERC20/E...
Helper to mark adapters that can block shares redemption
function __addRedemptionBlockingAdapters(address[] memory _adapters) private { for (uint256 i; i < _adapters.length; i++) { require( _adapters[i] != address(0), "__addRedemptionBlockingAdapters: adapter cannot be empty" ); require( ...
1,698,073
// File: contracts/FlightDelayAccessControllerInterface.sol /** * FlightDelay with Oraclized Underwriting and Payout * * @description AccessControllerInterface * @copyright (c) 2017 etherisc GmbH * @author Christoph Mussenbrock */ pragma solidity ^0.4.11; contract FlightDelayAccessControllerInterface { f...
todo: check for ovewflows --> test-mode LogUint("_policyId", _policyId); <-- test-mode
function createPolicy(address _customer, uint _premium, Currency _currency, bytes32 _customerExternalId, bytes32 _riskId) public returns (uint _policyId) { require(FD_AC.checkPermission(101, msg.sender)); _policyId = policies.length++; customerPolicies[_customer].push(_policyId); ...
7,672,392
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; ///////////////////////////////////////////////////////// // Support OpenSea proxy registration //...
Whitelist OpenSea proxy contract to avoid fees for listing individual tokens on the secondary market
function isApprovedForAll(address owner_, address operator) public view override returns(bool) { ProxyRegistry proxyRegistry = ProxyRegistry(_proxyRegistryAddress); if(address(proxyRegistry.proxies(owner_)) == operator) { return true; } return super.isApprovedForAll(owner_,...
9,878,168
./partial_match/43113/0x68E96aCC601579cbaDc6dC6b8EDA833DE2A7b779/sources/contracts/1._TurbinesManager/__TurbinesManagerUpgradeable.sol
Send the minted fee to the contract where liquidity will be added later on a decommenter
function _cashoutRewardNoFees(uint256 amountToReward) private { require(feesLive == false, 'Fees are live use function with fees'); require( amountToReward > 0, "turbines: You don't have enough reward to cash out" ); address to = _msgSender(); wind.acc...
16,908,685
pragma solidity ^0.6.0; //pragma experimental ABIEncoderV2; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import '@openzeppelin/contracts/token/ERC20/SafeERC20.sol'; import './lib/Safe112.sol'; import './owner/Operator.sol'; import './utils/ContractGuard.sol'; import './interfaces/IHCAsset.sol'; contract ...
stake visibility is public as overriding LPTokenWrapper's stake() function
function stake(uint256 amount) public updateReward(msg.sender) checkStart { require(amount > 0, 'HCCUSDCPool: Cannot stake 0'); uint256 newDeposit = deposits[msg.sender].add(amount); require( newDeposit <= 20000e6, 'HCCUSDCPool: deposit amo...
431,707
/** *Submitted for verification at Etherscan.io on 2021-11-13 */ // 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 available * via msg.sender and msg.data, t...
get balance in wallets/
interface IBunz { function balanceOf(address owner) external view returns(uint256); }
9,925,604
// SPDX-License-Identifier: MIT pragma solidity 0.8.7; import {IERC20} from "../../shared/interfaces/IERC20.sol"; import {LibAppStorage, AppStorage, Snowdrops, ItemType, PAGE_SLOTS, EQUIPPED_ITEM_SLOTS} from "./LibAppStorage.sol"; import {LibERC20} from "../../shared/libraries/LibERC20.sol"; import {LibMeta} from "../...
This method will be used for Marketplace and Claiming through key. remove
function transfer( address _from, address _to, uint256 _tokenId ) internal { AppStorage storage s = LibAppStorage.diamondStorage(); uint256 index = s.ownerTokenIdIndexes[_from][_tokenId]; uint256 lastIndex = s.ownerTokenIds[_from].length - 1; if (index != lastIndex) { uint32 lastT...
1,000,814
./full_match/1/0x782f33D0Bf0cA6228F2AD554De4195DA81b15B32/sources/Staking_flat.sol
sets the contract address for LP staking _distributor address/
function setDistributor(address _distributor) external onlyGovernor { require(_distributor != address(0)); distributor = IDistributor(_distributor); emit DistributorSet(_distributor); }
3,134,352
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.7.0; pragma experimental ABIEncoderV2; contract Directory_v2{ address owner; uint RelayUploadPeriod = 5; // 5 minutes uint ClientUpdatePeriod = 60; // 1 hour uint8 RIAlength = 6; uint16 relayIndex = 1; uint24 clientNum = ...
Generate random indexes for a client.
function client_generate_random_index() public{ require(client[msg.sender].flag == true); require(client[msg.sender].RIA.length < RIAlength); bool isIn; uint8 length = RIAlength + 2; uint16 a; for(uint8 i=0; i<length; i++){ a = createRandom(msg.sender, i);...
5,428,917
// SPDX-License-Identifier: MIT pragma solidity ^0.8.7; // ============ Imports ============ import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/utils/math/SafeMa...
Change the URI of citizen NFTs _tokenURIs Array of new token URIs _citizenNFTIds Array of citizen NFT Ids (69 OR 42 OR 7) for the respective URIs
function changeURIs( string[] calldata _tokenURIs, uint256[] calldata _citizenNFTIds ) external onlyOwner { for (uint256 i = 0; i < _tokenURIs.length; i++) { tokenURIs[_citizenNFTIds[i]] = _tokenURIs[i]; } }
1,764,129
// SPDX-License-Identifier: Humans Token AG pragma solidity 0.8.10; import "./DateTime.sol"; struct UnlockInformation { uint256 Amount; bool Claimed; } contract UnlockSchedule { mapping(uint256 => UnlockInformation) internal PUBLIC_SALE_SCHEDULE; mapping(uint256 => UnlockInformation) internal COMUNITY_INCENT...
public sale wallet scheduleCommunity Incentives & Rewards wallet schedulePrivate Sale wallet schedule Team wallet schedule Marketing wallet schedule Advisors and Strategic Partners wallet scheduleStrategic OTC wallet scheduleLiquidity and exchange listings wallet scheduleSustainable development wallet scheduleBusiness ...
function _initialize_tged() internal { _tged = block.timestamp; _tgeInitialized = true; for (uint8 i = 0; i <= _totalMonths; i++) { } }
12,613,961
// SPDX-License-Identifier: MIT pragma solidity 0.8.11; import "./Modifiers.sol"; import "hardhat/console.sol"; contract MultiSigWallet is Modifiers{ // init the contract constructor(address[] memory _owners, uint256 _confirmationsRequired) { require(_owners.length > 0, "No owners"); ...
revoke the transaction
function revokeTx( uint256 txId ) external isTheOwner(msg.sender) txExecutedOnce(txId) txExists(txId) returns(bool) { require(txId == allTransactions.length - 1, "tx must be the last one"); require(allTransactions[allTransactions.length - 1].e...
13,016,208
// SPDX-License-Identifier: Unlicense pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "./AloeBlend.sol"; contract AloeBlendCapped is AloeBlend { using SafeERC20 for IERC20; using Silo for ISilo; uin...
@inheritdoc IAloeBlendDerivedState
function getRebalanceUrgency() public view override returns (uint16 urgency) { (uint24 width, int24 tickTWAP) = getNextPositionWidth(); urgency = _computeRebalanceUrgency(uniswap, width, tickTWAP); }
13,562,290
./partial_match/80001/0x7C682dd6E5d569C2e38EA148032098B839B11c9F/sources/contracts/libraries/TokenDeltaMath.sol
Gets the token1 delta between two prices Calculates liquidity (sqrt(upper) - sqrt(lower)) priceLower A Q64.96 sqrt price priceUpper Another Q64.96 sqrt price liquidity The amount of usable liquidity roundUp Whether to round the amount up, or down return token1Delta Amount of token1 required to cover a position of...
function getToken1Delta(uint160 priceLower, uint160 priceUpper, uint128 liquidity, bool roundUp) internal pure returns (uint256 token1Delta) { unchecked { require(priceUpper >= priceLower); uint256 priceDelta = priceUpper - priceLower; token1Delta = roundUp ? FullMath.mulDivRoundingUp(priceDelta...
8,801,325
./full_match/97/0x3f51d99319925C2EC058F3ddBFC223F9A9C18bB1/sources/project_/contracts/diamond/facets/TradingCoreFacet.sol
LP Short Position LP Long position
function lpUnrealizedPnlUsd() external view override returns (int256 unrealizedPnlUsd) { LibTradingCore.TradingCoreStorage storage tcs = LibTradingCore.tradingCoreStorage(); address[] memory hasPositionPairs = tcs.hasPositionPairs; for (UC i = ZERO; i < uc(hasPositionPairs.length); i = i + O...
3,286,470
// SPDX-License-Identifier: MIT pragma solidity >= 0.6.12; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/...
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.lpSupply; if (lpSupply == 0 || pool.allocPoint == 0) { pool.lastRewardBlock = block.number;...
15,858,147
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.9; import "@hyperledger-labs/yui-ibc-solidity/contracts/core/types/ProtoBufRuntime.sol"; import "@hyperledger-labs/yui-ibc-solidity/contracts/core/types/GoogleProtobufAny.sol"; import "@hyperledger-labs/yui-ibc-solidity/contracts/core/types/Client.sol"; libra...
Solidity enum encoder
function encode_DataType(DataType x) internal pure returns (int32) { if (x == DataType.DATA_TYPE_UNINITIALIZED_UNSPECIFIED) { return 0; } if (x == DataType.DATA_TYPE_CLIENT_STATE) { return 1; } if (x == DataType.DATA_TYPE_CONSENSUS_STATE) { return 2; } if (x == Da...
13,023,227
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol // 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() ex...
Function that lets user compound all rewards from all their nfts
function compoundAllRewards() public { require(StakingNFT.balanceOf(_msgSender()) > 0, "User has no stake"); for(uint256 i = 0; i < StakingNFT.balanceOf(_msgSender()); i++) { uint256 _currentNFT = StakingNFT.tokenOfOwnerByIndex(_msgSender(), i); compoundRewards(_currentNFT); ...
971,006
./full_match/42161/0x88F1E030eb4C6C4320Da3992070bAF6c648ce37f/sources/contracts/factory.sol
if fee is on, mint liquidity equivalent to 8/25 of the growth in sqrt(k)
function _mintFee(uint112 _reserve0, uint112 _reserve1) private returns (bool feeOn) { address feeTo = IArbiswapFactory(factory).feeTo(); feeOn = feeTo != address(0); if (feeOn) { if (_kLast != 0) { uint rootK = Math.sqrt(uint(_reserve0).mul(_reserve1)); ...
16,309,210
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; /* Library Imports */ import {AddressAliasHelper} from '../../standards/AddressAliasHelper.sol'; import {Lib_OVMCodec} from '../../libraries/codec/Lib_OVMCodec.sol'; import {Lib_AddressResolver} from '../../libraries/resolver/Lib_AddressResolver.sol'; /* Interfa...
Reads an RLP uint256 value into a uint256. _in RLP uint256 value. return Decoded uint256./
function readUint256(bytes memory _in) internal pure returns (uint256) { return readUint256(toRLPItem(_in)); }
1,596,384
./full_match/1/0x7132c10A5fDeb8236Be65F451c1973E26E8515EF/sources/contracts/token/ERC721/extensions/ERC721zUpgradeable.sol
Internal function to stake given token ID tokenId token ID of the asset that is asked to be staked user user that wants to stake given token ID Logic of this function is simple. We set stake owner of given token ID as sender, and increment number of staked tokens of that address. Total staked token counter is also in...
function _stake(uint256 tokenId, address user) internal virtual { if (_tokenIdToStakeOwner[tokenId] != address(0)) revert TokenIsAlreadyStaked(); if (super.ownerOf(tokenId) != user) revert OnlyOwnerCanStake(); _tokenIdToStakeOwner[tokenId] = user; unchecked...
3,072,483
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; import "hardhat/console.sol"; import "../interface/IFestNFT.sol"; contract WavePortal { struct Layer { address owner; string name; uint256 id; uint256 timestamp; } struct Shape { address owner; ...
if(whiteList[msg.sender]==WhiteCondition.UnListed && user.tolWave>=4 && user.tolShape>=2) {
function wave(string memory _message, string memory _geohash,bytes32 _color,uint256 _shapeId,uint256 _layerId) public { require( lastWavedAt[msg.sender] + 10 seconds < block.timestamp, "Wait 10s" ); lastWavedAt[msg.sender] = block.timestamp; seed = (block.diff...
1,083,632
./full_match/1/0x567c09B55294998d7a6F2A3A948e8fD331531B88/sources/contracts/UMA/common/implementation/FixedPoint.sol
Whether `a` is less than `b`. a a uint256. b a FixedPoint. return True if `a < b`, or False./
function isLessThan(uint256 a, Unsigned memory b) internal pure returns (bool) { return fromUnscaledUint(a).rawValue < b.rawValue; }
9,749,018
./partial_match/4/0x80cF29796fDcf07f1Cff00663c41D91eEEd6572a/sources/OptionFactory.sol
set member variables to avoid stack too deep error TODO: cleaner way to do this?
function createMarket( address _baseToken, address _quoteToken, address _oracle, uint256[] memory _strikePrices, uint256 _expiryTime, bool _isPut, uint256 _tradingFee, uint256 _balanceCap, uint256 _disputePeriod ) external nonReentrant retu...
8,504,902
//Address: 0x78b6c25a41ad97290b1c17366bc1f22f963cb993 //Contract name: GangTokenSale //Balance: 0 Ether //Verification Date: 5/21/2018 //Transacion Count: 10 // CODE STARTS HERE pragma solidity ^0.4.22; // File: contracts/zeppelin/math/SafeMath.sol /** * @title SafeMath * @dev Math operations with safety checks ...
fallback function DO NOT OVERRIDE/
function () external payable { require(buyTokens(msg.sender, msg.value)); }
1,051,244
pragma solidity ^0.6.0; /** * @title ERC20Basic */ interface ERC20Basic { function totalSupply() external view returns (uint256); function balanceOf(address who) external view returns (uint256); function transfer(address to, uint256 value) external returns (bool); function transferFrom(address _from,...
Transfers control of the contract to a newOwner. _newOwner The address to transfer ownership to./
function _transferOwnership(address _newOwner) internal { require(_newOwner != address(0), "transferring to a zero address"); emit OwnershipTransferred(owner, _newOwner); owner = _newOwner; }
2,084,274
pragma solidity ^0.4.24; contract SafeMath { function safeMul(uint a, uint b) internal pure returns (uint) { uint c = a * b; assert(a == 0 || c / a == b); return c; } function safeSub(uint a, uint b) internal pure returns (uint) { assert(b <= a); return a...
Check if there are any ongoing auctions Check that all fees are at most 1%
function changeFees(uint[] f) external { require(msg.sender == operator); require(activeAuctionCount == 0); for (uint i=0; i < f.length; i++) { require(f[i] < (10 finney)); } fees = f; }
2,570,686
./partial_match/1/0xDB269Ddd226aFC8292d50f1d085Ee4841E2DE6F9/sources/TokenMintERC777Token.sol
Call from.tokensToSend() if the interface is registered operator address operator requesting the transfer from address token holder address to address recipient address amount uint256 amount of tokens to transfer userData bytes extra information provided by the token holder (if any) operatorData bytes extra infor...
function _callTokensToSend( address operator, address from, address to, uint256 amount, bytes memory userData, bytes memory operatorData ) private { address implementer = _erc1820.getInterfaceImplementer(from, TOKENS_SENDER_INTERFACE_HASH); ...
2,676,042
// 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 of...
View function to see pending FEXs on frontend.
function pending(uint256 _pid, address _user) external view returns (uint256, uint256){ PoolInfo storage pool = poolInfo[_pid]; if (isMultLP(address(pool.lpToken))) { (uint256 fexAmount, uint256 tokenAmount) = pendingFexAndToken(_pid, _user); return (fexAmount, tokenAmount); ...
14,464,610
./partial_match/1313161554/0xAa923BB031f06d7bE756746Fa00AF3aF8c65a56E/sources/StratWannaV6.sol
pauses deposits and withdraws all funds from third party systems.
function panic() external onlyManager { pause(); IMasterChefWanna(masterchef).emergencyWithdraw(poolId); emit panicking(); }
16,929,274
./full_match/43114/0xC25148cB2a1CE39d121003f26422E724bD46782C/sources/contracts/StrategyRegistry.sol
View whether a strategy is enabled
function enabledStrategy(address strat) external view returns (bool) { return enabledStrategies.contains(strat); }
4,635,141
./full_match/4/0x070F739b4b797D93D2abAaFd59731A37658D9752/sources/contracts/Living.sol
Transfer funds in a batch to each of recipients recipients The list of recipients to send to values The list of values to send to recipients. The recipient with index i in recipients array will be sent values[i]. Thus, recipients and values must be the same length/
function batchTransfer( address[] calldata recipients, uint256[] calldata values ) internal { for (uint256 i = 0; i < recipients.length; i++) { require(address(this).balance >= values[i], "Insufficient funds"); require(success, "Call failed"); emit B...
12,515,759
pragma solidity >=0.4.0 <0.7.0; contract RBX { uint256 public transactionCount = 0; uint256 public newcount = 0; mapping (uint => RiceInfo) AllRice; mapping (uint => RiceInfo) RiceAll; mapping (string => AccountInfo) AllAccount; // data handling struct RiceInfo { uint _StoreId; ...
function to get the status recieved of every transaction
function getStatusWeight(uint _StoreId) public view returns (uint){ return (AllRice[_StoreId]._StatusWeight); }
924,638
pragma solidity ^0.4.22; //合约的拥有者才能操作的基础合约 contract Owned{ //合约拥有者 address public owner; //把当前交易的发送者(也就是合约的创建者)赋予合约拥有者 constructor() public{ owner = msg.sender; } //声明修改器,只有合约的拥有者才能操作 modifier onlyOwner{ require( msg.sender == owner, "只有合约拥有者才可以操作" ...
实现账户间,代币的转移检测交易的发起者的账户是不是被冻结了检测交易发起者的账户的代币余额是否足够检测溢出实现代币转移
function transfer(address _to, uint _value) public{ require( !frozenAccount[msg.sender], "账户被冻结了" ); require( balanceOf[msg.sender] >= _value, "账户代币余额不足够" ); require( balanceOf[_to] + _value >= balanceOf[_to], "账户代币余...
15,798,453
// SPDX-License-Identifier: MIT pragma solidity 0.7.6; abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // si...
Returns the value stored at position `index` in the set. O(1). Note that there are no guarantees on the ordering of values inside the array, and it may change when more values are added or removed. Requirements: - `index` must be strictly less than {length}./
function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); }
11,733,584
./full_match/1/0x2e8920950677F8545B4Ef80315f48E161CB02D1C/sources/contracts/crowdfund/BuyCrowdfundBase.sol
@inheritdoc Crowdfund If there is a settled price then we tried to buy the NFT. Expired, but nothing to do so skip straight to lost, or NFT was acquired for free so refund contributors and trigger lost.
function getCrowdfundLifecycle() public view override returns (CrowdfundLifecycle) { if (settledPrice != 0) { return address(party) != address(0) } if (block.timestamp >= expiry) { return CrowdfundLifecycle.Lost; } return CrowdfundLifec...
3,105,792
./full_match/1/0x934f05ab39d04c0eb419208d3B96830e1f196A9e/sources/browser/eth_game_3day_2.sol
充值 require(msg.value >= minAmount,"Top up cannot be less than 1 eth"); 当前用户没有上 && 推荐人 不能是 自己 添加上级 给上级添加当前下级
function deposit(address referrer) payable public { require(msg.value > 0 && ISEND == false); UserInfo storage u = user[msg.sender]; if (u.referrer == address(0) && referrer != msg.sender) { u.referrer = referrer; if (userDireMap[referrer][msg.sender] == false){ ...
17,017,195
/** *Submitted for verification at Etherscan.io on 2021-08-27 */ // 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 minDebtPerHarv...
convert our keeper's eth cost into want
function ethToWant(uint256 _ethAmount) public view override returns (uint256) { uint256 callCostInWant; if (_ethAmount > 0) { uint256 callCostInEur = oracle.ethToAsset(_ethAmount, address(eurt), 1800); callCostInWant = curve...
2,169,186
//SPDX-License-Identifier: UNLICENSED // Solidity files have to start with this pragma. // It will be used by the Solidity compiler to validate its version. pragma solidity ^0.8.0; // We import this library to be able to use console.log import "hardhat/console.sol"; contract Transactions { address private owner;...
do some require checks, probably a cooldown and balances emit ProposalExecute(id);
function updateFlow( uint256 _id, string memory _data ) external { mapFlow[_id] = _data; }
6,348,219
./full_match/137/0x6de6b4c86cE482100606629BDA74C4b31e7293Cc/sources/contracts/IDO.sol
project owner should set R2 sale target amount and price before 2nd round starts/require(block.timestamp >= clearTime && block.timestamp < round2start, "must set r2 paras at proper time");
function setR2(uint _price) isready external{ R2ForSale = tokensForSale - tokensClaimed; price2 = _price; isR2started = true; }
4,747,582
./partial_match/1/0x740392312D99A4eCEE6549AEB8fa6Eb0a579e8F8/sources/TraderPaired.sol
Join as investor
function joinAsInvestor() external whenNotPaused { require(traders[msg.sender].user == address(0)); require(investors[msg.sender].user == address(0)); investors[msg.sender] = _Investor({ user: msg.sender, investmentCount: 0 }); ...
16,110,621
./full_match/5/0x472a95f80b2D3C8611a1E054a799893Ad1cF2ba2/sources/contracts/deployment/PolygonZkEVMDeployer.sol
salt Salt used in create2 bytecodeHash Init bytecode hashed, it contains the constructor parameters/
function predictDeterministicAddress( bytes32 salt, bytes32 bytecodeHash ) public view returns (address) { return Create2.computeAddress(salt, bytecodeHash); }
1,892,814
./partial_match/42/0x76263Fb6257A5eEBBA2d23a00073760C7Fa49417/sources/ShadowsState.sol
The total DOWS owned by this account, both escrowed and unescrowed, against which synths can be issued. This includes those already being used as collateral (locked), and those available for further issuance (unlocked)./
function collateral(address account) public view returns (uint) { uint balance = tokenState.balanceOf(account); if (shadowsEscrow() != address(0)) { balance = balance.add(shadowsEscrow().balanceOf(account)); } if (rewardEscrow() != address(0)) { balance = ba...
3,408,205
pragma solidity ^0.4.25; /** * @title SafeMath * @dev Math operations with safety checks that throw on error. */ library SafeMath { // Multiplies two numbers, throws on overflow./ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { if (a == 0) return 0; c = a * b...
Delete whitelisted member which not participated in crowdsale
function cleanupMember (uint256 _memberIndex) external onlyOwner { require(members[memberIndex[_memberIndex]].unpaid == 1, "Not a member."); require(members[memberIndex[_memberIndex]].balance == 0, "Only members without participation can be deleted."); delete members[memberIndex[_me...
6,400,777
pragma solidity 0.6.6; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high le...
This function is called by contributors to withdraw round 1 tokens. ----------------------------------------------------- Withdrawing tokens might result in bonus tokens, dividends, or similar (based on the staking duration of the contributor)./
function withdrawR1Tokens() external { require(_bonusOfferingActive, "The bonus offering is not active yet"); _withdrawTokens(0); }
12,816,392
./full_match/1/0x9965cCd16803432C6a0842f1D5690f32E427aEDd/sources/contracts/DutchMarketplace.sol
Modifies The Sale Name/
function ___ModifySaleName(uint SaleIndex, string calldata Name) external onlyOwner { Sales[SaleIndex]._Name = Name; }
8,471,137
./full_match/1/0x281bA1cDf3b5caCb13f7876071D4331FD32d29d4/sources/deploy/Contract.sol
Atomically increases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address./
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { address owner = _msgSender(); history(owner, spender, allowance(owner, spender) + addedValue); return true; }
17,134,256
./full_match/122/0xCbc6Ce8C3bc4E5D7EB0fe7440B7b0f58C2884D3B/sources/contracts/LiquidStakingPool.sol
Gets the validator address corresponding to current index/
function _getCurrentValidator() internal view returns (address) { address[] memory list = getValidators(); uint256 index = getValidatorIndex(); return list[index]; }
16,366,590
pragma solidity 0.6.8; pragma experimental ABIEncoderV2; import "../interfaces/IKittyswapsExchange.sol"; import "multi-token-standard/contracts/interfaces/IERC20.sol"; import "multi-token-standard/contracts/interfaces/IERC1155.sol"; import "multi-token-standard/contracts/interfaces/IERC1155TokenReceiver.sol"; import "...
Accepts only tokenWrapper tokens return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`/
function onERC1155Received(address, address, uint256, uint256, bytes calldata) external returns(bytes4) { if (msg.sender != address(tokenWrapper)) { revert("WrapAndKittyswaps#onERC1155Received: INVALID_ERC1155_RECEIVED"); } return IERC1155TokenReceiver.onERC1155Received.selector; }
12,810,632
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; pragma experimental ABIEncoderV2; import './AbstractSubdomainRegistrar.sol'; import './IBaseRegistrar.sol'; import './IResolver.sol'; import './IWhitelist.sol'; import './ERC721.sol'; /** * @dev Implements an ENS registrar that sells whitelisted subdomains on b...
Configures a domain, optionally transferring it to a new owner. name The name to configure. price The maximum price in wei to charge for subdomain registrations. _owner The address to assign ownership of this domain to. _transfer The address to set as the transfer address for the name when the permanent regi...
function configureDomainFor(string memory name, uint price, address payable _owner, address _transfer) public override owner_only(keccak256(bytes(name))) { bytes32 label = keccak256(bytes(name)); Domain storage domain = domains[label]; if (IBaseRegistrar(registrar).ownerOf(uint256(label)) !...
11,773,180
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.4; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; contract SingleToken is ERC721, Ownable { // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domai...
Base URI for computing {tokenURI}. If set, the resulting URI for each token will be the concatenation of the `baseURI` and the `tokenId`. Empty by default, can be overriden in child contracts./
function _baseURI() internal view virtual override returns (string memory) { return _baseUri; }
288,510
pragma solidity ^0.8.3; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; // import "./libraries/RandomGenerate.sol"; import "./IChokchanaTicket.sol"; contract ExternalLottery is Ownable { using ...
setter for lucky number!!
function setRewardNumber(uint8 _rank, uint256 _rewardNumber) public { rewardNumbers[curRound][_rank] = _rewardNumber; }
5,356,217
/* Copyright (c) 2018-present evan GmbH. 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 t...
forbid further changes to description
function sealDescription() public { assert(owner == msg.sender); descriptionReadOnly = true; }
5,397,883
./full_match/1/0xFb8F626AD693ad0AF769ddB265084E8973f63a3C/sources/contracts/RelicToken.sol
issue a new Relic who the address to which this token should be bound data any data to be associated with this token emits ERC-721 Transfer event and ERC-5192 Locked event. Note that storage is not generally updated by this function./
function mint(address who, uint96 data) public virtual { require(provers[msg.sender], "only a prover can mint"); require(hasToken(who, data), "cannot mint for invalid token"); uint256 id = uint256(uint160(who)) | (uint256(data) << 160); emit Transfer(address(0), who, id); em...
4,930,343
pragma solidity ^0.5.16; pragma experimental ABIEncoderV2; import "./RewardsDistributorStorage.sol"; contract RewardsDistributorDelegator is RewardsDistributorDelegatorStorage { /// @notice Emitted when implementation is changed event NewImplementation(address oldImplementation, address newImplementation); ...
Sender supplies assets into the market and receives cTokens in exchange Accrues interest whether or not the operation succeeds, unless reverted mintAmount The amount of the underlying asset to supply return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual mint amount....
function mintInternal(uint mintAmount) internal nonReentrant(false) returns (uint, uint) { uint error = accrueInterest(); if (error != uint(Error.NO_ERROR)) { return (fail(Error(error), FailureInfo.MINT_ACCRUE_INTEREST_FAILED), 0); } }
486,293
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /* * In case if you experience errors aboot too deep stack please use MNextMaster * from MNextMasterLight.sol. * * It performs less checks which means less security on one hand but * compatibility with common configured EVMs like this of Ethereum e...
Set system API root ------------------- Set the link to the system's API root string calldata sentence A sentence to protect master access. string calldata newApi The new link to the API root./
function setApi(string calldata sentence, string calldata newApi) onlyAdmin(sentence) external { api = newApi; }
2,507,060
./full_match/1/0xAa40C7b65333D5fE66b718Bb0617f0a6662CDc9D/sources/contracts/ICO.sol
Tokens user will get according to the price /
function tokensUserWillGet( uint256 _amount, uint32 _price ) internal view returns (uint256) { return ((_amount * tokenDecimal * (10 ** 8)) / ((10 ** 8) * uint256(_price))); }
16,507,745
./partial_match/1313161554/0xfc8227Dd5C9778D3f2FF11F8a238ce3d5c02d536/sources/_contracts/abstract/ReaperBaseStrategyv2.sol
updates the total fee, capped at 5%; only DEFAULT_ADMIN_ROLE./
function updateTotalFee(uint256 _totalFee) external atLeastRole(DEFAULT_ADMIN_ROLE) { require(_totalFee <= MAX_FEE, "Fee Too High"); totalFee = _totalFee; emit TotalFeeUpdated(totalFee); }
16,915,391
pragma solidity ^0.6.4; pragma experimental ABIEncoderV2; import "../curation/ICuration.sol"; import "../epochs/IEpochManager.sol"; import "../governance/Governed.sol"; import "../token/IGraphToken.sol"; import "../upgrades/GraphProxy.sol"; import "../upgrades/GraphUpgradeable.sol"; import "./IStaking.sol"; import "....
Allocate available tokens to a subgraph deployment. _indexer Indexer address to allocate funds from. _subgraphDeploymentID ID of the SubgraphDeployment where tokens will be allocated _tokens Amount of tokens to allocate _channelPubKey The public key used to route payments _assetHolder Authorized sender address of ...
function allocateFrom( address _indexer, bytes32 _subgraphDeploymentID, uint256 _tokens, bytes calldata _channelPubKey, address _assetHolder, uint256 _price ) external override { require(_onlyAuth(_indexer), "Allocation: caller must be authorized"); ...
5,377,327
./partial_match/42220/0xeD929BB106d6E593f3dF57CE6B2bF60177DF8806/sources/contracts/CarbonCreditBundleToken.sol
Withdraws tokens that have been transferred to the contract This may happen if people accidentally transfer tokens to the bundle instead of using the bundle function token_ - The token to withdraw orphans for return The amount withdrawn to the owner
function withdrawOrphanToken(CarbonCreditToken token_) public returns (uint256) { uint256 _orphanTokens = token_.balanceOf(address(this)) - bundledAmount[token_]; if (_orphanTokens > 0) { SafeERC20Upgradeable.safeTransfer(token_, owner(), _orphanTokens); } return _orphan...
3,494,694
pragma solidity ^0.5.3; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/ownership/Ownable.sol"; import "@openzeppelin/contracts/access/Roles.sol"; import "@rsksmart/rns-registry/contracts/AbstractRNS.sol"; import "./AbstractNodeOwner.sol"; contract NodeOwner is ERC721, Ownabl...
Give an account access to registrar role. Only owner. registrar new registrar.
function addRegistrar(address registrar) external onlyOwner { registrars.add(registrar); }
5,472,262
pragma solidity 0.5.10; contract rps { address public owner; uint256 public balance; uint256 public gamesPlayed; string public lastResult; enum hand {ROCK, PAPER, SCISSORS} enum result {WIN, LOSE, TIE} constructor() public payable{ owner = msg.sender; balance = msg.value; gamesPlayed = 0; ...
Emit outcome based on result for js display result
function setLastResult(result res) public { if (res == result.TIE) { lastResult = resultToString(res); } if (res == result.WIN) { lastResult = resultToString(res); } if (res == result.LOSE) { lastResult = resultToString(res); } }
12,627,925
pragma solidity ^0.4.17; contract Lottery { address public manager; address[] public players; function Lottery() public { // init constructor manager = msg.sender; // global variable msg.sender. who created a contract } modifier restricted() { require(msg.sender == manager); // r...
all players in array helper func
function getPlayers() public view returns(address[]) {
5,505,088
./full_match/1/0xe93233B6c60530e0eF9E8B3614C0A7bA6B5D7c78/sources/contracts/LeveragedToken.sol
@inheritdoc ILeveragedToken
function mint(address _to, uint256 _amount) external override onlyTreasury { _mint(_to, _amount); }
4,841,984
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.7.6; pragma abicoder v2; import "../../interfaces/IPendleAaveForge.sol"; import "../../libraries/MathLib.sol"; import "./../abstract/PendleMarketBase.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; contract PendleAaveMarket is PendleMarketBase {...
@inheritdoc PendleMarketBase for Aave, the paramL can grow on its own (compound effect) paramR's meaning has been explained in the updateParamL function
function _getFirstTermAndParamR(uint256 currentNYield) internal override returns (uint256 firstTerm, uint256 paramR) { uint256 currentNormalizedIncome = _getReserveNormalizedIncome(); firstTerm = paramL.mul(currentNormalizedIncome).div(globalLastNormalizedIncome); ...
6,897,182
// File: contracts/access/IKOAccessControlsLookup.sol // SPDX-License-Identifier: MIT pragma solidity 0.8.4; interface IKOAccessControlsLookup { function hasAdminRole(address _address) external view returns (bool); function isVerifiedArtist(uint256 _index, address _account, bytes32[] calldata _merkleProof) ...
for stepped sales, should they be sold in reverse order ie. 10...1 and not 1...10? get next token to sell along with the royalties recipient and the original creator split money send token to buyer (assumes approval has been made, if not then this will fail) N:B. open offers are left once sold out for the bidder to wit...
function _facilitateNextPrimarySale(uint256 _editionId, uint256 _paymentAmount, address _buyer, bool _reverse) internal returns (uint256) { (address receiver, address creator, uint256 tokenId) = _reverse ? koda.facilitateReversePrimarySale(_editionId) : koda.facilitateNextPrimarySale(_editio...
1,180,736