Value before commodity exchange=Value after commodity exchange
The reason for exchange is the mismatch between quantity and value, automatically matched through market mechanisms
Let:
- Va: Current total value of Token A (unit: e.g., USD)
- Qa: Current total quantity of Token A
- Vb, Qb: Total value and quantity of Token B
- Δa: Quantity of A that the user wants to invest
- ΔV: Value transferred in this exchange (from A to B)
- Δb: Quantity of B exchanged from the pool based on value transfer
Δb=Qa+ΔaQb⋅Δa
Split commodity b according to the quantity of a, then exchange Δa portions
ΔV=Qa+2ΔaVa⋅Δa
Δb=Vb+2ΔVQb⋅ΔV
| Token A | Token B |
---|
Value | Va | Vb |
Quantity | Qa+Δa | Qb−Δb |
- After trading completion, new marginal values:
Panew=Qa+ΔaVa,Pbnew=Qb−ΔbVb
Ra→b=PbnewPanew
Twitter:@ttswapfinance
Telegram:@ttswapfinance
Email:bussiness@ttswap.io
Discord:ttswap
Github:ttswap
Website:ttswap.io
Welcome everyone to join our community