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/80001/0x3715FE0c0E39c2D28dB7f374Fe1F58481da51697/sources/contracts/AlgebraBasePluginV1.sol
@inheritdoc IFarmingPlugin
function isIncentiveConnected(address targetIncentive) external view override returns (bool) { if (incentive != targetIncentive) return false; if (_getPluginInPool() != address(this)) return false; (, , , uint8 pluginConfig) = _getPoolState(); if (!pluginConfig.hasFlag(Plugins.AFTER_SWAP_FLAG)) return...
8,819,981
pragma solidity ^0.4.18; import "./SpaceBase.sol"; // @title Interface for contracts conforming to ERC-721: Non-Fungible Tokens // @author Earthereum <austinatchley@gmail.com> (https://github.com/Earthereum) contract ERC721 { // Required methods function totalSupply() public view returns (uint256 to...
Checks if a given address currently has transferApproval for a particular planet. _claimant the address we are confirming planet is approved for. _tokenId planet id, only valid when > 0
function _approvedFor(address _claimant, uint256 _tokenId) internal view returns (bool) { return planetIndexToApproved[_tokenId] == _claimant; }
1,011,236
/** *Submitted for verification at Etherscan.io on 2022-01-06 */ /** *Submitted for verification at Etherscan.io on 2021-12-30 */ // SPDX-License-Identifier: MIT pragma solidity 0.8.4; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } ...
Function to set the merkle root/
function setRoot(uint256 _root) onlyOwner() public { root = bytes32(_root); }
2,243,300
./partial_match/3/0xaFC2CebC0CC2a955A119963a6BeE486b0c2364A9/sources/UETH.sol
Sweeps liquidity provider fees for udev
function sweep(IUniswapV2Pair[] calldata pairs) external { require(pairs.length < 256, "pairs.length>=256"); uint8 i; for(i = 0; i < pairs.length; i++) { IUniswapV2Pair pair = pairs[i]; require(pairRegistered[address(pair)],"!pairRegistered[pair]"); bool ...
5,295,896
pragma solidity >=0.5.4 <0.6.0; import './SafeMath.sol'; import './AOLibrary.sol'; import './TheAO.sol'; import './IAOPurchaseReceipt.sol'; import './IAOContent.sol'; import './IAOStakedContent.sol'; import './IAOContentHost.sol'; import './IAOTreasury.sol'; import './IAOEarning.sol'; import './INameFactory.sol'; /**...
Check whether the network ion is adequate to pay for existing staked content _price The price of the content _networkIntegerAmount The integer amount of the network ion _networkFractionAmount The fraction amount of the network ion _denomination The denomination of the the network ion return true when the amount is ...
function _canBuyAOContent(uint256 _price, uint256 _networkIntegerAmount, uint256 _networkFractionAmount, bytes8 _denomination) internal view returns (bool) { return _aoTreasury.toBase(_networkIntegerAmount, _networkFractionAmount, _denomination) >= _price; }
12,824,907
./full_match/1/0x85Ff72ef23C559881589Daa5C8Ed9698124eDE72/sources/src/LienToken.sol
Retrieves the auctionData for a CollateralToken. collateralId The ID of the CollateralToken./
function getAuctionData( uint256 collateralId ) external view returns (AuctionData memory data) { data = _loadLienStorageSlot().collateralLiquidator[collateralId]; if (data.liquidator == address(0)) { revert InvalidLienState(InvalidLienStates.COLLATERAL_NOT_LIQUIDATED); } }
8,451,379
//Address: 0xc45865b235a7c6693b9db5fed46ea8a3022d9b07 //Contract name: KATXDcorpMemberProxy //Balance: 0 Ether //Verification Date: 11/26/2017 //Transacion Count: 4 // CODE STARTS HERE pragma solidity ^0.4.18; /** * IOwnership * * Perminent ownership * * #created 01/10/2017 * #author Frank Bonnet */ interfac...
Receive contribution and forward to the target crowdsale This function requires that msg.sender is not a contract. This is required because it's not possible for a contract to specify a gas amount when calling the (internal) send() function. Solidity imposes a maximum amount of gas (2300 gas at the time of writing)/
function () public payable { target.contributeFor.value(msg.value)(member); }
5,547,264
./full_match/1/0x700d6d24A55512c6AEC08820B49da4e4193105B3/sources/src/BaseLocker.sol
Migrates the tokens hold by this contract to another address (& unlocks everything that can be unlocked) receiver Address to receive the migrated tokens/ Migrates the tokens hold by this contract to another address receiver Address to receive the migrated tokens/
function _migrate(address receiver) internal virtual; function migrate(address receiver) external nonReentrant onlyOwner whenPaused { if (receiver == address(0)) revert Errors.ZeroAddress(); _migrate(receiver); }
3,008,506
./full_match/4/0x3510A99D7dB4Ba6072B4FDDef4eD56fAe384728d/sources/browser/tokenICO.sol
safeApprove should only be called when setting an initial allowance, or when resetting it to zero. To increase and decrease it, use 'safeIncreaseAllowance' and 'safeDecreaseAllowance' solhint-disable-next-line max-line-length
function safeApprove(FYNX token, address spender, uint256 value) internal { require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector,...
13,320,961
/** *Submitted for verification at Etherscan.io on 2021-12-23 */ // _____ ______ _________ _____ ______ // |\ _ \ _ \|\___ ___\\ _ \ _ \ // \ \ \\\__\ \ \|___ \ \_\ \ \\\__\ \ \ // \ \ \\|__| \ \ \ \ \ \ \ \\|__| \ \ // \ \ \ \ \ \ \ \ \ ...
Satellite Burn for Whitelist System $MES Credit System Update Reward First Flow Deduct Credits Flow
function satelliteBurnForWL(string memory projectName_, bool useCredits_) external { require(!projectToWL[projectName_][msg.sender], "satelliteBurnForWL: You are already whitelisted!"); BurnWLSettings memory _BurnWLSettings = projectToBurnWLSettings[projectName_]; address _tokenAdd...
2,383,885
//Be name khoda pragma solidity 0.6.12; import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/SafeMath.sol"; import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol"; interface StakedToken { function balanceOf(address account) ex...
Withdraw without caring about rewards. EMERGENCY ONLY.
function emergencyWithdraw() public { User storage user = users[msg.sender]; stakedToken.transfer(msg.sender, user.depositAmount); emit EmergencyWithdraw(msg.sender, user.depositAmount); user.depositAmount = 0; user.paidReward = 0; }
885,821
./partial_match/4/0x262BE5EAE80Ebcb5e37327eB2D0A4553c290A45e/sources/Tx2UNI.sol
Calculate ETH/ARTT rateuint256 amount = 0.05 (1018);
function get_swaprate( uint256 ETH_amount ) external view returns (uint256 rate) { uint[] memory result = _unirouter.getAmountsOut( ETH_amount , _pair_artt_weth ); uint256 rate = (result[0]* (10**18))/result[1]; return rate; }
8,623,760
/** * Copyright 2017-2021, bZxDao. All Rights Reserved. * Licensed under the Apache License, Version 2.0. */ pragma solidity ^0.8.0; import "@openzeppelin-4.3.2/token/ERC20/ERC20.sol"; import "@openzeppelin-4.3.2/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin-4.3.2/access/Ownable.sol"; import "./MintCoord...
allows the DAO to rescue tokens accidently sent to the contract
function rescue( IERC20 _token) external onlyOwner { SafeERC20.safeTransfer(_token, msg.sender, _token.balanceOf(address(this))); }
1,787,281
pragma solidity ^0.4.17; // File: contracts/iERC20Token.sol // Abstract contract for the full ERC 20 Token standard // https://github.com/ConsenSys/Tokens // https://github.com/ethereum/EIPs/issues/20 pragma solidity ^0.4.17; /// @title iERC20Token contract contract iERC20Token { // FIELDS ...
Gets the balance of the specified address _id the token id erc1155Token address to erc1155 token to target return uint256 representing the amount owned by the passed address/
function balanceOfERC1155(address erc1155Token, uint256 _id) external view returns (uint256) { return ERC1155(erc1155Token).balanceOf(_id, this); }
5,475,808
./full_match/1/0x08e46853c6a3b57D01F1748041999fb8EB8fF9e5/sources/contracts/fundraising/libraries/LibAppStorage.sol
Get equity badge. return Equity badge contract instance return
function getBadge() internal view returns (IEquityBadge) { return appStorage().equityBadge; }
17,012,051
pragma solidity ^0.4.18; // solhint-disable-line /// @title Interface for contracts conforming to ERC-721: Non-Fungible Tokens /// @author Dieter Shirley <<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="6f0b0a1b0a2f0e17060002150a01410c00">[email&#160;protected]</a>> (https://github.com/dete) c...
PUBLIC FUNCTIONS / Grant another address the right to transfer token via takeOwnership() and transferFrom(). _to The address to be granted transfer approval. Pass address(0) to clear all approvals. _tokenId The ID of the Token that can be transferred if this call succeeds. Required for ERC-721 compliance. Caller m...
function approve( address _to, uint256 _tokenId ) public { require(_owns(msg.sender, _tokenId)); memeIndexToApproved[_tokenId] = _to; Approval(msg.sender, _to, _tokenId); }
6,648,094
./partial_match/1/0x00000000000006c7676171937C444f6BDe3D6282/sources/contracts/helpers/PointerLibraries.sol
Reads the int16 at `rdPtr` in returndata.
function readInt16( ReturndataPointer rdPtr ) internal pure returns (int16 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } }
4,300,475
pragma solidity ^0.4.11; library SafeMath { function mul(uint256 a, uint256 b) internal constant returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint256 a, uint256 b) internal constant returns (uint256) { // assert(b > 0); // So...
Send 800m to Company Wallet
function sendfutureDistributionsSupplyToken(address to, uint256 value) onlyOwner isActive { require ( to != 0x0 && value > 0 && _futureDistributionsSupply >= value ); balances[multisig] = balances[multisig].sub(value); balances[to] = balances[to].add(value); _fut...
2,513,702
// SPDX-License-Identifier: MIT // File: @openzeppelin/contracts/token/ERC20/IERC20.sol // OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol) pragma solidity 0.8.7; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in exi...
allocate tokens and lock to release periodically allocate tokens from owner to system wallets when smart contract is deployed/ last month includes all the rest
function lockSystemWallet(address _wallet, uint256 _amountSum, uint256 _startTime, uint8 _forHowManyPeriods, uint256 _periodInSeconds) private { uint256 amount = _amountSum/_forHowManyPeriods; for(uint8 i = 0; i< _forHowManyPeriods; i++) { uint256 releaseTime = _startTime + uint2...
1,121,610
./full_match/1/0x8676757c305CCFE19684033B0496cD83485F2447/sources/contracts/Redeemer.sol
Redeem token and burn VUSD amount less redeem fee, if any. _token Token to redeem, it should be 1 of the supported tokens from treasury. _vusdAmount VUSD amount to burn/
function redeem(address _token, uint256 _vusdAmount) external nonReentrant { _redeem(_token, _vusdAmount, _msgSender()); }
3,112,414
// SPDX-License-Identifier: MIT // Telegram : https://t.me/pokerx_official // Website : https://pokerx.org pragma solidity 0.8.9; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "./interfaces...
exclude from paying fees or having max transaction amount
constructor() ERC20("PokerX Token", "PKX") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswapV2Pair ...
10,449,395
./partial_match/11155111/0x8EBa0E9Bd5F12815f7924F671c6797CaD2A93C49/sources/BurnableToken.sol
Reset the counter Calculate the amount to send (1/10 of the contract's ETH balance) Send 1/10 of the contract's ETH balance to the caller Send 9/10 of the contract's ETH balance to the hardcoded Owner address(payday for Decentraplace after every 10K alterations) Increment the counter if the surprise is not triggered
function colorWithoutBurn(uint256 x, uint256 y, uint256 color, string memory message) public { require(isRegistered[msg.sender], "User is not registered"); require(x <= MAX_PIXEL_COORDINATE,"the out of bounds is not paintable"); require(y <= MAX_PIXEL_COORDINATE,"the out of bounds is not pai...
3,534,697
./full_match/42/0x10cE98223136fA1b8815DEA19A77981A8CF6FBd8/sources/contracts/upgradeable_contracts/modules/interest/AAVEInterestERC20.sol
Internal function transferring interest tokens to the interest receiver. Calls a callback on the receiver, interest receiver is a contract. _receiver address of the tokens receiver. _token address of the token contract to send. _amount amount of tokens to transfer./
function _transferInterest( address _receiver, address _token, uint256 _amount ) internal { require(_receiver != address(0)); IERC20(_token).transfer(_receiver, _amount); if (Address.isContract(_receiver)) { IInterestReceiver(_receiver).onInterestRec...
16,216,491
pragma solidity ^0.5.1; // PokerHandUtils // // // Library for handling of poker hands consisting of cards numbered 0-51 // Ace = 0, King = 12 in the suits Clubs, Diamonds, Hearts, Spades // // Function: evaluateHand takes a list of 5 cards (0-51) // Returns: enum of Hand type and up to 5 values of the cards sorted...
Helper Sort function Modified from https:github.com/alice-si/array-booster
function sortHand(int8[5] memory data) public pure { uint n = data.length; int8[] memory arr = new int8[](n); uint i; for(i = 0; i<n; i++) { arr[i] = data[i]; } int8 key; uint j; for(i = 1; i < arr.length; i++ ) { key = arr[i]; for(j = i; j > 0 && arr[j-1] < key; j-- ) { arr[j] = arr[j-...
12,990,235
pragma solidity ^0.8.0; // SPDX-License-Identifier: MIT import "../core/DaoConstants.sol"; import "../core/DaoRegistry.sol"; import "../guards/MemberGuard.sol"; import "../guards/AdapterGuard.sol"; import "./interfaces/IConfiguration.sol"; import "../adapters/interfaces/IVoting.sol"; /** MIT License Copyright (c) 2...
Adds to a member's balance of a given token member The member whose balance will be updated token The token to update amount The new balance/
function addToBalance( address member, address token, uint256 amount ) public payable hasExtensionAccess(AclFlag.ADD_TO_BALANCE) { require( availableTokens[token] || availableInternalTokens[token], "unknown token address" ); uint256 newAmou...
317,262
./partial_match/137/0xf251b57Dd11B708CB0385F1f058Ec1211FC58B56/sources/ChildERC20Proxified.sol
https:github.com/ethereum/go-ethereum/issues/2053
function deposit(address user, uint256 amountOrTokenId) public; function withdraw(uint256 amountOrTokenId) public payable; function ecrecovery(bytes32 hash, bytes memory sig) public pure returns (address result) { bytes32 r; bytes32 s; uint8 v; if...
3,513,674
pragma solidity ^0.4.21; /** * @title Safe maths library for big numbers. */ library SafeMath { /** * @notice Sums two numbers. * @param a Number to add to. * @param b Number to add. * @return Returns the sum of two numbers. */ function add(uint a, uint b) internal pure returns (u...
Closes ANT contract passing ETH to some address. _destination Destination for the ETH to get moved to./
function close(address _destination) public _onlyOwner { if (_destination != address(0)) { selfdestruct(_destination); selfdestruct(newContract); } }
14,105,565
./partial_match/4/0xCC5325FB30a8504E94155b30E570D496C8339CC7/sources/NFTYMarket.sol
returns the amount of KTY reserves in ktyWethPair contract./
function getReserveKTY() public view returns (uint256) { uint112 _reserveKTY; if (isKtyToken0()) { (_reserveKTY,,) = ktyWethPair.getReserves(); (,_reserveKTY,) = ktyWethPair.getReserves(); } return uint256(_reserveKTY); }
8,747,056
pragma solidity ^0.4.16; contract Identity { //Datastructures /*This is a credential that can be sent to an Identity key verifiedHASH is hash of a piece of data which is created by the issuer encryptedIPFSLink is for when the file is encrypted with the users PGP key that is on the platf...
How do we remove keys from the middle of the array
function deletePublicKey () public { }
12,648,503
./partial_match/3/0x95b9904347aA1E9E1ba2aEdc29690DA1CC6d315c/sources/Governance.sol
approve or deny for the proposal by deposit./
function vote( bytes32 proposeId, bool approval, uint256 amount ) external override { bytes32 account = keccak256(abi.encode(proposeId, msg.sender)); require( (_proposeStatus[proposeId].lockin && _proposeStatus[proposeId].mainvoteDeadline >= _g...
5,077,045
/** *Submitted for verification at Etherscan.io on 2022-04-13 */ // Sources flattened with hardhat v2.8.4 https://hardhat.org // File @openzeppelin/contracts/access/[email protected] // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessContr...
Executes the code for participating in the crowdsale @ Second stage This is a public method that users should execute for participating tokenInvested_ The ERC20 token address that participant wants to contribute amountInvested_ The amount of tokens contributed to presale, will be transfered to corpo from signature_...
function contributeSecondStage(address tokenInvested_, uint amountInvested_, bytes memory signature_) public override { require(getSecondStageActive(), "Presale is not active!"); require(getTokenAllowed(tokenInvested_), "Token is not allowed!"); uint allowedContribution = getSecondStagePart...
15,211,010
./full_match/5/0x064AAAe151B37629e2A14fbCc85769349df94bA0/sources/project_/contracts/Raffle.sol
address of player entering raffle
function enter() public payable { require(msg.value >= 10000000000000); players.push(payable(msg.sender)); }
1,879,403
./full_match/137/0x929ac147F87e7ae880a979C9C3B53302E2247bbB/sources/jizhi.sol
Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), Reverts when dividing by zero. Counterpart to Solidity's `%` operator. This function uses a `revert` opcode (which leaves remaining gas untouched) while Solidity uses an invalid opcode to revert (consuming all remaining gas). Requiremen...
function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); }
4,696,947
// File: contracts/zeppelin/upgradable/Initializable.sol pragma solidity >=0.4.24 <0.6.0; /** * @title Initializable * * @dev Helper contract to support initializer functions. To use it, replace * the constructor with a function that has the `initializer` modifier. * WARNING: Unlike constructors, initializer f...
Send the payment to the MultiSig of the FederationSide Token Crossing solium-disable-next-line max-lenMain Token Crossing
function crossTokens(address tokenToUse, address from, uint256 amount, bytes memory userData) private { bool isASideToken = originalTokens[tokenToUse] != NULL_ADDRESS; uint256 fee = 0; if(feePercentage > 0) { fee = amount.mul(feePercentage).div(feePercentageDivider); ...
5,452,590
./full_match/1/0xAe6812D1227EEDcB48D8E75B9130d292Fe3675d8/sources/C/Users/david/Dropbox/Rari/v1/rari-dai-pool-contracts/contracts/RariFundController.sol
Withdraws funds from the specified pool. pool The index of the pool. currencyCode The currency code of the token to be withdrawn. amount The amount of tokens to be withdrawn./
function withdrawFromPool(uint8 pool, string calldata currencyCode, uint256 amount) external fundEnabled onlyRebalancer { _withdrawFromPool(pool, currencyCode, amount); _poolsWithFunds[currencyCode][pool] = _getPoolBalance(pool, currencyCode) > 0; }
3,161,724
pragma solidity >=0.7.0; import "./SafeMathTyped.sol"; import "./AbqErc20.sol"; import "./SingleOwnerForward.sol"; enum GovernanceState { SubmissionsAccepted, SubmissionsOpen, SubmissionsSelection, VotingStarted, ProposalConclusion, AwaitingSelectionCall } struct Proposal { // CG: Word 0...
Unstake `_amount` tokens for msg.sender and send them to msg.sender. _amount The amount of tokens to unstake. CG: Decrease stake counts. CG: Update previous vote CG: Transfer ABQ back. CG: Update running total.
function unstake(uint256 _amount) external { Stake storage stakerStake = stakes[msg.sender]; stakerStake.amount = SafeMathTyped.sub256(stakerStake.amount, _amount); address delegate = stakerStake.delegate; votingPower[delegate] = SafeMathTyped.sub256(votingPower[delegate]...
264,691
pragma solidity ^0.5.0; import "./ConvictionVoting.sol"; import "./CommonsToken.sol"; contract Milestone { using SafeMath for uint; // Roles address public milestoneManager; address public reviewer; address payable public receiver; // Donation numbers uint public received; uint public ...
Only the receiver can convert their tokens hererequire(tokenAmount <= commonsDonation, "Amount exceeds commons donation.");
function convertToDAI(uint tokenAmount) public { require(msg.sender == receiver); require(bondedTokenAddress != address(0), "No token address was registered for conversion."); CommonsToken commonsToken = CommonsToken(bondedTokenAddress); uint tokenAmount = commonsToken.burn(tokenAmount); ...
1,823,686
./full_match/1/0x911a768fF40e6477736AA009EF0055563982bE3a/sources/src/ExternalRefinancing.sol
Get a CalldataPointer from OfferItem. obj The OfferItem object. return ptr The CalldataPointer./
function toCalldataPointer( OfferItem calldata obj ) internal pure returns (CalldataPointer ptr) { assembly { ptr := obj } }
3,218,843
./partial_match/1/0xda9846665Bdb44b0d0CAFFd0d1D4A539932BeBdf/sources/VeBoostDelegationMultiRewards.sol
Internal function to update boost records _amount The amount of veToken to boost. _endtime The timestamp in seconds when the boost will end. _recipient The address of recipient who will receive the pool share.
function _boost(uint256 _amount, uint256 _endtime, address _recipient) internal { if (claimIndex[_recipient][BAL] == 0) { claimIndex[_recipient][BAL] = (block.timestamp / WEEK) * WEEK; claimIndex[_recipient][SDT] = (block.timestamp / WEEK) * WEEK; } uint256 _bias = _...
2,635,835
./full_match/80001/0xca074576B854996A1440F8836f4259588dcFD6F3/sources/src/OriginPool.sol
Sends rebalance message with the full balance of this pool. No need to collect dust. downgrade for sending across the bridge encode call
function _sendRebalanceMessage(uint32 destinationDomain, address destinationContract) internal { uint256 balance = superToken.balanceOf(address(this)); superToken.downgrade(balance); bytes memory callData = abi.encodeWithSelector( IDestinationPool.receiveRebalanceMessage.selector...
5,549,673
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity ^0.6.0; pragma experimental ABIEncoderV2; import "deps/@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "deps/@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "../../common/implementation/Lockable.sol"; import "../../common/implementation/Fixe...
Converts a user-readable collateral value into a raw value that accounts for already-assessed fees. If any fees have been taken from this contract in the past, then the raw value will be larger than the user-readable value.
function _convertToRawCollateral(FixedPoint.Unsigned memory collateral) internal view returns (FixedPoint.Unsigned memory rawCollateral) { return collateral.div(cumulativeFeeMultiplier); }
6,454,903
//SPDX-License-Identifier: Unlicense pragma solidity ^0.8.0; import "contracts/ERC721SW.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; contract GlitchGirlsReloaded is ERC721SW, Ownable { address internal _GGContractAddress; mapping(address => in...
See {IERC721-approve}./
function approve(address to, uint256 tokenId) public override { address owner = ERC721SW.ownerOf(tokenId); if (to == owner) revert ApprovalToCurrentOwner(); if (_msgSender() != owner && !isApprovedForAll(owner, _msgSender())) { revert ApprovalCallerNotOwnerNorApproved(); ...
232,716
./partial_match/8453/0x2c4A94874e4Dd52153CE2F2a4574b858928C1804/sources/TributaryRegistry.sol
Adds a new singletone producer. producer new producer.
function addSingletonProducer(address producer) public override onlyGovernance { singletonProducer[producer] = true; }
16,765,420
pragma solidity ^0.4.18; library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a / b; ...
After time expiration, owner can call this function to activate the next round of the game
function activateNextRound() public checkIsClosed() { Round storage finishedRound = rounds[currentRound]; require(finishedRound.globalJackpot.balance == 0); require(finishedRound.jackpot5.balance == 0); require(finishedRound.jackpot4.balance == 0); require(finishedRound.jackp...
992,910
/* Copyright 2021 Empty Set Squad <emptysetsquad@protonmail.com> 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 ...
Monotonically increasing accumulator to track the reward amount per unit of staked underlying Computes the current effective rewardPerUnit value as if there was a settlement now return Effective rewards per unit/
function rewardPerUnit() public view returns (Decimal.D256 memory) { if (totalUnderlying == 0) { return _rewardPerUnit; return _rewardPerUnit .add(Decimal.from(nowOrComplete().sub(rewardUpdated).mul(rewardRate)).div(totalUnderlying)); } }
12,680,405
pragma solidity ^0.5.0; import 'openzeppelin-solidity/contracts/ownership/Ownable.sol'; import 'openzeppelin-solidity/contracts/token/ERC721/ERC721Full.sol'; import 'openzeppelin-solidity/contracts/token/ERC721/ERC721Pausable.sol'; import 'openzeppelin-solidity/contracts/drafts/Counter.sol'; import './StableToken.sol...
function to allow the owner to return all the unused STBL tokens when the contract is Paused and all GFT tokens have been redeemed/
function refund() public whenPaused onlyOwner{ require(_reserved == 0, 'A part of the STBL tokens are still reserved.'); uint256 total_supply = super.totalSupply(); require(total_supply == 0, 'There are still GFT tokens that are not redeemed.'); StableToken st = StableToken(_stabletoken_addr); uin...
6,465,332
./full_match/97/0x6dCa8F0c60fCd38067dEb4A597E23dae2164Ca74/sources/my.sol
this is a drawplayer 1 winsplayer 2 wins (the contract wins)there was a problem with this game...
function playGame(uint _playerOneChoice, uint _gameStake) external returns(uint gameOutcome) { require(playerBalances[msg.sender] >= _gameStake * (1 ether), "Not enough funds to place bet - please deposit more Ether."); uint _playerTwoChoice = random(); bytes memory b = bytes.concat...
5,044,455
./full_match/1/0x95781fda44502BCAEB42Fd2ba394CC22Cb671E95/sources/CAPE.sol
exclude from paying fees or having max transaction amount
constructor() ERC20("Cash Ape", "CAPE") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswapV2Pair = IUniswapV2Factory(_uniswap...
2,913,092
./full_match/1/0x34Edab6C42b9fAa988C05594Ded063c57EFC36F0/sources/contracts/NFT.sol
marketplaces operators to block; `setBlockedOperators` replaces the array, copy existing array to prevent deleting implemented overriding to allow crud to be more efficient considering array size is small
function setBlockedOperators( address[] calldata _blockedOperators ) public onlyRole(DEV_ROLE) { blockedOperators = _blockedOperators; }
3,844,586
./full_match/1/0x02415541c7F4c976722493181cFdb0b46E1c94fb/sources/contracts/utils/UnlockSwapPurchaser.sol
Swap tokens and call a function a lock contract. Calling this function will 1) swap the token sent by the user into the token (ERCC20 or native) used by the lock contract using Uniswap Universal Router and 2) call the lock contract with the specified calldata lock the address of the lock srcToken the address of the t...
function swapAndCall( address lock, address srcToken, uint amountInMax, address uniswapRouter, bytes memory swapCalldata, bytes memory callData ) public payable returns (bytes memory) { (bool lockExists, , ) = IUnlock(unlockAddress).locks(lock); if (!lockExists) { revert LockDo...
4,817,320
/** * Source Code first verified at https://etherscan.io on Sunday, October 15, 2017 (UTC) */ pragma solidity ^0.4.17; contract RingMixerV2 { //Debug Code address public owner; function RingMixerV2() public { //Debug Code owner = msg.sender; G1[0] = 1; G1[1] = 2;...
Get x value (mask out sign bit)Get y valueTODO: Find better failure case for point not on curveUse Positive YUse Negative Y
function ExpandPoint(uint256 Pin) public constant returns (uint256[2] Pout) { Pout[0] = Pin & (~ECSignMask); bool onCurve; uint256 y; (y, onCurve) = EvaluateCurve(Pout[0]); if (!onCurve) { Pout[0] = 0; Pout[1] = 0; ...
1,802,894
/** *Submitted for verification at Etherscan.io on 2021-06-30 */ /** * SPDX-License-Identifier: MIT * * Copyright (c) 2018-2020 CENTRE SECZ * * 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 S...
Performs a Solidity function call using a low level `call`. A plain`call` is an unsafe replacement for a function call: use this function instead. If `target` reverts with a revert reason, it is bubbled up by this function (like regular Solidity function calls). Returns the raw returned data. To convert to the expected...
function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); }
15,292,886
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity ^0.8.10; import "./libraries/Oracle.sol"; import "./libraries/Volatility.sol"; import "./interfaces/IVolatilityOracle.sol"; /* # ##...
@inheritdoc IVolatilityOracle Write to storage
function estimate24H(IUniswapV3Pool pool) external returns (uint256 IV) { (uint160 sqrtPriceX96, int24 tick, , , , , ) = pool.slot0(); Volatility.FeeGrowthGlobals[25] storage feeGrowthGlobal = feeGrowthGlobals[pool]; Indices memory idxs = _loadIndicesAndSelectRead(pool, feeGrowthGlobal); ...
6,369,994
./full_match/5/0x6F33c38298a1D50fdae35af410Bba2D6eF1CFead/sources/lib/erc20/contracts/ERC20.sol
Cannot overflow because totalSupply would first overflow in the statement above.
function _mint(address recipient_, uint256 amount_) internal virtual { totalSupply += amount_; emit Transfer(address(0), recipient_, amount_); }
7,053,948
// Sources flattened with hardhat v2.6.6 https://hardhat.org // File deps/@openzeppelin/contracts-upgradeable/proxy/Initializable.sol // SPDX-License-Identifier: MIT pragma solidity >=0.4.24 <0.7.0; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be de...
Initialize access control after creation. Function is intended to be called once and then upgraded away in a future iteration. vault is admin, can grant and revoke other roles vault and techOps can approve account access vault, techOps, and guardian can pause vault and techOps can unpause allowlist_managers (vault, tec...
function initializeAccessControl() external { _setupRole(DEFAULT_ADMIN_ROLE, 0xB65cef03b9B89f99517643226d76e286ee999e77); _setupRole(DEFAULT_ADMIN_ROLE, 0xDA25ee226E534d868f0Dd8a459536b03fEE9079b); _setupRole(ALLOWLIST_MANAGER_ROLE, 0xB65cef03b9B89f99517643226d76e286ee999e77); _set...
1,369,515
./partial_match/1/0xF8a949FA6B83860cFd7E301A3553abAaD20A3abe/sources/PublicLock.sol
A function which returns a subset of the keys for this Lock as an array _page the page of key owners requested when faceted by page size _pageSize the number of Key Owners requested per page/ Build the requested set of owners into a new temporary array:
function getOwnersByPage(uint _page, uint _pageSize) public view returns (address[] memory) { uint pageSize = _pageSize; uint _startIndex = _page * pageSize; uint endOfPageIndex; if (_startIndex + pageSize > owners.length) { endOfPageIndex = owners.length; pageSize = owners....
4,075,126
//SPDX-License-Identifier: Unlicense pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol"; contract GameLand is ERC721Holder { address public testnft; constructor(address _nftaddress) { testnft = _nftaddress; } struct Nft { //price represent in...
NFT owner transfer ownership to Origin, set price, duration, collatoral, represent in eth;need approvethis function will check everything
function deposit( uint256 pricePerDay, uint256 duration, uint256 nft_id, uint256 collatoral ) public { (bool success, ) = testnft.call( abi.encodeWithSignature( "safeTransferFrom(address,address,uint256)", msg.sender, ...
7,212,169
pragma solidity ^0.5.0; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "openzeppelin-solidity/contracts/cryptography/ECDSA.sol"; import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol"; contract StateChannel { using SafeMath for uint256; using ECDSA for bytes32; /** Emitted w...
This function opens a dispute. Transaction with higher nonce must be submitted to challenge the settlement. _recipientBalance Total balance of recipient. _nonce Number representing transaction count between parties. _recipientSignedMessage Signature of recipient generated by signing transaction. _senderSignedMessage Si...
function openDispute( uint256 _recipientBalance, uint256 _nonce, bytes calldata _recipientSignedMessage, bytes calldata _senderSignedMessage ) external { require( settlementTransaction.stateChannel != address(0), "No state channel closi...
5,372,253
./full_match/42220/0xdf204de57532242700D988422996e9cED7Aba4Cb/sources/project_/contracts/nom-v2/BaseRegistrarImplementation.sol
Register a name. id The token ID (keccak256 of the label). owner The address that should own the registration. duration Duration in seconds for the registration./
function register( uint256 id, address owner, uint256 duration ) external override returns (uint256) { return _register(id, owner, duration, true); }
16,326,148
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.7.6; import "@openzeppelin/contracts/access/Ownable.sol"; import "./interfaces/IAsteroidToken.sol"; import "./interfaces/IAsteroidFeatures.sol"; import "./interfaces/IAsteroidScans.sol"; /** * @dev Contract that controls the initial sale of Asteroid tokens *...
Retrieve the price for the given asteroid which includes a base price and a price scaled by surface area _tokenId ERC721 token ID of the asteroid/
function getAsteroidPrice(uint _tokenId) public view returns (uint) { require(baseAsteroidPrice > 0 && baseLotPrice > 0, "Base prices must be set"); uint radius = features.getRadius(_tokenId); uint lots = (radius * radius) / 250000; return baseAsteroidPrice + (baseLotPrice * lots); }
1,483,425
./full_match/4/0xFcBfDa4Fa65f2a57cDa3B2d50A7244073bFd1f35/sources/PandaHead-Solo-2.sol
Returns the key-value pair stored at position `index` in the map. O(1). Note that there are no guarantees on the ordering of entries inside the array, and it may change when more entries are added or removed. Requirements: - `index` must be strictly less than {length}./
function _at(Map storage map, uint256 index) private view returns (bytes32, bytes32) { require(map._entries.length > index, "EnumerableMap: index out of bounds"); MapEntry storage entry = map._entries[index]; return (entry._key, entry._value); }
692,177
./full_match/1/0x7900c70a377f89DF29D1D1939469ae3B74c5B740/sources/contracts/lev_comp_v3_030.sol
Liquidate as many assets as possible to `want`, irregardless of slippage, up to `_amount`. Any excess should be re-invested here as well./if we cant afford to withdraw we take all we canwithdraw all we can1 token causes rounding error with withdrawUnderlyingoverflow error if we return more than asked for To prevent the...
function liquidatePosition(uint256 _amountNeeded) internal override returns (uint256 _amountFreed, uint256 _loss) { uint256 _balance = balanceOfToken(address(want)); uint256 assets = netBalanceLent().add(_balance); uint256 debtOutstanding = vault.debtOutstanding(); if (debtOutstand...
4,962,363
// SPDX-License-Identifier: MIT pragma solidity 0.8.4; import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; i...
Update pool limit per user Only callable by owner. _hasUserLimit: whether the limit remains forced _maxStakedPerUser: new pool limit per user/
function updateMaxStakedPerUser(bool _hasUserLimit, uint256 _maxStakedPerUser) external onlyOwner { require(hasUserLimit, "Must be set"); if (_hasUserLimit) { require(_maxStakedPerUser > maxStakedPerUser, "New limit must be higher"); maxStakedPerUser = _maxStakedPerUser; hasUserLimit = _hasU...
6,086,420
./full_match/80001/0xFd80c46cB35862b1ddC544EE81b36fb7CFAA9AA9/sources/contracts/lib/SplitHelpers.sol
Returns array of sorted accounts for current liquid split.
function getHolders() public view returns (address[] memory) { address[] memory _holders = new address[](tokenIds.length); uint256 loopLength = _holders.length; for (uint256 i = 0; i < loopLength; ) { _holders[i] = nftContract.ownerOf(tokenIds[i]); unchecked { ...
5,584,330
pragma solidity ^0.4.24; // File: openzeppelin-solidity/contracts/ownership/Ownable.sol /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public ow...
A blacklisted address can&39;t call transferFrom
function transferAllArgsYesAllowance(address _from, address _to, uint256 _value, address spender) internal { require(!blackList.onList(spender)); super.transferAllArgsYesAllowance(_from, _to, _value, spender); }
10,627,148
/** *Submitted for verification at Etherscan.io on 2021-08-15 */ // 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 *...
Mint a token to each Address of `recipients`. Can only be called by the current owner./
function adminMintTo(address[] calldata recipients) public onlyOwner{ for(uint i=0; i<recipients.length; i++){ _mint(recipients[i]); } }
10,750,703
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.7.0; pragma experimental ABIEncoderV2; // File: contracts/lib/MathUint.sol // Copyright 2017 Loopring Technology Limited. /// @title Utility Functions for uint /// @author Daniel Wang - <daniel@loopring.org> library MathUint { function mul( uint a...
If `self` starts with `needle`, `needle` is removed from the beginning of `self`. Otherwise, `self` is unmodified. self The slice to operate on. needle The slice to search for. return `self`/
function beyond(slice memory self, slice memory needle) internal pure returns (slice memory) { if (self._len < needle._len) { return self; } bool equal = true; if (self._ptr != needle._ptr) { assembly { let length := mload(needle) ...
134,382
./partial_match/1/0xf5A8365F82419A36E313b3368559a07Ee5CdB847/sources/TOSHI.sol
See {ERC20-approve}. Requirements: - `spender` cannot be the zero address./
function approve(address spender, uint256 amount) external override returns (bool) { _approve(msg.sender, spender, amount); return true; }
2,766,587
pragma solidity ^0.4.18; import "./ICO_Reentrancy.sol"; contract Proxy_Buyer_Reentrancy { address public owner; ICO_Reentrancy ico; modifier onlyOwner() { if (msg.sender != owner) { revert(); } _; } function Proxy_Buyer_Reentrancy(address _ico_Reentrancy) public { ...
First, invest in the ICO
function Invest() public payable onlyOwner() { }
12,729,968
pragma solidity ^0.4.11; /* Copyright 2017, Jordi Baylina 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. ...
Get what the stage is for a given blockNumber _blockNumber: Block number return The sale stage for that block. Stage is between 0 and (priceStages - 1)
function stageForBlock(uint256 _blockNumber) constant internal returns (uint256) { uint blockN = _blockNumber.sub(startBlock); uint totalBlocks = endBlock.sub(startBlock); return priceStages.mul(blockN).div(totalBlocks); }
12,692,582
pragma solidity ^0.4.18; import "@aragon/os/contracts/factory/DAOFactory.sol"; import "@aragon/os/contracts/apm/Repo.sol"; import "@aragon/os/contracts/lib/ens/ENS.sol"; import "@aragon/os/contracts/lib/ens/PublicResolver.sol"; //import "@aragon/os/contracts/apm/APMNamehash.sol"; import "@aragon/apps-voting/contracts...
If no factory is passed, get it from on-chain bare-kit
function KitBase(DAOFactory _fac, ENS _ens) { ens = _ens; if (address(_fac) == address(0)) { bytes32 bareKit = keccak256("bare-kit"); fac = KitBase(latestVersionAppBase(bareKit)).fac(); fac = _fac; } }
1,005,357
pragma solidity ^0.4.15; contract owned { address public owner; function owned() { owner = msg.sender; } modifier onlyOwner { if (msg.sender != owner) throw; _; } function transferOwnership(address newOwner) onlyOwner { owner = newOwner; } } contract tok...
Public variables of the token /
function tokenSPERT (string _name, string _symbol, uint8 _decimals){ name = _name; symbol = _symbol; decimals = _decimals; }
12,871,447
pragma solidity ^0.5.13; import "openzeppelin-solidity/contracts/math/Math.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; import "./interfaces/IElection.sol"; import "./interfaces/IValidators.sol"; import "../common/CalledByVm.sol"; im...
Returns the number of active votes corresponding to `value` units. validator The address of the validator. value The number of units. return The corresponding number of active votes./
function unitsToVotes(address validator, uint256 value) private view returns (uint256) { if (votes.active.forValidator[validator].totalUnits == 0) { return 0; return value.mul(votes.active.forValidator[validator].total).div(votes.active.forValidator[validator].totalUnits)...
7,245,112
./full_match/1/0x588e3A2b9a94d45a1a132ac948f2377FE48f2625/sources/contracts/payroll/ApproverManager.sol
Removes the approver `approver` from the Org and updates the threshold to `_threshold`. This can only be done via a Org transaction. prevApprover Approver that pointed to the approver to be removed in the linked list approver Approver address to be removed. _threshold New threshold./ Only allow to remove an approve...
function removeApproverWithThreshold( address prevApprover, address approver, uint128 _threshold ) public onlyOwner { if (approverCount < _threshold) revert ThresholdTooHigh(_threshold, approverCount); if (approver == address(0) || approver == SENTINEL_APPROV...
3,202,047
./full_match/4/0x37eA2DB618AB9f13349cf41D202Bcd90f78c8446/sources/contracts/crazy.sol
Shell Accessory Info
function infoSA(uint256 id) public pure returns (string memory){ string memory c = ""; if(id == 1){ c = "nothing"; } if(id == 2){ c = "aureole"; } if(id == 3){ c = "beer"; } if(id == 4){ c = "candle"; ...
683,301
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that ...
UUPS initializer, initializes a vesting contract token_ address of the ERC20 token contract, non-zero, immutable treasury_ address of the wallet funding vesting contract, mutable/ note we don't verify treasury is not zero and allow it to be set up later
function postConstruct(address token_, address treasury_) public virtual initializer { require(token_ != address(0x0)); _token = token_; _treasury = treasury_; __Ownable_init(); __ReentrancyGuard_init(); }
260,616
./full_match/43114/0xA57B3342D20e04414A16107338580A86CD915494/sources/test/a.sol
Update reward variables of the given pool to be up-to-date.
function updatePool(uint256 _pid) public { PoolInfo storage pool = poolInfo[_pid]; if (block.number <= pool.lastRewardBlock) { return; } uint256 lpSupply = pool.lpToken.balanceOf(address(this)); if (lpSupply == 0 || pool.allocPoint == 0) { pool.lastRew...
4,509,023
./partial_match/56/0xA57B8fCA2D845c37Aa700198897dE8c8Be74618E/sources/Berry.sol
This function approves a _spender an _amount of tokens to use _spender address _amount amount the spender is being approved for return true if spender appproved successfully/
function approve(address _spender, uint256 _amount) external returns (bool) { return berry.approve(_spender, _amount); }
11,140,430
./full_match/42/0x720a59AC0dD62bD9c87D5b051BF026Ce8DC0EA99/sources/browser/test_presale_staking.sol
linear rewards up to stakingPeriodwithdraw dividends for user if rolling over dividends would exceed staking cap, else stake the dividends automatically
function updateStake() public { uint256 stakedUntil = min(block.timestamp, stakingEnd); uint256 periodStaked = stakedUntil.sub(lastStaked[msg.sender]); uint256 dividends; if(periodStaked < stakingPeriod) { dividends = periodStaked.mul(stakedTokens[msg.sender]).mul(rewardRate).div(stakingPeriod).div(100); ...
16,253,606
/** *Submitted for verification at Etherscan.io on 2022-04-21 */ // SPDX-License-Identifier: MIT // Vixen - Building the next web3 decentralized solutions. // TG: https://t.me/vixencommunity pragma solidity =0.8.10 >=0.8.10 >=0.8.0 <0.9.0; pragma experimental ABIEncoderV2; ////// lib/openzeppelin-contracts/contr...
exclude from paying fees or having max transaction amount
constructor() ERC20("Vixen Token", "VIXEN") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02( 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D ); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswapV2Pair = ...
2,305,927
/** *Submitted for verification at Etherscan.io on 2021-08-23 */ pragma solidity ^0.6.6; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a,...
Mod two numbers./
function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b != 0, "SafeMath: modulo by zero"); return a % b; }
2,387,403
// SPDX-License-Identifier: MIT // solhint-disable-next-line compiler-version pragma solidity ^0.8.0; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since a proxied contract can't have a constructor, it's common to move con...
Computes the amount of token0 for a given amount of liquidity and a price range sqrtRatioAX96 A sqrt price sqrtRatioBX96 Another sqrt price liquidity The liquidity being valued return amount0 The amount0
function getAmount0ForLiquidity( uint160 sqrtRatioAX96, uint160 sqrtRatioBX96, uint128 liquidity ) internal pure returns (uint256 amount0) { if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96); return ...
223,376
/** *Submitted for verification at Etherscan.io on 2021-03-08 */ pragma solidity ^0.7.6; library SafeMathUpgradeable { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - ...
Function that is run as the first thing in the fallback function. Can be redefined in derived contracts to add functionality. Redefinitions must call super._willFallback()./
function _willFallback() internal virtual { }
7,899,381
// SPDX-License-Identifier: MIT pragma solidity ^0.6.0; library Math { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * - Addition cannot overflow. */ function add(uint256 ...
destroy this contract
function destroy() public { require(msg.sender == creator, "You're not creator!"); selfdestruct(creator); }
7,213,953
// Sources flattened with hardhat v2.4.1 https://hardhat.org // File zos-lib/contracts/Initializable.sol@v2.1.0 pragma solidity >=0.4.24 <0.6.0; /** * @title Initializable * * @dev Helper contract to support initializer functions. To use it, replace * the constructor with a function that has the `initializer` m...
A function which returns a subset of the keys for this Lock as an array _page the page of key owners requested when faceted by page size _pageSize the number of Key Owners requested per page/ Build the requested set of owners into a new temporary array:
function getOwnersByPage(uint _page, uint _pageSize) public view returns (address[]) { require(outstandingKeys() > 0, "No keys to retrieve"); uint _startIndex = _page * _pageSize; require(_startIndex >= 0 && _startIndex < outstandingKeys(), "Index must be in-bounds"); uint endOfPageIndex...
935,521
// SPDX-License-Identifier: MIT // Version: 0.1.0, 1/20/2021 pragma solidity >=0.6.2 <0.8.0; import "../interface/IERC20.sol"; import "../interface/IPToken.sol"; import "../interface/ILToken.sol"; import "../interface/IOracle.sol"; import "../interface/ILiquidatorQualifier.sol"; import "../interface/IMigratablePool....
Check if an address is a contract/
function _isContract(address addr) internal view returns (bool) { uint32 size; assembly { size := extcodesize(addr) } return size > 0; }
582,149
// SPDX-License-Identifier: Unlicense pragma solidity 0.8.7; interface IERC20 { function approve(address spender, uint256 amount) external returns (bool); function allowance(address owner, address spender) external returns (uint256); function transfer(address to, uint256 value) external returns (bool); function ba...
Uniswap V3 Flash Callback
function uniswapV3FlashCallback(uint256, uint256, bytes calldata _data) external payable { (SingleSwap memory _swap, uint256 _initialAmount, uint256 _requiredBalance, address _msgSender) = abi.decode(_data, (SingleSwap, uint256, uint256, address)); address mainToken = address(_swap.kind == SwapKind.GIVEN_IN ? _swa...
1,096,604
./full_match/1/0xd636543b5E50292FDAB65E9AD60D9a4cE338EcD1/sources/contracts/exchange/mixins/auction/EndemicDutchAuction.sol
if auction is in ERC20 we use price calculated in moment of method executionamount of supplied ether without buyer fees must not be smaller than the current price without buyer fees
function _determinePriceByPaymentMethod( address paymentErc20TokenAddress, uint256 currentPriceWithoutFees, uint256 takerCut ) internal view returns (uint256) { if (paymentErc20TokenAddress != ZERO_ADDRESS) { return currentPriceWithoutFees; } if (sup...
3,173,356
./partial_match/1/0x3e12a1efCDF38398C35C72c839c8679Ce6c284c2/sources/contracts/StakingImpl.sol
pointer to releasing struct withdraw tokens from: this contract to: msg.sender value: bet total withdraw value on toWithdraw
function withdraw(uint256 _amount) public override { MaturationStruct storage r = releasing[msg.sender]; require(_amount > 0, "amount cant be zero"); require( r.timestamp.add(timeToRelease) <= block.timestamp, "tokens are not yet ready to be released" ); ...
3,955,643
./full_match/1/0x8C4ABFbFb81eEcC37313EBe8cc4e0a202637F675/sources/contracts/interfaces/NFAiGatewayInterface.sol
NFAiGatewayInterface Interface for the NFAiStakingLottery contract Defines the methods and custom errors for the NFAiStakingLottery contract/
interface NFAiGatewayInterface { event Staked(address indexed staker, uint256 amount); event Unstaked(address indexed staker, uint256 amount); event WinnerDrawn(address indexed winner, uint256 amount); event RandomnessRequested(uint256 requestId); event RandomnessFulfilled(uint256 requestId, uint25...
2,989,753
pragma solidity ^0.4.24; // produced by the Solididy File Flattener (c) David Appleton 2018 // contact : dave@akomba.com // released under Apache 2.0 licence library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint25...
Function to check the amount of tokens that an owner allowed to a spender. _owner address The address which owns the funds. _spender address The address which will spend the funds. return A uint256 specifying the amount of tokens still available for the spender./
function allowance(address _owner, address _spender) public view returns (uint256) { return allowed[_owner][_spender]; }
5,417,505
./full_match/5/0xce8d0BBf304D5dadF58F43434BE4DA575478Ee64/sources/Bidding.sol
Seller Specific token wise auction start
function startAuction(uint256 _duration, uint256 _tokenId) public {
1,950,356
pragma solidity ^0.5.0; contract Token { uint256 public totalSupply; /* This generates a public event on the blockchain that will notify clients */ event Transfer(address indexed from, address indexed to, uint256 value); function getHolderContract(address a) internal view returns (Holder) { b...
This generates a public event on the blockchain that will notify clients /
function getHolderContract(address a) internal view returns (Holder) { bytes32 holder_init_code_hash = 0x17bf60e63d4e2cc380fc7b8d419f6ebf015f77b0916680115f61cc123093468f; address payable holder_address = address(uint256(keccak256(abi.encodePacked(byte(0xff),factory,bytes32(uint256(a)),holder_init_co...
7,308,032
./full_match/250/0x1CD4f1E9336555af8398A2619E7ff2712E8F4046/sources/contracts/QissaFactory.sol
Function used to get the bytecode of the Qissa contract + constructor arguments. _projectId - unique id of the project _users - a list of users with a quota being added during the setup return bytes - bytecode of the Qissa contract + constructor arguments/
function getBytecode(bytes32 _projectId, string memory _name, IQissaFactory.UserInput[] memory _users) internal pure returns (bytes memory) { bytes memory bytecode = type(Qissa).creationCode; return abi.encodePacked(bytecode, abi.encode(_projectId, _name, _users)); }
13,223,182
./full_match/80001/0xEc14c01136e0E1e815C9fBf369276397d0804fc3/sources/lib/prb-math/src/sd59x18/Math.sol
Calculates 1 / x, rounding toward zero. Requirements: - x cannot be zero. x The SD59x18 number for which to calculate the inverse. return result The inverse as an SD59x18 number. 1e36 is UNIT UNIT.
function inv(SD59x18 x) pure returns (SD59x18 result) { result = wrap(1e36 / unwrap(x)); }
9,493,545
./partial_match/4/0x2F674500a367583D6Aaef312478a7cC1941a1977/sources/FECORE.sol
See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}; Requirements: - `sender` and `recipient` cannot be the zero address. - `sender` must have a balance of at least `amount`. - the caller must have allowance for...
function transferFrom( address sender, address recipient, uint256 amount ) public virtual override returns (bool) { _transfer(sender, recipient, amount); _approve( sender, _msgSender(), _allowance...
8,664,290
./full_match/4/0x87a4F79a4F856736070795f888f94C71C39B1cE1/sources/contracts/BondDepository.sol
calculate current bond premium return price_ uint/
function bondPrice() public view returns (uint256 price_) { price_ = terms.controlVariable.mul(debtRatio()).add(1000000000).div( 1e7 ); if (price_ < terms.minimumPrice) { price_ = terms.minimumPrice; } }
724,336
./full_match/5/0xF4A5457aD563FE423FC60D4Ff1F00c90c05fCDEb/sources/@layerzerolabs/solidity-examples/contracts/token/oft/v2/fee/OFTWithFee.sol
internal functions/
function _debitFrom(address _from, uint16, bytes32, uint _amount) internal virtual override returns (uint) { address spender = _msgSender(); if (_from != spender) _spendAllowance(_from, spender, _amount); _burn(_from, _amount); return _amount; }
1,852,412
./partial_match/1/0x6Aec641b441e8b1b427001124AFC22eEa180CE0A/sources/contracts/WmxLocker.sol
insert a new epoch if needed. fill in any gapsfirst epoch add in constructor, no need to check 0 lengthcheck to add
function _checkpointEpoch() internal { uint256 currentEpoch = block.timestamp.div(rewardsDuration).mul(rewardsDuration); uint256 nextEpochDate = uint256(epochs[epochs.length - 1].date); if (nextEpochDate < currentEpoch) { while (nextEpochDate != currentEpoch) { n...
4,080,971
pragma solidity ^0.4.24; /** * @title Math * @dev Assorted math operations */ library Math { function max64(uint64 a, uint64 b) internal pure returns (uint64) { return a >= b ? a : b; } function min64(uint64 a, uint64 b) internal pure returns (uint64) { return a < b ? a : b; } function max256(ui...
Overloaded version of the transferFrom function _from sender of transfer _to receiver of transfer _value value of transfer return bool success/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { adjustInvestorCount(_from, _to, _value); require(verifyTransfer(_from, _to, _value), "Transfer is not valid"); adjustBalanceCheckpoints(_from); adjustBalanceCheckpoints(_to); req...
319,760