Module to add more functionalities to a contract using extensions.
Implementation of the
fallback(...) logic according to LSP17
- Contract Extension standard. This module can be inherited to extend the functionality of the parent contract when calling a function that doesn't exist on the parent contract via forwarding the call to an extension mapped to the function selector being called, set originally by the parent contract
Public methods are accessible externally from users, allowing interaction with this function from dApps or other smart contracts. When marked as 'public', a method can be called both externally and internally, on the other hand, when marked as 'external', a method can only be called externally.
function supportsInterface(bytes4 interfaceId) external view returns (bool);
Any method labeled as
internal serves as utility function within the contract. They can be used when writing solidity contracts that inherit from this contract. These methods can be extended or modified by overriding their internal behavior to suit specific needs.
Internal functions cannot be called externally, whether from other smart contracts, dApp interfaces, or backend services. Their restricted accessibility ensures that they remain exclusively available within the context of the current contract, promoting controlled and encapsulated usage of these internal utilities.
) internal view returns (bool);
Returns whether the interfaceId being checked is supported in the extension of the
To be used by extendable contracts wishing to extend the ERC165 interfaceIds originally
supported by reading whether the interfaceId queried is supported in the
extension if the extension is set, if not it returns false.
function _getExtension(bytes4 functionSelector) internal view returns (address);
Returns the extension mapped to a specific function selector If no extension was found, return the address(0) To be overrided. Up to the implementor contract to return an extension based on a function selector
) internal nonpayable returns (bytes);
Forwards the call to an extension mapped to a function selector.
_getExtension to get the address of the extension mapped to the function selector being
called on the account. If there is no extension, the address(0) will be returned.
Reverts if there is no extension for the function being called.
If there is an extension for the function selector being called, it calls the extension with the
CALL opcode, passing the
msg.data appended with the 20 bytes of the
32 bytes of the
Because the function uses assembly
return()/revert() to terminate the call, it cannot be
called before other codes in fallback().
Otherwise, the codes after _fallbackLSP17Extendable() may never be reached.