Unnamed: 0 int64 0 7.36k | comments stringlengths 3 35.2k | code_string stringlengths 1 527k | code stringlengths 1 527k | __index_level_0__ int64 0 88.6k |
|---|---|---|---|---|
54 | // presale start and end blocks | uint256 public presaleStart;
uint256 public presaleEnd;
| uint256 public presaleStart;
uint256 public presaleEnd;
| 47,836 |
19 | // 根据合约记录的上一次种子生产一个随机数/ return 返回一个随机数 | function _rand() internal returns (uint256) {
_seed = uint256(keccak256(_seed, block.blockhash(block.number - 1), block.coinbase, block.difficulty));
return _seed;
}
| function _rand() internal returns (uint256) {
_seed = uint256(keccak256(_seed, block.blockhash(block.number - 1), block.coinbase, block.difficulty));
return _seed;
}
| 45,447 |
12 | // Token storage Token storageCyril Lapinte - <cyril.lapinte@openfiz.com>SPDX-License-Identifier: MIT / | contract TokenStorage is ITokenStorage, OperableStorage {
struct LockData {
uint64 startAt;
uint64 endAt;
}
struct TokenData {
string name;
string symbol;
uint256 decimals;
uint256 totalSupply;
mapping (address => uint256) balances;
mapping (address => mapping (address => uint25... | contract TokenStorage is ITokenStorage, OperableStorage {
struct LockData {
uint64 startAt;
uint64 endAt;
}
struct TokenData {
string name;
string symbol;
uint256 decimals;
uint256 totalSupply;
mapping (address => uint256) balances;
mapping (address => mapping (address => uint25... | 45,467 |
0 | // contract administrator | address public owner;
| address public owner;
| 57,840 |
2 | // token i multiplier to reach POOL_TOKEN_COMMON_DECIMALS | uint256[] public baseMultipliers;
| uint256[] public baseMultipliers;
| 15,078 |
88 | // cant send it to a non existing petition | require (keccak256(petitions[_petitionId].name) != keccak256(""));
require (ownerPetitionSignerArrayCreated[msg.sender][_petitionId] == 0);
| require (keccak256(petitions[_petitionId].name) != keccak256(""));
require (ownerPetitionSignerArrayCreated[msg.sender][_petitionId] == 0);
| 43,222 |
3 | // An enum of the transaction types. either deposit or withdrawal. / | enum TransactionType { DEPOSIT, WITHDRAWAL }
/**
* An enum of all the states of a transaction.
* AWAITING_AGENT :- transaction initialized and waitning for agent pairing.
* AWAITING_CONFIRMATIONS :- agent paired awaiting for approval by the agent and client.
* CONFIRMED :- transactions ... | enum TransactionType { DEPOSIT, WITHDRAWAL }
/**
* An enum of all the states of a transaction.
* AWAITING_AGENT :- transaction initialized and waitning for agent pairing.
* AWAITING_CONFIRMATIONS :- agent paired awaiting for approval by the agent and client.
* CONFIRMED :- transactions ... | 22,011 |
54 | // allowed percentage to mitigate failure for min/max vest | uint256 public allowedPercentage;
| uint256 public allowedPercentage;
| 18,316 |
63 | // realize $CARROT earnings for a single Fox and optionally unstake itfoxes earn $CARROT proportional to their Alpha rank tokenId the ID of the Fox to claim earnings from unstake whether or not to unstake the Fox time currnet block timereturn reward - the amount of $CARROT earned / | function _claimHunterFromCabin(uint16 tokenId, bool unstake, uint48 time) internal returns (uint128 reward) {
require(foxNFT.ownerOf(tokenId) == address(this), "must be staked to claim rewards");
uint8 marksman = _getAdvantagePoints(tokenId);
EarningStake memory earningStake = hunterStakeByMarksman[marksm... | function _claimHunterFromCabin(uint16 tokenId, bool unstake, uint48 time) internal returns (uint128 reward) {
require(foxNFT.ownerOf(tokenId) == address(this), "must be staked to claim rewards");
uint8 marksman = _getAdvantagePoints(tokenId);
EarningStake memory earningStake = hunterStakeByMarksman[marksm... | 40,139 |
165 | // Deposit tokens into pos portal When `depositor` deposits tokens into pos portal, tokens get locked into predicate contract. depositor Address who wants to deposit tokens depositReceiver Address (address) who wants to receive tokens on side chain rootToken Token which gets deposited depositData Extra data for deposit... | function lockTokens(
address depositor,
address depositReceiver,
address rootToken,
bytes calldata depositData
) external;
| function lockTokens(
address depositor,
address depositReceiver,
address rootToken,
bytes calldata depositData
) external;
| 51,863 |
206 | // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding an 'if' statement (like in _removeTokenFromOwnerEnumeration) | uint256 lastTokenId = _allTokens[lastTokenIndex];
_allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
_allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
| uint256 lastTokenId = _allTokens[lastTokenIndex];
_allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
_allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
| 2,347 |
5 | // update functions callable on Diamond proxy l storage layout facetCuts array of structured Diamond facet update data target optional recipient of initialization delegatecall data optional initialization call data / | function diamondCut(
Layout storage l,
IDiamondWritable.FacetCut[] memory facetCuts,
address target,
bytes memory data
| function diamondCut(
Layout storage l,
IDiamondWritable.FacetCut[] memory facetCuts,
address target,
bytes memory data
| 20,910 |
62 | // View offering ETH span | function checkOfferSpan() public view returns(uint256) {
return _offerSpan;
}
| function checkOfferSpan() public view returns(uint256) {
return _offerSpan;
}
| 53,387 |
30 | // INTRODUCING ADVANCE FUNCTIONALITIES/ | {
//generate a public event on the blockchain
function _transfer(address _from, address _to,uint256 _value) internal {
//prevent transfer to 0x0 address.
require(_to != 0x0);
//check if sender has enough tokens
require(balances[_from] >= _value);
//check for overflows
... | {
//generate a public event on the blockchain
function _transfer(address _from, address _to,uint256 _value) internal {
//prevent transfer to 0x0 address.
require(_to != 0x0);
//check if sender has enough tokens
require(balances[_from] >= _value);
//check for overflows
... | 24,477 |
59 | // Verify whether strategy can be executed | require(executionManager.isStrategyWhitelisted(makerOrder.strategy), "Strategy: Not whitelisted");
| require(executionManager.isStrategyWhitelisted(makerOrder.strategy), "Strategy: Not whitelisted");
| 17,963 |
30 | // set a new owner. | function changeOwner(address _newFundDeposit) isOwner() external {
if (_newFundDeposit == address(0x0)) throw;
ethFundDeposit = _newFundDeposit;
}
| function changeOwner(address _newFundDeposit) isOwner() external {
if (_newFundDeposit == address(0x0)) throw;
ethFundDeposit = _newFundDeposit;
}
| 2,159 |
14 | // Reservation contract Forword ether to pre-ico address / | contract ReservationContract {
// Keep track of who invested
mapping(address => bool) public invested;
// Minimum investment for reservation contract
uint public MIN_INVESTMENT = 1 ether;
// address of the pre-ico
PreIcoContract public preIcoAddr;
// start and end time of the pre-ico
ui... | contract ReservationContract {
// Keep track of who invested
mapping(address => bool) public invested;
// Minimum investment for reservation contract
uint public MIN_INVESTMENT = 1 ether;
// address of the pre-ico
PreIcoContract public preIcoAddr;
// start and end time of the pre-ico
ui... | 9,659 |
13 | // Indicator that this is a BController contract (for inspection) | bool public constant isBController = true;
| bool public constant isBController = true;
| 3,236 |
79 | // This is where we actually mint tokens: | tokenSupply = tokenSupply.add(tokensBought);
divTokenSupply = divTokenSupply.add(dividendTokensBought);
| tokenSupply = tokenSupply.add(tokensBought);
divTokenSupply = divTokenSupply.add(dividendTokensBought);
| 16,566 |
6 | // Returns the subtraction of two signed integers, reverting on overflow. / | function sub(int256 a, int256 b) internal pure returns (int256) {
int256 c = a - b;
_require((b >= 0 && c <= a) || (b < 0 && c > a), Errors.SUB_OVERFLOW);
return c;
}
| function sub(int256 a, int256 b) internal pure returns (int256) {
int256 c = a - b;
_require((b >= 0 && c <= a) || (b < 0 && c > a), Errors.SUB_OVERFLOW);
return c;
}
| 28,020 |
16 | // Publicly callable function that takes all ETH in this contract, wraps it to WETH and sends it to thebridge pool contract. Function is called by fallback functions to automatically wrap ETH to WETH and send at theconclusion of a canonical ETH bridging action. / | function wrapAndTransfer() public payable {
weth.deposit{ value: address(this).balance }();
weth.transfer(bridgePool, weth.balanceOf(address(this)));
}
| function wrapAndTransfer() public payable {
weth.deposit{ value: address(this).balance }();
weth.transfer(bridgePool, weth.balanceOf(address(this)));
}
| 33,444 |
176 | // Reverts if the `tokenId` has not been minted yet. / | function _requireMinted(uint256 tokenId) internal view virtual {
require(_exists(tokenId), "ERC721: invalid token ID");
}
| function _requireMinted(uint256 tokenId) internal view virtual {
require(_exists(tokenId), "ERC721: invalid token ID");
}
| 25,362 |
13 | // This version does not have any devfees eggsBought=SafeMath.sub(eggsBought,devFee(eggsBought)); | reinvest();
| reinvest();
| 76,839 |
30 | // Used when rolling funds into a new round | struct NAVDetails {
// Collaterals of the vault
Collateral[] collaterals;
// Collateral balances at the start of the round
uint256[] startingBalances;
// Current collateral balances
uint256[] currentBalances;
// Used to calculate NAV
address oracleAddr;
// Expiry of the round
uin... | struct NAVDetails {
// Collaterals of the vault
Collateral[] collaterals;
// Collateral balances at the start of the round
uint256[] startingBalances;
// Current collateral balances
uint256[] currentBalances;
// Used to calculate NAV
address oracleAddr;
// Expiry of the round
uin... | 16,793 |
154 | // Override this to add all tokens/tokenized positions this contractmanages on a persistent basis (e.g. not just for swapping back towant ephemerally). NOTE: Do not include `want`, already included in `sweep` below. Example: | * function protectedTokens() internal override view returns (address[] memory) {
* address[] memory protected = new address[](3);
* protected[0] = tokenA;
* protected[1] = tokenB;
* protected[2] = tokenC;
* return protected;
* }
| * function protectedTokens() internal override view returns (address[] memory) {
* address[] memory protected = new address[](3);
* protected[0] = tokenA;
* protected[1] = tokenB;
* protected[2] = tokenC;
* return protected;
* }
| 7,428 |
31 | // original: 62%, 70%, 91, 31 hoi an sky: 528fcb, 004b9e); hoi an sunset background: linear-gradient(0deg, fed2a8, 6393d6); | if(suffix == 0){
return string.concat('hsl(', Strings.toString(hue), ', 54%, 56%)');
} else {
| if(suffix == 0){
return string.concat('hsl(', Strings.toString(hue), ', 54%, 56%)');
} else {
| 14,480 |
138 | // emit an improved atomic approve event | emit Approved(_from, msg.sender, _allowance + _value, _allowance);
| emit Approved(_from, msg.sender, _allowance + _value, _allowance);
| 50,547 |
28 | // modifier to scope access to admins / | modifier onlyAdmin()
| modifier onlyAdmin()
| 6,197 |
1 | // Constructor to create an ERC20 token/_initialAmount Amount of the new token/_tokenName Name of the new token/_decimalUnits Number of decimals of the new token/_tokenSymbol Token Symbol for the new token | constructor(
string memory _tokenName,
string memory _tokenSymbol,
uint256 _initialAmount,
uint8 _decimalUnits
| constructor(
string memory _tokenName,
string memory _tokenSymbol,
uint256 _initialAmount,
uint8 _decimalUnits
| 21,287 |
31 | // get LQTY rewards from SP return uint / | function getLQTYRewards() public view returns (uint256) {
return lusdStabilityPool.getDepositorLQTYGain(address(this));
}
| function getLQTYRewards() public view returns (uint256) {
return lusdStabilityPool.getDepositorLQTYGain(address(this));
}
| 51,546 |
77 | // l_beneficiary account that will receive the conversion result or 0x0 to send the result to the sender accountl если след UNI/SUSHI, то в качестве получателя назначаем пару, иначе address(0), тогда результат вернётся sender-у (контракту) | address beneficiary = (i < swapSequence.length - 1) && swapSequence[i + 1] == 0 ? path[index] : address(0);
| address beneficiary = (i < swapSequence.length - 1) && swapSequence[i + 1] == 0 ? path[index] : address(0);
| 2,234 |
10 | // this contract is the dealer who recive "OnFlashLoan" callack | address dealer = address(this);
| address dealer = address(this);
| 19,084 |
232 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
function _beforeTokenTransfer(address from, address to, uint256 tokenId)
internal
whenNotPaused
override(ERC721, ERC721Enumerable)
|
function _beforeTokenTransfer(address from, address to, uint256 tokenId)
internal
whenNotPaused
override(ERC721, ERC721Enumerable)
| 23,923 |
185 | // Mapping from marble NFT source uri hash TO NFT ID . / | mapping (uint256 => uint256) public sourceUriHashToId;
constructor()
public
| mapping (uint256 => uint256) public sourceUriHashToId;
constructor()
public
| 12,954 |
216 | // cant drain glp | require(_token != address(fsGLP), "no glp draining");
IERC20(_token).safeTransfer(msg.sender, _amount);
| require(_token != address(fsGLP), "no glp draining");
IERC20(_token).safeTransfer(msg.sender, _amount);
| 19,660 |
216 | // Hack to get things to work automatically on OpenSea.Use isApprovedForAll so the frontend doesn't have to worry about different method names. / | function ownerOf(uint256 _tokenId) public view returns (address _owner) {
return owner();
}
| function ownerOf(uint256 _tokenId) public view returns (address _owner) {
return owner();
}
| 42,958 |
143 | // Price Ratios, to x decimal places hencedecimals, dependent on the size of the denominator. Ratios are relative to eth, amount of ether for a single token, ie. ETH / GNO == 0.2 Ether per 1 Gnosis | uint256 orderPrice; // The price the maker is willing to accept
uint256 offeredPrice; // The offer the taker has given
uint256 decimals = _makerOrder.offerToken_ == address(0) ? __flooredLog10__(_makerOrder.wantTokenTotal_) : __flooredLog10__(_makerOrder.offerTokenTotal_);
| uint256 orderPrice; // The price the maker is willing to accept
uint256 offeredPrice; // The offer the taker has given
uint256 decimals = _makerOrder.offerToken_ == address(0) ? __flooredLog10__(_makerOrder.wantTokenTotal_) : __flooredLog10__(_makerOrder.offerTokenTotal_);
| 14,040 |
54 | // low level token purchase function caution: tokens must be redeemed by beneficiary address | function buyTokens(address beneficiary) payable {
require(beneficiary != 0x0);
require(validPurchase());
// calculate token amount to be purchased
uint256 weiAmount = msg.value;
uint256 tokens = weiAmount.mul(rate);
// update state
weiRaised = weiRaised.add(weiAmount);
// allocate t... | function buyTokens(address beneficiary) payable {
require(beneficiary != 0x0);
require(validPurchase());
// calculate token amount to be purchased
uint256 weiAmount = msg.value;
uint256 tokens = weiAmount.mul(rate);
// update state
weiRaised = weiRaised.add(weiAmount);
// allocate t... | 43,570 |
81 | // Gets the total amount the issuer has to pay by the end of the contract/ | function getTotalPayment() public view returns (uint256) {
return nTotalInputInterest;
}
| function getTotalPayment() public view returns (uint256) {
return nTotalInputInterest;
}
| 8,052 |
65 | // rawReceiveData - Called by the Router's fulfillRequest functionin order to fulfil a data request. Data providers call the Router's fulfillRequest functionThe request is validated to ensure it has indeed been sent via the Router. The Router will only call rawReceiveData once it has validated the origin of the data fu... | function rawReceiveData(
uint256 _price,
bytes32 _requestId) external
| function rawReceiveData(
uint256 _price,
bytes32 _requestId) external
| 61,910 |
31 | // Event emitted when the TokenRecoverer changes/previousEthereum address of previous token recoverer/current Ethereum address of new token recoverer | event TokenRecovererChange(address indexed previous, address indexed current);
| event TokenRecovererChange(address indexed previous, address indexed current);
| 4,975 |
55 | // Retrieves the exchange rates (sUSD per unit) for a list of currency keys / | function getRates(bytes32[] memory currencyKeys)
public
view
returns (uint[] memory)
| function getRates(bytes32[] memory currencyKeys)
public
view
returns (uint[] memory)
| 13,710 |
2 | // If true, payout addresses and basis points are permanently frozen and can never be updated | bool public payoutAddressesFrozen;
| bool public payoutAddressesFrozen;
| 21,268 |
1 | // Address of stable token. | ERC20 public stableToken;
| ERC20 public stableToken;
| 37,421 |
47 | // check that token's owner should be equal to the caller of the function | require(tokenOwner == msg.sender);
| require(tokenOwner == msg.sender);
| 10,027 |
57 | // The current inbox message was read | afterInboxCount++;
| afterInboxCount++;
| 33,856 |
2 | // Allows the current owner to add a new owner to the owners group. owner The address to add to the owners group. / | function addOwner(address owner) public onlyOwner {
require(owner != address(0), "Invalid address");
owners[owner] = true;
}
| function addOwner(address owner) public onlyOwner {
require(owner != address(0), "Invalid address");
owners[owner] = true;
}
| 10,816 |
172 | // Calculates returned BPT Tokens from Pool given In Token amount _inAmount Amount of In Tokens / | function calcBpPoolIn(uint256 _inAmount)
external
view
returns (uint256)
| function calcBpPoolIn(uint256 _inAmount)
external
view
returns (uint256)
| 32,700 |
23 | // This contract is abstract, and thus cannot be instantiated directly | require(owner != address(0), "Owner must be set");
| require(owner != address(0), "Owner must be set");
| 6,286 |
0 | // Function to verify linkdrop signer's signature_weiAmount Amount of wei to be claimed_tokenAddress Token address_tokenAmount Amount of tokens to be claimed (in atomic value)_expiration Unix timestamp of link expiration time_version Linkdrop contract version_chainId Network id_linkId Address corresponding to link key_... | function verifyLinkdropSignerSignature
(
uint _weiAmount,
address _tokenAddress,
uint _tokenAmount,
uint _expiration,
uint _version,
uint _chainId,
address _linkId,
bytes memory _signature
| function verifyLinkdropSignerSignature
(
uint _weiAmount,
address _tokenAddress,
uint _tokenAmount,
uint _expiration,
uint _version,
uint _chainId,
address _linkId,
bytes memory _signature
| 22,462 |
33 | // Lookup data at an index | function lookup(EvalX memory eval_x, uint256 index) internal trace_mod('eval_x_lookup') returns (uint256) {
return fpow(eval_x.eval_domain_generator, index);
}
// Returns a memory object which allows lookups
function init_eval(uint8 log_eval_domain_size) internal returns (EvalX memory) {
... | function lookup(EvalX memory eval_x, uint256 index) internal trace_mod('eval_x_lookup') returns (uint256) {
return fpow(eval_x.eval_domain_generator, index);
}
// Returns a memory object which allows lookups
function init_eval(uint8 log_eval_domain_size) internal returns (EvalX memory) {
... | 27,266 |
34 | // Public function that clears out an address's white list ID/addressToRemove The address removed from a white list | function removeFromWhitelist(address addressToRemove)
external
onlyWhitelister
| function removeFromWhitelist(address addressToRemove)
external
onlyWhitelister
| 54,093 |
26 | // Adds a new project and mints a batch of tokens for it. to Address to mint the tokens to. num Number of tokens to mint. royaltyReceiver Address to receive royalties. royaltyBasisPoints Royalty fraction in basis points (0.01%). | * @param baseTokenURI Base token URI used as a prefix by {tokenURI}.
*/
function mintNewProject(
address to,
uint16 num,
address royaltyReceiver,
uint16 royaltyBasisPoints,
string calldata baseTokenURI
) external onlyRole(OPERATOR_ROLE) onlyValidRoyaltySettings(... | * @param baseTokenURI Base token URI used as a prefix by {tokenURI}.
*/
function mintNewProject(
address to,
uint16 num,
address royaltyReceiver,
uint16 royaltyBasisPoints,
string calldata baseTokenURI
) external onlyRole(OPERATOR_ROLE) onlyValidRoyaltySettings(... | 15,598 |
128 | // Returns the amount contributed so far by a specific beneficiary. beneficiary Address of contributorreturn Beneficiary contribution so far / | function getContribution(address beneficiary)
public
view
returns (uint256)
| function getContribution(address beneficiary)
public
view
returns (uint256)
| 5,071 |
16 | // Prepay the next subsequent transfer | if(leftover >= (lastSoldFor[_tokenId] * 15 /100)){
leftover = leftover - (lastSoldFor[_tokenId] * 15 /100);
transferFeePrepaid[_tokenId] = true;
}
| if(leftover >= (lastSoldFor[_tokenId] * 15 /100)){
leftover = leftover - (lastSoldFor[_tokenId] * 15 /100);
transferFeePrepaid[_tokenId] = true;
}
| 32,134 |
32 | // This error is thrown whenever a report has a duplicate/ signature | error NonUniqueSignatures();
| error NonUniqueSignatures();
| 26,262 |
1 | // Transfers part of an account's balance in the old token to thiscontract, and mints the same amount of new tokens for that account. token The legacy token to migrate from, should be registered under this token account whose tokens will be migrated amount amount of tokens to be migrated / | function migrate(address token, address account, uint256 amount) public {
require(_legacyTokens[token]);
StandardBurnableToken legacyToken = StandardBurnableToken(token);
legacyToken.burnFrom(account, amount);
_mint(account, amount);
}
| function migrate(address token, address account, uint256 amount) public {
require(_legacyTokens[token]);
StandardBurnableToken legacyToken = StandardBurnableToken(token);
legacyToken.burnFrom(account, amount);
_mint(account, amount);
}
| 36,048 |
137 | // ========== EVENTS ========== | event CrossDomainMessageGasLimitChanged(CrossDomainMessageGasLimits gasLimitType, uint newLimit);
event TradingRewardsEnabled(bool enabled);
event WaitingPeriodSecsUpdated(uint waitingPeriodSecs);
event PriceDeviationThresholdUpdated(uint threshold);
event IssuanceRatioUpdated(uint newRatio);
ev... | event CrossDomainMessageGasLimitChanged(CrossDomainMessageGasLimits gasLimitType, uint newLimit);
event TradingRewardsEnabled(bool enabled);
event WaitingPeriodSecsUpdated(uint waitingPeriodSecs);
event PriceDeviationThresholdUpdated(uint threshold);
event IssuanceRatioUpdated(uint newRatio);
ev... | 11,134 |
9 | // define function modifier restricting to landlord only | modifier onlyLandlord() {
if (msg.sender != lease.landlord) revert();
_;
}
| modifier onlyLandlord() {
if (msg.sender != lease.landlord) revert();
_;
}
| 31,794 |
228 | // Counters Matt Condon (@shrugs) Provides counters that can only be incremented or decremented by one. This can be used e.g. to track the numberof elements in a mapping, issuing ERC721 ids, or counting request ids. Include with `using Counters for Counters.Counter;` / | library Counters {
struct Counter {
// This variable should never be directly accessed by users of the library: interactions must be restricted to
// the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
// this feature: see https://github.... | library Counters {
struct Counter {
// This variable should never be directly accessed by users of the library: interactions must be restricted to
// the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
// this feature: see https://github.... | 29,893 |
326 | // X1 - X5: OK | (uint256 amount0, uint256 amount1) = pair.burn(address(this));
if (token0 != pair.token0()) {
(amount0, amount1) = (amount1, amount0);
}
| (uint256 amount0, uint256 amount1) = pair.burn(address(this));
if (token0 != pair.token0()) {
(amount0, amount1) = (amount1, amount0);
}
| 37,064 |
190 | // Close sale if open, open sale if closed | function flipSaleState() external onlyOwner {
saleOpen = !saleOpen;
}
| function flipSaleState() external onlyOwner {
saleOpen = !saleOpen;
}
| 11,666 |
13 | // max per tx | uint256 public constant MAX_TOKENS_PER_TX = 10;
uint256 public MINT_GENESIS_PRICE = .06942 ether;
uint256 public MINT_PRICE = 70000;
| uint256 public constant MAX_TOKENS_PER_TX = 10;
uint256 public MINT_GENESIS_PRICE = .06942 ether;
uint256 public MINT_PRICE = 70000;
| 21,848 |
15 | // Verify that the caller is mapped to a given identifier. _identifier The identifier. / | modifier only(bytes32 _identifier) {
require(msg.sender == getContractAddress(_identifier), "caller is illegal");
_;
}
| modifier only(bytes32 _identifier) {
require(msg.sender == getContractAddress(_identifier), "caller is illegal");
_;
}
| 56,243 |
0 | // An operation with an ERC20 token failed. / | error SafeERC20FailedOperation(address token);
| error SafeERC20FailedOperation(address token);
| 16,381 |
2 | // this event is emitted when the IdentityRegistry has been set for the token the event is emitted by the token constructor and by the setIdentityRegistry function `_identityRegistry` is the address of the Identity Registry of the token / | event IdentityRegistryAdded(address indexed _identityRegistry);
| event IdentityRegistryAdded(address indexed _identityRegistry);
| 1,212 |
70 | // Mint the token with the id from claimedMemes array | _mint(msg.sender, id);
| _mint(msg.sender, id);
| 36,885 |
28 | // Return information about the swap at swapIndex. swapIndex Index of swap to be retrieve info for.return Total swap cap.return Per-user cap.return Bonus multiplier.return Number of tokens alreaduy claimed. / | function swapInfo(uint256 swapIndex) internal view returns (uint256, uint256, uint256, uint256) {
Swap storage activeSwap = swaps[swapIndex];
require(activeSwap.totalCap > 0, "No swap exists at this index.");
return(
activeSwap.totalCap,
activeSwap.userCap,
activeSwap.bon... | function swapInfo(uint256 swapIndex) internal view returns (uint256, uint256, uint256, uint256) {
Swap storage activeSwap = swaps[swapIndex];
require(activeSwap.totalCap > 0, "No swap exists at this index.");
return(
activeSwap.totalCap,
activeSwap.userCap,
activeSwap.bon... | 21,492 |
139 | // This is the address where the Mastercontract initializedERC20 is deployed to address payable public masterContract = 0xEb4c4f701cb50c8dDF7B0CEd051CeB25Aed9f3CA;master contract for bsc testnet placido factory | address payable public masterContract = 0x8bcE416dDc68c7DF920a5EdeFe8445F63330DC86; // PROD ETH MasterContract for kovan.eth testnet jacinto factory
| address payable public masterContract = 0x8bcE416dDc68c7DF920a5EdeFe8445F63330DC86; // PROD ETH MasterContract for kovan.eth testnet jacinto factory
| 33,311 |
54 | // lock +10% to referrer | LockRefTokens(refBonus, ref);
| LockRefTokens(refBonus, ref);
| 13,618 |
99 | // return the best offer for a token pairthe best offer is the lowest one if it's an ask,and highest one if it's a bid offer | function getBestOffer(ERC20 sell_gem, ERC20 buy_gem)
public
view
returns (uint256)
| function getBestOffer(ERC20 sell_gem, ERC20 buy_gem)
public
view
returns (uint256)
| 8,563 |
203 | // Reflection | uint256 public reflectionBalance;
uint256 public totalDividend;
| uint256 public reflectionBalance;
uint256 public totalDividend;
| 17,951 |
12 | // Starts the sale | function start() external onlyOwner {
require(!started, "Sale has already started");
started = true;
emit SaleStarted(block.number);
}
| function start() external onlyOwner {
require(!started, "Sale has already started");
started = true;
emit SaleStarted(block.number);
}
| 10,043 |
3 | // Callback function used by VRF Coordinator to return the random numberto this contract. Some action on the contract state should be taken here, like storing the result. WARNING: take care to avoid having multiple VRF requests in flight if their order of arrival would resultin contract states with different outcomes. ... | function fulfillRandomness(bytes32 _requestId, uint256 _randomness) internal override {
result = _randomness % BIG_PRIME;
if (result == 0)
result += 1;
emit DiceLanded(_requestId, _randomness);
}
| function fulfillRandomness(bytes32 _requestId, uint256 _randomness) internal override {
result = _randomness % BIG_PRIME;
if (result == 0)
result += 1;
emit DiceLanded(_requestId, _randomness);
}
| 80,168 |
374 | // Exchange remaining CVX for bveCVX | uint256 cvxToDistribute = cvxToken.balanceOf(address(this));
uint256 minbveCVXOut =
cvxToDistribute
.mul(MAX_FEE.sub(stableSwapSlippageTolerance))
.div(MAX_FEE);
| uint256 cvxToDistribute = cvxToken.balanceOf(address(this));
uint256 minbveCVXOut =
cvxToDistribute
.mul(MAX_FEE.sub(stableSwapSlippageTolerance))
.div(MAX_FEE);
| 23,404 |
1 | // address of the AvoForwarder (proxy) that is allowed to forward tx with valid/ signatures to this contract/ immutable but could be updated in the logic contract when a new version of AvoWallet is deployed | address public immutable avoForwarder;
| address public immutable avoForwarder;
| 25,423 |
18 | // Returns the current incognito proxy. | * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.
*
* TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the
* https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
* `0x6c... | * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.
*
* TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the
* https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
* `0x6c... | 34,719 |
127 | // Transfer stablecoins back to the sender | IERC20(underlyingCoin).safeTransfer(_msgSender(), underlyingCoinAmount);
| IERC20(underlyingCoin).safeTransfer(_msgSender(), underlyingCoinAmount);
| 57,920 |
154 | // Make sure we are not over debt ceiling (line) or under debt floor (dust) | if (
vatDebt >= line || (desiredAmount.add(debtBalance) <= dust.div(RAY))
) {
return 0;
}
| if (
vatDebt >= line || (desiredAmount.add(debtBalance) <= dust.div(RAY))
) {
return 0;
}
| 3,335 |
13 | // L'Owner peut réinitialiser le contract | function Reset() public onlyOwner(){
delete winningProposalId;
delete Propositions;
Etat = WorkflowStatus.RegisteringVoters;
uint i;
uint len= ListAddress.length;
for(i=0; i<len; i++){
delete Whitelist[ListAddress[i]];
}
delete ListAddress;... | function Reset() public onlyOwner(){
delete winningProposalId;
delete Propositions;
Etat = WorkflowStatus.RegisteringVoters;
uint i;
uint len= ListAddress.length;
for(i=0; i<len; i++){
delete Whitelist[ListAddress[i]];
}
delete ListAddress;... | 14,280 |
1 | // Mint multiple boards_to The owners to receive the assets _level The level of each board / | function mintMultiple(
address[] memory _to,
uint8[] memory _level
)
public
onlyMinters(msg.sender)
| function mintMultiple(
address[] memory _to,
uint8[] memory _level
)
public
onlyMinters(msg.sender)
| 47,696 |
402 | // Parse an address from the view at `_index`. Requires that the view have >= 20 bytes following that index. memView The view _indexThe indexreturnaddress - The address / | function indexAddress(bytes29 memView, uint256 _index) internal pure returns (address) {
return address(uint160(indexUint(memView, _index, 20)));
}
| function indexAddress(bytes29 memView, uint256 _index) internal pure returns (address) {
return address(uint160(indexUint(memView, _index, 20)));
}
| 22,475 |
4 | // This contract extends the NitroAdjudicator contract to enable it to be more easily unit-tested. It exposes public or external functions that set storage variables or wrap otherwise internal functions. It should not be deployed in a production environment. / | contract TESTNitroAdjudicator is NitroAdjudicator, TESTForceMove {
/**
* @dev Manually set the holdings mapping to a given amount for a given channelId. Shortcuts the deposit workflow (ONLY USE IN A TESTING ENVIRONMENT)
* @param channelId Unique identifier for a state channel.
* @param amount The nu... | contract TESTNitroAdjudicator is NitroAdjudicator, TESTForceMove {
/**
* @dev Manually set the holdings mapping to a given amount for a given channelId. Shortcuts the deposit workflow (ONLY USE IN A TESTING ENVIRONMENT)
* @param channelId Unique identifier for a state channel.
* @param amount The nu... | 39,359 |
28 | // calculate token amount to be sent | uint256 tokens = ((weiAmount) * price);
weiRaised = weiRaised.add(weiAmount);
| uint256 tokens = ((weiAmount) * price);
weiRaised = weiRaised.add(weiAmount);
| 31,665 |
89 | // Otherwise, we can fill the order entirely, so make the tokens and put them in the specified account. | totalSupply = newTotalSupply;
balances[recipient] = balances[recipient].add(tokens);
| totalSupply = newTotalSupply;
balances[recipient] = balances[recipient].add(tokens);
| 50,806 |
118 | // Stores a valid AMB bridge contract address. _bridgeContract the address of the bridge contract. / | function _setBridgeContract(address _bridgeContract) internal {
require(Address.isContract(_bridgeContract));
addressStorage[BRIDGE_CONTRACT] = _bridgeContract;
}
| function _setBridgeContract(address _bridgeContract) internal {
require(Address.isContract(_bridgeContract));
addressStorage[BRIDGE_CONTRACT] = _bridgeContract;
}
| 8,934 |
58 | // Allows seller to cancel a request _id request id / | function cancelRequest(bytes32 _id) public {
require(requests[_id].seller == msg.sender, "This request id does not belong to the message sender");
require(requests[_id].status == RequestStatus.AWAIT || requests[_id].status == RequestStatus.ACCEPTED, "Invalid request status");
address arbit... | function cancelRequest(bytes32 _id) public {
require(requests[_id].seller == msg.sender, "This request id does not belong to the message sender");
require(requests[_id].status == RequestStatus.AWAIT || requests[_id].status == RequestStatus.ACCEPTED, "Invalid request status");
address arbit... | 13,682 |
16 | // add balance | _itokenBalances[to] = _itokenBalances[to].add(itokenValue);
| _itokenBalances[to] = _itokenBalances[to].add(itokenValue);
| 10,818 |
149 | // Checks if two receivers fulfil the sortedness requirement of the receivers list./prev The previous receiver/next The next receiver | function _isOrdered(StreamReceiver memory prev, StreamReceiver memory next)
private
pure
returns (bool)
| function _isOrdered(StreamReceiver memory prev, StreamReceiver memory next)
private
pure
returns (bool)
| 21,676 |
190 | // ensure than as a result of running a function,balance of `token` increases by at least `expectedGain` / | modifier exchangeProtector(uint256 expectedGain, IERC20 _token) {
uint256 balanceBefore = _token.balanceOf(address(this));
_;
uint256 balanceDiff = _token.balanceOf(address(this)).sub(balanceBefore);
require(balanceDiff >= conservativePriceEstimation(expectedGain), "TrueFiPool: Not o... | modifier exchangeProtector(uint256 expectedGain, IERC20 _token) {
uint256 balanceBefore = _token.balanceOf(address(this));
_;
uint256 balanceDiff = _token.balanceOf(address(this)).sub(balanceBefore);
require(balanceDiff >= conservativePriceEstimation(expectedGain), "TrueFiPool: Not o... | 19,489 |
6 | // error InsufficientFunds(uint _currentAccountSerialNumber,uint _balanceRequested,uint _balanceAvailable,string _transactionType); |
event AccountCreated(
uint256 _serialNumber,
bytes32 _name,
bytes32 _location,
uint256 _createdAt,
uint256 _balance
);
event TransactionCompleted(
|
event AccountCreated(
uint256 _serialNumber,
bytes32 _name,
bytes32 _location,
uint256 _createdAt,
uint256 _balance
);
event TransactionCompleted(
| 23,879 |
58 | // Contract RESTO token ERC20 compatible token contract / | contract RESTOToken is ERC20Pausable {
string public constant name = "RESTO";
string public constant symbol = "RESTO";
uint32 public constant decimals = 18;
uint256 public INITIAL_SUPPLY = 1100000000 * 1 ether; // 1 100 000 000
address public CrowdsaleAddress;
uint64 crowdSaleEndTime = 154474560... | contract RESTOToken is ERC20Pausable {
string public constant name = "RESTO";
string public constant symbol = "RESTO";
uint32 public constant decimals = 18;
uint256 public INITIAL_SUPPLY = 1100000000 * 1 ether; // 1 100 000 000
address public CrowdsaleAddress;
uint64 crowdSaleEndTime = 154474560... | 51,572 |
221 | // set our newItemID do the current counter uint | uint256 newItemId = _tokenIds.current();
| uint256 newItemId = _tokenIds.current();
| 35,682 |
2 | // start block height of the chain element | uint256 start_height;
| uint256 start_height;
| 760 |
32 | // Casts a vote with a reason/proposalId The proposal id/support The support value (0 = Against, 1 = For, 2 = Abstain)/reason The vote reason | function castVoteWithReason(
bytes32 proposalId,
uint256 support,
string memory reason
) external returns (uint256);
| function castVoteWithReason(
bytes32 proposalId,
uint256 support,
string memory reason
) external returns (uint256);
| 17,881 |
251 | // solhint-disable-next-line max-line-length | address internal constant L2_CROSS_DOMAIN_MESSENGER =
0x4200000000000000000000000000000000000007;
address internal constant LIB_ADDRESS_MANAGER =
0x4200000000000000000000000000000000000008;
address internal constant PROXY_EOA =
0x4200000000000000000000000000000000000009;
address internal constant L2... | address internal constant L2_CROSS_DOMAIN_MESSENGER =
0x4200000000000000000000000000000000000007;
address internal constant LIB_ADDRESS_MANAGER =
0x4200000000000000000000000000000000000008;
address internal constant PROXY_EOA =
0x4200000000000000000000000000000000000009;
address internal constant L2... | 37,295 |
37 | // IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x10ED43C718714eb63d5aA57B78B54704E256024E); IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x9Ac64Cc6e4415144C455BD8E4837Fea55603e5c3); | IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router = _uniswapV2Router;
_isExcludedFromFee[own... | IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router = _uniswapV2Router;
_isExcludedFromFee[own... | 2,031 |
45 | // PRIVILEGED GOVERNANCE FUNCTION. Allows governance to edit the curve meta registry_curveMetaRegistryAddress of the new curve meta registry / | function editCurveMetaRegistry(address _curveMetaRegistry) external override {
_onlyGovernanceOrEmergency();
require(_curveMetaRegistry != address(0), 'Address must not be 0');
curveMetaRegistry = _curveMetaRegistry;
}
| function editCurveMetaRegistry(address _curveMetaRegistry) external override {
_onlyGovernanceOrEmergency();
require(_curveMetaRegistry != address(0), 'Address must not be 0');
curveMetaRegistry = _curveMetaRegistry;
}
| 72,379 |
44 | // private function to claim rewards for multiple pids/_pids array pids, pools to claim | function _multiClaim(
uint256[] memory _pids
| function _multiClaim(
uint256[] memory _pids
| 39,878 |
200 | // Safe GrowDeFi transfer function, just in case if rounding error causes pool to not have enough growdefis. | function safeGrowDeFiTransfer(address _to, uint256 _amount) internal {
uint256 growdefiBal = GrowDeFi.balanceOf(address(this));
if (_amount > growdefiBal) {
GrowDeFi.transfer(_to, growdefiBal);
} else {
GrowDeFi.transfer(_to, _amount);
}
}
| function safeGrowDeFiTransfer(address _to, uint256 _amount) internal {
uint256 growdefiBal = GrowDeFi.balanceOf(address(this));
if (_amount > growdefiBal) {
GrowDeFi.transfer(_to, growdefiBal);
} else {
GrowDeFi.transfer(_to, _amount);
}
}
| 41,240 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.