Exploring Another Architecture for DEX from ArtexSwap

Intermediate7/29/2024, 11:18:36 AM
This article explains the mainstream architectures of DEX, their main risks, design issues of Bancor, and the specific implementation and security explorations of ArtexSwap. It focuses on how ArtexSwap improves security and efficiency through Artela EVM++ and Aspect technology.

ArtexSwap is a decentralized exchange that uses Artela EVM++ and Aspect technology to address MEV risks and Rug Pull issues, enhancing transaction security and efficiency. It is suitable for decentralized trading scenarios that require high security and flexibility.

Since the birth of Ethereum, it has been a home for digital currencies, global payments, and applications. DEX (Decentralized Exchanges) are the cornerstone of decentralized finance (DeFi). After all, without DEX, DeFi can be said to be just an empty talk. As a platform running on the blockchain, it allows direct transactions between users without being regulated by any third-party institutions, making it possible to create more advanced financial products.

1. Mainstream Architectures of DEX

Currently, in the Ethereum ecosystem, DEXs are flourishing with many different design models. Each model has its pros and cons in terms of functionality, scalability, and decentralization. Based on the different transaction mechanisms, DEXs can be divided into two categories (as shown in the figure below).

1.1. DEX based on order book

The order book essentially matches algorithms, automatically searching various markets for unfulfilled buy and sell orders. The trading platform’s system will automatically match these buy and sell orders. It is suitable for scenarios requiring efficient price matching and flexible trading strategies. In short, the liquidity of the order book comes from two sources: traders and market makers.

For further reading, see: “A Brief Analysis: Order Book Model and Automated Market Making (AMM)” (Appendix)

1.2. Automatic Market Maker (AMM)

An automated market maker (AMM) is a pricing and liquidity determination mechanism in DEX. Simply put, it is a market maker that provides liquid assets (two assets) to the liquidity pool. The product of the reserves in the liquidity pool is maintained at the k value. When a user takes away a coin, he or she needs to provide another coin to the liquidity pool to maintain the k value.

For a detailed understanding of AMM, you can further read: “UniswapX Research Report (Part 1): Summarize V1–3 development links and interpret the principle innovation and challenges of the next generation of DEX

1.3 What Value Does DEX Provide?

According to CoinGecko’s statistics, as of July 9, 2024, there are about 835 known DEX exchanges with a 24-hour trading volume of 8.35 billion dollars, and a monthly visit volume of 320 million times.

In terms of trading volume, the three largest decentralized exchanges are BabyDogeSwap, Uniswap V3 (Ethereum), and Orca.

We calculated the 24-hour trading volume of the top three DEX and CEX, and DEX accounted for 16% of the single-day trading liquidity. Moreover, compared to the same period in 2023, the 24-hour trading volume of DEX increased by 315% (20 billion in 2023), and the trading volume increased by 166% (120 million in 2023). It is clear that there is a huge demand for decentralized trading platforms in the market.

Because decentralized exchanges (DEX) use deterministic smart contracts for transactions without the intervention of centralized third parties, this transparent operation is in stark contrast to traditional financial markets.

For example, in 2022, FTX, one of the largest cryptocurrency trading platforms at the time, went bankrupt due to a series of market downturns caused by the misappropriation of user funds, causing widespread market turmoil.

Additionally, DEX enhances financial inclusiveness through decentralization. Some CEX may restrict user access based on geographic location or other factors.

But overall, users only need to access the internet and connect a compatible self-built wallet to use DEX services. This mode, which does not require cumbersome registration and verification, allows new users to join the platform quickly and conveniently, improving the user experience.

2. Major Risks of DEX

Decentralized exchanges (DEX) ensure the execution of trades, enhance transparency, and allow permissionless access, significantly lowering the barriers to trading and providing liquidity. However, DEX also come with some risks, which include but are not limited to the following:

Smart Contract Risks: Although blockchain technology can securely execute financial transactions, the security of smart contracts depends on the technical level and experience of the development team.

Front-Running Risks: Due to the public and transparent nature of on-chain transactions, arbitrageurs or MEV bots may front-run transactions to capture value from regular users. These bots are similar to high-frequency traders in traditional financial markets, profiting from regular users’ transactions by paying higher fees and exploiting network latency.

Network Risks: Since transactions are conducted on-chain, the trading costs on DEX can be high, especially when the network is congested or down. Therefore, users are susceptible to market volatility.

Rug Pull Risks: A common and severe problem in the decentralized finance (DeFi) space, where numerous projects attract significant investor funds, only for the project team to suddenly withdraw liquidity and abscond with the funds. Rug pull risks can be broadly categorized into three types:

  • Liquidity Withdrawal
  • Developers holding a large number of tokens or issuing new ones
  • Fraudulent projects

Such scams result in substantial losses for investors, causing the project value to plummet to zero instantly. This severely impacts the overall trust in the DeFi market. For example, the 2021 SushiSwap incident is a classic case. The anonymous founder of SushiSwap, Chef Nomi, sold $13 million worth of SUSHI tokens from the developer fund after raising a large amount of capital, causing market panic and a sharp drop in token prices. Although Chef Nomi later returned the funds and the project management was taken over by the community, this incident caused significant financial losses and psychological impacts on investors.

3. Issues Extending from Bancor to DEX

When discussing the pioneer of AMM (Automated Market Makers), Bancor cannot be overlooked. Unfortunately, before the DeFi boom, it did not receive widespread attention, leading many to mistakenly believe that AMM was invented by Uniswap.

Today, with the introduction of Bancor V2, which includes innovative designs such as using oracles to provide the latest prices and updating token pool ratios based on oracle prices, it still has some drawbacks.

The introduction of oracles can provide more accurate price information but also brings implementation challenges. For instance, if there is no corresponding trading pair price on a centralized exchange, this creates a chicken-and-egg problem. Additionally, the reliability and security of oracles are concerns, as they can be targets for attacks, leading to price manipulation and other security issues.

The dynamic pool model can update the token pool ratio based on oracle prices, but in highly volatile markets, liquidity providers (LPs) may face greater risks of loss. The higher the market volatility, the more severe the impermanent loss for LPs, which may lead to liquidity providers withdrawing funds, affecting the stability and trading efficiency of the liquidity pool.

Bancor’s design may also face counterparty risks. Although the oracle mechanism is introduced, if the market price fluctuates sharply and the oracle cannot update prices in time, liquidity providers may still face significant risks. Delays or inaccuracies in oracle price updates can result in losses for LPs during price swings.

Despite the many innovative designs introduced in Bancor V2, its complexity also increases the learning and usage threshold for users. Compared to other simpler and more user-friendly AMM models, Bancor may require users to grasp more professional knowledge and technical background to fully understand and utilize its new features. This may limit its user growth and market acceptance.

4. DEX implementation of ArtexSwap

The ArtexSwap platform operates similarly to Uniswap, but has enhanced security by using the native capabilities of Artela EVM++.

4.1 Artela’s Scalability Mechanism

First of all, in order to better understand the underlying environment of ArtexSwap, let us first briefly talk about the underlying operating mechanism of Artela. The scalability here actually contains two meanings, namely the scalability and performance of EVM.

For extensibility, Artela introduces Aspect technology to achieve this. This technology supports developers in creating on-chain custom programs within the WebAssembly (WASM) environment. These programs can collaborate with the EVM to provide dApps with high-performance, customized application-specific extensions. For further reading: “Insights of Vitalik Buterin: The Next Station of Web3.0 Infrastructure, Is It ‘Encapsulation or Expansion’?” (see appendix).

From a performance perspective, it’s about improving the execution efficiency of the EVM. We all know that the EVM is a serial virtual machine environment, which is very inefficient compared to today’s hardware. Therefore, parallel processing becomes especially important.

To achieve parallel execution, the following issues need to be addressed:

  1. How to resolve conflicts in simultaneously executed transactions? Adopting a predictive optimistic execution strategy for parallel execution, assuming that transactions initially do not conflict. Each transaction records modifications but does not finalize them immediately. After the transactions are executed, verification is performed to check for conflicts. If any exist, re-execution occurs. Predictive modeling uses AI models to analyze historical transaction data, predict transaction dependencies, optimize execution order, and reduce conflicts and re-execution. In comparison, Sei and Monad rely on predefined transaction dependency files and lack Artela’s AI-based dynamic prediction model’s adaptive capabilities, giving Artela an advantage in reducing execution conflicts.
  2. How to increase IO speed and reduce transaction execution wait time? Using asynchronous preloading technology to solve the input/output (I/O) bottleneck caused by state access. Before transaction execution, Artela uses predictive models to preload the required state data from slow storage (like hard drives) into fast storage (like memory). This preloading and caching technique allows multiple processors or execution threads to access data simultaneously, increasing parallelism and efficiency.
  3. How to address data bloat and increased database processing pressure during data writing? Artela combines various traditional data processing techniques to develop a parallel storage system, improving the efficiency of parallel processing. The parallel storage system mainly solves two issues: achieving parallel processing of storage and enhancing the ability to efficiently record data states into the database. Common problems during data storage include data bloat and increased database processing pressure when writing data. To address this, Artela adopts a strategy of separating state commitment (SC) from state storage (SS). This strategy divides storage tasks into two parts: one part handles operations quickly without retaining complex data structures to save space and reduce data duplication, while the other part records all detailed data information. Additionally, Artela merges small data chunks into larger blocks to reduce the complexity of data storage, ensuring performance is not affected when handling large amounts of data.

Furthermore, validator nodes support horizontal scaling, allowing the network to automatically adjust the scale of computing nodes based on current load or demand. This scaling process is coordinated by an elastic protocol to ensure sufficient computing resources in the consensus network. Through elastic computing, the network node’s computing power can scale, achieving elastic block space. This allows for the allocation of independent block space according to demand, meeting the expansion needs of public block space while ensuring performance and stability. This enables the DEX to handle peak trading periods smoothly, similar to the elastic scaling of Web2.

It is worth mentioning that elastic block space, as a solution for horizontally scaling blockchain performance, is based on the premise of “transaction parallelization.” Only after achieving a high degree of transaction parallelism does it become necessary to horizontally scale node machine resources to improve transaction throughput.

4.2 ArtexSwap’s DEX Security Exploration

ArtexSwap has been updated to version 2.0. Judging from the architecture of ArtexSwap, it mainly focuses on three security aspects, namely:

  • How should DEX identify and prevent malicious behavior?
  • How to prevent users from being harmed by Rug Pull when trading?
  • How to prevent high slippage from happening?

Blacklist mechanism


The blacklist mechanism is a strategy that emphasizes preemptive security. From a behavioral standpoint, addresses and users who have participated in malicious activities are highly likely to reoffend. By tagging accounts, addresses, and contracts deemed risky, ArtexSwap can preemptively assess both parties and the environment involved in a transaction before it occurs. The blacklist mechanism continuously monitors trading activities, checking each one to see if it involves any “dangerous entities” listed on the blacklist. When a request from a blacklisted account is detected, it is automatically blocked to prevent malicious activities.

For example, if an account is blacklisted for participating in a rug pull or other fraudulent activities, it will be unable to trade or add liquidity on the DEX, thus protecting other users from potential losses.

Essentially, ArtexSwap provides a passive defense system focused on the end-user (C-end).

Anti-Rug Mechanism

A rug pull occurs when developers or large holders suddenly increase the token supply or withdraw a significant portion of funds from the liquidity pool, causing the token price to plummet and resulting in substantial losses for investors.

These incidents are often associated with contracts that have backdoors. Such cases usually slip through the cracks of the blacklist mechanism because blacklist information can be somewhat delayed. Generally, there are two scenarios:

  1. The contract vulnerability is undiscovered.
  2. Find that the blacklist disappears.

In the first scenario, where there is no direct evidence of issues with the token contract, ArtexSwap adopts an optimistic approach, assuming the contract is safe by default. If such actions are detected, they are blocked, and trading of the related token is halted to prevent losses.

The second scenario relies on off-chain message communication. Aspect, when enabled for off-chain message communication, allows for interaction and data exchange outside the blockchain. This enables ArtexSwap to obtain information about malicious contract addresses from third-party sources in real-time and conduct security checks on token contracts across the DEX. If a malicious contract is identified, all related operations are immediately blocked.

Slippage Mechanism

It should be noted that in the AMM liquidity mechanism, high slippage leading to losses is likely. Slippage refers to the difference between the executed trade price and the expected price. Slippage becomes significant during high market volatility or when liquidity is insufficient, which is a systemic issue.

Preventing slippage is essentially a “predictive” problem. Addressing insufficient liquidity is relatively straightforward; ArtexSwap’s contracts can achieve this by monitoring the liquidity pool in real-time. The challenge lies in market volatility, an external event. The first solution that comes to mind is integrating an oracle to obtain market conditions. To achieve this, ArtexSwap leverages its foundational environment, Artela, which supports Aspect technology. By creating a dApp on the blockchain, ArtexSwap can interact with third-party oracles to obtain market volatility data. Artela supports AI agents, which can predict high slippage in transactions at any given moment using market condition data. Combining this with the previously mentioned liquidity monitoring, ArtexSwap can derive an estimated value. If the predicted slippage exceeds a threshold (30%), the transaction is blocked to protect traders from losses due to severe price fluctuations.

5. Summary

Although it’s uncertain whether the current DEX models can support long-term growth and institutional applications, it is foreseeable that DEX will continue to be an essential infrastructure within the cryptocurrency ecosystem.

As always, behind every successful scam, there is likely a user who has stopped using Web3. Without new users, the DEX ecosystem would have nowhere to go. For DEX, losing security means losing everything.

However, despite the current hot market for DEXs and the ongoing narrative around derivatives, DEXs remain the most certain demand for users. Therefore, no amount of attention is too much for their continued development and security.

Disclaimer:

  1. This article is reprinted from [十四君], All copyrights belong to the original author [十四君]. If there are objections to this reprint, please contact the Gate Learn team, and they will handle it promptly.
  2. Liability Disclaimer: The views and opinions expressed in this article are solely those of the author and do not constitute any investment advice.
  3. Translations of the article into other languages are done by the Gate Learn team. Unless mentioned, copying, distributing, or plagiarizing the translated articles is prohibited.

Exploring Another Architecture for DEX from ArtexSwap

Intermediate7/29/2024, 11:18:36 AM
This article explains the mainstream architectures of DEX, their main risks, design issues of Bancor, and the specific implementation and security explorations of ArtexSwap. It focuses on how ArtexSwap improves security and efficiency through Artela EVM++ and Aspect technology.

ArtexSwap is a decentralized exchange that uses Artela EVM++ and Aspect technology to address MEV risks and Rug Pull issues, enhancing transaction security and efficiency. It is suitable for decentralized trading scenarios that require high security and flexibility.

Since the birth of Ethereum, it has been a home for digital currencies, global payments, and applications. DEX (Decentralized Exchanges) are the cornerstone of decentralized finance (DeFi). After all, without DEX, DeFi can be said to be just an empty talk. As a platform running on the blockchain, it allows direct transactions between users without being regulated by any third-party institutions, making it possible to create more advanced financial products.

1. Mainstream Architectures of DEX

Currently, in the Ethereum ecosystem, DEXs are flourishing with many different design models. Each model has its pros and cons in terms of functionality, scalability, and decentralization. Based on the different transaction mechanisms, DEXs can be divided into two categories (as shown in the figure below).

1.1. DEX based on order book

The order book essentially matches algorithms, automatically searching various markets for unfulfilled buy and sell orders. The trading platform’s system will automatically match these buy and sell orders. It is suitable for scenarios requiring efficient price matching and flexible trading strategies. In short, the liquidity of the order book comes from two sources: traders and market makers.

For further reading, see: “A Brief Analysis: Order Book Model and Automated Market Making (AMM)” (Appendix)

1.2. Automatic Market Maker (AMM)

An automated market maker (AMM) is a pricing and liquidity determination mechanism in DEX. Simply put, it is a market maker that provides liquid assets (two assets) to the liquidity pool. The product of the reserves in the liquidity pool is maintained at the k value. When a user takes away a coin, he or she needs to provide another coin to the liquidity pool to maintain the k value.

For a detailed understanding of AMM, you can further read: “UniswapX Research Report (Part 1): Summarize V1–3 development links and interpret the principle innovation and challenges of the next generation of DEX

