smart-contracts/backlog/tasks/task-4 - Port-FlowDampener-...

1.1 KiB

id title status assignee created_date labels dependencies references priority
TASK-4 Port FlowDampener to Solidity To Do
2026-04-03 21:39
solidity
core
risk
TASK-1
/home/jeffe/Github/myco-bonding-curve/src/primitives/flow_dampening.py
medium

Description

Translate src/primitives/flow_dampening.py to Solidity.

Simplest of the core primitives — exponential outflow memory to prevent bank runs.

Core logic:

  • dampened_rate = base_rate * exp(-k * recent_outflow / total_reserve)
  • Track cumulative outflow with exponential decay per block
  • Configurable decay half-life and sensitivity parameter k

Integrates with bonding curve sell() and tranche redeem() as a rate limiter. Should be a library or modifier that other contracts can use.

Acceptance Criteria

  • #1 Outflow dampening matches Python model behavior
  • #2 Decay correctly resets over configured half-life
  • #3 Can be used as modifier on sell/redeem functions
  • #4 Gas overhead < 10k per check