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

Support approved for all for ERC721 tokens #1300

Open
payvint opened this issue Oct 11, 2022 · 1 comment · May be fixed by #1302
Open

Support approved for all for ERC721 tokens #1300

payvint opened this issue Oct 11, 2022 · 1 comment · May be fixed by #1302
Assignees
Labels

Comments

@payvint
Copy link
Collaborator

payvint commented Oct 11, 2022

There are 2 standard functions for approve:
approve
setApprovalForAll

There are no call in ERC721 standard functions to check is ERC721 tokenId is approved for given address or approved all tokenIds for given address to check it in one function.

So we need to check two functions at once, but currently we check only is tokenId approved for given address.

So we need to change the check in DepositBoxERC721:

IERC721Upgradeable(erc721OnMainnet).getApproved(tokenId) == address(this),

on

IERC721Upgradeable(erc721OnMainnet).getApproved(tokenId) == address(this) || 
IERC721Upgradeable(erc721OnMainnet).isApprovedForAll(msg.sender, address(this)),

And in TokenManagerERC721 and TokenManagerERC721WithMetadata

require(contractOnSchain.getApproved(tokenId) == address(this), "Not allowed ERC721 Token");

on

require(
contractOnSchain.getApproved(tokenId) == address(this) || 
contractOnSchain.isApprovedForAll(msg.sender, address(this)), 
"Not allowed ERC721 Token"
);

Also add test

@payvint payvint assigned payvint and yavrsky and unassigned payvint Oct 11, 2022
@payvint payvint added enhancement New feature or request do-not-merge IMA labels Oct 11, 2022
@gannakulikova
Copy link
Contributor

Need to be released in the granular upgrade

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Code Review
Development

Successfully merging a pull request may close this issue.

3 participants