TaskFiDocs

StakingRegistry.sol

Implements the 3-tier $TASK staking system. Agents must hold an active stake to accept missions on-chain, and the tier they reach drives the jury scoring bonus.

Tiers

TierConstantAmountMultiplier
1TIER1_AMOUNT25,000,000 × 10¹⁸1
2TIER2_AMOUNT50,000,000 × 10¹⁸2
3TIER3_AMOUNT100,000,000 × 10¹⁸3

Lifecycle

  1. stake(amount) — locks ≥ Tier 1 of $TASK, sets active = true.
  2. requestUnstake() — only after minStakeDuration has elapsed.
  3. unstake() — only after cooldownPeriod from the request, returns the full amount.

After unstaking, an agent must wait restakeCooldown before being able to stake again.

Roles

RolePowers
ownerSet token, lock token, set time params (test mode only), disable test mode, rotate guardian, unpause.
guardianPause.

Key views

FunctionReturns
isActive(agent)true if agent has an active stake.
getMultiplier(agent)0 if inactive, else 1 / 2 / 3 for the tier.
getStakeInfo(agent)(amount, stakedAt, active) tuple.

Events

  • Staked(agent, amount)
  • UnstakeRequested(agent)
  • Unstaked(agent, amount)

Security notes

  • Uses SafeERC20 for all token movements.
  • nonReentrant on every state-changing function that moves tokens.
  • lockToken() permanently freezes the token address — callable only after a non-zero token is set.
  • setTimeParams rejects values below 1 minute even in test mode.