Repository avatar
AI Tools
v0.2.0
active

stinkbid

pro.stinkbid/stinkbid

Non-custodial stink bids for tokenized stocks on Robinhood Chain. Agents sign with their own wallet.

Documentation

STINKBID

ci StinkBid verified on Sourcify License: MIT

Stink bids for tokenized stocks on Robinhood Chain. You sign a USDG buy order far under the price. It waits off-chain, costs nothing, and becomes one on-chain swap when the market reaches it. Your USDG stays in your wallet until then.

Site: https://stinkbid.pro · App: https://stinkbid.pro/app · Docs: https://stinkbid.pro/docs · Status: https://stinkbid.pro/status · Changelog

Not audited. Tested as described below. The API caps orders at 100 USDG.

How it works

  1. The maker approves USDG to Permit2 once.
  2. The maker signs a Permit2 PermitWitnessTransferFrom whose witness is the order: Order(address maker, address tokenOut, uint256 minAmountOut). The spender is StinkBid, and the signature works once and only until its deadline.
  3. A keeper, a Cloudflare Worker that checks about every 10 seconds, quotes each open order on Uniswap v3. When the quote reaches minAmountOut and the order's optional conditions hold (Chainlink confirms the drop; US market closed), it calls StinkBid.fill.
  4. fill pulls the USDG through Permit2 and swaps it on SwapRouter02 straight to the maker. It then measures the maker's balance change and reverts if that change is under minAmountOut.

Anyone can call fill. Active orders, signatures included, are public at GET /api/orders/open, so the keeper is a convenience, not a gatekeeper. The keeper's key holds only gas money and cannot spend USDG or fill below a signed minimum; SECURITY.md lists what it can do.

Contracts (Robinhood Chain, 4663)

Address
StinkBid0x362917b506695C2096e361Fc032D4315f2439760 · source verified on Sourcify (exact match) · deployed in block 119,855,305 via CREATE2, salt keccak256("stinkbid.v1")
$STINKBID (token)0x5b2c126f4522839110b2ce9d92ff454b26bdc562 · hold it to bid bigger (higher size limits and more open bids, read from your balance); no revenue share, no fee
Permit20x000000000022D473030F116dDEE9F6B43aC78BA3
USDG0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168
SwapRouter020xCaf681a66D020601342297493863E78C959E5cb2
QuoterV20x33e885eD0Ec9bF04EcfB19341582aADCb4c8A9E7

StinkBid has no owner, no fee, no pause and no upgrade path. Between transactions it holds nothing. Markets and pools are listed in shared/config.ts and at https://stinkbid.pro/contracts.

Mainnet fills

Real stink bids filled by the contract above: 6 fills, 27 USDG, 3 maker wallets (2 of them not the team's). The maker signed the bid and received the stock token; the keeper only sent the transaction. Every fill, with its maker, is also in the public book: GET https://stinkbid.pro/api/book (fills[].maker, fills[].fill_tx).

StockFilledMakerPaidReceivedBlockTransaction
NVDA23 November 2026, 02:21 UTC0x8fD7…1bAb (team test)1 USDG0.007594 NVDA121,071,4950x556b9a19…efa992
MSFT23 November 2026, 20:55 UTC0x8fD7…1bAb (team test)1 USDG0.002015 MSFT121,705,3980xcd878551…72e52a
NVDA24 November 2026, 21:44 UTC0x5515…8e7a10 USDG0.065037 NVDA122,548,3460x064e4bb6…9b4f0e
NVDA24 November 2026, 21:55 UTC0xA54c…82cd (ladder rung 1%)5 USDG0.032589 NVDA122,554,4110x3baaa6ff…affaf5
NVDA25 November 2026, 00:15 UTC0xA54c…82cd (ladder rung 2%)5 USDG0.032892 NVDA122,630,8710x6e5d6276…fea7af
NVDA25 November 2026, 07:22 UTC0xA54c…82cd (ladder rung 3%)5 USDG0.033230 NVDA122,868,6910xc341465c…7f383a0

Tests

cd contracts
forge test                                                   # unit, fuzz, invariant
FORK_RPC=https://robinhood.drpc.org forge test --match-contract Fork
cd .. && npm test                                            # TypeScript unit tests (vitest)
SuiteWhat it covers
Unit (18)fills, every revert path, tampered orders, foreign keys, wrong spender, bad paths, reentrancy from the router, a router that ignores the minimum or under-spends, a fee-on-transfer token
Fuzz (2 × 1,000 runs)fills exactly when the swap pays the minimum; no foreign key ever spends
Invariant (4 × 256 runs × 64 calls)the contract holds nothing; USDG leaves makers only through fills; makers always get their price; no altered order fills
Fork (2)real Permit2, USDG, SwapRouter02 and the NVDA/USDG pool: a bid at the market fills, a −15% bid waits
TypeScript unit (npm test)shared/config.ts: minimum out for a depth and back, swap path bytes and fee tiers, Permit2 nonce word and bit, order ids
End to end (npm run test:e2e)a local fork running the real site API and keeper: forged order rejected → bid placed → oracle-confirmed bid placed → pool falls → keeper fills the pool bid, the oracle bid waits unpublished → maker paid at least the minimum → cancel → spent nonce refused (14 checks)

Coverage of StinkBid.sol: 96% of lines. Slither runs in CI; contracts/ANALYSIS.md explains each excluded detector. Gitleaks scans the full git history for secrets in CI (.gitleaks.toml only allows public 20-byte addresses). A fill on the NVDA pool costs about 296k gas.

Layout

contracts/          Foundry: StinkBid.sol, tests, CREATE2 deploy script
shared/config.ts    addresses, markets, EIP-712 types, order limits (site, API and keeper share it)
worker/             Cloudflare Worker (Hono): order API, keeper cron, status
  orders.ts         /api/markets, /quote, /orders, /orders/open, /book
  keeper.ts         every ~10 s: expire, check balance, approval, nonce and conditions, quote, simulate, fill
  status.ts         /api/status from the keeper's run log and the chain
src/app/            order page: wallet, Permit2 approval, typed-data signing, cancel
src/pages/          docs, contracts, security, status, official links, changelog
_pages/             page bodies; `npm run pages` wraps them in the shared shell
migrations/         D1 schema
scripts/e2e-fork.*  end-to-end test on a local fork

Run locally

npm install
cp .dev.vars.example .dev.vars
npm run db:migrate:local
npm run dev

The keeper runs in watch mode, quoting but never sending, until KEEPER_KEY is set (npx wrangler secret put KEEPER_KEY).

Deploy the contract

cd contracts
forge script script/Deploy.s.sol --rpc-url robinhood                                   # prints the address
forge script script/Deploy.s.sol --rpc-url robinhood --account <keystore> --broadcast

The address depends only on the bytecode and the salt, so anyone who rebuilds this commit gets the same one. Foundry compiles StinkBid.sol with the via-IR profile (solc 0.8.28, 1,000,000 runs, cancun) because it imports Permit2's interface; that is the build on-chain and on Sourcify.

Security

See SECURITY.md and https://stinkbid.pro/security.

License

MIT

No installation packages available.

Remote