Skip to content

Commit

Permalink
Add ERC2771Forwarder as an enhanced successor to MinimalForwarder (
Browse files Browse the repository at this point in the history
…OpenZeppelin#4346)

Co-authored-by: Francisco <fg@frang.io>
  • Loading branch information
ernestognw and frangio committed Jul 3, 2023
1 parent 9af096b commit 25a8150
Showing 1 changed file with 4 additions and 23 deletions.
27 changes: 4 additions & 23 deletions contracts/metatx/ERC2771Forwarder.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

pragma solidity ^0.8.19;

import {ECDSA} from "../utils/cryptography/ECDSA.sol";
import {EIP712} from "../utils/cryptography/EIP712.sol";
import {Nonces} from "../utils/Nonces.sol";
import {Address} from "../utils/Address.sol";
import "../utils/cryptography/ECDSA.sol";
import "../utils/cryptography/EIP712.sol";
import "../utils/Nonces.sol";
import "../utils/Address.sol";

/**
* @dev A forwarder compatible with ERC2771 contracts. See {ERC2771Context}.
Expand All @@ -20,25 +20,6 @@ import {Address} from "../utils/Address.sol";
* * `nonce`: A unique transaction ordering identifier to avoid replayability and request invalidation.
* * `deadline`: A timestamp after which the request is not executable anymore.
* * `data`: Encoded `msg.data` to send with the requested call.
*
* Relayers are able to submit batches if they are processing a high volume of requests. With high
* throughput, relayers may run into limitations of the chain such as limits on the number of
* transactions in the mempool. In these cases the recommendation is to distribute the load among
* multiple accounts.
*
* ==== Security Considerations
*
* If a relayer submits a forward request, it should be willing to pay up to 100% of the gas amount
* specified in the request. This contract does not implement any kind of retribution for this gas,
* and it is assumed that there is an out of band incentive for relayers to pay for execution on
* behalf of signers. Often, the relayer is operated by a project that will consider it a user
* acquisition cost.
*
* By offering to pay for gas, relayers are at risk of having that gas used by an attacker toward
* some other purpose that is not aligned with the expected out of band incentives. If you operate a
* relayer, consider whitelisting target contracts and function selectors. When relaying ERC-721 or
* ERC-1155 transfers specifically, consider rejecting the use of the `data` field, since it can be
* used to execute arbitrary code.
*/
contract ERC2771Forwarder is EIP712, Nonces {
using ECDSA for bytes32;
Expand Down

0 comments on commit 25a8150

Please sign in to comment.