> For the complete documentation index, see [llms.txt](https://wiki.zenlink.pro/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wiki.zenlink.pro/zenlink-dex-protocol/evm.md).

# EVM

The Ethereum Virtual Machine ([EVM](https://www.coindesk.com/open-heart-surgery-inside-ethereums-crucial-replacement-of-the-evm)) has the pole position among blockchain developers. The EVM is what enables Ethereum to run smart contracts. Many parachains implement and import EVM pallets. The purpose is quite simple: migrate Ethereum projects to Polkadot seamlessly.

Zenlink aims to help parachains in the ecosystem by offering them a simple way to implement dex functionalities. So, writing EVM smart contracts with an EVM pallet is an effective way to deploy features. The benefit of this method is that people compile and deploy the smart contract to the parachain's EVM pallet, rather than modify the source code of the parachain.

The EVM smart contract consists of two parts: Exchange and Factory.

The Exchange contract is the core of the ZenLink Dex Protocol. It implements the following interfaces:

* Initializing token trading pairs.
* Token swaps.
* Adding/extracting liquidity.
* Defining the liquidity constant function used throughout the protocol.

The Factory contract can be used to create exchange contracts for any ERC20 token that does not already have one. It also functions as a registry of ERC20 tokens that have been added to the system, and the exchange with which they are associated.

For more setup and test details, please find **EVM smart contract repo** on the following page:

{% content-ref url="/pages/-MdztX-SVDrlxyZLTs31" %}
[Github](/resources/github.md)
{% endcontent-ref %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://wiki.zenlink.pro/zenlink-dex-protocol/evm.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
