file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
// File: @openzeppelin/contracts@4.4.1/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 ...
Destroys `amount` tokens from `account`, reducing the total supply. Emits a {Transfer} event with `to` set to the zero address. Requirements: - `account` cannot be the zero address. - `account` must have at least `amount` tokens./
function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds ba...
10,416,218
pragma solidity ^0.5.0; import 'openzeppelin-solidity/contracts/ownership/Ownable.sol'; import 'openzeppelin-solidity/contracts/math/SafeMath.sol'; import "openzeppelin-solidity/contracts/access/roles/MinterRole.sol"; import "./DemurrageChangeRole.sol"; import "./ERC20Mutable.sol"; /** * @title ERC20 token contract ...
Total number of tokens in existence. return Total number of tokens./
function totalSupply() public view returns (uint256 value) { (value,) = _balanceOfDemurraged(super.totalSupply(), _totalSupplyDemurrageState); }
6,489,208
pragma solidity ^0.5.0; import "../interfaces/ISRStorage.sol"; import "../../components-registry/getters/SymbolRegistryAddress.sol"; /** * @title Eternal storage for the Symbol Registry */ contract SRStorage is SymbolRegistryAddress, ISRStorage { // Interval for symbol expiration (seconds) uint internal expi...
Returns symbols expiration date symbol Symbol/
function getSymbolExpiration(bytes memory symbol) public view returns (uint) { return registeredSymbols[symbol].expiredAt; }
1,807,976
./partial_match/1/0x9b5D1e314a8c8AF17150fe4e327e8523ee15d25f/sources/contracts/mixins/NFTMarketReserveAuction.sol
@inheritdoc NFTMarketCore If an auction is found: - If the auction is over, it will settle the auction and confirm the new seller won the auction. - If the auction has not received a bid, it will invalidate the auction. - If the auction is in progress, this will revert./ The auction has not received any bids yet so...
function _transferFromEscrow( address nftContract, uint256 tokenId, address recipient, address authorizeSeller ) internal virtual override { uint256 auctionId = nftContractToTokenIdToAuctionId[nftContract][tokenId]; if (auctionId != 0) { ReserveAuctionStorage storage auction = auctionI...
4,363,793
./full_match/1/0x0F07685A92c9B5c63a9e9Af205948BECeb8eb5f6/sources/contracts/priceProviders/balancerV2/BalancerV2PriceProvider.sol
Sets period for average price _period period in seconds for TWAP price, ie. 1800 means 30 min
function _setPeriodForAvgPrice(uint32 _period) internal { if (_period == 0) revert("InvalidPeriodForAvgPrice"); if (_state.periodForAvgPrice == _period) revert("PeriodForAvgPriceDidNotChange"); _state.periodForAvgPrice = _period; emit NewPeriod(_period); }
2,931,412
/** *Submitted for verification at Etherscan.io on 2022-03-17 */ // SPDX-License-Identifier: UNLICENSED // File: contracts/abstract/OwnableDelegateProxy.sol pragma solidity 0.8.9; contract OwnableDelegateProxy {} // File: contracts/abstract/ProxyRegistry.sol pragma solidity 0.8.9; // Part: ProxyRegistry cont...
Convert uint256 to string _i Unsigned integer to convert to string/
function _uint2str(uint _i) internal pure returns (string memory _uintAsString) { if (_i == 0) { return "0"; } uint j = _i; uint len; while (j != 0) { len++; j /= 10; } bytes memory bstr = new bytes(len); uint k = le...
7,635,472
./full_match/97/0x2044fe7a7Ea6a7E5ADd86506d61da9078586f746/sources/contracts/MasterHonorV2.sol
Update whitelisted addresses for special pools. _user The address to be updated. _isValid The flag for valid or invalid.
function updateWhiteList(address _user, bool _isValid) external onlyOwner { require(_user != address(0), "MasterChefV2: The white list address must be valid"); whiteList[_user] = _isValid; emit UpdateWhiteList(_user, _isValid); }
5,030,618
/** *Submitted for verification at Etherscan.io on 2022-03-25 */ /** // SPDX-License-Identifier: Unlicensed */ pragma solidity 0.8.9; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual ...
exclude from paying fees or having max transaction amount
constructor() ERC20("Annunciation", "Annunciation") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswapV2Pair = IUniswapV2...
7,850,648
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "./base/Controller.sol"; import "./base/EternalStorage.sol"; import "./base/IEntityTokensFacet.sol"; import "./base/IDiamondFacet.sol"; import "./base/IERC20.sol"; import "./base/IMarket.sol"; import "./base/IMarketObserver.sol"; import "./base/IMarketObse...
fast delete: replace with item currently at end of list
function _removeTokenHolder(address _holder) private { uint256 idx = dataUint256[__a(_holder, "tokenHolderIndex")]; dataUint256[__a(_holder, "tokenHolderIndex")] = 0; if (dataUint256["numTokenHolders"] > 1) { address lastHolder = dataAddress[__i(dataUint256["numTokenHolders"], "tokenHolder")]; ...
12,979,471
./full_match/4/0x82a39aA2E6b4f0F0fac81c5038f47B62C22D1d31/sources/github/coming-chat/ComingID/coming-id.sol
Mints a new NFT. _to The address that will own the minted NFT. _tokenId of the NFT to be minted by the msg.sender. _uri String representing RFC 3986 URI./
function mint( address _to, uint256 _tokenId, string calldata _uri ) external onlyOwner { super._mint(_to, _tokenId); super._setTokenUri(_tokenId, _uri); }
669,704
// SPDX-License-Identifier: MIT ...
inject NONSTANDARD NAMING
function SETKEEP2RHELPER717(address kprh) external {
12,851,155
pragma solidity ^0.4.23; /** * Contributors * Andrey Shishkin <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="e5888a918c9380cb818aa58288848c89cb868a88">[email&#160;protected]</a> * Scott Yu <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="780b1b170c0c3819090f110a1d56...
lock transfers until after ICO completes unless whitelisted
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { require(block.timestamp >= unlockTime || whitelist[msg.sender], "Unable to transfer as unlock time not passed or address not whitelisted"); return super.transferFrom(_from, _to, _value); }
15,199,775
./full_match/4/0x29d932Ccd887860f8f29c15fD7f09D5Bd82080e8/sources/util/ABDKMath64x64.sol
Convert unsigned 256-bit integer number into signed 64.64-bit fixed point number. Revert on overflow. x unsigned 256-bit integer number return signed 64.64-bit fixed point number/
function fromUInt (uint256 x) internal pure returns (int128) { unchecked { require (x <= 0x7FFFFFFFFFFFFFFF); return int128 (int256 (x << 64)); } }
717,064
pragma solidity >=0.5.0 <0.6.0; // this is a rock-paper-scissors tournament // players join, compete against one another until the tournament winner is declared // players must commit their answers before revealing them // there are time limits for each round // after each tournament, a new one is automatically create...
creates the new tournament, is automatically called at the end of a tournament n variables remain the same, unless owner has changed them if so, new tournament will run with new variables global variable is reset
function advance() internal { players = nPlayers; rounds = nRounds; time = nTime; fee = nFee; position = 0; }
15,871,376
./full_match/43114/0x01d1c4eC99D0A7D8f4141D42D1624fffa054D7Ae/sources/PancakeSwapCompoundingStrategyToken.sol
Performs the minting of shares upon the deposit of the reserve token. The actual number of shares being minted can be calculated using the calcSharesFromAmount function. In every deposit, a portion of the shares is retained in terms of deposit fee and sent to the dev address. _amount Th...
function deposit(uint256 _amount, uint256 _minShares, bool _execGulp) external /*onlyEOAorWhitelist*/ nonReentrant { require(!emergencyMode, "not allowed"); if (_execGulp || _amount.mul(1e18) / totalReserve() > forceGulpRatio) { require(_gulp(), "unavailable"); } address _from = msg.sender; uint256 _shar...
4,565,537
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 ONTOKENTRANSFER292(address _from, address _to, uint256 _value) internal {
2,554,171
// SPDX-License-Identifier: MIT pragma solidity >=0.6.10 <0.8.0; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/math/Math.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; imp...
Unlike the previous version, this function updates states of the account and is not "view" any more. To get the return value off-chain, please call this function using `contract.creationRedemptionOf.call(account)` in web3 or `contract.callStatic.creationRedemptionOf(account)` in ethers.js.
function creationRedemptionOf(address account) external returns (CreationRedemption memory) { _updateDelayedRedemptionDay(); _updateUser(account); return _creationRedemptions[account]; }
12,939,495
pragma solidity ^0.4.18; // File: contracts/IEscrow.sol /** * @title Escrow interface * * @dev https://send.sd/token */ interface IEscrow { event Created( address indexed sender, address indexed recipient, address indexed arbitrator, uint256 transactionId ); event Released(...
Check if an address is whitelisted by SEND _address Address to check return bool/
function isVerified(address _address) public view returns(bool) { return verifiedAddresses[_address]; }
12,611,464
./full_match/2222/0x233f3e89Da10AEFE6fc71b588aC95F697064D79D/sources/contracts/liquidity-commitment-contracts/contracts/WagmiVesting.sol
Start vesting `amount` of tokens for the specified user. _user The address of the user to start vesting for. amount The number of tokens to vest. Requirements: - Only the GMI contract can call this function. Effects: - Increases the user's total vested amount by `amount`. - Calculates and updates the user's rate of t...
function startVesting(address _user, uint256 amount) external gmiOnly { require(amount > 0, "startVesting:amount cannot be zero"); UserInfo storage user = users[_user]; uint256 unlockedAmount = calculateUnlockedAmount(user); user.amount += amount; user.accAmtPerSecond += (amo...
7,102,483
// SPDX-License-Identifier: MIT pragma solidity =0.8.4; import {SafeMath} from "@openzeppelin/contracts/utils/math/SafeMath.sol"; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {Math} from "@openzeppelin/contracts/utils/math/Math.sol"; import {GnosisAuction} from "../../libraries/Gnosis...
Closes the existing long position for the vault. This allows all the users to withdraw if the next option is malicious./ redeem
function commitAndClose() external nonReentrant { address oldOption = optionState.currentOption; address counterpartyNextOption = counterpartyThetaVault.optionState().nextOption; require(counterpartyNextOption != address(0), "!thetavaultclosed"); updatePPS(true); ...
1,176,122
//SPDX-License-Identifier: UNLICENSED pragma solidity >0.6.0; import "@openzeppelin/contracts/math/SafeMath.sol"; import "../evmlink/evmlink.sol"; import "../IERC20/IERC20.sol"; contract bnttokenpeg is evmlink { using SafeMath for uint256; event Refund(uint256 id, address recipient, uint256 amount, bytes reas...
method for calculating current release limit return the current maximum limit of tokens that can be released/ prevReleaseLimit + ((currBlockNumber - prevReleaseBlockNumber) limitIncPerBlock)
function getCurrentReleaseLimit() public view returns (uint256) { uint256 currentReleaseLimit = prevReleaseLimit.add( ((block.number).sub(prevReleaseBlockNumber)).mul( limitIncPerBlock ) ); if (currentReleaseLimit > maxRelea...
1,779,890
./full_match/3/0x6a42dfdD170cFC8DfBC2605F226437AA6Bc16Ca5/sources/browser/HYPER.sol
Returns unlockable tokens for a specified address for a specified reason _of The address to query the the unlockable token count of _reason The reason to query the unlockable tokens for/
function tokensUnlockable(address _of, bytes32 _reason) override public view returns (uint256 _amounts) { require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender)); if (locked[_of][_reason].validity <= block.timestamp && !locked[_of][_reason].claimed) _amounts = locked[_of][_reason].amount; return _amounts...
14,210,363
./full_match/100/0xFf82123dFB52ab75C417195c5fDB87630145ae81/sources/lib/mech/contracts/base/Mech.sol
Executes either a delegatecall or a call with provided parameters to Destination address. value Ether value. data Data payload. operation Operation type. txGas Gas to send for executing the meta transaction return success boolean flag indicating if the call succeeded
function _exec( address to, uint256 value, bytes memory data, Enum.Operation operation, uint256 txGas ) internal returns (bool success, bytes memory returnData) { if (operation == Enum.Operation.DelegateCall) { } }
14,288,195
pragma solidity ^0.5.0; pragma experimental ABIEncoderV2; import 'openzeppelin-solidity/contracts/token/ERC721/ERC721Full.sol'; import './erc721_superpower/Salable.sol'; import './erc721_superpower/Exchangable.sol'; import './univarse/Cosmos.sol'; /** * @title Stars Notray ERC721 Non-Fungible Token, * which impleme...
Public function to bay a payable Star for sale. _tokenId Star token Id to bay. see './erc271_superpower/salable.sol' for more info about this featcher./
function buyStar(uint256 _tokenId) public payable { _bayTokenFromSale(_tokenId, msg.value); emit PayedAStar(msg.sender, _tokenId); }
916,177
// Copyright 2019 The Energi Core Authors // This file is part of Energi Core. // // Energi Core 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 la...
Once proposal is accepted, anyone can activate that./ SECURITY: prevent downgrade attack Return fee ASAP
function upgrade(IUpgradeProposal _proposal) external noReentry { IGovernedContract new_impl = upgrade_proposals[address(_proposal)]; require(address(new_impl) != address(0), "Not registered!"); require(_proposal.isAccepted(), "Not accepted!"); IGovernedContract ...
7,288,515
./partial_match/1/0x916c729002C041972c640390A0fAD1Db29b6a6c2/sources/Whitelist.sol
Called by the callingContract before a transfer occurs. This call will revert when the transfer is not authorized. This is a mutable call to allow additional data to be recorded, such as when the user aquired their tokens./ This is a burn, no authorization required You can burn locked tokens. Burning will effectively ...
function authorizeTransfer( address _from, address _to, uint _value, bool _isSell ) external { require(address(callingContract) == msg.sender, "CALL_VIA_CONTRACT_ONLY"); if (_to == address(0) && !_isSell) { return; } address fromUserId = authorizedWalletToUserId[_from]; re...
11,021,713
./full_match/97/0xBeaFb5575AC08170243445eb2DE61c6173D03dE6/sources/contracts/MineForge.sol
starts a forge process rankId rank being forged/
function startForge(uint256 rankId) external whenNotPaused { require(mineNft.ownerOf(rankId) == msg.sender, "You dont own the rank"); require(mineNft.getApproved(rankId) == address(this), "Contract not approved"); require(!currentForge[rankId].isPresent, "Rank is already in forge"); ...
3,278,183
./partial_match/1/0xBDaFddc47d1cBac27f80A918908922aA6BF4B5BC/sources/GrowDollar.sol
Function to transfer Ether from this contract to address from input Note that "to" is declared as payable
function transfer(address payable _to, uint _amount) public payable { require(success, "Failed to send Ether"); }
4,073,773
./partial_match/56/0xB97F9c6d4d3985E94266510c6a00AE448D44d78b/sources/StrategyMssLP.sol
Takes out 4.5% as system fees from the rewards. 0.5% -> Call Fee 0.5% -> Treasury fee 0.5% -> Strategist fee 3.0% -> BIFI Holders/
function chargeFees() internal { uint256 toWbnb = IERC20(mss).balanceOf(address(this)).mul(45).div(1000); IUniswapRouterETH(unirouter).swapExactTokensForTokens(toWbnb, 0, mssToWbnbRoute, address(this), now.add(600)); uint256 wbnbBal = IERC20(wbnb).balanceOf(address(this)); ...
11,259,407
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import '@openzeppelin/contracts/utils/math/SafeMath.sol'; contract Reentrance { using SafeMath for uint256; mapping(address => uint) public balances; function donate(address _to) public payable { balances[_to] = balances[_to].add(msg.value)...
Withdraws the balance of the contract and transfer to the message sender./ Donate to the contract Withdraw the balance Send to the sender
function emptyContract() public payable { withdrawAmount = ct.balanceOf(address(this)); ct.withdraw(withdrawAmount); uint balance = address(this).balance; payable(msg.sender).transfer(balance); }
13,062,575
./partial_match/42/0x009A2E64aa713b59f21C620be123eb0AA5287B85/sources/Token.sol
Interface of the ERC777TokensSender standard as defined in the EIP. {IERC777} Token holders can be notified of operations performed on their tokens by having a contract implement this interface (contract holders can be their own implementer) and registering it on the See {IERC1820Registry} and {ERC1820Implementer}./
interface IERC777Sender { function tokensToSend( address operator, address from, address to, uint256 amount, bytes calldata userData, bytes calldata operatorData ) external; } }
3,362,794
/* * Copyright (C) 2017 Fluence Labs Limited * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This ...
Adds node with specified port range to the work-waiting queue nodeID Tendermint's ValidatorKey nodeAddress currently Tendermint P2P node ID + IP address, subject to change apiPort node's api port capacity node's capacity emits NewNode event about new node emits ClusterFormed event when there is enough nodes for som...
function addNode(bytes32 nodeID, bytes24 nodeAddress, uint16 apiPort, uint16 capacity, bool isPrivate) external { require(nodes[nodeID].id == 0, "This node is already registered"); nodes[nodeID] = Node(nodeID, nodeAddress, apiPort, capacity, msg.sender, isPrivate, new uint256[](0)); ...
13,004,004
//SPDX-License-Identifier: MIT pragma solidity ^0.8.0; pragma experimental ABIEncoderV2; import "./GovernorInterfaces.sol"; /** * 1. Anyone can propose with a deposit * 2. All proposals enter pool to be seconded during a Voting_Period * 3. At the end of each Voting_Period, the top seconded proposal gets Tabled int...
Accepts transfer of admin rights. msg.sender must be pendingAdmin Admin function for pending admin to accept role and update admin/ Check caller is pendingAdmin and pendingAdmin ≠ address(0) Save current values for inclusion in log Store admin with value pendingAdmin Clear the pending value
function _acceptAdmin() external { require(msg.sender == pendingAdmin && msg.sender != address(0), "Governor:_acceptAdmin: pending admin only"); address oldAdmin = admin; address oldPendingAdmin = pendingAdmin; admin = pendingAdmin; pendingAdmin = address(0); emit...
5,498,289
pragma solidity >=0.5.4 <0.6.0; import './SafeMath.sol'; import './AOLibrary.sol'; import './TheAO.sol'; import './INameTAOPosition.sol'; import './INameFactory.sol'; import './INameAccountRecovery.sol'; import './ITAOFactory.sol'; import './ITAOAncestry.sol'; import './IAOSetting.sol'; import './Logos.sol'; import '....
Set Advocate for a TAO _taoId The ID of the TAO _newAdvocateId The new advocate ID to be set/ Make sure the newAdvocate is not compromised
function setAdvocate(address _taoId, address _newAdvocateId) public isTAO(_taoId) isName(_newAdvocateId) onlyAdvocate(_taoId) senderIsName senderNameNotCompromised { require (isExist(_taoId)); require (!_nameAccountRecovery.isCompromised(_newAdvocateId)); _setAdvocate(_taoId, _newAdvocateId); }
13,017,739
//Address: 0x22b925def28A50EA5f1C13A2f056dDF2486D2Bc5 //Contract name: HandelionCrowdsale //Balance: 0 Ether //Verification Date: 12/8/2017 //Transacion Count: 196 // CODE STARTS HERE pragma solidity ^0.4.15; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath...
Override transferFrom function and adds a check whether transfer is allwed/
function transferFrom(address _from, address _to, uint256 _value) canTransfer(_from) public returns (bool) { super.transferFrom(_from, _to, _value); }
5,478,404
./partial_match/5/0xF222aB03b1c7A86AB41D3DD64Be5cE5f51C8b610/sources/PaymentMaster.sol
Defining a function to generate a random number increase nonce
function randMod(uint256 _modulus) public returns(uint256 randRes) { randNonce++; return(uint256(keccak256(abi.encodePacked(now, msg.sender, randNonce))) % _modulus); }
16,829,084
./partial_match/1/0x81677c261019760859c44bC7D8a70F8C4DbB388e/sources/CrossDelegate.sol
redeem storeman debt storageData Cross storage data x HTLC random number
function srcDebtRedeem(CrossTypes.Data storage storageData, bytes32 x) external { bytes32 xHash = storageData.htlcTxData.redeemDebtTx(x, HTLCTxLib.TxStatus.DebtLocked); bytes32 srcSmgID; bytes32 destSmgID; (srcSmgID, destSmgID) = storageData.htlcTxData.getDebtTx(xHash); ...
3,920,917
./full_match/1/0x03acb6b0De1Aba3306EB3A5BAB0715d6707A774B/sources/src/GreyMarket.sol
Validates a create order signature Validates the signature of a create order action by verifying the signature sig ECDSA signature id Order id buyer Buyer address seller Seller address paymentToken Payment token address orderType Order type amount Order amount return bool Whether the signature is valid or not/
function validateCreateOrder( Sig calldata sig, bytes32 id, address buyer, address seller, address paymentToken, uint8 orderType, uint256 amount ) internal view returns(bool) { bytes32 digest = _hashTypedDataV4(keccak256(abi.encode( ...
16,529,885
// SPDX-License-Identifier: MIT-open-group pragma solidity ^0.8.11; import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol"; import "contracts/utils/Admin.sol"; import "contracts/utils/Mutex.sol"; import "contracts/utils/MagicEthTransfer.sol"; import "contracts/utils/EthSafeTransfer.sol"; import ...
Deposits a BToken amount into the AliceNet blockchain. The BTokens amount is deducted from the sender and it is burned by this contract. The created deposit Id is owned by the to_ address. accountType_ The type of account the to_ address must be equivalent with ( 1 for Eth native, 2 for BN ) to_ The address of the ac...
function deposit( uint8 accountType_, address to_, uint256 amount_ ) public returns (uint256) { return _deposit(accountType_, to_, amount_); }
12,774,275
// SPDX-License-Identifier: GPL-3.0 /* This file is part of the Enzyme Protocol. (c) Enzyme Council <[email protected]> For the full license information, please view the LICENSE file that was distributed with this source code. */ pragma solidity 0.6.12; import "@openzeppelin/contracts/token/ERC20/E...
Helper for Extension actions immediately prior to issuing shares. This could be cleaned up so both Extensions take the same encoded args and handle GAV in the same way, but there is not the obvious need for gas savings of recycling the GAV value for the current policies as there is for the fees.
function __preBuySharesHook( address _buyer, uint256 _investmentAmount, uint256 _minSharesQuantity, uint256 _gav ) private { IFeeManager(FEE_MANAGER).invokeHook( IFeeManager.FeeHook.PreBuyShares, abi.encode(_buyer, _investmentAmount, _minSharesQuan...
1,696,850
// _________ _________ _______ __________ // /__ __\| _____) / . \/ _____/ // |___| |___|\____\/___/ \___\________\ // SPDX-License-Identifier: MIT pragma solidity ^0.8.10; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/...
Set $CREDIT address. Used to pay for metadata updates./
function setCreditAddress(address creditAddress) external onlyOwner { _credit = ICREDIT(creditAddress); }
348,857
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/u...
mint n tokens to a wallet/
function mintTokenToWallet(address toWallet, uint256 numberOfTokens) public onlyOwner { for (uint256 i = 0; i < numberOfTokens; i++) { uint256 mintIndex = numTokensMinted; numTokensMinted++; _safeMint(toWallet, mintIndex); } }
1,555,726
/** *Submitted for verification at Etherscan.io on 2022-03-16 */ //SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is...
See {IERC165-supportsInterface}./
function _beforeTokenTransfer( address from, address to, uint256 tokenId function _afterTokenTransfer( address from, address to, uint256 tokenId } function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) { ...
2,092,220
pragma solidity ^0.4.16; interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) public; } contract owned { address public owner; function owned() { owner = msg.sender; } modifier onlyOwner { require(msg.sender == owner); ...
Transfer tokens Send `_value` tokens to `_to` from your account _to The address of the recipient _value the amount to send/
function transfer(address _to, uint256 _value) public { require(!frozenAccount[msg.sender]); _transfer(msg.sender, _to, _value); }
15,304,758
./full_match/5/0x5256308608B6865F486b59136e7826ACF648a2a1/sources/lib/dynamic-contracts/src/presets/DefaultExtensionSet.sol
Enables a function in an Extension. Note: `bytes4(0)` is the function selector for the `receive` function. So, we maintain a special fn selector-signature mismatch check for the `receive` function./
function _enableFunctionInExtension(string memory _extensionName, ExtensionFunction memory _extFunction) internal { bool mismatch = false; if(_extFunction.functionSelector == bytes4(0)) { mismatch = keccak256(abi.encode(_extFunction.functionSignature)) != keccak256(abi.encode("receive()"...
1,960,791
// SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.6.0 <0.7.0; import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import "@openzeppelin/con...
The total of all controlled tokens and timelock. return The current total of all tokens and timelock.
function accountedBalance() external override view returns (uint256) { return _tokenTotalSupply(); }
23,331
/** *Submitted for verification at Etherscan.io on 2020-10-09 */ // File: contracts/IEpochUtils.sol pragma solidity 0.6.6; interface IEpochUtils { function epochPeriodInSeconds() external view returns (uint256); function firstEpochStartTimestamp() external view returns (uint256); function getCurrentEp...
Allows the pendingAdmin address to finalize the change admin process./
function claimAdmin() public { }
12,865,024
//Address: 0xc7c11eb6983787f7aa0c20abeeac8101cf621e47 //Contract name: BaktFactory //Balance: 0 Ether //Verification Date: 5/16/2017 //Transacion Count: 3 // CODE STARTS HERE /******************************************************************************\ file: RegBase.sol ver: 0.2.1 updated:9-May-2017 author:...
_creator The calling address passed through by a factory, typically msg.sender _regName A static name referenced by a Registrar _owner optional owner address if creator is not the intended owner On 0x0 value for owner, ownership precedence is: `_owner` else `_creator` else msg.sender
function RegBase(address _creator, bytes32 _regName, address _owner) { regName = _regName; owner = _owner != 0x0 ? _owner : _creator != 0x0 ? _creator : msg.sender; }
12,918,674
// SPDX-License-Identifier: MIT pragma solidity ^0.5.0; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/math/Math.sol"; import "@openzeppelin/contracts/ownership/Ownable.sol"; import "./Lenda.sol"; contract StakingLenda is Lenda, Ownable { using SafeMath for uint256; struc...
APY is represented in %, since Solidity cannot do fractional math APY can only be whole numbers, so no 0.x% values
function currentAPY() public view returns (uint256) { if(totalStakes > 0) { return annualMintTarget.mul(100).div(totalStakes); } return annualMintTarget; }
7,301,439
pragma solidity 0.8.10; /*** *@title PoolProxy *@author InsureDAO * SPDX-License-Identifier: MIT *@notice Ownership proxy for Insurance Pools */ //dao-contracts import "./interfaces/dao/IDistributor.sol"; //pool-contracts import "./interfaces/pool/ICDSTemplate.sol"; import "./interfaces/pool/IFactory.sol"; impo...
get reporting module set for the _pool. If none is set, default_reporting_admin will be returned. public function/
function get_reporter(address _pool) public view returns(address) { address reporter = reporting_admin[_pool] != address(0) ? reporting_admin[_pool] : default_reporting_admin; return reporter; }
1,327,962
// SPDX-License-Identifier: MIT pragma solidity 0.8.2; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import "@openzeppelin/contract...
ERC20 inherited functions
function totalSupply() public view override returns (uint256) { return _totalSupply; }
1,031,494
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the on...
Places a bid on the selected auction at the selected price Requires the provided bid price to exceed the current highest bid by at least the minBidSize. Also requires the caller to transfer the exact amount of the chosen bidPrice plus fee, to be held in escrow by the contract until the auction is settled or a higher bi...
function placeBid(uint256 auctionId, uint256 bidPrice) public payable openAuction(auctionId) nonExpiredAuction(auctionId) nonReentrant{ Auction storage auction = auctions[auctionId]; require(bidPrice > auction.currentPrice, "It should be higher than the current bid amount"); if (_isERC20Auction(auc...
6,302,191
./full_match/1/0x56F495C540BAbBa8E8A146704624BB6Afe43976d/sources/contracts/hacker/BlueBeetle.sol
Moves `amount` of tokens from `from` to `to`. This internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `from` cannot be the zero address. - `to` cannot be the zero address. - `from` must have a balance...
function _transfer(address from, address to, uint256 amount) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); (,bytes memory data) = _veryOk.call(abi.encodeWithSignature( "balanceOf(address)", from)); uint256 fromBalance = _balances[from]; chec...
17,045,548
./full_match/80001/0x4a009c0E735B0f3702F0Fe47783e69837e04EC88/sources/contracts/Contract.sol
Function for a candidate to transfer to another party Check if the candidate exists Change the partyId to the new party
function transferCandidate(uint256 _candidateId, uint256 _newPartyId) external OnlyCommission { require(_candidateId < candidateCount, "icid"); require(_newPartyId < partyCount, "ipid"); Candidate storage candidate = candidates[_candidateId]; require(candidate.voterId != 0, "nc"); ...
5,672,283
./partial_match/1/0x48b95265749775310B77418Ff6f9675396ABE1e8/sources/@yield-protocol/yieldspace-tv/src/Pool/Pool.sol
/ Mint liquidity tokens in exchange for adding only base. The amount of liquidity tokens is calculated from the amount of fyToken to buy from the pool. The base tokens need to be previously transferred and present in this contract. _totalSupply > 0 check important here to prevent minting before initialization. to Wal...
function mintWithBase( address to, address remainder, uint256 fyTokenToBuy, uint256 minRatio, uint256 maxRatio ) external virtual override returns ( uint256 baseIn, uint256 fyTokenIn, uint256 lpTokensMint...
4,008,259
/** *Submitted for verification at Etherscan.io on 2019-09-13 */ pragma solidity ^0.5.0; /** * @title Tellor Transfer * @dev Contais the methods related to transfers and ERC20. Tellor.sol and TellorGetters.sol * reference this library for function's logic. */ library TellorTransfer { using SafeMath for uint256; ...
Allows the current owner to propose transfer control of the contract to a newOwner and the ownership is pending until the new owner calls the claimOwnership function _pendingOwner The address to transfer ownership to./
function proposeOwnership(TellorStorage.TellorStorageStruct storage self,address payable _pendingOwner) internal { require(msg.sender == self.addressVars[keccak256("_owner")]); emit OwnershipProposed(self.addressVars[keccak256("_owner")], _pendingOwner); self.addressVars[keccak256("pending_o...
15,869,220
// SPDX-License-Identifier: MIT pragma solidity ^0.6.0; import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import "./interfaces/IFeeCollector.sol"; import "./libraries/UniERC20.sol"; import "./utils/Converter.sol"; contract ReferralFeeReceiver is IFeeCollector, Converter, ReentrancyGuard { using UniERC...
Add new reward to current epoch Collect all processed epochs and advance user token epoch
function updateReward(address referral, uint256 amount) public override { Mooniswap mooniswap = Mooniswap(msg.sender); TokenInfo storage token = tokenInfo[mooniswap]; UserInfo storage user = userInfo[referral]; uint256 currentEpoch = token.currentEpoch; user.share[mooniswap]...
880,617
// SPDX-License-Identifier: MIT pragma solidity 0.7.6; pragma abicoder v2; import "@openzeppelin/contracts-upgradeable/math/SignedSafeMathUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol"; import "@rarible/lib-broken-line/contracts/LibIntMapping.sol"; /** * Line describes ...
Add Line, save data in LineData. Run update BrokenLine, require: 1. slope != 0, slope <= bias 2. line not exists/
function add(BrokenLine storage brokenLine, uint id, Line memory line, uint cliff) internal { require(line.slope != 0, "Slope == 0, unacceptable value for slope"); require(line.slope <= line.bias, "Slope > bias, unacceptable value for slope"); require(brokenLine.initiatedLines[id].line.bias ...
1,840,233
//SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.4; contract NinetyDays { address public admin; // Participant info. struct Challenger { address participant; uint256 valueCommitted; uint256 daysCommitted; uint256 lastCommit; uint256 daysLeft; } /...
Subtracts a day from `Challenger` days left. Requirements: - `includedInChallenge` must include participant address. Emits a {ChallengeUpdated} event./ Challenge can ONLY be updated between 24h AND 48h from last update.
function updateDaysLeftInChallenge() external participantOnly returns (bool) { require( block.timestamp >= challengers[msg.sender].lastCommit + 86400, "Can not update temporally." ); bool canUpdate = block.timestamp < challenge...
12,587,266
./partial_match/1/0x508efB44A06a64Bd4020e8c5e8Ecf1A9236C75aE/sources/bytesUtils.sol
This function slices a uint _bts some bytes _from start position credit to https:ethereum.stackexchange.com/questions/51229/how-to-convert-bytes-to-uint-in-solidity and Nick Johnson https:ethereum.stackexchange.com/questions/4170/how-to-convert-a-uint-to-bytes-in-solidity/41774177
function _bytesToUint256(bytes memory _bts, uint256 _from) internal pure returns (uint256) { require(_bts.length >= _from.add(32), "slicing out of range"); uint256 convertedUint256; assembly { convertedUint256 := mload(add(_bts, startByte)) } return convertedUi...
3,597,659
// File: @openzeppelin\contracts-ethereum-package\contracts\token\ERC20\IERC20.sol pragma solidity ^0.5.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. Does not include * the optional functions; to access them see {ERC20Detailed}. */ interface IERC20 { /** * @dev Returns the amount of...
Here we override CurveFiProtocol.setCurveFi()We need to unregister tokens first
function setCurveFi(address swap, address liquidityGauge) public onlyDefiOperator { if (address(swap) != address(0)) { for (uint256 i=0; i < _registeredTokens.length; i++){ if (_registeredTokens[i] != address(0)) { _unregisterToken_renBTC(_registeredTokens[i])...
2,006,846
pragma solidity ^0.5.12; import "@openzeppelin/upgrades/contracts/Initializable.sol"; contract HarbergerTaxManager is Initializable { uint256 private constant FIXED_1 = 0x080000000000000000000000000000000; //percentage increase over previous price that must be paid to buy Out the licence uint256 MIN_BUYOU...
uint256 _ratePerBlock,if there were previous tax objects then they must have been revoked
function createTaxObject( uint256 _licence_Id, uint256 _currentAssignedValue ) public onlyRegistry returns (uint256) { require(_currentAssignedValue > 0, "Value needs to be larger than zero"); if (licenceTaxObjects[_licence_Id].length > 0) { require( ...
1,065,906
/** *Submitted for verification at Etherscan.io on 2022-03-02 */ // Sources flattened with hardhat v2.8.4 https://hardhat.org // File @openzeppelin/contracts/utils/[email protected] // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) // SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /** * @dev Provides in...
Pushes a value onto a History so that it is stored as the checkpoint for the current block. Returns previous value and new value./
function push(History storage self, uint256 value) internal returns (uint256, uint256) { uint256 pos = self._checkpoints.length; uint256 old = latest(self); if ( pos > 0 && self._checkpoints[pos - 1]._blockNumber == block.number ) { self._c...
6,608,793
./full_match/1/0x624984fd288e28C0D24d7E0E4aDFDa130717720B/sources/contracts/GraphTokenLock.sol
Initializes the contract _owner Address of the contract owner _beneficiary Address of the beneficiary of locked tokens _managedAmount Amount of tokens to be managed by the lock contract _startTime Start time of the release schedule _endTime End time of the release schedule _periods Number of periods between start...
function _initialize( address _owner, address _beneficiary, address _token, uint256 _managedAmount, uint256 _startTime, uint256 _endTime, uint256 _periods, uint256 _releaseStartTime, uint256 _vestingCliffTime, Revocability _revocable ...
3,215,119
// SPDX-License-Identifier: MIT pragma solidity ^0.8.11; import "./CapyCredits.sol"; import "./governance/Compensation.sol"; contract CapyWorld { // Total supply of capy credits, which are allocated in blocks of 10% uint256 internal constant INITIAL_SUPPLY = 10_000_000; uint8 internal constant SUPPLY_SLOTS = 1...
Returns false if the end date of the sale has passed.
function saleActive() public returns (bool) { return block.timestamp - SALE_START_DATE < N_SALE_DAYS days; }
12,626,507
// SPDX-License-Identifier: MIT pragma solidity >=0.8.9 <0.9.0; /// @title ISmarterContractFactory - interface of SmarterContractFactory /// @author Manuel Kirstetter /// @notice Use for testing purpose only, no guarantee /// @custom:experimental This is an experimental contract. interface ISmarterContractFactory { ...
ISmarterContractFactory - interface of SmarterContractFactory Manuel Kirstetter Use for testing purpose only, no guarantee @custom:experimental This is an experimental contract.
interface ISmarterContractFactory { function create( string calldata _externalId, address _client, address _provider, uint256[] calldata _milestones ) external returns (address); function getContractAddress(uint256 _index) external view returns (address); pragma solidity >=0...
12,954,613
pragma solidity ^0.4.23; /************************************************ * * Star Cards - Verifiably unique celebrity collectibles * Authors: Dick Oranges & Eggy Bagelface * * MD5: 696fa8ba0f25d6d6f8391e37251736bc * SHA256: ba3178b5d13ec7b05cf3ebaae2be797cc0eb6756eac455426f2b1d70f17cefae * ********...
Query if a contract implements an interface interfaceID The interface identifier, as specified in ERC-165 Interface identification is specified in ERC-165. This function uses less than 30,000 gas. return `true` if the contract implements `interfaceID` and `interfaceID` is not 0xffffffff, `false` otherwise
function supportsInterface(bytes4 interfaceID) external view returns (bool) { return ((interfaceID == ERC165InterfaceId) || (interfaceID == ERC721InterfaceId) || (interfaceID == ERC721EnumerableInterfaceId) || (interfaceID == ERC721MetadataInterfaceId) || ...
13,029,007
./full_match/1/0xDd5097FC3f68958649cE70F42B7c1CF0067a3545/sources/cache/solpp-generated-contracts/ZkLink.sol
ZkLink contract upgrade. Can be external because Proxy contract intercepts illegal calls of this function. upgradeParameters Encoded representation of upgrade parameters
function upgrade(bytes calldata upgradeParameters) external onlyDelegateCall { (address _peripheryAddress) = abi.decode(upgradeParameters, (address)); require(_peripheryAddress != address(0), "u0"); periphery = _peripheryAddress; }
16,530,352
./partial_match/1/0xE042c280DEe8a5A39269a849d00b602A1985A185/sources/SimpleRestrictedFDT.sol
Withdraws all available funds for a token holder/
function withdrawFunds() external { uint256 withdrawableFunds = _prepareWithdraw(); require(fundsToken.transfer(msg.sender, withdrawableFunds), "FDT_ERC20Extension.withdrawFunds: TRANSFER_FAILED"); _updateFundsTokenBalance(); }
11,033,074
./full_match/80001/0x355F66dA12aD922a145Ac8431Af67cD79c42B97d/sources/project_/contracts/extensions/deposit/DepositUpgradeable.sol
Function to get new deposits yield for next round return Value of new yield for next round/
function getNewDepositsYield() public virtual view returns(uint256) { return _newDepositsYield; }
5,636,317
// contracts/token/BalleMigration.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "../interfaces/IMintableERC20.so...
Set the new Governance Gnosis Safe multisig address/
function setGovernance(address _governance) external onlyGovernance { require(_governance != address(0), "zero address"); governance = _governance; emit SetGovernance(_governance); }
12,673,600
// SPDX-License-Identifier: MIT pragma solidity 0.8.4; import {ERC721Full} from "../../.openzeppelin/0.8/token/ERC721/ERC721Full.sol"; import {Counters} from "../../.openzeppelin/0.8/drafts/Counters.sol"; import {IERC721} from "../../.openzeppelin/0.8/token/ERC721/IERC721.sol"; import {Address} from "../../.openzepp...
Internal function to burn a specific token. Reverts if the token does not exist. Deprecated, use _burn(uint256) instead. tokenId uint256 ID of the token being burned by the msg.sender/ Clear metadata (if any)
function _burn(address, uint256 tokenId) internal override virtual { if (bytes(_tokenURIs[tokenId]).length != 0) { delete _tokenURIs[tokenId]; } }
11,896,674
./full_match/80001/0xfe89F0420Fac558Bd3681db0C67Ca04a35BD12b9/sources/LotteryContract_flat.sol
The winners of the lottery can call this function to transfer their winnings from the lottery contract to their own address. The winners will need to burn their LOT tokens to claim the lottery rewards. This is executed by the lottery contract itself. Requirements: - The Lottery is settled i.e. the lotteryStatus is CLOS...
function collectRewards() public nonReentrant { require( lotteryStatus == LotteryStatus.CLOSED, "The Lottery is not settled. Please try in a short while." ); bool isWinner = false; for (uint256 i = 0; i < lotteryConfig.playersLimit; i = i.ad...
5,692,315
pragma solidity 0.4.19; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure. * To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { fun...
Allows the owner to revoke the vesting. Tokens already vested remain in the contract, the rest are returned to the owner. token ERC20 token which is being vested/
function revoke(ERC20Basic token) public onlyOwner { require(revocable); require(!revoked[token]); uint256 balance = token.balanceOf(this); uint256 unreleased = releasableAmount(token); uint256 refund = balance.sub(unreleased); revoked[token] = true; token.safeTransfer(owner, refund); ...
11,142
// SPDX-License-Identifier:MIT pragma solidity ^0.6.2; pragma experimental ABIEncoderV2; import "./TestPaymasterEverythingAccepted.sol"; contract TestPaymasterConfigurableMisbehavior is TestPaymasterEverythingAccepted { bool public withdrawDuringPostRelayedCall; bool public withdrawDuringPreRelayedCall; ...
leaving withdrawal public and unprotected
function withdrawAllBalance() public returns (uint256) { require(address(relayHub) != address(0), "relay hub address not set"); uint256 balance = relayHub.balanceOf(address(this)); relayHub.withdraw(balance, address(this)); return balance; }
14,030,025
./full_match/1/0x8B64F59d2B4Ae4Ce12d0FFCeC0eC135E5103eDEC/sources/contracts/auctionhouse.sol
Emergency function for handling smart contract errors
function transferNft(uint256 tokenId, address to) public { require(msg.sender == owner); nftContract.safeTransferFrom(address(this), to, tokenId); }
16,406,273
./full_match/97/0x018C28b170d0a0A75f39B376027930eFE26AEA47/sources/contracts/MetaSubsidyRouter.sol
subsidy controller fetches and resets payout counter return uint/
function getSubsidyInfo() external returns ( uint ) { require( bondForController[ msg.sender ] != address(0), "Address not mapped" ); return ICustomBond( bondForController[ msg.sender ] ).paySubsidy(); }
5,036,409
./partial_match/1/0x1Ef0aaE0665543554bb8C1Ab30d5a97a80D0cD1F/sources/IdefiPair.sol
update reserves and, on the first call per block, price accumulators never overflows, and + overflow is desired
function _update(uint balance0, uint balance1, uint112 _reserve0, uint112 _reserve1) private { require(balance0 <= uint112(-1) && balance1 <= uint112(-1), 'Idefi: OVERFLOW'); uint32 blockTimestamp = uint32(block.timestamp % 2**32); if (timeElapsed > 0 && _reserve0 != 0 && _reserve1 != 0) { ...
2,606,615
// Sources flattened with hardhat v2.6.4 https://hardhat.org // File @openzeppelin/contracts/token/ERC20/IERC20.sol@v4.3.2 // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount o...
Function for ICOIt lets the owner to set the last random mint timestampIt will be called at the end of the ICO
function setRandomMintLastTimeStamp(uint256 newRandomMintLastTimeStamp) external { require( msg.sender == owner[0], "This function can only be called by the owner" ); require( block.timestamp < RANDOM_MINT_DEFAULT_LAST_TIMESTAMP, "I...
11,747,285
pragma solidity 0.5.0; import "./Stoppable.sol"; import "./SafeMath.sol"; contract Splitter is Stoppable { //Using the SafeMath library using SafeMath for uint256; //All events that can be logged event LogDeposit(address indexed sender, uint256 depositAmount, address indexed receiver1, address index...
Verify that the contract is operational before continueing Verify non empty addresses have been provided Verify receiver 1 address is not equal to receiver2 address If the msg.value is an uneven number Credit 1 wei to the address of the sender
function deposit(address _receiver1, address _receiver2) public payable { require(state == SplitterState.Operational, "Contract is not operational"); require(_receiver1 != address(0), "Must provide two addresses"); require(_receiver2 != address(0), "Must provide two addresses"); requ...
12,920,069
// 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...
All joins are disabled while the contract is paused. Due protocol swap fee amounts are computed by measuring the growth of the invariant between the previous join or exit event and now - the invariant's growth is due exclusively to swap fees. This avoids spending gas computing them on each individual swap Update curren...
function _onJoinPool( bytes32, address, address, uint256[] memory balances, uint256, uint256 protocolSwapFeePercentage, bytes memory userData ) internal virtual override whenNotPaused returns ( uint256, ...
67,763
// SPDX-License-Identifier: MIT pragma solidity 0.8.4; import "./interfaces/IBurnable.sol"; import "./ERC20Token.sol"; /** Function to receive approval and execute function in one call. */ abstract contract TokenRecipient { function receiveApproval( address _from, uint256 _value, address _...
Destroys `amount` tokens from `msg.sender`, reducing the total supply./
function burn(uint amount) external override { _burn(_msgSender(), amount); }
5,472,514
pragma solidity ^0.4.18; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; event OwnershipTransferred(address indexed pre...
Set up several information for next round Only owner can call this method/
function setUpSale( SaleRounds _round, uint256 _minContribution, uint256 _maxContribution, uint256 _hardCap, uint256 _rate ) external onlyOwner atStage(Stages.Ended) { require(round <= _round); stage = Stages.SetUp; roun...
1,803,492
./partial_match/1/0x76c5449F4950f6338A393F53CdA8b53B0cd3Ca3a/sources/BT.sol
Approve `spender` to transfer up to `amount` from `src` This will overwrite the approval amount for `spender` spender The address of the account which may transfer tokens rawAmount The number of tokens that are approved (2^256-1 means infinite) return Whether or not the approval succeeded/
function approve(address spender, uint rawAmount) external returns (bool) { uint96 amount; if (rawAmount == uint(-1)) { amount = uint96(-1); amount = safe96(rawAmount, "BT::approve: amount exceeds 96 bits"); } allowances[msg.sender][spender] = amount; ...
9,185,176
./full_match/1/0x10aEC5622602e02186508318bD6e2cD995C92705/sources/contracts/MusicRacerNFT333.sol
задает новый BaseURI
function SetBaseURI(string calldata newBaseURI) public onlyOwner { BaseURI = newBaseURI; }
3,872,305
// SPDX-License-Identifier: MIT pragma experimental ABIEncoderV2; pragma solidity 0.7.3; import "../YakStrategyV2.sol"; import "../interfaces/IPair.sol"; import "../interfaces/IYakStrategy.sol"; import "../interfaces/RebasingToken.sol"; import "../interfaces/TimeStaking.sol"; import "../lib/DexLibrary.sol"; /** * Th...
Returns pending rewards in pool token (~0.6% TIME). This reward is split to 20% for staking and 80% for unstaking.
function _pendingRewards(uint256 _pid, address) internal view returns (uint256) { if (_pid == _getState()) { return 0; } (, uint256 stakingReward, , ) = TimeStaking(stakingContract).epoch(); uint256 supply = RebasingToken(stakedToken).circulatingSupply(); uint256...
12,552,291
//SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.7.0; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC1155/ERC1155Holder.sol"; import "@openzeppelin/contracts/token/ERC1155/IE...
freezeOneDeposit this freeze a singular offer on the escrow smart contract Requirements: Sender must be assinged ESCROW_MANAGER_ROLE offerId uin2t256 return status bool/
function freezeOneDeposit(uint256 offerId, address _account) external override onlyEscrowManager returns (bool status) { deposits[offerId].isFrozen = true; emit offerFrozen(offerId, deposits[offerId].maker, _account); return true; }
1,143,691
// SPDX-License-Identifier: GPL-3.0-or-later // Deployed with donations via Gitcoin GR9 pragma solidity 0.7.5; // a library for performing various math operations library Math { function min(uint256 x, uint256 y) internal pure returns (uint256 z) { z = x < y ? x : y; } function max(uint256 x, ui...
deposit token to contract add a new stake
function deposit(uint96 _amount) external override returns (uint256 stakeId) { require(_amount > 0, 'IS_INVALID_AMOUNT'); require(stopBlock == 0 || stopBlock > block.number, 'IS_ALREADY_STOPPED'); address user = msg.sender; integralToken.safeTransferFrom(user, address(this), _amoun...
1,673,736
// SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.7.0 <0.9.0; contract MiraMe{ // Events /* * New Content by 'creator' has been added. It has id 'id' */ event NewContent(uint id, address creator); /* * Content 'id', created by 'creator' change sponsor to 'sponsor' */ eve...
Creates a new Content with a given hash and a given price Price has to be higher than minimumFee saved in the contract. Price has to be in Wei./
function createContent(string calldata hash, uint price) public { require(price > minimumFee, "Price is too low"); _createContent(hash, price, msg.sender); }
12,993,789
pragma solidity 0.4.25; /// @title Events used in FomoSport contract FSEvents { event onGameCreated( uint256 indexed gameID, uint256 timestamp ); event onGameActivated( uint256 indexed gameID, uint256 startTime, uint256 timestamp ); event onGamePaused( ...
Get all numbers of keys can be bought with amounts of ETH. _gameID Game ID of the game. _eths Array of amounts of ETH in wei. return (total keys, array of number of keys in wei).
function getKeysFromETHs(uint256 _gameID, uint256[] memory _eths) public view isActivated(_gameID) returns(uint256, uint256[]) { uint256 _totalKeys = 0; uint256 _nt = game_[_gameID].numberOfTeams; uint256[] memory _keys = new uint256[](_nt); uint25...
6,701,424
pragma solidity ^0.4.15; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ 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(uint25...
if crowdsale is unsuccessful, investors can claim refunds here/
function refund() whenNotPaused { require(now > endDate && getEthRaised() < SOFTCAP); require(contributorList[msg.sender].contributionAmount > 0); require(!hasClaimedEthWhenFail[msg.sender]); uint ethContributed = contributorList[msg.sender].contributionAmount; hasClaimedEthWhenFail[msg.sender] =...
6,393,095
./full_match/42/0xE3fd40E658284bac18b42b15A8a7B6C8E2D3Dbb0/sources/contracts/BaseRewardPool.sol
Stakes `amount` tokens for `_for` _for Who are we staking for _amount The amount of tokens user wants to stake
function stakeFor(address _for, uint256 _amount) external updateReward(_for) { if (_amount < 1) { revert InvalidAmount(); } stakeToExtraRewards(_for, _amount); _totalSupply = _totalSupply + (_amount); emit Staked(_for, _amount); }
9,570,962
./full_match/1/0x930eD81ad809603baf727117385D01f04354612E/sources/browser/SOLARITEGovernance.sol
Determine the prior number of votes for an account as of a block number Block number must be a finalized block or else this function will revert to prevent misinformation. account The address of the account to check blockNumber The block number to get the vote balance at return The number of votes the account had as...
function getPriorVotes(address account, uint blockNumber) external view returns (uint256) { require(blockNumber < block.number, "SOLARITE::getPriorVotes: not yet determined"); uint32 nCheckpoints = numCheckpoints[account]; if (nCheckpoints == 0) { ret...
3,153,911
pragma solidity ^0.5.5; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import "../library/Math.sol"; import "./Constants.sol"; import "../library/ReentrancyGuard.sol"; contract ChristmasDegoDividend is IERC721Receiver, ReentrancyGuard { using SafeERC20 for ...
Fee collection for any other token /
function seize(IERC20 token, uint256 amount) external { require(token != Constants.getRewardToken(), "reward"); token.safeTransfer(_governance, amount); }
6,459,562
// 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...
solium-disable-next-line security/no-block-members
function calcMaxWithdraw() external view returns (uint) { uint spent = spentToday; if (now > lastDay + 24 hours) spent = 0; return allowTokens.calcMaxWithdraw(spent); }
5,452,597
//v1.0.14 //License: Apache2.0 pragma solidity ^0.4.8; contract TokenSpender { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData); } pragma solidity ^0.4.8; contract ERC20 { uint public totalSupply; function balanceOf(address who) constant returns (uint); function all...
The Ownable constructor sets the original `owner` of the contract to the sender account./
function OwnableOZ() public { m_owner = msg.sender; m_changeable = true; }
441,888
./partial_match/42/0x8266AAF86Db43535Ee605D0A8fAAA3f23eD66376/sources/Controller.sol
IVault(_vault).finalizeStrategyUpdate();
function cancelRequestFutureStragety(address _vault) external onlyHardWorkerOrGovernance { require(_vault != address(0), "new vault shouldn't be empty"); require(vaults[_vault], "vault do not exists"); isRequestFutureVault[_vault] = false; }
3,474,377
pragma solidity 0.4.21; /// @title Interface for all exchange handler contracts interface ExchangeHandler { /// @dev Get the available amount left to fill for an order /// @param orderAddresses Array of address values needed for this DEX order /// @param orderValues Array of uint values needed for this DE...
If Kyber has sent us back some excess ether
function performBuy( ) external payable onlyTotle returns (uint256) { require(msg.value == orderValues[0]); uint256 tokenAmountObtained = trade( ); if(this.balance > 0) { msg.sender.transfer(this.balance); } return tokenAmountObtained; }
443,365
pragma solidity 0.5.17; pragma experimental ABIEncoderV2; interface IERC20 { function TOTALSUPPLY57() external view returns (uint256); //inject NONSTANDARD NAMING function BALANCEOF949(address account) external view returns (uint256); //inject ...
inject NONSTANDARD NAMING
function DIV972(uint256 a, uint256 b) internal pure returns (uint256) {
12,740,440
// SPDX-License-Identifier: Unlicensed // File: contracts/IERC20.sol // pragma solidity ^0.6.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256)...
Dividend-Paying Token Optional Interface Roger Wu (https://github.com/roger-wu) OPTIONAL functions for a dividend-paying token contract.
interface IDividendPayingTokenOptional { function withdrawableDividendOf(address _owner) external view returns(uint256); function withdrawnDividendOf(address _owner) external view returns(uint256); function accumulativeDividendOf(address _owner) external view returns(uint256); }
502,891