WOW Architecture
Last updated
Last updated
The following diagram describes the high-level architecture and workflow of WOWswap protocol.
Reserve is a smart-contract for liquidity pools. Liquidity Providers (LP) can deposit liquidity to Reserve in lendable tokens (BNB or BUSD). Reserve contract has ERC20 token interface – LP receive these tokens according to their share of the pool.
Pair is a smart-contract responsible for opening, closing and liquidating trading positions. Pair contracts are created for each tradable/lendable token pair, for example, CAKE-BNB. Pair contracts temporary hold all tradable tokens bought by traders, and mint proxy-tokens, which are sent to traders instead of real tokens. Proxy-tokens are necessary to make sure that traders pay back their debts to the liquidity pools. Proxy-tokens are pegged 1:1 to real tokens held by Pair contracts on behalf of traders.
Factory is a smart-contract factory: it creates Reserve contracts for new liquidity pools and Position contracts for new tradable/lendable token pairs. For security reasons only Factory is authorized to call some methods, for example, borrow, which borrows liquidity from the Reserve smart-contract.
Router – is an entry point for users, who interact with WOWswap though this smart-contract. Router allows adding and withdrawing liquidity, as well as opening, closing, and liquidating trading positions. PancakeSwap Router and Uniswap Router are entry points of decentralized exchanges, where actual swaps of tradable tokens take place.
Chainlink Price Guard - WOWswap checks if the price on AMM does is not less than 102% of the Oracle’s price. If the price is lower or higher, transaction is not allowed.