DeFi Demo
Sell Order Book
Limit | Amount (TOKEN) | Filled (0) | * |
Buy Order Book
Limit | Amount (WART) | Filled (0) | * |
0 TOKEN
0 WART
0 WART
0 TOKEN
Pool
Pool Interaction
Before
After
Explanation
N/A TOKEN
600 TOKEN
TOKEN
N/A WART
250 WART
WART
N/A
N/A
N/A
PRICE
Seller Swaps
* | FROM (TOKEN) | TO (WART) | PRICE |
---|
Buyer Swaps
* | FROM (WART) | TO (TOKEN) | PRICE |
---|
Questions and Answers
What is this?
Warthog is implementing a completely new DeFi model supporting a matching engine, which, in a one-of-a-kind way combines two sources of liquidity in a fair and sandwich-proof way:
- discrete liquidity in the form of order books
- continuous liquidity in the form of a liquidity pool
What do you mean by "sandwich-proof"?
Sandwich attacks are one of the most dreaded DeFi attacks. They are part of a bigger problem called front-running which is inherently caused by that fact that in current DeFi designs reordering of transactions has an effect on their fill price. This is highly unfair against traders because their transactions are regularly sandwiched (front-run and back-run) by exploiters of this design. For example they buy before normal buy orders are executed, and sell immediately afterwards, essentially doing arbitrage trading within a block and causing financial loss to their victims. Reordering of Warthog's transactions won't have any effect such that sandwich attacks are not possible.
What is a matching engine?
Simply put, in TradFi (Traditional Finance) a matching engine is a program or routine that matches buy and sell orders. It is responsible for deciding which orders are matched and deducting fees. In Warthog we do not only match buy and sell orders, but also pool liquidity.
What are "WART" and "TOKEN"?
WART is the native currency in Warthog. In this demo it acts as the quote currency. TOKEN acts as a generic placeholder for any Warthog tradable token (a feature that we are working on) that takes the role of the base currency.
What are base and quote currencies?
In finance terms, when talking about trading a currency pair, the currency that you are trading, i.e. buying or selling, is called base currency, whereas the other, the one with respect to which you are expressing the price, is called quote currency. In this example TOKEN is the base currency since we are refering buy/sell terms to TOKEN, and WART is the quote currency since we are expressing the prices in WART.
What are the orange, blue and yellow colors expressing?
For easier visualization we use the following color-codes:
- Orage: TOKEN amount
- Blue: WART amount
- Yellow: Price
Why is the buy order amount measured in WART but not in TOKEN despite I am buying TOKEN?
In DeFi trades are specified as swaps, i.e. the input amount is specified for both trade directions
- When you swap from WART to TOKEN the WART to be swapped is specified.
- When you swap from TOKEN to WART the WART to be swapped is specified.
How does matching work in Warthog?
The matching mechanism that we invented at Warthog works by finding a price p at which the situation between buy and sell orders is saturated, i.e.
- Buys are saturated: Either all swaps from WART to TOKEN at current limit price or above are filled, or additional swaps would move the price down below a limit swap that was partially matched already.
- Sells are saturated: Either all swaps from TOKEN to WART at current limit price or below are filled, or additional swaps would move the price up above a limit swap that was partially matched already.
- Some buy or sell pressure goes to the pool to move the price to p