RampETH on BNB Chain

Uniswap v4 Hook Contract 0x1e4605837970eef394662b1a9e88e09292636080 on BNB Chain · Dynamic fee · Verified contract

Volume (24h)
$0.96
Value locked (TVL)
$1.00
All-time volume
$0.96
Pools using this hook
1
Swaps (24h)
1 (1 traders)
Total swaps
1

What it does

RampETH applies an owner-tuned dynamic fee on every swap, where the trade direction favoured by the configured asymmetry pays the higher base fee while the other direction pays the flat fee, with keeper pokes and same-block surcharges adjusting within floor and cap bounds, and it splits LP fee income between share holders and a protocol treasury.

How it works step by step

  • Overrides the LP fee on every swap via beforeSwap, returning the pool fee with the override flag, so the pool uses an autonomous, owner-configured dynamic fee.
  • Fee is resolved from a per-pool autonomous base (flat fee plus an asymmetry premium in one direction), capped by a per-pool maximum and floored by a configured floor.
  • A keeper can poke directional fee overrides for a limited TTL (up to 72 hours), clamped between the floor and cap.
  • Optional mid-block surcharge: on the first swap of a block the hook records the sqrt price, and later same-block swaps moving price away from that observation can pay an extra fee computed by a companion math contract.
  • Liquidity is held in a shared range ledger: deposits mint ERC-6909 shares, PoolManager fees are collected into the ledger, a claim fee (capped at 20%) can be taken, and the remainder is distributed to share holders pro rata.
Swap behaviour
beforeSwap pauses swaps if the pool or ledger is paused, optionally records a mid-block price observation, and returns the resolved fee with the override flag. Swaps in the direction of the configured asymmetry premium pay the higher base fee; the opposite direction pays the flat fee. A live keeper poke on the matching direction replaces the autonomous fee, bounded between floor/2 (not below floor) and cap. Same-block swaps that move price away from the recorded observation can pay an additional surcharge up to the midCap, and total fee is capped at the pool maximum. Swaps never take or return tokens (zero delta).
Liquidity behaviour
Deposits and withdrawals go through PoolManager unlock callbacks; the hook itself has no add/remove liquidity callbacks enabled. Deposits pull principal from the depositor (native currency is prepaid for native pools). Withdrawals return principal to a recipient with a minimum-amount check. Accrued LP fees are minted as PoolManager claims to the hook and distributed to share holders via fee accumulators; ERC-6909 share transfers first settle accrued fees for both parties.
Fee behaviour
Fees are set dynamically per swap: an autonomous base fee (flat fee, plus a premium in the configured asymmetry direction), overridden by a non-expired keeper poke in the matching direction (bounded by floor and cap), plus an optional same-block mid-block surcharge capped at midCap, with the total bounded by the pool max. Collected LP fees are split: a configurable claim fee (up to 20%, recorded per pool with history) accrues to a protocol recipient, and the rest accrues to share holders. The protocol share can be swept by the recipient.
Owner & admin controls
Restricted (AccessManaged authority) functions include: setting per-pool floor/flat/cap configuration, pool asymmetry, keeper pokes and poke clearing, global and per-pool pause (up to 7 days), mid-block configuration, claim-fee rate and treasury recipient changes, and setting the ABSOLUTE_MAX_FEE at deployment. Claim-fee changes are recorded in history and apply to ranges from their sync point. The contract is not an upgradeable proxy. Authority role assignments are external to the contract and not visible here.

Enabled Uniswap v4 callbacks

beforeInitialize, beforeSwap

beforeInitialize: validates the pool is dynamic-fee, own-hook and configured, and rejects duplicate or invalid setups. beforeSwap: enforces pause, updates the mid-block observation, and returns the dynamic fee override. All other hook callbacks are disabled (they revert with NotPoolManager).

Security & trust assessment

Risk level: medium (verified source, high confidence).

Who controls it: A single authority role can change fees within bounds, pause trading and deposits for up to 7 days repeatedly, and set the protocol claim-fee rate and recipient. It cannot move LP principal directly through documented paths, but a compromised key could degrade pool economics or halt the pool.

Risk to user funds: The hook can take a protocol fee share from LP fee income and can block swaps and deposits through pausing. It does not return delta on swaps, so it does not take swap principal. Deposited principal is held by the PoolManager and returned on withdrawal; LP fee claims are held as PoolManager claims until redeemed.

Security findings

  • [medium] Privileged fee control: The authority can set a pool cap up to the absolute maximum fee and push keeper pokes between floor and cap, so swaps on a pool can be made expensive within the configured bounds.
  • [medium] Pausable swaps and deposits: beforeSwap reverts with LedgerPaused when the global or per-pool pause is active, so the authority can halt trading on a pool for up to 7 days per call.
  • [low] Protocol fee skim on LP fees: A configurable claim fee (up to 20% of collected LP fees) is diverted to a treasury recipient and history changes are retroactive only through the minimum-rate rule, which can still reduce LP earnings.
  • [low] Principal and fee custody in hook: The hook holds PoolManager claims for accrued fees and redeems them to recipients; a bug in accounting or the authority-controlled recipient could misdirect these balances, but no upgrade path is present.
  • [info] Mid-block surcharge depends on external math contract: The surcharge is computed by a separate immutable math contract with a fixed gas budget; failure falls back to the base fee rather than reverting.

Contract details

Verified source
Yes (RampETH)
Compiler
solc 0.8.26+commit.8a97fa7a
Bytecode size
23,777 bytes
Upgradeable proxy
No
Detected patterns
dynamic-fee, erc20, fee-sharing, moves-currency, pausable, self-unlock

Pools using RampETH