## Summary
Missing check for the same asset in `CreditDelegationBranch::rebalanceVaultsAssets`.
## Vulnerability Details
`CreditDelegationBranch::rebalanceVaultsAssets` rebalances credit and debt between two vaults by swapping the asset of a
vault in credit to USDC in order to pay the debt in the second vault.
Vaults could have the same engine but different assets. For example: InDebt vault asset could be WETH while InCredit vault
asset could be BTC. If InCredit vault has less unsettled realized debt, that is the vault has more credit, the InCredit vault
will be used.
Using the code snippet below, if the code below evaluate to `false` InCredit asset(BTC) will be used for the swap operation.
```javascript
SD59x18 depositAmountUsdX18 = inCreditVaultUnsettledRealizedDebtUsdX18.gt(
inDebtVaultUnsettledRealizedDebtUsdX18Abs
) ? inDebtVaultUnsettledRealizedDebtUsdX18Abs : inCreditVaultUnsettledRealizedDebtUsdX18;
```
If the code snippet above evaluate to `false` the address of InCredit Vault(BTC) will be used as `tokenIn` but that is not
the case when creating the struct instance. The address of InDebt vault was used as shown below.
```javascript
SwapExactInputSinglePayload memory swapCallData = SwapExactInputSinglePayload({
tokenIn: ctx.inDebtVaultCollateralAsset,
tokenOut: usdc,
amountIn: assetInputNative,
recipient: address(this)
});
```
## Impact
This swap InDebt vault assets instead of InCredit vault asset, making the function not serving its purpose.
## Recommendations
Replacing the swap struct instance
```diff
+ if(inCreditVault.collateral.asset != inDebtVault.collateral.asset) {
+ if(inCreditVaultUnsettledRealizedDebtUsdX18.gt(inDebtVaultUnsettledRealizedDebtUsdX18Abs)) {
+ SwapExactInputSinglePayload memory swapCallData = SwapExactInputSinglePayload({
+ tokenIn: ctx.inDebtVaultCollateralAsset,
+ tokenOut: usdc,
+ amountIn: assetInputNative,
+ recipient: address(this)
+ });
+ } else {
+ SwapExactInputSinglePayload memory swapCallData = SwapExactInputSinglePayload({
+ tokenIn: inCreditVault.collateral.asset,
+ tokenOut: usdc,
+ amountIn: assetInputNative,
+ recipient: address(this)
+ });
+ }
+ }
```