DeployContracts.s.sol
1 // SPDX-License-Identifier: UNLICENSED 2 3 pragma solidity ^0.8.17; 4 5 import { BaseScript } from "./Base.s.sol"; 6 import { DeploymentConfig } from "./DeploymentConfig.s.sol"; 7 import { CommunityOwnerTokenFactory } from "../contracts/factories/CommunityOwnerTokenFactory.sol"; 8 import { CommunityMasterTokenFactory } from "../contracts/factories/CommunityMasterTokenFactory.sol"; 9 import { CommunityOwnerTokenRegistry } from "../contracts/CommunityOwnerTokenRegistry.sol"; 10 import { CommunityTokenDeployer } from "../contracts/CommunityTokenDeployer.sol"; 11 12 contract DeployContracts is BaseScript { 13 function run() 14 external 15 returns ( 16 CommunityTokenDeployer, 17 CommunityOwnerTokenRegistry, 18 CommunityOwnerTokenFactory, 19 CommunityMasterTokenFactory, 20 DeploymentConfig 21 ) 22 { 23 DeploymentConfig deploymentConfig = new DeploymentConfig(broadcaster); 24 25 vm.startBroadcast(broadcaster); 26 CommunityOwnerTokenFactory ownerTokenFactory = new CommunityOwnerTokenFactory(); 27 CommunityMasterTokenFactory masterTokenFactory = new CommunityMasterTokenFactory(); 28 CommunityOwnerTokenRegistry tokenRegistry = new CommunityOwnerTokenRegistry(); 29 CommunityTokenDeployer tokenDeployer = 30 new CommunityTokenDeployer(address(tokenRegistry), address(ownerTokenFactory), address(masterTokenFactory)); 31 32 tokenRegistry.setCommunityTokenDeployerAddress(address(tokenDeployer)); 33 ownerTokenFactory.setTokenDeployerAddress(address(tokenDeployer)); 34 masterTokenFactory.setTokenDeployerAddress(address(tokenDeployer)); 35 vm.stopBroadcast(); 36 37 return (tokenDeployer, tokenRegistry, ownerTokenFactory, masterTokenFactory, deploymentConfig); 38 } 39 40 // This function is a hack to have it excluded by `forge coverage` until 41 // https://github.com/foundry-rs/foundry/issues/2988 is fixed. 42 // See: https://github.com/foundry-rs/foundry/issues/2988#issuecomment-1437784542 43 // for more info. 44 // solhint-disable-next-line 45 function test() public { } 46 }