Etherlime CLI命令行界面

Installing & Help

Syntax语法

npm i -g etherlime

Install the global etherlime to allow you to run etherlime commands.

安装全局etherlime,然后让你能够运行etherlime命令

Help寻求帮助

etherlime help

Run this command to give you all possible commands of etherlime + help info

Version查看etherlime版本

etherlime --version

Running this command will give you the current installed etherlime version

etherlime init初始化

Syntax

etherlime init [output]

Parameters:

  • output - [Optional] Defines the way that the logs are shown.Choices:(可选)定义日志显示的方法。选择有
  1. none - silences the output of logs, 停止日志的输出
  2. normal - see verbose logs in the console在控制台查看详细日志
  3. structured - structured output in a file meant for inter program communication.在文件中味了内部项目交流的结构性输出

Running this command will install etherlime in the directory you’ve run it and will create deployment directory with deploy.js prepared for you to use. You can use this file to write your deployment procedure. It also create test directory where you can write your tests. It comes with an exampleTest.js file which you can use as a start point. The init command generate and package.json for you which you can use for your npm modules.

运行这个命令将在目录安装etherlime,运行它你将创建带有准备给你使用的deploy.jsdeployment文件夹。你可以使用这个文件去写你的部署过程。这个命令还创建了可以用来写你的测试的test文件夹,里面带着exampleTest.js文件,你可以使用它作为测试开端。这个init命令还为你使用npm模块生成了package.json

创建文件夹test-etherlime来测试部署,终端返回:

userdeMacBook-Pro:test-etherlime user$ etherlime init
===== Installing etherlime =====
===== Generating package.json ===== > keccak@1.4.0 install /Users/user/test-etherlime/node_modules/keccak
> npm run rebuild || echo "Keccak bindings compilation fail. Pure JS implementation will be used." > keccak@1.4.0 rebuild /Users/user/test-etherlime/node_modules/keccak
> node-gyp rebuild CXX(target) Release/obj.target/keccak/src/addon.o
CC(target) Release/obj.target/keccak/src/libkeccak/KeccakSponge.o
CC(target) Release/obj.target/keccak/src/libkeccak/KeccakP-1600-reference.o
SOLINK_MODULE(target) Release/keccak.node
+ etherlime@0.9.17
added 295 packages from 1034 contributors and audited 547 packages in 37.089s
found 0 vulnerabilities ===== Creating contracts file structure =====
===== Creating tests file structure =====
===== Creating deployment file structure =====
Etherlime was successfully initialized! Check ./deployment/deploy.js for your deployment script.

生成以下文件/文件夹:

etherlime ganache

Syntax

etherlime ganache [port] [output]

Parameters:

  • port - [Optional] By specifying --port you can specify port to run the etherlime ganache. Default: 8545(可选)通过指定--port,你可以指定运行etherlime ganache的端口,默认为8545
  • output - [Optional] Defines the way that the logs are shown. Choices: none - silences the output of logs, normal - see verbose logs in the console and structured - structured output in a file meant for inter program communication.定义展示日志的方法,选择有:none-取消日志的输出,normal-在控制器中查看详细的日志,structured-为了内部项目的交流在文件中进行结构性输出

For easier integration and usage of EtherlimeGanacheDeployer and running local deployments you can use the embedded ganache-cli. It comes with fixed 10 accounts and a lot of ETH (191408831393027885698 to be precise)

为了更简单的合并和EtherlimeGanacheDeployer的使用和运行本地部署,你可以使用嵌套的ganache-cli。它自带准备好的10个账户和许多的ETH(具体有191408831393027885698ETH)

测试-设置port为6658,output为normal:

