fuel-analyzer
v1.5.2
Published
Gas estimation
Downloads
6
Maintainers
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-analyzer
How 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.