Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: pallet-pool-system - Decouple Cash-Inflow from Epoch-Execution #1911

Open
mustermeiszer opened this issue Jul 15, 2024 · 0 comments · May be fixed by #1921
Open

Feat: pallet-pool-system - Decouple Cash-Inflow from Epoch-Execution #1911

mustermeiszer opened this issue Jul 15, 2024 · 0 comments · May be fixed by #1921
Labels
I3-annoyance The code behaves as expected, but "expected" is an issue. P5-soon Issue should be addressed soon.

Comments

@mustermeiszer
Copy link
Collaborator

mustermeiszer commented Jul 15, 2024

Description

Some pools in system have a cash flow issue with the current epoch design.

Why
A pool invests into other assets. Those assets have a monthly liquidity. Meaning, redeeming and investing into such assets is only possible once per month. Also, correct pricing for said assets is also only given at said moment. In our system a pool needs to know the correct prices for assets first, close an epoch and afterwards it receives the new investments. I.e. receiving of investments happens at the same time as pricing of assets - from an epoch perspective.

Problem
The above would have a cash-drag of one month for all new investments, because it would be necessary to transfer the new investments to another party BEFORE receiving the prices for the assets, which is technically not possible at the moment.

Solution

  • Epoch closing already transfers ALL tokens to the pool-system -- increase reserve too, NOT block withdraw() from pool, adapt EpochExecutionInfo to not contain the pool state but rather all relevant information to execute the epoch on the most recent state
  • NO trying to execute epoch during closing anymore -- seperate close() and execute()
  • Epoch execution does take the most recent state state and tries to execute with the given solution - might default to full fulfillment if no solution is available
  • Epoch execution re-transfers non-executed amounts back -- best taken care of by pallet-investments to not couple those too

APPS

  • NEED to inform apps about the api-change of closing an epoch

Research/based on

  • Issuer needs

How will this affect the code base

  • More flexible epoch structure
  • Remove storage and complexity of handling snapshot at epoch closing vs. state during epoch execution

What are foreseen obstacles or hurdles to overcome?

  • Epoch executing needs to back-transfer un-fullfilled tokens → if not possible, pool is blocked wrt. to new investments
  • Pallet-investments needs changes to transfer the tokens already during processing and re-get the tokens during fulfillment
@mustermeiszer mustermeiszer added I3-annoyance The code behaves as expected, but "expected" is an issue. P5-soon Issue should be addressed soon. labels Jul 15, 2024
@mustermeiszer mustermeiszer linked a pull request Jul 19, 2024 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I3-annoyance The code behaves as expected, but "expected" is an issue. P5-soon Issue should be addressed soon.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant