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

@@ -7,10 +7,11 @@ import {DODOPMMIntegration} from "../../contracts/dex/DODOPMMIntegration.sol";
/**
* @title RegisterDODOPools
* @notice Register existing DODO PMM pools with DODOPMMProvider.
* @notice Register all existing DODO PMM pools from DODOPMMIntegration with DODOPMMProvider.
* @dev Set DODO_PMM_PROVIDER_ADDRESS, DODO_PMM_INTEGRATION (or DODO_PMM_INTEGRATION_ADDRESS).
* Pool addresses: POOL_CUSDTCUSDC, POOL_CUSDTUSDT, POOL_CUSDCUSDC (optional).
* Token addresses read from integration if not in env.
* Reads integration.getAllPools() and poolConfigs(pool), then registers both directions
* for every discovered pool so provider.supportsTokenPair() and executeSwap() work
* symmetrically across the current live set and any future c* full-mesh expansion.
*/
contract RegisterDODOPools is Script {
function run() external {
@@ -18,34 +19,35 @@ contract RegisterDODOPools is Script {
address providerAddr = vm.envAddress("DODO_PMM_PROVIDER_ADDRESS");
address integrationAddr = vm.envAddress("DODO_PMM_INTEGRATION");
if (integrationAddr == address(0)) integrationAddr = vm.envAddress("DODO_PMM_INTEGRATION_ADDRESS");
require(providerAddr != address(0), "DODO_PMM_PROVIDER_ADDRESS not set");
require(integrationAddr != address(0), "DODO_PMM_INTEGRATION not set");
DODOPMMIntegration integration = DODOPMMIntegration(integrationAddr);
address cusdt = integration.compliantUSDT();
address cusdc = integration.compliantUSDC();
address usdt = integration.officialUSDT();
address usdc = integration.officialUSDC();
address poolCusdtCusdc = vm.envOr("POOL_CUSDTCUSDC", address(0));
address poolCusdtUsdt = vm.envOr("POOL_CUSDTUSDT", address(0));
address poolCusdcUsdc = vm.envOr("POOL_CUSDCUSDC", address(0));
DODOPMMProvider provider = DODOPMMProvider(providerAddr);
address[] memory pools = integration.getAllPools();
require(pools.length > 0, "No pools found in DODOPMMIntegration");
vm.startBroadcast(pk);
if (poolCusdtCusdc != address(0)) {
provider.registerPool(cusdt, cusdc, poolCusdtCusdc);
console.log("Registered cUSDT/cUSDC pool:", poolCusdtCusdc);
for (uint256 i = 0; i < pools.length; i++) {
try integration.getPoolConfig(pools[i]) returns (DODOPMMIntegration.PoolConfig memory config) {
_registerPair(provider, config.baseToken, config.quoteToken, pools[i]);
} catch {
console.log("Skipping removed or unreadable pool:", pools[i]);
}
}
if (poolCusdtUsdt != address(0)) {
provider.registerPool(cusdt, usdt, poolCusdtUsdt);
console.log("Registered cUSDT/USDT pool:", poolCusdtUsdt);
}
if (poolCusdcUsdc != address(0)) {
provider.registerPool(cusdc, usdc, poolCusdcUsdc);
console.log("Registered cUSDC/USDC pool:", poolCusdcUsdc);
}
vm.stopBroadcast();
}
function _registerPair(
DODOPMMProvider provider,
address tokenA,
address tokenB,
address pool
) internal {
provider.registerPool(tokenA, tokenB, pool);
provider.registerPool(tokenB, tokenA, pool);
console.log("Registered base:", tokenA);
console.log("Registered quote:", tokenB);
console.log("Pool:", pool);
}
}