Skip to content

feat: change fee model to one that cannot be gamed #74

Open
@fplord

Description

2 parameters maxLiquidityRemaining zeroLiquidityRemaining
if your swap leaves max liquidity remaining in the pool, you pay maxLiquidityRemaining% fees. If your swap leaves no liquidity remaining in the pool, you pay zeroLiquidityRemaining% fees

current fee model incentivises splitting up into smaller swaps so as to not incur higher fees: see the difference in fees paid (red rectangles' area) when you split unstake into two swaps versus doing it in one big swap

image

suggest changing this to the following:

  • let the amount requested be amountRequested
  • calculate feeAtCurrentLiquidity (linear interpolation between max and zero)
  • calculate feeAtCompletedLiquidity (fee that will be charged after this swap, again, linear interpolation)

total fee charged as follows:

amountRequested * feeAtCurrentLiquidity + 1/2 * amountRequested * (feeAtCompletedLiquidity - feeAtCurrentLiquidity)

image

Compared to the current fee model, this fee model means that you cannot get a lower fee by splitting up your swap into smaller swaps

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions