JSPM

  • Created
  • Published
  • 0
  • Score
    100M100P100Q48212F
  • License ISC

Gas estimation

Package Exports

  • fuel-analyzer

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (fuel-analyzer) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Fuel Analyzer

npm (tag)

A simple gas estimation module for your Truffle project. The project is still in BETA.

Keep Updated

For the latest news, please follow the @MartikKing. Dm me if you get some bugs.

Installing

node.js

$.../king_martik/some_project> npm install --save fuel-analyzer

How to

Simply import fuel-analyzer into your Truffle project.

const fa = require('fuel-analyzer');

Than create an instance of the fuel-analyzer.


let estimation r= await new fa.FuelAnalyzer(web3, UniswapRouterInstance, 
        [
            "swapExactTokensForTokens",
            "swapExactTokensForETH"
        ],
        [
            [1000, 20, [USDT, UNI], user, time, {from: owner}],
            [2000, 40, [USDT, WETH], user, time, {from: owner}]
        ],
        [
            "1000 USDT has been swapped for UNI wia swapExactTokensForTokens function",
            "2000 USDT has been swapped for ETH wia swapExactTokensForETH function"
        ], false
    );

Where:

-First param: a web3 instance.

-Second param: a contract instance.

-Third param: an array that includes one ore more functions that have to be estimated.

-Fourth param: an array of arrays of params for each function.

-Fifth param: a decription for each estimated function (Optional).

-Sixth param: a flag that decides should be the local node's state reverted to the last snapshot after every test (True by default).

After estimation completed the state of your local node will be reverted to previous snapshot.

Use getReport() to write gas_price.md file. The file will be stored in your project folder.

await estimation.getReport();