# ERC20 with GSN

**URL:** <https://forum.openzeppelin.com/t/erc20-with-gsn/2174>\
**Category:** SDK\
**Created:** [January 29, 2020, 2:42pm UTC](https://forum.openzeppelin.com/t/erc20-with-gsn/2174 "2020-01-29T14:42:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Casper](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/casper/32/1641_2.png) [@Casper](https://forum.openzeppelin.com/u/Casper)\
**Post date:** [January 29, 2020, 2:42pm UTC](https://forum.openzeppelin.com/t/erc20-with-gsn/2174/1 "2020-01-29T14:42:10Z")

</div>

Hello. How to do it right?

```
pragma solidity ^0.5.0;

import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20Detailed.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20Mintable.sol";
import "@openzeppelin/upgrades/contracts/Initializable.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/GSN/GSNRecipient.sol";

contract GLDToken is Initializable, ERC20, ERC20Detailed, ERC20Mintable, GSNRecipient {
    function initialize(uint256 initialSupply) public initializer {
        ERC20Detailed.initialize("Gold", "GLD", 18);
        _mint(_msgSender(), initialSupply);
    }

    function acceptRelayedCall(
        address relay,
        address from,
        bytes calldata encodedFunction,
        uint256 transactionFee,
        uint256 gasPrice,
        uint256 gasLimit,
        uint256 nonce,
        bytes calldata approvalData,
        uint256 maxPossibleCharge
    ) external view returns (uint256, bytes memory) {
        return _approveRelayedCall();
    }

    // We won't do any pre or post processing, so leave _preRelayedCall and _postRelayedCall empty
    function _preRelayedCall(bytes memory context) internal returns (bytes32) {
    }

    function _postRelayedCall(bytes memory context, bool, uint256 actualCharge, bytes32) internal {
    }
}

```

> **Select which function** \* initialize()  
> npx oz-gsn fund-recipient --recipient 0x46418e2df00C9Dc013C67f7169e0154DFb25e0d1

But, I do not have "ERC20Detailed" the data my token

or

> **Select which function** \* initialize(initialSupply: uint256)  
> npx oz-gsn fund-recipient --recipient 0x46418e2df00C9Dc013C67f7169e0154DFb25e0d1

I have a mistake: " The relay hub address is set to zero in recipient at.."

How should I do it right? To mint called and ERC20Detailed. And with the GSN on?

Thx

---

<div class="post-metadata">

**Author:** ![nventuro](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/nventuro/32/8_2.png) [@nventuro](https://forum.openzeppelin.com/u/nventuro)\
**Post date:** [January 29, 2020, 7:53pm UTC](https://forum.openzeppelin.com/t/erc20-with-gsn/2174/2 "2020-01-29T19:53:17Z")

</div>

Hello @Casper!

The issue you’re facing is caused by your contract not being fully initialized: you are missing the `initialize` calls for [`ERC20Mintable`](https://github.com/OpenZeppelin/openzeppelin-contracts-ethereum-package/blob/master/contracts/token/ERC20/ERC20Mintable.sol#L14) and (more importantly) [`GSNRecipient`](https://github.com/OpenZeppelin/openzeppelin-contracts-ethereum-package/blob/master/contracts/GSN/GSNRecipient.sol#L21), which should be added to your own `initialize` function.

Once you’ve called all initializers, you will be able to use the `oz-gsn` commands to interact with your contract.

---

<div class="post-metadata">

**Author:** ![Casper](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/casper/32/1641_2.png) [@Casper](https://forum.openzeppelin.com/u/Casper)\
**Post date:** [February 2, 2020, 9:14am UTC](https://forum.openzeppelin.com/t/erc20-with-gsn/2174/3 "2020-02-02T09:14:12Z")

</div>

> [@nventuro](#):
>
> `initialize` функции

Thanks, I just added `GSNRecipient.initialize();`
