forked from solana-developers/program-examples
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlib.rs
More file actions
28 lines (22 loc) · 766 Bytes
/
lib.rs
File metadata and controls
28 lines (22 loc) · 766 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#![cfg_attr(not(test), no_std)]
use quasar_lang::prelude::*;
mod instructions;
use instructions::*;
mod state;
#[cfg(test)]
mod tests;
declare_id!("E64FVeubGC4NPNF2UBJYX4AkrVowf74fRJD9q6YhwstN");
#[program]
mod quasar_lever {
use super::*;
/// Initialize the power status account (off by default).
#[instruction(discriminator = 0)]
pub fn initialize(ctx: Ctx<InitializeLever>) -> Result<(), ProgramError> {
instructions::handle_initialize(&mut ctx.accounts)
}
/// Toggle the power switch. Logs who is pulling the lever.
#[instruction(discriminator = 1)]
pub fn switch_power(ctx: Ctx<SwitchPower>, name: String<50>) -> Result<(), ProgramError> {
instructions::handle_switch_power(&mut ctx.accounts, name)
}
}