Tags [[Security]] [[Permits]] Using Permits - messages for minting NFTs idea was made by [Hadrien](https://twitter.com/Amxx) into ERC draft, you can find draft implementation [here:](https://gist.github.com/Amxx/e3c87476093a6b27d9271b2e54b35292). # 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