JSPM

  • Created
  • Published
  • 0
  • Score
    100M100P100Q48163F
  • 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.

IMPORTANT: Estimation does not change state of the storage in your local node.


let fuelAnalyzer= 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"
        ]
    );

Where:

-First param is a web3 instance

-Second param is a contract instance

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

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

-Fifth param is a decription for each estimated function.

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

await fuelAnalyzer.getReport();