delegation-framework icon indicating copy to clipboard operation
delegation-framework copied to clipboard

feat: Call Interval Enforcer

Open patidarmanoj10 opened this issue 1 year ago • 0 comments

What?

  • Add CallIntervalEnforcer contract to enforce a minimum interval between consecutive calls for a given delegation.
  • Includes unit tests for interval enforcement logic.

Why?

  • To provide a reusable enforcer that restricts the frequency of delegation usage, improving security and flexibility for delegation-based systems.
  • Enables use cases such as rate-limiting actions or enforcing cooldown periods on delegated permissions.

How?

  • Implements a beforeHook that checks if the required interval has passed since the last call for a (delegationManager, delegationHash) pair.
  • Stores the last execution timestamp in a mapping.
  • Decodes the interval from _terms (32 bytes, uint256 seconds).
  • Adds comprehensive unit tests to verify correct enforcement, including edge cases and independent tracking for different managers and delegations.

patidarmanoj10 avatar Jun 11 '25 05:06 patidarmanoj10