Skip to content

Conversation

@damcnuta
Copy link

Adds Balancer flashloan support for USDC, USDT, DAI, and USDS.

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Greptile Summary

This PR adds Balancer flashloan support to the SteakhouseUSD vault by introducing calls to _addBalancerFlashloanLeafs for four major stablecoins (USDC, USDT, DAI, and USDS). The changes are made to the Merkle root creation script, which generates the permissions structure that defines what operations the vault's strategist can perform.

Flashloans are a common DeFi primitive that allows borrowing assets temporarily within a single transaction, provided they are repaid by the transaction's end. This functionality would enable the SteakhouseUSD vault to perform capital-efficient operations like arbitrage, liquidation, or complex multi-step transactions without requiring upfront capital. The integration with Balancer's vault flashloan mechanism aligns with the existing BalancerVault interface already present in the codebase.

The modification is strategically placed in the script between the Odos swapping section and Morpho Blue section, suggesting this flashloan capability is intended to work alongside existing trading and lending functionalities. The choice of these four stablecoins indicates a focus on assets with deep liquidity in Balancer pools, which would provide reliable flashloan availability.

Changed Files
Filename Score Overview
script/MerkleRootCreation/Mainnet/CreateSteakhouseUSDMerkleRoot.s.sol 1/5 Adds calls to undefined _addBalancerFlashloanLeafs function for four stablecoins, causing compilation failure

Confidence score: 0/5

  • This PR will cause immediate compilation failure and cannot be merged in its current state
  • Score reflects missing implementation of the _addBalancerFlashloanLeafs function that is being called
  • Pay close attention to script/MerkleRootCreation/Mainnet/CreateSteakhouseUSDMerkleRoot.s.sol as it references non-existent functionality

Sequence Diagram

sequenceDiagram
    participant User
    participant Script as "CreateSteakhouseUSDMerkleRoot"
    participant MerkleHelper as "MerkleTreeHelper"
    participant BoringVault
    participant Manager as "ManagerWithMerkleVerification"
    participant Balancer as "Balancer Vault"
    
    User->>Script: "run()"
    Script->>Script: "generateMetaVaultMainnetStrategistMerkleRoot()"
    Script->>Script: "setSourceChainName(mainnet)"
    Script->>Script: "setAddress() for vault components"
    Script->>Script: "Initialize ManageLeaf array"
    
    Note over Script: Add various swap and lending leafs
    Script->>MerkleHelper: "_addLeafsFor1InchGeneralSwapping()"
    Script->>MerkleHelper: "_addOdosSwapLeafs()"
    
    Note over Script: NEW: Add Balancer Flashloan Support
    Script->>MerkleHelper: "_addBalancerFlashloanLeafs(USDC)"
    Script->>MerkleHelper: "_addBalancerFlashloanLeafs(USDT)"
    Script->>MerkleHelper: "_addBalancerFlashloanLeafs(DAI)"
    Script->>MerkleHelper: "_addBalancerFlashloanLeafs(USDS)"
    
    Note over Script: Continue with other protocol integrations
    Script->>MerkleHelper: "_addMorphoBlueSupplyLeafs()"
    Script->>MerkleHelper: "_addMorphoBlueCollateralLeafs()"
    Script->>MerkleHelper: "_addERC4626Leafs()"
    Script->>MerkleHelper: "_addPendleMarketLeafs()"
    Script->>MerkleHelper: "_addEthenaSUSDeWithdrawLeafs()"
    
    Script->>Script: "_verifyDecoderImplementsLeafsFunctionSelectors()"
    Script->>MerkleHelper: "_generateMerkleTree()"
    Script->>MerkleHelper: "_generateLeafs()"
    MerkleHelper-->>Script: "Generate JSON file with merkle root"
    
    Note over User,Balancer: Once deployed, users can execute flashloans
    User->>BoringVault: "manage() with flashloan call"
    BoringVault->>Manager: "Verify merkle proof"
    Manager->>Balancer: "flashLoan() for USDC/USDT/DAI/USDS"
    Balancer->>BoringVault: "Execute flashloan callback"
    BoringVault->>Balancer: "Repay flashloan + fees"
Loading

1 file reviewed, 1 comment

Edit Code Review Bot Settings | Greptile

Comment on lines +71 to +74
_addBalancerFlashloanLeafs(leafs, getAddress(sourceChain, "USDC"));
_addBalancerFlashloanLeafs(leafs, getAddress(sourceChain, "USDT"));
_addBalancerFlashloanLeafs(leafs, getAddress(sourceChain, "DAI"));
_addBalancerFlashloanLeafs(leafs, getAddress(sourceChain, "USDS"));
Copy link

Choose a reason for hiding this comment

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

logic: The function _addBalancerFlashloanLeafs does not exist in MerkleTreeHelper contract. This will cause compilation failure.

@mel0ndev mel0ndev closed this Oct 10, 2025
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