Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

17 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🏹 Longbow

build license: MIT site

The gap terminal for tokenized stocks on Robinhood Chain β€” non-custodial limit orders, DCA & portfolio P&L, executed through Uniswap V2.

Nock. Draw. Loose.

Stock markets close; on-chain pools never do. Off hours, pool prices drift from the last real quote β€” Longbow tracks that gap live and turns it into a trigger nobody else has: gap orders ("buy at β‰₯1% discount to the quote") and gap-guarded DCA (recurring buys that hold while the pool trades above your premium cap), verified on-chain by a permissionless executor contract plus a keeper, while your funds never leave your wallet. Plain price limits and DCA are in there too.

Monorepo layout

apps/web             Next.js 14 β€” landing (3D hero), app (/app/*), docs (/docs/*), API routes
apps/keeper          Node worker β€” polls orders every ~15s and executes them
packages/contracts   Foundry β€” LongbowExecutor.sol + mocks + tests + deploy scripts
packages/shared      TS β€” chains, token registry, ABIs, V2 math, mock market engine

Quick start (offline demo β€” zero keys needed)

pnpm install

# terminal 1 β€” web (landing + app + docs)   β†’ http://localhost:3000
pnpm dev

# terminal 2 β€” keeper (fills your limit/DCA orders)
pnpm keeper

Mock mode is the default (USE_MOCKS=true): prices, reserves, holdings and keeper fills are simulated deterministically. Place a limit or DCA order at /app/orders and watch the keeper fill it.

Contracts

cd packages/contracts
forge test        # 11 tests β€” triggers, DCA multi-run, slippage, expiry,
                  # oraclePaused, stale price, sequencer down, cancel auth

Deploy:

# testnet demo environment (mock router+tokens+feeds+pools+executor)
forge script script/SeedDemo.s.sol --rpc-url robinhood_testnet --broadcast --private-key $KEY

# mainnet executor against the real Uniswap V2 Router02
ROUTER=0x89e5db8b5aa49aa85ac63f691524311aeb649eba \
forge script script/Deploy.s.sol --rpc-url robinhood_mainnet --broadcast --private-key $KEY

Then copy the printed addresses into packages/shared/src/addresses.ts and .env (EXECUTOR_ADDRESS), set USE_MOCKS=false, restart.

Environment

cp .env.example .env β€” everything is optional in mock mode.

Var Purpose
NEXT_PUBLIC_CHAIN_ID 46630 testnet (default) / 4663 mainnet
NEXT_PUBLIC_USE_MOCKS / USE_MOCKS true (default) = offline demo
FINNHUB_API_KEY real stock quotes (primary)
ALPHAVANTAGE_API_KEY quote fallback
EXECUTOR_ADDRESS deployed LongbowExecutor
KEEPER_PRIVATE_KEY funded keeper wallet (live mode)

Key invariants (read before integrating)

  • USDG is 6 decimals; every stock token is 18.
  • Chainlink stock feeds are total-return (dividends via ERC-8056 uiMultiplier). Apply the multiplier to balances, never to feed prices.
  • Never hardcode the V2 pair init code hash on Robinhood Chain β€” resolve pairs via factory.getPair().
  • Execution guards: feed staleness (1h), oraclePaused(), sequencer uptime feed + 1h grace, minAmountOut, reentrancy, path validation.

Dev-mode order store

Orders are mirrored in a JSON file (apps/web/.data/orders.json) so the demo has zero native dependencies. The production schema mirror lives in apps/web/prisma/schema.prisma (Postgres) β€” swap lib/orderStore.ts for a Prisma client when deploying.

Disclaimers

Experimental software, provided as-is, MIT licensed. Not financial advice. Robinhood Chain stock tokens are not available to US persons; Longbow is non-custodial tooling and does not facilitate restricted access.

About

🏹 The gap terminal for Robinhood Chain β€” a live radar for on-chain price gaps vs real quotes, orders that fire on the gap itself, gap-guarded DCA and portfolio P&L, plus a public gap API. Non-custodial, Chainlink-verified, routed through Uniswap V2. Next.js terminal + keeper + Foundry contracts.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages