Skip to content
Socket

Catalog / module / rewards

Composite weight

v1

Combine several weight sources into one multiplier.

What it does

composite-weight v1: combine weight sources

A weight plugin for `staking-vault` that combines up to four other plugins:

| mode | result | |---|---| | 0 MAX | the best single reading ("diamond hands **or** questers") | | 1 SUM_BONUSES | 1.00x + every source's bonus over 1.00x | | 2 PRODUCT | the readings multiplied together |

Each source reading is clamped to [1.00x, 5.00x]. The combined result is clamped to [1.00x, `clampBps`], and the vault's own ceiling still applies.

- Each source is read with its own 32k gas budget (4 × 32k fits inside the vault's 150k plugin budget). A source that reverts, returns garbage or runs out of gas counts as 1.00x. `multiplierBpsOf` never reverts. - `_onInit` stores source addresses only and never calls them. In a recipe they may be predicted siblings. - `refresh(vault, ids)` forwards to a vault's permissionless `syncMany`.

**Roles:** the owner can only pause `refresh` and hand over ownership. **Locked:** `sources`, `mode`, `clampBps`. **Value flows / fee lanes:** none.

What if…

- **…one source breaks?** It counts as 1.00x and the others still count. - **…two sources both give a bonus?** MAX takes the best, SUM_BONUSES adds them, PRODUCT multiplies them. All are capped. - **…my multiplier went up but my share did not?** The vault adopts it on sync. Refresh, and it applies from then on.

Risks in plain English

  • Sources, mode and ceiling are fixed at deploy.
  • A source that breaks counts as 1.00x, never more.
  • PRODUCT compounds quickly; the ceiling (and the vault's own ceiling) is what bounds it.

What if…

What if one source stops working?
It is read with its own gas budget and counts as 1.00x; the others still count.
What if two sources both give a bonus?
MAX takes the best one, SUM_BONUSES adds them, PRODUCT multiplies them. All are capped by the ceiling.
What if my multiplier went up but my share did not?
The vault adopts new multipliers when it is synced. Use refresh (or the vault's sync) and it applies from then on.

Fees

No protocol fee on this module.

Evidence

Form check
Built from the source files
Implementation
—
Code hash
—

Settings you choose at deploy

  • Weight sourcesUp to 4 weight plugins (duration, task, ...). Can never change.Locked forever
  • How to combineLocked forever
  • Highest combined multiplierLocked forever