Swaps and Trades
This page provides an overview of how DiamondSwap functions, covering key concepts such as swaps, price impact, slippage, automated slippage mechanisms, and the associated protocol and service fees.
Introduction
Swaps are the most common way of interacting with DiamondSwap. Swapping is straightforward: a user selects a token that they own and a token they would like to trade it for. Executing a swap sells the currently owned tokens for the proportional amount of the tokens desired, minus the swap fee, which is awarded to liquidity providers. Swapping with DiamondSwap is a permissionless process (open for anyone to participate).
Swaps using DiamondSwap are not executed against discrete orders on a first-in-first-out basis like traditional order book trades — rather, swaps execute against a passive pool of liquidity, with liquidity providers earning fees proportional to their capital committed.
Price Impact
In a traditional order-book market, a sizeable market-buy order may deplete the available liquidity of a prior limit-sell and continue to execute against a subsequent limit-sell order at a higher price. As a result, the order's final execution price is somewhere between the two limit-sell prices against which it was filled.
Price impact affects the execution price of a swap similarly but is the result of a different dynamic. When using an automated market maker, the relative value of one asset in terms of another continuously shifts during the execution of a swap, leaving the final execution price somewhere between where the relative price started and ended.
This dynamic affects every swap using DiamondSwap, as it is an inextricable part of AMM design.
As the amount of liquidity available at different price points can vary, the price impact for a given swap size will change relative to the amount of liquidity available at any given point in price space. The greater the liquidity available at a given price, the lower the price impact for a given swap size. The lesser the liquidity available, the higher the price impact.
DiamondSwap's dApp predicts approximate price impact in real-time, and warnings appear if an unusually high price impact is expected during a swap. Anyone who executes a swap will be able to assess the circumstances of price impact when necessary.
Slippage
The other relevant detail to consider when approaching swaps with DiamondSwap is slippage. Slippage is the term we use to describe alterations to a given price that could occur while a submitted transaction is pending.
When transactions are submitted to the blockchain, their order of execution is established by the amount of 'gas' offered as a fee for executing each transaction. The higher the fee offered, the faster the transaction is executed. The transactions with a lower gas fee will remain pending for an indeterminate amount of time. During this time, the price environment in which the transaction will eventually be executed will change, as other swaps will be taking place.
Slippage tolerances establish a margin of change acceptable to the user beyond price impact. As long as the execution price is within the slippage range, e.g., %1, the transaction will be executed. If the execution price ends up outside of the accepted slippage range, the transaction will fail and the swap will not occur.
A comparable situation in a traditional market would be a market-buy order executed after a delay. One can know the expected price of a market-buy order when submitted, but much can change in the time between submission and execution.
Auto-slippage
We've developed an automated slippage mechanism that sets us apart from other decentralized exchanges (DEXs). This feature allows DiamondSwap to dynamically calculate the required slippage for both buying and selling tokens, even those with associated transaction taxes. By doing so, it eliminates the need for users to manually adjust slippage settings, simplifying the trading process. The slippage rate, which can range from 0.01% to 5%, is automatically adjusted based on factors such as network activity, gas costs, and trade size. This ensures optimal trade execution and reduces the risk of unfair trading practices.
Protocol Fee: 0.2%
This fee is split by liquidity providers proportional to their contribution to liquidity reserves.
Swapping fees are immediately deposited into liquidity reserves. This increases the value of liquidity tokens, functioning as a payout to all liquidity providers proportional to their share of the pool. Fees are collected by burning liquidity tokens to remove a proportional share of the underlying reserves.
If you are interested in learning more, understanding risks, or just conceptualizing a liquidity position you can read this article
Example:
A $10,000 exchange using $ETH as the input token and $USDC as the output token would result in a ~$20.00 fee from the input token, split proportionally amongst all LP providers.
Important Note: Please be aware that fees are deducted from the ultimate traded amount, following any applicable slippage. As a result, calculations might exhibit variance accordingly.
Service Fee: 0.1%
On all swaps, DiamondSwap takes a 0.1% trading fee on the output token.
This trading fee is allocated to the DiamondSwap Treasury. The Treasury can be used in a multitude of ways, including:
- Facilitating company growth.
- Forming Protocol Owned Liquidity.
- Growing Protocol Treasury.
Example:
A $10,000 exchange using $ETH as the input token and $USDC as the output token would result in a ~$10.00 fee on the output token ($10.00 in USDC).
Important Note: Please be aware that fees are deducted from the ultimate traded amount, following any applicable slippage. As a result, calculations might exhibit variance accordingly.
Updated 3 months ago