Skip to main content

Command-line tool for the DeltaPrime (Avalanche) and DegenPrime (Base) lending and leverage protocols.

Project description

primecli

Command-line tools for the DeltaPrime (Avalanche) and DegenPrime (Base) lending and leverage protocols.

PyPI Python License: MIT

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.

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.

Security and trust

This tool moves real on-chain funds. Read this before using.

  • 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.
  • 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.
  • 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.
  • The DeltaPrime team is not affiliated with this project. This is community-maintained tooling.

Full threat model and trust assumptions: docs/security.md.

Install

Requires Python 3.10+.

pip install primecli

From the latest main (ahead of the most recent release):

pip install git+https://github.com/Mnemosyne-quest/primecli.git

Or from a local clone (handy for development):

git clone https://github.com/Mnemosyne-quest/primecli.git
cd primecli
pip install -e .

Quickstart

# Set your key (or pass --key on each command for one-off use).
export DELTAPRIME_PRIVATE_KEY=0xabc...

# Read live pool state (no key needed for read-only commands).
deltaprime pool-info usdc

# Preview a deposit.
deltaprime deposit --pool usdc --amount 100

# Broadcast it.
deltaprime deposit --pool usdc --amount 100 --execute

Same shape for DegenPrime on Base:

# Same EVM key works on both chains; the DegenPrime env var falls back to DELTAPRIME_PRIVATE_KEY if unset.
export DEGENPRIME_PRIVATE_KEY=0xabc...

degenprime pool-info usdc
degenprime my-positions

Commands

DeltaPrime (Avalanche C-chain)

Lending core. pool-info, my-positions, deposit, withdraw, borrow, repay, fund.

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.

Swaps. swap --from S --to S --amount N [--via yak|paraswap] [--slippage P], swap-debt --from S --to S --amount N [--slippage P].

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+).

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.

sJOE staking. sjoe-position, sjoe-stake --amount N, sjoe-unstake --amount N, sjoe-claim.

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.

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.

Every state-changing command previews by default; add --execute to broadcast.

Full per-command reference: docs/deltaprime-reference.md. Per-capability build spec: docs/deltaprime-capabilities.md.

DegenPrime (Base)

Lending core. pool-info, my-positions, deposit, withdraw, borrow, repay, fund.

Degen Account. create-account, summary, withdraw-collateral, withdrawal-intents, execute-withdrawal, cancel-withdrawal.

Swaps. swap --from S --to S --amount N [--slippage P] (ParaSwap v6), swap-debt --from S --to S --amount N.

Aerodrome (read-only in v1). aerodrome-positions — lists owned/staked Aerodrome NFT tokenIds. Composition and write paths are deferred to v2.

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.

Full per-command reference: docs/degenprime-reference.md. Per-capability build spec: docs/degenprime-capabilities.md.

Configuration

Env var Default Purpose
DELTAPRIME_PRIVATE_KEY Your Avalanche signing key. Raw 0x... hex.
DELTAPRIME_KEY_FILE Path to a file containing the key. Use this if you don't want the key in process env.
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.
DEGENPRIME_PRIVATE_KEY falls back to DELTAPRIME_PRIVATE_KEY Your Base signing key. Same EVM key works on both chains.
DEGENPRIME_KEY_FILE falls back to DELTAPRIME_KEY_FILE Path to key file for Base.
DEGENPRIME_RPC https://base.publicnode.com Base RPC.

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.

A copy-paste template is at examples/env.example.

What's covered

DeltaPrime

Area Status
Savings pools (USDC, WAVAX, WETH, BTC, USDT) full read + write
Prime Account creation + funding full
Borrow / repay / fund / withdraw-collateral full
Solvency views (health ratio, total value, debt, solvent) full (RedStone-gated reads)
Swap (YieldYak + ParaSwap) full
Swap-debt (debt refinancing) full
GMX V2 LP (GM + GM+, 6 markets) full (async; account freezes until keeper callback)
TraderJoe V2 LB (9 whitelisted pairs) full (max 80 bins/account)
sJOE staking full
PRIME leverage tiers (BASIC / PREMIUM) full
Leveraged-long zap macro full (GM-terminal)
Wombat / GLP / Pangolin LP not yet (specced in docs)

DegenPrime

Area Status
Savings pools (8 v1 pools) full read + write
Degen Account creation + funding full
Borrow / repay / fund full
Universal 24h delayed collateral withdrawal full (3-step: create / list / execute, plus cancel)
Solvency views full (RedStone-gated reads, with BaseOracle TWAP fallback for non-RedStone symbols)
Swap (ParaSwap v6) full
Swap-debt full (both legs must have RedStone feeds)
Aerodrome positions read-only (tokenId listing)
Aerodrome write paths (add/remove/stake/claim) deferred to v2
$DgP staking not deployed on-chain yet

Documentation

  • DeltaPrime reference — protocol model, addresses, facet map, RedStone integration, full command table, GMX/LB/PRIME flows.
  • DeltaPrime capabilities — per-command build spec with exact function signatures, parameter encoding, approve targets, slippage/oracle/exec-fee requirements.
  • DegenPrime reference — Base-side equivalent.
  • DegenPrime capabilities — Base-side per-command build spec.
  • Security model — key handling, preview-by-default, ParaSwap executor allowlist, RedStone trust model, threat model.

Using from an AI agent

primecli is built for autonomous and semi-autonomous use. Three properties that matter for agents:

  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.
  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.
  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.

Drop-in patterns

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.

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.

MCP server. Not shipped in v0.1; if there's interest, file an issue and the wrapper is a few hundred lines of FastMCP.

Recommended agent guardrails

  • Never store --execute in a model-controlled string. Treat --execute as a separate authorisation step the operator (or a deliberate policy) attaches.
  • Cap daily spend with an external budget check (the tool has no built-in caps — that's the operator's responsibility).
  • 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.

Contributing

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.

License

MIT — see LICENSE.

Acknowledgements

Built on the work of the DeltaPrime team and the broader DeFi tooling ecosystem (web3.py, eth-account, RedStone, ParaSwap, YieldYak, TraderJoe / LFJ, GMX).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

primecli-0.1.2.tar.gz (93.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

primecli-0.1.2-py3-none-any.whl (88.4 kB view details)

Uploaded Python 3

File details

Details for the file primecli-0.1.2.tar.gz.

File metadata

  • Download URL: primecli-0.1.2.tar.gz
  • Upload date:
  • Size: 93.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for primecli-0.1.2.tar.gz
Algorithm Hash digest
SHA256 484e73ab9d461f4c4b984cd88ecea5e87ae498a1e673a31433a77140646fab1c
MD5 71b8489ab1309576a4ef2402dc246083
BLAKE2b-256 746a65e3b212a9437eb7ae1dacfecfa29034b98e22cac48b6ca487deb78e9a35

See more details on using hashes here.

Provenance

The following attestation bundles were made for primecli-0.1.2.tar.gz:

Publisher: release.yml on Mnemosyne-quest/primecli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file primecli-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: primecli-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 88.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for primecli-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 93f7d22c9fcd9bf0f473302aa3d51a8d80972aea814c4bf98a03bd50ba8d29fb
MD5 3492612b67610978a9a7a251af12ad1d
BLAKE2b-256 b2ba843a7fa5c0eabe3886b1a9850c2994b9066a2e90abf129da81576718b6f3

See more details on using hashes here.

Provenance

The following attestation bundles were made for primecli-0.1.2-py3-none-any.whl:

Publisher: release.yml on Mnemosyne-quest/primecli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page