Skip to content

[FEATURE] Add on-chain fee treasury contract: platform fees not collected on-chain #18

Description

@derbydaniels9-cpu

Summary

There is no fee collection contract. The backend charges a 1.5% fee on crypto trades and a 10% penalty on early savings withdrawal, but these fees are only tracked in the database — they are not collected into a verifiable on-chain treasury address.

Impact

  • Platform revenue is unverifiable — no on-chain proof of fee collection.
  • Fees stored only in the DB can be altered or hidden.
  • No transparent fee distribution to stakeholders or protocol treasury.

Proposed contract

A Soroban fee treasury contract that:

  1. Receives fee payments from the swap and savings contracts.
  2. Tracks cumulative fees by type (trade fee, withdrawal penalty, etc.).
  3. Allows the multisig admin to withdraw accumulated fees to a designated treasury wallet.
  4. Emits events for every fee collection for full auditability.
pub trait FeeTreasury {
    fn collect_fee(env: Env, fee_type: Symbol, amount: i128, from: Address);
    fn withdraw(env: Env, admin: Address, amount: i128, to: Address);
    fn get_balance(env: Env) -> i128;
    fn get_fees_by_type(env: Env, fee_type: Symbol) -> i128;
}

Files affected:

  • New: src/fee_treasury/lib.rs
  • New: src/fee_treasury/Cargo.toml

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions