Solidity

測試最佳實踐中的安全帽部署程序

  • October 17, 2021

為了測試契約,我從松露換成了安全帽。但我不知道如何在測試中更改本地測試的部署者帳戶……

在松露中: aContract = await contract.deployed(anyParameter, {from: deployAccount})

安全帽(參數+部署程序)的對應行是什麼?

基本上:

factory = await Factory.connect(deployAccount).deploy(parameters);

全面部署:

[owner, addr1, addr2] = await ethers.getSigners();
const Factory = await ethers.getContractFactory("Factory");
factory = await Factory.connect(addr1).deploy(parameters);
await factory.deployed();

引用自:https://ethereum.stackexchange.com/questions/111713