You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Set baseFee based on contract type,
ERC721 based NFTs have a 0.0008 ETH baseFee while ERC1155 based NFTs' baseFee are 0.0004 ETH.
These prices are consistent across mainnet and most L2s (except Polygon, etc.).
More info here.
PR Type
Enhancement
Description
Implemented dynamic base fee calculation for Highlight NFT minting:
ERC721 NFTs: 0.0008 ETH base fee
ERC1155 NFTs: 0.0004 ETH base fee
Added contract standard information to collection metadata queries
Updated type definitions to support contract standard identification
Enhanced price calculation logic to consider NFT contract type
Changes walkthrough 📝
Relevant files
Enhancement
index.ts
Add contract standard parameter to price calculation
src/ingestors/highlight/index.ts
Updated getHighlightMintPriceInWei function call to include contract standard parameter
The function accepts 'ERC721' | 'ERC1155' as parameter but uses string comparison without proper type validation. Consider using an enum or type guard to ensure type safety.
The code uses optional chaining for collection.standard but falls back to collection.contractKind without validating if it exists. This could lead to undefined being passed to the function.
Qodo Merge was enabled for this repository. To continue using it, please link your Git account with your Qodo account here.
PR Code Suggestions ✨
Explore these optional code suggestions:
Category
Suggestion
Score
Possible issue
Add input validation to prevent runtime errors from invalid contract standard values
Add input validation for the 'standard' parameter to handle undefined or invalid values, as the function assumes it will always be either 'ERC721' or 'ERC1155'.
Why: The suggestion addresses a potential runtime error by validating the 'standard' parameter, which is critical for determining the correct fee. Without validation, invalid values could lead to incorrect fee calculations or runtime errors.
8
Improve null value handling to prevent undefined being passed as a parameter
Add null coalescing operator to handle potential undefined values when accessing collection.standard or collection.contractKind.
Why: The suggestion improves robustness by using the null coalescing operator to handle potential undefined values, preventing runtime errors and providing a default fallback value of 'ERC721'.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
User description
Fix Highlight ingestor
Set baseFee based on contract type,
ERC721 based NFTs have a 0.0008 ETH baseFee while ERC1155 based NFTs' baseFee are 0.0004 ETH.
These prices are consistent across mainnet and most L2s (except Polygon, etc.).
More info here.
PR Type
Enhancement
Description
Changes walkthrough 📝
index.ts
Add contract standard parameter to price calculationsrc/ingestors/highlight/index.ts
getHighlightMintPriceInWeifunction call to include contractstandard parameter
offchain-metadata.ts
Add standard field to collection metadata querysrc/ingestors/highlight/offchain-metadata.ts
standardfield to GraphQL query for collection metadataonchain-metadata.ts
Implement dynamic base fee calculation by contract typesrc/ingestors/highlight/onchain-metadata.ts
getHighlightMintPriceInWeito accept contract standardparameter
(ERC721/ERC1155)
types.ts
Add contract type definitions for collectionssrc/ingestors/highlight/types.ts
contractKindandstandardtype definitions toCollectionByAddress1interface