Balance Aproximation
Metera - Balance Approximation on Deposit and Withdraw Operations
Currently, due to the need to re-balance the portfolio to adjust the weights of assets to match the target weights, we are faced with the limitation of waiting while this balancing is being done to continue executing transactions (e.g., making a deposit or withdraw).
Deposit / Withdraw operation acceptance
The acceptance or rejection of a deposit or withdraw operation relies only on the weights present in the portfolio and the states of the portfolio before and after the operation, more precisely, on the weights of the tokens in the portfolio. We propose to measure the L1 distance between the weights of the current portfolio and the weights indicated by the oracle, and the L1 distance between the weights of the portfolio after the interaction and the weights indicated by the oracle. If the latter valuation is lower, the transaction is accepted.
Examples
Deposit Operation Fails
Deposit Operation Succeeds
Withdraw Operations
Withdraw operations examples are analogous, since the evaluation of the balance approximation criteria only depends on the portfolio input and outputs states, and not on other inputs/outputs, mint/burn of MTK tokens, etc.
Deposit Function
Users may want to decide how much Ada they want to deposit in the portfolio. We need then to have functionality that supports this input, and calculates an appropriate set of tokens such that the whole input can be added to the portfolio. This of course considers the needed amount of tokens for the portfolio to be balanced, and if there was a remaining amount of user Ada input, then calculate the tokens to add according to the balance required.
Last updated