# Approvals and signatures

> A trade takes one signature and one transaction. Here is what each one does, what your wallet shows you, and how to check it before you approve.

## One signature, one transaction

Most token swaps need two transactions: an approval that lets the router take your tokens, and then the swap. USDG and every stock token support EIP-2612 permits, so Ramp folds the approval into a signature and the swap needs only one transaction.

| You trade | Your wallet asks for |
| --- | --- |
| Buy with USDG | A permit signature for USDG, then the swap transaction |
| Buy with ETH | The swap transaction only. The ETH travels with it. |
| Sell for USDG | A permit signature for the stock token, then the swap transaction |
| Sell for ETH | A permit signature for the stock token, then the swap transaction |

## The signature

A permit is a typed message, signed with your key, that lets one address spend a set amount of one token until a deadline. It costs no gas and moves nothing by itself.

When Ramp asks for one, your wallet shows:

- **The token**, by name: USDG shows as "Global Dollar", a stock token as something like "NVIDIA • Robinhood Token".
- **The spender**: Uniswap's SwapRouter02, `0xCaf681a66D020601342297493863E78C959E5cb2`.
- **The value**: exactly the amount you are trading, in the token's smallest unit.
- **The deadline**: about 10 minutes from now.

Ramp checks the permit's details against the token's own contract before it asks you to sign, so the signature is valid for that token and nothing else.

## The transaction

The transaction calls SwapRouter02's `multicall`, which runs these steps in order and fails as a whole if any one fails:

1. **`selfPermit`** uses your signature to approve the router, for this amount only.
2. **`exactInputSingle`** swaps in one pool, with your **Minimum received** as the floor.
3. **`refundETH`** returns any unused ETH on an ETH buy, or **`unwrapWETH9`** turns WETH into ETH on a sale for ETH.

The whole call carries the 10-minute deadline. Before your wallet opens, Ramp runs the exact transaction against the chain from your address without sending it. If it would fail, Ramp shows why instead of asking you to sign.

## When Ramp uses an approval instead

If your wallet can't sign typed data, or a token can't be permitted, Ramp falls back to a normal approval: a separate transaction that approves the router for the exact amount of the trade, followed by the swap. Ramp never asks for an unlimited approval.

## Before you approve

> [!WARNING]
> A permit signature can move tokens. Only sign one on `terminal.rampstocks.app`, and only when you have just chosen **Confirm buy** or **Confirm sell**.

Check that:

- the address bar shows `terminal.rampstocks.app`,
- the spender is SwapRouter02, `0xCaf681a66D020601342297493863E78C959E5cb2`,
- the amount matches what you typed,
- the network is Robinhood Chain, chain ID 4663.

If any of these is off, reject the request. Rejecting costs nothing. See [Security](https://docs.rampstocks.app/account/security).
