Skip to content
LogoLogo

Manage Allocations

In Vault V2, curators no longer manage allocations by setting network limits and operator shares directly. Instead, vault assets are allocated through the vault's Universal Delegator, which routes capital across the vault's configured adapters.

As a curator, the main allocation flow is:

  • Get the vault's delegator address
  • Make sure the relevant adapters have been added and configured
  • Allocate assets across adapters using the Universal Delegator
  • Deallocate assets from adapters when needed

Allocate to Adapters

The Universal Delegator exposes an allocateAll(uint256 amount) method that allocates vault assets across configured adapters.

The default allocation helper script calls:

IUniversalDelegator.allocateAll(amount)

on the delegator associated with a given Vault V2.

Allocation Script

AllocateAdaptersBaseScript.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
 
import {IVaultV2} from "../../../../src/interfaces/vault/IVaultV2.sol";
import {IUniversalDelegator} from "../../../../src/interfaces/delegator/IUniversalDelegator.sol";
import {Logs} from "../../../utils/Logs.sol";
import {ScriptBase} from "../../../utils/ScriptBase.s.sol";
 
contract AllocateAdaptersBaseScript is ScriptBase {
    function runBase(address vault, uint256 amount) public virtual returns (bytes memory data, address target) {
        target = IVaultV2(vault).delegator();
        data = abi.encodeCall(IUniversalDelegator.allocateAll, (amount));
        sendTransaction(target, data);
 
        Logs.log(
            string.concat("Allocate adapters", "\n    vault:", vm.toString(vault), "\n    amount:", vm.toString(amount))
        );
        Logs.logSimulationLink(target, data);
    }
}

This script:

  1. Receives the Vault V2 address and the amount to allocate
  2. Fetches the Universal Delegator address from the vault
  3. Encodes a call to allocateAll(amount)
  4. Sends the transaction to the delegator

Allocation Parameters

ParameterDescription
vaultAddress of the Vault V2 whose assets should be allocated.
amountAmount of the vault asset to allocate across adapters.
targetThe Universal Delegator address returned by IVaultV2(vault).delegator().
dataEncoded calldata for IUniversalDelegator.allocateAll(amount).

Using Safe

To allocate assets through Safe:

  1. Open Safe
  2. Open Transaction Builder
  3. Get the Vault V2 address
  4. Read the vault's delegator() address using the UI, CLI, Etherscan, or another block explorer
  5. Enter the delegator address as the contract address
  6. Click Use Implementation ABI
  7. Choose the allocateAll(uint256 amount) method
  8. Enter the amount of assets to allocate
  9. Sign and execute the transaction

Verify Allocation

To verify allocation state, use the Universal Delegator read methods and the relevant adapter read methods.

At a high level, you should verify:

  1. The vault's delegator() points to the Universal Delegator used for the transaction
  2. The relevant adapters are configured on the delegator
  3. The allocation transaction was executed successfully
  4. The target adapters received or accounted for the allocated assets

Verify the Delegator

  1. Open the Vault V2 contract in a block explorer
  2. Open the Read Contract tab
  3. Query delegator()
  4. Confirm that the returned address matches the delegator used for the allocation transaction

Verify the Allocation Transaction

  1. Open the allocation transaction in a block explorer
  2. Confirm that the transaction target is the Universal Delegator
  3. Confirm that the calldata corresponds to allocateAll(uint256 amount)
  4. Confirm that the transaction succeeded

Deallocations

Deallocations are also handled through the Universal Delegator. The exact method depends on the desired deallocation flow and adapter configuration.

Common deallocation-related permissions are assigned during Vault V2 deployment:

Role holderDescription
deallocateRoleHolderAddress allowed to deallocate assets from adapters.
forceDeallocateRoleHolderAddress allowed to force deallocation from adapters.

Adapter Management

Before assets can be allocated, the relevant adapters must be added and configured on the Universal Delegator.

Vault V2 deployment assigns the following adapter-management roles:

Role holderDescription
addAdapterRoleHolderAddress allowed to add new adapters.
removeAdapterRoleHolderAddress allowed to remove adapters.
swapAdaptersRoleHolderAddress allowed to reorder or swap adapters.
setAdapterLimitsRoleHolderAddress allowed to configure adapter limits.
setAutoAllocateAdaptersRoleHolderAddress allowed to configure auto-allocation adapters.

Example Flow

A typical Vault V2 allocation flow looks like this:

  1. Deploy the Vault V2
  2. Add the required adapters to the Universal Delegator
  3. Configure adapter limits
  4. Configure auto-allocation adapters if applicable
  5. Deposit assets into the vault
  6. Call allocateAll(amount) on the Universal Delegator
  7. Verify that assets were allocated as expected

Deprecated Flow

The previous curator allocation flow used network and operator allocation methods such as:

setNetworkLimit(...)
setOperatorNetworkShares(...)

These methods are part of the older delegator model. For Vault V2, allocation is performed through the Universal Delegator and its configured adapters.

If you are using Vault V2, use the adapter allocation flow described above instead.