The rate limiter uses a progressive fee calculation with the following key components:Parameters:
reference_amount (x₀): The base reference amount
cliff_fee_numerator (c): The base fee rate
fee_increment_bps (i): The fee increment in basis points
max_limiter_duration: Duration for which the rate limiter is active
The formula depends on the relationship between input_amount and reference_amount:Case 1: input_amount ≤ reference_amountFee=Input Amount×cCase 2: input_amount > reference_amountFirst, decompose the excess amount:Input Amount=x0+(a×x0+b)where:
a: floor division of (Input Amount - x₀) / x₀
b: remainder of (Input Amount - x₀) mod x₀
Then calculate fees based on whether we exceed the maximum index:Max Index can be calculated as:Max Index=fee_increment_numeratorMAX_FEE_NUMERATOR−cwhere: