合约代码:
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
import "hardhat/console.sol";
contract Greeter {
string private greeting;
event Log(uint gas);
constructor() {
}
fallback() external payable {
console.log("hello", "");
emit Log(gasleft());
}
receive() external payable {
}
}
js调用的代码:
const Greeter = await ethers.getContractFactory("Greeter");
const greeter = await Greeter.deploy();
await greeter.deployed();
const tx = await greeter.abc();
错误提示:greeter.abc is not a function
反正就是我调用了智能合约里面没有的函数,就会报错的。