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

Improve "execution engine" #149

Open
aviggiano opened this issue Oct 15, 2024 · 0 comments
Open

Improve "execution engine" #149

aviggiano opened this issue Oct 15, 2024 · 0 comments

Comments

@aviggiano
Copy link
Contributor

aviggiano commented Oct 15, 2024

Description

We discussed a potential long-term solution for the borrower exit functionality, which addresses both the need for atomically linked operations and optimization for credit compensation.

Proposed Solution

We identified two long-term solutions that should be implemented after solving the optimal deleveraging strategy on the backend:

  • Smart Multicall: A mechanism that passes parameters from one function to the next atomically, ensuring that credit position IDs generated in buyCreditMarket can be used directly in compensate.
  • BorrowerExit Function: A specific function like borrowerExit that handles the entire process, taking inputs from the first operation and applying them in the second, ensuring seamless operation without needing separate multicalls.

Both approaches depend on having the "optimal deleveraging strategy" in the backend, which should:

  • Evaluate the credit of the borrower willing to exit.
  • Optimize new credit creation based on yield and temporal constraints (credit.dueDate <= debt.dueDate).

Risks and Considerations

  • Frontrunning Risk: There is a small risk of transactions being frontrun, especially in scenarios where credit position counts change between getPositionsCount and buyCreditMarket operations. While the risk on Base might be low, we should account for it in the design.
  • Dealing with Suboptimal Transactions: In cases where frontrunning invalidates an optimal compensation strategy, consider fallback mechanisms such as partial compensation or transaction failure.

https://t.me/c/1852288641/164/9647

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant