Parametric Swap Fees and Dynamic Swap Fees

Potential updates not currently in scope:

  • Variable length epochs
  • Varying max swap fee based on TVL

Parametric Swap Fees

Premise: Swappers are currently charged a static swap fee for every single swap (and charged that fee twice when they execute a TKN1:Rowan:TKN2 double swap)

Problem: Currently, it's not possible to update this fee without a formal on-chain governance proposal

Solution: Enabling a parametric swap fee would let the variable be updated more quickly to address the market's rapid updates

Applying the parametric swap fee

This parametric swap fee will be used to facilitate the dynamic swap fee below, which is a response to the rate at which Rowan is sold. Thus, we should charge this fee based on when Rowan is sold. It is not necessary to implement the parametric swap fee on the sale of non-Rowan tokens at this time.

Examples

Consider default_swap_fee which is applied whenever a swap occurs at present. Consider rowan_swap_fee to be a new fee that is charged whenever Rowan is sold in a single swap. We would NOT want the fee to be applied when Rowan was sold in the middle of a double swap. We likewise would NOT want the fee to be applied when Rowan was purchased in a single swap. Examples below:

Rowan -> TKN Single Swap: rowan_swap_fee
TKN -> Rowan -> TKN Double Swap: default_swap_fee x 2
TKN -> Rowan Sale Single Swap: default_swap_fee

Dynamic Swap Fees

Premise: Dex Liquidity Protection and Liquidity Provider Distribution enable a purchasing power increase for Rowan on Sifchain

Problem: Excessive sales of Rowan on other exchanges can lead to price discrepancies that may confuddle arbitrageurs

Solution: Dynamic swap fees empower the arbitrageur community to keep a more constant price of Rowan across exchanges and share arbitrage profits with poolers, giving poolers additional yield from swap fees

Swap Fee Changing Over Time

This feature is simply about varying rowan_swap_fee over time such that it starts at a high value and drops over time. We can use an "epoch" structure similar to LPD and Ratio Shifting to decide how frequently a cycle of fee dropping occurs. Note that default_swap_fee does not vary over time here. Consider the following psuedocode:

    while (true){
        rowan_swap_fee = max_swap_fee
        while (epoch_not_over?(epoch)){
            intra_epoch_timer.reset(n.minutes)
            while (timer_not_over?(intra_epoch_timer)){
                if (swap_occured_in_last_n_minutes?(ROWAN)){
                    intra_epoch_timer.reset(n.minutes)
                }
            }
            reduce_swap_fee(rowan_swap_fee, sf_increment)
        }
    }

Within an epoch, we wait for the duration of thetimer to see if swappers are willing to swap Rowan at rowan_swap_fee. If so, we reset the timer to wait here longer and let other swaps occur. If the timer expires with no swaps occuring, we reduce the swap fee and then wait out again for the duration of the timer to see again if swappers want to swap.

At the end of an epoch, we reset rowan_swap_fee to max_swap_fee and try again.

Scrap Section

The following content was in a previous version of this document and is kept here merely for historical reference but not intended to be implemented for this feature:

Min Swap Fee and Swap Fee

Our current (not yet released) implementation of the min-swap fee feature parameterizes a flat minimum swap fee (ex: $0.3) on a per-token basis but has a global percentage swap fee rate (ex: 0.03%) across all pools. The swap fee charged per swap is (max(amount_swapped * swap_fee, min_swap_fee))

This document assumes swap_fee itself is parameterized on per-token basis and modifies it over time. An early implementation of this feature could instead use min_swap_fee as a variable being modified over time and be fine. Future version of this doc may explore options for modifying both variables over time.

Select a repo