Skip to content

About Real Time Balance

Miao ZhiCheng edited this page May 9, 2022 · 7 revisions

(NB!! This is a work in progress notes)

Notes

Per Spec

  • Real-time balance: vector of liquidity.
    • Current vector components:
      • transferable liquidity (TBA, CFA, GDA, DFA),
      • buffer (CFA),
      • withheld liquidity (GDA),
      • app credit (Buffer Based Solvency).
  • Sum of all agreement provided real-time balances.

EVMv1 Implementation Details

  • TBA (Transferable Balance Agreement) is not an agreement
  • "Settled balance" is a shared storage for:
    • TBA: C,
    • and all constant components of agreement provided real-time balances
      • CFA account: flowRate * time + C
      • IDA subscriber: for s in subs: (s.index.indexValue - s.indexValue) * s.units + C
      • IDA publisher: for i in indexes: i.indexValue * i.totalUnits + C
  • Buffer Logic:
    • :Current Logic
    • Clipping is used to store 96 bits as 64 bits
      • CFA: round-up clipping for calculating flow buffer.
  • App Credit Logic:
    • CFA
      • It is called appAllowanceBase.
      • App credit lending rule A: The same as the flow buffer.
      • :Problem - 1:N flow forwarding
      • when N > 1, app may not have enough app credit to create those flows
      • :Possible fix 1:
      • App credit lending rule B: each time app create a flow, minimum buffer could be borrowed form the user
        • Add on top of app credit lending rule A
        • As a "back-stop" to the app credit lending rule A
      • :Possible fix 2:
      • App created streams use round-down clipping for calculating flow buffer.
        • Math proof that, the rounded-up-clipped flow buffer can be used by N-split input flow with rounded-down-clipped flow buffers.
        • Need to solve the minimum buffer economic cost case.

Scribbles

	  CLIPPED_MINIMUM_BUFFER = 2**32
Ba = bufferAmount(Fa)

App Credit Rule a:

AppCredit/AppAllowance <= Ba

App Credit Rule b:


## Case 1

Fb + Fc = Fa

Bb = bufferAmount(Fb)
Bc = bufferAmount(Fc)

Worst case:

Bb + Bc = Ba + 2 * (CLIPPED_MINIMUM_BUFFER-1)

## Case 2

Fb + Fc < Fa
Clone this wiki locally