CallbackHandler
Abstract contract · src/core/utils/CallbackHandler.sol
Explained in: The DAO contract
Author: Aragon X - 2022-2023
This contract handles callbacks by registering a magic number together with the callback function's selector. It provides the _handleCallback function that inheriting contracts have to call inside their fallback() function (_handleCallback(msg.callbackSelector, msg.data)). This allows to adaptively register ERC standards (e.g., ERC-721, ERC-1115, or future versions of ERC-165) and returning the required magic numbers for the associated callback functions for the inheriting contract so that it doesn't need to be upgraded.
Dev: This callback handling functionality is intended to be used by executor contracts (i.e.,
DAO.sol).
security-contact: sirt@aragon.org
Events
CallbackReceived
event CallbackReceived(address sender, bytes4 indexed sig, bytes data)Emitted when _handleCallback is called.
| Parameter | Type | Description |
|---|---|---|
sender | address | Who called the callback. |
sig | bytes4 | The function signature. |
data | bytes | The calldata. |
Errors
UnknownCallback
error UnknownCallback(bytes4 callbackSelector, bytes4 magicNumber)Thrown if the callback function is not registered.
| Parameter | Type | Description |
|---|---|---|
callbackSelector | bytes4 | The selector of the callback function. |
magicNumber | bytes4 | The magic number to be registered for the callback function selector. |