-
Notifications
You must be signed in to change notification settings - Fork 237
About Real Time Balance
Miao ZhiCheng edited this page Aug 18, 2023
·
7 revisions
(NB!! This is a work in progress notes)
- 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).
- Current vector components:
- Sum of all agreement provided real-time balances.
- 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
- CFA account:
- TBA:
- Buffer Logic:
- :Current Logic
- Clipping is used to store 96 bits as 64 bits
- CFA: round-up clipping for calculating flow buffer.
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
Liquidity Sum Invariance
- non-semantic money version (CFA, IDA):
forall a. Account a => sum(avb + (d > od ? d - od : 0)) == totalSupply
where avb = availableBalance(a)
d = deposit(a)
od = owedDeposit(a)
- semantic money version (GDA):
forall a. Account a => sum(availableBalance(a)) == 0
Netflow Sum Invariance
forall a. Account a => sum(netFlowRate(a)) == 0
(Semantic Money/GDA-only) Pool Balance Sum Equals Claimable Balance Sum
forall a p. (Account a, Pool p) => sum(availableBalance(p)) == sum(claimableBalance(a))
(Semantic Money/GDA-only) Flow Buffer Sum Equals Buffer-Account balance
The so called "buffer account" is where the buffer amount is visible as available balance of it. In implementations, they could be the super token contract itself, or in GDA case it could be the GDA agreement contract itself, hypothetically it could be an address of its own such as 0x69.
forall a b. (Account a, BufferAccount b) => sum(flowBufferAmount(a)) == availableBalance(b)
- Governance Overview
- For Contributors
- Development Process
- Protocol EVMv1 Operations
- Protocol EVMv1 Technical Notes
- Protocol EVMv1 Core Subgraph