Created
January 10, 2022 15:29
-
-
Save ColinPlatt/e47b74e073be0ab22afb78ef8197dc36 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.10+commit.fc410830.js&optimize=false&runs=200&gist=
This file contains hidden or 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-Identifier: MIT | |
pragma solidity 0.8.10; | |
interface IPointsNFT { | |
function readSeed(uint256 id) external view returns (uint256); | |
} | |
contract pointsData { | |
struct layerData { | |
bytes data; | |
} | |
mapping(uint256 => layerData) public CellLayerData; | |
function addDataToLayer(string memory data, uint256 tokenId) external { | |
CellLayerData[tokenId].data = abi.encodePacked(data); | |
} | |
function multiAdd(string[] memory data, uint256[] memory tokenId) external { | |
require(data.length == tokenId.length); | |
for (uint256 i=0; i<tokenId.length; i++) { | |
CellLayerData[tokenId[i]].data = abi.encodePacked(data[i]); | |
} | |
} | |
function readId(uint256 tokenId) external view returns (string memory) { | |
return abi.decode(CellLayerData[tokenId].data,(string)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment