# DVM (DODO Vending Machine) Deployment Check — Chain 138 **Date:** 2026-02-20 ## Summary **There is no official DODO DVM factory deployment on Chain 138.** - DODO’s official contract list ([api.dodoex.io/dodo-contract/list?version=v1,v2](https://api.dodoex.io/dodo-contract/list?version=v1,v2)) includes chains such as **1** (Ethereum), **5** (Goerli), **10** (Optimism), **56** (BSC), **133** (Syscoin), **137** (Polygon), **8453** (Base), etc. - **Chain ID 138 is not in that list**, so there is no canonical DVM factory address for Chain 138 from DODO. ## Implications - **`DODO_VENDING_MACHINE_ADDRESS`** in `.env` must point to a DVM factory **you deploy or obtain** on Chain 138; it will not be an “official” DODO-listed address. - Until that address is set, **PMM (run-pmm-and-pools.sh)** and **DODOPMMIntegration** cannot be used on Chain 138. ## Options 0. **Use mock DVM (this repo)** - A minimal `MockDVMFactory` (and `MockDVMPool`) is provided so PMM can run on Chain 138 without official DODO. Deploy with: - `forge script script/dex/DeployMockDVMFactory.s.sol:DeployMockDVMFactory --rpc-url "$RPC_URL_138" --broadcast --private-key "$PRIVATE_KEY" --legacy` - Set `DODO_VENDING_MACHINE_ADDRESS` in `.env` to the deployed address, then run `scripts/deployment/run-pmm-and-pools.sh`. Pools created are mocks (no real AMM); swap views return stubs. 1. **Deploy official DODO DVM on Chain 138 (this repo)** - Submodule **lib/dodo-contractV2** (DODOEX/contractV2) is used to deploy the official DVM stack via Truffle. Our **DVMFactoryAdapter** wraps `createDODOVendingMachine` as `createDVM` so `DODOPMMIntegration` works unchanged. - **Blocker:** DODO contractV2 mixes Solidity 0.6.9 (DVM, Factory) and 0.8.16 (DODOGasSavingPool, SmartRoute). Truffle compiles the whole repo with one solc version, so `truffle compile` fails. Until DODO adds multi-compiler support or we vendor only the DVM 0.6.9 tree, use the **mock DVM** (option 0) or deploy from a DODO fork that compiles. - **One-shot (when Truffle compiles):** `scripts/deployment/deploy-official-dvm-chain138.sh` - Requires `lib/dodo-contractV2` deps: `cd lib/dodo-contractV2 && npm install` (if npm hits a registry/cert error, use `npm install --registry https://registry.npmjs.org/ --no-package-lock`). - **Manual:** 1) In `lib/dodo-contractV2`: set `privKey` and `RPC_URL_138` (e.g. from parent `.env`), then `npx truffle migrate -f 1 --to 1 --network chain138` and `npx truffle migrate -f 9 --to 9 --network chain138`. 2) Set `DODO_DVM_FACTORY` to the deployed DVMFactory address, then from repo root: `forge script script/dex/DeployDVMFactoryAdapter.s.sol:DeployDVMFactoryAdapter --rpc-url "$RPC_URL_138" --broadcast --private-key "$PRIVATE_KEY" --legacy` 3) Set `DODO_VENDING_MACHINE_ADDRESS` in `.env` to the **DVMFactoryAdapter** address (not the DVMFactory address). - Then run `scripts/deployment/run-pmm-and-pools.sh` (you may need to re-deploy DODOPMMIntegration if it was previously deployed with the mock DVM). 2. **Deploy DVM factory yourself from DODO source (outside this repo)** - DODO’s contracts are open source: [DODOEX GitHub](https://github.com/DODOEX) (contractV2). - Deploy **DVMFactory** (and dependencies) to Chain 138, then deploy our **DVMFactoryAdapter** pointing at that factory, set `DODO_VENDING_MACHINE_ADDRESS` to the adapter, and run `run-pmm-and-pools.sh`. 3. **Use an existing DVM factory on Chain 138 (if any)** - If someone else has already deployed a DODO-compatible DVM factory on Chain 138, set `DODO_VENDING_MACHINE_ADDRESS` to that address. - We are not aware of any public deployment; you would need to confirm with your network or chain operator. 4. **Leave PMM disabled on Chain 138** - Keep `DODO_VENDING_MACHINE_ADDRESS` unset. - `ensure-prerequisites.sh` will continue to warn; `run-pmm-and-pools.sh` will exit until the variable is set. ## Reference - DODO V1/V2 addresses: [docs.dodoex.io — Contract Addresses](https://docs.dodoex.io/en/developer/contracts/dodo-v1-v2/contracts-address) - DVM product overview: [DODO Vending Machine](https://docs.dodoex.io/en/product/dodo-v2-pools/dodo-vending-machine) - This repo: `DODOPMMIntegration.sol` uses `IDODOVendingMachine.createDVM(...)`; the factory must implement that interface.