# ERC2771Recipient
The ERC-2771 Recipient Base Abstract Class - Implementation
Note that this contract was called BaseRelayRecipient
in the previous revision of the GSN.
A base contract to be inherited by any contract that want to receive relayed transactions.
A subclass must use _msgSender()
instead of msg.sender
.
# Functions
# getTrustedForwarder()
→ address forwarder
(public)
⚠️ Warning ⚠️ The Forwarder can have a full control over your Recipient. Only trust verified Forwarder. Method is not a required method to allow Recipients to trust multiple Forwarders. Not recommended yet.
# Return values
The address of the Forwarder contract that is being used.
# _setTrustedForwarder(address _forwarder)
(internal)
# isTrustedForwarder(address forwarder)
→ bool
(public)
⚠️ Warning ⚠️ The Forwarder can have a full control over your Recipient. Only trust verified Forwarder.
forwarder: The address of the Forwarder contract that is being used.
# Return values
true
if the Forwarder is trusted to forward relayed transactions by this Recipient.
# _msgSender()
→ address ret
(internal)
Use this method the contract anywhere instead of msg.sender to support relayed transactions.
# Return values
The real sender of this call.
For a call that came through the Forwarder the real sender is extracted from the last 20 bytes of the msg.data
.
Otherwise simply returns msg.sender
.
# _msgData()
→ bytes ret
(internal)
Use this method in the contract instead of msg.data
when difference matters (hashing, signature, etc.)
# Return values
The real msg.data
of this call.
For a call that came through the Forwarder, the real sender address was appended as the last 20 bytes
of the msg.data
- so this method will strip those 20 bytes off.
Otherwise (if the call was made directly and not through the forwarder) simply returns msg.data
.