Skip to main content

Overview

Rebalancing allows you to adjust the composition of assets in your Folio’s basket. The process involves:
  1. Starting a rebalance with target weights and price ranges
  2. Opening auctions to execute trades
  3. Bidding on auctions (or using trusted fillers)
  4. Closing auctions and ending the rebalance
Only the REBALANCE_MANAGER role can start rebalances. The AUCTION_LAUNCHER role controls how auctions execute during the restricted period.

Starting a Rebalance

1

Define Token Parameters

Specify weights, price ranges, and constraints for each token in the rebalance:
Weight Ranges:
  • Weights are in D27 format (27 decimals) representing tok/BU
  • Total weights don’t need to equal 100%, they define ratios
  • spot is used for unrestricted auctions
  • AUCTION_LAUNCHER can narrow ranges if weightControl is enabled
2

Set Basket Unit Limits

Define the target basket unit (BU) range per share:
A Basket Unit (BU) is typically 1:1 with shares (1e18), but can be configured in the range (0, 1e27]. The BU defines the target composition of assets.
3

Configure Time Windows

Set how long the rebalance and restriction periods last:
Time Periods:
  • Restricted Period: Only AUCTION_LAUNCHER can open auctions
  • Unrestricted Period: Anyone can open auctions with spot values
  • Total TTL: Maximum time before rebalance expires
The AUCTION_LAUNCHER period can be extended automatically if auctions are ongoing, but cannot extend past the TTL.
4

Execute Start Rebalance

Call the startRebalance function:
This will:
  • Increment the rebalance nonce
  • Store all token parameters
  • Set time windows
  • Close any ongoing auction from a previous rebalance
  • Add new tokens to the basket if not already present

Opening Auctions

Once a rebalance is started, auctions must be opened to execute trades.

Restricted Auctions (AUCTION_LAUNCHER)

1

Select Tokens for Auction

Choose which tokens from the rebalance to include:
2

Narrow Ranges (Optional)

The AUCTION_LAUNCHER can progressively tighten ranges:
All ranges must stay within the original bounds set in startRebalance.
3

Launch the Auction

The auction will:
  • Have a 30-second warmup period (skipped if atomic swap)
  • Run Dutch auctions on all surplus/deficit pairs
  • Use exponential price decay from optimistic to pessimistic

Unrestricted Auctions

After the restricted period expires, anyone can open auctions:
Unrestricted auctions:
  • Include all tokens in the rebalance
  • Use spot weights (collapsing high/low ranges)
  • Use initial price ranges from startRebalance
  • Use spot limits
  • Run for maxAuctionLength duration

Monitoring Auction Progress

1

Check Auction Status

2

View Current Prices

3

Query Available Bids

Closing Auctions and Rebalances

Privileged roles can manually close auctions or end rebalances:
Important:
  • closeAuction() stops the auction immediately
  • endRebalance() prevents new auctions but lets the current one finish
  • Starting a new rebalance automatically closes any ongoing auction

Best Practices

Use multiple auctions to progressively narrow BU limits and weight ranges. This implements DCA (dollar-cost averaging) and reduces price impact.
If priceControl is PARTIAL, monitor market prices and update auction prices to reflect current conditions without going outside initial bounds.
Set maxAuctionSize to prevent single large trades from dominating the rebalance. Break large rebalances into multiple smaller auctions.
Monitor for:
  • Market prices moving outside initial price ranges
  • Unexpected token behavior
  • Low bidder participation
Use endRebalance() to stop if conditions warrant.

Code Reference

  • Rebalance start: contracts/Folio.sol:632-665
  • Open auction: contracts/Folio.sol:675-707
  • Unrestricted auction: contracts/Folio.sol:712-766
  • Rebalancing logic: contracts/utils/RebalancingLib.sol:24-119

Next Steps

Participate in Auctions

Learn how to bid on auctions and earn arbitrage profits

Governance Setup

Configure governance for rebalancing decisions