primecli 0.1.0__tar.gz

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.
primecli-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Mnemosyne-quest contributors
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.
@@ -0,0 +1,226 @@
1
+ Metadata-Version: 2.4
2
+ Name: primecli
3
+ Version: 0.1.0
4
+ Summary: Command-line tool for the DeltaPrime (Avalanche) and DegenPrime (Base) lending and leverage protocols.
5
+ Author: Mnemosyne-quest contributors
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/Mnemosyne-quest/primecli
8
+ Project-URL: Issues, https://github.com/Mnemosyne-quest/primecli/issues
9
+ Project-URL: Documentation, https://github.com/Mnemosyne-quest/primecli/tree/main/docs
10
+ Keywords: defi,deltaprime,degenprime,avalanche,base,lending,leverage,ethereum
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Intended Audience :: Financial and Insurance Industry
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Operating System :: POSIX :: Linux
17
+ Classifier: Operating System :: MacOS
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Topic :: Office/Business :: Financial
23
+ Requires-Python: >=3.10
24
+ Description-Content-Type: text/markdown
25
+ License-File: LICENSE
26
+ Requires-Dist: web3<8,>=7.0
27
+ Requires-Dist: eth-account>=0.13
28
+ Requires-Dist: eth-keys>=0.5
29
+ Requires-Dist: eth-abi>=5.0
30
+ Requires-Dist: requests>=2.31
31
+ Dynamic: license-file
32
+
33
+ # primecli
34
+
35
+ > Command-line tools for the **DeltaPrime** (Avalanche) and **DegenPrime** (Base) lending and leverage protocols.
36
+
37
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
38
+ [![Python](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://www.python.org/)
39
+
40
+ `primecli` is two `pip`-installable console commands — `deltaprime` and `degenprime` — that drive the lending and leverage protocols by the DeltaPrimeLabs team on Avalanche C-chain and Base. It exposes the full surface most people use day to day: savings pools, per-user Prime / Degen Accounts, ParaSwap and YieldYak swaps, debt refinancing, GMX V2 LP, TraderJoe V2 LB, sJOE staking, PRIME leverage tiers, delayed collateral withdrawals, and a leveraged-long zap macro.
41
+
42
+ Built to be agent-friendly: preview by default, structured stdout, hand-curated ABIs, no Etherscan / Snowtrace / Basescan API key required, RedStone-signed solvency math handled internally, ParaSwap calldata validated client-side before broadcast.
43
+
44
+ ## Security and trust
45
+
46
+ **This tool moves real on-chain funds.** Read this before using.
47
+
48
+ - You manage your own private key. The tool reads it from `DELTAPRIME_PRIVATE_KEY` / `DEGENPRIME_PRIVATE_KEY` (or a file path you point at). It never writes the key anywhere.
49
+ - Every state-changing command **previews by default**. You must pass `--execute` to broadcast a transaction. Don't pass `--execute` until you understand what the preview is about to do.
50
+ - The tool's RedStone payload, ParaSwap executor allowlist, and facet ABIs are pinned to specific on-chain state at the dates noted in the source. If DeltaPrime or DegenPrime upgrade their diamond facets, the tool may need updating. Open an issue.
51
+ - The DeltaPrime team is not affiliated with this project. This is community-maintained tooling.
52
+
53
+ Full threat model and trust assumptions: [docs/security.md](docs/security.md).
54
+
55
+ ## Install
56
+
57
+ Requires Python 3.10+.
58
+
59
+ ```bash
60
+ pip install git+https://github.com/Mnemosyne-quest/primecli.git
61
+ ```
62
+
63
+ Or from a local clone (handy for development):
64
+
65
+ ```bash
66
+ git clone https://github.com/Mnemosyne-quest/primecli.git
67
+ cd primecli
68
+ pip install -e .
69
+ ```
70
+
71
+ A PyPI release (`pip install primecli`) will follow once the project has been smoke-tested in the wild for a bit. Track [#1](https://github.com/Mnemosyne-quest/primecli/issues/1) if you want a ping.
72
+
73
+ ## Quickstart
74
+
75
+ ```bash
76
+ # Set your key (or pass --key on each command for one-off use).
77
+ export DELTAPRIME_PRIVATE_KEY=0xabc...
78
+
79
+ # Read live pool state (no key needed for read-only commands).
80
+ deltaprime pool-info usdc
81
+
82
+ # Preview a deposit.
83
+ deltaprime deposit --pool usdc --amount 100
84
+
85
+ # Broadcast it.
86
+ deltaprime deposit --pool usdc --amount 100 --execute
87
+ ```
88
+
89
+ Same shape for DegenPrime on Base:
90
+
91
+ ```bash
92
+ # Same EVM key works on both chains; the DegenPrime env var falls back to DELTAPRIME_PRIVATE_KEY if unset.
93
+ export DEGENPRIME_PRIVATE_KEY=0xabc...
94
+
95
+ degenprime pool-info usdc
96
+ degenprime my-positions
97
+ ```
98
+
99
+ ## Commands
100
+
101
+ ### DeltaPrime (Avalanche C-chain)
102
+
103
+ **Lending core.** `pool-info`, `my-positions`, `deposit`, `withdraw`, `borrow`, `repay`, `fund`.
104
+
105
+ **Prime Account.** `create-prime-account` (alias `create-account`), `prime-summary`, `defi --json` (full positions dump in a DeBank-like shape), `withdraw-collateral`, `withdrawal-intents`, `execute-withdrawal`.
106
+
107
+ **Swaps.** `swap --from S --to S --amount N [--via yak|paraswap] [--slippage P]`, `swap-debt --from S --to S --amount N [--slippage P]`.
108
+
109
+ **GMX V2 LP** (async, keeper-executed). `gmx-positions`, `gmx-deposit --market M --amount N [--side long|short]`, `gmx-withdraw --market M --amount N`. Markets: `avax-usdc`, `btc-usdc`, `eth-usdc` (two-sided GM); `avax+`, `btc+`, `eth+` (single-sided GM+).
110
+
111
+ **TraderJoe V2 LB** (concentrated liquidity). `lb-positions`, `lb-add --pair P --amount-x N --amount-y N [--shape spot|curve|bidask] [--range R]`, `lb-remove --pair P`. Pairs: `avax-usdc`, `avax-usdc-20`, `btc-usdc`, `eth-avax`, `btc-avax`, `avax-btc`, `eurc-usdc`, `usdt-usdc`, `joe-avax`.
112
+
113
+ **sJOE staking.** `sjoe-position`, `sjoe-stake --amount N`, `sjoe-unstake --amount N`, `sjoe-claim`.
114
+
115
+ **PRIME leverage tiers.** `prime-tier`, `prime-needed --borrow X [--tier premium|basic]`, `prime-deposit --amount N`, `prime-activate [--amount N]`, `prime-deactivate [--withdraw]`, `prime-unstake --amount N`, `prime-repay --amount N`.
116
+
117
+ **Zaps.** `zap --market M --collateral P --collateral-amount N --borrow-amount N --deposit-amount N [--side long|short] [--swap]` — leveraged-long macro composing fund → borrow → optional swap → GMX GM deposit.
118
+
119
+ Every state-changing command previews by default; add `--execute` to broadcast.
120
+
121
+ Full per-command reference: [docs/deltaprime-reference.md](docs/deltaprime-reference.md). Per-capability build spec: [docs/deltaprime-capabilities.md](docs/deltaprime-capabilities.md).
122
+
123
+ ### DegenPrime (Base)
124
+
125
+ **Lending core.** `pool-info`, `my-positions`, `deposit`, `withdraw`, `borrow`, `repay`, `fund`.
126
+
127
+ **Degen Account.** `create-account`, `summary`, `withdraw-collateral`, `withdrawal-intents`, `execute-withdrawal`, `cancel-withdrawal`.
128
+
129
+ **Swaps.** `swap --from S --to S --amount N [--slippage P]` (ParaSwap v6), `swap-debt --from S --to S --amount N`.
130
+
131
+ **Aerodrome** (read-only in v1). `aerodrome-positions` — lists owned/staked Aerodrome NFT tokenIds. Composition and write paths are deferred to v2.
132
+
133
+ Pools (v1): `usdc`, `weth`, `cbbtc`, `aero`, `brett`, `kaito`, `cbdoge`, `cbxrp`. Collateral assets beyond the pools (memecoins, LSTs) work for `swap` / `swap-debt` via the on-chain TokenManager.
134
+
135
+ Full per-command reference: [docs/degenprime-reference.md](docs/degenprime-reference.md). Per-capability build spec: [docs/degenprime-capabilities.md](docs/degenprime-capabilities.md).
136
+
137
+ ## Configuration
138
+
139
+ | Env var | Default | Purpose |
140
+ |---|---|---|
141
+ | `DELTAPRIME_PRIVATE_KEY` | — | Your Avalanche signing key. Raw `0x...` hex. |
142
+ | `DELTAPRIME_KEY_FILE` | — | Path to a file containing the key. Use this if you don't want the key in process env. |
143
+ | `DELTAPRIME_RPC` | `https://api.avax.network/ext/bc/C/rpc` | Avalanche C-chain RPC. Override with a paid Alchemy / QuickNode / Infura endpoint for high-throughput use. |
144
+ | `DEGENPRIME_PRIVATE_KEY` | falls back to `DELTAPRIME_PRIVATE_KEY` | Your Base signing key. Same EVM key works on both chains. |
145
+ | `DEGENPRIME_KEY_FILE` | falls back to `DELTAPRIME_KEY_FILE` | Path to key file for Base. |
146
+ | `DEGENPRIME_RPC` | `https://base.publicnode.com` | Base RPC. |
147
+
148
+ The CLI also accepts a per-command `--key <0xhex>` override that takes precedence over all env vars — handy for one-off operations from a shell where you don't want to persist the key.
149
+
150
+ A copy-paste template is at [examples/env.example](examples/env.example).
151
+
152
+ ## What's covered
153
+
154
+ ### DeltaPrime
155
+
156
+ | Area | Status |
157
+ |---|---|
158
+ | Savings pools (USDC, WAVAX, WETH, BTC, USDT) | full read + write |
159
+ | Prime Account creation + funding | full |
160
+ | Borrow / repay / fund / withdraw-collateral | full |
161
+ | Solvency views (health ratio, total value, debt, solvent) | full (RedStone-gated reads) |
162
+ | Swap (YieldYak + ParaSwap) | full |
163
+ | Swap-debt (debt refinancing) | full |
164
+ | GMX V2 LP (GM + GM+, 6 markets) | full (async; account freezes until keeper callback) |
165
+ | TraderJoe V2 LB (9 whitelisted pairs) | full (max 80 bins/account) |
166
+ | sJOE staking | full |
167
+ | PRIME leverage tiers (BASIC / PREMIUM) | full |
168
+ | Leveraged-long zap macro | full (GM-terminal) |
169
+ | Wombat / GLP / Pangolin LP | not yet (specced in docs) |
170
+
171
+ ### DegenPrime
172
+
173
+ | Area | Status |
174
+ |---|---|
175
+ | Savings pools (8 v1 pools) | full read + write |
176
+ | Degen Account creation + funding | full |
177
+ | Borrow / repay / fund | full |
178
+ | Universal 24h delayed collateral withdrawal | full (3-step: create / list / execute, plus cancel) |
179
+ | Solvency views | full (RedStone-gated reads, with BaseOracle TWAP fallback for non-RedStone symbols) |
180
+ | Swap (ParaSwap v6) | full |
181
+ | Swap-debt | full (both legs must have RedStone feeds) |
182
+ | Aerodrome positions | read-only (tokenId listing) |
183
+ | Aerodrome write paths (add/remove/stake/claim) | deferred to v2 |
184
+ | $DgP staking | not deployed on-chain yet |
185
+
186
+ ## Documentation
187
+
188
+ - [DeltaPrime reference](docs/deltaprime-reference.md) — protocol model, addresses, facet map, RedStone integration, full command table, GMX/LB/PRIME flows.
189
+ - [DeltaPrime capabilities](docs/deltaprime-capabilities.md) — per-command build spec with exact function signatures, parameter encoding, approve targets, slippage/oracle/exec-fee requirements.
190
+ - [DegenPrime reference](docs/degenprime-reference.md) — Base-side equivalent.
191
+ - [DegenPrime capabilities](docs/degenprime-capabilities.md) — Base-side per-command build spec.
192
+ - [Security model](docs/security.md) — key handling, preview-by-default, ParaSwap executor allowlist, RedStone trust model, threat model.
193
+
194
+ ## Using from an AI agent
195
+
196
+ `primecli` is built for autonomous and semi-autonomous use. Three properties that matter for agents:
197
+
198
+ 1. **Preview by default.** Every state-changing command prints a structured preview and stops unless `--execute` is passed. An agent can run any command speculatively, parse the preview, decide whether to broadcast, and only then re-run with `--execute`.
199
+ 2. **Predictable, parseable stdout.** Read-only commands (`pool-info`, `my-positions`, `prime-summary`, `summary`, `withdrawal-intents`, `lb-positions`, `gmx-positions`, `aerodrome-positions`, `sjoe-position`, `prime-tier`, `defi --json`) emit either fixed-format tables or JSON. `defi --json` is a one-shot full positions snapshot.
200
+ 3. **Clean failure modes.** No stack traces on configuration errors — a missing key prints `deltaprime: No signing key found. Set DELTAPRIME_PRIVATE_KEY ...` to stderr and exits 1.
201
+
202
+ ### Drop-in patterns
203
+
204
+ **Shell-tooled agents (Claude Code, Cursor agent mode, Aider, OpenAI Codex CLI, custom bash-using agents).** Install with `pip install git+https://github.com/Mnemosyne-quest/primecli.git`, set the env var, and the agent can call `deltaprime` / `degenprime` as normal CLI commands. No further wiring.
205
+
206
+ **Claude Code skills.** Drop a `SKILL.md` into `.claude/skills/deltaprime/` (or `degenprime/`) that describes when to invoke the tool and which commands are read-only vs state-changing. A starter template is in [docs/agent-integration.md](docs/agent-integration.md).
207
+
208
+ **MCP server.** Not shipped in v0.1; if there's interest, file an issue and the wrapper is a few hundred lines of FastMCP.
209
+
210
+ ### Recommended agent guardrails
211
+
212
+ - Never store `--execute` in a model-controlled string. Treat `--execute` as a separate authorisation step the operator (or a deliberate policy) attaches.
213
+ - Cap daily spend with an external budget check (the tool has no built-in caps — that's the operator's responsibility).
214
+ - Always log the preview output before broadcasting. If the agent decided to swap 100 USDC and the preview says 100,000 USDC, the operator needs to see that.
215
+
216
+ ## Contributing
217
+
218
+ PRs welcome. Open an issue first if you're planning anything non-trivial (new facet support, new chain, write paths for Aerodrome, etc.) — pinning ABIs and verifying on-chain shapes takes a real probe pass, and it's worth aligning before doing the work.
219
+
220
+ ## License
221
+
222
+ MIT — see [LICENSE](LICENSE).
223
+
224
+ ## Acknowledgements
225
+
226
+ Built on the work of the [DeltaPrime team](https://deltaprime.io/) and the broader DeFi tooling ecosystem (web3.py, eth-account, RedStone, ParaSwap, YieldYak, TraderJoe / LFJ, GMX).
@@ -0,0 +1,194 @@
1
+ # primecli
2
+
3
+ > Command-line tools for the **DeltaPrime** (Avalanche) and **DegenPrime** (Base) lending and leverage protocols.
4
+
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
6
+ [![Python](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://www.python.org/)
7
+
8
+ `primecli` is two `pip`-installable console commands — `deltaprime` and `degenprime` — that drive the lending and leverage protocols by the DeltaPrimeLabs team on Avalanche C-chain and Base. It exposes the full surface most people use day to day: savings pools, per-user Prime / Degen Accounts, ParaSwap and YieldYak swaps, debt refinancing, GMX V2 LP, TraderJoe V2 LB, sJOE staking, PRIME leverage tiers, delayed collateral withdrawals, and a leveraged-long zap macro.
9
+
10
+ Built to be agent-friendly: preview by default, structured stdout, hand-curated ABIs, no Etherscan / Snowtrace / Basescan API key required, RedStone-signed solvency math handled internally, ParaSwap calldata validated client-side before broadcast.
11
+
12
+ ## Security and trust
13
+
14
+ **This tool moves real on-chain funds.** Read this before using.
15
+
16
+ - You manage your own private key. The tool reads it from `DELTAPRIME_PRIVATE_KEY` / `DEGENPRIME_PRIVATE_KEY` (or a file path you point at). It never writes the key anywhere.
17
+ - Every state-changing command **previews by default**. You must pass `--execute` to broadcast a transaction. Don't pass `--execute` until you understand what the preview is about to do.
18
+ - The tool's RedStone payload, ParaSwap executor allowlist, and facet ABIs are pinned to specific on-chain state at the dates noted in the source. If DeltaPrime or DegenPrime upgrade their diamond facets, the tool may need updating. Open an issue.
19
+ - The DeltaPrime team is not affiliated with this project. This is community-maintained tooling.
20
+
21
+ Full threat model and trust assumptions: [docs/security.md](docs/security.md).
22
+
23
+ ## Install
24
+
25
+ Requires Python 3.10+.
26
+
27
+ ```bash
28
+ pip install git+https://github.com/Mnemosyne-quest/primecli.git
29
+ ```
30
+
31
+ Or from a local clone (handy for development):
32
+
33
+ ```bash
34
+ git clone https://github.com/Mnemosyne-quest/primecli.git
35
+ cd primecli
36
+ pip install -e .
37
+ ```
38
+
39
+ A PyPI release (`pip install primecli`) will follow once the project has been smoke-tested in the wild for a bit. Track [#1](https://github.com/Mnemosyne-quest/primecli/issues/1) if you want a ping.
40
+
41
+ ## Quickstart
42
+
43
+ ```bash
44
+ # Set your key (or pass --key on each command for one-off use).
45
+ export DELTAPRIME_PRIVATE_KEY=0xabc...
46
+
47
+ # Read live pool state (no key needed for read-only commands).
48
+ deltaprime pool-info usdc
49
+
50
+ # Preview a deposit.
51
+ deltaprime deposit --pool usdc --amount 100
52
+
53
+ # Broadcast it.
54
+ deltaprime deposit --pool usdc --amount 100 --execute
55
+ ```
56
+
57
+ Same shape for DegenPrime on Base:
58
+
59
+ ```bash
60
+ # Same EVM key works on both chains; the DegenPrime env var falls back to DELTAPRIME_PRIVATE_KEY if unset.
61
+ export DEGENPRIME_PRIVATE_KEY=0xabc...
62
+
63
+ degenprime pool-info usdc
64
+ degenprime my-positions
65
+ ```
66
+
67
+ ## Commands
68
+
69
+ ### DeltaPrime (Avalanche C-chain)
70
+
71
+ **Lending core.** `pool-info`, `my-positions`, `deposit`, `withdraw`, `borrow`, `repay`, `fund`.
72
+
73
+ **Prime Account.** `create-prime-account` (alias `create-account`), `prime-summary`, `defi --json` (full positions dump in a DeBank-like shape), `withdraw-collateral`, `withdrawal-intents`, `execute-withdrawal`.
74
+
75
+ **Swaps.** `swap --from S --to S --amount N [--via yak|paraswap] [--slippage P]`, `swap-debt --from S --to S --amount N [--slippage P]`.
76
+
77
+ **GMX V2 LP** (async, keeper-executed). `gmx-positions`, `gmx-deposit --market M --amount N [--side long|short]`, `gmx-withdraw --market M --amount N`. Markets: `avax-usdc`, `btc-usdc`, `eth-usdc` (two-sided GM); `avax+`, `btc+`, `eth+` (single-sided GM+).
78
+
79
+ **TraderJoe V2 LB** (concentrated liquidity). `lb-positions`, `lb-add --pair P --amount-x N --amount-y N [--shape spot|curve|bidask] [--range R]`, `lb-remove --pair P`. Pairs: `avax-usdc`, `avax-usdc-20`, `btc-usdc`, `eth-avax`, `btc-avax`, `avax-btc`, `eurc-usdc`, `usdt-usdc`, `joe-avax`.
80
+
81
+ **sJOE staking.** `sjoe-position`, `sjoe-stake --amount N`, `sjoe-unstake --amount N`, `sjoe-claim`.
82
+
83
+ **PRIME leverage tiers.** `prime-tier`, `prime-needed --borrow X [--tier premium|basic]`, `prime-deposit --amount N`, `prime-activate [--amount N]`, `prime-deactivate [--withdraw]`, `prime-unstake --amount N`, `prime-repay --amount N`.
84
+
85
+ **Zaps.** `zap --market M --collateral P --collateral-amount N --borrow-amount N --deposit-amount N [--side long|short] [--swap]` — leveraged-long macro composing fund → borrow → optional swap → GMX GM deposit.
86
+
87
+ Every state-changing command previews by default; add `--execute` to broadcast.
88
+
89
+ Full per-command reference: [docs/deltaprime-reference.md](docs/deltaprime-reference.md). Per-capability build spec: [docs/deltaprime-capabilities.md](docs/deltaprime-capabilities.md).
90
+
91
+ ### DegenPrime (Base)
92
+
93
+ **Lending core.** `pool-info`, `my-positions`, `deposit`, `withdraw`, `borrow`, `repay`, `fund`.
94
+
95
+ **Degen Account.** `create-account`, `summary`, `withdraw-collateral`, `withdrawal-intents`, `execute-withdrawal`, `cancel-withdrawal`.
96
+
97
+ **Swaps.** `swap --from S --to S --amount N [--slippage P]` (ParaSwap v6), `swap-debt --from S --to S --amount N`.
98
+
99
+ **Aerodrome** (read-only in v1). `aerodrome-positions` — lists owned/staked Aerodrome NFT tokenIds. Composition and write paths are deferred to v2.
100
+
101
+ Pools (v1): `usdc`, `weth`, `cbbtc`, `aero`, `brett`, `kaito`, `cbdoge`, `cbxrp`. Collateral assets beyond the pools (memecoins, LSTs) work for `swap` / `swap-debt` via the on-chain TokenManager.
102
+
103
+ Full per-command reference: [docs/degenprime-reference.md](docs/degenprime-reference.md). Per-capability build spec: [docs/degenprime-capabilities.md](docs/degenprime-capabilities.md).
104
+
105
+ ## Configuration
106
+
107
+ | Env var | Default | Purpose |
108
+ |---|---|---|
109
+ | `DELTAPRIME_PRIVATE_KEY` | — | Your Avalanche signing key. Raw `0x...` hex. |
110
+ | `DELTAPRIME_KEY_FILE` | — | Path to a file containing the key. Use this if you don't want the key in process env. |
111
+ | `DELTAPRIME_RPC` | `https://api.avax.network/ext/bc/C/rpc` | Avalanche C-chain RPC. Override with a paid Alchemy / QuickNode / Infura endpoint for high-throughput use. |
112
+ | `DEGENPRIME_PRIVATE_KEY` | falls back to `DELTAPRIME_PRIVATE_KEY` | Your Base signing key. Same EVM key works on both chains. |
113
+ | `DEGENPRIME_KEY_FILE` | falls back to `DELTAPRIME_KEY_FILE` | Path to key file for Base. |
114
+ | `DEGENPRIME_RPC` | `https://base.publicnode.com` | Base RPC. |
115
+
116
+ The CLI also accepts a per-command `--key <0xhex>` override that takes precedence over all env vars — handy for one-off operations from a shell where you don't want to persist the key.
117
+
118
+ A copy-paste template is at [examples/env.example](examples/env.example).
119
+
120
+ ## What's covered
121
+
122
+ ### DeltaPrime
123
+
124
+ | Area | Status |
125
+ |---|---|
126
+ | Savings pools (USDC, WAVAX, WETH, BTC, USDT) | full read + write |
127
+ | Prime Account creation + funding | full |
128
+ | Borrow / repay / fund / withdraw-collateral | full |
129
+ | Solvency views (health ratio, total value, debt, solvent) | full (RedStone-gated reads) |
130
+ | Swap (YieldYak + ParaSwap) | full |
131
+ | Swap-debt (debt refinancing) | full |
132
+ | GMX V2 LP (GM + GM+, 6 markets) | full (async; account freezes until keeper callback) |
133
+ | TraderJoe V2 LB (9 whitelisted pairs) | full (max 80 bins/account) |
134
+ | sJOE staking | full |
135
+ | PRIME leverage tiers (BASIC / PREMIUM) | full |
136
+ | Leveraged-long zap macro | full (GM-terminal) |
137
+ | Wombat / GLP / Pangolin LP | not yet (specced in docs) |
138
+
139
+ ### DegenPrime
140
+
141
+ | Area | Status |
142
+ |---|---|
143
+ | Savings pools (8 v1 pools) | full read + write |
144
+ | Degen Account creation + funding | full |
145
+ | Borrow / repay / fund | full |
146
+ | Universal 24h delayed collateral withdrawal | full (3-step: create / list / execute, plus cancel) |
147
+ | Solvency views | full (RedStone-gated reads, with BaseOracle TWAP fallback for non-RedStone symbols) |
148
+ | Swap (ParaSwap v6) | full |
149
+ | Swap-debt | full (both legs must have RedStone feeds) |
150
+ | Aerodrome positions | read-only (tokenId listing) |
151
+ | Aerodrome write paths (add/remove/stake/claim) | deferred to v2 |
152
+ | $DgP staking | not deployed on-chain yet |
153
+
154
+ ## Documentation
155
+
156
+ - [DeltaPrime reference](docs/deltaprime-reference.md) — protocol model, addresses, facet map, RedStone integration, full command table, GMX/LB/PRIME flows.
157
+ - [DeltaPrime capabilities](docs/deltaprime-capabilities.md) — per-command build spec with exact function signatures, parameter encoding, approve targets, slippage/oracle/exec-fee requirements.
158
+ - [DegenPrime reference](docs/degenprime-reference.md) — Base-side equivalent.
159
+ - [DegenPrime capabilities](docs/degenprime-capabilities.md) — Base-side per-command build spec.
160
+ - [Security model](docs/security.md) — key handling, preview-by-default, ParaSwap executor allowlist, RedStone trust model, threat model.
161
+
162
+ ## Using from an AI agent
163
+
164
+ `primecli` is built for autonomous and semi-autonomous use. Three properties that matter for agents:
165
+
166
+ 1. **Preview by default.** Every state-changing command prints a structured preview and stops unless `--execute` is passed. An agent can run any command speculatively, parse the preview, decide whether to broadcast, and only then re-run with `--execute`.
167
+ 2. **Predictable, parseable stdout.** Read-only commands (`pool-info`, `my-positions`, `prime-summary`, `summary`, `withdrawal-intents`, `lb-positions`, `gmx-positions`, `aerodrome-positions`, `sjoe-position`, `prime-tier`, `defi --json`) emit either fixed-format tables or JSON. `defi --json` is a one-shot full positions snapshot.
168
+ 3. **Clean failure modes.** No stack traces on configuration errors — a missing key prints `deltaprime: No signing key found. Set DELTAPRIME_PRIVATE_KEY ...` to stderr and exits 1.
169
+
170
+ ### Drop-in patterns
171
+
172
+ **Shell-tooled agents (Claude Code, Cursor agent mode, Aider, OpenAI Codex CLI, custom bash-using agents).** Install with `pip install git+https://github.com/Mnemosyne-quest/primecli.git`, set the env var, and the agent can call `deltaprime` / `degenprime` as normal CLI commands. No further wiring.
173
+
174
+ **Claude Code skills.** Drop a `SKILL.md` into `.claude/skills/deltaprime/` (or `degenprime/`) that describes when to invoke the tool and which commands are read-only vs state-changing. A starter template is in [docs/agent-integration.md](docs/agent-integration.md).
175
+
176
+ **MCP server.** Not shipped in v0.1; if there's interest, file an issue and the wrapper is a few hundred lines of FastMCP.
177
+
178
+ ### Recommended agent guardrails
179
+
180
+ - Never store `--execute` in a model-controlled string. Treat `--execute` as a separate authorisation step the operator (or a deliberate policy) attaches.
181
+ - Cap daily spend with an external budget check (the tool has no built-in caps — that's the operator's responsibility).
182
+ - Always log the preview output before broadcasting. If the agent decided to swap 100 USDC and the preview says 100,000 USDC, the operator needs to see that.
183
+
184
+ ## Contributing
185
+
186
+ PRs welcome. Open an issue first if you're planning anything non-trivial (new facet support, new chain, write paths for Aerodrome, etc.) — pinning ABIs and verifying on-chain shapes takes a real probe pass, and it's worth aligning before doing the work.
187
+
188
+ ## License
189
+
190
+ MIT — see [LICENSE](LICENSE).
191
+
192
+ ## Acknowledgements
193
+
194
+ Built on the work of the [DeltaPrime team](https://deltaprime.io/) and the broader DeFi tooling ecosystem (web3.py, eth-account, RedStone, ParaSwap, YieldYak, TraderJoe / LFJ, GMX).
@@ -0,0 +1,3 @@
1
+ """primecli - command-line tools for DeltaPrime (Avalanche) and DegenPrime (Base)."""
2
+
3
+ __version__ = "0.1.0"