_setTrustedForwarder() returning a tuple

Hey Everyone,

I am very new to GSN and am trying to incorporate it in my Dapp. I’m currently playing around with GSN on a test project and running into a few errors.

Here is the contract:

//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;

import "@opengsn/contracts/src/BaseRelayRecipient.sol";
import "hardhat/console.sol";

contract Greeter is BaseRelayRecipient {
    string public override versionRecipient = "2.0.0";
    string private greeting;

    constructor(string memory _greeting, address forwarder) {
        greeting = _greeting;
        trustedForwarder = _setTrustedForwarder(forwarder);

    function greet() public view returns (string memory) {
        return greeting;

    function setGreeting(string memory _greeting) public {
        console.log("Changing greeting from '%s' to '%s'", greeting, _greeting);
        greeting = _greeting;

And here is the Error:

TypeError: Expression has to be an lvalue.
  --> contracts/Greeter.sol:12:9:
12 |         trustedForwarder = _setTrustedForwarder(forwarder);
   |         ^^^^^^^^^^^^^^^^

TypeError: Type tuple() is not implicitly convertible to expected type function () view returns (address).
  --> contracts/Greeter.sol:12:28:
12 |         trustedForwarder = _setTrustedForwarder(forwarder);
   |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Error HH600: Compilation failed

I’ve tried looking at a few other discussions and none have been able to resolve the issue. So, anything help will be greatly appreciated! :smile:

Hey, the issue is you are trying to assign the result of _setTrustedForwarder to trustedForwarder. This is unneeded, you can just call the _setTrustedForwarder function and it will handle the assignment internally. No need to assign anything to trustedForwarder in your contract.

Hey Diggle,

Thank you very much for your help!!