Tender

Pay with any token, the merchant gets the exact stablecoin. Uniswap v4 hook, Whitechain USDT, x402

Tender

Created At

ETHGlobal Mumbai

Project Description

Tender is a checkout where the customer pays with any token they hold and the merchant receives exactly the invoice amount in a stablecoin.

A merchant creates an on-chain invoice for an exact amount (e.g. 1.00 USDC). Tender ranks every Uniswap v4 route by true cost (input value + fees + price impact + gas), runs an exact-output swap on the v4 PoolManager, sends the merchant exactly the invoice amount and returns the unused input to the payer, all in one transaction. If anything is off, the whole transaction reverts.

What's new:

  • A Uniswap v4 CheckoutHook: a hooked pool settles an invoice inside any router's swap, so the pool itself is the payment terminal.
  • Basket payments: one invoice paid from several tokens in one transaction.
  • A visible ranking panel with impact-sized slippage and split routing.
  • One merchant, three rails: any-token payments on Unichain, USDT invoices with partial refunds and CSV export on Whitechain, and x402 sales to AI agents on Hedera with spending controls and a public audit log, all in one dashboard.
  • A drop-in widget a separate shop adds in 23 lines.

Non-custodial, no admin: the contracts hold zero tokens after every call.

Live proof:

  • Unichain Sepolia any-token payment: https://unichain-sepolia.blockscout.com/tx/0x7dc679a80d3a49daa3f96a6d2e80f96af9efc23df5592d6a671af78da9f52fe9
  • Hook payment via Uniswap's router: https://unichain-sepolia.blockscout.com/tx/0x5445265c0fdbb79c5afc4f745dd9d1b3df5418584ad471f6389fb424cec857a8
  • Whitechain USDT payment: https://explorer.testnet.whitechain.io/tx/0x41485818a21c88008ffbdee188c142278a0d2686068e65e707a25e53a655de64
  • Hedera x402 settlement: https://hashscan.io/testnet/transaction/0.0.7162784@1793996113.115144711
  • Agent audit log (HCS): https://hashscan.io/testnet/topic/0.0.11345065

The live site runs the frontend; the full app runs locally against the testnets (see README).

How it's Made

Contracts (Solidity, Foundry):

  • CheckoutCore: on-chain invoices, payment, partial refunds to the original payer, cancel. Deployed on both chains.
  • UniswapCheckout: talks to the Uniswap v4 PoolManager directly (unlock -> swap each hop with exact output -> settle the input -> take the stablecoin straight to the merchant), then checks on-chain that the merchant got exactly the invoice and the contract holds nothing.
  • CheckoutHook: uses afterSwap + afterSwapReturnDelta to take exactly the invoice amount out of a swap's output and pay the merchant. Its address is mined with CREATE2 to set the hook permission bits. We proved it with Uniswap's own PoolSwapTest router, so our checkout contract was never called.
  • Basket payments use v4 flash accounting: several tokens, one unlock.
  • Tests: 44 Solidity checks against a real v4 PoolManager, including fuzzing and invariants.

Off-chain (TypeScript):

  • A route ranker that batches v4 Quoter calls through Multicall3, with Uniswap Trading API support built in (used when an API key is set).
  • Slippage buffers sized from measured price impact, split routing across two pools, and a vetted-pool allowlist, because some testnet pools had absurd prices.
  • A basket planner that prices legs sharing a pool against each other's impact.
  • A Hono API, a React + wagmi/viem app (pay page, merchant back office, dashboard) and a 23-line drop-in widget.
  • 56 Vitest tests, plus browser end-to-end runs on local forks of the testnets.

Partner tech:

  • Uniswap v4 (Unichain Sepolia): the hook and flash accounting make "the pool settles the invoice" and baskets possible.
  • Whitechain Sepolia: CheckoutCore verified on the explorer, real payments in Whitechain USDT (obtained by swapping WBT on their testnet DEX), a partial refund, and a one-signature EIP-2612 permit payment.
  • Hedera: the shop sells data to AI agents through @x402/hono with the Blocky402 facilitator. Our agent pays with no human, under a spending policy (allowlist, per-merchant cap, budget) checked before signing, and logs every decision to an HCS topic. The live run settled in HBAR because Circle's testnet USDC faucet wasn't delivering; USDC is the default.

Hacky bits: we seeded our own lite v4 pools with faucet funds, and the dashboard falls back to a second RPC when Unichain's public RPC rate-limits.

background image mobile

Join the mailing list

Get the latest news and updates