1.3 What Value Does DEX Provide?

According to CoinGecko’s statistics, as of July 9, 2024, there are about 835 known DEX exchanges with a 24-hour trading volume of 8.35 billion dollars, and a monthly visit volume of 320 million times.

In terms of trading volume, the three largest decentralized exchanges are BabyDogeSwap, Uniswap V3 (Ethereum), and Orca.

We calculated the 24-hour trading volume of the top three DEX and CEX, and DEX accounted for 16% of the single-day trading liquidity. Moreover, compared to the same period in 2023, the 24-hour trading volume of DEX increased by 315% (20 billion in 2023), and the trading volume increased by 166% (120 million in 2023). It is clear that there is a huge demand for decentralized trading platforms in the market.

Because decentralized exchanges (DEX) use deterministic smart contracts for transactions without the intervention of centralized third parties, this transparent operation is in stark contrast to traditional financial markets.

For example, in 2022, FTX, one of the largest cryptocurrency trading platforms at the time, went bankrupt due to a series of market downturns caused by the misappropriation of user funds, causing widespread market turmoil.

Additionally, DEX enhances financial inclusiveness through decentralization. Some CEX may restrict user access based on geographic location or other factors.

But overall, users only need to access the internet and connect a compatible self-built wallet to use DEX services. This mode, which does not require cumbersome registration and verification, allows new users to join the platform quickly and conveniently, improving the user experience.

2. Major Risks of DEX

Decentralized exchanges (DEX) ensure the execution of trades, enhance transparency, and allow permissionless access, significantly lowering the barriers to trading and providing liquidity. However, DEX also come with some risks, which include but are not limited to the following:

Smart Contract Risks: Although blockchain technology can securely execute financial transactions, the security of smart contracts depends on the technical level and experience of the development team.

Front-Running Risks: Due to the public and transparent nature of on-chain transactions, arbitrageurs or MEV bots may front-run transactions to capture value from regular users. These bots are similar to high-frequency traders in traditional financial markets, profiting from regular users’ transactions by paying higher fees and exploiting network latency.

Network Risks: Since transactions are conducted on-chain, the trading costs on DEX can be high, especially when the network is congested or down. Therefore, users are susceptible to market volatility.

Rug Pull Risks: A common and severe problem in the decentralized finance (DeFi) space, where numerous projects attract significant investor funds, only for the project team to suddenly withdraw liquidity and abscond with the funds. Rug pull risks can be broadly categorized into three types:

  • Liquidity Withdrawal
  • Developers holding a large number of tokens or issuing new ones
  • Fraudulent projects

Such scams result in substantial losses for investors, causing the project value to plummet to zero instantly. This severely impacts the overall trust in the DeFi market. For example, the 2021 SushiSwap incident is a classic case. The anonymous founder of SushiSwap, Chef Nomi, sold $13 million worth of SUSHI tokens from the developer fund after raising a large amount of capital, causing market panic and a sharp drop in token prices. Although Chef Nomi later returned the funds and the project management was taken over by the community, this incident caused significant financial losses and psychological impacts on investors.

3. Issues Extending from Bancor to DEX

When discussing the pioneer of AMM (Automated Market Makers), Bancor cannot be overlooked. Unfortunately, before the DeFi boom, it did not receive widespread attention, leading many to mistakenly believe that AMM was invented by Uniswap.

Today, with the introduction of Bancor V2, which includes innovative designs such as using oracles to provide the latest prices and updating token pool ratios based on oracle prices, it still has some drawbacks.

The introduction of oracles can provide more accurate price information but also brings implementation challenges. For instance, if there is no corresponding trading pair price on a centralized exchange, this creates a chicken-and-egg problem. Additionally, the reliability and security of oracles are concerns, as they can be targets for attacks, leading to price manipulation and other security issues.

The dynamic pool model can update the token pool ratio based on oracle prices, but in highly volatile markets, liquidity providers (LPs) may face greater risks of loss. The higher the market volatility, the more severe the impermanent loss for LPs, which may lead to liquidity providers withdrawing funds, affecting the stability and trading efficiency of the liquidity pool.

