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

encode flashloan call in the driver #3218

Open
Tracked by #3213
MartinquaXD opened this issue Jan 7, 2025 · 0 comments
Open
Tracked by #3213

encode flashloan call in the driver #3218

MartinquaXD opened this issue Jan 7, 2025 · 0 comments

Comments

@MartinquaXD
Copy link
Contributor

MartinquaXD commented Jan 7, 2025

When a solution gets settled using a flashloan the settlement contract will not be called directly. Instead a new helper contract (see #3217) will be called which in turn will call settle().

How exactly that will happen depends on the interface of the helper contract. Theoretically it could be as easy as preparing the underlying settle() call and passing the calldata to the helper but it might also be slightly different.

Unknown API details aside encoding the settlement needs to be aware of a few things:

  1. if the solver explicitly returned which flashloan provider to use the driver has use it
  2. if the solver didn't no provide anything the flashloan information can be looked up in the respective orders
  3. if multiple flashloans are required the call will likely have to be wrapped (e.g. executeFlashLoan(executeFlashLoan(settle())) instead of executeFlashLoan(flashLoanDetails[], settlement)) but these details also depend on the exact helper API
  4. the driver is still required to append the auction_id as metadata to the transaction. To not run into encoding issues these bytes need to be added to the end of the final calldata (not at the end of the inner settle() call).

Encoding happens in this function and all the necessary data should already be part of some of the arguments.

  • helper contract will be in contracts
  • data for 1 will be in auction.orders
  • data for 2 should be in solution

Test Plan

Depending on when this issue gets tackled we can either build a complete e2e test or just a unit test`

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