Fee Structure

Magicswap includes a three-tier royalty system: the protocol fee, LP fees, and the token creator fee. At this stage, the contract admin sets these fees and can be overridden on a pool-by-pool basis. Partners can request the LP and creator royalty fee for their pool to align incentives with liquidity providers.

For now as ratified in TIP-40, every pool in Magicswap will have (i) a 0.3% baseline protocol fee and variable (ii) LP fees; and (iii) creator fees, all of which can be overridden on a per-pool basis.

Fee Calculation

Protocol, LP, and token creator fees are paid by traders on each leg of a swap route. The total fee for a pool is the sum of the three sub-fees:

totalFee = protocolFee + lpFee + tokenCreatoreFee

If an exact amount of input token is specified, the fee is reduced from the input amount before calculating the swap value. For example, if your swap has an input of 1,000 MAGIC and the total fees on the route add up to 0.3%, the swap will be quoted as if you are actually trading 997 MAGIC.

If an exact amount of output token is specified, the fee is reduced from the resulting reserves in the pool after the swap. For example, for a swap to 1,000 MAGIC in a pool with reserves of 100,000 VEE and 10,000 MAGIC and total fees of 0.3%, the amount of VEE required for the trade would be calculated as follows:

numerator = 100,000 * 1,000
denominator = (10,000 - 1,000) * (1 - 0.003)
amountVee = (numerator / denominator) + 1 = (100,000,000 / 8,973) + 1 = ~11,145

Future of Fees

Treasure will iteratively make pool creation more permissionless. The protocol fee can eventually be sunset for a front-end fee with royalty distribution happening from this fee.