Skip to content

Commit

Permalink
Chore: make logs a bit more readable
Browse files Browse the repository at this point in the history
  • Loading branch information
ChiTimesChi committed Nov 8, 2023
1 parent f101fa3 commit 3e7a5b6
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions test/router/linkedPool/LinkedPoolConfigIntegration.sol
Original file line number Diff line number Diff line change
Expand Up @@ -261,19 +261,22 @@ abstract contract LinkedPoolConfigIntegrationTest is IntegrationUtils {
// ══════════════════════════════════════════════════ LOGGING ══════════════════════════════════════════════════════

function logQuotes() internal view {
logQuotes(zeroQuotes, "amountOut == 0");
logQuotes(slippageQuotes, "slippage >= 1%");
logQuotes({
quotes: zeroQuotes,
description: "amountOut == 0",
warningMsg: unicode"⛔ Swap is not possible for"
});
logQuotes({quotes: slippageQuotes, description: "slippage >= 1%", warningMsg: unicode"💥 High slippage for"});
}

function logQuotes(LoggedQuote[] storage quotes, string memory description) internal view {
function logQuotes(
LoggedQuote[] storage quotes,
string memory description,
string memory warningMsg
) internal view {
console2.log("Quotes with [%s] between adjacent nodes: %s", description, quotes.length);
for (uint256 i = 0; i < quotes.length; i++) {
console2.log(
unicode"❗❗❗ WARNING: [%s] for %s -> %s",
description,
quotes[i].nodeIndexFrom,
quotes[i].nodeIndexTo
);
console2.log(unicode" %s for %s -> %s", warningMsg, quotes[i].nodeIndexFrom, quotes[i].nodeIndexTo);
address tokenFrom = tokens[quotes[i].nodeIndexFrom];
address tokenTo = tokens[quotes[i].nodeIndexTo];
string memory amountOutInfo = quotes[i]
Expand Down

0 comments on commit 3e7a5b6

Please sign in to comment.