I'm still new with the solidity and it seems to be a very basics question. What i'm trying to do is to call the link the compound smart contract with mine. And when i try to compile is complaining : "This contract may be abstract, not implement an abstract parent's methods completely or not invoke an inherited contract's constructor correctly." while i try input into the testnet .I would appreciate greatly if anyone could help:

pragma solidity ^0.5.12;

contract testCompound {

    address cethAddress = 0x42a628e0c5F3767930097B34b08dCF77e78e4F2B; //Ropsten - Mainnet 0x4ddc2d193948926d02f9b1fe9e1daa0718270ed5
    address cusdcAddress = 0x43a1363AFB28235720FCbDF0C2dAb7759091F7e0; //Ropsten - Mainnet 0x39aa39c021dfbae8fac545936693ac917d5e7563

    ERC20 usdc = ERC20(0xFE724a829fdF12F7012365dB98730EEe33742ea2); //Ropsten - Mainnet 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48
   // ERC20 eth = ERC20(0x00eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee); 

    address owner;
    //CompoundERC20 private cethCompound;
    CompoundERC20 private cusdcCompound;

    constructor() public {
        owner = msg.sender;
        usdc = ERC20(0xFE724a829fdF12F7012365dB98730EEe33742ea2);
      //  cethCompound = CompoundERC20(cethAddress);
        cusdcCompound = CompoundERC20(cusdcAddress);

    function mint(uint256 mintAmount) external returns (bool){
        //usdc.approve(cusdcAddress, mintAmount);
        return true;


contract CompoundERC20 {
  function approve ( address spender, uint256 amount ) external returns ( bool );
  function mint ( uint256 mintAmount ) external returns ( uint );

contract ERC20 {
    function totalSupply() external view returns (uint supply);
    function balanceOf(address _owner) external view returns (uint balance);
    function transfer(address _to, uint _value) external returns (bool success);
    function transferFrom(address _from, address _to, uint _value) external returns (bool success);
    function approve(address _spender, uint _value) external returns (bool success);
    function allowance(address _owner, address _spender) external view returns (uint remaining);
    function decimals() external view returns(uint digits);
    event Approval(address indexed _owner, address indexed _spender, uint _value);
  • can you explain what did you do, what are you expecting to happen and what is the result you got. – Sanjay S B Nov 10 '19 at 14:40

I did not completely understand your requirement or issue you are facing, but I copied the contract you shared to remix. I am able to reproduce the error you have mentioned...

This contract may be abstract, not implement an abstract parent's methods completely or not invoke an inherited contract's constructor correctly.

This is when you try to deploy the Contracts, ERC20 or CompoundERC20. In your code, these are mere definitions or interfaces that are just the abstractions, an implementation should be following. Your code itself has the application of such abstractions. The line

ERC20 usdc = ERC20(0xFE724a829fdF12F7012365dB98730EEe33742ea2);

basically tells the compiler that there is a contract at the address 0xFE724a829fdF12F7012365dB98730EEe33742ea2 that will have implemented the functions whose signatures are specified later in your code as contract ERC20 { ... }. This enables you to use the usdc variable to write code that enables your contract to send messages(call functions in another contract).

| improve this answer | |
  • Hi Sanjay, what I'm trying to achieve is to link the call ERC20 and Compound Smart contract functions in my own smart contract. From my understanding, we need define the the function we want to call e.g. mint function in Compound contract. So I was wondering how come the error is occuring "This contract may be abstract, not implement an abstract parent's methods completely or not invoke an inherited contract's constructor correctly." If you could help me understand better? Thank you. – I Yeu C Nov 11 '19 at 4:57
  • In your CompoundERC20 contract there is only the signature of the functions. You have to define some logic for the functions to be actually callable. – Sanjay S B Nov 11 '19 at 8:46
  • Hi Sanjay, could you share some examples with me to allow me to have a better idea? – I Yeu C Nov 11 '19 at 13:35
  • there are a bunch of examples here github.com/OpenZeppelin/openzeppelin-contracts/tree/master/… – Sanjay S B Nov 12 '19 at 4:46

I managed to find out what the issue with the compile, I always been deploying to the wrong contract:Deployment of smart contract

It seems like the list highlighted is in alphabetical order, therefore unknowing I always have been trying to deploy the abstract/interface contract which prompt the error. All I need to do is to go to the drop down and select my contract and it would work.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.