Protocol Fees
How bridging and swap fees at Synapse Protocol work.

StableSwap Basics

What is a Stableswap, exactly?
Let us assume we are already familiar with Uniswap AMM model: x * y = k. This model is simple and effective, allowing the prices of the assets in the pool to track supply and demand. However, if we were to attempt a swap that was large relative to the liquidity contained in the pool, we would get rekt by slippage. Stableswaps are a mathematical improvement that optimize the model for assets that are intended to have prices that remain stable relative to one another. Because of this, stableswap pools can also contain more than two assets, unlike your traditional Uniswap AMM pool. Instead of the simple x * y = k model, a special function F(a, b, c, ...) is used to relate the prices of the assets contained in a stableswap to one another. This function is more complex, and can also have more than two parameters (as shown by a, b, c, etc.) but the exact formula is not necessary in order to discuss how this model affects the protocol's fee structure.
Let us do so by way of an example. Suppose the stableswap pool has three assets, ACash, BCash, CCash, with the respective balance of each token in the AMM pool represented by A, B, and C, such that F(A, B, C) = k. Let us say we want to swap x tokens of ACash to CCash. The Pool's new ACash balance is A + x, so now we need to find y, the amount of CCash that we will receive. This is found by solving F(A + x, B, C - y) = k.
Now to calculate fees - if the swap fee is 0.04%, that means that 0.04% of y (or CCash, in this example) will be fees and 99.96% of y will be sent to us as a result. We sent x tokens of ACash, received 99.96% * y tokens of CCash, and 0.04% * y tokens of CCash were paid as fees. Swap complete! Notice that the stableswap fee is applied to received assets. In addition, some percentage of this fee is generally reserved for the protocol as an admin fee. This fee can range from 0 to 100%, is applied only to the fee paid on the swap, and does not impact the user performing the swap. It does directly impact how much liquidity providers (LPs) earn from swaps in that pool. For instance, if the admin fee is 60%, the treasury will receive 0.04% * 0.6 * y, and LPs will receive 0.04% * 0.4 * y from this transaction.

Deposits and Withdrawals

Now that we understand the basics of a stableswap AMM, let us dive a bit deeper into how its LPs interact with its pools. When LPs deposit assets, they receive LP tokens in exchange for their deposit. When a stableswap pool is initialized, each LP token is worth ~1 token of A/B/C, on average. As swaps are performed using the liquidity in the pool, fees from those swaps accrue to the pool. This results in the LP tokens contained in that pool gaining value versus the assets which were deposited. This gain can be quantified by the "virtual price" of each LP token, which increases from a baseline value of 1 as more fees come in. For example, if the virtual price of an LP token is 1.01, that means 1 LP token is worth 1.01 A, B, or C token - in other words, a 1% return on initial deposits.
So what happens when we deposit assets into an existing stableswap pool? We can deposit a single asset, or a mix of the assets contained within. Because the pool needs to remain balanced to maintain F(A, B, C) = k, a deposit actually combines two actions behind the scenes. First, a "virtual swap" is made for us. Let us say we supply only one asset, x tokens of ACash. A virtual swap is made to make the proportion of your supplied assets equal to the ideal proportions of the pool. This means that some part of those x ACash tokens are swapped for BCash, and some for CCash. As a result the tokens you deposit go from [x, 0, 0] to [d, e, f] - d tokens of ACash, e tokens of BCash, and f tokens of CCash. The fee for the "virtual swap" associated with such a deposit is on average 50% of the usual swap fee, but will depend on the balance of assets in the pool at the time of deposit. Our swapped set of [d, e, f] tokens is now deposited into the pool, with no adverse effects on pool balance. Note: If we were to supply a perfectly balanced proportion of [d, e, f] in the first place then no swap would be made and no fees would be charged on deposit.
The same logic can be applied to withdrawals from the pool, in the reverse direction. Now the mix of [d, e, f] tokens is what we will receive, if we withdraw a combo of all three assets. If we want to withdraw only ACash, the BCash and CCash part of the basket is "virtually swapped" for ACash, to go from [d, e, f] to [x, 0, 0]. We will receive x tokens of ACash, and will have to pay fees on this "virtual swap" to do so since it results in the pool becoming unbalanced. The fee associated with withdrawal is also 50% of the usual swap fee, on average, but will again depend on the balance of assets in the pool at the time of deposit. Note: This means if we deposit a single asset in the pool and immediately withdraw liquidity as a different single asset, on average we will pay 50% + 50% = 100% of the usual swap fee. No free swaps!

Metapools

