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: add any pair capability to refinance strategy #153

Merged
merged 32 commits into from
Apr 5, 2024

Conversation

zerotucks
Copy link
Contributor

@zerotucks zerotucks commented Mar 28, 2024

  • Reintroduce the two swaps to refinance strategy
  • Simplify spotPrice method on SwapManager and SwapProviders. Gets one price only. Calculates a derived spot price when the quote token is a token and not a currency symbol.
  • Calculate the borrowAmount on the target protocol when a debtSwap is required. Accounts for slippage and summer fees when determining how much to borrow to repay flashloan
  • Account for summer fees when getting quotes on swap steps
  • Add getSummerFee method to SwapManager (currently resolves only to 20 basis pts - will update shortly)

TODO:

  • Add config and implement getSummerFee appropriately.

Copy link

This pull request has been linked to Shortcut Story #14939: Add any pair to Simulator/Order Planner.

@zerotucks zerotucks marked this pull request as ready for review March 28, 2024 18:45
Copy link
Contributor

@robercano robercano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job! I have some concerns on the refinance parameters fields, let's talk about it

Base automatically changed from jt/sc-14942/provide-swap-data-view-for-fe to dev April 3, 2024 10:43
zerotucks added a commit that referenced this pull request Apr 3, 2024
- Add Swaps to Simulation output
- Refactor `Simulation` -> `ISimulation` to align better with rest of
the SDK
- Refactor Swap related types from `swap-common` -> `sdk-common` to
remove cyclic dependencies in simulation types

Note:
- `getSpotPrices` simplified to `getSpotPrice` in
#153

TODO:
- Write tests for simulation swaps (done in
#153)
- Update refinance strategy to handle swaps (current implementation is
based on assumptions that no longer hold following
ProtocolManager/Plugins/Pool work) (done in
#153)
Copy link
Contributor

@robercano robercano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just a few requests

sdk/sdk-client/tests/queries/simulateRefinance.subtest.ts Outdated Show resolved Hide resolved
sdk/sdk-client/tests/queries/simulateRefinance.subtest.ts Outdated Show resolved Hide resolved
sdk/sdk-client/tests/queries/simulateRefinance.subtest.ts Outdated Show resolved Hide resolved
@zerotucks zerotucks requested a review from robercano April 4, 2024 13:43
Copy link
Contributor

@robercano robercano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Thanks for refactoring it

@zerotucks zerotucks merged commit 2bbad1c into dev Apr 5, 2024
2 checks passed
@zerotucks zerotucks deleted the jt/sc-14939/add-any-pair-to-simulator-order-planner branch April 5, 2024 11:54
jakubswierczek pushed a commit that referenced this pull request Apr 8, 2024
- Add Swaps to Simulation output
- Refactor `Simulation` -> `ISimulation` to align better with rest of
the SDK
- Refactor Swap related types from `swap-common` -> `sdk-common` to
remove cyclic dependencies in simulation types

Note:
- `getSpotPrices` simplified to `getSpotPrice` in
#153

TODO:
- Write tests for simulation swaps (done in
#153)
- Update refinance strategy to handle swaps (current implementation is
based on assumptions that no longer hold following
ProtocolManager/Plugins/Pool work) (done in
#153)
jakubswierczek pushed a commit that referenced this pull request Apr 8, 2024
- Reintroduce the two swaps to refinance strategy
- Simplify spotPrice method on SwapManager and SwapProviders. Gets one
price only. Calculates a derived spot price when the quote token is a
token and not a currency symbol.
- Calculate the borrowAmount on the target protocol when a debtSwap is
required. Accounts for slippage and summer fees when determining how
much to borrow to repay flashloan
- Account for summer fees when getting quotes on swap steps
- Add getSummerFee method to SwapManager (currently resolves only to 20
basis pts - will update shortly)

TODO:
- Add config and implement getSummerFee appropriately.
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

Successfully merging this pull request may close these issues.

2 participants