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
This commit is contained in:
defiQUG
2026-04-07 23:40:52 -07:00
parent 0fb7bba07b
commit 76aa419320
289 changed files with 28367 additions and 824 deletions

View File

@@ -156,7 +156,7 @@ forge script script/dex/DeployPrivatePoolRegistryAndPools.s.sol:DeployPrivatePoo
### PMM (Chain 138) completion checklist
1. Set **DODO_VENDING_MACHINE_ADDRESS** in `.env` to the DODO DVM factory address on Chain 138. **Chain 138 is not in DODOs official list** — see [DVM_DEPLOYMENT_CHECK.md](DVM_DEPLOYMENT_CHECK.md). Deploy the factory yourself from [DODOEX](https://github.com/DODOEX) or use an existing deployment if available.
1. Set **DODO_VENDING_MACHINE_ADDRESS** in `.env` to the DODO DVM factory adapter address on Chain 138. **Chain 138 is not in DODOs official list** — see [DVM_DEPLOYMENT_CHECK.md](DVM_DEPLOYMENT_CHECK.md). Use `scripts/deployment/deploy-official-dvm-chain138.sh` to deploy the official DVM `0.6.9` stack from the vendored DODO tree and then deploy the local adapter.
2. Set **OFFICIAL_USDT_ADDRESS** and **OFFICIAL_USDC_ADDRESS** to the live Chain 138 quote-side mirror stables:
- `OFFICIAL_USDT_ADDRESS=0x004b63A7B5b0E06f6bB6adb4a5F9f590BF3182D1`
- `OFFICIAL_USDC_ADDRESS=0x71D6687F38b93CCad569Fa6352c876eea967201b`
@@ -169,7 +169,7 @@ forge script script/dex/DeployPrivatePoolRegistryAndPools.s.sol:DeployPrivatePoo
| Chain ID | Network | Mapper (AddressMapperEmpty) |
|----------|-----------|----------------------------------|
| 138 | Chain 138 | 0xe48E3f248698610e18Db865457fcd935Bb3da856 (AddressMapper) |
| 138 | Chain 138 | 0x439Fcb2d2ab2f890DCcAE50461Fa7d978F9Ffe1A (AddressMapper; legacy dup `0xe48E3f248698610e18Db865457fcd935Bb3da856`) |
| 1 | Ethereum | 0x0ea68F5B5A8427bB58e54ECcee941F543Dc538c5 |
| 56 | BSC | 0x6e94e53F73893b2a6784Df663920D31043A6dE07 |
| 137 | Polygon | 0xb689c1C69DAa08DEb5D8feA2aBF0F64bFD409727 |

View File

@@ -1,6 +1,6 @@
# Deployed Smart Contracts — Cross-Network Overview
> Historical note (2026-03-26): this overview includes superseded PMM stack references from earlier deployment phases. The current canonical Chain 138 PMM stack is `DODOPMMIntegration=0x5BDc62f1ae7D630c37A8B363a1d49845356Ee72d` and `DODOPMMProvider=0x5CAe6Ce155b7f08D3a956F5Dc82fC9945f29B381`.
> Historical note (2026-04-01): this overview preserves earlier deployment phases, but the live canonical Chain 138 PMM stable stack is now `DODOPMMIntegration=0x86ADA6Ef91A3B450F89f2b751e93B1b7A3218895` and `DODOPMMProvider=0x3f729632E9553EBacCdE2e9b4c8F2B285b014F2e`.
**Last updated:** 2026-02-20
**Source:** `smom-dbis-138/.env` and deployment runbooks.
@@ -64,8 +64,9 @@ flowchart TB
| | CCIPWETH10 Bridge | `0xe0E93247376aa097dB308B92e6Ba36bA015535D0` | WETH10 cross-chain |
| | CCIP Router | `0x42DAb7b888Dd382bD5Adcf9E038dBF1fD03b4817` | CCIP router (on 138) |
| | CCIPTxReporter | `0x3F88b662F04d9B1413BA8d65bFC229e830D7d077` | Report txs to mainnet logger |
| **PMM** | Mock DVM Factory | `0xB16c3D48A111714B1795E58341FeFDd643Ab01ab` | Create mock pools |
| | DODOPMMIntegration | `0x5BDc62f1ae7D630c37A8B363a1d49845356Ee72d` | Canonical corrected PMM integration |
| **PMM** | DODO V2 DVMFactory | `0xc93870594C7f83A0aE076c2e30b494Efc526b68E` | Create canonical DVM-backed stable pools |
| | DODOPMMIntegration | `0x86ADA6Ef91A3B450F89f2b751e93B1b7A3218895` | Canonical official-DVM-backed PMM integration |
| | DODOPMMProvider | `0x3f729632E9553EBacCdE2e9b4c8F2B285b014F2e` | Canonical stable-pool routing provider |
| **Core eMoney** | Compliance Registry, Token Factory, Bridge Vault, Debt Registry, Policy Manager, Token Impl | (see .env) | Core system |
| **Channels** | Payment Channel Manager, Address Mapper, Mirror Manager | (see .env) | State channels |
| **Oracle** | Oracle Aggregator, Oracle Proxy | (see .env) | Price feeds |

View File

@@ -1,30 +1,41 @@
# DVM (DODO Vending Machine) Deployment Check — Chain 138
**Date:** 2026-02-20
**Date:** 2026-04-02
## Summary
**There is no official DODO DVM factory deployment on Chain 138.**
**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 not in that list**, so there is no canonical DVM factory address for Chain 138 from DODO.
- 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 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.
- **`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)**
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.
- **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`
- 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`.
@@ -32,6 +43,8 @@
`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).

View File

@@ -197,17 +197,17 @@ chainRegistry.registerEVMChain(
---
### **Hyperledger Firefly**
### **Hyperledger FireFly**
**Status**: ✅ Adapter + Service Client Created
**Infrastructure**: ✅ VMIDs 6202, 6203 deployed
**Infrastructure**: `6200` is the only validated FireFly runtime, `6201` is retired / standby, and `6202` / `6203` are not deployed in the current cluster.
**Deployment Steps**:
1. Initialize Firefly on VMID 6202:
1. Initialize FireFly only after confirming `6200` is healthy and intentionally in scope:
```bash
ssh root@192.168.11.175
ssh root@192.168.11.35
ff init alltra-bridge --multiparty
```
@@ -237,21 +237,26 @@ namespaces:
- erc20_erc721
```
For current runtime truth, prefer [docs/03-deployment/DBIS_HYPERLEDGER_RUNTIME_STATUS.md](../../../docs/03-deployment/DBIS_HYPERLEDGER_RUNTIME_STATUS.md).
---
## 🔧 **Hyperledger Integration**
### **Cacti (VMID 5201)**
### **Cacti (VMIDs 5200 / 5201 / 5202)**
**Status**: ⚠️ Needs Adapter
**Infrastructure**: `5200` is the primary Cacti / Besu connector node. `5201` and `5202` are the live Alltra/HYBX public Cacti surfaces and each also exposes a local Hyperledger Cacti API on `:4000`.
**Deployment Steps**:
1. Install Cacti API server on VMID 5201
2. Configure Besu connector plugin
3. Configure Fabric connector plugin (if needed)
4. Deploy CactiAdapter contract
5. Create Cacti client service
1. Maintain the core connector deployment on VMID `5200`.
2. Keep VMIDs `5201` and `5202` healthy for the public Alltra/HYBX Cacti surfaces and local `:4000` APIs.
3. Configure the Besu connector plugin.
4. Configure the Fabric connector plugin if needed.
5. Deploy the `CactiAdapter` contract.
6. Create the Cacti client service.
**Cacti Configuration**:
```json

View File

@@ -1,6 +1,6 @@
# Next Steps Completion Summary
> Historical note (2026-03-26): this completion summary preserves an earlier PMM deployment phase. The current canonical Chain 138 PMM stack is `DODOPMMIntegration=0x5BDc62f1ae7D630c37A8B363a1d49845356Ee72d` and `DODOPMMProvider=0x5CAe6Ce155b7f08D3a956F5Dc82fC9945f29B381`.
> Historical note (2026-04-01): this completion summary preserves an earlier PMM deployment phase. The live canonical Chain 138 PMM stable stack is now `DODOPMMIntegration=0x86ADA6Ef91A3B450F89f2b751e93B1b7A3218895` and `DODOPMMProvider=0x3f729632E9553EBacCdE2e9b4c8F2B285b014F2e`.
**Date:** 2026-02-20
@@ -21,7 +21,7 @@ This document summarizes what was completed in the "next steps" pass and what re
| **Verify script** | Optional checks (CCIPTxReporter, genesis) are warnings; log_* fallbacks; safe unset-var handling. |
| **Hardhat / Forge** | @emoney/interfaces replaced with relative imports; Hardhat viaIR for 0.8.22; Forge build available. |
| **Docs** | WARNINGS_AND_OPTIONAL_TASKS.md, DVM_DEPLOYMENT_CHECK.md, ALL_MAINNETS_DEPLOYMENT_RUNBOOK (PMM step → DVM doc), TODO_TASK_LIST_MASTER §10b updated. |
| **PMM (Chain 138)** | Earlier Mock DVM phase completed; current canonical PMM integration is `0x5BDc62f1ae7D630c37A8B363a1d49845356Ee72d` and supersedes the initial stack. `DODO_VENDING_MACHINE_ADDRESS` and `DODO_PMM_INTEGRATION` were set in .env during the first deployment phase. |
| **PMM (Chain 138)** | Earlier mock-DVM phase completed; the live canonical stable stack is now `0x86ADA6Ef91A3B450F89f2b751e93B1b7A3218895` with provider `0x3f729632E9553EBacCdE2e9b4c8F2B285b014F2e`. `DODO_VENDING_MACHINE_ADDRESS` and `DODO_PMM_INTEGRATION` should follow the current DVM-backed deployment in `.env`. |
---