Skip to content

Commit

Permalink
Create dg_proposal.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
KOSASIH authored Sep 21, 2024
1 parent fdb1f6b commit 4bbad02
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions blockchain-module/dg/dg_proposal.rs
Original file line number Diff line number Diff line change
@@ -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;

0 comments on commit 4bbad02

Please sign in to comment.