proof-of-take-sdk 5.0.6 → 5.0.8
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/dist/getters/getSeasonLaunchpadPool.d.ts +6 -3
- package/dist/getters/getSeasonLaunchpadPool.js +13 -9
- package/dist/idl/proof_of_take.json +44 -22
- package/dist/instructions/claimReferralPenaltyForWindow.d.ts +5 -0
- package/dist/instructions/claimReferralPenaltyForWindow.js +7 -2
- package/dist/instructions/claimSignupRewards.d.ts +5 -0
- package/dist/instructions/claimSignupRewards.js +7 -2
- package/dist/instructions/claimWindowRewards.d.ts +5 -0
- package/dist/instructions/claimWindowRewards.js +7 -2
- package/dist/instructions/joinSeason.js +18 -23
- package/dist/types/accountTypes.d.ts +3 -0
- package/dist/types/proof_of_take.d.ts +44 -22
- package/dist/utils/pdas.d.ts +17 -11
- package/dist/utils/pdas.js +25 -15
- package/package.json +1 -1
|
@@ -22,10 +22,13 @@ export type LaunchpadPoolView = {
|
|
|
22
22
|
* Shared across all seasons for this token mint.
|
|
23
23
|
* @deprecated Use getMoonpool instead
|
|
24
24
|
*/
|
|
25
|
-
export declare function getSeasonLaunchpadPool(connection: Connection, seasonNumber: BN,
|
|
25
|
+
export declare function getSeasonLaunchpadPool(connection: Connection, seasonNumber: BN, launchpadTokenMint: PublicKey): Promise<LaunchpadPoolView>;
|
|
26
26
|
/**
|
|
27
27
|
* View the global Moonpool status (spot price, reserves, k).
|
|
28
28
|
* The Moonpool is the Moon's seesaw for buying and selling stars (virtual tokens).
|
|
29
|
-
*
|
|
29
|
+
* Unique per launchpadTokenMint - each Moonpool has its own Season and reserves.
|
|
30
|
+
* @param connection - Solana connection
|
|
31
|
+
* @param seasonNumber - The season number
|
|
32
|
+
* @param launchpadTokenMint - The launchpad token mint (unique per Moonpool)
|
|
30
33
|
*/
|
|
31
|
-
export declare function getMoonpool(connection: Connection, seasonNumber: BN,
|
|
34
|
+
export declare function getMoonpool(connection: Connection, seasonNumber: BN, launchpadTokenMint: PublicKey): Promise<LaunchpadPoolView>;
|
|
@@ -13,25 +13,29 @@ const pdas_1 = require("../utils/pdas");
|
|
|
13
13
|
* Shared across all seasons for this token mint.
|
|
14
14
|
* @deprecated Use getMoonpool instead
|
|
15
15
|
*/
|
|
16
|
-
async function getSeasonLaunchpadPool(connection, seasonNumber,
|
|
17
|
-
return getMoonpool(connection, seasonNumber,
|
|
16
|
+
async function getSeasonLaunchpadPool(connection, seasonNumber, launchpadTokenMint) {
|
|
17
|
+
return getMoonpool(connection, seasonNumber, launchpadTokenMint);
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
20
|
* View the global Moonpool status (spot price, reserves, k).
|
|
21
21
|
* The Moonpool is the Moon's seesaw for buying and selling stars (virtual tokens).
|
|
22
|
-
*
|
|
22
|
+
* Unique per launchpadTokenMint - each Moonpool has its own Season and reserves.
|
|
23
|
+
* @param connection - Solana connection
|
|
24
|
+
* @param seasonNumber - The season number
|
|
25
|
+
* @param launchpadTokenMint - The launchpad token mint (unique per Moonpool)
|
|
23
26
|
*/
|
|
24
|
-
async function getMoonpool(connection, seasonNumber,
|
|
27
|
+
async function getMoonpool(connection, seasonNumber, launchpadTokenMint) {
|
|
25
28
|
const program = (0, programHelpers_1.getProgram)(connection);
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const [
|
|
29
|
+
// Season PDA uses launchpadTokenMint for Moonpool mode
|
|
30
|
+
const [season] = (0, pdas_1.getSeasonPda)(seasonNumber, constants_1.MIZD_TOKEN_MINT, launchpadTokenMint);
|
|
31
|
+
// Moonpool and treasury PDAs are scoped to launchpadTokenMint
|
|
32
|
+
const [moonpool] = (0, pdas_1.getMoonpoolPda)(launchpadTokenMint);
|
|
33
|
+
const [moonpoolTreasury] = (0, pdas_1.getMoonpoolTreasuryPda)(launchpadTokenMint);
|
|
30
34
|
const view = await program.methods
|
|
31
35
|
.viewLaunchpadPool(seasonNumber)
|
|
32
36
|
// Anchor's generated `.accounts` typing for `.view()` is sometimes overly strict;
|
|
33
37
|
// provide the correct accounts and cast to avoid leaking this complexity to callers.
|
|
34
|
-
.accounts({ season, moonpool, moonpoolTreasury, tokenMint })
|
|
38
|
+
.accounts({ season, moonpool, moonpoolTreasury, tokenMint: launchpadTokenMint })
|
|
35
39
|
.view();
|
|
36
40
|
// Anchor returns u128 as BN (and u64/i64 as BN).
|
|
37
41
|
return {
|
|
@@ -311,12 +311,17 @@
|
|
|
311
311
|
"name": "referral_penalty_claim",
|
|
312
312
|
"writable": true
|
|
313
313
|
},
|
|
314
|
+
{
|
|
315
|
+
"name": "launchpad_token_mint",
|
|
316
|
+
"docs": [
|
|
317
|
+
"Required for PDA derivation. Validated by Moonpool seeds constraint."
|
|
318
|
+
]
|
|
319
|
+
},
|
|
314
320
|
{
|
|
315
321
|
"name": "moonpool",
|
|
316
322
|
"docs": [
|
|
317
|
-
"
|
|
318
|
-
"The Moonpool is the Moon's seesaw for buying and selling stars (virtual tokens)."
|
|
319
|
-
"Shared across all seasons for this token mint."
|
|
323
|
+
"Moonpool PDA - unique per launchpad_token_mint (required when `season.is_moonpool()`).",
|
|
324
|
+
"The Moonpool is the Moon's seesaw for buying and selling stars (virtual tokens)."
|
|
320
325
|
],
|
|
321
326
|
"writable": true,
|
|
322
327
|
"optional": true,
|
|
@@ -337,7 +342,7 @@
|
|
|
337
342
|
},
|
|
338
343
|
{
|
|
339
344
|
"kind": "account",
|
|
340
|
-
"path": "
|
|
345
|
+
"path": "launchpad_token_mint"
|
|
341
346
|
},
|
|
342
347
|
{
|
|
343
348
|
"kind": "const",
|
|
@@ -358,7 +363,7 @@
|
|
|
358
363
|
{
|
|
359
364
|
"name": "moonpool_treasury",
|
|
360
365
|
"docs": [
|
|
361
|
-
"
|
|
366
|
+
"Unique per launchpad_token_mint.",
|
|
362
367
|
"",
|
|
363
368
|
"Safety:",
|
|
364
369
|
"- Address is constrained by PDA seeds.",
|
|
@@ -393,7 +398,7 @@
|
|
|
393
398
|
},
|
|
394
399
|
{
|
|
395
400
|
"kind": "account",
|
|
396
|
-
"path": "
|
|
401
|
+
"path": "launchpad_token_mint"
|
|
397
402
|
},
|
|
398
403
|
{
|
|
399
404
|
"kind": "const",
|
|
@@ -664,12 +669,17 @@
|
|
|
664
669
|
]
|
|
665
670
|
}
|
|
666
671
|
},
|
|
672
|
+
{
|
|
673
|
+
"name": "launchpad_token_mint",
|
|
674
|
+
"docs": [
|
|
675
|
+
"Required for PDA derivation. Validated by Moonpool seeds constraint."
|
|
676
|
+
]
|
|
677
|
+
},
|
|
667
678
|
{
|
|
668
679
|
"name": "moonpool",
|
|
669
680
|
"docs": [
|
|
670
|
-
"
|
|
671
|
-
"The Moonpool is the Moon's seesaw for buying and selling stars (virtual tokens)."
|
|
672
|
-
"Shared across all seasons for this token mint."
|
|
681
|
+
"Moonpool PDA - unique per launchpad_token_mint (required when `season.is_moonpool()`).",
|
|
682
|
+
"The Moonpool is the Moon's seesaw for buying and selling stars (virtual tokens)."
|
|
673
683
|
],
|
|
674
684
|
"writable": true,
|
|
675
685
|
"optional": true,
|
|
@@ -690,7 +700,7 @@
|
|
|
690
700
|
},
|
|
691
701
|
{
|
|
692
702
|
"kind": "account",
|
|
693
|
-
"path": "
|
|
703
|
+
"path": "launchpad_token_mint"
|
|
694
704
|
},
|
|
695
705
|
{
|
|
696
706
|
"kind": "const",
|
|
@@ -711,7 +721,7 @@
|
|
|
711
721
|
{
|
|
712
722
|
"name": "moonpool_treasury",
|
|
713
723
|
"docs": [
|
|
714
|
-
"
|
|
724
|
+
"Unique per launchpad_token_mint.",
|
|
715
725
|
"",
|
|
716
726
|
"Safety:",
|
|
717
727
|
"- Address is constrained by PDA seeds.",
|
|
@@ -746,7 +756,7 @@
|
|
|
746
756
|
},
|
|
747
757
|
{
|
|
748
758
|
"kind": "account",
|
|
749
|
-
"path": "
|
|
759
|
+
"path": "launchpad_token_mint"
|
|
750
760
|
},
|
|
751
761
|
{
|
|
752
762
|
"kind": "const",
|
|
@@ -1093,12 +1103,17 @@
|
|
|
1093
1103
|
"name": "season_membership",
|
|
1094
1104
|
"writable": true
|
|
1095
1105
|
},
|
|
1106
|
+
{
|
|
1107
|
+
"name": "launchpad_token_mint",
|
|
1108
|
+
"docs": [
|
|
1109
|
+
"Required for PDA derivation. Validated by Moonpool seeds constraint."
|
|
1110
|
+
]
|
|
1111
|
+
},
|
|
1096
1112
|
{
|
|
1097
1113
|
"name": "moonpool",
|
|
1098
1114
|
"docs": [
|
|
1099
|
-
"
|
|
1100
|
-
"The Moonpool is the Moon's seesaw for buying and selling stars (virtual tokens)."
|
|
1101
|
-
"Shared across all seasons for this token mint."
|
|
1115
|
+
"Moonpool PDA - unique per launchpad_token_mint (required when `season.is_moonpool()`).",
|
|
1116
|
+
"The Moonpool is the Moon's seesaw for buying and selling stars (virtual tokens)."
|
|
1102
1117
|
],
|
|
1103
1118
|
"writable": true,
|
|
1104
1119
|
"optional": true,
|
|
@@ -1119,7 +1134,7 @@
|
|
|
1119
1134
|
},
|
|
1120
1135
|
{
|
|
1121
1136
|
"kind": "account",
|
|
1122
|
-
"path": "
|
|
1137
|
+
"path": "launchpad_token_mint"
|
|
1123
1138
|
},
|
|
1124
1139
|
{
|
|
1125
1140
|
"kind": "const",
|
|
@@ -1140,7 +1155,7 @@
|
|
|
1140
1155
|
{
|
|
1141
1156
|
"name": "moonpool_treasury",
|
|
1142
1157
|
"docs": [
|
|
1143
|
-
"
|
|
1158
|
+
"Unique per launchpad_token_mint.",
|
|
1144
1159
|
"",
|
|
1145
1160
|
"Safety:",
|
|
1146
1161
|
"- Address is constrained by PDA seeds.",
|
|
@@ -1175,7 +1190,7 @@
|
|
|
1175
1190
|
},
|
|
1176
1191
|
{
|
|
1177
1192
|
"kind": "account",
|
|
1178
|
-
"path": "
|
|
1193
|
+
"path": "launchpad_token_mint"
|
|
1179
1194
|
},
|
|
1180
1195
|
{
|
|
1181
1196
|
"kind": "const",
|
|
@@ -2921,10 +2936,13 @@
|
|
|
2921
2936
|
{
|
|
2922
2937
|
"name": "moonpool",
|
|
2923
2938
|
"docs": [
|
|
2924
|
-
"
|
|
2939
|
+
"Moonpool PDA - unique per launchpad_token_mint.",
|
|
2925
2940
|
"The Moonpool is the Moon's seesaw for buying and selling stars (real SPL Token-2022 tokens).",
|
|
2926
2941
|
"Contains reserve state for the constant-product AMM.",
|
|
2927
2942
|
"",
|
|
2943
|
+
"Each unique launchpad_token_mint creates a unique Moonpool, allowing multiple \"Stars\"",
|
|
2944
|
+
"to coexist for the same token_mint.",
|
|
2945
|
+
"",
|
|
2928
2946
|
"SECURITY: This account is MANDATORY (not optional) to prevent bypassing the",
|
|
2929
2947
|
"launchpad mode check. If a previous season was launchpad mode, subsequent",
|
|
2930
2948
|
"seasons MUST also be launchpad mode - we enforce this by always checking",
|
|
@@ -2948,7 +2966,7 @@
|
|
|
2948
2966
|
},
|
|
2949
2967
|
{
|
|
2950
2968
|
"kind": "account",
|
|
2951
|
-
"path": "
|
|
2969
|
+
"path": "launchpad_token_mint"
|
|
2952
2970
|
},
|
|
2953
2971
|
{
|
|
2954
2972
|
"kind": "const",
|
|
@@ -2969,7 +2987,7 @@
|
|
|
2969
2987
|
{
|
|
2970
2988
|
"name": "moonpool_treasury",
|
|
2971
2989
|
"docs": [
|
|
2972
|
-
"
|
|
2990
|
+
"Unique per launchpad_token_mint, paired with its corresponding Moonpool.",
|
|
2973
2991
|
"",
|
|
2974
2992
|
"SECURITY: This account is MANDATORY alongside the pool to ensure consistent",
|
|
2975
2993
|
"mode validation across seasons.",
|
|
@@ -3006,7 +3024,7 @@
|
|
|
3006
3024
|
},
|
|
3007
3025
|
{
|
|
3008
3026
|
"kind": "account",
|
|
3009
|
-
"path": "
|
|
3027
|
+
"path": "launchpad_token_mint"
|
|
3010
3028
|
},
|
|
3011
3029
|
{
|
|
3012
3030
|
"kind": "const",
|
|
@@ -3530,6 +3548,10 @@
|
|
|
3530
3548
|
{
|
|
3531
3549
|
"name": "symbol",
|
|
3532
3550
|
"type": "string"
|
|
3551
|
+
},
|
|
3552
|
+
{
|
|
3553
|
+
"name": "force_new_launchpad_mint",
|
|
3554
|
+
"type": "bool"
|
|
3533
3555
|
}
|
|
3534
3556
|
]
|
|
3535
3557
|
},
|
|
@@ -12,6 +12,11 @@ export interface ClaimReferralPenaltyForWindowOptions {
|
|
|
12
12
|
seasonNumber: BN;
|
|
13
13
|
/** Token mint this season is scoped to (used for PDA derivation). Defaults to MIZD_TOKEN_MINT. */
|
|
14
14
|
tokenMint?: PublicKey;
|
|
15
|
+
/**
|
|
16
|
+
* SPL Token-2022 mint for the launchpad token (required for launchpad mode).
|
|
17
|
+
* Used for PDA derivation of moonpool and treasury.
|
|
18
|
+
*/
|
|
19
|
+
launchpadTokenMint: PublicKey;
|
|
15
20
|
windowNumber: WindowNumberLike;
|
|
16
21
|
/** Tier number: 0=copper, 1=silver, 2=gold, 3=platinum, 4=mithril */
|
|
17
22
|
tier: TierNumber;
|
|
@@ -7,6 +7,7 @@ const anchor_1 = require("@coral-xyz/anchor");
|
|
|
7
7
|
const web3_js_1 = require("@solana/web3.js");
|
|
8
8
|
const spl_token_1 = require("@solana/spl-token");
|
|
9
9
|
const pdaManager_1 = require("../utils/pdaManager");
|
|
10
|
+
const pdas_1 = require("../utils/pdas");
|
|
10
11
|
const constants_1 = require("../utils/constants");
|
|
11
12
|
const programHelpers_1 = require("../utils/programHelpers");
|
|
12
13
|
const signerHelpers_1 = require("../utils/signerHelpers");
|
|
@@ -25,14 +26,18 @@ async function claimReferralPenaltyForWindow(options) {
|
|
|
25
26
|
tier: options.tier,
|
|
26
27
|
tokenMint,
|
|
27
28
|
});
|
|
29
|
+
// Derive Moonpool and Treasury PDAs using the launchpadTokenMint
|
|
30
|
+
const [moonpoolPda] = (0, pdas_1.getMoonpoolPda)(options.launchpadTokenMint);
|
|
31
|
+
const [moonpoolTreasuryPda] = (0, pdas_1.getMoonpoolTreasuryPda)(options.launchpadTokenMint);
|
|
28
32
|
const accounts = {
|
|
29
33
|
seasonSettings: pdas.seasonSettings,
|
|
30
34
|
season: pdas.season,
|
|
31
35
|
seasonMembership: pdas.seasonMembership,
|
|
32
36
|
userWindowParticipation: pdas.userWindowParticipation,
|
|
33
37
|
referralPenaltyClaim: pdas.referralPenaltyClaim,
|
|
34
|
-
|
|
35
|
-
|
|
38
|
+
launchpadTokenMint: options.launchpadTokenMint,
|
|
39
|
+
moonpool: launchpad ? moonpoolPda : null,
|
|
40
|
+
moonpoolTreasury: launchpad ? moonpoolTreasuryPda : null,
|
|
36
41
|
seasonDepositVault: launchpad ? null : pdas.seasonDepositVault,
|
|
37
42
|
mizdMint: constants_1.MIZD_TOKEN_MINT,
|
|
38
43
|
tokenMint,
|
|
@@ -18,6 +18,11 @@ export interface ClaimSignupRewardsOptions {
|
|
|
18
18
|
seasonNumber: BN;
|
|
19
19
|
/** Token mint this season is scoped to (used for PDA derivation). Defaults to MIZD_TOKEN_MINT. */
|
|
20
20
|
tokenMint?: PublicKey;
|
|
21
|
+
/**
|
|
22
|
+
* SPL Token-2022 mint for the launchpad token (required for launchpad mode).
|
|
23
|
+
* Used for PDA derivation of moonpool and treasury.
|
|
24
|
+
*/
|
|
25
|
+
launchpadTokenMint: PublicKey;
|
|
21
26
|
/** Tier number: 0=copper, 1=silver, 2=gold, 3=platinum, 4=mithril */
|
|
22
27
|
tier: TierNumber;
|
|
23
28
|
/** If true, claim uses launchpad mode (SOL payout; token accounts can be omitted). */
|
|
@@ -7,6 +7,7 @@ const anchor_1 = require("@coral-xyz/anchor");
|
|
|
7
7
|
const web3_js_1 = require("@solana/web3.js");
|
|
8
8
|
const spl_token_1 = require("@solana/spl-token");
|
|
9
9
|
const pdaManager_1 = require("../utils/pdaManager");
|
|
10
|
+
const pdas_1 = require("../utils/pdas");
|
|
10
11
|
const constants_1 = require("../utils/constants");
|
|
11
12
|
const programHelpers_1 = require("../utils/programHelpers");
|
|
12
13
|
const signerHelpers_1 = require("../utils/signerHelpers");
|
|
@@ -34,11 +35,15 @@ async function claimSignupRewards(options) {
|
|
|
34
35
|
const userMizdAta = launchpad
|
|
35
36
|
? null
|
|
36
37
|
: (0, spl_token_1.getAssociatedTokenAddressSync)(constants_1.MIZD_TOKEN_MINT, options.user);
|
|
38
|
+
// Derive Moonpool and Treasury PDAs using the launchpadTokenMint
|
|
39
|
+
const [moonpoolPda] = (0, pdas_1.getMoonpoolPda)(options.launchpadTokenMint);
|
|
40
|
+
const [moonpoolTreasuryPda] = (0, pdas_1.getMoonpoolTreasuryPda)(options.launchpadTokenMint);
|
|
37
41
|
const accounts = {
|
|
38
42
|
seasonMembership: pdas.seasonMembership,
|
|
39
43
|
season: pdas.season,
|
|
40
|
-
|
|
41
|
-
|
|
44
|
+
launchpadTokenMint: options.launchpadTokenMint,
|
|
45
|
+
moonpool: launchpad ? moonpoolPda : null,
|
|
46
|
+
moonpoolTreasury: launchpad ? moonpoolTreasuryPda : null,
|
|
42
47
|
signupRewardsPda: pdas.signupRewardsPda,
|
|
43
48
|
signupRewardsMizdAta,
|
|
44
49
|
mizdMint: constants_1.MIZD_TOKEN_MINT,
|
|
@@ -29,6 +29,11 @@ export interface ClaimWindowRewardsOptions {
|
|
|
29
29
|
seasonNumber: BN;
|
|
30
30
|
/** Token mint this season is scoped to (used for PDA derivation). Defaults to MIZD_TOKEN_MINT. */
|
|
31
31
|
tokenMint?: PublicKey;
|
|
32
|
+
/**
|
|
33
|
+
* SPL Token-2022 mint for the launchpad token (required for launchpad mode).
|
|
34
|
+
* Used for PDA derivation of moonpool and treasury.
|
|
35
|
+
*/
|
|
36
|
+
launchpadTokenMint: PublicKey;
|
|
32
37
|
windowNumber: WindowNumberLike;
|
|
33
38
|
/** Tier number: 0=copper, 1=silver, 2=gold, 3=platinum, 4=mithril */
|
|
34
39
|
tier: TierNumber;
|
|
@@ -7,6 +7,7 @@ const anchor_1 = require("@coral-xyz/anchor");
|
|
|
7
7
|
const spl_token_1 = require("@solana/spl-token");
|
|
8
8
|
const web3_js_1 = require("@solana/web3.js");
|
|
9
9
|
const pdaManager_1 = require("../utils/pdaManager");
|
|
10
|
+
const pdas_1 = require("../utils/pdas");
|
|
10
11
|
const constants_1 = require("../utils/constants");
|
|
11
12
|
const programHelpers_1 = require("../utils/programHelpers");
|
|
12
13
|
const signerHelpers_1 = require("../utils/signerHelpers");
|
|
@@ -34,14 +35,18 @@ async function claimWindowRewards(options) {
|
|
|
34
35
|
tier: options.tier,
|
|
35
36
|
tokenMint,
|
|
36
37
|
});
|
|
38
|
+
// Derive Moonpool and Treasury PDAs using the launchpadTokenMint
|
|
39
|
+
const [moonpoolPda] = (0, pdas_1.getMoonpoolPda)(options.launchpadTokenMint);
|
|
40
|
+
const [moonpoolTreasuryPda] = (0, pdas_1.getMoonpoolTreasuryPda)(options.launchpadTokenMint);
|
|
37
41
|
const accounts = {
|
|
38
42
|
seasonSettings: pdas.seasonSettings,
|
|
39
43
|
season: pdas.season,
|
|
40
44
|
rewardWindow: pdas.rewardWindow,
|
|
41
45
|
userWindowParticipation: pdas.userWindowParticipation,
|
|
42
46
|
seasonMembership: pdas.seasonMembership,
|
|
43
|
-
|
|
44
|
-
|
|
47
|
+
launchpadTokenMint: options.launchpadTokenMint,
|
|
48
|
+
moonpool: launchpad ? moonpoolPda : null,
|
|
49
|
+
moonpoolTreasury: launchpad ? moonpoolTreasuryPda : null,
|
|
45
50
|
seasonDepositVault: launchpad ? null : pdas.seasonDepositVault,
|
|
46
51
|
mizdMint: constants_1.MIZD_TOKEN_MINT,
|
|
47
52
|
tokenMint,
|
|
@@ -9,6 +9,7 @@ const anchor_1 = require("@coral-xyz/anchor");
|
|
|
9
9
|
const web3_js_1 = require("@solana/web3.js");
|
|
10
10
|
const spl_token_1 = require("@solana/spl-token");
|
|
11
11
|
const pdaManager_1 = require("../utils/pdaManager");
|
|
12
|
+
const pdas_1 = require("../utils/pdas");
|
|
12
13
|
const constants_1 = require("../utils/constants");
|
|
13
14
|
const programHelpers_1 = require("../utils/programHelpers");
|
|
14
15
|
const signerHelpers_1 = require("../utils/signerHelpers");
|
|
@@ -49,38 +50,30 @@ async function joinSeason(options) {
|
|
|
49
50
|
console.log("[joinSeason] forceNewLaunchpadMint=true - generated new launchpad mint keypair:", launchpadTokenMintPubkey.toString());
|
|
50
51
|
}
|
|
51
52
|
else {
|
|
52
|
-
//
|
|
53
|
-
//
|
|
53
|
+
// For non-force mode, we need an existing launchpadTokenMint to find the moonpool
|
|
54
|
+
// Check currentAccounts first (for LiteSVM or optimistic updates)
|
|
54
55
|
let moonpoolData = options.currentAccounts?.moonpool ?? null;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
console.log("[joinSeason] Moonpool data fetched, launchpadTokenMint:", moonpoolData.launchpadTokenMint.toString());
|
|
60
|
-
}
|
|
61
|
-
catch (error) {
|
|
62
|
-
// Moonpool doesn't exist (first join scenario) or network error - treat as first join
|
|
63
|
-
moonpoolData = null;
|
|
64
|
-
}
|
|
56
|
+
if (moonpoolData && !moonpoolData.launchpadTokenMint.equals(web3_js_1.PublicKey.default)) {
|
|
57
|
+
// Use the launchpadTokenMint from the provided moonpool data
|
|
58
|
+
launchpadTokenMintPubkey = moonpoolData.launchpadTokenMint;
|
|
59
|
+
console.log("[joinSeason] Using launchpadTokenMint from currentAccounts:", launchpadTokenMintPubkey.toString());
|
|
65
60
|
}
|
|
66
|
-
|
|
67
|
-
//
|
|
68
|
-
//
|
|
61
|
+
else {
|
|
62
|
+
// No moonpool data provided - this is a first join scenario
|
|
63
|
+
// Generate a keypair for the mint (the mint will be created on-chain)
|
|
69
64
|
launchpadTokenMintKeypair = web3_js_1.Keypair.generate();
|
|
70
65
|
launchpadTokenMintPubkey = launchpadTokenMintKeypair.publicKey;
|
|
71
66
|
console.log("[joinSeason] First join - generated launchpad mint keypair:", launchpadTokenMintPubkey.toString());
|
|
72
67
|
}
|
|
73
|
-
else {
|
|
74
|
-
// Moonpool is already initialized - use the mint address stored in moonpool
|
|
75
|
-
launchpadTokenMintPubkey = moonpoolData.launchpadTokenMint;
|
|
76
|
-
console.log("[joinSeason] Moonpool exists - using stored mint address:", launchpadTokenMintPubkey.toString());
|
|
77
|
-
}
|
|
78
68
|
}
|
|
79
69
|
}
|
|
80
70
|
else {
|
|
81
71
|
// Non-launchpad mode, use PDA
|
|
82
72
|
launchpadTokenMintPubkey = pdasBase.launchpadTokenMint;
|
|
83
73
|
}
|
|
74
|
+
// Derive Moonpool and Treasury PDAs using the launchpadTokenMint
|
|
75
|
+
const [moonpoolPda] = (0, pdas_1.getMoonpoolPda)(launchpadTokenMintPubkey);
|
|
76
|
+
const [moonpoolTreasuryPda] = (0, pdas_1.getMoonpoolTreasuryPda)(launchpadTokenMintPubkey);
|
|
84
77
|
const rootAdminTokenAccount = launchpad
|
|
85
78
|
? null
|
|
86
79
|
: (0, spl_token_1.getAssociatedTokenAddressSync)(constants_1.MIZD_TOKEN_MINT, constants_1.ADMIN_PUBLIC_KEY);
|
|
@@ -93,6 +86,8 @@ async function joinSeason(options) {
|
|
|
93
86
|
: (0, spl_token_1.getAssociatedTokenAddressSync)(constants_1.MIZD_TOKEN_MINT, pdasBase.userJoinCredit, true);
|
|
94
87
|
const pdas = {
|
|
95
88
|
...pdasBase,
|
|
89
|
+
moonpool: moonpoolPda,
|
|
90
|
+
moonpoolTreasury: moonpoolTreasuryPda,
|
|
96
91
|
launchpadTokenMint: launchpadTokenMintPubkey,
|
|
97
92
|
userJoinCreditVault: userJoinCreditVault ?? web3_js_1.PublicKey.default,
|
|
98
93
|
};
|
|
@@ -103,8 +98,8 @@ async function joinSeason(options) {
|
|
|
103
98
|
// SECURITY: Pool accounts are now MANDATORY (non-optional) to prevent bypassing
|
|
104
99
|
// the mode check. The on-chain program validates pool state to ensure
|
|
105
100
|
// subsequent seasons use the same mode (launchpad/classic) as the first season.
|
|
106
|
-
moonpool:
|
|
107
|
-
moonpoolTreasury:
|
|
101
|
+
moonpool: moonpoolPda,
|
|
102
|
+
moonpoolTreasury: moonpoolTreasuryPda,
|
|
108
103
|
launchpadTokenMint: pdas.launchpadTokenMint,
|
|
109
104
|
sunpool: pdas.sunpool,
|
|
110
105
|
seasonDepositVault: launchpad ? null : pdas.seasonDepositVault,
|
|
@@ -140,7 +135,7 @@ async function joinSeason(options) {
|
|
|
140
135
|
const methodBuilder = program.methods
|
|
141
136
|
// Anchor expects BN for u64 args.
|
|
142
137
|
// referrerTier defaults to 0 if no referrer (ignored on-chain)
|
|
143
|
-
.joinSeason(options.seasonNumber, options.tier, referrer, options.referrerTier ?? 0, options.star ?? false, launchpad, options.maxSolInLamports ?? new anchor_1.BN(0), options.expectedSolInLamports ?? new anchor_1.BN(0), options.maxSlippageBps ?? 0, options.starFlagPrompt ?? "", options.symbol ?? "")
|
|
138
|
+
.joinSeason(options.seasonNumber, options.tier, referrer, options.referrerTier ?? 0, options.star ?? false, launchpad, options.maxSolInLamports ?? new anchor_1.BN(0), options.expectedSolInLamports ?? new anchor_1.BN(0), options.maxSlippageBps ?? 0, options.starFlagPrompt ?? "", options.symbol ?? "", options.forceNewLaunchpadMint ?? false)
|
|
144
139
|
.accounts(accounts);
|
|
145
140
|
if (remainingAccounts.length > 0) {
|
|
146
141
|
methodBuilder.remainingAccounts(remainingAccounts);
|
|
@@ -84,6 +84,7 @@ export interface ClaimWindowRewardsAccounts {
|
|
|
84
84
|
rewardWindow: PublicKey;
|
|
85
85
|
userWindowParticipation: PublicKey;
|
|
86
86
|
seasonMembership: PublicKey;
|
|
87
|
+
launchpadTokenMint: PublicKey;
|
|
87
88
|
moonpool: PublicKey | null;
|
|
88
89
|
moonpoolTreasury: PublicKey | null;
|
|
89
90
|
seasonDepositVault: PublicKey | null;
|
|
@@ -101,6 +102,7 @@ export interface ClaimReferralPenaltyForWindowAccounts {
|
|
|
101
102
|
seasonMembership: PublicKey;
|
|
102
103
|
userWindowParticipation: PublicKey;
|
|
103
104
|
referralPenaltyClaim: PublicKey;
|
|
105
|
+
launchpadTokenMint: PublicKey;
|
|
104
106
|
moonpool: PublicKey | null;
|
|
105
107
|
moonpoolTreasury: PublicKey | null;
|
|
106
108
|
seasonDepositVault: PublicKey | null;
|
|
@@ -115,6 +117,7 @@ export interface ClaimReferralPenaltyForWindowAccounts {
|
|
|
115
117
|
export interface ClaimSignupRewardsAccounts {
|
|
116
118
|
seasonMembership: PublicKey;
|
|
117
119
|
season: PublicKey;
|
|
120
|
+
launchpadTokenMint: PublicKey;
|
|
118
121
|
moonpool: PublicKey | null;
|
|
119
122
|
moonpoolTreasury: PublicKey | null;
|
|
120
123
|
signupRewardsPda: PublicKey;
|
|
@@ -317,12 +317,17 @@ export type ProofOfTake = {
|
|
|
317
317
|
"name": "referralPenaltyClaim";
|
|
318
318
|
"writable": true;
|
|
319
319
|
},
|
|
320
|
+
{
|
|
321
|
+
"name": "launchpadTokenMint";
|
|
322
|
+
"docs": [
|
|
323
|
+
"Required for PDA derivation. Validated by Moonpool seeds constraint."
|
|
324
|
+
];
|
|
325
|
+
},
|
|
320
326
|
{
|
|
321
327
|
"name": "moonpool";
|
|
322
328
|
"docs": [
|
|
323
|
-
"
|
|
324
|
-
"The Moonpool is the Moon's seesaw for buying and selling stars (virtual tokens)."
|
|
325
|
-
"Shared across all seasons for this token mint."
|
|
329
|
+
"Moonpool PDA - unique per launchpad_token_mint (required when `season.is_moonpool()`).",
|
|
330
|
+
"The Moonpool is the Moon's seesaw for buying and selling stars (virtual tokens)."
|
|
326
331
|
];
|
|
327
332
|
"writable": true;
|
|
328
333
|
"optional": true;
|
|
@@ -343,7 +348,7 @@ export type ProofOfTake = {
|
|
|
343
348
|
},
|
|
344
349
|
{
|
|
345
350
|
"kind": "account";
|
|
346
|
-
"path": "
|
|
351
|
+
"path": "launchpadTokenMint";
|
|
347
352
|
},
|
|
348
353
|
{
|
|
349
354
|
"kind": "const";
|
|
@@ -364,7 +369,7 @@ export type ProofOfTake = {
|
|
|
364
369
|
{
|
|
365
370
|
"name": "moonpoolTreasury";
|
|
366
371
|
"docs": [
|
|
367
|
-
"
|
|
372
|
+
"Unique per launchpad_token_mint.",
|
|
368
373
|
"",
|
|
369
374
|
"Safety:",
|
|
370
375
|
"- Address is constrained by PDA seeds.",
|
|
@@ -399,7 +404,7 @@ export type ProofOfTake = {
|
|
|
399
404
|
},
|
|
400
405
|
{
|
|
401
406
|
"kind": "account";
|
|
402
|
-
"path": "
|
|
407
|
+
"path": "launchpadTokenMint";
|
|
403
408
|
},
|
|
404
409
|
{
|
|
405
410
|
"kind": "const";
|
|
@@ -670,12 +675,17 @@ export type ProofOfTake = {
|
|
|
670
675
|
];
|
|
671
676
|
};
|
|
672
677
|
},
|
|
678
|
+
{
|
|
679
|
+
"name": "launchpadTokenMint";
|
|
680
|
+
"docs": [
|
|
681
|
+
"Required for PDA derivation. Validated by Moonpool seeds constraint."
|
|
682
|
+
];
|
|
683
|
+
},
|
|
673
684
|
{
|
|
674
685
|
"name": "moonpool";
|
|
675
686
|
"docs": [
|
|
676
|
-
"
|
|
677
|
-
"The Moonpool is the Moon's seesaw for buying and selling stars (virtual tokens)."
|
|
678
|
-
"Shared across all seasons for this token mint."
|
|
687
|
+
"Moonpool PDA - unique per launchpad_token_mint (required when `season.is_moonpool()`).",
|
|
688
|
+
"The Moonpool is the Moon's seesaw for buying and selling stars (virtual tokens)."
|
|
679
689
|
];
|
|
680
690
|
"writable": true;
|
|
681
691
|
"optional": true;
|
|
@@ -696,7 +706,7 @@ export type ProofOfTake = {
|
|
|
696
706
|
},
|
|
697
707
|
{
|
|
698
708
|
"kind": "account";
|
|
699
|
-
"path": "
|
|
709
|
+
"path": "launchpadTokenMint";
|
|
700
710
|
},
|
|
701
711
|
{
|
|
702
712
|
"kind": "const";
|
|
@@ -717,7 +727,7 @@ export type ProofOfTake = {
|
|
|
717
727
|
{
|
|
718
728
|
"name": "moonpoolTreasury";
|
|
719
729
|
"docs": [
|
|
720
|
-
"
|
|
730
|
+
"Unique per launchpad_token_mint.",
|
|
721
731
|
"",
|
|
722
732
|
"Safety:",
|
|
723
733
|
"- Address is constrained by PDA seeds.",
|
|
@@ -752,7 +762,7 @@ export type ProofOfTake = {
|
|
|
752
762
|
},
|
|
753
763
|
{
|
|
754
764
|
"kind": "account";
|
|
755
|
-
"path": "
|
|
765
|
+
"path": "launchpadTokenMint";
|
|
756
766
|
},
|
|
757
767
|
{
|
|
758
768
|
"kind": "const";
|
|
@@ -1099,12 +1109,17 @@ export type ProofOfTake = {
|
|
|
1099
1109
|
"name": "seasonMembership";
|
|
1100
1110
|
"writable": true;
|
|
1101
1111
|
},
|
|
1112
|
+
{
|
|
1113
|
+
"name": "launchpadTokenMint";
|
|
1114
|
+
"docs": [
|
|
1115
|
+
"Required for PDA derivation. Validated by Moonpool seeds constraint."
|
|
1116
|
+
];
|
|
1117
|
+
},
|
|
1102
1118
|
{
|
|
1103
1119
|
"name": "moonpool";
|
|
1104
1120
|
"docs": [
|
|
1105
|
-
"
|
|
1106
|
-
"The Moonpool is the Moon's seesaw for buying and selling stars (virtual tokens)."
|
|
1107
|
-
"Shared across all seasons for this token mint."
|
|
1121
|
+
"Moonpool PDA - unique per launchpad_token_mint (required when `season.is_moonpool()`).",
|
|
1122
|
+
"The Moonpool is the Moon's seesaw for buying and selling stars (virtual tokens)."
|
|
1108
1123
|
];
|
|
1109
1124
|
"writable": true;
|
|
1110
1125
|
"optional": true;
|
|
@@ -1125,7 +1140,7 @@ export type ProofOfTake = {
|
|
|
1125
1140
|
},
|
|
1126
1141
|
{
|
|
1127
1142
|
"kind": "account";
|
|
1128
|
-
"path": "
|
|
1143
|
+
"path": "launchpadTokenMint";
|
|
1129
1144
|
},
|
|
1130
1145
|
{
|
|
1131
1146
|
"kind": "const";
|
|
@@ -1146,7 +1161,7 @@ export type ProofOfTake = {
|
|
|
1146
1161
|
{
|
|
1147
1162
|
"name": "moonpoolTreasury";
|
|
1148
1163
|
"docs": [
|
|
1149
|
-
"
|
|
1164
|
+
"Unique per launchpad_token_mint.",
|
|
1150
1165
|
"",
|
|
1151
1166
|
"Safety:",
|
|
1152
1167
|
"- Address is constrained by PDA seeds.",
|
|
@@ -1181,7 +1196,7 @@ export type ProofOfTake = {
|
|
|
1181
1196
|
},
|
|
1182
1197
|
{
|
|
1183
1198
|
"kind": "account";
|
|
1184
|
-
"path": "
|
|
1199
|
+
"path": "launchpadTokenMint";
|
|
1185
1200
|
},
|
|
1186
1201
|
{
|
|
1187
1202
|
"kind": "const";
|
|
@@ -2927,10 +2942,13 @@ export type ProofOfTake = {
|
|
|
2927
2942
|
{
|
|
2928
2943
|
"name": "moonpool";
|
|
2929
2944
|
"docs": [
|
|
2930
|
-
"
|
|
2945
|
+
"Moonpool PDA - unique per launchpad_token_mint.",
|
|
2931
2946
|
"The Moonpool is the Moon's seesaw for buying and selling stars (real SPL Token-2022 tokens).",
|
|
2932
2947
|
"Contains reserve state for the constant-product AMM.",
|
|
2933
2948
|
"",
|
|
2949
|
+
"Each unique launchpad_token_mint creates a unique Moonpool, allowing multiple \"Stars\"",
|
|
2950
|
+
"to coexist for the same token_mint.",
|
|
2951
|
+
"",
|
|
2934
2952
|
"SECURITY: This account is MANDATORY (not optional) to prevent bypassing the",
|
|
2935
2953
|
"launchpad mode check. If a previous season was launchpad mode, subsequent",
|
|
2936
2954
|
"seasons MUST also be launchpad mode - we enforce this by always checking",
|
|
@@ -2954,7 +2972,7 @@ export type ProofOfTake = {
|
|
|
2954
2972
|
},
|
|
2955
2973
|
{
|
|
2956
2974
|
"kind": "account";
|
|
2957
|
-
"path": "
|
|
2975
|
+
"path": "launchpadTokenMint";
|
|
2958
2976
|
},
|
|
2959
2977
|
{
|
|
2960
2978
|
"kind": "const";
|
|
@@ -2975,7 +2993,7 @@ export type ProofOfTake = {
|
|
|
2975
2993
|
{
|
|
2976
2994
|
"name": "moonpoolTreasury";
|
|
2977
2995
|
"docs": [
|
|
2978
|
-
"
|
|
2996
|
+
"Unique per launchpad_token_mint, paired with its corresponding Moonpool.",
|
|
2979
2997
|
"",
|
|
2980
2998
|
"SECURITY: This account is MANDATORY alongside the pool to ensure consistent",
|
|
2981
2999
|
"mode validation across seasons.",
|
|
@@ -3012,7 +3030,7 @@ export type ProofOfTake = {
|
|
|
3012
3030
|
},
|
|
3013
3031
|
{
|
|
3014
3032
|
"kind": "account";
|
|
3015
|
-
"path": "
|
|
3033
|
+
"path": "launchpadTokenMint";
|
|
3016
3034
|
},
|
|
3017
3035
|
{
|
|
3018
3036
|
"kind": "const";
|
|
@@ -3536,6 +3554,10 @@ export type ProofOfTake = {
|
|
|
3536
3554
|
{
|
|
3537
3555
|
"name": "symbol";
|
|
3538
3556
|
"type": "string";
|
|
3557
|
+
},
|
|
3558
|
+
{
|
|
3559
|
+
"name": "forceNewLaunchpadMint";
|
|
3560
|
+
"type": "bool";
|
|
3539
3561
|
}
|
|
3540
3562
|
];
|
|
3541
3563
|
},
|
package/dist/utils/pdas.d.ts
CHANGED
|
@@ -23,14 +23,18 @@ export declare function getMiztakePda(shaHash: Sha256HexString | string): [Publi
|
|
|
23
23
|
*/
|
|
24
24
|
export declare function getSeasonSettingsPda(): [PublicKey, number];
|
|
25
25
|
/**
|
|
26
|
-
* Derive the Season PDA for a given season number
|
|
26
|
+
* Derive the Season PDA for a given season number.
|
|
27
|
+
* For Moonpool mode, pass launchpadTokenMint to scope the Season to a specific Moonpool.
|
|
27
28
|
* @param seasonNumber - The season number
|
|
29
|
+
* @param tokenMint - The token mint (MIZD) - used only if launchpadTokenMint is not provided
|
|
30
|
+
* @param launchpadTokenMint - The launchpad token mint (unique per Moonpool) - use this for Moonpool mode
|
|
28
31
|
*/
|
|
29
|
-
export declare function getSeasonPda(seasonNumber: SeasonNumberLike, tokenMint?: PublicKey): [PublicKey, number];
|
|
32
|
+
export declare function getSeasonPda(seasonNumber: SeasonNumberLike, tokenMint?: PublicKey, launchpadTokenMint?: PublicKey): [PublicKey, number];
|
|
30
33
|
/**
|
|
31
|
-
* Derive the SeasonMembership PDA
|
|
34
|
+
* Derive the SeasonMembership PDA.
|
|
35
|
+
* For Moonpool mode, pass launchpadTokenMint to scope the membership to a specific Moonpool.
|
|
32
36
|
* PDA model:
|
|
33
|
-
* seeds = ["season_membership", season_number_le_u64, user_pubkey_bytes, tier_u8]
|
|
37
|
+
* seeds = ["season_membership", mint_pubkey, instance_id, season_number_le_u64, user_pubkey_bytes, tier_u8]
|
|
34
38
|
*
|
|
35
39
|
* Tier mapping (u8):
|
|
36
40
|
* 0 = copper, 1 = silver, 2 = gold, 3 = platinum, 4 = mithril
|
|
@@ -38,8 +42,10 @@ export declare function getSeasonPda(seasonNumber: SeasonNumberLike, tokenMint?:
|
|
|
38
42
|
* @param seasonNumber - The season number
|
|
39
43
|
* @param user - The user's public key
|
|
40
44
|
* @param tier - Tier number (0..=4)
|
|
45
|
+
* @param tokenMint - The token mint (MIZD) - used only if launchpadTokenMint is not provided
|
|
46
|
+
* @param launchpadTokenMint - The launchpad token mint (unique per Moonpool) - use this for Moonpool mode
|
|
41
47
|
*/
|
|
42
|
-
export declare function getSeasonMembershipPda(seasonNumber: SeasonNumberLike, user: PublicKey, tier: TierNumber, tokenMint?: PublicKey): [PublicKey, number];
|
|
48
|
+
export declare function getSeasonMembershipPda(seasonNumber: SeasonNumberLike, user: PublicKey, tier: TierNumber, tokenMint?: PublicKey, launchpadTokenMint?: PublicKey): [PublicKey, number];
|
|
43
49
|
/**
|
|
44
50
|
* Derive the RewardWindow PDA
|
|
45
51
|
* @param seasonNumber - The season number
|
|
@@ -62,16 +68,16 @@ export declare function getUserWindowParticipationPda(seasonNumber: SeasonNumber
|
|
|
62
68
|
*/
|
|
63
69
|
export declare function getSeasonDepositVaultPda(seasonNumber: SeasonNumberLike, tokenMint?: PublicKey): [PublicKey, number];
|
|
64
70
|
/**
|
|
65
|
-
* Derive the
|
|
71
|
+
* Derive the Moonpool PDA (real SOL + real SPL Token-2022 reserves).
|
|
66
72
|
* The Moonpool is the Moon's seesaw for buying and selling stars (real SPL Token-2022 tokens).
|
|
67
|
-
*
|
|
73
|
+
* Each unique launchpadTokenMint creates a unique Moonpool, allowing multiple "Stars" to coexist.
|
|
68
74
|
*/
|
|
69
|
-
export declare function getMoonpoolPda(
|
|
75
|
+
export declare function getMoonpoolPda(launchpadTokenMint: PublicKey): [PublicKey, number];
|
|
70
76
|
/**
|
|
71
|
-
* Derive the
|
|
72
|
-
*
|
|
77
|
+
* Derive the MoonpoolTreasury PDA (system account holding real SOL).
|
|
78
|
+
* Unique per launchpadTokenMint, paired with its corresponding Moonpool.
|
|
73
79
|
*/
|
|
74
|
-
export declare function getMoonpoolTreasuryPda(
|
|
80
|
+
export declare function getMoonpoolTreasuryPda(launchpadTokenMint: PublicKey): [PublicKey, number];
|
|
75
81
|
/**
|
|
76
82
|
* Derive the Launchpad Token Mint PDA (SPL Token-2022 mint).
|
|
77
83
|
* The mint authority is the Moonpool PDA itself.
|
package/dist/utils/pdas.js
CHANGED
|
@@ -57,22 +57,28 @@ function getSeasonSettingsPda() {
|
|
|
57
57
|
return web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("season_settings")], constants_1.PROGRAM_ID);
|
|
58
58
|
}
|
|
59
59
|
/**
|
|
60
|
-
* Derive the Season PDA for a given season number
|
|
60
|
+
* Derive the Season PDA for a given season number.
|
|
61
|
+
* For Moonpool mode, pass launchpadTokenMint to scope the Season to a specific Moonpool.
|
|
61
62
|
* @param seasonNumber - The season number
|
|
63
|
+
* @param tokenMint - The token mint (MIZD) - used only if launchpadTokenMint is not provided
|
|
64
|
+
* @param launchpadTokenMint - The launchpad token mint (unique per Moonpool) - use this for Moonpool mode
|
|
62
65
|
*/
|
|
63
|
-
function getSeasonPda(seasonNumber, tokenMint = constants_1.MIZD_TOKEN_MINT) {
|
|
66
|
+
function getSeasonPda(seasonNumber, tokenMint = constants_1.MIZD_TOKEN_MINT, launchpadTokenMint) {
|
|
64
67
|
const seasonBn = (0, conversions_2.toSeasonNumberBn)(seasonNumber);
|
|
68
|
+
// For Moonpool mode, use launchpadTokenMint; for classic mode, use tokenMint
|
|
69
|
+
const mintToUse = launchpadTokenMint || tokenMint;
|
|
65
70
|
return web3_js_1.PublicKey.findProgramAddressSync([
|
|
66
71
|
Buffer.from("season"),
|
|
67
|
-
|
|
72
|
+
mintToUse.toBuffer(),
|
|
68
73
|
constants_1.SEASON_INSTANCE_ID.toArrayLike(Buffer, "le", 8),
|
|
69
74
|
seasonBn.toArrayLike(Buffer, "le", 8),
|
|
70
75
|
], constants_1.PROGRAM_ID);
|
|
71
76
|
}
|
|
72
77
|
/**
|
|
73
|
-
* Derive the SeasonMembership PDA
|
|
78
|
+
* Derive the SeasonMembership PDA.
|
|
79
|
+
* For Moonpool mode, pass launchpadTokenMint to scope the membership to a specific Moonpool.
|
|
74
80
|
* PDA model:
|
|
75
|
-
* seeds = ["season_membership", season_number_le_u64, user_pubkey_bytes, tier_u8]
|
|
81
|
+
* seeds = ["season_membership", mint_pubkey, instance_id, season_number_le_u64, user_pubkey_bytes, tier_u8]
|
|
76
82
|
*
|
|
77
83
|
* Tier mapping (u8):
|
|
78
84
|
* 0 = copper, 1 = silver, 2 = gold, 3 = platinum, 4 = mithril
|
|
@@ -80,13 +86,17 @@ function getSeasonPda(seasonNumber, tokenMint = constants_1.MIZD_TOKEN_MINT) {
|
|
|
80
86
|
* @param seasonNumber - The season number
|
|
81
87
|
* @param user - The user's public key
|
|
82
88
|
* @param tier - Tier number (0..=4)
|
|
89
|
+
* @param tokenMint - The token mint (MIZD) - used only if launchpadTokenMint is not provided
|
|
90
|
+
* @param launchpadTokenMint - The launchpad token mint (unique per Moonpool) - use this for Moonpool mode
|
|
83
91
|
*/
|
|
84
|
-
function getSeasonMembershipPda(seasonNumber, user, tier, tokenMint = constants_1.MIZD_TOKEN_MINT) {
|
|
92
|
+
function getSeasonMembershipPda(seasonNumber, user, tier, tokenMint = constants_1.MIZD_TOKEN_MINT, launchpadTokenMint) {
|
|
85
93
|
const t = (0, tierPenalty_1.assertValidTierNumber)(tier);
|
|
86
94
|
const seasonBn = (0, conversions_2.toSeasonNumberBn)(seasonNumber);
|
|
95
|
+
// For Moonpool mode, use launchpadTokenMint; for classic mode, use tokenMint
|
|
96
|
+
const mintToUse = launchpadTokenMint || tokenMint;
|
|
87
97
|
return web3_js_1.PublicKey.findProgramAddressSync([
|
|
88
98
|
Buffer.from("season_membership"),
|
|
89
|
-
|
|
99
|
+
mintToUse.toBuffer(),
|
|
90
100
|
constants_1.SEASON_INSTANCE_ID.toArrayLike(Buffer, "le", 8),
|
|
91
101
|
seasonBn.toArrayLike(Buffer, "le", 8),
|
|
92
102
|
user.toBuffer(),
|
|
@@ -144,25 +154,25 @@ function getSeasonDepositVaultPda(seasonNumber, tokenMint = constants_1.MIZD_TOK
|
|
|
144
154
|
], constants_1.PROGRAM_ID);
|
|
145
155
|
}
|
|
146
156
|
/**
|
|
147
|
-
* Derive the
|
|
157
|
+
* Derive the Moonpool PDA (real SOL + real SPL Token-2022 reserves).
|
|
148
158
|
* The Moonpool is the Moon's seesaw for buying and selling stars (real SPL Token-2022 tokens).
|
|
149
|
-
*
|
|
159
|
+
* Each unique launchpadTokenMint creates a unique Moonpool, allowing multiple "Stars" to coexist.
|
|
150
160
|
*/
|
|
151
|
-
function getMoonpoolPda(
|
|
161
|
+
function getMoonpoolPda(launchpadTokenMint) {
|
|
152
162
|
return web3_js_1.PublicKey.findProgramAddressSync([
|
|
153
163
|
Buffer.from(constants_1.MOONPOOL_SEED),
|
|
154
|
-
|
|
164
|
+
launchpadTokenMint.toBuffer(),
|
|
155
165
|
constants_1.SEASON_INSTANCE_ID.toArrayLike(Buffer, "le", 8),
|
|
156
166
|
], constants_1.PROGRAM_ID);
|
|
157
167
|
}
|
|
158
168
|
/**
|
|
159
|
-
* Derive the
|
|
160
|
-
*
|
|
169
|
+
* Derive the MoonpoolTreasury PDA (system account holding real SOL).
|
|
170
|
+
* Unique per launchpadTokenMint, paired with its corresponding Moonpool.
|
|
161
171
|
*/
|
|
162
|
-
function getMoonpoolTreasuryPda(
|
|
172
|
+
function getMoonpoolTreasuryPda(launchpadTokenMint) {
|
|
163
173
|
return web3_js_1.PublicKey.findProgramAddressSync([
|
|
164
174
|
Buffer.from(constants_1.MOONPOOL_TREASURY_SEED),
|
|
165
|
-
|
|
175
|
+
launchpadTokenMint.toBuffer(),
|
|
166
176
|
constants_1.SEASON_INSTANCE_ID.toArrayLike(Buffer, "le", 8),
|
|
167
177
|
], constants_1.PROGRAM_ID);
|
|
168
178
|
}
|