hookwire
Follow on XOpen app

Written plainly

How it works.

Hookwire is a small contract on Robinhood Chain that sells a token for you when its price crosses a line you set. This page says what it does and what it cannot protect you from.

The status

The rule contract is live on Robinhood Chain mainnet at 0x3c2c53453cE0699f9f24c025EA202d7605BAb3e0. It has no owner, no upgrade path and no admin key. Use only money you can afford to lose.

The three rules

  • Take profit. Sell when the price reaches a multiple of your entry price. 2x means double.
  • Stop loss. Sell when the price falls a set percent below your entry price.
  • Trailing stop. Sell when the price falls a set percent from its highest point since you created the rule. The peak moves up, never down. The contract only learns a new peak when someone calls poke, and a keeper bot does that for you. If nobody records the peak while the price climbs, the stop trails from an old high and can fire later than you expect. Anyone can poke, and the app has a button.

Entry price is the pool price at the moment you create the rule. Prices are read from the pool in the same units the pool uses.

What happens when you create a rule

  • You pick the token, the exact pool, the rule type, the amount, the slippage guard, the keeper fee and an expiry.
  • You approve the token to the rule contract. That allowance is your spend limit. A rule sells the smallest of the amount you set, your balance and your allowance.
  • Nothing moves yet. Your tokens stay in your wallet.

What happens when it fires

  • Anyone, called a keeper, sends execute. The contract checks the rule is active, not expired and past its trigger.
  • It pulls the tokens from you, swaps them in the pool you chose through the Uniswap v4 PoolManager, and sends the output straight to you.
  • The keeper fee, up to 2%, comes out of the output and goes to the keeper. The contract keeps nothing between transactions.
  • If the output is below your slippage guard or your minimum, the whole execution reverts and the rule stays armed.

Stopping a rule

  • Cancel the rule from the app. Only you can.
  • Or set the allowance to zero. Nothing can then sell your tokens, whatever the rule says. The app has a button for it.
  • Rules also end on their own at the expiry.

Fees

  • The pool fee, as for any swap.
  • The keeper fee you chose, 0% to 2%, paid only when a rule fires.
  • A protocol fee, fixed at deploy, capped at 1%. Read it from the contract.
  • Gas for creating, cancelling and approving.

Risks

  • Spot price can be pushed. Rules read the pool spot price. Someone with enough capital can move it inside one block, trip your rule and take the other side. The app sets a price floor on every rule it creates. The sale must fill at no worse than the trigger price minus your slippage, which stops a pushed price from forcing a bad sale. On a stop loss or trailing stop you can switch the floor off, and then a gap far below the trigger still sells but a pushed price can cost you. A time weighted trigger is on the roadmap.
  • Hooks can change a swap. A Uniswap v4 hook can take a cut, change the price you get, or block a sale. The Pools page decodes the hook on every pool and flags swap hooks. Read it first.
  • Thin pools. A sale can move the price a lot. The app shows a quote and price impact. The slippage guard stops a sale that fills too far from spot.
  • Keepers are not guaranteed. A rule only runs if someone sends the transaction. The fee is the reason they will, and a low fee on a small rule may not be worth the gas. You can always run it yourself from the Keepers page.
  • Sequencer. Robinhood Chain is an Arbitrum Nitro L2 with a central sequencer. If it is down, nothing runs.
  • Bugs. The contract is tested against real pools on a fork. It has not had an independent audit.

This page describes software. It does not tell you what to buy or sell.

Run a keeper

Use the Keepers page by hand, or run the bot from the repository. It reads armed rules, simulates each triggered one, and sends only the ones that would succeed and pay more than their gas.

cd keeper
cp .env.example .env
# set KEEPER_PRIVATE_KEY, ROBINHOOD_RPC_URL, RULES_ADDRESS
node keeper.mjs

Addresses

Contract interface

createRule(key, tokenIn, kind, triggerBps, amountIn,
           slippageBps, keeperFeeBps, expiry, minOut) -> id
cancel(id)
poke(id)                 // trailing stop peak
execute(id) -> amountOut // anyone
check(id)  -> status, price, triggerPrice, triggered, expired, sellable
rulesOf(owner), activeRules(from, limit), ruleCount()

kind is 0 take profit, 1 stop loss, 2 trailing stop. triggerBps is 30000 for 3x on take profit, and 2000 for a 20% drop on the others.