Context / issue
In #965, the TokenCallbackHandler contract makes a best effort to prevent accidental transfers of tokens to it. However, we can make it better by implementing token rescue for ERC-20, ERC-721 and ERC-1155. This would allow us to remove the "best-effort" transfer prevention functions with a safer, but permissioned, mechanism.
Proposed solution
Add rescueERC* functions for rescuing funds that were accidentally transferred to the TokenCallbackHandler contract.
Note that some careful consideration is needed for integrations like the ERC-4337 module which inherits from the CompatibilityFallbackHandler function and therefore may be "tricked" into calling a Safe.
Context / issue
In #965, the
TokenCallbackHandlercontract makes a best effort to prevent accidental transfers of tokens to it. However, we can make it better by implementing token rescue for ERC-20, ERC-721 and ERC-1155. This would allow us to remove the "best-effort" transfer prevention functions with a safer, but permissioned, mechanism.Proposed solution
Add
rescueERC*functions for rescuing funds that were accidentally transferred to theTokenCallbackHandlercontract.Note that some careful consideration is needed for integrations like the ERC-4337 module which inherits from the
CompatibilityFallbackHandlerfunction and therefore may be "tricked" into calling a Safe.