Skills stakr-protocol
Interact with the Stakr protocol — ERC-4626 vaults with multi-reward staking. Use when the user or an agent needs to work with Stakr vaults, add or modify rewards (addRewardToken, addRewards, modifyRewardToken, modifyReward), create or manage an "agent vault" or "own vault", fund incentive programs, configure reward schedules, or integrate Stakr in scripts or tooling. Prefer this skill whenever Stakr, StakrVault, rewards, staking, or vault ownership is mentioned.
git clone https://github.com/BankrBot/skills
T=$(mktemp -d) && git clone --depth=1 https://github.com/BankrBot/skills "$T" && mkdir -p ~/.claude/skills && cp -r "$T/stakr" ~/.claude/skills/bankrbot-skills-stakr-protocol && rm -rf "$T"
stakr/SKILL.mdStakr Protocol — Agent Overview
This skill gives agents the context to interact with the Stakr protocol: ERC-4626 tokenized vaults with multi-reward staking for any ERC-20 token. Use it when building integrations, scripts, or tooling that create vaults, add rewards, modify reward schedules, or let an agent operate its "own" vault.
Protocol at a Glance
- StakrVault: Single-asset ERC-4626 vault. Users deposit underlying, get shares; they can lock shares to earn multiple reward tokens over configurable windows.
- StakrVaultFactory: Deploys vaults and holds protocol fee configuration. One factory per chain.
- Rewards: Up to 25 reward tokens per vault. Each reward has
,startTime
, and totalendTime
. Distribution is linear over the window; logic is Masterchef-style (accumulated rewards per share).amount - Ownership: A vault can have an
(address that can add/modify rewards) orowner
for permissionless reward addition.address(0)
When an agent is said to have its "own vault", it means: the agent (or a controlled EOA/contract) is the vault owner, so it can call
addRewardToken and modifyRewardToken to fund and adjust rewards without third-party permission.
Emphasis: Adding and Modifying Rewards (Agent-Owned Vaults)
Agents that operate their own vault will use these two functions most:
1. addRewardToken(token, amount, settings)
addRewardToken(token, amount, settings)Purpose: Start a new reward program for a given ERC-20 token.
- Caller: Vault owner (or anyone if
).owner() == address(0) - Parameters:
: ERC-20 reward token address. Cannot be the vault’s share tokentoken
.address(vault)
: Total amount ofamount
to distribute. Tokens are pulled fromtoken
; protocol may take a fee (see factorymsg.sender
).feeOnAddReward
:settings
. Distribution is linear fromSettings{ startTime, endTime }
tostartTime
; both must be in the future andendTime
.startTime < endTime
- Effects: Registers the reward, pulls tokens (minus fee) into the vault, and emits
. Rewards cannot be withdrawn once added; they can only be modified (extended or topped up) viaAddReward
.modifyRewardToken - Limits: No duplicate reward token; vault cannot have more than 25 active rewards.
Use this when the agent wants to create a new reward (e.g. launch an incentive program on its vault).
2. modifyRewardToken(token, amount, settings)
modifyRewardToken(token, amount, settings)Purpose: Add more amount and/or extend (or reschedule) an existing reward.
- Caller: Same as
(vault owner or permissionless if owner is zero).addRewardToken - Parameters:
: Address of an already active reward token.token
: Additional amount ofamount
to add. Pulled fromtoken
; fee may apply. Cannot reduce existing amount.msg.sender
:settings
. Rules:Settings{ startTime, endTime }- If the reward has not yet ended (
): you can only extendcurrentTime <= reward.settings.endTime
(and add more amount).endTime
cannot be changed.startTime - If the reward has ended (
): you can set a new window (currentTime > reward.settings.endTime
,startTime
) and add amount;endTime
is reset.accRewardsPerShare
- If the reward has not yet ended (
- Effects: Increases
(and total amount) byremainingAmount
, updatesamount
(and possiblyendTime
if reward had ended), pulls tokens fromstartTime
, and emitsmsg.sender
.ModifyReward
Use this when the agent wants to top up an existing reward or extend the distribution period (or reschedule after it has ended).
Summary for agents:
- New reward →
.addRewardToken(token, amount, settings) - More reward or longer duration (or new window after end) →
.modifyRewardToken(token, amount, settings) - Ensure the vault has been created via the factory and the agent (or its controlled address) is the vault owner to call these.
Executing Transactions via Bankr
To submit any Stakr call (vault creation,
addRewardToken, modifyRewardToken), first encode calldata, then submit the transaction via the Bankr wallet API.
Use a natural-language Bankr agent prompt:
bankr agent prompt "Call addRewardToken on vault 0x... with token 0x... amount 1000 USDC starting tomorrow for 7 days"
Or submit raw encoded calldata directly:
bankr wallet submit --to <vault-address> --data <encoded-calldata> --chain base
For calldata encoding help, see the vault API reference.
3. Streaming rewards (continuous incentives)
Agents can stream rewards over time instead of funding one large window up front:
- Pattern: Call
once to start a reward (short amount if desired). Then calladdRewardToken
repeatedly to add more amount and extendmodifyRewardToken
. Each call tops up the reward and pushes the end of the distribution window forward.endTime - Why: This avoids locking a huge amount for a long period. The agent (or a script/cron) can fund the vault in chunks and extend the window as needed, effectively creating a continuous reward stream.
- Rules: While the reward is active (
),currentTime <= reward.settings.endTime
only allows extendingmodifyRewardToken
and addingendTime
;amount
cannot be changed. After the reward has ended, the agent can set a brand‑new window withstartTime
(newmodifyRewardToken
andstartTime
) and keep streaming.endTime
Use streaming when the agent wants to fund incentives on an ongoing basis (e.g. weekly top‑ups, or extending the program as budget allows) rather than committing to a single long window.
Creating an Agent-Owned Vault
- Get the StakrVaultFactory address for the chain.
- On Base mainnet, the factory is deployed at
(view on BaseScan).0x7Ef55108fa37472296DA59D2287FdA92cd21A0d0 - For an example Stakr vault implementation on Base, see
(example vault on BaseScan).0x93125009209e23fBAFf2B78712029F7A7CdD23cD
- On Base mainnet, the factory is deployed at
- Call
:createStakrVault(underlying, name, symbol, description, owner)
: ERC-20 underlying asset.underlying
,name
: Vault share token name/symbol.symbol
: Short metadata (e.g. "Agent incentive vault").description
: Set to the agent’s address (or the EOA/contract the agent controls). Useowner
for permissionless reward add/modify by anyone.address(0)
- Use the returned vault address for all subsequent calls (
,addRewardToken
, etc.).modifyRewardToken
Core User Flows (for completeness)
- Deposit only:
(ERC-4626).deposit(assets, receiver) - Deposit and lock:
.depositAndLock(assets, user) - Lock existing shares:
(vault must be approved for the shares).lock(shares, user) - Harvest:
to send pending rewards toharvest(user)
.user - Unlock:
; then optionallyunlock(shares, user)
to redeem shares for underlying.unlockAndRedeem(shares, receiver)
Settings and Types
- Settings:
struct Settings { uint256 startTime; uint256 endTime; } - Validation:
andblock.timestamp <= startTime
for new or rescheduled rewards.startTime < endTime - Token: Any ERC-20 except the vault’s share token. The underlying can be used as a reward.
For exact function signatures, revert reasons, and events, read the vault API in this skill when implementing calls or debugging.