diff --git a/programs/mmm/src/instructions/admin/create_pool.rs b/programs/mmm/src/instructions/admin/create_pool.rs index bf594c8..6e457e7 100644 --- a/programs/mmm/src/instructions/admin/create_pool.rs +++ b/programs/mmm/src/instructions/admin/create_pool.rs @@ -26,6 +26,7 @@ pub struct CreatePool<'info> { #[account(mut)] pub owner: Signer<'info>, /// CHECK: the cosigner can be set as owner if you want optional cosigner + #[account(constraint = owner.key() != cosigner.key() @ MMMErrorCode::InvalidCosigner)] pub cosigner: Signer<'info>, #[account( init, diff --git a/programs/mmm/src/instructions/admin/set_shared_escrow.rs b/programs/mmm/src/instructions/admin/set_shared_escrow.rs index c6d0ab8..dd2c6d8 100644 --- a/programs/mmm/src/instructions/admin/set_shared_escrow.rs +++ b/programs/mmm/src/instructions/admin/set_shared_escrow.rs @@ -10,6 +10,7 @@ pub struct SetSharedEscrowArgs { pub struct SetSharedEscrow<'info> { #[account(mut)] pub owner: Signer<'info>, + #[account(constraint = owner.key() != cosigner.key() @ MMMErrorCode::InvalidCosigner)] pub cosigner: Signer<'info>, #[account( mut, diff --git a/programs/mmm/src/instructions/admin/sol_close_pool.rs b/programs/mmm/src/instructions/admin/sol_close_pool.rs index e6fb96a..04780cb 100644 --- a/programs/mmm/src/instructions/admin/sol_close_pool.rs +++ b/programs/mmm/src/instructions/admin/sol_close_pool.rs @@ -4,6 +4,7 @@ use super::*; pub struct SolClosePool<'info> { #[account(mut)] pub owner: Signer<'info>, + #[account(constraint = owner.key() != cosigner.key() @ MMMErrorCode::InvalidCosigner)] pub cosigner: Signer<'info>, #[account( mut, diff --git a/programs/mmm/src/instructions/admin/update_allowlists.rs b/programs/mmm/src/instructions/admin/update_allowlists.rs index 5e17d10..d953fb2 100644 --- a/programs/mmm/src/instructions/admin/update_allowlists.rs +++ b/programs/mmm/src/instructions/admin/update_allowlists.rs @@ -9,6 +9,7 @@ pub struct UpdateAllowlistsArgs { #[instruction(args:UpdateAllowlistsArgs)] pub struct UpdateAllowlists<'info> { #[account(mut)] + #[account(constraint = owner.key() != cosigner.key() @ MMMErrorCode::InvalidCosigner)] pub cosigner: Signer<'info>, /// CHECK: Owner is only used for seed derivation. Cosigner has_one constraint is checked in the pool account. pub owner: UncheckedAccount<'info>, diff --git a/programs/mmm/src/instructions/admin/update_pool.rs b/programs/mmm/src/instructions/admin/update_pool.rs index 3bf09e7..7cdd63e 100644 --- a/programs/mmm/src/instructions/admin/update_pool.rs +++ b/programs/mmm/src/instructions/admin/update_pool.rs @@ -20,6 +20,7 @@ pub struct UpdatePoolArgs { pub struct UpdatePool<'info> { #[account(mut)] pub owner: Signer<'info>, + #[account(constraint = owner.key() != cosigner.key() @ MMMErrorCode::InvalidCosigner)] pub cosigner: Signer<'info>, #[account( mut, diff --git a/programs/mmm/src/instructions/ext_vanilla/ext_deposit_sell.rs b/programs/mmm/src/instructions/ext_vanilla/ext_deposit_sell.rs index b414760..e93cf1f 100644 --- a/programs/mmm/src/instructions/ext_vanilla/ext_deposit_sell.rs +++ b/programs/mmm/src/instructions/ext_vanilla/ext_deposit_sell.rs @@ -19,6 +19,7 @@ use crate::{ pub struct ExtDepositeSell<'info> { #[account(mut)] pub owner: Signer<'info>, + #[account(constraint = owner.key() != cosigner.key() @ MMMErrorCode::InvalidCosigner)] pub cosigner: Signer<'info>, #[account( mut, diff --git a/programs/mmm/src/instructions/ext_vanilla/ext_withdraw_sell.rs b/programs/mmm/src/instructions/ext_vanilla/ext_withdraw_sell.rs index 5c2d38e..82919bd 100644 --- a/programs/mmm/src/instructions/ext_vanilla/ext_withdraw_sell.rs +++ b/programs/mmm/src/instructions/ext_vanilla/ext_withdraw_sell.rs @@ -19,6 +19,7 @@ use crate::{ pub struct ExtWithdrawSell<'info> { #[account(mut)] pub owner: Signer<'info>, + #[account(constraint = owner.key() != cosigner.key() @ MMMErrorCode::InvalidCosigner)] pub cosigner: Signer<'info>, #[account( mut, diff --git a/programs/mmm/src/instructions/ext_vanilla/sol_ext_fulfill_buy.rs b/programs/mmm/src/instructions/ext_vanilla/sol_ext_fulfill_buy.rs index 2618898..d2c2572 100644 --- a/programs/mmm/src/instructions/ext_vanilla/sol_ext_fulfill_buy.rs +++ b/programs/mmm/src/instructions/ext_vanilla/sol_ext_fulfill_buy.rs @@ -39,6 +39,7 @@ pub struct ExtSolFulfillBuy<'info> { /// CHECK: we will check the owner field that matches the pool owner #[account(mut)] pub owner: UncheckedAccount<'info>, + #[account(constraint = owner.key() != cosigner.key() @ MMMErrorCode::InvalidCosigner)] pub cosigner: Signer<'info>, #[account(mut)] /// CHECK: we will check that the referral matches the pool's referral diff --git a/programs/mmm/src/instructions/ext_vanilla/sol_ext_fulfill_sell.rs b/programs/mmm/src/instructions/ext_vanilla/sol_ext_fulfill_sell.rs index 4b09f3a..4636dc8 100644 --- a/programs/mmm/src/instructions/ext_vanilla/sol_ext_fulfill_sell.rs +++ b/programs/mmm/src/instructions/ext_vanilla/sol_ext_fulfill_sell.rs @@ -34,6 +34,7 @@ pub struct ExtSolFulfillSell<'info> { /// CHECK: we will check the owner field that matches the pool owner #[account(mut)] pub owner: UncheckedAccount<'info>, + #[account(constraint = owner.key() != cosigner.key() @ MMMErrorCode::InvalidCosigner)] pub cosigner: Signer<'info>, /// CHECK: we will check that the referral matches the pool's referral #[account(mut)] diff --git a/programs/mmm/src/instructions/mip1/mip1_deposit_sell.rs b/programs/mmm/src/instructions/mip1/mip1_deposit_sell.rs index b84de87..8cdaf5d 100644 --- a/programs/mmm/src/instructions/mip1/mip1_deposit_sell.rs +++ b/programs/mmm/src/instructions/mip1/mip1_deposit_sell.rs @@ -23,6 +23,7 @@ use crate::{ pub struct Mip1DepositSell<'info> { #[account(mut)] pub owner: Signer<'info>, + #[account(constraint = owner.key() != cosigner.key() @ MMMErrorCode::InvalidCosigner)] pub cosigner: Signer<'info>, #[account( mut, diff --git a/programs/mmm/src/instructions/mip1/mip1_withdraw_sell.rs b/programs/mmm/src/instructions/mip1/mip1_withdraw_sell.rs index f6b0a2b..4d0651d 100644 --- a/programs/mmm/src/instructions/mip1/mip1_withdraw_sell.rs +++ b/programs/mmm/src/instructions/mip1/mip1_withdraw_sell.rs @@ -24,6 +24,7 @@ use crate::{ pub struct Mip1WithdrawSell<'info> { #[account(mut)] pub owner: Signer<'info>, + #[account(constraint = owner.key() != cosigner.key() @ MMMErrorCode::InvalidCosigner)] pub cosigner: Signer<'info>, #[account( mut, diff --git a/programs/mmm/src/instructions/mip1/sol_mip1_fulfill_buy.rs b/programs/mmm/src/instructions/mip1/sol_mip1_fulfill_buy.rs index 9d02849..2b0347a 100644 --- a/programs/mmm/src/instructions/mip1/sol_mip1_fulfill_buy.rs +++ b/programs/mmm/src/instructions/mip1/sol_mip1_fulfill_buy.rs @@ -38,6 +38,7 @@ pub struct SolMip1FulfillBuy<'info> { /// CHECK: we will check the owner field that matches the pool owner #[account(mut)] pub owner: UncheckedAccount<'info>, + #[account(constraint = owner.key() != cosigner.key() @ MMMErrorCode::InvalidCosigner)] pub cosigner: Signer<'info>, #[account(mut)] /// CHECK: we will check that the referral matches the pool's referral diff --git a/programs/mmm/src/instructions/mip1/sol_mip1_fulfill_sell.rs b/programs/mmm/src/instructions/mip1/sol_mip1_fulfill_sell.rs index ad38b4e..0db15bb 100644 --- a/programs/mmm/src/instructions/mip1/sol_mip1_fulfill_sell.rs +++ b/programs/mmm/src/instructions/mip1/sol_mip1_fulfill_sell.rs @@ -41,6 +41,7 @@ pub struct SolMip1FulfillSell<'info> { /// CHECK: we will check the owner field that matches the pool owner #[account(mut)] pub owner: UncheckedAccount<'info>, + #[account(constraint = owner.key() != cosigner.key() @ MMMErrorCode::InvalidCosigner)] pub cosigner: Signer<'info>, /// CHECK: we will check that the referral matches the pool's referral #[account(mut)] diff --git a/programs/mmm/src/instructions/mpl_core_asset/mpl_core_deposit_sell.rs b/programs/mmm/src/instructions/mpl_core_asset/mpl_core_deposit_sell.rs index 5cf0cba..9ba92bc 100644 --- a/programs/mmm/src/instructions/mpl_core_asset/mpl_core_deposit_sell.rs +++ b/programs/mmm/src/instructions/mpl_core_asset/mpl_core_deposit_sell.rs @@ -23,6 +23,7 @@ pub struct MplCoreDepositSellArgs { pub struct MplCoreDepositSell<'info> { #[account(mut)] pub owner: Signer<'info>, + #[account(constraint = owner.key() != cosigner.key() @ MMMErrorCode::InvalidCosigner)] pub cosigner: Signer<'info>, #[account( mut, diff --git a/programs/mmm/src/instructions/mpl_core_asset/mpl_core_withdraw_sell.rs b/programs/mmm/src/instructions/mpl_core_asset/mpl_core_withdraw_sell.rs index 1d2b748..41326d3 100644 --- a/programs/mmm/src/instructions/mpl_core_asset/mpl_core_withdraw_sell.rs +++ b/programs/mmm/src/instructions/mpl_core_asset/mpl_core_withdraw_sell.rs @@ -19,6 +19,7 @@ pub struct MplCoreWithdrawSellArgs { pub struct MplCoreWithdrawSell<'info> { #[account(mut)] pub owner: Signer<'info>, + #[account(constraint = owner.key() != cosigner.key() @ MMMErrorCode::InvalidCosigner)] pub cosigner: Signer<'info>, #[account( mut, diff --git a/programs/mmm/src/instructions/mpl_core_asset/sol_mpl_core_fulfill_buy.rs b/programs/mmm/src/instructions/mpl_core_asset/sol_mpl_core_fulfill_buy.rs index 69bdb7e..e38f3f7 100644 --- a/programs/mmm/src/instructions/mpl_core_asset/sol_mpl_core_fulfill_buy.rs +++ b/programs/mmm/src/instructions/mpl_core_asset/sol_mpl_core_fulfill_buy.rs @@ -38,6 +38,7 @@ pub struct SolMplCoreFulfillBuy<'info> { /// CHECK: we will check the owner field that matches the pool owner #[account(mut)] pub owner: UncheckedAccount<'info>, + #[account(constraint = owner.key() != cosigner.key() @ MMMErrorCode::InvalidCosigner)] pub cosigner: Signer<'info>, #[account(mut)] /// CHECK: we will check that the referral matches the pool's referral diff --git a/programs/mmm/src/instructions/mpl_core_asset/sol_mpl_core_fulfill_sell.rs b/programs/mmm/src/instructions/mpl_core_asset/sol_mpl_core_fulfill_sell.rs index feea84b..c04e6d8 100644 --- a/programs/mmm/src/instructions/mpl_core_asset/sol_mpl_core_fulfill_sell.rs +++ b/programs/mmm/src/instructions/mpl_core_asset/sol_mpl_core_fulfill_sell.rs @@ -38,6 +38,7 @@ pub struct SolMplCoreFulfillSell<'info> { /// CHECK: we will check the owner field that matches the pool owner #[account(mut)] pub owner: UncheckedAccount<'info>, + #[account(constraint = owner.key() != cosigner.key() @ MMMErrorCode::InvalidCosigner)] pub cosigner: Signer<'info>, /// CHECK: we will check that the referral matches the pool's referral #[account(mut)] diff --git a/programs/mmm/src/instructions/ocp/ocp_deposit_sell.rs b/programs/mmm/src/instructions/ocp/ocp_deposit_sell.rs index 119b929..8ffeab9 100644 --- a/programs/mmm/src/instructions/ocp/ocp_deposit_sell.rs +++ b/programs/mmm/src/instructions/ocp/ocp_deposit_sell.rs @@ -19,6 +19,7 @@ use crate::{ pub struct OcpDepositSell<'info> { #[account(mut)] pub owner: Signer<'info>, + #[account(constraint = owner.key() != cosigner.key() @ MMMErrorCode::InvalidCosigner)] pub cosigner: Signer<'info>, #[account( mut, diff --git a/programs/mmm/src/instructions/ocp/ocp_withdraw_sell.rs b/programs/mmm/src/instructions/ocp/ocp_withdraw_sell.rs index bfbec95..acb02e4 100644 --- a/programs/mmm/src/instructions/ocp/ocp_withdraw_sell.rs +++ b/programs/mmm/src/instructions/ocp/ocp_withdraw_sell.rs @@ -19,6 +19,7 @@ use crate::{ pub struct OcpWithdrawSell<'info> { #[account(mut)] pub owner: Signer<'info>, + #[account(constraint = owner.key() != cosigner.key() @ MMMErrorCode::InvalidCosigner)] pub cosigner: Signer<'info>, #[account( mut, diff --git a/programs/mmm/src/instructions/ocp/sol_ocp_fulfill_buy.rs b/programs/mmm/src/instructions/ocp/sol_ocp_fulfill_buy.rs index 826a5dd..9b61a12 100644 --- a/programs/mmm/src/instructions/ocp/sol_ocp_fulfill_buy.rs +++ b/programs/mmm/src/instructions/ocp/sol_ocp_fulfill_buy.rs @@ -36,6 +36,7 @@ pub struct SolOcpFulfillBuy<'info> { /// CHECK: we will check the owner field that matches the pool owner #[account(mut)] pub owner: UncheckedAccount<'info>, + #[account(constraint = owner.key() != cosigner.key() @ MMMErrorCode::InvalidCosigner)] pub cosigner: Signer<'info>, #[account(mut)] /// CHECK: we will check that the referral matches the pool's referral diff --git a/programs/mmm/src/instructions/ocp/sol_ocp_fulfill_sell.rs b/programs/mmm/src/instructions/ocp/sol_ocp_fulfill_sell.rs index 89598c9..3465a3c 100644 --- a/programs/mmm/src/instructions/ocp/sol_ocp_fulfill_sell.rs +++ b/programs/mmm/src/instructions/ocp/sol_ocp_fulfill_sell.rs @@ -40,6 +40,7 @@ pub struct SolOcpFulfillSell<'info> { /// CHECK: we will check the owner field that matches the pool owner #[account(mut)] pub owner: UncheckedAccount<'info>, + #[account(constraint = owner.key() != cosigner.key() @ MMMErrorCode::InvalidCosigner)] pub cosigner: Signer<'info>, /// CHECK: we will check that the referral matches the pool's referral #[account(mut)] diff --git a/programs/mmm/src/instructions/vanilla/deposit_sell.rs b/programs/mmm/src/instructions/vanilla/deposit_sell.rs index f364c6e..c5a08b1 100644 --- a/programs/mmm/src/instructions/vanilla/deposit_sell.rs +++ b/programs/mmm/src/instructions/vanilla/deposit_sell.rs @@ -22,6 +22,7 @@ pub struct DepositSellArgs { pub struct DepositSell<'info> { #[account(mut)] pub owner: Signer<'info>, + #[account(constraint = owner.key() != cosigner.key() @ MMMErrorCode::InvalidCosigner)] pub cosigner: Signer<'info>, #[account( mut, diff --git a/programs/mmm/src/instructions/vanilla/sol_deposit_buy.rs b/programs/mmm/src/instructions/vanilla/sol_deposit_buy.rs index 1cdb833..b78b736 100644 --- a/programs/mmm/src/instructions/vanilla/sol_deposit_buy.rs +++ b/programs/mmm/src/instructions/vanilla/sol_deposit_buy.rs @@ -13,6 +13,7 @@ pub struct SolDepositBuyArgs { pub struct SolDepositBuy<'info> { #[account(mut)] pub owner: Signer<'info>, + #[account(constraint = owner.key() != cosigner.key() @ MMMErrorCode::InvalidCosigner)] pub cosigner: Signer<'info>, #[account( mut, diff --git a/programs/mmm/src/instructions/vanilla/sol_fulfill_buy.rs b/programs/mmm/src/instructions/vanilla/sol_fulfill_buy.rs index c9927e4..2e0ec96 100644 --- a/programs/mmm/src/instructions/vanilla/sol_fulfill_buy.rs +++ b/programs/mmm/src/instructions/vanilla/sol_fulfill_buy.rs @@ -41,6 +41,7 @@ pub struct SolFulfillBuy<'info> { /// CHECK: we will check the owner field that matches the pool owner #[account(mut)] pub owner: UncheckedAccount<'info>, + #[account(constraint = owner.key() != cosigner.key() @ MMMErrorCode::InvalidCosigner)] pub cosigner: Signer<'info>, #[account(mut)] /// CHECK: we will check that the referral matches the pool's referral diff --git a/programs/mmm/src/instructions/vanilla/sol_fulfill_sell.rs b/programs/mmm/src/instructions/vanilla/sol_fulfill_sell.rs index c136b4e..ced157e 100644 --- a/programs/mmm/src/instructions/vanilla/sol_fulfill_sell.rs +++ b/programs/mmm/src/instructions/vanilla/sol_fulfill_sell.rs @@ -38,6 +38,7 @@ pub struct SolFulfillSell<'info> { /// CHECK: we will check the owner field that matches the pool owner #[account(mut)] pub owner: UncheckedAccount<'info>, + #[account(constraint = owner.key() != cosigner.key() @ MMMErrorCode::InvalidCosigner)] pub cosigner: Signer<'info>, /// CHECK: we will check that the referral matches the pool's referral #[account(mut)] diff --git a/programs/mmm/src/instructions/vanilla/sol_withdraw_buy.rs b/programs/mmm/src/instructions/vanilla/sol_withdraw_buy.rs index 92ec855..ca0079a 100644 --- a/programs/mmm/src/instructions/vanilla/sol_withdraw_buy.rs +++ b/programs/mmm/src/instructions/vanilla/sol_withdraw_buy.rs @@ -16,6 +16,7 @@ pub struct SolWithdrawBuyArgs { pub struct SolWithdrawBuy<'info> { #[account(mut)] pub owner: Signer<'info>, + #[account(constraint = owner.key() != cosigner.key() @ MMMErrorCode::InvalidCosigner)] pub cosigner: Signer<'info>, #[account( mut, diff --git a/programs/mmm/src/instructions/vanilla/withdraw_sell.rs b/programs/mmm/src/instructions/vanilla/withdraw_sell.rs index 0017228..b7ad6f5 100644 --- a/programs/mmm/src/instructions/vanilla/withdraw_sell.rs +++ b/programs/mmm/src/instructions/vanilla/withdraw_sell.rs @@ -22,6 +22,7 @@ pub struct WithdrawSellArgs { pub struct WithdrawSell<'info> { #[account(mut)] pub owner: Signer<'info>, + #[account(constraint = owner.key() != cosigner.key() @ MMMErrorCode::InvalidCosigner)] pub cosigner: Signer<'info>, #[account( mut,