The Ethereum Virtual Machine (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: