Created
November 8, 2021 16:17
-
-
Save Magicking/b2717a421ddec6ab90ec3636249c6b5e to your computer and use it in GitHub Desktop.
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
// SPDX-License: BEER | |
pragma solidity ^0.8.0; | |
contract MyBigNFTStorage { | |
mapping(uint256 => string) public _SVGChunks; | |
uint256 ChunkCount; | |
// Limited to 25kb | |
function loadSVGChunk(uint256 id, string memory chunk) public { | |
// Will store inside storage a chunk with ID | |
_SVGChunks[id] = chunk; | |
if (id > ChunkCount) { | |
ChunkCount = id; | |
} | |
} | |
function render(/* arguments for seach& replace goes here*/) public view returns (string memory output) { | |
string memory buffer; | |
for (uint256 i = 0; i <= ChunkCount; i++) { | |
buffer = string(abi.encodePacked(buffer, _SVGChunks[i])); | |
} | |
// Search & Replace in-memory for parameters | |
// - rate | |
return buffer; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment