Skip to content

Commit

Permalink
Make functions pure
Browse files Browse the repository at this point in the history
Signed-off-by: Danil Lugovskoy <[email protected]>
  • Loading branch information
Deniallugo committed Jun 9, 2021
1 parent 0f2032c commit 9b3ac0b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions contracts/contracts/ZkSyncNFTFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ contract ZkSyncNFTFactory is ERC721, NFTFactory {
}

/// @dev Converts hex string to base 58
function toBase58(bytes memory source) internal view returns (string memory) {
function toBase58(bytes memory source) internal pure returns (string memory) {
uint8[] memory digits = new uint8[](46);
digits[0] = 0;
uint8 digitLength = 1;
Expand All @@ -153,19 +153,19 @@ contract ZkSyncNFTFactory is ERC721, NFTFactory {
return toAlphabet(reverse(digits));
}

function ipfsCID(bytes32 source) public view returns (string memory) {
function ipfsCID(bytes32 source) public pure returns (string memory) {
return toBase58(abi.encodePacked(sha256MultiHash, source));
}

function reverse(uint8[] memory input) internal view returns (uint8[] memory) {
function reverse(uint8[] memory input) internal pure returns (uint8[] memory) {
uint8[] memory output = new uint8[](input.length);
for (uint8 i = 0; i < input.length; i++) {
output[i] = input[input.length - 1 - i];
}
return output;
}

function toAlphabet(uint8[] memory indices) internal view returns (string memory) {
function toAlphabet(uint8[] memory indices) internal pure returns (string memory) {
bytes memory output = new bytes(indices.length);
for (uint32 i = 0; i < indices.length; i++) {
output[i] = ALPHABET[indices[i]];
Expand Down

0 comments on commit 9b3ac0b

Please sign in to comment.