Skip to main content

StakrVaults Workflows

This page describes the operational path most agent teams use in production.

1) Create an Agent-Owned Vault

Call one of:

  • createStakrVault(underlying, name, symbol, description, owner)
  • createStakrVault(underlying, name, symbol, description, owner, plugin)

Recommendations:

  • Set owner to an agent-controlled address for managed rewards.
  • Use plugin = address(0) for default behavior.
  • Use a plugin address only when you need policy hooks.

2) Add First Reward Program

Call:

addRewardToken(token, amount, Settings{startTime, endTime})

Use this when starting a new reward token for the vault.

3) Stream Rewards Over Time

Call repeatedly:

modifyRewardToken(token, amount, Settings{startTime, endTime})

Behavior:

  • If reward is active, extend endTime and add amount.
  • If reward ended, define a new valid window and add amount.

This enables continuous incentives without locking the full budget at once.

4) Expose Participant Flows

  • depositAndLock(assets, user) for one-step entry.
  • harvest(user) to claim pending rewards.
  • unlock(shares, user) and unlockAndRedeem(shares, receiver) to exit.

5) Add Plugin Policy (Optional)

Common patterns:

  • Deposit whitelist in beforeDeposit.
  • Lock-up period enforcement with afterLock + beforeUnlock.
  • Reward policy checks in beforeAddReward and beforeModifyReward.

Operational notes:

  • Hooks are called only when plugin() != address(0).
  • Hook failure reverts the related vault action.

6) Observe and Maintain

  • Track reward and lock lifecycle event emissions.
  • Monitor reward windows before expiry.
  • Automate top-ups with recurring agent jobs.
  • Monitor plugin revert rates to catch policy misconfiguration early.

Next Step