-2

As IVotes is a interface and cannot be deployed.

    IVotes public immutable token;

    constructor(IVotes tokenAddress) {
        token = tokenAddress;
    }
....

Error: *** Deployment Failed ***

"IVotes" is an abstract contract or an interface and cannot be deployed.

  • Import abstractions into the '.sol' file that uses them instead of deploying them separately.
  • Contracts that inherit an abstraction must implement all its method signatures exactly.
  • A contract that only implements part of an inherited abstraction is also considered abstract.

I want to use IVotes address passing in GovernorVotes constructor. I tried bunch of methods but none works

1 Answers1

1

The Solidity snippet, that you shared, expects a contract on the tokenAddress to implement the IVotes interface.

But it needs to be a "full" contract with all function bodies - not just the function declarations.

Petr Hejda
  • 40,554
  • 8
  • 72
  • 100
  • it require the deployed contract address as a parameter which i am not able to understand how to get it as it is a interface contract(cannot be deployed). – Yakshesh Gupta Aug 20 '22 at 18:38
  • @YaksheshGupta You need to either obtain the address of an existing contract (that implements the interface) or create the contract yourself (again a contract that implements the interface).... Please note that there is a difference between an interface (doesn't have the function bodies - only function names, input params and output params) and a contract (does have function bodies). A simple description is also that a contract implements an interface by creating the function bodies for the function names declared in the interface. – Petr Hejda Aug 20 '22 at 19:29
  • I made a contract that usses all the function of the interface and its working now, Thanks – Yakshesh Gupta Aug 21 '22 at 16:25