Oku Trade Docs
  • General
    • Getting Started with Oku Trade
  • Swap
  • Advanced Orders
    • Order Types
    • System and Security
  • Bridge
  • Ramp
  • Approving Contracts
  • FAQ
  • Troubleshooting
  • Features
    • Morpho
    • Pool
      • Pool Creator
    • Position Manager
    • Analytics
  • CAMPAIGNS
    • Oku Hoodies (HOODIE)
    • Getting Rewards
  • Extra Information
    • Official Links
    • Deployed Contracts
    • Submitting a Token Request
    • Oku API
    • The Team
    • Terms and Conditions
    • Privacy Policy
Powered by GitBook
On this page
  • Token Approval
  • Confirming Your Transaction
  • Permit2 Transaction flow

Approving Contracts

A secure, efficient and user-friendly experience when swapping or bridging

PreviousRampNextFAQ

Last updated 3 months ago

Token approvals are security standards built into ERC-20 tokens that allow users to grant permission to smart contracts to manage a specified amount of tokens. When using Oku to swap or bridge, initiating transactions require signature approvals before they can be completed. For a token that you have not traded before, users can expect to confirm two approval requests from the connected wallet.

Token Approval

Above is an example of an approval to spend precisely 0.001 WETH on Optimism. Bundled in this on-chain signature is the approval to transact WETH within the same smart contract in the future.

Approval is required only once per token unless access is revoked or interacting with a new smart contract. For instance, trading WETH on Arbitrum and WETH on Base will require separate approval.

Confirming Your Transaction

Oku simulates the transaction to see the exact amount of tokens to be transferred after the swap is confirmed. Simply sign the final signature request from your wallet and you’re good to go! Your wallet balance will update as soon as the order has been confirmed on the blockchain.

Permit2 Transaction flow

Some of Oku's trade routers, specifically Uniswap and 0x, utilize Permit2 contracts which reduce the number of onchain transactions a user is required to approve. After trading a token pair for the first time using a Permit2 enabled router, executing trades become streamlined.

First time trading WETH/USDT (Uniswap/0x router):

  • Sign the message authorizing Permit2 to conduct the approval (offchain)

  • Send a transaction allowing a maximum token spend (onchain)

  • Execute the trade (onchain)

Subsequent trades for WETH/USDT (Uniswap/0x router):

  • Sign the message authorizing Permit2 to conduct the approval (offchain)

  • Execute the trade (onchain)

As you see, trading with routers that support Permit2 reduces the amount of onchain transactions required to swap or bridge.

What are Permit2 contracts?

  • Permit2 contracts are advanced smart contracts introduced by Uniswap that streamline token approvals, allowing users to grant permissions for token transfers with enhanced features like time limits and spending caps.

  • They enable a single approval to be used across multiple dApps, reducing repetitive transactions, improving gas efficiency, and providing greater control and security over token permissions.

Why are token approvals required?

  • Tokens adhere to the ERC-20 standard, which includes security measures requiring user authorization. These permissioned steps prevent unauthorized access or actions from a users wallet

  • Approval of spending limits that allow smart contracts to spend a specific amount of tokens on behalf of the user, enabling seamless swaps or transfers.

  • Bridges and Cross-Chain swaps allow contracts to lock tokens on the source chain before minting or releasing equivalent tokens on the destination chain.

Token approval request to spend WETH on Optimism - Rabby Wallet
Confirming a Swap through the OKX DEX trade router