Skip to content

Commit 6a8397c

Browse files
marcusreinidalithbbenface
authored
Contract analyzer cli - cookbook entry created (#904)
* Add contract analyzer guide and update metadata * feat: add contract analyzer guide to subgraph documentation * Updating branch --------- Co-authored-by: Idalith Bustos <[email protected]> Co-authored-by: benface <[email protected]>
1 parent 88a92b4 commit 6a8397c

File tree

45 files changed

+2324
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+2324
-0
lines changed

website/route-lockfile.txt

+22
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
/ar/subgraphs/developing/subgraphs/
5757
/ar/subgraphs/explorer/
5858
/ar/subgraphs/guides/arweave/
59+
/ar/subgraphs/guides/contract-analyzer/
5960
/ar/subgraphs/guides/enums/
6061
/ar/subgraphs/guides/grafting/
6162
/ar/subgraphs/guides/near/
@@ -141,6 +142,7 @@
141142
/cs/subgraphs/developing/subgraphs/
142143
/cs/subgraphs/explorer/
143144
/cs/subgraphs/guides/arweave/
145+
/cs/subgraphs/guides/contract-analyzer/
144146
/cs/subgraphs/guides/enums/
145147
/cs/subgraphs/guides/grafting/
146148
/cs/subgraphs/guides/near/
@@ -226,6 +228,7 @@
226228
/de/subgraphs/developing/subgraphs/
227229
/de/subgraphs/explorer/
228230
/de/subgraphs/guides/arweave/
231+
/de/subgraphs/guides/contract-analyzer/
229232
/de/subgraphs/guides/enums/
230233
/de/subgraphs/guides/grafting/
231234
/de/subgraphs/guides/near/
@@ -311,6 +314,7 @@
311314
/en/subgraphs/developing/subgraphs/
312315
/en/subgraphs/explorer/
313316
/en/subgraphs/guides/arweave/
317+
/en/subgraphs/guides/contract-analyzer/
314318
/en/subgraphs/guides/enums/
315319
/en/subgraphs/guides/grafting/
316320
/en/subgraphs/guides/near/
@@ -396,6 +400,7 @@
396400
/es/subgraphs/developing/subgraphs/
397401
/es/subgraphs/explorer/
398402
/es/subgraphs/guides/arweave/
403+
/es/subgraphs/guides/contract-analyzer/
399404
/es/subgraphs/guides/enums/
400405
/es/subgraphs/guides/grafting/
401406
/es/subgraphs/guides/near/
@@ -481,6 +486,7 @@
481486
/fr/subgraphs/developing/subgraphs/
482487
/fr/subgraphs/explorer/
483488
/fr/subgraphs/guides/arweave/
489+
/fr/subgraphs/guides/contract-analyzer/
484490
/fr/subgraphs/guides/enums/
485491
/fr/subgraphs/guides/grafting/
486492
/fr/subgraphs/guides/near/
@@ -566,6 +572,7 @@
566572
/hi/subgraphs/developing/subgraphs/
567573
/hi/subgraphs/explorer/
568574
/hi/subgraphs/guides/arweave/
575+
/hi/subgraphs/guides/contract-analyzer/
569576
/hi/subgraphs/guides/enums/
570577
/hi/subgraphs/guides/grafting/
571578
/hi/subgraphs/guides/near/
@@ -651,6 +658,7 @@
651658
/it/subgraphs/developing/subgraphs/
652659
/it/subgraphs/explorer/
653660
/it/subgraphs/guides/arweave/
661+
/it/subgraphs/guides/contract-analyzer/
654662
/it/subgraphs/guides/enums/
655663
/it/subgraphs/guides/grafting/
656664
/it/subgraphs/guides/near/
@@ -736,6 +744,7 @@
736744
/ja/subgraphs/developing/subgraphs/
737745
/ja/subgraphs/explorer/
738746
/ja/subgraphs/guides/arweave/
747+
/ja/subgraphs/guides/contract-analyzer/
739748
/ja/subgraphs/guides/enums/
740749
/ja/subgraphs/guides/grafting/
741750
/ja/subgraphs/guides/near/
@@ -819,6 +828,7 @@
819828
/ko/subgraphs/developing/subgraphs/
820829
/ko/subgraphs/explorer/
821830
/ko/subgraphs/guides/arweave/
831+
/ko/subgraphs/guides/contract-analyzer/
822832
/ko/subgraphs/guides/enums/
823833
/ko/subgraphs/guides/grafting/
824834
/ko/subgraphs/guides/near/
@@ -904,6 +914,7 @@
904914
/mr/subgraphs/developing/subgraphs/
905915
/mr/subgraphs/explorer/
906916
/mr/subgraphs/guides/arweave/
917+
/mr/subgraphs/guides/contract-analyzer/
907918
/mr/subgraphs/guides/enums/
908919
/mr/subgraphs/guides/grafting/
909920
/mr/subgraphs/guides/near/
@@ -987,6 +998,7 @@
987998
/nl/subgraphs/developing/subgraphs/
988999
/nl/subgraphs/explorer/
9891000
/nl/subgraphs/guides/arweave/
1001+
/nl/subgraphs/guides/contract-analyzer/
9901002
/nl/subgraphs/guides/enums/
9911003
/nl/subgraphs/guides/grafting/
9921004
/nl/subgraphs/guides/near/
@@ -1070,6 +1082,7 @@
10701082
/pl/subgraphs/developing/subgraphs/
10711083
/pl/subgraphs/explorer/
10721084
/pl/subgraphs/guides/arweave/
1085+
/pl/subgraphs/guides/contract-analyzer/
10731086
/pl/subgraphs/guides/enums/
10741087
/pl/subgraphs/guides/grafting/
10751088
/pl/subgraphs/guides/near/
@@ -1155,6 +1168,7 @@
11551168
/pt/subgraphs/developing/subgraphs/
11561169
/pt/subgraphs/explorer/
11571170
/pt/subgraphs/guides/arweave/
1171+
/pt/subgraphs/guides/contract-analyzer/
11581172
/pt/subgraphs/guides/enums/
11591173
/pt/subgraphs/guides/grafting/
11601174
/pt/subgraphs/guides/near/
@@ -1238,6 +1252,7 @@
12381252
/ro/subgraphs/developing/subgraphs/
12391253
/ro/subgraphs/explorer/
12401254
/ro/subgraphs/guides/arweave/
1255+
/ro/subgraphs/guides/contract-analyzer/
12411256
/ro/subgraphs/guides/enums/
12421257
/ro/subgraphs/guides/grafting/
12431258
/ro/subgraphs/guides/near/
@@ -1323,6 +1338,7 @@
13231338
/ru/subgraphs/developing/subgraphs/
13241339
/ru/subgraphs/explorer/
13251340
/ru/subgraphs/guides/arweave/
1341+
/ru/subgraphs/guides/contract-analyzer/
13261342
/ru/subgraphs/guides/enums/
13271343
/ru/subgraphs/guides/grafting/
13281344
/ru/subgraphs/guides/near/
@@ -1408,6 +1424,7 @@
14081424
/sv/subgraphs/developing/subgraphs/
14091425
/sv/subgraphs/explorer/
14101426
/sv/subgraphs/guides/arweave/
1427+
/sv/subgraphs/guides/contract-analyzer/
14111428
/sv/subgraphs/guides/enums/
14121429
/sv/subgraphs/guides/grafting/
14131430
/sv/subgraphs/guides/near/
@@ -1493,6 +1510,7 @@
14931510
/tr/subgraphs/developing/subgraphs/
14941511
/tr/subgraphs/explorer/
14951512
/tr/subgraphs/guides/arweave/
1513+
/tr/subgraphs/guides/contract-analyzer/
14961514
/tr/subgraphs/guides/enums/
14971515
/tr/subgraphs/guides/grafting/
14981516
/tr/subgraphs/guides/near/
@@ -1576,6 +1594,7 @@
15761594
/uk/subgraphs/developing/subgraphs/
15771595
/uk/subgraphs/explorer/
15781596
/uk/subgraphs/guides/arweave/
1597+
/uk/subgraphs/guides/contract-analyzer/
15791598
/uk/subgraphs/guides/enums/
15801599
/uk/subgraphs/guides/grafting/
15811600
/uk/subgraphs/guides/near/
@@ -1661,6 +1680,7 @@
16611680
/ur/subgraphs/developing/subgraphs/
16621681
/ur/subgraphs/explorer/
16631682
/ur/subgraphs/guides/arweave/
1683+
/ur/subgraphs/guides/contract-analyzer/
16641684
/ur/subgraphs/guides/enums/
16651685
/ur/subgraphs/guides/grafting/
16661686
/ur/subgraphs/guides/near/
@@ -1744,6 +1764,7 @@
17441764
/vi/subgraphs/developing/subgraphs/
17451765
/vi/subgraphs/explorer/
17461766
/vi/subgraphs/guides/arweave/
1767+
/vi/subgraphs/guides/contract-analyzer/
17471768
/vi/subgraphs/guides/enums/
17481769
/vi/subgraphs/guides/grafting/
17491770
/vi/subgraphs/guides/near/
@@ -1829,6 +1850,7 @@
18291850
/zh/subgraphs/developing/subgraphs/
18301851
/zh/subgraphs/explorer/
18311852
/zh/subgraphs/guides/arweave/
1853+
/zh/subgraphs/guides/contract-analyzer/
18321854
/zh/subgraphs/guides/enums/
18331855
/zh/subgraphs/guides/grafting/
18341856
/zh/subgraphs/guides/near/

website/src/pages/ar/subgraphs/guides/_meta.js

+1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ export default {
88
enums: '',
99
'secure-api-keys-nextjs': '',
1010
polymarket: '',
11+
'contract-analyzer': '',
1112
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
---
2+
title: Smart Contract Analysis with Cana CLI
3+
---
4+
5+
# Cana CLI: Quick & Efficient Contract Analysis
6+
7+
**Cana CLI** is a command-line tool that streamlines helpful smart contract metadata analysis specific to subgraph development across multiple EVM-compatible chains.
8+
9+
## 📌 Key Features
10+
11+
- Detect deployment blocks
12+
- Verify source code
13+
- Extract ABIs & event signatures
14+
- Identify proxy and implementation contracts
15+
- Support multiple chains
16+
17+
## 🚀 Installation & Setup
18+
19+
Install Cana globally using npm:
20+
21+
```bash
22+
npm install -g contract-analyzer
23+
```
24+
25+
Set up a blockchain for analysis:
26+
27+
```bash
28+
cana setup
29+
```
30+
31+
Provide the required block explorer API and block explorer endpoint URL details when prompted.
32+
33+
Running `cana setup` creates a configuration file at `~/.contract-analyzer/config.json`. This file stores your block explorer API credentials, endpoint URLs, and chain selection preferences for future use.
34+
35+
## 🍳 Usage
36+
37+
### 🔹 Chain Selection
38+
39+
Cana supports multiple EVM-compatible chains.
40+
41+
List chains added with:
42+
43+
```bash
44+
cana chains
45+
```
46+
47+
Then select a chain with:
48+
49+
```bash
50+
cana chains --switch <chain>
51+
```
52+
53+
Once a chain is selected, all subsequent contract analases will continue on that chain.
54+
55+
### 🔹 Basic Contract Analysis
56+
57+
Analyze a contract with:
58+
59+
```bash
60+
cana analyze 0xContractAddress
61+
```
62+
63+
or
64+
65+
```bash
66+
cana -a 0xContractAddress
67+
```
68+
69+
This command displays essential contract information in the terminal using a clear, organized format.
70+
71+
### 🔹 Understanding Output
72+
73+
Cana organizes results into the terminal as well as into a structured directory when detailed contract data is successfully retrieved:
74+
75+
```
76+
contracts-analyzed/
77+
└── ContractName_chainName_YYYY-MM-DD/
78+
├── contract/ # Folder for individual contract files
79+
├── abi.json # Contract ABI
80+
└── event-information.json # Event signatures and examples
81+
```
82+
83+
### 🔹 Chain Management
84+
85+
Add and manage chains:
86+
87+
```bash
88+
cana setup # Add a new chain
89+
cana chains # List configured chains
90+
cana chains -s <chain> # Swich chains.
91+
```
92+
93+
## ⚠️ Troubleshooting
94+
95+
- **Missing Data**: Ensure the contract address is correct, verified on the block explorer, and that your API key has the required permissions.
96+
97+
## ✅ Requirements
98+
99+
- Node.js v16+
100+
- npm v6+
101+
- Block explorer API keys
102+
103+
Keep your contract analyses efficient and well-organized. 🚀

website/src/pages/cs/subgraphs/guides/_meta.js

+1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ export default {
88
enums: '',
99
'secure-api-keys-nextjs': '',
1010
polymarket: '',
11+
'contract-analyzer': '',
1112
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
---
2+
title: Smart Contract Analysis with Cana CLI
3+
---
4+
5+
# Cana CLI: Quick & Efficient Contract Analysis
6+
7+
**Cana CLI** is a command-line tool that streamlines helpful smart contract metadata analysis specific to subgraph development across multiple EVM-compatible chains.
8+
9+
## 📌 Key Features
10+
11+
- Detect deployment blocks
12+
- Verify source code
13+
- Extract ABIs & event signatures
14+
- Identify proxy and implementation contracts
15+
- Support multiple chains
16+
17+
## 🚀 Installation & Setup
18+
19+
Install Cana globally using npm:
20+
21+
```bash
22+
npm install -g contract-analyzer
23+
```
24+
25+
Set up a blockchain for analysis:
26+
27+
```bash
28+
cana setup
29+
```
30+
31+
Provide the required block explorer API and block explorer endpoint URL details when prompted.
32+
33+
Running `cana setup` creates a configuration file at `~/.contract-analyzer/config.json`. This file stores your block explorer API credentials, endpoint URLs, and chain selection preferences for future use.
34+
35+
## 🍳 Usage
36+
37+
### 🔹 Chain Selection
38+
39+
Cana supports multiple EVM-compatible chains.
40+
41+
List chains added with:
42+
43+
```bash
44+
cana chains
45+
```
46+
47+
Then select a chain with:
48+
49+
```bash
50+
cana chains --switch <chain>
51+
```
52+
53+
Once a chain is selected, all subsequent contract analases will continue on that chain.
54+
55+
### 🔹 Basic Contract Analysis
56+
57+
Analyze a contract with:
58+
59+
```bash
60+
cana analyze 0xContractAddress
61+
```
62+
63+
or
64+
65+
```bash
66+
cana -a 0xContractAddress
67+
```
68+
69+
This command displays essential contract information in the terminal using a clear, organized format.
70+
71+
### 🔹 Understanding Output
72+
73+
Cana organizes results into the terminal as well as into a structured directory when detailed contract data is successfully retrieved:
74+
75+
```
76+
contracts-analyzed/
77+
└── ContractName_chainName_YYYY-MM-DD/
78+
├── contract/ # Folder for individual contract files
79+
├── abi.json # Contract ABI
80+
└── event-information.json # Event signatures and examples
81+
```
82+
83+
### 🔹 Chain Management
84+
85+
Add and manage chains:
86+
87+
```bash
88+
cana setup # Add a new chain
89+
cana chains # List configured chains
90+
cana chains -s <chain> # Swich chains.
91+
```
92+
93+
## ⚠️ Troubleshooting
94+
95+
- **Missing Data**: Ensure the contract address is correct, verified on the block explorer, and that your API key has the required permissions.
96+
97+
## ✅ Requirements
98+
99+
- Node.js v16+
100+
- npm v6+
101+
- Block explorer API keys
102+
103+
Keep your contract analyses efficient and well-organized. 🚀

0 commit comments

Comments
 (0)