Skip to content

Conversation

@giuseppecrj
Copy link
Contributor

@giuseppecrj giuseppecrj commented Oct 6, 2025

Description

This PR refactors the membership pricing and fee calculation logic to improve clarity and consistency. It simplifies how protocol fees are calculated and ensures proper payment distribution between protocol fees and space owner proceeds.

Changes

  • Removed Membership__PriceTooLow error as it's no longer needed
  • Added _getTotalMembershipPayment() to calculate total payment required (base price + protocol fee)
  • Improved protocol fee calculation to always take the maximum of percentage-based fee or base fee
  • Updated renewal process to properly handle fee distribution
  • Fixed payment distribution in membership renewal to correctly separate protocol fees from owner proceeds
  • Updated public methods to return total required payment including fees
  • Simplified price validation by removing redundant checks

Checklist

  • Tests added where required
  • Documentation updated where applicable
  • Changes adhere to the repository's contribution guidelines

@vercel
Copy link

vercel bot commented Oct 6, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
river-sample-app Ready Ready Preview Comment Oct 9, 2025 9:22pm

@giuseppecrj giuseppecrj changed the title Refactor membership pricing logic in MembershipBase and MembershipFacet. Removed redundant price verification and updated functions to calculate total membership payment, enhancing clarity and consistency in pricing calculations. refactor: improve membership pricing and protocol fee calculation Oct 6, 2025
Copy link
Contributor Author

giuseppecrj commented Oct 6, 2025

@giuseppecrj giuseppecrj marked this pull request as ready for review October 6, 2025 21:43
@giuseppecrj giuseppecrj force-pushed the g/10-06-refactor_membership_pricing branch from c15dac5 to 01b3daa Compare October 7, 2025 17:43
@giuseppecrj giuseppecrj force-pushed the g/10-06-membership_small_refactors branch from 57d042b to b6cb8ef Compare October 7, 2025 17:43
@giuseppecrj giuseppecrj changed the base branch from g/10-06-membership_small_refactors to graphite-base/4265 October 8, 2025 17:30
@giuseppecrj giuseppecrj force-pushed the g/10-06-refactor_membership_pricing branch from 1e8b8ad to bab6c1c Compare October 8, 2025 17:44
@giuseppecrj giuseppecrj changed the base branch from graphite-base/4265 to g/10-06-membership_small_refactors October 8, 2025 17:45
Copy link
Contributor

@shuhuiluo shuhuiluo left a comment

Choose a reason for hiding this comment

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

Lgtm.

@giuseppecrj giuseppecrj force-pushed the g/10-06-refactor_membership_pricing branch from b32ca60 to e87d7fb Compare October 8, 2025 19:47
@giuseppecrj giuseppecrj force-pushed the g/10-06-membership_small_refactors branch from 15713c4 to d7e7672 Compare October 8, 2025 19:47
@giuseppecrj giuseppecrj changed the base branch from g/10-06-membership_small_refactors to graphite-base/4265 October 9, 2025 15:43
@giuseppecrj giuseppecrj changed the base branch from graphite-base/4265 to g/10-06-membership_small_refactors October 9, 2025 15:45
@giuseppecrj giuseppecrj force-pushed the g/10-06-refactor_membership_pricing branch from 648d596 to 3fc2fef Compare October 9, 2025 15:48
…ble naming for layout storage. Update MembershipJoin to streamline join details assignment and improve readability. This enhances code clarity and maintains adherence to coding standards.
… conditional checks and improve code clarity.
…et. Removed redundant price verification and updated functions to calculate total membership payment, enhancing clarity and consistency in pricing calculations.
…ip pricing. Updated join functions to calculate total payment based on current membership price, enhancing consistency across membership transactions and improving code clarity.
### Description

Added protocol fee to the `getJoinSpacePriceDetails` method to properly
account for the total cost when joining a space.

### Changes

- Added `protocolFee` property to the return type of
`getJoinSpacePriceDetails`
- Updated the method to fetch protocol fee data via multicall
- Modified the method to decode and return the protocol fee value
- Updated tests to verify that the price includes the protocol fee

### Checklist

- [x] Tests added where required
- [x] Documentation updated where applicable
- [x] Changes adhere to the repository's contribution guidelines
### Description

Refactored the `SubscriptionModuleTest` to utilize the `SubscriptionParams` structure for renewal price assertions, enhancing clarity and consistency in test logic.

### Changes

- Updated the `_createSubscription` call to return `SubscriptionParams`.
- Modified assertions to use `params.renewalPrice` instead of hardcoded values.

### Checklist

- [x] Tests updated to reflect changes
- [x] Changes adhere to the repository's contribution guidelines
@giuseppecrj giuseppecrj force-pushed the g/10-06-membership_small_refactors branch from 4cd4719 to e0ad3f1 Compare October 9, 2025 21:17
@giuseppecrj giuseppecrj force-pushed the g/10-06-refactor_membership_pricing branch from 3fc2fef to 6baf394 Compare October 9, 2025 21:17
Base automatically changed from g/10-06-membership_small_refactors to main October 13, 2025 21:58
@giuseppecrj giuseppecrj changed the title refactor: improve membership pricing and protocol fee calculation refactor: update membership pricing to have fee added on top of price Oct 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants