@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.
Files changed (47) hide show
  1. package/README.md +11 -9
  2. package/dist/accounts/index.cjs +531 -3
  3. package/dist/accounts/index.cjs.map +1 -1
  4. package/dist/accounts/index.d.cts +307 -2
  5. package/dist/accounts/index.d.ts +307 -2
  6. package/dist/accounts/index.js +503 -4
  7. package/dist/accounts/index.js.map +1 -1
  8. package/dist/constants/index.cjs +41 -3
  9. package/dist/constants/index.cjs.map +1 -1
  10. package/dist/constants/index.d.cts +38 -3
  11. package/dist/constants/index.d.ts +38 -3
  12. package/dist/constants/index.js +40 -4
  13. package/dist/constants/index.js.map +1 -1
  14. package/dist/index.cjs +2297 -361
  15. package/dist/index.cjs.map +1 -1
  16. package/dist/index.d.cts +566 -7
  17. package/dist/index.d.ts +566 -7
  18. package/dist/index.js +2279 -379
  19. package/dist/index.js.map +1 -1
  20. package/dist/instructions/index.cjs +783 -40
  21. package/dist/instructions/index.cjs.map +1 -1
  22. package/dist/instructions/index.d.cts +492 -6
  23. package/dist/instructions/index.d.ts +492 -6
  24. package/dist/instructions/index.js +762 -42
  25. package/dist/instructions/index.js.map +1 -1
  26. package/dist/pdas/index.cjs +163 -1
  27. package/dist/pdas/index.cjs.map +1 -1
  28. package/dist/pdas/index.d.cts +131 -1
  29. package/dist/pdas/index.d.ts +131 -1
  30. package/dist/pdas/index.js +151 -2
  31. package/dist/pdas/index.js.map +1 -1
  32. package/dist/types/index.cjs +9 -0
  33. package/dist/types/index.cjs.map +1 -1
  34. package/dist/types/index.d.cts +586 -3
  35. package/dist/types/index.d.ts +586 -3
  36. package/dist/types/index.js +9 -1
  37. package/dist/types/index.js.map +1 -1
  38. package/package.json +5 -3
  39. package/src/__tests__/dynamic-tokenomics.test.ts +358 -0
  40. package/src/accounts/index.ts +852 -1
  41. package/src/client.ts +1130 -1
  42. package/src/constants/index.ts +48 -2
  43. package/src/index.ts +58 -0
  44. package/src/instructions/index.ts +1383 -40
  45. package/src/pdas/index.ts +346 -0
  46. package/src/types/index.ts +698 -2
  47. package/src/utils/index.ts +90 -0
@@ -16,7 +16,13 @@ var SEEDS = {
16
16
  SCAM_REPORT: "scam_report",
17
17
  ADMIN_CONFIG: "admin-config",
18
18
  NFT_MINT: "nft_mint",
19
- AUTHORITY: "authority"
19
+ AUTHORITY: "authority",
20
+ FUTURE_ROUND_VAULT: "future_round_vault",
21
+ FUTURE_ROUND_STATE: "future_round_state",
22
+ // Multi-Round Fundraising seeds
23
+ FUNDING_ROUND: "funding_round",
24
+ ROUND_ESCROW: "round_escrow",
25
+ INVESTOR_MS_VESTING: "investor_ms_vesting"
20
26
  };
21
27
 
22
28
  // src/pdas/index.ts
@@ -211,7 +217,150 @@ function getFounderVestingPDA(projectPda, programId) {
211
217
  );
212
218
  return pda;
213
219
  }
220
+ function getAllocationProposalPDA(projectPda, proposalIndex, programId) {
221
+ const [pda] = PublicKey.findProgramAddressSync(
222
+ [
223
+ Buffer.from("allocation_proposal"),
224
+ projectPda.toBuffer(),
225
+ Buffer.from([proposalIndex])
226
+ ],
227
+ programId
228
+ );
229
+ return pda;
230
+ }
231
+ function getAllocationVotePDA(proposalPda, nftMint, programId) {
232
+ const [pda] = PublicKey.findProgramAddressSync(
233
+ [
234
+ Buffer.from("allocation_vote"),
235
+ proposalPda.toBuffer(),
236
+ nftMint.toBuffer()
237
+ ],
238
+ programId
239
+ );
240
+ return pda;
241
+ }
242
+ function getSubAllocationVestingPDA(projectPda, subAllocationId, programId) {
243
+ const [pda] = PublicKey.findProgramAddressSync(
244
+ [
245
+ Buffer.from("sub_allocation_vesting"),
246
+ projectPda.toBuffer(),
247
+ Buffer.from([subAllocationId])
248
+ ],
249
+ programId
250
+ );
251
+ return pda;
252
+ }
253
+ function getInvestorMilestoneVestingPDA(projectPda, milestoneIndex, investmentPda, programId) {
254
+ const [pda] = PublicKey.findProgramAddressSync(
255
+ [
256
+ Buffer.from("investor_ms_vesting"),
257
+ projectPda.toBuffer(),
258
+ Buffer.from([milestoneIndex]),
259
+ investmentPda.toBuffer()
260
+ ],
261
+ programId
262
+ );
263
+ return pda;
264
+ }
265
+ function getFounderMilestoneVestingPDA(projectPda, milestoneIndex, programId) {
266
+ const [pda] = PublicKey.findProgramAddressSync(
267
+ [
268
+ Buffer.from("founder_ms_vesting"),
269
+ projectPda.toBuffer(),
270
+ Buffer.from([milestoneIndex])
271
+ ],
272
+ programId
273
+ );
274
+ return pda;
275
+ }
276
+ function getFutureRoundTokenVaultPDA(projectPda, programId) {
277
+ const [pda] = PublicKey.findProgramAddressSync(
278
+ [Buffer.from(SEEDS.FUTURE_ROUND_VAULT), projectPda.toBuffer()],
279
+ programId
280
+ );
281
+ return pda;
282
+ }
283
+ function getFutureRoundVaultPDA(projectPda, programId) {
284
+ const [pda] = PublicKey.findProgramAddressSync(
285
+ [Buffer.from(SEEDS.FUTURE_ROUND_STATE), projectPda.toBuffer()],
286
+ programId
287
+ );
288
+ return pda;
289
+ }
290
+ function getFundingRoundPDA(projectPda, roundNumber, programId) {
291
+ const [pda] = PublicKey.findProgramAddressSync(
292
+ [
293
+ Buffer.from(SEEDS.FUNDING_ROUND),
294
+ projectPda.toBuffer(),
295
+ Buffer.from([roundNumber])
296
+ ],
297
+ programId
298
+ );
299
+ return pda;
300
+ }
301
+ function getRoundEscrowPDA(projectPda, roundNumber, programId) {
302
+ const [pda] = PublicKey.findProgramAddressSync(
303
+ [
304
+ Buffer.from(SEEDS.ROUND_ESCROW),
305
+ projectPda.toBuffer(),
306
+ Buffer.from([roundNumber])
307
+ ],
308
+ programId
309
+ );
310
+ return pda;
311
+ }
312
+ function getRoundMilestonePDA(projectPda, roundNumber, milestoneIndex, programId) {
313
+ const [pda] = PublicKey.findProgramAddressSync(
314
+ [
315
+ Buffer.from(SEEDS.MILESTONE),
316
+ projectPda.toBuffer(),
317
+ Buffer.from([roundNumber]),
318
+ Buffer.from([milestoneIndex])
319
+ ],
320
+ programId
321
+ );
322
+ return pda;
323
+ }
324
+ function getRoundNftMintPDA(projectId, roundNumber, investor, investmentCount, programId) {
325
+ const projectIdBN = ensureBN(projectId);
326
+ const countBN = ensureBN(investmentCount);
327
+ return PublicKey.findProgramAddressSync(
328
+ [
329
+ Buffer.from(SEEDS.NFT_MINT),
330
+ projectIdBN.toArrayLike(Buffer, "le", 8),
331
+ Buffer.from([roundNumber]),
332
+ investor.toBuffer(),
333
+ countBN.toArrayLike(Buffer, "le", 8)
334
+ ],
335
+ programId
336
+ );
337
+ }
338
+ function getRoundInvestmentPDA(projectPda, roundNumber, nftMint, programId) {
339
+ const [pda] = PublicKey.findProgramAddressSync(
340
+ [
341
+ Buffer.from(SEEDS.INVESTMENT),
342
+ projectPda.toBuffer(),
343
+ Buffer.from([roundNumber]),
344
+ nftMint.toBuffer()
345
+ ],
346
+ programId
347
+ );
348
+ return pda;
349
+ }
350
+ function getRoundInvestorMilestoneVestingPDA(projectPda, roundNumber, milestoneIndex, investmentPda, programId) {
351
+ const [pda] = PublicKey.findProgramAddressSync(
352
+ [
353
+ Buffer.from(SEEDS.INVESTOR_MS_VESTING),
354
+ projectPda.toBuffer(),
355
+ Buffer.from([roundNumber]),
356
+ Buffer.from([milestoneIndex]),
357
+ investmentPda.toBuffer()
358
+ ],
359
+ programId
360
+ );
361
+ return pda;
362
+ }
214
363
 
215
- export { getAdminConfigPDA, getEscrowPDA, getFounderVaultPDA, getFounderVestingPDA, getInvestmentPDA, getInvestorVaultPDA, getLpTokenVaultPDA, getLpUsdcVaultPDA, getMilestonePDA, getNftMintPDA, getPivotProposalPDA, getProgramAuthorityPDA, getProjectPDA, getProjectPDAs, getScamReportPDA, getTgeEscrowPDA, getTgeEscrowVaultPDA, getTokenMintPDA, getTokenVaultPDA, getTokenomicsPDA, getTreasuryVaultPDA, getVaultAuthorityPDA, getVotePDA };
364
+ export { getAdminConfigPDA, getAllocationProposalPDA, getAllocationVotePDA, getEscrowPDA, getFounderMilestoneVestingPDA, getFounderVaultPDA, getFounderVestingPDA, getFundingRoundPDA, getFutureRoundTokenVaultPDA, getFutureRoundVaultPDA, getInvestmentPDA, getInvestorMilestoneVestingPDA, getInvestorVaultPDA, getLpTokenVaultPDA, getLpUsdcVaultPDA, getMilestonePDA, getNftMintPDA, getPivotProposalPDA, getProgramAuthorityPDA, getProjectPDA, getProjectPDAs, getRoundEscrowPDA, getRoundInvestmentPDA, getRoundInvestorMilestoneVestingPDA, getRoundMilestonePDA, getRoundNftMintPDA, getScamReportPDA, getSubAllocationVestingPDA, getTgeEscrowPDA, getTgeEscrowVaultPDA, getTokenMintPDA, getTokenVaultPDA, getTokenomicsPDA, getTreasuryVaultPDA, getVaultAuthorityPDA, getVotePDA };
216
365
  //# sourceMappingURL=index.js.map
217
366
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/constants/index.ts","../../src/pdas/index.ts"],"names":[],"mappings":";;;;;;AAWO,IAAM,KAAA,GAAQ;AAAA,EACnB,OAAA,EAAS,SAAA;AAAA,EACT,SAAA,EAAW,WAAA;AAAA,EACX,UAAA,EAAY,YAAA;AAAA,EACZ,IAAA,EAAM,MAAA;AAAA,EACN,MAAA,EAAQ,QAAA;AAAA,EACR,KAAA,EAAO,OAAA;AAAA,EAEP,UAAA,EAAY,YAAA;AAAA,EACZ,gBAAA,EAAkB,kBAAA;AAAA,EAClB,WAAA,EAAa,aAAA;AAAA,EACb,YAAA,EAAc,cAAA;AAAA,EACd,QAAA,EAAU,UAAA;AAAA,EACV,SAAA,EAAW;AACb,CAAA;;;ACPA,SAAS,SAAS,KAAA,EAA0D;AAE1E,EAAA,IAAI,KAAA,IAAS,OAAQ,KAAA,CAAa,WAAA,KAAgB,UAAA,EAAY;AAC5D,IAAA,OAAO,KAAA;AAAA,EACT;AAEA,EAAA,OAAO,IAAI,EAAA,CAAG,MAAA,CAAO,KAAK,CAAC,CAAA;AAC7B;AASO,SAAS,aAAA,CA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AAA,GAAI,SAAA,CAAU,sBAAA;AAAA,IACtB,CAAC,MAAA,CAAO,IAAA,CAAK,iBAAiB,CAAA,EAAG,UAAA,CAAW,UAAU,CAAA;AAAA,IACtD;AAAA,GACF;AACA,EAAA,OAAO,GAAA;AACT","file":"index.js","sourcesContent":["/**\n * Raise Constants\n *\n * Mirrors the on-chain program constants for client-side validation\n * and display purposes.\n */\n\n// =============================================================================\n// PDA Seeds\n// =============================================================================\n\nexport const SEEDS = {\n PROJECT: 'project',\n MILESTONE: 'milestone',\n INVESTMENT: 'investment',\n VOTE: 'vote',\n ESCROW: 'escrow',\n PIVOT: 'pivot',\n PIVOT_PROPOSAL: 'pivot_proposal',\n TGE_ESCROW: 'tge_escrow',\n TGE_ESCROW_VAULT: 'tge_escrow_vault',\n SCAM_REPORT: 'scam_report',\n ADMIN_CONFIG: 'admin-config',\n NFT_MINT: 'nft_mint',\n AUTHORITY: 'authority',\n} as const;\n\n// =============================================================================\n// Validation Constants\n// =============================================================================\n\nexport const VALIDATION = {\n /** Minimum number of milestones per project */\n MIN_MILESTONES: 2,\n /** Maximum number of milestones per project */\n MAX_MILESTONES: 10,\n /** Milestone percentages must sum to this value */\n MILESTONE_PERCENTAGE_SUM: 100,\n /** Maximum funding buffer (110% of goal) */\n MAX_FUNDING_BUFFER_PERCENT: 110,\n /** Maximum metadata URI length */\n MAX_METADATA_URI_LENGTH: 200,\n /** Maximum pivot description length */\n MAX_PIVOT_DESCRIPTION_LEN: 256,\n /** Maximum pivot vision length */\n MAX_PIVOT_VISION_LEN: 512,\n /** Maximum pivot justification length */\n MAX_PIVOT_JUSTIFICATION_LEN: 512,\n} as const;\n\n// =============================================================================\n// Timing Constants (in seconds)\n// =============================================================================\n\nexport const TIMING = {\n /** Production voting period (14 days) */\n VOTING_PERIOD_SECONDS: 1_209_600,\n /** Production hold period (7 days) */\n HOLD_PERIOD_SECONDS: 604_800,\n /** Inactivity timeout (90 days) */\n INACTIVITY_TIMEOUT_SECONDS: 7_776_000,\n /** Abandonment timeout (90 days) */\n ABANDONMENT_TIMEOUT_SECONDS: 7_776_000,\n /** Refund window (14 days) */\n REFUND_WINDOW_SECONDS: 1_209_600,\n /** Pivot withdrawal window (7 days) */\n PIVOT_WITHDRAWAL_WINDOW_SECONDS: 604_800,\n /** Minimum TGE date (15 days from now) */\n TGE_MIN_DAYS: 1_296_000,\n /** Maximum TGE date (90 days from now) */\n TGE_MAX_DAYS: 7_776_000,\n /** Post-TGE holdback period (30 days) */\n POST_TGE_HOLDBACK_DAYS: 2_592_000,\n} as const;\n\n// =============================================================================\n// Tier Configuration Constraints\n// =============================================================================\n\nexport const TIER_CONSTRAINTS = {\n /** Minimum number of tiers */\n MIN_TIERS: 1,\n /** Maximum number of tiers */\n MAX_TIERS: 10,\n /** Minimum tier amount (10 USDC in lamports) */\n MIN_TIER_AMOUNT: 10_000_000n,\n /** Minimum max_lots per tier */\n MIN_TIER_MAX_LOTS: 1,\n /** Minimum token ratio */\n MIN_TIER_TOKEN_RATIO: 1n,\n /** Minimum vote multiplier (100 = 1.0x) */\n MIN_TIER_VOTE_MULTIPLIER: 100,\n} as const;\n\n// =============================================================================\n// Investment Tiers (Legacy - kept for backwards compatibility)\n// =============================================================================\n\nexport enum InvestmentTier {\n Bronze = 'Bronze',\n Silver = 'Silver',\n Gold = 'Gold',\n Platinum = 'Platinum',\n Diamond = 'Diamond',\n}\n\n/** Investment tier minimum amounts in USDC lamports (6 decimals) - LEGACY */\nexport const TIER_MINIMUMS = {\n [InvestmentTier.Bronze]: 100_000_000n, // 100 USDC\n [InvestmentTier.Silver]: 500_000_000n, // 500 USDC\n [InvestmentTier.Gold]: 1_000_000_000n, // 1,000 USDC\n [InvestmentTier.Platinum]: 5_000_000_000n, // 5,000 USDC\n [InvestmentTier.Diamond]: 10_000_000_000n, // 10,000 USDC\n} as const;\n\n/** Vote weight multipliers (scaled by 100) - LEGACY */\nexport const TIER_VOTE_MULTIPLIERS = {\n [InvestmentTier.Bronze]: 100, // 1.0x\n [InvestmentTier.Silver]: 120, // 1.2x\n [InvestmentTier.Gold]: 150, // 1.5x\n [InvestmentTier.Platinum]: 200, // 2.0x\n [InvestmentTier.Diamond]: 300, // 3.0x\n} as const;\n\n/** Token allocation multipliers (same as vote multipliers) - LEGACY */\nexport const TIER_TOKEN_MULTIPLIERS = {\n [InvestmentTier.Bronze]: 100,\n [InvestmentTier.Silver]: 120,\n [InvestmentTier.Gold]: 150,\n [InvestmentTier.Platinum]: 200,\n [InvestmentTier.Diamond]: 300,\n} as const;\n\n/** Get tier from investment amount (in lamports) - LEGACY, use project.tiers instead */\nexport function getTierFromAmount(amount: bigint): InvestmentTier {\n if (amount >= TIER_MINIMUMS[InvestmentTier.Diamond]) return InvestmentTier.Diamond;\n if (amount >= TIER_MINIMUMS[InvestmentTier.Platinum]) return InvestmentTier.Platinum;\n if (amount >= TIER_MINIMUMS[InvestmentTier.Gold]) return InvestmentTier.Gold;\n if (amount >= TIER_MINIMUMS[InvestmentTier.Silver]) return InvestmentTier.Silver;\n return InvestmentTier.Bronze;\n}\n\n/** Get vote multiplier for an investment amount - LEGACY */\nexport function getVoteMultiplier(amount: bigint): number {\n const tier = getTierFromAmount(amount);\n return TIER_VOTE_MULTIPLIERS[tier] / 100;\n}\n\n/** Get token multiplier for an investment amount - LEGACY */\nexport function getTokenMultiplier(amount: bigint): number {\n const tier = getTierFromAmount(amount);\n return TIER_TOKEN_MULTIPLIERS[tier] / 100;\n}\n\n/**\n * Find matching tier index for an investment amount (threshold-based)\n * Returns the highest tier where amount >= tier.amount\n */\nexport function findTierIndex(tiers: Array<{ amount: bigint }>, amount: bigint): number | null {\n for (let i = tiers.length - 1; i >= 0; i--) {\n if (amount >= tiers[i].amount) {\n return i;\n }\n }\n return null;\n}\n\n// =============================================================================\n// Voting and Governance\n// =============================================================================\n\nexport const GOVERNANCE = {\n /** Scam report threshold (30%) */\n SCAM_THRESHOLD_PERCENT: 30,\n /** Consecutive milestone failures before exit window eligible */\n CONSECUTIVE_FAILURES_THRESHOLD: 3,\n /** Milestone approval threshold (>50% weighted approval per whitepaper voting.md:100-101) */\n MILESTONE_APPROVAL_THRESHOLD_PERCENT: 50,\n} as const;\n\n// =============================================================================\n// NFT Constants\n// =============================================================================\n\nexport const NFT = {\n /** NFT symbol */\n SYMBOL: 'SNI',\n /** NFT name prefix */\n NAME_PREFIX: 'Raise Investment #',\n /** Royalty basis points (2%) */\n ROYALTY_BASIS_POINTS: 200,\n} as const;\n\n// =============================================================================\n// USDC Constants\n// =============================================================================\n\nexport const USDC = {\n /** USDC decimals */\n DECIMALS: 6,\n /** Convert USDC to lamports */\n toAmount: (usdc: number): bigint => BigInt(Math.floor(usdc * 10 ** 6)),\n /** Convert lamports to USDC */\n fromAmount: (lamports: bigint): number => Number(lamports) / 10 ** 6,\n} as const;\n","/**\n * Raise PDA Derivation Helpers\n *\n * All PDA derivation functions for the Raise program.\n * PDAs are deterministic addresses derived from seeds and program ID.\n */\n\nimport { PublicKey } from '@solana/web3.js';\nimport { BN } from '@coral-xyz/anchor';\nimport { SEEDS } from '../constants/index.js';\n\n/**\n * Ensure value is a proper BN instance\n * This handles cases where BN objects lose their prototype chain\n * (e.g., when passing through React state or JSON serialization)\n *\n * Uses duck typing instead of instanceof to handle different BN module instances\n */\nfunction ensureBN(value: BN | number | string | { toString(): string }): BN {\n // Duck typing: if it has toArrayLike, it's BN-like and we can use it\n if (value && typeof (value as BN).toArrayLike === 'function') {\n return value as BN;\n }\n // Always create a fresh BN from the SDK's imported BN class\n return new BN(String(value));\n}\n\n/**\n * Derive Project PDA from project ID\n *\n * @param projectId - Unique project identifier\n * @param programId - Raise program ID\n * @returns Project account PDA\n */\nexport function getProjectPDA(projectId: BN | number | string, programId: PublicKey): PublicKey {\n const projectIdBN = ensureBN(projectId);\n const [pda] = PublicKey.findProgramAddressSync(\n [Buffer.from(SEEDS.PROJECT), projectIdBN.toArrayLike(Buffer, 'le', 8)],\n programId\n );\n return pda;\n}\n\n/**\n * Derive Escrow PDA from project ID\n *\n * @param projectId - Project identifier\n * @param programId - Raise program ID\n * @returns Escrow account PDA\n */\nexport function getEscrowPDA(projectId: BN | number | string, programId: PublicKey): PublicKey {\n const projectIdBN = ensureBN(projectId);\n const [pda] = PublicKey.findProgramAddressSync(\n [Buffer.from(SEEDS.ESCROW), projectIdBN.toArrayLike(Buffer, 'le', 8)],\n programId\n );\n return pda;\n}\n\n/**\n * Derive Milestone PDA from project PDA and milestone index\n *\n * @param projectPda - Project account PDA\n * @param milestoneIndex - Milestone index (0-based)\n * @param programId - Raise program ID\n * @returns Milestone account PDA\n */\nexport function getMilestonePDA(\n projectPda: PublicKey,\n milestoneIndex: number,\n programId: PublicKey\n): PublicKey {\n const [pda] = PublicKey.findProgramAddressSync(\n [\n Buffer.from(SEEDS.MILESTONE),\n projectPda.toBuffer(),\n Buffer.from([milestoneIndex]),\n ],\n programId\n );\n return pda;\n}\n\n/**\n * Derive Investment PDA from project PDA and NFT mint\n *\n * @param projectPda - Project account PDA\n * @param nftMint - Investment NFT mint address\n * @param programId - Raise program ID\n * @returns Investment account PDA\n */\nexport function getInvestmentPDA(\n projectPda: PublicKey,\n nftMint: PublicKey,\n programId: PublicKey\n): PublicKey {\n const [pda] = PublicKey.findProgramAddressSync(\n [\n Buffer.from(SEEDS.INVESTMENT),\n projectPda.toBuffer(),\n nftMint.toBuffer(),\n ],\n programId\n );\n return pda;\n}\n\n/**\n * Derive Vote PDA from milestone PDA, voter key, and voting round\n *\n * @param milestonePda - Milestone account PDA\n * @param voterKey - Voter's public key\n * @param votingRound - Current voting round (0 initially, incremented on resubmit)\n * @param programId - Raise program ID\n * @returns Vote account PDA\n */\nexport function getVotePDA(\n milestonePda: PublicKey,\n voterKey: PublicKey,\n votingRound: number,\n programId: PublicKey\n): PublicKey {\n const [pda] = PublicKey.findProgramAddressSync(\n [Buffer.from(SEEDS.VOTE), milestonePda.toBuffer(), voterKey.toBuffer(), Buffer.from([votingRound])],\n programId\n );\n return pda;\n}\n\n/**\n * Derive PivotProposal PDA from project PDA and pivot count\n *\n * @param projectPda - Project account PDA\n * @param pivotCount - Current pivot count from project account\n * @param programId - Raise program ID\n * @returns PivotProposal account PDA\n */\nexport function getPivotProposalPDA(\n projectPda: PublicKey,\n pivotCount: number,\n programId: PublicKey\n): PublicKey {\n const [pda] = PublicKey.findProgramAddressSync(\n [\n Buffer.from(SEEDS.PIVOT), // Use PIVOT seed, not PIVOT_PROPOSAL\n projectPda.toBuffer(),\n Buffer.from([pivotCount]), // pivot_count is u8 (1 byte) on-chain\n ],\n programId\n );\n return pda;\n}\n\n/**\n * Derive TgeEscrow PDA from project PDA\n *\n * @param projectPda - Project account PDA\n * @param programId - Raise program ID\n * @returns TgeEscrow account PDA\n */\nexport function getTgeEscrowPDA(\n projectPda: PublicKey,\n programId: PublicKey\n): PublicKey {\n const [pda] = PublicKey.findProgramAddressSync(\n [Buffer.from(SEEDS.TGE_ESCROW), projectPda.toBuffer()],\n programId\n );\n return pda;\n}\n\n/**\n * Derive TgeEscrowVault PDA from project PDA\n * Used for holding 10% USDC holdback from final milestone\n *\n * @param projectPda - Project account PDA\n * @param programId - Raise program ID\n * @returns TgeEscrowVault PDA\n */\nexport function getTgeEscrowVaultPDA(\n projectPda: PublicKey,\n programId: PublicKey\n): PublicKey {\n const [pda] = PublicKey.findProgramAddressSync(\n [Buffer.from(SEEDS.TGE_ESCROW_VAULT), projectPda.toBuffer()],\n programId\n );\n return pda;\n}\n\n/**\n * Derive TokenVault PDA from project PDA\n * Used for holding project tokens for investor distribution\n *\n * @param projectPda - Project account PDA\n * @param programId - Raise program ID\n * @returns TokenVault PDA\n */\nexport function getTokenVaultPDA(\n projectPda: PublicKey,\n programId: PublicKey\n): PublicKey {\n const [pda] = PublicKey.findProgramAddressSync(\n [Buffer.from('token_vault'), projectPda.toBuffer()],\n programId\n );\n return pda;\n}\n\n/**\n * Derive ScamReport PDA from project PDA and NFT mint\n *\n * @param projectPda - Project account PDA\n * @param nftMint - Reporter's NFT mint address\n * @param programId - Raise program ID\n * @returns ScamReport account PDA\n */\nexport function getScamReportPDA(\n projectPda: PublicKey,\n nftMint: PublicKey,\n programId: PublicKey\n): PublicKey {\n const [pda] = PublicKey.findProgramAddressSync(\n [\n Buffer.from(SEEDS.SCAM_REPORT),\n projectPda.toBuffer(),\n nftMint.toBuffer(),\n ],\n programId\n );\n return pda;\n}\n\n/**\n * Derive AdminConfig PDA (global admin authority)\n *\n * @param programId - Raise program ID\n * @returns AdminConfig account PDA\n */\nexport function getAdminConfigPDA(programId: PublicKey): PublicKey {\n const [pda] = PublicKey.findProgramAddressSync(\n [Buffer.from(SEEDS.ADMIN_CONFIG)],\n programId\n );\n return pda;\n}\n\n/**\n * Derive NFT Mint PDA\n *\n * @param projectId - Project identifier\n * @param investor - Investor's public key\n * @param investmentCount - Investment count (u64 in Rust, 8 bytes LE)\n * @param programId - Raise program ID\n * @returns NFT Mint PDA and bump\n */\nexport function getNftMintPDA(\n projectId: BN | number | string,\n investor: PublicKey,\n investmentCount: BN | number,\n programId: PublicKey\n): [PublicKey, number] {\n // Ensure both values are proper BN instances (handles prototype chain issues)\n const projectIdBN = ensureBN(projectId);\n const countBN = ensureBN(investmentCount);\n return PublicKey.findProgramAddressSync(\n [\n Buffer.from(SEEDS.NFT_MINT),\n projectIdBN.toArrayLike(Buffer, 'le', 8),\n investor.toBuffer(),\n countBN.toArrayLike(Buffer, 'le', 8), // u64 is 8 bytes LE\n ],\n programId\n );\n}\n\n/**\n * Derive Program Authority PDA\n *\n * @param programId - Raise program ID\n * @returns Program authority PDA and bump\n */\nexport function getProgramAuthorityPDA(programId: PublicKey): [PublicKey, number] {\n return PublicKey.findProgramAddressSync(\n [Buffer.from(SEEDS.AUTHORITY)],\n programId\n );\n}\n\n/**\n * Helper to derive all PDAs for a project\n *\n * @param projectId - Project identifier\n * @param programId - Raise program ID\n * @returns Object with project and escrow PDAs\n */\nexport function getProjectPDAs(projectId: BN, programId: PublicKey) {\n const project = getProjectPDA(projectId, programId);\n const escrow = getEscrowPDA(projectId, programId);\n return { project, escrow };\n}\n\n// =============================================================================\n// ZTM v2.0 PDAs\n// =============================================================================\n\n/**\n * Derive Tokenomics PDA from project PDA\n */\nexport function getTokenomicsPDA(projectPda: PublicKey, programId: PublicKey): PublicKey {\n const [pda] = PublicKey.findProgramAddressSync(\n [Buffer.from('tokenomics'), projectPda.toBuffer()],\n programId\n );\n return pda;\n}\n\n/**\n * Derive Token Mint PDA from project PDA\n */\nexport function getTokenMintPDA(projectPda: PublicKey, programId: PublicKey): PublicKey {\n const [pda] = PublicKey.findProgramAddressSync(\n [Buffer.from('token_mint'), projectPda.toBuffer()],\n programId\n );\n return pda;\n}\n\n/**\n * Derive Vault Authority PDA from project PDA\n */\nexport function getVaultAuthorityPDA(projectPda: PublicKey, programId: PublicKey): PublicKey {\n const [pda] = PublicKey.findProgramAddressSync(\n [Buffer.from('vault_authority'), projectPda.toBuffer()],\n programId\n );\n return pda;\n}\n\n/**\n * Derive Investor Vault PDA from project PDA\n */\nexport function getInvestorVaultPDA(projectPda: PublicKey, programId: PublicKey): PublicKey {\n const [pda] = PublicKey.findProgramAddressSync(\n [Buffer.from('investor_vault'), projectPda.toBuffer()],\n programId\n );\n return pda;\n}\n\n/**\n * Derive Founder Vault PDA from project PDA\n */\nexport function getFounderVaultPDA(projectPda: PublicKey, programId: PublicKey): PublicKey {\n const [pda] = PublicKey.findProgramAddressSync(\n [Buffer.from('founder_vault'), projectPda.toBuffer()],\n programId\n );\n return pda;\n}\n\n/**\n * Derive LP Token Vault PDA from project PDA\n */\nexport function getLpTokenVaultPDA(projectPda: PublicKey, programId: PublicKey): PublicKey {\n const [pda] = PublicKey.findProgramAddressSync(\n [Buffer.from('lp_token_vault'), projectPda.toBuffer()],\n programId\n );\n return pda;\n}\n\n/**\n * Derive Treasury Vault PDA from project PDA\n */\nexport function getTreasuryVaultPDA(projectPda: PublicKey, programId: PublicKey): PublicKey {\n const [pda] = PublicKey.findProgramAddressSync(\n [Buffer.from('treasury_vault'), projectPda.toBuffer()],\n programId\n );\n return pda;\n}\n\n/**\n * Derive LP USDC Vault PDA from project PDA\n */\nexport function getLpUsdcVaultPDA(projectPda: PublicKey, programId: PublicKey): PublicKey {\n const [pda] = PublicKey.findProgramAddressSync(\n [Buffer.from('lp_usdc_vault'), projectPda.toBuffer()],\n programId\n );\n return pda;\n}\n\n/**\n * Derive Founder Vesting PDA from project PDA\n */\nexport function getFounderVestingPDA(projectPda: PublicKey, programId: PublicKey): PublicKey {\n const [pda] = PublicKey.findProgramAddressSync(\n [Buffer.from('founder_vesting'), projectPda.toBuffer()],\n programId\n );\n return pda;\n}\n"]}
1
+ {"version":3,"sources":["../../src/constants/index.ts","../../src/pdas/index.ts"],"names":[],"mappings":";;;;;;AAWO,IAAM,KAAA,GAAQ;AAAA,EACnB,OAAA,EAAS,SAAA;AAAA,EACT,SAAA,EAAW,WAAA;AAAA,EACX,UAAA,EAAY,YAAA;AAAA,EACZ,IAAA,EAAM,MAAA;AAAA,EACN,MAAA,EAAQ,QAAA;AAAA,EACR,KAAA,EAAO,OAAA;AAAA,EAEP,UAAA,EAAY,YAAA;AAAA,EACZ,gBAAA,EAAkB,kBAAA;AAAA,EAClB,WAAA,EAAa,aAAA;AAAA,EACb,YAAA,EAAc,cAAA;AAAA,EACd,QAAA,EAAU,UAAA;AAAA,EACV,SAAA,EAAW,WAAA;AAAA,EACX,kBAAA,EAAoB,oBAAA;AAAA,EACpB,kBAAA,EAAoB,oBAAA;AAAA;AAAA,EAEpB,aAAA,EAAe,eAAA;AAAA,EACf,YAAA,EAAc,cAAA;AAAA,EACd,mBAAA,EAAqB;AACvB,CAAA;;;ACbA,SAAS,SAAS,KAAA,EAA0D;AAE1E,EAAA,IAAI,KAAA,IAAS,OAAQ,KAAA,CAAa,WAAA,KAAgB,UAAA,EAAY;AAC5D,IAAA,OAAO,KAAA;AAAA,EACT;AAEA,EAAA,OAAO,IAAI,EAAA,CAAG,MAAA,CAAO,KAAK,CAAC,C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AQ,IAAA,EAAM,CAAC,CAAA;AAAA,MACvC,MAAA,CAAO,IAAA,CAAK,CAAC,WAAW,CAAC,CAAA;AAAA,MACzB,SAAS,QAAA,EAAS;AAAA,MAClB,OAAA,CAAQ,WAAA,CAAY,MAAA,EAAQ,IAAA,EAAM,CAAC;AAAA,KACrC;AAAA,IACA;AAAA,GACF;AACF;AAYO,SAAS,qBAAA,CACd,UAAA,EACA,WAAA,EACA,OAAA,EACA,SAAA,EACW;AACX,EAAA,MAAM,CAAC,GAAG,CAAA,GAAI,SAAA,CAAU,sBAAA;AAAA,IACtB;AAAA,MACE,MAAA,CAAO,IAAA,CAAK,KAAA,CAAM,UAAU,CAAA;AAAA,MAC5B,WAAW,QAAA,EAAS;AAAA,MACpB,MAAA,CAAO,IAAA,CAAK,CAAC,WAAW,CAAC,CAAA;AAAA,MACzB,QAAQ,QAAA;AAAS,KACnB;AAAA,IACA;AAAA,GACF;AACA,EAAA,OAAO,GAAA;AACT;AAaO,SAAS,mCAAA,CACd,UAAA,EACA,WAAA,EACA,cAAA,EACA,eACA,SAAA,EACW;AACX,EAAA,MAAM,CAAC,GAAG,CAAA,GAAI,SAAA,CAAU,sBAAA;AAAA,IACtB;AAAA,MACE,MAAA,CAAO,IAAA,CAAK,KAAA,CAAM,mBAAmB,CAAA;AAAA,MACrC,WAAW,QAAA,EAAS;AAAA,MACpB,MAAA,CAAO,IAAA,CAAK,CAAC,WAAW,CAAC,CAAA;AAAA,MACzB,MAAA,CAAO,IAAA,CAAK,CAAC,cAAc,CAAC,CAAA;AAAA,MAC5B,cAAc,QAAA;AAAS,KACzB;AAAA,IACA;AAAA,GACF;AACA,EAAA,OAAO,GAAA;AACT","file":"index.js","sourcesContent":["/**\n * Raise Constants\n *\n * Mirrors the on-chain program constants for client-side validation\n * and display purposes.\n */\n\n// =============================================================================\n// PDA Seeds\n// =============================================================================\n\nexport const SEEDS = {\n PROJECT: 'project',\n MILESTONE: 'milestone',\n INVESTMENT: 'investment',\n VOTE: 'vote',\n ESCROW: 'escrow',\n PIVOT: 'pivot',\n PIVOT_PROPOSAL: 'pivot_proposal',\n TGE_ESCROW: 'tge_escrow',\n TGE_ESCROW_VAULT: 'tge_escrow_vault',\n SCAM_REPORT: 'scam_report',\n ADMIN_CONFIG: 'admin-config',\n NFT_MINT: 'nft_mint',\n AUTHORITY: 'authority',\n FUTURE_ROUND_VAULT: 'future_round_vault',\n FUTURE_ROUND_STATE: 'future_round_state',\n // Multi-Round Fundraising seeds\n FUNDING_ROUND: 'funding_round',\n ROUND_ESCROW: 'round_escrow',\n INVESTOR_MS_VESTING: 'investor_ms_vesting',\n} as const;\n\n// =============================================================================\n// Validation Constants\n// =============================================================================\n\nexport const VALIDATION = {\n /** Minimum number of milestones per project */\n MIN_MILESTONES: 2,\n /** Maximum number of milestones per project */\n MAX_MILESTONES: 10,\n /** Milestone percentages must sum to this value */\n MILESTONE_PERCENTAGE_SUM: 100,\n /** Maximum funding buffer (110% of goal) */\n MAX_FUNDING_BUFFER_PERCENT: 110,\n /** Maximum metadata URI length */\n MAX_METADATA_URI_LENGTH: 200,\n /** Maximum pivot description length */\n MAX_PIVOT_DESCRIPTION_LEN: 256,\n /** Maximum pivot vision length */\n MAX_PIVOT_VISION_LEN: 512,\n /** Maximum pivot justification length */\n MAX_PIVOT_JUSTIFICATION_LEN: 512,\n} as const;\n\n// =============================================================================\n// Timing Constants (in seconds)\n// =============================================================================\n\nexport const TIMING = {\n /** Production voting period (14 days) */\n VOTING_PERIOD_SECONDS: 1_209_600,\n /** Production hold period (7 days) */\n HOLD_PERIOD_SECONDS: 604_800,\n /** Inactivity timeout (90 days) */\n INACTIVITY_TIMEOUT_SECONDS: 7_776_000,\n /** Abandonment timeout (90 days) */\n ABANDONMENT_TIMEOUT_SECONDS: 7_776_000,\n /** Refund window (14 days) */\n REFUND_WINDOW_SECONDS: 1_209_600,\n /** Pivot withdrawal window (7 days) */\n PIVOT_WITHDRAWAL_WINDOW_SECONDS: 604_800,\n /** Minimum TGE date (15 days from now) */\n TGE_MIN_DAYS: 1_296_000,\n /** Maximum TGE date (90 days from now) */\n TGE_MAX_DAYS: 7_776_000,\n /** Post-TGE holdback period (30 days) */\n POST_TGE_HOLDBACK_DAYS: 2_592_000,\n} as const;\n\n// =============================================================================\n// Tier Configuration Constraints\n// =============================================================================\n\nexport const TIER_CONSTRAINTS = {\n /** Minimum number of tiers */\n MIN_TIERS: 1,\n /** Maximum number of tiers */\n MAX_TIERS: 10,\n /** Minimum tier amount (10 USDC in lamports) */\n MIN_TIER_AMOUNT: 10_000_000n,\n /** Minimum max_lots per tier */\n MIN_TIER_MAX_LOTS: 1,\n /** Minimum token ratio */\n MIN_TIER_TOKEN_RATIO: 1n,\n /** Minimum vote multiplier (100 = 1.0x) */\n MIN_TIER_VOTE_MULTIPLIER: 100,\n} as const;\n\n// =============================================================================\n// Progressive Pricing Constants (add-linear-progressive-pricing)\n// =============================================================================\n\nexport const PROGRESSIVE_PRICING = {\n /** Base price multiplier (10000 BPS = 1.0x) */\n PRICE_MULTIPLIER_BASE: 10000,\n /** Maximum price multiplier (20000 BPS = 2.0x) */\n MAX_MULTIPLIER_BPS: 20000,\n /** Percentage of ZEMYTH increment allocated to time-based component */\n TIME_ALLOCATION_PERCENT: 50,\n /** Percentage of ZEMYTH increment allocated to milestone spike component */\n MILESTONE_ALLOCATION_PERCENT: 50,\n} as const;\n\n// =============================================================================\n// Investment Tiers (Legacy - kept for backwards compatibility)\n// =============================================================================\n\nexport enum InvestmentTier {\n Bronze = 'Bronze',\n Silver = 'Silver',\n Gold = 'Gold',\n Platinum = 'Platinum',\n Diamond = 'Diamond',\n}\n\n/** Investment tier minimum amounts in USDC lamports (6 decimals) - LEGACY */\nexport const TIER_MINIMUMS = {\n [InvestmentTier.Bronze]: 100_000_000n, // 100 USDC\n [InvestmentTier.Silver]: 500_000_000n, // 500 USDC\n [InvestmentTier.Gold]: 1_000_000_000n, // 1,000 USDC\n [InvestmentTier.Platinum]: 5_000_000_000n, // 5,000 USDC\n [InvestmentTier.Diamond]: 10_000_000_000n, // 10,000 USDC\n} as const;\n\n/** Vote weight multipliers (scaled by 100) - LEGACY */\nexport const TIER_VOTE_MULTIPLIERS = {\n [InvestmentTier.Bronze]: 100, // 1.0x\n [InvestmentTier.Silver]: 120, // 1.2x\n [InvestmentTier.Gold]: 150, // 1.5x\n [InvestmentTier.Platinum]: 200, // 2.0x\n [InvestmentTier.Diamond]: 300, // 3.0x\n} as const;\n\n/** Token allocation multipliers (same as vote multipliers) - LEGACY */\nexport const TIER_TOKEN_MULTIPLIERS = {\n [InvestmentTier.Bronze]: 100,\n [InvestmentTier.Silver]: 120,\n [InvestmentTier.Gold]: 150,\n [InvestmentTier.Platinum]: 200,\n [InvestmentTier.Diamond]: 300,\n} as const;\n\n/** Get tier from investment amount (in lamports) - LEGACY, use project.tiers instead */\nexport function getTierFromAmount(amount: bigint): InvestmentTier {\n if (amount >= TIER_MINIMUMS[InvestmentTier.Diamond]) return InvestmentTier.Diamond;\n if (amount >= TIER_MINIMUMS[InvestmentTier.Platinum]) return InvestmentTier.Platinum;\n if (amount >= TIER_MINIMUMS[InvestmentTier.Gold]) return InvestmentTier.Gold;\n if (amount >= TIER_MINIMUMS[InvestmentTier.Silver]) return InvestmentTier.Silver;\n return InvestmentTier.Bronze;\n}\n\n/** Get vote multiplier for an investment amount - LEGACY */\nexport function getVoteMultiplier(amount: bigint): number {\n const tier = getTierFromAmount(amount);\n return TIER_VOTE_MULTIPLIERS[tier] / 100;\n}\n\n/** Get token multiplier for an investment amount - LEGACY */\nexport function getTokenMultiplier(amount: bigint): number {\n const tier = getTierFromAmount(amount);\n return TIER_TOKEN_MULTIPLIERS[tier] / 100;\n}\n\n/**\n * Find matching tier index for an investment amount (threshold-based)\n * Returns the highest tier where amount >= tier.amount\n */\nexport function findTierIndex(tiers: Array<{ amount: bigint }>, amount: bigint): number | null {\n for (let i = tiers.length - 1; i >= 0; i--) {\n if (amount >= tiers[i].amount) {\n return i;\n }\n }\n return null;\n}\n\n// =============================================================================\n// Voting and Governance\n// =============================================================================\n\nexport const GOVERNANCE = {\n /** Scam report threshold (30%) */\n SCAM_THRESHOLD_PERCENT: 30,\n /** Consecutive milestone failures before exit window eligible */\n CONSECUTIVE_FAILURES_THRESHOLD: 3,\n /** Milestone approval threshold (>50% weighted approval per whitepaper voting.md:100-101) */\n MILESTONE_APPROVAL_THRESHOLD_PERCENT: 50,\n} as const;\n\n// =============================================================================\n// NFT Constants\n// =============================================================================\n\nexport const NFT = {\n /** NFT symbol */\n SYMBOL: 'ZRI',\n /** NFT name prefix */\n NAME_PREFIX: 'Zemyth Raise Investment #',\n /** Royalty basis points (2%) */\n ROYALTY_BASIS_POINTS: 200,\n} as const;\n\n// =============================================================================\n// USDC Constants\n// =============================================================================\n\nexport const USDC = {\n /** USDC decimals */\n DECIMALS: 6,\n /** Convert USDC to lamports */\n toAmount: (usdc: number): bigint => BigInt(Math.floor(usdc * 10 ** 6)),\n /** Convert lamports to USDC */\n fromAmount: (lamports: bigint): number => Number(lamports) / 10 ** 6,\n} as const;\n\n// =============================================================================\n// Tokenomics Allocation Constants\n// =============================================================================\n\nexport const TOKENOMICS = {\n /** Minimum investor allocation (20%) */\n MIN_INVESTOR_ALLOCATION_BPS: 2000,\n /** Minimum founder allocation (5%) if > 0 */\n MIN_FOUNDER_ALLOCATION_BPS: 500,\n /** Minimum LP token allocation (5%) */\n MIN_LP_TOKEN_ALLOCATION_BPS: 500,\n /** Minimum LP USDC allocation (5%) */\n MIN_LP_USDC_BPS: 500,\n /** Minimum Zemyth allocation (1%) */\n MIN_ZEMYTH_ALLOCATION_BPS: 100,\n /** Default Zemyth allocation (1%) */\n DEFAULT_ZEMYTH_ALLOCATION_BPS: 100,\n /** Minimum future round allocation (10%) if > 0 */\n MIN_FUTURE_ROUND_ALLOCATION_BPS: 1000,\n /** Maximum token symbol length */\n MAX_TOKEN_SYMBOL_LEN: 8,\n /** Total allocation must sum to this (100% = 10000 bps) */\n TOTAL_ALLOCATION_BPS: 10000,\n} as const;\n","/**\n * Raise PDA Derivation Helpers\n *\n * All PDA derivation functions for the Raise program.\n * PDAs are deterministic addresses derived from seeds and program ID.\n */\n\nimport { PublicKey } from '@solana/web3.js';\nimport { BN } from '@coral-xyz/anchor';\nimport { SEEDS } from '../constants/index.js';\n\n/**\n * Ensure value is a proper BN instance\n * This handles cases where BN objects lose their prototype chain\n * (e.g., when passing through React state or JSON serialization)\n *\n * Uses duck typing instead of instanceof to handle different BN module instances\n */\nfunction ensureBN(value: BN | number | string | { toString(): string }): BN {\n // Duck typing: if it has toArrayLike, it's BN-like and we can use it\n if (value && typeof (value as BN).toArrayLike === 'function') {\n return value as BN;\n }\n // Always create a fresh BN from the SDK's imported BN class\n return new BN(String(value));\n}\n\n/**\n * Derive Project PDA from project ID\n *\n * @param projectId - Unique project identifier\n * @param programId - Raise program ID\n * @returns Project account PDA\n */\nexport function getProjectPDA(projectId: BN | number | string, programId: PublicKey): PublicKey {\n const projectIdBN = ensureBN(projectId);\n const [pda] = PublicKey.findProgramAddressSync(\n [Buffer.from(SEEDS.PROJECT), projectIdBN.toArrayLike(Buffer, 'le', 8)],\n programId\n );\n return pda;\n}\n\n/**\n * Derive Escrow PDA from project ID\n *\n * @param projectId - Project identifier\n * @param programId - Raise program ID\n * @returns Escrow account PDA\n */\nexport function getEscrowPDA(projectId: BN | number | string, programId: PublicKey): PublicKey {\n const projectIdBN = ensureBN(projectId);\n const [pda] = PublicKey.findProgramAddressSync(\n [Buffer.from(SEEDS.ESCROW), projectIdBN.toArrayLike(Buffer, 'le', 8)],\n programId\n );\n return pda;\n}\n\n/**\n * Derive Milestone PDA from project PDA and milestone index\n *\n * @param projectPda - Project account PDA\n * @param milestoneIndex - Milestone index (0-based)\n * @param programId - Raise program ID\n * @returns Milestone account PDA\n */\nexport function getMilestonePDA(\n projectPda: PublicKey,\n milestoneIndex: number,\n programId: PublicKey\n): PublicKey {\n const [pda] = PublicKey.findProgramAddressSync(\n [\n Buffer.from(SEEDS.MILESTONE),\n projectPda.toBuffer(),\n Buffer.from([milestoneIndex]),\n ],\n programId\n );\n return pda;\n}\n\n/**\n * Derive Investment PDA from project PDA and NFT mint\n *\n * @param projectPda - Project account PDA\n * @param nftMint - Investment NFT mint address\n * @param programId - Raise program ID\n * @returns Investment account PDA\n */\nexport function getInvestmentPDA(\n projectPda: PublicKey,\n nftMint: PublicKey,\n programId: PublicKey\n): PublicKey {\n const [pda] = PublicKey.findProgramAddressSync(\n [\n Buffer.from(SEEDS.INVESTMENT),\n projectPda.toBuffer(),\n nftMint.toBuffer(),\n ],\n programId\n );\n return pda;\n}\n\n/**\n * Derive Vote PDA from milestone PDA, voter key, and voting round\n *\n * @param milestonePda - Milestone account PDA\n * @param voterKey - Voter's public key\n * @param votingRound - Current voting round (0 initially, incremented on resubmit)\n * @param programId - Raise program ID\n * @returns Vote account PDA\n */\nexport function getVotePDA(\n milestonePda: PublicKey,\n voterKey: PublicKey,\n votingRound: number,\n programId: PublicKey\n): PublicKey {\n const [pda] = PublicKey.findProgramAddressSync(\n [Buffer.from(SEEDS.VOTE), milestonePda.toBuffer(), voterKey.toBuffer(), Buffer.from([votingRound])],\n programId\n );\n return pda;\n}\n\n/**\n * Derive PivotProposal PDA from project PDA and pivot count\n *\n * @param projectPda - Project account PDA\n * @param pivotCount - Current pivot count from project account\n * @param programId - Raise program ID\n * @returns PivotProposal account PDA\n */\nexport function getPivotProposalPDA(\n projectPda: PublicKey,\n pivotCount: number,\n programId: PublicKey\n): PublicKey {\n const [pda] = PublicKey.findProgramAddressSync(\n [\n Buffer.from(SEEDS.PIVOT), // Use PIVOT seed, not PIVOT_PROPOSAL\n projectPda.toBuffer(),\n Buffer.from([pivotCount]), // pivot_count is u8 (1 byte) on-chain\n ],\n programId\n );\n return pda;\n}\n\n/**\n * Derive TgeEscrow PDA from project PDA\n *\n * @param projectPda - Project account PDA\n * @param programId - Raise program ID\n * @returns TgeEscrow account PDA\n */\nexport function getTgeEscrowPDA(\n projectPda: PublicKey,\n programId: PublicKey\n): PublicKey {\n const [pda] = PublicKey.findProgramAddressSync(\n [Buffer.from(SEEDS.TGE_ESCROW), projectPda.toBuffer()],\n programId\n );\n return pda;\n}\n\n/**\n * Derive TgeEscrowVault PDA from project PDA\n * Used for holding 10% USDC holdback from final milestone\n *\n * @param projectPda - Project account PDA\n * @param programId - Raise program ID\n * @returns TgeEscrowVault PDA\n */\nexport function getTgeEscrowVaultPDA(\n projectPda: PublicKey,\n programId: PublicKey\n): PublicKey {\n const [pda] = PublicKey.findProgramAddressSync(\n [Buffer.from(SEEDS.TGE_ESCROW_VAULT), projectPda.toBuffer()],\n programId\n );\n return pda;\n}\n\n/**\n * Derive TokenVault PDA from project PDA\n * Used for holding project tokens for investor distribution\n *\n * @param projectPda - Project account PDA\n * @param programId - Raise program ID\n * @returns TokenVault PDA\n */\nexport function getTokenVaultPDA(\n projectPda: PublicKey,\n programId: PublicKey\n): PublicKey {\n const [pda] = PublicKey.findProgramAddressSync(\n [Buffer.from('token_vault'), projectPda.toBuffer()],\n programId\n );\n return pda;\n}\n\n/**\n * Derive ScamReport PDA from project PDA and NFT mint\n *\n * @param projectPda - Project account PDA\n * @param nftMint - Reporter's NFT mint address\n * @param programId - Raise program ID\n * @returns ScamReport account PDA\n */\nexport function getScamReportPDA(\n projectPda: PublicKey,\n nftMint: PublicKey,\n programId: PublicKey\n): PublicKey {\n const [pda] = PublicKey.findProgramAddressSync(\n [\n Buffer.from(SEEDS.SCAM_REPORT),\n projectPda.toBuffer(),\n nftMint.toBuffer(),\n ],\n programId\n );\n return pda;\n}\n\n/**\n * Derive AdminConfig PDA (global admin authority)\n *\n * @param programId - Raise program ID\n * @returns AdminConfig account PDA\n */\nexport function getAdminConfigPDA(programId: PublicKey): PublicKey {\n const [pda] = PublicKey.findProgramAddressSync(\n [Buffer.from(SEEDS.ADMIN_CONFIG)],\n programId\n );\n return pda;\n}\n\n/**\n * Derive NFT Mint PDA\n *\n * @param projectId - Project identifier\n * @param investor - Investor's public key\n * @param investmentCount - Investment count (u64 in Rust, 8 bytes LE)\n * @param programId - Raise program ID\n * @returns NFT Mint PDA and bump\n */\nexport function getNftMintPDA(\n projectId: BN | number | string,\n investor: PublicKey,\n investmentCount: BN | number,\n programId: PublicKey\n): [PublicKey, number] {\n // Ensure both values are proper BN instances (handles prototype chain issues)\n const projectIdBN = ensureBN(projectId);\n const countBN = ensureBN(investmentCount);\n return PublicKey.findProgramAddressSync(\n [\n Buffer.from(SEEDS.NFT_MINT),\n projectIdBN.toArrayLike(Buffer, 'le', 8),\n investor.toBuffer(),\n countBN.toArrayLike(Buffer, 'le', 8), // u64 is 8 bytes LE\n ],\n programId\n );\n}\n\n/**\n * Derive Program Authority PDA\n *\n * @param programId - Raise program ID\n * @returns Program authority PDA and bump\n */\nexport function getProgramAuthorityPDA(programId: PublicKey): [PublicKey, number] {\n return PublicKey.findProgramAddressSync(\n [Buffer.from(SEEDS.AUTHORITY)],\n programId\n );\n}\n\n/**\n * Helper to derive all PDAs for a project\n *\n * @param projectId - Project identifier\n * @param programId - Raise program ID\n * @returns Object with project and escrow PDAs\n */\nexport function getProjectPDAs(projectId: BN, programId: PublicKey) {\n const project = getProjectPDA(projectId, programId);\n const escrow = getEscrowPDA(projectId, programId);\n return { project, escrow };\n}\n\n// =============================================================================\n// ZTM v2.0 PDAs\n// =============================================================================\n\n/**\n * Derive Tokenomics PDA from project PDA\n */\nexport function getTokenomicsPDA(projectPda: PublicKey, programId: PublicKey): PublicKey {\n const [pda] = PublicKey.findProgramAddressSync(\n [Buffer.from('tokenomics'), projectPda.toBuffer()],\n programId\n );\n return pda;\n}\n\n/**\n * Derive Token Mint PDA from project PDA\n */\nexport function getTokenMintPDA(projectPda: PublicKey, programId: PublicKey): PublicKey {\n const [pda] = PublicKey.findProgramAddressSync(\n [Buffer.from('token_mint'), projectPda.toBuffer()],\n programId\n );\n return pda;\n}\n\n/**\n * Derive Vault Authority PDA from project PDA\n */\nexport function getVaultAuthorityPDA(projectPda: PublicKey, programId: PublicKey): PublicKey {\n const [pda] = PublicKey.findProgramAddressSync(\n [Buffer.from('vault_authority'), projectPda.toBuffer()],\n programId\n );\n return pda;\n}\n\n/**\n * Derive Investor Vault PDA from project PDA\n */\nexport function getInvestorVaultPDA(projectPda: PublicKey, programId: PublicKey): PublicKey {\n const [pda] = PublicKey.findProgramAddressSync(\n [Buffer.from('investor_vault'), projectPda.toBuffer()],\n programId\n );\n return pda;\n}\n\n/**\n * Derive Founder Vault PDA from project PDA\n */\nexport function getFounderVaultPDA(projectPda: PublicKey, programId: PublicKey): PublicKey {\n const [pda] = PublicKey.findProgramAddressSync(\n [Buffer.from('founder_vault'), projectPda.toBuffer()],\n programId\n );\n return pda;\n}\n\n/**\n * Derive LP Token Vault PDA from project PDA\n */\nexport function getLpTokenVaultPDA(projectPda: PublicKey, programId: PublicKey): PublicKey {\n const [pda] = PublicKey.findProgramAddressSync(\n [Buffer.from('lp_token_vault'), projectPda.toBuffer()],\n programId\n );\n return pda;\n}\n\n/**\n * Derive Treasury Vault PDA from project PDA\n */\nexport function getTreasuryVaultPDA(projectPda: PublicKey, programId: PublicKey): PublicKey {\n const [pda] = PublicKey.findProgramAddressSync(\n [Buffer.from('treasury_vault'), projectPda.toBuffer()],\n programId\n );\n return pda;\n}\n\n/**\n * Derive LP USDC Vault PDA from project PDA\n */\nexport function getLpUsdcVaultPDA(projectPda: PublicKey, programId: PublicKey): PublicKey {\n const [pda] = PublicKey.findProgramAddressSync(\n [Buffer.from('lp_usdc_vault'), projectPda.toBuffer()],\n programId\n );\n return pda;\n}\n\n/**\n * Derive Founder Vesting PDA from project PDA\n */\nexport function getFounderVestingPDA(projectPda: PublicKey, programId: PublicKey): PublicKey {\n const [pda] = PublicKey.findProgramAddressSync(\n [Buffer.from('founder_vesting'), projectPda.toBuffer()],\n programId\n );\n return pda;\n}\n\n// =============================================================================\n// Dynamic Tokenomics PDAs\n// =============================================================================\n\n/**\n * Derive Allocation Proposal PDA\n *\n * @param projectPda - Project account PDA\n * @param proposalIndex - Proposal index (from tokenomics.proposal_count)\n * @param programId - Raise program ID\n * @returns Allocation proposal PDA\n */\nexport function getAllocationProposalPDA(\n projectPda: PublicKey,\n proposalIndex: number,\n programId: PublicKey\n): PublicKey {\n const [pda] = PublicKey.findProgramAddressSync(\n [\n Buffer.from('allocation_proposal'),\n projectPda.toBuffer(),\n Buffer.from([proposalIndex]),\n ],\n programId\n );\n return pda;\n}\n\n/**\n * Derive Allocation Vote PDA\n *\n * @param proposalPda - Allocation proposal PDA\n * @param nftMint - NFT mint used for voting\n * @param programId - Raise program ID\n * @returns Allocation vote PDA\n */\nexport function getAllocationVotePDA(\n proposalPda: PublicKey,\n nftMint: PublicKey,\n programId: PublicKey\n): PublicKey {\n const [pda] = PublicKey.findProgramAddressSync(\n [\n Buffer.from('allocation_vote'),\n proposalPda.toBuffer(),\n nftMint.toBuffer(),\n ],\n programId\n );\n return pda;\n}\n\n/**\n * Derive Sub-Allocation Vesting PDA\n *\n * @param projectPda - Project account PDA\n * @param subAllocationId - Sub-allocation ID (0-9)\n * @param programId - Raise program ID\n * @returns Sub-allocation vesting PDA\n */\nexport function getSubAllocationVestingPDA(\n projectPda: PublicKey,\n subAllocationId: number,\n programId: PublicKey\n): PublicKey {\n const [pda] = PublicKey.findProgramAddressSync(\n [\n Buffer.from('sub_allocation_vesting'),\n projectPda.toBuffer(),\n Buffer.from([subAllocationId]),\n ],\n programId\n );\n return pda;\n}\n\n// =============================================================================\n// Per-Milestone Vesting PDAs (add-per-milestone-vesting)\n// =============================================================================\n\n/**\n * Derive InvestorMilestoneVesting PDA\n * Tracks investor vesting for a specific milestone with configurable schedules\n *\n * @param projectPda - Project account PDA\n * @param milestoneIndex - Milestone index\n * @param investmentPda - Investment account PDA\n * @param programId - Raise program ID\n * @returns Investor milestone vesting PDA\n */\nexport function getInvestorMilestoneVestingPDA(\n projectPda: PublicKey,\n milestoneIndex: number,\n investmentPda: PublicKey,\n programId: PublicKey\n): PublicKey {\n const [pda] = PublicKey.findProgramAddressSync(\n [\n Buffer.from('investor_ms_vesting'),\n projectPda.toBuffer(),\n Buffer.from([milestoneIndex]),\n investmentPda.toBuffer(),\n ],\n programId\n );\n return pda;\n}\n\n/**\n * Derive FounderMilestoneVesting PDA\n * Tracks founder milestone-based vesting with configurable schedules\n *\n * @param projectPda - Project account PDA\n * @param milestoneIndex - Milestone index\n * @param programId - Raise program ID\n * @returns Founder milestone vesting PDA\n */\nexport function getFounderMilestoneVestingPDA(\n projectPda: PublicKey,\n milestoneIndex: number,\n programId: PublicKey\n): PublicKey {\n const [pda] = PublicKey.findProgramAddressSync(\n [\n Buffer.from('founder_ms_vesting'),\n projectPda.toBuffer(),\n Buffer.from([milestoneIndex]),\n ],\n programId\n );\n return pda;\n}\n\n// =============================================================================\n// Future Round Allocation PDAs (add-future-round-allocation)\n// =============================================================================\n\n/**\n * Derive FutureRoundTokenVault PDA - Token account holding reserved tokens\n *\n * @param projectPda - Project account PDA\n * @param programId - Raise program ID\n * @returns Future round token vault PDA\n */\nexport function getFutureRoundTokenVaultPDA(\n projectPda: PublicKey,\n programId: PublicKey\n): PublicKey {\n const [pda] = PublicKey.findProgramAddressSync(\n [Buffer.from(SEEDS.FUTURE_ROUND_VAULT), projectPda.toBuffer()],\n programId\n );\n return pda;\n}\n\n/**\n * Derive FutureRoundVault state PDA - Tracks future round token usage\n *\n * @param projectPda - Project account PDA\n * @param programId - Raise program ID\n * @returns Future round vault state PDA\n */\nexport function getFutureRoundVaultPDA(\n projectPda: PublicKey,\n programId: PublicKey\n): PublicKey {\n const [pda] = PublicKey.findProgramAddressSync(\n [Buffer.from(SEEDS.FUTURE_ROUND_STATE), projectPda.toBuffer()],\n programId\n );\n return pda;\n}\n\n// =============================================================================\n// Multi-Round Fundraising PDAs (add-second-round-fundraising)\n// =============================================================================\n\n/**\n * Derive FundingRound PDA\n * Each round (R2, R3, R4...) has its own FundingRound account\n *\n * @param projectPda - Project account PDA\n * @param roundNumber - Round number (2, 3, 4...)\n * @param programId - Raise program ID\n * @returns Funding round PDA\n */\nexport function getFundingRoundPDA(\n projectPda: PublicKey,\n roundNumber: number,\n programId: PublicKey\n): PublicKey {\n const [pda] = PublicKey.findProgramAddressSync(\n [\n Buffer.from(SEEDS.FUNDING_ROUND),\n projectPda.toBuffer(),\n Buffer.from([roundNumber]),\n ],\n programId\n );\n return pda;\n}\n\n/**\n * Derive Round Escrow PDA\n * Each round has its own USDC escrow account\n *\n * @param projectPda - Project account PDA\n * @param roundNumber - Round number (2, 3, 4...)\n * @param programId - Raise program ID\n * @returns Round escrow PDA\n */\nexport function getRoundEscrowPDA(\n projectPda: PublicKey,\n roundNumber: number,\n programId: PublicKey\n): PublicKey {\n const [pda] = PublicKey.findProgramAddressSync(\n [\n Buffer.from(SEEDS.ROUND_ESCROW),\n projectPda.toBuffer(),\n Buffer.from([roundNumber]),\n ],\n programId\n );\n return pda;\n}\n\n/**\n * Derive Round Milestone PDA\n * Each round has its own milestones (R2M1, R2M2, etc.)\n *\n * @param projectPda - Project account PDA\n * @param roundNumber - Round number (2, 3, 4...)\n * @param milestoneIndex - Milestone index (0-based)\n * @param programId - Raise program ID\n * @returns Round milestone PDA\n */\nexport function getRoundMilestonePDA(\n projectPda: PublicKey,\n roundNumber: number,\n milestoneIndex: number,\n programId: PublicKey\n): PublicKey {\n const [pda] = PublicKey.findProgramAddressSync(\n [\n Buffer.from(SEEDS.MILESTONE),\n projectPda.toBuffer(),\n Buffer.from([roundNumber]),\n Buffer.from([milestoneIndex]),\n ],\n programId\n );\n return pda;\n}\n\n/**\n * Derive Round NFT Mint PDA\n * NFT mints for R2+ investments include round_number in seeds\n *\n * @param projectId - Project identifier\n * @param roundNumber - Round number (2, 3, 4...)\n * @param investor - Investor's public key\n * @param investmentCount - Investment count\n * @param programId - Raise program ID\n * @returns Round NFT mint PDA and bump\n */\nexport function getRoundNftMintPDA(\n projectId: BN | number | string,\n roundNumber: number,\n investor: PublicKey,\n investmentCount: BN | number,\n programId: PublicKey\n): [PublicKey, number] {\n const projectIdBN = ensureBN(projectId);\n const countBN = ensureBN(investmentCount);\n return PublicKey.findProgramAddressSync(\n [\n Buffer.from(SEEDS.NFT_MINT),\n projectIdBN.toArrayLike(Buffer, 'le', 8),\n Buffer.from([roundNumber]),\n investor.toBuffer(),\n countBN.toArrayLike(Buffer, 'le', 8),\n ],\n programId\n );\n}\n\n/**\n * Derive Round Investment PDA\n * R2+ investments include round_number in seeds\n *\n * @param projectPda - Project account PDA\n * @param roundNumber - Round number (2, 3, 4...)\n * @param nftMint - Investment NFT mint address\n * @param programId - Raise program ID\n * @returns Round investment PDA\n */\nexport function getRoundInvestmentPDA(\n projectPda: PublicKey,\n roundNumber: number,\n nftMint: PublicKey,\n programId: PublicKey\n): PublicKey {\n const [pda] = PublicKey.findProgramAddressSync(\n [\n Buffer.from(SEEDS.INVESTMENT),\n projectPda.toBuffer(),\n Buffer.from([roundNumber]),\n nftMint.toBuffer(),\n ],\n programId\n );\n return pda;\n}\n\n/**\n * Derive Round Investor Milestone Vesting PDA\n * R2+ investor vesting includes round_number in seeds\n *\n * @param projectPda - Project account PDA\n * @param roundNumber - Round number (2, 3, 4...)\n * @param milestoneIndex - Milestone index\n * @param investmentPda - Investment account PDA\n * @param programId - Raise program ID\n * @returns Round investor milestone vesting PDA\n */\nexport function getRoundInvestorMilestoneVestingPDA(\n projectPda: PublicKey,\n roundNumber: number,\n milestoneIndex: number,\n investmentPda: PublicKey,\n programId: PublicKey\n): PublicKey {\n const [pda] = PublicKey.findProgramAddressSync(\n [\n Buffer.from(SEEDS.INVESTOR_MS_VESTING),\n projectPda.toBuffer(),\n Buffer.from([roundNumber]),\n Buffer.from([milestoneIndex]),\n investmentPda.toBuffer(),\n ],\n programId\n );\n return pda;\n}\n"]}
@@ -35,7 +35,16 @@ var PivotState = /* @__PURE__ */ ((PivotState2) => {
35
35
  PivotState2["Finalized"] = "finalized";
36
36
  return PivotState2;
37
37
  })(PivotState || {});
38
+ var FundingRoundState = /* @__PURE__ */ ((FundingRoundState2) => {
39
+ FundingRoundState2["Open"] = "open";
40
+ FundingRoundState2["Funded"] = "funded";
41
+ FundingRoundState2["InProgress"] = "inProgress";
42
+ FundingRoundState2["Completed"] = "completed";
43
+ FundingRoundState2["Failed"] = "failed";
44
+ return FundingRoundState2;
45
+ })(FundingRoundState || {});
38
46
 
47
+ exports.FundingRoundState = FundingRoundState;
39
48
  exports.MilestoneState = MilestoneState;
40
49
  exports.PivotState = PivotState;
41
50
  exports.ProjectState = ProjectState;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/types/index.ts"],"names":["ProjectState","MilestoneState","VoteChoice","PivotState"],"mappings":";;;AAaO,IAAK,YAAA,qBAAAA,aAAAA,KAAL;AACL,EAAAA,cAAA,OAAA,CAAA,GAAQ,OAAA;AACR,EAAAA,cAAA,iBAAA,CAAA,GAAkB,iBAAA;AAClB,EAAAA,cAAA,MAAA,CAAA,GAAO,MAAA;AACP,EAAAA,cAAA,QAAA,CAAA,GAAS,QAAA;AACT,EAAAA,cAAA,YAAA,CAAA,GAAa,YAAA;AACb,EAAAA,cAAA,WAAA,CAAA,GAAY,WAAA;AACZ,EAAAA,cAAA,WAAA,CAAA,GAAY,WAAA;AACZ,EAAAA,cAAA,QAAA,CAAA,GAAS,QAAA;AACT,EAAAA,cAAA,WAAA,CAAA,GAAY,WAAA;AACZ,EAAAA,cAAA,WAAA,CAAA,GAAY,WAAA;AAVF,EAAA,OAAAA,aAAAA;AAAA,CAAA,EAAA,YAAA,IAAA,EAAA;AAaL,IAAK,cAAA,qBAAAC,eAAAA,KAAL;AACL,EAAAA,gBAAA,UAAA,CAAA,GAAW,UAAA;AACX,EAAAA,gBAAA,UAAA,CAAA,GAAW,UAAA;AACX,EAAAA,gBAAA,YAAA,CAAA,GAAa,YAAA;AACb,EAAAA,gBAAA,aAAA,CAAA,GAAc,aAAA;AACd,EAAAA,gBAAA,QAAA,CAAA,GAAS,QAAA;AACT,EAAAA,gBAAA,QAAA,CAAA,GAAS,QAAA;AACT,EAAAA,gBAAA,UAAA,CAAA,GAAW,UAAA;AAPD,EAAA,OAAAA,eAAAA;AAAA,CAAA,EAAA,cAAA,IAAA,EAAA;AAUL,IAAK,UAAA,qBAAAC,WAAAA,KAAL;AACL,EAAAA,YAAA,MAAA,CAAA,GAAO,MAAA;AACP,EAAAA,YAAA,KAAA,CAAA,GAAM,KAAA;AAFI,EAAA,OAAAA,WAAAA;AAAA,CAAA,EAAA,UAAA,IAAA,EAAA;AAKL,IAAK,UAAA,qBAAAC,WAAAA,KAAL;AACL,EAAAA,YAAA,0BAAA,CAAA,GAA2B,0BAAA;AAC3B,EAAAA,YAAA,gCAAA,CAAA,GAAiC,gCAAA;AACjC,EAAAA,YAAA,WAAA,CAAA,GAAY,WAAA;AAHF,EAAA,OAAAA,WAAAA;AAAA,CAAA,EAAA,UAAA,IAAA,EAAA","file":"index.cjs","sourcesContent":["/**\n * Raise Type Definitions\n *\n * Re-exports types from the IDL and provides additional utility types.\n */\n\nimport { PublicKey } from '@solana/web3.js';\nimport { BN } from '@coral-xyz/anchor';\n\n// =============================================================================\n// Project State Enums\n// =============================================================================\n\nexport enum ProjectState {\n Draft = 'draft',\n PendingApproval = 'pendingApproval',\n Open = 'open',\n Funded = 'funded',\n InProgress = 'inProgress',\n Completed = 'completed',\n Abandoned = 'abandoned',\n Failed = 'failed',\n TGEFailed = 'tgeFailed',\n Cancelled = 'cancelled',\n}\n\nexport enum MilestoneState {\n Proposed = 'proposed',\n Approved = 'approved',\n InProgress = 'inProgress',\n UnderReview = 'underReview',\n Passed = 'passed',\n Failed = 'failed',\n Unlocked = 'unlocked',\n}\n\nexport enum VoteChoice {\n Good = 'good',\n Bad = 'bad',\n}\n\nexport enum PivotState {\n PendingModeratorApproval = 'pendingModeratorApproval',\n ApprovedAwaitingInvestorWindow = 'approvedAwaitingInvestorWindow',\n Finalized = 'finalized',\n}\n\n// =============================================================================\n// Account Types\n// =============================================================================\n\n/**\n * Tier configuration stored on-chain (includes filled_lots)\n */\nexport interface Tier {\n /** USDC amount per lot */\n amount: BN;\n /** Maximum lots available */\n maxLots: number;\n /** Currently filled lots */\n filledLots: number;\n /** Token allocation per $1 invested */\n tokenRatio: BN;\n /** Vote weight multiplier (basis points, 100 = 1.0x) */\n voteMultiplier: number;\n}\n\n/**\n * Tier configuration input for project initialization\n * Founders pass these when creating a project\n */\nexport interface TierConfig {\n /** USDC amount per lot (must be >= 10 USDC = 10_000_000 lamports) */\n amount: BN;\n /** Maximum lots available (must be >= 1) */\n maxLots: number;\n /** Token allocation per $1 invested (must be >= 1) */\n tokenRatio: BN;\n /** Vote weight multiplier (basis points, must be >= 100 = 1.0x) */\n voteMultiplier: number;\n}\n\nexport interface ProjectAccount {\n founder: PublicKey;\n projectId: BN;\n fundingGoal: BN;\n amountRaised: BN;\n state: ProjectState;\n metadataUri: string;\n escrow: PublicKey;\n currentMilestone: number;\n totalMilestones: number;\n /** Number of active tiers (1-10) */\n tierCount: number;\n /** All tier slots (only first tierCount are active) */\n tiers: Tier[];\n tokenMint: PublicKey | null;\n tgeDate: BN | null;\n tokensDeposited: BN;\n tokenAllocationBps: number;\n totalTokenAllocation: BN;\n consecutiveFailures: number;\n investorCount: number;\n bump: number;\n}\n\nexport interface MilestoneAccount {\n project: PublicKey;\n milestoneIndex: number;\n percentage: number;\n description: string;\n state: MilestoneState;\n yesVotes: BN;\n noVotes: BN;\n totalWeight: BN;\n voterCount: number;\n votingEndsAt: BN | null;\n bump: number;\n}\n\nexport interface InvestmentAccount {\n project: PublicKey;\n investor: PublicKey;\n nftMint: PublicKey;\n amount: BN;\n voteWeight: BN;\n tokenAllocation: BN;\n tier: number;\n investedAt: BN;\n tokensClaimed: boolean;\n withdrawnFromPivot: boolean;\n refundClaimed: boolean;\n bump: number;\n}\n\nexport interface VoteAccount {\n milestone: PublicKey;\n voter: PublicKey;\n choice: VoteChoice;\n weight: BN;\n votedAt: BN;\n bump: number;\n}\n\nexport interface AdminConfigAccount {\n admin: PublicKey;\n pendingAdmin: PublicKey | null;\n bump: number;\n}\n\nexport interface PivotProposalAccount {\n project: PublicKey;\n newMetadataUri: string;\n newMilestones: Array<{ percentage: number; description: string }>;\n state: PivotState;\n proposedAt: BN;\n approvedAt: BN | null;\n withdrawalWindowEndsAt: BN | null;\n withdrawnAmount: BN;\n withdrawnCount: number;\n bump: number;\n}\n\nexport interface TgeEscrowAccount {\n project: PublicKey;\n holdbackAmount: BN;\n scamReports: BN;\n scamWeight: BN;\n scamConfirmed: boolean;\n holdbackReleased: boolean;\n bump: number;\n}\n\n// =============================================================================\n// Instruction Arguments\n// =============================================================================\n\nexport interface InitializeProjectArgs {\n projectId: BN;\n fundingGoal: BN;\n metadataUri: string;\n /** Founder-configured tiers (1-10 tiers) */\n tiers: TierConfig[];\n}\n\nexport interface CreateMilestoneArgs {\n milestoneIndex: number;\n percentage: number;\n description: string;\n}\n\nexport interface InvestArgs {\n amount: BN;\n}\n\nexport interface VoteOnMilestoneArgs {\n choice: VoteChoice;\n}\n\nexport interface SetTgeDateArgs {\n tgeDate: BN;\n tokenMint: PublicKey;\n}\n\nexport interface DepositTokensArgs {\n amount: BN;\n}\n\nexport interface ProposePivotArgs {\n newMetadataUri: string;\n newMilestones: Array<{ percentage: number; description: string }>;\n}\n\n// =============================================================================\n// Event Types\n// =============================================================================\n\nexport interface ProjectCreatedEvent {\n projectId: BN;\n founder: PublicKey;\n fundingGoal: BN;\n metadataUri: string;\n}\n\nexport interface InvestmentMadeEvent {\n projectId: BN;\n investor: PublicKey;\n amount: BN;\n nftMint: PublicKey;\n tier: number;\n voteWeight: BN;\n}\n\nexport interface MilestoneVoteCastEvent {\n projectId: BN;\n milestoneIndex: number;\n voter: PublicKey;\n choice: VoteChoice;\n weight: BN;\n}\n\nexport interface MilestoneVoteFinalizedEvent {\n projectId: BN;\n milestoneIndex: number;\n passed: boolean;\n yesVotes: BN;\n noVotes: BN;\n}\n\n// =============================================================================\n// Utility Types\n// =============================================================================\n\nexport interface InvestmentWithKey {\n publicKey: PublicKey;\n account: InvestmentAccount;\n}\n\nexport interface MilestoneWithKey {\n publicKey: PublicKey;\n account: MilestoneAccount;\n}\n\nexport interface VoteWithKey {\n publicKey: PublicKey;\n account: VoteAccount;\n}\n"]}
1
+ {"version":3,"sources":["../../src/types/index.ts"],"names":["ProjectState","MilestoneState","VoteChoice","PivotState","FundingRoundState"],"mappings":";;;AAaO,IAAK,YAAA,qBAAAA,aAAAA,KAAL;AACL,EAAAA,cAAA,OAAA,CAAA,GAAQ,OAAA;AACR,EAAAA,cAAA,iBAAA,CAAA,GAAkB,iBAAA;AAClB,EAAAA,cAAA,MAAA,CAAA,GAAO,MAAA;AACP,EAAAA,cAAA,QAAA,CAAA,GAAS,QAAA;AACT,EAAAA,cAAA,YAAA,CAAA,GAAa,YAAA;AACb,EAAAA,cAAA,WAAA,CAAA,GAAY,WAAA;AACZ,EAAAA,cAAA,WAAA,CAAA,GAAY,WAAA;AACZ,EAAAA,cAAA,QAAA,CAAA,GAAS,QAAA;AACT,EAAAA,cAAA,WAAA,CAAA,GAAY,WAAA;AACZ,EAAAA,cAAA,WAAA,CAAA,GAAY,WAAA;AAVF,EAAA,OAAAA,aAAAA;AAAA,CAAA,EAAA,YAAA,IAAA,EAAA;AAaL,IAAK,cAAA,qBAAAC,eAAAA,KAAL;AACL,EAAAA,gBAAA,UAAA,CAAA,GAAW,UAAA;AACX,EAAAA,gBAAA,UAAA,CAAA,GAAW,UAAA;AACX,EAAAA,gBAAA,YAAA,CAAA,GAAa,YAAA;AACb,EAAAA,gBAAA,aAAA,CAAA,GAAc,aAAA;AACd,EAAAA,gBAAA,QAAA,CAAA,GAAS,QAAA;AACT,EAAAA,gBAAA,QAAA,CAAA,GAAS,QAAA;AACT,EAAAA,gBAAA,UAAA,CAAA,GAAW,UAAA;AAPD,EAAA,OAAAA,eAAAA;AAAA,CAAA,EAAA,cAAA,IAAA,EAAA;AAUL,IAAK,UAAA,qBAAAC,WAAAA,KAAL;AACL,EAAAA,YAAA,MAAA,CAAA,GAAO,MAAA;AACP,EAAAA,YAAA,KAAA,CAAA,GAAM,KAAA;AAFI,EAAA,OAAAA,WAAAA;AAAA,CAAA,EAAA,UAAA,IAAA,EAAA;AAKL,IAAK,UAAA,qBAAAC,WAAAA,KAAL;AACL,EAAAA,YAAA,0BAAA,CAAA,GAA2B,0BAAA;AAC3B,EAAAA,YAAA,gCAAA,CAAA,GAAiC,gCAAA;AACjC,EAAAA,YAAA,WAAA,CAAA,GAAY,WAAA;AAHF,EAAA,OAAAA,WAAAA;AAAA,CAAA,EAAA,UAAA,IAAA,EAAA;AAotBL,IAAK,iBAAA,qBAAAC,kBAAAA,KAAL;AACL,EAAAA,mBAAA,MAAA,CAAA,GAAO,MAAA;AACP,EAAAA,mBAAA,QAAA,CAAA,GAAS,QAAA;AACT,EAAAA,mBAAA,YAAA,CAAA,GAAa,YAAA;AACb,EAAAA,mBAAA,WAAA,CAAA,GAAY,WAAA;AACZ,EAAAA,mBAAA,QAAA,CAAA,GAAS,QAAA;AALC,EAAA,OAAAA,kBAAAA;AAAA,CAAA,EAAA,iBAAA,IAAA,EAAA","file":"index.cjs","sourcesContent":["/**\n * Raise Type Definitions\n *\n * Re-exports types from the IDL and provides additional utility types.\n */\n\nimport { PublicKey } from '@solana/web3.js';\nimport { BN } from '@coral-xyz/anchor';\n\n// =============================================================================\n// Project State Enums\n// =============================================================================\n\nexport enum ProjectState {\n Draft = 'draft',\n PendingApproval = 'pendingApproval',\n Open = 'open',\n Funded = 'funded',\n InProgress = 'inProgress',\n Completed = 'completed',\n Abandoned = 'abandoned',\n Failed = 'failed',\n TGEFailed = 'tgeFailed',\n Cancelled = 'cancelled',\n}\n\nexport enum MilestoneState {\n Proposed = 'proposed',\n Approved = 'approved',\n InProgress = 'inProgress',\n UnderReview = 'underReview',\n Passed = 'passed',\n Failed = 'failed',\n Unlocked = 'unlocked',\n}\n\nexport enum VoteChoice {\n Good = 'good',\n Bad = 'bad',\n}\n\nexport enum PivotState {\n PendingModeratorApproval = 'pendingModeratorApproval',\n ApprovedAwaitingInvestorWindow = 'approvedAwaitingInvestorWindow',\n Finalized = 'finalized',\n}\n\n// =============================================================================\n// Account Types\n// =============================================================================\n\n/**\n * Tier configuration stored on-chain (includes filled_lots)\n */\nexport interface Tier {\n /** USDC amount per lot */\n amount: BN;\n /** Maximum lots available */\n maxLots: number;\n /** Currently filled lots */\n filledLots: number;\n /** Token allocation per $1 invested */\n tokenRatio: BN;\n /** Vote weight multiplier (basis points, 100 = 1.0x) */\n voteMultiplier: number;\n}\n\n/**\n * Tier configuration input for project initialization\n * Founders pass these when creating a project\n * Note: voteMultiplier is auto-calculated on-chain using logarithmic formula\n */\nexport interface TierConfig {\n /** USDC amount per lot (must be >= 10 USDC = 10_000_000 lamports) */\n amount: BN;\n /** Maximum lots available (must be >= 1) */\n maxLots: number;\n /** Token allocation per $1 invested (must be >= 1) */\n tokenRatio: BN;\n}\n\nexport interface ProjectAccount {\n founder: PublicKey;\n projectId: BN;\n fundingGoal: BN;\n amountRaised: BN;\n state: ProjectState;\n metadataUri: string;\n escrow: PublicKey;\n currentMilestone: number;\n totalMilestones: number;\n /** Number of active tiers (1-10) */\n tierCount: number;\n /** All tier slots (only first tierCount are active) */\n tiers: Tier[];\n tokenMint: PublicKey | null;\n tgeDate: BN | null;\n tokensDeposited: BN;\n tokenAllocationBps: number;\n totalTokenAllocation: BN;\n consecutiveFailures: number;\n investorCount: number;\n /** Milestone Price Increases: BPS multipliers per milestone (10000 = 1.0x)\n * NOTE: If priceMultipliers[0] === 0, project uses dynamic mode (ZEMYTH formula)\n * Otherwise uses static mode (legacy pre-configured multipliers) */\n priceMultipliers: number[];\n /** Milestone Price Increases: Number of milestones that have passed */\n milestonesPassed: number;\n /** Dynamic Price Multiplier: Current calculated multiplier in BPS (10000 = 1.0x)\n * Used when priceMultipliers[0] === 0 (dynamic mode) */\n currentPriceMultiplierBps: number;\n // === Linear Progressive Pricing Fields (add-linear-progressive-pricing) ===\n /** Base multiplier at start of current milestone period (BPS) */\n milestoneBaseMultiplierBps: number;\n /** Timestamp when current milestone period started (0 = legacy mode) */\n milestonePeriodStartedAt: BN;\n /** Expected deadline for current milestone period */\n expectedMilestoneDeadlineTs: BN;\n /** Time-based allocation for current period (50% of ZEMYTH increment) */\n timeAllocationBps: number;\n /** Milestone-based allocation (50% of ZEMYTH increment) */\n milestoneAllocationBps: number;\n bump: number;\n}\n\nexport interface MilestoneAccount {\n project: PublicKey;\n milestoneIndex: number;\n percentage: number;\n description: string;\n state: MilestoneState;\n yesVotes: BN;\n noVotes: BN;\n totalWeight: BN;\n voterCount: number;\n votingEndsAt: BN | null;\n bump: number;\n}\n\nexport interface InvestmentAccount {\n project: PublicKey;\n investor: PublicKey;\n nftMint: PublicKey;\n amount: BN;\n voteWeight: BN;\n tokenAllocation: BN;\n tier: number;\n investedAt: BN;\n tokensClaimed: boolean;\n withdrawnFromPivot: boolean;\n refundClaimed: boolean;\n /** Early Token Release: Whether 5% early tokens have been claimed */\n earlyTokensClaimed: boolean;\n /** Early Token Release: Amount of early tokens claimed (for burn-for-refund tracking) */\n earlyTokensAmount: BN;\n /** Preserve Pivot Vesting Rights: Milestone index at which vesting was frozen (on refund) */\n vestingFrozenAtMilestone: number | null;\n bump: number;\n}\n\nexport interface VoteAccount {\n milestone: PublicKey;\n voter: PublicKey;\n choice: VoteChoice;\n weight: BN;\n votedAt: BN;\n bump: number;\n}\n\nexport interface AdminConfigAccount {\n admin: PublicKey;\n pendingAdmin: PublicKey | null;\n /** Zemyth treasury wallet for platform token allocations */\n zemythTreasury: PublicKey | null;\n bump: number;\n}\n\nexport interface PivotProposalAccount {\n project: PublicKey;\n newMetadataUri: string;\n newMilestones: Array<{ percentage: number; description: string }>;\n state: PivotState;\n proposedAt: BN;\n approvedAt: BN | null;\n withdrawalWindowEndsAt: BN | null;\n withdrawnAmount: BN;\n withdrawnCount: number;\n bump: number;\n}\n\nexport interface TgeEscrowAccount {\n project: PublicKey;\n holdbackAmount: BN;\n scamReports: BN;\n scamWeight: BN;\n scamConfirmed: boolean;\n holdbackReleased: boolean;\n bump: number;\n}\n\n// =============================================================================\n// Instruction Arguments\n// =============================================================================\n\nexport interface InitializeProjectArgs {\n projectId: BN;\n fundingGoal: BN;\n metadataUri: string;\n /** Founder-configured tiers (1-10 tiers) */\n tiers: TierConfig[];\n}\n\nexport interface CreateMilestoneArgs {\n milestoneIndex: number;\n percentage: number;\n description: string;\n}\n\nexport interface InvestArgs {\n amount: BN;\n}\n\nexport interface VoteOnMilestoneArgs {\n choice: VoteChoice;\n}\n\nexport interface SetTgeDateArgs {\n tgeDate: BN;\n tokenMint: PublicKey;\n}\n\nexport interface DepositTokensArgs {\n amount: BN;\n}\n\nexport interface ProposePivotArgs {\n newMetadataUri: string;\n newMilestones: Array<{ percentage: number; description: string }>;\n}\n\n// =============================================================================\n// Event Types\n// =============================================================================\n\nexport interface ProjectCreatedEvent {\n projectId: BN;\n founder: PublicKey;\n fundingGoal: BN;\n metadataUri: string;\n}\n\nexport interface InvestmentMadeEvent {\n projectId: BN;\n investor: PublicKey;\n amount: BN;\n nftMint: PublicKey;\n tier: number;\n voteWeight: BN;\n /** Milestone Price Increases: Effective tier price with multiplier applied */\n effectivePrice: BN;\n /** Milestone Price Increases: Current price multiplier in BPS (10000 = 1.0x) */\n multiplierBps: number;\n}\n\nexport interface MilestoneVoteCastEvent {\n projectId: BN;\n milestoneIndex: number;\n voter: PublicKey;\n choice: VoteChoice;\n weight: BN;\n}\n\nexport interface MilestoneVoteFinalizedEvent {\n projectId: BN;\n milestoneIndex: number;\n passed: boolean;\n yesVotes: BN;\n noVotes: BN;\n}\n\n// =============================================================================\n// Utility Types\n// =============================================================================\n\nexport interface InvestmentWithKey {\n publicKey: PublicKey;\n account: InvestmentAccount;\n}\n\nexport interface MilestoneWithKey {\n publicKey: PublicKey;\n account: MilestoneAccount;\n}\n\nexport interface VoteWithKey {\n publicKey: PublicKey;\n account: VoteAccount;\n}\n\n// =============================================================================\n// Dynamic Tokenomics Types\n// =============================================================================\n\n/**\n * Sub-allocation within a project's founder allocation pool\n * Sub-allocations are founder team tokens (advisors, marketing, etc.)\n */\nexport interface SubAllocation {\n /** Unique ID within project (0-9, max 10 sub-allocations) */\n id: number;\n /** Name of the allocation (UTF-8, e.g., \"advisors\", \"marketing\") */\n name: string;\n /** Basis points from founder allocation pool (e.g., 500 = 5% of total supply) */\n bps: number;\n /** Token destination wallet */\n recipient: PublicKey;\n /** Vesting duration in months (0 = immediate, >0 = linear vesting) */\n vestingMonths: number;\n /** Cliff period in months before vesting starts */\n cliffMonths: number;\n /** Timestamp when sub-allocation was created */\n createdAt: BN;\n /** True if this was added via governance vote (post-Open state) */\n approvedViaGovernance: boolean;\n}\n\n/**\n * Allocation proposal for governance voting\n */\nexport interface AllocationProposalAccount {\n /** Parent project */\n project: PublicKey;\n /** Proposer (must be founder) */\n proposer: PublicKey;\n /** The proposed sub-allocation */\n subAllocation: SubAllocation;\n /** Total vote weight in favor */\n votesFor: BN;\n /** Total vote weight against */\n votesAgainst: BN;\n /** Timestamp when voting ends (7 days from creation) */\n votingEndsAt: BN;\n /** Whether the proposal has been executed */\n executed: boolean;\n /** Proposal index (for unique PDA derivation) */\n proposalIndex: number;\n /** PDA bump seed */\n bump: number;\n}\n\n/**\n * Vote record for an allocation proposal\n */\nexport interface AllocationVoteAccount {\n /** The proposal being voted on */\n proposal: PublicKey;\n /** The investment NFT used to vote */\n nftMint: PublicKey;\n /** Voter's wallet */\n voter: PublicKey;\n /** Vote weight */\n voteWeight: BN;\n /** True = for, False = against */\n voteFor: boolean;\n /** Timestamp of vote */\n votedAt: BN;\n /** PDA bump seed */\n bump: number;\n}\n\n/**\n * Extended Tokenomics account with dynamic allocation fields\n */\nexport interface TokenomicsAccount {\n /** Parent project */\n project: PublicKey;\n /** Token symbol (2-8 chars uppercase) */\n tokenSymbol: string;\n /** Token decimals (default: 9) */\n tokenDecimals: number;\n /** Total token supply */\n totalSupply: BN;\n /** Investor allocation in basis points */\n investorAllocationBps: number;\n /** LP token allocation in basis points */\n lpTokenAllocationBps: number;\n /** LP USDC allocation in basis points */\n lpUsdcAllocationBps: number;\n /** Founder allocation in basis points (includes sub-allocations for team) */\n founderAllocationBps: number;\n /** Zemyth platform allocation in basis points (minimum 1%, vests per milestone) */\n zemythAllocationBps: number;\n /** Number of active sub-allocations (draw from founder allocation) */\n subAllocationCount: number;\n /** Sub-allocations from founder pool (advisors, marketing, etc.) */\n subAllocations: SubAllocation[];\n /** Number of allocation proposals created */\n proposalCount: number;\n /** Founder wallet for vesting */\n founderWallet: PublicKey | null;\n /** Vesting duration in months */\n vestingDurationMonths: number;\n /** Cliff period in months */\n cliffMonths: number;\n /** Early Token Release: Founder milestone-based vesting BPS (e.g., 4750 = 47.5% of founder allocation) */\n founderMilestoneVestingBps: number;\n /** Early Token Release: Founder time-based vesting BPS (e.g., 4750 = 47.5% of founder allocation) */\n founderTimeVestingBps: number;\n /** Future round allocation in basis points (0 or >= 1000, reserved for second-round fundraising) */\n futureRoundAllocationBps: number;\n /** PDA bump seed */\n bump: number;\n}\n\n// =============================================================================\n// Dynamic Tokenomics Instruction Arguments\n// =============================================================================\n\nexport interface AddSubAllocationArgs {\n /** Name of the sub-allocation (e.g., \"advisors\", \"marketing\") */\n name: string;\n /** Basis points from founder allocation pool */\n bps: number;\n /** Token destination wallet */\n recipient: PublicKey;\n /** Vesting duration in months (0 = immediate) */\n vestingMonths: number;\n /** Cliff period in months */\n cliffMonths: number;\n}\n\nexport interface ProposeAllocationChangeArgs {\n /** Name of the sub-allocation */\n name: string;\n /** Basis points from founder allocation pool */\n bps: number;\n /** Token destination wallet */\n recipient: PublicKey;\n /** Vesting duration in months */\n vestingMonths: number;\n /** Cliff period in months */\n cliffMonths: number;\n}\n\nexport interface VoteAllocationChangeArgs {\n /** True = vote for, False = vote against */\n voteFor: boolean;\n}\n\n// =============================================================================\n// Dynamic Tokenomics Events\n// =============================================================================\n\nexport interface SubAllocationAddedEvent {\n projectId: BN;\n projectKey: PublicKey;\n subAllocationId: number;\n name: string;\n bps: number;\n recipient: PublicKey;\n vestingMonths: number;\n cliffMonths: number;\n timestamp: BN;\n}\n\nexport interface AllocationProposalCreatedEvent {\n projectId: BN;\n projectKey: PublicKey;\n proposalKey: PublicKey;\n name: string;\n bps: number;\n recipient: PublicKey;\n votingEndsAt: BN;\n timestamp: BN;\n}\n\nexport interface AllocationVoteCastEvent {\n projectId: BN;\n projectKey: PublicKey;\n proposalKey: PublicKey;\n voter: PublicKey;\n nftMint: PublicKey;\n voteWeight: BN;\n voteFor: boolean;\n timestamp: BN;\n}\n\nexport interface AllocationChangeExecutedEvent {\n projectId: BN;\n projectKey: PublicKey;\n proposalKey: PublicKey;\n subAllocationId: number;\n votesFor: BN;\n votesAgainst: BN;\n timestamp: BN;\n}\n\n// =============================================================================\n// Dynamic Tokenomics Utility Types\n// =============================================================================\n\nexport interface AllocationProposalWithKey {\n publicKey: PublicKey;\n account: AllocationProposalAccount;\n}\n\nexport interface AllocationVoteWithKey {\n publicKey: PublicKey;\n account: AllocationVoteAccount;\n}\n\n// =============================================================================\n// Sub-Allocation Vesting Types\n// =============================================================================\n\n/**\n * Sub-allocation vesting account for tracking vesting schedules\n * Similar to FounderVesting but for sub-allocations (treasury, advisors, etc.)\n */\nexport interface SubAllocationVestingAccount {\n /** Parent project */\n project: PublicKey;\n /** Sub-allocation ID (0-9) */\n subAllocationId: number;\n /** Recipient wallet (only this wallet can claim) */\n recipientWallet: PublicKey;\n /** Total token amount for this sub-allocation */\n totalAmount: BN;\n /** Timestamp when vesting starts (MAE completion) */\n startTimestamp: BN;\n /** Timestamp when cliff ends */\n cliffEnd: BN;\n /** Timestamp when vesting fully ends */\n vestingEnd: BN;\n /** Amount already claimed */\n claimedAmount: BN;\n /** Pending wallet update (for wallet migration) */\n pendingWallet: PublicKey | null;\n /** Timestamp when wallet update was initiated */\n walletUpdateTimestamp: BN | null;\n /** PDA bump seed */\n bump: number;\n}\n\nexport interface SubAllocationVestingWithKey {\n publicKey: PublicKey;\n account: SubAllocationVestingAccount;\n}\n\n/**\n * Arguments for claiming sub-allocation tokens\n */\nexport interface ClaimSubAllocationTokensArgs {\n /** Sub-allocation ID to claim from (0-9) */\n subAllocationId: number;\n}\n\n// =============================================================================\n// Sub-Allocation Vesting Events\n// =============================================================================\n\nexport interface SubAllocationVestingInitializedEvent {\n projectId: BN;\n projectKey: PublicKey;\n subAllocationId: number;\n recipientWallet: PublicKey;\n totalAmount: BN;\n cliffMonths: number;\n vestingMonths: number;\n startTimestamp: BN;\n timestamp: BN;\n}\n\nexport interface SubAllocationTokensClaimedEvent {\n projectId: BN;\n projectKey: PublicKey;\n subAllocationId: number;\n recipient: PublicKey;\n amountClaimed: BN;\n totalClaimed: BN;\n remaining: BN;\n vestingProgressPercent: number;\n timestamp: BN;\n}\n\n// =============================================================================\n// Early Token Release Types\n// =============================================================================\n\n/**\n * Arguments for claim_investor_tokens instruction\n */\nexport interface ClaimInvestorTokensArgs {\n /** Milestone index to claim tokens from */\n milestoneIndex: number;\n}\n\n/**\n * Arguments for claim_founder_milestone_tokens instruction\n */\nexport interface ClaimFounderMilestoneTokensArgs {\n /** Milestone index to claim tokens from */\n milestoneIndex: number;\n}\n\n// =============================================================================\n// Early Token Release Events\n// =============================================================================\n\nexport interface EarlyTokensClaimedEvent {\n projectId: BN;\n projectKey: PublicKey;\n investor: PublicKey;\n nftMint: PublicKey;\n amount: BN;\n timestamp: BN;\n}\n\nexport interface FounderEarlyTokensClaimedEvent {\n projectId: BN;\n projectKey: PublicKey;\n founder: PublicKey;\n amount: BN;\n timestamp: BN;\n}\n\nexport interface FounderMilestoneTokensClaimedEvent {\n projectId: BN;\n projectKey: PublicKey;\n founder: PublicKey;\n milestoneIndex: number;\n amount: BN;\n cumulativeClaimed: BN;\n timestamp: BN;\n}\n\nexport interface TokensBurnedForRefundEvent {\n projectId: BN;\n projectKey: PublicKey;\n investor: PublicKey;\n nftMint: PublicKey;\n amountBurned: BN;\n timestamp: BN;\n}\n\n// =============================================================================\n// Milestone Price Increase Events\n// =============================================================================\n\nexport interface PriceMultiplierActivatedEvent {\n projectId: BN;\n projectKey: PublicKey;\n milestoneIndex: number;\n newMultiplierBps: number;\n timestamp: BN;\n}\n\n// =============================================================================\n// Dynamic Price Multiplier Events (refactor-dynamic-price-multiplier)\n// =============================================================================\n\n/** Emitted when claim_milestone_funds dynamically calculates and updates the price multiplier */\nexport interface PriceMultiplierUpdatedEvent {\n projectId: BN;\n projectKey: PublicKey;\n /** Index of the milestone just claimed */\n milestoneIndex: number;\n /** Number of milestones remaining after this claim */\n remainingMilestones: number;\n /** Days until the next milestone deadline */\n daysToDeadline: BN;\n /** New price multiplier in BPS (10000 = 1.0x) */\n newMultiplierBps: number;\n /** Previous price multiplier in BPS */\n previousMultiplierBps: number;\n timestamp: BN;\n}\n\n// =============================================================================\n// Zemyth Platform Allocation Types (refactor-sub-allocation-to-founder)\n// =============================================================================\n\n/**\n * Zemyth vesting account for platform token allocation\n * Created at project approval, tokens vest proportionally per milestone\n */\nexport interface ZemythVestingAccount {\n /** Parent project */\n project: PublicKey;\n /** Total Zemyth token allocation */\n totalTokens: BN;\n /** Tokens already claimed by Zemyth treasury */\n claimedTokens: BN;\n /** Number of milestones claimed for (0 to milestone_count) */\n milestonesClaimed: number;\n /** Destination treasury wallet for claims */\n treasuryWallet: PublicKey;\n /** Account creation timestamp */\n createdAt: BN;\n /** PDA bump seed */\n bump: number;\n}\n\nexport interface ZemythVestingWithKey {\n publicKey: PublicKey;\n account: ZemythVestingAccount;\n}\n\n// =============================================================================\n// Zemyth Platform Allocation Events (refactor-sub-allocation-to-founder)\n// =============================================================================\n\n/** Emitted when ZemythVesting account is created at project approval */\nexport interface ZemythVestingCreatedEvent {\n projectId: BN;\n projectKey: PublicKey;\n totalTokens: BN;\n treasuryWallet: PublicKey;\n timestamp: BN;\n}\n\n/** Emitted when Zemyth claims tokens for passed milestones */\nexport interface ZemythTokensClaimedEvent {\n projectId: BN;\n projectKey: PublicKey;\n amountClaimed: BN;\n totalClaimed: BN;\n milestonesClaimed: number;\n treasuryWallet: PublicKey;\n timestamp: BN;\n}\n\n// =============================================================================\n// Future Round Allocation Types (add-future-round-allocation)\n// =============================================================================\n\n/**\n * FutureRoundVault account for tracking reserved tokens for future fundraising\n * Created at project approval if future_round_allocation_bps > 0\n */\nexport interface FutureRoundVaultAccount {\n /** Parent project */\n project: PublicKey;\n /** Token mint for the project */\n tokenMint: PublicKey;\n /** Total tokens reserved for future rounds */\n totalAmount: BN;\n /** Tokens already used in subsequent rounds */\n usedAmount: BN;\n /** PDA bump seed */\n bump: number;\n}\n\nexport interface FutureRoundVaultWithKey {\n publicKey: PublicKey;\n account: FutureRoundVaultAccount;\n}\n\n// =============================================================================\n// Multi-Round Fundraising Types (add-second-round-fundraising)\n// =============================================================================\n\n/**\n * FundingRound state enum\n */\nexport enum FundingRoundState {\n Open = 'open',\n Funded = 'funded',\n InProgress = 'inProgress',\n Completed = 'completed',\n Failed = 'failed',\n}\n\n/**\n * Milestone configuration input for funding rounds\n */\nexport interface RoundMilestoneConfig {\n /** Percentage of round funds for this milestone */\n percentage: number;\n /** Milestone description */\n description: string;\n /** Instant release percentage in basis points (e.g., 1000 = 10%) */\n instantReleaseBps: number;\n /** Cliff period in months */\n cliffMonths: number;\n /** Vesting duration in months */\n vestingDurationMonths: number;\n}\n\n/**\n * FundingRound account for R2, R3, R4... rounds\n */\nexport interface FundingRoundAccount {\n /** Parent project */\n project: PublicKey;\n /** Round number (2, 3, 4...) */\n roundNumber: number;\n /** Funding goal for this round */\n fundingGoal: BN;\n /** Amount raised in this round */\n amountRaised: BN;\n /** Round state */\n state: FundingRoundState;\n /** Number of investors in this round */\n investorCount: number;\n /** Allocation from future round pool (basis points) */\n roundAllocationBps: number;\n /** Number of tiers */\n tierCount: number;\n /** Tier configurations */\n tiers: Tier[];\n /** Number of milestones */\n milestoneCount: number;\n /** Current milestone index */\n currentMilestone: number;\n /** Consecutive milestone failures */\n consecutiveFailures: number;\n /** Round creation timestamp */\n createdAt: BN;\n /** PDA bump seed */\n bump: number;\n}\n\nexport interface FundingRoundWithKey {\n publicKey: PublicKey;\n account: FundingRoundAccount;\n}\n\n// =============================================================================\n// Multi-Round Fundraising Instruction Arguments\n// =============================================================================\n\n/**\n * Arguments for open_funding_round instruction\n */\nexport interface OpenFundingRoundArgs {\n /** Allocation from future round pool in basis points */\n roundAllocationBps: number;\n /** Funding goal for this round */\n fundingGoal: BN;\n /** Tier configurations (token_ratio must be <= R1's best tier) */\n tiers: TierConfig[];\n /** Milestone configurations for this round */\n milestones: RoundMilestoneConfig[];\n}\n\n/**\n * Arguments for invest_in_round instruction\n */\nexport interface InvestInRoundArgs {\n /** Round number to invest in */\n roundNumber: number;\n /** Investment amount in USDC lamports */\n amount: BN;\n}\n\n/**\n * Arguments for vote_on_round_milestone instruction\n */\nexport interface VoteOnRoundMilestoneArgs {\n /** Round number */\n roundNumber: number;\n /** Milestone index */\n milestoneIndex: number;\n /** Vote choice */\n choice: VoteChoice;\n}\n\n/**\n * Arguments for claim_round_instant_tokens instruction\n */\nexport interface ClaimRoundInstantTokensArgs {\n /** Milestone index */\n milestoneIndex: number;\n}\n\n/**\n * Arguments for claim_round_vested_tokens instruction\n */\nexport interface ClaimRoundVestedTokensArgs {\n /** Milestone index */\n milestoneIndex: number;\n}\n\n// =============================================================================\n// Multi-Round Fundraising Events\n// =============================================================================\n\nexport interface FundingRoundOpenedEvent {\n projectId: BN;\n projectKey: PublicKey;\n roundNumber: number;\n fundingGoal: BN;\n roundAllocationBps: number;\n tierCount: number;\n milestoneCount: number;\n timestamp: BN;\n}\n\nexport interface RoundInvestmentMadeEvent {\n projectId: BN;\n projectKey: PublicKey;\n roundNumber: number;\n investor: PublicKey;\n amount: BN;\n nftMint: PublicKey;\n tier: number;\n tokensAllocated: BN;\n timestamp: BN;\n}\n\nexport interface RoundMilestoneVoteEvent {\n projectId: BN;\n projectKey: PublicKey;\n roundNumber: number;\n milestoneIndex: number;\n voter: PublicKey;\n choice: VoteChoice;\n weight: BN;\n timestamp: BN;\n}\n\nexport interface RoundMilestoneFinalizedEvent {\n projectId: BN;\n projectKey: PublicKey;\n roundNumber: number;\n milestoneIndex: number;\n passed: boolean;\n yesVotes: BN;\n noVotes: BN;\n timestamp: BN;\n}\n\nexport interface RoundEarlyTokensClaimedEvent {\n projectId: BN;\n roundNumber: number;\n investmentKey: PublicKey;\n nftHolder: PublicKey;\n amount: BN;\n timestamp: BN;\n}\n\nexport interface RoundInstantTokensClaimedEvent {\n projectId: BN;\n roundNumber: number;\n milestoneIndex: number;\n investmentKey: PublicKey;\n nftHolder: PublicKey;\n tokensClaimed: BN;\n timestamp: BN;\n}\n\nexport interface RoundVestedTokensClaimedEvent {\n projectId: BN;\n roundNumber: number;\n milestoneIndex: number;\n investmentKey: PublicKey;\n nftHolder: PublicKey;\n tokensClaimed: BN;\n cumulativeClaimed: BN;\n vestingProgressPercent: number;\n timestamp: BN;\n}\n"]}