file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.11; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; //adding security protocol ReentracyGuard in contract to defend from reentrancy attack contract PurchaseAgreement is ReentrancyGuard{ // payable address of buyer, seller address payable...
to confirm the purchase and assign sender's address to buyer
function confirmPurchase() external payable checkState(State.Created) { require(msg.value == 2 * value, 'Please send 2 times the Purchase value, you will ' 'be returned the deposit once you confirmRecieve'); state = State.Locked; buyer = payable(msg.sender); }
12,757,709
// SPDX-License-Identifier: MIT pragma solidity ^0.8.11; /** .__ .___ ______ ____ |__| ______ ____ ____ ____ __| _/ \____ \ / _ \ | | / ___/ / _ \ / \ _/ __ \ / __ | | |_> > ( <_> ) | | \___ \ ( <_> ) | | \ \ ...
Function to burn multiple bananas. Can only be called by infectContract bananaOwner. The address of the banana owner bananaTypes. The types of bananas to burn amounts. The amounts of bananas to burn/
function burnMultiple(address bananaOwner, uint256[] memory bananaTypes, uint256[] memory amounts) external onlyInfector { require(bananaTypes.length > 0, "Zero types provided"); require(bananaTypes.length == amounts.length, "Non equal amounts specified"); for (uint i = 0; i < banana...
287,905
./full_match/1/0xa1144d26fC7DA2775782cf60029c3a98b250F92c/sources/contracts/Elemxnts.sol
Update the mint price. price The new price./
function updateMintPrice(uint256 price) external onlyOwner { mintPrice = price; }
9,611,125
// File: openzeppelin-solidity/contracts/utils/ReentrancyGuard.sol pragma solidity ^0.5.2; /** * @title Helps contracts guard against reentrancy attacks. * @author Remco Bloemen <remco@2π.com>, Eenae <alexey@mixbytes.io> * @dev If you mark a function `nonReentrant`, you should also * mark it `external`. ...
Gets base set address from rebalancing set token and calculates amount of base set needed for issuance. _rebalancingSetAddress Address of the RebalancingSetToken to issue _rebalancingSetQuantity The Quantity of the rebalancing SetToken to issue return baseSetAddress The address of RebalancingSet's b...
function getBaseSetAddressAndQuantity( address _rebalancingSetAddress, uint256 _rebalancingSetQuantity ) internal view returns (address, uint256) { validateRebalancingSetIssuance(_rebalancingSetAddress, _rebalancingSetQuantity); address baseSetAddress...
5,523,465
./full_match/1/0x4Cee4FeD0367319437480690FCad4E5580010462/sources/IERC721Enumerable.sol
ERC-721 Non-Fungible Token Standard, optional enumeration extension/
interface IERC721Enumerable is IERC721 { function totalSupply() external view returns (uint256); function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId); function tokenByIndex(uint256 index) external view returns (uint256); pragma solidity ^0.8.0; }
3,868,872
./full_match/8453/0x46E4eaE74254346867bBF53E7D30BAa6F6C8cD5a/sources/src/governance/governor/Governor.sol
Cancels a proposal _proposalId The proposal id Ensure the proposal hasn't been executed Get a copy of the proposal Cannot realistically underflow and `getVotes` would revert Ensure the caller is the proposer or the proposer's voting weight has dropped below the proposal threshold If the proposal was queued: Cancel the...
function cancel(bytes32 _proposalId) external { if (state(_proposalId) == ProposalState.Executed) revert PROPOSAL_ALREADY_EXECUTED(); Proposal memory proposal = proposals[_proposalId]; unchecked { if (msg.sender != proposal.proposer && getVotes(proposal.proposer, block.timestam...
11,559,646
./partial_match/56/0x12af6eC2df89f6d8dB14e9a3177dB056552a8C94/sources/PepsiSwap.sol
Function to check the amount of tokens that an owner has allowed to a spender. owner_ The address which owns the funds. spender The address which will spend the funds. return The number of tokens still available for the spender./
function allowance(address owner_, address spender) public view override returns (uint256) { return _allowedPEPSI[owner_][spender]; }
11,097,333
// _.--. // _.-'_:-'|| // _.-'_.-::::'|| // _.-:'_.-::::::' || // .'`-.-:::::::' || // /.'`;|:::::::' ||_ // || ||::::::' _.;._'-._ // || ||:::::' _.-!oo @.!-._'-. // ...
Destroys `tokenId`. The approval is cleared when the token is refunded. Requirements: - `tokenId` must exist. Emits a {Transfer} event./ Clear approvals
function _refund(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId)...
7,939,164
pragma solidity =0.5.16; import './interfaces/IMintyswapV2Factory.sol'; import './MintyswapV2Pair.sol'; contract MintyswapV2Factory is IMintyswapV2Factory { address public feeTo; address public feeToSetter; mapping(address => mapping(address => address)) public getPair; address[] public allPairs; ...
if fee is on, mint liquidity equivalent to 1/6th of the growth in sqrt(k)
function _mintFee(uint112 _reserve0, uint112 _reserve1) private returns (bool feeOn) { address feeTo = IMintyswapV2Factory(factory).feeTo(); feeOn = feeTo != address(0); if (feeOn) { if (_kLast != 0) { uint rootK = Math.sqrt(uint(_reserve0).mul(_reserve1)); ...
12,069,813
./partial_match/1/0xBb12686c360e9057be3CD031140035A705e19ceC/sources/contracts/FeralfileArtworkV4.sol
Modify from ERC721Enumerable Will only trigger during construction. Batch transferring (minting) is not available afterwards.
function _beforeTokenTransfer( address from, address to, uint256 firstTokenId, uint256 batchSize ) internal virtual override { super._beforeTokenTransfer(from, to, firstTokenId, batchSize); if (batchSize > 1) { revert("ERC721Enumerable: consecutive tr...
3,987,852
// SPDX-License-Identifier: AGPL-3.0-or-later pragma solidity ^0.7.5; pragma abicoder v2; import "../libraries/SafeMath.sol"; import "../libraries/FixedPoint.sol"; import "../interfaces/IBondingCalculator.sol"; import "../interfaces/IXTokenWeth.sol"; import "../interfaces/INFTXLPStaking.sol"; import "../interfaces/IN...
SPDX-License-Identifier: MIT
interface INFTXVault { function vaultId() external view returns (uint256); }
6,919,980
/** *Submitted for verification at Etherscan.io on 2020-02-11 */ // File: @aragon/os/contracts/common/EtherTokenConstant.sol /* * SPDX-License-Identitifer: MIT */ pragma solidity ^0.4.24; // aragonOS and aragon-apps rely on address(0) to denote native ETH, in // contracts where both tokens and ETH are accept...
Returns the SECP256k1 public key associated with an ENS node. Defined in EIP 619. node The ENS node to query return x, y the X and Y coordinates of the curve point for the public key./
function pubkey(bytes32 node) public constant returns (bytes32 x, bytes32 y) { return (records[node].pubkey.x, records[node].pubkey.y); }
451,440
// SPDX-License-Identifier: MIT pragma solidity ^0.8.7; contract LotteryContract { event TicketPurchase(address indexed player, uint256 amount); event TicketRefund(address indexed player, uint256 amount); event PickWinner(uint256 winnerIndex, address winner, uint256 amountWinner, uint256 amountAdmin); struc...
Function to get the total amount of tickets sold./
function getTotalTicketsSold() external view returns (uint256) { return totalTicketsSold; }
909,455
pragma solidity ^0.4.18; /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { uint256 public totalSupply; function balanceOf(address who) public view returns (uint256); function transfer(address to, uint2...
Constructor for a crowdsale of QuantstampToken tokens. ifSuccessfulSendTo the beneficiary of the fund fundingGoalInEthers the minimum goal to be reached fundingCapInEthers the cap (maximum) size of the fund minimumContributionInWei minimum contribution (in wei) start ...
function EBSCSale( address ifSuccessfulSendTo, uint fundingGoalInEthers, uint fundingCapInEthers, uint minimumContributionInWei, uint start, uint end, uint rateEBSCToEther, address addressOfTokenUsedAsReward ) public { require(ifSuccessfulS...
14,115,679
./full_match/5/0xa9703eF23D9F162ACA3eD63fdDbc68669c56D83D/sources/C/repos/cg-cryptoverse-transport/contracts/CVTransport.sol
_setTokenURI(_tokenId, tokenURI);
function mint(address _mintTo, uint256 _tokenId) external returns (uint256) { require(hasRole(MINTER_ROLE, msg.sender), "Caller is not minter"); _mint(_mintTo, _tokenId); return _tokenId; }
1,857,823
// SPDX-License-Identifier: AGPL-3.0-or-later pragma solidity ^0.8.0; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; import "@openzeppe...
return The mutex lock flag for transferring./
function isTransferMutexLocked() external view returns (bool) { return _isTransferMutexLocked; }
12,022,894
// 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...
Finalize the epoch with a buyback and a specific ETH amount to use minOut Minimum amount of tokens received from the buyback. Used for slippage protection ethAmount Amount of ETH to use Only run if _max is not the 0 address. Covers edge case when all staking rewards are disabled
function buybackSpecificETH(uint256 minOut, uint256 ethAmount) public onlyOwner { require(_pointer == stakingRewardsCount, "runEpoch incomplete"); require(ethAmount <= address(this).balance, "ethAmount too large"); if (address(_max) != address(0)) { IERC20 tok...
13,928,332
// SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.7.0 <0.9.0; // import "./IERC20.sol"; // 参考https://docs.soliditylang.org/en/latest/solidity-by-example.html#safe-remote-purchase // 已部署的DCT合约 // import "./DCT.sol"; interface ERC20 { function transfer(address recipient, uint256 amount) external returns (...
3 获取所有正在进行任务状态(悬赏榜) 遍历正在进行任务的索引,返回正在进行的任务 过期的任务作废 暂不设置 if(uint(MissionDetailList[bounties[index]].ddl) > block.timestamp){ } 返回正在进行的任务
function getMissionBrief() public view returns(uint, MissionDetail[] memory){ MissionDetail[] memory MissionBrief = new MissionDetail[](bountyOngoing_NUM); for(uint index = 0; index < MissionIDList.length; index++){ if(true == bountyOngoing[index]){ MissionDetail memory...
972,973
// SPDX-License-Identifier: MIT pragma solidity ^0.6.7; import "./strategy-base.sol"; import "../../interfaces/oxd-chef.sol"; abstract contract StrategyOxdXtokenFarmBase is StrategyBase { // Token addresses address public constant oxd = 0xc165d941481e68696f43EE6E99BFB2B23E0E3114; address public usdc = 0x0...
Collects OXD tokens
function harvest() public virtual override { IOxdChef(oxdChef).deposit(poolId, 0); uint256 _oxd = IERC20(oxd).balanceOf(address(this)); if (_oxd > 0) { uint256 _keepOXD = _oxd.mul(keepOXD).div(keepOXDMax); IERC20(oxd).safeTransfer( IController(control...
14,081,655
pragma solidity ^0.5.0; pragma experimental ABIEncoderV2; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when ...
Gets the approved address for a token ID, or zero if no address set Reverts if the token ID does not exist. tokenId uint256 ID of the token to query the approval of return address currently approved for the given token ID/
function getApproved(uint256 tokenId) public view returns (address) { require( _exists(tokenId), "ERC721: approved query for nonexistent token" ); return _tokenApprovals[tokenId]; }
25,927
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.4; import "./TokenManager.sol"; import "./DomainManager.sol"; import "./WalletGraph.sol"; import "./Enums.sol"; import "./IONEWallet.sol"; contract ONEWallet is TokenManager, IONEWallet { using TokenTracker for TokenTrackerState; using WalletGraph fo...
Invalid entry. Ignore
function _verifyReveal(bytes32 hash, uint32 indexWithNonce, bytes32 paramsHash, bytes32 eotp, OperationType operationType) view internal returns (uint32) for (uint32 i = 0; i < cc.length; i++) { Commit storage c = cc[i]; bytes32 expectedVerificationHash = keccak256(bytes.concat(c.par...
6,488,397
pragma solidity 0.4.15; import '../../Snapshot/Snapshot.sol'; import '../../Standards/ISnapshotToken.sol'; import './MMint.sol'; contract BasicSnapshotToken is ISnapshotToken, MMint, Snapshot { //////////////////////// // Immutable state //////////////////////// // `parentToken` is the T...
Queries the balance of `owner` at a specific `snapshot` owner The address from which the balance will be retrieved snapshot The block number when the balance is queried return The balance at `snapshot` If there is a value, return it Try parent contract at or before the fork
function balanceOfAt(address owner, uint256 snapshot) public constant returns (uint256) { Values[] storage values = _balances[owner]; if (hasValueAt(values, snapshot)) { return getValueAt(values, snapshot, 0); } if (address(PARENT_TOKEN) != 0...
5,515,046
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity ^0.7.6; pragma abicoder v2; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "./SwapRouter.sol"; import "./GrantRegistry.sol"; import "./GrantRound.sol"; import "hardhat/console.sol"; contract...
Core donation logic that transfers funds to grants _donations Array of donations to execute/ Get data for this donation Execute transfer
function _transferDonations(Donation[] calldata _donations) internal { for (uint256 i = 0; i < _donations.length; i++) { GrantRound[] calldata _rounds = _donations[i].rounds; uint96 _grantId = _donations[i].grantId; IERC20 _tokenIn = _donations[i].token; uint2...
5,372,150
./full_match/73799/0xf4F41dcBB159cc401BB60Ae328bbc4159c776CF6/sources/contracts/trove-factory.sol
remove a trove from the list and send any remaining token balance to the owner _trove is the trove which will be removed/ we can safely decrease the balance to zero with a newNextTrove of 0x0 because the debt is zero and insertTrove will not be called the collateral should be sent to the owner TODO: add test for this ...
function removeTrove(address _token, address _trove) public override troveExists(_token, _trove) { ITrove trove = ITrove(_trove); require( trove.owner() == msg.sender || _trove == msg.sender, "173fa only the owner can remove the trove from the list" ); require(trove.debt() == 0, "173fa rep...
16,363,608
//SPDX-License-Identifier: Unlicense pragma solidity ^0.8.7; import "@openzeppelin/contracts/access/Ownable.sol"; import "./ImbuedNFT.sol"; /** @title Imbued Minter v1 Controls the ImbuedNFT contract and allows users to mint new weaves, and the owner to mint a major weave, that is sent to the auction contrac...
Edition transfers can only be allowed, there is no way to disallow them later.
function setEditionTransferable(uint256 edition) external onlyOwner { editionTransferable[edition] = true; emit EditionTransferable(edition); }
1,612,645
pragma solidity ^0.8.0; //pragma experimental ABIEncoderV2; import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Address.sol"; contract Called_contract{ event LogBytes(bytes data); uint Nbr; string public name="Name"; constructor() { } ...
Make sure that string is not longer than 32 bytes or result will be cut
function stringToBytes32(string memory source) public pure returns (bytes32 result) { bytes memory tempEmptyStringTest = bytes(source); if (tempEmptyStringTest.length == 0) { return 0x0; } assembly { result := mload(add(source, 32)) } }
7,215,422
/** Copyright (c) 2018, ZSC Dev Team 2018-10-19: v0.00.01 */ pragma solidity ^0.4.25; // pragma experimental ABIEncoderV2; import "../utillib/LibString.sol"; import "../utillib/LibInt.sol"; import "../common/hashmap.sol"; import "../common/delegate.sol"; contract InsurancePolicy is Delegate { using LibStri...
[desc] Get policy brief info. [param] _key: policy key. [param] _addr: info address. [return] error code and info for json data. 0: success/
function _getBriefInfo(string _key, address _addr) private pure returns (int, string) { string memory str = "{\"Size\":2,"; string memory policy = "0x"; policy = policy.concat(_addr.addrToAsciiString()); str = str.concat(_key.toKeyValue("Key"), ","); str = str.concat(policy...
12,535,672
pragma solidity ^0.4.21; contract Owner { address public owner; modifier onlyOwner() { require(msg.sender == owner); _; } function Owner(address _owner) public { owner = _owner; } function changeOwner(address _newOwnerAddr) public onlyOwner { ...
ERC20 standard function
function transfer(address _to, uint256 _value) external transferable returns (bool) { require(_to != address(0)); require(_value > 0); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); ...
1,843,780
./full_match/4/0x12E787cB66fF2afbb03Db6b8c9321fd371e4102F/sources/browser/property.sol
Take down the property from the market _propertyId Property ID/
function markPropertyAsInactive(uint256 _propertyId) public { require( properties[_propertyId].owner == msg.sender, "THIS IS NOT YOUR PROPERTY" ); properties[_propertyId].isActive = false; }
669,647
pragma solidity ^0.4.18; import 'zeppelin-solidity/contracts/math/SafeMath.sol'; import "./OwnableRegistry.sol"; import "./OwnerRegistry.sol"; import "./ActivatableRegistry.sol"; import "./ApprovableRegistry.sol"; import './BotCoinPayableRegistry.sol'; /** * @title BotEntryStorableRegistry */ contract BotEntryStorabl...
Sets bot entry data botEntryId An id associated with the bot entry botEntryAddress An address associated with the bot entry/
function setBotEntryData(uint256 botEntryId, address botEntryAddress) private { _storage.setAddress(keccak256("botEntryAddresses", botEntryId), botEntryAddress); }
899,587
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pur...
Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. The call is not executed if the target address is not a contract. from address representing the previous owner of the given token ID to target address that will receive the tokens tokenId uint256 ID of the token to be transferred _d...
function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { ...
10,148,803
pragma solidity ^0.4.23; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { // Gas optimization: this is ch...
Determines how ETH is stored/forwarded on purchases./
function _forwardFunds(address _wallet) internal { _wallet.transfer(msg.value); }
1,809,534
//SPDX-License-Identifier: MIT pragma solidity 0.8.9; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/c...
get the tokenURI for the project
function tokenURI(uint256 _tokenId) public view virtual override onlyValidTokenId(_tokenId) returns (string memory) { return string(abi.encodePacked(projectBaseURI, Strings.toString(_tokenId))); }
521,536
// SPDX-License-Identifier: MIT // File: @openzeppelin/contracts/security/ReentrancyGuard.sol // OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the ...
Safely mints `quantity` tokens and transfers them to `to`. Requirements: - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called for each safe transfer. - `quantity` must be greater than 0. Emits a {Transfer} event./
function _safeMint( address to, uint256 quantity, bytes memory _data ) internal { _mint(to, quantity, _data, true); }
14,565,542
// SPDX-License-Identifier: Apache-2.0 // Copyright 2017 Loopring Technology Limited. pragma solidity ^0.7.0; /// @title Ownable /// @author Brecht Devos - <brecht@loopring.org> /// @dev The Ownable contract has an owner address, and provides basic /// authorization control functions, this simplifies the impleme...
Truncate the least significant 3 bits from the 256bit entropy so it fits the scalar field
function getProofEntropy( uint256[] memory in_proof, uint256[] memory proof_inputs, uint proofNumber ) internal pure returns (uint256) { return uint( keccak256( abi.encodePacked( in_proof[proofNumber*8 + 0], in_proof[pro...
2,231,926
pragma solidity ^0.4.24; //============================================================================== // struct //============================================================================== library ArtChainData { struct ArtItem { uint256 id; uint256 price; uint256 lastTransP...
============================================================================== query==============================================================================
function isPaused() public view returns (bool) { return paused; }
6,444,264
// SPDX-License-Identifier: MIT pragma solidity ^0.7.1; import "./OffchainAggregator.sol"; import "./SimpleReadAccessController.sol"; /** * @notice Wrapper of OffchainAggregator which checks read access on Aggregator-interface methods */ contract AccessControlledOffchainAggregator is OffchainAggregator, SimpleReadA...
sets the requester access controller _requesterAccessController designates the address of the new requester access controller/
{ AccessControllerInterface oldController = s_requesterAccessController; function requesterAccessController() external view returns (AccessControllerInterface) } function setRequesterAccessController(AccessControllerInterface _requesterAccessController) public onlyOwner() if (_reque...
56,036
// SPDX-License-Identifier: Unlicense pragma solidity >=0.6.2; import './Utilities.sol'; /// @notice This contract manages 'dripping assets' from a droplet and acts as a wrapper/gatekeeper /// around the assets for `rollupBridge`. /// The `rollupBridge` can only be set once and has an activation delay of `ACTIVATION_...
How long (in seconds) we have to wait once the change of `rollupBridge` can be applied.
function ACTIVATION_DELAY () internal view virtual returns (uint256) { }
14,125,569
./full_match/83/0xdb68eC6dFd21791cC9c1f4836b6499e2325461A7/sources/contracts/suErc20Delegator.sol
Sender supplies assets into the market and receives cTokens in exchange Accrues interest whether or not the operation succeeds, unless reverted mintAmount The amount of the underlying asset to supply return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/
function mint(uint256 mintAmount) external returns (uint256) { bytes memory data = delegateToImplementation(abi.encodeWithSignature('mint(uint256)', mintAmount)); return abi.decode(data, (uint256)); }
9,556,317
./full_match/83/0x2f6C93c4cf8D41d1dFdA96429d5e6DEb5ed20a4d/sources/contracts/Comptroller/ComptrollerStorage.sol
Set the given borrow caps for the given cToken markets. Borrowing that brings total borrows to or above borrow cap will revert. Admin or borrowCapGuardian function to set the borrow caps. A borrow cap of 0 corresponds to unlimited borrowing. cTokens The addresses of the markets (tokens) to change the borrow caps for ...
function setMarketBorrowCaps( address[] calldata cTokens, uint256[] calldata newBorrowCaps ) public override onlyRole(DEFAULT_ADMIN_ROLE) { uint256 numMarkets = cTokens.length; uint256 numBorrowCaps = newBorrowCaps.length; require( numMarkets != 0 && numMarket...
9,563,494
./full_match/1/0x0b1b37c0d376e72d523319c6592f3A24D39912fD/sources/contracts/proxy/VersionedInitializable.sol
Returns the revision number of the contract Needs to be defined in the inherited class as a constant. return The revision number/ Returns true if and only if the function is running in the constructor return True if the function is running in the constructor/ extcodesize checks the size of the code stored in an addre...
function getRevision() public pure virtual returns (uint256); function isConstructor() private view returns (bool) { uint256 cs; assembly { cs := extcodesize(address()) } return cs == 0; }
3,068,024
./full_match/1/0xe7d20aEd148751365729c35019eF8813Caa7dAf5/sources/contracts/tokenCutters/ProofNonReflectionTokenCutter.sol
Atomically increases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address./
function increaseAllowance( address spender, uint256 addedValue ) external virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, _allowances[owner][spender] + addedValue); return true; }
9,709,310
pragma solidity 0.4.19; library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically ...
safety checks assign variables assign the total supply to the owner
function FriendzToken(string _name, string _symbol, uint256 _decimals, uint256 _supply) public { require(_decimals > 0); require(_supply > 0); name = _name; symbol = _symbol; decimals = _decimals; totalSupply = _supply; balances[owner] = _supply; }
2,549,773
pragma solidity 0.5.7; pragma experimental ABIEncoderV2; import "./Ownable.sol"; import "./SafeMath.sol"; /** * @dev Contract module which provides an authorisation control mechanism, where * there is an 'owner' that can grant access to a specific 'reader'. * The 'reader' can request access to an 'owner'. */ con...
Check authorisation of the '_reader' for the '_owner'./
function isAuthorised(address _owner, address _reader) public view returns (bool) { return _isAuthorised(_owner, _reader); }
6,394,164
./full_match/80001/0x71eACEb0d09778b241155CCc8628D0Cb9ea0Fc1a/sources/contracts/StakingToken.sol
Staking token amount
function unStake(address stakingToken_, uint8 stakeId_) public nonReentrant { require( stakingToken_ != address(0), "UnStake: Zero address stakingToken" ); require( configTokens[stakingToken_].canUnStake == true, "UnStake: Token can't unStake"...
9,535,995
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, sinc...
Gets the integration for the module with the passed in hash. Validates that the address is not empty/
function getAndValidateAdapterWithHash(bytes32 _integrationHash) internal view returns (address) { address adapter = controller.getIntegrationRegistry().getIntegrationAdapterWithHash( address(this), _integrationHash ); require(adapter != address(0), "Must be valid adapter"); return adapte...
100,957
./partial_match/80001/0x69fcF6A264F5017CBdA314535ddD5c765A7F5968/sources/contracts/base/AlgebraPoolBase.sol
@inheritdoc IAlgebraPoolState
function getCommunityFeePending() external view override returns (uint128, uint128) { return (communityFeePending0, communityFeePending1); }
8,812,869
// SPDX-License-Identifier: MIT pragma solidity 0.7.4; import "./TellorStake.sol"; import "./TellorGetters.sol"; import "./Utilities.sol"; import "./ITellor.sol"; import "./SafeMath.sol"; /** @author Tellor Inc. @title Tellor @dev Main functionality for Tellor Oracle system **/ contract Tellor is TellorStake,Ut...
This is an internal function used by submitMiningSolution to calculate and pay rewards to miners miners are the 5 miners to reward _previousTime is the previous mine time based on the 4th entry/_timeDiff is how many seconds passed since last block
function _payReward(address[5] memory miners, uint256 _previousTime) internal { uint256 _timeDiff = block.timestamp - _previousTime; uint256 reward = (_timeDiff * uints[_CURRENT_REWARD]) / 300; uint256 _tip = uints[_CURRENT_TOTAL_TIPS] / 10; uint256 _devShare = reward / 2...
9,847,196
// 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...
This is called by another version of controller to migrate a pod to this version Will only accept calls from registered controllers Can only be called once. _podId The id number of the pod _podAdmin The address of the pod admin _safeAddress The address of the safe/
function updatePodState( uint256 _podId, address _podAdmin, address _safeAddress ) external { require(_safeAddress != address(0), "Invalid address"); require( controllerRegistry.isRegistered(msg.sender), "Controller not registered" ); ...
14,657,560
./full_match/41/0x49c995e164fc07A5c76ec25038b7A1588d62855a/sources/contracts/CalendarDailyTelos.sol
Only an account with the DEFAULT_ADMIN_ROLE can grant the ADMIN_ROLE If account is not a member, grant it MEMBER_ROLE and add to the members mapping
function grantAdminRole(address account) public { require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "Caller is not a default admin"); grantRole(ADMIN_ROLE, account); if (!hasRole(MEMBER_ROLE, account)) { grantRole(MEMBER_ROLE, account); members[account] = Member({ ...
16,369,817
// SPDX-License-Identifier: SEE LICENSE IN LICENSE pragma solidity 0.6.12; import "./interfaces/IBancorFormula.sol"; import "../utility/SafeMath.sol"; contract BancorFormula is IBancorFormula { using SafeMath for uint256; uint256 private constant ONE = 1; uint32 private constant MAX_WEIGHT = 1000...
given a token supply, reserve balance, weight and a sell amount (in the main token), calculates the target amount for a given conversion (in the reserve token) Formula: return = _reserveBalance (1 - (1 - _amount / _supply) ^ (1000000 / _reserveWeight)) _supply smart token supply _reserveBalance reserve bal...
function saleTargetAmount(uint256 _supply, uint256 _reserveBalance, uint32 _reserveWeight, uint256 _amount) public override view returns (uint256) { require(_supply > 0, "ERR_INVALID_S...
1,786,809
// SPDX-License-Identifier: MIT pragma solidity ^0.6.0; import "../common/Decimal.sol"; import "../common/SafeMath.sol"; import "../common/IERC20.sol"; import "../common/SafeERC20.sol"; import "../ownership/Ownable.sol"; import "../utils/Version.sol"; import "./ManagerConstants.sol"; import "./RewardDistribution.sol";...
canWithdraw checks if the given un-stake request for the given delegate and validator ID is already unlocked and ready to be withdrawn. if the validator dropped its validation account, delegations will unlock sooner
function canWithdraw(address delegate, uint256 validatorID, uint256 requestID) external view returns (bool) { uint256 requestTime = getUnstakingRequest[delegate][validatorID][requestID].time; if (0 < getValidator[validatorID].deactivatedTime && requestTime > getValidator[validatorID].deactivatedTime...
13,086,641
pragma solidity 0.5.8; import "../STO.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "./PreSaleSTOStorage.sol"; /** * @title STO module for private presales */ contract PreSaleSTO is PreSaleSTOStorage, STO { using SafeMath for uint256; event TokensAllocated(address _investor, uint...
Returns the total no. of tokens sold/
function getTokensSold() external view returns(uint256) { return totalTokensSold; }
12,769,168
pragma solidity ^0.4.18; /* 项目:以太世界信息链项目,商贸信息网 时间:2018-03-23 */ contract gradeinfo{ struct ProjectData{ string Descript; //项目描述 address dapp_address; //项目地址(ENS域名,或者42位以太坊项目合约地址) string dapp_ens; string dapp_jsoninfo; //项目ABI json信息 address Owner; //...
查询一个项目名称是否已经存在,true-存在,false-不存在
function __FindProjects(string ProjectName) constant private returns(bool r) { if(bytes(ProjectName).length==0) return false; if(bytes(ProjectDatas[ProjectName].Descript).length==0) return false; return true; }
6,237,370
./full_match/5/0x13FDeFcadca58916f3BFDD492dBa2F522fb58558/sources/ERC1410Operator.sol
Determines whether `_operator` is an operator for a specified partition of `_tokenHolder` _partition The partition to check _operator The operator to check _tokenHolder The token holder to check return Whether the `_operator` is an operator for a specified partition of `_tokenHolder`
function isOperatorForPartition( bytes32 _partition, address _operator, address _tokenHolder ) public view returns (bool) { return operatorForThisPartition[_tokenHolder][_partition][_operator]; } modifier onlyOperatorForPartition( bytes32 _partition, addr...
1,852,805
// File: @openzeppelin\upgrades\contracts\Initializable.sol pragma solidity >=0.4.24 <0.7.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...
return uint256 the total amount of KittieFightToken rewards return uint256 the total amount of SuperDaoFightToken rewards/
function getTotalRewards() public view returns (uint256, uint256) { uint256 rewardsKTY = yieldFarming.totalRewardsKTY(); uint256 rewardsSDAO = yieldFarming.totalRewardsSDAO(); return (rewardsKTY, rewardsSDAO); }
617,000
./partial_match/1/0x25C7C475934f40908523a36d5d7ea810D890b50F/sources/contracts/L1/Colosseum.sol
Determines whether bisection is possible in the challenge corresponding to the given L2 output index. _outputIndex Index of the L2 checkpoint output. _challenger Address of the challenger. return Whether bisection is possible./
function isAbleToBisect(uint256 _outputIndex, address _challenger) public view returns (bool) { Types.Challenge storage challenge = challenges[_outputIndex][_challenger]; return _isAbleToBisect(challenge); }
16,186,973
// SPDX-License-Identifier: Apache-2.0 pragma solidity 0.7.6; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./interfaces/IKernel.sol"; contract Rewards is Owna...
registerUserAction is called by the Kernel every time the user does a deposit or withdrawal in order to account for the changes in reward that the user should get it updates the amount owed to the user without transferring the funds
function registerUserAction(address user) public { require(msg.sender == address(kernel), 'only callable by kernel'); _calculateOwed(user); }
2,528,416
// SPDX-License-Identifier: MIT /* Copyright (c) 2018 requestnetwork Copyright (c) 2018 Fragments, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without lim...
calculation happens offchain
function setRatio(int256 _ratio) external { require(_ratio > 0, "Ratio must be higher than 0"); ratio = _ratio; emit RatioSet(_ratio, block.timestamp); }
12,617,669
./full_match/5/0xeaee146414B475Ba148235910DA00c35b4E1436E/sources/contracts/FundForward.sol
This function creates a new proposal and returns its ID
function createProposal(string memory _description) public returns (uint256) { Proposal storage proposal = proposals[numberOfProposals]; proposal.description = _description; proposal.yesVotes = 0; proposal.noVotes = 0; proposal.abstainVotes = 0; proposal.open = true;...
1,856,478
pragma solidity ^0.6.0; pragma experimental ABIEncoderV2; import "./User.sol"; interface OfferRideInterface { enum offerRideStatus {active, progress, cancel, completed, uncompleted} struct offerRide { uint256 oid; address user; uint256 vid; string start_location; string...
To find ride using destination match
function findRides(findRide memory _finfRide) public view onlyRegisteredUser returns (offerRide[] memory) { offerRide[] memory currentRides = new offerRide[](offerRideId); for (uint256 i = 0; i < offerRideId; i++) { if ( OfferRideList[i...
1,815,015
pragma solidity ^0.4.11; /* Ethart unindexed Factory Contract: Ethart ARCHITECTURE ------------------- _________________________________________ V V Controller --> Registrar <--> Factory Contract1 --> Artwork Contract1 Factory Contract2 Artwork Contract2 ... ... ...
Owner has 24h first right of refusual to fill the bid. Ethart can only fill bids after 1 year.
function fillBid () ownerFirst ethArtOnlyAfterOneYear notLocked(msg.sender, 1) {
2,109,012
./full_match/11155111/0xEc33c558f792C8Ea8993aa368fb470fC096cBca5/sources/contracts/DashoneContract.sol
Only the seller of this listing can update the stock
function updateStock(uint256 listingId, uint256 newStock) public { Listing storage listing = listings[listingId]; require(msg.sender == listing.seller, "Only the seller can update the stock."); listing.stock = newStock; emit StockUpdated(listingId, newStock); }
3,813,604
/** *Submitted for verification at Etherscan.io on 2021-06-28 */ pragma solidity 0.6.12; pragma experimental ABIEncoderV2; interface TrueFiPool { function join(uint256 amount) external; function balanceOf(address user) view external returns (uint256 amount); function liquidExit(uint256 amount) external;...
Controller only function for creating additional rewards from dust
function withdraw(IERC20 _asset) external override returns (uint256 balance) { require(address(_asset) != want, 'wantToken'); require(address(_asset) != trueFiPool, 'tfToken'); require(address(_asset) != stakingFarm, 'tfiLPFarming'); balance = _withdrawNonWantAsset(_asset); }
2,331,284
./partial_match/1/0x2a803B33fE175689BB6487101257be70CCade3ED/sources/SErc20Delegate.sol
The sender liquidates the borrowers collateral. The collateral seized is transferred to the liquidator. borrower The borrower of this sToken to be liquidated repayAmount The amount of the underlying borrowed asset to repay sTokenCollateral The market in which to seize collateral from the borrower return uint 0=succ...
function liquidateBorrow(address borrower, uint repayAmount, STokenInterface sTokenCollateral) external returns (uint) { (uint err,) = liquidateBorrowInternal(borrower, repayAmount, sTokenCollateral); return err; }
4,113,946
./full_match/80001/0x37E48eBAb579e2F3Db1346e67f9D8095A5cb1B7D/sources/project_/contracts/Payken.sol
require(saleData.seller != msg.sender, "You're the owner");
function purchase( uint256 quantity, address userAddress, uint256 tokenId, uint256 amount ) internal { require(tokenId > 0, "invalid Token Id"); require(userAddress != address(0), "not address(0)"); Sale storage saleData = sale[tokenId]; require(saleData.status != false, "Not On ...
5,600,629
./full_match/80001/0x8D970C6f57834c5F90e299eBaB0855941546412e/sources/project_/contracts/NTT1155.sol
Returns computed metadata {ComputedMetadata} by passed tokenId Requirements: - runs only for existing tokens/
function getNttMetadata( uint256 tokenId ) public view override isExistNTT(tokenId) returns (ComputedMetadata memory) { Metadata memory m = _nttMetadata[tokenId]; bool isValidExpirationTime = nttStatus(tokenId) != TokenStatus.EXPIRED; ...
5,591,747
//Address: 0xecfad7325b812e45ed07e0dbc7ef3f98f13fb4f5 //Contract name: ProofShrimpFarmer //Balance: 0 Ether //Verification Date: 6/5/2018 //Transacion Count: 1 // CODE STARTS HERE pragma solidity ^0.4.21; // solhint-disable-line /* * One Proof Shrimp Farm * https://oneproof.net/games/shrimp * * Instead of having m...
Calculate eggs to buy simple
function calculateEggBuySimple(uint256 eth) public view returns(uint256){ return calculateEggBuy(eth, tokenContract.myTokens()); }
6,379,310
/** *Submitted for verification at Etherscan.io on 2022-03-02 */ // hevm: flattened sources of src/BROtoken.sol // SPDX-License-Identifier: MIT pragma solidity =0.8.10 >=0.8.10 >=0.8.0 <0.9.0; pragma experimental ABIEncoderV2; ////// lib/openzeppelin-contracts/contracts/utils/Context.sol // OpenZeppelin Contracts v4...
exclude from paying fees or having max transaction amount
constructor() ERC20("BRO Token", "BRO") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02( 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D ); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswapV2Pair = IUni...
15,006,506
./partial_match/1/0x8fBeDAFCc0a4EDA503ceEd3FF64e668AB27B4D65/sources/xBRKB.sol
Creates `amount` new tokens for `to`. See {ERC20-_mint}. Requirements: - the caller must have the `MINTER_ROLE`./
function mint(address to, uint256 amount) public virtual onlyMinter { _mint(to, amount); }
2,604,116
pragma solidity 0.4.24; //https://www.sperm.network/ponzi //https://discord.gg/AkaGFuE contract Sperm { /*===================================== = CONFIGURABLES = =====================================*/ string public name = "Sperm Ponzi" ; string public symbol = "Sperm"; uint8 cons...
Multiplies two numbers, throws on overflow./
function mul(uint a, uint b) internal pure returns (uint) { if (a == 0) { return 0; } uint c = a * b; assert(c / a == b); return c; }
1,163,882
./full_match/5/0xaf7629ab114eFcC188Ee5ed6F186077740648Fe4/sources/contracts/ERC20.sol
Transfer token for a specified addresses from The address to transfer from. to The address to transfer to. value The amount to be transferred./
function _transfer(address from, address to, uint256 value) internal { require(to != address(0)); _balances[from] = _balances[from] - value; _balances[to] = _balances[to] + value; emit Transfer(from, to, value); }
1,892,063
/** Source code of Opium Protocol Web https://opium.network Telegram https://t.me/opium_network Twitter https://twitter.com/opium_network */ // File: LICENSE /** The software and documentation available in this repository (the "Software") is protected by copyright law and accessible pursuant to the licens...
This function validates whether sender address equals to `msg.sender` or set to zero address _order SwaprateOrder
function validateSenderAddress(SwaprateOrder memory _order) internal view { require( _order.senderAddress == address(0) || _order.senderAddress == msg.sender, ERROR_MATCH_SENDER_ADDRESS_WRONG ); }
1,368,215
// SPDX-License-Identifier: MIT pragma solidity >= 0.6.0; import "./lib/Ownable.sol"; import "./lib/EthlingUtils.sol"; import "./lib/SafeERC20.sol"; import "./lib/ReentrancyGuard.sol"; import "./IEthlings.sol"; import "./ChangeToken.sol"; import "./Wearables.sol"; import "./lib/ERC721.sol"; contract Ethlings is ...
re-randomizes the slots that are customizable for a given avatar avatarId the avatar to re-randomize return the id of the new avatar (old one is burned)/
function reroll(uint256 avatarId) external nonReentrant onlyUnlocked returns (uint256) { require(ownerOf(avatarId) == _msgSender(), "Invalid avatar"); require(EthlingUtils.isAvatarDefault(avatars[avatarId]), "Must remove all prints before rerolling"); (uint256 newAvatarId, ) = EthlingUtils.g...
1,785,380
./partial_match/11297108099/0x4C7E1e1Ba5e35934C8323d75AF838fDa26588177/sources/contracts/interfaces/0.8.x/IGenArt721CoreV2_PBAB.sol
getter function of public variable getter function of public variable getter function of public mapping
interface IGenArt721CoreV2_PBAB { event Mint( address indexed _to, uint256 indexed _tokenId, uint256 indexed _projectId ); function admin() external view returns (address); function nextProjectId() external view returns (uint256); function tokenIdToProjectId(uint256 tokenI...
11,034,232
./full_match/43113/0x6b9c8c5ac8161a932FF63308D0dF500a76c069AF/sources/src/Comptroller/IronControllerV2.sol
account shortfall below collateral requirements)/
function getAccountLiquidityInternal(address account) internal view returns (Error, uint, uint) { return getHypotheticalAccountLiquidityInternal(account, RToken(0), 0, 0); }
7,113,058
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol) pragma solidity ^0.8.0; import "./IAccessControlUpgradeable.sol"; /** * @dev External interface of AccessControlEnumerable declared to support ERC165 detection. */ interface IAccessControlEnumerableUpgradeable is...
@inheritdoc IPoolCollection/
function underlyingToPoolToken(Token pool, uint256 tokenAmount) external view returns (uint256) { Pool storage data = _poolData[pool]; return _underlyingToPoolToken(tokenAmount, data.poolToken.totalSupply(), data.liquidity.stakedBalance); }
10,394,337
./full_match/4/0x03Bf8d9D75cD898896Cdad9f4EBd690Cfc8b0A09/sources/contracts/StakingToken.sol
A simple method that calculates the rewards for each stakeholder. _stakeholder The stakeholder to calculate rewards for./
function calculateReward(address _stakeholder) public view returns(uint256) { return stakes[_stakeholder] / 100; }
801,915
./partial_match/1/0x0cC0F07b25F52D38133EFd5930364AcE009d0Ba4/sources/CUBI.sol
exclude from paying fees or having max transaction amount
constructor() ERC20("Cubie Bird", "CUBI") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02( 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D ); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; buyTaxFees = 1; ...
2,770,463
pragma solidity ^0.5.0; // File: contracts/IndividualCertification.sol /** * @title Individual Certification Contract * @author Rosen GmbH * * This contract represents the individual certificate. */ contract IndividualCertification { address public registryAddress; bytes32 public b0; ...
Derives an unique key from a certificate identifier to be used in the global mapping CertificateAddresses. This is necessary due to certificate identifiers are of type string which cannot be used as dictionary keys. _CertID The unique certificate identifier. return The key derived from certificate identifier./
function toCertificateKey(string memory _CertID, string memory _organizationID) public pure returns (bytes32) { return keccak256(abi.encodePacked(_CertID, _organizationID)); }
5,401,382
./partial_match/56/0xe3085D1c23242A7c4DbE54774452eb8763664906/sources/MasterChef.sol
Returns the SHUFtraction of two unsigned integers, reverting with custom message on overflow (when the result is negative). Counterpart to Solidity's `-` operator. Requirements: - SHUFtraction cannot overflow./
function SHUF(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; }
11,090,892
// SPDX-License-Identifier: MIT pragma solidity 0.6.8; // /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amou...
Mints new pool token. _account The account address used to mint. _amounts Unconverted token balances used to mint pool token. _minMintAmount Minimum amount of pool token to mint./ We don't perform input validations here as they are done in ACoconutSwap.
function mintToken(address _account, uint256[] memory _amounts, uint256 _minMintAmount) public validAccount(_account) { Account account = Account(payable(_account)); for (uint256 i = 0; i < _amounts.length; i++) { account.approveToken(swap.tokens(i), address(swap), _amounts[i]); ...
10,599,650
./full_match/42220/0xE9BF203737A1772B2E147E08fC23D939aA432627/sources/contracts/StorageContract.sol
Sets new factory address Only owner can call it _factory New factory address/
function setFactory(address _factory) external onlyOwner { require(_factory != address(0), "incorrect address"); factory = _factory; emit FactorySet(_factory); }
16,338,066
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) 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 functio...
Remove an account to the user role. Restricted to admins.
function removeMinter(address account) public onlyOwner { require(minters[account] == true, "account is already a minter"); minters[account] = false; emit MinterRemoved(account); }
11,989,815
./full_match/1/0x01c5AFdC4d40d4632c630E8371c49088084EA9c3/sources/contracts/TermAuction.sol
Returns the min of two `uint256` values a The first value to compare b The second value to compare return The min of the two values
function _minUint256(uint256 a, uint256 b) internal pure returns (uint256) { if (a >= b) { return b; return a; } }
8,466,318
./full_match/1/0x8cb8fEe1476285486A1F3efDAf53146b3eA831cd/sources/src/zodiac/modules/ShipModule.sol
Verifies that buying the specified NFT contract is allowed. nftContract The address of the NFT contract to verify. This function is read-only and does not modify the state of the contract. If the buy restrictions are not met or if the specified NFT contract is not allowed, the function will revert with a custom erro...
function verifyBuyRestrictions(address nftContract) public view { if (!_isRaiseOpen() || _hasRaiseClosed()) { revert BuyClosed(); revert RaiseNotMet(); } if (!nfts[nftContract] && enforceBuyRestrictions) { revert NFTNotAllowed(); } }
17,188,864
// Summary: Simple contract to set and display a variable contract HelloWorld { string greeting; // Summary: Constructor that accepts value during deployment // Input: string function HelloWorld(string _greeting) public { creator = msg.sender; greeting = _greeting; } // Sum...
Summary: Shows the greeting message. Returns string
function greet() constant returns (string) { return greeting; }
7,309,551
./full_match/84531/0xAC85D0E1Ed3bfb4a67d9019AB38f4D342FFfaABB/sources/contracts/Challenge.sol
Funktion zum Schließen einer Challenge Ermittle und bezahle Gewinner und Zweitplatzierte, setze Status geschlossen
function closeChallenge(uint256 _challengeId) public { address winner = determineWinner(_challengeId); challenges[_challengeId].winner = winner; challenges[_challengeId].open = false; emit ChallengeCompleted(_challengeId, winner, challenges[_challengeId].runnerUp); }
11,508,741
pragma solidity ^0.4.17; pragma experimental "v0.5.0"; pragma experimental "ABIEncoderV2"; import "../lib/dappsys/auth.sol"; import "./Authority.sol"; import "./IColony.sol"; import "./EtherRouter.sol"; import "./ERC20Extended.sol"; import "./ColonyNetworkStorage.sol"; import "./IColonyNetwork.sol"; contract ColonyN...
Clear out the inactive reputation log. We're setting a new root hash, so we're done with it. The active reputation update log is now switched to be the one we've just cleared out. The old activeReputationUpdateLog will be used for the next reputation mining cycle Reward stakers
function setReputationRootHash(bytes32 newHash, uint256 newNNodes, address[] stakers) public onlyReputationMiningCycle { reputationRootHash = newHash; reputationRootHashNNodes = newNNodes; delete ReputationUpdateLogs[(activeReputationUpdateLog + 1) % 2]; activeReputationUpdateLog = (activeReputati...
12,540,197
pragma solidity ^0.5.0; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { if (a == 0) { return 0; } c ...
beneficiary Investor address/
function deposit(address payable beneficiary) onlyOwner public payable { deposited[beneficiary] = deposited[beneficiary].add(msg.value); fundsOwners.push(beneficiary); emit Deposited(beneficiary, msg.value); }
12,566,441
pragma solidity ^0.8.0; import 'hardhat/console.sol'; import './interfaces/IUniswapV2PairV5.sol'; import './interfaces/IUniswapV2PairPartialV5.sol'; import './UniswapV2ERC20V8.sol'; import './libraries/Math.sol'; import './libraries/UQ112x112.sol'; import './interfaces/IERC20V5.sol'; import './interfaces/IUniswapV2Fa...
called once by the factory at time of deployment sufficient check TWAMM orderBlockInterval = _orderBlockInterval; TODO: pass this variable inSet whitelist status to "whitelistNewTwamms" in Factory "TWAMM: ERROR CHECKING GlOBAL WHITELIST STATUS" whitelistDisabled = !(abi.decode(data, (bool)));
function initialize(address _token0, address _token1) external override { require(msg.sender == factory, 'UniswapV2: FORBIDDEN'); token0 = _token0; token1 = _token1; longTermOrders.initialize(_token0, _token1, block.number, orderBlockInterval); (bool success, bytes memory d...
14,096,286
./partial_match/4/0xa555D7A7E195B7B9cA87Ff0A89Be19259A4061dE/sources/EscrowConnect.sol
Function to release funds to dev account. Can be called only by dev.
function releaseFunds() external onlyDev { require( currState == State.CONFIRMED, "Middleman did not confirm to release" ); dev.transfer(address(this).balance); currState = State.RELEASED; }
8,557,694
library OwnershipTypes{ using Serializer for Serializer.DataComponent; struct Ownership { address m_Owner; // 0 uint32 m_OwnerInventoryIndex; // 20 } function SerializeOwnership(Ownership ownership) internal pure returns (bytes32) { Serializer.DataComponent m...
string name;uint64 price;uint8 stars;uint8 mainOnePosition;uint8 mainTwoPosition;
function SerializeStockHero(StockHero stockhero) internal pure returns (bytes32){ Serializer.DataComponent memory data; data.WriteUint16(0, stockhero.price); data.WriteUint8(2, stockhero.stars); data.WriteUint8(3, stockhero.mainOnePosition); data.WriteUint8(4, stockhero.main...
5,352,684
// SPDX-License-Identifier: MIT pragma solidity ^0.6.11; pragma experimental ABIEncoderV2; import "deps/@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import "deps/@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol"; import "deps/@openzeppelin/contracts-upgradeable/math/MathUpgr...
Rebalance, Compound or Pay off debt here
function tend() external whenNotPaused { }
1,604,854
./partial_match/1/0xc92AB2DfF994dd77c0D2fe09F21d5CF9ea2BcC0a/sources/contracts/artist/21_mitchell/TheBoysOfSummer.sol
update 2981 royalty
function setDefaultRoyalty(address receiver, uint96 feeNumerator) public onlyOwner { _setDefaultRoyalty(receiver, feeNumerator); }
9,393,064
pragma solidity ^0.4.20; contract POMDA { /*================================= = MODIFIERS = =================================*/ // only people with tokens modifier onlyBagholders() { require(myTokens() > 0); _; } // only people with profits modifier onlyStronghands() { require(myDividends(true) >...
This is where all your gas goes, sorryNot sorry, you probably only paid 1 gwei
function sqrt(uint x) internal pure returns (uint y) { uint z = (x + 1) / 2; y = x; while (z < y) { y = z; z = (x / z + z) / 2; } }
7,835,033
./full_match/1/0x75af3FD37d7CA74447e865F792f263b2b1159B58/sources/contracts/USDT.sol
Fix for the ERC20 short address attack./
function _beforeTokenTransfer( address from, address to, uint256 amount function _afterTokenTransfer( address from, address to, uint256 amount } pragma solidity ^0.8.4; modifier onlyPayloadSize(uint size) { require(!(msg.data.length < size + 4)); ...
2,924,155
// SPDX-License-Identifier: MIT pragma solidity ^0.5.16; interface IERC20 { function TOTALSUPPLY342() external view returns (uint); //inject NONSTANDARD NAMING function BALANCEOF743(address account) external view returns (uint); //inject NONSTA...
inject NONSTANDARD NAMING
function TRANSFER899(address recipient, uint amount) public returns (bool) {
6,347,623
./full_match/5/0x1dfB95a438b8e1aAf224Fc1064B6Ba63616373FF/sources/Contract/skullsofzigar.sol
Casts the address to uint256 without masking./
function _addressToUint256(address value) private pure returns (uint256 result) { assembly { result := value } }
1,866,572
// SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.7.0 <0.9.0; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; contract HappyNftFriendz is ERC721Enumerable, Ownable { using Strings for uint256; string public baseURI; stri...
Function to ACTIVATE phrase 1/
function activatePhrase1(uint256 _newCost, uint256 _newMaxMintAmount) public onlyOwner { setCost(_newCost); setMaxMintAmount(_newMaxMintAmount); phase1 = true; phase2 = false; phase3 = false; }
12,803,825