Skip to content
This repository was archived by the owner on Aug 19, 2025. It is now read-only.

wrapper for Approve - Allow #62

@Lomet

Description

@Lomet

Token Approval Wrapper Function

This structure can be described by two functions:

  • checkApprovalStatus: Determines if approval is needed.
  • executeApproval: Executes the approval process.
async function approvalWrapper(params) {
  if (checkApprovalStatus(params.checkParams)) {
    await executeApproval(params.approvalParams);
  }
}

Implementations:

ERC-20 Tokens:

  • checkApprovalStatus = allowance: Checks the allowance of tokens.
  • executeApproval = approve: Approves the transfer of tokens.

ERC-721 Tokens (Type 1):

  • checkApprovalStatus = getApproved: Checks if a specific token is approved.
  • executeApproval = approve: Approves a specific token for transfer.

ERC-721 Tokens (Type 2 - Global Approval):

  • checkApprovalStatus = isApprovedForAll: Checks if an operator is approved for all tokens.
  • executeApproval = setApprovalForAll: Approves an operator for all tokens.

LockDealNFT Use Case:

  • checkApprovalStatus = approvedPoolUserTransfers: Checks if a user is approved for pool transfers.
  • executeApproval = approvePoolTransfers: Approves a user for pool transfers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions