generated from stackclass/solana-voting-program
Initial commit
This commit is contained in:
42
programs/voting-program/src/lib.rs
Normal file
42
programs/voting-program/src/lib.rs
Normal file
@@ -0,0 +1,42 @@
|
||||
use anchor_lang::prelude::*;
|
||||
|
||||
declare_id!("Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS");
|
||||
|
||||
#[program]
|
||||
pub mod voting_program {
|
||||
use super::*;
|
||||
|
||||
pub fn initialize_proposal(
|
||||
ctx: Context<InitializeProposal>,
|
||||
title: String,
|
||||
options: Vec<String>,
|
||||
) -> Result<()> {
|
||||
// Students will implement this function
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn vote(ctx: Context<Vote>, option_index: u32) -> Result<()> {
|
||||
// Students will implement this function
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
#[account]
|
||||
pub struct Proposal {
|
||||
// Students will complete this struct
|
||||
}
|
||||
|
||||
#[derive(Accounts)]
|
||||
pub struct InitializeProposal<'info> {
|
||||
// Students will complete this struct
|
||||
}
|
||||
|
||||
#[derive(Accounts)]
|
||||
pub struct Vote<'info> {
|
||||
// Students will complete this struct
|
||||
}
|
||||
|
||||
#[error_code]
|
||||
pub enum VotingError {
|
||||
// Students will define error codes
|
||||
}
|
||||
Reference in New Issue
Block a user