-
Notifications
You must be signed in to change notification settings - Fork 155
Contract analyzer cli - cookbook entry created #904
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,5 @@ export default { | |
enums: '', | ||
'secure-api-keys-nextjs': '', | ||
polymarket: '', | ||
'contract-analyzer': '', | ||
} |
103 changes: 103 additions & 0 deletions
103
website/src/pages/en/subgraphs/guides/contract-analyzer.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
--- | ||
title: Smart Contract Analysis with Cana CLI | ||
--- | ||
|
||
# Cana CLI: Quick & Efficient Contract Analysis | ||
Check failure on line 5 in website/src/pages/en/subgraphs/guides/contract-analyzer.mdx
|
||
|
||
**Cana CLI** is a command-line tool that streamlines helpful smart contract metadata analysis specific to subgraph development across multiple EVM-compatible chains. | ||
|
||
## 📌 Key Features | ||
idalithb marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
- Detect deployment blocks | ||
- Verify source code | ||
- Extract ABIs & event signatures | ||
- Identify proxy and implementation contracts | ||
- Support multiple chains | ||
|
||
## 🚀 Installation & Setup | ||
idalithb marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
Install Cana globally using npm: | ||
|
||
```bash | ||
npm install -g contract-analyzer | ||
``` | ||
|
||
Set up a blockchain for analysis: | ||
|
||
```bash | ||
cana setup | ||
``` | ||
|
||
Provide the required block explorer API and block explorer endpoint URL details when prompted. | ||
|
||
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. | ||
|
||
## 🍳 Usage | ||
idalithb marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
### 🔹 Chain Selection | ||
idalithb marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
Cana supports multiple EVM-compatible chains. | ||
|
||
List chains added with: | ||
|
||
```bash | ||
cana chains | ||
``` | ||
|
||
Then select a chain with: | ||
|
||
```bash | ||
cana chains --switch <chain> | ||
``` | ||
|
||
Once a chain is selected, all subsequent contract analases will continue on that chain. | ||
idalithb marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
### 🔹 Basic Contract Analysis | ||
idalithb marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
Analyze a contract with: | ||
|
||
```bash | ||
cana analyze 0xContractAddress | ||
``` | ||
|
||
or | ||
|
||
```bash | ||
cana -a 0xContractAddress | ||
``` | ||
|
||
This command displays essential contract information in the terminal using a clear, organized format. | ||
|
||
### 🔹 Understanding Output | ||
idalithb marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
Cana organizes results into the terminal as well as into a structured directory when detailed contract data is successfully retrieved: | ||
|
||
``` | ||
contracts-analyzed/ | ||
└── ContractName_chainName_YYYY-MM-DD/ | ||
├── contract/ # Folder for individual contract files | ||
├── abi.json # Contract ABI | ||
└── event-information.json # Event signatures and examples | ||
``` | ||
|
||
### 🔹 Chain Management | ||
idalithb marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
Add and manage chains: | ||
|
||
```bash | ||
cana setup # Add a new chain | ||
cana chains # List configured chains | ||
cana chains -s <chain> # Swich chains. | ||
``` | ||
idalithb marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
## ⚠️ Troubleshooting | ||
idalithb marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
- **Missing Data**: Ensure the contract address is correct, verified on the block explorer, and that your API key has the required permissions. | ||
|
||
## ✅ Requirements | ||
idalithb marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
- Node.js v16+ | ||
- npm v6+ | ||
- Block explorer API keys | ||
|
||
Keep your contract analyses efficient and well-organized. 🚀 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.