Skip to content

Commit

Permalink
fix: cache context user before delete when detach context
Browse files Browse the repository at this point in the history
  • Loading branch information
thaixuandang committed Jul 29, 2024
1 parent f3c15bc commit 58586fa
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/REP15.sol
Original file line number Diff line number Diff line change
Expand Up @@ -386,14 +386,15 @@ abstract contract REP15 is ERC721, IREP15, IREP15Errors {
}
}

address contextUser = _tokenContext[tokenId][ctxHash].user;
delete _tokenContext[tokenId][ctxHash];
_removeAttachedContext(tokenId, ctxHash);

if (emitEvent) emit ContextDetached(ctxHash, tokenId);

address controller = _contexts[ctxHash].controller;
if (controller.code.length > 0) {
try IREP15ContextCallback(controller).onExecDetachContext(ctxHash, tokenId, _tokenContext[tokenId][ctxHash].user, operator, data) { } catch { }
try IREP15ContextCallback(controller).onExecDetachContext(ctxHash, tokenId, contextUser, operator, data) { } catch { }
}
}

Expand Down

0 comments on commit 58586fa

Please sign in to comment.