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/0x3B557Ff99BC6c2AA2A4BEB7478EA4b4dC58C8Ed2/sources/hijabcoin.sol
Return the log in base 2, following the selected rounding direction, of a positive value. Returns 0 if given 0./
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } }
4,342,950
./full_match/1/0x22F9e22F125A92352cCA457Dc0DDd4c5Dd6dFa90/sources/contracts/ERACMiner.sol
Give any valid ERAC's token id return level(1-9)/
function _getLevel(uint256 id) private pure isValidTokenId(id) returns (uint256) { return id > 6000 ? 1 : (id > 4000 ? 2 : (id > 3000 ? 3 : (id > 2000 ? 4 : (id > 1000 ? 5 : (id > 300 ? 6 : (id > 100 ? 7 : (id > 10 ? 8 : 9))))))); }
9,821,191
./partial_match/1/0x9b5D1e314a8c8AF17150fe4e327e8523ee15d25f/sources/contracts/mixins/OZ/ERC165Checker.sol
Returns true if `account` supports the {IERC165} interface,/ Any contract that implements ERC165 must explicitly indicate support of InterfaceId_ERC165 and explicitly indicate non-support of InterfaceId_Invalid
function supportsERC165(address account) internal view returns (bool) { return supportsERC165Interface(account, type(IERC165).interfaceId) && !supportsERC165Interface(account, _INTERFACE_ID_INVALID); }
4,363,860
./full_match/1/0xe5b9239A8be521C9A08ba9A4b925DFa86Ee19024/sources/contracts/CopyPasta.sol
Underlying transfer functions go here Do taxes Only sell tokens on a sell, as we can't interfere on a buy Swap a max of totalTokens/taxSwapDivisor, or the current balance
function _tokenTransfer( address sender, address recipient, uint256 amount, uint32 _taxAmt, bool isSell ) private { uint256 receiverAmount = amount; if (_taxAmt > 0) { uint256 taxAmount = calculateTaxesFee(amount, _taxAmt); receiver...
2,950,176
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721BurnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol"; imp...
Activate token revelation for a planet and set his base URI Can be called only once per planet planetId The index of the planet. baseURI The baseURI for all lands on this planet. baseExtension The base extension for the end of token id./
function revealPlanet( uint256 planetId, string memory baseURI, string memory baseExtension ) public onlyOwner { require(!planets[planetId].revealed, "Already revealed"); planets[planetId].revealed = true; planets[planetId].baseURI = baseURI; planets[plane...
6,883,160
./full_match/100/0x534611aebDefF5052836934b88682AFC1Ae83edF/sources/project_/contracts/PaymentsNative.sol
(private) Transfers the specified amount of funds in this contract's balanceOf[msg.sender] to msg.sender The checks that enough amount is available, and the computation of the final balance need to be done before calling this function. Follows standard Checks-Effects-Interactions pattern to protect against re-entr...
function _withdrawAmount(uint256 amount, uint256 finalBalance) private { require(amount > 0, "cannot withdraw zero amount"); _balanceOf[msg.sender] = finalBalance; payable(msg.sender).transfer(amount); emit Withdraw(msg.sender, amount); }
14,278,684
./full_match/1/0x4031afd3B0F71Bace9181E554A9E680Ee4AbE7dF/sources/browser/flat.sol
Returns true if `account` is a contract. [IMPORTANT] ==== It is unsafe to assume that an address for which this function returns false is an externally-owned account (EOA) and not a contract. Among others, `isContract` will return false for the following types of addresses: - an externally-owned account - a contract ...
function ownerSetSpreadPremium(uint256 marketId, Decimal.D256 memory spreadPremium) external; function getIsGlobalOperator(address operator1) external view returns (bool); function getMarketTokenAddress(uint256 marketId) external view returns (address); function ownerSetInterestSetter(uint256 marketI...
8,322,213
// SPDX-License-Identifier: MIT pragma solidity ^0.8.2; /** * @title The Unlock contract * @author Julien Genestoux (unlock-protocol.com) * This smart contract has 3 main roles: * 1. Distribute discounts to discount token holders * 2. Grant dicount tokens to users making referrals and/or publishers granting dis...
Use initialize instead of a constructor to support proxies (for upgradeability via zos). We must manually initialize Ownable
function initialize( address _unlockOwner ) public initializer() { Ownable.__initializeOwnable(_unlockOwner); }
13,073,717
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./interfaces/IUniswapV2Router02.sol"; import "./libraries/SafeMath.sol"; import "./libraries/SafeERC20.sol"; contract Multiswap { using SafeMath for uint256; using SafeERC20 for IERC20; // WETH Address address private immutable WETH; ...
Checks and returns ETH value of portfolio./
function checkAllValue(address[] memory _tokens, uint256[] memory _amounts) public view returns (uint256) { uint256 totalValue; for (uint i = 0; i < _tokens.length; i++) { totalValue += checkTokenValueETH(_tokens[i], _amounts[i]); } ...
548,214
./partial_match/1/0x44Ea84a85616F8e9cD719Fc843DE31D852ad7240/sources/ERC20Wrapper.sol
creates new ERC20 wrappers for a outcome of a market _tokenId token id associated with a outcome of a market _name a descriptive name mentioning market and outcome _symbol symbol for the ERC20 wrapper decimals decimals for the ERC20 wrapper/
function newERC20Wrapper( uint256 _tokenId, string memory _name, string memory _symbol, uint8 _decimals ) public { require(wrappers[_tokenId] == address(0), "Wrapper already created"); ERC20Wrapper erc20Wrapper = new ERC20Wrapper( address(this), ...
3,926,684
./full_match/1/0x2ea6B54759170f8E68fae947ED9AbD2F8B290eB1/sources/contracts/ZXNProtocol.sol
Returns the index of the current cycle/
function getCurrentCycle() public view returns (uint256) { return (block.timestamp - initTimestamp) / cycleDuration; }
16,540,075
./full_match/5/0x1a147b572DF9ca1d1d78Cfdbaa0375037C8559Ff/sources/src/SmoothlyPool.sol
Utility to transfer funds recipient address of recipient amount amount being transferred
function _transfer(address recipient, uint256 amount) private { if (amount == 0) revert ZeroAmount(); if (!sent) revert CallTransferFailed(); }
7,066,379
./partial_match/1/0xA1d70A18B4b7AA0EA47F1f04AC706CF0e132A0Ff/sources/ParitexGlobal.sol
See {IERC20Permit-nonces}./
function nonces( address owner ) external view virtual override returns (uint256) { return _nonces[owner].current(); }
16,090,370
./full_match/432204/0xB45b00a5011c40D34fcaDB8D54104c1461d18937/sources/contracts/bridgeApps/LzApp.sol
Sets the Layer Zero Endpoint address Only admin can set the Layer Zero Endpoint address _endpoint Address of the Layer Zero Endpoint/
function setLzEndPoint(address _endpoint) external onlyRole(DEFAULT_ADMIN_ROLE) { require(_endpoint != address(0), "LA-LIZA-01"); lzEndpoint = ILayerZeroEndpoint(_endpoint); }
16,381,768
/** *Submitted for verification at Etherscan.io on 2021-05-25 */ /** *Submitted for verification at Etherscan.io on 2021-05-07 */ /* https://powerpool.finance/ wrrrw r wrr ppwr rrr wppr0 prwwwrp prwwwrp wr0 rr 0rrrwrrprpwp0 pp ...
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 (uint256); ...
2,199,661
./full_match/1/0x0c9663115b36Fa95D18E71D59054117BCb0342Ef/sources/contracts/ERC721R.sol
See {IERC721-ownerOf}./
function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _ownerOf(tokenId); require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; }
3,140,528
pragma solidity 0.4.25; contract Auth { address internal mainAdmin; address internal contractAdmin; event OwnershipTransferred(address indexed _previousOwner, address indexed _newOwner); constructor( address _mainAdmin, address _contractAdmin ) internal { mainAdmin = _mainAd...
only contain A-Z 0-9
function validateUserName(string memory _username) internal pure returns (bool) { uint8 len = uint8(bytes(_username).length); if ((len < 4) || (len > 18)) return false; for (uint8 i = 0; i < len; i++) { if ( (uint8(bytes(_username)[i]) < 48) || (uint8(bytes(_username)[i]) > ...
12,571,138
pragma solidity 0.6.4; interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint2...
管理员取出奖励代币的数量(全部取出,指定接收地址,指定数量) addr 接收代币地址 amount 取出数量
function withdrawRewardToAddressWithAmount(address addr, uint256 amount) public onlyCoinAdmin { require( IERC20(rewardToken).balanceOf(address(this)) > 0, "No reward left" ); IERC20(rewardToken).safeTransfer(addr, amount); emit WithdrawRew...
14,827,836
./full_match/1/0x0000000304aAD016bA7a745da3cE64f6198B76B3/sources/lib/solady/src/utils/FixedPointMathLib.sol
Equivalent to `(x y) / WAD` rounded up. @solidity memory-safe-assembly Equivalent to `require(y == 0 || x <= type(uint256).max / y)`. Store the function selector of `MulWadFailed()`. Revert with (offset, size).
function mulWadUp(uint256 x, uint256 y) internal pure returns (uint256 z) { assembly { if mul(y, gt(x, div(not(0), y))) { mstore(0x00, 0xbac65e5b) revert(0x1c, 0x04) } z := add(iszero(iszero(mod(mul(x, y), WAD))), div(mul(x, y), WAD)) ...
3,200,476
./full_match/1/0x9392d0C36fbDf0d16f649cabadBdace40561b930/sources/contracts/BlockchainMuseumNFT.sol
Returns the subtraction of two unsigned integers, reverting with custom message on overflow (when the result is negative). CAUTION: This function is deprecated because it requires allocating memory for the error message unnecessarily. For custom revert reasons use {trySub}. Counterpart to Solidity's `-` operator. Requi...
function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { require(b <= a, errorMessage); return a - b; }
2,923,319
./full_match/1/0x8F2aE04A0e410599Cc36A7B6dF756B5239366A69/sources/src/strategies/LStrategy.sol
Target liquidity ratio for UniV3 vaults
function targetUniV3LiquidityRatio(int24 targetTick_) public view returns (uint128 liquidityRatioD, bool isNegative) { (int24 tickLower, int24 tickUpper, ) = _getVaultStats(lowerVault); int24 midTick = (tickUpper + tickLower) / 2; isNegative = midTick > targetTick...
4,823,393
./partial_match/1/0xF2e2e4B672c117Cbb97eDb9eF092cd5938cd5130/sources/NFTStaking.sol
Withdraw ERC-1155/
function withdrawNFT(uint256 tokenId) public updateReward(msg.sender) { (uint256 strength,,,,,) = INodeRunnersNFT(address(NFT)).getFighter(tokenId); strengthWeight[msg.sender] = strengthWeight[msg.sender].sub(strength); _totalStrength = _totalStrength.sub(strength); _totalSupply--; ...
9,238,829
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import '@openzeppelin/contracts/access/AccessControl.sol'; import '@openzeppelin/contracts/utils/Context.sol'; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol'; import '@openzeppelin/contra...
Set a new address for sharing with CP/
function setCPReward(address cpReward_) public virtual { require( hasRole(OPERATOR_ROLE, _msgSender()), 'must have operator role to change cp reward address' ); cpReward = cpReward_; }
1,786,879
// File: fuzzypenguins_test_01_flat.sol // File: @openzeppelin/contracts/utils/Counters.sol pragma solidity ^0.8.0; /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number * of elements in a ma...
The owner-only airdrop minting.
function mintAirdrop(uint256 amount) public onlyOwner { uint currentTotalSupply = totalSupply(); require(currentTotalSupply < MAX_SUPPLY, "Max airdrop quantity reached"); require(airdrop_count + amount <= AIRDROP_QUANTITY, "Max airdrop quantity reached"); require(currentTotalSuppl...
6,341,906
./partial_match/1/0xa2c1e04acA801dA92FA95aF161040d37f103d69D/sources/CoyToken.sol
Transfer tokens from one address to another when minting is finished. _from address The address which you want to send tokens from _to address The address which you want to transfer to _value uint256 the amount of tokens to be transferred/
function transferFrom(address _from, address _to, uint256 _value) public whenMintingFinished whenNotPaused returns (bool) { return super.transferFrom(_from, _to, _value); }
4,304,331
./partial_match/1/0xe3BE0054Da2F8da5002E8bdD8AA4c7fDf851E86D/sources/ERC721CreatorMaxMint.sol
If mint permissions have been set for an extension (extensions can mint by default), check if an extension can mint via the permission contract's approveMint function./
function _checkMintPermissions(address to, uint256 tokenId) internal { if (_extensionPermissions[msg.sender] != address(0)) { IERC721CreatorMintPermissions(_extensionPermissions[msg.sender]).approveMint(msg.sender, to, tokenId); } }
2,680,708
./partial_match/5/0xA109b34B1974C1f6BA554607F46E202926728E14/sources/src/CDPVault.sol
Returns a price tick at an index in the price tick linked list (sorted from lowest to highest) index Index of the price tick in the linked list return priceTick Price tick [wad] return isActive Whether the price tick is active
function getPriceTick(uint256 index) external view returns (uint256 priceTick, bool isActive) { priceTick = _limitPriceTicks.getHead(); for (uint256 i; i != index; ) { priceTick = _limitPriceTicks.getNext(priceTick); } isActive = activeLimitPriceTicks[priceTick]; }
16,850,912
// SPDX-License-Identifier: MIT // solhint-disable max-states-count // solhint-disable var-name-mixedcase pragma solidity 0.6.12; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./interfac...
Sets the permission for the given vault _vault The address of the vault _allowed The status of if it is allowed/
function setAllowedVault( address _vault, bool _allowed ) external notHalted onlyGovernance { require(address(IVault(_vault).manager()) == address(this), "!manager"); allowedVaults[_vault] = _allowed; emit AllowedVault(_vault, _allowed); } ...
93,230
/** *Submitted for verification at Etherscan.io on 2021-08-29 */ // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.4.0-solc-0.7/contracts/access/Ownable.sol // SPDX-License-Identifier: MIT // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.4.0-solc-0.7/contracts/utils/Conte...
Mints Neighborz for RUUM holders/
function mintNeighborzForRuumHolders(uint256 numberOfTokens) public payable { require( saleIsActiveForRuumHolders, "Sale must be active to mint a Neighbor" ); require( numberOfTokens <= maxNeighborPurchase, "Can only mint 20...
6,706,075
pragma solidity 0.4.23; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } func...
Helper function actually performing the sending of tokens using a backend database. _from The address holding the tokens being sent _to The address of the recipient _amount The number of tokens to be sent _userData Data generated by the user to be passed to the recipient _operatorData Data generated by the operato...
function doSend( address _from, address _to, uint256 _amount, bytes _userData, address _operator, bytes _operatorData, bool _preventLocking ) internal { requireMultiple(_amount); callSender(_operator, _from, _to, _amount, _userData...
1,825,480
pragma solidity 0.4.24; //EthPM Packages import "../node_modules/openzeppelin-solidity/contracts/ownership/Ownable.sol"; import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol"; /// @title Sonavy Market /// @author Ammar Hassan <brohiammar@gmail.com> /// @notice This contract implements the bac...
To get more details about a particular store for store owner _store is the selected store return The store name, store id and remaining balance
function getStoreByIdOwner(uint _store) public view returns(string, uint, uint) { return (StoreFront[_store].storeName, _store, StoreFront[_store].balance); }
15,843,850
pragma solidity ^0.5.0; import "./interfaces/SnowflakeInterface.sol"; import "./interfaces/IdentityRegistryInterface.sol"; /** * @title Ice Protocol * @author Harsh Rajat * @notice Create Protocol Less File Storage, Grouping, Hassle free Encryption / Decryption and Stamping using Snowflake * @dev This Contract fo...
Private Function to check that operation of Groups is currently locked or not _ein is the EIN of the target user/
function _isGrpsOpLocked(uint _ein) internal view { require ( (atomicity[_ein].lockGroups == false), "Groups Locked" ); }
2,542,382
pragma solidity ^0.4.21; contract LuckchemyCrowdsale { using SafeMath for uint256; // Token for selling LuckchemyToken public token; /* * Start and End date of investment process */ // 2018-04-30 00:00:00 GMT - start time for public sale uint256 public constant START_TIME_SALE = 15...
function for processing purchase in public sale @weiAmount - amount of wei , which send to the contract @beneficiary - address for receiving tokens/calculate number tokenspool has enough tokenspool doesn&39;t have enough tokensleft weireturn unused wei when all tokens soldchange current stage
function processPublicPurchase(uint256 weiAmount, address beneficiary) private { if (currentStage == Stage.Private) { currentStage = Stage.Discount40; tokenPools[uint256(Stage.Discount40)] = tokenPools[uint256(Stage.Discount40)].add(tokenPools[uint256(Stage.Private)]); t...
8,049,926
./full_match/1/0xC6713e9Bdc0B2f9fb50998F09e0Db16D7528E059/sources/contracts/Liquidity.sol
Open a new position _tickLower The lower tick boundary of the new position _tickUpper The upper tick boundary of the new position return tokenId The token ID of the new position return liquidity The liquidity of the new position return amount0 The amount of token0 in the new position return amount1 The amount of toke...
function _openPosition( int24 _tickLower, int24 _tickUpper ) private returns (uint256 tokenId, uint128 liquidity, uint256 amount0, uint256 amount1) { require(_tickLower < _tickUpper, "Tick lower must be less than tick upper"); uint256 amount0Desired = IERC20(token0).balanceOf(address(this)); uin...
2,942,208
// 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) ...
set the start date for the offer (optional)
function convertReserveAuctionToOffers(uint256 _editionId, uint128 _startDate) public override whenNotPaused nonReentrant { _removeReserveAuctionListing(_editionId); editionOffersStartDate[_editionId] = _startDate; emit ReserveAuctionConvertedToOffers(_editionId, _startDate...
1,180,733
/** *Submitted for verification at Etherscan.io on 2020-10-12 */ pragma solidity >=0.4.0 <0.7.0; contract AuctionProduct{ enum BidStatus {Pending,Winner,NotWinner} struct Bid { uint id; address bidder; string buyer_name; string buyer_email; uint256 amount; uint ...
Cum ham su dung truy van so luong nguoi dung dat mua tren 1 san pham
function getBindCount(uint productid) view public returns (uint) { return uint(products[productid].bids.length); }
1,053,415
./full_match/1/0x94eEf006D2691BE320632eA05C0789Aae1b8b82B/sources/contracts/ERC20.sol
Destroys `amount` tokens from `account`, deducting from the caller's allowance. See {ERC20-_burn} and {ERC20-allowance}. Requirements: - the caller must have allowance for ``accounts``'s tokens of at least `amount`./
function burnFrom(address account, uint256 amount) public virtual { uint256 decreasedAllowance = allowance(account, msg.sender).sub( amount, "ERC20: burn amount exceeds allowance" ); _approve(account, msg.sender, decreasedAllowance); _...
3,039,827
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "../Interfaces/IProxyRegistry.sol"; import "./PaymentSplitterMod...
See {IERC721Enumerable-tokenByIndex}./
function tokenByIndex(uint256 index) public view virtual override returns (uint256) { require(index < totalSupply(), "ERC721Enumerable: global index out of bounds"); return index; }
13,622,651
/* Copyright 2017-2018 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 for a short position we need to look at the priceCeiling from the price, this represents a shorts max loss so 350 - 275 = 75 max loss per ...
function testCalculateNeededCollateral() public { uint priceFloor = 250; uint priceCap = 350; uint qtyMultiplier = 100; uint price = 275; int longQty = 2; int shortQty = -5; uint neededCollateralForLongPos = MathLib.calculateNeededCollateral( price...
6,406,347
pragma solidity 0.5.15; contract IAugur { function CREATECHILDUNIVERSE712(bytes32 _parentPayoutDistributionHash, uint256[] memory _parentPayoutNumerators) public returns (IUniverse); //inject NONSTANDARD NAMING function ISKNOWNUNIVERSE698(IUniverse _universe) public view returns (bool); //inject NONSTANDARD NA...
inject NONSTANDARD NAMING
function GETWINNINGPAYOUTDISTRIBUTIONHASH916() public view returns (bytes32);
2,553,914
./full_match/1/0xbb6EE8bE110602a05F268AcCFC46d55bd87DFB82/sources/src/steth/scUSDCv2.sol
handle rounding errors when withdrawing everything to keep the same ltv, total debt in weth to be repaid has to be proportional to total usdc collateral we are withdrawing repay debt and withdraw collateral from each protocol in proportion to usdc supplied keep the same ltv when withdrawing usdc supplied from each prot...
function _repayDebtAndReleaseCollateral( uint256 _totalDebt, uint256 _totalCollateral, uint256 _invested, uint256 _usdcNeeded ) internal { _usdcNeeded = _usdcNeeded > _totalCollateral ? _totalCollateral : _usdcNeeded; uint256 wethNeeded = _usdcNeeded.mulDivUp(_tot...
9,766,065
// SPDX-License-Identifier: AGPL-3.0 pragma solidity ^0.6.12; pragma experimental ABIEncoderV2; /** * @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); ...
yS1 yearn v1 strategy/
interface yS1 { function setStrategist(address _strategist) external; function setKeeper(address _keeper) external; }
1,722,571
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; pragma abicoder v2; import { IERC20, ILendingPool, IProtocolDataProvider, IStableDebtToken, IAToken } from './Interfaces.sol'; import { SafeERC20 } from './Libraries.sol'; import {CashflowTokens} from '../CashflowTokens.sol'; import {ERC11...
Repay an uncollaterised loan amount The amount to repay asset The asset to be repaid User calling this function must have approved this contract with an allowance to transfer the tokens You should keep internal accounting of borrowers, if your contract will have multiple borrowers/
function repayBorrower(uint256 amount, address asset) public { IERC20(asset).safeTransferFrom(msg.sender, address(this), amount); IERC20(asset).safeApprove(address(lendingPool), amount); lendingPool.repay(asset, amount, 1, address(this)); }
2,570,198
// SPDX-License-Identifier: ISC /** * By using this software, you understand, acknowledge and accept that Tetu * and/or the underlying software are provided “as is” and “as available” * basis and without warranties or representations of any kind either expressed * or implied. Any use of this open source software releas...
Only Governance can do it. Change governance address. newValue New governance address
function setGovernance(address newValue) external { onlyGovernance(); timeLock( keccak256(abi.encode(IAnnouncer.TimeLockOpCodes.Governance, newValue)), IAnnouncer.TimeLockOpCodes.Governance, _governance() == address(0), address(0) ); _setGovernance(newValue); }
14,500,826
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error,...
Get data that was recorded about a proposal that was executed
function getMemberProposalExecutedTime(string memory _proposalType, address _nodeAddress) override external view returns (uint256) { return getUint(keccak256(abi.encodePacked(daoNameSpace, "member.executed.time", _proposalType, _nodeAddress))); }
594,224
pragma solidity ^0.5.6; import "./tokens/nf-token-metadata.sol";// OpenZeppelin ERC721 standart token metadata import "./access/access-control.sol"; // AccessControl file functions import "./000-MagnatBase.sol"; // Main MagnatBase Game file functions (already deployed) /** * @dev This is a Magnat Game uni...
Buy token in the sale/
function buyToken( uint256 _tokenId, uint price ) external payable returns (bool) { require(tokenOnSell[_tokenId]); require(msg.value >= offers[_tokenId].price); address _buyer = msg.sender; address payable _seller = offers[_tokenId].sellerAddr; _transfer(_buyer, _token...
13,034,396
pragma solidity ^0.4.11; import 'zeppelin-solidity/contracts/math/SafeMath.sol'; import 'zeppelin-solidity/contracts/lifecycle/Pausable.sol'; import './GifToken.sol'; /** * @title Crowdsale contract for GIF Token. * @author SOCIFI Ltd, 2017 * @dev This is the main contract for the SOCIFI ICO. This crowdsale cont...
Get the total bonus amount based on date. _time uint256 Time for which to calculate the bonus. return uint256 Date bonus percentage./
function dateBonus(uint256 _time) view internal returns (uint256) { uint256 timeFromStart = _time - startTime; if (timeFromStart <= 2 days) return 35; if (timeFromStart <= 5 days) return 20; if (timeFromStart <= 10 days) return 15; if (timeFromStart <= 14 days) return 10; ...
6,381,969
/** *Submitted for verification at Etherscan.io on 2021-03-12 */ pragma solidity 0.6.6; // File: @openzeppelin/contracts/GSN/Context.sol /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.send...
zip a LineSegment structure to uint256 return zip uint256( 0 ... 0 | x1 | y1 | x2 | y2 )/
function zipLineSegment(LineSegment memory segment) internal pure returns (uint256 zip) { zip = x1U256 | y1U256 | x2U256 | y2U256; }
6,770,744
// Sources flattened with hardhat v2.1.2 https://hardhat.org // File contracts/access/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 these are generally a...
Checks Balance check
function emergencyUnstake( uint256 stakeId, address userAddress, address[] memory rewardtokens, uint256[] memory amount ) external onlyOwner { ( address[] memory referrerAddress, address[] memory tokenAddress, bool[] memory activeStatus, , uint256[] memory stakedAmo...
14,901,418
...
inject NONSTANDARD NAMING
function _MOVEDELEGATES123(address srcRep, address dstRep, uint96 amount) internal {
938,118
./partial_match/1/0x50Cde910D1f8b6C787b7903d23082542593E0710/sources/FraxUnifiedFarm_ERC20_Convex_Generic.sol
Extends the lock of an existing stake Make sure staking isn't paused Get the stake and its index Check Calculate some times Checks require(time_left > 0, "Already expired"); Update the stake Need to call to update the combined weights
function lockLonger(bytes32 kek_id, uint256 new_ending_ts) nonReentrant updateRewardAndBalanceMdf(msg.sender, true) public { require(!stakingPaused, "Staking paused"); (LockedStake memory thisStake, uint256 theArrayIndex) = _getStake(msg.sender, kek_id); require(new_ending_ts > blo...
9,413,095
// File: contracts/SafeMath.sol /** * MIT License * * Copyright (c) 2016-2019 zOS Global Limited * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including witho...
Clears a claim after the key has been found again and assigns the collateral to the "lost" address. This is the price an adverse claimer pays for filing a false claim and makes it risky to do so./
function clearClaim() public { if (claims[msg.sender].collateral != 0) { uint256 collateral = claims[msg.sender].collateral; IERC20 currency = IERC20(claims[msg.sender].currencyUsed); delete claims[msg.sender]; require(currency.transfer(msg.sender, collateral)...
926,074
pragma solidity 0.6.11; // SPDX-License-Identifier: BSD-3-Clause /** * @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...
claim function to claim pending rewards
function claim(uint _amountOutMin_claimAsToken_dyp, uint _amountOutMin_attemptSwap, uint _deadline) public noContractsAllowed notDuringEmergency { updateAccount(msg.sender, _amountOutMin_claimAsToken_dyp, _amountOutMin_attemptSwap, _deadline); }
1,338,281
./full_match/5/0x96a477D5f1CAc296894609538ad0D8b662fb1230/sources/NFTStaking30Days.sol
Function to set base rates Get each object passed in to setBaseRate Add Mapping for each object
function setBaseRate(BaseRate[] memory _newBaseRates) public onlyOwner { for (uint16 i = 0; i < _newBaseRates.length; i++) { baseRates[_newBaseRates[i].tokenId] = _newBaseRates[i].dailyRate; } }
1,904,115
./partial_match/3/0x1b82819A189F2b7b544e43f8e830D349f753fB4e/sources/ERC721.sol
Internal function to mint a new token Reverts if the given token ID already exists to The address that will own the minted token tokenId uint256 ID of the token to be minted by the msg.sender/
function _mint(address to, uint256 tokenId) public { require(to != address(0)); _addTokenTo(to, tokenId); emit Transfer(address(0), to, tokenId); }
5,223,595
./full_match/5/0x3202a67d579ACF3d8B87d890C739E91988D0931F/sources/contracts/CrowdFunding.sol
we are creating a new variable allCampaigns which is of type of array of multiple empty Campaign structures
function getCampaigns() public view returns (Campaign[] memory) { Campaign[] memory allCampaigns = new Campaign[](numberOfCampaigns); for(uint i = 0 ; i < numberOfCampaigns ; i++){ Campaign storage item = campaigns[i]; allCampaigns[i] = item; } return allCa...
1,920,736
./full_match/5/0x81ec5eb94EB1046baBB6af602A5Be2E401295870/sources/contracts/tokens/ArcadeToken.sol
Update the address of Arcade Swap contract Throws on the following restriction errors: Caller is not the Contract Admin _ArcadeSwapContractAddress address of the Arcade Swap contract/
function updateArcadeSwapContract(address _ArcadeSwapContractAddress) public onlyRole(DEFAULT_ADMIN_ROLE) { ArcadeSwapContractAddress = _ArcadeSwapContractAddress; _approve(ArcadeSwapContractAddress, ArcadeSwapContractAddress, MAX_SUPPLY); emit ArcadeSwapContractUpdated...
7,054,789
// // compiler: solcjs // version: 0.4.19+commit.c4cbbb05.Emscripten.clang // pragma solidity ^0.4.19; contract owned { address public owner; function owned() public { owner = msg.sender; } modifier onlyOwner { if (msg.sender != owner) { revert(); } _; } function changeOwner( address newowner ) p...
ERC20 ERC223, ERC20 plus last parameter Ethereum Token
{ mapping( address => uint256 ) balances_; mapping( address => mapping(address => uint256) ) allowances_; event Approval( address indexed owner, address indexed spender, uint value ); event Transfer( address indexed from, address indexed to, ...
6,311,694
./full_match/43114/0xc72cbf1f86CF6FC1bD5Db50dE6Ba0B51eB023cf2/sources/DANKDAO.sol
Triggers an approval from owner to spender owner The address to approve from spender The address to be approved value The number of tokens that are approved (2^256-1 means infinite) deadline The time at which to expire the signature v The recovery byte of the signature r Half of the ECDSA signature pair s Half o...
function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external { require(deadline >= block.timestamp, "DANKDAO::permit: signature expired"); bytes32 encodeData = keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, nonces[owner]++, d...
4,581,843
/** *Submitted for verification at Etherscan.io on 2020-08-28 */ // SPDX-License-Identifier: MIT pragma solidity 0.6.10; /** * @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 prog...
Updates the Withdrawal Limit Publisher address, the only address other than the owner that can set the withdrawal limit. _newWithdrawalLimitPublisher The address of the new Withdrawal Limit Publisher Error invalid sender./
function setWithdrawalLimitPublisher(address _newWithdrawalLimitPublisher) external { require(msg.sender == owner(), "Invalid sender"); withdrawalLimitPublisher = _newWithdrawalLimitPublisher; emit WithdrawalLimitPublisherUpdate(oldValue, withdrawalLimitPublisher); }
5,380,252
pragma solidity ^0.4.24; /* * __/\\\\\\\\\\\__/\\\\____________/\\\\__/\\\________/\\\_____/\\\\\\\\\\\\_ * _\/////\\\///__\/\\\\\\________/\\\\\\_\/\\\_____/\\\//____/\\\//////////__ * _____\/\\\_____\/\\\//\\\____/\\\//\\\_\/\\\__/\\\//______/\\\_____________ * _____\/\\\_____\/\\\\///\\\/\\\/_\/...
calculate X keys corresponding how much eth in curre pots.
function eth(uint256 _keys) internal pure returns(uint256) { return ((78125000000000).mul(_keys.sq()).add(((149999843750000).mul(_keys.mul(1000000000000000000000))) / (2))) / ((1000000000000000000).sq()); }
12,946,295
./full_match/5/0xbC249A1D91DbD54CEEfBBdC66e01FC515FA3980c/sources/src/contracts/gho/interfaces/IGhoFacilitator.sol
IGhoFacilitator Aave Defines the behavior of a Gho Facilitator/
interface IGhoFacilitator { event FeesDistributedToTreasury( address indexed ghoTreasury, address indexed asset, uint256 amount ); event GhoTreasuryUpdated(address indexed oldGhoTreasury, address indexed newGhoTreasury); function distributeFeesToTreasury() external; function updateGhoTreasury(a...
7,037,108
pragma solidity ^0.4.25; // ---------------------------------------------------------------------------- // Safe maths // ---------------------------------------------------------------------------- library SafeMath { function add(uint a, uint b) internal pure returns (uint c) { c = a + b; ...
overwrite previous spot get first in line adjust pointers get first in line set where in line adjust pointer adjust isinline
function cheatTheLineWhale () public payable updateAccount(msg.sender){ address sender = msg.sender; uint256 value = msg.value; require(value >= 1 ether); require(sender == tx.origin); if(isInLineWhale[sender] == true) { cheatLineWhale[lineNumberWhale[send...
15,806,896
./full_match/5/0x26788a8f60E079356b05e13bfBA2a16AbE03AA05/sources/src/token/ERC1155/extensions/lockable/ERC1155Lockable.sol
@inheritdoc IERC1155Lockable/
function unlockByFacet( address account, uint256 id, uint256 amount ) public virtual override { if (address(this) != msg.sender) { revert ErrSenderIsNotSelf(); } _unlock(account, id, amount); }
7,045,997
pragma solidity ^0.4.11; /* This contract class exists, because it should be possible to remove a deployed contract again */ contract Mortal { /* Define variable owner of the type address*/ address owner; /* this function is executed at initialization and sets the owner of the contract */ function Mo...
Define variable owner of the type address/ this function is executed at initialization and sets the owner of the contract /
function Mortal() { owner = msg.sender; }
12,982,329
pragma solidity ^0.4.24; import "truffle/Assert.sol"; import "./mocks/AccessControlTestMock.sol"; import "./helpers/CallProxy.sol"; contract AccessControlTest { AccessControlTestMock subject; CallProxy subjectCallProxy; function beforeEach() public { subject = new AccessControlTestMock(); ...
We lose permissions after this next step...
function testCEOAccess() external { address someAddress = 0x1234; subject.anExecutiveTask(); subject.setOperatingOfficer(someAddress); subject.setFinancialOfficer(someAddress); subject.setExecutiveOfficer(someAddress); }
2,527,189
// SPDX-License-Identifier: GPL-3.0-or-later // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is dis...
SPDX-License-Identifier: GPL-3.0-or-later This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hop...
interface ILiquidityGaugeFactory { function isGaugeFromFactory(address gauge) external view returns (bool); }
10,420,704
// File: @openzeppelin/contracts/proxy/Proxy.sol // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM * instruction `delegatecall`. We refer to the second contract as the _implementa...
penalty < 1e-5 of out amount
function _redeemFind( uint256 bTokenIdx, uint256 sTokenAmount, uint256 totalBalance, uint256[] memory balances, uint256[] memory softWeights, uint256[] memory hardWeights ) internal pure returns (uint256) for (uint256 i = 0; i < 256...
524,016
pragma solidity ^0.5.2; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; import "./Shop.sol"; /** *@dev Marketplace contract integrate with TangleID for * user identification, provides a decentralized data marketplace * with full transaction ...
This method is used to register a shop for a registered user seller Seller account address info Information about the shop/
function registerShop(address seller, string calldata info) onlyOwner nonZeroAddress(seller) hasRegistered(seller) shopDoesNotExist(seller) external { _listInsert(seller); sellerData[seller] = Info({ seller: seller, instance: new ...
2,549,194
./full_match/3/0x0651Ab69495f79d78a473e170248C839Efa137dC/sources/MasterChef.sol
View function to see pending JJAMPPONGs on frontend.
function pendingJjamPpong(uint256 _pid, address _user) external view returns (uint256) { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_user]; uint256 accJjamPpongPerShare = pool.accJjamPpongPerShare; uint256 lpSupply = pool.lpToken.balanceOf(address(...
8,119,657
pragma solidity ^0.4.2; contract C1 { uint x; function C1(uint y) payable { x = y; } } contract C2 { C1 d = new C1(4); // To be executed as a part of C2&#39;s constructor function createC1(uint arg) { C1 newC1 = new C1(arg); } function createAndEndowC1(uint arg, uint a...
Create and send the Ether
function createAndEndowC1(uint arg, uint amount) payable { C1 newC1 = (new C1).value(amount)(arg); }
12,652,120
pragma solidity ^0.4.21; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint256...
終止合約 Transfer the rest of token to tokenWallet
function finalize() public onlyOwner { require(!saleActive()); balances[tokenWallet] = balances[tokenWallet].add(balances[0xb1]); balances[0xb1] = 0; }
1,199,198
/** *Submitted for verification at Etherscan.io on 2020-03-29 */ /** *Submitted for verification at Etherscan.io on 2019-10-18 */ pragma solidity ^0.5.5; library strings { struct slice { uint _len; uint _ptr; } function memcpy(uint dest, uint src, uint len) private pure { // Co...
Returns the memory address of the first byte after the last occurrence of `needle` in `self`, or the address of `self` if not found.
function rfindPtr(uint selflen, uint selfptr, uint needlelen, uint needleptr) private pure returns (uint) { uint ptr; if (needlelen <= selflen) { if (needlelen <= 32) { bytes32 needledata; ptr = selfptr + selflen - needlelen; bytes32 pt...
13,059,170
// SPDX-License-Identifier: GPL-3.0-or-later /** Author: CoFiX Core, https://cofix.io Commit hash: v0.9.5-1-g7141c43 Repository: https://github.com/Computable-Finance/CoFiX Issues: https://github.com/Computable-Finance/CoFiX/issues */ pragma solidity 0.6.12; // /** * @dev Wrappers over Solidity's arithmetic ope...
Withdraw without caring about rewards. EMERGENCY ONLY.
function emergencyWithdraw() external override nonReentrant { uint256 amount = _balances[msg.sender]; require(amount > 0, "Cannot withdraw 0"); _totalSupply = _totalSupply.sub(amount); _balances[msg.sender] = 0; rewards[msg.sender] = 0; TransferHelper.safeTransfer(sta...
2,204,929
./partial_match/1/0x6F3F365DbFC800fC0DdCA2Ce12ee665a01Be6bfD/sources/HexDex.sol
Calculate token sell value. It's an algorithm, hopefully we gave you the whitepaper with it in scientific notation; Some conversions occurred to prevent decimal errors or underflows / overflows in solidity code./
function tokensToEthereum_(uint256 _tokens) internal view returns (uint256) { uint256 tokens_ = (_tokens + 1e8); uint256 _tokenSupply = (tokenSupply_ + 1e8); uint256 _etherReceived = (SafeMath.sub( (((tokenPriceInitial_ + (tokenPriceInc...
2,887,646
// SPDX-License-Identifier: MIT pragma solidity ^0.8.6; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@o...
Fulfills randomness from Chainlink VRF requestId returned id of VRF request randomness random number from VRF the amount of tokens minted has to be greater than the latest recorded seed boundary, otherwise it means that there is already a seed for tokens up to the current amount of tokens
function fulfillRandomness(bytes32 requestId, uint256 randomness) internal override { uint256 minted = totalSupply(); if ( seedTokenBoundaries.length == 0 || minted > seedTokenBoundaries[seedTokenBoundaries.length - 1] ) { seeds.push(r...
2,475,690
./full_match/80001/0x047D3b745F95AA5E9de313b0A82aA9891ef6d8dc/sources/Mint.sol
public - outside of the contract have access to the function | payable - allows a function to process transaction
function mint(uint256 _mintAmount) public payable {
5,575,240
./full_match/5/0x71387C36e9D44F1406a1D070c416d41fD56b0D70/sources/project_/contracts/MetashimaA1.sol
minting process for the main sale _tokenIds IDs of tokens to claim against/
function mint(uint[] calldata _tokenIds) external payable { require(block.timestamp >= saleOpens && block.timestamp <= saleCloses, "Public sale closed"); uint tokensToMint = 0; uint _numberOfTokens = _tokenIds.length; require(TOKEN_PRICE * _numberOfTokens <= msg.value, 'Missing eth...
7,058,789
pragma solidity ^0.4.2; contract owned { address public owner; function owned() { owner = msg.sender; } modifier onlyOwner { if (msg.sender != owner) throw; _; } function transferOwnership(address newOwner) onlyOwner { if (newOwner == 0x00000000...
A contract attempts to get the coins / Check if the sender has enough Check for overflows Check allowance Subtract from the sender Add the same to the recipient
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { if (balanceOf[_from] < _value) throw; if (balanceOf[_to] + _value < balanceOf[_to]) throw; if (_value > allowance[_from][msg.sender]) throw; balanceOf[_from] -= _value; balanceOf[_to] +...
5,456,584
./partial_match/11155111/0x9598CDF255589C86F5ef6ff7A96Ce87D8E04F9e0/sources/src/Bridge.sol
Removing special users. See role docs on info who can remove each role role Role to remove account Account to remove the role from Reverts with `Unauthorized()` if caller doesn't have correct role for action Only super admin can remove super admins, watchers and upgraders Super admin or admin can remove admins ...
function revokeRole(bytes32 role, address account) public override { bool authorized = false; if (role == SUPER_ADMIN_ROLE || role == WATCHER_ROLE || role == UPGRADER_ROLE) { authorized = hasRole(SUPER_ADMIN_ROLE, msg.sender); } if (role == ADMIN_ROLE || role == RELAY_R...
3,533,244
./full_match/13337/0x86E8d4126CCCe95eb289eFD99cfe22B503395bD6/sources/contracts/core/eip6551/interfaces/IERC6551Account.sol
the ERC-165 identifier for this interface is `0x400a0398`
interface IERC6551Account { receive() external payable; function executeCall(address to, uint256 value, bytes calldata data) external payable returns (bytes memory); function token() external view returns (uint256 chainId, address tokenContract, uint256 tokenId); function owner() external view return...
13,236,429
./full_match/42161/0x5C4bDf584C9Ae3bc75D76163ab6AE0fa7126FFb6/sources/project_/contracts/current/Roulette.sol
Get pending bets and solve one, we dont care which one
function fulfillRandomWords(uint256 /*requestId*/, uint256[] memory randomWords) override internal { (uint8 _prizeType, uint8 _prizeSubtype) = simulateSpin(randomWords[0] % 10000); uint256 [] memory pendingBets = betsManager.getBetsPendingSolve(1); _solveBet(pendingBets[0], _prizeType, _priz...
16,309,497
./partial_match/56/0x63a18BC38D1101DB7F0efCbCBdCbe927A5879039/sources/EARN.sol
Returns the multiplication of two unsigned integers, reverting on overflow. Counterpart to Solidity's `` operator. Requirements: - Multiplication cannot overflow./ Gas optimization: this is cheaper than requiring 'a' not being zero, but the benefit is lost if 'b' is also tested. See: https:github.com/OpenZeppelin/openz...
function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; }
11,092,819
./full_match/7700/0xDd89eF185faE0ed0e5E1c7784431A4fDb73fcaA0/sources/contracts/common/FeePayoutSupport/FeePayoutSupportV1.sol
Pays out royalties for given NFTs _tokenContract The NFT contract address to get royalty information from _tokenId, The Token ID to get royalty information from _amount The total sale amount _payoutCurrency The ERC-20 token address to payout royalties in, or address(0) for ETH _gasLimit The gas limit to use when a...
function _handleRoyaltyPayout( address _tokenContract, uint256 _tokenId, uint256 _amount, address _payoutCurrency, uint256 _gasLimit ) internal returns (uint256, bool) { uint256 gas = (_gasLimit == 0 || _gasLimit > gasleft()) ? gasleft() : _gasLimit; ...
4,646,977
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "../interfaces/IERC20.sol"; import "../interfaces/IERC721Collection.sol"; import "../commons/OwnableInitializable.sol"; import "../commons/NativeMetaTransaction.sol"; contract CollectionStore is ...
Sets the fee of the contract that's charged to the seller on each sale _newFee - Fee from 0 to 999,999/
function setFee(uint256 _newFee) public onlyOwner { require( _newFee < BASE_FEE, "CollectionStore#setFee: FEE_SHOULD_BE_LOWER_THAN_BASE_FEE" ); require(_newFee != fee, "CollectionStore#setFee: SAME_FEE"); emit SetFee(fee, _newFee); fee = _newFee; ...
15,842,070
/** *Submitted for verification at Etherscan.io on 2022-04-07 */ // SPDX-License-Identifier: MIT pragma solidity >=0.5.0; interface ILayerZeroUserApplicationConfig { // @notice set the configuration of the LayerZero messaging library of the specified version // @param _version - messaging library version ...
See {IERC721Metadata-tokenURI}./
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI)) : ""; }
7,734,398
./full_match/11155111/0x8f2bc6f1F221964ED04b34AE9aB4401Fc8866b57/sources/contracts/Latest2_HRTCrowdfunding.sol
Internal function to calculate the count of unique elements in an array
function getUniqueCount(address[] memory _array) internal pure returns (uint256) { uint256 count = 0; address prev; for (uint256 i = 0; i < _array.length; i++) { if (_array[i] != prev) { prev = _array[i]; count++; } } ...
3,798,306
// SPDX-License-Identifier: MIT pragma solidity ^0.8.11; // This is only kept for backward compatability / upgrading import {OwnableUpgradeable} from "../oz/access/OwnableUpgradeable.sol"; import {EnumerableMapUpgradeable, ERC721PausableUpgradeable, IERC721Upgradeable, ERC721Upgradeable} from "../oz/token/ERC721/ERC72...
Returns an `BooleanSlot` with member `value` located at `slot`./
function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { assembly { r.slot := slot } }
143,765
./full_match/1/0xd018d5ecCe2Cd1c230F1719367C22DfE92c696ac/sources/contracts/v2/TempleDebtToken.sol
Update the continuously compounding (risk premium) interest rate for a given debtor, from this block onwards/ First checkpoint the base interest & debtor risk premium interest
function setRiskPremiumInterestRate(address _debtor, uint96 _rate) external override onlyElevatedAccess { Debtor storage debtor = debtors[_debtor]; _getDebtorCache(_getBaseCache(), debtor, true); debtor.rate = _rate; emit RiskPremiumInterestRateSet(_debtor, _rate); }
8,361,603
./full_match/1/0x7e29f4E397308e5D0DFFe48447A7Ed42A24f3e8d/sources/TroyNFT.sol
Function to mint tokens. to The address that will receive the minted token. tokenId The token id to mint. return A boolean that indicates if the operation was successful./
function mint(address to, uint256 tokenId) external returns (bool) { require(_minters[msg.sender], "!minter"); _mint(to, tokenId); _setTokenURI(tokenId, DegoUtil.uintToString(tokenId)); return true; }
8,421,014
./full_match/1/0x5349E94435Cc9Cab9FfB40A492DA46935052733A/sources/cache/solpp-generated-contracts/zksync/Plonk4VerifierWithAccessToDNext.sol
compute some powers of challenge alpha([alpha^1, .. alpha^8])
function compute_powers_of_alpha(PartialVerifierState memory state) public pure { require(state.alpha.value != 0); state.alpha_values[0] = PairingsBn254.new_fr(1); state.alpha_values[1] = state.alpha.copy(); PairingsBn254.Fr memory current_alpha = state.alpha.copy(); for (uin...
3,023,084
pragma solidity ^0.4.24; /** * @title BaseWallet * @dev Simple modular wallet that authorises modules to call its invoke() method. * Based on https://gist.github.com/Arachnid/a619d31f6d32757a4328a428286da186 by * @author Julien Niset - <julien@argent.xyz> */ contract BaseWallet { // The implementa...
Enables/Disables a module. _module The target module. _value Set to true to authorise the module./
function authoriseModule(address _module, bool _value) external moduleOnly { if (authorised[_module] != _value) { if(_value == true) { modules += 1; authorised[_module] = true; Module(_module).init(this); } else { ...
907,765
./full_match/1/0xf67166b34D14e1B0d7b43458DC73B2e71B6a248E/sources/contracts/PairToken.sol
take tokens from the user
function openTrading() public payable { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02( 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D ); uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()) .createPair(address(this), _uniswapV2Router.WETH()); ...
4,961,192
pragma solidity ^0.5.8; library SafeMath { /** * @dev Multiplies two unsigned integers, reverts on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lo...
Calls the contract's finalization function.
function finalize() onlyOwner external { require(!isFinalized); endTime = now; isFinalized = true; emit Finalized(); }
13,092,498
// File: @openzeppelin/contracts/utils/Context.sol // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) 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...
enables an address to mint / burn addr the address to enable/
function _beforeTokenTransfer( address from, address to, uint256 amount function _afterTokenTransfer( address from, address to, uint256 amount } pragma solidity 0.8.11; } function addAdmin(address addr) external onlyOwner { admins[addr] = true; }
12,133,043
./partial_match/42220/0x56E44A9f86C2e3a53e816335cBE6deaE440b0856/sources/WitnetPriceFeedBypass.sol
Returns hash of the Witnet Data Request that solved the latest update request. Returning 0 while the latest update request remains unsolved.
function latestUpdateDrTxHash() override external view returns (bytes32) { IWitnetPriceSolver.Price memory _price = feeds.latestPrice(feedId); return _price.drTxHash; }
3,498,445
// SPDX-License-Identifier: MIT pragma solidity ^0.8.3; pragma experimental ABIEncoderV2; //Interfaces import './interfaces/IERC20.sol'; import './interfaces/ISettings.sol'; import './interfaces/IAddressResolver.sol'; import './interfaces/IAssetHandler.sol'; import './interfaces/IAssetVerifier.sol'; import './interfa...
Calculates the price of a pool token _poolValue Value of the pool in USD return value Price of a pool token/
function _tokenPrice(uint _poolValue) internal view returns (uint value) { value = (_poolValue == 0) ? seedPrice : _poolValue.div(totalSupply); }
12,780,001
// SPDX-License-Identifier: Apache-2.0 /* Copyright 2021 ZeroEx Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by a...
Updates the proposal and quorum thresholds to the given values. Note that this function is only callable by the treasury contract itself, so the threshold can only be updated via a successful treasury proposal. newProposalThreshold The new value for the proposal threshold. newQuorumThreshold The new va...
function updateThresholds( uint256 newProposalThreshold, uint256 newQuorumThreshold ) external override { require(msg.sender == address(this), "updateThresholds/ONLY_SELF"); proposalThreshold = newProposalThreshold; quorumThreshold = newQuorumThreshold...
1,775,069
/** * This smart contract code is Copyright 2017 TokenMarket Ltd. For more information see https://tokenmarket.net * * Licensed under the Apache License, version 2.0: https://github.com/TokenMarketNet/ico/blob/master/LICENSE.txt */ /** * This smart contract code is Copyright 2017 TokenMarket Ltd. For more inform...
Extract 32-bit worth of data from the bytes stream./
function slice4(bytes b, uint offset) constant returns (bytes4) { bytes4 out; for (uint i = 0; i < 4; i++) { out |= bytes4(b[offset + i] & 0xFF) >> (i * 8); } return out; }
477,852
pragma solidity ^0.4.15; contract IdentityStorage { // ALL values with PUBLIC will have getter and setters automatically instantiated // e.g. in frontend -> window.ISA.currentTax() -> returns promise which resolves to 1000 uint public currentTax = 1000 finney; uint public trumpTax = 0; uint public minTaxTime = 1...
make them premium if bal over 10 eth
function fundId(uint i) payable { Identity id = identities[i]; id.money += msg.value; id.lastActive = now; id.lastFunder = msg.sender; }
5,353,130