diff --git a/deploy/01-deploy-erc-20-dao-factory.ts b/deploy/01-deploy-erc-20-dao-factory.ts index 04c48b9..71afd4e 100644 --- a/deploy/01-deploy-erc-20-dao-factory.ts +++ b/deploy/01-deploy-erc-20-dao-factory.ts @@ -2,6 +2,7 @@ import { DeployFunction, DeployResult } from "hardhat-deploy/dist/types"; import { HardhatRuntimeEnvironment } from "hardhat/types"; import { network } from "hardhat"; +import fs from 'fs'; const deployErc20DaoFactory: DeployFunction = async ( hre: HardhatRuntimeEnvironment @@ -9,13 +10,24 @@ const deployErc20DaoFactory: DeployFunction = async ( const { deploy } = hre.deployments; const { deployer } = await hre.getNamedAccounts(); const chainId = network.config.chainId!; + const currentNetwork = network.name; - await deploy("ERC20DaoFactory", { + const deployerResult = await deploy("ERC20DaoFactory", { from: deployer, log: true, args: [], waitConfirmations: chainId == 31337 ? 1 : 6, }); + + if (!fs.existsSync('deployments')) { + fs.mkdirSync('deployments'); + } + fs.writeFileSync( + `deployments/erc-20-dao-factory-${currentNetwork}.json`, + JSON.stringify({ + address: deployerResult.address, + }, null, 2)); + console.log('Done!'); }; export default deployErc20DaoFactory; diff --git a/deploy/02-deploy-nft-dao-factory.ts b/deploy/02-deploy-nft-dao-factory.ts index 68757d8..1b7d317 100644 --- a/deploy/02-deploy-nft-dao-factory.ts +++ b/deploy/02-deploy-nft-dao-factory.ts @@ -2,21 +2,32 @@ import { DeployFunction, DeployResult } from "hardhat-deploy/dist/types"; import { HardhatRuntimeEnvironment } from "hardhat/types"; import { network } from "hardhat"; +import fs from 'fs'; -const deployErc20DaoFactory: DeployFunction = async ( +const deployNftDaoFactory: DeployFunction = async ( hre: HardhatRuntimeEnvironment ) => { const { deploy } = hre.deployments; const { deployer } = await hre.getNamedAccounts(); const chainId = network.config.chainId!; + const currentNetwork = network.name; - await deploy("NFTDaoFactory", { + const deployerResult = await deploy("NFTDaoFactory", { from: deployer, log: true, args: [], waitConfirmations: chainId == 31337 ? 1 : 6, }); + if (!fs.existsSync('deployments')) { + fs.mkdirSync('deployments'); + } + fs.writeFileSync( + `deployments/nft-dao-factory-${currentNetwork}.json`, + JSON.stringify({ + address: deployerResult.address, + }, null, 2)); + console.log('Done!'); }; -export default deployErc20DaoFactory; -deployErc20DaoFactory.tags = ["all", "NFTDaoFactory"]; \ No newline at end of file +export default deployNftDaoFactory; +deployNftDaoFactory.tags = ["all", "NFTDaoFactory"]; \ No newline at end of file diff --git a/scripts/send-to-dao.ts b/scripts/send-to-dao.ts index 544bd92..7b46057 100644 --- a/scripts/send-to-dao.ts +++ b/scripts/send-to-dao.ts @@ -4,7 +4,7 @@ import { readFileSync } from 'fs'; async function main() { // TODO EDIT dao address - const daoAddress = '0xE6135Dd153266E9001728765Cb101e3F233F0E8b'; + const daoAddress = '0xC88Bc7C6e67cc1a2Ae9a39f2fB97509902D6672E'; const abi = ['function transfer(address recipient, uint256 amount) external returns (bool)']; const nftAbi = ['function createNFT(address,string) external returns (uint256)'];