userdeMBP:~ user$ etherlime ganache  normal
[] Address: 0xd9995bae12fee327256ffec1e3184d492bd94c31 Private key: 0x7ab741b57e8d94dd7e1a29055646bafde7010f38a900f55bbd7647880faa6ee8
[] Address: 0xd4fa489eacc52ba59438993f37be9fcc20090e39 Private key: 0x2030b463177db2da82908ef90fa55ddfcef56e8183caf60db464bc398e736e6f
[] Address: 0x760bf27cd45036a6c486802d30b5d90cffbe31fe Private key: 0x62ecd49c4ccb41a70ad46532aed63cf815de15864bc415c87d507afd6a5e8da2
[] Address: 0x56a32fff5e5a8b40d6a21538579fb8922df5258c Private key: 0xf473040b1a83739a9c7cc1f5719fab0f5bf178f83314d98557c58aae1910e03a
[] Address: 0xfec44e15328b7d1d8885a8226b0858964358f1d6 Private key: 0x823d590ed2cb5e8493bb0efc834771c1cde36f9fc49b9fe3620ebd0754ad6ea2
[] Address: 0xda8a06f1c910cab18ad187be1faa2b8606c2ec86 Private key: 0xd6d710943471e4c37ceb787857e7a2b41ca57f9cb4307ee9a9b21436a8e709c3
[] Address: 0x8199de05654e9afa5c081bce38f140082c9a7733 Private key: 0x187bb12e927c1652377405f81d93ce948a593f7d66cfba383ee761858b05921a
[] Address: 0x28bf45680ca598708e5cdacc1414fcac04a3f1ed Private key: 0xf41486fdb04505e7966c8720a353ed92ce0d6830f8a5e915fbde735106a06d25
[] Address: 0xf0508f89e26bd6b00f66a9d467678c7ed16a3c5a Private key: 0x6ca40ba4cca775643398385022264c0c414da1abd21d08d9e7136796a520a543
[] Address: 0x87e0ed760fb316eeb94bd9cf23d1d2be87ace3d8 Private key: 0xfac0bc9325ad342033afe956e83f0bf8f1e863c1c3e956bc75d66961fe4cd186 Listening on http://localhost:6658

后面有设置为none和structured,但是没能成功生成

etherlime compile编译

Syntax

etherlime compile [dir] [runs] [solcVersion] [docker] [list] [all] [quite] [output]

Parameters:

  • dir - [Optional] By specifying dir you can set the root directory where to read the contracts and place the build folder. By default dir is set to the current working directory ./ (可选)通过指定dir你可以设置读取合约以及放置build文件夹的根目录。默认dir被设置为目前的工作目录./
  • runs - [Optional] By specifying runs between 1 and 999 you enabled the optimizer and set how many times the optimizer will be run. By default the optimizer is not enabled. (可选)通过指定大小在1到999之间的runs,你可以使用优化器并设置优化器将运行多少次。默认优化器是不可用的。
  • solcVersion - [Optional] By specifying solcVersion you can set the version of the solc which will be used for compiling the smart contracts. By default it use the solc version from the node_modules folder. (可选)通过指定solcVersion你可以设置用于编译智能合约的solc版本。默认是使用来自node_modules文件夹的版本。
  • docker - [Optional] When you want to use a docker image for your solc you should set docker=true in order solcVersion to accept the passed image. (可选)当你想要为你的solc使用docker镜像时,为了solcVersion接受传递过来的镜像,你应该设置docker=true
  • list - [Optional] By specifying list you can list the available solc versions. The following values can be used: dockerreleasesprereleases and latestRelease. By default only 10 version are listed (可选)通过指定list,你可以列举可用的solc版本。一下的值可以被使用:dockerreleasesprereleases 和latestRelease。默认只有版本10被列举出来
  • all - [Optional] By specifying all together with list you will be able to list all available solc versions. (可选)通过指定all和list,你将能够列举所有可用的solc版本
  • quite - [Optional] Disable verboseness during compilation. By the default quite is set to false. (可选)在编译时禁用冗长。默认设置为false
  • output - [Optional] Defines the way that the logs are shown. Choices: none - silences the output of logs, normal - see verbose logs in the console and structured - structured output in a file meant for inter program communication.定义展示日志的方法,选择有:none-取消日志的输出,normal-在控制器中查看详细的日志,structured-为了内部项目的交流在文件中进行结构性输出

The solcVersion can accept the following values:

solcVersion可以接受下面的值:

  • <undefined> - passing undefined or simply don’t using the solcVersion argument will use the solc version from the local node_modules 传递undefined或是简单地不使用solcVersion参数将从本地node_modules中使用solc版本
  • <version> - you can pass directly the version of the solc. Example: --solcVersion=0.4.24 直接传递solc的版本,比如--solcVersion=0.4.24
  • <image> - the image which will be used to load the solc into the docker. Example: nightly-0.4.25-a2c754b3fed422b3d8027a5298624bcfed3744a5  该镜像用来下载solc到docker中。比如nightly-0.4.25-a2c754b3fed422b3d8027a5298624bcfed3744a5
  • <path> - you can pass the absolute path to a local solc 传递绝对路径给本地solc
  • <native> - when you set the solc version argument to native the compiler is using the solc globally installed on your machine 当你设置solc版本参数为native,编译器将使用安装在记你的机器中的全局solc

框架中给的合约例子为:

pragma solidity ^0.5.;

contract LimeFactory {

    event FreshLime(string name);

    struct Lime {
string name;
uint8 carbohydrates;
uint8 fat;
uint8 protein;
} Lime[] public limes; function createLime(string memory _name, uint8 _carbohydrates, uint8 _fat, uint8 _protein) public {//原来状态为internal,改成了pubic,为了后面调用createLime函数
limes.push(Lime(_name, _carbohydrates, _fat, _protein));
emit FreshLime(_name);
}
}

Here is example of result 结果的例子:

userdeMBP:test-etherlime user$ etherlime compile
Compiling ./contracts/LimeFactory.sol...
Compilation finished successfully

运行该命令将生成带有LimeFactory.json文件的build文件夹

etherlime deploy部署

Syntax

etherlime deploy [file] [network] [secret] [-s] [compile] [runs] [output]

Parameters:

  • file - [Optional] By specifying --file you can use another file as long as you keep the structure of the file (exporting an async deploy function with network and secret params) (可选)通过指定--file你可以使用另一个文件,只要你保持该文件的结构(输出带有network和secret参数的异步部署函数)
  • network - [Optional] By specifying --network you can specify the network param to be passed to your deploy method (可选)通过指定--network你可以指定传递的network参数给你的部署方法
  • secret - [Optional] By specifying secret you can specify the secret param to be passed to your deploy method. Comes in very handy for passing private keys. (可选)通过指定secret你可以传递secret参数给你的部署方法。非常简单地传递了私钥
  • -s - [Optional] Silent - silences the verbose errors (可选)取消生成详细的错误
  • compile - [Optional] Enable compilation of the smart contracts before their deployment. By default the deployment is done with a compilation (可选)在部署前智能合约编译可用。默认部署和编译一起完成
  • runs - [Optional] Enables the optimizer and runs it the specified number of times (可选)可用优化器并运行指定次数
  • output - [Optional] Defines the way that the logs are shown. Choices: none - silences the output of logs, normal - see verbose logs in the console and structured - structured output in a file meant for inter program communication.定义展示日志的方法,选择有:none-取消日志的输出,normal-在控制器中查看详细的日志,structured-为了内部项目的交流在文件中进行结构性输出

Running this command will deploy the file specified (defaults to ./deployment/deploy.js) The deployment process is verbose and gives you real-time info about the performed actions. In addition there is a report of the actions when the deployment finishes (as not all of us monitor the deployment process constantly):

运行这个命令将部署指定的文件(默认为./deployment/deploy.js)。

deployment/deploy.js文件为:

const etherlime = require('etherlime');
const LimeFactory = require('../build/LimeFactory.json'); const deploy = async (network, secret) => { //const deployer = new etherlime.EtherlimeGanacheDeployer();改成
const deployer = new etherlime.EtherlimeGanacheDeployer('0x7ab741b57e8d94dd7e1a29055646bafde7010f38a900f55bbd7647880faa6ee8',);//第一个参数是ganache第一个账户的私钥,上面打开的ganache的端口设置成了6658
const result = await deployer.deploy(LimeFactory); }; module.exports = {
deploy
};

这个部署过程是很繁琐的,将会给你关于执行操作的实时信息。除此之外,当部署结束时,这里还有操作的报告(因为不是我们所有人都一直监控着部署的过程)

部署后返回:

