-
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.
Merge pull request #39 from adm-metaex/penalties/block-the-clam-opera…
…tion [mtg-578] Penalties/block the clam operation
- Loading branch information
Showing
13 changed files
with
554 additions
and
5 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
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
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
pub(crate) use allow_tokenflow::*; | ||
pub(crate) use restrict_tokenflow::*; | ||
|
||
mod allow_tokenflow; | ||
mod restrict_tokenflow; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,4 +11,6 @@ mod precision; | |
mod utils; | ||
mod withdraw_mining; | ||
|
||
mod tokenflow_restrictions; | ||
|
||
mod extend_stake; |
Oops, something went wrong.