From 25367321ee83c5c40922b7598325e6fd79a4257a Mon Sep 17 00:00:00 2001 From: Jacob Homanics Date: Mon, 24 Jun 2024 20:43:54 -0500 Subject: [PATCH] added factory code --- packages/foundry/script/DeployFactory.s.sol | 94 +++++++++---------- .../nextjs/contracts/deployedContracts.ts | 12 +-- 2 files changed, 53 insertions(+), 53 deletions(-) diff --git a/packages/foundry/script/DeployFactory.s.sol b/packages/foundry/script/DeployFactory.s.sol index c9ac608..f5eaae2 100644 --- a/packages/foundry/script/DeployFactory.s.sol +++ b/packages/foundry/script/DeployFactory.s.sol @@ -1,47 +1,47 @@ -// //SPDX-License-Identifier: MIT -// pragma solidity ^0.8.19; - -// import {console} from "forge-std/console.sol"; - -// import {ScaffoldETHDeploy} from "./DeployHelpers.s.sol"; -// import {ReputationTokensFactory} from "@atxdao/contracts/reputation/ReputationTokensFactory.sol"; -// import {ReputationTokensUpgradeable} from "@atxdao/contracts/reputation/ReputationTokensUpgradeable.sol"; - -// contract DeployFactoryScript is ScaffoldETHDeploy { -// error InvalidPrivateKey(string); - -// address controller = 0x2F15D4A66D22ecC6967928b6A76Ab06897b05676; //replace with burner or other address from wallet! - -// function run() external { -// uint256 deployerPrivateKey = setupLocalhostEnv(); -// if (deployerPrivateKey == 0) { -// revert InvalidPrivateKey( -// "You don't have a deployer account. Make sure you have set DEPLOYER_PRIVATE_KEY in .env or use `yarn generate` to generate a new random account" -// ); -// } -// address deployerPubKey = vm.createWallet(deployerPrivateKey).addr; - -// vm.startBroadcast(deployerPrivateKey); -// address[] memory admins = new address[](2); -// admins[0] = deployerPubKey; -// admins[1] = controller; - -// address tokensAddr = address(0); - -// uint256 chainId; -// assembly { -// chainId := chainid() -// } - -// if (chainId == 10) { -// tokensAddr = 0x4200000000000000000000000000000000000042; -// } - -// ReputationTokensUpgradeable implementation = new ReputationTokensUpgradeable(); -// ReputationTokensFactory factory = new ReputationTokensFactory( -// admins, -// address(implementation), -// address(0) -// ); -// } -// } +//SPDX-License-Identifier: MIT +pragma solidity ^0.8.19; + +import {console} from "forge-std/console.sol"; + +import {ScaffoldETHDeploy} from "./DeployHelpers.s.sol"; +import {ReputationTokensFactory} from "@atxdao/contracts/reputation/ReputationTokensFactory.sol"; +import {ReputationTokensUpgradeable} from "@atxdao/contracts/reputation/ReputationTokensUpgradeable.sol"; + +contract DeployFactoryScript is ScaffoldETHDeploy { + error InvalidPrivateKey(string); + + address controller = 0x2F15D4A66D22ecC6967928b6A76Ab06897b05676; //replace with burner or other address from wallet! + + function run() external { + uint256 deployerPrivateKey = setupLocalhostEnv(); + if (deployerPrivateKey == 0) { + revert InvalidPrivateKey( + "You don't have a deployer account. Make sure you have set DEPLOYER_PRIVATE_KEY in .env or use `yarn generate` to generate a new random account" + ); + } + address deployerPubKey = vm.createWallet(deployerPrivateKey).addr; + + vm.startBroadcast(deployerPrivateKey); + address[] memory admins = new address[](2); + admins[0] = deployerPubKey; + admins[1] = controller; + + address tokensAddr = address(0); + + uint256 chainId; + assembly { + chainId := chainid() + } + + if (chainId == 10) { + tokensAddr = 0x4200000000000000000000000000000000000042; + } + + ReputationTokensUpgradeable implementation = new ReputationTokensUpgradeable(); + new ReputationTokensFactory( + admins, + address(implementation), + address(0) + ); + } +} diff --git a/packages/nextjs/contracts/deployedContracts.ts b/packages/nextjs/contracts/deployedContracts.ts index ca10e5f..c707528 100644 --- a/packages/nextjs/contracts/deployedContracts.ts +++ b/packages/nextjs/contracts/deployedContracts.ts @@ -7,7 +7,7 @@ import { GenericContractsDeclaration } from "~~/utils/scaffold-eth/contract"; const deployedContracts = { 31337: { ReputationTokens: { - address: "0xc0f115a19107322cfbf1cdbc7ea011c19ebdb4f8", + address: "0x986aaa537b8cc170761fdac6ac4fc7f9d8a20a8c", abi: [ { type: "constructor", @@ -1410,7 +1410,7 @@ const deployedContracts = { }, }, ReputationFaucet: { - address: "0xfaaddc93baf78e89dcf37ba67943e1be8f37bb8c", + address: "0xb2b580ce436e6f77a5713d80887e14788ef49c9a", abi: [ { type: "constructor", @@ -1535,7 +1535,7 @@ const deployedContracts = { }, }, Hats: { - address: "0x3aade2dcd2df6a8cac689ee797591b2913658659", + address: "0xaca81583840b1bf2ddf6cde824ada250c1936b4d", abi: [ { type: "constructor", @@ -3496,7 +3496,7 @@ const deployedContracts = { }, }, MultiClaimsHatter: { - address: "0x1f10f3ba7acb61b2f50b9d6ddcf91a6f787c0e82", + address: "0xa56f946d6398dd7d9d4d9b337cf9e0f68982ca5b", abi: [ { type: "constructor", @@ -3822,7 +3822,7 @@ const deployedContracts = { }, }, ActiveModule: { - address: "0x525c7063e7c20997baae9bda922159152d0e8417", + address: "0xdde78e6202518ff4936b5302cc2891ec180e8bff", abi: [ { type: "function", @@ -3852,7 +3852,7 @@ const deployedContracts = { inheritedFunctions: {}, }, ERC1155EligibiltiyModule: { - address: "0xb82008565fdc7e44609fa118a4a681e92581e680", + address: "0xad523115cd35a8d4e60b3c0953e0e0ac10418309", abi: [ { type: "constructor",