-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from muhammedshahinshapottayil/Rainmaker
Rainmaker
- Loading branch information
Showing
17 changed files
with
1,119 additions
and
882 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
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 |
---|---|---|
@@ -1,33 +1,30 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
|
||
library HexStrings { | ||
bytes16 private constant ALPHABET = "0123456789abcdef"; | ||
|
||
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"; | ||
|
||
assembly { | ||
let pos := add(buffer, 34) | ||
let end := add(pos, mul(length, 2)) | ||
let remaining := value | ||
pragma solidity 0.8.26; | ||
|
||
for { | ||
library HexStrings { | ||
bytes16 private constant ALPHABET = "0123456789abcdef"; | ||
|
||
} lt(pos, end) { | ||
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"; | ||
|
||
} { | ||
mstore8(sub(end, 1), byte(mod(remaining, 16), ALPHABET)) | ||
remaining := div(remaining, 16) | ||
end := sub(end, 1) | ||
} | ||
} | ||
assembly { | ||
let pos := add(buffer, 34) | ||
let end := add(pos, mul(length, 2)) | ||
let remaining := value | ||
|
||
return string(buffer); | ||
for { } lt(pos, end) { } { | ||
mstore8(sub(end, 1), byte(mod(remaining, 16), ALPHABET)) | ||
remaining := div(remaining, 16) | ||
end := sub(end, 1) | ||
} | ||
} | ||
|
||
return string(buffer); | ||
} | ||
} |
Oops, something went wrong.