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: UNLICENSED pragma solidity 0.8.4; // いくつかの OpenZeppelin のコントラクトをインポートします。 import "@openzeppelin/contracts/utils/Strings.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol"; // utils ライブラリをインポートして文字列の処理を行いま...
ユーザーが NFT を取得するために実行する関数です。 現在のtokenIdを取得します。tokenIdは0から始まります。 3つの配列からそれぞれ1つの単語をランダムに取り出します。 3つの単語を連携して格納する変数 combinedWord を定義します。 3つの単語を連結して、<text>タグと<svg>タグで閉じます。 NFTに出力されるテキストをターミナルに出力します。 JSONファイルを所定の位置に取得し、base64としてエンコードします。 NFTのタイトルを生成される言葉(例: GrandCuteBird)に設定します。 data:image/svg+xml;base64 を追加し、SVG を base64 でエン...
function makeAnEpicNFT() public payable { require(totalSupply() < MAX_SUPPLY, "Exceeds max supply"); require(msg.value == MINT_PRICE, "Minting fee of 0.01 ether"); uint256 newItemId = _tokenIds.current(); string memory first = pickRandomFirstWord(newItemId); string memory s...
2,536,834
/** *Submitted for verification at Etherscan.io on 2021-11-01 */ // Sources flattened with hardhat v2.6.7 https://hardhat.org // File @openzeppelin/contracts-upgradeable/proxy/utils/[email protected] // SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.0; /** * @dev This is a base contract to aid in writing ...
Gets the balance of an owner owner Address of the owner Balance here represents the number of perpetuals owned by a HA
function balanceOf(address owner) external view override returns (uint256) { require(owner != address(0), "0"); return _balances[owner]; }
7,761,022
./partial_match/4/0xB942536a4255a04622C16dB974f54002DE78Da7a/sources/Inflator.sol
Deflates one iteration, calculating necessary amounts value Value left to deflate at call moment return Value left to deflate at return moment, 0 to stop further iterations In fact, credit is not used here/
function deflateOnce(uint256 value, uint credit) internal returns (uint) { Amounts memory a = currentAmounts(credit); uint amount = Math.min256(a.redeemAmount, a.borrowBalance); amount = Math.min256(amount, value); deflateOnceExact(amount); return value.sub(amount); }
8,607,067
./partial_match/1/0x85cdDcE5C1889D84e10d97074b7Af007f2CaDCC5/sources/BankrollNetworkStackPlus.sol
Stats of any single address
function statsOf(address _customerAddress) public view returns (uint256[16] memory){ Stats memory s = stats[_customerAddress]; uint256[16] memory statArray = [s.invested, s.withdrawn, s.rewarded, s.contributed, s.transferredTokens, s.receivedTokens, s.xInvested, s.xRewarded, s.xContributed, s.xWithd...
11,023,184
// contracts/PvP/PvPManager.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "../Governance/GovernanceWhitelist.sol"; import "./IPvP.sol"; // payment versus payment manager experimental implementation // OTC style contract PvPManager is Governa...
getting swap infromation getting swap information return information
function getSwap(uint256 swapid) public view returns ( address cbdc1Address, address from1Address, address to1Address, uint256 amount1, address cbdc2Address, address from2Address, address to2Address, uint256 amount2 ) { Swap memory swap = swaps[swapid]; ...
1,047,310
pragma solidity ^0.5.0; import '../math/SafeMath.sol'; import '../token/ERC777TokensSender.sol'; import '../token/IERC777.sol'; import '../registry/ERC1820Implementer.sol'; /** * @title SupplementWitholdingAccount * * An ERC777 tokens sender contract that supplements a specified account * with a pe...
removeSupplement removes a supplement/
function removeSupplement() external { accounts[msg.sender] = address(0); percentages[msg.sender] = 0; emit SupplementRemoved(msg.sender); }
13,066,113
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; import {SafeERC20} from "@openzeppelin/contracts/token/ER...
@custom:oz-upgrades-unsafe-allow state-variable-immutable @custom:oz-upgrades-unsafe-allow state-variable-immutable @custom:oz-upgrades-unsafe-allow state-variable-immutable Premiums can come in (for free, without liability) with receiveGrant. And can come out (withdrawed to treasury) with withdrawWonPremiums/
modifier onlyAssetManager() { require( msg.sender == address(_config.assetManager()), "Only assetManager can call this function" ); _; }
2,481,294
/** *Submitted for verification at Etherscan.io on 2020-08-11 */ //SPDX-License-Identifier: Unlicense pragma solidity 0.6.8; // ERC20 Interface interface ERC20 { function transfer(address, uint256) external returns (bool); function transferFrom( address, address, uint256 ) extern...
Member checks claim in a single pool Requires non-zero balance of the pool tokens
function checkClaimInPool( address member, uint256 era, address pool ) public view returns (uint256 claimShare) { if (totalClaimsInEra > 0) { claimShare = getShare( memberClaimInEra, totalClaimsInEra, poolShare ...
919,387
./full_match/43113/0x45DE33Eb4d1064e96Ad5C5787746Bd1ACf8EC29A/sources/contracts/Copy_BondDepository.sol
initializes bond parameters _controlVariable uint _vestingTerm uint32 _minimumPrice uint _maxPayout uint _fee uint _maxDebt uint _initialDebt uint/
function initializeBondTerms( uint _controlVariable, uint _minimumPrice, uint _maxPayout, uint _fee, uint _maxDebt, uint _initialDebt, uint32 _vestingTerm ) external onlyPolicy() { require( terms.controlVariable == 0, "Bonds must be initialized fro...
7,145,788
/** *Submitted for verification at Etherscan.io on 2022-02-01 */ /* ____ __ __ __ _ / __/__ __ ___ / /_ / / ___ / /_ (_)__ __ _\ \ / // // _ \/ __// _ \/ -_)/ __// / \ \ / /___/ \_, //_//_/\__//_//_/\__/ \__//_/ /_\_\ /___/ * Synthetix: ExchangerWithFeeRecAlternatives.sol * * Late...
Using struct to resolve stack too deep error SIP-65: Decentralized Circuit Breaker mutative call to suspend system if the rate is invalid If, after settlement the user has no balance left (highly unlikely), then return to prevent emitting events of 0 and don't revert so as to ensure the settlement queue is emptied do n...
function _exchange( address from, bytes32 sourceCurrencyKey, uint sourceAmount, bytes32 destinationCurrencyKey, address destinationAddress, bool virtualSynth ) internal returns ( uint amountReceived, uint fee, IV...
10,635,253
pragma solidity ^0.4.24; import "./Moduler.sol"; import "./ReliableToken.sol"; /** * @title TokenDrop * @dev TokenDrop is a token holder contract that will spread * locked tokens multiply */ contract TokenDrop is Moduler { /** * @dev Creates a contract that drop its initication balances of locked ERC20 ...
Transfers tokens to recipients multiply. _toList address of the recipients to whom received tokens _amountEach uint256 the amount of tokens to be transferred/
function spread( address[] _toList, uint256 _amountEach ) public returns (bool) { require(_toList.length > 0); require(_amountEach.mul(_toList.length) <= token.balanceOf(this)); for (uint i = 0; i < _toList.length; i++ ) { token.transfer(_...
6,415,839
./full_match/43113/0x306E0AADe325EAcE9187698df1fb13eA63596D6b/sources/contracts/AG.sol
check current apa against apas voted array
function isEligible(uint _currentAPA, uint proposalId) private view returns (bool){ for(uint16 i=0; i < votedAPAs[proposalId].length; i++){ if(votedAPAs[proposalId] [i] == _currentAPA) return false; } return true; }
7,159,156
./full_match/7672/0x04742440f3272232Dd46FCDb3e86A4c2961d5164/sources/contracts/payments/ticketing/TicketingParameters.sol
Retrieve the current ticketing parameters. return faceValue The face value of a ticket in SOLO. return baseLiveWinProb The base live win probability of a ticket. return expiredWinProb The expired win probability of a ticket. return ticketDuration The duration of a ticket in number of blocks. return decayRate The decay ...
function getTicketingParameters() external view returns (uint256, uint128, uint128, uint256, uint16) { return (faceValue, baseLiveWinProb, expiredWinProb, ticketDuration, decayRate); }
16,296,070
pragma solidity ^0.5.0; /* * @title String & slice utility library for Solidity contracts. * @author Nick Johnson <arachnid@notdot.net> * * @dev Functionality in this library is largely implemented using an * abstraction called a 'slice'. A slice represents a part of a string - * anything from the enti...
Returns the number of tokens that are owned outside of a batch for a given owner/
function fallbackCount(address __owner) public view returns (uint256) { return _ownedTokens[__owner].length; }
6,283,541
/** *Submitted for verification at Etherscan.io on 2020-09-16 */ /** *Submitted for verification at Etherscan.io on 2020-09-15 */ pragma solidity ^0.5.16; pragma experimental ABIEncoderV2; // From https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/Math.sol // Subject to the MIT licen...
Approve `spender` to transfer up to `amount` from `src` This will overwrite the approval amount for `spender` spender The address of the account which may transfer tokens rawAmount The number of tokens that are approved (2^256-1 means infinite) return Whether or not the approval succeeded/
function approve(address spender, uint rawAmount) external returns (bool) { uint96 amount; if (rawAmount == uint(-1)) { amount = uint96(-1); amount = safe96(rawAmount, "Dena::approve: amount exceeds 96 bits"); } allowances[msg.sender][spender] = amount; ...
8,005,864
/** *Submitted for verification at Etherscan.io on 2021-04-28 */ // File: @openzeppelin/contracts/utils/ReentrancyGuard.sol // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {no...
Calculate state based on withdraw amount. vaultNum Vault number. amount Collateral amount to withraw./
function whatWouldWithdrawDo(uint256 vaultNum, uint256 amount) external view override returns ( uint256 collateralLocked, uint256 daiDebt, uint256 collateralUsdRate, uint256 collateralRatio, uint256 minimumDebt ) ...
2,352,503
./full_match/1/0x97ed62B1Db853F5eeE03C7837edF8994BBE543ED/sources/src/lender/adapters/mkr/clerk.sol
decrease MKR creditline amountDAI amount of DAI to decrease creditline creditline amount including required overcollateralization => amount by that the seniorAssetValue should be decreased protection value for the creditline decrease going to the junior tranche => amount by that the juniorAssetValue should be increase...
function sink(uint256 amountDAI) public auth active { require(remainingCredit() >= amountDAI, "decrease-amount-too-high"); uint256 overcollAmountDAI = calcOvercollAmount(amountDAI); uint256 protectionDAI = safeSub(overcollAmountDAI, amountDAI); require((validate(protectionDAI, 0, 0,...
17,147,454
./full_match/100/0xF965f52046D7095d5080bD31459601F4Eb24f72D/sources/src/Facets/OFTWrapperFacet.sol
Sets the Layer zero chain Id for a given chain Id. _chainId Chain Id. _layerZeroChainId Layer zero chain Id. This is used to map a chain Id to its Layer zero chain Id.
function setOFTLayerZeroChainId( uint256 _chainId, uint16 _layerZeroChainId ) external { LibDiamond.enforceIsContractOwner(); Storage storage sm = getStorage(); sm.layerZeroChainId[_chainId] = _layerZeroChainId; emit LayerZeroChainIdSet(_chainId, _layerZeroChain...
14,273,361
/** *Submitted for verification at Etherscan.io on 2021-04-24 */ /** *Submitted for verification at etherscan.io and at BscScan.com on 2020-09-09 */ pragma solidity 0.5.16; interface IBEP20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); ...
Atomically decreases 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 {BEP20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. - `spender` must have a...
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "BEP20: decreased allowance below zero")); return true; }
2,281,974
//SPDX-License-Identifier: MIT pragma solidity >=0.6.6; import './interface/IERC2917.sol'; import './libraries/Upgradable.sol'; import './libraries/SafeMath.sol'; import './libraries/ReentrancyGuard.sol'; import './ERC20.sol'; /* The Objective of ERC2917 Demo is to implement a decentralized staking mechanism, whi...
External function call This function increase user's productivity and updates the global productivity. the users' actual share percentage will calculated by: Formula: user_productivity / global_productivity
function increaseProductivity(address user, uint value) internal returns (bool) { require(value > 0, 'PRODUCTIVITY_VALUE_MUST_BE_GREATER_THAN_ZERO'); UserInfo storage userInfo = users[user]; update(); if (userInfo.amount > 0) { uint pending = userInfo.amount.mul(accAmoun...
6,443,206
pragma solidity 0.5.11; /** * @notice Stores an updateable bond size * @dev Bond design details at https://github.com/omisego/research/issues/107#issuecomment-525267486 * @dev Security depends on the min/max value, which can be updated to compare to the current bond size, plus the waiting period * Min/max val...
Returns the current bond size/
function bondSize(Params memory self) internal view returns (uint128) { if (now < self.effectiveUpdateTime) { return self.previousBondSize; return self.updatedBondSize; } }
2,527,287
pragma solidity ^0.5.6; import "./openzeppelin-solidity/contracts/token/ERC20/ERC20Detailed.sol"; import "./openzeppelin-solidity/contracts/token/ERC20/ERC20.sol"; import "./openzeppelin-solidity/contracts/token/ERC20/ERC20Burnable.sol"; import "./openzeppelin-solidity/contracts/token/ERC20/SafeERC20.sol"; import "./o...
Function to mint tokens when not paused. to The address that will receive the minted tokens. value The amount of tokens to mint. return A boolean that indicates if the operation was successful./
function mint(address to, uint256 value) public onlyMinter whenNotPaused returns (bool) { _mint(to, value); return true; }
910,288
// 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...
Destroys `tokenId`. The approval is cleared when the token is burned. Requirements: - `tokenId` must exist. Emits a {Transfer} event./ Clear approvals from the previous owner Underflow of the sender's balance is impossible because we check for ownership above and the recipient's balance can't realistically overflow. Co...
function _burn(uint256 tokenId) internal virtual { TokenOwnership memory prevOwnership = ownershipOf(tokenId); _beforeTokenTransfers(prevOwnership.addr, address(0), tokenId, 1); _approve(address(0), tokenId, prevOwnership.addr); unchecked { _addressData[prevOwnership.a...
13,865,641
// File: contracts/ERC721/ERC721ReceiverDraft.sol pragma solidity ^0.5.10; /// @title ERC721ReceiverDraft /// @dev Interface for any contract that wants to support safeTransfers from /// ERC721 asset contracts. /// @dev Note: this is the interface defined from /// https://github.com/ethereum/EIPs/commit/2bddd126d...
tokenFallback is called from an ERC223 compatible contract _from the address from which the token was sent _value the amount of tokens sent _data the data sent with the transaction TKN memory tkn; tkn.sender = _from; tkn.value = _value; tkn.data = _data; uint32 u = uint32(_data[3]) + (uint32(_data[2]) << 8...
function tokenFallback(address _from, uint _value, bytes memory _data) public pure { _from; _value; _data;
93,674
/** *Submitted for verification at Etherscan.io on 2021-10-16 */ /** * For history and the expedited evolution of the collective consciousness */ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]....
one may paint a blank Canvas with immutable ink for history and the evolution of the collective consciousness /
function paintCanvas(uint256 tokenId, string[17] memory line, string memory metadataDescription) public nonReentrant { require(bytes(line[0]).length <= maxLineLen && bytes(line[1]).length <= maxLineLen && bytes(line[2]).length <= maxLineLen && bytes(line[3]).length <= maxLineLen && bytes(line[4]).l...
2,267,884
// ,----, ,----, // ,--. ,/ .`| ,/ .`| // ,---,. ,--.'| ,` .' : ,---, ,` .' : ,---, ,---,. .--.--. // ,' .' | ,--,: : | ; ; ...
Mints new tokens/
function teamMint(uint256 amount) public onlyOwner { require( totalTeamMinted + amount < MAX_TEAM_MINT + 1, "Max dev tokens minted" ); for (uint256 i = 0; i < amount; i++) { if (totalTeamMinted < MAX_TEAM_MINT) { totalTeamMinted += 1; ...
594,277
./partial_match/1/0xeacAbd7339202DED487Bb67a088CF47c6Ed00aa2/sources/src/Egg/StochasticSampling.sol
Adds a new probability distribution for a given trait./
function _pushProbabilities(uint256 traitId, uint64[] memory pdf) internal { if (traitId >= _numPerTrait.length) { revert InvalidTraitId(traitId); } if (pdf.length != _numPerTrait[traitId]) { revert IncorrectPDFLength(pdf.length, traitId, _numPerTrait[traitId]); ...
9,146,446
pragma solidity 0.4.24; // File: openzeppelin-solidity/contracts/ownership/Ownable.sol /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner...
----------- View Methods -----------/
function isWhitelisted(address _check) public view returns(bool isIndeed) { return whitelist[_check]; }
904,709
// SPDX-License-Identifier: MIT pragma solidity ^0.6.10; import {GelatoStatefulConditionsStandard} from "../../GelatoStatefulConditionsStandard.sol"; import {SafeMath} from "../../../external/SafeMath.sol"; import {IGelatoCore} from "../../../gelato_core/interfaces/IGelatoCore.sol"; import {IERC20} from "../../../exte...
This function should be called via the userProxy of a Gelato Task as part of the Task.actions, if the Condition state should be updated after the task. This is for Task Cycles/Chains and we fetch the TaskReceipt.id of the next Task that will be auto-submitted by GelatoCore in the same exec Task transaction. _timeDel...
function setRefTime(uint256 _timeDelta, uint256 _idDelta) external { uint256 currentTime = block.timestamp; uint256 newRefTime = currentTime + _timeDelta; refTime[msg.sender][_getIdOfNextTaskInCycle() + _idDelta] = newRefTime; }
2,518,262
./partial_match/1/0xDD3A8f6793AFBFA8d7C8e2B19106175DcCabEc41/sources/ELCK.sol
PUBLIC FACING: Leave the transform lobby after the round is complete enterDay Day number when the member entered count Number of queued-enters to exit (optional; 0 for all)/
function xfLobbyExit(uint256 enterDay, uint256 count) external { require(enterDay < _currentDay(), "ELCK: Round is not complete"); XfLobbyQueueStore storage qRef = xfLobbyMembers[enterDay][msg.sender]; uint256 headIndex = qRef.headIndex; uint256 endIndex; if (c...
4,031,325
./full_match/1/0xcE9b49b0d4FE456aD6E4a1b7e4bBdD0699400Ef9/sources/src/abstracts/EIP712.sol
Given an already: this function returns the hash of the fully encoded EIP712 message for this domain. This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example: ```solidity bytes32 digest = _hashTypedDataV4(keccak256(abi.encode( keccak256("Mail(address to,string contents)"),...
function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) { return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash); }
2,940,101
./full_match/5/0x19947890b642D3b6Ca0E467dF1E9Bcf6aDe5225a/sources/project_/contracts/PriceConverter.sol
ABI 0xA39434A63A52E749F02807ae27335515BA4b07F7 AggregatorV3Interface(0xA39434A63A52E749F02807ae27335515BA4b07F7) .version();
function getPrice() internal view returns (uint256) { AggregatorV3Interface priceFeed = AggregatorV3Interface( 0xA39434A63A52E749F02807ae27335515BA4b07F7 ); (, int price, , , ) = priceFeed.latestRoundData(); return uint256(price * 1e10); }
11,632,407
// SPDX-License-Identifier: MIT pragma solidity >=0.6.6; import './TomiLP.sol'; import './modules/Ownable.sol'; interface ITomiLP { function addLiquidity( address user, uint256 amountA, uint256 amountB, uint256 amountAMin, uint256 amountBMin, uint256 deadline) exter...
External function call This function will decreases user's productivity by value, and updates the global productivity it will record which block this is happenning and accumulates the area of (productivity time)
function _decreaseProductivity(address user, uint value) internal virtual returns (bool) { UserInfo storage userInfo = users[user]; require(value > 0 && userInfo.amount >= value, 'INSUFFICIENT_PRODUCTIVITY'); _update(); _audit(user); userInfo.amount = userIn...
1,372,455
./full_match/5/0xCf4969837ee1e7188609AB8bDD9c4425A3487FA1/sources/contracts/dynamic-contracts/extension/Royalty.sol
Returns the defualt royalty recipient and BPS for this contract's NFTs./
function getDefaultRoyaltyInfo() external view override returns (address, uint16) { RoyaltyStorage.Data storage data = RoyaltyStorage.royaltyStorage(); return (data.royaltyRecipient, uint16(data.royaltyBps)); }
7,034,525
// SPDX-License-Identifier: Apache-2.0 pragma solidity >=0.6.4 <0.8.0; pragma experimental ABIEncoderV2; import "./announcement.sol"; import "./eventsEIP1129.sol"; import "https://github.com/vigilance91/solidarity/libraries/unsigned/uint256ToString.sol"; /// /// @dev Library for managing an enumerable mapping of Anno...
/ swap the last entry with the index where the entry to be deleted ismap._entries[toDeleteIndex] = lastEntry;/ Update the index for the moved entrymap._indexes[lastEntry._key] = toDeleteIndex + 1; All indexes are 1-based} Removes a key-value pair from a map, O(1) return {bool} true if key was removed from map, if it ...
function remove( Map storage map, bytes32 key, bytes32 removerHash, string memory reason )public returns( bool ){ uint256 keyIndex = map._indexes[key]; if(keyIndex.equal(0)){ return false; } uint256 toDeleteIndex = keyIndex...
12,573,365
// SPDX-License-Identifier: MIT pragma solidity ^0.8.7; contract PlansStorage { // STRUCTS struct Plan { uint Index; uint Value; } // MAPS mapping (address => Plan) public plans; // VARIABLES address owner; address allowedContract; address[] internal keyList; // CONSTRUCTOR constructor...
TRANSACTION CONTRACT
function updateAllowedContract(address _key) public onAllow { allowedContract = _key; }
7,236,854
pragma solidity ^0.5.2; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address private _owner; event OwnershipTransferred(address indexed ...
returns up to 10 devices for the device owner return _deviceIds device ID's of the owner/
function getDevicesByOwner(bytes32 _message, uint8 _v, bytes32 _r, bytes32 _s) public view returns(bytes32[10] memory _deviceIds) { address signer = ecrecover(_message, _v, _r, _s); uint numDevices; bytes32[10] memory devicesByOwner; ...
13,008,227
./partial_match/1/0xBB8F3F39B86D4e326A1C6e90e6FceED36EF03329/sources/BUNNYGIRLS.sol
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. See {_mint}. Emits a {Transfer} event for each mint./
function _safeMint( address to, uint256 quantity, bytes memory _data ) internal virtual { _mint(to, quantity); unchecked { if (to.code.length != 0) { uint256 end = _currentIndex; uint...
2,812,792
pragma solidity ^0.4.13; //solc --bin --abi --optimize --optimize-runs 20000 -o . Testpool.sol import "./Ethash.sol"; /** * @title RLPReader * * RLPReader is used to read and parse RLP encoded data in memory. * * @author Andreas Olofsson (androlo1980@gmail.com) * * code was taken from https://github.com/androlo/s...
anyone who is willing to pay gas fees can call this function submission is not ready for verification submission is not ready for verification it is too late to call store function unknown error
function storeClaimSeed( address miner ) { uint seed = getClaimSeed( miner ); if( seed != 0 ) { submissionsMetaData[miner].submissionSeed = seed; StoreClaimSeed( msg.sender, 0, uint(miner) ); return; } uint lastBlockNumber = uint(metaData....
13,006,304
// 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...
Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been granted `role`, emits a {RoleRe...
function renounceRole(bytes32 role, address account) public virtual override { require( account == _msgSender(), "AccessControl: can only renounce roles for self" ); _revokeRole(role, account); }
6,033,067
./partial_match/1/0x37DF85b18b65e2Cf8A0464756c236a31C3Af1c7E/sources/contracts/JEANCLAUDEDAMNVAN.sol
Sets up the initial set of artist wallet that can autograph the contract _artistWallets the addresses of the artists that will be able to autograph the contract/
function setArtists(address[] memory _artistWallets) external adminRequired { if (activated || gumballsLeft > 0) revert MachineIsLocked(); artists = _artistWallets; }
15,994,943
pragma solidity 0.4.25; /** * @title SafeCompare */ library SafeCompare { function stringCompare(string str1, string str2) internal pure returns(bool) { return keccak256(abi.encodePacked(str1)) == keccak256(abi.encodePacked(str2)); } } library SafeMath { /** * @dev Multiplies two...
Batch create a pledge subcontract _pledgeIds index number of the pledge contract./
function batchCreatePledgeContract(uint256[] _pledgeIds) public onlyPartner { require(_pledgeIds.length > 0); PledgeFactory(pledgeFactory).batchCreatePledgeContract(_pledgeIds,partner); }
6,378,376
pragma solidity ^0.4.19; library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { // Gas optimization: this is cheaper than asserting 'a' not being zero, but the // benefit is lost if 'b' is ...
Integer division of two numbers, truncating the quotient./ assert(b > 0); Solidity automatically throws when dividing by 0 uint256 c = a / b; assert(a == b c + a % b); There is no case in which this doesn't hold
function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; }
608,485
// SPDX-License-Identifier: AGPL-3.0-only /* Bounty.sol - SKALE Manager Copyright (C) 2020-Present SKALE Labs @author Dmytro Stebaiev SKALE Manager is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Softw...
Deletes node from array./
function _deleteNode(uint nodeIndex) private { uint8 space = spaceOfNodes[nodeIndex].freeSpace; uint indexInArray = spaceOfNodes[nodeIndex].indexInSpaceMap; if (indexInArray < spaceToNodes[space].length.sub(1)) { uint shiftedIndex = spaceToNodes[space][spaceToNodes[space].length....
401,158
/** *Submitted for verification at Etherscan.io on 2021-07-15 */ pragma solidity 0.8.2; interface ILiquidator { function createLiquidation( address _integration, address _sellToken, address _bAsset, bytes calldata _uniswapPath, bytes calldata _uniswapPathReversed, ...
Delete a liquidation/
function deleteLiquidation(address _integration) external override onlyGovernance { Liquidation memory liquidation = liquidations[_integration]; require(liquidation.bAsset != address(0), "Liquidation does not exist"); delete liquidations[_integration]; emit LiquidationEnded(_integr...
10,714,620
./partial_match/80001/0x94086f81367Ec9398665D9b66d299510EE3Ce57B/sources/contracts/AlgebraFactory.sol
Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner if RENOUNCE_OWNERSHIP_DELAY seconds have passed since the call to the startRenounceOwnership() function.
function renounceOwnership() public override onlyOwner { require(renounceOwnershipStartTimestamp != 0); require(block.timestamp - renounceOwnershipStartTimestamp >= RENOUNCE_OWNERSHIP_DELAY); renounceOwnershipStartTimestamp = 0; super.renounceOwnership(); emit RenounceOwnershipFinish(block.timest...
8,804,955
./partial_match/1/0x8B7Dbc256360F4181d4005D12d455378845A82fA/sources/SILVERFORTH.sol
Allows the current owner to relinquish control of the contract. Renouncing to ownership will leave the contract without an owner. It will not be possible to call the functions with the `onlyOwner` modifier anymore./
function renounceOwnership() public onlyOwner { emit OwnershipRenounced(_owner); _owner = address(0); }
2,868,659
./full_match/5/0xF25bBDF9f7C5b75Be0eAb107dF497C863D651247/sources/contracts/seed/Seed.sol
Withdraw funds from the contract/
function withdraw() external onlyAdmin { Admin can't withdraw funding tokens until buying has ended and therefore contributors can no longer withdraw their funding tokens. require( maximumReached || (minimumReached && block.timestamp >= endTime), "Seed: cannot...
1,926,253
// SPDX-License-Identifier: MIT pragma solidity ^0.8; contract StakingRewards { IERC20 public rewardsToken; IERC721 public stakingToken; uint public rewardRate = 100; uint public lastUpdateTime; uint public rewardPerTokenStored; mapping(address => uint) public userRewardPerTokenPaid; mapp...
assembel metadata offchain/onchain
interface IERC721Metadata { /* is ERC721 */ function name() external view returns (string calldata _name); function symbol() external view returns (string calldata _symbol); function tokenURI(uint256 _tokenId) external view returns (string calldata); }
12,764,628
./full_match/5/0x846f8dC40F8Bc5E71F56Fe2867D98a65810a3cA9/sources/src/Member1155.sol
endpoints.push(dao_);
function pushIsEndpointOf(address dao_, address endpointOwner_) external { if (msg.sender != ODAOaddress) revert MR1155_OnlyODAO(); endpointsOf[endpointOwner_].push(dao_); } override
1,868,933
pragma solidity ^0.5.1; contract ERC20 { function transferFrom(address from, address to, uint256 value) public returns (bool); } contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev The Ownable constructor sets the orig...
transfer balance to owner
function withdrawEther(uint256 _amount) public onlyOwner{ msg.sender.transfer(_amount); }
6,362,554
// SPDX-License-Identifier: GNU-GPL v3.0 or later pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/access/AccessControlEnumerable.sol"; import '@openzeppelin/contracts/utils/introspection/ERC165Checker.sol'; import "./interfaces/IRevest.sol"; im...
Returns true if `account` supports the interface defined by `interfaceId`. Support for {IERC165} itself is queried automatically. See {IERC165-supportsInterface}./ query support of both ERC165 as per the spec and support of _interfaceId
function supportsInterface(address account, bytes4 interfaceId) internal view returns (bool) { return supportsERC165(account) && _supportsERC165Interface(account, interfaceId); }
22,865
/** *Submitted for verification at Etherscan.io on 2021-06-09 */ pragma solidity ^0.4.18; // ---------------------------------------------------------------------------- // 'UglyShiba' token contract // // Deployed to : 0xD445dC1f1d9ca1A5857adAE1FE1621cEE0744bc7 // Symbol : UGLYSHIB ...
------------------------------------------------------------------------ Transfer tokens from the from account to the to account The calling account must already have sufficient tokens approve(...)-d for spending from the from account and - From account must have sufficient balance to transfer - Spender must have suffi...
function transferFrom(address from, address to, uint tokens) public returns (bool success) { balances[from] = safeSub(balances[from], tokens); allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); Tra...
7,959,970
./full_match/1/0xA19D882845Db7e97b986dA8c3189aa9B6f62D24a/sources/browser/FLAPP.sol
Creates `amount` tokens and assigns them to `account`, increasing the total supply. Emits a {Transfer} event with `from` set to the zero address. Requirements - `to` cannot be the zero address./
function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); require(_totalSupply + amount <= _maxSupply); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _ba...
3,139,338
pragma solidity ^0.4.13; interface ERC721Enumerable /* is ERC721 */ { /// @notice Count NFTs tracked by this contract /// @return A count of valid NFTs tracked by this contract, where each one of /// them has an assigned and queryable owner not equal to the zero address function totalSupply() public v...
Approves another address to claim for the ownership of any tokens owned by this account _to address to be approved for the given token ID/
function approveAll(address _to) public whenNotPaused { require(_to != msg.sender); require(_to != address(0)); operatorApprovals[msg.sender][_to] = true; ApprovalForAll(msg.sender, _to, true); }
478,486
./partial_match/1/0x52d2beB043A6F1b0C94d9FB69cDB048805A3B789/sources/ERC20.sol
Sets the values for {name} and {symbol}. The default value of {decimals} is 18. To select a different value for {decimals} you should overload it. All two of these values are immutable: they can only be set once during construction./
function _afterTokenTransfer( address from, address to, uint256 amount constructor(string memory name_, string memory symbol_,uint256 amount) { _name = name_; _symbol = symbol_; _mint(msg.sender, amount * 10 ** decimals()); }
15,571,694
pragma solidity 0.5.8; /** * The energyTrading contract manages collectives and allows home owners to transact between each other. Energy producers can sell their energy and buyers pay for it in ether. The company or contract owner handles changes in home owners and the creation of new collectives. */ // import ...
Checks if the user is enrolled in the collective or not.
function isenrolled() public view returns(bool) { return(enrolled[msg.sender]); }
1,036,139
./full_match/1/0x032Ba44EB2DB607d2F9424b90e191BbFb51152A1/sources/contracts/PrizeDistributionFactoryV2.sol
Calculate total picks for a draw. _bitRangeSize Bit range size _cardinality Cardinality return Total number of picks/
function _calculateTotalPicks(uint8 _bitRangeSize, uint8 _cardinality) internal pure returns (uint256) { return (2**_bitRangeSize)**_cardinality; }
16,513,594
/** * SourceUnit: c:\Users\Jad\Documents\code\NFTC\nftc-monorepo\blockend\contracts\tokens\ArtCirculationToken.sol */ ////// SPDX-License-Identifier-FLATTEN-SUPPRESS-WARNING: MIT pragma solidity ^0.8.0; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions ca...
grants the pauser role to a specified address pauser address/
function grantPauser(address pauser) public onlyRole(DEFAULT_ADMIN_ROLE) { grantRole(PAUSER_ROLE, pauser); }
372,338
pragma solidity ^0.4.2; contract owned { address public owner; function owned() { owner = msg.sender; } function changeOwner(address newOwner) onlyOwner { owner = newOwner; } modifier onlyOwner { require(msg.sender == owner); _; } } contract tokenRecipient {function receiveApprova...
Send coins / Check for overflows Subtract from the sender
function transfer(address _to, uint256 _value) { checkMyAging(msg.sender); require(matureBalanceOf[msg.sender] >= _value); require(balanceOf[_to] + _value > balanceOf[_to]); require(matureBalanceOf[_to] + _value > matureBalanceOf[_to]); balanceOf[msg.sender] -= _value; matureBalanceOf[msg.sender] -= _val...
12,782,435
// SPDX-License-Identifier: AGPL-3.0-or-later pragma solidity 0.6.11; /** * @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 (uint); /** * @dev Returns th...
Interface of the ERC20 standard as defined in the EIP./
interface IERC20 { function totalSupply() external view returns (uint); function balanceOf(address account) external view returns (uint); function transfer(address recipient, uint amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint); fu...
1,738,730
./full_match/5/0x9ccDD0Bb22aA073Be7f4021D9bfa89fdD7BfAbdF/sources/project_/_pancakeswap/v3-periphery/contracts/base/PeripheryPaymentsWithFee.sol
@inheritdoc IPeripheryPaymentsWithFee
function sweepTokenWithFee( address token, uint256 amountMinimum, address recipient, uint256 feeBips, address feeRecipient ) public payable override { require(feeBips > 0 && feeBips <= 100); uint256 balanceToken = IERC20(token).balanceOf(address(this)); ...
1,959,216
// Sources flattened with hardhat v2.6.0 https://hardhat.org // File contracts/libraries/SafeMath.sol pragma solidity ^0.6.6; /** * @title SafeMath * @dev Unsigned math operations with safety checks that revert on error * * @dev Default OpenZeppelin */ library SafeMath { /** * @dev Multiplies two unsi...
Some NFT expiries used a different bucket step upon update and must be reset./
function forceResetExpires(uint256[] calldata _nftIds) external onlyOwner { uint64[] memory validUntils = new uint64[](_nftIds.length); for (uint256 i = 0; i < _nftIds.length; i++) { (/*coverId*/, /*status*/, /*uint256 sumAssured*/, /*uint16 coverPeriod*/, uint256 validUn...
226,701
pragma ton-solidity >= 0.52.0; pragma AbiHeader time; pragma AbiHeader pubkey; pragma AbiHeader expire; //================================================================================ // import "../interfaces/IBase.sol"; import "../interfaces/ILiquidFTWallet.sol"; //================================================...
========================================
function setAllowance(address targetAddress, uint128 amount, uint32 until) external override onlyOwner reserve returnChange { if(amount == 0) { delete _allowances[targetAddress]; } else { AllowanceInfo info; info.allowanceAmount = amoun...
14,059,229
./full_match/8453/0x7Fb69e8fb1525ceEc03783FFd8a317bafbDfD394/sources/contracts/WidoCrossReceiver.sol
Receives an order initiated from WidoCrossRouter on source chain order The order to be executed on destination chain route The route of the order recipient Recipient of the final tokens of the order partner Partner address
function receiveCrossOrder( IWidoRouter.Order calldata order, IWidoRouter.Step[] calldata route, address recipient, address partner ) external payable { if (order.inputs.length != 1) revert SingleTokenInputExpected(); _sendTokens(order.inputs[0]); IWidoR...
11,546,258
import 'dapple/test.sol'; import 'database.sol'; import 'dappsys/auth.sol'; import 'initial_controller.sol'; contract DappHubSimpleControllerTest is Test, DSAuthModesEnum { DappHubNameOwnerDB names; DappHubDB packages; DappHubSimpleController controller; Tester T1; address t1; Tester T2; address t2; funct...
Unauthorized user should be able to register names prefixed with 'beta/'
function testUnauthorizedSetBetaPackage() { DappHubSimpleController(t1).setPackage("beta/foo", 1, 0, 0, "bar"); }
1,042,795
./partial_match/97/0x74be7aFB7653D64D10070EC055aB34f2D3C1A940/sources/PantyFarm.sol
Deposit LP tokens to PantyFarm for PANTY allocation.
function deposit(uint256 _pid, uint256 _amount) public { require (_pid != 0, 'deposit PANTY by staking'); PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; updatePool(_pid); if (user.amount > 0) { uint256 pending = user....
11,382,849
./partial_match/1/0x6601d3f885D1A91FfE63B4b4A834Cf9E2490C2D8/sources/src/settled-physical/CrossMarginPhysicalEngine.sol
hook to be invoked by Grappa to handle custom logic of settlement/
function handleExercise(uint256 _tokenId, uint256 _debtPaid, uint256 _amountPaidOut) external override(BaseEngine, IMarginEngine) { _checkIsPomace(); tokenTracker[_tokenId].totalDebt += _debtPaid.toUint80(); tokenTracker[_tokenId].totalPaid += _amountPaidOut.toUint80(); ...
4,198,926
pragma solidity ^0.4.11; import './interfaces/ILoanPlanFormula.sol'; import './interfaces/IDABFormula.sol'; import './interfaces/ISmartToken.sol'; import './SmartTokenController.sol'; import './DABAgent.sol'; import './DABDepositAgent.sol'; import './DABWalletFactory.sol'; /* DABDepositAgent v0.1 The agent o...
/ event event
@return true if the function was successful, false if it wasn't function repay(address _user) public payable ownerOnly active validAddress(_user) validAmount(msg.value) returns (bool success) { Token storage subCredit = tokens[subCreditToken]; uint256 sctAmount ...
6,422,292
// SPDX-License-Identifier: AGPL-3.0 pragma solidity ^0.8.9; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/finance/PaymentSplitter.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; import "./externa...
See {IERC721Enumerable-totalSupply}./
function totalSupply() public view override returns (uint256) { return currentIndex - 1; }
210,870
./partial_match/42220/0xe55C3eb4a04F93c3302A5d8058348157561BF5ca/sources/home/obernardovieira/Documentos/GitHub/impact-market/smart-contracts/contracts/Community.sol
Allow community managers to lock community claims./
function lock() external onlyManagers { locked = true; emit CommunityLocked(msg.sender); }
3,497,805
pragma solidity ^0.4.21; contract Ownable { address public owner; event OwnershipTransferred(address previousOwner, address newOwner); function Ownable() public { owner = msg.sender; } modifier onlyOwner() { require(msg.sender == owner); _; } function transferOwn...
the monster must not pregnant othewise the birth child may owned by the the sale auction or the buyer Sale auction throws if inputs are invalid and approve status will be reverted
function createSaleAuction( uint256 _tokenId, uint256 _startingPrice, uint256 _endingPrice, uint256 _duration ) external whenNotPaused { require(_tokenId > 0); require(_owns(msg.sender, _tokenId)); require(!isPregnant(_tokenId)); ...
34,084
pragma solidity >=0.4.24; contract SupplyChain{ //model a landlord struct Landlord{ uint landlordID; string landlordName; uint landlordContact; string landlordAddress; address laddr; bool isValue; } //model a seed dealer struct SeedDealer{ u...
add new farmer Only allows new records to be created
function newFarmer ( uint _farmerID, string memory _farmerName, uint _farmerContact, string memory _farmerAddress ) public { Farmer storage _newfarmer = mfarmer[msg.sender]; require(!mfarmer[msg.sender].isValue); _newfarmer.faddr = msg.sender; _ne...
15,796,771
./partial_match/1/0x44383018ecf3DBED34eE621439a5Ff6002e8209b/sources/contracts/libraries/GovernanceUtilV1.sol
Gets the "valid" reporter's stablecoin commission rate on protocol's earnings (upon each claim payout received by claimants) for the given cover. Warning: this function does not validate the input arguments. s Specify store instance/
function getClaimReporterCommissionInternal(IStore s) external view returns (uint256) { return s.getUintByKey(ProtoUtilV1.NS_CLAIM_REPORTER_COMMISSION); }
10,998,081
/** *Submitted for verification at Etherscan.io on 2021-08-13 */ pragma solidity 0.8.4; // SPDX-License-Identifier: MIT License // contract SafeMath { function safeMul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; ...
------------------------------------------------------------------------ Total supply ------------------------------------------------------------------------
function totalSupply() public override view returns (uint256) { return _totalSupply - balances[address(0)]; }
10,786,449
./partial_match/3/0xAAa655f350eF27981dcDfC2B82d3DA52D8D1cf45/sources/Governance.sol
propose to update the incentive addresses and its allocation. proposer needs to commit minimum deposit amount./
function proposeUpdateIncentiveFund( address[] memory incentiveAddresses, uint256[] memory incentiveAllocation ) external override { bytes32 proposeId = keccak256(abi.encode(incentiveAddresses, incentiveAllocation)); uint32 prevoteDeadline = _getBlockTimestampSec() + _prevoteLeng...
5,230,190
//Address: 0x14f37b574242d366558db61f3335289a5035c506 //Contract name: HackerGold //Balance: 0 Ether //Verification Date: 1/9/2017 //Transacion Count: 4373 // CODE STARTS HERE pragma solidity ^ 0.4 .0; /* * Token - is a smart contract interface * for managing common functionality of * a token. * * ERC.20 Tok...
transferFrom() - used to move allowed funds from other owner account from - move funds from account to - move funds to account value - move the value return - return true on success false otherwise/ do the actual transfer addjust the permision, after part of permited to spend value was used ...
function transferFrom(address from, address to, uint256 value) returns(bool success) { if (balances[from] >= value && allowed[from][msg.sender] >= value && value > 0) { balances[from] -= value; bal...
7,271,332
./full_match/97/0xbA8d885b4029C836B05BF7A8aE5348a0e8468317/sources/project_/contracts/Ballot.sol
used to update the voting start & end times startTime_ Start time that needs to be updated currentTime_ Current time that needs to be updated/
function updateVotingStartTime(uint256 startTime_, uint256 currentTime_) public isElectionChief { require(votingStartTime > currentTime_); votingStartTime = startTime_; }
5,025,385
// Copyright 2019 - See NOTICE file for copyright holders. // // 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 ap...
Function `pushOutcome` pushes the accumulated outcome of the channel identified by `state.channelID` and its subchannels referenced by `subStates` to the assetholder contracts. The following must be guaranteed when calling the function: - state and subStates conform with participants - the outcome has not been pushed y...
function pushOutcome( Channel.State memory state, Channel.State[] memory subStates, address[] memory participants) internal { address[] memory assets = state.outcome.assets; for (uint256 a = 0; a < assets.length; a++) { uint256[] memory outcome = new uint...
1,085,584
// SPDX-License-Identifier: MIT pragma solidity ^0.8.2; pragma abicoder v2; import "@openzeppelin/contracts/utils/Strings.sol"; import "@openzeppelin/contracts/utils/math/SafeCast.sol"; /// @title Accessory SVG generator library Lines3 { /// @dev Accessory N°1 => Classic function fortune_41() public pure r...
Accessory N°1 => Classic
function fortune_60() public pure returns (string[2] memory) { return ["You know", "what to do."] ; }
5,390,172
./full_match/5/0x94571FA1995B3052302fd027CC7a3ABAca1Ab358/sources/browser/WXMR.sol
/ Remember that only owner can call so be careful when use on contracts generated from other contracts. tokenAddress The token contract address tokenAmount Number of tokens to be sent/
function recoverToken(address tokenAddress, uint256 tokenAmount) public onlyOwner { IERC20(tokenAddress).transfer(owner(), tokenAmount); }
1,904,864
./partial_match/1/0x7e55ccB0bCe9A9094aE5cf75EF71b3275B45658A/sources/Tettoken.sol
Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. _spender The address which will spend the funds. _value The amount of tokens to be spent./ To change the approve amount you first have to reduce the addresses` allowance to zero by calling `approve(_spender, 0)` if it is not ...
function approve(address _spender, uint256 _value) public onlyPayloadSize(2 * 32) returns (bool success) { require(!((_value != 0) && (allowed[msg.sender][_spender] != 0))); allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; }
3,553,626
//Address: 0x2fc5f7b04b1a43a64cfc066530f2bd87e001824d //Contract name: MilestoneTracker //Balance: 0 Ether //Verification Date: 1/20/2017 //Transacion Count: 8 // CODE STARTS HERE pragma solidity ^0.4.6; /* Copyright 2016, Jordi Baylina This program is free software: you can redistribute it and/or modify ...
`onlyReviewer` Approves a specific milestone _idMilestone ID of the milestone that is approved
function approveCompletedMilestone(uint _idMilestone) campaignNotCanceled notChanging { if (_idMilestone >= milestones.length) throw; Milestone milestone = milestones[_idMilestone]; if ((msg.sender != milestone.reviewer) || (milestone.status != MilestoneStatus.Complet...
1,752,242
/** *Submitted for verification at Etherscan.io on 2020-09-29 */ /** *Submitted for verification at Etherscan.io on 2020-09-03 */ /* solhint-disable no-mix-tabs-and-spaces */ /* solhint-disable indent */ pragma solidity 0.5.15; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethe...
inject PUBLIC FUNC TO EXTERNAL
function shardOfferingAddress() public view returns (address) {
12,973,446
pragma solidity ^0.4.18; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return ...
Constructor that gives msg.sender all of existing tokens./
function HcoinToken() public { _totalSupply = INITIAL_SUPPLY; balances[msg.sender] = INITIAL_SUPPLY; Transfer(0x0, msg.sender, INITIAL_SUPPLY); }
202,110
// SPDX-License-Identifier: MIT pragma solidity >=0.7.0 <0.9.0; contract Token { mapping(address => uint64) public balances; string public name; constructor(string memory _name) { name = _name; } // virtual is used to mark if function is created to override function mint() virtual pub...
virtual is used to mark if function is created to override tx represents address which started chain of transactions (here creator of wallet)
function mint() virtual public { balances[tx.origin]++; }
13,005,699
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.6.8; import "@hyperledger-labs/yui-ibc-solidity/contracts/core/types/ProtoBufRuntime.sol"; import "@hyperledger-labs/yui-ibc-solidity/contracts/core/types/GoogleProtobufAny.sol"; import "@hyperledger-labs/yui-ibc-solidity/contracts/core/types/gogoproto/gogo.sol"...
The encoder for internal usage r The struct to be encoded p The offset of bytes array to start decode bs The bytes array to be decoded return The number of bytes encoded/
function _encode(Data memory r, uint256 p, bytes memory bs) internal pure returns (uint) { uint256 offset = p; uint256 pointer = p; if (r.tx_id.length != 0) { pointer += ProtoBufRuntime._encode_key( 1, ProtoBufRuntime.WireType.LengthDelim, pointer, bs ); ...
13,056,904
pragma solidity ^0.4.15; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal constant returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(...
Function to send the calculated tokens amount to the investor
function dividendTransfer(address _to, uint256 _value) private { if (token.transfer(_to,_value)) { token.changeTotalSupply(_value); tokenDistributeInDividend = tokenDistributeInDividend.add(_value); SendDividend(_to,_value,now); } }
12,731,430
./full_match/4/0x05F5230b57E7D1d96B7ECC3975e447955a690b85/sources/BondingCurveFactory_flat.sol
This function returns the variables that determine the behaviour of the curve. The variables returned are used in the curves calculations. Below is the current version of the equation being used: a/3(x_1^3 - x_0^3) + b/2(x_1^2 - x_0^2) + c(x_1 - x_0) return uint256: a return uint256: b retur...
function getCurve() external view returns ( uint256, uint256, uint256 ) { return (a, b, c); }
651,429
pragma solidity ^0.4.24; //============================================================================== // _ _ _ _|_ _ . // (/_\/(/_| | | _\ . //============================================================================== contract BBTevents { // fired whenever a player registers a name event on...
set up our tx event data fetch player ID manage affiliate residuals if no affiliate code was given or player tried to use their own, lolz use last stored affiliate code if affiliate code was given get affiliate ID from aff Code if affID is not the same as previously stored update last affiliate
function reLoadXname(bytes32 _affCode, uint256 _team, uint256 _eth) isActivated() isHuman() isWithinLimits(_eth) public { BBTdatasets.EventReturns memory _eventData_; uint256 _pID = pIDxAddr_[msg.sender]; uint256 _affID; if (_affC...
1,192,493
./full_match/1/0x4552f8b70a72A8ea1084bf7B7Ba50F10F2F9dAa7/sources/contracts/modules/RangeEditionMinter.sol
@inheritdoc IRangeEditionMinter/
function mintInfo(address edition, uint128 mintId) external view returns (MintInfo memory) { BaseData memory baseData = _baseData[edition][mintId]; EditionMintData storage mintData = _editionMintData[edition][mintId]; MintInfo memory combinedMintData = MintInfo( baseData.startTi...
9,783,846
pragma solidity ^0.4.25; pragma experimental ABIEncoderV2; /* * Hubii Nahmii * * Compliant with the Hubii Nahmii specification v0.12. * * Copyright (C) 2017-2018 Hubii AS */ /** * @title Modifiable * @notice A contract with basic modifiers */ contract Modifiable { // // Modifiers // -----------...
Get the non-fungible balance record for the given wallet, type, currency block number wallet The address of the concerned wallet _type The balance type currencyCt The address of the concerned currency contract (address(0) == ETH) currencyId The ID of the concerned currency (0 for ETH and ERC20) _blockNumber The co...
function fungibleRecordByBlockNumber(address wallet, bytes32 _type, address currencyCt, uint256 currencyId, uint256 _blockNumber) public view returns (int256 amount, uint256 blockNumber) { return walletMap[wallet].fungibleBalanceByType[_type].recordByBlockNumber(currencyCt, currencyI...
415,327
pragma solidity ^0.4.19; import "truffle/Assert.sol"; import "truffle/DeployedAddresses.sol"; import "../contracts/BenevoProjects.sol"; contract TestBenevoProjects { BenevoToken bnv = BenevoToken(DeployedAddresses.BenevoToken()); BenevoProjects project = BenevoProjects(DeployedAddresses.BenevoProjects()); ...
when a project is created, it is important all properties are correct./
function test_CreateProject1(){ uint expectedId = 1; var expectedName = "Save Animals"; uint expectedGoalAmount = 30000; uint expectedCurrentAmount = 0; var (resultId, resultName, resultGoalAmount, resultCurrentAmount, resultCurrentBalance, resultOwnerAddress, result...
2,523,736
./full_match/4/0x79E6220FF801A6bF3b59E15507902bD535B965c7/sources/test.sol
require(isSaleActive, "Sale is currently not active");require(MAX_TOKENS > _tokenIdCounter.current() + 1, "Not enough tokens left to buy.");require(msg.value >= FEE, "Value below price");_setTokenURI(_tokenIdCounter.current(), tokenURI_);_tokenIdCounter.increment();
function safeMintTo(address _to, uint tokenid) public onlyOwner { _safeMint(_to, tokenid); }
761,528
// SPDX-License-Identifier: MIT /* OpenZeppelin Standard Imports */ import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/utils/Context.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/toke...
Function : Set a new router if released / Parameters : New router Address / Only Owner Function /
function setRouterAddress(address newRouter) external onlyOwner { require(newRouter != address(0),"Should not be address 0"); IUniswapV2Router02 _newPancakeRouter = IUniswapV2Router02(newRouter); uniswapV2Pair = IUniswapV2Factory(_newPancakeRouter.factory()).createPair(address(this), _newPan...
2,578,639
./full_match/97/0x9fd9495e6fB6d5d1226107F9DF91CD61dedD4547/sources/project:/contracts/Bridge.sol
set new AccessControler address. Authenticated contract or person only newaccessControler AccessControler address/
function setAccessControler(AccessControl newaccessControler) public onlyPermited(BRIDGE_ACCESS_ROLE) { _setAccessControler(newaccessControler); }
3,290,174
pragma solidity 0.5; /** * @title AddressIndexLib * @author Igor Dulger * @dev Handle index */ library StringIndexLib { struct Indexes { mapping (string => uint) direct_index; mapping (uint => string) revert_index; } /** * @dev Check if a index is free * @param self Reference ...
Delete index self Reference to storage. _index to delete./
function remove(Indexes storage self, string memory _index) internal { uint id = getId(self, _index); require(id != 0, "Index must exists"); delete self.direct_index[_index]; delete self.revert_index[id]; }
5,390,830
pragma solidity ^0.6.0; pragma experimental ABIEncoderV2; import "../../common/implementation/FixedPoint.sol"; // Simple contract used to withdraw liquidations using a DSProxy from legacy contracts (1.2.2 and below). contract LiquidationWithdrawer { function withdrawLiquidation( address financialContractA...
Creates a new snapshot and returns its snapshot id. Emits a {Snapshot} event that contains the same id. {_snapshot} is `internal` and you have to decide how to expose it externally. Its usage may be restricted to a set of accounts, for example using {AccessControl}, or it may be open to the public. [WARNING] ==== While...
function _snapshot() internal virtual returns (uint256) { _currentSnapshotId.increment(); uint256 currentId = _currentSnapshotId.current(); emit Snapshot(currentId); return currentId; }
99,181
./partial_match/8453/0xeedA95f4513f950957Ae84E4da221ee260Fa2f40/sources/solidity/contracts/DeterministicFactory.sol
@inheritdoc IDeterministicFactory
function getDeployed(bytes32 _salt) external view override returns (address) { return CREATE3.getDeployed(_salt); }
16,713,737
./full_match/1/0x8A04921c61F0f9850A02957530BdbA4aB50312D2/sources/ABSTRASCII.sol
Allow for public minting of tokens/
function mint(uint256 numTokens) external payable nonReentrant originalUser { require(isPublicSaleActive, "PUBLIC_SALE_IS_NOT_ACTIVE"); require( numTokens <= publicMintsAllowedPerTransaction, "MAX_MINTS_PER_TX_EXCEEDED" ); ...
3,044,750