10得票3回答
如何限制代币接收者调用者到被接受的代币地址?

我想创建一个可支付代币,其中包括一个函数transferAndCall(TokenReceiver to, uint256 amount, bytes4 selector)。通过调用此函数,您可以将代币转移到TokenReceiver智能合约地址,然后在接收器上调用onTransferRece...

10得票1回答
从 hardhat 的交易收据中获取事件

我有一个ethers合约,我已经进行了一笔交易: const randomSVG = new ethers.Contract(RandomSVG.address, RandomSVGContract.interface, signer) let tx = await randomSVG.cr...

10得票4回答
在Hardhat最新版本2.9.9中,“npx hardhat accounts”不可用。

我已经安装了最新版本的Hardhat。它已经成功安装。 在设置好Hardhat并安装所有所需软件包之后,当我运行以下命令时: npx hardhat accounts 它会出现错误: Error HH303: Unrecognized task accounts 最新版的Hard...

9得票2回答
ethers.getContractAt() 文档说明。

请问有人能指引我到官方或非官方的文档,来说明函数 ethers.getContractAt() 的作用: 这个问题的原始背景如下: vrfCoordinator = await ethers.getContractAt('VRFCoordinatorMock', VRFCoordinato...

9得票6回答
无效的地址或ENS名称。

我不明白问题出在哪里。当我运行应用程序时,我遇到了这个错误: Unhandled Runtime Error Error: invalid address or ENS name (argument="name", value=5.050201689117535e+47, code=INVA...

9得票3回答
VScode Solidity扩展程序-找不到openzepplin导入

我正在尝试使用一份非常简单的Solidity合约开始工作,但是VSCode给了我很大的困扰。 我正在使用Juan Blancos的solidity插件,但是VSCode无法找到openzepplin的导入文件: import "@openzeppelin/contracts/token/E...

9得票9回答
连接本地主机出错,经过npm hardhat run后。

我刚开始使用Hardhat部署智能合约,并遵循这篇教程:https://dev.to/dabit3/the-complete-guide-to-full-stack-ethereum-development-3j13。但是,在运行npx hardhat run scripts/deploy.j...

8得票7回答
Hardhat配置错误HH100:网络goerli不存在。

我正在尝试在Goerli上部署一个合约,但一直收到错误提示Error HH100: Network goerli doesn't exist 这是我的hardhat.config.ts文件 require("dotenv").config(); import { task } from 'h...

8得票7回答
"hardhat" 模块没有导出名为 "ethers" 的成员。

当我想从 hardhat 导入 ethers 时,它会抛出我在标题中提到的错误。以下是完整版本: - error TS2305: Module '"hardhat"' has no exported member 'ethers'. 2 import { ethers } f...

8得票2回答
如何在使用 --constructor-args 参数的情况下运行 Hardhat?

我正在尝试使用Hardhat运行一个脚本以部署一个带有构造函数参数的合约。当我运行npx hardhat run scripts\deploy.js --network rinkeby时,我得到以下错误: Error: missing argument: in Contract constr...