Routes

Route

We would like to add a second pallet that is able to route orders between different AMM instances or pools. We chose to not make it part of the AMM pallet due to the fact that the AMM pallet can be instantiated many times, and we may want to route orders between all of them (for example we could have a route USDT-KSM-xKSM).

Trade

The calculation is as follows:

amount_out = amount_in * supply_out / (supply_in + amount_in)
  • amount_in being the amount of base_token entering the pool

  • supply_in being our supply of base_token tokens in the pool

  • supply_out being our supply of quote_token tokens in the pool

Last updated