Every deposit transaction requires a gas fee to generate the zero-knowledge proof. Currently, the node operator is subsidizing this fee that exempts the user from paying the processing fee for the deposit. Both standard and advanced deposits have been set with a quota of the number of free subsidies to prevent abusive attacks on the protocol. This quota decreases each time the subsidy is used and is replenished linearly over time. The quota-related parameters for the standard deposit are configured in the node while for the advanced deposit, they are configured in DeGate smart contract.
The standard deposit process begins with the user performing a deposit to the contract address. When the deposit transaction is confirmed on-chain, there is a check on whether the subsidy quota has been used up. If the quota has been fully utilized, the user will be required to pay a processing fee for deposit before the node processes the asset deposit into their DeGate account. The advanced deposit process has a slightly different workflow. If the subsidy quota is fully utilized, the user is required to include an additional processing fee for deposit on top of the gas fees needed to call the smart contract deposit function, and this is only payable in ETH. The failure to do so may result in the transaction failing. All processing fees for deposits can only be paid with ETH.
In centralized exchanges, both token and trading pair managements are conducted manually. For instance, the listing process is typically done and overseen through a series of operational procedures. DeGate, on the contrary, supports these functions in a permissionless manner. Anyone can perform an ERC20 token listing which enables all other users in DeGate the ability to deposit these listed tokens. Listed tokens are automatically added to DeGate's global token list. On top of this, users will also be able to create new trading pairs and place orders in the order book.
Inevitably, the permissionless token listing mechanism may bring forth some problems. Just to name a few, the listing of counterfeit tokens, burn on transfer, and non-ERC20 rebase tokens. Tokens with these characteristics can harm user experience in DeGate or even attack DeGate protocol through price manipulation. Therefore, some parameters are configurable for the global token list which will be managed by the DeGate node operator to avoid the abovementioned problems.
The node operator manages a list of default tokens – tokens in this list have successfully been verified on their token icon, symbol, and contract address data against websites like coinmarketcap, tokenlists, etc. Users can be assured that these tokens are valid when dealing with these default tokens on DeGate. The management of the default token list will be regularly maintained and updated by the node operator where mainstream and common assets will be identified as default tokens. The quote currency for trading pairs is default tokens – ETH, USDC, and USDT.
Newly permissionless listed tokens will not automatically become default tokens. Users will also be able to see a risk warning during the trading of these new tokens.
Refer to the table below for the difference between a default and a non-default token:
It is mainly distinguished by the token icon and contract address. Picture 1 shows a counterfeit token and Picture 2 shows the real token.
Picture 1: Non-Default Token
Picture 2: Default Token
Since DeGate offers the permissionless listing of tokens and trading pair creation, without setting a restriction minimum order size. This can increase transaction cost and potentially expose the protocol to attacks. Hence, before users can place an order, they will need to fulfill the minimum order size criteria set in place. The protocol acknowledges that DeGate's minimum order size threshold is notably higher than the usual centralized exchange. Hence, the concept of a highly trading volume token is introduced to reduce the minimum order size requirement. The computation method of the value of each order differs if the token is a high or low trading volume token.
DeGate offers a gas-saving option through the standard deposit method. Most tokens should be eligible but there may be some tokens that cannot be deposited through the standard deposit method as a result of the problems relating to trustless.
A trading pair consists of a base token and a quote token. For example, the trading pair of ETH/USDC. ETH is the base token. USDC is the quote token. Tokens that are listed by users can only be used as the base token in a trading pair. Currently, only ETH, USDC, and USDT can be used as a quote token during the trading pair creation. In the future, the DAO can vote to support more assets as quote tokens in trading pairs.
The gas fee collected for each trade is paid in the quote currency.
For example ETH/USDC trading pair
- Buy ETH: When buying, the user will require USDC, and the gas fees can be paid with the USDC in the account balance
- Sell ETH: When selling, the user does not need to have USDC, the gas fees can be paid from the obtained USDC
Currently, each base token can create 3 different trading pairs. Namely XXX/ETH, XXX/USDC, and XXX/USDT. DeGate protocol has designed 3 different types of prices to manage risk on DeGate:
- Risk Price: Each token has only one risk price which is calculated based on the trading data from all the token-related trading pairs.
- Real-Time Price: Each token has only one real-time price which is calculated based on the trading data from all the token-related trading pairs.
- Latest Price: Every trading pair has only one latest price – the price of the last trade done.
Amongst the above prices, the risk price is the most important as it is used to calculate the order value which determines if an order can be placed. Real-time prices are used for data computation and the latest price is displayed on the trade user interface.
- 1.For any token XXX, take the historical data of all XXX-related trading pairs and perform an hourly computation. Select the trading pair, P, that has the highest average traded volume in a period.
- 2.The risk price for token XXX will be the average price of P in a period.
- 3.The real-time price for token XXX will be the latest price of P.
Calculation of the Risk and Real-Time Prices
The minimum order size is used to determine if an order can be placed, currently set at $100, and this is configured by the node operator. In the future, the value of the minimum order size will be adjusted according to Ethereum's network cost and the statistical data of DeGate's trade amount.
There are different computation conditions of the minimum order size varies and it depends if the base token is a high/low trading volume token.
- High Traded Token:
- value of base token >= minimum order size, or
- value of quote token >= minimum order size
- Low Traded Token:
- value of quote token >= minimum order size
Where the value of a token = quantity * risk price.
Using ETH/USDC as an example.
- Minimum order size = $100
- ETH is a high trading volume token.
- Assuming the risk price of ETH is $2,000.Example A:
- The user can place the buy order of 0.05 ETH at $1,500 as
- value of ETH = $2,000 * 0.05 = $100
- $100 is >= minimum order size
- value of USDC = $1,500 * 0.05 = $75
- $75 is < minimum order size
- Even though the value of the quote token (USDC) did not fulfill the condition, the order can still be placed because the value of the base token (ETH) has met the minimum order size criteria for a High Traded Token. Only one of the two conditions needs to be met.Example B:
- The user cannot place the sell order of 0.04 ETH at $2,100 as
- value of ETH = $2,000 * 0.04 = $80
- $80 < minimum order size
- value of USDC = $2,100 * 0.04 = $84
- $84 < minimum order size
- The order cannot be placed as both conditions for the value of the base token (ETH) & the quote token (USDC) have not been met.
Using XYZ/USDC as an example.
- Minimum order size = $100
- XYZ is a low trading volume token.
- Assuming the risk price of ETH is $2.Example C:
- The user cannot place the buy order of 40 XYZ at $1.5 as
- value of USDC = $1.5 * 40 = $60
- $60 < minimum order size
- The order cannot be placed as the condition for the value of the quote token (USDC) has not been met.Example D:
- The user can place the sell order of 20 XYZ at $10 as
- value of USDC = $10 * 20 = $200
- $200 >= minimum order size
- The order can be placed as the condition for the value of the quote token (USDC) has been met.
The minimum order size rule also applies to grid strategy meaning that all orders under a grid strategy must meet the minimum order size.
There is a limit to the number of active orders each DeGate account can have at a given time which is constrained by the Risk Order and the Circuit Constraint. The node operator has the ability to adjust these parameters except for the circuit constraint.
The concept of risk orders is to reduce the number of malicious open orders in the market. The bandwidth is intended to be large such that typical users will not experience any restrictions. This bandwidth constraint of risk orders is shared between the regular order and orders in the grid strategy.
After an order satisfy the minimum order size (value of token = token risk price * token transaction quantity) condition, there is another layer of check to determine if an order is a risk order based on the token's attributes. The rules are as follows:
1. The base token is ETH, USDC or USDT
2. The base token is not ETH, USDC, USDT, or a high trading volume token
3. The base token is a high trading volume token but not ETH, USDC or USDT
There can at most be 16,384 active orders from regular open order and grid strategy as each account only has 16,384 StorageID in the circuit.
From a performance standpoint, the DeGate protocol has also set some restrictions which are configurable and managed by the node operator:
- Maximum number of orders created per minute applied to each account level
- Maximum number of grid strategies created per minute applied to each account level
Even though the DeGate protocol allows the permissionless listing of any token, to protect the interests of DeGate's users and prevent attacks on the protocol, DeGate has a token blacklist feature that can affect certain features in DeGate's front-end and back-end services. The token blacklist is managed by the node operator. Examples of tokens that will be blacklisted are non-ERC20 tokens that can modify balance and freeze transfer burn on transfer.
Tokens that are on the blacklist will not be able to use the following operations:
- Deposit: The standard/advanced deposit function will not be processed and the tokens will not be deposited into the DeGate account when initiated from the user interface of degate.com or through direct smart contract interaction. Users will need to contact the discord administrator to retrieve back their deposit of the blacklisted tokens.
- Transfer: Will not be able to transfer assets to other DeGate accounts.
- Create Trading Pairs: Will not be able to add new trading pairs on DeGate.
- Order: Will not be able to submit a new order or create a new grid strategy
- List Tokens: Token listing will not work when in the degate.com user interface but users can still directly call and perform token registration with DeGate smart contract
Operations that will still work:
- Viewing of token balance
- Viewing of historical data
- Order cancellation
- Grid Strategy cancellation
In addition to the manual maintenance of the token blacklist, there is also an automatic function to add tokens to the blacklist. The conditions are as follows:
- 1.During the verification process of the deposit, if the deposit amount recorded in the smart contract differs from the actual token amount received, the token will automatically be added to the blacklist.
- 2.Perform verification before submitting data to the blockchain. If the off-chain balance is greater than the on-chain asset balance, the token will automatically be added to the token blacklist.
The node operator can manually remove the token from the token blacklist