Skip to content

Conversation

@jayanth-kumar-morem
Copy link

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:

(base) jayanthkumar@Jayanths-MacBook-Air flash-loan-router % MAINNET_ARCHIVE_NODE_URL=https://eth-mainnet.public.blastapi.io forge test
[⠊] Compiling...
No files changed, compilation skipped

Ran 10 tests for test/mixin/Borrower.t.sol:BorrowerTest
[PASS] test_approve_callsApproveOnToken() (gas: 39652)
[PASS] test_approve_revertsIfApprovalReturnsFalse() (gas: 40526)
[PASS] test_approve_revertsIfApprovalReverts() (gas: 39933)
[PASS] test_approve_revertsIfNotCalledBySettlementContract() (gas: 34796)
[PASS] test_approve_supportsNoReturnValue() (gas: 38998)
[PASS] test_constructor_parameters() (gas: 18209)
[PASS] test_flashLoanAndCallBack_revertsIfNotCalledByRouter() (gas: 35532)
[PASS] test_flashLoanAndCallBack_triggersFlashLoan() (gas: 41809)
[PASS] test_flashLoanCallBack_callsRouterForwardingData() (gas: 35963)
[PASS] test_flashLoanCallBack_revertsIfRouterCallReverts() (gas: 36402)
Suite result: ok. 10 passed; 0 failed; 0 skipped; finished in 6.03ms (4.29ms CPU time)

@github-actions
Copy link

github-actions bot commented Oct 9, 2025


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@jayanth-kumar-morem
Copy link
Author

I have read the CLA Document and I hereby sign the CLA

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.

1 participant