@zemyth/raise-sdk 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -9
- package/dist/accounts/index.cjs +531 -3
- package/dist/accounts/index.cjs.map +1 -1
- package/dist/accounts/index.d.cts +307 -2
- package/dist/accounts/index.d.ts +307 -2
- package/dist/accounts/index.js +503 -4
- package/dist/accounts/index.js.map +1 -1
- package/dist/constants/index.cjs +41 -3
- package/dist/constants/index.cjs.map +1 -1
- package/dist/constants/index.d.cts +38 -3
- package/dist/constants/index.d.ts +38 -3
- package/dist/constants/index.js +40 -4
- package/dist/constants/index.js.map +1 -1
- package/dist/index.cjs +2297 -361
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +566 -7
- package/dist/index.d.ts +566 -7
- package/dist/index.js +2279 -379
- package/dist/index.js.map +1 -1
- package/dist/instructions/index.cjs +783 -40
- package/dist/instructions/index.cjs.map +1 -1
- package/dist/instructions/index.d.cts +492 -6
- package/dist/instructions/index.d.ts +492 -6
- package/dist/instructions/index.js +762 -42
- package/dist/instructions/index.js.map +1 -1
- package/dist/pdas/index.cjs +163 -1
- package/dist/pdas/index.cjs.map +1 -1
- package/dist/pdas/index.d.cts +131 -1
- package/dist/pdas/index.d.ts +131 -1
- package/dist/pdas/index.js +151 -2
- package/dist/pdas/index.js.map +1 -1
- package/dist/types/index.cjs +9 -0
- package/dist/types/index.cjs.map +1 -1
- package/dist/types/index.d.cts +586 -3
- package/dist/types/index.d.ts +586 -3
- package/dist/types/index.js +9 -1
- package/dist/types/index.js.map +1 -1
- package/package.json +5 -3
- package/src/__tests__/dynamic-tokenomics.test.ts +358 -0
- package/src/accounts/index.ts +852 -1
- package/src/client.ts +1130 -1
- package/src/constants/index.ts +48 -2
- package/src/index.ts +58 -0
- package/src/instructions/index.ts +1383 -40
- package/src/pdas/index.ts +346 -0
- package/src/types/index.ts +698 -2
- package/src/utils/index.ts +90 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BN } from '@coral-xyz/anchor';
|
|
2
|
-
import { PublicKey, SystemProgram, SYSVAR_INSTRUCTIONS_PUBKEY, SYSVAR_RENT_PUBKEY,
|
|
2
|
+
import { PublicKey, ComputeBudgetProgram, SystemProgram, SYSVAR_INSTRUCTIONS_PUBKEY, SYSVAR_RENT_PUBKEY, SYSVAR_CLOCK_PUBKEY } from '@solana/web3.js';
|
|
3
3
|
import { getAssociatedTokenAddressSync, TOKEN_PROGRAM_ID, ASSOCIATED_TOKEN_PROGRAM_ID } from '@solana/spl-token';
|
|
4
4
|
|
|
5
5
|
// src/instructions/index.ts
|
|
@@ -15,7 +15,13 @@ var SEEDS = {
|
|
|
15
15
|
TGE_ESCROW: "tge_escrow",
|
|
16
16
|
ADMIN_CONFIG: "admin-config",
|
|
17
17
|
NFT_MINT: "nft_mint",
|
|
18
|
-
AUTHORITY: "authority"
|
|
18
|
+
AUTHORITY: "authority",
|
|
19
|
+
FUTURE_ROUND_VAULT: "future_round_vault",
|
|
20
|
+
FUTURE_ROUND_STATE: "future_round_state",
|
|
21
|
+
// Multi-Round Fundraising seeds
|
|
22
|
+
FUNDING_ROUND: "funding_round",
|
|
23
|
+
ROUND_ESCROW: "round_escrow",
|
|
24
|
+
INVESTOR_MS_VESTING: "investor_ms_vesting"
|
|
19
25
|
};
|
|
20
26
|
|
|
21
27
|
// src/pdas/index.ts
|
|
@@ -187,6 +193,149 @@ function getFounderVestingPDA(projectPda, programId) {
|
|
|
187
193
|
);
|
|
188
194
|
return pda;
|
|
189
195
|
}
|
|
196
|
+
function getAllocationProposalPDA(projectPda, proposalIndex, programId) {
|
|
197
|
+
const [pda] = PublicKey.findProgramAddressSync(
|
|
198
|
+
[
|
|
199
|
+
Buffer.from("allocation_proposal"),
|
|
200
|
+
projectPda.toBuffer(),
|
|
201
|
+
Buffer.from([proposalIndex])
|
|
202
|
+
],
|
|
203
|
+
programId
|
|
204
|
+
);
|
|
205
|
+
return pda;
|
|
206
|
+
}
|
|
207
|
+
function getAllocationVotePDA(proposalPda, nftMint, programId) {
|
|
208
|
+
const [pda] = PublicKey.findProgramAddressSync(
|
|
209
|
+
[
|
|
210
|
+
Buffer.from("allocation_vote"),
|
|
211
|
+
proposalPda.toBuffer(),
|
|
212
|
+
nftMint.toBuffer()
|
|
213
|
+
],
|
|
214
|
+
programId
|
|
215
|
+
);
|
|
216
|
+
return pda;
|
|
217
|
+
}
|
|
218
|
+
function getSubAllocationVestingPDA(projectPda, subAllocationId, programId) {
|
|
219
|
+
const [pda] = PublicKey.findProgramAddressSync(
|
|
220
|
+
[
|
|
221
|
+
Buffer.from("sub_allocation_vesting"),
|
|
222
|
+
projectPda.toBuffer(),
|
|
223
|
+
Buffer.from([subAllocationId])
|
|
224
|
+
],
|
|
225
|
+
programId
|
|
226
|
+
);
|
|
227
|
+
return pda;
|
|
228
|
+
}
|
|
229
|
+
function getInvestorMilestoneVestingPDA(projectPda, milestoneIndex, investmentPda, programId) {
|
|
230
|
+
const [pda] = PublicKey.findProgramAddressSync(
|
|
231
|
+
[
|
|
232
|
+
Buffer.from("investor_ms_vesting"),
|
|
233
|
+
projectPda.toBuffer(),
|
|
234
|
+
Buffer.from([milestoneIndex]),
|
|
235
|
+
investmentPda.toBuffer()
|
|
236
|
+
],
|
|
237
|
+
programId
|
|
238
|
+
);
|
|
239
|
+
return pda;
|
|
240
|
+
}
|
|
241
|
+
function getFounderMilestoneVestingPDA(projectPda, milestoneIndex, programId) {
|
|
242
|
+
const [pda] = PublicKey.findProgramAddressSync(
|
|
243
|
+
[
|
|
244
|
+
Buffer.from("founder_ms_vesting"),
|
|
245
|
+
projectPda.toBuffer(),
|
|
246
|
+
Buffer.from([milestoneIndex])
|
|
247
|
+
],
|
|
248
|
+
programId
|
|
249
|
+
);
|
|
250
|
+
return pda;
|
|
251
|
+
}
|
|
252
|
+
function getFutureRoundTokenVaultPDA(projectPda, programId) {
|
|
253
|
+
const [pda] = PublicKey.findProgramAddressSync(
|
|
254
|
+
[Buffer.from(SEEDS.FUTURE_ROUND_VAULT), projectPda.toBuffer()],
|
|
255
|
+
programId
|
|
256
|
+
);
|
|
257
|
+
return pda;
|
|
258
|
+
}
|
|
259
|
+
function getFutureRoundVaultPDA(projectPda, programId) {
|
|
260
|
+
const [pda] = PublicKey.findProgramAddressSync(
|
|
261
|
+
[Buffer.from(SEEDS.FUTURE_ROUND_STATE), projectPda.toBuffer()],
|
|
262
|
+
programId
|
|
263
|
+
);
|
|
264
|
+
return pda;
|
|
265
|
+
}
|
|
266
|
+
function getFundingRoundPDA(projectPda, roundNumber, programId) {
|
|
267
|
+
const [pda] = PublicKey.findProgramAddressSync(
|
|
268
|
+
[
|
|
269
|
+
Buffer.from(SEEDS.FUNDING_ROUND),
|
|
270
|
+
projectPda.toBuffer(),
|
|
271
|
+
Buffer.from([roundNumber])
|
|
272
|
+
],
|
|
273
|
+
programId
|
|
274
|
+
);
|
|
275
|
+
return pda;
|
|
276
|
+
}
|
|
277
|
+
function getRoundEscrowPDA(projectPda, roundNumber, programId) {
|
|
278
|
+
const [pda] = PublicKey.findProgramAddressSync(
|
|
279
|
+
[
|
|
280
|
+
Buffer.from(SEEDS.ROUND_ESCROW),
|
|
281
|
+
projectPda.toBuffer(),
|
|
282
|
+
Buffer.from([roundNumber])
|
|
283
|
+
],
|
|
284
|
+
programId
|
|
285
|
+
);
|
|
286
|
+
return pda;
|
|
287
|
+
}
|
|
288
|
+
function getRoundMilestonePDA(projectPda, roundNumber, milestoneIndex, programId) {
|
|
289
|
+
const [pda] = PublicKey.findProgramAddressSync(
|
|
290
|
+
[
|
|
291
|
+
Buffer.from(SEEDS.MILESTONE),
|
|
292
|
+
projectPda.toBuffer(),
|
|
293
|
+
Buffer.from([roundNumber]),
|
|
294
|
+
Buffer.from([milestoneIndex])
|
|
295
|
+
],
|
|
296
|
+
programId
|
|
297
|
+
);
|
|
298
|
+
return pda;
|
|
299
|
+
}
|
|
300
|
+
function getRoundNftMintPDA(projectId, roundNumber, investor, investmentCount, programId) {
|
|
301
|
+
const projectIdBN = ensureBN(projectId);
|
|
302
|
+
const countBN = ensureBN(investmentCount);
|
|
303
|
+
return PublicKey.findProgramAddressSync(
|
|
304
|
+
[
|
|
305
|
+
Buffer.from(SEEDS.NFT_MINT),
|
|
306
|
+
projectIdBN.toArrayLike(Buffer, "le", 8),
|
|
307
|
+
Buffer.from([roundNumber]),
|
|
308
|
+
investor.toBuffer(),
|
|
309
|
+
countBN.toArrayLike(Buffer, "le", 8)
|
|
310
|
+
],
|
|
311
|
+
programId
|
|
312
|
+
);
|
|
313
|
+
}
|
|
314
|
+
function getRoundInvestmentPDA(projectPda, roundNumber, nftMint, programId) {
|
|
315
|
+
const [pda] = PublicKey.findProgramAddressSync(
|
|
316
|
+
[
|
|
317
|
+
Buffer.from(SEEDS.INVESTMENT),
|
|
318
|
+
projectPda.toBuffer(),
|
|
319
|
+
Buffer.from([roundNumber]),
|
|
320
|
+
nftMint.toBuffer()
|
|
321
|
+
],
|
|
322
|
+
programId
|
|
323
|
+
);
|
|
324
|
+
return pda;
|
|
325
|
+
}
|
|
326
|
+
function getRoundInvestorMilestoneVestingPDA(projectPda, roundNumber, milestoneIndex, investmentPda, programId) {
|
|
327
|
+
const [pda] = PublicKey.findProgramAddressSync(
|
|
328
|
+
[
|
|
329
|
+
Buffer.from(SEEDS.INVESTOR_MS_VESTING),
|
|
330
|
+
projectPda.toBuffer(),
|
|
331
|
+
Buffer.from([roundNumber]),
|
|
332
|
+
Buffer.from([milestoneIndex]),
|
|
333
|
+
investmentPda.toBuffer()
|
|
334
|
+
],
|
|
335
|
+
programId
|
|
336
|
+
);
|
|
337
|
+
return pda;
|
|
338
|
+
}
|
|
190
339
|
var TOKEN_METADATA_PROGRAM_ID = new PublicKey("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s");
|
|
191
340
|
function ensurePublicKey(value) {
|
|
192
341
|
if (value instanceof PublicKey) {
|
|
@@ -201,19 +350,19 @@ function getAccountNamespace(program) {
|
|
|
201
350
|
return program.account;
|
|
202
351
|
}
|
|
203
352
|
async function initializeAdmin(program, admin, payer) {
|
|
204
|
-
return getMethods(program).initializeAdmin().
|
|
353
|
+
return getMethods(program).initializeAdmin().accountsPartial({
|
|
205
354
|
admin,
|
|
206
355
|
payer
|
|
207
356
|
}).rpc();
|
|
208
357
|
}
|
|
209
358
|
async function transferAdmin(program, adminKeypair, newAdmin) {
|
|
210
|
-
return getMethods(program).transferAdmin().
|
|
359
|
+
return getMethods(program).transferAdmin().accountsPartial({
|
|
211
360
|
authority: adminKeypair.publicKey,
|
|
212
361
|
newAdmin
|
|
213
362
|
}).signers([adminKeypair]).rpc();
|
|
214
363
|
}
|
|
215
364
|
async function acceptAdmin(program, newAuthority) {
|
|
216
|
-
return getMethods(program).acceptAdmin().
|
|
365
|
+
return getMethods(program).acceptAdmin().accountsPartial({
|
|
217
366
|
newAuthority
|
|
218
367
|
}).rpc();
|
|
219
368
|
}
|
|
@@ -275,19 +424,23 @@ async function initializeProject(program, args, founder) {
|
|
|
275
424
|
lpTokenAllocationBps: args.tokenomics.lpTokenAllocationBps,
|
|
276
425
|
lpUsdcAllocationBps: args.tokenomics.lpUsdcAllocationBps,
|
|
277
426
|
founderAllocationBps: args.tokenomics.founderAllocationBps ?? null,
|
|
278
|
-
|
|
427
|
+
zemythAllocationBps: args.tokenomics.zemythAllocationBps ?? null,
|
|
279
428
|
founderWallet: args.tokenomics.founderWallet ?? null,
|
|
280
429
|
vestingDurationMonths: args.tokenomics.vestingDurationMonths ?? null,
|
|
281
|
-
cliffMonths: args.tokenomics.cliffMonths ?? null
|
|
430
|
+
cliffMonths: args.tokenomics.cliffMonths ?? null,
|
|
431
|
+
founderMilestoneVestingBps: args.tokenomics.founderMilestoneVestingBps ?? null,
|
|
432
|
+
founderTimeVestingBps: args.tokenomics.founderTimeVestingBps ?? null,
|
|
433
|
+
futureRoundAllocationBps: args.tokenomics.futureRoundAllocationBps ?? null
|
|
282
434
|
},
|
|
283
|
-
milestone1Deadline: args.milestone1Deadline
|
|
284
|
-
|
|
435
|
+
milestone1Deadline: args.milestone1Deadline,
|
|
436
|
+
priceMultipliers: args.priceMultipliers ?? null
|
|
437
|
+
}).accountsPartial({
|
|
285
438
|
founder
|
|
286
439
|
}).rpc();
|
|
287
440
|
}
|
|
288
441
|
async function submitForApproval(program, projectId, founder) {
|
|
289
442
|
const projectPda = getProjectPDA(projectId, program.programId);
|
|
290
|
-
return getMethods(program).submitForApproval().
|
|
443
|
+
return getMethods(program).submitForApproval().accountsPartial({
|
|
291
444
|
project: projectPda,
|
|
292
445
|
founder
|
|
293
446
|
}).rpc();
|
|
@@ -303,7 +456,12 @@ async function approveProject(program, args, adminKeypair) {
|
|
|
303
456
|
const lpTokenVaultPda = getLpTokenVaultPDA(projectPda, program.programId);
|
|
304
457
|
const treasuryVaultPda = getTreasuryVaultPDA(projectPda, program.programId);
|
|
305
458
|
const lpUsdcVaultPda = getLpUsdcVaultPDA(projectPda, program.programId);
|
|
306
|
-
|
|
459
|
+
const futureRoundTokenVaultPda = getFutureRoundTokenVaultPDA(projectPda, program.programId);
|
|
460
|
+
const futureRoundVaultPda = getFutureRoundVaultPDA(projectPda, program.programId);
|
|
461
|
+
const computeBudgetIx = ComputeBudgetProgram.setComputeUnitLimit({
|
|
462
|
+
units: 4e5
|
|
463
|
+
});
|
|
464
|
+
return getMethods(program).approveProject().accountsPartial({
|
|
307
465
|
project: projectPda,
|
|
308
466
|
tokenomics: tokenomicsPda,
|
|
309
467
|
tokenVault: tokenVaultPda,
|
|
@@ -314,10 +472,12 @@ async function approveProject(program, args, adminKeypair) {
|
|
|
314
472
|
lpTokenVault: lpTokenVaultPda,
|
|
315
473
|
treasuryVault: treasuryVaultPda,
|
|
316
474
|
lpUsdcVault: lpUsdcVaultPda,
|
|
475
|
+
futureRoundTokenVault: futureRoundTokenVaultPda,
|
|
476
|
+
futureRoundVault: futureRoundVaultPda,
|
|
317
477
|
usdcMint: args.usdcMint,
|
|
318
478
|
authority: adminKeypair.publicKey,
|
|
319
479
|
payer: adminKeypair.publicKey
|
|
320
|
-
}).signers([adminKeypair]).rpc();
|
|
480
|
+
}).preInstructions([computeBudgetIx]).signers([adminKeypair]).rpc();
|
|
321
481
|
}
|
|
322
482
|
async function createMilestone(program, args, founder) {
|
|
323
483
|
const projectPda = getProjectPDA(args.projectId, program.programId);
|
|
@@ -325,8 +485,11 @@ async function createMilestone(program, args, founder) {
|
|
|
325
485
|
return getMethods(program).createMilestone({
|
|
326
486
|
milestoneIndex: args.milestoneIndex,
|
|
327
487
|
percentage: args.percentage,
|
|
328
|
-
description: args.description
|
|
329
|
-
|
|
488
|
+
description: args.description,
|
|
489
|
+
vestingDurationMonths: args.vestingDurationMonths ?? null,
|
|
490
|
+
cliffMonths: args.cliffMonths ?? null,
|
|
491
|
+
instantReleaseBps: args.instantReleaseBps ?? null
|
|
492
|
+
}).accountsPartial({
|
|
330
493
|
project: projectPda,
|
|
331
494
|
milestone: milestonePda,
|
|
332
495
|
founder
|
|
@@ -335,7 +498,7 @@ async function createMilestone(program, args, founder) {
|
|
|
335
498
|
async function submitMilestone(program, projectId, milestoneIndex, founder) {
|
|
336
499
|
const projectPda = getProjectPDA(projectId, program.programId);
|
|
337
500
|
const milestonePda = getMilestonePDA(projectPda, milestoneIndex, program.programId);
|
|
338
|
-
return getMethods(program).submitMilestone().
|
|
501
|
+
return getMethods(program).submitMilestone().accountsPartial({
|
|
339
502
|
project: projectPda,
|
|
340
503
|
milestone: milestonePda,
|
|
341
504
|
founder
|
|
@@ -356,7 +519,7 @@ async function voteOnMilestone(program, args, voter) {
|
|
|
356
519
|
// allowOwnerOffCurve
|
|
357
520
|
TOKEN_PROGRAM_ID
|
|
358
521
|
);
|
|
359
|
-
return getMethods(program).voteOnMilestone({ choice: args.choice }).
|
|
522
|
+
return getMethods(program).voteOnMilestone({ choice: args.choice }).accountsPartial({
|
|
360
523
|
milestone: milestonePda,
|
|
361
524
|
project: projectPda,
|
|
362
525
|
investment: investmentPda,
|
|
@@ -369,7 +532,7 @@ async function voteOnMilestone(program, args, voter) {
|
|
|
369
532
|
async function finalizeVoting(program, projectId, milestoneIndex) {
|
|
370
533
|
const projectPda = getProjectPDA(projectId, program.programId);
|
|
371
534
|
const milestonePda = getMilestonePDA(projectPda, milestoneIndex, program.programId);
|
|
372
|
-
return getMethods(program).finalizeVoting().
|
|
535
|
+
return getMethods(program).finalizeVoting().accountsPartial({
|
|
373
536
|
project: projectPda,
|
|
374
537
|
milestone: milestonePda
|
|
375
538
|
}).rpc();
|
|
@@ -382,7 +545,7 @@ async function claimMilestoneFunds(program, args, founder) {
|
|
|
382
545
|
const tokenomicsPda = getTokenomicsPDA(projectPda, program.programId);
|
|
383
546
|
const lpUsdcVaultPda = getLpUsdcVaultPDA(projectPda, program.programId);
|
|
384
547
|
const nextMilestonePda = args.nextMilestonePda ?? (args.nextMilestoneDeadline.gt(new BN(0)) ? getMilestonePDA(projectPda, args.milestoneIndex + 1, program.programId) : null);
|
|
385
|
-
return getMethods(program).claimMilestoneFunds({ nextMilestoneDeadline: args.nextMilestoneDeadline }).
|
|
548
|
+
return getMethods(program).claimMilestoneFunds({ nextMilestoneDeadline: args.nextMilestoneDeadline }).accountsPartial({
|
|
386
549
|
milestone: milestonePda,
|
|
387
550
|
project: projectPda,
|
|
388
551
|
founder,
|
|
@@ -400,7 +563,7 @@ async function claimMilestoneFunds(program, args, founder) {
|
|
|
400
563
|
async function resubmitMilestone(program, args, founder) {
|
|
401
564
|
const projectPda = getProjectPDA(args.projectId, program.programId);
|
|
402
565
|
const milestonePda = getMilestonePDA(projectPda, args.milestoneIndex, program.programId);
|
|
403
|
-
return getMethods(program).resubmitMilestone().
|
|
566
|
+
return getMethods(program).resubmitMilestone().accountsPartial({
|
|
404
567
|
project: projectPda,
|
|
405
568
|
milestone: milestonePda,
|
|
406
569
|
founder
|
|
@@ -412,7 +575,7 @@ async function setMilestoneDeadline(program, args, founder) {
|
|
|
412
575
|
return getMethods(program).setMilestoneDeadline({
|
|
413
576
|
milestoneIndex: args.milestoneIndex,
|
|
414
577
|
deadline: args.deadline
|
|
415
|
-
}).
|
|
578
|
+
}).accountsPartial({
|
|
416
579
|
project: projectPda,
|
|
417
580
|
milestone: milestonePda,
|
|
418
581
|
founder
|
|
@@ -424,7 +587,7 @@ async function extendMilestoneDeadline(program, args, founder) {
|
|
|
424
587
|
return getMethods(program).extendMilestoneDeadline({
|
|
425
588
|
milestoneIndex: args.milestoneIndex,
|
|
426
589
|
newDeadline: args.newDeadline
|
|
427
|
-
}).
|
|
590
|
+
}).accountsPartial({
|
|
428
591
|
project: projectPda,
|
|
429
592
|
milestone: milestonePda,
|
|
430
593
|
founder
|
|
@@ -462,7 +625,7 @@ async function invest(program, args, investor) {
|
|
|
462
625
|
const masterEdition = getMasterEditionPDA(nftMint);
|
|
463
626
|
const [programAuthority] = getProgramAuthorityPDA(program.programId);
|
|
464
627
|
const firstMilestonePda = getMilestonePDA(projectPda, 0, program.programId);
|
|
465
|
-
return getMethods(program).invest({ amount: args.amount }).
|
|
628
|
+
return getMethods(program).invest({ amount: args.amount }).accountsPartial({
|
|
466
629
|
project: projectPda,
|
|
467
630
|
firstMilestone: firstMilestonePda,
|
|
468
631
|
nftMint,
|
|
@@ -489,7 +652,7 @@ async function cancelInvestment(program, args, investor) {
|
|
|
489
652
|
const projectPda = getProjectPDA(args.projectId, program.programId);
|
|
490
653
|
const investmentPda = getInvestmentPDA(projectPda, nftMintPubkey, program.programId);
|
|
491
654
|
const escrowPda = getEscrowPDA(args.projectId, program.programId);
|
|
492
|
-
return getMethods(program).cancelInvestment().
|
|
655
|
+
return getMethods(program).cancelInvestment().accountsPartial({
|
|
493
656
|
investor,
|
|
494
657
|
project: projectPda,
|
|
495
658
|
investment: investmentPda,
|
|
@@ -508,7 +671,7 @@ async function proposePivot(program, args, founder) {
|
|
|
508
671
|
return getMethods(program).proposePivot({
|
|
509
672
|
newMetadataUri: args.newMetadataUri,
|
|
510
673
|
newMilestones: args.newMilestones
|
|
511
|
-
}).
|
|
674
|
+
}).accountsPartial({
|
|
512
675
|
project: projectPda,
|
|
513
676
|
founder,
|
|
514
677
|
pivotProposal: pivotProposalPda,
|
|
@@ -526,7 +689,7 @@ async function approvePivot(program, projectId, adminKeypair) {
|
|
|
526
689
|
const pivotCount = projectAccount.pivotCount || 0;
|
|
527
690
|
pivotProposalPda = getPivotProposalPDA(projectPda, pivotCount, program.programId);
|
|
528
691
|
}
|
|
529
|
-
return getMethods(program).approvePivot().
|
|
692
|
+
return getMethods(program).approvePivot().accountsPartial({
|
|
530
693
|
moderator: adminKeypair.publicKey,
|
|
531
694
|
project: projectPda,
|
|
532
695
|
pivotProposal: pivotProposalPda
|
|
@@ -549,7 +712,7 @@ async function withdrawFromPivot(program, args, investor) {
|
|
|
549
712
|
isSigner: false,
|
|
550
713
|
isWritable: false
|
|
551
714
|
}));
|
|
552
|
-
return getMethods(program).withdrawFromPivot().
|
|
715
|
+
return getMethods(program).withdrawFromPivot().accountsPartial({
|
|
553
716
|
investor,
|
|
554
717
|
project: projectPda,
|
|
555
718
|
pivotProposal: pivotProposalPda,
|
|
@@ -569,7 +732,7 @@ async function finalizePivot(program, args, authority) {
|
|
|
569
732
|
isSigner: false,
|
|
570
733
|
isWritable: true
|
|
571
734
|
}));
|
|
572
|
-
return getMethods(program).finalizePivot().
|
|
735
|
+
return getMethods(program).finalizePivot().accountsPartial({
|
|
573
736
|
authority,
|
|
574
737
|
project: projectPda,
|
|
575
738
|
pivotProposal: pivotProposalPda
|
|
@@ -580,14 +743,14 @@ async function setTgeDate(program, args, founder) {
|
|
|
580
743
|
return getMethods(program).setTgeDate({
|
|
581
744
|
tgeDate: args.tgeDate,
|
|
582
745
|
tokenMint: args.tokenMint
|
|
583
|
-
}).
|
|
746
|
+
}).accountsPartial({
|
|
584
747
|
project: projectPda,
|
|
585
748
|
founder
|
|
586
749
|
}).rpc();
|
|
587
750
|
}
|
|
588
751
|
async function depositTokens(program, args, founder) {
|
|
589
752
|
const projectPda = getProjectPDA(args.projectId, program.programId);
|
|
590
|
-
return getMethods(program).depositTokens({ amount: args.amount }).
|
|
753
|
+
return getMethods(program).depositTokens({ amount: args.amount }).accountsPartial({
|
|
591
754
|
project: projectPda,
|
|
592
755
|
tokenMint: args.tokenMint,
|
|
593
756
|
founderTokenAccount: args.founderTokenAccount,
|
|
@@ -598,7 +761,7 @@ async function claimTokens(program, args, investor) {
|
|
|
598
761
|
const projectPda = getProjectPDA(args.projectId, program.programId);
|
|
599
762
|
const investmentPda = getInvestmentPDA(projectPda, args.nftMint, program.programId);
|
|
600
763
|
const tokenVaultPda = getTokenVaultPDA(projectPda, program.programId);
|
|
601
|
-
return getMethods(program).claimTokens().
|
|
764
|
+
return getMethods(program).claimTokens().accountsPartial({
|
|
602
765
|
investor,
|
|
603
766
|
project: projectPda,
|
|
604
767
|
investment: investmentPda,
|
|
@@ -613,7 +776,7 @@ async function reportScam(program, args, reporter) {
|
|
|
613
776
|
const projectPda = getProjectPDA(args.projectId, program.programId);
|
|
614
777
|
const tgeEscrowPda = getTgeEscrowPDA(projectPda, program.programId);
|
|
615
778
|
const investmentPda = getInvestmentPDA(projectPda, args.nftMint, program.programId);
|
|
616
|
-
return getMethods(program).reportScam().
|
|
779
|
+
return getMethods(program).reportScam().accountsPartial({
|
|
617
780
|
tgeEscrow: tgeEscrowPda,
|
|
618
781
|
project: projectPda,
|
|
619
782
|
investment: investmentPda,
|
|
@@ -624,7 +787,7 @@ async function reportScam(program, args, reporter) {
|
|
|
624
787
|
async function releaseHoldback(program, args) {
|
|
625
788
|
const projectPda = getProjectPDA(args.projectId, program.programId);
|
|
626
789
|
const tgeEscrowPda = getTgeEscrowPDA(projectPda, program.programId);
|
|
627
|
-
return getMethods(program).releaseHoldback().
|
|
790
|
+
return getMethods(program).releaseHoldback().accountsPartial({
|
|
628
791
|
tgeEscrow: tgeEscrowPda,
|
|
629
792
|
project: projectPda,
|
|
630
793
|
founderTokenAccount: args.founderTokenAccount
|
|
@@ -633,7 +796,7 @@ async function releaseHoldback(program, args) {
|
|
|
633
796
|
async function checkAbandonment(program, projectId, milestoneIndex = 0) {
|
|
634
797
|
const projectPda = getProjectPDA(projectId, program.programId);
|
|
635
798
|
const milestonePda = getMilestonePDA(projectPda, milestoneIndex, program.programId);
|
|
636
|
-
return getMethods(program).checkAbandonment().
|
|
799
|
+
return getMethods(program).checkAbandonment().accountsPartial({
|
|
637
800
|
project: projectPda,
|
|
638
801
|
milestone: milestonePda
|
|
639
802
|
}).rpc();
|
|
@@ -652,7 +815,7 @@ async function claimRefund(program, args, investor) {
|
|
|
652
815
|
isSigner: false
|
|
653
816
|
});
|
|
654
817
|
}
|
|
655
|
-
return getMethods(program).claimRefund().
|
|
818
|
+
return getMethods(program).claimRefund().accountsPartial({
|
|
656
819
|
project: projectPda,
|
|
657
820
|
investment: investmentPda,
|
|
658
821
|
nftMint: nftMintPubkey,
|
|
@@ -675,7 +838,7 @@ async function claimInvestorTokens(program, args, investor) {
|
|
|
675
838
|
false,
|
|
676
839
|
TOKEN_PROGRAM_ID
|
|
677
840
|
);
|
|
678
|
-
return getMethods(program).claimInvestorTokens({ milestoneIndex: args.milestoneIndex }).
|
|
841
|
+
return getMethods(program).claimInvestorTokens({ milestoneIndex: args.milestoneIndex }).accountsPartial({
|
|
679
842
|
investor,
|
|
680
843
|
project: projectPda,
|
|
681
844
|
tokenVault: tokenVaultPda,
|
|
@@ -697,7 +860,7 @@ async function distributeTokens(program, args, payer) {
|
|
|
697
860
|
{ pubkey: inv.investmentPda, isSigner: false, isWritable: true },
|
|
698
861
|
{ pubkey: inv.investorTokenAccount, isSigner: false, isWritable: true }
|
|
699
862
|
]);
|
|
700
|
-
return getMethods(program).distributeTokens({ milestoneIndex: args.milestoneIndex }).
|
|
863
|
+
return getMethods(program).distributeTokens({ milestoneIndex: args.milestoneIndex }).accountsPartial({
|
|
701
864
|
project: projectPda,
|
|
702
865
|
tokenVault: tokenVaultPda,
|
|
703
866
|
investorVault: investorVaultPda,
|
|
@@ -709,7 +872,7 @@ async function distributeTokens(program, args, payer) {
|
|
|
709
872
|
async function completeDistribution(program, args, payer) {
|
|
710
873
|
const projectPda = getProjectPDA(args.projectId, program.programId);
|
|
711
874
|
const tokenVaultPda = getTokenVaultPDA(projectPda, program.programId);
|
|
712
|
-
return getMethods(program).completeDistribution({ milestoneIndex: args.milestoneIndex }).
|
|
875
|
+
return getMethods(program).completeDistribution({ milestoneIndex: args.milestoneIndex }).accountsPartial({
|
|
713
876
|
project: projectPda,
|
|
714
877
|
tokenVault: tokenVaultPda,
|
|
715
878
|
payer
|
|
@@ -740,7 +903,7 @@ async function initializeFounderVesting(program, args, payer) {
|
|
|
740
903
|
const tokenomicsPda = getTokenomicsPDA(projectPda, program.programId);
|
|
741
904
|
const tokenVaultPda = getTokenVaultPDA(projectPda, program.programId);
|
|
742
905
|
const founderVestingPda = getFounderVestingPDA(projectPda, program.programId);
|
|
743
|
-
return getMethods(program).initializeFounderVesting().
|
|
906
|
+
return getMethods(program).initializeFounderVesting().accountsPartial({
|
|
744
907
|
project: projectPda,
|
|
745
908
|
tokenomics: tokenomicsPda,
|
|
746
909
|
tokenVault: tokenVaultPda,
|
|
@@ -755,7 +918,7 @@ async function claimVestedTokens(program, args, founder) {
|
|
|
755
918
|
const founderVestingPda = getFounderVestingPDA(projectPda, program.programId);
|
|
756
919
|
const founderVaultPda = getFounderVaultPDA(projectPda, program.programId);
|
|
757
920
|
const vaultAuthorityPda = getVaultAuthorityPDA(projectPda, program.programId);
|
|
758
|
-
return getMethods(program).claimVestedTokens().
|
|
921
|
+
return getMethods(program).claimVestedTokens().accountsPartial({
|
|
759
922
|
project: projectPda,
|
|
760
923
|
tokenVault: tokenVaultPda,
|
|
761
924
|
founderVesting: founderVestingPda,
|
|
@@ -770,7 +933,7 @@ async function forceCompleteDistribution(program, args, adminKeypair) {
|
|
|
770
933
|
const projectPda = getProjectPDA(args.projectId, program.programId);
|
|
771
934
|
const tokenVaultPda = getTokenVaultPDA(projectPda, program.programId);
|
|
772
935
|
const adminConfigPda = getAdminConfigPDA(program.programId);
|
|
773
|
-
return getMethods(program).forceCompleteDistribution().
|
|
936
|
+
return getMethods(program).forceCompleteDistribution().accountsPartial({
|
|
774
937
|
admin: adminKeypair.publicKey,
|
|
775
938
|
adminConfig: adminConfigPda,
|
|
776
939
|
project: projectPda,
|
|
@@ -790,7 +953,7 @@ async function claimMissedUnlock(program, args, claimer) {
|
|
|
790
953
|
false,
|
|
791
954
|
TOKEN_PROGRAM_ID
|
|
792
955
|
);
|
|
793
|
-
return getMethods(program).claimMissedUnlock({ milestoneIndex: args.milestoneIndex }).
|
|
956
|
+
return getMethods(program).claimMissedUnlock({ milestoneIndex: args.milestoneIndex }).accountsPartial({
|
|
794
957
|
claimer,
|
|
795
958
|
project: projectPda,
|
|
796
959
|
tokenVault: tokenVaultPda,
|
|
@@ -803,7 +966,564 @@ async function claimMissedUnlock(program, args, claimer) {
|
|
|
803
966
|
tokenProgram: TOKEN_PROGRAM_ID
|
|
804
967
|
}).rpc();
|
|
805
968
|
}
|
|
969
|
+
async function addSubAllocation(program, args, founder) {
|
|
970
|
+
const projectPda = getProjectPDA(args.projectId, program.programId);
|
|
971
|
+
const tokenomicsPda = getTokenomicsPDA(projectPda, program.programId);
|
|
972
|
+
return getMethods(program).addSubAllocation({
|
|
973
|
+
name: args.name,
|
|
974
|
+
bps: args.bps,
|
|
975
|
+
recipient: args.recipient,
|
|
976
|
+
vestingMonths: args.vestingMonths,
|
|
977
|
+
cliffMonths: args.cliffMonths
|
|
978
|
+
}).accountsPartial({
|
|
979
|
+
project: projectPda,
|
|
980
|
+
tokenomics: tokenomicsPda,
|
|
981
|
+
founder
|
|
982
|
+
}).rpc();
|
|
983
|
+
}
|
|
984
|
+
async function proposeAllocationChange(program, args, founder) {
|
|
985
|
+
const projectPda = getProjectPDA(args.projectId, program.programId);
|
|
986
|
+
const tokenomicsPda = getTokenomicsPDA(projectPda, program.programId);
|
|
987
|
+
const tokenomics = await getAccountNamespace(program).tokenomics.fetch(tokenomicsPda);
|
|
988
|
+
const proposalIndex = tokenomics.proposalCount || 0;
|
|
989
|
+
const proposalPda = getAllocationProposalPDA(projectPda, proposalIndex, program.programId);
|
|
990
|
+
return getMethods(program).proposeAllocationChange({
|
|
991
|
+
name: args.name,
|
|
992
|
+
bps: args.bps,
|
|
993
|
+
recipient: args.recipient,
|
|
994
|
+
vestingMonths: args.vestingMonths,
|
|
995
|
+
cliffMonths: args.cliffMonths
|
|
996
|
+
}).accountsPartial({
|
|
997
|
+
project: projectPda,
|
|
998
|
+
tokenomics: tokenomicsPda,
|
|
999
|
+
proposal: proposalPda,
|
|
1000
|
+
founder,
|
|
1001
|
+
systemProgram: SystemProgram.programId
|
|
1002
|
+
}).rpc();
|
|
1003
|
+
}
|
|
1004
|
+
async function voteAllocationChange(program, args, voter) {
|
|
1005
|
+
const nftMintPubkey = ensurePublicKey(args.nftMint);
|
|
1006
|
+
const projectPda = getProjectPDA(args.projectId, program.programId);
|
|
1007
|
+
const proposalPda = getAllocationProposalPDA(projectPda, args.proposalIndex, program.programId);
|
|
1008
|
+
const investmentPda = getInvestmentPDA(projectPda, nftMintPubkey, program.programId);
|
|
1009
|
+
const votePda = getAllocationVotePDA(proposalPda, nftMintPubkey, program.programId);
|
|
1010
|
+
const investorNftAccount = getAssociatedTokenAddressSync(
|
|
1011
|
+
nftMintPubkey,
|
|
1012
|
+
voter,
|
|
1013
|
+
false,
|
|
1014
|
+
TOKEN_PROGRAM_ID
|
|
1015
|
+
);
|
|
1016
|
+
return getMethods(program).voteAllocationChange({ voteFor: args.voteFor }).accountsPartial({
|
|
1017
|
+
project: projectPda,
|
|
1018
|
+
proposal: proposalPda,
|
|
1019
|
+
investment: investmentPda,
|
|
1020
|
+
nftMint: nftMintPubkey,
|
|
1021
|
+
investorNftAccount,
|
|
1022
|
+
voteRecord: votePda,
|
|
1023
|
+
voter,
|
|
1024
|
+
systemProgram: SystemProgram.programId
|
|
1025
|
+
}).rpc();
|
|
1026
|
+
}
|
|
1027
|
+
async function executeAllocationChange(program, args, executor) {
|
|
1028
|
+
const projectPda = getProjectPDA(args.projectId, program.programId);
|
|
1029
|
+
const tokenomicsPda = getTokenomicsPDA(projectPda, program.programId);
|
|
1030
|
+
const proposalPda = getAllocationProposalPDA(projectPda, args.proposalIndex, program.programId);
|
|
1031
|
+
return getMethods(program).executeAllocationChange().accountsPartial({
|
|
1032
|
+
project: projectPda,
|
|
1033
|
+
tokenomics: tokenomicsPda,
|
|
1034
|
+
proposal: proposalPda,
|
|
1035
|
+
executor
|
|
1036
|
+
}).rpc();
|
|
1037
|
+
}
|
|
1038
|
+
async function claimEarlyTokens(program, args, investor) {
|
|
1039
|
+
const nftMintPubkey = ensurePublicKey(args.nftMint);
|
|
1040
|
+
const projectPda = getProjectPDA(args.projectId, program.programId);
|
|
1041
|
+
const tokenVaultPda = getTokenVaultPDA(projectPda, program.programId);
|
|
1042
|
+
const investmentPda = getInvestmentPDA(projectPda, nftMintPubkey, program.programId);
|
|
1043
|
+
const investorVaultPda = getInvestorVaultPDA(projectPda, program.programId);
|
|
1044
|
+
const vaultAuthorityPda = getVaultAuthorityPDA(projectPda, program.programId);
|
|
1045
|
+
const investorNftAccount = getAssociatedTokenAddressSync(
|
|
1046
|
+
nftMintPubkey,
|
|
1047
|
+
investor,
|
|
1048
|
+
false,
|
|
1049
|
+
TOKEN_PROGRAM_ID
|
|
1050
|
+
);
|
|
1051
|
+
return getMethods(program).claimEarlyTokens().accountsPartial({
|
|
1052
|
+
investor,
|
|
1053
|
+
project: projectPda,
|
|
1054
|
+
tokenVault: tokenVaultPda,
|
|
1055
|
+
investment: investmentPda,
|
|
1056
|
+
nftMint: nftMintPubkey,
|
|
1057
|
+
investorNftAccount,
|
|
1058
|
+
investorVault: investorVaultPda,
|
|
1059
|
+
investorTokenAccount: args.investorTokenAccount,
|
|
1060
|
+
vaultAuthority: vaultAuthorityPda,
|
|
1061
|
+
tokenProgram: TOKEN_PROGRAM_ID
|
|
1062
|
+
}).rpc();
|
|
1063
|
+
}
|
|
1064
|
+
async function claimFounderEarlyTokens(program, args, founder) {
|
|
1065
|
+
const projectPda = getProjectPDA(args.projectId, program.programId);
|
|
1066
|
+
const tokenomicsPda = getTokenomicsPDA(projectPda, program.programId);
|
|
1067
|
+
const tokenVaultPda = getTokenVaultPDA(projectPda, program.programId);
|
|
1068
|
+
const founderVaultPda = getFounderVaultPDA(projectPda, program.programId);
|
|
1069
|
+
const vaultAuthorityPda = getVaultAuthorityPDA(projectPda, program.programId);
|
|
1070
|
+
return getMethods(program).claimFounderEarlyTokens().accountsPartial({
|
|
1071
|
+
founder,
|
|
1072
|
+
project: projectPda,
|
|
1073
|
+
tokenomics: tokenomicsPda,
|
|
1074
|
+
tokenVault: tokenVaultPda,
|
|
1075
|
+
founderVault: founderVaultPda,
|
|
1076
|
+
founderTokenAccount: args.founderTokenAccount,
|
|
1077
|
+
vaultAuthority: vaultAuthorityPda,
|
|
1078
|
+
tokenProgram: TOKEN_PROGRAM_ID
|
|
1079
|
+
}).rpc();
|
|
1080
|
+
}
|
|
1081
|
+
async function claimFounderMilestoneTokens(program, args, founder) {
|
|
1082
|
+
const projectPda = getProjectPDA(args.projectId, program.programId);
|
|
1083
|
+
const milestonePda = getMilestonePDA(projectPda, args.milestoneIndex, program.programId);
|
|
1084
|
+
const tokenomicsPda = getTokenomicsPDA(projectPda, program.programId);
|
|
1085
|
+
const tokenVaultPda = getTokenVaultPDA(projectPda, program.programId);
|
|
1086
|
+
const founderVaultPda = getFounderVaultPDA(projectPda, program.programId);
|
|
1087
|
+
const vaultAuthorityPda = getVaultAuthorityPDA(projectPda, program.programId);
|
|
1088
|
+
return getMethods(program).claimFounderMilestoneTokens({ milestoneIndex: args.milestoneIndex }).accountsPartial({
|
|
1089
|
+
founder,
|
|
1090
|
+
project: projectPda,
|
|
1091
|
+
milestone: milestonePda,
|
|
1092
|
+
tokenomics: tokenomicsPda,
|
|
1093
|
+
tokenVault: tokenVaultPda,
|
|
1094
|
+
founderVault: founderVaultPda,
|
|
1095
|
+
founderTokenAccount: args.founderTokenAccount,
|
|
1096
|
+
vaultAuthority: vaultAuthorityPda,
|
|
1097
|
+
tokenProgram: TOKEN_PROGRAM_ID
|
|
1098
|
+
}).rpc();
|
|
1099
|
+
}
|
|
1100
|
+
async function initializeSubAllocationVesting(program, args, payer) {
|
|
1101
|
+
const projectPda = getProjectPDA(args.projectId, program.programId);
|
|
1102
|
+
const tokenomicsPda = getTokenomicsPDA(projectPda, program.programId);
|
|
1103
|
+
const tokenVaultPda = getTokenVaultPDA(projectPda, program.programId);
|
|
1104
|
+
const subAllocationVestingPda = getSubAllocationVestingPDA(projectPda, args.subAllocationId, program.programId);
|
|
1105
|
+
return getMethods(program).initializeSubAllocationVesting({ subAllocationId: args.subAllocationId }).accountsPartial({
|
|
1106
|
+
project: projectPda,
|
|
1107
|
+
tokenomics: tokenomicsPda,
|
|
1108
|
+
tokenVault: tokenVaultPda,
|
|
1109
|
+
subAllocationVesting: subAllocationVestingPda,
|
|
1110
|
+
payer,
|
|
1111
|
+
systemProgram: SystemProgram.programId
|
|
1112
|
+
}).rpc();
|
|
1113
|
+
}
|
|
1114
|
+
async function claimSubAllocationTokens(program, args, recipient) {
|
|
1115
|
+
const projectPda = getProjectPDA(args.projectId, program.programId);
|
|
1116
|
+
const tokenomicsPda = getTokenomicsPDA(projectPda, program.programId);
|
|
1117
|
+
const tokenVaultPda = getTokenVaultPDA(projectPda, program.programId);
|
|
1118
|
+
const subAllocationVestingPda = getSubAllocationVestingPDA(projectPda, args.subAllocationId, program.programId);
|
|
1119
|
+
const treasuryVaultPda = getTreasuryVaultPDA(projectPda, program.programId);
|
|
1120
|
+
const vaultAuthorityPda = getVaultAuthorityPDA(projectPda, program.programId);
|
|
1121
|
+
return getMethods(program).claimSubAllocationTokens({ subAllocationId: args.subAllocationId }).accountsPartial({
|
|
1122
|
+
project: projectPda,
|
|
1123
|
+
tokenomics: tokenomicsPda,
|
|
1124
|
+
tokenVault: tokenVaultPda,
|
|
1125
|
+
subAllocationVesting: subAllocationVestingPda,
|
|
1126
|
+
reserveVault: treasuryVaultPda,
|
|
1127
|
+
vaultAuthority: vaultAuthorityPda,
|
|
1128
|
+
recipientTokenAccount: args.recipientTokenAccount,
|
|
1129
|
+
recipient,
|
|
1130
|
+
tokenProgram: TOKEN_PROGRAM_ID
|
|
1131
|
+
}).rpc();
|
|
1132
|
+
}
|
|
1133
|
+
async function claimMilestoneInstantTokens(program, args, investor) {
|
|
1134
|
+
const nftMintPubkey = ensurePublicKey(args.nftMint);
|
|
1135
|
+
const projectPda = getProjectPDA(args.projectId, program.programId);
|
|
1136
|
+
const milestonePda = getMilestonePDA(projectPda, args.milestoneIndex, program.programId);
|
|
1137
|
+
const investmentPda = getInvestmentPDA(projectPda, nftMintPubkey, program.programId);
|
|
1138
|
+
const tokenVaultPda = getTokenVaultPDA(projectPda, program.programId);
|
|
1139
|
+
const vestingPda = getInvestorMilestoneVestingPDA(projectPda, args.milestoneIndex, investmentPda, program.programId);
|
|
1140
|
+
const investorVaultPda = getInvestorVaultPDA(projectPda, program.programId);
|
|
1141
|
+
const vaultAuthorityPda = getVaultAuthorityPDA(projectPda, program.programId);
|
|
1142
|
+
const investorNftAccount = getAssociatedTokenAddressSync(
|
|
1143
|
+
nftMintPubkey,
|
|
1144
|
+
investor,
|
|
1145
|
+
false,
|
|
1146
|
+
TOKEN_PROGRAM_ID
|
|
1147
|
+
);
|
|
1148
|
+
return getMethods(program).claimMilestoneInstantTokens({ milestoneIndex: args.milestoneIndex }).accountsPartial({
|
|
1149
|
+
investor,
|
|
1150
|
+
project: projectPda,
|
|
1151
|
+
milestone: milestonePda,
|
|
1152
|
+
investment: investmentPda,
|
|
1153
|
+
tokenVault: tokenVaultPda,
|
|
1154
|
+
vesting: vestingPda,
|
|
1155
|
+
nftMint: nftMintPubkey,
|
|
1156
|
+
investorNftAccount,
|
|
1157
|
+
investorVault: investorVaultPda,
|
|
1158
|
+
investorTokenAccount: args.investorTokenAccount,
|
|
1159
|
+
vaultAuthority: vaultAuthorityPda,
|
|
1160
|
+
tokenProgram: TOKEN_PROGRAM_ID,
|
|
1161
|
+
systemProgram: SystemProgram.programId
|
|
1162
|
+
}).rpc();
|
|
1163
|
+
}
|
|
1164
|
+
async function claimMilestoneVestedTokens(program, args, investor) {
|
|
1165
|
+
const nftMintPubkey = ensurePublicKey(args.nftMint);
|
|
1166
|
+
const projectPda = getProjectPDA(args.projectId, program.programId);
|
|
1167
|
+
const milestonePda = getMilestonePDA(projectPda, args.milestoneIndex, program.programId);
|
|
1168
|
+
const investmentPda = getInvestmentPDA(projectPda, nftMintPubkey, program.programId);
|
|
1169
|
+
const tokenVaultPda = getTokenVaultPDA(projectPda, program.programId);
|
|
1170
|
+
const vestingPda = getInvestorMilestoneVestingPDA(projectPda, args.milestoneIndex, investmentPda, program.programId);
|
|
1171
|
+
const investorVaultPda = getInvestorVaultPDA(projectPda, program.programId);
|
|
1172
|
+
const vaultAuthorityPda = getVaultAuthorityPDA(projectPda, program.programId);
|
|
1173
|
+
const investorNftAccount = getAssociatedTokenAddressSync(
|
|
1174
|
+
nftMintPubkey,
|
|
1175
|
+
investor,
|
|
1176
|
+
false,
|
|
1177
|
+
TOKEN_PROGRAM_ID
|
|
1178
|
+
);
|
|
1179
|
+
return getMethods(program).claimMilestoneVestedTokens({ milestoneIndex: args.milestoneIndex }).accountsPartial({
|
|
1180
|
+
investor,
|
|
1181
|
+
project: projectPda,
|
|
1182
|
+
milestone: milestonePda,
|
|
1183
|
+
investment: investmentPda,
|
|
1184
|
+
tokenVault: tokenVaultPda,
|
|
1185
|
+
vesting: vestingPda,
|
|
1186
|
+
nftMint: nftMintPubkey,
|
|
1187
|
+
investorNftAccount,
|
|
1188
|
+
investorVault: investorVaultPda,
|
|
1189
|
+
investorTokenAccount: args.investorTokenAccount,
|
|
1190
|
+
vaultAuthority: vaultAuthorityPda,
|
|
1191
|
+
tokenProgram: TOKEN_PROGRAM_ID
|
|
1192
|
+
}).rpc();
|
|
1193
|
+
}
|
|
1194
|
+
async function claimFounderMsInstantTokens(program, args, founder) {
|
|
1195
|
+
const projectPda = getProjectPDA(args.projectId, program.programId);
|
|
1196
|
+
const milestonePda = getMilestonePDA(projectPda, args.milestoneIndex, program.programId);
|
|
1197
|
+
const tokenomicsPda = getTokenomicsPDA(projectPda, program.programId);
|
|
1198
|
+
const tokenVaultPda = getTokenVaultPDA(projectPda, program.programId);
|
|
1199
|
+
const vestingPda = getFounderMilestoneVestingPDA(projectPda, args.milestoneIndex, program.programId);
|
|
1200
|
+
const founderVaultPda = getFounderVaultPDA(projectPda, program.programId);
|
|
1201
|
+
const vaultAuthorityPda = getVaultAuthorityPDA(projectPda, program.programId);
|
|
1202
|
+
return getMethods(program).claimFounderMsInstantTokens({ milestoneIndex: args.milestoneIndex }).accountsPartial({
|
|
1203
|
+
founder,
|
|
1204
|
+
project: projectPda,
|
|
1205
|
+
tokenomics: tokenomicsPda,
|
|
1206
|
+
milestone: milestonePda,
|
|
1207
|
+
tokenVault: tokenVaultPda,
|
|
1208
|
+
vesting: vestingPda,
|
|
1209
|
+
founderVault: founderVaultPda,
|
|
1210
|
+
founderTokenAccount: args.founderTokenAccount,
|
|
1211
|
+
vaultAuthority: vaultAuthorityPda,
|
|
1212
|
+
tokenProgram: TOKEN_PROGRAM_ID,
|
|
1213
|
+
systemProgram: SystemProgram.programId
|
|
1214
|
+
}).rpc();
|
|
1215
|
+
}
|
|
1216
|
+
async function claimFounderMsVestedTokens(program, args, founder) {
|
|
1217
|
+
const projectPda = getProjectPDA(args.projectId, program.programId);
|
|
1218
|
+
const tokenVaultPda = getTokenVaultPDA(projectPda, program.programId);
|
|
1219
|
+
const vestingPda = getFounderMilestoneVestingPDA(projectPda, args.milestoneIndex, program.programId);
|
|
1220
|
+
const founderVaultPda = getFounderVaultPDA(projectPda, program.programId);
|
|
1221
|
+
const vaultAuthorityPda = getVaultAuthorityPDA(projectPda, program.programId);
|
|
1222
|
+
return getMethods(program).claimFounderMsVestedTokens({ milestoneIndex: args.milestoneIndex }).accountsPartial({
|
|
1223
|
+
founder,
|
|
1224
|
+
project: projectPda,
|
|
1225
|
+
tokenVault: tokenVaultPda,
|
|
1226
|
+
vesting: vestingPda,
|
|
1227
|
+
founderVault: founderVaultPda,
|
|
1228
|
+
founderTokenAccount: args.founderTokenAccount,
|
|
1229
|
+
vaultAuthority: vaultAuthorityPda,
|
|
1230
|
+
tokenProgram: TOKEN_PROGRAM_ID
|
|
1231
|
+
}).rpc();
|
|
1232
|
+
}
|
|
1233
|
+
function getRoundEscrowAuthorityPDA(projectPda, roundNumber, programId) {
|
|
1234
|
+
return PublicKey.findProgramAddressSync(
|
|
1235
|
+
[
|
|
1236
|
+
Buffer.from("round_escrow"),
|
|
1237
|
+
projectPda.toBuffer(),
|
|
1238
|
+
Buffer.from([roundNumber]),
|
|
1239
|
+
Buffer.from("authority")
|
|
1240
|
+
],
|
|
1241
|
+
programId
|
|
1242
|
+
);
|
|
1243
|
+
}
|
|
1244
|
+
async function openFundingRound(program, args, founder) {
|
|
1245
|
+
const projectPda = getProjectPDA(args.projectId, program.programId);
|
|
1246
|
+
const tokenomicsPda = getTokenomicsPDA(projectPda, program.programId);
|
|
1247
|
+
const project = await getAccountNamespace(program).project.fetch(projectPda);
|
|
1248
|
+
const newRoundNumber = (project.roundCount || 1) + 1;
|
|
1249
|
+
const fundingRoundPda = getFundingRoundPDA(projectPda, newRoundNumber, program.programId);
|
|
1250
|
+
const roundEscrowPda = getRoundEscrowPDA(projectPda, newRoundNumber, program.programId);
|
|
1251
|
+
const [roundEscrowAuthorityPda] = getRoundEscrowAuthorityPDA(projectPda, newRoundNumber, program.programId);
|
|
1252
|
+
const remainingAccounts = args.milestones.map((_, i) => {
|
|
1253
|
+
const milestonePda = getRoundMilestonePDA(projectPda, newRoundNumber, i, program.programId);
|
|
1254
|
+
return {
|
|
1255
|
+
pubkey: milestonePda,
|
|
1256
|
+
isSigner: false,
|
|
1257
|
+
isWritable: true
|
|
1258
|
+
};
|
|
1259
|
+
});
|
|
1260
|
+
const milestonesParam = args.milestones.map((m) => ({
|
|
1261
|
+
percentage: m.percentage,
|
|
1262
|
+
description: m.description,
|
|
1263
|
+
vestingDurationMonths: m.vestingDurationMonths ?? null,
|
|
1264
|
+
cliffMonths: m.cliffMonths ?? null,
|
|
1265
|
+
instantReleaseBps: m.instantReleaseBps ?? null
|
|
1266
|
+
}));
|
|
1267
|
+
return getMethods(program).openFundingRound({
|
|
1268
|
+
roundAllocationBps: args.roundAllocationBps,
|
|
1269
|
+
fundingGoal: args.fundingGoal,
|
|
1270
|
+
tiers: args.tiers,
|
|
1271
|
+
milestones: milestonesParam
|
|
1272
|
+
}).accountsPartial({
|
|
1273
|
+
project: projectPda,
|
|
1274
|
+
tokenomics: tokenomicsPda,
|
|
1275
|
+
fundingRound: fundingRoundPda,
|
|
1276
|
+
roundEscrow: roundEscrowPda,
|
|
1277
|
+
roundEscrowAuthority: roundEscrowAuthorityPda,
|
|
1278
|
+
usdcMint: args.usdcMint,
|
|
1279
|
+
previousFundingRound: args.previousFundingRoundPda ?? null,
|
|
1280
|
+
founder,
|
|
1281
|
+
tokenProgram: TOKEN_PROGRAM_ID,
|
|
1282
|
+
systemProgram: SystemProgram.programId,
|
|
1283
|
+
rent: SYSVAR_RENT_PUBKEY
|
|
1284
|
+
}).remainingAccounts(remainingAccounts).rpc();
|
|
1285
|
+
}
|
|
1286
|
+
async function investInRound(program, args, investor) {
|
|
1287
|
+
const projectPda = getProjectPDA(args.projectId, program.programId);
|
|
1288
|
+
const fundingRoundPda = getFundingRoundPDA(projectPda, args.roundNumber, program.programId);
|
|
1289
|
+
const roundEscrowPda = getRoundEscrowPDA(projectPda, args.roundNumber, program.programId);
|
|
1290
|
+
const firstRoundMilestonePda = getRoundMilestonePDA(projectPda, args.roundNumber, 0, program.programId);
|
|
1291
|
+
const [nftMint] = getRoundNftMintPDA(args.projectId, args.roundNumber, investor, args.investmentCount, program.programId);
|
|
1292
|
+
const investmentPda = getRoundInvestmentPDA(projectPda, args.roundNumber, nftMint, program.programId);
|
|
1293
|
+
const investorNftAccount = getAssociatedTokenAddressSync(nftMint, investor);
|
|
1294
|
+
const metadataAccount = getMetadataPDA(nftMint);
|
|
1295
|
+
const masterEdition = getMasterEditionPDA(nftMint);
|
|
1296
|
+
const [programAuthority] = getProgramAuthorityPDA(program.programId);
|
|
1297
|
+
return getMethods(program).investInRound({ amount: args.amount }).accountsPartial({
|
|
1298
|
+
project: projectPda,
|
|
1299
|
+
fundingRound: fundingRoundPda,
|
|
1300
|
+
firstRoundMilestone: firstRoundMilestonePda,
|
|
1301
|
+
nftMint,
|
|
1302
|
+
investment: investmentPda,
|
|
1303
|
+
investorNftAccount,
|
|
1304
|
+
metadataAccount,
|
|
1305
|
+
masterEdition,
|
|
1306
|
+
roundEscrow: roundEscrowPda,
|
|
1307
|
+
investorTokenAccount: args.investorTokenAccount,
|
|
1308
|
+
programAuthority,
|
|
1309
|
+
investor,
|
|
1310
|
+
tokenProgram: TOKEN_PROGRAM_ID,
|
|
1311
|
+
associatedTokenProgram: ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
1312
|
+
systemProgram: SystemProgram.programId,
|
|
1313
|
+
rent: SYSVAR_RENT_PUBKEY,
|
|
1314
|
+
tokenMetadataProgram: TOKEN_METADATA_PROGRAM_ID,
|
|
1315
|
+
sysvarInstructions: SYSVAR_INSTRUCTIONS_PUBKEY
|
|
1316
|
+
}).preInstructions([
|
|
1317
|
+
ComputeBudgetProgram.setComputeUnitLimit({ units: 4e5 })
|
|
1318
|
+
]).rpc();
|
|
1319
|
+
}
|
|
1320
|
+
async function cancelRoundInvestment(program, args, investor) {
|
|
1321
|
+
const nftMintPubkey = ensurePublicKey(args.nftMint);
|
|
1322
|
+
const projectPda = getProjectPDA(args.projectId, program.programId);
|
|
1323
|
+
const fundingRoundPda = getFundingRoundPDA(projectPda, args.roundNumber, program.programId);
|
|
1324
|
+
const investmentPda = getRoundInvestmentPDA(projectPda, args.roundNumber, nftMintPubkey, program.programId);
|
|
1325
|
+
const roundEscrowPda = getRoundEscrowPDA(projectPda, args.roundNumber, program.programId);
|
|
1326
|
+
const [roundEscrowAuthorityPda] = getRoundEscrowAuthorityPDA(projectPda, args.roundNumber, program.programId);
|
|
1327
|
+
return getMethods(program).cancelRoundInvestment().accountsPartial({
|
|
1328
|
+
investor,
|
|
1329
|
+
project: projectPda,
|
|
1330
|
+
fundingRound: fundingRoundPda,
|
|
1331
|
+
investment: investmentPda,
|
|
1332
|
+
nftMint: nftMintPubkey,
|
|
1333
|
+
investorNftAccount: args.investorNftAccount,
|
|
1334
|
+
roundEscrow: roundEscrowPda,
|
|
1335
|
+
roundEscrowAuthority: roundEscrowAuthorityPda,
|
|
1336
|
+
investorUsdcAccount: args.investorUsdcAccount,
|
|
1337
|
+
tokenProgram: TOKEN_PROGRAM_ID
|
|
1338
|
+
}).rpc();
|
|
1339
|
+
}
|
|
1340
|
+
async function submitRoundMilestone(program, args, founder) {
|
|
1341
|
+
const projectPda = getProjectPDA(args.projectId, program.programId);
|
|
1342
|
+
const fundingRoundPda = getFundingRoundPDA(projectPda, args.roundNumber, program.programId);
|
|
1343
|
+
const milestonePda = getRoundMilestonePDA(projectPda, args.roundNumber, args.milestoneIndex, program.programId);
|
|
1344
|
+
return getMethods(program).submitRoundMilestone().accountsPartial({
|
|
1345
|
+
founder,
|
|
1346
|
+
project: projectPda,
|
|
1347
|
+
fundingRound: fundingRoundPda,
|
|
1348
|
+
milestone: milestonePda,
|
|
1349
|
+
clock: SYSVAR_CLOCK_PUBKEY
|
|
1350
|
+
}).rpc();
|
|
1351
|
+
}
|
|
1352
|
+
async function voteOnRoundMilestone(program, args, voter) {
|
|
1353
|
+
const nftMintPubkey = ensurePublicKey(args.nftMint);
|
|
1354
|
+
const projectPda = getProjectPDA(args.projectId, program.programId);
|
|
1355
|
+
const fundingRoundPda = getFundingRoundPDA(projectPda, args.roundNumber, program.programId);
|
|
1356
|
+
const milestonePda = getRoundMilestonePDA(projectPda, args.roundNumber, args.milestoneIndex, program.programId);
|
|
1357
|
+
let investmentPda;
|
|
1358
|
+
if (args.investmentRoundNumber === 1) {
|
|
1359
|
+
investmentPda = getInvestmentPDA(projectPda, nftMintPubkey, program.programId);
|
|
1360
|
+
} else {
|
|
1361
|
+
investmentPda = getRoundInvestmentPDA(projectPda, args.investmentRoundNumber, nftMintPubkey, program.programId);
|
|
1362
|
+
}
|
|
1363
|
+
const milestone = await getAccountNamespace(program).milestone.fetch(milestonePda);
|
|
1364
|
+
const votingRound = milestone.votingRound ?? 0;
|
|
1365
|
+
const votePda = getVotePDA(milestonePda, voter, votingRound, program.programId);
|
|
1366
|
+
const voterNftAccount = getAssociatedTokenAddressSync(
|
|
1367
|
+
nftMintPubkey,
|
|
1368
|
+
voter,
|
|
1369
|
+
false,
|
|
1370
|
+
TOKEN_PROGRAM_ID
|
|
1371
|
+
);
|
|
1372
|
+
return getMethods(program).voteOnRoundMilestone({ choice: args.choice }).accountsPartial({
|
|
1373
|
+
vote: votePda,
|
|
1374
|
+
project: projectPda,
|
|
1375
|
+
fundingRound: fundingRoundPda,
|
|
1376
|
+
milestone: milestonePda,
|
|
1377
|
+
investment: investmentPda,
|
|
1378
|
+
nftMint: nftMintPubkey,
|
|
1379
|
+
voterNftAccount,
|
|
1380
|
+
voter,
|
|
1381
|
+
systemProgram: SystemProgram.programId
|
|
1382
|
+
}).rpc();
|
|
1383
|
+
}
|
|
1384
|
+
async function finalizeRoundVoting(program, args) {
|
|
1385
|
+
const projectPda = getProjectPDA(args.projectId, program.programId);
|
|
1386
|
+
const fundingRoundPda = getFundingRoundPDA(projectPda, args.roundNumber, program.programId);
|
|
1387
|
+
const milestonePda = getRoundMilestonePDA(projectPda, args.roundNumber, args.milestoneIndex, program.programId);
|
|
1388
|
+
return getMethods(program).finalizeRoundVoting().accountsPartial({
|
|
1389
|
+
project: projectPda,
|
|
1390
|
+
fundingRound: fundingRoundPda,
|
|
1391
|
+
milestone: milestonePda,
|
|
1392
|
+
clock: SYSVAR_CLOCK_PUBKEY
|
|
1393
|
+
}).rpc();
|
|
1394
|
+
}
|
|
1395
|
+
async function claimRoundMilestoneFunds(program, args, founder) {
|
|
1396
|
+
const projectPda = getProjectPDA(args.projectId, program.programId);
|
|
1397
|
+
const fundingRoundPda = getFundingRoundPDA(projectPda, args.roundNumber, program.programId);
|
|
1398
|
+
const milestonePda = getRoundMilestonePDA(projectPda, args.roundNumber, args.milestoneIndex, program.programId);
|
|
1399
|
+
const roundEscrowPda = getRoundEscrowPDA(projectPda, args.roundNumber, program.programId);
|
|
1400
|
+
const [roundEscrowAuthorityPda] = getRoundEscrowAuthorityPDA(projectPda, args.roundNumber, program.programId);
|
|
1401
|
+
const nextMilestonePda = args.nextMilestoneDeadline.gt(new BN(0)) ? getRoundMilestonePDA(projectPda, args.roundNumber, args.milestoneIndex + 1, program.programId) : null;
|
|
1402
|
+
return getMethods(program).claimRoundMilestoneFunds({ nextMilestoneDeadline: args.nextMilestoneDeadline }).accountsPartial({
|
|
1403
|
+
project: projectPda,
|
|
1404
|
+
fundingRound: fundingRoundPda,
|
|
1405
|
+
milestone: milestonePda,
|
|
1406
|
+
founder,
|
|
1407
|
+
roundEscrow: roundEscrowPda,
|
|
1408
|
+
roundEscrowAuthority: roundEscrowAuthorityPda,
|
|
1409
|
+
founderUsdcAccount: args.founderUsdcAccount,
|
|
1410
|
+
nextMilestone: nextMilestonePda,
|
|
1411
|
+
systemProgram: SystemProgram.programId,
|
|
1412
|
+
tokenProgram: TOKEN_PROGRAM_ID
|
|
1413
|
+
}).rpc();
|
|
1414
|
+
}
|
|
1415
|
+
async function claimRoundInstantTokens(program, args, investor) {
|
|
1416
|
+
const nftMintPubkey = ensurePublicKey(args.nftMint);
|
|
1417
|
+
const projectPda = getProjectPDA(args.projectId, program.programId);
|
|
1418
|
+
const fundingRoundPda = getFundingRoundPDA(projectPda, args.roundNumber, program.programId);
|
|
1419
|
+
const milestonePda = getRoundMilestonePDA(projectPda, args.roundNumber, args.milestoneIndex, program.programId);
|
|
1420
|
+
const investmentPda = getRoundInvestmentPDA(projectPda, args.roundNumber, nftMintPubkey, program.programId);
|
|
1421
|
+
const tokenVaultPda = getTokenVaultPDA(projectPda, program.programId);
|
|
1422
|
+
const futureRoundVaultPda = getFutureRoundVaultPDA(projectPda, program.programId);
|
|
1423
|
+
const futureRoundTokenVaultPda = getFutureRoundTokenVaultPDA(projectPda, program.programId);
|
|
1424
|
+
const vaultAuthorityPda = getVaultAuthorityPDA(projectPda, program.programId);
|
|
1425
|
+
const vestingPda = getRoundInvestorMilestoneVestingPDA(
|
|
1426
|
+
projectPda,
|
|
1427
|
+
args.roundNumber,
|
|
1428
|
+
args.milestoneIndex,
|
|
1429
|
+
investmentPda,
|
|
1430
|
+
program.programId
|
|
1431
|
+
);
|
|
1432
|
+
const investorNftAccount = getAssociatedTokenAddressSync(
|
|
1433
|
+
nftMintPubkey,
|
|
1434
|
+
investor,
|
|
1435
|
+
false,
|
|
1436
|
+
TOKEN_PROGRAM_ID
|
|
1437
|
+
);
|
|
1438
|
+
return getMethods(program).claimRoundInstantTokens({ milestoneIndex: args.milestoneIndex }).accountsPartial({
|
|
1439
|
+
investor,
|
|
1440
|
+
project: projectPda,
|
|
1441
|
+
fundingRound: fundingRoundPda,
|
|
1442
|
+
milestone: milestonePda,
|
|
1443
|
+
investment: investmentPda,
|
|
1444
|
+
tokenVault: tokenVaultPda,
|
|
1445
|
+
futureRoundVault: futureRoundVaultPda,
|
|
1446
|
+
vesting: vestingPda,
|
|
1447
|
+
nftMint: nftMintPubkey,
|
|
1448
|
+
investorNftAccount,
|
|
1449
|
+
futureRoundTokenVault: futureRoundTokenVaultPda,
|
|
1450
|
+
investorTokenAccount: args.investorTokenAccount,
|
|
1451
|
+
vaultAuthority: vaultAuthorityPda,
|
|
1452
|
+
tokenProgram: TOKEN_PROGRAM_ID,
|
|
1453
|
+
systemProgram: SystemProgram.programId
|
|
1454
|
+
}).rpc();
|
|
1455
|
+
}
|
|
1456
|
+
async function claimRoundVestedTokens(program, args, investor) {
|
|
1457
|
+
const nftMintPubkey = ensurePublicKey(args.nftMint);
|
|
1458
|
+
const projectPda = getProjectPDA(args.projectId, program.programId);
|
|
1459
|
+
const fundingRoundPda = getFundingRoundPDA(projectPda, args.roundNumber, program.programId);
|
|
1460
|
+
const milestonePda = getRoundMilestonePDA(projectPda, args.roundNumber, args.milestoneIndex, program.programId);
|
|
1461
|
+
const investmentPda = getRoundInvestmentPDA(projectPda, args.roundNumber, nftMintPubkey, program.programId);
|
|
1462
|
+
const tokenVaultPda = getTokenVaultPDA(projectPda, program.programId);
|
|
1463
|
+
const futureRoundVaultPda = getFutureRoundVaultPDA(projectPda, program.programId);
|
|
1464
|
+
const futureRoundTokenVaultPda = getFutureRoundTokenVaultPDA(projectPda, program.programId);
|
|
1465
|
+
const vaultAuthorityPda = getVaultAuthorityPDA(projectPda, program.programId);
|
|
1466
|
+
const vestingPda = getRoundInvestorMilestoneVestingPDA(
|
|
1467
|
+
projectPda,
|
|
1468
|
+
args.roundNumber,
|
|
1469
|
+
args.milestoneIndex,
|
|
1470
|
+
investmentPda,
|
|
1471
|
+
program.programId
|
|
1472
|
+
);
|
|
1473
|
+
const investorNftAccount = getAssociatedTokenAddressSync(
|
|
1474
|
+
nftMintPubkey,
|
|
1475
|
+
investor,
|
|
1476
|
+
false,
|
|
1477
|
+
TOKEN_PROGRAM_ID
|
|
1478
|
+
);
|
|
1479
|
+
return getMethods(program).claimRoundVestedTokens({ milestoneIndex: args.milestoneIndex }).accountsPartial({
|
|
1480
|
+
investor,
|
|
1481
|
+
project: projectPda,
|
|
1482
|
+
fundingRound: fundingRoundPda,
|
|
1483
|
+
milestone: milestonePda,
|
|
1484
|
+
investment: investmentPda,
|
|
1485
|
+
tokenVault: tokenVaultPda,
|
|
1486
|
+
futureRoundVault: futureRoundVaultPda,
|
|
1487
|
+
vesting: vestingPda,
|
|
1488
|
+
nftMint: nftMintPubkey,
|
|
1489
|
+
investorNftAccount,
|
|
1490
|
+
futureRoundTokenVault: futureRoundTokenVaultPda,
|
|
1491
|
+
investorTokenAccount: args.investorTokenAccount,
|
|
1492
|
+
vaultAuthority: vaultAuthorityPda,
|
|
1493
|
+
tokenProgram: TOKEN_PROGRAM_ID
|
|
1494
|
+
}).rpc();
|
|
1495
|
+
}
|
|
1496
|
+
async function claimRoundEarlyTokens(program, args, investor) {
|
|
1497
|
+
const nftMintPubkey = ensurePublicKey(args.nftMint);
|
|
1498
|
+
const projectPda = getProjectPDA(args.projectId, program.programId);
|
|
1499
|
+
const fundingRoundPda = getFundingRoundPDA(projectPda, args.roundNumber, program.programId);
|
|
1500
|
+
const investmentPda = getRoundInvestmentPDA(projectPda, args.roundNumber, nftMintPubkey, program.programId);
|
|
1501
|
+
const tokenVaultPda = getTokenVaultPDA(projectPda, program.programId);
|
|
1502
|
+
const futureRoundVaultPda = getFutureRoundVaultPDA(projectPda, program.programId);
|
|
1503
|
+
const futureRoundTokenVaultPda = getFutureRoundTokenVaultPDA(projectPda, program.programId);
|
|
1504
|
+
const vaultAuthorityPda = getVaultAuthorityPDA(projectPda, program.programId);
|
|
1505
|
+
const investorNftAccount = getAssociatedTokenAddressSync(
|
|
1506
|
+
nftMintPubkey,
|
|
1507
|
+
investor,
|
|
1508
|
+
false,
|
|
1509
|
+
TOKEN_PROGRAM_ID
|
|
1510
|
+
);
|
|
1511
|
+
return getMethods(program).claimRoundEarlyTokens().accountsPartial({
|
|
1512
|
+
investor,
|
|
1513
|
+
project: projectPda,
|
|
1514
|
+
fundingRound: fundingRoundPda,
|
|
1515
|
+
investment: investmentPda,
|
|
1516
|
+
tokenVault: tokenVaultPda,
|
|
1517
|
+
futureRoundVault: futureRoundVaultPda,
|
|
1518
|
+
nftMint: nftMintPubkey,
|
|
1519
|
+
investorNftAccount,
|
|
1520
|
+
futureRoundTokenVault: futureRoundTokenVaultPda,
|
|
1521
|
+
investorTokenAccount: args.investorTokenAccount,
|
|
1522
|
+
vaultAuthority: vaultAuthorityPda,
|
|
1523
|
+
tokenProgram: TOKEN_PROGRAM_ID
|
|
1524
|
+
}).rpc();
|
|
1525
|
+
}
|
|
806
1526
|
|
|
807
|
-
export { MAX_DEADLINE_DURATION_SECONDS, MIN_DEADLINE_DURATION_SECONDS_DEV, MIN_DEADLINE_DURATION_SECONDS_PROD, acceptAdmin, approvePivot, approveProject, calculateDeadline, cancelInvestment, checkAbandonment, claimExitWindowRefund, claimInvestorTokens, claimMilestoneFunds, claimMissedUnlock, claimRefund, claimTokens, claimVestedTokens, completeDistribution, createMilestone, depositTokens, distributeTokens, extendMilestoneDeadline, finalizePivot, finalizeVoting, forceCompleteDistribution, initializeAdmin, initializeFounderVesting, initializeProject, invest, minDeadline, proposePivot, releaseHoldback, reportScam, resubmitMilestone, setMilestoneDeadline, setTgeDate, submitForApproval, submitMilestone, symbolToBytes, transferAdmin, validateDeadline, voteOnMilestone, withdrawFromPivot };
|
|
1527
|
+
export { MAX_DEADLINE_DURATION_SECONDS, MIN_DEADLINE_DURATION_SECONDS_DEV, MIN_DEADLINE_DURATION_SECONDS_PROD, acceptAdmin, addSubAllocation, approvePivot, approveProject, calculateDeadline, cancelInvestment, cancelRoundInvestment, checkAbandonment, claimEarlyTokens, claimExitWindowRefund, claimFounderEarlyTokens, claimFounderMilestoneTokens, claimFounderMsInstantTokens, claimFounderMsVestedTokens, claimInvestorTokens, claimMilestoneFunds, claimMilestoneInstantTokens, claimMilestoneVestedTokens, claimMissedUnlock, claimRefund, claimRoundEarlyTokens, claimRoundInstantTokens, claimRoundMilestoneFunds, claimRoundVestedTokens, claimSubAllocationTokens, claimTokens, claimVestedTokens, completeDistribution, createMilestone, depositTokens, distributeTokens, executeAllocationChange, extendMilestoneDeadline, finalizePivot, finalizeRoundVoting, finalizeVoting, forceCompleteDistribution, initializeAdmin, initializeFounderVesting, initializeProject, initializeSubAllocationVesting, invest, investInRound, minDeadline, openFundingRound, proposeAllocationChange, proposePivot, releaseHoldback, reportScam, resubmitMilestone, setMilestoneDeadline, setTgeDate, submitForApproval, submitMilestone, submitRoundMilestone, symbolToBytes, transferAdmin, validateDeadline, voteAllocationChange, voteOnMilestone, voteOnRoundMilestone, withdrawFromPivot };
|
|
808
1528
|
//# sourceMappingURL=index.js.map
|
|
809
1529
|
//# sourceMappingURL=index.js.map
|