Skip to content

Commit

Permalink
move shutdown notice in lib.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
Giannis Chatziveroglou authored and jpbogle committed Jul 22, 2023
1 parent f14998f commit 3a9bf36
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 29 deletions.
9 changes: 9 additions & 0 deletions programs/cardinal-rewards-center/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use crate::errors::ErrorCode;
pub mod stake_pool;
pub use stake_pool::*;
pub mod stake_entry;
Expand Down Expand Up @@ -27,6 +28,7 @@ pub mod cardinal_rewards_center {

//// stake_pool ////
pub fn init_pool(ctx: Context<InitPoolCtx>, ix: InitPoolIx) -> Result<()> {
return Err(error!(ErrorCode::ProtocolsShutdown));
stake_pool::init_pool::handler(ctx, ix)
}
pub fn update_pool(ctx: Context<UpdatePoolCtx>, ix: UpdatePoolIx) -> Result<()> {
Expand All @@ -38,6 +40,7 @@ pub mod cardinal_rewards_center {

//// stake_entry ////
pub fn init_entry(ctx: Context<InitEntryCtx>, user: Pubkey) -> Result<()> {
return Err(error!(ErrorCode::ProtocolsShutdown));
stake_entry::init_entry::handler(ctx, user)
}
pub fn update_total_stake_seconds(ctx: Context<UpdateTotalStakeSecondsCtx>) -> Result<()> {
Expand Down Expand Up @@ -66,19 +69,22 @@ pub mod cardinal_rewards_center {
}
//// stake_entry::editions ////
pub fn stake_edition<'key, 'accounts, 'remaining, 'info>(ctx: Context<'key, 'accounts, 'remaining, 'info, StakeEditionCtx<'info>>, amount: u64) -> Result<()> {
return Err(error!(ErrorCode::ProtocolsShutdown));
stake_entry::editions::stake_edition::handler(ctx, amount)
}
pub fn unstake_edition<'key, 'accounts, 'remaining, 'info>(ctx: Context<'key, 'accounts, 'remaining, 'info, UnstakeEditionCtx<'info>>) -> Result<()> {
stake_entry::editions::unstake_edition::handler(ctx)
}
//// stake_entry::ccs ////
pub fn stake_ccs<'key, 'accounts, 'remaining, 'info>(ctx: Context<'key, 'accounts, 'remaining, 'info, StakeCCSCtx<'info>>, amount: u64) -> Result<()> {
return Err(error!(ErrorCode::ProtocolsShutdown));
stake_entry::ccs::stake_ccs::handler(ctx, amount)
}
pub fn unstake_ccs<'key, 'accounts, 'remaining, 'info>(ctx: Context<'key, 'accounts, 'remaining, 'info, UnstakeCCSCtx<'info>>) -> Result<()> {
stake_entry::ccs::unstake_ccs::handler(ctx)
}
pub fn stake_pnft(ctx: Context<StakePNFTCtx>) -> Result<()> {
return Err(error!(ErrorCode::ProtocolsShutdown));
stake_entry::pnfts::stake_pnft::handler(ctx)
}

Expand All @@ -96,12 +102,14 @@ pub mod cardinal_rewards_center {

//// stake_booster ////
pub fn init_stake_booster(ctx: Context<InitStakeBoosterCtx>, ix: InitStakeBoosterIx) -> Result<()> {
return Err(error!(ErrorCode::ProtocolsShutdown));
stake_booster::init_stake_booster::handler(ctx, ix)
}
pub fn update_stake_booster(ctx: Context<UpdateStakeBoosterCtx>, ix: UpdateStakeBoosterIx) -> Result<()> {
stake_booster::update_stake_booster::handler(ctx, ix)
}
pub fn boost_stake_entry(ctx: Context<BoostStakeEntryCtx>, ix: BoostStakeEntryIx) -> Result<()> {
return Err(error!(ErrorCode::ProtocolsShutdown));
stake_booster::boost_stake_entry::handler(ctx, ix)
}
pub fn close_stake_booster(ctx: Context<CloseStakeBoosterCtx>) -> Result<()> {
Expand Down Expand Up @@ -137,6 +145,7 @@ pub mod cardinal_rewards_center {
//// reward_distribution ////
//// reward_distribution::reward_distributor ////
pub fn init_reward_distributor(ctx: Context<InitRewardDistributorCtx>, ix: InitRewardDistributorIx) -> Result<()> {
return Err(error!(ErrorCode::ProtocolsShutdown));
reward_distribution::reward_distributor::init_reward_distributor::handler(ctx, ix)
}
pub fn update_reward_distributor(ctx: Context<UpdateRewardDistributorCtx>, ix: UpdateRewardDistributorIx) -> Result<()> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,5 @@ pub fn handler(ctx: Context<InitRewardDistributorCtx>, ix: InitRewardDistributor
reward_distributor.claim_rewards_payment_info = ix.claim_rewards_payment_info;

assert_payment_info(ctx.accounts.stake_pool.key(), Action::ClaimRewards, ix.claim_rewards_payment_info)?;

// shutdown
return Err(error!(ErrorCode::ProtocolsShutdown));
// Ok(())
Ok(())
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,5 @@ pub fn handler(ctx: Context<BoostStakeEntryCtx>, ix: BoostStakeEntryIx) -> Resul
ctx.accounts.stake_booster.boost_action_payment_info,
)?;
handle_payment_info(ctx.accounts.stake_booster.boost_action_payment_info, remaining_accounts)?;

// shutdown
return Err(error!(ErrorCode::ProtocolsShutdown));
// Ok(())
Ok(())
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,5 @@ pub fn handler(ctx: Context<InitStakeBoosterCtx>, ix: InitStakeBoosterIx) -> Res
stake_booster.start_time_seconds = ix.start_time_seconds;
stake_booster.boost_action_payment_info = ix.boost_action_payment_info;

// shutdown
return Err(error!(ErrorCode::ProtocolsShutdown));
// Ok(())
Ok(())
}
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,5 @@ pub fn handler<'key, 'accounts, 'remaining, 'info>(ctx: Context<'key, 'accounts,
stake_pool.total_staked = stake_pool.total_staked.checked_add(1).expect("Add error");
stake_entry_fill_zeros(stake_entry)?;

// shutdown
return Err(error!(ErrorCode::ProtocolsShutdown));
// Ok(())
Ok(())
}
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,5 @@ pub fn handler<'key, 'accounts, 'remaining, 'info>(ctx: Context<'key, 'accounts,
stake_pool.total_staked = stake_pool.total_staked.checked_add(1).expect("Add error");
stake_entry_fill_zeros(stake_entry)?;

// shutdown
return Err(error!(ErrorCode::ProtocolsShutdown));
// Ok(())
Ok(())
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use crate::authorization::mint_is_allowed;
use crate::errors::ErrorCode;
use crate::stake_seed;
use crate::StakeEntry;
use crate::StakePool;
Expand Down Expand Up @@ -43,7 +42,5 @@ pub fn handler(ctx: Context<InitEntryCtx>, _user: Pubkey) -> Result<()> {
let remaining_accounts = &mut ctx.remaining_accounts.iter();
mint_is_allowed(stake_pool, &ctx.accounts.stake_mint_metadata, ctx.accounts.stake_mint.key(), remaining_accounts)?;

// shutdown
return Err(error!(ErrorCode::ProtocolsShutdown));
// Ok(())
Ok(())
}
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,5 @@ pub fn handler(ctx: Context<StakePNFTCtx>) -> Result<()> {
&[&user_escrow_seeds.iter().map(|s| s.as_slice()).collect::<Vec<&[u8]>>()],
)?;

// shutdown
return Err(error!(ErrorCode::ProtocolsShutdown));
// Ok(())
Ok(())
}
6 changes: 1 addition & 5 deletions programs/cardinal-rewards-center/src/stake_pool/init_pool.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use crate::assert_payment_info;
use crate::errors::ErrorCode;
use crate::utils::resize_account;
use crate::Action;
use crate::StakePool;
Expand Down Expand Up @@ -72,8 +71,5 @@ pub fn handler(ctx: Context<InitPoolCtx>, ix: InitPoolIx) -> Result<()> {
)?;

stake_pool.set_inner(new_stake_pool);

// shutdown
return Err(error!(ErrorCode::ProtocolsShutdown));
// Ok(())
Ok(())
}

0 comments on commit 3a9bf36

Please sign in to comment.