# MIMOManagedRebalance

The `MIMOManagedRebalance` action contract handle the super vault empty vault logic described in [Managed Rebalance](/products/parallel-v2/how-it-works/super-vaults-sv/managed-rebalance.md).

### Process Flow

<figure><img src="/files/dHFKsUPKNAffluIR6BCf" alt=""><figcaption></figcaption></figure>

### Write Methods

#### `setManagement(uint256 vaultId, ManagedVault calldata mgtParams)`

Sets a vault management parameters.

Requirements :&#x20;

* Caller must be the `MIMOProxy` owner the vault or the `MIMOProxy` owner
* Selected manager must be whitelisted

| Param Name  | Type    | Description                                              |
| ----------- | ------- | -------------------------------------------------------- |
| `vaultId`   | uint256 |                                                          |
| mgt`Params` | struct  | ManagedVault struct containing all management parameters |

**`ManagedVault`**

| Param Name         | Type    | Description                                                                               |
| ------------------ | ------- | ----------------------------------------------------------------------------------------- |
| `isManaged`        | bool    | `true` if vault is under management `false` if not                                        |
| `manager`          | address | Selected manager address                                                                  |
| `allowedVariation` | uint256 | The maximum allowed slippage on rebalancing swaps                                         |
| `minRatio`         | uint256 | Minimum vault ratio above which the starting vault be at the end of a rebalance operation |
| `fixedFee`         | uint256 | Fixed fee paid to the manager                                                             |
| `varFee`           | uint256 | Variable fee paid to the manager                                                          |
| `mcrBuffer`        | uint256 | Rebalancing vault MCR buffer padding                                                      |

#### `rebalance(uint256 vaultId,` IMIMORebalance.RebalanceData calldata rbData,`IMIMOSwap.SwapData calldata swapData)`

Performs a rebalance on a vault by an appointed whitelisted manager on behalf of the vault owner.

Requirements :&#x20;

* Contract must be unpaused
* Vault must have been created through the user's `MIMOProxy`
* Vault must be under management
* Caller must be the appointed manager
* Rebalance amount cannot be set to zero
* Maximum daily operation must have not been reached
* Set mint amount cannot be greater than vault debt
* The change in vault value due to the rebalance operation must be lower or equal then the `allowedVariation` set by the owner
* The final vault ratio must be greater or equal then the `minRatio` set by the owner

| Param Name | Type   | Description                                                      |
| ---------- | ------ | ---------------------------------------------------------------- |
| `flData`   | struct | `FlashLoanData` struct containing flash loan parameters          |
| `rbData`   | struct | `RebalanceData` struct containing rebalance operation parameters |
| `swapData` | struct | `SwapData` struct containing aggregator swap parameters          |

#### `executeOperation(address[] calldata assets, uint256[] calldata amounts, uint256[] calldata premiums, address initiator, bytes calldata params`

AAVE `Pool` contract flash loan callback function.

Requirements :&#x20;

* Contract must be unpaused
* Can only be called by the AAVE `Pool` contract
* Flash loan initiator must be the `MIMOProxy`

<table><thead><tr><th>Param Name</th><th width="301.3333333333333">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>assets</code></td><td>address[]</td><td>Address array with one element corresponding to the address of the target vault asset</td></tr><tr><td><code>amounts</code></td><td>uint256[]</td><td>Uint array with one element corresponding to the amount of the target vault asset</td></tr><tr><td><code>premiums</code></td><td>uint256[]</td><td>Uint array with one element corresponding to the flashLoan fees</td></tr><tr><td><code>initiator</code></td><td>address</td><td>Initiator of the flashloan; can only be MIMOProxy owner</td></tr><tr><td><code>params</code></td><td>bytes</td><td>Bytes sent by this contract containing MIMOProxy owner, target vault id, SwapData struct</td></tr></tbody></table>

### View Methods

#### `mimoRebalance()`

Returns the `MIMORebalance` action contract address.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.parallel.best/developers-hub/parallel-v2/super-vault-sv/action-contracts/mimomanagedrebalance.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
