Skip to content

Implement Platform Revenue (Service Fee) #31

Open

Description

@Bosun-Josh121

Target Contract: payment-vault-contract
Labels: phase-1-vault, business-logic

Description: Extract a percentage-based fee (in Basis Points, where 10000 = 100%) on successful sessions to generate platform revenue. This fee must be deducted from the expert's gross pay, not the user's refund.

Tasks:

  • src/error.rs: Add FeeTooHigh = 11.
  • src/storage.rs: Add DataKey::FeeBps and DataKey::Treasury. Add setters/getters.
  • src/contract.rs: Implement set_fee(env, new_fee_bps) (cap at 2000 BPS) and set_treasury(env, treasury). Require admin.require_auth(). In finalize_session, calculate fee = (expert_pay * fee_bps) / 10000. Transfer fee to Treasury and expert_pay - fee to Expert.
  • src/lib.rs: Inside #[contractimpl], expose pub fn set_fee(env: Env, new_fee_bps: u32) -> Result<(), VaultError> and pub fn set_treasury(env: Env, treasury: Address) -> Result<(), VaultError>.
  • src/events.rs: Update session_finalized to emit fee_amount.
  • src/test.rs: Mock a 10% fee. Assert treasury, expert, and user receive exact expected token amounts.

Acceptance Criteria:

  • Contract correctly calculates fractional fees using BPS.
  • Admin cannot raise fee above 20%.

Activity

  1. clintjeff2 commented on Mar 23, 2026

    @clintjeff2

    @clintjeff2 has applied to work on this issue as part of the Stellar Wave Program's 3rd wave.

    Hello, I have 6 years of experience working on tasks like this and handling similar challenges across backend, frontend, and smart-contract development. I have carefully read and fully understood the task requirements, and I am confident I can deliver a clean, efficient, and well-tested solution promptly. I always ensure high-quality implementation, maintainability, and adherence to best practices.

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @clintjeff2 to this issue.

  2. drips-wave commented on Mar 23, 2026

    @drips-wave

    This issue has been added to the Stellar Wave Program and is worth 200 Points.

    🧑‍💻 Interested in contributing? Apply to work on this issue on Drips Wave, earn points, and receive rewards.

    Warning

    Only applications submitted via the apply link above will be considered. Please do not apply by commenting on the issue or opening a PR directly.

    🤠 Repo maintainers: You can manage this issue's Points and Complexity on your Maintainer Dashboard here. Please keep an eye on applications and respond quickly 💙

    ℹ️ Learn more about Drips Wave

  3. Amas-01 commented on Mar 23, 2026

    @Amas-01

    @Amas-01 has applied to work on this issue as part of the Stellar Wave Program's 3rd wave.

    Hello Maintainer, I'll love to work on this Issue

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @Amas-01 to this issue.

  4. gidson5 commented on Mar 23, 2026

    @gidson5

    @gidson5 has applied to work on this issue as part of the Stellar Wave Program's 3rd wave.

    i'd like to work on this issue. ETA 1day

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @gidson5 to this issue.

  5. deleted a comment from Mosas2000 on Mar 23, 2026
  6. Edoscoba commented on Mar 23, 2026

    @Edoscoba

    @Edoscoba has applied to work on this issue as part of the Stellar Wave Program's 3rd wave.

    Can I work on this issue?

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @Edoscoba to this issue.

  7. drips-wave commented on Mar 24, 2026

    @drips-wave

    Congratulations, @clintjeff2! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on March 30, 2026.

    🧑‍💻 @clintjeff2: Please resolve the issue such that the repo's maintainers have enough time to review your contribution before the due date. You'll earn Points for completing the issue on-time, which will make you eligible for a share of the Stellar Wave Program's reward pool.

    Warning

    When opening a PR, please link it to this issue to ensure it gets tracked accurately. Points are awarded when this issue is marked as completed by the maintainer.

    🤠 Repo maintainers: Please keep an eye on the contributor's progress and review their work before the due date. You can manage this issue, including adjusting its complexity and points, here.

    🌊 Happy Wave 🌊

  8. deleted a comment from Itodo-S on Mar 24, 2026
  9. deleted a comment from Mac-5 on Mar 24, 2026
  10. deleted a comment from teethaking on Mar 24, 2026
  11. added a commit that references this issue on Mar 25, 2026
  12. drips-wave commented on Apr 1, 2026

    @drips-wave

    This issue has been marked as completed by a Drips Wave moderator for @clintjeff2 as part of the Stellar Wave Program's 3rd Wave 🥳

    Moderator's reason: [Auto-assessed] The contributor completed all the specific tasks listed in the issue description in PR #50 for the LightForgeHub/SkillSphere-Contracts repository, including the implementation of fee logic, admin constraints, and necessary storage updates. The PR has been open for seven days with no objections from maintainers, and the contributor has demonstrated effort by addressing automated review findings.

    😎 @clintjeff2: You earned 200 Points for completing this issue! After the current Wave ends, you'll be eligible for a percentage of the Wave's reward pool based on the percentage of total points you've earned. Learn more here.

    🧑‍💻 Repo maintainers: How'd the contributor do? Leave a review to share your experience working with them.

    ℹ️ Note: This issue was marked complete via moderation. Points were issued even though the GitHub issue remains open.

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions