工件与工件之间的差异。松露中的新特性

问题描述 投票:0回答:1

松露测试文件中以下两个对象之间有什么区别:

  1. const simpleStorage = artifacts.require('SimpleStorage');
  2. const instance = await simpleStorage.new({from: accounts[0]);
blockchain ethereum smartcontracts truffle
1个回答
0
投票

命名可能有点混乱。可以对其进行一些更改以使其更具可读性:

第一行正在创建Class

const SimpleStorage = artifacts.require('SimpleStorage');

第二个是部署Classinstance(代码缺少await)。

const instance = await SimpleStorage.new({from: accounts[0]);
© www.soinside.com 2019 - 2024. All rights reserved.