Questions for Tronsave SDK

Q. Which ERC20 Tokens are supported as payments?

TronSave relayers will initially support payments in WTRX. In the future, dApps can also participate in a relayer network and collect fees in tokens of their choice.

Q. My contract is using OpenZeppelin. How do I add GSN support?

Here is a sample on how to use GSN with OpenZeppelin contracts. The _msgData and _msgSender methods methods of OpenZeppelin's Context base-contract are used by all other contracts, and thus the hooks below are enough to support tokens, Ownable, roles, etc.

(Note that OpenZeppelin's GSNRecipient is for GSN v1.0, and should not be used anymore)

pragma solidity ^0.8;

import "@opengsn/contracts/src/ERC2771Recipient.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract MyContract is ERC2771Recipient, ERC20 {

  constructor(string memory name_, string memory symbol_, address forwarder_) 
    ERC20(name_, symbol_) {
    _setTrustedForwarder(forwarder_);
  }

  string public override versionRecipient = "2.2.0";

  function _msgSender() internal view override(Context, ERC2771Recipient)
      returns (address sender) {
      sender = ERC2771Recipient._msgSender();
  }

  function _msgData() internal view override(Context, ERC2771Recipient)
      returns (bytes calldata) {
      return ERC2771Recipient._msgData();
  }
}

You can use instead OpenZeppelin's ERC2771Context, which is an equivalent implementation of ERC2771Recipient.

Last updated