Flows - Programmed Liquidity
Algorithmically defined liquidity flows
Last updated
Algorithmically defined liquidity flows
Last updated
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.
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.
The formula for the available liquidity depends on the final maturity T and the target amount.
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.
The escrow is defined as a locked amount described by the following formulat:
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.