userdeMBP:test-etherlime user$ etherlime deploy
Compilation finished successfully
Deployer set to deploy from address: 0xD9995BAE12FEe327256FFec1e3184d492bD94C31 JSONRPC Deployer Network: http://localhost:6658/ Deploying contract: LimeFactory
Contract LimeFactory deployed at address: 0xc9707E1e496C12f1Fa83AFbbA8735DA697cdBf64
Your deployment script finished successfully! Here is your report:
┌───────────────┬────────────────────────────────────────────────────────────────────┐
│ Event Time │ Dec, :: │
├───────────────┼────────────────────────────────────────────────────────────────────┤
│ Executor │ EtherlimeGanacheDeployer │
├───────────────┼────────────────────────────────────────────────────────────────────┤
│ Name or Label │ LimeFactory │
├───────────────┼────────────────────────────────────────────────────────────────────┤
│ Tx Hash │ 0x3ff5e59e87eaaa53e54531b36d66cc1e83597cf78cc5caa21bbb29369486ce21 │
├───────────────┼────────────────────────────────────────────────────────────────────┤
│ Status │ Success │
├───────────────┼────────────────────────────────────────────────────────────────────┤
│ Gas Price │ 2.0 Gwei │
├───────────────┼────────────────────────────────────────────────────────────────────┤
│ Gas Used │ │
├───────────────┼────────────────────────────────────────────────────────────────────┤
│ Result │ 0xc9707E1e496C12f1Fa83AFbbA8735DA697cdBf64 │
└───────────────┴────────────────────────────────────────────────────────────────────┘

然后ganache上的日志为:

Listening on http://localhost:6658
net_version
net_version
eth_gasPrice
eth_getTransactionCount
eth_estimateGas
eth_sendRawTransaction Transaction: 0x5694939e172d9901f90889f480a63517db23db4c34022d1f938e4c3fffeb5ea0
Contract created: 0xc9707e1e496c12f1fa83afbba8735da697cdbf64
Gas usage:
Block Number:
Block Time: Thu Dec :: GMT+ (中国标准时间) evm_mine
eth_getTransactionReceipt
eth_blockNumber
 
 
 
 

etherlime history历史

Syntax

etherlime history [limit] [output]

Parameters:

  • limit - [Optional] By specifying -limit you can set the max number of historical records to be shown. Default is 5. (可选)通过指定-limit你可以设置被展示的历史纪录的最大数量。默认为5
  • output - [Optional] Defines the way that the logs are shown. Choices: none - silences the output of logs, normal - see verbose logs in the console and structured - structured output in a file meant for inter program communication.定义展示日志的方法,选择有:none-取消日志的输出,normal-在控制器中查看详细的日志,structured-为了内部项目的交流在文件中进行结构性输出

Using this command will print you historical list of execution reports

使用这个命令将输出给你执行报告的历史列表

终端返回:

userdeMBP:test-etherlime user$ etherlime history
Execution ID: :
┌───────────────┬────────────────────────────────────────────────────────────────────┐
│ Event Time │ Dec, :: │
├───────────────┼────────────────────────────────────────────────────────────────────┤
│ Executor │ EtherlimeGanacheDeployer │
├───────────────┼────────────────────────────────────────────────────────────────────┤
│ Name or Label │ LimeFactory │
├───────────────┼────────────────────────────────────────────────────────────────────┤
│ Tx Hash │ 0x5694939e172d9901f90889f480a63517db23db4c34022d1f938e4c3fffeb5ea0 │
├───────────────┼────────────────────────────────────────────────────────────────────┤
│ Status │ Success │
├───────────────┼────────────────────────────────────────────────────────────────────┤
│ Gas Price │ 2.0 Gwei │
├───────────────┼────────────────────────────────────────────────────────────────────┤
│ Gas Used │ │
├───────────────┼────────────────────────────────────────────────────────────────────┤
│ Result │ 0xc9707E1e496C12f1Fa83AFbbA8735DA697cdBf64 │
└───────────────┴────────────────────────────────────────────────────────────────────┘ Execution ID: :
┌───────────────┬────────────────────────────────────────────────────────────────────┐
│ Event Time │ Dec, :: │
├───────────────┼────────────────────────────────────────────────────────────────────┤
│ Executor │ EtherlimeGanacheDeployer │
├───────────────┼────────────────────────────────────────────────────────────────────┤
│ Name or Label │ LimeFactory │
├───────────────┼────────────────────────────────────────────────────────────────────┤
│ Tx Hash │ 0x3ff5e59e87eaaa53e54531b36d66cc1e83597cf78cc5caa21bbb29369486ce21 │
├───────────────┼────────────────────────────────────────────────────────────────────┤
│ Status │ Success │
├───────────────┼────────────────────────────────────────────────────────────────────┤
│ Gas Price │ 2.0 Gwei │
├───────────────┼────────────────────────────────────────────────────────────────────┤
│ Gas Used │ │
├───────────────┼────────────────────────────────────────────────────────────────────┤
│ Result │ 0xc9707E1e496C12f1Fa83AFbbA8735DA697cdBf64 │
└───────────────┴────────────────────────────────────────────────────────────────────┘

