Files
smom-dbis-138/script/liquidity/RegisterDODOPools.s.sol
2026-03-02 12:14:09 -08:00

52 lines
2.2 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 existing DODO PMM pools 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.
*/
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(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);
vm.startBroadcast(pk);
if (poolCusdtCusdc != address(0)) {
provider.registerPool(cusdt, cusdc, poolCusdtCusdc);
console.log("Registered cUSDT/cUSDC pool:", poolCusdtCusdc);
}
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();
}
}