Flows - Programmed Liquidity

Algorithmically defined liquidity flows

Liquidity flows through out the TradeFlows Core protocol according to two formulas. When a stream is created, an escrow account is automatically deployed and two types of liquidity come to exist as a result. The first amount is the Available and the second is the Locked. As time passes, the liquidity flows from the Locked amount, which is in escrow, to the Available amount.

When a stream is created, a final maturity and a target amount are defined and the payer deposits an initial amount to the escrow. As time passes, the amount that flows continuously between the locked and the available amount is defined by the final maturity and the target amount. The amount that flows is such that at the time of the final maturity, the available amount has grown to the target amount, unless the stream has been paused.

Initial Parameters

Programming liquidity starts with setting up a payment stream based on a few parameters:

  • Target Amount - The full amount that is to be paid in aggregate between the starting time and the final maturity.

  • Initial Amount - The amount that the payment stream is initially collateralised with and sent to escrow.

  • Start Time - The time at which the stream starts flowing to the receiver.

  • Final Maturity - The final time at which the full amount has flown to the receiver.

Available Liquidity

The formula for the available liquidity depends on the final maturity T and the target amount.

Available(t)=AmounttargetttlastTtoAvailable(t) = Amount_{target} * \frac{t-t_{last}}{T-t_o}

In the event of a withdrawal at time last, the formula resets the accrual of the flowing amounts. For the sake of clarity, as time passes, the available amount grows.

Escrowed Liquidity

The escrow is defined as a locked amount described by the following formulat:

Locked(t)=Locked(t1)Available(t)Locked(t) = Locked(t-1) - Available(t)

In other words, the new locked amount is equal to the locked amount at the previous time minus the available amount. As time passes, the locked amount decreases.

Last updated