> ## Documentation Index
> Fetch the complete documentation index at: https://docs.eco.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Permit2 (permit2)

> Universal token approval infrastructure by Uniswap. Provides a single approval contract for all DeFi protocols.

Universal token approval infrastructure by Uniswap. Provides a single approval contract for all DeFi protocols.

| Fact | Value |
| - | - |
| Category | Infrastructure and standards |
| Family | none |
| Namespace | `Permit2` on ethereum, optimism, bsc, polygon, monad, arc, base, arbitrum, avalanche |
| Chains | ethereum, optimism, bsc, polygon, monad, arc, base, arbitrum, avalanche |

## When to use it

* Uniswap's token-approval contract at one address on every chain it is on. A signature transfer
  (`permitTransferFrom`) moves a user's tokens with a one-time signed permit; an allowance
  transfer (`approve` with an expiry, then `transferFrom`) works like an expiring ERC-20
  allowance.
* `sauce run --fund` pulls with Permit2 by default: the owner signs, the Pot receives.

## Pitfalls for a program

* The user approves Permit2 itself once per token, by an ordinary ERC-20 `approve`.
* A signed permit names the spender (the contract calling Permit2: the Pot), the amount, a
  nonce and a deadline; nonces are unordered bits, each usable once.
* Allowance amounts are `uint160` and expiries `uint48`.

## In a Sauce program

Pull a user's tokens into the Pot with their signed permit:

```ts theme={null}
function main(
  owner: Address,
  token: Address,
  amount: Uint256,
  nonce: Uint256,
  deadline: Uint256,
  signature: bytes
) {
  const permit = { permitted: { token: token, amount: amount }, nonce: nonce, deadline: deadline };
  const details = { to: pot, requestedAmount: amount };
  const before = Token(token).balanceOf(pot);
  Permit2.Permit2.permitTransferFrom(permit, details, owner, signature);
  require(Token(token).balanceOf(pot) - before == amount, "the permit moved another amount");
}
```

## What it offers

* **approve**: Set token allowance for a spender via Permit2
* **transferFrom**: Transfer tokens using a Permit2 allowance

## Notes

* Same address on all 9 chains (deterministic CREATE2 deployment)
* Approve once: ERC-20 approve to Permit2, then use Permit2 to manage per-protocol allowances
* amount is uint160 (not uint256) - max value is type(uint160).max
* expiration is uint48 unix timestamp - approvals auto-expire for security
* Uniswap V3/V4, 1inch, and many protocols use Permit2 for token transfers
* lockdown is an emergency function to batch-revoke compromised approvals

## Its names in a program

On Ethereum, `Permit2` is a namespace: its contracts need no import.

```ts theme={null}
function main() {
  // Ethereum's permit2, `0x000000000022D473030F116dDEE9F6B43aC78BA3`.
  require(Permit2.Permit2 != 0);
}
```

## Deployments

| Chain | Contract | Address | In a program |
| - | - | - | - |
| [Ethereum](https://docs.eco.com/sauce-sdk/reference/chains/ethereum.md) | permit2 | `0x000000000022D473030F116dDEE9F6B43aC78BA3` | `Permit2.Permit2` |
| [Optimism](https://docs.eco.com/sauce-sdk/reference/chains/optimism.md) | permit2 | `0x000000000022D473030F116dDEE9F6B43aC78BA3` | `Permit2.Permit2` |
| [BNB Chain](https://docs.eco.com/sauce-sdk/reference/chains/bsc.md) | permit2 | `0x000000000022D473030F116dDEE9F6B43aC78BA3` | `Permit2.Permit2` |
| [Polygon](https://docs.eco.com/sauce-sdk/reference/chains/polygon.md) | permit2 | `0x000000000022D473030F116dDEE9F6B43aC78BA3` | `Permit2.Permit2` |
| [Monad](https://docs.eco.com/sauce-sdk/reference/chains/monad.md) | permit2 | `0x000000000022D473030F116dDEE9F6B43aC78BA3` | `Permit2.Permit2` |
| [Arc](https://docs.eco.com/sauce-sdk/reference/chains/arc.md) | permit2 | `0x000000000022D473030F116dDEE9F6B43aC78BA3` | `Permit2.Permit2` |
| [Base](https://docs.eco.com/sauce-sdk/reference/chains/base.md) | permit2 | `0x000000000022D473030F116dDEE9F6B43aC78BA3` | `Permit2.Permit2` |
| [Arbitrum One](https://docs.eco.com/sauce-sdk/reference/chains/arbitrum.md) | permit2 | `0x000000000022D473030F116dDEE9F6B43aC78BA3` | `Permit2.Permit2` |
| [Avalanche C-Chain](https://docs.eco.com/sauce-sdk/reference/chains/avalanche.md) | permit2 | `0x000000000022D473030F116dDEE9F6B43aC78BA3` | `Permit2.Permit2` |

## ABI

### `Permit2ABI`

`import Permit2ABI from "./protocols/permit2/Permit2ABI.json";` Speaks for: permit2.

* `approve(address token, address spender, uint160 amount, uint48 expiration)`
* `transferFrom(address from, address to, uint160 amount, address token)`
* `permitTransferFrom(((address token, uint256 amount) permitted, uint256 nonce, uint256 deadline) permit, (address to, uint256 requestedAmount) transferDetails, address owner, bytes signature)`
* `nonceBitmap(address owner, uint256 wordPosition) view returns (uint256)`
* `lockdown((address token, address spender)[] approvals)`

## Next steps

* [Protocols](https://docs.eco.com/sauce-sdk/reference/protocols.md): the other protocols, by what they do.
* [Protocols and tokens](https://docs.eco.com/sauce/names.md): calling a contract by its namespace, or through its ABI.
* [Glossary](https://docs.eco.com/sauce/glossary.md): the words these pages use, in plain terms.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.