Worker Operations
Register, stake, and deregister workers
register_worker
Stakes tokens and creates a Worker PDA. The worker's max_concurrent_jobs is snapshotted from the queue config at registration time.
Parameters:
| Param | Type | Description |
|---|---|---|
stake_amount | u64 | Tokens to stake (must be >= min_worker_stake) |
Effects:
- Creates
WorkerPDA at["worker", queue, wallet] - Transfers
stake_amountfrom worker's token account to vault - Increments
total_active_workerson queue
increase_stake
Adds more tokens to an existing worker's stake.
Parameters:
| Param | Type | Description |
|---|---|---|
additional_amount | u64 | Tokens to add (must be > 0) |
Effects:
- Transfers tokens from worker's token account to vault
- Increases
stake_amounton Worker account
deregister_worker
Returns the full stake and closes the Worker account.
Requirements:
active_jobsmust be 0 (all held jobs must complete or expire first)- Worker must be the signer
Effects:
- Transfers full
stake_amountfrom vault to worker's token account - Decrements
total_active_workerson queue - Closes Worker account (rent returned to worker)