Still investigating why newly made accounts have delegates
This commit is contained in:
parent
f5aa219d5c
commit
2329e520b6
|
@ -238,7 +238,7 @@ program
|
|||
.option('-u, --uuid <string>', 'uuid')
|
||||
.option('-f, --fee <string>', 'price range end', '2')
|
||||
.option('-s, --price-range-start <string>', 'price range start', '1')
|
||||
.option('-e, --price-range-end <string>', 'price range end', '2')
|
||||
.option('-pe, --price-range-end <string>', 'price range end', '2')
|
||||
.option(
|
||||
'-arbp, --anti-rug-reserve-bp <string>',
|
||||
'optional anti-rug treasury reserve basis points (1-10000)',
|
||||
|
@ -491,7 +491,6 @@ program
|
|||
rent: anchor.web3.SYSVAR_RENT_PUBKEY,
|
||||
clock: anchor.web3.SYSVAR_CLOCK_PUBKEY,
|
||||
},
|
||||
//__private: { logAccounts: true },
|
||||
remainingAccounts,
|
||||
signers,
|
||||
instructions: instructions.length > 0 ? instructions : undefined,
|
||||
|
@ -799,8 +798,9 @@ program
|
|||
)
|
||||
)[0];
|
||||
|
||||
const fairLaunchLotteryBitmap = //@ts-ignore
|
||||
(await getFairLaunchLotteryBitmap(fairLaunchObj.tokenMint))[0];
|
||||
const fairLaunchLotteryBitmap = ( //@ts-ignore
|
||||
await getFairLaunchLotteryBitmap(fairLaunchObj.tokenMint)
|
||||
)[0];
|
||||
|
||||
await adjustTicket({
|
||||
amountNumber,
|
||||
|
@ -1129,8 +1129,9 @@ program
|
|||
)
|
||||
)[0];
|
||||
|
||||
const fairLaunchLotteryBitmap = //@ts-ignore
|
||||
(await getFairLaunchLotteryBitmap(fairLaunchObj.tokenMint))[0];
|
||||
const fairLaunchLotteryBitmap = ( //@ts-ignore
|
||||
await getFairLaunchLotteryBitmap(fairLaunchObj.tokenMint)
|
||||
)[0];
|
||||
|
||||
const ticket = await anchorProgram.account.fairLaunchTicket.fetch(
|
||||
fairLaunchTicket,
|
||||
|
@ -1253,8 +1254,9 @@ program
|
|||
const fairLaunchObj = await anchorProgram.account.fairLaunch.fetch(
|
||||
fairLaunchKey,
|
||||
);
|
||||
const fairLaunchLotteryBitmap = //@ts-ignore
|
||||
(await getFairLaunchLotteryBitmap(fairLaunchObj.tokenMint))[0];
|
||||
const fairLaunchLotteryBitmap = ( //@ts-ignore
|
||||
await getFairLaunchLotteryBitmap(fairLaunchObj.tokenMint)
|
||||
)[0];
|
||||
|
||||
await anchorProgram.rpc.startPhaseThree({
|
||||
accounts: {
|
||||
|
|
|
@ -18,7 +18,6 @@ use {
|
|||
},
|
||||
anchor_spl::token::Mint,
|
||||
spl_token::{instruction::initialize_account2, state::Account},
|
||||
std::str::FromStr,
|
||||
};
|
||||
|
||||
pub const PREFIX: &str = "fair_launch";
|
||||
|
@ -318,6 +317,11 @@ pub mod fair_launch {
|
|||
return Err(ErrorCode::TreasuryMintMismatch.into());
|
||||
}
|
||||
|
||||
if buyer_token_account.delegate.is_some() {
|
||||
msg!("Delegate {}", buyer_token_account.delegate.unwrap());
|
||||
return Err(ErrorCode::AccountShouldHaveNoDelegates.into());
|
||||
}
|
||||
|
||||
assert_owned_by(treasury_mint_info, &token_program.key)?;
|
||||
assert_owned_by(buyer_token_account_info, &token_program.key)?;
|
||||
|
||||
|
@ -335,7 +339,7 @@ pub mod fair_launch {
|
|||
if buyer_token_account.amount < charged_amount {
|
||||
return Err(ErrorCode::NotEnoughTokens.into());
|
||||
}
|
||||
|
||||
msg!("b4 {}", buyer_token_account_info.key);
|
||||
spl_token_transfer(TokenTransferParams {
|
||||
source: buyer_token_account_info.clone(),
|
||||
destination: ctx.accounts.treasury.clone(),
|
||||
|
@ -344,6 +348,7 @@ pub mod fair_launch {
|
|||
token_program: token_program.clone(),
|
||||
amount: charged_amount,
|
||||
})?;
|
||||
msg!("aft");
|
||||
} else {
|
||||
if buyer.lamports() < charged_amount {
|
||||
return Err(ErrorCode::NotEnoughSOL.into());
|
||||
|
|
|
@ -59,6 +59,8 @@ pub fn spl_token_transfer(params: TokenTransferParams<'_, '_>) -> ProgramResult
|
|||
authority_signer_seeds,
|
||||
} = params;
|
||||
|
||||
let val = &[authority_signer_seeds];
|
||||
|
||||
let result = invoke_signed(
|
||||
&spl_token::instruction::transfer(
|
||||
token_program.key,
|
||||
|
@ -69,7 +71,11 @@ pub fn spl_token_transfer(params: TokenTransferParams<'_, '_>) -> ProgramResult
|
|||
amount,
|
||||
)?,
|
||||
&[source, destination, authority, token_program],
|
||||
&[authority_signer_seeds],
|
||||
if authority_signer_seeds.len() == 0 {
|
||||
&[]
|
||||
} else {
|
||||
val
|
||||
},
|
||||
);
|
||||
|
||||
result.map_err(|_| ErrorCode::TokenTransferFailed.into())
|
||||
|
@ -183,11 +189,11 @@ pub fn get_mask_and_index_for_seq(seq: u64) -> Result<(u8, usize), ProgramError>
|
|||
}
|
||||
|
||||
pub fn assert_data_valid(data: &FairLaunchData) -> ProgramResult {
|
||||
if data.phase_one_end < data.phase_one_start {
|
||||
if data.phase_one_end <= data.phase_one_start {
|
||||
return Err(ErrorCode::TimestampsDontLineUp.into());
|
||||
}
|
||||
|
||||
if data.phase_two_end < data.phase_one_end {
|
||||
if data.phase_two_end <= data.phase_one_end {
|
||||
return Err(ErrorCode::TimestampsDontLineUp.into());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue