Vault Strategy Share Reallocation

Due to the market changes and the protocol dynamics, the Vault-Strategy share allocations have to be periodically reallocated to correctly reflect the Smart Vault’s risk assessment.

Reallocation adjusts capital allocation to maximize capital efficiency within the constraints of the parameters and Risk Appetite set by each individual Spool Smart Vault. This happens periodically depending on the gas prices and smart vault

Entry contract: SmartVaultManager

Entry function: reallocate(smartVaults)

Access control: ROLE_REALLOCATOR

This is invoked using the following:

function reallocate(address[] calldata smartVaults, address[] calldata strategies_) external;

Process Flow for reallocation

- Check that all smart vaults have same asset group.

- Confirm all strategies involved

- Pass all strategies in and only verify on-chain

- Build an array of all strategies

- Build a mapping from smart vault strategies to all strategies array

- Calculate new allocation and how much to withdraw and deposit for each smart vault strategy

- `reallocations[][][]`

- first index goes over smart vaults

- second index is 0 (withdrawal needed) or 1 (deposit needed)

- third index goes over smart vault's strategies

- number specifies value in USD to deposit or withdraw

- Build reallocation table that specifies flow of value between strategies

- `reallocationTable[i][j][k]`

- first index goes over all strategies -> strategies doing withdrawal

- second index goes over all strategies -> strategies doing deposits

- third index is 0, 1 or 2

- 0: how much value to withdraw from strategy i and deposit into strategy j

- 1: (later) distributed matched shares

- 2: (later) distributed minted shares

- Performing the reallocation

- calculate amount of shares that should be redeemed

- do the matching

- track matched and unmatched values

- split shares into matched and unmatched shares

- matched shares can be distributed to matching strategies - store into reallocationTable[j][i][1]

- unmatched shares are redeemed

- withdrawn assets are then distributed among strategies needing deposit from this strategy

- mark amount into table tracking to-deposit assets per strategy

- mark value into reallocationTable[i][j][2]

- distributed assets are deposited into protocols

- minted shares are distributed to strategies j depositing into strategy i based on reallocationTable[j][i][2]

- write distributed minted shares into reallocationTable[j][i][2], overwriting value from before

- Smart vaults claim strategy shares

- calculate value deposited from strategy i into strategy j

- claim matched shares based on reallocationTable[i][j][1]

- claim unmatched shares based on reallocationTable[i][j][2]

Last updated