Skip to content

dinero-protocol/pirexeth-ops-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PirexEth Ops CLI

A CLI tool for PirexEth protocol operations using CubeSigner and Pier Two API.

Available Commands

  • harvest - Harvest ETH rewards from the RewardRecipient contract
  • unstake - Exit validators via Pier Two API

Setup

  1. Install dependencies:

    pnpm install
  2. Create a .env file from the example:

    cp .env.example .env
  3. Configure your .env file (see sections below for specific operations)

  4. Place your CubeSigner session file (e.g., signer-session.json) in the project root (for harvest operations).

Usage


Harvest Command

Harvest ETH rewards from the RewardRecipient contract.

Environment Variables (Harvest)

  • RPC_URL: Your Ethereum RPC endpoint
  • NETWORK: mainnet or holesky
  • PIREX_ETH_ADDRESS: The PirexEth contract address
  • HARVEST_KEEPER_ADDRESS: The CubeSigner key address
  • CUBIST_SESSION_FILE: Path to CubeSigner session file (default: signer-session.json)
  • END_BLOCK: Block number for harvest (required)

Harvest Commands

# Simulate first, then prompt to broadcast
pnpm run harvest

# Simulate only
pnpm run harvest:simulate

# Broadcast directly (skip confirmation)
pnpm run harvest:broadcast

What it does

  1. Loads the CubeSigner session and refreshes it
  2. Connects to the specified network using the RPC URL
  3. Fetches the RewardRecipient address from PirexEth contract
  4. Gets the ETH balance of the RewardRecipient at the specified END_BLOCK
  5. Signs the transaction using CubeSigner
  6. Calls harvest(amount, endBlock)
  7. Waits for confirmation and prints the state to update in AWS Secrets Manager

Validator Unstake (Exit) Command

Exit validators via Pier Two API.

Environment Variables (Unstake)

  • PIER2_API_KEY: Your Pier Two API key (required)
  • PIER2_BASE_URL: Optional, defaults to https://gw-1.api.piertwo.io
  • VALIDATOR_PUBKEYS_FILE: File with pubkeys, one per line (default: validator-pubkeys.txt)

Unstake Commands

# Generate exit messages, then prompt to broadcast
pnpm run unstake:generate

# Generate and broadcast in one request
pnpm run unstake:bulk

# Show validator queue stats
pnpm run unstake:queue

# Pass pubkeys directly
pnpm run unstake:generate 0x1234... 0x5678...

Providing Validator Pubkeys

  1. Command line: pnpm run unstake:generate 0x1234... 0x5678...
  2. File: Create validator-pubkeys.txt with one pubkey per line
  3. Custom file: Set VALIDATOR_PUBKEYS_FILE in .env

Manual State Update (After Harvest)

After a successful harvest, update AWS Secrets Manager with:

  • lastHarvestCheckpointBlock: The block used for harvest
  • lastRewards: Reset to "0"
  • lastBlockRewards: Reset to "0"
  • lastMevRewards: Reset to "0"

Security Notes

  • Never commit your .env file with real credentials
  • Never commit your signer-session.json file
  • Never commit validator-pubkeys.txt with real pubkeys
  • The CubeSigner key should only have permissions to call the harvest function

About

Operations CLI for Dinero's PirexEth LST protocol

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors