Skip to content

Conversation

@crStiv
Copy link

@crStiv crStiv commented Jan 29, 2025

Reorder state changes in _unsafeTransfer function to follow best practices:

  1. First clear old state (delete idOf[from])
  2. Then set new state (idOf[to] and custodyOf[id])
    This change helps prevent potential reentrancy issues and provides clearer state transition.

PR-Codex overview

This PR focuses on modifying the _unsafeTransfer function in the IdRegistry contract to ensure proper handling of the idOf mapping during token transfers.

Detailed summary

  • Added delete idOf[from]; to remove the ID associated with the from address before transferring.
  • Updated idOf[to] = id; to assign the ID to the to address.
  • Emitted a Transfer event after the ID transfer.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

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

Successfully merging this pull request may close these issues.

1 participant