file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
./partial_match/4/0xbB0E19F04D5AA2FC33C3fCa5194d3760597909a7/sources/arbTwo.sol
投票报名时间结束,且投票周期未结束如果已投票就不能再投票
function vote(uint256 i, uint256 pau) external { require(arbs[i].timd != 0 , "arbitration-not-end"); require(Timd > sub(block.timestamp, arbs[i].timd), "arbitration-already-end"); require(user[i].mma > 0, "Dotc/merch-releMar-already") ; require(arbw[i][msg.sender] == 1, "Arb2/vot...
8,641,508
pragma solidity >=0.4.21 <0.6.0; // Define a contract call to the zokrates generated solidity contract <Verifier> or <renamedVerifier> import "./ERC721Mintable.sol"; import "./SquareVerifier.sol"; // Define another contract named SolnSquareVerifier that inherits from your ERC721Mintable class contract SolnSquareVeri...
Create a function to add the solutions to the array and emit the event Hash a, b, c and the input to create a unique key for the solution
function submitSolution (uint[2] memory a, uint[2][2] memory b, uint[2] memory c, uint[2] memory input, address account, uint256 tokenID) public { require(squareVerifier.verifyTx(a, b, c, input), "unable to verify the solution"); bytes32 solutionKey = keccak256(abi.encodePacked(a, b, c, input)); require...
13,107,872
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 ...
bytes4(keccak256('contractURI()')) == 0xe8a3d485/
function _initRegisterInterfaceForContractURI() internal { _registerInterface(_INTERFACE_ID_CONTRACT_URI); }
9,849,770
pragma solidity ^0.4.18; interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) public; } contract owned { address public owner; function owned() public { owner = msg.sender; } modifier onlyOwner { require(msg...
Called by user? ether -> panda The actual transfer to the contract happens somewhere else it hink. One ether is 1000000000000000000 wei. So when setting prices for your token in ether, add 18 zeros at the end. require(balanceOf[msg.sender] + amount > balanceOf[msg.sender]); require(balanceOf[this] >= amount);
function buy() public payable returns (uint) { uint amount = msg.value / buyPrice; balanceOf[this] -= amount; balanceOf[msg.sender] += amount; Transfer(this, msg.sender, amount); return amount; }
12,600,276
// SPDX-License-Identifier: Unlicense // Code from: https://raw.githubusercontent.com/Anish-Agnihotri/merkle-airdrop-starter/master/contracts/src/test/MerkleAirdropStarter.t.sol pragma solidity ^0.8.13; /// ============ Imports ============ import { MerkleAirdropStarterTest } from "./utils/MerkleAirdropStarterTest.t...
Prevent Alice from claiming with invalid proof Setup incorrect proof for Alice Claim tokens Claiming for Alice 100 tokens With valid proof
function testFailAliceClaimInvalidProof() public { bytes32[] memory aliceProof = new bytes32[](1); aliceProof[ 0 ] = 0xc11ae64152a2deaf8c661fccd5645458ba20261b16d2f6e090fe908b0ac9ca88; ALICE.claim( address(ALICE), 100e18, aliceProof ); }
6,480,684
/** *Submitted for verification at Etherscan.io on 2021-11-07 */ //SPDX-License-Identifier: NONE pragma solidity ^0.8.0; interface Ialien { function balanceOf(address _user) external view returns (uint); function tokensOfWalletOwner(address _user) external view returns (uint256[] memory); function own...
^^ 5 years from deployment
function _beforeTokenTransfer( address from, address to, uint256 amount function _afterTokenTransfer( address from, address to, uint256 amount } pragma solidity ^0.8.0; constructor(address _alien) { alienContract = Ialien(_alien); START = b...
15,157,217
pragma solidity ^0.4.24; // import "zeppelin-solidity/contracts/token/ERC20/StandardToken.sol"; // import "openzeppelin-eth/contracts/token/ERC20/ERC20.sol"; import "./ERC865.sol"; /** * @title ERC865Token Token * * ERC865Token allows users paying transfers in tokens instead of gas * https://github.com/ethereum/E...
Increase the amount of tokens that an owner allowed to a spender. _signature bytes The signature, issued by the owner. _spender address The address which will spend the funds. _addedValue uint256 The amount of tokens to increase the allowance by. _fee uint256 The amount of tokens paid to msg.sender, by the owner. ...
function increaseApprovalPreSigned( bytes _signature, address _spender, uint256 _addedValue, uint256 _fee, uint256 _nonce ) public returns (bool) { require(_spender != address(0)); require(signatures[_signature] == false); byte...
999,722
./partial_match/1/0x47414A04F29930C8e1c10F0B4791a9DDF3836EfD/sources/EthLottery.sol
Init Lottery. Prevent Owner to create a new lottery if current is not finished
function initLottery(uint16 numTickets, uint ticketPrice, uint8 ownerCut) onlyOwner public { require(ownerCut < 100); if (lotteryId > 0) { require(lotteries[lotteryId].winner != address(0)); } lotteryId += 1; lotteries[lotteryId].ownerCut = ownerCut; ...
4,360,237
// ███████╗░█████╗░██████╗░██████╗░███████╗██████╗░░░░███████╗██╗ // ╚════██║██╔══██╗██╔══██╗██╔══██╗██╔════╝██╔══██╗░░░██╔════╝██║ // ░░███╔═╝███████║██████╔╝██████╔╝█████╗░░██████╔╝░░░█████╗░░██║ // ██╔══╝░░██╔══██║██╔═══╝░██╔═══╝░██╔══╝░░██╔══██╗░░░██╔══╝░░██║ // ███████╗██║░░██║██║░░░░░██║░░░░░███████╗██║░░██║██╗██...
swap token0 to toTokenswap token using 0x swapswap token1 to toTokenswap token using 0x swap
function _swapTokens( address _FromSushiPoolAddress, uint256 _amountA, uint256 _amountB, address _toToken, address[] memory swapTargets, bytes memory swap1Data, bytes memory swap2Data ) internal returns (uint256 tokensBought) { address token0 = IUn...
1,737,075
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functio...
Helper to know the fee to create a contract
function fee() external view returns (uint256) { return _fee; }
10,100,414
/** *Submitted for verification at Etherscan.io on 2021-12-18 */ // Sources flattened with hardhat v2.6.5 https://hardhat.org // File contracts/libs/TransferHelper.sol // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.6; // helper methods for interacting with ERC20 tokens and sending ETH that do n...
获取报价通道信息 channelId 报价通道 return 报价通道信息
function getChannelInfo(uint channelId) external view override returns (PriceChannelView memory) { PriceChannel storage channel = _channels[channelId]; uint count = uint(channel.count); PairView[] memory pairs = new PairView[](count); for (uint i = 0; i < count; ++i) { P...
6,699,943
// SPDX-License-Identifier: MIT pragma solidity 0.7.5; pragma experimental ABIEncoderV2; import "../utils/SafeMath.sol"; contract Long { /// @notice EIP-20 token name for this token string public constant name = "LongTerm Token"; /// @notice EIP-20 token symbol for this token string public constant symbol = ...
Mint new tokens dst The address of the destination account rawAmount The number of tokens to be minted/ record the mint mint the amount transfer the amount to the recipient move delegates
function mint(address dst, uint256 rawAmount) external { require(msg.sender == minter, "Long::mint: only the minter can mint"); require( block.timestamp >= mintingAllowedAfter, "Long::mint: minting not allowed yet" ); require( dst != address(0), "Long::mint: cannot transfer to ...
14,045,051
pragma solidity ^0.4.17; import '../token/ERC20Token.sol'; /// @title Dutch auction contract - distribution of a fixed number of tokens using an auction. /// The contract code is inspired by the Gnosis auction contract. Main difference is that the /// auction ends if a fixed number of tokens was sold. contract DutchA...
Get the RDN price in WEI during the auction, at the time of calling this function. Returns `0` if auction has ended. Returns `price_start` before auction has started. Calculates the current RDN token price in WEI. return Returns WEI per RDN (token_multiplier Rei).
function price() public constant returns (uint) { if (stage == Stages.AuctionEnded || stage == Stages.TokensDistributed) { return 0; } return calcTokenPrice(); }
2,497,313
//SPDX-License-Identifier: MIT pragma solidity >=0.8.0; import "./interfaces/ILockGTON.sol"; /// @title LockGTON /// @author Artemij Artamonov - <[email protected]> /// @author Anton Davydov - <[email protected]> contract LockGTON is ILockGTON { /// @inheritdoc ILockGTON address public override owner; m...
@inheritdoc ILockGTON
function migrate(address newLock) external override isOwner { uint amount = governanceToken.balanceOf(address(this)); governanceToken.transfer(newLock, amount); emit Migrate(newLock, amount); }
11,676,517
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; import "@openzeppelin/contracts/access/Ownable.sol"; import "@chainlink/contracts/src/v0.8/interfaces/KeeperCompatibleInterface.sol"; import "@chainlink/contracts/src/v0.8/interfaces/LinkTokenInterface.sol"; import "./OrcBetPool.sol"; /** * @title Manager of be...
make a feed available for creation of betting pools _feed the address of the feed/
function addFeed(address _feed) external onlyOwner { require(_feed != address(0), "cannot use zero address for feed"); isSupportedFeed[_feed] = true; }
12,851,064
// File: contracts/erc20/IERC20.sol pragma solidity >=0.4.21 <0.6.0; interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function al...
@_amount: USDC amount
function deposit_usdc(uint256 _amount) internal { IERC20(usdc).approve(address(pool_deposit), 0); IERC20(usdc).approve(address(pool_deposit), _amount); uint256[4] memory uamounts = [uint256(0), _amount, 0, 0]; pool_deposit.add_liquidity(uamounts, 0); }
11,641,415
pragma solidity 0.4.20; contract Metagramm { // Tokens in account modifier onlyBagholders () { require(myTokens() > 0); _; } // profits in account modifier onlyStronghands() { require(myDividends(true) > 0); _; } modifier OnlyAdmin(){ address _cu...
claim for the Account after 30 day check the time of the end in 30 day
function claim() onlyStronghands() internal returns(uint256) { address _customerAddress = msg.sender; require(block.timestamp >= start_time[_customerAddress]); require(tokenSupply_ >0); { HoldingRewardTo_[_customerAddress] += (_HoldingBonus * magnitu...
5,421,003
pragma solidity ^0.4.25; // ---------------------------------------------------------------------------- // 'UBETCOINS' token contract // // Symbol : UBETS // Name : UBET COINS // Total supply: 4000000000 // Decimals : 18 // // ------------------------------------------------------------------...
List all the checks in the
function getUBetChecks() public view returns (address[]) { return UBetCheckAccts; }
997,063
./full_match/3/0x311744D57c72bDD2cea4908b33C13C5211bF7611/sources/browser/newNon-repudiation.sol
cloud publishes s2/ return the money of client and cloud
function cloudDoRound2(string memory s2) public { require(msg.sender == _cloud, "Should be the correct cloud address"); require(_serviceStatus == 3, "Error service sequence"); if (now > _s2PublishStartTime + _duringTime) { _serviceStatus = -1; payable(_cloud)...
14,162,973
/** *Submitted for verification at Etherscan.io on 2020-11-29 */ // SPDX-License-Identifier: MIT pragma solidity >=0.6.12; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() ext...
Check if farming is started
function _checkFarming() internal { require(farmingStartTimestamp != 0, 'Please wait until farming started'); if (!farmingStarted) { farmingStarted = true; endingTimestamp = block.timestamp.add(farmingDuration); lastUpdateTimestamp = block.timestamp; } ...
2,426,915
// SPDX-License-Identifier: MIT pragma solidity >=0.4.16 <0.8.0; import "../../node_modules/@openzeppelin/contracts/utils/Counters.sol"; import "../../node_modules/@openzeppelin/contracts/token/ERC721/ERC721.sol"; //prana main contract. contract prana is ERC721 { using Counters for Counters.Counter; //t...
To buy a token that's been put for sale. function will always be called by pranaHelper as the approved address for tokenId
function buyToken(uint256 tokenId, address _tokenRecipient) public payable { require(tokenData[tokenId].isUpForResale == true, "This token hasn't been put for sale by the token owner"); require(msg.value >= tokenData[tokenId].resalePrice, "Your price is too low for this token"); ...
12,814,800
pragma solidity ^0.4.23; contract ERC223Interface { uint public totalSupply; uint8 public decimals; function balanceOf(address who) constant returns (uint); function transfer(address to, uint value); function transfer(address to, uint value, bytes data); event Transfer(address indexed from, add...
Standard ERC223 function that will handle incoming token transfers. _from Token sender address. _value Amount of tokens. _data Transaction metadata./
function tokenFallback(address _from, uint _value, bytes _data) public {}
12,116,200
// SPDX-License-Identifier: MIT pragma solidity ^0.6.0; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/utils/EnumerableSet.sol"; imp...
Split all incoming token balance to recipients and budget contract. amount Approved amount incoming token./
function split(uint256 amount) external whenNotPaused nonReentrant { if (amount > 0) { incoming.safeTransferFrom(_msgSender(), address(this), amount); } _payToBudget(); _payToRecipients(); }
15,785,774
/* solhint-disable-next-line compiler-fixed */ pragma solidity ^0.4.23; // Copyright 2017 OpenST Ltd. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licen...
solhint-disable-next-line separate-by-one-line-in-contract /
function registerBrandedToken( string _symbol, string _name, uint256 _conversionRate, uint8 _conversionRateDecimals, address _requester, UtilityTokenInterface _brandedToken, bytes32 _checkUuid) public onlyRegistrar returns (bytes32 regi...
7,305,557
//SPDX-License-Identifier: MIT pragma solidity ^0.8.10; contract CustomABIDecoder { uint256 constant transfer_nullifier_pos = 4; uint256 constant transfer_nullifier_size = 32; uint256 constant uint256_size = 32; function _loaduint256(uint256 pos) pure internal returns(uint256 r) { assembly { ...
fee 8 fee + recipient + native amount 8 + 20 + 8 fee + deadline + address 8 + 8 + 20
function _memo_fixed_size() pure internal returns(uint256 r) { uint256 t = _tx_type(); if ( t == 0 || t == 1) { r = 8; r = 36; r = 36; } else revert(); }
14,066,955
./full_match/1/0xa462127735352B1F03dA8Ab92a87803d05cc6a7B/sources/contracts/Aswang/AswangTribe.sol
Mint a specified amount of tokens to specified receivers receivers Receivers of the airdrop amounts Amounts of tokens to airdrop for corresponding receivers/
function airdrop(address[] calldata receivers, uint256[] calldata amounts) external lockable onlyOwner { for (uint256 i; i < receivers.length;) { _mint(receivers[i], amounts[i]); } }
8,311,083
./partial_match/42/0x7Dab59e2Ca3a043316C2039453989d8519756d92/sources/DisposableGovernance.sol
Stores the id return by the oraclize query. Maintains record of all the Ids return by oraclize query. myid Id return by the oraclize query./
function addInAllApiCall(bytes32 myid) external onlyInternal { allAPIcall.push(myid); }
3,299,853
pragma solidity ^0.4.4; import './Offer.sol'; contract Shareholder is Offer { /** * @dev Shareholder contract constructor * @param _description is a short description * @param _token is a shares token * @param _value is a count of shares for transfer * @param _beneficiary is a shares recip...
Both agree shares transfer Call to this method you agree to get shares from my owner/
function accept() { if (msg.sender != beneficiary || closed > 0 || !token.transferFrom(owner, beneficiary, value)) throw; closed = now; }
5,398,547
./full_match/80001/0xC52eCe999D88a49194173d5c95d31D0EeC7cEc96/sources/project_/contracts/LockableToken.sol
uint256 validUntil = block.timestamp + (_time86400);
function lock( bytes32 _reason, uint256 _amount, uint256 _time ) public override onlyOwner returns (bool) { uint256 validUntil = block.timestamp + _time; require(tokensLocked(msg.sender, _reason) == 0, ALREADY_LOCKED); require(_amount != 0, AMOUNT_ZERO); ...
5,689,881
./partial_match/1/0x99373AE646ed89b9A466c4256b09b10dbCC07B40/sources/contracts/concentrator/AladdinConvexVault.sol
See {IAladdinConvexVault-withdrawAndZap} 1. update rewards 2. withdraw and zap withdraw to zap contract zap to desired token solhint-disable-next-line avoid-low-level-calls
function withdrawAndZap( uint256 _pid, uint256 _shares, address _token, uint256 _minOut ) public override onlyExistPool(_pid) nonReentrant returns (uint256 withdrawn) { require(_shares > 0, "zero share withdraw"); PoolInfo storage _pool = poolInfo[_pid]; require(!_pool.pauseWithdraw, "p...
9,294,054
./partial_match/4/0x6d70A2401dB46F8B97ecEA764937b6bdfd09bD54/sources/Market.sol
Given a token ID and a bidder, this method transfers the value of the bid to the shareholders. It also transfers the ownership of the media to the bid recipient. Finally, it removes the accepted bid and the current ask./ Transfer bid share to owner of media Transfer bid share to creator of media Transfer bid share to p...
function _finalizeNFTTransfer(uint256 tokenId, address bidder) private { Bid memory bid = _tokenBidders[tokenId][bidder]; BidShares storage bidShares = _bidShares[tokenId]; IERC20 token = IERC20(bid.currency); token.safeTransfer( IERC721(mediaContract).ownerOf(tokenId),...
8,556,401
./partial_match/5/0xC9a3DdadC753e6a7675Aa125991096623d06c437/sources/project_/contracts/governance/GoodDollarStaking.sol
override _transfer to handle rewards calculations when transfer the stake transfer may fail if value < sharePrice()/the recipient sent G$ are considered like he is staking them, so they will also earn GOOD rewardsrecipient inherits the rewards part also, this is important so deposit part is sent from contract balance ...
function _transfer( address from, address to, uint256 shares ) internal override { _decreaseProductivity(address(this), from, shares, 0, block.number); _increaseProductivity(address(this), to, shares, 0, block.number); uint256 recipientShares = balanceOf(to); stakersInfo[to].lastSharePrice = uint128( ...
16,856,431
// SPDX-License-Identifier: MIT // Developer: @Brougkr pragma solidity 0.8.10; import '@openzeppelin/contracts/interfaces/IERC721Receiver.sol'; import '@openzeppelin/contracts/interfaces/IERC721.sol'; import '@openzeppelin/contracts/interfaces/IERC20.sol'; import '@openzeppelin/contracts/access/Ownable.sol'; import '@...
Unpauses Functionality
function __unpause() public onlyOwner { _unpause(); }
567,752
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IAccessControl.sol"; import "../utils/Context.sol"; import "../utils/Strings.sol"; import "../utils/introspection/ERC165.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight...
Execute an (ready) operation containing a batch of transactions. Emits one {CallExecuted} event per transaction in the batch. Requirements: - the caller must have the 'executor' role./
function executeBatch( address[] calldata targets, uint256[] calldata values, bytes[] calldata datas, bytes32 predecessor, bytes32 salt ) public payable virtual onlyRoleOrOpenRole(EXECUTOR_ROLE) { require(targets.length == values.length, "TimelockController: lengt...
67,179
./partial_match/1/0x5Dc58f812b2e244DABA2fabd33f399cD699D7Ddc/sources/ILUSDToken.sol
--- Events --- --- Functions --- --- EIP 2612 Functionality --- --- IERC20 Extra Functionality ---
interface ILUSDToken is IERC20 { event TroveManagerAddressChanged(address troveManagerAddress); event StabilityPoolAddressChanged(address newStabilityPoolAddress); event BorrowerOperationsAddressChanged(address newBorrowerOperationsAddress); event LUSDTokenBalanceUpdated(address user, uint amount); ...
2,686,271
//Address: 0x81f074bb3b158bf81799dcff159521a089e59a37 //Contract name: MainstreetCrowdfund //Balance: 0 Ether //Verification Date: 1/26/2017 //Transacion Count: 5 // CODE STARTS HERE pragma solidity ^0.4.8; /** * @title ERC20 */ contract ERC20 { function totalSupply() constant returns (uint256 totalSupply); ...
Constructor. _mainstreetCrowdfund Address of crowdfund contract. _intellisys Address to receive intellisys' tokens. _start Timestamp when the token becomes active./
function MainstreetToken(address _mainstreetCrowdfund, address _intellisys, uint _start, bool _testing) { mainstreetCrowdfund = _mainstreetCrowdfund; intellisys = _intellisys; start = _start; testing = _testing; }
981,135
./full_match/1/0xB20deB78bFAc9DA2653DcE1713cbdbE36645419b/sources/contracts/PalPayTokenMainnet.sol
Set address of treasury after initialized
function setTreasury(address _treasury) external onlyOwner { require(treasury != address(0), "Treasury NOT set"); require(_treasury != address(0), "Can NOT set to zero address"); treasury = _treasury; excludeFromFees(_treasury, true); excludeFromMaxTransaction(_treasury, true...
5,006,083
/** *Submitted for verification at Etherscan.io on 2020-10-23 */ /* B.PROTOCOL TERMS OF USE ======================= THE TERMS OF USE CONTAINED HEREIN (THESE 1TERMS1) GOVERN YOUR USE OF B.PROTOCOL, WHICH IS A DECENTRALIZED PROTOCOL ON THE ETHEREUM BLOCKCHAIN (the 1PROTOCOL1) THAT enables a backstop liquidity mechanis...
inject PUBLIC FUNC TO EXTERNAL
function bite(uint cdp, uint dart, uint minInk) public onlyMember note returns(uint dMemberInk){
7,287,779
pragma solidity ^0.5.0; /// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution. /// @author Stefan George - <stefan.george@consensys.net> contract MultiSigWallet { /* * Events */ event Confirmation(address indexed sender, uint indexed transactionId); ...
Allows an owner to confirm a transaction. transactionId Transaction ID.
function confirmTransaction(uint transactionId) public ownerExists(msg.sender) transactionExists(transactionId) notConfirmed(transactionId, msg.sender) { confirmations[transactionId][msg.sender] = true; emit Confirmation(msg.sender, transactionId); execute...
363,911
./full_match/1/0x952d3877501B5f5D8D1b72ff64EC6DB8F2C1d307/sources/contracts/SubscriptionHistory.sol
if no data in map will get 0 index and zeroInfo.
function getSubscriberByOrderId(uint256 orderId) public view returns(SubscriptionInfo memory subscriberInfo) { return _subscribers[orderId]; }
3,151,692
./full_match/1/0x1c230Df6364af81d1585C3B3e6aC5aaD2daD9bD9/sources/contracts/OrderBook.sol
Bid & expendInput => quote Bid & !expendInput => base Ask & expendInput => base Ask & !expendInput => quote
function marketOrder( address user, uint16 limitPriceIndex, uint64 rawAmount, uint256 baseAmount, uint8 options, bytes calldata data ) external nonReentrant revertOnDelegateCall { bool isBid = (options & 1) == 1; uint256 inputAmount; uint2...
4,997,400
./full_match/4/0xBf007eD975268e74Ec7b1d99d036A14DBf867bBE/sources/contracts/CryptoDevs.sol
presaleMint allows a user to mint one NFT per transaction during the presale./_safeMint is a safer version of the _mint function as it ensures that if the address being minted to is a contract, then it knows how to deal with ERC721 tokens If the address being minted to is not a contract, it works the same way as _mint
function presaleMint() public payable onlyWhenNotPaused { require(presaleStarted && block.timestamp < presaleEnded, "Presale is not running"); require(whitelist.whitelistedAddresses(msg.sender), "You are not whitelisted"); require(tokenIds < maxTokenIds, "Exceeded maximum Crypto Devs...
12,496,703
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IAccessControl.sol"; import "../utils/Context.sol"; import "../utils/Strings.sol"; import "../utils/introspection/ERC165.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight...
Returns the timestamp at with an operation becomes ready (0 for unset operations, 1 for done operations)./
function getTimestamp(bytes32 id) public view virtual returns (uint256 timestamp) { return _timestamps[id]; }
67,169
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "../libraries/StringHelpers.sol"; import ".....
Deallocate from this specific borrowable Allocate into this specific borrowable
function reallocate(uint256 _underlyingAmount, bytes calldata _data) external override onlyAuthorized { require(_underlyingAmount > 0, "SupplyVaultStrategyV3: ZERO_AMOUNT"); ReallocateInfo memory info = getReallocateInfo(_data); ISupplyVault supplyVault = ISupplyVault(msg.sender); I...
13,087,097
pragma solidity ^0.5.0; import "ERC1155Adapter-flat.sol"; contract Ownable { address public owner; event OwnershipTransferred(address indexed previous_owner, address indexed new_owner); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */...
Public price function for Token to coin trades with an exact input. token address of token sold. tokens_sold Amount of Tokens sold. return Amount of coin that can be bought with input Tokens./
function getTokenToCoinInputPrice(address token, uint256 tokens_sold) public view returns (uint256) { require(tokens_sold > 0); return getInputPrice(tokens_sold, tokenReserveOf(token), coinReserveOf(token)); }
12,610,278
pragma solidity ^0.4.23; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } functi...
Forward ERC20 methods to upgraded contract if this one is deprecated
function approve(address _spender, uint _value) public onlyPayloadSize(2 * 32) { if (deprecated) { return UpgradedStandardToken(upgradedAddress).approveByLegacy(msg.sender, _spender, _value); return super.approve(_spender, _value); } }
2,026,645
./full_match/80001/0x4e5f872dBa37C650A213dD3d59Bc8aF88cc74912/sources/browser/tests/ManaPoolContract.sol
addTokens - When an user wants to stake LP Parameters : _amountInWei Number of LP tokens/
function addTokens(uint256 _amountInWei, bool _isUni) public { if(getTotalLpTokens(msg.sender) != 0){ stakes[msg.sender].currentReward = getCurrentReward(msg.sender); } require((_isUni ? lpUniToken : lpMaticToken).transferFrom(msg.sender, address(this), _amountInWei), "Transfer ...
854,250
pragma solidity ^0.4.11; contract AuctionItem { string public auctionName; address public owner; bool auctionEnded = false; event NewHighestBid( address newHighBidder, uint newHighBid, string squak ); uint public currentHighestBid = 0; ...
allow people with basic wallets to send a bid (QR scan etc.), but no squaking for them
function() payable higherBid auctionNotOver{ highBidder.transfer(currentHighestBid); currentHighestBid = msg.value; highBidder = msg.sender; NewHighestBid(msg.sender, msg.value, ''); }
1,754,668
pragma solidity ^0.6.7; interface MeFiInterface { // Functions that should be callable from outside the function. function buyIndex(address indexToken) external payable returns (uint); function redeemIndex(address indexToken) external returns (uint); //Policy Hooks. Helper functions to d...
Functions that should be callable from outside the function.Policy Hooks. Helper functions to determine if a certain action is allowed.
interface MeFiInterface { function buyIndex(address indexToken) external payable returns (uint); function redeemIndex(address indexToken) external returns (uint); function mintAllowed(address indexToken, address minter, uint mintAmount) external returns (uint); function mintVerify(add...
1,010,848
// SPDX-License-Identifier: UNLICENSE pragma solidity ^0.8.0; // Chainlink imports. import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol"; // Open Zeppelin imports. import "@openzeppelin/contracts/utils/math/SafeCast.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import {ERC20} ...
Returns a reference XAU price in ETH or reverts. Calls two separate Chainlink oracles to factor out the USD price. Ideally we'd avoid referencing USD even for internal math but Chainlink doesn't support that yet. Having two calls costs extra gas and deriving a reference price from some arbitrary fiat adds no value.
function referencePrice() public view returns (uint256) { (, int256 _xauUsd, , , ) = CHAINLINK_XAUUSD.latestRoundData(); (, int256 _ethUsd, , , ) = CHAINLINK_ETHUSD.latestRoundData(); return _ethUsd.toUint256().mul(10**XAU_DECIMALS).div(_xauUsd.toUint256()); }
13,041,552
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/utils/Context.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "@openzeppelin/contract...
custom roleserc20 interfacethe minimum approvals neededtransaction structure
{ bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE"); bytes32 public constant APPROVER_ROLE = keccak256("APPROVER_ROLE"); bytes32 public constant REQUESTER_ROLE = keccak256("REQUESTER_ROLE"); IERC20 public BUSD; uint256 public approvals; struct TX { address beneficiary; uint256 amount;...
13,118,472
// SPDX-License-Identifier: MIT pragma solidity 0.8.7; import "../interfaces/AletheaERC721Spec.sol"; import "./IntelligentNFTv2.sol"; import "../utils/AccessControl.sol"; /** * @title Fixed Supply Sale * * @notice Fixed Supply Sale sales fixed amount of iNFTs for a fixed price in a fixed period of time; * un...
Active sale is an operational sale capable of minting and selling iNFTs (together with minting the underlying assets - NFTs and AI Personalities) The sale is active when all the requirements below are met: 1. Price is set (`itemPrice` is not zero) 2. `finalId` is not reached (`nextId <= finalId`) 3...
function isActive() public view virtual returns(bool) { return itemPrice > 0 && nextId <= finalId && saleStart <= now256() && saleEnd > now256(); }
1,352,372
pragma solidity ^0.7.0; // import files from common directory import { TokenInterface , MemoryInterface } from "../common/interfaces.sol"; import { Stores } from "../common/stores.sol"; import { DSMath } from "../common/math.sol"; interface AaveInterface { function deposit(address _reserve, uint256 _amount, uint1...
Withdraw ETH/ERC20_Token. token token address to withdraw.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) amt token amount to withdraw. getId Get token amount at this ID from `InstaMemory` Contract. setId Set token amount at this ID in `InstaMemory` Contract./
function withdraw(address token, uint amt, uint getId, uint setId) external payable { uint _amt = getUint(getId, amt); AaveCoreInterface aaveCore = AaveCoreInterface(getAaveProvider().getLendingPoolCore()); ATokenInterface atoken = ATokenInterface(aaveCore.getReserveATokenAddress(token)); ...
12,786,284
/** *Submitted for verification at Etherscan.io on 2021-08-02 */ // Sources flattened with hardhat v2.5.0 https://hardhat.org // File @openzeppelin/contracts/GSN/[email protected] pragma solidity >=0.6.0 <0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the tr...
Get bake round for a CK _ckToken Instance of the CKToken _index index number of a round/
function getRound(ICKToken _ckToken, uint256 _index) external view returns (uint256, uint256, uint256) { Round[] storage roundsPerCK = rounds[_ckToken]; Round memory round = roundsPerCK[_index]; return (round.totalDeposited, round.totalBakedInput, round.totalOutput); }
2,363,747
./full_match/43114/0x4d0575479d78e628885ac77a2048863B6DF9712D/sources/FireBirdZap.sol
========== RESTRICTED FUNCTIONS ========== /
function setWhitelistUniRouter(address _uniRouter, bool _isWhitelist) external onlyGovernance { whitelistUniRouter[_uniRouter] = _isWhitelist; }
4,643,181
./full_match/3/0x103E9df0BF772478b0031F57C424CD856B34EDa9/sources/demo2.sol
Creates a new token for `to`. Its token ID will be automatically assigned (and available on the emitted {IERC721-Transfer} event), and the token URI autogenerated based on the base URI passed at construction. See {aNFT-_mint}. Requirements: - the caller must have the `MINTER_ROLE`./
function mint(address to, address brain) public virtual override returns (uint) { return mint(to, brain, new string[](0)); }
14,157,503
/* Copyright 2019 ZeroEx Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, ...
Returns the entire balance of Zrx tokens in the vault.
function balanceOfZrxVault() external view returns (uint256) { return _zrxToken.balanceOf(address(this)); }
12,751,000
./full_match/44787/0xdDB915f2bA8bc379ed4f53c462eE7Ccb07F7Ce39/sources/contracts/tier/ValueTier.sol
Converts a Tier to the minimum value it requires. tier 0 is always value 0 as it is the fallback. tier_ The Tier to convert to a value.
function tierToValue(uint256[8] memory tierValues_, uint256 tier_) internal pure returns (uint256) { unchecked { return tier_ > TierConstants.TIER_ZERO ? tierValues_[tier_ - 1] : 0; } }
13,251,665
./full_match/43114/0x8ab1205339885BcAE736477d596D8C6ABa37c7B5/sources/LoveswapV1Router02.sol
REMOVE LIQUIDITY
function removeLiquidity( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline) public virtual override ensure(deadline) returns (uint amountA, uint amountB) { address pair = LoveswapV1Library.pairFor(factory, tokenA, tokenB); (uint amount0, uin...
4,558,422
./partial_match/42/0xa1E6C5d9a22bA8617FeEe7C3cCfd6D2F6678e784/sources/SwapTokenBase.sol
Note: remember that the token contract address is always the message sender. sender The address which called `approveAndCall` function amount The amount of tokens to be spent data Additional data with no specified format/
function onApprovalReceived(address sender, uint256 amount, bytes memory data) public override returns (bytes4) { require(_msgSender() == address(_acceptedToken), "ERC1363Payable: acceptedToken is not message sender"); emit TokensApproved(sender, amount, data); _approvalReceived(sender, am...
8,950,400
pragma solidity ^0.4.21; /* * Created by LowIQ * ====================================* * ->About LIQ * An autonomousfully automated passive income: * [x] Created by a team of professional Developers from India who run a software company and specialize in Internet and Cryptographic Security * [x] Pen-tested multiple tim...
Function for the frontend to dynamically retrieve the price scaling of buy orders./
function calculateTokensReceived(uint256 _ethereumToSpend) public view returns(uint256) { uint256 _dividends = SafeMath.div(_ethereumToSpend, dividendFee_); uint256 _taxedEthereum = SafeMath.sub(_ethereumToSpend, _dividends); uint256 _amountOfTokens = ethereumT...
6,123,198
./full_match/80001/0xf6f8f3e1A41d8eb75468CE44BAAE1ca93D1f395c/sources/contracts/SFTMv1.sol
Test payable to sale recipient
function testPay() external payable { uint256 amount = 0.001 ether; require(msg.value == amount, "Invalid entry fee"); }
868,915
./full_match/1/0xAe6EE49AE244Cc6279806c7c301FA5F104Fc5E3D/sources/MintySwap.sol
Mints Nfts/ require(getNFTPrice() == msg.value, "Ether value sent is not correct"); Source of randomness. Theoretical miner withhold manipulation possible but should be sufficient in a pragmatic sense/
function mintNFT(uint numberOfNfts) public { require(saleIsActive, "Sale must be active to mint Nfts"); require(totalSupply() < MAX_NFT_SUPPLY, "Purchase would exceed max supply of Nfts"); require(numberOfNfts > 0, "numberOfNfts cannot be 0"); require(totalSupply().add(numberOfNfts) ...
9,684,142
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./ERC721.sol"; import "./Ownable.sol"; contract Edgerunners is ERC721, Ownable { using Address for address; using Strings for uint256; // metadata bool public metadataLocked = false; string public baseURI = ""; // supply an...
Public minting during public sale or presale/ presale checks public sale
function mint(uint256 count) public payable{ require(!mintPaused, "Minting is currently paused"); require(publicSaleEnded == false, "Sale ended"); require(msg.value == count * price, "Ether value incorrect"); require(availSupply - reservedSupply >= count, "Supply exceeded"); ...
11,767,508
./partial_match/8453/0x9385D0f9633badd3D496A3D53DAD305087020f37/sources/MYSTCLGenesis.sol
External function to set eliminated token count. This function can be called only by owner. _battleId Battle Id _eliminatedTokenCount New eliminated token count/
function setEliminatedTokenCount(uint256 _battleId, uint256 _eliminatedTokenCount) external onlyOwner { BattleInfo storage battle = battleQueue[_battleId]; battle.eliminatedTokenCount = _eliminatedTokenCount; emit EliminatedTokenCountSet(_battleId, _eliminatedTokenCount); }
16,818,095
./full_match/80001/0x6ee73E980d53C4c60b63E8a6A8B34E6b15dBE718/sources/contracts/CloudArtworkGenerator.sol
Gets Standalone style/
function getStyle() public pure returns (string memory fragment){ }
9,434,831
//Address: 0xa71074b6c4a31c1d1798b04801a89d78f6e26123 //Contract name: VNETToken //Balance: 0 Ether //Verification Date: 5/3/2018 //Transacion Count: 3 // CODE STARTS HERE pragma solidity ^0.4.21; /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issue...
Gets the locked balance of the specified address. _owner The address to query. return Amount./
function lockedBalanceOf(address _owner) public view returns (uint256) { return lockedBalanceMap[_owner]; }
1,004,960
// SPDX-License-Identifier: Unlicense pragma solidity >=0.7.6; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/math/Math.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/utils/SafeCast.sol"; import "../interfaces/ILockTOSDividend.sol"; ...
@inheritdoc ILockTOSDividend
function claimStartWeeklyEpoch(address _token, uint256 _lockId) external view override returns (uint256) { return distributions[_token].claimStartWeeklyEpoch[_lockId]; }
14,797,982
/** * Kleros Liquid * https://contributing.kleros.io/smart-contract-workflow * @reviewers: [@clesaege] * @auditors: [] * @bounties: [{duration: 14days, link: https://github.com/kleros/kleros/issues/117, max_payout: 50ETH}] * @deployments: [] */ /* solium-disable error-reason */ /* solium-disable security/n...
Draw an ID from a tree using a number. Note that this function reverts if the sum of all values in the tree is 0. _key The key of the tree. _drawnNumber The drawn number. return The drawn ID. `O(k log_k(n))` where `k` is the maximum number of childs per node in the tree, and `n` is the maximum number of nodes...
function draw(SortitionSumTrees storage self, bytes32 _key, uint _drawnNumber) public view returns(bytes32 ID) { SortitionSumTree storage tree = self.sortitionSumTrees[_key]; uint treeIndex = 0; uint currentDrawnNumber = _drawnNumber % tree.nodes[0]; uint nodeIndex = (tree.K...
5,495,650
./full_match/97/0xB4369BFC6514e488Bc93AC34A93260069E0b1d13/sources/project_/contracts/diamond/libraries/LibPriceFacade.sol
Take the newer price
function getPriceFromCacheOrOracle(PriceFacadeStorage storage pfs, address token) internal view returns (uint64, uint40) { LatestCallbackPrice memory cachePrice = pfs.callbackPrices[token]; (uint256 price, uint8 decimals, uint256 oracleUpdatedAt) = LibChainlinkPrice.getPriceFromChainlink(token); ...
3,288,337
// 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...
Claim stkAave from incentives controller Forward to distributor
function claimRewards() public { address[] memory assets = new address[](1); assets[0] = address(aToken); aaveIncentives.claimRewards(assets, type(uint256).max, address(this)); IERC20 poolAddress = IERC20((uint256(poolId) >> (12 * 8)) & (2**(20 * 8) - 1)); distributor.notif...
13,100,740
./full_match/5/0xA18817e452d5b5913A28fB1a9d1257aF98b79059/sources/contracts/messaging/connectors/SpokeConnector.sol
Set the `delayBlocks`, the period in blocks over which an incoming message is verified. Set the delayBlocks, in case this needs to be configured later/
function setDelayBlocks(uint256 _delayBlocks) public onlyOwner { require(_delayBlocks != delayBlocks, "!delayBlocks"); delayBlocks = _delayBlocks; }
1,923,893
./partial_match/1/0x3B557Ff99BC6c2AA2A4BEB7478EA4b4dC58C8Ed2/sources/hijabcoin.sol
See {IERC20-totalSupply}./
function totalSupply() public view virtual override returns (uint256) { return _totalSupply; }
4,343,075
pragma solidity ^0.6.2; // SPDX-License-Identifier: MIT ...
inject NONSTANDARD NAMING
function SUB321(uint256 a, uint256 b) internal pure returns (uint256) {
1,820,495
./full_match/11155111/0xFb73a1AFf31022491208C3155880bd61Df2aF0CD/sources/AllTypes.sol
Store & retrieve an int256 val Value to return/
function getInt256(int256 val) public pure returns (int256) { return val; }
3,796,046
./full_match/42220/0xFfba915D00045049Fe2A9050D7Fe1C21091c625f/sources/D/wannaswap/wannaswap-core/contracts/WannaSwapPair.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), 'WannaSwap: OVERFLOW'); uint32 blockTimestamp = uint32(block.timestamp % 2**32); if (timeElapsed > 0 && _reserve0 != 0 && _reserve1 != 0)...
16,322,829
./partial_match/4/0x4a6948a622C2B4DB9aee84B35c3bEC8F64442956/sources/MyDefiProject.sol
Pushed a piece of data to a user
function addData(uint256 _id, string memory _data) public { users[_id].data.push(_data); }
8,508,628
./partial_match/1/0x880fc0150aba07A74605D40B326B87bB9B651016/sources/Winner.sol
Transfer tokens from one address to another _from address The address which you want to send tokens from _to address The address which you want to transfer to _value uint256 the amount of tokens to be transferred/
function transferFrom( address _from, address _to, uint256 _value ) public returns (bool) { var _allowance = allowed[_from][msg.sender]; require(_to != address(0)); require(_value <= _allowance); balances[_from] = balances[_from].sub(_value); balan...
3,712,615
pragma solidity ^0.4.23; /** * @title Interface for contracts conforming to ERC-721: Non-Fungible Tokens */ contract ERC721 { event Transfer( address indexed from, address indexed to, uint256 indexed tokenId ); event Approval( address indexed owner, address indexed approved, ...
Transfer token from owner to this contract. _owner Current owner address of token to escrow _tokenId ID of token whose approval to verify/
function _deposit( address _owner, uint256 _tokenId ) internal { tokenContract.transferFrom(_owner, this, _tokenId); }
6,443,591
./full_match/1/0x996B0EE86c6817DD4d627d23CAe1a58e37E9a702/sources/src/shatter/IShatter.sol
IShatter.sol interface defining the Shatter standard shatter turns a 1/1 into a multiple sub-pieces. transientlabs.xyz @custom:version 2.4.0
interface IShatter { Events event Shattered(address indexed user, uint256 indexed numShatters, uint256 indexed shatteredTime); event Fused(address indexed user, uint256 indexed fuseTime); Functions function shatter(uint256 numSha...
2,965,254
pragma solidity ^0.5.16; import "./ComptrollerInterface.sol"; import "./CTokenInterfaces.sol"; import "./ErrorReporter.sol"; import "./Exponential.sol"; import "./EIP20Interface.sol"; import "./EIP20NonStandardInterface.sol"; import "./InterestRateModel.sol"; /** * @title Compound's CToken Contract * @notice Abstra...
Sets liquidationIncentive Admin function to set liquidationIncentive newLiquidationIncentiveMantissa New liquidationIncentive scaled by 1e18 return uint 0=success, otherwise a failure. (See ErrorReporter for details)/ Check caller is admin
function _setLiquidationIncentive(uint256 newLiquidationIncentiveMantissa) external returns (uint256) { if (msg.sender != admin) { return fail(Error.UNAUTHORIZED, FailureInfo.SET_LIQUIDATION_INCENTIVE_OWNER_CHECK); } return uint256(Error.NO_ERROR); }
333,338
//SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "./DaoStaking.sol"; import "./RicVault.sol"; // The FeeDao is where the fees accumulate from the contracts in the catalog. // Token holders...
Lock the ric in the vault reduce the balance and send it
function withdrawETH(uint256 amount) external { require(!lock, "925"); lock = true; require(ric.balanceOf(msg.sender) >= amount, "934"); uint256 _reward = calculateETHWithdraw(amount); require(_reward < balance[hashBalance(Balance.current)], "927"); balance[hashBalanc...
2,473,274
./partial_match/1/0xb9a6EB06754d6981903f8d285436439ca0001A3D/sources/Kawanaide.sol
exclude from paying fees or having max transaction amount
constructor() ERC20("Kawanaide Inu", "KAWA") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02( 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D ); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswapV2Pair =...
4,018,270
./full_match/5/0x409e6656e49aC29b662BB0a5B80EAFFC4CFA71f4/sources/project_/contracts/NBPresale.sol
Withdraw ETH from the contract to the sender's wallet. Only callable by the owner/
function withdrawEth() public onlyOwner { uint256 balance = address(this).balance; require(sent, "Failed to send Ether"); }
1,857,516
// SPDX-License-Identifier: MIT pragma solidity ^0.8.7; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import...
Base URI for computing {tokenURI}. If set, the resulting URI for each token will be the concatenation of the `baseURI` and the `tokenId`. Empty by default, can be overriden in child contracts./
function _baseURI() internal view virtual returns ( string memory ) { return ""; }
1,049,344
./full_match/1/0x4a55CBAc33cfF6149510D498E2B1D314678688e7/sources/src/H4CK3R5.sol
minting should be called from the distributor contract which assigns an ID and gives it to the caller
function mintFromDistributor(address to, uint256 id) external onlyDistributor { require(id<=MAX_ID && id != 0, "H4CK3R5: invalid ID"); _mint(to, id); }
17,171,733
pragma solidity ^0.4.11; /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20Basic { uint256 public totalSupply; function balanceOf(address who) constant returns (uint256); function transfer(address to, uint256 value); ev...
Contructor that assigns all presale tokens and starts the sale/ Allocate presale and founders tix
function TIXGeneration( address _ethFundDeposit, address _tixFundDeposit, address _tixFoundersDeposit, address _tixPromoDeposit, address _tixPresaleDeposit, uint256 _startTime, uint256 _endTime) { ethFundDeposit = _ethFundDeposit; tixFundD...
2,336,171
/** * @authors: [@unknownunknown1] * @reviewers: [] * @auditors: [] * @bounties: [] * @deployments: [] */ /* solium-disable security/no-block-members */ /* solium-disable max-len */ /* solium-disable security/no-send */ pragma solidity ^0.4.24; import { Arbitrable, Arbitrator } from "../arbitration/Arbitr...
Computes the Realitio answerer, of a specified question, that should win. This function is needed to avoid the "stack too deep error". TRUSTED. _questionID The ID of the question. _lastAnswerOrCommitmentID The last answer given, or its commitment ID if it was a commitment, to the question in the Realitio contract. ...
function computeWinner( bytes32 _questionID, bytes32 _lastAnswerOrCommitmentID, uint _lastBond, address _lastAnswerer, bool _isCommitment ) private view returns(address winner) { bytes32 lastAnswer; bool isAnswered; Question storage question = ques...
5,511,514
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; pragma experimental ABIEncoderV2; import "contracts/ImpartialSelection.sol"; import "contracts/ExactDollarPartitionMap.sol"; /// @title Impartial Selection Map implementation /// @author Giovanni Rescinito /// @notice smart contract implementing the sys...
executes the actual selection of the winners k number of winners to select randomness random value used to draw an allocation from the possible ones
function impartialSelection(uint k, uint randomness) override public{ super.impartialSelection(k, randomness); ExactDollarPartitionMap.exactDollarPartition(partition, scoreMap, allocations, randomness, k); }
5,531,848
pragma solidity ^0.4.19; contract Logger { event PrintNumber(string _message, uint256 _value); event PrintAddress(string _message, address _value); event PrintString(string _message, string _value); event PrintBoolean(string _message, bool _value); /** * This smart-contract can be used for debugging/log...
This smart-contract can be used for debugging/logging purposes. Simply import the Logger contract and print values in the truffle testing terminal by calling Logger.printNumber(...) You can provide a _message to describe the _value you are logging./
function Logger() public {}
981,177
// Using the ABIEncoderV2 poses little risk here because we only use it for fetching the byte arrays // of shares/responses/justifications pragma experimental ABIEncoderV2; pragma solidity ^0.6.6; contract DKG { enum UserState { CannotRegister, CanRegister, Registered } /// Mapping...
Gets the participants' ethereum addresses
function getParticipants() external view returns (address[] memory) { return participants; }
7,215,533
./full_match/80001/0x29B172DE06941aFcB22e79B4CDdd06003bD5aDbF/sources/project_/contracts/Test.sol
We keep the 16 MSb from nonce because it has better randomness Applying the mutation color via a mask Generating the next nonce using MMIX LGC parameters by Donald Knuth (used in RISC architecture)
function mutationBB(uint nMutations) public { unchecked { uint64 nonce = random(); uint mutationMatrixSizeWords = 2; uint iWord; uint pixelIndex; bytes32 nullMask; for ( uint nMutationsLeft = nMutations; ...
5,558,024
./partial_match/1/0xAd100C81305244a32372Bc307AB247864ce6c68a/sources/BKRW.sol
Function to remove an address from the mint-whitelist addr The address to remove from the mint-whitelist return A boolean that indicates if the operation was successful./
function removeFromMintWhitelist(address addr) public onlyOwner returns (bool) { require(_mintWhitelistMap[addr], "addr is not mint-whitelisted"); _mintWhitelistMap[addr] = false; for (uint256 i = 0; i < _mintWhitelist.length; i++) { if (_mintWhitelist...
3,982,409
./partial_match/7700/0xae2BF8e822C5f92d8E5F9aD3225C8F815893BB32/sources/motorChef.sol
Applies accrued interest to total borrows and reserves This calculates interest accrued from the last checkpointed block up to the current block and writes new checkpoint to storage./ Remember the initial block number / Short-circuit accumulating 0 interest /
function accrueInterest() virtual override public returns (uint) { uint currentBlockNumber = getBlockNumber(); uint accrualBlockNumberPrior = accrualBlockNumber; if (accrualBlockNumberPrior == currentBlockNumber) { return NO_ERROR; } uint borrowsPrior = totalBor...
3,505,731
// SPDX-License-Identifier: MIT pragma solidity 0.8.4; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; contract EmergencyWithdraw is OwnableUpgradeable { event Received(address sender, uint amount); /** * @dev allow...
get the token balance _tokenAddress token address/
function getTokenBalance(address _tokenAddress) public view onlyOwner returns (uint) { IERC20 erc20 = IERC20(_tokenAddress); return erc20.balanceOf(address(this)); }
1,752,881
./full_match/80001/0x8d19F0f5b1F181F01Ed06B55B91e5D2c9334C02B/sources/contracts/Gigble.sol
Function to create a new gig
function createGig( string memory _title, string memory _description, uint _price, uint _deliveryDate ) public payable returns (uint256) { require( bytes(_title).length > 0 && bytes(_description).length > 0 && _price > 0 && ...
5,556,089
./full_match/80001/0x14e39aDc79A7610c685143c4cd891F94dB3B40cD/sources/@ensdomains/ens-contracts/contracts/resolvers/profiles/IDNSRecordResolver.sol
DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated. DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.
interface IDNSRecordResolver { event DNSRecordChanged( bytes32 indexed node, bytes name, uint16 resource, bytes record ); event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource); function dnsRecord( bytes32 node, bytes32 name, ui...
5,569,592
//Address: 0x1d95a10ee67595aee46f82983c567b92f5e6534a //Contract name: Voting //Balance: 0 Ether //Verification Date: 10/24/2017 //Transacion Count: 6 // CODE STARTS HERE pragma solidity ^0.4.15; /* Copyright 2017 Mothership Foundation https://mothership.cx Permission is hereby granted, free of charge, to any ...
Queries the list with `_offset` and `_limit` of `voters`, candidates choosen and MSP amount at a specific `_blockNumber` _offset The offset at the `voters` list _limit The number of voters to return _blockNumber The block number when the voters's MSP balances is queried return The voters, candidates and MSP amount ...
function getVotersAt(uint _offset, uint _limit, uint _blockNumber) public constant returns(address[] _voters, uint8[] _candidates, uint[] _amounts) { if (_offset < voters.length) { uint count = 0; uint resultLength = voters.length - _offset > _limit ? _limit : voters.length - _offset; ...
12,901,415
./partial_match/1/0x67391801E7564994bdAa80544Ff916A7bCBFCB60/sources/MacroverseUniversalRegistry.sol
Make a new commitment by debiting msg.sender's account for the given deposit. Returns the numerical ID of the commitment, which must be passed to reveal() together with the actual bit-packed keypath of the thing being claimed in order to finalize the claim./ Deposit size will not be checked until reveal! We use the 0 h...
function commit(bytes32 hash, uint256 deposit) external { require(hash != bytes32(0), "Zero hash prohibited"); expectedDepositBalance = expectedDepositBalance.add(deposit); depositTokenContract.safeTransferFrom(msg.sender, address(this), deposit); bytes32 commitment_key = keccak2...
9,237,094
// SPDX-License-Identifier: MIT pragma solidity >=0.7.0 <0.9.0; /** * @title Owner * @dev Set & change owner */ contract Owner { address private owner; // event for EVM logging event OwnerSet(address indexed oldOwner, address indexed newOwner); // modifier to check if caller is owner ...
owner can query all stake accounts holders
function queryOwnersAccounts() external view isOwner returns (address[] memory) { return ownersAccounts; }
13,580,178