@diamondslab/diamonds 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/dist/core/CallbackManager.d.ts +0 -13
- package/dist/core/CallbackManager.d.ts.map +0 -1
- package/dist/core/CallbackManager.js +0 -95
- package/dist/core/CallbackManager.js.map +0 -1
- package/dist/core/DeploymentManager.d.ts +0 -10
- package/dist/core/DeploymentManager.d.ts.map +0 -1
- package/dist/core/DeploymentManager.js +0 -50
- package/dist/core/DeploymentManager.js.map +0 -1
- package/dist/core/Diamond.d.ts +0 -58
- package/dist/core/Diamond.d.ts.map +0 -1
- package/dist/core/Diamond.js +0 -146
- package/dist/core/Diamond.js.map +0 -1
- package/dist/core/DiamondDeployer.d.ts +0 -10
- package/dist/core/DiamondDeployer.d.ts.map +0 -1
- package/dist/core/DiamondDeployer.js +0 -33
- package/dist/core/DiamondDeployer.js.map +0 -1
- package/dist/core/index.d.ts +0 -5
- package/dist/core/index.d.ts.map +0 -1
- package/dist/core/index.js +0 -12
- package/dist/core/index.js.map +0 -1
- package/dist/index.d.ts +0 -6
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -22
- package/dist/index.js.map +0 -1
- package/dist/repositories/DBDeploymentRepository.d.ts +0 -1
- package/dist/repositories/DBDeploymentRepository.d.ts.map +0 -1
- package/dist/repositories/DBDeploymentRepository.js +0 -20
- package/dist/repositories/DBDeploymentRepository.js.map +0 -1
- package/dist/repositories/DeploymentRepository.d.ts +0 -8
- package/dist/repositories/DeploymentRepository.d.ts.map +0 -1
- package/dist/repositories/DeploymentRepository.js +0 -7
- package/dist/repositories/DeploymentRepository.js.map +0 -1
- package/dist/repositories/FileDeploymentRepository.d.ts +0 -18
- package/dist/repositories/FileDeploymentRepository.d.ts.map +0 -1
- package/dist/repositories/FileDeploymentRepository.js +0 -58
- package/dist/repositories/FileDeploymentRepository.js.map +0 -1
- package/dist/repositories/databaseHandler.d.ts +0 -1
- package/dist/repositories/databaseHandler.d.ts.map +0 -1
- package/dist/repositories/databaseHandler.js +0 -13
- package/dist/repositories/databaseHandler.js.map +0 -1
- package/dist/repositories/index.d.ts +0 -4
- package/dist/repositories/index.d.ts.map +0 -1
- package/dist/repositories/index.js +0 -20
- package/dist/repositories/index.js.map +0 -1
- package/dist/repositories/jsonFileHandler.d.ts +0 -81
- package/dist/repositories/jsonFileHandler.d.ts.map +0 -1
- package/dist/repositories/jsonFileHandler.js +0 -223
- package/dist/repositories/jsonFileHandler.js.map +0 -1
- package/dist/repositories/prismaDBHandler.d.ts +0 -1
- package/dist/repositories/prismaDBHandler.d.ts.map +0 -1
- package/dist/repositories/prismaDBHandler.js +0 -11
- package/dist/repositories/prismaDBHandler.js.map +0 -1
- package/dist/schemas/DeploymentSchema.d.ts +0 -309
- package/dist/schemas/DeploymentSchema.d.ts.map +0 -1
- package/dist/schemas/DeploymentSchema.js +0 -56
- package/dist/schemas/DeploymentSchema.js.map +0 -1
- package/dist/schemas/index.d.ts +0 -2
- package/dist/schemas/index.d.ts.map +0 -1
- package/dist/schemas/index.js +0 -18
- package/dist/schemas/index.js.map +0 -1
- package/dist/strategies/BaseDeploymentStrategy.d.ts +0 -41
- package/dist/strategies/BaseDeploymentStrategy.d.ts.map +0 -1
- package/dist/strategies/BaseDeploymentStrategy.js +0 -545
- package/dist/strategies/BaseDeploymentStrategy.js.map +0 -1
- package/dist/strategies/DeploymentStrategy.d.ts +0 -19
- package/dist/strategies/DeploymentStrategy.d.ts.map +0 -1
- package/dist/strategies/DeploymentStrategy.js +0 -3
- package/dist/strategies/DeploymentStrategy.js.map +0 -1
- package/dist/strategies/LocalDeploymentStrategy.d.ts +0 -4
- package/dist/strategies/LocalDeploymentStrategy.d.ts.map +0 -1
- package/dist/strategies/LocalDeploymentStrategy.js +0 -8
- package/dist/strategies/LocalDeploymentStrategy.js.map +0 -1
- package/dist/strategies/OZDefenderDeploymentStrategy.d.ts +0 -62
- package/dist/strategies/OZDefenderDeploymentStrategy.d.ts.map +0 -1
- package/dist/strategies/OZDefenderDeploymentStrategy.js +0 -757
- package/dist/strategies/OZDefenderDeploymentStrategy.js.map +0 -1
- package/dist/strategies/RPCDeploymentStrategy.d.ts +0 -139
- package/dist/strategies/RPCDeploymentStrategy.d.ts.map +0 -1
- package/dist/strategies/RPCDeploymentStrategy.js +0 -710
- package/dist/strategies/RPCDeploymentStrategy.js.map +0 -1
- package/dist/strategies/index.d.ts +0 -6
- package/dist/strategies/index.d.ts.map +0 -1
- package/dist/strategies/index.js +0 -12
- package/dist/strategies/index.js.map +0 -1
- package/dist/types/config.d.ts +0 -26
- package/dist/types/config.d.ts.map +0 -1
- package/dist/types/config.js +0 -3
- package/dist/types/config.js.map +0 -1
- package/dist/types/defender.d.ts +0 -22
- package/dist/types/defender.d.ts.map +0 -1
- package/dist/types/defender.js +0 -3
- package/dist/types/defender.js.map +0 -1
- package/dist/types/deployments.d.ts +0 -71
- package/dist/types/deployments.d.ts.map +0 -1
- package/dist/types/deployments.js +0 -20
- package/dist/types/deployments.js.map +0 -1
- package/dist/types/index.d.ts +0 -5
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -21
- package/dist/types/index.js.map +0 -1
- package/dist/types/rpc.d.ts +0 -35
- package/dist/types/rpc.d.ts.map +0 -1
- package/dist/types/rpc.js +0 -3
- package/dist/types/rpc.js.map +0 -1
- package/dist/utils/common.d.ts +0 -20
- package/dist/utils/common.d.ts.map +0 -1
- package/dist/utils/common.js +0 -45
- package/dist/utils/common.js.map +0 -1
- package/dist/utils/configurationResolver.d.ts +0 -30
- package/dist/utils/configurationResolver.d.ts.map +0 -1
- package/dist/utils/configurationResolver.js +0 -151
- package/dist/utils/configurationResolver.js.map +0 -1
- package/dist/utils/contractMapping.d.ts +0 -29
- package/dist/utils/contractMapping.d.ts.map +0 -1
- package/dist/utils/contractMapping.js +0 -224
- package/dist/utils/contractMapping.js.map +0 -1
- package/dist/utils/defenderClients.d.ts +0 -5
- package/dist/utils/defenderClients.d.ts.map +0 -1
- package/dist/utils/defenderClients.js +0 -21
- package/dist/utils/defenderClients.js.map +0 -1
- package/dist/utils/defenderStore.d.ts +0 -14
- package/dist/utils/defenderStore.d.ts.map +0 -1
- package/dist/utils/defenderStore.js +0 -92
- package/dist/utils/defenderStore.js.map +0 -1
- package/dist/utils/diamondAbiGenerator.d.ts +0 -113
- package/dist/utils/diamondAbiGenerator.d.ts.map +0 -1
- package/dist/utils/diamondAbiGenerator.js +0 -415
- package/dist/utils/diamondAbiGenerator.js.map +0 -1
- package/dist/utils/diffDeployedFacets.d.ts +0 -26
- package/dist/utils/diffDeployedFacets.d.ts.map +0 -1
- package/dist/utils/diffDeployedFacets.js +0 -106
- package/dist/utils/diffDeployedFacets.js.map +0 -1
- package/dist/utils/index.d.ts +0 -16
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/index.js +0 -35
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/loupe.d.ts +0 -44
- package/dist/utils/loupe.d.ts.map +0 -1
- package/dist/utils/loupe.js +0 -128
- package/dist/utils/loupe.js.map +0 -1
- package/dist/utils/rpcStore.d.ts +0 -36
- package/dist/utils/rpcStore.d.ts.map +0 -1
- package/dist/utils/rpcStore.js +0 -166
- package/dist/utils/rpcStore.js.map +0 -1
- package/dist/utils/signer.d.ts +0 -36
- package/dist/utils/signer.d.ts.map +0 -1
- package/dist/utils/signer.js +0 -91
- package/dist/utils/signer.js.map +0 -1
- package/dist/utils/txlogging.d.ts +0 -13
- package/dist/utils/txlogging.d.ts.map +0 -1
- package/dist/utils/txlogging.js +0 -87
- package/dist/utils/txlogging.js.map +0 -1
- package/dist/utils/workspaceSetup.d.ts +0 -32
- package/dist/utils/workspaceSetup.d.ts.map +0 -1
- package/dist/utils/workspaceSetup.js +0 -311
- package/dist/utils/workspaceSetup.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"txlogging.js","sourceRoot":"","s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C,OAAO,CAAC,EAAE,CAAC;gBACX,yBAAyB;YAC3B,CAAC;QACH,CAAC;QAED,IAAI,MAAM,EAAE,CAAC;YACX,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI;iBAC3B,GAAG,CAAC,CAAC,GAAY,EAAE,CAAS,EAAE,EAAE;gBAC/B,MAAM,GAAG,GAAG,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;gBAC5C,OAAO,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,EAAE,CAAC;YAC1C,CAAC,CAAC;iBACD,IAAI,CAAC,IAAI,CAAC,CAAC;YAEd,OAAO,CAAC,GAAG,CACT,eAAK,CAAC,YAAY,CAAC,WAAW,GAAG,GAAG,CAAC;gBACrC,eAAK,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;gBAC7B,QAAQ,UAAU,EAAE,CACrB,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,GAAG,CACT,eAAK,CAAC,GAAG,CAAC,WAAW,GAAG,GAAG,CAAC,GAAG,iCAAiC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CACjF,CAAC;QACJ,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Workspace setup utility for diamonds module
|
|
3
|
-
* Supports both standalone and hardhat-diamonds plugin configurations
|
|
4
|
-
*/
|
|
5
|
-
export declare class WorkspaceSetup {
|
|
6
|
-
/**
|
|
7
|
-
* Initialize a new diamond workspace with default structure
|
|
8
|
-
*/
|
|
9
|
-
static initializeWorkspace(diamondName: string, options?: {
|
|
10
|
-
useHardhatPlugin?: boolean;
|
|
11
|
-
contractsPath?: string;
|
|
12
|
-
deploymentsPath?: string;
|
|
13
|
-
createExampleConfig?: boolean;
|
|
14
|
-
}): Promise<void>;
|
|
15
|
-
/**
|
|
16
|
-
* Create a default diamond configuration file
|
|
17
|
-
*/
|
|
18
|
-
private static createDefaultConfig;
|
|
19
|
-
/**
|
|
20
|
-
* Create an example callback file
|
|
21
|
-
*/
|
|
22
|
-
private static createExampleCallback;
|
|
23
|
-
/**
|
|
24
|
-
* Create example contract files if they don't exist
|
|
25
|
-
*/
|
|
26
|
-
private static createExampleContracts;
|
|
27
|
-
/**
|
|
28
|
-
* Create hardhat config example for hardhat-diamonds plugin
|
|
29
|
-
*/
|
|
30
|
-
private static createHardhatConfigExample;
|
|
31
|
-
}
|
|
32
|
-
//# sourceMappingURL=workspaceSetup.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"workspaceSetup.d.ts","sourceRoot":"","sources":["../../src/utils/workspaceSetup.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,qBAAa,cAAc;IAEzB;;OAEG;WACU,mBAAmB,CAC9B,WAAW,EAAE,MAAM,EACnB,OAAO,GAAE;QACP,gBAAgB,CAAC,EAAE,OAAO,CAAC;QAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,mBAAmB,CAAC,EAAE,OAAO,CAAC;KAC1B,GACL,OAAO,CAAC,IAAI,CAAC;IA6DhB;;OAEG;mBACkB,mBAAmB;IAwCxC;;OAEG;mBACkB,qBAAqB;IAmD1C;;OAEG;mBACkB,sBAAsB;IAuE3C;;OAEG;mBACkB,0BAA0B;CA0DhD"}
|
|
@@ -1,311 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.WorkspaceSetup = void 0;
|
|
37
|
-
const fs = __importStar(require("fs-extra"));
|
|
38
|
-
const path = __importStar(require("path"));
|
|
39
|
-
/**
|
|
40
|
-
* Workspace setup utility for diamonds module
|
|
41
|
-
* Supports both standalone and hardhat-diamonds plugin configurations
|
|
42
|
-
*/
|
|
43
|
-
class WorkspaceSetup {
|
|
44
|
-
/**
|
|
45
|
-
* Initialize a new diamond workspace with default structure
|
|
46
|
-
*/
|
|
47
|
-
static async initializeWorkspace(diamondName, options = {}) {
|
|
48
|
-
const { useHardhatPlugin = false, contractsPath = './contracts', deploymentsPath = './diamonds', createExampleConfig = true } = options;
|
|
49
|
-
console.log(`Initializing ${diamondName} workspace...`);
|
|
50
|
-
// Create basic directory structure
|
|
51
|
-
const diamondsDir = path.join(process.cwd(), deploymentsPath);
|
|
52
|
-
const diamondDir = path.join(diamondsDir, diamondName);
|
|
53
|
-
const deploymentsDir = path.join(diamondDir, 'deployments');
|
|
54
|
-
const callbacksDir = path.join(diamondDir, 'callbacks');
|
|
55
|
-
const contractsDir = path.join(process.cwd(), contractsPath);
|
|
56
|
-
await fs.ensureDir(diamondsDir);
|
|
57
|
-
await fs.ensureDir(diamondDir);
|
|
58
|
-
await fs.ensureDir(deploymentsDir);
|
|
59
|
-
await fs.ensureDir(callbacksDir);
|
|
60
|
-
await fs.ensureDir(contractsDir);
|
|
61
|
-
console.log(`✅ Created directory structure for ${diamondName}`);
|
|
62
|
-
// Create default configuration file
|
|
63
|
-
if (createExampleConfig) {
|
|
64
|
-
await this.createDefaultConfig(diamondName, diamondDir);
|
|
65
|
-
}
|
|
66
|
-
// Create example callback file
|
|
67
|
-
await this.createExampleCallback(diamondName, callbacksDir);
|
|
68
|
-
// Create example contracts if they don't exist
|
|
69
|
-
await this.createExampleContracts(contractsDir);
|
|
70
|
-
// Create hardhat config extension example if requested
|
|
71
|
-
if (useHardhatPlugin) {
|
|
72
|
-
await this.createHardhatConfigExample(diamondName);
|
|
73
|
-
}
|
|
74
|
-
console.log(`✅ ${diamondName} workspace initialized successfully!`);
|
|
75
|
-
console.log(`
|
|
76
|
-
Configuration files created:
|
|
77
|
-
- Diamond config: ${path.join(diamondDir, `${diamondName.toLowerCase()}.config.json`)}
|
|
78
|
-
- Callbacks: ${path.join(callbacksDir, 'ExampleFacet.ts')}
|
|
79
|
-
- Contracts: ${contractsDir}
|
|
80
|
-
|
|
81
|
-
${useHardhatPlugin ?
|
|
82
|
-
'- Hardhat config example: ./hardhat-diamonds-config.example.ts' :
|
|
83
|
-
'- Using standalone mode (no hardhat plugin required)'}
|
|
84
|
-
|
|
85
|
-
Next steps:
|
|
86
|
-
1. Customize your diamond configuration in the config file
|
|
87
|
-
2. Add your facet contracts to ${contractsPath}
|
|
88
|
-
3. Implement callback functions in ${path.join(callbacksDir)}
|
|
89
|
-
4. Deploy using: DiamondDeployer with your chosen strategy
|
|
90
|
-
`);
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Create a default diamond configuration file
|
|
94
|
-
*/
|
|
95
|
-
static async createDefaultConfig(diamondName, diamondDir) {
|
|
96
|
-
const configPath = path.join(diamondDir, `${diamondName.toLowerCase()}.config.json`);
|
|
97
|
-
if (await fs.pathExists(configPath)) {
|
|
98
|
-
console.log(`⚠️ Configuration file already exists: ${configPath}`);
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
const defaultConfig = {
|
|
102
|
-
protocolVersion: 0.0,
|
|
103
|
-
facets: {
|
|
104
|
-
DiamondCutFacet: {
|
|
105
|
-
priority: 10,
|
|
106
|
-
versions: {
|
|
107
|
-
"0.0": {}
|
|
108
|
-
}
|
|
109
|
-
},
|
|
110
|
-
DiamondLoupeFacet: {
|
|
111
|
-
priority: 20,
|
|
112
|
-
versions: {
|
|
113
|
-
"0.0": {}
|
|
114
|
-
}
|
|
115
|
-
},
|
|
116
|
-
ExampleFacet: {
|
|
117
|
-
priority: 30,
|
|
118
|
-
versions: {
|
|
119
|
-
"0.0": {
|
|
120
|
-
callbacks: ["exampleCallback"],
|
|
121
|
-
deployInit: "initialize()",
|
|
122
|
-
upgradeInit: "reinitialize()"
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
await fs.writeJson(configPath, defaultConfig, { spaces: 2 });
|
|
129
|
-
console.log(`✅ Created default configuration: ${configPath}`);
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* Create an example callback file
|
|
133
|
-
*/
|
|
134
|
-
static async createExampleCallback(diamondName, callbacksDir) {
|
|
135
|
-
const callbackPath = path.join(callbacksDir, 'ExampleFacet.ts');
|
|
136
|
-
if (await fs.pathExists(callbackPath)) {
|
|
137
|
-
console.log(`⚠️ Callback file already exists: ${callbackPath}`);
|
|
138
|
-
return;
|
|
139
|
-
}
|
|
140
|
-
const callbackContent = `import { CallbackArgs } from "../../../src/types";
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* Example callback function for ExampleFacet
|
|
144
|
-
* This function will be called after the facet is deployed
|
|
145
|
-
*/
|
|
146
|
-
export async function exampleCallback(args: CallbackArgs) {
|
|
147
|
-
const { diamond } = args;
|
|
148
|
-
|
|
149
|
-
console.log(\`Running example callback for \${diamond.diamondName} on \${diamond.networkName}\`);
|
|
150
|
-
|
|
151
|
-
// Add your post-deployment logic here
|
|
152
|
-
// For example:
|
|
153
|
-
// - Initialize contract state
|
|
154
|
-
// - Set up permissions
|
|
155
|
-
// - Configure parameters
|
|
156
|
-
|
|
157
|
-
console.log('Example callback completed successfully');
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* Initialize function called during initial deployment
|
|
162
|
-
*/
|
|
163
|
-
export async function initialize(args: CallbackArgs) {
|
|
164
|
-
const { diamond } = args;
|
|
165
|
-
console.log(\`Initializing \${diamond.diamondName}...\`);
|
|
166
|
-
// Add initialization logic here
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* Reinitialize function called during upgrades
|
|
171
|
-
*/
|
|
172
|
-
export async function reinitialize(args: CallbackArgs) {
|
|
173
|
-
const { diamond } = args;
|
|
174
|
-
console.log(\`Reinitializing \${diamond.diamondName}...\`);
|
|
175
|
-
// Add reinitialization logic here
|
|
176
|
-
}
|
|
177
|
-
`;
|
|
178
|
-
await fs.writeFile(callbackPath, callbackContent);
|
|
179
|
-
console.log(`✅ Created example callback: ${callbackPath}`);
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* Create example contract files if they don't exist
|
|
183
|
-
*/
|
|
184
|
-
static async createExampleContracts(contractsDir) {
|
|
185
|
-
const exampleFacetPath = path.join(contractsDir, 'ExampleFacet.sol');
|
|
186
|
-
if (await fs.pathExists(exampleFacetPath)) {
|
|
187
|
-
console.log(`⚠️ Example contract already exists: ${exampleFacetPath}`);
|
|
188
|
-
return;
|
|
189
|
-
}
|
|
190
|
-
const exampleFacetContent = `// SPDX-License-Identifier: MIT
|
|
191
|
-
pragma solidity ^0.8.0;
|
|
192
|
-
|
|
193
|
-
/**
|
|
194
|
-
* @title ExampleFacet
|
|
195
|
-
* @dev Example facet contract for diamond pattern
|
|
196
|
-
*/
|
|
197
|
-
contract ExampleFacet {
|
|
198
|
-
// State variables
|
|
199
|
-
uint256 private value;
|
|
200
|
-
bool private initialized;
|
|
201
|
-
|
|
202
|
-
// Events
|
|
203
|
-
event ValueSet(uint256 newValue);
|
|
204
|
-
event Initialized();
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* @dev Initialize the facet
|
|
208
|
-
*/
|
|
209
|
-
function initialize() external {
|
|
210
|
-
require(!initialized, "Already initialized");
|
|
211
|
-
initialized = true;
|
|
212
|
-
value = 0;
|
|
213
|
-
emit Initialized();
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
* @dev Reinitialize during upgrades
|
|
218
|
-
*/
|
|
219
|
-
function reinitialize() external {
|
|
220
|
-
initialized = true;
|
|
221
|
-
emit Initialized();
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
/**
|
|
225
|
-
* @dev Set a value
|
|
226
|
-
*/
|
|
227
|
-
function setValue(uint256 _value) external {
|
|
228
|
-
require(initialized, "Not initialized");
|
|
229
|
-
value = _value;
|
|
230
|
-
emit ValueSet(_value);
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
/**
|
|
234
|
-
* @dev Get the current value
|
|
235
|
-
*/
|
|
236
|
-
function getValue() external view returns (uint256) {
|
|
237
|
-
return value;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
/**
|
|
241
|
-
* @dev Check if initialized
|
|
242
|
-
*/
|
|
243
|
-
function isInitialized() external view returns (bool) {
|
|
244
|
-
return initialized;
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
`;
|
|
248
|
-
await fs.writeFile(exampleFacetPath, exampleFacetContent);
|
|
249
|
-
console.log(`✅ Created example contract: ${exampleFacetPath}`);
|
|
250
|
-
}
|
|
251
|
-
/**
|
|
252
|
-
* Create hardhat config example for hardhat-diamonds plugin
|
|
253
|
-
*/
|
|
254
|
-
static async createHardhatConfigExample(diamondName) {
|
|
255
|
-
const configPath = path.join(process.cwd(), 'hardhat-diamonds-config.example.ts');
|
|
256
|
-
if (await fs.pathExists(configPath)) {
|
|
257
|
-
console.log(`⚠️ Hardhat config example already exists: ${configPath}`);
|
|
258
|
-
return;
|
|
259
|
-
}
|
|
260
|
-
const configContent = `// Example hardhat.config.ts extension for hardhat-diamonds
|
|
261
|
-
// Copy this configuration to your hardhat.config.ts when using the hardhat-diamonds plugin
|
|
262
|
-
|
|
263
|
-
import { HardhatUserConfig } from "hardhat/config";
|
|
264
|
-
import "@nomiclabs/hardhat-waffle";
|
|
265
|
-
import "@nomiclabs/hardhat-ethers";
|
|
266
|
-
// import "@gnus.ai/hardhat-diamonds"; // Uncomment when plugin is available
|
|
267
|
-
|
|
268
|
-
declare module "hardhat/types/config" {
|
|
269
|
-
interface HardhatUserConfig {
|
|
270
|
-
diamonds?: {
|
|
271
|
-
[diamondName: string]: {
|
|
272
|
-
deploymentsPath?: string;
|
|
273
|
-
contractsPath?: string;
|
|
274
|
-
callbacksPath?: string;
|
|
275
|
-
configFilePath?: string;
|
|
276
|
-
};
|
|
277
|
-
};
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
const config: HardhatUserConfig = {
|
|
282
|
-
solidity: "0.8.17",
|
|
283
|
-
|
|
284
|
-
// Diamond configurations
|
|
285
|
-
diamonds: {
|
|
286
|
-
${diamondName}: {
|
|
287
|
-
deploymentsPath: "./diamonds",
|
|
288
|
-
contractsPath: "./contracts",
|
|
289
|
-
callbacksPath: "./diamonds/${diamondName}/callbacks",
|
|
290
|
-
configFilePath: "./diamonds/${diamondName}/${diamondName.toLowerCase()}.config.json",
|
|
291
|
-
},
|
|
292
|
-
|
|
293
|
-
// Add more diamond configurations as needed
|
|
294
|
-
},
|
|
295
|
-
|
|
296
|
-
networks: {
|
|
297
|
-
hardhat: {
|
|
298
|
-
chainId: 31337,
|
|
299
|
-
},
|
|
300
|
-
// Add other networks as needed
|
|
301
|
-
},
|
|
302
|
-
};
|
|
303
|
-
|
|
304
|
-
export default config;
|
|
305
|
-
`;
|
|
306
|
-
await fs.writeFile(configPath, configContent);
|
|
307
|
-
console.log(`✅ Created Hardhat config example: ${configPath}`);
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
exports.WorkspaceSetup = WorkspaceSetup;
|
|
311
|
-
//# sourceMappingURL=workspaceSetup.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"workspaceSetup.js","sourceRoot":"","sources":["../../src/utils/workspaceSetup.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA+B;AAC/B,2CAA6B;AAG7B;;;GAGG;AACH,MAAa,cAAc;IAEzB;;OAEG;IACH,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAC9B,WAAmB,EACnB,UAKI,EAAE;QAEN,MAAM,EACJ,gBAAgB,GAAG,KAAK,EACxB,aAAa,GAAG,aAAa,EAC7B,eAAe,GAAG,YAAY,EAC9B,mBAAmB,GAAG,IAAI,EAC3B,GAAG,OAAO,CAAC;QAEZ,OAAO,CAAC,GAAG,CAAC,gBAAgB,WAAW,eAAe,CAAC,CAAC;QAExD,mCAAmC;QACnC,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC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