Bancor’s design may also face counterparty risks. Although the oracle mechanism is introduced, if the market price fluctuates sharply and the oracle cannot update prices in time, liquidity providers may still face significant risks. Delays or inaccuracies in oracle price updates can result in losses for LPs during price swings.

Despite the many innovative designs introduced in Bancor V2, its complexity also increases the learning and usage threshold for users. Compared to other simpler and more user-friendly AMM models, Bancor may require users to grasp more professional knowledge and technical background to fully understand and utilize its new features. This may limit its user growth and market acceptance.

4. DEX implementation of ArtexSwap

The ArtexSwap platform operates similarly to Uniswap, but has enhanced security by using the native capabilities of Artela EVM++.

4.1 Artela’s Scalability Mechanism

First of all, in order to better understand the underlying environment of ArtexSwap, let us first briefly talk about the underlying operating mechanism of Artela. The scalability here actually contains two meanings, namely the scalability and performance of EVM.

For extensibility, Artela introduces Aspect technology to achieve this. This technology supports developers in creating on-chain custom programs within the WebAssembly (WASM) environment. These programs can collaborate with the EVM to provide dApps with high-performance, customized application-specific extensions. For further reading: “Insights of Vitalik Buterin: The Next Station of Web3.0 Infrastructure, Is It ‘Encapsulation or Expansion’?” (see appendix).

From a performance perspective, it’s about improving the execution efficiency of the EVM. We all know that the EVM is a serial virtual machine environment, which is very inefficient compared to today’s hardware. Therefore, parallel processing becomes especially important.

To achieve parallel execution, the following issues need to be addressed:

  1. How to resolve conflicts in simultaneously executed transactions? Adopting a predictive optimistic execution strategy for parallel execution, assuming that transactions initially do not conflict. Each transaction records modifications but does not finalize them immediately. After the transactions are executed, verification is performed to check for conflicts. If any exist, re-execution occurs. Predictive modeling uses AI models to analyze historical transaction data, predict transaction dependencies, optimize execution order, and reduce conflicts and re-execution. In comparison, Sei and Monad rely on predefined transaction dependency files and lack Artela’s AI-based dynamic prediction model’s adaptive capabilities, giving Artela an advantage in reducing execution conflicts.
  2. How to increase IO speed and reduce transaction execution wait time? Using asynchronous preloading technology to solve the input/output (I/O) bottleneck caused by state access. Before transaction execution, Artela uses predictive models to preload the required state data from slow storage (like hard drives) into fast storage (like memory). This preloading and caching technique allows multiple processors or execution threads to access data simultaneously, increasing parallelism and efficiency.
  3. How to address data bloat and increased database processing pressure during data writing? Artela combines various traditional data processing techniques to develop a parallel storage system, improving the efficiency of parallel processing. The parallel storage system mainly solves two issues: achieving parallel processing of storage and enhancing the ability to efficiently record data states into the database. Common problems during data storage include data bloat and increased database processing pressure when writing data. To address this, Artela adopts a strategy of separating state commitment (SC) from state storage (SS). This strategy divides storage tasks into two parts: one part handles operations quickly without retaining complex data structures to save space and reduce data duplication, while the other part records all detailed data information. Additionally, Artela merges small data chunks into larger blocks to reduce the complexity of data storage, ensuring performance is not affected when handling large amounts of data.

Furthermore, validator nodes support horizontal scaling, allowing the network to automatically adjust the scale of computing nodes based on current load or demand. This scaling process is coordinated by an elastic protocol to ensure sufficient computing resources in the consensus network. Through elastic computing, the network node’s computing power can scale, achieving elastic block space. This allows for the allocation of independent block space according to demand, meeting the expansion needs of public block space while ensuring performance and stability. This enables the DEX to handle peak trading periods smoothly, similar to the elastic scaling of Web2.

It is worth mentioning that elastic block space, as a solution for horizontally scaling blockchain performance, is based on the premise of “transaction parallelization.” Only after achieving a high degree of transaction parallelism does it become necessary to horizontally scale node machine resources to improve transaction throughput.

4.2 ArtexSwap’s DEX Security Exploration

