@zemyth/raise-sdk 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +416 -0
- package/dist/accounts/index.cjs +258 -0
- package/dist/accounts/index.cjs.map +1 -0
- package/dist/accounts/index.d.cts +115 -0
- package/dist/accounts/index.d.ts +115 -0
- package/dist/accounts/index.js +245 -0
- package/dist/accounts/index.js.map +1 -0
- package/dist/constants/index.cjs +174 -0
- package/dist/constants/index.cjs.map +1 -0
- package/dist/constants/index.d.cts +143 -0
- package/dist/constants/index.d.ts +143 -0
- package/dist/constants/index.js +158 -0
- package/dist/constants/index.js.map +1 -0
- package/dist/errors/index.cjs +177 -0
- package/dist/errors/index.cjs.map +1 -0
- package/dist/errors/index.d.cts +83 -0
- package/dist/errors/index.d.ts +83 -0
- package/dist/errors/index.js +170 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/index.cjs +2063 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +680 -0
- package/dist/index.d.ts +680 -0
- package/dist/index.js +1926 -0
- package/dist/index.js.map +1 -0
- package/dist/instructions/index.cjs +852 -0
- package/dist/instructions/index.cjs.map +1 -0
- package/dist/instructions/index.d.cts +452 -0
- package/dist/instructions/index.d.ts +452 -0
- package/dist/instructions/index.js +809 -0
- package/dist/instructions/index.js.map +1 -0
- package/dist/pdas/index.cjs +241 -0
- package/dist/pdas/index.cjs.map +1 -0
- package/dist/pdas/index.d.cts +171 -0
- package/dist/pdas/index.d.ts +171 -0
- package/dist/pdas/index.js +217 -0
- package/dist/pdas/index.js.map +1 -0
- package/dist/types/index.cjs +44 -0
- package/dist/types/index.cjs.map +1 -0
- package/dist/types/index.d.cts +229 -0
- package/dist/types/index.d.ts +229 -0
- package/dist/types/index.js +39 -0
- package/dist/types/index.js.map +1 -0
- package/package.json +130 -0
- package/src/accounts/index.ts +329 -0
- package/src/client.ts +715 -0
- package/src/constants/index.ts +205 -0
- package/src/errors/index.ts +222 -0
- package/src/events/index.ts +256 -0
- package/src/index.ts +253 -0
- package/src/instructions/index.ts +1504 -0
- package/src/pdas/index.ts +404 -0
- package/src/types/index.ts +267 -0
- package/src/utils/index.ts +277 -0
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// src/constants/index.ts
|
|
4
|
+
var SEEDS = {
|
|
5
|
+
PROJECT: "project",
|
|
6
|
+
MILESTONE: "milestone",
|
|
7
|
+
INVESTMENT: "investment",
|
|
8
|
+
VOTE: "vote",
|
|
9
|
+
ESCROW: "escrow",
|
|
10
|
+
PIVOT: "pivot",
|
|
11
|
+
PIVOT_PROPOSAL: "pivot_proposal",
|
|
12
|
+
TGE_ESCROW: "tge_escrow",
|
|
13
|
+
TGE_ESCROW_VAULT: "tge_escrow_vault",
|
|
14
|
+
SCAM_REPORT: "scam_report",
|
|
15
|
+
ADMIN_CONFIG: "admin-config",
|
|
16
|
+
NFT_MINT: "nft_mint",
|
|
17
|
+
AUTHORITY: "authority"
|
|
18
|
+
};
|
|
19
|
+
var VALIDATION = {
|
|
20
|
+
/** Minimum number of milestones per project */
|
|
21
|
+
MIN_MILESTONES: 2,
|
|
22
|
+
/** Maximum number of milestones per project */
|
|
23
|
+
MAX_MILESTONES: 10,
|
|
24
|
+
/** Milestone percentages must sum to this value */
|
|
25
|
+
MILESTONE_PERCENTAGE_SUM: 100,
|
|
26
|
+
/** Maximum funding buffer (110% of goal) */
|
|
27
|
+
MAX_FUNDING_BUFFER_PERCENT: 110,
|
|
28
|
+
/** Maximum metadata URI length */
|
|
29
|
+
MAX_METADATA_URI_LENGTH: 200,
|
|
30
|
+
/** Maximum pivot description length */
|
|
31
|
+
MAX_PIVOT_DESCRIPTION_LEN: 256,
|
|
32
|
+
/** Maximum pivot vision length */
|
|
33
|
+
MAX_PIVOT_VISION_LEN: 512,
|
|
34
|
+
/** Maximum pivot justification length */
|
|
35
|
+
MAX_PIVOT_JUSTIFICATION_LEN: 512
|
|
36
|
+
};
|
|
37
|
+
var TIMING = {
|
|
38
|
+
/** Production voting period (14 days) */
|
|
39
|
+
VOTING_PERIOD_SECONDS: 1209600,
|
|
40
|
+
/** Production hold period (7 days) */
|
|
41
|
+
HOLD_PERIOD_SECONDS: 604800,
|
|
42
|
+
/** Inactivity timeout (90 days) */
|
|
43
|
+
INACTIVITY_TIMEOUT_SECONDS: 7776e3,
|
|
44
|
+
/** Abandonment timeout (90 days) */
|
|
45
|
+
ABANDONMENT_TIMEOUT_SECONDS: 7776e3,
|
|
46
|
+
/** Refund window (14 days) */
|
|
47
|
+
REFUND_WINDOW_SECONDS: 1209600,
|
|
48
|
+
/** Pivot withdrawal window (7 days) */
|
|
49
|
+
PIVOT_WITHDRAWAL_WINDOW_SECONDS: 604800,
|
|
50
|
+
/** Minimum TGE date (15 days from now) */
|
|
51
|
+
TGE_MIN_DAYS: 1296e3,
|
|
52
|
+
/** Maximum TGE date (90 days from now) */
|
|
53
|
+
TGE_MAX_DAYS: 7776e3,
|
|
54
|
+
/** Post-TGE holdback period (30 days) */
|
|
55
|
+
POST_TGE_HOLDBACK_DAYS: 2592e3
|
|
56
|
+
};
|
|
57
|
+
var TIER_CONSTRAINTS = {
|
|
58
|
+
/** Minimum number of tiers */
|
|
59
|
+
MIN_TIERS: 1,
|
|
60
|
+
/** Maximum number of tiers */
|
|
61
|
+
MAX_TIERS: 10,
|
|
62
|
+
/** Minimum tier amount (10 USDC in lamports) */
|
|
63
|
+
MIN_TIER_AMOUNT: 10000000n,
|
|
64
|
+
/** Minimum max_lots per tier */
|
|
65
|
+
MIN_TIER_MAX_LOTS: 1,
|
|
66
|
+
/** Minimum token ratio */
|
|
67
|
+
MIN_TIER_TOKEN_RATIO: 1n,
|
|
68
|
+
/** Minimum vote multiplier (100 = 1.0x) */
|
|
69
|
+
MIN_TIER_VOTE_MULTIPLIER: 100
|
|
70
|
+
};
|
|
71
|
+
var InvestmentTier = /* @__PURE__ */ ((InvestmentTier2) => {
|
|
72
|
+
InvestmentTier2["Bronze"] = "Bronze";
|
|
73
|
+
InvestmentTier2["Silver"] = "Silver";
|
|
74
|
+
InvestmentTier2["Gold"] = "Gold";
|
|
75
|
+
InvestmentTier2["Platinum"] = "Platinum";
|
|
76
|
+
InvestmentTier2["Diamond"] = "Diamond";
|
|
77
|
+
return InvestmentTier2;
|
|
78
|
+
})(InvestmentTier || {});
|
|
79
|
+
var TIER_MINIMUMS = {
|
|
80
|
+
["Bronze" /* Bronze */]: 100000000n,
|
|
81
|
+
// 100 USDC
|
|
82
|
+
["Silver" /* Silver */]: 500000000n,
|
|
83
|
+
// 500 USDC
|
|
84
|
+
["Gold" /* Gold */]: 1000000000n,
|
|
85
|
+
// 1,000 USDC
|
|
86
|
+
["Platinum" /* Platinum */]: 5000000000n,
|
|
87
|
+
// 5,000 USDC
|
|
88
|
+
["Diamond" /* Diamond */]: 10000000000n
|
|
89
|
+
// 10,000 USDC
|
|
90
|
+
};
|
|
91
|
+
var TIER_VOTE_MULTIPLIERS = {
|
|
92
|
+
["Bronze" /* Bronze */]: 100,
|
|
93
|
+
// 1.0x
|
|
94
|
+
["Silver" /* Silver */]: 120,
|
|
95
|
+
// 1.2x
|
|
96
|
+
["Gold" /* Gold */]: 150,
|
|
97
|
+
// 1.5x
|
|
98
|
+
["Platinum" /* Platinum */]: 200,
|
|
99
|
+
// 2.0x
|
|
100
|
+
["Diamond" /* Diamond */]: 300
|
|
101
|
+
// 3.0x
|
|
102
|
+
};
|
|
103
|
+
var TIER_TOKEN_MULTIPLIERS = {
|
|
104
|
+
["Bronze" /* Bronze */]: 100,
|
|
105
|
+
["Silver" /* Silver */]: 120,
|
|
106
|
+
["Gold" /* Gold */]: 150,
|
|
107
|
+
["Platinum" /* Platinum */]: 200,
|
|
108
|
+
["Diamond" /* Diamond */]: 300
|
|
109
|
+
};
|
|
110
|
+
function getTierFromAmount(amount) {
|
|
111
|
+
if (amount >= TIER_MINIMUMS["Diamond" /* Diamond */]) return "Diamond" /* Diamond */;
|
|
112
|
+
if (amount >= TIER_MINIMUMS["Platinum" /* Platinum */]) return "Platinum" /* Platinum */;
|
|
113
|
+
if (amount >= TIER_MINIMUMS["Gold" /* Gold */]) return "Gold" /* Gold */;
|
|
114
|
+
if (amount >= TIER_MINIMUMS["Silver" /* Silver */]) return "Silver" /* Silver */;
|
|
115
|
+
return "Bronze" /* Bronze */;
|
|
116
|
+
}
|
|
117
|
+
function getVoteMultiplier(amount) {
|
|
118
|
+
const tier = getTierFromAmount(amount);
|
|
119
|
+
return TIER_VOTE_MULTIPLIERS[tier] / 100;
|
|
120
|
+
}
|
|
121
|
+
function getTokenMultiplier(amount) {
|
|
122
|
+
const tier = getTierFromAmount(amount);
|
|
123
|
+
return TIER_TOKEN_MULTIPLIERS[tier] / 100;
|
|
124
|
+
}
|
|
125
|
+
function findTierIndex(tiers, amount) {
|
|
126
|
+
for (let i = tiers.length - 1; i >= 0; i--) {
|
|
127
|
+
if (amount >= tiers[i].amount) {
|
|
128
|
+
return i;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return null;
|
|
132
|
+
}
|
|
133
|
+
var GOVERNANCE = {
|
|
134
|
+
/** Scam report threshold (30%) */
|
|
135
|
+
SCAM_THRESHOLD_PERCENT: 30,
|
|
136
|
+
/** Consecutive milestone failures before exit window eligible */
|
|
137
|
+
CONSECUTIVE_FAILURES_THRESHOLD: 3,
|
|
138
|
+
/** Milestone approval threshold (>50% weighted approval per whitepaper voting.md:100-101) */
|
|
139
|
+
MILESTONE_APPROVAL_THRESHOLD_PERCENT: 50
|
|
140
|
+
};
|
|
141
|
+
var NFT = {
|
|
142
|
+
/** NFT symbol */
|
|
143
|
+
SYMBOL: "SNI",
|
|
144
|
+
/** NFT name prefix */
|
|
145
|
+
NAME_PREFIX: "Raise Investment #",
|
|
146
|
+
/** Royalty basis points (2%) */
|
|
147
|
+
ROYALTY_BASIS_POINTS: 200
|
|
148
|
+
};
|
|
149
|
+
var USDC = {
|
|
150
|
+
/** USDC decimals */
|
|
151
|
+
DECIMALS: 6,
|
|
152
|
+
/** Convert USDC to lamports */
|
|
153
|
+
toAmount: (usdc) => BigInt(Math.floor(usdc * 10 ** 6)),
|
|
154
|
+
/** Convert lamports to USDC */
|
|
155
|
+
fromAmount: (lamports) => Number(lamports) / 10 ** 6
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
exports.GOVERNANCE = GOVERNANCE;
|
|
159
|
+
exports.InvestmentTier = InvestmentTier;
|
|
160
|
+
exports.NFT = NFT;
|
|
161
|
+
exports.SEEDS = SEEDS;
|
|
162
|
+
exports.TIER_CONSTRAINTS = TIER_CONSTRAINTS;
|
|
163
|
+
exports.TIER_MINIMUMS = TIER_MINIMUMS;
|
|
164
|
+
exports.TIER_TOKEN_MULTIPLIERS = TIER_TOKEN_MULTIPLIERS;
|
|
165
|
+
exports.TIER_VOTE_MULTIPLIERS = TIER_VOTE_MULTIPLIERS;
|
|
166
|
+
exports.TIMING = TIMING;
|
|
167
|
+
exports.USDC = USDC;
|
|
168
|
+
exports.VALIDATION = VALIDATION;
|
|
169
|
+
exports.findTierIndex = findTierIndex;
|
|
170
|
+
exports.getTierFromAmount = getTierFromAmount;
|
|
171
|
+
exports.getTokenMultiplier = getTokenMultiplier;
|
|
172
|
+
exports.getVoteMultiplier = getVoteMultiplier;
|
|
173
|
+
//# sourceMappingURL=index.cjs.map
|
|
174
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/constants/index.ts"],"names":["InvestmentTier"],"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,EACP,cAAA,EAAgB,gBAAA;AAAA,EAChB,UA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kB,MAAA,EAAwB;AACxD,EAAA,MAAM,IAAA,GAAO,kBAAkB,MAAM,CAAA;AACrC,EAAA,OAAO,qBAAA,CAAsB,IAAI,CAAA,GAAI,GAAA;AACvC;AAGO,SAAS,mBAAmB,MAAA,EAAwB;AACzD,EAAA,MAAM,IAAA,GAAO,kBAAkB,MAAM,CAAA;AACrC,EAAA,OAAO,sBAAA,CAAuB,IAAI,CAAA,GAAI,GAAA;AACxC;AAMO,SAAS,aAAA,CAAc,OAAkC,MAAA,EAA+B;AAC7F,EAAA,KAAA,IAAS,IAAI,KAAA,CAAM,MAAA,GAAS,CAAA,EAAG,CAAA,IAAK,GAAG,CAAA,EAAA,EAAK;AAC1C,IAAA,IAAI,MAAA,IAAU,KAAA,CAAM,CAAC,CAAA,CAAE,MAAA,EAAQ;AAC7B,MAAA,OAAO,CAAA;AAAA,IACT;AAAA,EACF;AACA,EAAA,OAAO,IAAA;AACT;AAMO,IAAM,UAAA,GAAa;AAAA;AAAA,EAExB,sBAAA,EAAwB,EAAA;AAAA;AAAA,EAExB,8BAAA,EAAgC,CAAA;AAAA;AAAA,EAEhC,oCAAA,EAAsC;AACxC;AAMO,IAAM,GAAA,GAAM;AAAA;AAAA,EAEjB,MAAA,EAAQ,KAAA;AAAA;AAAA,EAER,WAAA,EAAa,oBAAA;AAAA;AAAA,EAEb,oBAAA,EAAsB;AACxB;AAMO,IAAM,IAAA,GAAO;AAAA;AAAA,EAElB,QAAA,EAAU,CAAA;AAAA;AAAA,EAEV,QAAA,EAAU,CAAC,IAAA,KAAyB,MAAA,CAAO,KAAK,KAAA,CAAM,IAAA,GAAO,EAAA,IAAM,CAAC,CAAC,CAAA;AAAA;AAAA,EAErE,YAAY,CAAC,QAAA,KAA6B,MAAA,CAAO,QAAQ,IAAI,EAAA,IAAM;AACrE","file":"index.cjs","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"]}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Raise Constants
|
|
3
|
+
*
|
|
4
|
+
* Mirrors the on-chain program constants for client-side validation
|
|
5
|
+
* and display purposes.
|
|
6
|
+
*/
|
|
7
|
+
declare const SEEDS: {
|
|
8
|
+
readonly PROJECT: "project";
|
|
9
|
+
readonly MILESTONE: "milestone";
|
|
10
|
+
readonly INVESTMENT: "investment";
|
|
11
|
+
readonly VOTE: "vote";
|
|
12
|
+
readonly ESCROW: "escrow";
|
|
13
|
+
readonly PIVOT: "pivot";
|
|
14
|
+
readonly PIVOT_PROPOSAL: "pivot_proposal";
|
|
15
|
+
readonly TGE_ESCROW: "tge_escrow";
|
|
16
|
+
readonly TGE_ESCROW_VAULT: "tge_escrow_vault";
|
|
17
|
+
readonly SCAM_REPORT: "scam_report";
|
|
18
|
+
readonly ADMIN_CONFIG: "admin-config";
|
|
19
|
+
readonly NFT_MINT: "nft_mint";
|
|
20
|
+
readonly AUTHORITY: "authority";
|
|
21
|
+
};
|
|
22
|
+
declare const VALIDATION: {
|
|
23
|
+
/** Minimum number of milestones per project */
|
|
24
|
+
readonly MIN_MILESTONES: 2;
|
|
25
|
+
/** Maximum number of milestones per project */
|
|
26
|
+
readonly MAX_MILESTONES: 10;
|
|
27
|
+
/** Milestone percentages must sum to this value */
|
|
28
|
+
readonly MILESTONE_PERCENTAGE_SUM: 100;
|
|
29
|
+
/** Maximum funding buffer (110% of goal) */
|
|
30
|
+
readonly MAX_FUNDING_BUFFER_PERCENT: 110;
|
|
31
|
+
/** Maximum metadata URI length */
|
|
32
|
+
readonly MAX_METADATA_URI_LENGTH: 200;
|
|
33
|
+
/** Maximum pivot description length */
|
|
34
|
+
readonly MAX_PIVOT_DESCRIPTION_LEN: 256;
|
|
35
|
+
/** Maximum pivot vision length */
|
|
36
|
+
readonly MAX_PIVOT_VISION_LEN: 512;
|
|
37
|
+
/** Maximum pivot justification length */
|
|
38
|
+
readonly MAX_PIVOT_JUSTIFICATION_LEN: 512;
|
|
39
|
+
};
|
|
40
|
+
declare const TIMING: {
|
|
41
|
+
/** Production voting period (14 days) */
|
|
42
|
+
readonly VOTING_PERIOD_SECONDS: 1209600;
|
|
43
|
+
/** Production hold period (7 days) */
|
|
44
|
+
readonly HOLD_PERIOD_SECONDS: 604800;
|
|
45
|
+
/** Inactivity timeout (90 days) */
|
|
46
|
+
readonly INACTIVITY_TIMEOUT_SECONDS: 7776000;
|
|
47
|
+
/** Abandonment timeout (90 days) */
|
|
48
|
+
readonly ABANDONMENT_TIMEOUT_SECONDS: 7776000;
|
|
49
|
+
/** Refund window (14 days) */
|
|
50
|
+
readonly REFUND_WINDOW_SECONDS: 1209600;
|
|
51
|
+
/** Pivot withdrawal window (7 days) */
|
|
52
|
+
readonly PIVOT_WITHDRAWAL_WINDOW_SECONDS: 604800;
|
|
53
|
+
/** Minimum TGE date (15 days from now) */
|
|
54
|
+
readonly TGE_MIN_DAYS: 1296000;
|
|
55
|
+
/** Maximum TGE date (90 days from now) */
|
|
56
|
+
readonly TGE_MAX_DAYS: 7776000;
|
|
57
|
+
/** Post-TGE holdback period (30 days) */
|
|
58
|
+
readonly POST_TGE_HOLDBACK_DAYS: 2592000;
|
|
59
|
+
};
|
|
60
|
+
declare const TIER_CONSTRAINTS: {
|
|
61
|
+
/** Minimum number of tiers */
|
|
62
|
+
readonly MIN_TIERS: 1;
|
|
63
|
+
/** Maximum number of tiers */
|
|
64
|
+
readonly MAX_TIERS: 10;
|
|
65
|
+
/** Minimum tier amount (10 USDC in lamports) */
|
|
66
|
+
readonly MIN_TIER_AMOUNT: 10000000n;
|
|
67
|
+
/** Minimum max_lots per tier */
|
|
68
|
+
readonly MIN_TIER_MAX_LOTS: 1;
|
|
69
|
+
/** Minimum token ratio */
|
|
70
|
+
readonly MIN_TIER_TOKEN_RATIO: 1n;
|
|
71
|
+
/** Minimum vote multiplier (100 = 1.0x) */
|
|
72
|
+
readonly MIN_TIER_VOTE_MULTIPLIER: 100;
|
|
73
|
+
};
|
|
74
|
+
declare enum InvestmentTier {
|
|
75
|
+
Bronze = "Bronze",
|
|
76
|
+
Silver = "Silver",
|
|
77
|
+
Gold = "Gold",
|
|
78
|
+
Platinum = "Platinum",
|
|
79
|
+
Diamond = "Diamond"
|
|
80
|
+
}
|
|
81
|
+
/** Investment tier minimum amounts in USDC lamports (6 decimals) - LEGACY */
|
|
82
|
+
declare const TIER_MINIMUMS: {
|
|
83
|
+
readonly Bronze: 100000000n;
|
|
84
|
+
readonly Silver: 500000000n;
|
|
85
|
+
readonly Gold: 1000000000n;
|
|
86
|
+
readonly Platinum: 5000000000n;
|
|
87
|
+
readonly Diamond: 10000000000n;
|
|
88
|
+
};
|
|
89
|
+
/** Vote weight multipliers (scaled by 100) - LEGACY */
|
|
90
|
+
declare const TIER_VOTE_MULTIPLIERS: {
|
|
91
|
+
readonly Bronze: 100;
|
|
92
|
+
readonly Silver: 120;
|
|
93
|
+
readonly Gold: 150;
|
|
94
|
+
readonly Platinum: 200;
|
|
95
|
+
readonly Diamond: 300;
|
|
96
|
+
};
|
|
97
|
+
/** Token allocation multipliers (same as vote multipliers) - LEGACY */
|
|
98
|
+
declare const TIER_TOKEN_MULTIPLIERS: {
|
|
99
|
+
readonly Bronze: 100;
|
|
100
|
+
readonly Silver: 120;
|
|
101
|
+
readonly Gold: 150;
|
|
102
|
+
readonly Platinum: 200;
|
|
103
|
+
readonly Diamond: 300;
|
|
104
|
+
};
|
|
105
|
+
/** Get tier from investment amount (in lamports) - LEGACY, use project.tiers instead */
|
|
106
|
+
declare function getTierFromAmount(amount: bigint): InvestmentTier;
|
|
107
|
+
/** Get vote multiplier for an investment amount - LEGACY */
|
|
108
|
+
declare function getVoteMultiplier(amount: bigint): number;
|
|
109
|
+
/** Get token multiplier for an investment amount - LEGACY */
|
|
110
|
+
declare function getTokenMultiplier(amount: bigint): number;
|
|
111
|
+
/**
|
|
112
|
+
* Find matching tier index for an investment amount (threshold-based)
|
|
113
|
+
* Returns the highest tier where amount >= tier.amount
|
|
114
|
+
*/
|
|
115
|
+
declare function findTierIndex(tiers: Array<{
|
|
116
|
+
amount: bigint;
|
|
117
|
+
}>, amount: bigint): number | null;
|
|
118
|
+
declare const GOVERNANCE: {
|
|
119
|
+
/** Scam report threshold (30%) */
|
|
120
|
+
readonly SCAM_THRESHOLD_PERCENT: 30;
|
|
121
|
+
/** Consecutive milestone failures before exit window eligible */
|
|
122
|
+
readonly CONSECUTIVE_FAILURES_THRESHOLD: 3;
|
|
123
|
+
/** Milestone approval threshold (>50% weighted approval per whitepaper voting.md:100-101) */
|
|
124
|
+
readonly MILESTONE_APPROVAL_THRESHOLD_PERCENT: 50;
|
|
125
|
+
};
|
|
126
|
+
declare const NFT: {
|
|
127
|
+
/** NFT symbol */
|
|
128
|
+
readonly SYMBOL: "SNI";
|
|
129
|
+
/** NFT name prefix */
|
|
130
|
+
readonly NAME_PREFIX: "Raise Investment #";
|
|
131
|
+
/** Royalty basis points (2%) */
|
|
132
|
+
readonly ROYALTY_BASIS_POINTS: 200;
|
|
133
|
+
};
|
|
134
|
+
declare const USDC: {
|
|
135
|
+
/** USDC decimals */
|
|
136
|
+
readonly DECIMALS: 6;
|
|
137
|
+
/** Convert USDC to lamports */
|
|
138
|
+
readonly toAmount: (usdc: number) => bigint;
|
|
139
|
+
/** Convert lamports to USDC */
|
|
140
|
+
readonly fromAmount: (lamports: bigint) => number;
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
export { GOVERNANCE, InvestmentTier, NFT, SEEDS, TIER_CONSTRAINTS, TIER_MINIMUMS, TIER_TOKEN_MULTIPLIERS, TIER_VOTE_MULTIPLIERS, TIMING, USDC, VALIDATION, findTierIndex, getTierFromAmount, getTokenMultiplier, getVoteMultiplier };
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Raise Constants
|
|
3
|
+
*
|
|
4
|
+
* Mirrors the on-chain program constants for client-side validation
|
|
5
|
+
* and display purposes.
|
|
6
|
+
*/
|
|
7
|
+
declare const SEEDS: {
|
|
8
|
+
readonly PROJECT: "project";
|
|
9
|
+
readonly MILESTONE: "milestone";
|
|
10
|
+
readonly INVESTMENT: "investment";
|
|
11
|
+
readonly VOTE: "vote";
|
|
12
|
+
readonly ESCROW: "escrow";
|
|
13
|
+
readonly PIVOT: "pivot";
|
|
14
|
+
readonly PIVOT_PROPOSAL: "pivot_proposal";
|
|
15
|
+
readonly TGE_ESCROW: "tge_escrow";
|
|
16
|
+
readonly TGE_ESCROW_VAULT: "tge_escrow_vault";
|
|
17
|
+
readonly SCAM_REPORT: "scam_report";
|
|
18
|
+
readonly ADMIN_CONFIG: "admin-config";
|
|
19
|
+
readonly NFT_MINT: "nft_mint";
|
|
20
|
+
readonly AUTHORITY: "authority";
|
|
21
|
+
};
|
|
22
|
+
declare const VALIDATION: {
|
|
23
|
+
/** Minimum number of milestones per project */
|
|
24
|
+
readonly MIN_MILESTONES: 2;
|
|
25
|
+
/** Maximum number of milestones per project */
|
|
26
|
+
readonly MAX_MILESTONES: 10;
|
|
27
|
+
/** Milestone percentages must sum to this value */
|
|
28
|
+
readonly MILESTONE_PERCENTAGE_SUM: 100;
|
|
29
|
+
/** Maximum funding buffer (110% of goal) */
|
|
30
|
+
readonly MAX_FUNDING_BUFFER_PERCENT: 110;
|
|
31
|
+
/** Maximum metadata URI length */
|
|
32
|
+
readonly MAX_METADATA_URI_LENGTH: 200;
|
|
33
|
+
/** Maximum pivot description length */
|
|
34
|
+
readonly MAX_PIVOT_DESCRIPTION_LEN: 256;
|
|
35
|
+
/** Maximum pivot vision length */
|
|
36
|
+
readonly MAX_PIVOT_VISION_LEN: 512;
|
|
37
|
+
/** Maximum pivot justification length */
|
|
38
|
+
readonly MAX_PIVOT_JUSTIFICATION_LEN: 512;
|
|
39
|
+
};
|
|
40
|
+
declare const TIMING: {
|
|
41
|
+
/** Production voting period (14 days) */
|
|
42
|
+
readonly VOTING_PERIOD_SECONDS: 1209600;
|
|
43
|
+
/** Production hold period (7 days) */
|
|
44
|
+
readonly HOLD_PERIOD_SECONDS: 604800;
|
|
45
|
+
/** Inactivity timeout (90 days) */
|
|
46
|
+
readonly INACTIVITY_TIMEOUT_SECONDS: 7776000;
|
|
47
|
+
/** Abandonment timeout (90 days) */
|
|
48
|
+
readonly ABANDONMENT_TIMEOUT_SECONDS: 7776000;
|
|
49
|
+
/** Refund window (14 days) */
|
|
50
|
+
readonly REFUND_WINDOW_SECONDS: 1209600;
|
|
51
|
+
/** Pivot withdrawal window (7 days) */
|
|
52
|
+
readonly PIVOT_WITHDRAWAL_WINDOW_SECONDS: 604800;
|
|
53
|
+
/** Minimum TGE date (15 days from now) */
|
|
54
|
+
readonly TGE_MIN_DAYS: 1296000;
|
|
55
|
+
/** Maximum TGE date (90 days from now) */
|
|
56
|
+
readonly TGE_MAX_DAYS: 7776000;
|
|
57
|
+
/** Post-TGE holdback period (30 days) */
|
|
58
|
+
readonly POST_TGE_HOLDBACK_DAYS: 2592000;
|
|
59
|
+
};
|
|
60
|
+
declare const TIER_CONSTRAINTS: {
|
|
61
|
+
/** Minimum number of tiers */
|
|
62
|
+
readonly MIN_TIERS: 1;
|
|
63
|
+
/** Maximum number of tiers */
|
|
64
|
+
readonly MAX_TIERS: 10;
|
|
65
|
+
/** Minimum tier amount (10 USDC in lamports) */
|
|
66
|
+
readonly MIN_TIER_AMOUNT: 10000000n;
|
|
67
|
+
/** Minimum max_lots per tier */
|
|
68
|
+
readonly MIN_TIER_MAX_LOTS: 1;
|
|
69
|
+
/** Minimum token ratio */
|
|
70
|
+
readonly MIN_TIER_TOKEN_RATIO: 1n;
|
|
71
|
+
/** Minimum vote multiplier (100 = 1.0x) */
|
|
72
|
+
readonly MIN_TIER_VOTE_MULTIPLIER: 100;
|
|
73
|
+
};
|
|
74
|
+
declare enum InvestmentTier {
|
|
75
|
+
Bronze = "Bronze",
|
|
76
|
+
Silver = "Silver",
|
|
77
|
+
Gold = "Gold",
|
|
78
|
+
Platinum = "Platinum",
|
|
79
|
+
Diamond = "Diamond"
|
|
80
|
+
}
|
|
81
|
+
/** Investment tier minimum amounts in USDC lamports (6 decimals) - LEGACY */
|
|
82
|
+
declare const TIER_MINIMUMS: {
|
|
83
|
+
readonly Bronze: 100000000n;
|
|
84
|
+
readonly Silver: 500000000n;
|
|
85
|
+
readonly Gold: 1000000000n;
|
|
86
|
+
readonly Platinum: 5000000000n;
|
|
87
|
+
readonly Diamond: 10000000000n;
|
|
88
|
+
};
|
|
89
|
+
/** Vote weight multipliers (scaled by 100) - LEGACY */
|
|
90
|
+
declare const TIER_VOTE_MULTIPLIERS: {
|
|
91
|
+
readonly Bronze: 100;
|
|
92
|
+
readonly Silver: 120;
|
|
93
|
+
readonly Gold: 150;
|
|
94
|
+
readonly Platinum: 200;
|
|
95
|
+
readonly Diamond: 300;
|
|
96
|
+
};
|
|
97
|
+
/** Token allocation multipliers (same as vote multipliers) - LEGACY */
|
|
98
|
+
declare const TIER_TOKEN_MULTIPLIERS: {
|
|
99
|
+
readonly Bronze: 100;
|
|
100
|
+
readonly Silver: 120;
|
|
101
|
+
readonly Gold: 150;
|
|
102
|
+
readonly Platinum: 200;
|
|
103
|
+
readonly Diamond: 300;
|
|
104
|
+
};
|
|
105
|
+
/** Get tier from investment amount (in lamports) - LEGACY, use project.tiers instead */
|
|
106
|
+
declare function getTierFromAmount(amount: bigint): InvestmentTier;
|
|
107
|
+
/** Get vote multiplier for an investment amount - LEGACY */
|
|
108
|
+
declare function getVoteMultiplier(amount: bigint): number;
|
|
109
|
+
/** Get token multiplier for an investment amount - LEGACY */
|
|
110
|
+
declare function getTokenMultiplier(amount: bigint): number;
|
|
111
|
+
/**
|
|
112
|
+
* Find matching tier index for an investment amount (threshold-based)
|
|
113
|
+
* Returns the highest tier where amount >= tier.amount
|
|
114
|
+
*/
|
|
115
|
+
declare function findTierIndex(tiers: Array<{
|
|
116
|
+
amount: bigint;
|
|
117
|
+
}>, amount: bigint): number | null;
|
|
118
|
+
declare const GOVERNANCE: {
|
|
119
|
+
/** Scam report threshold (30%) */
|
|
120
|
+
readonly SCAM_THRESHOLD_PERCENT: 30;
|
|
121
|
+
/** Consecutive milestone failures before exit window eligible */
|
|
122
|
+
readonly CONSECUTIVE_FAILURES_THRESHOLD: 3;
|
|
123
|
+
/** Milestone approval threshold (>50% weighted approval per whitepaper voting.md:100-101) */
|
|
124
|
+
readonly MILESTONE_APPROVAL_THRESHOLD_PERCENT: 50;
|
|
125
|
+
};
|
|
126
|
+
declare const NFT: {
|
|
127
|
+
/** NFT symbol */
|
|
128
|
+
readonly SYMBOL: "SNI";
|
|
129
|
+
/** NFT name prefix */
|
|
130
|
+
readonly NAME_PREFIX: "Raise Investment #";
|
|
131
|
+
/** Royalty basis points (2%) */
|
|
132
|
+
readonly ROYALTY_BASIS_POINTS: 200;
|
|
133
|
+
};
|
|
134
|
+
declare const USDC: {
|
|
135
|
+
/** USDC decimals */
|
|
136
|
+
readonly DECIMALS: 6;
|
|
137
|
+
/** Convert USDC to lamports */
|
|
138
|
+
readonly toAmount: (usdc: number) => bigint;
|
|
139
|
+
/** Convert lamports to USDC */
|
|
140
|
+
readonly fromAmount: (lamports: bigint) => number;
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
export { GOVERNANCE, InvestmentTier, NFT, SEEDS, TIER_CONSTRAINTS, TIER_MINIMUMS, TIER_TOKEN_MULTIPLIERS, TIER_VOTE_MULTIPLIERS, TIMING, USDC, VALIDATION, findTierIndex, getTierFromAmount, getTokenMultiplier, getVoteMultiplier };
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
// src/constants/index.ts
|
|
2
|
+
var SEEDS = {
|
|
3
|
+
PROJECT: "project",
|
|
4
|
+
MILESTONE: "milestone",
|
|
5
|
+
INVESTMENT: "investment",
|
|
6
|
+
VOTE: "vote",
|
|
7
|
+
ESCROW: "escrow",
|
|
8
|
+
PIVOT: "pivot",
|
|
9
|
+
PIVOT_PROPOSAL: "pivot_proposal",
|
|
10
|
+
TGE_ESCROW: "tge_escrow",
|
|
11
|
+
TGE_ESCROW_VAULT: "tge_escrow_vault",
|
|
12
|
+
SCAM_REPORT: "scam_report",
|
|
13
|
+
ADMIN_CONFIG: "admin-config",
|
|
14
|
+
NFT_MINT: "nft_mint",
|
|
15
|
+
AUTHORITY: "authority"
|
|
16
|
+
};
|
|
17
|
+
var VALIDATION = {
|
|
18
|
+
/** Minimum number of milestones per project */
|
|
19
|
+
MIN_MILESTONES: 2,
|
|
20
|
+
/** Maximum number of milestones per project */
|
|
21
|
+
MAX_MILESTONES: 10,
|
|
22
|
+
/** Milestone percentages must sum to this value */
|
|
23
|
+
MILESTONE_PERCENTAGE_SUM: 100,
|
|
24
|
+
/** Maximum funding buffer (110% of goal) */
|
|
25
|
+
MAX_FUNDING_BUFFER_PERCENT: 110,
|
|
26
|
+
/** Maximum metadata URI length */
|
|
27
|
+
MAX_METADATA_URI_LENGTH: 200,
|
|
28
|
+
/** Maximum pivot description length */
|
|
29
|
+
MAX_PIVOT_DESCRIPTION_LEN: 256,
|
|
30
|
+
/** Maximum pivot vision length */
|
|
31
|
+
MAX_PIVOT_VISION_LEN: 512,
|
|
32
|
+
/** Maximum pivot justification length */
|
|
33
|
+
MAX_PIVOT_JUSTIFICATION_LEN: 512
|
|
34
|
+
};
|
|
35
|
+
var TIMING = {
|
|
36
|
+
/** Production voting period (14 days) */
|
|
37
|
+
VOTING_PERIOD_SECONDS: 1209600,
|
|
38
|
+
/** Production hold period (7 days) */
|
|
39
|
+
HOLD_PERIOD_SECONDS: 604800,
|
|
40
|
+
/** Inactivity timeout (90 days) */
|
|
41
|
+
INACTIVITY_TIMEOUT_SECONDS: 7776e3,
|
|
42
|
+
/** Abandonment timeout (90 days) */
|
|
43
|
+
ABANDONMENT_TIMEOUT_SECONDS: 7776e3,
|
|
44
|
+
/** Refund window (14 days) */
|
|
45
|
+
REFUND_WINDOW_SECONDS: 1209600,
|
|
46
|
+
/** Pivot withdrawal window (7 days) */
|
|
47
|
+
PIVOT_WITHDRAWAL_WINDOW_SECONDS: 604800,
|
|
48
|
+
/** Minimum TGE date (15 days from now) */
|
|
49
|
+
TGE_MIN_DAYS: 1296e3,
|
|
50
|
+
/** Maximum TGE date (90 days from now) */
|
|
51
|
+
TGE_MAX_DAYS: 7776e3,
|
|
52
|
+
/** Post-TGE holdback period (30 days) */
|
|
53
|
+
POST_TGE_HOLDBACK_DAYS: 2592e3
|
|
54
|
+
};
|
|
55
|
+
var TIER_CONSTRAINTS = {
|
|
56
|
+
/** Minimum number of tiers */
|
|
57
|
+
MIN_TIERS: 1,
|
|
58
|
+
/** Maximum number of tiers */
|
|
59
|
+
MAX_TIERS: 10,
|
|
60
|
+
/** Minimum tier amount (10 USDC in lamports) */
|
|
61
|
+
MIN_TIER_AMOUNT: 10000000n,
|
|
62
|
+
/** Minimum max_lots per tier */
|
|
63
|
+
MIN_TIER_MAX_LOTS: 1,
|
|
64
|
+
/** Minimum token ratio */
|
|
65
|
+
MIN_TIER_TOKEN_RATIO: 1n,
|
|
66
|
+
/** Minimum vote multiplier (100 = 1.0x) */
|
|
67
|
+
MIN_TIER_VOTE_MULTIPLIER: 100
|
|
68
|
+
};
|
|
69
|
+
var InvestmentTier = /* @__PURE__ */ ((InvestmentTier2) => {
|
|
70
|
+
InvestmentTier2["Bronze"] = "Bronze";
|
|
71
|
+
InvestmentTier2["Silver"] = "Silver";
|
|
72
|
+
InvestmentTier2["Gold"] = "Gold";
|
|
73
|
+
InvestmentTier2["Platinum"] = "Platinum";
|
|
74
|
+
InvestmentTier2["Diamond"] = "Diamond";
|
|
75
|
+
return InvestmentTier2;
|
|
76
|
+
})(InvestmentTier || {});
|
|
77
|
+
var TIER_MINIMUMS = {
|
|
78
|
+
["Bronze" /* Bronze */]: 100000000n,
|
|
79
|
+
// 100 USDC
|
|
80
|
+
["Silver" /* Silver */]: 500000000n,
|
|
81
|
+
// 500 USDC
|
|
82
|
+
["Gold" /* Gold */]: 1000000000n,
|
|
83
|
+
// 1,000 USDC
|
|
84
|
+
["Platinum" /* Platinum */]: 5000000000n,
|
|
85
|
+
// 5,000 USDC
|
|
86
|
+
["Diamond" /* Diamond */]: 10000000000n
|
|
87
|
+
// 10,000 USDC
|
|
88
|
+
};
|
|
89
|
+
var TIER_VOTE_MULTIPLIERS = {
|
|
90
|
+
["Bronze" /* Bronze */]: 100,
|
|
91
|
+
// 1.0x
|
|
92
|
+
["Silver" /* Silver */]: 120,
|
|
93
|
+
// 1.2x
|
|
94
|
+
["Gold" /* Gold */]: 150,
|
|
95
|
+
// 1.5x
|
|
96
|
+
["Platinum" /* Platinum */]: 200,
|
|
97
|
+
// 2.0x
|
|
98
|
+
["Diamond" /* Diamond */]: 300
|
|
99
|
+
// 3.0x
|
|
100
|
+
};
|
|
101
|
+
var TIER_TOKEN_MULTIPLIERS = {
|
|
102
|
+
["Bronze" /* Bronze */]: 100,
|
|
103
|
+
["Silver" /* Silver */]: 120,
|
|
104
|
+
["Gold" /* Gold */]: 150,
|
|
105
|
+
["Platinum" /* Platinum */]: 200,
|
|
106
|
+
["Diamond" /* Diamond */]: 300
|
|
107
|
+
};
|
|
108
|
+
function getTierFromAmount(amount) {
|
|
109
|
+
if (amount >= TIER_MINIMUMS["Diamond" /* Diamond */]) return "Diamond" /* Diamond */;
|
|
110
|
+
if (amount >= TIER_MINIMUMS["Platinum" /* Platinum */]) return "Platinum" /* Platinum */;
|
|
111
|
+
if (amount >= TIER_MINIMUMS["Gold" /* Gold */]) return "Gold" /* Gold */;
|
|
112
|
+
if (amount >= TIER_MINIMUMS["Silver" /* Silver */]) return "Silver" /* Silver */;
|
|
113
|
+
return "Bronze" /* Bronze */;
|
|
114
|
+
}
|
|
115
|
+
function getVoteMultiplier(amount) {
|
|
116
|
+
const tier = getTierFromAmount(amount);
|
|
117
|
+
return TIER_VOTE_MULTIPLIERS[tier] / 100;
|
|
118
|
+
}
|
|
119
|
+
function getTokenMultiplier(amount) {
|
|
120
|
+
const tier = getTierFromAmount(amount);
|
|
121
|
+
return TIER_TOKEN_MULTIPLIERS[tier] / 100;
|
|
122
|
+
}
|
|
123
|
+
function findTierIndex(tiers, amount) {
|
|
124
|
+
for (let i = tiers.length - 1; i >= 0; i--) {
|
|
125
|
+
if (amount >= tiers[i].amount) {
|
|
126
|
+
return i;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return null;
|
|
130
|
+
}
|
|
131
|
+
var GOVERNANCE = {
|
|
132
|
+
/** Scam report threshold (30%) */
|
|
133
|
+
SCAM_THRESHOLD_PERCENT: 30,
|
|
134
|
+
/** Consecutive milestone failures before exit window eligible */
|
|
135
|
+
CONSECUTIVE_FAILURES_THRESHOLD: 3,
|
|
136
|
+
/** Milestone approval threshold (>50% weighted approval per whitepaper voting.md:100-101) */
|
|
137
|
+
MILESTONE_APPROVAL_THRESHOLD_PERCENT: 50
|
|
138
|
+
};
|
|
139
|
+
var NFT = {
|
|
140
|
+
/** NFT symbol */
|
|
141
|
+
SYMBOL: "SNI",
|
|
142
|
+
/** NFT name prefix */
|
|
143
|
+
NAME_PREFIX: "Raise Investment #",
|
|
144
|
+
/** Royalty basis points (2%) */
|
|
145
|
+
ROYALTY_BASIS_POINTS: 200
|
|
146
|
+
};
|
|
147
|
+
var USDC = {
|
|
148
|
+
/** USDC decimals */
|
|
149
|
+
DECIMALS: 6,
|
|
150
|
+
/** Convert USDC to lamports */
|
|
151
|
+
toAmount: (usdc) => BigInt(Math.floor(usdc * 10 ** 6)),
|
|
152
|
+
/** Convert lamports to USDC */
|
|
153
|
+
fromAmount: (lamports) => Number(lamports) / 10 ** 6
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
export { GOVERNANCE, InvestmentTier, NFT, SEEDS, TIER_CONSTRAINTS, TIER_MINIMUMS, TIER_TOKEN_MULTIPLIERS, TIER_VOTE_MULTIPLIERS, TIMING, USDC, VALIDATION, findTierIndex, getTierFromAmount, getTokenMultiplier, getVoteMultiplier };
|
|
157
|
+
//# sourceMappingURL=index.js.map
|
|
158
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/constants/index.ts"],"names":["InvestmentTier"],"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,EACP,cAAA,EAAgB,gBAAA;AAAA,EAChB,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;AAMO,IAAM,UAAA,GAAa;AAAA;AAAA,EAExB,cAAA,EAAgB,CAAA;AAAA;AAAA,EAEhB,cAAA,EAAgB,EAAA;AAAA;AAAA,EAEhB,wBAAA,EAA0B,GAAA;AAAA;AAAA,EAE1B,0BAAA,EAA4B,GAAA;AAAA;AAAA,EAE5B,uBAAA,EAAyB,GAAA;AAAA;AAAA,EAEzB,yBAAA,EAA2B,GAAA;AAAA;AAAA,EAE3B,oBAAA,EAAsB,GAAA;AAAA;AAAA,EAEtB,2BAAA,EAA6B;AAC/B;AAMO,IAAM,MAAA,GAAS;AAAA;AAAA,EAEpB,qBAAA,EAAuB,OAAA;AAAA;AAAA,EAEvB,mBAAA,EAAqB,MAAA;AAAA;AAAA,EAErB,0BAAA,E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A;AAAA;AAAA,EAExB,8BAAA,EAAgC,CAAA;AAAA;AAAA,EAEhC,oCAAA,EAAsC;AACxC;AAMO,IAAM,GAAA,GAAM;AAAA;AAAA,EAEjB,MAAA,EAAQ,KAAA;AAAA;AAAA,EAER,WAAA,EAAa,oBAAA;AAAA;AAAA,EAEb,oBAAA,EAAsB;AACxB;AAMO,IAAM,IAAA,GAAO;AAAA;AAAA,EAElB,QAAA,EAAU,CAAA;AAAA;AAAA,EAEV,QAAA,EAAU,CAAC,IAAA,KAAyB,MAAA,CAAO,KAAK,KAAA,CAAM,IAAA,GAAO,EAAA,IAAM,CAAC,CAAC,CAAA;AAAA;AAAA,EAErE,YAAY,CAAC,QAAA,KAA6B,MAAA,CAAO,QAAQ,IAAI,EAAA,IAAM;AACrE","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"]}
|