Skip to content

fees and referral system#14

Merged
Junman140 merged 1 commit into
mainfrom
PIRC
Mar 19, 2026
Merged

fees and referral system#14
Junman140 merged 1 commit into
mainfrom
PIRC

Conversation

@Junman140

@Junman140 Junman140 commented Mar 19, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

Release Notes

  • New Features

    • Platform fee breakdown now visible across lending, liquidity, mint, and savings pages
    • New Referral Earnings card in rewards showing earned amounts, paid amounts, and payout eligibility status
  • UI/UX Improvements

    • Swap card displays separate pool and platform fee details
    • Streamlined rewards page with simplified navigation and cleaner card layout
    • Updated fee labels in lending for improved clarity

@coderabbitai

coderabbitai Bot commented Mar 19, 2026

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 21f442b2-b49f-48e3-b61b-46a2a199d54b

📥 Commits

Reviewing files that changed from the base of the PR and between 800b7ad and aecf468.

📒 Files selected for processing (9)
  • app/lending/page.tsx
  • app/liquidity/page.tsx
  • app/mint/page.tsx
  • app/profile/rewards/page.tsx
  • app/savings/page.tsx
  • components/fee-breakdown.tsx
  • components/swap/swap-card.tsx
  • lib/api/fees.ts
  • lib/api/rewards.ts

📝 Walkthrough

Walkthrough

This PR introduces a FeeBreakdown component for displaying platform fees and restructures fee handling across the application. The fee data model evolves from an untyped value field to a structured approach with feeType, baseValue, and optional bounds. Multiple pages (lending, liquidity, mint, savings) now fetch and conditionally display platform fees. The rewards API expands to include referral-related fields, and the rewards page displays a new "Referral Earnings" card.

Changes

Cohort / File(s) Summary
Fee Data Model
lib/api/fees.ts, lib/api/rewards.ts
Updated FeeConfig and related payloads to replace untyped value with structured feeType ("fixed" | "percentage" | "tiered"), baseValue, optional minValue/maxValue, and appliesTo. Extended RewardsSummary with referral-related fields (referralFeePiEarned, referralFeePiPaid, referralFeePiOwed) and payoutEligible.
Fee Display Component
components/fee-breakdown.tsx
New reusable component exporting FeeItem interface and FeeBreakdown function component for rendering styled fee breakdowns with optional title and mapped items.
Swap Integration
components/swap/swap-card.tsx
Refactored fee display from inline "Total Fee" row to separate FeeBreakdown section rendering "Pool fee" and "Platform fee" items with proper formatting.
Lending & Savings Pages
app/lending/page.tsx, app/savings/page.tsx
Integrated usePlatformFees() to fetch platform fees, derive payoutFee, and conditionally display "Platform payout fee" via FeeBreakdown formatted as percentage. Updated field labels in lending tabs.
Liquidity Page
app/liquidity/page.tsx
Integrated usePlatformFees() to fetch and derive addFee and removeFee, replacing static fee cards with conditional FeeBreakdown rendering in create-pool and withdraw dialogs.
Mint Page
app/mint/page.tsx
Integrated usePlatformFees() to fetch platform fees, derive mintFee, and conditionally render "Application fee" via FeeBreakdown in the Token Details card.
Rewards Page
app/profile/rewards/page.tsx
Added parsePi() helper function, replaced icon decorations with text navigation, and introduced "Referral Earnings (Pi)" card displaying earned/paid/owed amounts and conditional payout-eligibility alert.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • PR #11: Modifies rewards API and rewards page UI to extend referral and payout data, directly related through the new reward fields and UI components in this PR.

Poem

🐰 Fees flow like carrots through the code,
Platform pennies on each mode,
Breakdowns render, clean and bright,
Referrals sprout from payout's light!
Types bring order, structure true—
The warren thanks this work from you! 🥕✨

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch PIRC
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

You can enable review details to help with troubleshooting, context usage and more.

Enable the reviews.review_details setting to include review details such as the model used, the time taken for each step and more in the review comments.

@Junman140 Junman140 merged commit 0eee1eb into main Mar 19, 2026
1 of 2 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request Mar 19, 2026
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.

1 participant