ArtexSwap has been updated to version 2.0. Judging from the architecture of ArtexSwap, it mainly focuses on three security aspects, namely:

  • How should DEX identify and prevent malicious behavior?
  • How to prevent users from being harmed by Rug Pull when trading?
  • How to prevent high slippage from happening?

Blacklist mechanism


The blacklist mechanism is a strategy that emphasizes preemptive security. From a behavioral standpoint, addresses and users who have participated in malicious activities are highly likely to reoffend. By tagging accounts, addresses, and contracts deemed risky, ArtexSwap can preemptively assess both parties and the environment involved in a transaction before it occurs. The blacklist mechanism continuously monitors trading activities, checking each one to see if it involves any “dangerous entities” listed on the blacklist. When a request from a blacklisted account is detected, it is automatically blocked to prevent malicious activities.

For example, if an account is blacklisted for participating in a rug pull or other fraudulent activities, it will be unable to trade or add liquidity on the DEX, thus protecting other users from potential losses.

Essentially, ArtexSwap provides a passive defense system focused on the end-user (C-end).

Anti-Rug Mechanism

A rug pull occurs when developers or large holders suddenly increase the token supply or withdraw a significant portion of funds from the liquidity pool, causing the token price to plummet and resulting in substantial losses for investors.

These incidents are often associated with contracts that have backdoors. Such cases usually slip through the cracks of the blacklist mechanism because blacklist information can be somewhat delayed. Generally, there are two scenarios:

  1. The contract vulnerability is undiscovered.
  2. Find that the blacklist disappears.

In the first scenario, where there is no direct evidence of issues with the token contract, ArtexSwap adopts an optimistic approach, assuming the contract is safe by default. If such actions are detected, they are blocked, and trading of the related token is halted to prevent losses.

The second scenario relies on off-chain message communication. Aspect, when enabled for off-chain message communication, allows for interaction and data exchange outside the blockchain. This enables ArtexSwap to obtain information about malicious contract addresses from third-party sources in real-time and conduct security checks on token contracts across the DEX. If a malicious contract is identified, all related operations are immediately blocked.

Slippage Mechanism

It should be noted that in the AMM liquidity mechanism, high slippage leading to losses is likely. Slippage refers to the difference between the executed trade price and the expected price. Slippage becomes significant during high market volatility or when liquidity is insufficient, which is a systemic issue.

Preventing slippage is essentially a “predictive” problem. Addressing insufficient liquidity is relatively straightforward; ArtexSwap’s contracts can achieve this by monitoring the liquidity pool in real-time. The challenge lies in market volatility, an external event. The first solution that comes to mind is integrating an oracle to obtain market conditions. To achieve this, ArtexSwap leverages its foundational environment, Artela, which supports Aspect technology. By creating a dApp on the blockchain, ArtexSwap can interact with third-party oracles to obtain market volatility data. Artela supports AI agents, which can predict high slippage in transactions at any given moment using market condition data. Combining this with the previously mentioned liquidity monitoring, ArtexSwap can derive an estimated value. If the predicted slippage exceeds a threshold (30%), the transaction is blocked to protect traders from losses due to severe price fluctuations.

5. Summary

Although it’s uncertain whether the current DEX models can support long-term growth and institutional applications, it is foreseeable that DEX will continue to be an essential infrastructure within the cryptocurrency ecosystem.

As always, behind every successful scam, there is likely a user who has stopped using Web3. Without new users, the DEX ecosystem would have nowhere to go. For DEX, losing security means losing everything.

However, despite the current hot market for DEXs and the ongoing narrative around derivatives, DEXs remain the most certain demand for users. Therefore, no amount of attention is too much for their continued development and security.

Disclaimer:

  1. This article is reprinted from [十四君], All copyrights belong to the original author [十四君]. If there are objections to this reprint, please contact the Gate Learn team, and they will handle it promptly.
  2. Liability Disclaimer: The views and opinions expressed in this article are solely those of the author and do not constitute any investment advice.
  3. Translations of the article into other languages are done by the Gate Learn team. Unless mentioned, copying, distributing, or plagiarizing the translated articles is prohibited.
Nu Starten
Meld Je Aan En Ontvang
$100
Voucher!