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

Refactor transferCrossChain to support been extended by user in evm/UniversalNFTCore.sol #45

Open
andresaiello opened this issue Jan 27, 2025 · 0 comments

Comments

@andresaiello
Copy link
Collaborator

Right now transferCrossChain in UniversalNFTCore it's like this:

 function transferCrossChain(
        uint256 tokenId,
        address receiver,
        address destination
    ) external payable {
// code

then if you want to extend it and add custom code, you have to call super.transferCrossChain and as it's external will be expensive. I recommend to refactor like this:

 function transferCrossChain(
        uint256 tokenId,
        address receiver,
        address destination
    ) external payable {
_transferCrossChain(     tokenId,
        receiver,
        destination);
}

 function _transferCrossChain(
        uint256 tokenId,
        address receiver,
        address destination
    ) internal virtual{
// code
}

then if a developer wants to extend it it's just an internal call

@andresaiello andresaiello changed the title Refactor transferCrossChain to support been extended by user Refactor transferCrossChain to support been extended by user in evm/UniversalNFTCore.sol Jan 27, 2025
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