I’m trying to build a token with its ticker, name, and decimals specified, while also being burnable. I’m importing ERC20Detailed and ERC20Burnable. But my Remix compiler throws:
browser/GGCoin.sol:4:1: DeclarationError: Identifier already declared. import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v2.5.0/contracts/token/ERC20/ERC20Burnable.sol"; ^--------------------------------------------------------------------------------------------------------------------------^ https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.5.0/contracts/token/ERC20/IERC20.sol:7:1: The previous declaration is here: interface IERC20 { ^ (Relevant source part starts here and spans across multiple lines).
I suspect this is because both ERC20Detailed and ERC20Burnable are inheriting from IERC20.
Environment
Remix IDE
OpenZeppelin Contracts v2.5.0
Solidity 0.5.0
Code to reproduce
pragma solidity ^0.5.0;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.5.0/contracts/token/ERC20/ERC20Detailed.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v2.5.0/contracts/token/ERC20/ERC20Burnable.sol";
contract GGCoin is ERC20Burnable, ERC20Detailed {
address owner;
constructor () public ERC20Detailed("GGCoin", "GGC", 2) {
_mint(msg.sender, 100000);
owner = msg.sender;
}
function mint(uint256 amount) public {
require(msg.sender == owner);
_mint(msg.sender, amount);
}
}
Is it possible to inherit from both ERC20Detailed and ERC20Burnable, without getting this error? Maybe I have to call the constructor differently?