Comment on page
When liquidity providers and traders use the IPOR protocol, the AMM keeps stablecoins in custody. That includes both LP's stable and collateral put forward by the traders. Those funds are used to make payments between Liquidity Pools and the swap takers. The funds must be kept to ensure the solvency of contracts. However, this is only necessary when the funds are transferred between parties. However, most of the time, the funds would simply be sitting there idle while they could be earning interest.
This is where Asset Management comes in. Its task is to ensure that available funds are put to work at the lowest possible risk yet earning interest. At conception, the Asset Management will be delegating stable to AAVE and Compound as they are regarded as the most secure, liquid, and reliable.
Stanley - the name of the asset management suite of contracts
Below chart shows the flow of funds through the asset management:
Deposit to asset management
When Milton has excess free funds in custody, it will deposit them to Stanley. It will receive ivTokens which serve as accounting tokens in exchange for that. Further, Stanley will deposit stable to one of the supported money markets and receive accounting tokens in exchange.
Withdraw from asset management
The withdrawal process is a reverse of a deposit: When Milton requests to withdraw assets from Stanley, then Stanley calculates the number of accounting tokens to withdraw from the money market selected according to its logic. It then redeems the accounting tokens and transfers the proceeds to Milton while burning the corresponding liquidity tokens.
ivTokens, being accounting tokens, are used to represent the share of Milton in the funds kept by Stanley. This construction would allow opening position on Stanley by an outside actor.
When the funds are delegated to the money markets, Stanley may potentially be entitled to some rewards denominated in platform tokens (i.e., Comp or AAVE tokens). Stanley can then claim the tokens and transfer them to the appointed address controlled by the DAO, which can be used at the DAO's discretion.
At conception, the strategy employed by asset management starts simple and will be constantly refined to maximize return. However, risk mitigation is of utmost importance when it comes to asset management.
At inception, the strategy of the asset management is relatively simple:
- each time the deposit is made from Milton, Stanley checks which money market offers the higher APR and deposits the whole amount there
- every time withdrawal is triggered by Milton, Stanley checks where the APR is the lowest and draws stable from there
Stanley allows for the manual action by way of multi-sig of transferring funds between money markets should the manager of Stanley have a reason to transfer holdings, either to improve APY or for maintenance reasons (money markets can be added and subtracted, in which case they would need to be drained from all the stable). This authority will be transferred to DAO.
Not all the funds can be delegated to the money markets. A certain amount of cash needs to be held on hand to fulfill potential payoff obligations resulting from closing derivatives and withdrawing liquidity. Milton has a configuration to set the desired level of reserves and a public function "rebalance" that, when invoked, either deposits or withdraws funds from money markets to bring the reserves to the configured level.
As specified in Liquidity Provisioning, returns from money markets are profits of liquidity providers. Calculating it, therefore, must consider the worth of the interest-bearing tokens coming from the money markets. When Milton needs to calculate the utilization or the LP pool, it requests Stanley (asset management contract) to calculate the value of its holdings. However, since the holdings of Stanley are made of the balance from the trader's collateral and deposits of liquidity providers, but the interest should be counted only towards the LPs, it makes the calculation a little bit more complex.
First - Stanley needs to keep track of interest separately from its balance. The "virtual balance" is updated every time deposit or withdrawal from Stanley is made. Interest is calculated as a difference between balance (as calculated by counting interest-bearing tokens from money markets) and "virtual balance" from the time of rebalancing.
Second - Interest is dynamically added to the LP on top of the balance kept by the AMM. At each rebalancing, the balance of the liquidity pool is updated, and the count of accrued interest is reset.