etherlime test测试

Syntax

etherlime test [path] [skip-compilation] [solc-version] [output]

Parameters:

  • path - [Optional] By specifying path you can set a path to a selected directory or you can set the path directly to the javascript file which contains your tests. By default the path points to ./test. (可选)通过指定path,你可以给选中的目录设置路径或你可以直接给包含测试的 javascript文件设置路径
  • skip-compilation - [Optional] This parameter controls wether a compilation will be ran before the tests are started. Default: false. (可选)这个参数控制在测试开始前是否一个编译将运行。默认是false
  • solc-version - [Optional] By specifying solc-version you can set the version of the solc which will be used for compiling the smart contracts. By default it use the solc version from the node_modules folder. (可选)通过指定solc-version你可以设置用来编译智能合约的solc的版本。默认使用来自node_modules文件夹的版本
  • output - [Optional] Defines the way that the logs are shown. Choices: none - silences the output of logs, normal - see verbose logs in the console and structured - structured output in a file meant for inter program communication.定义展示日志的方法,选择有:none-取消日志的输出,normal-在控制器中查看详细的日志,structured-为了内部项目的交流在文件中进行结构性输出

Global Objects全局对象

We’ve augmented the test runner with the following things you can use:你可以使用带着以下内容的test运行器

  • In your unit tests you can use the global accounts object. It contains the secretKey (private key) and instance of ethers.Wallet of the account.你可以在你的单元测试中使用全局accounts对象。它包含秘钥(私钥)和ethers实例。账户的钱包。
  • The assert object has assert.revert(promiseOfFailingTransaction) function for testing reverting transactions assert对象为了测试恢复交易有 assert.revert(promiseOfFailingTransaction)函数

Available Utils可用单元

On your disposal there is a global available utils object. Here are the methods it exposes:

这里有着全局可用的utils对象。下面是暴露的方法:

  • utils.timeTravel(provider, seconds) method allowing etherlime ganache to move seconds ahead. You need to pass your provider from the EtherlimeGanacheDeployer   该方法允许etherlime ganache前进seconds秒。你需要传递来自 EtherlimeGanacheDeployer的provider
  • utils.setTimeTo(provider, timestamp) method allowing etherlime ganache to move to the desired timestamp ahead. You need to pass your provider from the EtherlimeGanacheDeployer。 该方法允许etherlime ganache前进希望的timestamp秒。你需要传递来自 EtherlimeGanacheDeployer的provider
  • utils.snapshot(provider) method allowing etherlime ganache to take a Snapshot of the current Blockchain data. You can revert back to this snapshot when desired. You need to pass your provider from the EtherlimeGanacheDeployer。 这个方法允许etherlime ganache为目前的区块链数据拍快照。你可以在希望的时候回复到该快照时候。你需要传递来自 EtherlimeGanacheDeployer的provider
  • utils.revertState(provider) method allowing etherlime ganache to revert back to the most recent snapshot. In case you don’t have a snapshot it will reset the entire chain data. You need to pass your provider from the EtherlimeGanacheDeployer   这个方法允许etherlime ganache恢复到最近的快照。在这种情况下,如果你没有快照,将重置整个数据链。你需要传递来自 EtherlimeGanacheDeployer的provider
  • utils.mineBlock(provider) method telling the etherlime ganache to mine the next block. You need to pass your provider from the EtherlimeGanacheDeployer。 这个方法告诉etherlime ganache下一个挖的块。你需要传递来自 EtherlimeGanacheDeployer的provider
  • utils.hasEvent(receipt, contract, eventName) allowing the user to check if the desired event was broadcasted in the transaction receipt. You need to pass the Transaction receipt, the contract that emits it and the name of the Event.   这个方法有想要的事件被广播在交易收据时,允许用户进行查看。你需要传递交易收据,发送该收据的合约和该事件的名字
  • utils.parseLogs(receipt, contract, eventName) allowing the user get parsed events from a transaction receipt. You need to pass the Transaction receipt, the contract that emits it and the name of the Event. Always returns an event.    这个方法允许用户从交易收据中得到解析事件。你需要传递交易收据,发送该收据的合约和该事件的名字。总是返回一个事件

Examples

General Example

const etherlime = require('etherlime');
const Billboard = require('../build/Billboard.json'); describe('Example', () => {
let accountFour = accounts[];
let deployer; beforeEach(async () => {
deployer = new etherlime.EtherlimeGanacheDeployer(accountFour.secretKey);
}); it('should set correct owner', async () => {
const deployedContractWrapper = await deployer.deploy(Billboard, {});
const contract = deployedContractWrapper.contract;
let _owner = await contract.owner(); assert.strictEqual(_owner, owner.wallet.address, 'Initial contract owner does not match');
});
});

accounts

const Billboard = require('../build/Billboard.json');
const etherlime = require('etherlime'); describe('Billboard', () => {
let owner = accounts[]; it('should initialize contract with correct values', async () => {
const deployer = new etherlime.EtherlimeGanacheDeployer(owner.secretKey);
const deployedContractWrapper = await deployer.deploy(Billboard, {}); // Do something with the contract
});
});

assert.revert

it('should throw if throwing method is called', async () => {
assert.revert(contract.throwingMethod());
});

Check if the desired event was broadcasted in the transaction receipt

 查看是否在交易收据中广播了你想要的事件

const etherlime = require('etherlime');
const Billboard = require('../build/Billboard.json');
const assert = require('chai').assert; describe('Billboard', () => {
let owner = accounts[]; it('should emit event', async () => {
const deployer = new etherlime.EtherlimeGanacheDeployer(owner.secretKey);
const deployedContractWrapper = await deployer.deploy(Billboard, {}); const buyTransaction = await deployedContractWrapper.contract.buy('Billboard slogan', { value: ONE_ETHER }); const transactionReceipt = await deployedContractWrapper.verboseWaitForTransaction(buyTransaction); const expectedEvent = 'LogBillboardBought'; assert.isDefined(transactionReceipt.events.find(emittedEvent => emittedEvent.event === expectedEvent, 'There is no such event'));
});
});

模仿上面的例子使用框架中给的合约进行测试时,发现下面的问题:

TypeError: deployedContractWrapper.contract.createLime is not a function

发现原因是etherlime中给的合约将函数createLime声明成了internal,更改成public后重新编译、部署和调用,重新部署后合约代码为0x9eD274314f0fB37837346C425D3cF28d89ca9599,测试代码为:

exampleTest.js

const etherlime = require('etherlime');

describe('Example', () => {
let accountFour = accounts[];
console.log(accountFour);
let deployer; beforeEach(async () => {
deployer = new etherlime.EtherlimeGanacheDeployer(accountFour.secretKey,);
}); it('should have valid private key', async () => {
assert.strictEqual(deployer.wallet.privateKey, accountFour.secretKey);
}); });

contractTest.js

const LimeFactory = require('../build/LimeFactory.json');
const etherlime = require('etherlime'); describe('LimeFactory', () => {
let owner = accounts[]; it('should initialize contract with correct values', async () => {
const deployer = new etherlime.EtherlimeGanacheDeployer(owner.secretKey,); // const deployedContractWrapper = await deployer.deploy(LimeFactory);
const deployedContractWrapper = await deployer.wrapDeployedContract(LimeFactory, '0x9eD274314f0fB37837346C425D3cF28d89ca9599'); // Do something with the contract
const createLimeTransaction = await deployedContractWrapper.contract.createLime('thin lime', , , ); const transactionReceipt = await deployedContractWrapper.verboseWaitForTransaction(createLimeTransaction);
console.log(transactionReceipt); const expectedEvent = 'FreshLime'; assert.isDefined(transactionReceipt.events.find(emittedEvent => emittedEvent.event === expectedEvent, 'There is no such event')); });
});

终端运行结果为:

userdeMBP:test-etherlime user$ etherlime test
{ secretKey:
'0xf473040b1a83739a9c7cc1f5719fab0f5bf178f83314d98557c58aae1910e03a',
wallet:
Wallet {
signingKey:
SigningKey {
privateKey:
'0xf473040b1a83739a9c7cc1f5719fab0f5bf178f83314d98557c58aae1910e03a',
keyPair:
KeyPair {
privateKey:
'0xf473040b1a83739a9c7cc1f5719fab0f5bf178f83314d98557c58aae1910e03a',
publicKey:
'0x0439c395f0923d0224eff7aef522924c5ad2e1b6ed786e1a816b1b57679759ea02678f129b578e79a419173908991753b2b6b23b024661394a45ce878028128bac',
compressedPublicKey:
'0x0239c395f0923d0224eff7aef522924c5ad2e1b6ed786e1a816b1b57679759ea02',
publicKeyBytes:
[ ,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
] },
publicKey:
'0x0439c395f0923d0224eff7aef522924c5ad2e1b6ed786e1a816b1b57679759ea02678f129b578e79a419173908991753b2b6b23b024661394a45ce878028128bac',
address: '0x56A32fFf5E5A8B40d6A21538579fB8922DF5258c' },
provider: undefined } } LimeFactory
{ contractAddress: null,
transactionIndex: ,
gasUsed: BigNumber { _hex: '0x14239' },
logsBloom:
'0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000001000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000',
blockHash:
'0xaed75939915dd051a916a21e49a397fe2210a895144ace67272b22cb026b081f',
transactionHash:
'0x807552aeb1d2fb4f16da1b7f6240025de74e665a1bc6123dea9152ad9023dfcc',
logs:
[ { transactionIndex: ,
blockNumber: ,
transactionHash:
'0x807552aeb1d2fb4f16da1b7f6240025de74e665a1bc6123dea9152ad9023dfcc',
address: '0x9eD274314f0fB37837346C425D3cF28d89ca9599',
topics:
[ '0xe65ca226f7ab35846085554e9c72f162260bd2e4a6d6a752f0aacad4e0f18fe5' ],
data:
'0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000097468696e206c696d650000000000000000000000000000000000000000000000',
logIndex: ,
blockHash:
'0xaed75939915dd051a916a21e49a397fe2210a895144ace67272b22cb026b081f',
transactionLogIndex: } ],
blockNumber: ,
confirmations: ,
cumulativeGasUsed: BigNumber { _hex: '0x14239' },
status: ,
byzantium: true,
events:
[ { transactionIndex: ,
blockNumber: ,
transactionHash:
'0x807552aeb1d2fb4f16da1b7f6240025de74e665a1bc6123dea9152ad9023dfcc',
address: '0x9eD274314f0fB37837346C425D3cF28d89ca9599',
topics:
[ '0xe65ca226f7ab35846085554e9c72f162260bd2e4a6d6a752f0aacad4e0f18fe5' ],
data:
'0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000097468696e206c696d650000000000000000000000000000000000000000000000',
logIndex: ,
blockHash:
'0xaed75939915dd051a916a21e49a397fe2210a895144ace67272b22cb026b081f',
transactionLogIndex: ,
args: Result { '': 'thin lime', name: 'thin lime', length: },
decode: [Function],
event: 'FreshLime',
eventSignature: 'FreshLime(string)',
removeListener: [Function],
getBlock: [Function],
getTransaction: [Function],
getTransactionReceipt: [Function] } ] }
✓ should initialize contract with correct values (228ms) Example
✓ should have valid private key passing (236ms)

etherlime coverage测试代码覆盖率

Syntax

etherlime coverage [path] [port] [runs]

Parameters:

  • path - [Optional] By specifying path you can set a path to a selected directory or you can set the path directly to the javascript file which contains your tests. By default the path points to ./test.   通过指定path,你可以给选中的目录设置路径或可以直接给包含你的测试文件的javascript文件传递路径。默认路径指向./test
  • port - [Optional] The port to run the solidity coverage testrpc (compatible with etherlime ganache deployer). Default: 8545.  (可选)运行solidity coverage testrpc的端口,默认为8545
  • runs - [Optional] By specifying number runs you can enable the optimizer of the compiler with the provided number of optimization runs to be executed. Compilation is always performed by solidity coverage.  (可选)通过指定runs数量,你将可用带着提供次数的执行优化运行的编译优化器。编译将总是被solidity coverage执行

