Swaps and Settlements
Traders can choose to swap between the following different assets on their respective protocols:
The swap process is as follows:
- 1.The price of each asset against USD is retrieved from external oracles
- 2.The current balance and target balance is calculated to determine if a discount or premium is to be applied (this incentivises arbitrageurs to rebalance the pools)
- 3.The trade volume is accounted for to determine slippage
- 4.The estimated amount of received tokens is projected for the trader
After a swap has been executed, it will be added to the list of pending settlements and there is a three-minute countdown before the position can be settled and the tokens are received.
During this settlement-pending period, the affected pools will be locked and new trades (that utilise similar pools) cannot be initiated.
The primary drawback of oracle price derivation involves front-running attacks conducted by malicious users:
- 1.Attacker sees an oracle update in the mempool.
- 2.Attacker places a favorable trade and pays a higher gas fee to ensure it is processed before the oracle update (placing a buy order if the external price goes up)
- 3.Oracles update the price to reflect the changes.
- 4.Attacker settles their position for a guaranteed profit.
- 5.Losses are distributed among liquidity providers.
To mitigate this, Centaur Swap uses an execution-settlement structure for trades. This means that prices are locked in when the trade is executed and any profit between the two events is removed from the settlement:
- 1.Trader swaps 2000 USDT to 1 ETH at 2000 USDT/ETH
- 2.Trader waits 3 mins for the settlement
- 3.At the time of settlement,3.1 If the price of ETH increases to 2500 USDT/ETH, the trader will receive 0.8 ETH3.2 If the price of ETH decreases to 1500 USDT/ETH, the trader will still receive 1 ETH
The extra ETH is kept in the liquidity pool and distributed to liquidity providers proportionately. As this is a fringe use case, we do not expect the amount to be of major significance.
Due to the calculations required for the curves and the technologies employed (details in the technical section of this document), the gas consumed is higher than simplified automated market makers. We are actively following the developments related to scalability on Ethereum. Centaur Swap has been deployed on the Polygon network and we looking at other L2 protocols in the future. There is also a trading competition to support the first month of the launch and to reward users who provide tangible data for future versions.