Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

store bump in seeds for rebate manager #32

Merged
merged 1 commit into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
Expand Up @@ -39,8 +39,9 @@ pub fn handler(ctx: Context<CreateRebateManager>) -> Result<()> {
let authority = ctx.accounts.authority.key();
let quote_token_mint = ctx.accounts.quote_token_mint.key();
let token_vault = ctx.accounts.token_vault.key();
let bump = ctx.bumps.rebate_manager;

let rebate_manager = &mut ctx.accounts.rebate_manager;

rebate_manager.initialize(authority, quote_token_mint, token_vault)
rebate_manager.initialize(authority, quote_token_mint, token_vault, bump)
}
7 changes: 6 additions & 1 deletion programs/rebate_manager/src/state/rebate_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ pub const ADMIN_AUTH_MAX_LEN: usize = 5;
pub struct RebateManager {
pub authority: Pubkey, // 32

pub rebate_manager_bump: [u8; 1], // 1

#[max_len(ADMIN_AUTH_MAX_LEN)]
pub admin_authority: Vec<Pubkey>,

Expand All @@ -51,10 +53,11 @@ pub struct RebateManager {
}

impl RebateManager {
pub fn seeds(&self) -> [&[u8]; 2] {
pub fn seeds(&self) -> [&[u8]; 3] {
[
REBATEMANAGER_SEED.as_bytes(),
self.quote_token_mint.as_ref(),
self.rebate_manager_bump.as_ref(),
]
}

Expand All @@ -63,10 +66,12 @@ impl RebateManager {
authority: Pubkey,
quote_token_mint: Pubkey,
token_vault: Pubkey,
bump: u8
) -> Result<()> {
self.authority = authority;
self.quote_token_mint = quote_token_mint;
self.token_vault = token_vault;
self.rebate_manager_bump = [bump];

Ok(())
}
Expand Down