Contract Note

calender iconUpdated on November 15, 2023
financial advisor
practice management

Table of Contentstable of content icon

“`soliditypragma solidity ^0.8.0;

contract Note {

// Mapping to store notesmapping(uint => NoteData) public notes;// Structure to represent a notestruct NoteData {    address author;    string content;    uint timestamp;}// Function to create a new notefunction createNote(string memory _content) public {    // Generate a unique ID for the note    uint id = notes.length++;    // Create a new note    NoteData memory noteData = NoteData({        author: msg.sender,        content: _content,        timestamp: block.timestamp    });    // Store the note    notes[id] = noteData;}// Function to get a note by its IDfunction getNote(uint _id) public view returns (NoteData memory) {    return notes[_id];}

}“`

Explanation:

  • The Note contract stores notes in a mapping called notes, where the key is the ID of the note and the value is a NoteData structure.
  • The NoteData structure contains the author’s address, the note content, and the timestamp.
  • The createNote function allows you to create a new note and store it in the notes mapping.
  • The getNote function allows you to retrieve a note by its ID.

Example Usage:

“`// Create a new noteawait note.createNote(“This is a new note.”);

// Get the note by its IDNoteData memory noteData = await note.getNote(0);

// Print the note contentconsole.log(noteData.content); // Output: This is a new note.“`

Note:

  • This contract does not include any security measures, such as authentication or authorization.
  • You can add additional functions to the contract, such as the ability to update or delete notes.
  • You can also modify the structure of the NoteData struct to include additional data fields.

Categories

Pocketful Fintech Capital Private Limited (CIN U65999DL2021PTC390548):

The SEBI Registration No. allotted to us is INZ000313732.
NSE Member Code: 90326| BSE Member Code: 6808| MCX Member Code: 57120
DP CDSL: 12099800

Compliance Officer : Mr. Randhir Kumar Chaudhari
Tel no: 011- 49022222 / 011-49022277
Email: randhir@pocketful.in

Registered Address/Correspondence Address: C- 3, Ground Floor, Okhla Industrial Area, Phase - 1, New Delhi - 110020

For any complaints, drop us an email atlegal@pocketful.in

Procedure to file a complaint on SEBI SCORES: Register on SCORES portal. Mandatory details for filing complaints on SCORES: Name, PAN, Address, Mobile Number, E-mail ID.

Smart Online Dispute Resolution|Link To Circular|Procedures and Policies|Broker Investor Charter|DP Investor Charter

Benefits: Effective Communication, Speedy redressal of the grievances.

Benefits: Effective Communication, Speedy redressal of the grievances.

Please ensure you carefully read the Risk Disclosure Document as prescribed by SEBI and our Terms of Use and Privacy Policy.
The brand name Pocketful and logo is in process of trademarks registration. The cost-effective brokerage plans make Pocketful a trustworthy and reliable online stock broker. Available on both the web and mobile, it offers unmatched convenience to traders. If you are considering opening......

Read More