Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
use {
crate::state::PowerStatus,
crate::state::{PowerStatus, PowerStatusInner},
quasar_lang::prelude::*,
};

/// Accounts for initialising the power status (PDA seeded by "power").
#[derive(Accounts)]
pub struct InitializeLever<'info> {
pub struct InitializeLever {
#[account(mut)]
pub payer: &'info mut Signer,
#[account(mut, init, payer = payer, seeds = [b"power"], bump)]
pub power: &'info mut Account<PowerStatus>,
pub system_program: &'info Program<System>,
pub payer: Signer,
#[account(mut, init, payer = payer, seeds = PowerStatus::seeds(), bump)]
pub power: Account<PowerStatus>,
pub system_program: Program<System>,
}

#[inline(always)]
pub fn handle_initialize(accounts: &mut InitializeLever) -> Result<(), ProgramError> {
// Power starts off (false).
accounts.power.set_inner(PodBool::from(false));
// Power starts off (false). Counter-style fixed-size set_inner takes only the inner value.
accounts.power.set_inner(PowerStatusInner { is_on: PodBool::from(false) });
Ok(())
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ use {

/// Accounts for toggling the power switch.
#[derive(Accounts)]
pub struct SwitchPower<'info> {
pub struct SwitchPower {
#[account(mut)]
pub power: &'info mut Account<PowerStatus>,
pub power: Account<PowerStatus>,
}

#[inline(always)]
Expand Down
2 changes: 1 addition & 1 deletion basics/cross-program-invocation/quasar/lever/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ mod quasar_lever {

/// Toggle the power switch. Logs who is pulling the lever.
#[instruction(discriminator = 1)]
pub fn switch_power(ctx: Ctx<SwitchPower>, name: String) -> Result<(), ProgramError> {
pub fn switch_power(ctx: Ctx<SwitchPower>, name: String<50>) -> Result<(), ProgramError> {
Comment thread
cursor[bot] marked this conversation as resolved.
instructions::handle_switch_power(&mut ctx.accounts, name)
}
}
4 changes: 3 additions & 1 deletion basics/cross-program-invocation/quasar/lever/src/state.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
use quasar_lang::prelude::*;

/// Onchain power status: a single boolean toggle.
#[account(discriminator = 1)]
/// Derived as a PDA from the seed "power" (single global account).
#[account(discriminator = 1, set_inner)]
#[seeds(b"power")]
pub struct PowerStatus {
pub is_on: PodBool,
}
2 changes: 1 addition & 1 deletion tokens/token-extensions/basics/quasar/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ quasar-spl = { git = "https://github.com/blueshift-gg/quasar", branch = "master"
solana-instruction = { version = "3.2.0" }

[dev-dependencies]
quasar-svm = { version = "0.1" }
quasar-svm = { git = "https://github.com/blueshift-gg/quasar-svm" }
spl-token-interface = { version = "2.0.0" }
solana-program-pack = { version = "3.1.0" }
2 changes: 1 addition & 1 deletion tokens/token-extensions/cpi-guard/quasar/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ quasar-spl = { git = "https://github.com/blueshift-gg/quasar", branch = "master"
solana-instruction = { version = "3.2.0" }

[dev-dependencies]
quasar-svm = { version = "0.1" }
quasar-svm = { git = "https://github.com/blueshift-gg/quasar-svm" }
spl-token-interface = { version = "2.0.0" }
solana-program-pack = { version = "3.1.0" }
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ quasar-spl = { git = "https://github.com/blueshift-gg/quasar", branch = "master"
solana-instruction = { version = "3.2.0" }

[dev-dependencies]
quasar-svm = { version = "0.1" }
quasar-svm = { git = "https://github.com/blueshift-gg/quasar-svm" }
spl-token-interface = { version = "2.0.0" }
solana-program-pack = { version = "3.1.0" }
2 changes: 1 addition & 1 deletion tokens/token-extensions/group/quasar/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ quasar-spl = { git = "https://github.com/blueshift-gg/quasar", branch = "master"
solana-instruction = { version = "3.2.0" }

[dev-dependencies]
quasar-svm = { version = "0.1" }
quasar-svm = { git = "https://github.com/blueshift-gg/quasar-svm" }
spl-token-interface = { version = "2.0.0" }
solana-program-pack = { version = "3.1.0" }
2 changes: 1 addition & 1 deletion tokens/token-extensions/immutable-owner/quasar/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ quasar-spl = { git = "https://github.com/blueshift-gg/quasar", branch = "master"
solana-instruction = { version = "3.2.0" }

[dev-dependencies]
quasar-svm = { version = "0.1" }
quasar-svm = { git = "https://github.com/blueshift-gg/quasar-svm" }
spl-token-interface = { version = "2.0.0" }
solana-program-pack = { version = "3.1.0" }
2 changes: 1 addition & 1 deletion tokens/token-extensions/interest-bearing/quasar/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ quasar-spl = { git = "https://github.com/blueshift-gg/quasar", branch = "master"
solana-instruction = { version = "3.2.0" }

[dev-dependencies]
quasar-svm = { version = "0.1" }
quasar-svm = { git = "https://github.com/blueshift-gg/quasar-svm" }
spl-token-interface = { version = "2.0.0" }
solana-program-pack = { version = "3.1.0" }
2 changes: 1 addition & 1 deletion tokens/token-extensions/memo-transfer/quasar/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ quasar-spl = { git = "https://github.com/blueshift-gg/quasar", branch = "master"
solana-instruction = { version = "3.2.0" }

[dev-dependencies]
quasar-svm = { version = "0.1" }
quasar-svm = { git = "https://github.com/blueshift-gg/quasar-svm" }
spl-token-interface = { version = "2.0.0" }
solana-program-pack = { version = "3.1.0" }
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ quasar-spl = { git = "https://github.com/blueshift-gg/quasar", branch = "master"
solana-instruction = { version = "3.2.0" }

[dev-dependencies]
quasar-svm = { version = "0.1" }
quasar-svm = { git = "https://github.com/blueshift-gg/quasar-svm" }
spl-token-interface = { version = "2.0.0" }
solana-program-pack = { version = "3.1.0" }
2 changes: 1 addition & 1 deletion tokens/token-extensions/non-transferable/quasar/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ quasar-spl = { git = "https://github.com/blueshift-gg/quasar", branch = "master"
solana-instruction = { version = "3.2.0" }

[dev-dependencies]
quasar-svm = { version = "0.1" }
quasar-svm = { git = "https://github.com/blueshift-gg/quasar-svm" }
spl-token-interface = { version = "2.0.0" }
solana-program-pack = { version = "3.1.0" }
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ quasar-spl = { git = "https://github.com/blueshift-gg/quasar", branch = "master"
solana-instruction = { version = "3.2.0" }

[dev-dependencies]
quasar-svm = { version = "0.1" }
quasar-svm = { git = "https://github.com/blueshift-gg/quasar-svm" }
spl-token-interface = { version = "2.0.0" }
solana-program-pack = { version = "3.1.0" }
2 changes: 1 addition & 1 deletion tokens/token-extensions/transfer-fee/quasar/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ quasar-spl = { git = "https://github.com/blueshift-gg/quasar", branch = "master"
solana-instruction = { version = "3.2.0" }

[dev-dependencies]
quasar-svm = { version = "0.1" }
quasar-svm = { git = "https://github.com/blueshift-gg/quasar-svm" }
spl-token-interface = { version = "2.0.0" }
solana-program-pack = { version = "3.1.0" }
Loading