Files
smom-dbis-138/docs/deployment/DVM_DEPLOYMENT_CHECK.md
defiQUG 76aa419320 feat: bridges, PMM, flash workflow, token-aggregation, and deployment docs
- CCIP/trustless bridge contracts, GRU tokens, DEX/PMM tests, reserve vault.
- Token-aggregation service routes, planner, chain config, relay env templates.
- Config snapshots and multi-chain deployment markdown updates.
- gitignore services/btc-intake/dist/ (tsc output); do not track dist.

Run forge build && forge test before deploy (large solc graph).

Made-with: Cursor
2026-04-07 23:40:52 -07:00

66 lines
5.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# DVM (DODO Vending Machine) Deployment Check — Chain 138
**Date:** 2026-04-02
## Summary
**Chain 138 now has a self-deployed official DODO V2 DVM stack, but it is not DODO-listed.**
- DODOs 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 still not in that list**, so there is no DODO-published canonical DVM factory address for Chain 138.
- This repo now operates a **self-deployed official DODO V2 DVM stack** on Chain 138:
- **DVMFactory:** `0xc93870594C7f83A0aE076c2e30b494Efc526b68E`
- **DVMFactoryAdapter / DODO_VENDING_MACHINE_ADDRESS:** `0xb6D9EF3575bc48De3f011C310DC24d87bEC6087C`
- **DODOPMMIntegration:** `0x86ADA6Ef91A3B450F89f2b751e93B1b7A3218895`
- **DODOPMMProvider:** `0x3f729632E9553EBacCdE2e9b4c8F2B285b014F2e`
- **Stable pools (canonical corrected stack):**
- `cUSDT/cUSDC`: `0x9e89bAe009adf128782E19e8341996c596ac40dC`
- `cUSDT/USDT`: `0x866Cb44b59303d8dc5f4F9E3E7A8e8b0bf238d66`
- `cUSDC/USDC`: `0xc39B7D0F40838cbFb54649d327f49a6DAC964062`
## Implications
- **`DODO_VENDING_MACHINE_ADDRESS`** in `.env` must point to a Chain 138 factory adapter **you deploy or obtain**; it is not a DODO-listed public address.
- The canonical Chain 138 PMM path is now the **official DODO V2 DVMFactoryAdapter** above, not the earlier mock DVM path.
## Options
0. **Use mock DVM (this repo, fallback only)**
- 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.
- **Do not treat this as canonical anymore** unless you are intentionally testing without the official DVM stack.
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.
- The repo deployment helper now runs the vendored DODO tree in a **DVM-only compile mode** by temporarily hiding unrelated Solidity `0.8.x` contracts during `truffle compile` / `truffle migrate`, then restoring them on exit. That allows the official DVM `0.6.9` stack to compile without forking the upstream repo.
- **One-shot:** `scripts/deployment/deploy-official-dvm-chain138.sh`
- To verify compile before broadcast: `scripts/deployment/deploy-official-dvm-chain138.sh --compile-only`
- 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).
- **Current live Chain 138 result:** the repo has already deployed this path and currently uses the addresses listed in the Summary section above.
- **Stable-pair calibration note:** for equal-reserve stable pairs on the official DODO V2 DVM stack, the current canonical Chain 138 pools use `i = 1e18`, `k = 0`, `lpFeeRate = 10 bps`, `isOpenTWAP = false`. Earlier `k = 0.5e18` pools were removed because they priced above parity.
2. **Deploy DVM factory yourself from DODO source (outside this repo)**
- DODOs 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.