Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wrapper for Approve - Allow #62

Open
Lomet opened this issue Feb 14, 2024 · 0 comments
Open

wrapper for Approve - Allow #62

Lomet opened this issue Feb 14, 2024 · 0 comments

Comments

@Lomet
Copy link
Member

Lomet commented Feb 14, 2024

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant