Catalog / module / rewards
Duration weight
v1The longer an NFT stays staked, the bigger its share.
What it does
duration-weight v1: the longer it stays, the more it earns
A weight plugin for `staking-vault`. It reports a multiplier from a breakpoint table fixed at deploy: `bps[i]` applies once a stake has lasted `elapsed[i]` seconds. Below the first step the multiplier is 1.00x. The table has up to 16 steps; both columns are strictly increasing, and each multiplier is between 1.00x and 5.00x. The vault's own `maxMultiplierBps` still caps the result.
Ported from ENTITY's `StakeDurationMultiplier`, with a configurable table instead of constants.
- Time is read from the vault's `stakeInfo(id).since`, which resets on unstake. - If the token is not staked, or the vault cannot be read, the multiplier is 1.00x. `multiplierBpsOf` never reverts. - `_onInit` stores the vault address only and never calls it. In a recipe the vault is a predicted sibling deployed afterwards. - The vault adopts a new reading on `sync`. `refresh(ids)` forwards to the vault's permissionless `syncMany`. Between syncs a stake earns at its older, **lower** rate, never a higher one.
**Presets** (`DurationWeightPresets`): `gentle` (1d 1.10x, 7d 1.25x, 30d 1.50x, 90d 2.00x) and `steep` (1h 1.10x, 1d 1.50x, 7d 2.00x, 30d 3.00x), or a custom table in hours and percent.
**Roles:** the owner can only pause `refresh` and hand over ownership. **Locked:** `vault`, `elapsed`, `bps`.
**Value flows / fee lanes:** none. It holds no value.
**Gas:** a 16-step table read cold costs well under the 32k per-source budget of `composite-weight`. There is a test that runs four such sources inside the vault's 150k budget.
What if…
- **…I unstake and restake?** The clock starts over. - **…nobody syncs my NFT?** It keeps the last multiplier the vault recorded. Anyone can sync, and the site does it before claims. - **…the owner wants a different curve?** This one cannot change. A new vault and plugin would be needed.
Risks in plain English
- The schedule is fixed at deploy; nobody can change it afterwards.
- Time counts from the moment of staking and starts over after an unstake.
- The vault only adopts a new multiplier when it is synced (anyone can sync; the site does it before every claim). Until then a stake earns at its older, lower rate: never more.
What if…
- What if I unstake and stake again?
- Your clock starts over at the first step.
- What if nobody syncs my NFT?
- You keep earning at the last multiplier the vault recorded. Syncing is free for anyone and the site does it for you before a claim.
- What if the owner wants a steeper curve later?
- They cannot change this one. They would deploy a new vault with a new plugin and stakers would choose to move.
Fees
No protocol fee on this module.
Evidence
- Form check
- Built from the source files
- Implementation
- —
- Code hash
- —
Settings you choose at deploy
- Staking vaultFilled in automatically by recipes (the vault deployed alongside). Can never change.Locked forever
- Time staked at each stepStrictly increasing.Locked forever
- Multiplier at each stepStrictly increasing, 1.00x to 5.00x. The vault's own ceiling still applies.Locked forever