In the cryptocurrency industry, the terms "swaps" and "replacements" are used in a broader technical sense.


A swap is simply the transfer of one type of token for another.
The main advantage of swapping in DeFi is that it is both atomic and non-custodial. In a smart contract, funds can be tailored with withdrawal rights that can be exercised at any time before the swap is completed. If the swap fails, all parties involved retain their custody funds. The swap only takes place when all parties agree to and meet the exchange criteria, which are enforced by the smart contract. If any of the conditions are not satisfied, the entire transaction will be canceled. A decentralized exchange (DEX) is a platform that allows non-custodial token swapping on Ethereum. For DEX liquidity, there are two basic mechanisms: an order-matching approach and an Automated Market Maker.


Trading in the DeFi space encompasses a variety of activities, including derivatives trading, margin trading, and token swaps, and occurs over an ever-growing and integrated network of exchanges, liquidity pools, and marketplaces. Decentralized exchanges provide cryptocurrency traders with lower exchange fees, faster transaction settlement, and full custody of their assets.


Liquidity Provider Fees

There is a 0.3% fee for swapping tokens. This fee is split by liquidity providers proportionally to their contributions to liquidity reserves. Swapping fees are immediately deposited into liquidity reserves. This increases the value of liquidity tokens and functions 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. Since fees are added to liquidity pools, the invariant increases at the end of every trade. Within a single transaction, the invariant represents token0_pool * token1_pool at the end of the previous transaction.

Protocol Fees

There are currently no protocol fees. A 0.05% fee, on the other hand, might be implemented in the future.