Ethereum hardhat - NomicLabsHardhatPluginError: abstract contract factory for the contract ERC1155Facet can't be deployed

Ethereum hardhat - NomicLabsHardhatPluginError: abstract contract factory for the contract ERC1155Facet can't be deployed

我正在尝试在 Ethereum 的 solidity 和 nomiclabs hardhat 中使用抽象合约部署智能合约。

但我的 'test.ts' 脚本中一直出现以下错误。

可能是什么问题?

提前致谢!

错误:


"before all" hook for "Check that all functions and facets exist in the diamond":
     
NomicLabsHardhatPluginError: You are trying to create a contract factory for the contract ERC1155Facet, which is abstract and can't be deployed.
If you want to call a contract using ERC1155Facet as its interface use the "getContractAt" function instead.
at getContractFactoryByName (node_modules\@nomiclabs\hardhat-ethers\src\internal\helpers.ts:112:11)
at deployFacets (test\test.js:74:25)
at Context.<anonymous> (test\test.js:90:9)

ERC 合约代码如下所示:

ERC1155MintBurnPB.sol:


abstract contract ERC1155MintBurnPB is ERC1155PB { }

ERC1155PB.sol:


abstract contract ERC1155PB is IERC1155 { }

ERC1155Facet.sol


abstract contract ERC1155Facet is ERC1155MintBurnPB { }

test.ts长这样:

...
...
const factory = await ethers.getContractFactory(facet, signer);
...
...

抽象合同不可部署。它们可用于继承自定义常规合约的基础功能。

从您要部署的合约中删除 abstract 关键字,然后重试!