最近,我开始学习如何使用安全帽与智能契约进行交互和部署,并且我注意到,虽然brownie可以接受用于链式事务的from
地址字段,但不接受。
例如,部署Box
合同并调用接受整数的函数store
的Barebone代码:
Brownie
box = Box.deploy({"from": account})
box_tx = box.store(42, {"from": account})
*hardhat
const box = await deploy("Box", {
from: account,
args: [],
});
const boxTx = await box.store(42)
No,我们如何添加一个帐户?发布于 2022-05-13 16:40:11
在默认情况下,硬件是使用ethers.js的,您可以阅读有关overrides
的内容。
你可以这样称呼它
const boxTx = await box.store(42, {
from: account
})
希望这能回答你的问题
发布于 2022-08-15 17:18:04
相同的这个问题在这里得到解决。上的官方以太github回购。
注意:默认情况下,ethers.getSigners
方法返回的帐户列表中的第一个帐户(即0索引的签名者)用于所有合同部署和所有事务。
const [_, secondSigner, thirdSigner] = await ethers.getSigners();
await box.connect(secondSigner).store(42);
await box.connect(thirdSigner).store(42);
https://ethereum.stackexchange.com/questions/128159
复制相似问题