Index of every page on this site: llms.txt
All skills
whetstoneresearch avatar

/rehypothecation-hook

@4f654fe
Run it yourself

Operate and configure Doppler's Rehype initializer hook for buybacks, beneficiary fees, fee routing, and protocol-owner fee claims.

Use this Skill: https://skilld.dev/gh/whetstoneresearch/doppler-skills/rehypothecation-hook

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencesCONFIGURATION.md

≈918 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Configuration Guide

Source of truth

Initializer-side configuration

Use this path for RehypeDopplerHookInitializer.

  • Calldata layout (abi.encode(...) of RehypeTypes.InitData):
    1. address numeraire
    2. address buybackDst
    3. uint24 startFee
    4. uint24 endFee
    5. uint32 durationSeconds
    6. uint32 startingTime
    7. FeeRoutingMode feeRoutingMode
    8. FeeDistributionInfo feeDistributionInfo
  • Validation:
    • startFee <= MAX_SWAP_FEE (currently 0.8e6, or 80%)
    • endFee <= MAX_SWAP_FEE (currently 0.8e6, or 80%)
    • startFee >= endFee
    • if startFee > endFee, durationSeconds > 0
    • each 4-field fee-distribution row must sum to WAD (1e18, or 100%)
    • startingTime is normalized to block.timestamp when passed as 0 or already in the past
  • Operational note:
    • initializer-side Rehype does not use getHookFees(poolId).customFee as its fee source of truth
    • read getFeeSchedule(poolId) instead
  • Operational note:
    • fee distribution is configured at initialization and is not customer-updated by an external admin call

Beneficiary Fee Collection

  1. Locate the Doppler asset address.
  2. Call collectFees(asset) directly on the hook contract.
  3. Resolve the pool through DopplerHookInitializer.getState(asset).
  4. Transfers accrued beneficiary fees to buybackDst.
  5. Returned BalanceDelta indicates the amounts paid out; log it for accounting.

Protocol Owner Fee Collection

The Rehype initializer hook tracks a protocol-owner fee bucket.

  1. Fees accumulate in getHookFees[poolId].airlockOwnerFees0 and airlockOwnerFees1.
  2. Call claimAirlockOwnerFees(asset) from the current airlock.owner() address.
  3. Only the current Airlock owner can claim this bucket.
  4. Returns (fees0, fees1) indicating transferred amounts.

Fee routing behavior

  • FeeRoutingMode.DirectBuyback transfers buyback-designated outputs directly to buybackDst.
  • FeeRoutingMode.RouteToBeneficiaryFees rolls those outputs into Rehype's internal beneficiaryFees buckets instead.
  • Rehype beneficiary fees are internal hook accounting that is ultimately claimed to buybackDst.
  • They are separate from beneficiary-share accounting managed by the initializer flow.

Runtime notes

  • Rehype takes a fixed 5% share of the raw hook fee for the Airlock owner, with the remaining 95% routed through buybacks, beneficiary accounting, and LP reinvestment.
  • Routing only proceeds once accumulated fees0 or fees1 exceed EPSILON (currently 1e6).
  • LP-designated fees are rebalanced and added back into a full-range LP position instead of sitting idle.

Operational Checklist

  • Snapshot getFeeDistributionInfo, getHookFees, and getPoolInfo for the target pool.
  • Snapshot getFeeSchedule(poolId) as well.
  • Verify on-chain balances of the hook match beneficiaryFees to avoid payout underflows.
  • Ensure buybackDst is set correctly, since it multiplexes both buybacks and beneficiary payouts.
  • Confirm the initialized fee schedule before assuming current fee behavior.
  • If protocol-owner fee claiming is part of your flow, confirm airlock.owner() before calling claimAirlockOwnerFees(asset).

Source: SKILL.md on GitHub

No rule matched.

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

1 warning2mo5 checks · Risk SAFE
  • Gen Agent Trust Hub2mo

    The skill provides safe documentation and checklists for interacting with the Doppler rehypothecation hook. All referenced URLs originate from the vendor's own verified GitHub repository.

  • Socket2mo

    No alerts

  • Snyk2mo

    Risk: MEDIUM · 1 issue

  • Runlayer8mo

    2 files scanned · No issues

  • ZeroLeaks7mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at 4f654fe. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 months ago.

Steadyupdated 8 months ago
metadata
{
  "author": "doppler",
  "version": "2.0"
}

README badge

README badge for whetstoneresearch/doppler-skills/rehypothecation-hook