Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PLA-2010] v2.0.0 API Updates #100

Closed
wants to merge 4 commits into from

Conversation

v16Studios
Copy link
Contributor

@v16Studios v16Studios commented Sep 23, 2024

PR Type

Enhancement, Tests


Description

  • Updated the token mint cap type logic across the codebase, replacing SINGLE_MINT and INFINITE with COLLAPSING_SUPPLY.
  • Modified SQL query conditions to reflect the new token cap type.
  • Adjusted tests to accommodate the changes in token cap type logic.
  • Removed references to TokenMintCapType in test data preparation.

Changes walkthrough 📝

Relevant files
Enhancement
BatchProcess.php
Update token mint cap type logic in batch processing         

src/Commands/BatchProcess.php

  • Updated token mint cap type logic.
  • Replaced SINGLE_MINT and INFINITE with COLLAPSING_SUPPLY.
  • Adjusted cap amount logic for single mint scenarios.
  • +2/-2     
    TokensDoNotExistInBeam.php
    Modify token cap type in SQL query conditions                       

    src/Rules/TokensDoNotExistInBeam.php

  • Changed token cap type from SINGLE_MINT to COLLAPSING_SUPPLY.
  • Updated SQL query conditions for token cap checks.
  • +1/-1     
    Tests
    UpdateBeamTest.php
    Update test for token cap type change                                       

    tests/Feature/GraphQL/Mutations/UpdateBeamTest.php

    • Updated test to use COLLAPSING_SUPPLY instead of SINGLE_MINT.
    +1/-1     
    CreateCollectionData.php
    Remove TokenMintCapType and set cap to null in tests         

    tests/Feature/Traits/CreateCollectionData.php

  • Removed TokenMintCapType usage.
  • Set token cap to null in test data preparation.
  • +1/-2     

    💡 PR-Agent usage: Comment /help "your question" on any pull request to receive relevant information

    Copy link

    PR Reviewer Guide 🔍

    ⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
    🧪 PR contains tests
    🔒 No security concerns identified
    ⚡ Key issues to review

    Possible Bug
    The conditional logic for setting 'type' and 'amount' under 'cap' might not handle all edge cases correctly, especially when neither condition is true. Consider adding an else case to handle unexpected scenarios.

    Code Consistency
    The SQL condition added for 'COLLAPSING_SUPPLY' should be reviewed to ensure it aligns with the intended logic changes and consistency across similar conditions.

    Copy link

    github-actions bot commented Sep 23, 2024

    PR Code Suggestions ✨

    CategorySuggestion                                                                                                                                    Score
    Possible bug
    Add null checks for $claim->collection to prevent null reference exceptions

    Consider handling the case where $claim->collection might be null before accessing
    the force_single_mint property to avoid potential null reference exceptions.

    src/Commands/BatchProcess.php [193-194]

    -'type' => $claim->quantity == 1 || $claim->collection?->force_single_mint ? TokenMintCapType::COLLAPSING_SUPPLY->name : null,
    -'amount' => $claim->collection?->force_single_mint ? 1 : null,
    +'type' => $claim->quantity == 1 || ($claim->collection && $claim->collection->force_single_mint) ? TokenMintCapType::COLLAPSING_SUPPLY->name : null,
    +'amount' => $claim->collection && $claim->collection->force_single_mint ? 1 : null,
     
    Suggestion importance[1-10]: 3

    Why: The suggestion correctly identifies a potential null reference issue, but the existing code already uses the null-safe operator (?->), which handles null references. Therefore, the improvement is minor and not crucial.

    3

    'type' => $claim->quantity == 1 || $claim->collection?->force_single_mint ? TokenMintCapType::SINGLE_MINT->name : TokenMintCapType::INFINITE->name,
    'amount' => null,
    'type' => $claim->quantity == 1 || $claim->collection?->force_single_mint ? TokenMintCapType::COLLAPSING_SUPPLY->name : null,
    'amount' => $claim->collection?->force_single_mint ? 1 : null,
    Copy link
    Contributor

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    This was changed to force_collapsing_supply

    @v16Studios v16Studios closed this Oct 12, 2024
    @v16Studios
    Copy link
    Contributor Author

    Closed in favour of #106

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Development

    Successfully merging this pull request may close these issues.

    2 participants