//SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "../utilities/Moderatable.sol"; /** ____ __. .___ ________ __ | |/ _|____ __| _/____ ___ ___ \______ \ _____ _/ |______ | < / _ \ / __ |/ __ \\ \/ / | | \\__ \\ __\__ \ | | ( <_> ) /_/ \ ___/ > < | ` \/ __ \| | / __ \_ |____|__ \____/\____ |\___ >__/\_ \ /_______ (____ /__| (____ / \/ \/ \/ \/ \/ \/ \/ kodexdata.systems */ contract HashStore is Moderatable { struct Storage { uint index; string cid; uint timeAdded; uint timeUpdated; } event NewStorage(uint index, string cid, uint timeAdded, uint timeUpdated); event UpdatedStorage( uint index, string cid, uint timeAdded, uint timeUpdated ); uint public createDate = block.timestamp; uint public storeCount = 0; mapping(uint256 => Storage) public store; constructor() Moderatable() {} function add(string memory _cid) public onlyRole(ROLE_MODERATOR) { Storage memory x = store[storeCount]; x.index = storeCount; x.cid = _cid; x.timeAdded = block.timestamp; x.timeUpdated = block.timestamp; storeCount++; emit NewStorage(x.index, x.cid, x.timeAdded, x.timeUpdated); } function update( uint256 index, string memory _cid ) public onlyRole(ROLE_MODERATOR) { Storage memory x = store[index]; x.cid = _cid; x.timeUpdated = block.timestamp; emit UpdatedStorage(x.index, x.cid, x.timeAdded, x.timeUpdated); } function remove(uint256 index) public onlyRole(ROLE_MODERATOR) { delete store[index]; } }