You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Add unstake:generate, unstake:bulk, unstake:queue commands
- Support pubkeys from CLI args or file
- Confirmation prompts before broadcasting
- Update README with all commands and env vars
A CLI tool for PirexEth operations (harvest, dissolve-validator, etc.) using CubeSigner for transaction signing.
3
+
A CLI tool for PirexEth protocol operations using CubeSigner and Pier Two API.
4
4
5
5
## Available Commands
6
6
7
7
-**harvest** - Harvest ETH rewards from the RewardRecipient contract
8
+
-**unstake** - Exit validators via Pier Two API
8
9
9
10
## Setup
10
11
@@ -18,61 +19,99 @@ A CLI tool for PirexEth operations (harvest, dissolve-validator, etc.) using Cub
18
19
cp .env.example .env
19
20
```
20
21
21
-
3. Configure your `.env` file:
22
-
-`RPC_URL`: Your Ethereum RPC endpoint (Alchemy, Infura, etc.)
23
-
-`NETWORK`: `mainnet` or `holesky`
24
-
-`PIREX_ETH_ADDRESS`: The PirexEth contract address
25
-
-`HARVEST_KEEPER_ADDRESS`: The address of the CubeSigner key used for harvesting
26
-
-`CUBIST_SESSION_FILE`: Path to the CubeSigner session JSON file (default: `signer-session.json`)
22
+
3. Configure your `.env` file (see sections below for specific operations)
27
23
28
-
4. Place your CubeSigner session file (e.g., `signer-session.json`) in the project root.
24
+
4. Place your CubeSigner session file (e.g., `signer-session.json`) in the project root (for harvest operations).
29
25
30
26
## Usage
31
27
32
-
### Harvest
28
+
---
29
+
30
+
## Harvest Command
31
+
32
+
Harvest ETH rewards from the RewardRecipient contract.
33
+
34
+
### Environment Variables (Harvest)
35
+
36
+
-`RPC_URL`: Your Ethereum RPC endpoint
37
+
-`NETWORK`: `mainnet` or `holesky`
38
+
-`PIREX_ETH_ADDRESS`: The PirexEth contract address
39
+
-`HARVEST_KEEPER_ADDRESS`: The CubeSigner key address
40
+
-`CUBIST_SESSION_FILE`: Path to CubeSigner session file (default: `signer-session.json`)
41
+
-`END_BLOCK`: Block number for harvest (required)
42
+
43
+
### Harvest Commands
33
44
34
-
Run the harvest command (simulates first, then prompts to broadcast):
35
45
```bash
46
+
# Simulate first, then prompt to broadcast
36
47
pnpm run harvest
37
-
```
38
48
39
-
Or simulate only:
40
-
```bash
49
+
# Simulate only
41
50
pnpm run harvest:simulate
42
-
```
43
51
44
-
Or broadcast directly (skip confirmation):
45
-
```bash
52
+
# Broadcast directly (skip confirmation)
46
53
pnpm run harvest:broadcast
47
54
```
48
55
49
-
## Harvest Command
50
-
51
56
### What it does
52
57
53
58
1. Loads the CubeSigner session and refreshes it
54
59
2. Connects to the specified network using the RPC URL
55
60
3. Fetches the RewardRecipient address from PirexEth contract
56
-
4. Gets the entire ETH balance of the RewardRecipient
61
+
4. Gets the ETH balance of the RewardRecipient at the specified END_BLOCK
57
62
5. Signs the transaction using CubeSigner
58
-
6. Calls `harvest(amount, endBlock)` with:
59
-
-`amount`: The entire ETH balance
60
-
-`endBlock`: The current finalized block number
61
-
7. Waits for transaction confirmation and reports success/failure
62
-
8.**Prints the state values you need to manually update in AWS Secrets Manager**
63
+
6. Calls `harvest(amount, endBlock)`
64
+
7. Waits for confirmation and prints the state to update in AWS Secrets Manager
65
+
66
+
---
67
+
68
+
## Validator Unstake (Exit) Command
69
+
70
+
Exit validators via Pier Two API.
71
+
72
+
### Environment Variables (Unstake)
73
+
74
+
-`PIER2_API_KEY`: Your Pier Two API key (required)
75
+
-`PIER2_BASE_URL`: Optional, defaults to `https://gw-1.api.piertwo.io`
76
+
-`VALIDATOR_PUBKEYS_FILE`: File with pubkeys, one per line (default: `validator-pubkeys.txt`)
77
+
78
+
### Unstake Commands
79
+
80
+
```bash
81
+
# Generate exit messages, then prompt to broadcast
82
+
pnpm run unstake:generate
83
+
84
+
# Generate and broadcast in one request
85
+
pnpm run unstake:bulk
86
+
87
+
# Show validator queue stats
88
+
pnpm run unstake:queue
89
+
90
+
# Pass pubkeys directly
91
+
pnpm run unstake:generate 0x1234... 0x5678...
92
+
```
93
+
94
+
### Providing Validator Pubkeys
95
+
96
+
1.**Command line**: `pnpm run unstake:generate 0x1234... 0x5678...`
97
+
2.**File**: Create `validator-pubkeys.txt` with one pubkey per line
98
+
3.**Custom file**: Set `VALIDATOR_PUBKEYS_FILE` in `.env`
99
+
100
+
---
63
101
64
-
## Manual State Update
102
+
## Manual State Update (After Harvest)
65
103
66
-
After a successful harvest, the script will print the JSON state you need to update in AWS Secrets Manager (HARVEST_KEEPER_STATE_SECRET_ID). This includes:
67
-
-`lastHarvestCheckpointBlock`: The finalized block used for harvest
104
+
After a successful harvest, update AWS Secrets Manager with:
105
+
-`lastHarvestCheckpointBlock`: The block used for harvest
68
106
-`lastRewards`: Reset to "0"
69
107
-`lastBlockRewards`: Reset to "0"
70
108
-`lastMevRewards`: Reset to "0"
71
109
72
-
It will also print the refreshed CubeSigner session if you need to update it in Secrets Manager.
110
+
---
73
111
74
112
## Security Notes
75
113
76
114
- Never commit your `.env` file with real credentials
77
115
- Never commit your `signer-session.json` file
116
+
- Never commit `validator-pubkeys.txt` with real pubkeys
78
117
- The CubeSigner key should only have permissions to call the `harvest` function
0 commit comments