-
Notifications
You must be signed in to change notification settings - Fork 0
/
smart_contract_repos.js
47 lines (38 loc) · 1.54 KB
/
smart_contract_repos.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
```javascript
// Importing necessary libraries and tools
const fs = require('fs');
const path = require('path');
const { execSync } = require('child_process');
// Importing blockchain configuration
const blockchainConfig = require('./blockchain_config');
// Smart Contract Repositories configuration for the project
class SmartContractRepos {
constructor() {
this.repos = {
QuantumUnityFramework: this.cloneRepo(blockchainConfig.QUANTUM_UNITY_FRAMEWORK_CHAIN_ID),
GlobalDigitalCurrencyNetwork: this.cloneRepo(blockchainConfig.GLOBAL_DIGITAL_CURRENCY_NETWORK_CHAIN_ID),
Contudo: this.cloneRepo(blockchainConfig.CONTUDO_CHAIN_ID)
};
}
// Function to clone the repository
cloneRepo(chainId) {
const repoUrl = this.getRepoUrl(chainId);
const repoPath = path.join(__dirname, 'repos', chainId);
// Create the repos directory if it doesn't exist
if (!fs.existsSync(path.join(__dirname, 'repos'))) {
fs.mkdirSync(path.join(__dirname, 'repos'));
}
// Clone the repository
execSync(`git clone ${repoUrl} ${repoPath}`, { stdio: 'inherit' });
// Install the dependencies
execSync('npm install', { cwd: repoPath, stdio: 'inherit' });
return repoPath;
}
// Function to get the repository URL
getRepoUrl(chainId) {
// Replace this with the actual logic to get the repository URL
return `https://github.com/your-organization/${chainId}.git`;
}
}
module.exports = new SmartContractRepos();
```