OpenZeppelin ContractsPrevious Versionsv4API Reference

Metatx

Smart contract metatx utilities and implementations

Outdated Version

You're viewing an older version (v4.x) The latest documentation is available for the current version. Click here to visit latest version.

Core

ERC2771Context

Utils

MinimalForwarder

import "@openzeppelin/contracts/metatx/ERC2771Context.sol";

Context variant with ERC2771 support.

The usage of delegatecall in this contract is dangerous and may result in context corruption. Any forwarded request to this contract triggering a delegatecall to itself will result in an invalid ERC2771Context._msgSender recovery.

constructor(address trustedForwarder)

internal

#

isTrustedForwarder(address forwarder) → bool

public

#

_msgSender() → address

internal

#

_msgData() → bytes

internal

#

_contextSuffixLength() → uint256

internal

#

ERC-2771 specifies the context as being a single address (20 bytes).

import "@openzeppelin/contracts/metatx/MinimalForwarder.sol";

Simple minimal forwarder to be used together with an ERC2771 compatible contract. See ERC2771Context.

MinimalForwarder is mainly meant for testing, as it is missing features to be a good production-ready forwarder. This contract does not intend to have all the properties that are needed for a sound forwarding system. A fully functioning forwarding system with good properties requires more complexity. We suggest you look at other projects such as the GSN which do have the goal of building a system like that.

constructor()

public

#

getNonce(address from) → uint256

public

#

verify(struct MinimalForwarder.ForwardRequest req, bytes signature) → bool

public

#

execute(struct MinimalForwarder.ForwardRequest req, bytes signature) → bool, bytes

public

#