Docs
How a stink bid works
A stink bid is a buy order parked far under the price. On STINKBID it is a signature: it waits off-chain, costs nothing, and turns into one on-chain swap only when the market reaches it.
The flow
- Approve once. You approve USDG to Permit2, the Uniswap signature-transfer contract. The app approves exactly the total of your open bids, not an unlimited amount.
- Sign the slip. Stock, size in USDG, how far under the price, expiry. Your wallet shows it as an EIP-712 message with spender StinkBid and token USDG. No transaction, no gas.
- Wait. Every minute the keeper asks the Uniswap quoter what your USDG would buy right now.
- Fill. When the quote reaches your minimum, the keeper calls
StinkBid.fill. In one transaction Permit2 pulls your USDG, Uniswap swaps it and the stock token lands in your wallet. If the swap would pay less than your minimum, the whole transaction reverts and nothing moves.
The signed order
The order travels as the witness of a Permit2 PermitWitnessTransferFrom. Permit2 refuses the transfer unless every field below matches the signature exactly.
PermitWitnessTransferFrom( TokenPermissions permitted, // token = USDG, amount = your size address spender, // StinkBid, and only StinkBid uint256 nonce, // random; one use only uint256 deadline, // expiry, unix seconds Order witness ) Order(address maker, address tokenOut, uint256 minAmountOut)
minAmountOut is your price. The app sets it from a live Uniswap quote for your size: for a bid 15% under, it asks for quote / 0.85 tokens, so the order fills once the same USDG buys that many.
What a fill checks
Anyone may call fill(order, permit, signature, path). The caller chooses the route, nothing else:
- The input token must be USDG and the path must start at USDG and end at the order's token.
- Permit2 verifies the signature, the deadline and the nonce, and burns the nonce before any USDG moves.
- After the swap the contract measures the change in your balance of the token, and reverts if it is under
minAmountOut. It does not trust the router's return value. - It reverts if any USDG would stay behind in the contract. Between transactions it holds nothing.
There is no owner, admin key, fee switch, pause or upgrade. The constructor fixes Permit2, the Uniswap router and USDG forever.
Cancelling
Cancel in the app. It sends one Permit2 transaction, invalidateUnorderedNonces, from your wallet. After it confirms, the signature is dead for everyone, including any other filler who copied it. Expired orders need no action.
You can also cancel without this site, from the explorer's write tab on Permit2, or by lowering your USDG approval to Permit2, which stops every order at once.
The keeper
A Cloudflare Worker runs every minute. It expires old orders, checks each maker's USDG balance, approval and nonce, gets one quote per order and simulates the fill before sending it. It pays the gas and takes no fee. Its run log is public on the status page.
The keeper is a convenience, not a gatekeeper: it can fill an order only as signed, and it cannot change the price, size, token, recipient or expiry.
Run your own filler
Open orders, signatures included, are public at GET /api/orders/open. Anyone can fill them, which also means nobody has to trust our keeper being online.
// for each order from /api/orders/open
stinkbid.fill(
{ maker, tokenOut: token_out, minAmountOut: min_amount_out },
{ permitted: { token: USDG, amount: amount_in }, nonce, deadline },
signature,
path // USDG → fee → token, packed
)
A filler can choose when to fill and through which pools. It can never pay you less than your minimum. If the market falls further than your bid, a filler may route so that you get close to the minimum; that is the price you set.
Beta limits
| Size | 1 to 100 USDG per order |
|---|---|
| Open orders | Up to 10 per wallet |
| Expiry | Up to 30 days |
| Depth | 1% to 50% under the current quote |
| Fee | None. You pay the Uniswap pool fee inside the swap |
| Markets | 10 stock tokens with deep USDG pools, listed on Contracts |
The limits live in the API, not in the contract. They are there while the contract is new and unaudited.
API
GET /api/markets | Markets, pool, price for a 100 USDG buy, beta limits |
|---|---|
GET /api/quote?symbol=&amount= | Uniswap quote for a size |
POST /api/orders | Submit a signed order (checked: signature, balance, approval, nonce) |
GET /api/orders?maker= | A wallet's orders |
GET /api/orders/open | Every open order with signature, for fillers |
GET /api/book | Open bids and recent fills per market, no addresses |
GET /api/status | Contract, chain head, keeper runs |