Skip to content

Manage Allocations (Vaults V1)

Managing allocations is the core responsibility of the Allocator role. It involves strategically moving capital between the vault's enabled markets to optimize for yield, maintain liquidity, and adhere to the risk parameters set by the Curator.

This guide covers how to manage allocations using two methods:

  1. The Curator App: An intuitive interface for rebalancing the vault's portfolio.
  2. Direct Contract Calls: For advanced users and scripted interactions with the powerful reallocate function.

Method 1: Managing Allocations with the Curator App

The Curator App provides a visual and interactive way to rebalance your vault's assets. Navigate to the Allocation tab to get started.

Viewing and Planning Allocations

The main table on this page displays the vault's current, live allocation across all its enabled markets, including the Idle Market. You can customize the table with additional columns to see real-time data like supply caps, utilization, and interest rates.

Vault allocations interface in the Curator App

Performing a Reallocation

Enter Edit Mode

Click the Reallocate button to make the "New Allocation" column editable. This also reveals several helpful tools at the top right of the table:

  • Reset: Reverts your pending changes back to the vault's live state.
  • Simulate: Analyzes the impact of your proposed reallocation on the vault's overall APY.
  • Undo/Redo: Steps back and forth through your recent changes.
Entering reallocation edit mode

Define the New Allocation

You can now input your desired allocation for each market. Use the toggle at the top of the column to switch between entering values as percentages (%) or as absolute asset amounts. As you edit, the "Delta" column will show you how much capital will be moved for each market.

Editing allocations by percentage or absolute amount

Save and Execute

Once you are satisfied with your new allocation strategy, click the Save button to initiate the transaction. The app will generate the necessary reallocate call for you to confirm in your wallet.

If your new allocation doesn't account for 100% of the vault's assets, a popup will prompt you to allocate the small remaining amount to a market of your choice (typically the Idle Market) to ensure no funds are left unallocated.

Method 2: Reallocating via Direct Contract Calls

For advanced control and scripting, you can call the reallocate function directly on the vault contract. This function is extremely powerful, as it can simultaneously withdraw from some markets and supply to others in a single, gas-efficient transaction.

Understanding the reallocate Function

The function signature is: reallocate(MarketAllocation[] calldata allocations)

It takes a single argument: an array of MarketAllocation structs. Each struct tells the vault how much of the underlying asset it should aim to have in a specific market after the reallocation is complete.

struct MarketAllocation {
    MarketParams marketParams; // The full parameters of the target market
    uint256 assets;            // The desired final amount of assets in this market
}

How reallocate Works

  1. Calculates Net Flow: The function first determines the total amount of assets that need to be withdrawn from markets where the target allocation is less than the current allocation.
  2. Withdraws First: It performs all necessary withdrawals from the designated markets.
  3. Supplies Second: It then uses the pool of withdrawn assets to supply to markets where the target allocation is greater than the current allocation.
  4. Balance Check: The transaction will revert if the total amount supplied does not exactly match the total amount withdrawn.

Practical Example: Shifting Funds

Imagine a vault with 100 WETH, currently allocated as:

  • Market A: 70 WETH
  • Idle Market: 30 WETH

The Allocator wants to move 20 WETH from Market A to a new, higher-yielding Market B.

The allocations array would look like this:
[
  {
    "marketParams": { ...Market A params... },
    "assets": "50000000000000000000" // Target: 50 WETH
  },
  {
    "marketParams": { ...Market B params... },
    "assets": "20000000000000000000" // Target: 20 WETH
  }
]
What happens when this is executed?
  1. The vault sees it needs to withdraw 70 - 50 = 20 WETH from Market A.
  2. It withdraws 20 WETH from Market A.
  3. It sees it needs to supply 20 - 0 = 20 WETH to Market B.
  4. It supplies the 20 WETH to Market B.
  5. The total withdrawn (20) equals the total supplied (20), so the transaction succeeds. The Idle Market was not included, so its balance of 30 WETH remains untouched.

Best Practice: The "Max" Catcher

To ensure that the total supplied always matches the total withdrawn and to avoid failed transactions due to rounding or accrued interest, it is a critical best practice to make the last item in your allocations array a "catcher."

This is typically your Idle Market, with its assets parameter set to the maximum possible uint256 value (115792089237316195423570985008687907853269984665640564039457584007913129639935).

Example: Safely shifting 20 WETH from Market A to Market B
[
  {
    "marketParams": { ...Market A params... },
    "assets": "50000000000000000000" // Target: 50 WETH
  },
  {
    "marketParams": { ...Market B params... },
    "assets": "20000000000000000000" // Target: 20 WETH
  },
  {
    "marketParams": { ...Idle Market params... },
    "assets": "115792089237316195423570985008687907853269984665640564039457584007913129639935" // MAX_UINT256
  }
]

In this case, the Idle Market will automatically absorb any remaining assets from the withdrawn pool, guaranteeing the transaction succeeds. This is especially useful for fully delisting a market by setting its target assets to 0.