Skip to content

Set Up Public Allocator

Overview

As the vault curator of a Morpho Vault, you can designate the PublicAllocator address as an allocator of the vault. This will allow borrowers or Morpho's interface to trigger reallocations, amplifying the available liquidity for end users while limiting the flow of tokens that can be supplied or withdrawn from a market listed in the vault.

This provides power for the curator to:

  • Enable interface/advanced borrowers to trigger reallocations
  • Amplifies available liquidity
  • Controls token flow limits

Prerequisites

  • You must be a curator of a Morpho Vault
  • Access to the Morpho Vault contract

Setup Steps

Enable the Public Allocator

As a curator of your own vault, provide the allocator role to the PublicAllocator contract address as described in this section, via the setIsAllocator function (0xNewAllocator, true).

Providing the allocator role to the PublicAllocator contract on the Morpho Vault contract

Configure Basic Settings

A. Set Admin (Optional)

By default, only the owner of the vault can configure the PublicAllocator for a given vault. However, the owner can appoint an additional admin by triggering the setAdmin function.

B. Set Fee (Optional)

The PublicAllocator can set a fee to charge on every reallocation. The fee is paid in ETH and can be changed at any time by the owner of the vault or the admin by triggering the setFee function.

This fee prevents griefing attacks and helps the vault curators to cover the gas costs reallocations in the case the reallocation through the PublicAllocator has created an imbalance.

Configure Flow Caps

Flow caps determine the maximum amount of tokens that can be supplied or withdrawn from a market listed in the vault. The flow caps can be set by the owner of the vault or the admin for a specific market by triggering the setFlowCap function.

A flow cap is composed of the maxIn and maxOut in this order. The maxIn is the maximum amount of tokens that can be supplied to a market and the maxOut is the maximum amount of tokens that can be withdrawn from a market.

For example, if amount x is withdrawn from a market during reallocation, the market's maxIn increases by x, while maxOut decreases by x. Conversely, if x is supplied to the market, maxIn decreases by x and maxOut increases by x.

This mechanism helps maintain balance and limits excessive token flows in and out of the market.

Example Configuration

Security Considerations

  • Flow cap limits protect against excessive token movements
  • Fees prevent griefing attacks
  • Admin controls provide flexibility while maintaining security

Next Steps

  • Monitor your flow caps
  • Adjust settings as needed
  • Consider market conditions when setting limits