From 4bbad0212f284499c483ab05790e2c505ca23c9c Mon Sep 17 00:00:00 2001 From: KOSASIH Date: Sat, 21 Sep 2024 19:27:12 +0700 Subject: [PATCH] Create dg_proposal.rs --- blockchain-module/dg/dg_proposal.rs | 43 +++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 blockchain-module/dg/dg_proposal.rs diff --git a/blockchain-module/dg/dg_proposal.rs b/blockchain-module/dg/dg_proposal.rs new file mode 100644 index 000000000..87b1e9803 --- /dev/null +++ b/blockchain-module/dg/dg_proposal.rs @@ -0,0 +1,43 @@ +// Import necessary libraries +use std::collections::HashMap; +use std::hash::{Hash, Hasher}; +use std::io::{Read, Write}; +use std::ops::{Add, Mul, Sub}; +use std::vec::Vec; + +// Define the Proposal struct +pub struct Proposal { + // Proposal ID + id: u32, + // Proposal title + title: String, + // Proposal description + description: String, + // Proposal status + status: ProposalStatus, +} + +// Implement the Proposal struct +impl Proposal { + // Create a new Proposal + pub fn new(id: u32, title: String, description: String) -> Self { + Proposal { + id, + title, + description, + status: ProposalStatus::Pending, + } + } +} + +// Define the ProposalStatus enum +pub enum ProposalStatus { + Pending, + Voting, + Approved, + Rejected, +} + +// Export the Proposal and ProposalStatus +pub use Proposal; +pub use ProposalStatus;