import "@opengsn/gsn/contracts/BaseRelayRecipient.sol";
// import "@openzeppelin/contracts/metatx/ERC2771Context.sol";
// OR MyContract is ERC2771Context
contract MyContract is BaseRelayRecipient {
* Set the trustedForwarder address either in constructor or
* in other init function in your contract
// OR constructor(address _trustedForwarder) public ERC2771Context(_trustedForwarder)
constructor(address _trustedForwarder) public {
trustedForwarder = _trustedForwarder;
* You should add one setTrustedForwarder(address _trustedForwarder)
* method with onlyOwner modifier so you can change the trusted
* forwarder address to switch to some other meta transaction protocol
* if any better protocol comes tomorrow or the current one is upgraded.
* Override this function.
* This version is to keep track of BaseRelayRecipient you are using
function versionRecipient() external view override returns (string memory) {