π‘οΈPortfolio Manager
"The only thing to fear is fear itself and a private key leak" - Franklin D. Roosevelt
The Itos PM is the accounting smart contract for all user portfolios. A single wallet can create up to 8 portfolios, each of which holds up to 16 positions and has their own individual risk silo. By holding positions together in portfolios, the PM allows users to cross-margin those positions with each other.
Producers plug into the PM and help create the positions we place in portfolios. These positions have credits and debts in various tokens and the PM ensures that each portfolio's total credits are greater than their total debts by a sufficient margin. If they aren't then the portfolio is eligible for liquidation. See Cross-Margin Accounting for precise solvency rules.
The interface to the portfolio manager has three main functions:
Installing an asset
Valuing an asset
Uninstalling an asset
Installing Assets
When a producer creates a new asset, the producer requests/provides the necessary tokens from the user and assigns it a per-producer-unique asset ID and gives that ID to the PM. The PM stores this ID in one of the user's portfolios (the user selects which).
After installation the PM does a solvency check on the portfolio and if it passes, the transaction completes.
Valuing Assets
Each position is valued by its underlying token balances. Using the Asset ID, the PM calls into the producer that created the asset to retrieve what is called a Record. The record reports the credits, debts and delta of the position.
When checking a portfolio for solvency, all the portfolio's positions' records are retrieved and netted together.
Uninstalling Assets
Uninstalls are initiated by users on the PM. The PM looks up the asset, goes to the appropriate producer and tells the producer to destroy that asset. The Producer makes a callback to the user to retrieve or provide it with any remaining token balances.
After uninstalling, the PM makes another solvency check. A user cannot make any actions that directly put a portfolio into insolvency. The only time insolvencies occur is when a collateral asset depreciates in value or when a debt asset grows too large.
Last updated