Package Exports
- fuel-analyzer
- fuel-analyzer/fuel-analyzer.js
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
A simple gas estimation module for your Truffle project.
Keep Updated
For the latest news, please follow the @MartikKing. Dm me if you get some bugs.
Installing
node.js
$.../temmartik/some_project> npm install --save fuel-analyzerHow to
Simply import fuel-analyzer into your Truffle project.
const fa = require('fuel-analyzer');Then create an instance of the fuel-analyzer.
let estimation= 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 via swapExactTokensForTokens function",
"2000 USDT has been swapped for ETH via swapExactTokensForETH function"
], false
);
estimation.getReport();
Where:
-First param: a web3 instance.
-Second param: a contract instance.
-Third param: an array that includes one or 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 the local node's state be 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.
Report will be saved in gas_price.md file in your project directory.