Hell yeah i can make these and show them

This commit is contained in:
Jordan Prince 2021-09-10 22:20:05 -05:00
parent 46693dc6dd
commit b6ac259413
2 changed files with 118 additions and 3 deletions

View File

@ -158,7 +158,7 @@ program
'--keypair not provided',
)
.option('-u, --uuid <string>', 'uuid')
.action(async (files: string[], options, cmd) => {
.action(async (options, cmd) => {
const { env, uuid, keypair } = cmd.opts();
const realUuid = uuid.slice(0, 6);
@ -172,7 +172,122 @@ program
const fairLaunchObj = await anchorProgram.account.fairLaunch.fetch(
fairLaunch,
);
console.log('Fair launch object', fairLaunchObj);
//@ts-ignore
console.log('Token Mint', fairLaunchObj.tokenMint.toBase58());
//@ts-ignore
console.log('Treasury', fairLaunchObj.treasury.toBase58());
//@ts-ignore
console.log('Treasury Mint', fairLaunchObj.treasuryMint?.toBase58());
//@ts-ignore
console.log('Authority', fairLaunchObj.authority.toBase58());
//@ts-ignore
console.log('Bump', fairLaunchObj.bump);
//@ts-ignore
console.log('Treasury Bump', fairLaunchObj.treasuryBump);
//@ts-ignore
console.log('Token Mint Bump', fairLaunchObj.tokenMintBump);
console.log(
'Price Range Start',
//@ts-ignore
fairLaunchObj.data.priceRangeStart.toNumber(),
);
console.log(
'Price Range Start',
//@ts-ignore
fairLaunchObj.data.priceRangeEnd.toNumber(),
);
console.log(
'Tick Size ',
//@ts-ignore
fairLaunchObj.data.tickSize.toNumber(),
);
console.log(
'Fees ',
//@ts-ignore
fairLaunchObj.data.fee.toNumber(),
);
console.log(
'Phase One Start',
//@ts-ignore
new Date(fairLaunchObj.data.phaseOneStart.toNumber() * 1000),
);
console.log(
'Phase One End ',
//@ts-ignore
new Date(fairLaunchObj.data.phaseOneEnd.toNumber() * 1000),
);
console.log(
'Phase Two End ',
//@ts-ignore
new Date(fairLaunchObj.data.phaseTwoEnd.toNumber() * 1000),
);
console.log(
'Number of Tokens',
//@ts-ignore
fairLaunchObj.data.numberOfTokens.toNumber(),
);
console.log(
'Number of Tickets Un-Sequenced ',
//@ts-ignore
fairLaunchObj.numberTicketsUnSeqed.toNumber(),
);
console.log(
'Number of Tickets Sold ',
//@ts-ignore
fairLaunchObj.numberTicketsSold.toNumber(),
);
console.log(
'Number of Tickets Dropped ',
//@ts-ignore
fairLaunchObj.numberTicketsDropped.toNumber(),
);
console.log(
'Number of Tickets Punched ',
//@ts-ignore
fairLaunchObj.numberTicketsPunched.toNumber(),
);
console.log(
'Number of Tickets Dropped + Punched',
//@ts-ignore
fairLaunchObj.numberTicketsDropped.toNumber() +
//@ts-ignore
fairLaunchObj.numberTicketsPunched.toNumber(),
);
console.log(
'Phase Three Started',
//@ts-ignore
fairLaunchObj.phaseThreeStarted,
);
console.log(
'Current Median',
//@ts-ignore
fairLaunchObj.currentMedian.toNumber(),
);
console.log('Counts at Each Tick');
//@ts-ignore
fairLaunchObj.countsAtEachTick.forEach((c, i) =>
console.log(
//@ts-ignore
fairLaunchObj.data.priceRangeStart.toNumber() +
//@ts-ignore
i * fairLaunchObj.data.tickSize.toNumber(),
':',
c.toNumber(),
),
);
});
program.parse(process.argv);

View File

@ -727,7 +727,7 @@ pub mod fair_launch {
#[derive(Accounts)]
#[instruction(bump: u8, treasury_bump: u8, token_mint_bump: u8, data: FairLaunchData)]
pub struct InitializeFairLaunch<'info> {
#[account(init, seeds=[PREFIX.as_bytes(), token_mint.key.as_ref()], payer=payer, bump=bump, space=FAIR_LAUNCH_SPACE_VEC_START+8*(((data.price_range_end - data.price_range_start).checked_div(data.tick_size).ok_or(ErrorCode::NumericalOverflowError)? + 1)) as usize)]
#[account(init, seeds=[PREFIX.as_bytes(), token_mint.key.as_ref()], payer=payer, bump=bump, space=FAIR_LAUNCH_SPACE_VEC_START+8u64.checked_mul((data.price_range_end - data.price_range_start).checked_div(data.tick_size).ok_or(ErrorCode::NumericalOverflowError)?.checked_add(2).ok_or(ErrorCode::NumericalOverflowError)?).ok_or(ErrorCode::NumericalOverflowError)? as usize)]
fair_launch: ProgramAccount<'info, FairLaunch>,
#[account(init, seeds=[PREFIX.as_bytes(), authority.key.as_ref(), MINT.as_bytes(), data.uuid.as_bytes()], mint::authority=fair_launch, mint::decimals=0, payer=payer, bump=token_mint_bump)]
token_mint: CpiAccount<'info, Mint>,