Glossary
A pair (or pool) in SIZE is a smart contract that holds the ERC20 tokens where actual events (swap/deposit/withdraw) happen. Currently SIZE only supports 2-token swapping (does not support multi-token swapping), so each pool contains only 2 tokens. Each trading pair (such as WBTC-WETH, USDC-WETH) has its own pool.
Due to the delay mechanism, only the delay contract can directly interact with the pair contract, i.e. all the swap/deposit/withdraw actions have to be invoked by the delay contract, and cannot be triggered by anyone else.
Pair creation is a governance-controlled process instead of a templated system such as in Uniswap. This is because pair creation in SIZE involves many other parameters including oracle choice, fee rate, etc, that need to be decided by governance.
Oracle in the SIZE is a smart contract that holds the reference to the external price oracle and contains the math that swaps involve (given tokenIn calculate tokenOut etc). Currently SIZE only supports Uniswap V2 oracle.
The curve is a mathematical function that calculates the swap amount. In Uniswap, the curve is a constant product formula x*y=k, which implies
thus given
, one can calculate
and vice versa.
In SIZE, the curve is a constant swap function, meaning that it always fills the order at the oracle TWAP price, regardless of order size. Therefore, there is no price impact.
Delay in the SIZE is a smart contract that serves as an intermediary layer between users and the SIZE pool contracts. All user interactions with the SIZE (swap/deposit/withdraw, etc) will be done through the delay contract. In particular, every user action (swap/deposit/withdraw) will experience a delay.
The key parameter (governance controlled) in the delay contract is the delay parameter. It dictates the time period that has to elapse before any particular user action can start to be processed. The delay parameter can range from minutes to a week. This delay parameter is also the time duration of the TWAP window.
Order is an instruction struct that a user sends to the delay contract to be processed. An order can be swap, deposit, or withdraw. Once an order is successfully sent, it will be enqueued in the system. After the delay time has passed, the order will become eligible and will be processed in the order it is received. A swap order will be filled at the TWAP price of the oracle over the window between the submit time and the execution time.
In order for orders to be executed smoothly, a bot is set up to run continuously to look for eligible orders to execute. Once the bot sees eligible orders, it will initiate an Ethereum transaction to execute the order. Currently, the bot is set by admin, i.e. not everyone can become a bot.
Last modified 1yr ago