abc-scaffold 1.0.1 → 1.0.4

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "abc-scaffold",
3
- "version": "1.0.1",
3
+ "version": "1.0.4",
4
4
  "description": "Africa's Blockchain Club — project-agnostic blockchain scaffolding tool",
5
5
  "author": "Africa's Blockchain Club",
6
6
  "license": "MIT",
package/src/scaffold.js CHANGED
@@ -68,28 +68,28 @@ Fill in your values in \`.env\`:
68
68
  ### 3. Compile contracts
69
69
 
70
70
  \`\`\`bash
71
- npm run compile
71
+ npx hardhat compile
72
72
  \`\`\`
73
73
 
74
74
  ### 4. Run tests
75
75
 
76
76
  \`\`\`bash
77
- npm test
77
+ npx hardhat test
78
78
  \`\`\`
79
79
 
80
- ### 5. Start a local Hardhat node
80
+ ### 5. Deploy contracts locally
81
+
82
+ Open two terminals:
81
83
 
82
84
  \`\`\`bash
85
+ # Terminal 1 — start a local node
83
86
  npx hardhat node
84
- \`\`\`
85
87
 
86
- ### 6. Deploy contracts locally
87
-
88
- \`\`\`bash
88
+ # Terminal 2 — deploy your contracts
89
89
  npx hardhat run scripts/deploy.js --network localhost
90
90
  \`\`\`
91
91
 
92
- ### 7. Start the frontend
92
+ ### 6. Start the frontend
93
93
 
94
94
  \`\`\`bash
95
95
  cd frontend
@@ -295,9 +295,17 @@ export async function scaffold(initialName) {
295
295
 
296
296
  fs.mkdirSync(targetDir, { recursive: true });
297
297
 
298
- for (const dir of ['contracts', 'scripts', 'test']) {
299
- fs.mkdirSync(path.join(targetDir, dir), { recursive: true });
300
- logger.success(`${dir}/`);
298
+ // Copy starter files directories are created implicitly by fse.copySync
299
+ const starterFiles = [
300
+ ['contracts/MyContract.sol', 'contracts/MyContract.sol'],
301
+ ['scripts/deploy.js', 'scripts/deploy.js'],
302
+ ['scripts/upgrade.js', 'scripts/upgrade.js'],
303
+ ['test/MyContract.test.js', 'test/MyContract.test.js'],
304
+ ];
305
+
306
+ for (const [src, dest] of starterFiles) {
307
+ fse.copySync(path.join(TEMPLATES, src), path.join(targetDir, dest));
308
+ logger.success(dest);
301
309
  }
302
310
 
303
311
  // ── Copy configuration files ────────────────────────────────────────────────
@@ -337,7 +345,7 @@ export async function scaffold(initialName) {
337
345
  console.log(chalk.cyan(` cd ${projectName}`));
338
346
  console.log(chalk.cyan(' npm install') + chalk.gray(' # install root dependencies'));
339
347
  console.log(chalk.cyan(' cp .env.example .env') + chalk.gray(' # fill in your keys'));
340
- console.log(chalk.cyan(' npm run compile') + chalk.gray(' # compile contracts'));
348
+ console.log(chalk.cyan(' npx hardhat compile') + chalk.gray(' # compile contracts'));
341
349
  console.log(chalk.cyan(' cd frontend && npm install') + chalk.gray(' # install frontend dependencies'));
342
350
  console.log(chalk.cyan(' npm run dev') + chalk.gray(' # start the UI'));
343
351
  console.log('');
@@ -0,0 +1,6 @@
1
+ // SPDX-License-Identifier: MIT
2
+ pragma solidity ^0.8.26;
3
+
4
+ contract MyContract {
5
+ // Your logic here
6
+ }
@@ -19,16 +19,13 @@ body {
19
19
  flex-direction: column;
20
20
  }
21
21
 
22
- /* ── Main content ── */
23
22
  .main {
24
23
  flex: 1;
25
- max-width: 1100px;
26
- margin: 0 auto;
27
- padding: 5rem 2rem;
28
- width: 100%;
24
+ display: flex;
25
+ align-items: center;
26
+ justify-content: center;
29
27
  }
30
28
 
31
- /* ── Hero ── */
32
29
  .hero {
33
30
  text-align: center;
34
31
  }
@@ -44,50 +41,5 @@ body {
44
41
  .subtitle {
45
42
  font-size: 1.1rem;
46
43
  color: #e94560;
47
- margin-bottom: 3.5rem;
48
44
  font-weight: 500;
49
45
  }
50
-
51
- /* ── Cards ── */
52
- .cards {
53
- display: grid;
54
- grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
55
- gap: 1.5rem;
56
- margin-top: 1rem;
57
- }
58
-
59
- .card {
60
- background-color: #1a1a2e;
61
- border: 1px solid #2a2a4a;
62
- border-radius: 12px;
63
- padding: 1.75rem 1.5rem;
64
- text-align: left;
65
- transition: border-color 0.2s ease, transform 0.2s ease;
66
- }
67
-
68
- .card:hover {
69
- border-color: #e94560;
70
- transform: translateY(-3px);
71
- }
72
-
73
- .card h3 {
74
- font-size: 1.05rem;
75
- font-weight: 700;
76
- color: #ffffff;
77
- margin-bottom: 0.6rem;
78
- }
79
-
80
- .card p {
81
- font-size: 0.9rem;
82
- color: #9090a8;
83
- line-height: 1.5;
84
- }
85
-
86
- .card code {
87
- background-color: #0d0d1a;
88
- color: #e94560;
89
- padding: 0.1rem 0.4rem;
90
- border-radius: 4px;
91
- font-size: 0.85rem;
92
- font-family: 'Fira Code', 'Cascadia Code', monospace;
93
- }
@@ -9,25 +9,6 @@ function App() {
9
9
  <div className="hero">
10
10
  <h1>Your Blockchain Project</h1>
11
11
  <p className="subtitle">Scaffolded by Africa's Blockchain Club</p>
12
-
13
- <div className="cards">
14
- <div className="card">
15
- <h3>📄 Write Contracts</h3>
16
- <p>Add your Solidity files to <code>contracts/</code></p>
17
- </div>
18
- <div className="card">
19
- <h3>⚙️ Compile</h3>
20
- <p>Run <code>npm run compile</code> in the project root</p>
21
- </div>
22
- <div className="card">
23
- <h3>🚀 Deploy</h3>
24
- <p>Add a script to <code>scripts/</code> and run it with Hardhat</p>
25
- </div>
26
- <div className="card">
27
- <h3>🔗 Connect</h3>
28
- <p>Use the wallet button above to connect MetaMask, then interact with your contracts</p>
29
- </div>
30
- </div>
31
12
  </div>
32
13
  </main>
33
14
  </div>
@@ -10,12 +10,10 @@
10
10
  z-index: 100;
11
11
  }
12
12
 
13
- /* ── Brand ── */
14
13
  .navbar-brand {
15
14
  display: flex;
16
15
  align-items: center;
17
16
  gap: 0.6rem;
18
- text-decoration: none;
19
17
  }
20
18
 
21
19
  .navbar-logo {
@@ -30,7 +28,6 @@
30
28
  letter-spacing: 0.3px;
31
29
  }
32
30
 
33
- /* ── Actions ── */
34
31
  .navbar-actions {
35
32
  display: flex;
36
33
  align-items: center;
@@ -3,7 +3,7 @@ import { BrowserProvider } from 'ethers';
3
3
  import './Navbar.css';
4
4
 
5
5
  export default function Navbar() {
6
- const [account, setAccount] = useState(null);
6
+ const [account, setAccount] = useState(null);
7
7
  const [connecting, setConnecting] = useState(false);
8
8
 
9
9
  async function connectWallet() {
@@ -0,0 +1,18 @@
1
+ const { ethers } = require('hardhat');
2
+
3
+ async function main() {
4
+
5
+ const [deployer] = await ethers.getSigners();
6
+ console.log('Deploying from:', deployer.address);
7
+
8
+ const MyContract = await ethers.getContractFactory('MyContract');
9
+ const contract = await MyContract.deploy();
10
+ await contract.waitForDeployment();
11
+
12
+ console.log('MyContract deployed to:', await contract.getAddress());
13
+ }
14
+
15
+ main().catch((err) => {
16
+ console.error(err);
17
+ process.exitCode = 1;
18
+ });
@@ -0,0 +1,20 @@
1
+ const { ethers, upgrades } = require('hardhat');
2
+
3
+ // Address of the proxy contract from your initial deployment
4
+ const PROXY_ADDRESS = '0xYOUR_PROXY_ADDRESS_HERE';
5
+
6
+ async function main() {
7
+ const [deployer] = await ethers.getSigners();
8
+ console.log('Upgrading from:', deployer.address);
9
+
10
+ const MyContractV2 = await ethers.getContractFactory('MyContractV2');
11
+ const upgraded = await upgrades.upgradeProxy(PROXY_ADDRESS, MyContractV2);
12
+ await upgraded.waitForDeployment();
13
+
14
+ console.log('Proxy upgraded at:', await upgraded.getAddress());
15
+ }
16
+
17
+ main().catch((err) => {
18
+ console.error(err);
19
+ process.exitCode = 1;
20
+ });
@@ -0,0 +1,10 @@
1
+ const { expect } = require('chai');
2
+ const { ethers } = require('hardhat');
3
+
4
+ describe('MyContract', function () {
5
+ it('should deploy successfully', async function () {
6
+ const MyContract = await ethers.getContractFactory('MyContract');
7
+ const contract = await MyContract.deploy();
8
+ expect(await contract.getAddress()).to.not.equal(ethers.ZeroAddress);
9
+ });
10
+ });