FAQ

How does it work?

NativeLend presents an innovative solution that enables Market Makers to provide pricing capability without the burden of managing inventory availability. This feature enables Market Makers to power leverage trading as long as their credit is healthy.

In general, Market Maker can effortlessly borrow the 'buy token' (quote token) to facilitate user swap, while returning the 'sell token' (base token) to NativeLend. To close the position, the Market Maker can make a settlement to pay all the short positions and take all the long positions.

  1. How is the interest calculated?

    • The fee rate is based on the market condition and pool utilization same as Compound v2 Jump rate model. Each hour, Native fetches the latest borrow and supply rate from the smart contract, and apply that fee rate for that hour. Note that for short rate Native applies a minimum rate of 1%. For MM to know the current rate, MM can continuously check /token-settings token rate endpoint and decide if the fee makes sense and still profitable for them to borrow from Native Lend.

    • Fee calculation happens off chain by computing the on-chain positions history for each Market Maker and apply the fee based on their position changes and elapsed seconds.

      • For example, at second 0, MM position is -1 ETH and +2000 USDT. At second 2, MM position is -0.5 ETH and +1000 USDT. to calculate fee at second 5:

      • ETH short fee = (-1 ETH * short fee rate per second) * (2 - 0) seconds + (-0.5 ETH * short fee rate per block) * (5 - 2) seconds

      • USDT long fee = (+2000 USDT * long fee rate per second) * (2 - 0) seconds + (+1000 USDT * long fee rate per second) * (5 - 2) seconds

    • Fee engine will distribute evenly the long fee, in notional values, that Market Maker has earned to the short fee that Market Maker needs to 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

      • 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

  2. How is the interest fee charged?

    • For each Market Maker, their principal position is stored on chain while the fee is calculated off chain. Periodically (roughly every 8 hours) Native off chain engine will send a transaction to post the fee data on chain, by updating the on-chain position data (Epoch Update). Meaning the fee will be merged into the principle, making the short position to increase by the amount. Note that if market makers have more long fee than short fee, it will just cancel out all the short fee, it will not increase the long position.

  3. How to know Market Maker position?

    • Native has the endpoint /mm-positions to show Market Maker short and long position for all the token. Additionally, it will show your overall credit USD and USD price used at the moment. Note that there will be a delay of 1 - 2 minutes before the position and credit is updated off chain.

      • availableCreditUsd = sum(collateral_token_amout * token_usd_price * collateral_ratio) + sum(long_token_amount * token_usd_price * collateral_ratio) - sum(short_token_amount * token_usd_price)

    • Also market maker can always fetch the position on-chain as the golden truth (Without the pending fee off-chain, that would only be updated on-chain periodically)

  4. How to know the largest order size that can be quoted?

    • The order size that MM can quote depends on the long token in the quoting pair, more specifically the collateral factor of it. The higher the collateral factor, the larger the size can MM quote. For example, MM quoting on ETH/USDT and PEPE/USDT. An user wants to sell ETH or PEPE to buy USDT. ETH and PEPE in this example are the long tokens, USDT is the short token. Collateral factor ETH > PEPE, meaning putting ETH in will be more in credit value, thus MM can have larger short position in USDT, so MM's max order size that it can quote for ETH -> USDT is larger than PEPE -> USDT.

    • From /mm-available-borrow, the endpoint returns the inventory balance and baseShortLimit for each token. baseShortLimit = availableCreditUsd/shortTokenUsdPrice. This is the conservative amount that MM can quote if the long token collateral is 0. MM can use the collateral factor of the quoting long token to calculate the actual max amount. The amount would be baseShortLimit/(1 - longTokenCollateralFactor)

    • For example

      • MM's availableCreditUsd: 10K

      • For token USDC, baseShortLimit: 10K

      • Collateral factors

        • Token X: 0

        • Token Y: 0.5

        • Token Z: 0.8

      • Assuming the inventory is sufficient, the max orders MM can quote are

        • Token X: 10K

          • After the trade MM will have $10K worth of token X as long, but 0 collateral value. So at most it can short 10K of USDC, which consume all the available credit.

        • Token Y: 20K

          • MM takes $20K worth of Y as long, with 10K as collateral value (collateral factor 0.5). Shorting 20K USDC, long and short net out to be -10K credit, consuming all the availableCreditUsd

        • Token Z: 50K

          • MM takes $50K worth of Y as long, with 40K as collateral value (collateral factor 0.8). Shorting 50K USDC, long and short net out to be -10K credit, consuming all the availableCreditUsd

  5. How does liquidation work?

    • The account is liquidatable when availableCredit < 0. Whitelisted liquidators can check all the market maker positions and when a market maker credit is unhealthy, liquidators can call Native API with liquidation proposal. The proposal would include what short positions to repay, and what long positions and what collateral to claim. Native will verify the proposal, approve if the proposal improves the account health, and return the signature that liquidators can submit on chain and execute the liquidation.

  6. How the off chain price feed works?

    • Native off chain price feed is the core of the Native credit engine. Aqua aggregates price from multiple sources such as Binance, Kucoin, MEXC, and CoinMarketCap. Native also has internal risk check to compare price from trusted Market Maker.

    • In case the price is flagged as ‘not valid’ or the price sources are down, the internal risk engine will pause the whole activities including trading borrowing, settlement, collateral removal, and liquidation.

  7. What is repayment and settlement, and how do they work?

    • Repayment is a permissionless operation where Market Maker can just pay the short position they have directly to the Vault contract, in order to minimize the short fee that they need to pay.

    • Settlement is a permissioned operation where Market Maker can pay the short position and/or take the long positions as long as their credit remains healthy. Because this operation can decrease Market Maker credit and make their credit unhealthy, Native requires a time delay of 2 minutes where Native will pause Market Maker from other credit decrease actions such as collateral removal or trading borrowing and to take account of the credit calculation delay.

  8. What happens if there’s no asset left for Market Maker to do settlement?

    • Similar with Compound logic, Market Maker is not able to settle if the inventory is not available in the Native at the moment. In this case, the short/borrow fee will be very high to encourage other Market Maker/Borrowers to return the money back to Native following the JumpRateModel.

Last updated