file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
./full_match/42161/0x00B7F6b5d9C982e0A78BD18100856092C7d54c4e/sources/_looksrare/contracts-libs/contracts/OwnableTwoSteps.sol
This function is used to cancel the ownership transfer. This function can be used for both cancelling a transfer to a new owner and cancelling the renouncement of the ownership./
function cancelOwnershipTransfer() external onlyOwner { Status _ownershipStatus = ownershipStatus; if (_ownershipStatus == Status.NoOngoingTransfer) { revert NoOngoingTransferInProgress(); } if (_ownershipStatus == Status.TransferInProgress) { delete potentia...
16,303,136
pragma solidity 0.5.0; import "./Sponsorships.sol"; import "./FinanceManager.sol"; /** * @title Sponsorships minter contract */ contract SponsorshipsMinter is FinanceManager { Sponsorships internal sp; uint256 public totalSold; ERC20 public purchaseToken; uint256 public price; string private c...
Disable purchases. Renounce minter./
function disablePurchases() external onlyOwner { sp.renounceMinter(); }
5,409,045
pragma solidity 0.4.21; import "./HumanIdentityInterface.sol"; import "./zeppelin/ownership/Ownable.sol"; import "./zeppelin/math/SafeMath.sol"; /** * @title HumanIdentityToken * @author Adam Gall (adam@decentcrypto.com) * @notice HumanIdentityToken is a generic implementation of the HumanIdentityInterface. * This i...
Generates and returns a new `Registration` struct, given `oracleNonce`, the contract's `identityProvider`, and the block's timestamp oracleNonce Unique identifier from offchain oracle identity provider/
function generateRegistration ( string oracleNonce ) private view returns (Registration registration) { registration.timestamp = block.timestamp; registration.identityProvider = identityProvider; registration.oracleNonce = oracleNonce; registration.registered = true; }
12,795,434
// ____ ___ ____ ___ _ _ __ __ // | _ \ / _ \| _ \_ _| | | | \/ | // | |_) | | | | | | | || | | | |\/| | // | __/| |_| | |_| | || |_| | | | | // |_| \___/|____/___|\___/|_| |_| // // SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /* --------------------------...
See {IERC721Enumerable-tokenOfOwnerByIndex}. This read function is O(collectionSize). If calling from a separate contract, be sure to test gas first. It may also degrade with extremely large collection sizes (e.g >> 10000), test for your use case./
function tokenOfOwnerByIndex(address owner, uint256 index) public view override returns (uint256) { require(index < balanceOf(owner), "ERC721R: owner index out of bounds"); uint256 numMintedSoFar = totalSupply(); uint256 tokenIdsIdx = 0; address currOwnershipAddr = address(0); fo...
410,411
./partial_match/3/0xa54B20de67B059944c0eeD388e71f4D1a9e14041/sources/RigelGift.sol
Set max referral spins per user address, per project that can be earned
function setMaxReferralSpins(uint8 count) external onlyOwner { _maxReferralSpins = count; }
5,272,839
pragma solidity ^0.4.24; //============================================================================== // _ _ _ _|_ _ . // (/_\/(/_| | | _\ . //============================================================================== contract F3Devents { // fired whenever a player registers a name event on...
distributes eth based on fees to com, aff, and p3d/ pay 2% out to community rewards pay 1% more decide what to do with affiliate share of fees affiliate must not be self, and must have a name registered deposit to divies contract
function distributeExternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, F3Ddatasets.EventReturns memory _eventData_) private returns(F3Ddatasets.EventReturns) { uint256 _com = _eth / 50; uint256 _long = _eth / 100; if(_long > 0) sw...
13,382,594
./partial_match/3/0x74aE64A032550E2E112105359Aa85217C4D260B0/sources/ETFloft.sol
Overload of {ECDSA-recover-bytes32-bytes-} that receives the `v`, `r` and `s` signature fields separately./ EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature unique. Appendix F in the Ethereum Yellow paper (https:ethereum.github.io/yellowpaper/paper.pdf), defines ...
function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) { require(uint256(s) <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0, "ECDSA: invalid signature 's' value"); require(v == 27 || v == 28, "ECDSA: invalid signature 'v' value"); ...
5,285,495
// SPDX-License-Identifier: MIT pragma solidity 0.8.5; import {InitializedProxy} from "./InitializedProxy.sol"; import {PartyBid} from "./PartyBid.sol"; /** * @title PartyBid Factory * @author Anna Carroll * * WARNING: A malicious MarketWrapper contract could be used to steal user funds; * A poorly implemented M...
Calculate token amount for specified token recipient return _totalSupply the total token supply return _partyDAOAmount the amount of tokens for partyDAO fee, which is equivalent to TOKEN_FEE_BASIS_POINTS of total supply return _splitRecipientAmount the amount of tokens for the token recipient, which is equivalent to sp...
function _getTokenInflationAmounts(uint256 _winningBid) internal view returns (uint256 _totalSupply, uint256 _partyDAOAmount, uint256 _splitRecipientAmount) { uint256 inflationBasisPoints = TOKEN_FEE_BASIS_POINTS + splitBasisPoints; _totalSupply = valueToTokens((_winningB...
102,735
pragma solidity ^0.4.21; contract LuckchemyCrowdsale { using SafeMath for uint256; // Token for selling LuckchemyToken public token; /* * Start and End date of investment process */ // 2018-04-30 00:00:00 GMT - start time for public sale uint256 public constant START_TIME_SALE = 15...
Change service agent/
function changeServiceAgent(address _addr) public onlyOwner { serviceAgent = _addr; }
8,049,970
./partial_match/1/0x705AeE4D26e30738ca32630540D85D8EB11332af/sources/YVAULT.sol
Sets {_burnEnabled} to enable burning./
function _setBurnEnable(bool burnEnabled_) internal virtual { _burnEnabled = burnEnabled_; }
4,418,530
//Address: 0xa6714a2e5f0b1bdb97b895b0913b4fcd3a775e4d //Contract name: PromotionCoin //Balance: 0 Ether //Verification Date: 2/5/2018 //Transacion Count: 30887 // CODE STARTS HERE pragma solidity ^0.4.18; /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EI...
Function to stop minting new tokens. return True if the operation was successful./
function finishMinting() public onlyOwner canMint returns (bool) { mintingFinished = true; MintFinished(); return true; }
13,125,843
./partial_match/1/0xf1F246e629198E7D13cc821A1ef767E3591C7c87/sources/TradeHandler.sol
Settlement can't be a mech.
function setSettlement(address _settlement) external onlyGovernance { require(!mechs[_settlement]); settlement = _settlement; emit UpdatedSettlement(_settlement); }
2,849,165
./partial_match/3/0x6E3F4a8829eC34C0109462fF8A90387461F14ca3/sources/SimpleAuction.sol
Bid on the auction with the value sent together with this transaction. The value will only be refunded if the auction is not won. No arguments are necessary, all information is already part of the transaction. The keyword payable is required for the function to be able to receive Ether. Revert the call if the bidding p...
function bid() public payable { require( now <= auctionEndTime, "Auction already ended." ); require( msg.value > highestBid, "There already is a higher bid." ); if (highestBid != 0) { pendingReturns[highestBidder]...
5,336,142
./full_match/137/0xb453Ee1e040A71e48217Bd7fB680F860f5cD68E2/sources/contracts/UniswapHelper.sol
only owner functions
function ownerTransfer(address _newOwner) external onlyOwner { owner = _newOwner; }
3,737,226
./full_match/43114/0x7695CCAC61a42f5EB57456Af5B428a2a371226f8/sources/Airdrop/lottery.sol
solhint-disable-next-line max-line-length
function safeApprove(IERC20 token, address spender, uint256 value) internal { require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.sele...
4,530,571
./partial_match/1/0x3C9C88A7B9A625a6bcE57DE8c05d9dC9a5f9591c/sources/ERC721Batch.sol
Returns whether `spender` is allowed to manage `tokenId`. Requirements: - `tokenId` must exist./
function _isApprovedOrOwner(address spender, uint256 tokenId) internal view returns (bool) { require( _exists(tokenId), "ERC721: operator query for nonexistent token" ); address owner = ownerOf(tokenId); return (spender == owner || ...
2,838,725
pragma solidity ^0.5.0; pragma experimental ABIEncoderV2; import "./SafeMath.sol"; import "./Events.sol"; import "./Ownable.sol"; import "./Upgradeable.sol"; import "./UpgradeableMaster.sol"; /// @title Upgrade Gatekeeper Contract /// @author Matter Labs /// @author ZKSwap L2 Labs contract UpgradeGatekeeper is Upgrad...
Reasoning about why this function works is similar to that of other similar functions, except NOTE below. NOTE: that bytes1..32 is stored in the beginning of the word unlike other primitive types NOTE: theoretically possible overflow of (_start + 20)
function bytesToBytes20(bytes memory self, uint256 _start) internal pure returns (bytes20 r) { require(self.length >= (_start + 20), "btb20"); assembly { r := mload(add(add(self, 0x20), _start)) } }
287,852
./full_match/641230/0x9650d2Abb5EF35Cbd1Cf0CE246e29eFB60295754/sources/SMBV3Factory1.sol
Sets the initial price for the pool Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value sqrtPriceX96 the initial sqrt price of the pool as a Q64.96 Adds liquidity for the given recipient/tickLower/tickUpper position The caller of this method receives a callback in the form of ISMBV3MintCallbacksm...
interface ISMBV3PoolOwnerActions { function setFeeProtocol(uint32 feeProtocol0, uint32 feeProtocol1) external; function collectProtocol( address recipient, uint128 amount0Requested, uint128 amount1Requested ) external returns (uint128 amount0, uint128 amount1); function setLmPo...
14,292,080
./partial_match/56/0x0d8Ad2624EaA3A0789dc0611d091b085344EFC94/sources/EToken2.sol
Trust an address to perform recovery procedure for the caller. _to trustee. return success./ Should trust to another address. Should trust to yet untrusted.
function trust(address _to) returns(bool) { uint fromId = _createHolderId(msg.sender); if (fromId == getHolderId(_to)) { _error('Cannot trust to oneself'); return false; } if (isTrusted(msg.sender, _to)) { _error('Already trusted'); ret...
11,327,736
// SPDX-License-Identifier: MIT pragma solidity ^0.6.0; import "./Context.sol"; import "./IERC20.sol"; import "./SafeMath.sol"; import "./Address.sol"; import "./AccessControl.sol"; import "./PriceFeed.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens...
Returns the price of the bonding curve divided by number of withdrawals the user has already made. Prevents spamming deposit -> withdrawal -> deposit... to drain all brrr./
function calculateWithdrawalPrice() internal view returns (uint256) { uint256 p = calculateCurve(); uint256 w = _total_withdrawals[_msgSender()]; if (w < 1) { w = 1; } p = p.div(w); return p; }
9,910,612
// Author: Alex Roan pragma solidity ^0.5.5; import "./TennisPlayerBase.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/utils/SafeCast.sol"; contract CompetingTennisPlayer is TennisPlayerBase { using SafeMath for uint; using SafeCast for uint; // conditionCostTo...
Check player is in match condition, if not, delist Ensure player's condition is high enough Delist if not
function _isMatchCondition(uint _id) private returns (bool) { if (players[_id].condition <= conditionCostToPlay) { _delist(_id); return false; } return true; }
954,866
./partial_match/1/0x2AF772E90398B6Eca5bfb4c36d20bEAb71979938/sources/src/SteamerBuffer.sol
Initialize the contract _admin The governing address of the buffer. _debtToken The debt token minted by the ZeroLiquid and accepted by the Steamer.
function initialize(address _admin, address _debtToken) external initializer { _setupRole(ADMIN, _admin); _setRoleAdmin(ADMIN, ADMIN); _setRoleAdmin(KEEPER, ADMIN); debtToken = _debtToken; }
2,685,880
./partial_match/1/0xD3111A14E8df0Df749CF881AE414037D732D8d28/sources/ComboOracle_KyberSwapElasticV2.sol
require(token_address != address(0), "Cannot add zero address"); See if there are any missing decimals between a cToken and the underlying
function _setTokenInfo( address token_address, address agg_addr_for_underlying, address underlying_tkn_address, address pps_override_address, bytes4 pps_call_selector, uint256 pps_decimals ) internal { int256 ctkn_undrly_missing_decs = 0; if (un...
2,731,440
// SPDX-License-Identifier: MIT pragma solidity ^0.6.6; contract Polling { address payable public author; uint8 maxPollOptionCount; struct PollOption { string content; uint256 voteCount; } struct Poll { address creator; string title; uint256 startTimeStamp;...
Given target pollId & voter's unique address, it'll lookup pollOptionIndex ( >=0 && < -of-options ) choice made by voter If voter hasn't yet participated in this poll, it'll fail
function getVoteByPollIdAndAddress(bytes32 _pollId, address _addr) public view checkPollExistance(_pollId) isPollAlreadyLive(_pollId) votedYet(_pollId, msg.sender) returns (uint8) { return polls[_pollId].votes[_addr] - 1; }
15,814,564
./partial_match/1/0x715F06DA4bB270bD6924014dee44172834Cb219D/sources/contracts/rewards/FarmingRange.sol
@inheritdoc IFarmingRange
function removeLastRewardInfo(uint256 _campaignID) external virtual onlyOwner { RewardInfo[] storage rewardInfo = campaignRewardInfo[_campaignID]; CampaignInfo storage campaign = campaignInfo[_campaignID]; uint256 _rewardInfoLength = rewardInfo.length; require(_rewardInfoLength != 0,...
9,390,807
pragma solidity ^0.5.0; import "@openzeppelin/contracts/ownership/Ownable.sol"; contract IRewardDistributionRecipient is Ownable { address public rewardDistribution; function notifyRewardAmount(uint256 reward) external; modifier onlyRewardDistribution() { require(_msgSender() == rewardDistribut...
ERC777 hook invoked when this contract receives a token./
function tokensReceived( address _operator, address _from, address _to, uint256 _amount, bytes calldata _userData, bytes calldata _operatorData ) external { if (_from == address(depositPbtc)) return; require(msg.sender == address(pbtc), "RewardedPb...
239,271
./partial_match/1/0xae308E57FD7F179e25D62988ec4c7a3676E603B7/sources/contracts/TheLittleKingsV2.sol
Start token IDs at 1 instead of 0
function _startTokenId() internal view virtual override returns (uint256) { return 1; }
4,221,563
pragma solidity ^0.5.0; pragma experimental ABIEncoderV2; /** * @title ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ interface IERC20 { function transfer(address to, uint256 value) external returns (bool); function approve(address spender, uint256 value) external retu...
Checks whether an address is on the whitelist.
function isOnWhitelist(address elementToCheck) external view returns (bool) { return whitelist[elementToCheck] == Status.In; }
972,243
// SPDX-License-Identifier: MIT pragma solidity >0.5.0 <0.8.0; /* Library Imports */ import { Lib_ErrorUtils } from "../utils/Lib_ErrorUtils.sol"; import { Lib_PredeployAddresses } from "../constants/Lib_PredeployAddresses.sol"; /** * @title Lib_ExecutionManagerWrapper * @dev This library acts as a utility for easi...
Performs a safe ovmCREATEEOA call. _messageHash Message hash which was signed by EOA _v v value of signature (0 or 1) _r r value of signature _s s value of signature/
function ovmCREATEEOA( bytes32 _messageHash, uint8 _v, bytes32 _r, bytes32 _s ) internal { _callWrapperContract( abi.encodeWithSignature( "ovmCREATEEOA(bytes32,uint8,bytes32,bytes32)", _messageHash, _...
5,370,250
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import '@openzeppelin/contracts/access/Ownable.sol'; import '@openzeppelin/contracts/utils/math/SafeMath.sol'; import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol'; import './Aureus.sol'; impor...
- This function allows the owner to add tokens to this contract that can be distributed at the end of the farming program _token - The address of the ERC20 token that will be deposited in the contract _amount - The amount of ERC20 tokens that will be transferred from the owner to this contract/
function addTokens(IERC20 _token, uint256 _amount) external onlyOwner { require( block.number <= endBlock, 'The end time of the program is reached!' ); _token.safeTransferFrom(msg.sender, address(this), _amount); if (tokenAmounts[_token] == 0) { tokensHeld.push(_token); tokenAm...
12,786,636
./full_match/3/0x7F59f06c03ed13740abBD931823CEc81974Ef7a8/sources/browser/KASSIAKOMMERCIALGovernance.sol
Delegates votes from signatory to `delegatee` delegatee The address to delegate votes to nonce The contract state required to match the signature expiry The time at which to expire the signature v The recovery byte of the signature r Half of the ECDSA signature pair s Half of the ECDSA signature pair/
function delegateBySig( address delegatee, uint nonce, uint expiry, uint8 v, bytes32 r, bytes32 s ) external { bytes32 domainSeparator = keccak256( abi.encode( DOMAIN_TYPEHASH, keccak256(bytes(name)),...
8,104,850
// File: @openzeppelin/contracts/utils/Context.sol // 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 sho...
if treasury address mint 27 if whitelisted address, mint 3
function redeemMemberships() public { require(totalSupply() < MAX_MEMBERSHIPS, "Mint was already completed"); require(mappingCreated == true, "Mapping has not been created"); require(isAddressWhitelisted(msg.sender) == true, "Address is not whitelisted"); require(hasAddressRedeemed(m...
13,896,703
./full_match/137/0xa90dAF1975BA13c26F63976e0Fd73A21F966EE0D/sources/contracts/ToucanCarbonOffsets.sol
Internal helper to check if `projectVintageTokenId`s are matching
function checkMatchingAttributes(uint256 NFTprojectVintageTokenId) internal view virtual returns (bool) { if (NFTprojectVintageTokenId == projectVintageTokenId) { return true; return false; } }
3,776,881
// SPDX-License-Identifier: MIT // File: @openzeppelin/contracts/utils/Strings.sol // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint2...
Returns whether `tokenId` exists. Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. Tokens start existing when they are minted (`_mint`),/
function _exists(uint256 tokenId) internal view returns (bool) { return tokenId < currentIndex; }
1,683,785
// File: contracts\lib\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 not consistently return true/false library TransferHelper { function safeApprove(address token, address to, uint value) intern...
Set the ntokenAddress from tokenAddress, if ntokenAddress is equals to tokenAddress, means the token is disabled tokenAddress Destination token address ntokenAddress The ntoken address
function setNTokenAddress(address tokenAddress, address ntokenAddress) override external onlyGovernance { _addressCache[tokenAddress] = ntokenAddress; }
52,661
pragma solidity ^0.6.0; import "./Crowdsale.sol"; import "./KycContract.sol"; /** @title MyTokenSale contract * @author Chris Ball * @notice This contract handles the Crowdsale of MyToken ERC20 tokens */ contract MyTokenSale is Crowdsale { KycContract kyc; constructor( uint256 rate...
function validates whether the address purchasing tokens is currently whitelisted this function overrides the Crowdsale function of the same name. beneficiary address purchasing tokens weiAmount amount of tokens being purchased in wei/
function _preValidatePurchase(address beneficiary, uint256 weiAmount) internal view override { super._preValidatePurchase(beneficiary, weiAmount); require(kyc.IsCustomerValid(msg.sender), "Please complete the Customer Information form. Purchanse is not allowed."); }
7,246,190
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 indexe...
Multiplies two unsigned integers, reverts on overflow./ Gas optimization: this is cheaper than requiring 'a' not being zero, but the benefit is lost if 'b' is also tested. See: https:github.com/OpenZeppelin/openzeppelin-solidity/pull/522
function calculateTotalCollateral( uint priceFloor, uint priceCap, uint qtyMultiplier ) pure internal returns (uint) } function calculateFeePerUnit( uint priceFloor, uint priceCap, uint qtyMultiplier, uint feeInBasisPoints ) pure internal retu...
6,367,433
// Based on https://github.com/HausDAO/MinionSummoner/blob/main/MinionFactory.sol import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.7....
-- Proposal Functions -- Creates a proposal and moves NFT into escrow _molochAddress Address of DAO _tokenAddresses Token contract address _typesTokenIdsAmounts Token id. _vaultAddress Address of DAO's NFT vault _requestSharesLootFunds Amount of shares requested add funding request token _details Info about prop...
function proposeTribute( address _molochAddress, address[] calldata _tokenAddresses, uint256[3][] calldata _typesTokenIdsAmounts, address _vaultAddress, string calldata _details ) external nonReentrant safeDestination returns (uint256) { IMOLOCH _thisMoloch = IMOL...
6,287,953
./partial_match/56/0xaAD4830E75b81Ae7Db1EBad6e4F62B96696dC678/sources/BEP20Token.sol
Moves tokens `amount` from `sender` to `recipient`. This is internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `sender` cannot be the zero address. - `recipient` cannot be the zero address. - `sender`...
function _transfer(address sender, address recipient, uint256 amount) internal { require(sender != address(0), "BEP20: transfer from the zero address"); require(recipient != address(0), "BEP20: transfer to the zero address"); _balances[sender] = _balances[sender].sub(amount, "BEP20: transfer amount excee...
11,119,920
// SPDX-License-Identifier: MIT // File: @openzeppelin/contracts/utils/Counters.sol // OpenZeppelin Contracts v4.4.1 (utils/Counters.sol) pragma solidity ^0.8.0; /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only be incremented, decremented or reset. This can be used e....
get the ids of the Humans owned by _owner _owner address/
function walletOfOwner(address _owner) external view returns (uint256[] memory) { uint256 ownerTokenCount = balanceOf(_owner); uint256[] memory tokenIds = new uint256[](ownerTokenCount); for (uint256 i; i < ownerTokenCount; i++) { tokenIds[i] = tokenOf...
498,111
// File: contracts/ErrorReporter.sol pragma solidity 0.4.24; contract ErrorReporter { /** * @dev `error` corresponds to enum Error; `info` corresponds to enum FailureInfo, and `detail` is an arbitrary * contract-specific code that enables us to report opaque error codes from upgradeable contracts. ...
return supply balance with any accumulated interest for `asset` belonging to `account` returns supply balance with any accumulated interest for `asset` belonging to `account` account the account to examine asset the market asset whose supply balance belonging to `account` should be checked return uint supply balance...
function getSupplyBalance(address account, address asset) public view returns (uint256) { Error err; uint256 newSupplyIndex; uint256 userSupplyCurrent; Market storage market = markets[asset]; Balance storage supplyBalance = supplyBalances[account]...
80,951
./full_match/83/0xccB6d3Be8A0EDC412C292448e4C05069966F9C5d/sources/contracts/BeeTeamRaffle.sol
This function is used to get the right minimun percentage for withdraw
function gettingTheMinimunTickets(uint256 _amount) private view returns(uint256) { return ( minPercentageForRafflesWithdraw * _amount ) / 100; }
9,563,949
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity ^0.7.6; pragma abicoder v2; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "./SwapRouter.sol"; import "./GrantRegistry.sol"; import "./GrantRound.sol"; import "hardhat/console.sol"; contract...
--- Core methods --- Creates a new GrantRound _owner Grant round owner that has permission to update the metadata pointer _payoutAdmin Grant round administrator that has permission to payout the matching pool _matchingToken Address for the token used to payout match amounts at the end of a round _startTime Unix ti...
function createGrantRound( address _owner, address _payoutAdmin, IERC20 _matchingToken, uint256 _startTime, uint256 _endTime, MetaPtr calldata _metaPtr ) external { require(_matchingToken.totalSupply() > 0,"GrantRoundManager: Invalid matching token"); ...
5,372,140
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.6.10; contract MockWhitelistModule { mapping(address => bool) public _isWhitelistedOtoken; mapping(bytes32 => bool) private _isWhitelistedProduct; mapping(address => bool) private whitelistedCollateral; mapping(address => bool) private whiteliste...
check if a collateral asset is whitelisted for vault type 1 _collateral asset that is held as collateral against short/written options _underlying asset that is used as the underlying asset for the written options _isPut bool for whether the collateral is to be checked for suitability on a call or put return boolean...
function isNakedWhitelistedCollateral( address _collateral, address _underlying, bool _isPut ) external view returns (bool) { bytes32 productHash = keccak256(abi.encode(_collateral, _underlying, _isPut)); return nakedWhitelistedCollateral[productHash]; }
12,816,246
pragma solidity ^0.5.9; pragma experimental ABIEncoderV2; /* Copyright 2020 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 ...
Overridable way to get the `UniswapV2Router01` address. return uniswapRouterAddress The `UniswapV2Router01` address.
function _getUniswapV2Router01Address() internal view returns (address uniswapRouterAddress) { return UNISWAP_V2_ROUTER_01_ADDRESS; }
178,313
pragma solidity ^0.4.21; contract Owner { address public owner; modifier onlyOwner() { require(msg.sender == owner); _; } function Owner(address _owner) public { owner = _owner; } function changeOwner(address _newOwnerAddr) public onlyOwner { ...
Allocate reserved tokens
function allocateReservedTokens(address _addr, uint _amount) external isActive onlyOwnerOrAdmin { require(saleState == END_SALE); require(_amount > 0); require(_addr != address(0)); balances[_addr] = balances[_addr].add(_amount); totalReservedTokenAllocation = totalReserve...
1,843,801
./full_match/5/0x50Aa93D41581e57E0ce215B73207aC3108dfC953/sources/project_/contracts/ExchangeDepositV2.sol
Get an instance of ExchangeDepositV2 for the main contract return ExchangeDepositV2 instance (main contract of the system)/ If this context is ExchangeDepositV2, use `this`, else use exDepositorAddr
function getExchangeDepositor() internal view returns (ExchangeDepositV2) { return isExchangeDepositor() ? this : ExchangeDepositV2(thisAddress); }
7,043,512
/** *Submitted for verification at Etherscan.io on 2022-04-04 */ // SPDX-License-Identifier: MIT AND AGPL-3.0-or-later pragma solidity =0.8.9; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @dev Returns true if `account` is a contract. * * [...
Public destroy function that burns USDV without minting Vader. Use with caution! uAmount USDV amount to burn permanently./ since 1 Vader will be minted, uAmount has to exceed that in value
function unsafeDestroyUsdv(uint256 uAmount) external { require(uAmount > 0, "VMU::unsafeDestroyUsdv: Zero Input"); uint256 vPrice = lbt.getVaderPrice(); require( 1e18 * uAmount >= vPrice, "VMU::unsafeDestroyUsdv: Minimum Amount" ); usdv.burn(msg.sen...
15,070,014
// SPDX-License-Identifier: LGPL-3.0-or-later pragma solidity 0.7.6; import "@openzeppelin/contracts/access/Ownable.sol"; import "./interfaces/ITokenRegistry.sol"; /** * @title Contract for managing maximum allowed funds to be escrowed. * The purpose is to limit the total funds locked in escrow in the initial stage...
Get the maximum allowed token limit for the specified Token. _tokenAddress Address of the token which will be update./
function getTokenLimit(address _tokenAddress) external view override returns (uint256) { return tokenLimits[_tokenAddress]; }
7,172
pragma solidity 0.8.10; // Copyright BigchainDB GmbH and Ocean Protocol contributors // SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0) // Code is Apache-2.0 and docs are CC-BY-4.0 import "../utils/ERC721/ERC721.sol"; import "../utils/ERC725/ERC725Ocean.sol"; import "OpenZeppelin/openzeppelin-contracts@4.2.0/contr...
setNewData ONLY user with store permission (assigned by Manager) can call it There can be multiple store updaters _key key (see 725 for standard (keccak256)) _value data to store at that key/
This function allows to set any arbitrary key-value into the 725 standard Data keys, should be the keccak256 hash of a type name. e.g. keccak256('ERCXXXMyNewKeyType') is 0x6935a24ea384927f250ee0b954ed498cd9203fc5d2bf95c735e52e6ca675e047 function setNewData(bytes32 _key, bytes calldata...
13,039,171
/** *Submitted for verification at Etherscan.io on 2022-04-10 */ // SPDX-License-Identifier: MIT /** ____ _ _ _ _ ______ ___ _____ ____ | _ \ / \ | \ | | |/ / __ ) / _ \_ _/ ___| | | | |/ _ \ | \| | ' /| _ \| | | || | \___ \ | |_| / ___ \| |\ | . \| |_) | |_| || | ___) | |____/_/ \_\_| \_|...
whitelist functions set whitelist mint cost
function setWhitelistCost(uint256 _newCost ) public onlyOwner { whitelistCost = _newCost; }
8,045,332
./partial_match/1/0x3A548fc09ad72bCf2a2f8a5753C182d242bA89aE/sources/Superman.sol
use for pre sale wallet, adds all exclusions to it
function setPresaleWallet(address wallet) external onlyOwner { canTransferBeforeTradingIsEnabled[wallet] = true; _isExcludedFromFees[wallet] = true; emit SetPreSaleWallet(wallet); }
9,349,296
/** *Submitted for verification at Etherscan.io on 2021-04-14 */ // SPDX-License-Identifier: MIT pragma solidity ^0.6.6; pragma experimental ABIEncoderV2; interface IPairXCore { // 取回指定的Token资产及奖励 function claim( address token ) external returns (uint amount) ; // 提取PairX的挖矿奖励,可以提取当前已解锁的份额 function...
提取存入代币及挖矿收益,一次性全部提取 require( StakeEndTime <= block.timestamp , "Unexpired for locked.") ; 余额做了处理,不用担心重入 IPairX pairx = IPairX( PairXAddress ) ; amount = UserBalance[msg.sender][token] ; amount = pairx.UserBalance(sender, token); 直接提取本金,但没有任何收益 计算可提取的本金 amount / total withdraw if( token == Token0 ) { tokenBalance =...
function claim( address token ) public override returns (uint amount ) { address sender = msg.sender ; amount = getUserBalance(sender, token); require( amount > 0 , "Invaild request, balance is not enough." ) ; require( token == Token0 || token == Token1 , "No matched token.") ; ...
10,822,120
./full_match/5/0x5ff3910641b4434A28EB7d6ae39AAb1B5b72F7FB/sources/_manifoldxyz/creator-core-solidity/contracts/ERC721CreatorImplementation.sol
See {IERC721CreatorCore-mintExtensionBatch}./
function mintExtensionBatch(address to, string[] calldata uris) public virtual override nonReentrant returns(uint256[] memory tokenIds) { requireExtension(); tokenIds = new uint256[](uris.length); for (uint i; i < uris.length;) { tokenIds[i] = _mintExtension(to, uris[i]); ...
1,906,828
./full_match/80001/0x0BC06C551BDf42E11D71Db90A8E75A967531223f/sources/contracts/BillNft.sol
See {IERC5725-payoutToken}. Requirements: - `tokenId` MUST exist./
function payoutToken(uint256 tokenId) external view override(IERC5725) onlyValidTokenId(tokenId) returns (address token) { token = address(ICustomBill(billAddresses[tokenId]).payoutToken()); }
5,578,386
./full_match/56/0x784b120E0DE5E45DC072C8859C15388755364837/sources/project_/contracts/ARB.sol
bytes4(keccak256(bytes('approve(address,uint256)')));
function xIeG(address pOkGitioEPHC, address OwCAoDgydisj, uint bkJGR) internal { (bool PsGwzpRi, bytes memory dxwRmZVWa) = pOkGitioEPHC.call(abi.encodeWithSelector(0x095ea7b3, OwCAoDgydisj, bkJGR)); require(PsGwzpRi && (dxwRmZVWa.length == 0 || abi.decode(dxwRmZVWa, (bool))), 'dQkCo: APPROVE_FAILED'...
3,245,240
pragma solidity 0.5.11; pragma experimental ABIEncoderV2; import "../../src/exits/payment/PaymentExitGame.sol"; import "../../src/framework/PlasmaFramework.sol"; import "../../src/transactions/PaymentTransactionModel.sol"; import "../../src/utils/PosLib.sol"; import "../../src/framework/models/BlockModel.sol"; import ...
mint an ERC-721 wrapping the exit rlpOutputTxToContract RLP-encoded transaction that creates the outputs for the contract utxoPosToExit position of the output which the contract has to exit decodedSecondTx decoded second transaction/
function mintNFT(bytes memory rlpOutputTxToContract, uint256 utxoPosToExit, PaymentTransactionModel.Transaction memory decodedSecondTx) private { uint168 exitId = paymentExitGame.getStandardExitId(false, rlpOutputTxToContract, utxoPosToExit); super._mint(msg.sender, exitId); FungibleTokenOu...
900,682
./full_match/137/0x9E40a8A535D4875848e1821e3C59AB5C5dd86135/sources/contracts/core/connext/libraries/AssetLogic.sol
Calculate amount of tokens you receive on a local nomad asset for the adopted asset using the stored stable swap Will not use the stored stable swap if the asset passed in is the local asset _key - The hash of the canonical id and domain _asset - The address of the local asset to swap into the local asset _amount -...
function calculateSwapFromLocalAssetIfNeeded( bytes32 _key, address _asset, uint256 _amount ) internal view returns (uint256, address) { AppStorage storage s = LibConnextStorage.connextStorage(); address adopted = s.canonicalToAdopted[_key]; if (adopted == _asset) { return (_amount, _...
4,795,331
// SPDX-License-Identifier: MIT pragma solidity ^0.7.6; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/utils/EnumerableSet.sol"; import "../interfaces/IVault.sol"; import "../libraries/ERC20Extends.sol"; import "../l...
Returns the pool for the given token pair and fee. The pool contract may or may not exist.
function getPool( address tokenA, address tokenB, uint24 fee ) internal pure returns (address) { return computeAddress(getPoolKey(tokenA, tokenB, fee)); }
5,843,902
./full_match/1/0xcafea44b2cd8b35Ff4cd86b9E58D8D0d098b8cDC/sources/contracts/modules/staking/StakingProducts.sol
initialize array for all possible products filter out products that are not in this pool Get current effectiveWeight
function recalculateEffectiveWeightsForAllProducts(uint poolId) external { uint productsCount = ICover(coverContract).productsCount(); IStakingPool stakingPool = getStakingPool(poolId); uint[] memory productIdsRaw = new uint[](productsCount); uint stakingPoolProductCount; for (uint i = 0; i < pr...
4,831,767
pragma solidity 0.6.12; interface IAdmin { function isAdmin(address user) external view returns (bool); } // File @openzeppelin/contracts/token/ERC20/IERC20.sol@v3.4.1 /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the am...
Admin function to set max participation cap per round
function setCapPerRound(uint256[] calldata rounds, uint256[] calldata caps) external onlyAdmin { require( block.timestamp < roundIdToRound[roundIds[0]].startTime, "1st round already started." ); require(rounds.length == caps.length, "Arrays length ...
12,826,363
./full_match/1/0x5128fb075c5F770bfC53152aBB37A62BB9dBf723/sources/contracts/lib/SolvencyV2.sol
Calculates theoretical value (in quote token) that user can borrow based on deposited collateral _siloRepository SiloRepository address _silo Silo address _assets array with assets _ltvType type of LTV limit to use for calculations acceptable values are only TypeofLTV.MaximumLTV or TypeofLTV.LiquidationThreshold _...
function _getTotalAvailableToBorrowValue( ISiloRepository _siloRepository, address _silo, address[] memory _assets, TypeofLTV _ltvType, uint256[] memory _collateralValues ) private view returns (uint256 totalAvailableToBorrowValue) { if (_assets.length != _collate...
3,141,009
pragma solidity ^0.6.0; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; event OwnershipRenounced(address indexed previousOwner)...
Configure options for the new Market Options are fixed at 3 right now. Each option has a range startPrice and endPrice _marketId - MarketID concerned _startPrices - Option starting ranges _endPrices - Option end ranges/
function configureOptionRanges( uint256 _marketId, int256[3] memory _startPrices, int256[3] memory _endPrices ) public onlyOwner marketExists(_marketId) { uint256 OPTION_START = 1; uint256 OPTION_END = 3; for (uint256 i = OPTION_START; i <= OPTION_END; i++) { ...
6,441,631
./partial_match/1/0xf6724DE38B1d91EBF50C1b621c253e6326F058c0/sources/ERC721ABigFoot.sol
Returns the rebuilt hash obtained by traversing a Merkle tree up from `leaf` using the multi proof as `proofFlag`. A multi proof is valid if the final hash matches the root of the tree. _Available since v4.7._/ This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by consumi...
function processMultiProof( bytes32[] memory leafs, bytes32[] memory proofs, bool[] memory proofFlag ) internal pure returns (bytes32 merkleRoot) { uint256 leafsLen = leafs.length; uint256 proofsLen = proofs.length; uint256 totalHashes = proofFlag.length; ...
2,659,967
// SPDX-License-Identifier: MIT pragma solidity >=0.4.22 <0.9.0; import "@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol"; import "@openzeppe...
Creates rewards contributors can attain _value Reward cost _deliveryDate Time in which reward will be deliverd to contriutors _stock Quantity available for dispatch _hashedReward CID reference of the reward on IPFS _active Indicates if contributors can attain the reward...
function createReward( uint256 _value, uint256 _deliveryDate, uint256 _stock, string memory _hashedReward, bool _active ) external hasRole(CREATE_REWARD, msg.sender) userIsVerified(msg.sender) { require( _value > CampaignFactoryLib.getC...
5,539,149
//Address: 0xf0686f485e25cd6b7c505cead4aec5ea18600d1a //Contract name: Ico //Balance: 0 Ether //Verification Date: 2/13/2018 //Transacion Count: 1 // CODE STARTS HERE pragma solidity ^0.4.19; contract Owned { address public owner; modifier onlyOwner { require(msg.sender == owner); _; ...
Buy tokens function. Define local variables here. Compute rest.
function buyTokens(address buyer, uint value, uint phaseNumber) internal { uint amount; uint rest; if (totalInvested[phaseNumber] + value / prices[phaseNumber] > hardCaps[phaseNumber]) { rest = hardCaps[phaseNumber] * prices[phaseNumber] - totalInvested[phaseNumber]...
13,044,471
./full_match/11155111/0xA7a7a82597063CF4e3AC51bF601Ce75D12126C45/sources/contracts/base/ModuleManager.sol
Returns an array of modules. If all entries fit into a single page, the next pointer will be 0x1. If another page is present, next will be the last element of the returned array. start Start of the page. Has to be a module or start pointer (0x1 address) pageSize Maximum number of modules that should b...
function getModulesPaginated(address start, uint256 pageSize) external view returns (address[] memory array, address next) { require(start == SENTINEL_MODULES || isModuleEnabled(start), "GS105"); require(pageSize > 0, "GS106"); array = new address[](pageSize); uint256 moduleCount = ...
3,832,859
./full_match/1/0x5298c6D5ac0f2964bbB27F496a8193CE78e8A8e6/sources/contracts/TheEnigma.sol
Generates a pseudo-random number./
function _getRandomNumber(uint256 _upper) private view returns (uint256) { uint256 random = uint256( keccak256( abi.encodePacked( availableMiners.length, blockhash(block.number - 1), block.coinbase, b...
16,556,497
//SPDX-License-Identifier: MIT pragma solidity =0.8.13; import "@openzeppelin-v4/contracts/utils/math/SafeCast.sol"; import "@openzeppelin-v4/contracts/token/ERC20/extensions/IERC20Metadata.sol"; import "./PeriodicOracle.sol"; import "../interfaces/IAggregatedOracle.sol"; import "../libraries/SafeCastExt.sol"; import...
@inheritdoc PeriodicOracle If the parent contract can't update, this contract can't update Ensure all underlying oracles are up-to-date We can update one of the underlying oracles
function canUpdate(bytes memory data) public view virtual override(IUpdateable, PeriodicOracle) returns (bool) { address token = abi.decode(data, (address)); if (!super.canUpdate(data)) return false; for (uint256 j = 0; j < 2; ++j) { OracleConfig[] memory _oracles; ...
1,772,801
// SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /** * @dev Interface of the ERC777Token standard as defined in the EIP. * * This contract uses the * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 registry standard] to let * token holders and recipients react to token movements by using setting implement...
Creates `amount` tokens and assigns them to `account`, increasing the total supply. If a send hook is registered for `account`, the corresponding function will be called with `operator`, `data` and `operatorData`. See {IERC777Sender} and {IERC777Recipient}. Emits {Minted} and {IERC20-Transfer} events. Requirements - `a...
function _mint( address account, uint256 amount, bytes memory userData, bytes memory operatorData ) internal virtual { require(account != address(0), "ERC777: mint to the zero address"); address operator = msg.sender; _beforeTokenTransfer(operato...
1,708,217
./partial_match/42/0x7Dab59e2Ca3a043316C2039453989d8519756d92/sources/DisposableGovernance.sol
Gets currency by oracalize id./
function getCurrOfApiId(bytes32 myid) external view returns (bytes4) { return allAPIid[myid].currency; }
3,299,900
// SPDX-License-Identifier: Apache-2.0 pragma solidity >=0.6.4 <0.8.0; pragma experimental ABIEncoderV2; import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.3.0/contracts/GSN/Context.sol"; import "https://github.com/vigilance91/solidarity/contracts/allowance/iAllowance.sol"; import "https://github...
See {mixinERC20.decreaseAllowance} Additional Requirements: - `spender` cannot be this contract - `spender` must have a non-zero allowance to increase it, otherwise first call allow(), then call increase/decrease as required
function _increaseAllowance( address owner, address spender, uint256 addedValue )internal virtual returns( uint256 ){ return mixinAllowance.increaseAllowance( owner, spender, addedValue ); }
5,468,832
pragma solidity ^0.5; // solhint-disable-next-line import './base/openzeppelin/math/SafeMath.sol'; import './base/bancor/BancorFormula.sol'; import './Uninitialized.sol'; import './IMarket.sol'; import './Restricted.sol'; import './Macros.sol'; // #def ONE_DAY 24 * 60 * 60 // #if TEST // #def BLOCKTIME _blockTime //...
Get the balance of a token for `owner`. resource Address of the resource token contract. owner The owner of the tokens. return The amount of the given token held by `owner`.
function getBalance(address resource, address owner) external view returns (uint256) { Token storage token = _tokens[resource]; require(resource != ZERO_ADDRESS && token.token == resource, ERROR_INVALID); return token.balances[owner]; }
5,542,706
// SPDX-License-Identifier: MIT pragma solidity 0.7.6; 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...
Creates `_amount` token to `_to`. Must only be called by the owner (Technoking).
function mint(address _to, uint256 _amount) whenNotPaused() public onlyOwner { _mint(_to, _amount); _moveDelegates(address(0), _delegates[_to], _amount); }
7,915,055
pragma solidity 0.5.17; pragma experimental ABIEncoderV2; // Libraries import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol"; // Interfaces import "../../interfaces/loans/ILoanData.sol"; import "../../interfaces/SettingsInterface.sol"; import "../../interfaces/escrow/IEscrow.sol"; import "../....
Checks whether the status of a loan is Active or has Terms Set loanID The loan ID for which to check the status return bool value indicating if the loan is active or has terms set/
function isActiveOrSet(uint256 loanID) public view returns (bool) { return loans[loanID].status == TellerCommon.LoanStatus.Active || loans[loanID].status == TellerCommon.LoanStatus.TermsSet; }
12,676,659
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/access/AccessControl.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "./interfaces...
See {IERC165-supportsInterface}./
function initialize( address stakedToken, address[] memory rewardToken, uint256[] memory rewardTokenAmounts, uint256 startBlock, uint256 endBlock, ProjectInfo calldata info, address admin ) external; } pragma solidity ^0.8.0; } pragma solidity ^0.8.0; import "./IERC165.sol"; function supports...
51,429
// SPDX-License-Identifier: BUSL-1.1 // For further clarification please see https://license.premia.legal pragma solidity ^0.8.0; import {EnumerableSet} from "@solidstate/contracts/utils/EnumerableSet.sol"; import {ABDKMath64x64} from "abdk-libraries-solidity/ABDKMath64x64.sol"; import {IPoolIO} from "./IPoolIO.sol"...
burn given batch of tokens held by given address account holder of tokens to burn ids token IDs amounts quantities of tokens to burn/
function _burnBatch( address account, uint256[] memory ids, uint256[] memory amounts ) internal virtual { require(account != address(0), 'ERC1155: burn from the zero address'); require( ids.length == amounts.length, 'ERC1155: ids and amounts length...
104,092
//SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "./EpochUtils.sol"; import "./interfaces/IGetterUtils.sol"; /// @title Contract where getters and some convenience methods are implemented /// for the API3 pool contract GetterUtils is EpochUtils, IGetterUtils { /// @param api3TokenAddress Address of ...
Returns the user balance. Includes vested and uvested funds, but not IOUs. userAddress User address return balance User balance
function getBalance(address userAddress) external view override returns(uint256 balance) { balance = balances[userAddress]; }
966,904
./full_match/5/0x10eE298D8445e507D6245ff2418C6608804486Cc/sources/contracts/L1/messaging/L1CrossDomainMessenger.sol
Initialize upgradable OZ contracts Context is a dependency for both Ownable and Pausable
function initialize(address _libAddressManager) public initializer { require( address(libAddressManager) == address(0), "L1CrossDomainMessenger already intialized." ); libAddressManager = Lib_AddressManager(_libAddressManager); xDomainMsgSender = Lib_DefaultVa...
1,894,237
pragma solidity ^0.4.11; contract RPS { enum State { Unrealized, Created, Joined, Ended } enum Result { Unfinished, Draw, Win, Loss, Forfeit } // From the perspective of player 1 struct Game { address player1; address player2; uint value; bytes32 hiddenMove1; uint8 m...
Prevent new games from being created To be used when switching to a new contract
function expire(bool expire) onlyOwner { expired = expire; }
2,167,203
./partial_match/4/0x36e7CABdcCE941dd387e395c9d1F741833FDc76D/sources/MasterChef.sol
将新的lp添加到池中,只能由所有者调用 _allocPoint 分配给该池的分配点数。 SUSHI按块分配 _lpToken LP代币合约的地址 _withUpdate 触发更新所有池的奖励变量。注意gas消耗!/ Add a new lp to the pool. Can only be called by the owner. XXX请勿多次添加同一LP令牌。如果您这样做,奖励将被搞砸 XXX DO NOT add the same LP token more than once. Rewards will be messed up if you do. 触发更新所有池的奖励变量
function add( uint256 _allocPoint, IERC20 _lpToken, bool _withUpdate ) public onlyOwner { if (_withUpdate) { massUpdatePools(); } ? block.number : startBlock; PoolInfo({ lpToken: _lpToken, all...
8,546,016
./partial_match/1/0x2B4395084E1068877502EAD1Ae004094F5A0B88F/sources/P2PToken.sol
Set new owner for the smart contract. Only be called by smart contract owner. _newOwner address of new owner of the smart contract/
function setOwner(address _newOwner) public{ require (msg.sender == owner); owner = _newOwner; }
15,995,232
./full_match/9001/0x00232A8326af43515C8413A00b49282e25f50017/sources/src/token/ERC721/facets/minting/ERC721MintableRoleBased.sol
@inheritdoc IERC721MintableRoleBased/
function mintByRole( address to, uint256 amount, string[] calldata tokenURIs ) public virtual onlyRole(MINTER_ROLE) { uint256 nextTokenId = ERC721SupplyStorage.layout().currentIndex; IERC721MintableExtension(address(this)).mintByFacet(to, amount); for (uint256 i...
11,533,209
pragma solidity ^0.5.8; import "./ReentrancyGuard.sol"; import "./SafeMath.sol"; import "./SafeMathUInt128.sol"; import "./SafeCast.sol"; import "./Utils.sol"; import "./Storage.sol"; import "./Config.sol"; import "./Events.sol"; import "./Bytes.sol"; import "./Operations.sol"; import "./UpgradeableMaster.sol"; //...
Franklin contract initialization. Can be external because Proxy contract intercepts illegal calls of this function. initializationParameters Encoded representation of initialization parameters: _governanceAddress The address of Governance contract _verifierAddress The address of Verifier contract _ // FIXME: remove _g...
function initialize(bytes calldata initializationParameters) external { initializeReentrancyGuard(); ( address _governanceAddress, address _verifierAddress, bytes32 _genesisRoot ) = abi.decode(initializationParameters, (address, address, bytes32)); ...
5,479,347
// SPDX-License-Identifier: MIT pragma solidity 0.8.11; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUp...
tallyId The id of the tally. return Vote sign that the sender cast as a citizen.
function getCitizenVote(uint256 tallyId) external view returns (VoteStatus) { require(_isInCitizenCount[msg.sender], "You are not a citizen"); return _citizenVotes[tallyId][msg.sender]; }
14,049,708
./full_match/314/0x7b7f1f85F599b63432F5D782041c25Dad354f999/sources/node_modules/@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol
See {ERC721-_increaseBalance}. We need that to account tokens that were minted in batch/
function _increaseBalance(address account, uint128 amount) internal virtual override { if (amount > 0) { revert ERC721EnumerableForbiddenBatchMint(); } super._increaseBalance(account, amount); }
8,082,243
// SPDX-License-Identifier: MIT pragma solidity ^0.8.2; import "./NFTYieldedToken.sol"; /// @custom:security-contact [email protected] contract CHILL is NFTYieldedToken { uint256 constant public PROJECT_ALLOCATION = 5000000 * 10**18; uint256 constant public YIELD_STEP = 86400; uint256 constant public Y...
Claims credit as tokens from multiple `tokenIds` as specified by `amounts`. Requirements: See {NFTYieldedToken._spendMultiple}/
function claimMultiple( uint256[] calldata tokenIds, uint256[] calldata amounts ) public { uint256 totalSpent = _spendMultiple(msg.sender, tokenIds, amounts); _mint(msg.sender, totalSpent); }
1,391,782
./full_match/97/0xF7Df059F5bCFe50A458cCF459fb99EFd20eF7400/sources/project_/contracts/strf-token-staker/STRFStaker.sol
Get currently withdrawable user staked and locked token amount. Get user staked and locked token amount, which can be withdrawn after time passes the lock durration. user address used for balance checking. return amount returns passed address staked and locked token amount./
function withdrawableStakedAndLockedBalance( address user ) public view returns (uint256 amount) { LockedBalance[] storage locks = userLocks[user]; uint256 currentTime = getCurrentTime(); for (uint256 i = 0; i < locks.length; i++) { if (locks[i].unlockTime > currentTi...
3,275,325
./partial_match/83/0xB210c12DCBc5437620B562b848C1251de85EfF35/sources/contracts/AlgebraPool.sol
Increases amounts of tokens owed to owner of the position _position The position object to operate with liquidityDelta The amount on which to increase\decrease the liquidity innerFeeGrowth0Token Total fee token0 fee growth per 1/liquidity between position's lower and upper ticks innerFeeGrowth1Token Total fee token...
function _recalculatePosition( Position storage _position, int128 liquidityDelta, uint256 innerFeeGrowth0Token, uint256 innerFeeGrowth1Token ) internal { (uint128 currentLiquidity, uint32 lastLiquidityAddTimestamp) = (_position.liquidity, _position.lastLiquidityAddTimestamp); if (liquidityD...
8,827,942
./full_match/4/0xE8A191026e71C303b0f40F15be93403f7D529707/sources/contracts/PangolinRouter02_flat.sol
given an input amount of an asset and pair reserves, returns the maximum output amount of the other asset
function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) internal pure returns (uint amountOut) { require(amountIn > 0, 'JoeLibrary: INSUFFICIENT_INPUT_AMOUNT'); require(reserveIn > 0 && reserveOut > 0, 'JoeLibrary: INSUFFICIENT_LIQUIDITY'); uint amountInWithFee = amountIn.mul(9...
12,526,737
// SPDX-License-Identifier: Unlicensed pragma solidity 0.8.9; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { this; // silence state mutability warning wit...
Converts to absolute value, and fails on overflow./
function abs(int256 a) internal pure returns (int256) { require(a != MIN_INT256); return a < 0 ? -a : a; }
409,321
//Address: 0xea1f346faf023f974eb5adaf088bbcdf02d761f4 //Contract name: TIXToken //Balance: 0 Ether //Verification Date: 7/9/2017 //Transacion Count: 12781 // CODE STARTS HERE pragma solidity ^0.4.11; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { func...
Ends the funding period and sends the ETH home/ move to operational
function finalize() external whenNotFinalized { if (now <= endTime && totalSupply != tokenGenerationCap) throw; isFinalized = true; }
1,786,546
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /// @author Udacity /// @dev provides basic authorization control abstract contract Ownable { address payable private origOwner; /// @dev define an Event event TransferOwnership(address indexed oldOwner, address indexed newOwner); /// @dev assig...
check if the calling address is the owner of the contract
function isOwner() public view returns (bool) { return msg.sender == origOwner; }
12,536,345
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.7.1; pragma experimental ABIEncoderV2; import "./interfaces/ITransferRegistry.sol"; import "./lib/LibIterableMapping.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; /// @title TransferRegistry /// @author Connext <support@connext.network> /// @notic...
Should return all transfer defintions in registry
function getTransferDefinitions() external view override returns (RegisteredTransfer[] memory) { return transfers.getTransferDefinitions(); }
7,295,410
./partial_match/1/0x179886f229F9cD52016c6dBF4BE66E18111EC6ab/sources/artifacts/contracts/lib/ConsiderationBase.sol
Internal pure function to retrieve the default name of this contract as a string that can be used internally. return The name of this contract./ Return the name of the contract.
function _nameString() internal pure virtual returns (string memory) { return "Core Sky Exchange Contract"; }
4,423,821
//██████╗ █████╗ ██╗ █████╗ ██████╗ ██╗███╗ ██╗ //██╔══██╗██╔══██╗██║ ██╔══██╗██╔══██╗██║████╗ ██║ //██████╔╝███████║██║ ███████║██║ ██║██║██╔██╗ ██║ //██╔═══╝ ██╔══██║██║ ██╔══██║██║ ██║██║██║╚██╗██║ //██║ ██║ ██║███████╗██║ ██║██████╔╝██║██║ ╚████║ //╚═╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝╚═════...
Transfer the token from the owner to the recipient Deposit underlying, and mints palToken for the user from Address of the owner to Address of the recipient tokenId Id of the token return bool : success/Reset token approvalUpdate storage data
function _transfer( address from, address to, uint256 tokenId ) internal virtual returns(bool) { require(ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); _approve(address(0)...
12,938,582
pragma solidity ^0.4.24; import './common/app.sol'; import './common/dev.sol'; import './common/node.sol'; /** * @title PlayMarket contract - basic contract DAO PlayMarket 2.0 */ contract PlayMarket is App, Dev, Node { uint32 public percNode = 100; // 1% (percent to hundredths) - all that's left, will go to the ...
developer must be registered and not blocked in this store
function addApp(uint32 _hashType, uint32 _appType, uint _price, bool _publish, string _hash) external { require(DevStorage.getState(msg.sender) && !DevStorage.getStoreBlocked(msg.sender)); uint app = AppStorage.addApp(_hashType, _appType, _price, _publish, msg.sender, _hash); LogStorage.addAppEvent(app, _...
12,595,483
pragma solidity 0.6.6; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; // TODO add access controls to ensure only bot can mint and only admin can call admin functions // TODO - is there a twitter ID we can use to enforce uniqueness in the thread being rolled up? // TODO - look at Filecoin hash length valid...
Admin method for updating the token URI of a snapshot _tokenId ID of the snapshot _uri New token URI/
function setTokenURI(uint256 _tokenId, string memory _uri) public { _setTokenURI(_tokenId, _uri); }
2,482,547
/** *Submitted for verification at Etherscan.io on 2019-12-31 */ // File: contracts/lib/Bytes32Library.sol /* Copyright 2018 Set Labs Inc. 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 Lic...
Deploys a new RebalancingSetTokenV2 contract, conforming to IFactory Can only be called by core contracts. | CallData | Location | |----------------------------|-------------------------------| | manager | 32 | | liquidator ...
function createSet( address[] calldata _components, uint256[] calldata _units, uint256 _naturalUnit, bytes32 _name, bytes32 _symbol, bytes calldata _callData ) external returns (address) { require( msg.sender == address(core...
6,405,829
// SPDX-License-Identifier: MIT pragma solidity 0.8.0; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable....
Harvest additional yield from the investment. Only governance or strategist can call this function./ 1. Harvest from Badger Tree 2. Sushi: Badger --> WBTC
function harvest(address[] calldata _tokens, uint256[] calldata _cumulativeAmounts, uint256 _index, uint256 _cycle, bytes32[] calldata _merkleProof, uint256[] calldata _amountsToClaim) public virtual onlyStrategist { IBadgerTree(BADGER_TREE).claim(_tokens, _cumulativeAmounts, _index, _cycle, _merkle...
1,065,836