📥PostingReviews.sol

as of June 19 2024

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract Reviews {
    struct Review {
        address reviewer;
        string content;
        uint256 timestamp;
    }

    Review[] public reviews;

    event ReviewPosted(address indexed reviewer, string content, uint256 timestamp);

    function postReview(string memory content) public {
        reviews.push(Review({
            reviewer: msg.sender,
            content: content,
            timestamp: block.timestamp
        }));
        emit ReviewPosted(msg.sender, content, block.timestamp);
    }

    function getReview(uint256 index) public view returns (Review memory) {
        require(index < reviews.length, "Review does not exist");
        return reviews[index];
    }
}

2. Users Posting Reviews Contract

This contract allows users to post reviews, which are stored on-chain for immutability.

Key Features:

  • Posting reviews.

  • Storing reviews securely.

  • Retrieving reviews.

Last updated