LogoLogo
  • Introduction to Unizen
    • Unizen Overview
      • Unizen Liquidity Distribution Mechanism (ULDM)
        • ULDM Performance
      • Unizen Interoperability Protocol (UIP)
        • LayerZero
        • DeBridge
        • Stargate
        • Celer
        • Axelar
        • Thorchain
    • Unizen Dashboard
      • General
      • Portfolio
      • History
    • Unizen Trade
      • Fees
    • Unizen Explore
      • Unizen Omni-Chain Data Pool
    • Unizen Earn
  • ZCX
    • Token Utility
    • Tokenomics
  • API - Introduction
    • Introduction
    • Before you get started
      • Understanding Price Impact and Price Slippage in Token Swaps
      • Token Allowance Management for Non-updatable Allowance Tokens
      • Tokens with taxes
      • Wrapping and Unwrapping Native Tokens
      • Quote expiration deadline
    • Security Best Practices for Integrating Unizen
      • Why disable CORS
      • How to integrate with a reverse proxy
    • Version 2 of our smart contracts
      • Migration to smart contract v2
  • API - GET STARTED
    • QuickStart guide
    • Swagger
    • Information endpoints
      • GET /trade/v1/info/chains
      • GET /trade/v1/info/sources
      • GET/v1/info/cross-providers
      • GET /trade/v1/info/token/search
      • GET /v1/info/token/popular
      • GET /trade/v1/info/token/{chainId}/{tokenAddress}
      • GET /trade/v1/info/tokenLogo/{chainId}/{tokenAddress}
      • GET /info/thorchain-inbound-address
      • GET /trade/v1/info/tx/{txHash}
      • GET /trade/v1/info/trade/{chainId}/{txHash}
      • GET /trade/v1/info/trades
    • Approval
      • GET /trade/v1/{chainId}/approval/spender
      • GET /trade/v1/{chainId}/approval/transaction
      • GET /trade/v1/{chainId}/approval/allowance
    • Single-Chain Swap
      • GET /trade/v1/{chainId}/quote/single
      • GET /trade/v1/{chainId}/swap/single
      • Send transaction in evm chains
      • Send transaction in Solana
    • Cross-Chain Swap
      • GET /trade/v1/{chainId}/quote/cross
      • GET /trade/v1/{chainId}/swap/cross
      • Send transaction
    • Gasless orders
      • POST /trade/v1/gasless/typed-data
      • POST /v1/gasless/estimate
      • POST /v1/gasless/create
      • POST /v1/gasless/cancel
      • GET /trade/v1/gasless/status/{orderId}
      • GET /v1/gasless/orderByAddress/{address}
    • UTXO Assets and Cosmos Swap
      • GET /trade/v1/{chainId}/quote/cross 1
      • GET /trade/v1/{chainId}/swap/cross
      • Sending transactions
    • Efficient Quote Retrieval with Batch Processing
      • GET /trade/v1/{chainId}/batch_quote/single
    • Error Messages
  • GASLESS TRADES
    • Obtaining gasless quotes
    • Gas estimation
    • Executing the trade
    • Following the orders
  • On-Chain Contracts - Get Started
    • Integration with Unizen Contracts for Token Swapping
    • Registering Errors on Smart Contract Calls
  • PERMIT2
    • What is Permit2?
    • Usage in our api
  • WIDGET - Get Started
    • Embed the Unizen Widget
    • Playground
  • Other
    • Smart Contracts
    • Security Audits
    • Roadmap
  • links
    • Unizen
    • Marketing Website
    • Medium
    • Twitter
    • Discord
    • Telegram
Powered by GitBook
On this page

Was this helpful?

  1. PERMIT2

What is Permit2?

What is Permit2?

Permit2 is an advanced token approval mechanism introduced to streamline and enhance the user experience for decentralized token transactions. Building on the foundations of the ERC-20 token standard and EIP-2612 (Permit), Permit2 enables users to grant token allowances to smart contracts without requiring multiple on-chain approvals. This innovation allows for improved efficiency, reduced gas costs, and enhanced flexibility in decentralized trading.

Permit2 is particularly beneficial for DeFi applications and trading protocols, as it simplifies the process of granting token approvals, making the workflow more user-friendly and cost-effective.


How Permit2 Works

Permit2 leverages off-chain signatures to authorize token spending, enabling users to delegate token approvals to a specific smart contract or relayer. Instead of requiring users to send on-chain approval transactions, Permit2 allows:

  1. Off-Chain Authorization:

    • The user signs a message (a "permit") off-chain authorizing a specific spender (e.g., a trading protocol) to spend a certain amount of tokens on their behalf.

  2. On-Chain Execution:

    • The relayer or smart contract submits the signed permit to the blockchain, executing the transaction without the need for a separate approval step.

  3. Enhanced Features:

    • Permit2 supports additional features such as allowance transfers, bulk approvals, and precise allowance expiration times, providing greater control over token approvals.


Key Benefits of Permit2 for Trading

  1. Gas Cost Savings:

    • Traditional ERC-20 token approvals require a separate transaction for each allowance, incurring gas fees. Permit2 eliminates the need for these redundant approval transactions, saving users gas costs.

  2. Simplified User Experience:

    • Users can sign a single message off-chain instead of interacting with the blockchain twice (approval + transaction). This reduces complexity and enhances accessibility, especially for new users.

  3. Reduced Approval Risks:

    • Traditional token approvals often involve granting large or unlimited allowances to smart contracts, exposing users to potential security risks. Permit2 enables users to set:

      • Custom Allowance Limits: Users can specify exact amounts to be approved.

      • Time-Limited Approvals: Permissions can expire automatically after a defined period, reducing exposure.

  4. Cross-Platform Compatibility:

    • Permit2 is designed to work seamlessly across multiple decentralized applications (dApps) and protocols. This makes it a versatile solution for trading platforms, DeFi protocols, and wallet integrations.

  5. Batch Operations:

    • Permit2 allows bulk approvals and transfers in a single transaction, optimizing workflows for advanced use cases such as portfolio management and multi-token swaps.


Use Cases in Trading

  1. Decentralized Exchanges (DEXs):

    • Traders can sign a Permit2 authorization once, enabling seamless trades across multiple tokens without additional approvals.

  2. Aggregators:

    • Trading aggregators can leverage Permit2 to simplify routing trades through multiple liquidity sources without requiring repeated token approvals.

  3. Gasless Transactions:

    • Protocols can use Permit2 in combination with relayers to enable gasless trading experiences, where users do not need to pay for gas fees directly.

  4. Lending and Yield Farming:

    • Users can authorize lending protocols or yield farms to manage token allowances more dynamically and securely, improving operational efficiency.


Comparison: Permit vs. Permit2

Feature
Permit (EIP-2612)
Permit2

Approval Methodology

Off-chain signature + on-chain call

Off-chain signature + on-chain call

Gas Savings

Yes

Yes, with bulk operations support

Time-Limited Approvals

Yes

Yes

Batch Approvals

No

Yes

Transfer Allowances

No

Yes

Compatibility

Specific to token implementation

Works across all ERC-20 tokens


Conclusion

Permit2 is a significant step forward in enhancing the efficiency, security, and user experience of token approvals for decentralized trading. By reducing gas costs, simplifying workflows, and offering advanced features such as batch operations and time-limited allowances, Permit2 provides a powerful tool for DeFi protocols and traders alike.

For developers and platforms, integrating Permit2 into their systems can unlock better user experiences while optimizing transaction workflows. Permit2 is set to become a foundational component in the next generation of decentralized finance.

PreviousRegistering Errors on Smart Contract CallsNextUsage in our api

Last updated 4 months ago

Was this helpful?