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

fix(protocol): use safeTransferFrom to transfer ERC721 to unspecified address to #15416

Closed
wants to merge 2 commits into from

Conversation

paweenpit
Copy link
Contributor

Use safeTransferFrom to ensure target address to implements onERC721received

Copy link

vercel bot commented Dec 26, 2023

@paweenpit is attempting to deploy a commit to the taikoxyz Team on Vercel.

A member of the Team first needs to authorize it.

@paweenpit paweenpit changed the title fix(bridge): use safeTransferFrom to transfer ERC721 to unspecified address to fix(protocol): use safeTransferFrom to transfer ERC721 to unspecified address to Dec 26, 2023
@@ -106,7 +106,7 @@ contract ERC721Vault is BaseNFTVault, IERC721Receiver, IERC165Upgradeable {
if (ctoken.chainId == block.chainid) {
token = ctoken.addr;
for (uint256 i; i < tokenIds.length; ++i) {
ERC721Upgradeable(token).transferFrom({
ERC721Upgradeable(token).safeTransferFrom({
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other .transferFrom in this file sends the ERC721 to address(this) (this contract) which already implements onERC721received. So there is no need to use .safeTransferFrom. Using .transferFrom will optimize a bit more gas.

@dantaik
Copy link
Contributor

dantaik commented Dec 27, 2023

@paweenpit thank you for this PR. Inspired by your change, I made this PR with more changes and bug fixes.#15422

@dantaik dantaik closed this Dec 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants