Skip to Content
Contract APIWrite Methods

Reserve Manager Write Methods

These public functions allow users to interact directly with the pool, including minting and burning index tokens, performing allocation-sensitive swaps, and triggering equalization. All functions are state-changing and require on-chain execution.


mint

function mint( uint256 mintAmount, bytes calldata forwardData ) external;

Parameters:

  • uint256 mintAmount: The number of index tokens to mint (in atomic units).
  • bytes forwardData: Optional data for flash mint functionality. Caller must implement IReserveManagerCallback for this to take effect. Pass empty bytes to ignore.

Description:
Transfers underlying assets from the caller to the reserve manager based on target allocations and mints index tokens. Requires prior approval for each underlying asset.


burn

function burn( uint256 burnAmount, bool unsafe, bytes calldata forwardData ) external;

Parameters:

  • uint256 burnAmount: The number of index tokens to burn (in atomic units).
  • bool unsafe: If true, allows “unsafe” burns (token transfers may fail without reverting). Should almost always be false — used only for emergency recovery.
  • bytes forwardData: Optional data for flash burn functionality. Caller must implement IReserveManagerCallback for this to take effect. Pass empty bytes to ignore.

Description:
Burns index tokens from the caller and transfers a proportional share of underlying reserves back, according to the current allocation. Does not require prior approvals.


swapTowardsTarget

function swapTowardsTarget( address asset, int256 delta ) external returns ( uint256 reserveTransfer, uint256 indexTransfer );

Parameters:

  • address asset: The reserve asset being swapped.
  • int256 delta: Amount of reserves being swapped; positive = deposit, negative = withdraw.

Returns:

  • uint256 reserveTransfer: Amount of reserves transferred to/from the reserve manager.
  • uint256 indexTransfer: Amount of index tokens minted or burned for the caller.

Description:
Swaps a reserve asset for index tokens (or vice versa), only if the swap moves the allocation closer to target. Applies equalization bounty as discount/premium if set. Blocked if output is index tokens and the reserve manager is migrating.


equalizeToTarget

function equalizeToTarget() external returns (int256[] memory actualDeltas);

Returns:

  • int256[] actualDeltas: Actual deltas in each reserve, expressed in native decimals, ordered as in currentAssetParams.

Description:
Applies the equalization vector using assets from the caller to bring the pool into balance with its target allocations. Transfers remaining bounty to the caller. Requires approvals for all relevant assets.


withdrawAll

function withdrawAll(bool unsafe) external returns (AssetAmount[] memory outputAmounts);

Parameters:

  • bool unsafe: If true, allows “unsafe” withdrawals (token transfers may fail without reverting). Should almost always be false — used only for emergency recovery.

Returns:

  • AssetAmount[] outputAmounts: Array of all reserves withdrawn.

Description:
Withdraws all reserves and burns equivalent index tokens from the caller. Intended for cleanup at the end of a migration (e.g., dust removal). No reserves should remain after migration completes.


Last updated on