πCross-Margin Accounting
"I have a dream that I'll never be liquidated again." - Martin Luther King Jr.
Last updated
"I have a dream that I'll never be liquidated again." - Martin Luther King Jr.
Last updated
All positions are valued by a Record struct which reports a table of token columns and one row each for credits, debts, and deltas. Within a portfolio, these Records can be netted against each other and as long as the final credit balance is sufficiently larger than the final delta plus debt balance, the portfolio is solvent.
Credit: The token balance owned by the position.
Debt: The token balance owed by the position.
Delta: The amount of debt possibly incurred by a position within the time it takes to liquidate the position. This acts as a safety buffer for how volatile the position is (not the token!). A very stable position would have a low delta and highly volatile position would have a large delta.
Example Record | BTC | PEPE | WIF | USDC |
---|---|---|---|---|
In the Itos accounting system, each token is categorized as either a blue-chip or a tail-token. Similar to money markets, this indicates which tokens can be cross-margined, and which must have the risk (semi-) isolated. We will see later how we avoid total isolation.
Blue-chips are ultimately valued in USD and as long as that net USD balance is sufficiently positive solvency is secured. For tail-tokens, their debts can only be collateralized by credits in the same token. This would be strange in the context of just borrow/lending, but within Itos's ecosystem it becomes an invaluable tool in leverage and risk management.
Whenever we check for solvency we need to tally up all the credits, debts, and deltas and show that they meet our collateral requirements. During the accounting procedure, deltas are added to debts and we refer to the combined value as debt.
The first step is to fetch all the positions held in a portfolio, and query from each of their respective producers what their value is in the form of a Record. When the record comes back, each of the credit balances are scaled down by the respective token's variance factor and the debts are scaled up by The Variance Factor. This gives the protocol a margin of safety that is specific to each token.
For positions that are a combination of tokens, all tokens in the position use the largest variance factor of all the underlying tokens. So if we have an AMM LP between DOGE and PEPE, where DOGE has a variance of 1.1 and PEPE of 1.3, then all token balances would be adjusted by 1.3.
Next, for tail tokens we do a simple positive or negative balance check on the adjusted credit and debt values (called virtual collateral and virtual debt). A negative balance indicates insolvency and liquidations are eligible for just that token. However they may affect some blue-chip related positions which results in USD rewards for the liquidator. Additionally, positions that are entirely composed of tail tokens also come with a small built-in, USD debt which is adjustable by governance on a per chain basis. This ensures sufficient liquidation premiums to secure the protocol.
Blue-chip solvency adds an extra step. After netting adjusted balances, they're priced in USD by Chainlink oracles before netting the final USD balance. If this final adjusted balance is positive, then the portfolio is solvent.
Credit
1
2000
0
100
Debt
0
0
5000
500
Delta
0.01
0.01
0.01
0.5