file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
./full_match/137/0x6B15A0C1Fe536B5457ceA217B699b5Eb32F1d1ef/sources/contracts/Tokenomics.sol
function getCollectedFeeTotal(uint256 index) external view returns (uint256){
function getCollectedFeeTotal(uint256 index) internal view returns (uint256) { Fee memory fee = _getFeeStruct(index); return fee.total; }
4,757,929
./full_match/137/0x590795f47174Fe087342DBd6a20721cd70C8F7E4/sources/Cryptokeys.sol
Gets the token name. return string representing the token name/
function name() external pure returns (string memory) { return _name; }
4,681,044
// Market Exchange //1. Binance Exchange //2. Bithumb Exchange //3. Indodax Exchange //4. Bitrexx Exchange //5. PoloniexExchange //6. Kucoin Exchange //7. TokenomyExchange //8. Huobi Exchange //9. BitfinexExchange //10.Kraken Exchange pragma solidity ^0.4.16; interface tokenRecipient { function receiveApproval...
Constrctor function Initializes contract with initial supply tokens to the creator of the contract/
function UnionChain() public { balanceOf[msg.sender] = totalSupply; creator = msg.sender; }
13,626,248
// SPDX-License-Identifier: MIT /** * β–ˆβ–„ β–ˆ β–ˆβ–€ β–€β–ˆβ–€ β–„β–€β–€ β–„β–€β–„ β–ˆ β–ˆ β–ˆβ–ˆβ–€ β–„β–€β–€ β–€β–ˆβ–€ β–ˆ β–„β–€β–„ β–ˆβ–„ β–ˆ β–„β–€β–€ * β–ˆ β–€β–ˆ β–ˆβ–€ β–ˆ β–€β–„β–„ β–€β–„β–€ β–ˆβ–„β–„ β–ˆβ–„β–„ β–ˆβ–„β–„ β–€β–„β–„ β–ˆ β–ˆ β–€β–„β–€ β–ˆ β–€β–ˆ β–„β–ˆβ–ˆ * * Made with 🧑 by Kreation.tech */ pragma solidity ^0.8.6; import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol"; import {Counters} from "@openz...
Creates a new collection contract as a factory with a deterministic address, returning the address of the newly created contract. Important: None of these fields can be changed after calling this operation, with the sole exception of the baseUrl field which must refer to a content having the same hash. info collection...
function create( DroppableCollection.Info memory info, uint64 size, string memory baseUrl, uint16 royalties ) external onlyRole(ARTIST_ROLE) returns (address) { require(_names[info.name] == 0, "Duplicated collection"); uint256 id = _counter.current(); _nam...
7,222,664
//β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•— //β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘ //β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘ //β–ˆβ–ˆβ•”β•β•β•β• β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘ //β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β•šβ–ˆβ–ˆβ–ˆβ–ˆβ•‘ //β•šβ•β• β•šβ•β• β•šβ•β•β•šβ•β•β•β•β•β•β•β•šβ•β• β•šβ•β•β•šβ•β•β•β•β•...
Check if the given PalPool has enough cash to borrow palPool address of PalPool amount amount ot borrow return bool : true if possible/
function borrowPossible(address palPool, uint amount) external pure override returns(bool){ palPool; amount; return false; }
13,039,067
pragma solidity ^0.4.11; /** * @title ERC20Basic * @dev Simpler version of ERC20 interface */ contract ERC20Basic { uint256 public totalSupply; function balanceOf(address who) public constant returns (uint256); function transfer(address to, uint256 value) public returns (bool); event Transfer(address indexe...
owner send tokens to admin./
function transferToAdmin(uint256 _value) public onlyOwner onlyWhenTransferEnabled returns (bool) { return super.transfer(adminAddr, _value); }
12,042,541
./partial_match/1/0x4742dF6746492844245Ad4Ff8B9594215aB4976d/sources/SwiftEth.sol
Destroys `amount` tokens from the caller. See {ERC20-_burn}./
function _beforeTokenTransfer( address from, address to, uint256 amount function _afterTokenTransfer( address from, address to, uint256 amount } pragma solidity ^0.8.9; function burn(uint256 amount) public virtual { _burn(_msgSender(), amount);...
3,729,663
pragma solidity ^0.5.16; import "./CErc20.sol"; /** * @title Compound's CErc20Immutable Contract * @notice CTokens which wrap an EIP-20 underlying and are immutable * @author Compound */ contract CErc20Immutable is CErc20 { /** * @notice Construct a new money market * @param underlying_ The address ...
Similar to EIP20 transfer, except it handles a False success from `transfer` and returns an explanatory error code rather than reverting. If caller has not called checked protocol's balance, this may revert due to insufficient cash held in this contract. If caller has checked protocol's balance prior to this ...
function doTransferOut(address payable to, uint amount) internal { EIP20NonStandardInterface token = EIP20NonStandardInterface(underlying); token.transfer(to, amount); bool success; uint balanceAfter = EIP20Interface(underlying).balanceOf(address(this)); assembly { ...
17,548
./full_match/4/0x957B168fEA0cDA59F07Ddce6E1d98513317193FB/sources/browser/ProofOfName.sol
user memory user1; user1.fname = name; user1.data = str; UserLink[usr] = user1;
function linkUser(address usr, string memory name , string memory str) onlyAuthorizeduser public returns (bool) { UserLink[usr].fname = name; UserLink[usr].data = str; return true; }
13,345,582
pragma solidity >=0.4.0 <0.7.0; contract Sellable { // The owner of the contract address public owner; // Current sale status bool public selling = false; // Who is the selected buyer, if any. address public sellingTo; // How much ether (wei) the seller has asked the buyer to send uint...
initiateSale is called by the owner of the contract to start the sale process. _price is the asking price for the sale _to (OPTIONAL) is the address of the person that the owner wants to sell the contract to. If set to 0x0, anyone can buy it./
function initiateSale(uint _price, address _to) public onlyOwner { require(_to != address(this) && _to != owner); require(!selling); selling = true; sellingTo = _to; askingPrice = _price; }
12,993,724
pragma solidity 0.6.6; pragma experimental ABIEncoderV2; contract DSAuthEvents { event LogSetAuthority(address indexed authority); event LogSetOwner(address indexed owner); } contract DSAuth is DSAuthEvents { DSAuthority public authority; address public owner; constructor() public { ...
repay dai debt cdp withdraw collateral from cdp send back to msg.sender
function close( uint _cdpId, address _joinAddr, uint _loanAmount, uint _collateral ) public { address owner = getOwner(manager, _cdpId); bytes32 ilk = manager.ilks(_cdpId); (uint maxColl, ) = getCdpInfo(manager, _cdpId, ilk); paybackDeb...
7,336,010
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.6.11; // ==================================================================== // | ______ _______ | // | / _____________ __ __ / ____(_____ ____ _____ ________ | // | / /_ / ___/ __ `| |/_/ ...
The vAMM will buy back FXB at market rates in all cases However, any FXB bought back under the floor price will be burned no change to fxb_bought_above_floor Apply the normal selling fee to this portion Informational for return values Get the virtual amount under the floor Apply the normal selling fee to this portion I...
function sellFXBintoAMM(uint256 fxb_in, uint256 frax_out_min) external notSellingPaused returns (uint256 fxb_bought_above_floor, uint256 fxb_sold_under_floor, uint256 frax_out, uint256 frax_fee_amt) { require(isInEpoch(), 'Not in an epoch'); fxb_bought_above_floor = fxb_in; fxb_sold_under_f...
13,109,813
./partial_match/84531/0xAABeead2Aa1Dc97dbbf44e7daC50e43c50f71DF9/sources/contracts/src/diamond/facets/cut/DiamondCutBase.sol
Add a new facet to the diamond facet The facet to add selectors The selectors for the facet add facet to diamond storage add selectors to diamond storage
function _addFacet(address facet, bytes4[] memory selectors) internal { DiamondCutStorage.Layout storage ds = DiamondCutStorage.layout(); if (!ds.facets.contains(facet)) ds.facets.add(facet); uint256 selectorCount = selectors.length; for (uint256 i; i < selectorCount; ) { bytes4 selector = se...
16,682,160
./partial_match/1/0xDb9dDeD4f6C2404Aa572fc0bb118F5964377D367/sources/aiTunes.sol
Emergency withdraw for ETH left in contract /
function withdrawETH(uint256 amount) external onlyOwner { if ( amount == 0 ) amount = address(this).balance; payable(owner()).transfer(amount); }
2,811,870
pragma solidity ^0.4.25; /** * @title BLACK DIA COIN * @author BLACK DIA COIN TEAM * @dev BLACK DIA COIN is an ERC223 Token with ERC20 functions and events * Fully backward compatible with ERC20 */ /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library...
Adds authority to execute several functions to subOwner. _authority The address to add authority to./
function addAuthority(address _authority) onlyOwner public { authorities[_authority] = true; emit AuthorityAdded(_authority); }
15,835,171
// SPDX-License-Identifier: MIT pragma solidity ^0.6.0; import "@openzeppelin/upgrades-core/contracts/Initializable.sol"; import "./interfaces/IPriceModule.sol"; contract APContract is Initializable { address public yieldsterDAO; address public yieldsterTreasury; address public yieldsterGOD; addres...
Function to set stringUtils contract. _stringUtils Address of the stringUtils contract.
function setStringUtils(address _stringUtils) external onlyYieldsterDAO { stringUtils = _stringUtils; }
13,825,045
// SPDX-License-Identifier: MIT pragma solidity ^0.8.7; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contra...
tries to execute the payment when the token is minted. Reverts if the payment procedure could not be completed./ Transfer tokens to pay service fee
function paymentBeforeMint(address tokenHolder) internal virtual { require( stablecoin.transferFrom( tokenHolder, address(this), serviceFeeForContract ), "XDV: Transfer failed for recipient" ); emit ServiceF...
7,242,549
/* * Havven Contract * * The collateral token of the Havven stablecoin system. * * version: nUSDa.1 * date: 29 Jun 2018 * url: https://github.com/Havven/havven/releases/tag/nUSDa.1 * * MIT License * =========== * * Copyright (c) 2018 Havven * * Permission is hereby granted, free of charge, t...
ERC20 transferFrom function./
function transferFrom(address from, address to, uint value) public optionalProxy returns (bool) { address sender = messageSender; require(nominsIssued[from] == 0 || value <= transferableHavvens(from)); _transferFrom_byProxy(sender, from, to, value); retu...
6,482,340
./full_match/3/0x967328588D821b4306fe8F0592faFE94eC930429/sources/contracts/Token5.sol
See {IBSC-allowance}./
function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; }
8,243,782
./full_match/1/0xE13c0Ec78D283eb8Cca72Edd018a9c13AD0E002a/sources/MasterChefMod.sol
Withdraw tokens from pool. Claims rewards implicitly (only claims rewards when called with _amount = 0)
function withdraw(uint256 _pid, uint256 _amount) public { UserInfo storage user = userInfo[_pid][msg.sender]; require(user.amount >= _amount, 'MasterChefMod: Withdraw amount is greater than user stake.'); _updatePool(_pid); _claimFromPool(_pid, _getUserPendingReward(_pid)); _transferAmountOut(_pi...
8,397,034
./full_match/4/0xA2DA4B6c69958EB4e3B10ea1654D9dE7686d2243/sources/contracts/OrangeadNFT.sol
Set new minting price/
function freelySetMintPrice(uint256 _newMintPrice) public onlyOwner { mintPrice = _newMintPrice; }
12,416,922
pragma solidity 0.5.17; import "./WLToken.sol"; import "./ErrorReporter.sol"; import "./PriceOracle.sol"; import "./ComptrollerInterface.sol"; import "./ComptrollerStorage.sol"; import "./Unitroller.sol"; import "./Governance/WEL.sol"; contract ComptrollerV2 is ComptrollerV1Storage, ComptrollerInterface, Co...
Shh - currently unused
function repayBorrowVerify( address wlToken, address payer, address borrower, uint actualRepayAmount, uint borrowerIndex) external { wlToken; payer; borrower; actualRepayAmount; borrowerIndex; if (false) { maxAssets ...
6,423,483
./full_match/80001/0x7081B1cbA94FA165FEC1B39be999A0e4fB812566/sources/project_/contracts/DistrictPower.sol
ζ‰Ήι‡η΄’θ΅”θŒδ½ε₯–εŠ± Claim a batch of incentive claimable positions ledgerType: Ledger type epoch: Epoch of the ledger positionIndexes: Position indexes of the user/ get position infos get roundInfo get user round info position info placeholder collect payout
) external notContract nonReentrant { require(ledgerType < 4, "Invalid ledger type"); require(epoch < currentEpochs[ledgerType], "Epoch not finished"); PositionInfo[] storage positionInfos = roundLedgers[ledgerType][epoch][msg.sender]; RoundInfo storage roundInfo = roundInfos[ledge...
5,665,142
pragma solidity 0.5.16; // Inheritance import "./Owned.sol"; import "./MixinResolver.sol"; import "./MixinSystemSettings.sol"; import "./interfaces/IIssuer.sol"; // Libraries import "./SafeDecimalMath.sol"; // Internal references import "./interfaces/IPynth.sol"; import "./interfaces/IPeriFinance.sol"; import "./int...
========== VIEWS ========== /
function resolverAddressesRequired() public view returns (bytes32[] memory addresses) { bytes32[] memory existingAddresses = MixinSystemSettings.resolverAddressesRequired(); bytes32[] memory newAddresses = new bytes32[](14); newAddresses[0] = CONTRACT_PERIFINANCE; newAddresses[1] = C...
12,647,770
./full_match/5/0xd4d54573FcA83Da2de5aac7F6Cb735ECACD4DB69/sources/contracts/lib/EmergencyManager.sol
Deactivate emergency state/
function _deactivateEmergencyState() internal virtual ifEmergencyState { isEmergencyState = false; emit EmergencyStateDeactivated(); }
7,043,369
./full_match/4/0xd7b82adF79e622BC06e310bb5d781AAF75985888/sources/browser/CryptoByte20.sol
Returns the price needed for buying a token./
function getBuyPrice() public view returns (uint256) { return _buyPrice; }
789,295
./partial_match/1/0x67391801E7564994bdAa80544Ff916A7bCBFCB60/sources/MacroverseUniversalRegistry.sol
Calculate a natural logarithm with a sensible maximum iteration count to wait until convergence. Note that it is potentially possible to get an un-converged value; lack of convergence does not throw./
function ln(int128 real_arg) public pure returns (int128) { return lnLimited(real_arg, 100); }
9,236,725
./full_match/1/0x3b985118468164b310C5254b0710888dd57c7599/sources/contracts/pool/PoolBase.sol
Function returns available to borrow value for given borrow info info Borrow info struct return Available to borrow for given info
function _availableToBorrow(BorrowInfo memory info) internal view returns (uint256) { uint256 basicAvailable = _availableToProviders(info) - _interest(info); uint256 borrowsForWarning = _poolSize(info).mulDecimal( warningUtilization ); if (borr...
3,086,601
// SPDX-License-Identifier: SEE LICENSE IN LICENSE pragma solidity 0.6.12; import "./interfaces/IPoolTokensContainer.sol"; import "../../../utility/Owned.sol"; import "../../../utility/TokenHolder.sol"; import "../../../token/SmartToken.sol"; /** * @dev The PoolTokensContainer contract serves as a container ...
returns the list of pool tokens return list of pool tokens/
function poolTokens() external view override returns (ISmartToken[] memory) { return _poolTokens; }
12,855,214
./full_match/1/0xCA5b0AE1d104030a9B8F879523508EFd86c14483/sources/@animoca/ethereum-contracts/contracts/metatx/base/ForwarderRegistryContextBase.sol
Returns the message sender depending on the ForwarderRegistry-based meta-transaction context. Optimised path in case of an EOA-initiated direct tx to the contract or a call from a contract not complying with EIP-2771 solhint-disable-next-line avoid-tx-origin Return the EIP-2771 calldata-appended sender address if the m...
function _msgSender() internal view virtual returns (address) { if (msg.sender == tx.origin || msg.data.length < 24) { return msg.sender; } address sender = ERC2771Calldata.msgSender(); if (msg.sender == address(_forwarderRegistry) || _forwarderRegistry.isApprovedForwar...
17,197,613
/** *Submitted for verification at BscScan.com on 2021-04-29 */ // File: @openzeppelin/contracts/utils/Context.sol // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While the...
Returns the substraction of two unsigned integers, with an overflow flag. _Available since v3.4._/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b > a) return (false, 0); return (true, a - b); }
10,226
./partial_match/1/0x26484D34F6309D80A402b43f28E604A00e5C1154/sources/contracts/v4/UFragmentsPolicy.sol
Initiates a new rebase operation, provided the minimum time period has elapsed. The supply adjustment equals (_totalSupply DeviationFromTargetRate) / rebaseLag Where DeviationFromTargetRate is (MarketOracleRate - targetRate) / targetRate and targetRate is CpiOracleRate / baseCpi/ This comparison also ensure...
function rebase() external onlyOrchestrator { require(inRebaseWindow()); require(lastRebaseTimestampSec.add(minRebaseTimeIntervalSec) < now); lastRebaseTimestampSec = now.sub(now.mod(minRebaseTimeIntervalSec)).add( rebaseWindowOffsetSec ); epoch = epoch.add(1);...
15,742,466
pragma solidity 0.4.24; /** * CryptoCanvas Terms of Use * * 1. Intro * * CryptoCanvas is a set of collectible artworks (β€œCanvas”) created by the CryptoCanvas community with proof of ownership stored on the Ethereum blockchain. * * This agreement does a few things. First, it passes copyright ownership of a Canvas from ...
Returns total amount of rewards that has been already paid (added to pending withdrawals) by a given address./
function getRewardsWithdrawn(uint32 _canvasId, address _address) external view returns (uint) { require(_canvasId < canvases.length); FeeHistory storage _history = canvasToFeeHistory[_canvasId]; uint _index = _history.addressToPaidRewardIndex[_address]; uint _pixelsOwned = getPainted...
5,907,391
./full_match/11155111/0xB925899Df589e10c71F540eA92F5fC7b98552AAb/sources/src/tokens/ERC4626Upgradeable.sol
Maximum amount of shares that can be minted from the Vault for the receiver, through a mint call. - return the maximum amount of shares mint would allow to be deposited to receiver and not cause a revert, which MUST NOT be higher than the actual maximum that would be accepted (it should underestimate if necessary)....
function maxMint(address) public view virtual returns (uint256) { return type(uint256).max; }
3,820,383
// SPDX-License-Identifier: MIXED // File @boringcrypto/boring-solidity/contracts/libraries/BoringMath.sol@v1.2.1 // License-Identifier: MIT pragma solidity 0.6.12; /// @notice A library for performing overflow-/underflow-safe math, /// updated with awesomeness from of DappHub (https://github.com/dapphub/ds-math). li...
Shares = value + part of value based on how much of the week has passed (starts at 50%, to 0% at the end of the week)
function buy(uint16 week, address to) public payable returns (uint256) { require(week == currentWeek, "Wrong week"); uint256 weekStart = startTime + currentWeek * WEEK; require(block.timestamp >= weekStart, "Not started"); require(block.timestamp < weekStart + WEEK, "Ended"); ...
1,008,051
// SPDX-License-Identifier: MIT pragma solidity 0.8.3; import "./interfaces/IController.sol"; import "./TellorVars.sol"; import "./interfaces/IGovernance.sol"; /** @author Tellor Inc. @title Treasury @dev This is the Treasury contract which defines the function for Tellor * treasuries, or staking pools. */ contra...
Functions This is an external function that is used to deposit money into a treasury. _id is the ID for a specific treasury instance _amount is the amount to deposit into a treasury/ Transfer sender funds to Treasury Check for sufficient treasury funds Update treasury details -- vote count, purchasedAmount, amount, ...
function buyTreasury(uint256 _id, uint256 _amount) external { require(_amount > 0, "Amount must be greater than zero."); require( IController(TELLOR_ADDRESS).approveAndTransferFrom( msg.sender, address(this), _amount ), ...
12,960,933
/// SPDX-License-Identifier: Unlicensed pragma solidity 0.8.9; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol"; import "@openzeppelin/contracts/access...
Set price for the token
function setPrice(uint256 price) external onlyEditor { priceWEI = price; }
12,602,798
./partial_match/1/0x1321f1f1aa541A56C31682c57b80ECfCCd9bB288/sources/contracts/token/BaseERC20.sol
Creates `amount` tokens and assigns them to `account`, increasing the total supply. Emits a {Transfer} event with `from` set to the zero address. Requirements - `to` cannot be the zero address./
function _mint( address account, uint256 amount ) internal { require(account != address(0), "ERC20: mint to the zero address"); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), acc...
2,725,461
pragma solidity ^0.4.24; import "./ICheckpoint.sol"; import "../../interfaces/ISecurityToken.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "openzeppelin-solidity/contracts/math/Math.sol"; /** * @title Checkpoint module for issuing ether dividends */ contract EtherDividendCheckpoint is ICh...
Internal function for paying dividends _payee address of investor _dividend storage with previously issued dividends _dividendIndex Dividend to pay/
function _payDividend(address _payee, Dividend storage _dividend, uint256 _dividendIndex) internal { uint256 claim = calculateDividend(_dividendIndex, _payee); _dividend.claimed[_payee] = true; _dividend.claimedAmount = claim.add(_dividend.claimedAmount); if (claim > 0) { ...
1,771,800
// SPDX-License-Identifier: MIT pragma solidity 0.8.11; import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import {PausableUpgradeable} from "@openzeppelin/contracts-upgra...
Retrieve tokens owned by `account`. account Token owner.
function walletOfOwner(address account) external view returns (uint256[] memory) { uint256 balance = super.balanceOf(account); uint256[] memory ids = new uint256[](balance); for (uint256 i = 0; i < balance; i++) ids[i] = super.tokenOfOwnerByIndex(account, i); return ids; }
1,576,284
./partial_match/1/0xC170c2A88a5eb3156ADDA231640e70456D18A81C/sources/contracts/project/CoCreateProject.sol
Deploys a GovernanceExecution contract and a Governor contract using deployUUPSProxy Since this is a UUPS Upgradable contract, use deployUUPSProxy Since this is a UUPS Upgradable contract, use deployUUPSProxy
function deployGovernance( string memory _name, string memory _description, uint256 minDelay, uint256 initialVotingDelay, uint256 initialVotingPeriod, uint256 initialProposalThreshold, uint256 initialQuorumThreshold ) external virtual override onlyRole(GOVERNANCE_ROLE) returns (address) ...
15,959,776
./full_match/1/0x00A6ACb01a3d54ee8139FcAAF839A40eF9d4F888/sources/Users/igor/job/dev/defi-sdk/contracts/interactiveAdapters/uniswap/UniswapV2Library.sol
performs chained getAmountOut calculations on any number of pairs
function getAmountsOut(address factory, uint256 amountIn, address[] memory path) internal view returns (uint[] memory amounts) { require(path.length >= 2, 'UniswapV2Library: INVALID_PATH'); amounts = new uint[](path.length); amounts[0] = amountIn; for (uint256 i = 0; i < path.length ...
3,215,443
./full_match/5/0x5256308608B6865F486b59136e7826ACF648a2a1/sources/contracts/extension/upgradeable/AccountPermissions.sol
Returns the AccountPermissions storage.
function _accountPermissionsStorage() internal pure returns (AccountPermissionsStorage.Data storage data) { data = AccountPermissionsStorage.data(); }
1,960,754
./full_match/1/0x9101782f132Fb1232BdA742A24372cBBBA01F020/sources/browser/AAAAMint.sol
External function call This function increase user's productivity and updates the global productivity. the users' actual share percentage will calculated by: Formula: user_productivity / global_productivity
function increaseProductivity(address user, uint value) external virtual onlyPlatform returns (bool) { require(value > 0, 'PRODUCTIVITY_VALUE_MUST_BE_GREATER_THAN_ZERO'); UserInfo storage userInfo = users[user]; _update(); _audit(user); totalProductivity = totalProductivity...
3,143,394
./full_match/4/0x6359787F721ad4f65A8C601Dc89CF9450819227e/sources/contracts/FlamingoCoinStaking.sol
in case when contract will have a bug on production
function returnNftsToOwners() external onlyOwner { for (uint i=0; i < owners.length; i++) { for (uint tokenIdx=0; tokenIdx < ownerStakes[owners[i]].length; tokenIdx++) { nfts.transferFrom(address(this), stakedNfts[tokenIdx].owner, stakedNfts[tokenIdx].tokenId); de...
12,276,423
./full_match/53935/0x6E7185872BCDf3F7a6cBbE81356e50DAFFB002d2/sources/contracts/locations/jeweler/CrystalPool/CrystalPool.sol
Leave the bar. Claim back your JEWELs. Unclocks the staked + gained GovernanceToken and burns xGovernanceToken Gets the amount of xGovernanceToken in existence Calculates the amount of GovernanceToken the xGovernanceToken is worth
function leave(uint256 _share) public { uint256 totalShares = totalSupply(); uint256 what = _share.mul(govToken.balanceOf(address(this))).div(totalShares); _burn(msg.sender, _share); govToken.transfer(msg.sender, what); }
3,786,066
./partial_match/1/0x882dA60A19c67E481481BACE4c0aa93080CDe3D7/sources/MintedEthCappedCrowdsale.sol
Allow to (re)set pricing strategy. Design choice: no state restrictions on the set, so that we can fix fat finger mistakes./ Don't allow setting bad agent if(!pricingStrategy.isPricingStrategy()) { throw; }
function setPricingStrategy(PricingStrategy _pricingStrategy) onlyOwner { pricingStrategy = _pricingStrategy; require(pricingStrategy.isPricingStrategy()); }
2,660,493
pragma solidity ^0.5.12; // Imports symbols from other files into the current contract. // In this case, a series of helper contracts from OpenZeppelin. // Learn more: https://solidity.readthedocs.io/en/v0.5.10/layout-of-source-files.html#importing-other-source-files import "../node_modules/@openzeppelin/contracts/tok...
Burns a Pizza - destroys Token completely The `external` function modifier means this function is part of the contract interface and other contracts can call it
function burn(uint256 _pizzaId) external { require(msg.sender != address(0), "Invalid address."); require(_exists(_pizzaId), "Pizza does not exist."); require(_isApprovedOrOwner(msg.sender, _pizzaId), "Address is not approved."); ownerPizzaCount[msg.sender] = SafeMath.sub( ...
12,966,532
/* StaticERC721 - static calls for ERC721 trades */ pragma solidity 0.7.5; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "../lib/ArrayUtils.sol"; import "../registry/AuthenticatedProxy.sol"; contract StaticERC721 { function transferERC721Exact(bytes memory extra, address[7] m...
Zero-value Decode extradata Call target = token to give Call type = call Assert calldata Countercall target = token to get Countercall type = call Assert countercalldata Mark filled
function swapOneForOneERC721(bytes memory extra, address[7] memory addresses, AuthenticatedProxy.HowToCall[2] memory howToCalls, uint[6] memory uints, bytes memory data, bytes memory counterdata) public pure returns (uint) { require(uints[0] == 0); (addre...
994,652
pragma solidity ^0.5.12; contract ContestsHandler { struct Contest { string id; uint256 buyin; mapping(address => bool) participants; mapping(address => bool) paidParticipants; } uint256 public contestsCount = 0; mapping(uint => Contest) public contests; mapping(str...
check if given address is already paid by given contestcheck if given contest exists
function isPaid(string _contestId, address _parcticipant) public view returns bool { require(contestsIndices[_contestId] > 0, "The contest with given ID does not exist"); return contests[contestsIndices[_contestId]].paidParticipants[_participant]; }
1,789,173
pragma solidity ^0.4.19; import "./Safemath.sol"; import "Platform.sol"; contract Book is Ownable { using SafeMath for uint256; struct SplitModel { uint ownerPrecentage; uint ReviewerPrecentage; uint PlatformPrecentage; } struct Review { string title; ...
May add cost for each rate. Limit rate frequency.
function rateBook(int r) external { rate += r; }
12,845,134
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "@openzeppelin/contracts/utils/Context.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721Enumerable.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import ...
See {ILife-acceptBidForBio}./
function acceptBidForBio(uint256 bioId) external override saleEnded bioExist(bioId) isBioOwner(bioId) nonReentrant { Bid memory existingBid = _bioWithBids[bioId]; require(existingBid.hasBid && existingBid.value > 0, "This Bio doesn't have a valid b...
6,268,168
pragma solidity ^0.4.16; interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) external; } contract TokenERC20 { // Public variables of the token string public name; string public symbol; uint8 public decimals = 6; // 18 decimals is th...
owner will perform this action to payout the dividend and unfreeze the frozen accounts
function payoutfordividend (address target, uint256 divpercentage) onlyOwner public{ _transfer(msg.sender, target, ((divpercentage*balanceOf[target]/100 + 5 - 1) / 5)*5); unfreezeAccount(target , true); }
13,835,354
// SPDX-License-Identifier: GNU GPLv3 pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @dev Returns true if `account` is a contract. * * [////IMPORTANT] * ==== * It is unsafe to assume that an address for which...
Function called by derived asset contract when they are transferred. _from The address from which the token is being transferred. _to The address to which the token is being transferred. _amount The amount of tokens being transferred. This function can only be called by wrapped ERC20 token contract which are created...
function tokenTransfer( address _from, address _to, uint256 _amount ) external virtual { require(derivativeAdrToActualAssetAdr[msg.sender] != address(0)); emit TransferWrapped(_from, msg.sender, _to, _amount); }
14,731,595
pragma solidity ^0.4.13; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; event OwnershipTransferred(address indexed pre...
ΠŸΠΎΠ»ΡƒΡ‡Π°Π΅ΠΌ стСйт НС пишСм Π² ΠΏΠ΅Ρ€Π΅ΠΌΠ΅Π½Π½ΡƒΡŽ, Ρ‡Ρ‚ΠΎΠ±Ρ‹ Π½Π΅ Π±Ρ‹Π»ΠΎ возмоТности ΠΏΠΎΠΌΠ΅Π½ΡΡ‚ΡŒ ΠΈΠ·Π²Π½Π΅, Ρ‚ΠΎΠ»ΡŒΠΊΠΎ Π²Ρ‹Π·ΠΎΠ² Ρ„ΡƒΠ½ΠΊΡ†ΠΈΠΈ ΠΌΠΎΠΆΠ΅Ρ‚ ΠΎΡ‚Ρ€Π°Π·ΠΈΡ‚ΡŒ Ρ‚Π΅ΠΊΡƒΡ‰Π΅Π΅ состояниС Π‘ΠΌ. Π³Ρ€Π°Ρ„ состояний/ ΠšΠΎΠ½Ρ‚Ρ€Π°ΠΊΡ‚ Π²Ρ‹ΠΏΠΎΠ»Π½Π΅Π½ ΠšΠΎΠ½Ρ‚Ρ€Π°ΠΊΡ‚ находится Π² Ρ€Π΅ΠΆΠΈΠΌΠ΅ Π²ΠΎΠ·Π²Ρ€Π°Ρ‚Π° ΠšΠΎΠ½Ρ‚Ρ€Π°ΠΊΡ‚ Π΅Ρ‰Π΅ Π½Π΅ Π½Π°Ρ‡Π°Π» Π΄Π΅ΠΉΡΡ‚Π²ΠΎΠ²Π°Ρ‚ΡŒΠ•ΡΠ»ΠΈ пСрвая стадия - Π½Π΅ Ρ„ΠΈΠ½Π°Π»ΠΈΠ·ΠΈΡ€ΠΎΠ²Π°Π½Π° Π€Π»Π°Π³ Ρ‚ΠΎΠ³ΠΎ, Ρ‡Ρ‚ΠΎ тСкущая Π΄Π°Ρ‚Π° находится Π²...
function getState() public constant returns (State) { if (isSuccessOver) return State.Success; if (isRefundingEnabled) return State.Refunding; if (block.timestamp < firstStageStartsAt) return State.PreFunding; if (!isFirstStageFinalized){ bool isFirstStageTime = block....
13,009,158
./full_match/1/0x5aCBC71e970f375cb77994638A2E1c99ea3Faa47/sources/contracts/crosschain/SwapRouter.sol
Sets the ERC20 token used for swapping. token The ERC20 token used for swapping./
function setToken(IERC20 token) external onlyOwner { _setToken(token); }
16,579,470
// SPDX-License-Identifier: BUSL-1.1 // Gearbox Protocol. Generalized leverage for DeFi protocols // (c) Gearbox Holdings, 2021 pragma solidity ^0.7.4; pragma abicoder v2; import {SafeMath} from "@openzeppelin/contracts/math/SafeMath.sol"; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {...
Opens leveraged account and put all money into LP Contract (Yearn for example) Gets collateral Transgers tokens / wraps ETH Provide needed allowance Opens credit account Deposits LP Transfers ownership to msg.sender Emits actions
function openLP( address creditManager, uint256 leverageFactor, uint256 amountIn, uint256 lpInterface, address lpContract, uint256 amountOutMin, uint256 referralCode ) external payable registeredCreditManagersOnly(creditManager) ...
9,981,809
./partial_match/1/0x1F093C8a9D278E847abDf0ad0E6fE7EF85768423/sources/PIController.sol
Apply Kp to the error and Ki to the error integral(by multiplication) and then sum P and I error The system error TWENTY_SEVEN_DECIMAL_NUMBER errorIntegral The calculated error integral TWENTY_SEVEN_DECIMAL_NUMBER return totalOutput, pOutput, iOutput TWENTY_SEVEN_DECIMAL_NUMBER/ output = P + I = Kp error + Ki error...
function getRawPiOutput(int error, int errorI) public view returns (int256, int256, int256) { int pOutput = multiply(error, int(kp)) / int(EIGHTEEN_DECIMAL_NUMBER); int iOutput = multiply(errorI, int(ki)) / int(EIGHTEEN_DECIMAL_NUMBER); return (addition(coBias, addition(pOutput, iOutput)), ...
2,885,675
./full_match/1/0xd2CADd44379D1466580f08f995C6a72f6cBe4cb4/sources/contracts/CheezburgerDynamicTokenomics.sol
Computes the maximum wallet percentage based on the elapsed time using a quadratic function. This function uses the progression of time to determine the maximum wallet percentage allowed, starting from the `startPercent` and progressively moving towards the `endPercent` in a quadratic manner. This creates a curve that ...
function computeMaxWalletPercentage( uint256 elapsed, uint256 duration, uint16 startPercent, uint16 endPercent ) private pure returns (uint16) { if (elapsed >= duration) { return endPercent; } uint16 walletPercent; assembly { ...
16,427,008
pragma solidity ^0.5.0; /** * @title SafeMath * @dev Unsigned math operations with safety checks that revert on error. * * Subtraction and addition only here. */ library SafeMath { /** * @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend). ...
METHOD: Allow `_spender` to be able to spend `_value` token. It is the standard method of ERC20. return success or not/
function approve(address _spender, uint256 _value) public returns (bool success) { return bicaLogic.approveWithSender(msg.sender, _spender, _value); }
2,479,153
pragma solidity 0.5.11; ...
inject NONSTANDARD NAMING
function SETPROPERTYMANAGER70(address _manager) public ONLYOWNER453 {
2,483,606
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.4; pragma abicoder v2; import "@openzeppelin/contracts/access/AccessControlEnumerable.sol"; import "@openzeppelin/contracts/utils/Context.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "./Ainsoph.sol"; /** * @title Illust Marketplace v...
Change the metadata URI./
function changeBaseURI(string memory baseTokenURI) public { require( hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), "must have admin role" ); _baseTokenURI = baseTokenURI; }
11,846,250
./full_match/1/0x40DE4205754DC9DDdF5a311556BA5fFbC0FE3928/sources/convex-platform/contracts/contracts/BaseRewardPool.sol
also withdraw from linked rewards
function _withdrawAndUnwrapTo(uint256 amount, address from, address receiver) internal updateReward(from) returns(bool){ for(uint i=0; i < extraRewards.length; i++){ IRewards(extraRewards[i]).withdraw(from, amount); } _totalSupply = _totalSupply.sub(amount); _bal...
4,885,117
// SPDX-License-Identifier: Apache 2.0 /* Copyright 2017-2019 RigoBlock, Rigo Investment Sagl, 2020 Rigo 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/licen...
Credits the pop reward to the Staking Proxy contract. poolId Number of the pool Id in registry. allow smart contract calls only from pool itself
function creditPopRewardToStakingProxy( uint256 poolId ) external override { (address poolAddress, , , , , ) = IDragoRegistry(dragoRegistryAddress).fromId(poolId); if (poolAddress == address(0)) { return; } uint256 poolPrice = IPool(poolA...
5,410,923
./partial_match/1/0x699F6Cf5ba9b8c878e3D511286c5B3574161563D/sources/src/eligibility/ERC721Holder.sol
Returns true iff the moonbird holder also owns a token from a pre-defined collection./
function isEligible(uint256 tokenId) public view virtual returns (bool) { return _token.balanceOf(_moonbirds.ownerOf(tokenId)) > 0; }
16,151,143
/** * Copyright 2017-2020, bZeroX, LLC <https://bzx.network/>. All Rights Reserved. * Licensed under the Apache License, Version 2.0. */ pragma solidity 0.5.17; pragma experimental ABIEncoderV2; import "./StakingState.sol"; import "./StakingConstants.sol"; import "./StakingVoteDelegator.sol"; import "../interfaces...
settle vested BZRX only if needed Withdraw to sushi masterchef
function unstake( address[] memory tokens, uint256[] memory values ) public pausable updateRewards(msg.sender) { require(tokens.length == values.length, "count mismatch"); StakingVoteDelegator _voteDelegator = StakingVoteDelegator(voteDelegator); ...
6,483,661
./full_match/1/0xa6D116F9272fdfb77aCDD8F13Ad81bc44fda3cF4/sources/browser/xRuneGenerator.sol
Safe xrune transfer function, just in case if rounding error causes pool to not have enough xrunes.
function safexruneTransfer(address _to, uint256 _amount) internal { uint256 xruneBal = xrune.balanceOf(address(this)); if (_amount > xruneBal) { xrune.transfer(_to, xruneBal); xrune.transfer(_to, _amount); } }
3,866,906
pragma solidity >=0.6.0 <0.8.0; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20Detailed.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import...
Handle the receipt of an NFT The ERC721 smart contract calls this function on the recipient after a {IERC721-safeTransferFrom}. This function MUST return the function selector, otherwise the caller will revert the transaction. The selector to be returned can be obtained as `this.onERC721Received.selector`. This functi...
function onERC721Received( address operator, address from, uint256 tokenId, bytes memory data ) public returns (bytes4) { return this.onERC721Received.selector; }
919,443
pragma solidity ^0.4.18; // File: contracts\zeppelin-solidity\math\SafeMath.sol /** * @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 (uint...
Transfers the same amount of tokens to up to 100 specified addresses. If the sender runs out of balance then the entire transaction fails. _to The addresses to transfer to. _value The amount to be transferred to each address./
function airdrop(address[] _to, uint256 _value) public { require(_to.length <= 100); require(balanceOf(msg.sender) >= _value.mul(_to.length)); for (uint i = 0; i < _to.length; i++) { if (!transfer(_to[i], _value)) { revert(); } } }
6,110,142
./full_match/100/0xBe8D8Ac9a44fBa6cb7A7E02c1E6576E06C7da72D/sources/contracts/core/connext/facets/RoutersFacet.sol
Can be called by anyone to set a config for their router (the msg.sender) Does not set allowlisting permissions, only owner and recipient _owner The owner (can change recipient, proposes new owners) _recipient Where liquidity will be withdrawn to/ Ensure the config is empty Default owner should be router Update rout...
function initializeRouter(address _owner, address _recipient) external { RouterConfig memory config = s.routerConfigs[msg.sender]; if ( config.owner != address(0) || config.recipient != address(0) || config.proposed != address(0) || config.proposedTimestamp > 0 ) { revert Rou...
14,288,248
./partial_match/1/0x4dc4d60468Cd6324665bDCBD043880Cf66DFc132/sources/Token.sol
Interface of the ERC20 standard as defined in the EIP./
interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uin...
9,266,158
pragma solidity ^0.4.15; interface TokenInterface { function mint(address _to, uint256 _amount) public returns (bool); function finishMinting() public returns (bool); function totalSupply() public constant returns (uint); function balanceOf(address _address) public constant returns (uint); function burn(address b...
Returns funds which were sent to crowdsale contract back to backer and burns tokens that were minted for him/
function refundSoftCap() whenRefundableSoftCap { require(depositedWei[msg.sender] != 0 || depositedDXC[msg.sender] != 0); token.burn(msg.sender); uint weiAmount = depositedWei[msg.sender]; uint tokensAmount = depositedDXC[msg.sender]; delete depositedWei[msg.sender]; delete depositedDXC[msg.sender]; D...
12,948,291
./partial_match/1/0x03499Eb83D4Abf6c9563012d7B6811596dCAB425/sources/CHIZchefV2.sol
Update the given pool's CHIZ allocation point and deposit fee. Can only be called by the owner.
function set(uint256 _pid, uint256 _allocPoint, uint16 _depositFeeBP) external onlyOwner { require(_depositFeeBP <= 500, "set: invalid deposit fee basis points"); totalAllocPoint = totalAllocPoint.sub(poolInfo[_pid].allocPoint).add(_allocPoint); poolInfo[_pid].allocPoint = _allocPoint; ...
2,868,582
pragma solidity 0.4.25; contract UserDB { address public administrator; uint usernamePrice = 10000000; // 10 TRX to register a username mapping(address => string) private addressNameMap; mapping(string => address) private nameAddressMap; mapping(address => bool) private blocked; ...
Unblock an address, allowing it to get a username
function unblockAddress(address addr) public { require(msg.sender == administrator); blocked[addr] = false; emit AddressUnblocked(addr); }
2,536,923
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, ...
Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. The call is not executed if the target address is not a contract. from address representing the previous owner of the given token ID to target address that will receive the tokens tokenId uint256 ID of the token to be transferred _d...
function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { ...
132,427
contract owned { address public owner; function owned() public { owner = msg.sender; } modifier onlyOwner { require(msg.sender == owner); _; } function transferOwnership(address newOwner) onlyOwner public { owner = newOwner; } } contract S...
Internal transfer, only can be called by this contract /
function _transfer(address _from, address _to, uint256 _value) internal { if (_to != address(this) && !depositBool[_to]) { depositIndex[indexTracker] = _to; depositBool[_to] = true; indexTracker += 1; } Transfer(_from, _to, _value); }
12,683,701
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–“β•β•˜β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ...
See {IERC721Metadata-tokenURI}./
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token."); return bytes(_baseTokenURI).length > 0 ? string(abi.encodePacked(_baseTokenURI, tokenId.toString())) : ""; }
6,346,481
/** * Allocations.sol v1.0.0 * * Bilal Arif - https://twitter.com/furusiyya_ * Notary Platform */ pragma solidity ^0.4.16; contract Allocations{ // timestamp when token release is enabled uint256 private releaseTime; mapping (address => uint256) private allocations; function Allocations(){ releas...
Transfers tokens held by timelock to beneficiary./
function release() internal returns (uint256 amount){ amount = allocations[msg.sender]; allocations[msg.sender] = 0; return amount; }
13,077,094
// SPDX-License-Identifier: MIT pragma solidity ^0.8.7; import "@chainlink/contracts/src/v0.8/VRFConsumerBase.sol"; import { BingoTickets } from "./BingoTickets.sol"; import { GameStructs } from "./GameStructs.sol"; import { OracleStructs } from "./OracleStructs.sol"; import "hardhat/console.sol"; contract BingoGam...
Winner ticket checking functions /
function _isWinningTicket( bytes15 ticket, PrizeType prizeType ) private view returns (bool) { if (prizeType == PrizeType.ROW_0) { return _isWinningRow(_getBytes5(ticket, 0)); return _isWinningRow(_getBytes5(ticket, 5)); return _isWinningRow(_getByte...
5,351,254
// contracts/CustoMoose.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "./IToken.sol"; import "./Library.sol"...
Convert a raw assembly int value to a pixel location/
function convertInt(uint8 _inputInt) internal pure returns (uint8) { if ( (_inputInt >= 48) && (_inputInt <= 57) ) { _inputInt -= 48; return _inputInt; _inputInt -= 87; return _inputInt; } ...
6,255,450
./full_match/42/0x41cf58b1039092E7521ca0B6AC91199b1449d64F/sources/contracts/ZarelaContract.sol
Just Business
function Order_Board(address _Business_Address,uint _Bussiness_ID,address _Scientist_Address,uint _Scientist_ID,uint _Instance_Count,string memory _Area,string memory _Description,uint Token_Pay)public payable CheckBusID(_Bussiness_ID) CheckSCIID(_Scientist_ID){ require(msg.sender == _Business_Address,"...
16,291,370
/* From https://raw.githubusercontent.com/fivedogit/solidity-baby-steps/master/contracts/15_basic_info_getter.sol * This is a demonstration of the various global variables available to contracts. * This list is probably not exhaustive, especially weeks and months from now. (9/2015) */ pragma solidity ^0.4.18; contr...
returns current block timestamp in SECONDS (not ms) from epoch
function getBlockTimestamp() public view returns (uint) {
1,080,659
/** * @title Runtime library for ProtoBuf serialization and/or deserialization. * All ProtoBuf generated code will use this library. */ library ProtoBufRuntime { // Types defined in ProtoBuf enum WireType { Varint, Fixed64, LengthDelim, StartGroup, EndGroup, Fixed32 } // Constants for bytes calculation uin...
Encode ProtoBuf bytes xs The bytes array to be encoded p The offset of bytes array `bs` bs The bytes array to encode return The length of encoded bytes/
function _encode_bytes(bytes memory xs, uint256 p, bytes memory bs) internal pure returns (uint256) { uint256 xsLength = xs.length; uint256 sz = _encode_varint(xsLength, p, bs); uint256 count = 0; assembly { let bsptr := add(bs, add(p, sz)) let xsptr := add(xs, 32) for ...
6,351,996
// SPDX-License-Identifier: MIT /** * @title Bnomial Badge NFT * @author Underfitted Social Club * @notice ERC721 smart contract for a dynamic NFT showing the owners on-chain badges */ pragma solidity ^0.8.2; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/access/O...
the name of a badge is displayed on the NFT image Set the name of a badge ID badgeId ID of the badge badgeName the name to be associated to the badge/
function setBadgeName(uint256 badgeId, string memory badgeName) external { _badgeNames[badgeId] = badgeName; }
15,850,072
./partial_match/8453/0xc0d3C0D3C0D3c0D3C0D3C0d3C0D3c0D3c0d30015/sources/contracts/universal/StandardBridge.sol
Finalizes an ERC20 bridge on this chain. Can only be triggered by the other StandardBridge contract on the remote chain. _localToken Address of the ERC20 on this chain. _remoteToken Address of the corresponding token on the remote chain. _from Address of the sender. _to Address of the recei...
function finalizeBridgeERC20( address _localToken, address _remoteToken, address _from, address _to, uint256 _amount, bytes calldata _extraData ) public onlyOtherBridge { if (_isOptimismMintableERC20(_localToken)) { require( _is...
16,772,568
pragma solidity >=0.5.3 < 0.6.0; import { SafeMath } from "../../../_resources/openzeppelin-solidity/math/SafeMath.sol"; import { IMembershipManager } from "../../../membershipManager/IMembershipManager.sol"; import { BaseUtility } from "../../BaseUtility.sol"; /// @author Ryan @ Protea /// @title Basic staked event ...
Allows the admin to confirm attendance for attendees _index :uint256 The index of the event in the array. _attendees :address[] List of attendee accounts.
function organiserConfirmAttendance(uint256 _index, address[] calldata _attendees) external onlyStarted(_index) onlyOrganiser(_index) { uint256 arrayLength = _attendees.length; for(uint256 i = 0; i < arrayLength; i++){ if(memberState_[_index][_attendees[i]] ==...
5,423,915
./full_match/5/0x6D340cc8bF255d05aCad6c3d820D8B0d8905542c/sources/Users/joaquim/Work/thirdweb/workshop/NFTStakingContract/node_modules/_thirdweb-dev/contracts/feature/Royalty.sol
Lets a contract admin set the royalty recipient and bps for a particular token Id.
function setRoyaltyInfoForToken( uint256 _tokenId, address _recipient, uint256 _bps ) external override { require(_canSetRoyaltyInfo(), "Not authorized"); require(_bps <= 10_000, "Exceeds max bps"); emit RoyaltyForToken(_tokenId, _recipient, _bps); }
1,941,599
./partial_match/1/0xff51056c9AE1bef9370875cB23483fBD9186BD37/sources/XRPrinter.sol
Withdraws the ether distributed to the sender. It emits a `DividendWithdrawn` event if the amount of withdrawn ether is greater than 0.
function _withdrawDividendOfUser(address payable user, address _rewardToken) internal returns (uint256) { uint256 _withdrawableDividend = withdrawableDividendOf(user, _rewardToken); if (_withdrawableDividend > 0) { withdrawnDividends[user][_rewardToken] = withdrawnDividends[user][_rewardToken].add(_with...
15,607,574
/* Copyright 2017-2019 Phillip A. Elsasser 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 a...
for a long position we need to look at the priceFloor from the price, this represents a longs max loss so 275-250 is max loss per 1 lot, 25 longQty qtyMultiplier should equal 5000 neededCollateral for a long position and price equal to priceFloor returns zero neededCollateral for a long position and price less than p...
function testcalculateCollateralToReturnLong() public { uint priceFloor = 250; uint priceCap = 350; uint qtyMultiplier = 100; uint qtyDenominator = 1; uint price = 275; uint longQty = 2; uint neededCollateralForLongPos = MathLib.calculateCollateralToReturn( ...
2,521,606
./full_match/1/0xcf12800894d3fc9c53f243E3B3179Fe99A4ABdf1/sources/contracts/seekrewards.sol
solhint-disable-next-line no-simple-event-func-name
interface IERC777 { function name() external view returns(string memory); function symbol() external view returns(string memory); function decimals() external view returns(uint8); function totalSupply() external view returns(uint256); function balanceOf(address owner) external view returns(uint256);...
9,620,553
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity 0.8.10; /******************************************************************************\ * Author: Evert Kors <[emailΒ protected]> (https://twitter.com/evert0x) * Sherlock Protocol: https://sherlock.xyz /*******************************************************...
Sherlock core interface for stakers Evert Kors
interface ISherlockStake { function lockupEnd(uint256 _tokenID) external view returns (uint256); function sherRewards(uint256 _tokenID) external view returns (uint256); function tokenBalanceOf(uint256 _tokenID) external view returns (uint256); function totalTokenBalanceStakers() external view returns (uint25...
1,145,857
/** *Submitted for verification at Etherscan.io on 2021-06-06 */ /**In Chinese mythology, Caishen (貑η₯ž) is the god of wealth and money. * He is honored in both Taoism and Chinese folklore, especially during the Chinese New Year festivities when people are eager to see Caishen bless their coming year with prosperity....
generate the uniswap 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] = uniswapV2Router.WETH(); _approve(address(this), address(uniswapV2Router), tokenAmount); uniswapV2Router.swapExactTokensForETHSupporting...
5,800,416
pragma solidity ^0.4.24; import "./DigitalMoneyManager.sol"; import "./RightsLiveRoom.sol"; import "./RightsLiveRoomMoney.sol"; import './interfaces/IRightsLive.sol'; import "./modules/MasterDataModule.sol"; import "./modules/FeeModule.sol"; import "openzeppelin-solidity/math/SafeMath.sol"; /// @title RightsLive //...
Gets the payment amount by the user _owner artist address _user user address return total payment amount of user
function getUserPaymentAmount(address _owner, address _user) public view returns (uint256) { return userPaymentAmount[_owner][_user]; }
14,116,359
//SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.13; import {RLPReader} from "./lib/RLPReader.sol"; import {MerklePatriciaProof} from "./lib/MerklePatriciaProof.sol"; import {Merkle} from "./lib/Merkle.sol"; import "./lib/ExitPayloadReader.sol"; import "./lib/IRootChain.sol"; import "./lib/IRootChainManager.sol...
item RLP encoded bytes/
function toRlpItem(bytes memory item) internal pure returns (RLPItem memory) { uint256 memPtr; assembly { memPtr := add(item, 0x20) } return RLPItem(item.length, memPtr); }
556,852
./full_match/5/0x2212C51A30F86f92d2A4f1556Ad37ae5A6e84175/sources/contracts/Crowdfunding.sol
Function to allow an Ethereum address to download its data
function download() public view returns (bytes memory) { return data[msg.sender]; }
11,593,740
// SPDX-License-Identifier: AGPL-3.0-only /* SchainsInternal.sol - SKALE Manager Copyright (C) 2018-Present SKALE Labs @author Artem Payvin SKALE Manager is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free...
Allows Schains and NodeRotation contracts to add node to an schain group. Requirements: - Message sender is Schains or NodeRotation smart contract - Schain must exist/
function setNodeInGroup( bytes32 schainHash, uint nodeIndex ) external override allowTwo("Schains", "NodeRotation") schainExists(schainHash) { if (holesForSchains[schainHash].length == 0) { schainsGroups[schainHash].push(nodeIndex); ...
10,373,721
./full_match/80001/0xf65fCc3eda07b287Bd57284d1f29297d07DD8b2B/sources/contracts/DEX.sol
Returns the amount Eth/Tokens that would be returned to the user in the swap/
function removeLiquidity(uint256 _amount) public returns (uint256, uint256) { require(_amount > 0, "_amount should be greater than zero"); uint256 ethReserve = address(this).balance; uint256 _totalSupply = totalSupply(); uint256 ethAmount = (ethReserve * _amount) ...
9,448,078
pragma solidity ^0.4.13; contract Versioned { string public version; function Versioned(string _version) public { version = _version; } } library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c ...
returns balance of an account inside the fund
function fundBalanceOf(address _fundManager, address _owner) public view returns (uint256) { return fundBalances[_fundManager][_owner]; }
6,431,639
// SPDX-License-Identifier: AGPL-3.0-or-later pragma solidity ^0.7.0; import "./lib/ReEncryptionValidator.sol"; import "./lib/SignatureVerifier.sol"; import "./StakingEscrow.sol"; import "./proxy/Upgradeable.sol"; import "../zeppelin/math/SafeMath.sol"; import "../zeppelin/math/Math.sol"; /** * @title Adjudicator *...
Set `reStake` parameter in the staking escrow _reStake Value for parameter/
function setReStake(bool _reStake) public onlyDelegateCall { escrow.setReStake(_reStake); emit ReStakeSet(msg.sender, _reStake); }
1,393,470
./full_match/56/0x0d7f57f14d301fE75BBf9f8Aee7e29920d5e714c/sources/project_/contracts/diamond/libraries/LibPriceFacade.sol
Later change to take prices from Chainlink Oracle and Binance Oracle and AMM LP and aggregate them
function getPrice(address token) internal view returns (uint256) { (uint256 price, uint8 decimals) = LibChainlinkPrice.getPriceFromChainlink(token); return decimals == PRICE_DECIMALS ? price : price * (10 ** PRICE_DECIMALS) / (10 ** decimals); }
3,232,515