Openzeppelin-contracts: Learn-about-tokens code snippet doesn't compile

Created on 11 Dec 2018  Â·  1Comment  Â·  Source: OpenZeppelin/openzeppelin-contracts

I'm following https://openzeppelin.org/api/docs/learn-about-tokens.html which contains the following snippet:

contract DoggoToken is ERC20, ERC20Detailed, ERC20Mintable, ERC20Burnable {

    constructor(
        string name,
        string symbol,
        uint8 decimals,
        address[] minters
    )
        ERC20Burnable()
        ERC20Mintable(minters)
        ERC20Detailed(name, symbol, decimals)
        ERC20()
        public
    {}
}

Compiling using

○ → npx truffle version
Truffle v4.1.14 (core: 4.1.14)
Solidity v0.4.24 (solc-js)

I get the following error

(...)
  ERC20Mintable(minters)
  ^--------------------^
Compilation failed. See above.

And that's because ERC20Mintable doesn't expect minters in the constructor. I'm not sure how to fix though, just starting with Solidity/OZ.

bug documentation

Most helpful comment

Hey there @vanjan, thanks for reporting this. Indeed, the example is wrong, it should read:

contract DoggoToken is ERC20, ERC20Detailed, ERC20Mintable, ERC20Burnable {
    constructor(
        string name,
        string symbol,
        uint8 decimals
    )
        ERC20Burnable()
        ERC20Mintable(
        ERC20Detailed(name, symbol, decimals)
        ERC20()
        public
    {}
}

We're currently in the process of revamping the docsite, updating old guides, etc. (including letting users improve it themselves!), and this is one of the first things I intend to fix. Sorry about this!

>All comments

Hey there @vanjan, thanks for reporting this. Indeed, the example is wrong, it should read:

contract DoggoToken is ERC20, ERC20Detailed, ERC20Mintable, ERC20Burnable {
    constructor(
        string name,
        string symbol,
        uint8 decimals
    )
        ERC20Burnable()
        ERC20Mintable(
        ERC20Detailed(name, symbol, decimals)
        ERC20()
        public
    {}
}

We're currently in the process of revamping the docsite, updating old guides, etc. (including letting users improve it themselves!), and this is one of the first things I intend to fix. Sorry about this!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nventuro picture nventuro  Â·  4Comments

LogvinovLeon picture LogvinovLeon  Â·  4Comments

frangio picture frangio  Â·  3Comments

rstormsf picture rstormsf  Â·  4Comments

xiaoyao1991 picture xiaoyao1991  Â·  3Comments