A CLI tool for PirexEth protocol operations using CubeSigner and Pier Two API.
- harvest - Harvest ETH rewards from the RewardRecipient contract
- unstake - Exit validators via Pier Two API
-
Install dependencies:
pnpm install
-
Create a
.envfile from the example:cp .env.example .env
-
Configure your
.envfile (see sections below for specific operations) -
Place your CubeSigner session file (e.g.,
signer-session.json) in the project root (for harvest operations).
Harvest ETH rewards from the RewardRecipient contract.
RPC_URL: Your Ethereum RPC endpointNETWORK:mainnetorholeskyPIREX_ETH_ADDRESS: The PirexEth contract addressHARVEST_KEEPER_ADDRESS: The CubeSigner key addressCUBIST_SESSION_FILE: Path to CubeSigner session file (default:signer-session.json)END_BLOCK: Block number for harvest (required)
# Simulate first, then prompt to broadcast
pnpm run harvest
# Simulate only
pnpm run harvest:simulate
# Broadcast directly (skip confirmation)
pnpm run harvest:broadcast- Loads the CubeSigner session and refreshes it
- Connects to the specified network using the RPC URL
- Fetches the RewardRecipient address from PirexEth contract
- Gets the ETH balance of the RewardRecipient at the specified END_BLOCK
- Signs the transaction using CubeSigner
- Calls
harvest(amount, endBlock) - Waits for confirmation and prints the state to update in AWS Secrets Manager
Exit validators via Pier Two API.
PIER2_API_KEY: Your Pier Two API key (required)PIER2_BASE_URL: Optional, defaults tohttps://gw-1.api.piertwo.ioVALIDATOR_PUBKEYS_FILE: File with pubkeys, one per line (default:validator-pubkeys.txt)
# 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...- Command line:
pnpm run unstake:generate 0x1234... 0x5678... - File: Create
validator-pubkeys.txtwith one pubkey per line - Custom file: Set
VALIDATOR_PUBKEYS_FILEin.env
After a successful harvest, update AWS Secrets Manager with:
lastHarvestCheckpointBlock: The block used for harvestlastRewards: Reset to "0"lastBlockRewards: Reset to "0"lastMevRewards: Reset to "0"
- Never commit your
.envfile with real credentials - Never commit your
signer-session.jsonfile - Never commit
validator-pubkeys.txtwith real pubkeys - The CubeSigner key should only have permissions to call the
harvestfunction