简体   繁体   English

我无法理解如何在GovernorVotes 合约中使用IVotes 合约地址

[英]I am not able to understand how to use IVotes contract address in GovernorVotes contract

As IVotes is a interface and cannot be deployed.因为 IVotes 是一个接口,无法部署。

    IVotes public immutable token;

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

Error: *** Deployment Failed ***错误:*** 部署失败 ***

"IVotes" is an abstract contract or an interface and cannot be deployed. “IVotes”是抽象合约或接口,无法部署。

  • Import abstractions into the '.sol' file that uses them instead of deploying them separately.将抽象导入到使用它们的“.sol”文件中,而不是单独部署它们。
  • 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.我想使用在GovernorVotes 构造函数中传递的IVotes 地址。 I tried bunch of methods but none works我尝试了一堆方法,但没有一个有效

The Solidity snippet, that you shared, expects a contract on the tokenAddress to implement the IVotes interface.您共享的 Solidity 代码段需要tokenAddress上的合约来实现IVotes接口。

But it needs to be a "full" contract with all function bodies - not just the function declarations.但它必须是与所有 function 主体的“完整”合同 - 而不仅仅是 function 声明。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何获取另一个合约部署的合约的地址 - How to get the address of a contract deployed by another contract 如何获得合同创建者的地址 - How to get the address of the contract creator 如何在ganache / truffle / web3中解锁合同地址,以便我可以使用from作为调用函数? - How to unlock a contract address in ganache/truffle/web3 so that I can use it as from to call a function? 在合约构造函数中使用地址 function? - Use of address function inside a contract constructor? 在浏览器或chrome扩展程序中确认交易之前如何获取web3合约地址? - How can I get the web3 contract address before confirming transaction in the browser or chrome extension? Solidity 中合约地址变量会消耗多少状态字节? - How many state bytes will contract address variable consume in Solidity? 如何在订单合同中存储一系列产品合同 - How to store in an orders contract an array of products contract 如何从以太坊中部署的合约部署合约? - How to deploy contract from deployed contract in Ethereum? 如何在我的 Solidity 合约中使用我的 erc20 自定义代币作为所需付款? - How can I use my erc20 custom token as required payment in my solidity contract? 如何发送wei/eth到合约地址? (使用松露 javascript 测试) - How to send wei/eth to contract address? (using truffle javascript test)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM