Skip to content

AMM: Implement fee system - Trading Fees For LPs #19

@3esmit

Description

@3esmit

Scope

  • Apply the fee only in swap pricing, not by changing the transferred input amount.
  • Leave the fee amount in the vault as surplus above tracked reserves.
  • Continue distributing vault balances proportionally on liquidity removal so accrued fees are claimable by LPs.
  • Update liquidity-add math to use live vault balances when surplus exists so newly added LPs do not receive a share of fees earned before they joined.

Acceptance Criteria

  • Repeated swaps accumulate measurable fee surplus in the vaults.
  • Removing liquidity pays out a proportional share of the accrued surplus.
  • Adding liquidity after fee accrual does not dilute previously earned LP fees.
  • Unit and integration coverage proves multi-swap fee accumulation and post-fee

Implement trading fee accumulation so that liquidity providers earn a portion of each swap based on the pool's configured fee tier.
Fees accumulate as surplus in the pool vaults above the tracked reserves and are distributed to LPs proportionally when they remove liquidity.

Dependency

Depends on #15

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions