/** * Deploy only the DVM (DODO Vending Machine) stack for Chain 138. * Run with: truffle migrate -f 9 --to 9 --network chain138 * Requires: .env with privKey and RPC_URL_138 (or CHAIN138_RPC_URL) */ const CloneFactory = artifacts.require("CloneFactory"); const FeeRateModelTemplate = artifacts.require("FeeRateModel"); const FeeRateDIP3 = artifacts.require("FeeRateDIP3Impl"); const PermissionManagerTemplate = artifacts.require("PermissionManager"); const DvmTemplate = artifacts.require("DVM"); const DvmFactory = artifacts.require("DVMFactory"); module.exports = async function (deployer, network, accounts) { if (network !== "chain138") return; const multiSig = accounts[0]; const defaultMaintainer = accounts[0]; console.log("Deploying DVM stack on Chain 138 with maintainer:", multiSig); await deployer.deploy(CloneFactory); const CloneFactoryAddress = CloneFactory.address; console.log("CloneFactory:", CloneFactoryAddress); await deployer.deploy(FeeRateModelTemplate); const defaultMtFeeRateAddress = FeeRateModelTemplate.address; console.log("FeeRateModel:", defaultMtFeeRateAddress); const feeRateModelInstance = await FeeRateModelTemplate.at(defaultMtFeeRateAddress); await feeRateModelInstance.initOwner(multiSig); await deployer.deploy(FeeRateDIP3); const feeRateDIP3Address = FeeRateDIP3.address; console.log("FeeRateDIP3Impl:", feeRateDIP3Address); const feeRateDIP3Instance = await FeeRateDIP3.at(feeRateDIP3Address); await feeRateDIP3Instance.initOwner(multiSig); await deployer.deploy(PermissionManagerTemplate); const permissionManagerAddress = PermissionManagerTemplate.address; console.log("PermissionManager:", permissionManagerAddress); const permissionInstance = await PermissionManagerTemplate.at(permissionManagerAddress); await permissionInstance.initOwner(multiSig); await deployer.deploy(DvmTemplate); const dvmTemplateAddress = DvmTemplate.address; console.log("DVM template:", dvmTemplateAddress); await deployer.deploy( DvmFactory, CloneFactoryAddress, dvmTemplateAddress, defaultMaintainer, defaultMtFeeRateAddress ); const dvmFactoryAddress = DvmFactory.address; console.log("DVMFactory:", dvmFactoryAddress); const dvmFactoryInstance = await DvmFactory.at(dvmFactoryAddress); await dvmFactoryInstance.initOwner(multiSig); console.log("\n=== Chain 138 DVM deployment summary ==="); console.log("DVMFactory (use this with an adapter for createDVM):", dvmFactoryAddress); console.log("Set DODO_VENDING_MACHINE_ADDRESS to the DVMFactoryAdapter address (deploy separately)."); };