FlashSwap
Swap collaterals from a single margin account.
Last updated
Swap collaterals from a single margin account.
Last updated
Flash Collateral Swaps on Reya allow for the atomic changing of collateral assets:
Without Flashswaps: If there is an open perp position on a margin account, to swap the collateral covering this exposure, the position has to be unwound, collateral withdrawn, swapped and re-deposited to be able to open the position.
With FlashSwaps: The perp positions can be kept open while swapping collateral assets atomically within one block.
Reya DEX integrated with Camelot Smart Contracts to swap assets directly from the margin account. The liquidity pools can be used as usual via the Camelot UI to provide liquidity and swap assets from a wallet. Swaps from the Reya margin account can be executed on the Reya DEX UI. Here, the supported pairs are listed under Spot Markets, their pricing and execution are done via the same Camelot liquidity pools.
On Reya, a margin account can hold collateral in multiple assets (e.g. rUSD, deUSD). The integrated swap functionality on Reya DEX allows users to swap within their margin accounts. The tokens will go in and out of your selected margin account, no wallet interaction, no token approval. If 1-click-trading is activated on the selected account, the wallet won't be prompted to sign the transaction either.
Key elements of a swap:
Enter the amount to sell in the 'From' field. The corresponding amount received will appear in the 'To' field. This is calculated based on Camelot's price and price impact.
The maximum amount that can be sold is the balance which is not locked by margin requirements.
The yellow icon allows you to switch the swap directions.
Once an amount to sell is introduced, price impact and post-swap margin ratio are calculated.
The Price Impact shows the potential change of the AMM tick caused by this swap. This is already accounted for in the given price (i.e. the generated amount 'To').
The user can set their preferred slippage tolerance which can come up on top of the calculated price impact. If the obtained price exceeds the slippage tolerance, the transaction won't execute.
The margin ratio post-swap shows the health of the account after the swap is executed.
Executing a FalshSwap means the amount of sold tokens will be deducted from your margin account and the bought tokens will be added to the balance. Even though the exposure does not need to be closed, the balance accounted for collateralising positions on Reya DEX can change after the swap. There are two key elements to it:
Some collateral tokens on Reya DEX are subject to haircuts to protect the settlement layer. This is a small percentage that won't contribute to collateralising exposures but will remain in the margin account and can be withdrawn as usual. The swap form shows your account's 'Margin Ratio Post Swap' which is the ratio of exposure over the post-swap margin balance.
The swap price is determined by Camelot's liquidity pool and it includes slippage. The exchange rate used by Reya DEX to calculate margin balances is different, coming from the Stork Price Feeds. These prices do not always align and the total rUSD value of your margin can change after a swap due to exchange rates.