Skip to content

Instantly share code, notes, and snippets.

@iBreve
Created April 29, 2022 12:05
Show Gist options
  • Save iBreve/2a6576ff8aa664a04c4eab220f375d25 to your computer and use it in GitHub Desktop.
Save iBreve/2a6576ff8aa664a04c4eab220f375d25 to your computer and use it in GitHub Desktop.
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.9.0;
contract ReportPost {
mapping(string => Block) blocks;
struct Block{
string PostUrl;
//make new with items from a list: known, unknown, or boolean true/false
string ReviewStatus;
//make new with items from a list: good, bad, satire, mixed
string Verdict;
}
constructor() public {
}
function addBlock(string memory PostUrl, string memory ReviewStatus, string memory Verdict) public {
blocks[PostUrl] = Block(PostUrl, ReviewStatus, Verdict);
}
function updateVerdict(string memory PostUrl, string memory ReviewStatus, string memory Verdict) public {
Block storage newblock = blocks[PostUrl];
newblock.Verdict = Verdict;
newblock.ReviewStatus = ReviewStatus;
}
function getVerdict(string memory PostUrl) public view returns (string memory) {
return blocks[PostUrl].Verdict;
}
function getReviewStatus(string memory PostUrl) public view returns (string memory) {
return blocks[PostUrl].ReviewStatus;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment