Skip to content

Instantly share code, notes, and snippets.

@ColinPlatt
Created January 10, 2022 17:15
Show Gist options
  • Save ColinPlatt/152995247c943f7c2b7e29d49d3131ea to your computer and use it in GitHub Desktop.
Save ColinPlatt/152995247c943f7c2b7e29d49d3131ea to your computer and use it in GitHub Desktop.
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.9+commit.e5eed63a.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
contract pointsData {
struct layerData {
bytes data;
}
mapping(uint256 => layerData) private CellLayerData;
function addDataToLayer(bytes memory _data, uint256 tokenId) external {
CellLayerData[tokenId].data = _data;
}
function multiAdd(bytes[] memory _data, uint256[] memory tokenId) external {
for (uint256 i=0; i<tokenId.length; i++) {
CellLayerData[tokenId[i]].data = _data[i];
}
}
function readId(uint256 tokenId) external view returns (bytes memory) {
return CellLayerData[tokenId].data;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment