# 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: 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:

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

The question should be specific, self-contained, and written in natural language.
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.
