contracts
contracts copied to clipboard
fix: optimize state changes order in _unsafeTransfer
Reorder state changes in _unsafeTransfer function to follow best practices:
- First clear old state (delete idOf[from])
- 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 thefromaddress before transferring. - Updated
idOf[to] = id;to assign the ID to thetoaddress. - Emitted a
Transferevent after the ID transfer.
✨ Ask PR-Codex anything about this PR by commenting with
/codex {your question}