Interest Fee Calculation Algorithm

  • Aqua will apply interest for short and long positions held by market makers according to the utilization rate of the asset. It follows the jump rate model used by Compound. Every hour, Aqua fetch the borrow rate and supply rate on-chain, and fixed that rate for 1 hour. Short positions applies the borrow rate and long position applies the supply rate.

  • To check the current fee rate, MM can call /aqua/token-settings API and decide if the fee rate is sensible for earning a profit.

    • To make sure that Aqua does not lose any money, Aqua will charge short positions a fee rate higher than the long positions.

  • The off-chain fee engine will post the fee accumulated by each market maker on-chain at intervals. The fee engine will evenly distribute the long fees earned by market makers to the short fee that market makers pay.

    • For example

      • at t0, MM1 has position of -1 ETH, +2000 USDT, +100 LINK, -1500 USDC

      • at t5,

        • short fee = -0.001 ETH, -3 USDC

        • long fee = + 1 USDT, + 0.01 LINK

        • when epoch update is triggered at this time

          • short fee USD = -2 USD (from ETH), -3 USD (from USDC)

          • long fee USD = + 1 USD (from USDT), + 0.2 USD (from LINK)

          • Fee engine will distribute the long fee to the short fee evenly

            • final short fee ETH = -2 + (2 / (2+3) * 1.2) USD = -1.52 USD = -0.00076 ETH

            • final short fee USDC = -3 + (3/ (2+3) * 1.2) USD = -2.28 USD = -2.28 USDC

        • this fee will be posted on chain to update Market Maker position

Last updated