A metapool is a stableswap pool that consists of two tokens, where one of the tokens is actually an LP token for another stableswap pool. Let us imagine there is stableswap pool of three assets: ACash, BCash, CCash. The LP token for this pool is called ABC-LP. If we were to have a separate pool containing two tokens, DCash and ABC-LP, this would be a metapool (Poolception! DNNN DNNN DNNN). The structure of this pool is essentially [DCash, (ACash, BCash, CCash)].
A metapool must be balanced in two ways. First, there should be a balance between the pool's DCash and ABC-LP assets. Second, the ABC-LP pool must itself be balanced, as described above. Notice that for the ABC pool to be perfectly balanced, it must contain 33% ACash, 33% BCash, 33% CCash. However, for the metapool to be perfectly balanced, it must contain 50% DCash and 50% ABC-LP.
How are metapool swaps charged? Let us say we want to swap DCash for ACash. First, our DCash is swapped for ABC-LP, and we have to pay the metapool swap fee to do so. Next, ABC-LP is withdrawn from the metapool as single-asset ACash, meaning that we are paying at least part of the ABC pool's base swap fee in the process. If we are swapping the other direction and want to convert ACash for DCash, then first we are supplying ACash to ABC-LP, and paying at least part of the ABC-LP's base swap fee in the process. Next, ABC-LP is swapped for DCash, and we pay the metapool fee for this swap.

nUSD Pools

How does this relate to Synapse? There are two types of Synapse nUSD pools. There is the "nexus" pool on Ethereum, and there are other nUSD pools on Avalanche, Binance Smartchain, and Polygon. The nexus pool is a basic stableswap pool of [USDT, USDC, DAI]. The LP token for this pool is nUSD, itself, and can be bridged to other chains. The nUSD pools on other chains are actually metapools. For instance, the Avalanche pool consists of nUSD and USD-LP, which is an LP token for the base Avalanche pool of [USDT, USDC, DAI]. This means the full structure of the Avalanche nUSD pool is [nUSD, (USDT, USDC, DAI)].
Given that, what do a bridge transactions look like in terms of the pools and assets used? Let us look at some examples:
  1. 1.
    Bridging Avalanche USDT to BSC BUSD
    1. 1.
      Avalanche USDT is supplied to the Avalanche USD-LP
    2. 2.
      Avalanche USD-LP is swapped for Avalanche nUSD
    3. 3.
      Avalanche nUSD is bridged to BSC nUSD
    4. 4.
      BSC nUSD is swapped for BSC USD-LP
    5. 5.
      BSC BUSD is withdrawn from BSC USD-LP
  2. 2.
    Bridging ETH USDT to BSC USDC
    1. 1.
      ETH USDT is supplied to the nexus pool in exchange for nUSD
    2. 2.
      ETH nUSD is bridged to BSC nUSD
    3. 3.
      BSC nUSD is swapped for BSC USD-LP
    4. 4.
      BSC USDC is withdrawn from BSC USD-LP
  3. 3.
    Bridging BSC USDT to ETH USDC
    1. 1.
      BSC USDT is supplied to the BSC USD-LP
    2. 2.
      BSC USD-LP is swapped for BSC nUSD
    3. 3.
      BSC nUSD is bridged to ETH nUSD
    4. 4.
      ETH USDT is withdrawn from the nexus pool.

Swap and Bridge Fees

Alright, prepare for some math. Let us divide all Synapse fees into these categories:
a% = swap fee for the "base pools" (nUSD pool on Ethereum, USD-LP on non-Ethereum chains) b% = swap fee for metapools (nUSD pools on non-Ethereum chains) c% = bridge fee for nUSD from any chain to any other chain
So, what are the costs for the following actions?
  1. 1.
    Bridging USDT from Ethereum to non-Ethereum chains (or vice versa)
    1. 1.
      ERC-20 USDT is supplied to the nexus pool -> 0.5 * a%
    2. 2.
      nUSD is bridged from Ethereum -> c%
    3. 3.
      nUSD is swapped for USD-LP -> b%
    4. 4.
      USDT is withdrawn from USD-LP -> 0.5 * a% Total = (a + b + c)% charged in fees
  2. 2.
    Bridging USDT from non-Ethereum chains to non-Ethereum chains
    1. 1.
      Local USDT is supplied to the USD-LP -> 0.5 * a%
    2. 2.
      USD-LP is swapped for nUSD -> b%
    3. 3.
      nUSD is bridged to other chain -> c%
    4. 4.
      nUSD is swapped for USD-LP -> b%
    5. 5.
      USDT is withdrawn from USD-LP -> 0.5 * a% Total = (a + 2b + c)% charged in fees
  3. 3.
    Swapping USDT for USDC on the same chain
    1. 1.
      Local USDT is supplied to the USD-LP -> 0.5 * a%
    2. 2.
      USDC is withdrawn from USD-LP -> 0.5 * a% Total: a%
As you can see, the most expensive swap you can make is to swap between stables on non-Ethereum chains - this is because as the bridged asset and the LP token for the Ethereum nexus pool, nUSD must be swapped with the USD-LP twice when bridging between non-Ethereum chains but can swapped directly into stables when bridging from or to Ethereum.
Please note that these are average fees, assuming that the pool is balanced already or assuming that enough transactions are occurring that such imbalances even out over time. It is possible to get discounted fees or even get paid for swapping or bridging into assets that are over-supplied; conversely, it can be more expensive than average to swap into a specific asset on a different chain if it is under-supplied. Pay attention to the price impact monitor - it is your friend!
Note: current Synapse bridge and swap fees can be found in the FAQ.
H/T to community member Chi Squared for the material contained on this page.
Last modified 2mo ago