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

Feat/fees refund #121

Merged
merged 10 commits into from
Mar 7, 2025
Merged

Feat/fees refund #121

merged 10 commits into from
Mar 7, 2025

Conversation

juangirini
Copy link
Contributor

@juangirini juangirini commented Feb 25, 2025

Feat/fees refund

closes #104
closes #107

This pull request implements the fees refund feature and introduces several enhancements and fixes to the subscription management system. The key changes are as follows:

Summary

  • Implements fee refund calculations and handling.
  • Enhances subscription management with new events and improved error handling.
  • Refactors fee calculation logic to support tiered and linear calculations.
  • Adds comprehensive tests for new features and edge cases.

Description

New Features and Enhancements

  1. Fees Management Improvements:

    • Introduced BalanceDirection and DiffBalance structs to represent and handle balance movements.
    • Updated the FeesManager trait to include methods for calculating fee differences (calculate_diff_fees) and collecting fees with references (collect_fees).
  2. Subscription Management Enhancements:

    • Updated subscription creation, updating, and removal processes to handle fee and deposit differences.
    • Added methods to manage and calculate storage deposits (calculate_diff_deposit).
    • Improved the event system to emit detailed subscription-related events such as FeesCollected and SubscriptionRemoved.
  3. Fee Calculation Logic:

    • Implemented tiered fee calculation with predefined discount tiers.
    • Enhanced linear fee calculator to handle fee differences.
  4. Testing Enhancements:

    • Added comprehensive tests for fee calculations, fee collection, subscription updates, and edge cases like insufficient balance.
    • Improved mock setup to better simulate real scenarios.
  5. Code Refactoring:

    • Refactored existing code for better readability and maintainability.
    • Consolidated common logic and improved error handling.

Base automatically changed from feat/fees-collection to main February 26, 2025 16:54
@juangirini juangirini marked this pull request as ready for review March 4, 2025 12:14
@juangirini juangirini requested review from driemworks, colemanirby and carloskiron and removed request for driemworks March 4, 2025 12:15
Copy link
Contributor

@driemworks driemworks left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

@carloskiron carloskiron left a comment

Choose a reason for hiding this comment

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

@juangirini looks good to me. Coming along nicely, only left a comment related to a nice to have comments on the implementation of fees calculation and associated functions.

Copy link
Contributor

@colemanirby colemanirby left a comment

Choose a reason for hiding this comment

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

LGTM

@juangirini juangirini merged commit 272fbf1 into main Mar 7, 2025
1 check passed
@juangirini juangirini deleted the feat/fees-refund branch March 7, 2025 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants