DeFi Rate Limit Lab

Production-style transaction flow for rate-limited borrows.

Compare the two limiter mechanisms with the same reusable execution workflow: preflight on the public client, explicit wallet prompt, receipt confirmation, and visible failure states.

Network

Base Sepolia

Wallet

--

Flow

simulate -> wallet -> confirm

Model

single active mechanism

BucketedRateLimiter

Strict rolling window

Hard ceiling across the most recent rolling hour. Use this when you want deterministic recent-volume controls.

Window Limit

--

Used Now

--

Remaining

--

Recent Buckets

One slot per on-chain bucket. Old slots fall out of the rolling hour automatically.

10m slots

50 min ago

0 units

40 min ago

0 units

30 min ago

0 units

20 min ago

0 units

10 min ago

0 units

Now

0 units

Borrow Workflow

The execution path is fixed: validate input, run a public-client simulation, prompt the wallet, then wait for confirmation.

Execution Status

Ready

Use the preflight step to verify the rolling-window cap before the wallet prompt appears.

1

Validate input

complete

Display amount 250,000 maps to raw contract amount 250000.

2

Simulate on public client

pending

Run publicClient.simulateContract(borrow(250000)) to catch limiter reverts before the wallet prompt.

3

Prompt wallet

pending

Ask the wallet to sign and broadcast the prepared borrow request with zero ETH value.

4

Confirm onchain

pending

Wait for the receipt so the UI only reports success after settlement.

Status Logs

0 entries

No execution logs yet. Run simulate or send to populate the audit trail.

Preflight Preview

Simulation output appears here

Run the simulation to confirm the window state for the typed amount before you prompt the wallet.

DeFi rate limiting proof of concept.simulation-first workflow.