Skip to content

Solidity API

ERC2771Internal

Abstract contract implementing ERC2771 meta-transactions support. This contract extends OpenZeppelin's Context contract to provide trusted forwarder functionality for meta-transactions.

_isTrustedForwarder

solidity
function _isTrustedForwarder(address forwarder) internal view virtual returns (bool)

Checks if the given address is a trusted forwarder.

Parameters

NameTypeDescription
forwarderaddressThe address to check.

Return Values

NameTypeDescription
[0]boolbool True if the address is a trusted forwarder, false otherwise.

_msgSender

solidity
function _msgSender() internal view virtual returns (address sender)

_Overrides the msgSender() function to support meta-transactions. If the message sender is a trusted forwarder, it extracts the original sender from the last 20 bytes of the calldata. Otherwise, it falls back to the default behavior.

Return Values

NameTypeDescription
senderaddressThe address of the original transaction sender.

_msgData

solidity
function _msgData() internal view virtual returns (bytes)

_Overrides the msgData() function to support meta-transactions. If the message sender is a trusted forwarder, it returns the calldata excluding the last 20 bytes (which contain the original sender address). Otherwise, it falls back to the default behavior.

Return Values

NameTypeDescription
[0]bytesbytes calldata The original calldata, potentially truncated for meta-transactions.