Prepare the Forwarder Contract
We will be using Remix web IDE to compile and deploy Smart Contracts to the Blockchain, and a production-ready Forwarder from OpenZeppelin that relays operation requests signed off-chain by an EOA (Externally Owned Account).
Remix IDE
Create a new file in Remix and name it
CounterForwarder.Paste this code in the file as shown in the image below 1.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import "@openzeppelin/contracts/metatx/ERC2771Forwarder.sol";
Then compile the file using compiler version 0.8.20+. After that you go to DEPLOY & RUN TRANSACTIONS tab and select from the
Environmentdrop down Injected Provider - MetaMask 2.Make sure the correct contract is selected in the
Contractdrop down which isERC2771Forwarder3.Lastly you need to provide a Forwarder Name for the
ERC2771Forwarderconstructor in order to deploy this contract. Let's set it toCounterForwarderas seen in the image below 4.
