-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8a5b238
commit a638638
Showing
14 changed files
with
252 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 0 additions & 32 deletions
32
programs/rewards/src/instructions/penalties/allow_claiming.rs
This file was deleted.
Oops, something went wrong.
31 changes: 31 additions & 0 deletions
31
programs/rewards/src/instructions/penalties/allow_tokenflow.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
use crate::{asserts::assert_and_get_pool_and_mining, utils::AccountLoader}; | ||
use solana_program::{account_info::AccountInfo, entrypoint::ProgramResult, pubkey::Pubkey}; | ||
|
||
pub fn process_allow_tokenflow<'a>( | ||
program_id: &Pubkey, | ||
accounts: &'a [AccountInfo<'a>], | ||
mining_owner: &Pubkey, | ||
) -> ProgramResult { | ||
let account_info_iter = &mut accounts.iter().enumerate(); | ||
|
||
let deposit_authority = AccountLoader::next_signer(account_info_iter)?; | ||
let reward_pool = AccountLoader::next_with_owner(account_info_iter, program_id)?; | ||
let mining = AccountLoader::next_with_owner(account_info_iter, program_id)?; | ||
|
||
let reward_pool_data = &mut reward_pool.data.borrow_mut(); | ||
let mining_data = &mut mining.data.borrow_mut(); | ||
|
||
let (_, wrapped_mining) = assert_and_get_pool_and_mining( | ||
program_id, | ||
mining_owner, | ||
mining, | ||
reward_pool, | ||
deposit_authority, | ||
reward_pool_data, | ||
mining_data, | ||
)?; | ||
|
||
wrapped_mining.mining.allow_tokenflow()?; | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
pub(crate) use allow_claiming::*; | ||
pub(crate) use restrict_claiming::*; | ||
pub(crate) use allow_tokenflow::*; | ||
pub(crate) use restrict_tokenflow::*; | ||
|
||
mod allow_claiming; | ||
mod restrict_claiming; | ||
mod allow_tokenflow; | ||
mod restrict_tokenflow; |
32 changes: 0 additions & 32 deletions
32
programs/rewards/src/instructions/penalties/restrict_claiming.rs
This file was deleted.
Oops, something went wrong.
31 changes: 31 additions & 0 deletions
31
programs/rewards/src/instructions/penalties/restrict_tokenflow.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
use crate::{asserts::assert_and_get_pool_and_mining, utils::AccountLoader}; | ||
use solana_program::{account_info::AccountInfo, entrypoint::ProgramResult, pubkey::Pubkey}; | ||
|
||
pub fn process_restrict_tokenflow<'a>( | ||
program_id: &Pubkey, | ||
accounts: &'a [AccountInfo<'a>], | ||
mining_owner: &Pubkey, | ||
) -> ProgramResult { | ||
let account_info_iter = &mut accounts.iter().enumerate(); | ||
|
||
let deposit_authority = AccountLoader::next_signer(account_info_iter)?; | ||
let reward_pool = AccountLoader::next_with_owner(account_info_iter, program_id)?; | ||
let mining = AccountLoader::next_with_owner(account_info_iter, program_id)?; | ||
|
||
let reward_pool_data = &mut reward_pool.data.borrow_mut(); | ||
let mining_data = &mut mining.data.borrow_mut(); | ||
|
||
let (_, wrapped_mining) = assert_and_get_pool_and_mining( | ||
program_id, | ||
mining_owner, | ||
mining, | ||
reward_pool, | ||
deposit_authority, | ||
reward_pool_data, | ||
mining_data, | ||
)?; | ||
|
||
wrapped_mining.mining.restrict_tokenflow()?; | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.