Skip to content

Instantly share code, notes, and snippets.

@Magicking
Created November 8, 2021 16:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Magicking/b2717a421ddec6ab90ec3636249c6b5e to your computer and use it in GitHub Desktop.
Save Magicking/b2717a421ddec6ab90ec3636249c6b5e to your computer and use it in GitHub Desktop.
// 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