chore: sync submodule state (parent ref update)
Made-with: Cursor
This commit is contained in:
32
script/liquidity/DeployDODOPMMProvider.s.sol
Normal file
32
script/liquidity/DeployDODOPMMProvider.s.sol
Normal file
@@ -0,0 +1,32 @@
|
||||
// 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";
|
||||
|
||||
/**
|
||||
* @title DeployDODOPMMProvider
|
||||
* @notice Deploy DODOPMMProvider for Chain 138 (or any chain with DODOPMMIntegration).
|
||||
* @dev Set DODO_PMM_INTEGRATION or DODO_PMM_INTEGRATION_ADDRESS in .env. After deploy,
|
||||
* call registerPool(tokenIn, tokenOut, pool) for each pool created via DODOPMMIntegration.
|
||||
*/
|
||||
contract DeployDODOPMMProvider is Script {
|
||||
function run() external {
|
||||
uint256 pk = vm.envUint("PRIVATE_KEY");
|
||||
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");
|
||||
|
||||
address deployer = vm.addr(pk);
|
||||
|
||||
vm.startBroadcast(pk);
|
||||
DODOPMMProvider provider = new DODOPMMProvider(integrationAddr, deployer);
|
||||
console.log("DODOPMMProvider deployed at:", address(provider));
|
||||
vm.stopBroadcast();
|
||||
|
||||
console.log("\nNext: register pools with registerPool(tokenIn, tokenOut, pool)");
|
||||
console.log("export DODO_PMM_PROVIDER_ADDRESS=", vm.toString(address(provider)));
|
||||
}
|
||||
}
|
||||
51
script/liquidity/RegisterDODOPools.s.sol
Normal file
51
script/liquidity/RegisterDODOPools.s.sol
Normal file
@@ -0,0 +1,51 @@
|
||||
// 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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user