feat: restore operator WIP — PMM JSON sync entrypoint, dotenv RPC trim + secrets, pool env alignment

- Resolve stash: merge load_deployment_env path with secure-secrets and CR/LF RPC strip
- create-pmm-full-mesh-chain138.sh delegates to sync-chain138-pmm-pools-from-json.sh
- env.additions.example: canonical PMM pool defaults (cUSDT/USDT per crosscheck)
- Include Chain138 scripts, official mirror deploy scaffolding, and prior staged changes

Made-with: Cursor
This commit is contained in:
defiQUG
2026-03-27 19:02:30 -07:00
parent c6e7bad15e
commit 2a4753eb2d
200 changed files with 5987 additions and 913 deletions

View File

@@ -157,7 +157,9 @@ 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.
2. Set **OFFICIAL_USDT_ADDRESS** and **OFFICIAL_USDC_ADDRESS** to the official or wrapped USDT/USDC token addresses on Chain 138 (already in .env as reference; replace with Chain 138 addresses if different).
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`
3. Run: `bash scripts/deployment/deploy-all-mainnets-with-mapper-oracle-pmm.sh pmm` to deploy DODOPMMIntegration.
4. Set **DODOPMM_INTEGRATION_ADDRESS** (or DODO_PMM_INTEGRATION) in .env from the deploy output, then create pools:
- cUSDT/USDT and cUSDC/USDC: call `createCUSDTUSDTPool` and `createCUSDCUSDCPool` on the integration (see `docs/integration/DODO_PMM_INTEGRATION.md`).

View File

@@ -1,5 +1,7 @@
# 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`.
**Last updated:** 2026-02-20
**Source:** `smom-dbis-138/.env` and deployment runbooks.
@@ -63,7 +65,7 @@ flowchart TB
| | CCIP Router | `0x42DAb7b888Dd382bD5Adcf9E038dBF1fD03b4817` | CCIP router (on 138) |
| | CCIPTxReporter | `0x3F88b662F04d9B1413BA8d65bFC229e830D7d077` | Report txs to mainnet logger |
| **PMM** | Mock DVM Factory | `0xB16c3D48A111714B1795E58341FeFDd643Ab01ab` | Create mock pools |
| | DODOPMMIntegration | `0x79cdbaFBaA0FdF9F55D26F360F54cddE5c743F7D` | cUSDT/cUSDC pools |
| | DODOPMMIntegration | `0x5BDc62f1ae7D630c37A8B363a1d49845356Ee72d` | Canonical corrected PMM integration |
| **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,5 +1,7 @@
# 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`.
**Date:** 2026-02-20
This document summarizes what was completed in the "next steps" pass and what remains for the operator.
@@ -19,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)** | Mock DVM: deployed `MockDVMFactory` at `0xB16c3D48A111714B1795E58341FeFDd643Ab01ab` and `DODOPMMIntegration` at `0x79cdbaFBaA0FdF9F55D26F360F54cddE5c743F7D`. `DODO_VENDING_MACHINE_ADDRESS` and `DODO_PMM_INTEGRATION` set in .env. `run-pmm-and-pools.sh` fixed (no longer rejects valid 0x… addresses). Pools are mock (see DVM_DEPLOYMENT_CHECK.md option 0). |
| **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. |
---

View File

@@ -43,7 +43,7 @@ Complete these **before** running the three operator task scripts.
- DODO does not list Chain 138; use your own deployment or an existing DVM if available.
- **.env:** Set:
- `DODO_VENDING_MACHINE_ADDRESS` — DVM factory on Chain 138.
- `OFFICIAL_USDT_ADDRESS`, `OFFICIAL_USDC_ADDRESS` — official or wrapped USDT/USDC on Chain 138 (already have placeholders).
- `OFFICIAL_USDT_ADDRESS=0x004b63A7B5b0E06f6bB6adb4a5F9f590BF3182D1`, `OFFICIAL_USDC_ADDRESS=0x71D6687F38b93CCad569Fa6352c876eea967201b` — live Chain 138 quote-side mirror stables for PMM pools.
- `COMPLIANT_USDT_ADDRESS`, `COMPLIANT_USDC_ADDRESS` — already set.
- **Script:** `scripts/deployment/run-pmm-and-pools.sh`.

View File

@@ -122,8 +122,9 @@ This guide provides a complete implementation path for making CompliantUSDT (cUS
export DODO_VENDING_MACHINE_ADDRESS=0x...
export COMPLIANT_USDT_ADDRESS=0x...
export COMPLIANT_USDC_ADDRESS=0x...
export OFFICIAL_USDT_ADDRESS=0x...
export OFFICIAL_USDC_ADDRESS=0x...
# On Chain 138, use the live local quote-side mirror stables
export OFFICIAL_USDT_ADDRESS=0x004b63A7B5b0E06f6bB6adb4a5F9f590BF3182D1
export OFFICIAL_USDC_ADDRESS=0x71D6687F38b93CCad569Fa6352c876eea967201b
# Deploy
forge script script/dex/DeployDODOPMMIntegration.s.sol:DeployDODOPMMIntegration \
@@ -383,4 +384,3 @@ For issues or questions:
2. Check troubleshooting section
3. Review contract code comments
4. Contact development team

View File

@@ -41,11 +41,11 @@ The Master Plan specifies four **public** liquidity pool types for user routing
| Pair | Creation method | Notes |
|------|-----------------|--------|
| **cUSDT / cUSDC** | `createCUSDTCUSDCPool(lpFeeRate, initialPrice, k, isOpenTWAP)` | Dedicated function; swap via `swapCUSDTForUSDC` / `swapUSDCForCUSDT`. Register in DODOPMMProvider for getQuote/executeSwap. |
| **cUSDT / XAU** | `createPool(cUSDT, xauTokenAddress, ...)` | Requires XAU token address on Chain 138. Use generic `createPool`. |
| **cUSDT / XAU** | `createPool(cUSDT, xauTokenAddress, ...)` | Use the Chain 138 XAU anchor token address (`cXAUC` or `cXAUT`) and the generic `createPool`. |
| **cUSDC / XAU** | `createPool(cUSDC, xauTokenAddress, ...)` | Same as above. |
| **cEURT / XAU** | `createPool(cEURTAddress, xauTokenAddress, ...)` | Requires cEURT and XAU token addresses on Chain 138. |
| **cEURT / XAU** | `createPool(cEURTAddress, xauTokenAddress, ...)` | Requires `cEURT` and a Chain 138 XAU anchor token (`cXAUC` or `cXAUT`). |
For cUSDT/XAU, cUSDC/XAU, and cEURT/XAU: deploy or obtain token addresses on Chain 138, then call `createPool(baseToken, quoteToken, lpFeeRate, initialPrice, k, isOpenTWAP)` with `POOL_MANAGER_ROLE`. Public pools serve user routing, price discovery, and flash loan access; they do not serve as the primary stabilization engine (see Master Plan private mesh).
For cUSDT/XAU, cUSDC/XAU, and cEURT/XAU: use the deployed Chain 138 XAU anchor token (`cXAUC` at `0x290E52a8819A4fbD0714E517225429aA2B70EC6b` or `cXAUT` at `0x94e408E26c6FD8F4ee00b54dF19082FDA07dC96E`), then call `createPool(baseToken, quoteToken, lpFeeRate, initialPrice, k, isOpenTWAP)` with `POOL_MANAGER_ROLE`. **Unit:** 1 full XAU token = **1 troy ounce** of gold (`10^6` base units with 6 decimals). Public pools serve user routing, price discovery, and flash loan access; they do not serve as the primary stabilization engine (see Master Plan private mesh).
---
@@ -101,9 +101,9 @@ RPC_URL=https://...
DODO_VENDING_MACHINE_ADDRESS=0x... # DODO Vending Machine Factory
DODO_APPROVE_ADDRESS=0x... # Optional
# Official tokens
OFFICIAL_USDT_ADDRESS=0xdAC17F958D2ee523a2206206994597C13D831ec7
OFFICIAL_USDC_ADDRESS=0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48
# Official tokens on Chain 138 (local quote-side mirror stables)
OFFICIAL_USDT_ADDRESS=0x004b63A7B5b0E06f6bB6adb4a5F9f590BF3182D1
OFFICIAL_USDC_ADDRESS=0x71D6687F38b93CCad569Fa6352c876eea967201b
# Compliant tokens
COMPLIANT_USDT_ADDRESS=0x93E66202A11B1772E55407B32B44e5Cd8eda7f22
@@ -468,4 +468,3 @@ See `scripts/setup-dodo-pools.sh` for automated pool creation and configuration.
3. Seed initial liquidity
4. Enable trading
5. Monitor and optimize

View File

@@ -12,6 +12,8 @@ Set in project `.env` (and in token-aggregation or relay when they consume oracl
|----------|-------------|
| `ORACLE_AGGREGATOR_ADDRESS` | Oracle aggregator contract on Chain 138 (e.g. from deployment). Used by CCIP and other consumers. |
| `ORACLE_PROXY_ADDRESS` | Oracle proxy contract on Chain 138 when applicable. |
| `ORACLE_PRICE_FEED` | **OraclePriceFeed** wired to **PriceFeedKeeper** and **ReserveSystem** — not the same as `ORACLE_PROXY_ADDRESS`. |
| `CHAIN138_WETH_MOCK_PRICE_FEED` | Optional **MockPriceFeed** for WETH on the keeper path when Besu block time lags the public aggregator `updatedAt`. Sync: `scripts/reserve/sync-weth-mock-price.sh`. |
| `RESERVE_SYSTEM` | ReserveSystem address (Chain 138). Required for DODOPMMIntegration oracle-backed mid price. |
| `RPC_URL_138` / `RPC_URL` | RPC endpoint for Chain 138 (keeper and scripts). |
@@ -38,10 +40,37 @@ References: [DEPLOYMENT_COMPLETE_GUIDE.md](../deployment/DEPLOYMENT_COMPLETE_GUI
4. **Update oracle price script**
One-off or cron-driven update of oracle/oracle proxy with current price:
- `scripts/update-oracle-price.sh` — usage: `[rpc-url] [oracle-address] [private-key]`; uses `AGGREGATOR_ADDRESS` and fetches ETH/USD from CoinGecko.
**CoinGecko Demo keys** (`CG-…`): use `https://api.coingecko.com` with header `x-cg-demo-api-key` (not `pro-api.coingecko.com` with `x-cg-pro-api-key`). Paid Pro uses the pro host and pro header; the script tries demo first, then pro, then unauthenticated public.
Schedule this (or the keeper service) so PMM oracle-backed prices and reporting stay fresh.
---
## PMM mesh automation (6-second tick)
**Policy:** Run off-chain ticks every **6 seconds** so oracle pushes, `PriceFeedKeeper` upkeep, and PMM/WETH read paths stay warm—supporting peg alignment with `DODOPMMIntegration` / optional `ReserveSystem`.
| Component | Role |
|-----------|------|
| `scripts/reserve/pmm-mesh-6s-automation.sh` | Loop: `getPoolPriceOrOracle` on `PMM_MESH_POLL_POOLS`, WETH9/WETH10 `totalSupply` reads, conditional `performUpkeep`, `update-oracle-price.sh`. |
| `PMM_MESH_INTERVAL_SEC` | Default **6**. |
| `PriceFeedKeeper.updateInterval` | Default on **new** deployments is **6s** (`PriceFeedKeeper.sol`). **Existing** keepers: run `scripts/reserve/set-price-feed-keeper-interval.sh 6` as admin. |
| `KEEPER_PRIVATE_KEY` | Wallet with **KEEPER_ROLE** on `PriceFeedKeeper` for `performUpkeep` txs. |
| `MESH_WETH_WRAP_WEI` | Optional tiny `WETH.deposit{value}` on a throttled cadence (`MESH_WETH_WRAP_EVERY_N`); costs gas—default **0** (off). |
**systemd:** `config/systemd/chain138-pmm-mesh-automation.service.example` in the Proxmox repo—copy, fix paths, `enable --now`.
**Bring-up checklist (operator):**
1. `PRICE_FEED_KEEPER_ADDRESS` in `smom-dbis-138/.env` (Chain 138: `0xD3AD6831aacB5386B8A25BB8D8176a6C8a026f04` per explorer docs—verify live).
2. `KEEPER_PRIVATE_KEY` optional if same as `PRIVATE_KEY` (must have `KEEPER_ROLE` on the keeper).
3. `./scripts/reserve/set-price-feed-keeper-interval.sh 6` once if the keeper still used a 30s interval.
4. Oracle: `scripts/update-oracle-price.sh` needs Besu-safe paths (eth_call + explicit `--gas-limit`); set `AGGREGATOR_ADDRESS` / transmitter as deployed.
5. If the keeper uses a **WETH MockPriceFeed** (`CHAIN138_WETH_MOCK_PRICE_FEED`), run `scripts/reserve/sync-weth-mock-price.sh` on a schedule (or from the same cron as the mesh) so ReserveSystem WETH tracks the market.
6. Start: `nohup ./scripts/reserve/pmm-mesh-6s-automation.sh >> logs/pmm-mesh-automation.log 2>&1 &` (optional: `MESH_CAST_GAS_PRICE=2gwei` for Besu)
**Note:** On-chain PMM curves still move on **swaps**; this loop **does not** replace liquidity. It **feeds** oracles/keeper and **observes** PMM/WETH state on a fixed cadence.
---
## PMM and Reporting
- **DODOPMMIntegration**: Optional `setReserveSystem(ReserveSystem)`; then `getPoolPriceOrOracle(pool)` uses ReserveSystem when base/quote are registered.

View File

@@ -37,8 +37,9 @@ export RPC_URL=http://192.168.11.250:8545 # Chain 138
export DODO_VENDING_MACHINE_ADDRESS=0x... # Check DODO docs
export COMPLIANT_USDT_ADDRESS=0x93E66202A11B1772E55407B32B44e5Cd8eda7f22
export COMPLIANT_USDC_ADDRESS=0xf22258f57794CC8E06237084b353Ab30fFfa640b
export OFFICIAL_USDT_ADDRESS=0xdAC17F958D2ee523a2206206994597C13D831ec7
export OFFICIAL_USDC_ADDRESS=0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48
# Chain 138 local quote-side mirror stables
export OFFICIAL_USDT_ADDRESS=0x004b63A7B5b0E06f6bB6adb4a5F9f590BF3182D1
export OFFICIAL_USDC_ADDRESS=0x71D6687F38b93CCad569Fa6352c876eea967201b
# Deploy
forge script script/dex/DeployDODOPMMIntegration.s.sol:DeployDODOPMMIntegration \
@@ -147,4 +148,3 @@ cast call $DODO_PMM_INTEGRATION_ADDRESS \
5. Enable trading
See `COMPLETE_INTEGRATION_GUIDE.md` for detailed instructions.

View File

@@ -18,8 +18,8 @@ This document lists GRU-M1 base money, ISO-4217 W tokens, Aave-style asset/debt
| cJPYC | CompliantFiatToken.sol | Specified| 6 | JPY (often 0 or 2 decimals; 6 for uniformity). |
| cCHFC | CompliantFiatToken.sol | Specified| 6 | CHF. |
| cCADC | CompliantFiatToken.sol | Specified| 6 | CAD. |
| cXAUC | CompliantFiatToken.sol | Specified| 6 | XAU-backed. |
| cXAUT | CompliantFiatToken.sol | Specified| 6 | Tether XAU. |
| cXAUC | CompliantFiatToken.sol | Specified| 6 | XAU; **1 token = 1 troy oz Au** (canonical). |
| cXAUT | CompliantFiatToken.sol | Specified| 6 | XAU; **1 token = 1 troy oz Au** (canonical). |
| LiXAU | — | Specified| 6 | XAU-liquidity-adjusted; map or add. |
Properties for all: ISO-4217 aligned naming and decimals, non-interest-bearing, fully redeemable, E-Money safeguards, reserve attestation hooks. Full ERC-20 (transfer, approve, balanceOf) for DEX pools.