Skip to content

Commit

Permalink
feat: add console stats for curve calls
Browse files Browse the repository at this point in the history
  • Loading branch information
toniocodo committed Sep 5, 2023
1 parent bc03ae8 commit 972d400
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions libs/oeth/swap/src/actions/swapCurve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,20 @@ const estimateAmount: EstimateAmount = async (tokenIn, tokenOut, amountIn) => {
return 0n;
}

console.time('curve getBestRouteAndOutput');
const routes = await curve.router.getBestRouteAndOutput(
tokenIn?.address ?? ETH,
tokenOut?.address ?? ETH,
formatUnits(amountIn, tokenIn.decimals),
);
console.timeEnd('curve getBestRouteAndOutput');
console.log(
`curve found ${routes.route.length} routes: ${JSON.stringify(
routes.route,
null,
2,
)}`,
);

return parseUnits(routes.output, tokenOut.decimals);
};
Expand Down

0 comments on commit 972d400

Please sign in to comment.