This repository has been archived by the owner on Jan 9, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 325
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: add univ3 svg generation test
- Loading branch information
Showing
12 changed files
with
1,047 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,15 @@ | ||
[submodule "solidity_contracts/lib/forge-std"] | ||
path = solidity_contracts/lib/forge-std | ||
url = https://github.com/foundry-rs/forge-std | ||
branch = v1.3.0 | ||
[submodule "solidity_contracts/lib/kakarot-lib"] | ||
path = solidity_contracts/lib/kakarot-lib | ||
url = https://github.com/kkrt-labs/kakarot-lib | ||
[submodule "solidity_contracts/lib/v3-core"] | ||
path = solidity_contracts/lib/v3-core | ||
url = https://github.com/Uniswap/v3-core | ||
[submodule "solidity_contracts/lib/openzeppelin"] | ||
path = solidity_contracts/lib/openzeppelin | ||
url = https://github.com/OpenZeppelin/openzeppelin-contracts | ||
[submodule "solidity_contracts/lib/base64-sol"] | ||
path = solidity_contracts/lib/base64-sol | ||
url = https://github.com/Brechtpd/base64 |
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
Submodule base64-sol
added at
dcbf85
Submodule openzeppelin
added at
8e0296
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,29 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity =0.7.6; | ||
|
||
library HexStrings { | ||
bytes16 internal constant ALPHABET = "0123456789abcdef"; | ||
|
||
/// @notice Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. | ||
/// @dev Credit to Open Zeppelin under MIT license https://github.com/OpenZeppelin/openzeppelin-contracts/blob/243adff49ce1700e0ecb99fe522fb16cff1d1ddc/contracts/utils/Strings.sol#L55 | ||
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { | ||
bytes memory buffer = new bytes(2 * length + 2); | ||
buffer[0] = "0"; | ||
buffer[1] = "x"; | ||
for (uint256 i = 2 * length + 1; i > 1; --i) { | ||
buffer[i] = ALPHABET[value & 0xf]; | ||
value >>= 4; | ||
} | ||
require(value == 0, "Strings: hex length insufficient"); | ||
return string(buffer); | ||
} | ||
|
||
function toHexStringNoPrefix(uint256 value, uint256 length) internal pure returns (string memory) { | ||
bytes memory buffer = new bytes(2 * length); | ||
for (uint256 i = buffer.length; i > 0; i--) { | ||
buffer[i - 1] = ALPHABET[value & 0xf]; | ||
value >>= 4; | ||
} | ||
return string(buffer); | ||
} | ||
} |
Oops, something went wrong.