TREPA_MASTER_PRIVATE_KEY is set, the SDK runs a balance manager next to trepa.bots.run. It keeps each bot’s stake token (USDC) and SOL near fixed targets: the master wallet sends top-ups when balances are low and receives sweeps when they are high.
This flow is built for Swarms: one treasury keeps many bot wallets topped up. You can still use it with a single bot if you want that separation.
Turning it on
Add a base58 Solana private key to the same environment as your bot credentials. Use the same encoding style as each bot’sTREPA_PRIVATE_KEY.
privateKey values in your credentials list. The master pays fees and signs transfers to bot wallets; bot keys still sign predictions and sign sweeps back to the master.
If TREPA_MASTER_PRIVATE_KEY is unset or empty, nothing runs in the background. You fund each bot yourself.
What happens each cycle
Roughly every 60 seconds the SDK:- Reads each bot’s stake-token balance for the pool and SOL balance.
- Fills when balances fall below thresholds.
- Sweeps when balances sit above targets.
Defaults
Unless you override them in code:
SOL targets are never below the rent-exempt minimum; very small numbers are raised to that floor.
The master keeps about 0.05 SOL in reserve for its own fees. If a cycle needs more SOL than that budget allows, a bot’s top-up may be skipped (watch logs).
Override in code
You can tune targets without editing.env:
Pass balanceManager on new Trepa(...) or on the options you pass to bots.run:
Next: SDK reference.