Skip to content

Commit

Permalink
feat: added bytesToBech32Bytes helper function (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
fadeev authored Sep 25, 2023
1 parent e14c6d5 commit 439fd48
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions contracts/BytesHelperLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,16 @@ library BytesHelperLib {
) internal pure returns (bytes32) {
return bytes32(uint256(uint160(someAddress)));
}

function bytesToBech32Bytes(
bytes calldata data,
uint256 offset
) internal pure returns (bytes memory) {
bytes memory bech32Bytes = new bytes(42);
for (uint i = 0; i < 42; i++) {
bech32Bytes[i] = data[i + offset];
}

return bech32Bytes;
}
}

0 comments on commit 439fd48

Please sign in to comment.