etherlime-4-Etherlime CLI的更多相关文章

  1. etherlime-1-Quick Start

    https://etherlime.readthedocs.io/en/latest/getting-started.html Quick Start Installing全局安装 npm i -g ...

  2. etherlime-2-Etherlime Library API-deployer

    Etherlime Library API 库API Deployer部署者 Deployer functionality The main functionality the deployer ex ...

  3. .NET Core系列 : 1、.NET Core 环境搭建和命令行CLI入门

    2016年6月27日.NET Core & ASP.NET Core 1.0在Redhat峰会上正式发布,社区里涌现了很多文章,我也计划写个系列文章,原因是.NET Core的入门门槛相当高, ...

  4. 跨越语言的障碍:C++/CLI 调用 C#

    首先我想投诉一下博客园首页右边栏的广告..最近总是出现很恐怖的整容脸的广告.真的是吓坏了.=.=大家有同感吗? 博客园前一阵子掀起了语言的广泛讨论,事实上语言的争执在整个程序员圈子也没有停止过.以我个 ...

  5. Ubuntu 安装 CLI 并运行 ASP.NET Core 1.0

    Ubuntu 下载地址:http://www.ubuntu.org.cn/download/desktop 注:目前 CLI 的安装命令只支持 Ubuntu 14.04,暂不支持 Ubuntu 14. ...

  6. 『.NET Core CLI工具文档』(十四)dotnet-install 脚本参考

    说明:本文是个人翻译文章,由于个人水平有限,有不对的地方请大家帮忙更正. 原文:dotnet-install scripts reference 翻译:dotnet-install 脚本参考 名称 d ...

  7. 『.NET Core CLI工具文档』(九)dotnet-run

    说明:本文是个人翻译文章,由于个人水平有限,有不对的地方请大家帮忙更正. 原文:dotnet-run 翻译:dotnet-run 名称 dotnet-run -- 没有任何明确的编译或启动命令运行&q ...

  8. 『.NET Core CLI工具文档』(八)dotnet-restore

    说明:本文是个人翻译文章,由于个人水平有限,有不对的地方请大家帮忙更正. 原文:dotnet-restore 翻译:dotnet-restore 名称 dotnet-restore - 还原一个项目的 ...

  9. 『.NET Core CLI工具文档』(七)dotnet-new

    说明:本文是个人翻译文章,由于个人水平有限,有不对的地方请大家帮忙更正. 原文:dotnet-new 翻译:dotnet-new 名称 dotnet-new -- 创建一个新的 .NET Core 项 ...

随机推荐

  1. Springboot集成SpringData JPA

    序 StringData JPA 是微服务框架下一款ORM框架,在微服务体系架构下,数据持久化框架,主要为SpringData JPA及Mybatis两种,这两者的具体比较,本文不做阐述,本文只简单阐 ...

  2. Yii 时间戳格式化显示的问题

    这个控件是CJuiDatePicker控件的扩展,支持时分秒. 下载地址:http://www.yiiframework.com/extension/timepicker/ 这个控件用在view里的_ ...

  3. YII 用gii生成modules模块下的mvc

    1.生成model ModelPath设置为: application.modules.[moduleName].models 2.生成CURD ModelClass设置为: application. ...

  4. Layabox 3D游戏开发学习笔记---射线检测,鼠标控制物体运动

    核心要点:3D物体碰撞是靠射线检测,射线与碰撞器相撞获取对应的碰撞点信息. class RayPicking03 { private ray: Laya.Ray; private point: Lay ...

  5. BZOJ4144: [AMPPZ2014]Petrol(最短路 最小生成树)

    题意 题目链接 Sol 做的时候忘记写题解了 可以参考这位大爷 #include<bits/stdc++.h> #define Pair pair<int, int> #def ...

  6. 【转发】【小程序】微信小程序日常开发中常遇到的错误代码

    还在为看不懂小程序错误状态码纠结吗?这里推荐一篇文章 重要的事情说三遍:原文链接  https://www.cnblogs.com/webonline/p/7528778.html 作者:玩世不恭. ...

  7. C#+MapServer相关代码

    //放大的代码: private void MapZoomIn(NameValueCollection queryString) { mapObj map = Session["MapSer ...

  8. javascript的继承实现

    javascript虽然是一门面向对象的语言,但是它的继承机制从一开始设计的时候就不同于传统的其他面向对象语言,是基于原型的继承机制,但是在这种机制下,继承依然有一些不同的实现方式. 方法一:类式继承 ...

  9. 润乾报表与DERBY数据库的创建连接详解

     1. 问题概述 1.Derby数据库的创建过程 2.润乾报表连接Derby数据库展现数据 概述: Derby是Apache Software Foundation (ASF)的一个的孵化器项目. ...

  10. Python redis交互

    1.首先安装模块 pip3 install redis 2.代码模板如下: from redis import StrictRedis if __name__ == '__main__': # 设置连 ...