IRONQ

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:

ParamTypeDescription
stake_amountu64Tokens to stake (must be >= min_worker_stake)

Effects:

  • Creates Worker PDA at ["worker", queue, wallet]
  • Transfers stake_amount from worker's token account to vault
  • Increments total_active_workers on queue

increase_stake

Adds more tokens to an existing worker's stake.

Parameters:

ParamTypeDescription
additional_amountu64Tokens to add (must be > 0)

Effects:

  • Transfers tokens from worker's token account to vault
  • Increases stake_amount on Worker account

deregister_worker

Returns the full stake and closes the Worker account.

Requirements:

  • active_jobs must be 0 (all held jobs must complete or expire first)
  • Worker must be the signer

Effects:

  • Transfers full stake_amount from vault to worker's token account
  • Decrements total_active_workers on queue
  • Closes Worker account (rent returned to worker)