Skip to content

Commit

Permalink
Fix some intructions
Browse files Browse the repository at this point in the history
  • Loading branch information
Aursen committed Feb 21, 2024
1 parent ab21614 commit 2aaa2d8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
12 changes: 5 additions & 7 deletions programs/network/src/jobs/process_unstakes/unstake_preprocess.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ pub struct UnstakePreprocess<'info> {

pub fn handler(ctx: Context<UnstakePreprocess>) -> Result<ThreadResponse> {
// Get accounts.
let config = &ctx.accounts.config;
let config_key = ctx.accounts.config.key();
let config = &ctx.accounts.config.load()?;
let registry = &ctx.accounts.registry;
let thread = &ctx.accounts.thread;
let unstake = &ctx.accounts.unstake;
Expand All @@ -38,19 +39,16 @@ pub fn handler(ctx: Context<UnstakePreprocess>) -> Result<ThreadResponse> {
authority: unstake.authority,
authority_tokens: get_associated_token_address(
&unstake.authority,
&config.load()?.mint,
&config.mint,
),
config: config.key(),
config: config_key,
delegation: unstake.delegation,
registry: registry.key(),
thread: thread.key(),
token_program: anchor_spl::token::ID,
unstake: unstake.key(),
worker: unstake.worker,
worker_tokens: get_associated_token_address(
&unstake.worker,
&config.load()?.mint,
),
worker_tokens: get_associated_token_address(&unstake.worker, &config.mint),
}
.to_account_metas(Some(true)),
data: crate::instruction::UnstakeProcess {}.data(),
Expand Down
5 changes: 3 additions & 2 deletions programs/network/src/jobs/take_snapshot/create_entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ pub struct TakeSnapshotCreateEntry<'info> {

pub fn handler(ctx: Context<TakeSnapshotCreateEntry>) -> Result<ThreadResponse> {
// Get accounts.
let config_key = ctx.accounts.config.key();
let config = &ctx.accounts.config.load()?;
let delegation = &ctx.accounts.delegation;
let registry = &ctx.accounts.registry;
Expand Down Expand Up @@ -102,7 +103,7 @@ pub fn handler(ctx: Context<TakeSnapshotCreateEntry>) -> Result<ThreadResponse>
Instruction {
program_id: crate::ID,
accounts: crate::accounts::TakeSnapshotCreateEntry {
config: ctx.accounts.config.key(),
config: config_key,
delegation: next_delegation_pubkey,
payer: PAYER_PUBKEY,
registry: registry.key(),
Expand All @@ -127,7 +128,7 @@ pub fn handler(ctx: Context<TakeSnapshotCreateEntry>) -> Result<ThreadResponse>
Instruction {
program_id: crate::ID,
accounts: crate::accounts::TakeSnapshotCreateFrame {
config: ctx.accounts.config.key(),
config: config_key,
payer: PAYER_PUBKEY,
registry: registry.key(),
snapshot: snapshot.key(),
Expand Down

0 comments on commit 2aaa2d8

Please sign in to comment.