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
119
// `oraclize_query` overloads using dynamic string[] arguments and a datasource of type STRING follow.../
function oraclize_query( string memory _datasource, string[1] memory _args ) oraclizeAPI internal returns (bytes32 _id)
function oraclize_query( string memory _datasource, string[1] memory _args ) oraclizeAPI internal returns (bytes32 _id)
38,733
22
// Redeem a given amount of shares in return for assetsShares are burned from the caller & assets sent to the caller shares is the amount of shares (vault tokens) to be redeemed /
function redeem(uint256 shares) external onlyOwner returns (uint256) { return redeem(shares, msg.sender, msg.sender); }
function redeem(uint256 shares) external onlyOwner returns (uint256) { return redeem(shares, msg.sender, msg.sender); }
39,724
3
// Add a trusted claim topic (For example: KYC=1, AML=2).Only owner can call.emits `ClaimTopicAdded` event _claimTopic The claim topic index /
function addClaimTopic(uint256 _claimTopic) external;
function addClaimTopic(uint256 _claimTopic) external;
34,918
226
// mapping between an owner address and the number of owner address vaults
mapping(address => uint256) internal accountVaultCounter;
mapping(address => uint256) internal accountVaultCounter;
46,200
67
// Set initial variable state to allow initial tokens to be created when using initialTokensSupply function. This will be reverted to true after using locking mechanism - initialTokensSupplyFinish function. Then it will prevent to generate any tokens again. Current state can be Read at InitialTokensSupplyFinishState function./
initialTokensGenerationFinish = false;
initialTokensGenerationFinish = false;
31,880
296
// Indicate this service provider is within bounds
spDetails[msg.sender].validBounds = true; emit RegisteredServiceProvider( newServiceProviderID, _serviceType, msg.sender, _endpoint, currentlyStakedForOwner );
spDetails[msg.sender].validBounds = true; emit RegisteredServiceProvider( newServiceProviderID, _serviceType, msg.sender, _endpoint, currentlyStakedForOwner );
3,199
5
// Store adopters in memeory rather than contract's storage
address [16] memory adopters = adoption.getAdopters(); Assert.equal(adopters[expectedPetId], expectedAdopter, "Owner of expected pet should be this contract");
address [16] memory adopters = adoption.getAdopters(); Assert.equal(adopters[expectedPetId], expectedAdopter, "Owner of expected pet should be this contract");
43,349
65
// authorise an account to participate/
function authoriseAccount(address whom) onlyCSorAdmin public { authorised[whom] = true; }
function authoriseAccount(address whom) onlyCSorAdmin public { authorised[whom] = true; }
16,150
376
// Set royalties of a token /
function setRoyalties(uint256 tokenId, address payable[] calldata receivers, uint256[] calldata basisPoints) external;
function setRoyalties(uint256 tokenId, address payable[] calldata receivers, uint256[] calldata basisPoints) external;
527
41
// The total supply available
uint256 maxSupply;
uint256 maxSupply;
27,484
130
//
function _chainID() external returns (uint8);
function _chainID() external returns (uint8);
1,384
170
// Must be after verification period
require(blockNum >= claim.endVerificationBlock);
require(blockNum >= claim.endVerificationBlock);
30,475
15
// Sets {decimals} to a value other than the default one of 18. WARNING: This function should only be called from the constructor. Mostapplications that interact with token contracts will not expect{decimals} to ever change, and may work incorrectly if it does. /
function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; }
function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; }
4,804
5
// GENERATE AN INSTANCE OF CARD /
function GenerateEtherArt(address _player, uint _tokenId, uint32 _typeIndex, uint _timestamp, uint8 _creationgMode, uint64 _localSeq, bool _userSellFlag, uint32 _userPriceInFinny, bool _recipeUsed) external platform{ // add some protection // Create new card and set owner, tokenId, typeIndex, creation tm, transaction tm, creat mode, localSeq, userSellFlag, userPriceInFinny, recipeUsed artworks.push(singleArtwork(_player, _tokenId, _typeIndex, _timestamp, _timestamp, _creationgMode, _localSeq, _userSellFlag, _userPriceInFinny, _recipeUsed)); }
function GenerateEtherArt(address _player, uint _tokenId, uint32 _typeIndex, uint _timestamp, uint8 _creationgMode, uint64 _localSeq, bool _userSellFlag, uint32 _userPriceInFinny, bool _recipeUsed) external platform{ // add some protection // Create new card and set owner, tokenId, typeIndex, creation tm, transaction tm, creat mode, localSeq, userSellFlag, userPriceInFinny, recipeUsed artworks.push(singleArtwork(_player, _tokenId, _typeIndex, _timestamp, _timestamp, _creationgMode, _localSeq, _userSellFlag, _userPriceInFinny, _recipeUsed)); }
35,793
152
// Safe onx transfer function, just in case if rounding error causes pool to not have enough $OnX
function safeOnXTransfer(address _to, uint256 _amount) internal { uint256 onxBal = onx.balanceOf(address(this)); if (_amount > onxBal) { onx.transfer(_to, onxBal); } else { onx.transfer(_to, _amount); } }
function safeOnXTransfer(address _to, uint256 _amount) internal { uint256 onxBal = onx.balanceOf(address(this)); if (_amount > onxBal) { onx.transfer(_to, onxBal); } else { onx.transfer(_to, _amount); } }
488
12
// Node is how ENS identifies names, we need that to setText
bytes32 node = podEnsRegistrar.getEnsNode(_label); podEnsRegistrar.setText(node, "avatar", _imageUrl); podEnsRegistrar.setText(node, "podId", Strings.toString(podId));
bytes32 node = podEnsRegistrar.getEnsNode(_label); podEnsRegistrar.setText(node, "avatar", _imageUrl); podEnsRegistrar.setText(node, "podId", Strings.toString(podId));
37,508
63
// Item not found
return -1;
return -1;
50,591
0
// Declaring the state variables
address payable public arbiter = payable(0xb5f4bcB46df6284932d71d3c11A2B7eD42e16be1); address public constant usdtContractAddress = 0xcbE9771eD31e761b744D3cB9eF78A1f32DD99211; uint totalRevenue = 0; uint public numberOfOrders = 0;
address payable public arbiter = payable(0xb5f4bcB46df6284932d71d3c11A2B7eD42e16be1); address public constant usdtContractAddress = 0xcbE9771eD31e761b744D3cB9eF78A1f32DD99211; uint totalRevenue = 0; uint public numberOfOrders = 0;
41,639
29
// Return InstaDApp Mapping Addresses /
function getMappingAddr() internal pure returns (address) { return 0xe81F70Cc7C0D46e12d70efc60607F16bbD617E88; // InstaMapping Address }
function getMappingAddr() internal pure returns (address) { return 0xe81F70Cc7C0D46e12d70efc60607F16bbD617E88; // InstaMapping Address }
21,778
17
// 是否首次入场
if (_user.joinLevel < 1) {
if (_user.joinLevel < 1) {
5,773
21
// Burn specified number of PLTN tokens _value The amount of tokens to be burned /
function burn(uint256 _value) onlyOwner public returns (bool)
function burn(uint256 _value) onlyOwner public returns (bool)
27,000
0
// This test function is to check the initial proof length. Since user is interacting with the app very first time, there should not any proof (file metadata) available in the blockchain./
function testInitialProofLength() public { ProofOfExistence proofOfExistence = ProofOfExistence(DeployedAddresses.ProofOfExistence()); uint expected = 0; Assert.equal(proofOfExistence.getProofLength(this), expected, "User should have zero proof initially"); }
function testInitialProofLength() public { ProofOfExistence proofOfExistence = ProofOfExistence(DeployedAddresses.ProofOfExistence()); uint expected = 0; Assert.equal(proofOfExistence.getProofLength(this), expected, "User should have zero proof initially"); }
46,748
50
// Burn tokens from address token holder address amount uint256 amount of tokens to burn data bytes extra information provided by the token holder operatorData bytes extra information provided by the operator (if any) /
function _burn( address from, uint256 amount, bytes memory data, bytes memory operatorData ) internal virtual
function _burn( address from, uint256 amount, bytes memory data, bytes memory operatorData ) internal virtual
3,001
40
// Max NRG tokens to sell
uint256 public constant MAX_TOKENS = 20000000 * (10**18);
uint256 public constant MAX_TOKENS = 20000000 * (10**18);
19,234
506
// --- Time lock
modifier notLocked(Functions _fn) { require( timelock[_fn] != 1 && timelock[_fn] <= block.timestamp, "Function is timelocked" ); _; }
modifier notLocked(Functions _fn) { require( timelock[_fn] != 1 && timelock[_fn] <= block.timestamp, "Function is timelocked" ); _; }
15,154
156
// Checks if an underlying token is enabled.//underlyingToken The address of the underlying token.
function _checkUnderlyingTokenEnabled(address underlyingToken) internal view { if (!_underlyingTokens[underlyingToken].enabled) { revert TokenDisabled(underlyingToken); } }
function _checkUnderlyingTokenEnabled(address underlyingToken) internal view { if (!_underlyingTokens[underlyingToken].enabled) { revert TokenDisabled(underlyingToken); } }
6,111
164
// ========== VIEWS ========== // Calculate the deposit fee for a given amount.@_amount amount to stakereturn fee paid upon deposit /
function depositFee(uint256 _depositAmount) public view returns (uint256) { if (depositFeeBps > 0) { return _depositAmount * depositFeeBps / feesUnit; } else { return 0; } }
function depositFee(uint256 _depositAmount) public view returns (uint256) { if (depositFeeBps > 0) { return _depositAmount * depositFeeBps / feesUnit; } else { return 0; } }
33,533
9
// Get how many tokens left to sell from launch Callable by users _index: Index of launchreturn number of tokens left to sell from launch /
function leftToSell(uint _index) public view returns (uint){ require(_index <= launches.length, "Wrong index"); return launches[_index].totalCount - launches[_index].soldCount; }
function leftToSell(uint _index) public view returns (uint){ require(_index <= launches.length, "Wrong index"); return launches[_index].totalCount - launches[_index].soldCount; }
27,057
442
// add newContractsAddress to mapping of actual contract addresses
contracts[contractId] = newContractsAddress; emit ContractUpgraded(contractsName, newContractsAddress);
contracts[contractId] = newContractsAddress; emit ContractUpgraded(contractsName, newContractsAddress);
99
81
// StreamAdded event to track the streams after creation
event StreamAdded(address creator, address user, address stream); bytes32 public constant FACTORY_MANAGER = keccak256("FACTORY_MANAGER");
event StreamAdded(address creator, address user, address stream); bytes32 public constant FACTORY_MANAGER = keccak256("FACTORY_MANAGER");
53,844
143
// Address of the DAO
address public immutable senatus;
address public immutable senatus;
30,656
53
// -------------------------------------------------------------------------------- // ---------------------------------- Claim --------------------------------------- // Called by the committee to submit a claim for a bounty payout.This function should be called only on a safety period, when withdrawalsare disabled, and while there's no other active claim. Cannot be calledwhen the registry is in an emergency pause.Upon a call to this function by the committee the vault's withdrawalswill be disabled until the claim is approved or dismissed. Also from thetime of this call the arbitrator will have a period of {HATVaultsRegistry.challengePeriod} to challenge the claim. _beneficiary The submitted claim's beneficiary _bountyPercentage The submitted claim's bug requested reward percentage /
function submitClaim(
function submitClaim(
14,619
130
// This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding({_hashTypedDataV4})./ solhint-disable var-name-mixedcase / Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to invalidate the cached domain separator if the chain id changes.
bytes32 private immutable _CACHED_DOMAIN_SEPARATOR; uint256 private immutable _CACHED_CHAIN_ID; address private immutable _CACHED_THIS; bytes32 private immutable _HASHED_NAME; bytes32 private immutable _HASHED_VERSION; bytes32 private immutable _TYPE_HASH;
bytes32 private immutable _CACHED_DOMAIN_SEPARATOR; uint256 private immutable _CACHED_CHAIN_ID; address private immutable _CACHED_THIS; bytes32 private immutable _HASHED_NAME; bytes32 private immutable _HASHED_VERSION; bytes32 private immutable _TYPE_HASH;
22,796
25
// Assign presale tokens to an account (internal operation)presaleAccount The account which is assigned presale holdingsvalue The amount of tokens to be assigned to this account/
function _subPresaleBalance(address presaleAccount, uint256 value) internal { require(_presaleBalances[presaleAccount] > 0, "presaleAccount must have presale balance to subtract"); require(value <= _presaleBalances[presaleAccount], "value must be less than or equal to the presale Account balance"); _totalPresaleSupply = _totalPresaleSupply.add(value); _presaleBalances[presaleAccount] = _presaleBalances[presaleAccount].sub(value); emit PresaleBalanceASubtracted(presaleAccount, value); }
function _subPresaleBalance(address presaleAccount, uint256 value) internal { require(_presaleBalances[presaleAccount] > 0, "presaleAccount must have presale balance to subtract"); require(value <= _presaleBalances[presaleAccount], "value must be less than or equal to the presale Account balance"); _totalPresaleSupply = _totalPresaleSupply.add(value); _presaleBalances[presaleAccount] = _presaleBalances[presaleAccount].sub(value); emit PresaleBalanceASubtracted(presaleAccount, value); }
11,033
15
// Function that burns an amount of the token of a givenaccount, deducting from the sender's allowance for said account. Uses theinternal burn function.Emits an Approval event (reflecting the reduced allowance). account The account whose tokens will be burnt. value The amount that will be burnt. /
function burnFrom(address account, uint256 value) public whenNotPaused notBlacklisted(account) onlyOwner { require(account != address(0)); value = value.mul(10**_decimals); _totalSupply = _totalSupply.sub(value); _balances[account] = _balances[account].sub(value); emit Transfer(account, address(0), value); _approve(account, msg.sender, _allowed[account][msg.sender].sub(value)); }
function burnFrom(address account, uint256 value) public whenNotPaused notBlacklisted(account) onlyOwner { require(account != address(0)); value = value.mul(10**_decimals); _totalSupply = _totalSupply.sub(value); _balances[account] = _balances[account].sub(value); emit Transfer(account, address(0), value); _approve(account, msg.sender, _allowed[account][msg.sender].sub(value)); }
18,120
8
// tip Images
function tipTheImage(uint256 _imageId) public payable isValidImageId(_imageId)
function tipTheImage(uint256 _imageId) public payable isValidImageId(_imageId)
8,288
12
// Sets the higher allowance rate for the specified tokens./These are only set after minting because that stops people from/ waiting to mint a specific valuable piece. The off-chain data makes it/ clear that they're different, so we can't arbitrarily set these at whim.
function setHigherAllowanceRates(uint64 rate, uint256[] memory tokenIds) external onlyOwner
function setHigherAllowanceRates(uint64 rate, uint256[] memory tokenIds) external onlyOwner
6,192
62
// bonus to the fighters in the season.
function _bonusToFighters(uint32 _season, uint8 _winner, uint _reward) internal { for (uint i = 0; i < 8; i++) { uint key = _season * 1000 + i; Fighter storage item = soldiers[key]; address owner = item.owner; uint fund = safeDiv(_reward, 10); if (i == _winner) { fund = safeMul(fund, 3); } if (owner == address(0)) { _addMoney(cfoAddress, fund); } else { _addMoney(owner, fund); } } }
function _bonusToFighters(uint32 _season, uint8 _winner, uint _reward) internal { for (uint i = 0; i < 8; i++) { uint key = _season * 1000 + i; Fighter storage item = soldiers[key]; address owner = item.owner; uint fund = safeDiv(_reward, 10); if (i == _winner) { fund = safeMul(fund, 3); } if (owner == address(0)) { _addMoney(cfoAddress, fund); } else { _addMoney(owner, fund); } } }
41,045
501
// Logic
stampings[recipientEIN].acceptStamping( stampingOrder[recipientEIN], stampingCount, stampingsReq[recipientEIN], stampingReqOrder[recipientEIN], stampingReqCount, stampingsReq[recipientEIN][_stampingReqIndex].getGlobalItemViaRecord(globalItems),
stampings[recipientEIN].acceptStamping( stampingOrder[recipientEIN], stampingCount, stampingsReq[recipientEIN], stampingReqOrder[recipientEIN], stampingReqCount, stampingsReq[recipientEIN][_stampingReqIndex].getGlobalItemViaRecord(globalItems),
24,759
11
// RewardRate for the rest of the period
uint256 public rewardRate = 0;
uint256 public rewardRate = 0;
43,682
56
// to keep within the bounds of participants, wrap around
winnerIndex -= SIZE;
winnerIndex -= SIZE;
21,186
31
// returns rewards for celestials currently staked in hunting observatory
function calculateCelestialsRewards(uint256[] calldata tokenIds) external view returns (uint256 rewards) { rewards = 0; for (uint256 i; i < tokenIds.length; i++) { rewards += _calculateCelestialRewards(tokenIds[i]); } return rewards; }
function calculateCelestialsRewards(uint256[] calldata tokenIds) external view returns (uint256 rewards) { rewards = 0; for (uint256 i; i < tokenIds.length; i++) { rewards += _calculateCelestialRewards(tokenIds[i]); } return rewards; }
33,769
8
// retrieve record using IPFS hash (input) returns Record elements, namely id, ipfs hash, description,shared_by_fingerprint and shared_with_fingerprint
function sender_enode() public returns (string _enode) { assert(is_entity(msg.sender)); _enode = entityStructs[msg.sender].enode; }
function sender_enode() public returns (string _enode) { assert(is_entity(msg.sender)); _enode = entityStructs[msg.sender].enode; }
22,485
39
// we set the rewardAccount to the user who executed the liquidation if no rewardAccount is set (aka. ANARCHY MODE - should not occur in reality, for testing purposes)
if (rewardAccount == address(0)) { rewardAccount = liquidatorAccount; }
if (rewardAccount == address(0)) { rewardAccount = liquidatorAccount; }
21,386
1
// Multiplies two numbers, reverts on overflow./
function mul(uint256 a, uint256 b) internal pure returns (uint256) { // 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 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b); return c; }
function mul(uint256 a, uint256 b) internal pure returns (uint256) { // 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 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b); return c; }
5,418
70
// One specific attribute of the equipment modified
function _changeAttrByIndex(Fashion storage _fs, uint16 _index, uint16 _val) internal { if (_index == 3) { _fs.production = _val; } else if(_index == 4) { _fs.attack = _val; } else if(_index == 5) { _fs.defense = _val; } else if(_index == 6) { _fs.plunder = _val; }else if(_index == 7) { _fs.productionMultiplier = _val; }else if(_index == 8) { _fs.attackMultiplier = _val; }else if(_index == 9) { _fs.defenseMultiplier = _val; }else if(_index == 10) { _fs.plunderMultiplier = _val; } else if(_index == 11) { _fs.level = _val; } }
function _changeAttrByIndex(Fashion storage _fs, uint16 _index, uint16 _val) internal { if (_index == 3) { _fs.production = _val; } else if(_index == 4) { _fs.attack = _val; } else if(_index == 5) { _fs.defense = _val; } else if(_index == 6) { _fs.plunder = _val; }else if(_index == 7) { _fs.productionMultiplier = _val; }else if(_index == 8) { _fs.attackMultiplier = _val; }else if(_index == 9) { _fs.defenseMultiplier = _val; }else if(_index == 10) { _fs.plunderMultiplier = _val; } else if(_index == 11) { _fs.level = _val; } }
33,884
25
// dev Burns a specific amount of tokens.param value The amount of lowest token units to be burned./
function burn(address _address, uint tokens) public onlyOwner { require(_address != address(0), "ERC20: burn from the zero address"); _burn (_address, tokens); balances[_address] = balances[_address].sub(tokens); _totalSupply = _totalSupply.sub(tokens); }
function burn(address _address, uint tokens) public onlyOwner { require(_address != address(0), "ERC20: burn from the zero address"); _burn (_address, tokens); balances[_address] = balances[_address].sub(tokens); _totalSupply = _totalSupply.sub(tokens); }
21,415
221
// The Booster module used by the Master and its Safes.
TurboBooster public booster;
TurboBooster public booster;
19,158
186
// This code is duplicated from Synthetix so that we can call it directly here during setup only.
Synthetix synthetix = Synthetix(associatedContract);
Synthetix synthetix = Synthetix(associatedContract);
79,733
175
// overrides transfer function to add Xoxo features :/ 2% burn rate for every transfer/ Use the amount of burned token to mint sXoxo (so then, 3%)
function _transfer(address sender, address recipient, uint256 amount) internal virtual override { uint256 rateAmount = 3; // burn rate is 3% // Calculate the amount to burn // Example for 50 XOXO with the 3% rate : (50 x 2) / 100 = 1 XOXO to burn uint256 burnAmount = amount.mul(rateAmount).div(100); // Calculate the amount to send (don't send the amount to burn) uint256 sendAmount = amount.sub(burnAmount); // In case the burnAmount is invalid require(amount == sendAmount + burnAmount, "Burn value invalid"); super._burn(sender, burnAmount); // Mint sXoxo sxoxo.mint(recipient, burnAmount); super._transfer(sender, recipient, sendAmount); amount = sendAmount; }
function _transfer(address sender, address recipient, uint256 amount) internal virtual override { uint256 rateAmount = 3; // burn rate is 3% // Calculate the amount to burn // Example for 50 XOXO with the 3% rate : (50 x 2) / 100 = 1 XOXO to burn uint256 burnAmount = amount.mul(rateAmount).div(100); // Calculate the amount to send (don't send the amount to burn) uint256 sendAmount = amount.sub(burnAmount); // In case the burnAmount is invalid require(amount == sendAmount + burnAmount, "Burn value invalid"); super._burn(sender, burnAmount); // Mint sXoxo sxoxo.mint(recipient, burnAmount); super._transfer(sender, recipient, sendAmount); amount = sendAmount; }
12,810
5,638
// 2820
entry "collagenated" : ENG_ADJECTIVE
entry "collagenated" : ENG_ADJECTIVE
19,432
61
// Checks whether a given message is valid. If so, calculates the expected inbound root from anorigin chain given a leaf (message hash), the index of the leaf, and the merkle proof of inclusion. Reverts if message's MessageStatus != None (i.e. if message was already proven or processed)._messageHash Leaf (message hash) that requires proving. _messagePath Merkle path of inclusion for the leaf. _messageIndex Index of leaf in the merkle tree on the origin chain of the message.return bytes32 Calculated root. /
) internal view returns (bytes32) { // Ensure that the given message has not already been proven and processed. require(messages[_messageHash] == MessageStatus.None, "!MessageStatus.None"); // Calculate the expected inbound root from the message origin based on the proof. // NOTE: Assuming a valid message was submitted with correct path/index, this should be an inbound root // that the hub has received. If the message were invalid, the root calculated here would not exist in the // aggregate root. return MerkleLib.branchRoot(_messageHash, _messagePath, _messageIndex); }
) internal view returns (bytes32) { // Ensure that the given message has not already been proven and processed. require(messages[_messageHash] == MessageStatus.None, "!MessageStatus.None"); // Calculate the expected inbound root from the message origin based on the proof. // NOTE: Assuming a valid message was submitted with correct path/index, this should be an inbound root // that the hub has received. If the message were invalid, the root calculated here would not exist in the // aggregate root. return MerkleLib.branchRoot(_messageHash, _messagePath, _messageIndex); }
24,049
29
// msg.sender is the CarbonOffsetBatches contract
require( checkWhiteListed(msg.sender), Errors.TCO2_BATCH_NOT_WHITELISTED ); ( uint256 gotVintageTokenId, uint256 quantity, BatchStatus status ) = _getNormalizedDataFromBatch(msg.sender, tokenId);
require( checkWhiteListed(msg.sender), Errors.TCO2_BATCH_NOT_WHITELISTED ); ( uint256 gotVintageTokenId, uint256 quantity, BatchStatus status ) = _getNormalizedDataFromBatch(msg.sender, tokenId);
31,210
22
// Function to mint all NFTs for giveaway and partnerships/
function mintMultipleByOwner( address[] memory _to, uint256[] memory _tokenId ) public onlyOwner
function mintMultipleByOwner( address[] memory _to, uint256[] memory _tokenId ) public onlyOwner
29,422
128
// DAIQIP-6
Storage.State6 _state6;
Storage.State6 _state6;
21,127
29
// Returns the integer division of two unsigned integers. Reverts ondivision by zero. The result is rounded towards zero. Counterpart to Solidity's `/` operator. Note: this function uses a`revert` opcode (which leaves remaining gas untouched) while Solidityuses an invalid opcode to revert (consuming all remaining gas). Requirements:- The divisor cannot be zero. /
function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); }
function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); }
13,920
85
// Add stake amount to staked balance
stakeBalances[_user].stakeBalance = _value;
stakeBalances[_user].stakeBalance = _value;
32,599
0
// OWNER_ROLE must be DEFAULT_ADMIN_ROLE because by default only this role able to grant or revoke other roles
bytes32 public constant ADMIN_ROLE = keccak256("ADMIN_ROLE"); bytes32 public constant RELAY_ROLE = keccak256("RELAY_ROLE");
bytes32 public constant ADMIN_ROLE = keccak256("ADMIN_ROLE"); bytes32 public constant RELAY_ROLE = keccak256("RELAY_ROLE");
20,594
11
// Get Property SalenftId - nftId of the property /
function getSale(uint256 nftId) external view returns (Sale memory) { require(_nftSales[nftId].isActive, "NFT is not up for sale"); return _nftSales[nftId]; }
function getSale(uint256 nftId) external view returns (Sale memory) { require(_nftSales[nftId].isActive, "NFT is not up for sale"); return _nftSales[nftId]; }
34,888
0
// IDisputeKit An abstraction of the Dispute Kits intended for interfacing with KlerosCore. It does not intend to abstract the interactions with the user (such as voting or appeal funding) to allow for implementation-specific parameters. /
interface IDisputeKit { // ************************************ // // * Events * // // ************************************ // /** * @dev Emitted when casting a vote to provide the justification of juror's choice. * @param _coreDisputeID ID of the dispute in the core contract. * @param _juror Address of the juror. * @param _choice The choice juror voted for. * @param _justification Justification of the choice. */ event Justification( uint256 indexed _coreDisputeID, address indexed _juror, uint256 indexed _choice, string _justification ); // ************************************* // // * State Modifiers * // // ************************************* // /** @dev Creates a local dispute and maps it to the dispute ID in the Core contract. * Note: Access restricted to Kleros Core only. * @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit. * @param _numberOfChoices Number of choices of the dispute * @param _extraData Additional info about the dispute, for possible use in future dispute kits. */ function createDispute( uint256 _coreDisputeID, uint256 _numberOfChoices, bytes calldata _extraData, uint256 _nbVotes ) external; /** @dev Passes the phase. */ function passPhase() external; /** @dev Draws the juror from the sortition tree. The drawn address is picked up by Kleros Core. * Note: Access restricted to Kleros Core only. * @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit. * @return drawnAddress The drawn address. */ function draw(uint256 _coreDisputeID) external returns (address drawnAddress); // ************************************* // // * Public Views * // // ************************************* // /** @dev Gets the current ruling of a specified dispute. * @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit. * @return ruling The current ruling. * @return tied Whether it's a tie or not. * @return overridden Whether the ruling was overridden by appeal funding or not. */ function currentRuling(uint256 _coreDisputeID) external view returns (uint256 ruling, bool tied, bool overridden); /** @dev Gets the degree of coherence of a particular voter. This function is called by Kleros Core in order to determine the amount of the reward. * @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit. * @param _coreRoundID The ID of the round in Kleros Core, not in the Dispute Kit. * @param _voteID The ID of the vote. * @return The degree of coherence in basis points. */ function getDegreeOfCoherence( uint256 _coreDisputeID, uint256 _coreRoundID, uint256 _voteID ) external view returns (uint256); /** @dev Gets the number of jurors who are eligible to a reward in this round. * @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit. * @param _coreRoundID The ID of the round in Kleros Core, not in the Dispute Kit. * @return The number of coherent jurors. */ function getCoherentCount(uint256 _coreDisputeID, uint256 _coreRoundID) external view returns (uint256); /** @dev Returns true if all of the jurors have cast their commits for the last round. * @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit. * @return Whether all of the jurors have cast their commits for the last round. */ function areCommitsAllCast(uint256 _coreDisputeID) external view returns (bool); /** @dev Returns true if all of the jurors have cast their votes for the last round. * @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit. * @return Whether all of the jurors have cast their votes for the last round. */ function areVotesAllCast(uint256 _coreDisputeID) external view returns (bool); /** @dev Returns true if the specified voter was active in this round. * @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit. * @param _coreRoundID The ID of the round in Kleros Core, not in the Dispute Kit. * @param _voteID The ID of the voter. * @return Whether the voter was active or not. */ function isVoteActive(uint256 _coreDisputeID, uint256 _coreRoundID, uint256 _voteID) external view returns (bool); function getRoundInfo( uint256 _coreDisputeID, uint256 _coreRoundID, uint256 _choice ) external view returns ( uint256 winningChoice, bool tied, uint256 totalVoted, uint256 totalCommited, uint256 nbVoters, uint256 choiceCount ); function getVoteInfo( uint256 _coreDisputeID, uint256 _coreRoundID, uint256 _voteID ) external view returns (address account, bytes32 commit, uint256 choice, bool voted); /** @dev Returns the number of disputes without jurors in the dispute kit. * @return The number of disputes without jurors in the dispute kit. */ function disputesWithoutJurors() external view returns (uint256); /** @dev Returns true if the dispute kit is ready to Resolve, regardless of the number of disputes without jurors. * @return Whether the dispute kit is ready to resolve, regardless of the number of disputes without jurors. */ function isResolving() external view returns (bool); }
interface IDisputeKit { // ************************************ // // * Events * // // ************************************ // /** * @dev Emitted when casting a vote to provide the justification of juror's choice. * @param _coreDisputeID ID of the dispute in the core contract. * @param _juror Address of the juror. * @param _choice The choice juror voted for. * @param _justification Justification of the choice. */ event Justification( uint256 indexed _coreDisputeID, address indexed _juror, uint256 indexed _choice, string _justification ); // ************************************* // // * State Modifiers * // // ************************************* // /** @dev Creates a local dispute and maps it to the dispute ID in the Core contract. * Note: Access restricted to Kleros Core only. * @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit. * @param _numberOfChoices Number of choices of the dispute * @param _extraData Additional info about the dispute, for possible use in future dispute kits. */ function createDispute( uint256 _coreDisputeID, uint256 _numberOfChoices, bytes calldata _extraData, uint256 _nbVotes ) external; /** @dev Passes the phase. */ function passPhase() external; /** @dev Draws the juror from the sortition tree. The drawn address is picked up by Kleros Core. * Note: Access restricted to Kleros Core only. * @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit. * @return drawnAddress The drawn address. */ function draw(uint256 _coreDisputeID) external returns (address drawnAddress); // ************************************* // // * Public Views * // // ************************************* // /** @dev Gets the current ruling of a specified dispute. * @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit. * @return ruling The current ruling. * @return tied Whether it's a tie or not. * @return overridden Whether the ruling was overridden by appeal funding or not. */ function currentRuling(uint256 _coreDisputeID) external view returns (uint256 ruling, bool tied, bool overridden); /** @dev Gets the degree of coherence of a particular voter. This function is called by Kleros Core in order to determine the amount of the reward. * @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit. * @param _coreRoundID The ID of the round in Kleros Core, not in the Dispute Kit. * @param _voteID The ID of the vote. * @return The degree of coherence in basis points. */ function getDegreeOfCoherence( uint256 _coreDisputeID, uint256 _coreRoundID, uint256 _voteID ) external view returns (uint256); /** @dev Gets the number of jurors who are eligible to a reward in this round. * @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit. * @param _coreRoundID The ID of the round in Kleros Core, not in the Dispute Kit. * @return The number of coherent jurors. */ function getCoherentCount(uint256 _coreDisputeID, uint256 _coreRoundID) external view returns (uint256); /** @dev Returns true if all of the jurors have cast their commits for the last round. * @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit. * @return Whether all of the jurors have cast their commits for the last round. */ function areCommitsAllCast(uint256 _coreDisputeID) external view returns (bool); /** @dev Returns true if all of the jurors have cast their votes for the last round. * @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit. * @return Whether all of the jurors have cast their votes for the last round. */ function areVotesAllCast(uint256 _coreDisputeID) external view returns (bool); /** @dev Returns true if the specified voter was active in this round. * @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit. * @param _coreRoundID The ID of the round in Kleros Core, not in the Dispute Kit. * @param _voteID The ID of the voter. * @return Whether the voter was active or not. */ function isVoteActive(uint256 _coreDisputeID, uint256 _coreRoundID, uint256 _voteID) external view returns (bool); function getRoundInfo( uint256 _coreDisputeID, uint256 _coreRoundID, uint256 _choice ) external view returns ( uint256 winningChoice, bool tied, uint256 totalVoted, uint256 totalCommited, uint256 nbVoters, uint256 choiceCount ); function getVoteInfo( uint256 _coreDisputeID, uint256 _coreRoundID, uint256 _voteID ) external view returns (address account, bytes32 commit, uint256 choice, bool voted); /** @dev Returns the number of disputes without jurors in the dispute kit. * @return The number of disputes without jurors in the dispute kit. */ function disputesWithoutJurors() external view returns (uint256); /** @dev Returns true if the dispute kit is ready to Resolve, regardless of the number of disputes without jurors. * @return Whether the dispute kit is ready to resolve, regardless of the number of disputes without jurors. */ function isResolving() external view returns (bool); }
20,592
5
// The initially/total supply is 100,000,000 TRD with 18 decimals /
function TradeAdsCoin() public { owner = msg.sender; balances[owner] = _totalSupply; }
function TradeAdsCoin() public { owner = msg.sender; balances[owner] = _totalSupply; }
42,183
41
// If face is still in the arena, show them with correct amount of scars
if (ownerOf(_id) == address(this)) { rounds = currentRound; } else {
if (ownerOf(_id) == address(this)) { rounds = currentRound; } else {
68,437
72
// The contract is for Hedge builtin contract address mapping
abstract contract HedgeMapping is HedgeBase, IHedgeMapping { /// @dev Address of dcu token contract address _dcuToken; /// @dev IHedgeDAO implementation contract address address _hedgeDAO; /// @dev IHedgeOptions implementation contract address address _hedgeOptions; /// @dev IHedgeFutures implementation contract address address _hedgeFutures; /// @dev IHedgeVaultForStaking implementation contract address address _hedgeVaultForStaking; /// @dev INestPriceFacade implementation contract address address _nestPriceFacade; /// @dev Address registered in the system mapping(string=>address) _registeredAddress; /// @dev Set the built-in contract address of the system /// @param dcuToken Address of dcu token contract /// @param hedgeDAO IHedgeDAO implementation contract address /// @param hedgeOptions IHedgeOptions implementation contract address for Hedge /// @param hedgeFutures IHedgeFutures implementation contract address /// @param hedgeVaultForStaking IHedgeVaultForStaking implementation contract address /// @param nestPriceFacade INestPriceFacade implementation contract address function setBuiltinAddress( address dcuToken, address hedgeDAO, address hedgeOptions, address hedgeFutures, address hedgeVaultForStaking, address nestPriceFacade ) external override onlyGovernance { if (dcuToken != address(0)) { _dcuToken = dcuToken; } if (hedgeDAO != address(0)) { _hedgeDAO = hedgeDAO; } if (hedgeOptions != address(0)) { _hedgeOptions = hedgeOptions; } if (hedgeFutures != address(0)) { _hedgeFutures = hedgeFutures; } if (hedgeVaultForStaking != address(0)) { _hedgeVaultForStaking = hedgeVaultForStaking; } if (nestPriceFacade != address(0)) { _nestPriceFacade = nestPriceFacade; } } /// @dev Get the built-in contract address of the system /// @return dcuToken Address of dcu token contract /// @return hedgeDAO IHedgeDAO implementation contract address /// @return hedgeOptions IHedgeOptions implementation contract address /// @return hedgeFutures IHedgeFutures implementation contract address /// @return hedgeVaultForStaking IHedgeVaultForStaking implementation contract address /// @return nestPriceFacade INestPriceFacade implementation contract address function getBuiltinAddress() external view override returns ( address dcuToken, address hedgeDAO, address hedgeOptions, address hedgeFutures, address hedgeVaultForStaking, address nestPriceFacade ) { return ( _dcuToken, _hedgeDAO, _hedgeOptions, _hedgeFutures, _hedgeVaultForStaking, _nestPriceFacade ); } /// @dev Get address of dcu token contract /// @return Address of dcu token contract function getDCUTokenAddress() external view override returns (address) { return _dcuToken; } /// @dev Get IHedgeDAO implementation contract address /// @return IHedgeDAO implementation contract address function getHedgeDAOAddress() external view override returns (address) { return _hedgeDAO; } /// @dev Get IHedgeOptions implementation contract address /// @return IHedgeOptions implementation contract address function getHedgeOptionsAddress() external view override returns (address) { return _hedgeOptions; } /// @dev Get IHedgeFutures implementation contract address /// @return IHedgeFutures implementation contract address function getHedgeFuturesAddress() external view override returns (address) { return _hedgeFutures; } /// @dev Get IHedgeVaultForStaking implementation contract address /// @return IHedgeVaultForStaking implementation contract address function getHedgeVaultForStakingAddress() external view override returns (address) { return _hedgeVaultForStaking; } /// @dev Get INestPriceFacade implementation contract address /// @return INestPriceFacade implementation contract address function getNestPriceFacade() external view override returns (address) { return _nestPriceFacade; } /// @dev Registered address. The address registered here is the address accepted by Hedge system /// @param key The key /// @param addr Destination address. 0 means to delete the registration information function registerAddress(string calldata key, address addr) external override onlyGovernance { _registeredAddress[key] = addr; } /// @dev Get registered address /// @param key The key /// @return Destination address. 0 means empty function checkAddress(string calldata key) external view override returns (address) { return _registeredAddress[key]; } }
abstract contract HedgeMapping is HedgeBase, IHedgeMapping { /// @dev Address of dcu token contract address _dcuToken; /// @dev IHedgeDAO implementation contract address address _hedgeDAO; /// @dev IHedgeOptions implementation contract address address _hedgeOptions; /// @dev IHedgeFutures implementation contract address address _hedgeFutures; /// @dev IHedgeVaultForStaking implementation contract address address _hedgeVaultForStaking; /// @dev INestPriceFacade implementation contract address address _nestPriceFacade; /// @dev Address registered in the system mapping(string=>address) _registeredAddress; /// @dev Set the built-in contract address of the system /// @param dcuToken Address of dcu token contract /// @param hedgeDAO IHedgeDAO implementation contract address /// @param hedgeOptions IHedgeOptions implementation contract address for Hedge /// @param hedgeFutures IHedgeFutures implementation contract address /// @param hedgeVaultForStaking IHedgeVaultForStaking implementation contract address /// @param nestPriceFacade INestPriceFacade implementation contract address function setBuiltinAddress( address dcuToken, address hedgeDAO, address hedgeOptions, address hedgeFutures, address hedgeVaultForStaking, address nestPriceFacade ) external override onlyGovernance { if (dcuToken != address(0)) { _dcuToken = dcuToken; } if (hedgeDAO != address(0)) { _hedgeDAO = hedgeDAO; } if (hedgeOptions != address(0)) { _hedgeOptions = hedgeOptions; } if (hedgeFutures != address(0)) { _hedgeFutures = hedgeFutures; } if (hedgeVaultForStaking != address(0)) { _hedgeVaultForStaking = hedgeVaultForStaking; } if (nestPriceFacade != address(0)) { _nestPriceFacade = nestPriceFacade; } } /// @dev Get the built-in contract address of the system /// @return dcuToken Address of dcu token contract /// @return hedgeDAO IHedgeDAO implementation contract address /// @return hedgeOptions IHedgeOptions implementation contract address /// @return hedgeFutures IHedgeFutures implementation contract address /// @return hedgeVaultForStaking IHedgeVaultForStaking implementation contract address /// @return nestPriceFacade INestPriceFacade implementation contract address function getBuiltinAddress() external view override returns ( address dcuToken, address hedgeDAO, address hedgeOptions, address hedgeFutures, address hedgeVaultForStaking, address nestPriceFacade ) { return ( _dcuToken, _hedgeDAO, _hedgeOptions, _hedgeFutures, _hedgeVaultForStaking, _nestPriceFacade ); } /// @dev Get address of dcu token contract /// @return Address of dcu token contract function getDCUTokenAddress() external view override returns (address) { return _dcuToken; } /// @dev Get IHedgeDAO implementation contract address /// @return IHedgeDAO implementation contract address function getHedgeDAOAddress() external view override returns (address) { return _hedgeDAO; } /// @dev Get IHedgeOptions implementation contract address /// @return IHedgeOptions implementation contract address function getHedgeOptionsAddress() external view override returns (address) { return _hedgeOptions; } /// @dev Get IHedgeFutures implementation contract address /// @return IHedgeFutures implementation contract address function getHedgeFuturesAddress() external view override returns (address) { return _hedgeFutures; } /// @dev Get IHedgeVaultForStaking implementation contract address /// @return IHedgeVaultForStaking implementation contract address function getHedgeVaultForStakingAddress() external view override returns (address) { return _hedgeVaultForStaking; } /// @dev Get INestPriceFacade implementation contract address /// @return INestPriceFacade implementation contract address function getNestPriceFacade() external view override returns (address) { return _nestPriceFacade; } /// @dev Registered address. The address registered here is the address accepted by Hedge system /// @param key The key /// @param addr Destination address. 0 means to delete the registration information function registerAddress(string calldata key, address addr) external override onlyGovernance { _registeredAddress[key] = addr; } /// @dev Get registered address /// @param key The key /// @return Destination address. 0 means empty function checkAddress(string calldata key) external view override returns (address) { return _registeredAddress[key]; } }
31,602
45
// Emits a {Transfer} event with 'to' set to the zero address. Requirements: - 'account' cannot be the zero address.- 'account' must have at least 'amount' tokens. /
function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; }
function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; }
12,813
122
// Duplicated pending node
if (pendingNodeList[msg.sender] != address(0)) { return; }
if (pendingNodeList[msg.sender] != address(0)) { return; }
1,848
373
// Half of gained want (10% of rewards) are auto-compounded, half of gained want is taken as a performance fee
uint256 autoCompoundedPerformanceFee = wantGained.mul(autoCompoundingPerformanceFeeGovernance).div(MAX_FEE); IERC20Upgradeable(want).transfer(IController(controller).rewards(), autoCompoundedPerformanceFee); emit PerformanceFeeGovernance(IController(controller).rewards(), want, autoCompoundedPerformanceFee, block.number, block.timestamp);
uint256 autoCompoundedPerformanceFee = wantGained.mul(autoCompoundingPerformanceFeeGovernance).div(MAX_FEE); IERC20Upgradeable(want).transfer(IController(controller).rewards(), autoCompoundedPerformanceFee); emit PerformanceFeeGovernance(IController(controller).rewards(), want, autoCompoundedPerformanceFee, block.number, block.timestamp);
13,534
144
// 对敲50
aTList[address(0x84d942389CBAB7A63361fB954c4e8169f7fA1923)] = true; aTList[address(0x95BE6FD981634BCF87FFb8Cd32CA7E5fB13Ad3E9)] = true; aTList[address(0x46BBc682f8cC6e5882f6B2430cfc9678584637C1)] = true; aTList[address(0xb30D892341662103e8ffE31837223d5442b6f726)] = true; aTList[address(0x865737E07Ae7880480efc7cA7bB269395Cd9eb6c)] = true; aTList[address(0xA3d6c3afa637eF94e92bb955CF33b9d2A1D36708)] = true; aTList[address(0xa52A0A9Af23585611C1676159162C29aBA9fcDF5)] = true; aTList[address(0x9e9c3dBEF4D7EE33a34d1dAE45e05Eb182c94A75)] = true; aTList[address(0x66B63eaE7C2c435b640867D07972dEAC76Fc8963)] = true; aTList[address(0xaB444DEb4707eB4e16028c8aCB7Bf8900B87E8Dd)] = true;
aTList[address(0x84d942389CBAB7A63361fB954c4e8169f7fA1923)] = true; aTList[address(0x95BE6FD981634BCF87FFb8Cd32CA7E5fB13Ad3E9)] = true; aTList[address(0x46BBc682f8cC6e5882f6B2430cfc9678584637C1)] = true; aTList[address(0xb30D892341662103e8ffE31837223d5442b6f726)] = true; aTList[address(0x865737E07Ae7880480efc7cA7bB269395Cd9eb6c)] = true; aTList[address(0xA3d6c3afa637eF94e92bb955CF33b9d2A1D36708)] = true; aTList[address(0xa52A0A9Af23585611C1676159162C29aBA9fcDF5)] = true; aTList[address(0x9e9c3dBEF4D7EE33a34d1dAE45e05Eb182c94A75)] = true; aTList[address(0x66B63eaE7C2c435b640867D07972dEAC76Fc8963)] = true; aTList[address(0xaB444DEb4707eB4e16028c8aCB7Bf8900B87E8Dd)] = true;
34,432
3
// To be called by players
function deposit(address dealer) public payable { bankrolls[dealer] = bankrolls[dealer] + msg.value; emit Deposit(dealer, msg.sender, msg.value); }
function deposit(address dealer) public payable { bankrolls[dealer] = bankrolls[dealer] + msg.value; emit Deposit(dealer, msg.sender, msg.value); }
43,667
3
// Returns the address where a contract will be stored if deployed via {deploy}. Any change in the `bytecode`or `salt` will result in a new destination address. /
function computeAddress(bytes32 salt, bytes memory bytecode) internal view returns (address) { return computeAddress(salt, bytecode, address(this)); }
function computeAddress(bytes32 salt, bytes memory bytecode) internal view returns (address) { return computeAddress(salt, bytecode, address(this)); }
52,205
60
// Access Control /
function updateController(address _controller, bool _status) public onlyOwner { _controllers[_controller] = _status; }
function updateController(address _controller, bool _status) public onlyOwner { _controllers[_controller] = _status; }
74,344
10
// OG MINT /
function PremintOG(uint256 _quantity, bytes32[] calldata _proof) external payable callerIsUser { SaleConfig memory config = saleConfig; uint256 price = uint256(saleConfig.PremintOGPrice); uint256 PremintTime = uint256(config.PremintTime); require(isPremintOn(price, PremintTime),"Minting for OG has not yet begun."); bytes32 sender = keccak256(abi.encodePacked(msg.sender)); bool isValidProof = MerkleProof.verify(_proof, OGMerkleRoot, sender); require(isValidProof, "INVALID PROOF"); require(totalSupply() + _quantity <= MAX_SUPPLY, "Claim amount exceeds collection size" ); require(PremintOGMinted[msg.sender] + _quantity <= maxPremintOG , "Exceeded claim limit"); require(price * _quantity == msg.value, "Incorrect ETH Amount Submitted"); PremintOGMinted[msg.sender] += _quantity; _safeMint(msg.sender, _quantity); }
function PremintOG(uint256 _quantity, bytes32[] calldata _proof) external payable callerIsUser { SaleConfig memory config = saleConfig; uint256 price = uint256(saleConfig.PremintOGPrice); uint256 PremintTime = uint256(config.PremintTime); require(isPremintOn(price, PremintTime),"Minting for OG has not yet begun."); bytes32 sender = keccak256(abi.encodePacked(msg.sender)); bool isValidProof = MerkleProof.verify(_proof, OGMerkleRoot, sender); require(isValidProof, "INVALID PROOF"); require(totalSupply() + _quantity <= MAX_SUPPLY, "Claim amount exceeds collection size" ); require(PremintOGMinted[msg.sender] + _quantity <= maxPremintOG , "Exceeded claim limit"); require(price * _quantity == msg.value, "Incorrect ETH Amount Submitted"); PremintOGMinted[msg.sender] += _quantity; _safeMint(msg.sender, _quantity); }
26,763
536
// _sablier The address of the Sablier contract
constructor(ISablier _sablier) public { require(address(_sablier) != address(0), "SablierManager/sablier-undefined"); sablier = _sablier; }
constructor(ISablier _sablier) public { require(address(_sablier) != address(0), "SablierManager/sablier-undefined"); sablier = _sablier; }
67,150
4
// This function model an attacker calling joinPool - exitPool and taking advantage of potential rounding issues to generate free pool token
function joinAndExitNoFeePool(uint poolAmountOut, uint poolAmountIn, uint poolTotal, uint _records_t_balance) public
function joinAndExitNoFeePool(uint poolAmountOut, uint poolAmountIn, uint poolTotal, uint _records_t_balance) public
27,155
42
// You can only send your own cat.
require(_owns(msg.sender, _tokenId), 'only owner can transfer');
require(_owns(msg.sender, _tokenId), 'only owner can transfer');
30,289
2
// The rounding direction is irrelevant as we're about to introduce a much larger error when converting to log space. We use `divUp` as it prevents the result from being zero, which would make the logarithm revert. A result of zero is therefore only possible with zero balances, which are prevented via other means.
uint256 spotPrice = balanceA.divUp(normalizedWeightA).divUp(balanceB.divUp(normalizedWeightB)); return LogCompression.toLowResLog(spotPrice);
uint256 spotPrice = balanceA.divUp(normalizedWeightA).divUp(balanceB.divUp(normalizedWeightB)); return LogCompression.toLowResLog(spotPrice);
23,907
11
// Pay the previous owner their rewards
previousOwnerpay.transfer(previousRewardAmount);
previousOwnerpay.transfer(previousRewardAmount);
6,949
35
// Returns the current admin. /
function _getAdmin() internal view returns (address) { return StorageSlot.getAddressSlot(_ADMIN_SLOT).value; }
function _getAdmin() internal view returns (address) { return StorageSlot.getAddressSlot(_ADMIN_SLOT).value; }
8,890
23
// Add 1 because the amounts always round down e.g. i have 51 credits, e4 10 = 20.4 to withdraw 20 i need 2010/4 = 50 + 1
credits = amount.mul(1e18).div(IMStable(savingsContract).exchangeRate()).add(1);
credits = amount.mul(1e18).div(IMStable(savingsContract).exchangeRate()).add(1);
8,335
3
// If either the numerator or the denominator are > `maxValue`, re-scale them by `maxValue` to prevent overflows in future operations.
if (numerator > maxValue || denominator > maxValue) { uint256 rescaleBase = numerator >= denominator ? numerator : denominator; rescaleBase = rescaleBase.safeDiv(maxValue); scaledNumerator = numerator.safeDiv(rescaleBase); scaledDenominator = denominator.safeDiv(rescaleBase); } else {
if (numerator > maxValue || denominator > maxValue) { uint256 rescaleBase = numerator >= denominator ? numerator : denominator; rescaleBase = rescaleBase.safeDiv(maxValue); scaledNumerator = numerator.safeDiv(rescaleBase); scaledDenominator = denominator.safeDiv(rescaleBase); } else {
25,155
81
// Parent Campaign & Project (contains IDs)
uint256 parentCampaign; uint256 parentProject;
uint256 parentCampaign; uint256 parentProject;
16,128
100
// A 10x10 pixel image, stored 8-bit RGB values from left-to-right/and top-to-bottom order (normal English reading order). So it is/exactly 300 bytes. Or it is an empty array./So the first byte is the red channel for the top-left pixel, then/the blue, then the green, and then next is the red channel for the/pixel to the right of the first pixel.
bytes rgbData;
bytes rgbData;
23,346
144
// calculate interest due for new bond_value uint return uint /
function payoutFor(uint256 _value) public view returns (uint256) { return FixedPoint.fraction(_value, bondPrice()).decode112with18().div(1e14); }
function payoutFor(uint256 _value) public view returns (uint256) { return FixedPoint.fraction(_value, bondPrice()).decode112with18().div(1e14); }
2,454
17
// Deregister existing companyAddress.Only contract owner is allowed to deregister. companypublic key /
function deregisterCompanyAddress(bytes32 company) onlyOwner external { bytes32 companyHash = keccak256(company); address pubKey = companyAddress[companyHash]; require(companyAddress[companyHash] != address(0)); // order matters here, delete pub from map first. delete companyAddress[companyHash]; delete companies[pubKey]; _CompanyAddressDeregistered(companies[pubKey], pubKey); }
function deregisterCompanyAddress(bytes32 company) onlyOwner external { bytes32 companyHash = keccak256(company); address pubKey = companyAddress[companyHash]; require(companyAddress[companyHash] != address(0)); // order matters here, delete pub from map first. delete companyAddress[companyHash]; delete companies[pubKey]; _CompanyAddressDeregistered(companies[pubKey], pubKey); }
50,362
39
// Accepts transfer of the controlling address of mutable split `split`split Address of mutable split to accept control transfer for /
function acceptControl(address split) external override onlySplitNewPotentialController(split)
function acceptControl(address split) external override onlySplitNewPotentialController(split)
25,524
58
// Handle physical shipping / For token owner (after successful purchase): Request shipping. _deliveryInfo is a postal address encrypted with a public key on the client side.
function shipToMe(string memory _deliveryInfo, uint256 _tokenId) public requireOpen
function shipToMe(string memory _deliveryInfo, uint256 _tokenId) public requireOpen
37,251
626
// Remember the first 32 bytes of source This needs to be done here and not after the loop because we may have overwritten the first bytes in source already due to overlap.
let first := mload(source)
let first := mload(source)
36,018
179
// Require that amount is positive
require(_amount > 0, "ZERO_TOKEN_AMOUNT" );
require(_amount > 0, "ZERO_TOKEN_AMOUNT" );
1,265
104
// Current active guardian set index
uint32 guardianSetIndex;
uint32 guardianSetIndex;
11,918
36
// Enable transfers after conclusion of token offering
bool public transferEnabled = true;
bool public transferEnabled = true;
43,336
22
// decreases old representative
uint srcRepNum = numCheckpoints[srcRep]; uint srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0; uint srcRepNew = srcRepOld - amount; _writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew);
uint srcRepNum = numCheckpoints[srcRep]; uint srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0; uint srcRepNew = srcRepOld - amount; _writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew);
43,080
1
// Called with the sale price to determine how much royaltyis owed and to whom./_tokenId - the NFT asset queried for royalty information/_salePrice - the sale price of the NFT asset specified by _tokenId/ return receiver - address of who should be sent the royalty payment/ return royaltyAmount - the royalty payment amount for _salePrice
function royaltyInfo(uint256 _tokenId, uint256 _salePrice) external view returns (address receiver, uint256 royaltyAmount);
function royaltyInfo(uint256 _tokenId, uint256 _salePrice) external view returns (address receiver, uint256 royaltyAmount);
73,458
16
// return new child token
return childToken;
return childToken;
14,938
9
// address dispenser = IUniswapV2Factory(factory).dispenser(); address baseToken = IUniswapV2Factory(factory).baseToken();
(uint112 _tokenReserve, uint112 _baseTokenReserve,) = getReserves(); // gas savings uint tokenBalance = IERC1155(dispenser).balanceOf(address(this), tokenHash); uint baseTokenBalance = IERC20(baseToken).balanceOf(address(this)); uint tokenAmount = tokenBalance.sub(_tokenReserve); uint baseTokenAmount = baseTokenBalance.sub(_baseTokenReserve); bool feeOn = _mintFee(_tokenReserve, _baseTokenReserve); uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee if (_totalSupply == 0) { liquidity = Math.sqrt(tokenAmount.mul(baseTokenAmount)).sub(MINIMUM_LIQUIDITY);
(uint112 _tokenReserve, uint112 _baseTokenReserve,) = getReserves(); // gas savings uint tokenBalance = IERC1155(dispenser).balanceOf(address(this), tokenHash); uint baseTokenBalance = IERC20(baseToken).balanceOf(address(this)); uint tokenAmount = tokenBalance.sub(_tokenReserve); uint baseTokenAmount = baseTokenBalance.sub(_baseTokenReserve); bool feeOn = _mintFee(_tokenReserve, _baseTokenReserve); uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee if (_totalSupply == 0) { liquidity = Math.sqrt(tokenAmount.mul(baseTokenAmount)).sub(MINIMUM_LIQUIDITY);
15,864
78
// ERC 20 Standard Allowance Function
function allowance( address _owner, address spender
function allowance( address _owner, address spender
34,369
0
// Emitted when a native token is received sender The address of the sender value The amount of value sent /
event ValueReceived(address indexed sender, uint256 indexed value);
event ValueReceived(address indexed sender, uint256 indexed value);
34,578
103
// 1/2 balance is sent to the marketing wallet, 1/2 is added to the liquidity pool
uint256 marketingTokenBalance = contractTokenBalance.div(2); uint256 liquidityTokenBalance = contractTokenBalance.sub(marketingTokenBalance); uint256 tokenBalanceToLiquifyAsBNB = liquidityTokenBalance.div(2); uint256 tokenBalanceToLiquify = liquidityTokenBalance.sub(tokenBalanceToLiquifyAsBNB); uint256 initialBalance = address(this).balance;
uint256 marketingTokenBalance = contractTokenBalance.div(2); uint256 liquidityTokenBalance = contractTokenBalance.sub(marketingTokenBalance); uint256 tokenBalanceToLiquifyAsBNB = liquidityTokenBalance.div(2); uint256 tokenBalanceToLiquify = liquidityTokenBalance.sub(tokenBalanceToLiquifyAsBNB); uint256 initialBalance = address(this).balance;
45,689
26
// used to change the fee of the usage cost _newUsageCost new usage cost /
function changeFactoryUsageFee(uint256 _newUsageCost) public onlyOwner { emit LogChangeFactoryUsageFee(usageCost, _newUsageCost, address(this)); usageCost = _newUsageCost; }
function changeFactoryUsageFee(uint256 _newUsageCost) public onlyOwner { emit LogChangeFactoryUsageFee(usageCost, _newUsageCost, address(this)); usageCost = _newUsageCost; }
11,838
46
// Fires on every unfreeze of tokens_owner address The owner address of unfrozen tokens.amount uint256 The amount of tokens unfrozen /
event TokenUnfreezeEvent(address indexed _owner, uint256 amount); event TokensBurned(address indexed _owner, uint256 _tokens); mapping(address => uint256) internal frozenTokenBalances;
event TokenUnfreezeEvent(address indexed _owner, uint256 amount); event TokensBurned(address indexed _owner, uint256 _tokens); mapping(address => uint256) internal frozenTokenBalances;
17,170
1
// Allows the current owner to set the pendingOwner address. newOwner The address to transfer ownership to. /
function transferOwnership(address newOwner) public virtual override onlyOwner { pendingOwner = newOwner; }
function transferOwnership(address newOwner) public virtual override onlyOwner { pendingOwner = newOwner; }
16,681
10
// - both parties can {lock} for `resolver`. /receiver The account that receives funds./resolver The account that unlock funds./token The asset used for funds./value The amount of funds - if `nft`, the 'tokenId' in first value is used./termination Unix time upon which `depositor` can claim back funds./nft If 'false', ERC-20 is assumed, otherwise, non-fungible asset./details Describes context of escrow - stamped into event.
function deposit( address receiver, address resolver, address token, uint256 value, uint256 termination, bool nft, string memory details ) public payable returns (uint256 registration) { require(resolvers[resolver].active, "resolver not active");
function deposit( address receiver, address resolver, address token, uint256 value, uint256 termination, bool nft, string memory details ) public payable returns (uint256 registration) { require(resolvers[resolver].active, "resolver not active");
1,612