# Permit Singleton

Using Permits - messages for minting NFTs idea was made by Hadrien into ERC draft; you can find the draft implementation here:

## Intro

Permit Singleton for backward-compatible signed ERC20/721/1155 transfers

TL:DR This implementation takes ERC20, ERC721, or ERC1155 assets and wraps them with a permit function.

## Using the Permit Singleton

"A user willing to use the Permit Singleton will have to grant it the authorization to manage his or her assets. This authorization is performed on a token-per-token basis, either by approving a balance to it (by calling [ERC20](https://eips.ethereum.org/EIPS/eip-20)'s `approve`) or by making it an operator (by calling [ERC721](https://eips.ethereum.org/EIPS/eip-721) and [ERC1155](https://eips.ethereum.org/EIPS/eip-1155)'s `setApprovalForAll` function).

Once approved, the singleton will be able to transfer the user's assets. For that, it requires the user to sign an authorization (following [ERC712](https://eips.ethereum.org/EIPS/eip-712) standard). There is one message format per token standard:

```
Permit20(address registry,address to,uint256 value,uint256 nonce,uint256 deadline,address relayer)
Permit721(address registry,uint256 tokenid,address to,uint256 nonce,uint256 deadline,address relayer)
Permit1155(address registry,uint256 tokenid,address to,uint256 value,uint256 nonce,uint256 deadline,address relayer,bytes data)
```

" - Author

## Out-of-order execution

"The Permit Singleton's nonces, which are represented as `uint256` should be seen as the concatenation of two `uint128`. The first one is the timeline id, while the second one is the nonce id within this timeline.

This means that regular nounce, which are smaller then 2128 are living on timeline 0, and match the exepcted behaviour. However, messages with nonce 2128, 2*2128 and 3*2128 are on 3 independant timeline and have no dependency (they are the first nonce in their respective timeline).

The current nonce of a user (on the trivial timeline) can be queried using `function nonce(address) public view returns (uint256)`. The current nonce on a specific timeline can be queried using `function nonce(address,uint256) public view returns (uint256)`." - Author

## Further reading

* Full repo of the implementation: <https://github.com/Amxx/Permit>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://nft-standards.gitbook.io/nft-standards-wiki/working-group-eips-and-implementations/permit-singleton.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
