松露测试文件中以下两个对象之间有什么区别:
const simpleStorage = artifacts.require('SimpleStorage');
const instance = await simpleStorage.new({from: accounts[0]);
命名可能有点混乱。可以对其进行一些更改以使其更具可读性:
第一行正在创建Class。
const SimpleStorage = artifacts.require('SimpleStorage');
第二个是部署Class的instance(代码缺少await
)。
const instance = await SimpleStorage.new({from: accounts[0]);