Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Feature_Request_Blockchain.md #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions Feature_Request_Blockchain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
pragma solidity ^0.8.0;

contract StockPriceData {
struct StockPrice {
uint256 price;
uint256 timestamp;
address submitter;
}

mapping(string => StockPrice[]) private stockPrices;

event StockPriceSubmitted(
string stockSymbol,
uint256 price,
uint256 timestamp,
address indexed submitter
);

// Function to submit stock price data
function submitStockPrice(string memory stockSymbol, uint256 price) public {
StockPrice memory newPrice = StockPrice({
price: price,
timestamp: block.timestamp,
submitter: msg.sender
});

stockPrices[stockSymbol].push(newPrice);

emit StockPriceSubmitted(stockSymbol, price, block.timestamp, msg.sender);
}

// Function to get stock price data
function getStockPrices(string memory stockSymbol) public view returns (StockPrice[] memory) {
return stockPrices[stockSymbol];
}
}