My solidity contract compiles in Remix, but when I try to deploy it it fails and throws
Error: This contract may be abstract, not implement an abstract parent's methods completely or not invoke an inherited contract's constructor correctly.
Here is the contract code
pragma solidity ^0.6.0;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20Detailed.sol";
/**
* @title DetailedERC20 token
* @dev The decimals are only for visualization purposes.
* All the operations are done using the smallest and indivisible token unit,
* just as on Ethereum all the operations are done in wei.
*/
abstract contract ExampleToken is ERC20Detailed {
//We inherited the DetailedERC20
constructor(string memory _name, string memory _symbol, uint8 _decimals)
ERC20Detailed(_name, _symbol, _decimals)
public {
}
}
For constructor parameters I used Mooncoin
, MNC
, 6
Best Answer
Contract
ERC20Detailed
inherits from interface IERC20, which declares the following functions:Hence any contract which inherits from contract
ERC20Detailed
needs to implement these functions in order to be deployable.You might also need to get rid of the
abstract
prefix at the beginning of your contract declaration. I'm not familiar with this keyword myself (it was probably added to the language only recently), but I believe that it tells the compiler that the author's intention is to leave some functions unimplemented.