From 823721608106bb72901cd79f06429249cc265c9e Mon Sep 17 00:00:00 2001 From: KOSASIH Date: Wed, 28 Aug 2024 14:07:57 +0700 Subject: [PATCH] Create pi_network_module_5: Storage.sol --- .../pi_network_module_5: Storage.sol | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 blockchain_integration/pi_network/features/pi_network_smart_contract_architecture/pi_network_module_5: Storage.sol diff --git a/blockchain_integration/pi_network/features/pi_network_smart_contract_architecture/pi_network_module_5: Storage.sol b/blockchain_integration/pi_network/features/pi_network_smart_contract_architecture/pi_network_module_5: Storage.sol new file mode 100644 index 000000000..b5cc7bbf8 --- /dev/null +++ b/blockchain_integration/pi_network/features/pi_network_smart_contract_architecture/pi_network_module_5: Storage.sol @@ -0,0 +1,24 @@ +pragma solidity ^0.8.0; + +import "./AccessControl.sol"; + +contract Storage { + using AccessControl for address; + + // Mapping of storage data + mapping (string => bytes) public data; + + // Event emitted when new storage data is updated + event NewData(string indexed key, bytes value); + + // Function to update storage data + function updateData(string memory _key, bytes memory _value) public onlyAdmin { + data[_key] = _value; + emit NewData(_key, _value); + } + + // Function to get storage data + function getData(string memory _key) public view returns (bytes memory) { + return data[_key]; + } +}