more commands, more love, more life
This commit is contained in:
parent
9dd06d4d19
commit
210a956a02
|
@ -320,8 +320,9 @@ program
|
|||
)
|
||||
)[0];
|
||||
|
||||
const fairLaunchLotteryBitmap = //@ts-ignore
|
||||
(await getFairLaunchLotteryBitmap(fairLaunchObj.tokenMint))[0];
|
||||
const fairLaunchLotteryBitmap = ( //@ts-ignore
|
||||
await getFairLaunchLotteryBitmap(fairLaunchObj.tokenMint)
|
||||
)[0];
|
||||
|
||||
const remainingAccounts = [];
|
||||
const instructions = [];
|
||||
|
@ -397,6 +398,60 @@ program
|
|||
);
|
||||
});
|
||||
|
||||
program
|
||||
.command('create_fair_launch_lottery')
|
||||
.option(
|
||||
'-e, --env <string>',
|
||||
'Solana cluster env name',
|
||||
'devnet', //mainnet-beta, testnet, devnet
|
||||
)
|
||||
.option(
|
||||
'-k, --keypair <path>',
|
||||
`Solana wallet location`,
|
||||
'--keypair not provided',
|
||||
)
|
||||
.option('-f, --fair-launch <string>', 'fair launch id')
|
||||
.action(async (_, cmd) => {
|
||||
const { env, keypair, fairLaunch } = cmd.opts();
|
||||
const walletKeyPair = loadWalletKey(keypair);
|
||||
const anchorProgram = await loadFairLaunchProgram(walletKeyPair, env);
|
||||
|
||||
const fairLaunchKey = new anchor.web3.PublicKey(fairLaunch);
|
||||
const fairLaunchObj = await anchorProgram.account.fairLaunch.fetch(
|
||||
fairLaunchKey,
|
||||
);
|
||||
|
||||
const [fairLaunchLotteryBitmap, bump] = await getFairLaunchLotteryBitmap(
|
||||
//@ts-ignore
|
||||
fairLaunchObj.tokenMint,
|
||||
);
|
||||
|
||||
const exists = await anchorProgram.provider.connection.getAccountInfo(
|
||||
fairLaunchLotteryBitmap,
|
||||
);
|
||||
if (!exists) {
|
||||
await anchorProgram.rpc.createFairLaunchLotteryBitmap(bump, {
|
||||
accounts: {
|
||||
fairLaunch,
|
||||
fairLaunchLotteryBitmap,
|
||||
authority: walletKeyPair.publicKey,
|
||||
payer: walletKeyPair.publicKey,
|
||||
systemProgram: anchor.web3.SystemProgram.programId,
|
||||
rent: anchor.web3.SYSVAR_RENT_PUBKEY,
|
||||
clock: anchor.web3.SYSVAR_CLOCK_PUBKEY,
|
||||
},
|
||||
});
|
||||
|
||||
console.log(
|
||||
`created fair launch lottery bitmap Done: ${fairLaunchLotteryBitmap.toBase58()}.`,
|
||||
);
|
||||
} else {
|
||||
console.log(
|
||||
`checked fair launch lottery bitmap, exists: ${fairLaunchLotteryBitmap.toBase58()}.`,
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
program
|
||||
.command('create_missing_sequences')
|
||||
.option(
|
||||
|
|
|
@ -121,6 +121,12 @@ pub fn adjust_counts(
|
|||
.ok_or(ErrorCode::NumericalOverflowError)?;
|
||||
}
|
||||
|
||||
if total_counts == 1 {
|
||||
// degen case
|
||||
fair_launch.current_median = new_amount;
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let median_location = total_counts
|
||||
.checked_div(2)
|
||||
.ok_or(ErrorCode::NumericalOverflowError)?;
|
||||
|
|
Loading…
Reference in New Issue