# Rebalancing

UXD stablecoin is created through the set-up of various asset strategies, including the delta-neutral position.&#x20;

At initiation, this delta-neutral position is 100% backed by decentralized crypto assets, such as SOL, ETH and BTC. The below section is intended to explain some of the intricacies involved in the dynamics of the delta-neutral accounting, and scenarios in which UXD may become partially and temporarily collateralized by USDC.&#x20;

### Delta-Neutral Accounting

Suppose there is 1,000,000 of UXD outstanding, which was created on average when SOL was $100. This means the UXD asset depository holds 10,000 SOL and is short 10,000 SOL-perp on a relevant derivative exchange. Each UXD is backed by an equivalent dollar amount of SOL.&#x20;

Suppose SOL moves to $90. Then:

1. UXD's depository still holds 10,000 SOL, which is now worth $900,000.&#x20;
2. UXD's short SOL-perp position accrues a +$100,000 PnL

Each UXD is still backed by an equivalent dollar amount of "assets", but the composition of assets has changed slightly. Now, 1 UXD is backed by 90% SOL and 10% "paper profits", which are the unsettled PnL profits from the derivative exchange (note: paper profits are themselves collateralized due to margin maintenance requirements, significantly reducing any sort of counterparty risk).&#x20;

The existence of UXD's +$100,000 paper profit implies that another party has a -$100,000 paper loss, in unsettled PnL. If this profit remains unsettled, UXD remains 100% backed by "decentralized" assets, because the paper PnL is a formal accounting structure on a decentralized derivative exchange.&#x20;

However, for decentralized exchanges like Mango Markets, PnL settlement may only occur in USDC. Therefore, if UXD's counterparty wishes to settle the -$100,000 PnL, they are allowed to do so by sending USDC only. Immediately after settlement, UXD is still backed 100% by assets, but the composition has become: 90% SOL, 10% USDC.&#x20;

Since UXD is not intended to ever have permanent USDC backing, there needs to be a mechanism for bringing UXD back to 100% backing by ***decentralized*** crypto assets. Note also that if the counterparty never settles the negative PnL, then UXD never holds any USDC, though eventually would be required to do so.&#x20;

### Rebalancing

The solution is a "rebalancing" mechanism that "resets" the delta-neutral position to have zero PnL. Using the above example, in one atomic transaction rebalancing works as follows:

1. UXD settles the $100,000 PnL and receives $100,000 USDC.
2. The USDC is atomically swapped into SOL, BTC or ETH through a spot-market purchase. In the above example, UXD purchases \~1,111 SOL at $90/SOL.
3. Atomically, a corresponding short SOL perp position is established for \~1,111 SOL.&#x20;

The end result is as follows:

1. UXD's depository now holds \~11,111 SOL, worth $1,000,000 at $90/SOL.
2. UXD's short SOL-perp position has 0 PnL, as the PnL has been settled.

After this operation, UXD is 100% backed by decentralized crypto assets once again.&#x20;

#### Current State of Rebalancing

In UXD's current beta state, it has not been possible to implement rebalancing due to a technical limitation regarding the number of accounts involved in a single atomic transaction and the current 200k computing units limit. As a result, UXD does not currently have a rebalancing mechanism.&#x20;

However [this proposal, ](https://docs.solana.com/proposals/transactions-v2)once implemented, will allow for continuous rebalancing of UXD's position. Moreover, since the rebalancing operation incurs fees (trading slippage + taker fees), the DAO may find it preferable to set a USDC backing %, above which rebalancing occurs.&#x20;

Currently, as of 2/08/2022, UXD is not backed by any USDC because the short perpetual futures global depository is in a negative PnL, and so there is no positive PnL at risk of settlement.&#x20;

However, UXD Protocol is working on temporary solutions to help mitigate the rebalancing issue until such a time as UXD Protocol can implement a full rebalancing solution. These will be communicated over public communications channels such as Twitter and Discord.&#x20;

#### Redeemability Liquidity

In the (viewed as unlikely) scenario that assets in the depository consist almost entirely of positive PnL, then UXD may become temporarily backed by a corresponding amount of USDC if this PnL is settled. Currently, there is no direct mechanism for redeeming UXD for USDC, so redeemability may be temporarily not possible for 100% of outstanding UXD, though such UXD would still remain fully collateralized.

UXD Protocol has developed a temporary solution in this case that would allow for UXD to be redeemed for USD&#x43;**:**

1.UXD Protocol would mint UXD using insurance fund converted to the desired collateral as a temporary buffer.

2.Add Liquidity in USDC from the insurance fund on Saber USDC-UXD pools if the pool has <= 30% USDC.&#x20;

UXD Protocol believes a combination of these two solutions will allow for sufficient exit liquidity should a user wish to exit their UXD Position. Such a solution has not been deployed on mainnet, but will be implemented very soon.

Moreover, our next audited update will include an audited rebalancing-lite instruction, that has been designed to circumvent the current technical limitation. This will be replaced by the full automatic rebalancing mechanism in the future.
