Dear Hoo users,
Hooswap is an ethereum-based decentralized trading platform (DEX). In order to solve the problem of illiquid DEX, Hooswap uses an Automated Market Maker (AMM) mechanism.
In a traditional order book, traders place orders based on the bid and offer prices shown in the order panel. In Hooswap's automated market-making algorithm, everyone's assets are pooled together in a liquidity pool and market-making is carried out based on the "Constant Function Market Maker Model" algorithm.
What’s Constant Function Market Maker algorithm?
The term can be seen as a function "X * Y = Z", in the sub-function, no matter how X, Y change, Z is always a constant value. And put into the Hooswap transaction means that the amount of two tokens multiplied by each other in the liquid pool before and after a transaction is kept constant, that is, pre-trade multiplier = after-trade multiplier.
A person creates a new liquid pool of ETH and SUSHI in Hooswap. The amounts of ETH and SUSHI are 10 and 100 respectively, the price of SUSHI is 0.1 ETH and the multiplier of the two amounts is 1000. Once the pool is created, the user can swap ETH and SUSHI in Hooswap. Suppose someone uses 1 ETH to buy SUSHI, that is, 1 ETH enters the liquid pool and the total amount of ETH in the liquid pool is 11. Therefore, the product of the two tokens is required to remain unchanged and the amount of SUSHI should be reduced, which is the amount of SUSHI that 1 ETH can buy.
Based on Constant Function Market Maker algorithm, that is, 10*100=（10+1）（100-N），N=9.09
Namely, in the AMM algorithm, 1 ETH can buy 9.09 SUSHI. But in fact, 1 ETH can be swapped for 10 SUSHI, indicating that there is an error of (10-9.09), which is 33.3%(the slippage in this trade) different from the actual.
In Hooswap's AMM algorithm, users can add funds to help reduce the slippage of transactions. In order to keep the current swap ratio of the two tokens intact, the user needs to add the current proportional amount of both tokens to the liquidity pool at the same time. In this way, the multiplier is increased, but the swap price does not change.