- 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
54 lines
2.4 KiB
Solidity
54 lines
2.4 KiB
Solidity
// SPDX-License-Identifier: MIT
|
|
pragma solidity ^0.8.19;
|
|
|
|
import {Script, console} from "forge-std/Script.sol";
|
|
import {DODOPMMProvider} from "../../contracts/liquidity/providers/DODOPMMProvider.sol";
|
|
import {DODOPMMIntegration} from "../../contracts/dex/DODOPMMIntegration.sol";
|
|
|
|
/**
|
|
* @title RegisterDODOPools
|
|
* @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).
|
|
* 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 {
|
|
uint256 pk = vm.envUint("PRIVATE_KEY");
|
|
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);
|
|
DODOPMMProvider provider = DODOPMMProvider(providerAddr);
|
|
address[] memory pools = integration.getAllPools();
|
|
require(pools.length > 0, "No pools found in DODOPMMIntegration");
|
|
|
|
vm.startBroadcast(pk);
|
|
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]);
|
|
}
|
|
}
|
|
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);
|
|
}
|
|
}
|