Improve Balancer v3 borrower and e2e stability #49
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description:
1/ Implemented the BalancerV3Borrower wrapper so the router can request Balancer v3 flash loans, validate the lender, and repay principal plus fees within the callback.
2/ Vendored the Balancer v3 vault interfaces to expose flash-loan and fee-percentage entry points used by the borrower and tests.
3/ Added an end-to-end mainnet-fork test that walks through a settlement funded by a Balancer flash loan and verifies balance accounting and repayment.
4/ Reworked the Balancer v3 borrower to drop the unused SafeERC20 helper and explicitly require successful ERC20 repayments of principal plus fees.
5/ Scaled the Aave flash-loan end-to-end tests to the settlement contract’s available WETH so they no longer depend on archive-state buffers.
6/ Allowed the Balancer v3 settlement test to tolerate fee lookups that revert and sized repayments dynamically based on on-chain data.
7/ Hardened the fork helper to prefer provided RPCs, fall back to multiple public endpoints, and default to the latest block, updating benchmark snapshots accordingly.
Testing: