Skip to content

Commit

Permalink
Create pi_network_module_4: Oracle.sol
Browse files Browse the repository at this point in the history
  • Loading branch information
KOSASIH authored Aug 28, 2024
1 parent 60b0fb9 commit 860c50b
Showing 1 changed file with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
pragma solidity ^0.8.0;

import "./AccessControl.sol";

contract Oracle {
using AccessControl for address;

// Mapping of oracle data
mapping (string => uint256) public data;

// Event emitted when new oracle data is updated
event NewData(string indexed key, uint256 value);

// Function to update oracle data
function updateData(string memory _key, uint256 _value) public onlyAdmin {
data[_key] = _value;
emit NewData(_key, _value);
}

// Function to get oracle data
function getData(string memory _key) public view returns (uint256) {
return data[_key];
}
}

0 comments on commit 860c50b

Please sign in to comment.