Skip to content

Commit

Permalink
fix: print fix
Browse files Browse the repository at this point in the history
  • Loading branch information
0xmikko committed Aug 7, 2023
1 parent 394d65d commit 539af9a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion contracts/test/live/PricePrinter.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ contract PricePrinterTest is Test {
function printUsdPrice(address token, uint256 price) public view {
uint256 integerPart = price / 1e8;
uint256 fractionalPart = (price / 1e6) % 100;
string memory zero = fractionalPart < 10 ? "0" : "";
string memory result = string.concat(
ERC20(token).symbol(), ": $", Strings.toString(integerPart), ".", Strings.toString(fractionalPart)
ERC20(token).symbol(), ": $", Strings.toString(integerPart), ".", zero, Strings.toString(fractionalPart)
);
console.log(result);
}
Expand Down

0 comments on commit 539af9a

Please sign in to comment.