protoscan 0.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/LICENSE +21 -0
- package/README.md +163 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2648 -0
- package/package.json +45 -0
- package/protoscan.config.json +20 -0
- package/src/chains.ts +38 -0
- package/src/config.ts +36 -0
- package/src/diff.ts +113 -0
- package/src/index.ts +289 -0
- package/src/protocols/common.ts +66 -0
- package/src/protocols/index.ts +2 -0
- package/src/protocols/proxy.ts +50 -0
- package/src/registry/aave-v3.ts +242 -0
- package/src/registry/compound-v3.ts +238 -0
- package/src/registry/eigenlayer.ts +190 -0
- package/src/registry/index.ts +38 -0
- package/src/registry/lido.ts +557 -0
- package/src/registry/maker.ts +176 -0
- package/src/registry/morpho-blue.ts +347 -0
- package/src/registry/pendle.ts +120 -0
- package/src/registry/schema.ts +40 -0
- package/src/registry/uniswap-v3.ts +198 -0
- package/src/scanner.ts +181 -0
- package/src/snapshot.ts +70 -0
- package/src/types.ts +67 -0
- package/tsconfig.json +17 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
# protoscan
|
|
2
|
+
|
|
3
|
+
On-chain protocol state tracker and diff tool for DeFi teams.
|
|
4
|
+
|
|
5
|
+
Track deployed contract state across chains — proxy implementations, admin addresses, protocol parameters, access control — and detect changes between snapshots.
|
|
6
|
+
|
|
7
|
+
## Why
|
|
8
|
+
|
|
9
|
+
During audits and post-deployment ops I kept repeating the same manual checks: verifying proxy implementations on Etherscan, comparing admin addresses across chains, checking that governance proposals actually changed what they were supposed to. Multiply that by 5 chains and 20 contracts and it becomes unsustainable.
|
|
10
|
+
|
|
11
|
+
With Defender sunsetting, there's even less tooling for this. `protoscan` fills the gap — a self-hosted CLI that gives you a complete picture of your protocol's on-chain state in one command.
|
|
12
|
+
|
|
13
|
+
## Built-in Protocol Registry
|
|
14
|
+
|
|
15
|
+
`protoscan` ships with curated definitions for major DeFi protocols — contract addresses, ABIs, parameter names, and access control mappings across all deployed chains. No configuration needed.
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
protoscan protocols
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
aave-v3 Aave V3 v3.0 5 chains | 10 params | 3 access roles
|
|
23
|
+
compound-v3 Compound V3 v3.0 3 chains | 13 params | 3 access roles
|
|
24
|
+
uniswap-v3 Uniswap V3 v3.0 5 chains | 10 params | 2 access roles
|
|
25
|
+
maker Maker (Sky) vMCD 1 chain | 9 params | 2 access roles
|
|
26
|
+
eigenlayer EigenLayer v1.0 1 chain | 7 params | 6 access roles
|
|
27
|
+
pendle Pendle v2.0 2 chains | 5 params | 2 access roles
|
|
28
|
+
lido Lido v2.0 1 chain | 36 params | 4 access roles
|
|
29
|
+
morpho-blue Morpho Blue v1.0 2 chains | 20 params | 4 access roles
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
# Full protocol scan — contracts, access control, parameters
|
|
34
|
+
protoscan scan aave-v3 -c ethereum
|
|
35
|
+
|
|
36
|
+
# Save and compare
|
|
37
|
+
protoscan scan aave-v3 -c ethereum -l before-proposal
|
|
38
|
+
# ... governance executes ...
|
|
39
|
+
protoscan scan aave-v3 -c ethereum -l after-proposal
|
|
40
|
+
protoscan diff before-proposal after-proposal
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Install
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
npm install -g protoscan
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Quick Start
|
|
50
|
+
|
|
51
|
+
### Scan a known protocol
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
protoscan scan morpho-blue -c ethereum
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Output:
|
|
58
|
+
```
|
|
59
|
+
Contracts
|
|
60
|
+
Morpho: 0xBBBB...FFCb
|
|
61
|
+
Core immutable lending singleton
|
|
62
|
+
MetaMorphoFactory: 0xA9c3...6101
|
|
63
|
+
Factory deploying MetaMorpho vault instances
|
|
64
|
+
...
|
|
65
|
+
|
|
66
|
+
Access Control
|
|
67
|
+
✗ Morpho Core Owner
|
|
68
|
+
holder: 0xcBa2...9AFa
|
|
69
|
+
Can enable new IRMs/LLTVs and change fee recipient
|
|
70
|
+
✗ Vault Owner
|
|
71
|
+
holder: 0x0A0e...8DD
|
|
72
|
+
Full control over MetaMorpho vault
|
|
73
|
+
...
|
|
74
|
+
|
|
75
|
+
Config Parameters
|
|
76
|
+
! reserveFeePercent: 1000 (10.00%)
|
|
77
|
+
Fee percentage taken from yield as protocol revenue
|
|
78
|
+
...
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Track your own contracts
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
# Initialize config
|
|
85
|
+
protoscan init
|
|
86
|
+
|
|
87
|
+
# Edit protoscan.config.json with your contracts
|
|
88
|
+
protoscan snapshot -l baseline
|
|
89
|
+
# ... time passes ...
|
|
90
|
+
protoscan snapshot -l current
|
|
91
|
+
protoscan diff baseline current
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Configuration
|
|
95
|
+
|
|
96
|
+
`protoscan.config.json`:
|
|
97
|
+
|
|
98
|
+
```json
|
|
99
|
+
{
|
|
100
|
+
"chains": {
|
|
101
|
+
"ethereum": {
|
|
102
|
+
"rpc": "https://ethereum-rpc.publicnode.com"
|
|
103
|
+
},
|
|
104
|
+
"arbitrum": {
|
|
105
|
+
"rpc": "https://arbitrum-one-rpc.publicnode.com"
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
"contracts": {
|
|
109
|
+
"MyPool": {
|
|
110
|
+
"address": "0x...",
|
|
111
|
+
"chains": ["ethereum", "arbitrum"],
|
|
112
|
+
"type": "proxy"
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Contract types
|
|
119
|
+
|
|
120
|
+
| Type | Description |
|
|
121
|
+
|------|-------------|
|
|
122
|
+
| `proxy` | ERC-1967 proxy — tracks implementation, admin, beacon |
|
|
123
|
+
| `raw` | Non-proxy contract — tracks public state only |
|
|
124
|
+
| `gnosis-safe` | Safe multisig — tracks owners, threshold |
|
|
125
|
+
|
|
126
|
+
## Commands
|
|
127
|
+
|
|
128
|
+
| Command | Description |
|
|
129
|
+
|---------|-------------|
|
|
130
|
+
| `protoscan protocols` | List supported protocols in the built-in registry |
|
|
131
|
+
| `protoscan scan <id> -c <chain>` | Scan a known protocol |
|
|
132
|
+
| `protoscan snapshot` | Snapshot custom contracts from config |
|
|
133
|
+
| `protoscan diff <from> <to>` | Compare two snapshots |
|
|
134
|
+
| `protoscan show <snapshot>` | Display a snapshot |
|
|
135
|
+
| `protoscan list` | List saved snapshots |
|
|
136
|
+
|
|
137
|
+
## What it reads
|
|
138
|
+
|
|
139
|
+
- Proxy implementation, admin, beacon (ERC-1967)
|
|
140
|
+
- Owner, admin, guardian, governance addresses
|
|
141
|
+
- Paused state, pending ownership transfers
|
|
142
|
+
- Protocol-specific parameters (rates, fees, ceilings, limits)
|
|
143
|
+
- Access control role holders
|
|
144
|
+
- Token supply and configuration
|
|
145
|
+
|
|
146
|
+
Changes are classified by severity:
|
|
147
|
+
- **critical** — implementation upgrade, admin/owner change, oracle swap
|
|
148
|
+
- **warning** — paused state, fee changes, beacon change
|
|
149
|
+
- **info** — supply changes, utilization metrics
|
|
150
|
+
|
|
151
|
+
## Supported chains
|
|
152
|
+
|
|
153
|
+
Ethereum, Arbitrum, Optimism, Base, Polygon, Avalanche, BSC, Gnosis, Scroll, Linea, Blast, zkSync.
|
|
154
|
+
|
|
155
|
+
## Adding a protocol
|
|
156
|
+
|
|
157
|
+
Protocol definitions live in `src/registry/`. Each file exports a `ProtocolDef` with contracts, deployment addresses, parameter definitions, and access control mappings. See existing definitions for the pattern.
|
|
158
|
+
|
|
159
|
+
PRs welcome — especially for protocols not yet covered.
|
|
160
|
+
|
|
161
|
+
## License
|
|
162
|
+
|
|
163
|
+
MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|