我正在基于 BEP20Token 模板(https://github.com/binance-chain/bsc-genesis-contract/blob/master/contracts/bep20_template/BEP20Token.template )创建智能合约(BEP20 代币)。公共构造函数被修改以添加一些令牌详细信息。然而,所有标准函数都会出现编译时问题,例如缺少覆盖函数。
**这是源代码**
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.2;
interface IBEP20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the token decimals.
*/
function decimals() external view returns (uint8);
/**
* @dev Returns the token symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the token name.
*/
function name() external view returns (string memory);
/**
* @dev …Run Code Online (Sandbox Code Playgroud) 尝试使用 Hardhat 部署智能合约但出现配置错误。
这是完整的错误详细信息
Error HH9: Error while loading Hardhat's configuration.
You probably tried to import the "hardhat" module from your config or a file imported from it.
This is not possible, as Hardhat can't be initialized while its config is being defined.
Run Code Online (Sandbox Code Playgroud)
所有插件似乎都已正确安装。
部署.js
const hre = require("hardhat");
async function main() {
const TestContract = await hre.ethers.getContractFactory("TestContract");
const superInstance = await TestContract.deploy("TestContractHAT", "SMC");
await superInstance.deployed();
console.log("contract was deployed to:", superInstance.address());
}
// We recommend this pattern to be able …Run Code Online (Sandbox Code Playgroud)