Skip to main content

TWRouter

Methods

addExtension

function addExtension(string _extensionName) external nonpayable

Adds a new extension to the router.

Parameters

NameTypeDescription
_extensionNamestringundefined

defaultExtensionSet

function defaultExtensionSet() external view returns (address)

The DefaultExtensionSet that stores default extensions of the router.

Returns

NameTypeDescription
_0addressundefined

extensionRegistry

function extensionRegistry() external view returns (address)

The ExtensionRegistry that stores all latest, vetted extensions available to router.

Returns

NameTypeDescription
_0addressundefined

getAllExtensions

function getAllExtensions() external view returns (struct IExtension.Extension[] allExtensions)

Returns all extensions stored. Override default lugins stored in router are given precedence over default extensions in DefaultExtensionSet.

Returns

NameTypeDescription
allExtensionsIExtension.Extension[]undefined

getAllFunctionsOfExtension

function getAllFunctionsOfExtension(string _extensionName) external view returns (struct IExtension.ExtensionFunction[])

Returns all functions that belong to the given extension contract.

Parameters

NameTypeDescription
_extensionNamestringundefined

Returns

NameTypeDescription
_0IExtension.ExtensionFunction[]undefined

getExtension

function getExtension(string _extensionName) external view returns (struct IExtension.Extension)

Returns the extension metadata and functions for a given extension.

Parameters

NameTypeDescription
_extensionNamestringundefined

Returns

NameTypeDescription
_0IExtension.Extensionundefined

getExtensionForFunction

function getExtensionForFunction(bytes4 _functionSelector) external view returns (struct IExtension.ExtensionMetadata)

Returns the Extension metadata for a given function.

Parameters

NameTypeDescription
_functionSelectorbytes4undefined

Returns

NameTypeDescription
_0IExtension.ExtensionMetadataundefined

getExtensionImplementation

function getExtensionImplementation(string _extensionName) external view returns (address)

Returns the extension's implementation smart contract address.

Parameters

NameTypeDescription
_extensionNamestringundefined

Returns

NameTypeDescription
_0addressundefined

getImplementationForFunction

function getImplementationForFunction(bytes4 _functionSelector) external view returns (address extensionAddress)

Returns the extension implementation address stored in router, for the given function.

Parameters

NameTypeDescription
_functionSelectorbytes4undefined

Returns

NameTypeDescription
extensionAddressaddressundefined

multicall

function multicall(bytes[] data) external nonpayable returns (bytes[] results)

Receives and executes a batch of function calls on this contract.

Receives and executes a batch of function calls on this contract.

Parameters

NameTypeDescription
databytes[]The bytes data that makes up the batch of function calls to execute.

Returns

NameTypeDescription
resultsbytes[]The bytes data that makes up the result of the batch of function calls executed.

removeExtension

function removeExtension(string _extensionName) external nonpayable

Removes an existing extension from the router.

Parameters

NameTypeDescription
_extensionNamestringundefined

updateExtension

function updateExtension(string _extensionName) external nonpayable

Updates an existing extension in the router, or overrides a default extension.

Parameters

NameTypeDescription
_extensionNamestringundefined

Events

ExtensionAdded

event ExtensionAdded(address indexed extensionAddress, bytes4 indexed functionSelector, string functionSignature)

Parameters

NameTypeDescription
extensionAddress indexedaddressundefined
functionSelector indexedbytes4undefined
functionSignaturestringundefined

ExtensionRemoved

event ExtensionRemoved(address indexed extensionAddress, bytes4 indexed functionSelector, string functionSignature)

Parameters

NameTypeDescription
extensionAddress indexedaddressundefined
functionSelector indexedbytes4undefined
functionSignaturestringundefined

ExtensionUpdated

event ExtensionUpdated(address indexed oldExtensionAddress, address indexed newExtensionAddress, bytes4 indexed functionSelector, string functionSignature)

Parameters

NameTypeDescription
oldExtensionAddress indexedaddressundefined
newExtensionAddress indexedaddressundefined
functionSelector indexedbytes4undefined
functionSignaturestringundefined