The Records Smart Contract is a decentralized application (DApp) deployed on the Ethereum blockchain. It allows users to post, edit, report, verify, and flag tweets, which are stored as files on the blockchain. Verifiers play a crucial role in verifying the authenticity of tweets, while users can interact with the contract to manage their tweets.
- Users can post new tweets.
- Users can edit their previously posted tweets.
- Verifiers can register and verify the authenticity of tweets.
- Users can report tweets for review by verifiers.
- Verifiers can flag reported tweets as legitimate or permanently flagged.
- Language: Solidity
- Compiler Version: 0.8.24
- License: GNU General Public License v3.0
- SPDX-License-Identifier: GPL-3.0
- Description: Restricts access to functions to only the contract owner.
- Usage: Applied to functions that should only be callable by the contract owner.
- Description: Restricts access to functions to only registered verifiers.
- Parameters:
vr: The address of the verifier.
- Usage: Applied to functions that should only be callable by registered verifiers.
- Description: Records new files added.
- Parameters:
sender: The address of the sender.message: The message of the tweet.
- Description: Records all the flags.
- Parameters:
wer: The address of the flagger.ssss: The flag message.
- Description: Records the files (tweets).
- Parameters:
pinnu: An array of strings representing the tweets.abhi: The address of the user.
- Description: Records all the verified records.
- Parameters:
verifier: The address of the verifier.user: The address of the user.CID: The CID of the verified record.
- Description: Records all the reported files.
- Parameters:
reporter: The address of the reporter.CID: The CID of the reported file.flag: Boolean indicating whether the file was flagged.
- Description: Records all the flagged files.
- Parameters:
verifier: The address of the verifier.CID: The CID of the flagged file.decision: Boolean indicating the decision on the flag.
- Description: Records all the permanently flagged files.
- Parameters:
CID: The CID of the permanently flagged file.
- Description: Records all the edited files (tweets).
- Parameters:
newtweet: The edited tweet message.indexat: The index of the tweet.
- Type: Mapping
- Description: Check for existing file records.
- Type: Mapping
- Description: Store the file CID.
- Type: Mapping
- Description: Tracks registered users.
- Type: Mapping
- Description: Tracks registered verifiers.
- Type: Mapping
- Description: List of verified files by user.
- Type: Mapping
- Description: Used to report files.
- Type: Mapping
- Description: List of permanently flagged files.
- Type: Mapping
- Description: Stores the address and the number of files reported.
- Type: Mapping
- Description: Stores the reporter for each CID.
- Type: Mapping
- Description: Returns the user address using a function.
- Type: Mapping
- Description: Holds the verified records.
- Type: Mapping
- Description: Holds the CID of all the flagged files.
- Type: Mapping
- Description: Currently not in use, will be used in the future.
- Type: Mapping
- Description: List of reporters.
- Type: Mapping
- Description: Used to check for the CID.
- Type: Address
- Description: Address of the contract deployer.
- Type: Payable Address
- Description: Same as the contract deployer.
- Type: Unsigned Integer
- Description: Total number of registered users.
- Type: Unsigned Integer
- Description: Total number of registered verifiers.
- Type: Array of Addresses
- Description: List of verifiers.
- Type: Array of Addresses
- Description: Registered user list.
- Type: Unsigned Integer
- Description: Number of reporters.
- Type: Unsigned Integer
- Description: Number of CIDs.
- Description: Allows users to post a new tweet.
- Parameters:
message: The content of the tweet.user: The address of the user posting the tweet.
- Modifier:
onlyOwner
- Description: Enables users to edit their previously posted tweets.
- Parameters:
message: The new content of the tweet.old_CID: The CID (Content Identifier) of the tweet to be edited.user: The address of the user editing the tweet.index: The index of the tweet in the user's tweet list.
- Modifier:
onlyverfier
- Description: Retrieves a user's own tweets.
- Parameters:
user: The address of the user whose tweets are to be retrieved.
- Description: Allows users or verifiers to report a tweet.
- Parameters:
CID: The CID (Content Identifier) of the tweet being reported.reporter: The address of the user or verifier reporting the tweet.user: The address of the user who posted the tweet.
- Description: Enables verifiers to flag reported tweets.
- Parameters:
CID: The CID (Content Identifier) of the tweet being flagged.verifierAddress: The address of the verifier flagging the tweet.decision: A boolean indicating whether to flag the tweet as legitimate or permanently flagged.
- Modifier:
onlyverfier
- Description: Registers a new verifier (callable by the contract owner).
- Parameters:
verifierAddress: The address of the verifier being registered.
- Modifier:
onlyOwner
- Description: Allows verifiers to verify the authenticity of tweets.
- Parameters:
verifierAddress: The address of the verifier verifying the tweet.user: The address of the user who posted the tweet.CID: The CID (Content Identifier) of the tweet being verified.
- Modifier:
onlyverfier
- Description: Function to transfer ether.
- Parameters:
to: The address to which the ether is being transferred.amount: The amount of ether being transferred.
- Description: Returns how many records an address has.
- Parameters:
ac: The address for which the number of records is to be determined.
- Description: Checks if a user has a tweet with the same CID.
- Parameters:
user: The address of the user.CID: The CID (Content Identifier) of the tweet.
- Description: Returns the index of a tweet in a user's tweet list.
- Parameters:
user: The address of the user.CID: The CID (Content Identifier) of the tweet.
- Description: Returns the address of the reporter who reported a tweet.
- Parameters:
CID: The CID (Content Identifier) of the tweet.
- Description: Returns the address of the user who posted a tweet matching a given CID.
- Parameters:
reporter: The address of the reporter who reported the tweet.searchString: The CID (Content Identifier) of the tweet.
- Description: Deletes a specific string from the
verifiedFilesmapping. - Parameters:
addr: The address for which the string is to be deleted.stringToDelete: The string to be deleted.
- Description: Deletes a specific string from the
Recordmapping. - Parameters:
addr: The address for which the string is to be deleted.valueToDelete: The string to be deleted.
- Description: Deletes a specific string from the
verifiedFilesmapping. - Parameters:
addr: The address for which the string is to be deleted.valueToDelete: The string to be deleted.
- Description: Deletes a specific string from a mapping.
- Parameters:
addr: The address for which the string is to be deleted.valueToDelete: The string to be deleted.
- Deploy the contract on an Ethereum network.
- Use the provided functions to interact with the contract:
- Post tweets.
- Edit tweets.
- Verify tweets.
- Report tweets.
- Flag tweets.
- Register as a verifier.
This project is licensed under the terms of the GNU General Public License v3.0. For more details, see the LICENSE file.