MixBytes在Neon EVM成功部署Uniswap V2 (MixBytes Successfully Deploys Uniswap V2 Protocol on Neon EVM)

Neon Labs recently partnered with MixBytes to prove the functionality and performance of Neon EVM via the deployment of Ethereum dApps. The exercise involved the MixBytes team deploying and assessing the Uniswap v2 protocol on both local network and Devnet. The Uniswap v2 protocol, which was originally developed on Ethereum, allows users to exchange tokens without relying on a centralized exchange, helping with asset liquidity and reducing volatility.

Neon Labs 最近与 MixBytes 合作,通过部署以太坊 dApp 来证明 Neon EVM 的功能和性能。该练习涉及 MixBytes 团队在本地网络和 Devnet 上部署和评估 Uniswap v2 协议。 Uniswap v2 协议最初是在以太坊上开发的,允许用户在不依赖中心化交易所的情况下交换代币,有助于资产流动性和降低波动性。

谁是 MixBytes?(Who is MixBytes?)

MixBytes is a blockchain solution advisory company that provides a comprehensive suite of services for smart contract development and testing, including security audits and protocol development.

MixBytes 是一家区块链解决方案咨询公司,为智能合约开发和测试提供一整套服务,包括安全审计和协议开发。

我们的目标 (Our Objective)

The objective of deploying the Uniswap v2 protocol to Neon EVM was to verify that the level of effort required, and performance, is the same on both Ethereum and Neon. Upon successful deployment, the team also wanted to confirm the expected functionality of the Uniswap v2 protocol and test its performance in production-like scenarios.

将 Uniswap v2 协议部署到 Neon EVM 的目的是验证所需的工作量和性能,在以太坊和 Neon 上是否相同。成功部署后,该团队还希望确认 Uniswap v2 协议的预期功能,并在类似生产的场景中测试其性能。

测试方法 (Testing Methodology)

MixBytes deployed the Uniswap v2 protocol on local Neon and Solana environments to test functionality and performance. The deployment included Uniswap v2 protocol contracts, required libraries, and testing artifacts. Firstly, the following script was executed:

MixBytes 在本地 Neon 和 Solana 环境中部署了 Uniswap v2 协议,以测试功能和性能。该部署包括 Uniswap v2 协议合约、所需的库和测试工件。首先,执行以下脚本:

npx hardhat run ./scripts/deploy.ts

Then, the environment was deployed with this Docker config file by executing the below command:
然后,通过执行以下命令,使用 此 Docker 配置 文件部署环境:

//sudo NEON_EVM_COMMIT=v0.8.3 FAUCET_COMMIT=latest REVISION=v0.9.1 docker-compose -f docker-compose.neon.yml up -d

Additionally, the following network configurations were applied to the hardhat.config.ts file:

此外,以下网络配置已应用于 hardhat.config.ts 文件:

import { HardhatUserConfig } from "hardhat/config";

import "@nomicfoundation/hardhat-toolbox";

const config: HardhatUserConfig = {

solidity: {

compilers: [

{

version: "0.5.0"

},

{

version: "0.5.16"

},

{

version: "0.6.6"

},

{

version: "0.6.12"

},

],

settings: {

optimizer: {

enabled: true,

runs: 999999,

},

},

},

defaultNetwork: 'neonlabs',

networks: {

hardhat: {

gas: 3000000000,

blockGasLimit: 100000000429720,

gasPrice: 875000000

},

neonlabs: {

url: 'http://localhost:9090/solana',

accounts: ['0x41167312f8c46439b2bcc5e5a6af929262efcd20357a56ebcbc455d835d9f080',

'0x41167312f8c46439b2bcc5e5a6af929262efcd20357a56ebcbc455d835d9f081', '0x41167312f8c46439b2bcc5e5a6af929262efcd20357a56ebcbc455d835d9f082',

'0x41167312f8c46439b2bcc5e5a6af929262efcd20357a56ebcbc455d835d9f083', '0x41167312f8c46439b2bcc5e5a6af929262efcd20357a56ebcbc455d835d9f084'],

// @ts-ignore

network_id: 111,

chainId: 111,

allowUnlimitedContractSize: false,

timeout: 100000000,

// @ts-ignore

isFork: true

}

},

};

export default config;

测试范围 (Testing Scope)

The scope of the testing focused on the deployed contracts:
测试的范围集中在已部署的合约上:

  • UniswapV2Factory contract
  • UniswapV2Router01contract
  • UniswapV2Pair contract
  • Liquidity Pool (LP) token farming test contracts

测试执行 (Testing Execution)

MixBytes assessed the liquidity pool creation functionality by deploying two liquidity pools: one liquidity pool containing only native SOL tokens, and the other containing two non-native tokens. Once the liquidity pools were created, the team tested the “swap_with_exact_input” and “swap_with_exact_output” variants.

MixBytes 通过部署两个流动性池来评估流动性池创建功能:一个流动性池仅包含原生 SOL 代币,另一个包含两个非原生代币。创建流动性池后,团队测试了“swap_with_exact_input”和“swap_with_exact_output”变体。

In regards to LP farming scenarios, the team tested the following common use cases:
针对 LP挖矿场景,团队测试了以下常见用例:

  • Adding tokens to the two newly created liquidity pools
    将代币添加到两个新创建的流动性池中

  • Receiving LP tokens after depositing liquidity
    存入流动性后接收LP代币

  • Performing token swaps using the liquidity pools
    使用流动性池执行代币交换

  • Transferring LP tokens to another beneficiary
    将 LP 代币转移给另一个受益人

  • Collecting rewards from liquidity pools
    从流动资金池中收集奖励

The project deliverables can be found on Neon’s GitHub. The contract and token addresses are noted below:

项目可交付成果可在 Neon 的 GitHub 上找到。合约和代币地址如下:

  • UniswapV2Factory address: 0x8eA3207A157106B68ECa73638cbacdD6973DaBda
  • UniswapV2Router01address: 0x4f8C61909f92c4c8f83E527D8f063F78322b35b7
  • UniswapV2Pair contract 1 (tokens 1,2) address: 0xDa0Ed5e2Adda73c6336A1ae9C87A4BbC3Ba46876
  • UniswapV2Pair contract 2 (tokens 2,3) address: 0xf285B885f0F113b5fF54354492a6Bac38a6AC188
  • Token1 address: 0x72acC5B7306FB3886Dbcea62eB8Cffd83bEE5b9c
  • Token2 address: 0x66dE9Ee76b78085ab73386741e20A82c6db09f2B
  • Token3 address: 0x8346aD3Ba1476890524eF262a47b589365633E30

The following image highlights the output and status of the testing scenarios at each execution phase.

下图突出显示了每个执行阶段的测试场景的输出和状态。

发现 (Findings)

At the time of testing, all functions of the Uniswap v2 protocol within our testing scope performed as expected on the local Neon network and Devnet. The testing scenarios selected demonstrate the same output in the Hardhat network as in the Neon environment. Overall, the deployment of the Uniswap v2 protocol Solidity code to Neon was seamless and raised no issues. No modifications to the contracts’ source code were required.

在测试时,我们测试范围内的 Uniswap v2 协议的所有功能在本地 Neon 网络和 Devnet 上都按预期执行。所选的测试场景展示了 Hardhat 网络中与 Neon 环境中相同的输出。总体而言,将 Uniswap v2 协议 Solidity 代码部署到 Neon 是无缝的,没有出现任何问题。无需修改合约的源代码。

For more information on the Uniswap v2 deployment, check out our recent AMA. Now, its your turn to deploy your own smart contracts to Neon EVM. Make sure to let us know what you think. If you run into any issues or need additional guidance, check out our Neon Docs or reach out to a team member on Discord. We know that you’ll create something great!

有关 Uniswap v2 部署的更多信息,请查看我们的 最近的 AMA。现在,轮到您将自己的智能合约部署到 Neon EVM。请务必让我们知道您的想法。如果您遇到任何问题或需要更多指导,请查看我们的 Neon Docs 或通过 [Discord](https://discord. com/invite/9jVYEDVwn8) 联系。我们知道你会创造出伟大的东西!

赞赏