-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix price calculation and commission formatting
- Loading branch information
1 parent
41ac789
commit 087f58d
Showing
7 changed files
with
188 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// SPDX-License-Identifier: MIT OR Apache-2.0 | ||
pragma solidity ^0.8.26; | ||
|
||
import "forge-std/console.sol"; | ||
|
||
library Console { | ||
function log(string memory format, uint256 amount, uint8 precision) pure internal { | ||
string memory zeros = ""; | ||
uint256 decimals = amount % 10**precision; | ||
while (decimals > 0 && decimals < 10**(precision - 1)) { | ||
//console.log("%s %s", zeros, decimals); | ||
zeros = string.concat(zeros, "0"); | ||
decimals *= 10; | ||
} | ||
console.log( | ||
format, | ||
amount / 10**precision, | ||
zeros, | ||
amount % 10**precision | ||
); | ||
} | ||
|
||
function log(string memory format, uint256 amount) pure internal { | ||
return log(format, amount, 18); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters