0xklen-detect-just-in-time-liquidity-rental
暂无简介
- License 许可
- MIT
- 最近更新
- 2026-11-15
- Stars
- ★ 81
- Forks
- 17
02 资源文件 3
- 许可证LICENSE1.0 KB
- 参考文档SOURCE.md362 B
- 参考文档TRUST.auto.yaml2.2 KB
03 SKILL.md 正文
Detect just-in-time liquidity rental
Just-in-time liquidity is a mint immediately before a large swap and a burn immediately after it inside the same block, so the attacker collects the swap's fee without bearing any inventory risk — a pattern that is invisible in end-state pool balances.
Procedure
-
Pull the block's logs for the pool and filter for liquidity events adjacent to the swap:
cast logs --from-block $N --to-block $N --address $POOL \ "Mint(address,uint256,uint256)" "Burn(address,uint256,uint256)" --rpc-url $RPC -
Order the events by log index. A JIT fingerprint is
Mint, Swap, Burnwith the mint and burn from the same address and no intervening swap. -
Confirm the JIT provider entered and exited in one block by checking its token balances at block boundaries: if its LP balance at
N-1andNare equal (or zero), it held the position for exactly zero blocks. -
Attribute the fee. Compute the deposit's share of the pool at mint time (
base_liquidity / (base_liquidity + minted)) — that fraction of the swap fee is what the JIT provider captured, at the expense of passive LPs. -
Measure the sandwich-adjacent case: if the JIT provider's burn also moves price against the swapper's remaining tolerance, it is a JIT sandwich and the loss to the user is larger than the fee.
-
Compare the sum of DEX fees paid by LPs in the block: if one address captured more than 40% of a pool's fee in a single block with no prior LP history, treat it as JIT.
-
Log the pattern with block, pool, provider, deposit, fee-captured, and whether a sandwich leg is present. Repeat occurrences from one address are a JIT bot, not a market maker.
Pitfalls
- Looking only at end-of-block state, where the JIT position is gone. The evidence lives in log ordering, not balances.
- Confusing JIT with a legitimate single-block arbitrage that happens to touch liquidity; the arb does not mint LP tokens.
- Ignoring the swap's own logs. A Mint and Burn with no Swap between them is a deposit/withdraw churn, not JIT.
- Missing that a JIT sandwich charges the user twice: the fee and the adverse price move.
- Assuming a specific pool implementation. Balancer, Uniswap v3, and v4 all emit different liquidity events; normalise them first.
Verification
cast logs --from-block $N --to-block $N --address $POOL "Mint(address,uint256,uint256)" "Burn(address,uint256,uint256)" --rpc-url $RPC
A Mint, Swap, Burn sequence in log-index order from one address, with equal LP balance at block boundaries, confirms JIT. Report the pool, provider, fee captured, and whether a sandwich leg is present.
04 同仓库更多 Skills
troves
Deposit and withdraw from Troves DeFi yield vault strategies on Starknet. View available strategies, check positions, and manage vault deposits. Use this skill when the user mentions Troves, vault, yield vault, DeFi vault, strategy, yield farming, vault deposit, vault withdraw, earning yield through vaults, passive yield strategies, or wants to deposit into or withdraw from a yield strategy — even if they don't say "Troves" explicitly.
trade
Swap tokens on Starknet via Fibrous DEX aggregator. Supports per-provider selection (avnu, ekubo, or auto to race all). Use this skill when the user wants to swap, exchange, trade, convert, buy, or sell one token for another on Starknet. Also use when the user asks about token prices, exchange rates, DEX routing, best swap route, or wants to check how much they would receive for a given amount — even if they don't explicitly say "swap".
staking
Stake, unstake, claim, and compound rewards for STRK, WBTC, tBTC, SolvBTC, and LBTC on Starknet. View validators, pools, and staking positions. Use this skill when the user mentions staking, delegating, validators, staking pools, rewards, compounding, unstaking, earning yield, passive income on crypto, or wants to earn on their STRK or BTC tokens — even if they don't say "stake" explicitly.
send
Send STRK, ETH, or any ERC-20 token to a Starknet address. Supports simulation (dry-run) before execution. Use this skill when the user wants to send, transfer, pay, tip, or move tokens to another wallet address on Starknet. Also trigger when the user mentions sending funds to someone, making a payment, transferring assets, or moving crypto to a specific address — even if they just say "pay 10 STRK to 0x...".
portfolio
View a comprehensive DeFi portfolio dashboard and optimize portfolio allocation via automated rebalancing. Use this skill when the user wants an overview, summary, dashboard, total value, net worth, portfolio rebalancing, target allocation, or wants to see all their DeFi positions across Starknet at once. Also trigger when the user asks "what do I have", "show me everything", "how much am I worth", "my positions", "my investments", "rebalance my portfolio", "I want 50% ETH", "optimize my holdings", or any request for a holistic view of their Starknet holdings — even if they don't explicitly say "portfolio".
multi-swap
Execute multiple token swaps in a single Starknet transaction via Fibrous (default). Supports per-provider selection (avnu, ekubo, or auto to race all). Supports 2-3 swap pairs bundled into one multicall. Use this skill when the user wants to swap multiple token pairs at once, do batch swaps, execute several trades simultaneously, perform parallel swaps, or do bulk trading in one transaction. Also trigger when the user mentions "two swaps", "three swaps", "swap X and Y at the same time", or wants to convert multiple tokens in a single call.