@meteora-ag/dynamic-bonding-curve-sdk 1.4.10 → 1.5.1
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 +13 -5
- package/dist/index.cjs +1126 -327
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +929 -309
- package/dist/index.d.ts +929 -309
- package/dist/index.js +1143 -344
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -83,29 +83,44 @@ var SwapMode = /* @__PURE__ */ ((SwapMode2) => {
|
|
|
83
83
|
// src/constants.ts
|
|
84
84
|
import BN from "bn.js";
|
|
85
85
|
import { PublicKey } from "@solana/web3.js";
|
|
86
|
+
var MAX_CURVE_POINT = 16;
|
|
86
87
|
var OFFSET = 64;
|
|
87
|
-
var U128_MAX = new BN("340282366920938463463374607431768211455");
|
|
88
|
-
var U64_MAX = new BN("18446744073709551615");
|
|
89
|
-
var U16_MAX = 65535;
|
|
90
|
-
var MIN_SQRT_PRICE = new BN("4295048016");
|
|
91
|
-
var MAX_SQRT_PRICE = new BN("79226673521066979257578248091");
|
|
92
88
|
var RESOLUTION = 64;
|
|
93
89
|
var ONE_Q64 = new BN(1).shln(RESOLUTION);
|
|
94
90
|
var FEE_DENOMINATOR = 1e9;
|
|
91
|
+
var MAX_BASIS_POINT = 1e4;
|
|
92
|
+
var U16_MAX = 65535;
|
|
93
|
+
var U64_MAX = new BN("18446744073709551615");
|
|
94
|
+
var U128_MAX = new BN("340282366920938463463374607431768211455");
|
|
95
|
+
var MIN_SQRT_PRICE = new BN("4295048016");
|
|
96
|
+
var MAX_SQRT_PRICE = new BN("79226673521066979257578248091");
|
|
95
97
|
var MIN_FEE_BPS = 25;
|
|
96
98
|
var MAX_FEE_BPS = 9900;
|
|
97
99
|
var MIN_FEE_NUMERATOR = 25e5;
|
|
98
100
|
var MAX_FEE_NUMERATOR = 99e7;
|
|
99
|
-
var
|
|
100
|
-
var
|
|
101
|
-
var
|
|
101
|
+
var MAX_RATE_LIMITER_DURATION_IN_SECONDS = 43200;
|
|
102
|
+
var MAX_RATE_LIMITER_DURATION_IN_SLOTS = 108e3;
|
|
103
|
+
var DYNAMIC_FEE_FILTER_PERIOD_DEFAULT = 10;
|
|
104
|
+
var DYNAMIC_FEE_DECAY_PERIOD_DEFAULT = 120;
|
|
105
|
+
var DYNAMIC_FEE_REDUCTION_FACTOR_DEFAULT = 5e3;
|
|
106
|
+
var DYNAMIC_FEE_SCALING_FACTOR = new BN(1e11);
|
|
107
|
+
var DYNAMIC_FEE_ROUNDING_OFFSET = new BN(99999999999);
|
|
108
|
+
var BIN_STEP_BPS_DEFAULT = 1;
|
|
109
|
+
var BIN_STEP_BPS_U128_DEFAULT = new BN("1844674407370955");
|
|
110
|
+
var MAX_PRICE_CHANGE_PERCENTAGE_DEFAULT = 20;
|
|
111
|
+
var PROTOCOL_FEE_PERCENT = 20;
|
|
112
|
+
var HOST_FEE_PERCENT = 20;
|
|
102
113
|
var SWAP_BUFFER_PERCENTAGE = 25;
|
|
103
114
|
var MAX_MIGRATION_FEE_PERCENTAGE = 99;
|
|
104
115
|
var MAX_CREATOR_MIGRATION_FEE_PERCENTAGE = 100;
|
|
105
|
-
var
|
|
106
|
-
var
|
|
107
|
-
var
|
|
108
|
-
var
|
|
116
|
+
var MIN_LOCKED_LIQUIDITY_BPS = 1e3;
|
|
117
|
+
var SECONDS_PER_DAY = 86400;
|
|
118
|
+
var MAX_LOCK_DURATION_IN_SECONDS = 63072e3;
|
|
119
|
+
var PROTOCOL_POOL_CREATION_FEE_PERCENT = 10;
|
|
120
|
+
var MIN_POOL_CREATION_FEE = 1e6;
|
|
121
|
+
var MAX_POOL_CREATION_FEE = 1e11;
|
|
122
|
+
var MIN_MIGRATED_POOL_FEE_BPS = 10;
|
|
123
|
+
var MAX_MIGRATED_POOL_FEE_BPS = 1e3;
|
|
109
124
|
var DYNAMIC_BONDING_CURVE_PROGRAM_ID = new PublicKey(
|
|
110
125
|
"dbcij3LWUppWqq96dh6gJWwBifmcGfLSB5D4DuSMaqN"
|
|
111
126
|
);
|
|
@@ -127,17 +142,6 @@ var LOCKER_PROGRAM_ID = new PublicKey(
|
|
|
127
142
|
var BASE_ADDRESS = new PublicKey(
|
|
128
143
|
"HWzXGcGHy4tcpYfaRDCyLNzXqBTv3E6BttpCH2vJxArv"
|
|
129
144
|
);
|
|
130
|
-
var DYNAMIC_FEE_FILTER_PERIOD_DEFAULT = 10;
|
|
131
|
-
var DYNAMIC_FEE_DECAY_PERIOD_DEFAULT = 120;
|
|
132
|
-
var DYNAMIC_FEE_REDUCTION_FACTOR_DEFAULT = 5e3;
|
|
133
|
-
var MAX_DYNAMIC_FEE_PERCENTAGE = 20;
|
|
134
|
-
var DYNAMIC_FEE_SCALING_FACTOR = new BN(1e11);
|
|
135
|
-
var DYNAMIC_FEE_ROUNDING_OFFSET = new BN(99999999999);
|
|
136
|
-
var BIN_STEP_BPS_DEFAULT = 1;
|
|
137
|
-
var BIN_STEP_BPS_U128_DEFAULT = new BN("1844674407370955");
|
|
138
|
-
var MAX_PRICE_CHANGE_BPS_DEFAULT = 1500;
|
|
139
|
-
var MIN_MIGRATED_POOL_FEE_BPS = 10;
|
|
140
|
-
var MAX_MIGRATED_POOL_FEE_BPS = 1e3;
|
|
141
145
|
var DAMM_V1_MIGRATION_FEE_ADDRESS = [
|
|
142
146
|
new PublicKey("8f848CEy8eY6PhJ3VcemtBDzPPSD4Vq7aJczLZ3o8MmX"),
|
|
143
147
|
// FixedBps25
|
|
@@ -168,6 +172,13 @@ var DAMM_V2_MIGRATION_FEE_ADDRESS = [
|
|
|
168
172
|
new PublicKey("A8gMrEPJkacWkcb3DGwtJwTe16HktSEfvwtuDh2MCtck")
|
|
169
173
|
// Customizable
|
|
170
174
|
];
|
|
175
|
+
var DEFAULT_LIQUIDITY_VESTING_INFO_PARAMS = {
|
|
176
|
+
vestingPercentage: 0,
|
|
177
|
+
bpsPerPeriod: 0,
|
|
178
|
+
numberOfPeriods: 0,
|
|
179
|
+
cliffDurationFromMigrationTime: 0,
|
|
180
|
+
totalDuration: 0
|
|
181
|
+
};
|
|
171
182
|
|
|
172
183
|
// src/helpers/common.ts
|
|
173
184
|
import BN6 from "bn.js";
|
|
@@ -512,10 +523,10 @@ function convertDecimalToBN(value) {
|
|
|
512
523
|
return new BN5(value.floor().toFixed());
|
|
513
524
|
}
|
|
514
525
|
function bpsToFeeNumerator(bps) {
|
|
515
|
-
return new BN5(bps * FEE_DENOMINATOR).divn(
|
|
526
|
+
return new BN5(bps * FEE_DENOMINATOR).divn(MAX_BASIS_POINT);
|
|
516
527
|
}
|
|
517
528
|
function feeNumeratorToBps(feeNumerator) {
|
|
518
|
-
return feeNumerator.muln(
|
|
529
|
+
return feeNumerator.muln(MAX_BASIS_POINT).div(new BN5(FEE_DENOMINATOR)).toNumber();
|
|
519
530
|
}
|
|
520
531
|
|
|
521
532
|
// src/helpers/token.ts
|
|
@@ -717,7 +728,7 @@ function getTotalTokenSupply(swapBaseAmount, migrationBaseThreshold, lockedVesti
|
|
|
717
728
|
}
|
|
718
729
|
return totalAmount;
|
|
719
730
|
} catch (error) {
|
|
720
|
-
throw new Error(
|
|
731
|
+
throw new Error(`Math overflow: ${error}`);
|
|
721
732
|
}
|
|
722
733
|
}
|
|
723
734
|
function getPriceFromSqrtPrice(sqrtPrice, tokenBaseDecimal, tokenQuoteDecimal) {
|
|
@@ -1054,6 +1065,11 @@ function getFeeSchedulerParams(startingBaseFeeBps, endingBaseFeeBps, baseFeeMode
|
|
|
1054
1065
|
`startingBaseFeeBps (${startingBaseFeeBps} bps) exceeds maximum allowed value of ${MAX_FEE_BPS} bps`
|
|
1055
1066
|
);
|
|
1056
1067
|
}
|
|
1068
|
+
if (endingBaseFeeBps < MIN_FEE_BPS) {
|
|
1069
|
+
throw new Error(
|
|
1070
|
+
`endingBaseFeeBps (${endingBaseFeeBps} bps) is less than minimum allowed value of ${MIN_FEE_BPS} bps`
|
|
1071
|
+
);
|
|
1072
|
+
}
|
|
1057
1073
|
if (endingBaseFeeBps > startingBaseFeeBps) {
|
|
1058
1074
|
throw new Error(
|
|
1059
1075
|
"endingBaseFeeBps bps must be less than or equal to startingBaseFeeBps bps"
|
|
@@ -1074,7 +1090,7 @@ function getFeeSchedulerParams(startingBaseFeeBps, endingBaseFeeBps, baseFeeMode
|
|
|
1074
1090
|
} else {
|
|
1075
1091
|
const ratio = minBaseFeeNumerator.toNumber() / maxBaseFeeNumerator.toNumber();
|
|
1076
1092
|
const decayBase = Math.pow(ratio, 1 / numberOfPeriod);
|
|
1077
|
-
reductionFactor = new BN6(
|
|
1093
|
+
reductionFactor = new BN6(MAX_BASIS_POINT * (1 - decayBase));
|
|
1078
1094
|
}
|
|
1079
1095
|
return {
|
|
1080
1096
|
cliffFeeNumerator: maxBaseFeeNumerator,
|
|
@@ -1086,16 +1102,16 @@ function getFeeSchedulerParams(startingBaseFeeBps, endingBaseFeeBps, baseFeeMode
|
|
|
1086
1102
|
}
|
|
1087
1103
|
function calculateFeeSchedulerEndingBaseFeeBps(cliffFeeNumerator, numberOfPeriod, periodFrequency, reductionFactor, baseFeeMode) {
|
|
1088
1104
|
if (numberOfPeriod === 0 || periodFrequency === 0) {
|
|
1089
|
-
return cliffFeeNumerator / FEE_DENOMINATOR *
|
|
1105
|
+
return cliffFeeNumerator / FEE_DENOMINATOR * MAX_BASIS_POINT;
|
|
1090
1106
|
}
|
|
1091
1107
|
let baseFeeNumerator;
|
|
1092
1108
|
if (baseFeeMode == 0 /* FeeSchedulerLinear */) {
|
|
1093
1109
|
baseFeeNumerator = cliffFeeNumerator - numberOfPeriod * reductionFactor;
|
|
1094
1110
|
} else {
|
|
1095
|
-
const decayRate = 1 - reductionFactor /
|
|
1111
|
+
const decayRate = 1 - reductionFactor / MAX_BASIS_POINT;
|
|
1096
1112
|
baseFeeNumerator = cliffFeeNumerator * Math.pow(decayRate, numberOfPeriod);
|
|
1097
1113
|
}
|
|
1098
|
-
return Math.max(0, baseFeeNumerator / FEE_DENOMINATOR *
|
|
1114
|
+
return Math.max(0, baseFeeNumerator / FEE_DENOMINATOR * MAX_BASIS_POINT);
|
|
1099
1115
|
}
|
|
1100
1116
|
function getRateLimiterParams(baseFeeBps, feeIncrementBps, referenceAmount, maxLimiterDuration, tokenQuoteDecimal, activationType) {
|
|
1101
1117
|
const cliffFeeNumerator = bpsToFeeNumerator(baseFeeBps);
|
|
@@ -1108,6 +1124,11 @@ function getRateLimiterParams(baseFeeBps, feeIncrementBps, referenceAmount, maxL
|
|
|
1108
1124
|
`Base fee (${baseFeeBps} bps) exceeds maximum allowed value of ${MAX_FEE_BPS} bps`
|
|
1109
1125
|
);
|
|
1110
1126
|
}
|
|
1127
|
+
if (baseFeeBps < MIN_FEE_BPS) {
|
|
1128
|
+
throw new Error(
|
|
1129
|
+
`Base fee (${baseFeeBps} bps) is less than minimum allowed value of ${MIN_FEE_BPS} bps`
|
|
1130
|
+
);
|
|
1131
|
+
}
|
|
1111
1132
|
if (feeIncrementBps > MAX_FEE_BPS) {
|
|
1112
1133
|
throw new Error(
|
|
1113
1134
|
`Fee increment (${feeIncrementBps} bps) exceeds maximum allowed value of ${MAX_FEE_BPS} bps`
|
|
@@ -1144,21 +1165,21 @@ function getRateLimiterParams(baseFeeBps, feeIncrementBps, referenceAmount, maxL
|
|
|
1144
1165
|
baseFeeMode: 2 /* RateLimiter */
|
|
1145
1166
|
};
|
|
1146
1167
|
}
|
|
1147
|
-
function getDynamicFeeParams(baseFeeBps,
|
|
1148
|
-
if (
|
|
1168
|
+
function getDynamicFeeParams(baseFeeBps, maxPriceChangePercentage = MAX_PRICE_CHANGE_PERCENTAGE_DEFAULT) {
|
|
1169
|
+
if (maxPriceChangePercentage > MAX_PRICE_CHANGE_PERCENTAGE_DEFAULT) {
|
|
1149
1170
|
throw new Error(
|
|
1150
|
-
`
|
|
1171
|
+
`maxPriceChangePercentage (${maxPriceChangePercentage}%) must be less than or equal to ${MAX_PRICE_CHANGE_PERCENTAGE_DEFAULT}`
|
|
1151
1172
|
);
|
|
1152
1173
|
}
|
|
1153
|
-
const priceRatio =
|
|
1174
|
+
const priceRatio = maxPriceChangePercentage / MAX_BASIS_POINT + 1;
|
|
1154
1175
|
const sqrtPriceRatioQ64 = new BN6(
|
|
1155
1176
|
Decimal2.sqrt(priceRatio.toString()).mul(Decimal2.pow(2, 64)).floor().toFixed()
|
|
1156
1177
|
);
|
|
1157
1178
|
const deltaBinId = sqrtPriceRatioQ64.sub(ONE_Q64).div(BIN_STEP_BPS_U128_DEFAULT).muln(2);
|
|
1158
|
-
const maxVolatilityAccumulator = new BN6(deltaBinId.muln(
|
|
1179
|
+
const maxVolatilityAccumulator = new BN6(deltaBinId.muln(MAX_BASIS_POINT));
|
|
1159
1180
|
const squareVfaBin = maxVolatilityAccumulator.mul(new BN6(BIN_STEP_BPS_DEFAULT)).pow(new BN6(2));
|
|
1160
1181
|
const baseFeeNumerator = new BN6(bpsToFeeNumerator(baseFeeBps));
|
|
1161
|
-
const maxDynamicFeeNumerator = baseFeeNumerator.muln(
|
|
1182
|
+
const maxDynamicFeeNumerator = baseFeeNumerator.muln(maxPriceChangePercentage).divn(100);
|
|
1162
1183
|
const vFee = maxDynamicFeeNumerator.mul(new BN6(1e11)).sub(new BN6(99999999999));
|
|
1163
1184
|
const variableFeeControl = vFee.div(squareVfaBin);
|
|
1164
1185
|
return {
|
|
@@ -1228,6 +1249,69 @@ function getLockedVestingParams(totalLockedVestingAmount, numberOfVestingPeriod,
|
|
|
1228
1249
|
)
|
|
1229
1250
|
};
|
|
1230
1251
|
}
|
|
1252
|
+
var getLiquidityVestingInfoParams = (vestingPercentage, bpsPerPeriod, numberOfPeriods, cliffDurationFromMigrationTime, totalDuration) => {
|
|
1253
|
+
if (vestingPercentage < 0 || vestingPercentage > 100) {
|
|
1254
|
+
throw new Error("vestingPercentage must be between 0 and 100");
|
|
1255
|
+
}
|
|
1256
|
+
if (vestingPercentage === 0) {
|
|
1257
|
+
if (bpsPerPeriod !== 0 || numberOfPeriods !== 0 || cliffDurationFromMigrationTime !== 0 || totalDuration !== 0) {
|
|
1258
|
+
throw new Error(
|
|
1259
|
+
"If vestingPercentage is 0, all other parameters must be 0"
|
|
1260
|
+
);
|
|
1261
|
+
}
|
|
1262
|
+
return {
|
|
1263
|
+
vestingPercentage: 0,
|
|
1264
|
+
bpsPerPeriod: 0,
|
|
1265
|
+
numberOfPeriods: 0,
|
|
1266
|
+
cliffDurationFromMigrationTime: 0,
|
|
1267
|
+
frequency: 0
|
|
1268
|
+
};
|
|
1269
|
+
}
|
|
1270
|
+
if (bpsPerPeriod < 0 || bpsPerPeriod > MAX_BASIS_POINT) {
|
|
1271
|
+
throw new Error(`bpsPerPeriod must be between 0 and ${MAX_BASIS_POINT}`);
|
|
1272
|
+
}
|
|
1273
|
+
if (numberOfPeriods <= 0) {
|
|
1274
|
+
throw new Error(
|
|
1275
|
+
"numberOfPeriods must be greater than zero when vestingPercentage > 0"
|
|
1276
|
+
);
|
|
1277
|
+
}
|
|
1278
|
+
if (cliffDurationFromMigrationTime < 0) {
|
|
1279
|
+
throw new Error("cliffDurationFromMigrationTime must be >= 0");
|
|
1280
|
+
}
|
|
1281
|
+
if (totalDuration <= 0) {
|
|
1282
|
+
throw new Error("totalDuration must be greater than zero");
|
|
1283
|
+
}
|
|
1284
|
+
const frequency = totalDuration / numberOfPeriods;
|
|
1285
|
+
if (frequency <= 0) {
|
|
1286
|
+
throw new Error(
|
|
1287
|
+
"frequency must be greater than zero (totalDuration / numberOfPeriods must be > 0)"
|
|
1288
|
+
);
|
|
1289
|
+
}
|
|
1290
|
+
const totalBps = bpsPerPeriod * numberOfPeriods;
|
|
1291
|
+
if (totalBps > MAX_BASIS_POINT) {
|
|
1292
|
+
throw new Error(
|
|
1293
|
+
`Total BPS (bpsPerPeriod * numberOfPeriods = ${totalBps}) must not exceed ${MAX_BASIS_POINT}`
|
|
1294
|
+
);
|
|
1295
|
+
}
|
|
1296
|
+
const totalVestingDuration = cliffDurationFromMigrationTime + numberOfPeriods * frequency;
|
|
1297
|
+
if (totalVestingDuration > MAX_LOCK_DURATION_IN_SECONDS) {
|
|
1298
|
+
throw new Error(
|
|
1299
|
+
`Total vesting duration (${totalVestingDuration}s) must not exceed ${MAX_LOCK_DURATION_IN_SECONDS}s (2 years)`
|
|
1300
|
+
);
|
|
1301
|
+
}
|
|
1302
|
+
if (cliffDurationFromMigrationTime === 0 && numberOfPeriods === 0) {
|
|
1303
|
+
throw new Error(
|
|
1304
|
+
"If cliffDurationFromMigrationTime is 0, numberOfPeriods must be > 0"
|
|
1305
|
+
);
|
|
1306
|
+
}
|
|
1307
|
+
return {
|
|
1308
|
+
vestingPercentage,
|
|
1309
|
+
bpsPerPeriod,
|
|
1310
|
+
numberOfPeriods,
|
|
1311
|
+
cliffDurationFromMigrationTime,
|
|
1312
|
+
frequency: Math.round(frequency)
|
|
1313
|
+
};
|
|
1314
|
+
};
|
|
1231
1315
|
var getTwoCurve = (migrationSqrtPrice, midSqrtPrice, initialSqrtPrice, swapAmount, migrationQuoteThreshold) => {
|
|
1232
1316
|
const p0 = new Decimal2(initialSqrtPrice.toString());
|
|
1233
1317
|
const p1 = new Decimal2(midSqrtPrice.toString());
|
|
@@ -1368,8 +1452,72 @@ async function prepareSwapAmountParam(amount, mintAddress, connection) {
|
|
|
1368
1452
|
const mintTokenDecimals = await getTokenDecimals(connection, mintAddress);
|
|
1369
1453
|
return convertToLamports(amount, mintTokenDecimals);
|
|
1370
1454
|
}
|
|
1455
|
+
function getVestingLockedLiquidityBpsAtNSeconds(vestingInfo, nSeconds) {
|
|
1456
|
+
if (!vestingInfo || vestingInfo.vestingPercentage === 0) {
|
|
1457
|
+
return 0;
|
|
1458
|
+
}
|
|
1459
|
+
const totalLiquidity = U128_MAX;
|
|
1460
|
+
const totalVestedLiquidity = totalLiquidity.mul(new BN6(vestingInfo.vestingPercentage)).div(new BN6(100));
|
|
1461
|
+
const bpsPerPeriod = vestingInfo.bpsPerPeriod;
|
|
1462
|
+
const numberOfPeriods = vestingInfo.numberOfPeriods;
|
|
1463
|
+
const frequency = vestingInfo.frequency;
|
|
1464
|
+
const cliffDuration = vestingInfo.cliffDurationFromMigrationTime;
|
|
1465
|
+
const totalBpsAfterCliff = bpsPerPeriod * numberOfPeriods;
|
|
1466
|
+
const totalVestingLiquidityAfterCliff = totalVestedLiquidity.mul(new BN6(totalBpsAfterCliff)).div(new BN6(MAX_BASIS_POINT));
|
|
1467
|
+
let liquidityPerPeriod = new BN6(0);
|
|
1468
|
+
let adjustedFrequency = frequency;
|
|
1469
|
+
let adjustedNumberOfPeriods = numberOfPeriods;
|
|
1470
|
+
let adjustedCliffDuration = cliffDuration;
|
|
1471
|
+
if (numberOfPeriods > 0) {
|
|
1472
|
+
liquidityPerPeriod = totalVestingLiquidityAfterCliff.div(
|
|
1473
|
+
new BN6(numberOfPeriods)
|
|
1474
|
+
);
|
|
1475
|
+
}
|
|
1476
|
+
if (liquidityPerPeriod.isZero()) {
|
|
1477
|
+
adjustedNumberOfPeriods = 0;
|
|
1478
|
+
adjustedFrequency = 0;
|
|
1479
|
+
adjustedCliffDuration = Math.max(cliffDuration, 1);
|
|
1480
|
+
}
|
|
1481
|
+
const cliffUnlockLiquidity = totalVestedLiquidity.sub(
|
|
1482
|
+
liquidityPerPeriod.mul(new BN6(adjustedNumberOfPeriods))
|
|
1483
|
+
);
|
|
1484
|
+
const cliffPoint = new BN6(adjustedCliffDuration);
|
|
1485
|
+
const currentPoint = new BN6(nSeconds);
|
|
1486
|
+
let unlockedLiquidity = new BN6(0);
|
|
1487
|
+
if (currentPoint.gte(cliffPoint)) {
|
|
1488
|
+
unlockedLiquidity = cliffUnlockLiquidity;
|
|
1489
|
+
if (adjustedFrequency > 0 && adjustedNumberOfPeriods > 0) {
|
|
1490
|
+
const timeAfterCliff = currentPoint.sub(cliffPoint);
|
|
1491
|
+
const periodsElapsed = timeAfterCliff.div(new BN6(adjustedFrequency)).toNumber();
|
|
1492
|
+
const actualPeriodsElapsed = Math.min(
|
|
1493
|
+
periodsElapsed,
|
|
1494
|
+
adjustedNumberOfPeriods
|
|
1495
|
+
);
|
|
1496
|
+
unlockedLiquidity = unlockedLiquidity.add(
|
|
1497
|
+
liquidityPerPeriod.mul(new BN6(actualPeriodsElapsed))
|
|
1498
|
+
);
|
|
1499
|
+
}
|
|
1500
|
+
}
|
|
1501
|
+
const lockedLiquidity = totalVestedLiquidity.sub(unlockedLiquidity);
|
|
1502
|
+
const liquidityLockedBps = lockedLiquidity.mul(new BN6(MAX_BASIS_POINT)).div(totalLiquidity);
|
|
1503
|
+
return liquidityLockedBps.toNumber();
|
|
1504
|
+
}
|
|
1505
|
+
function calculateLockedLiquidityBpsAtTime(partnerPermanentLockedLiquidityPercentage, creatorPermanentLockedLiquidityPercentage, partnerLiquidityVestingInfo, creatorLiquidityVestingInfo, elapsedSeconds) {
|
|
1506
|
+
const partnerVestedLockedLiquidityBps = getVestingLockedLiquidityBpsAtNSeconds(
|
|
1507
|
+
partnerLiquidityVestingInfo,
|
|
1508
|
+
elapsedSeconds
|
|
1509
|
+
);
|
|
1510
|
+
const creatorVestedLockedLiquidityBps = getVestingLockedLiquidityBpsAtNSeconds(
|
|
1511
|
+
creatorLiquidityVestingInfo,
|
|
1512
|
+
elapsedSeconds
|
|
1513
|
+
);
|
|
1514
|
+
const partnerPermanentLockedLiquidityBps = partnerPermanentLockedLiquidityPercentage * 100;
|
|
1515
|
+
const creatorPermanentLockedLiquidityBps = creatorPermanentLockedLiquidityPercentage * 100;
|
|
1516
|
+
const totalLockedLiquidityBpsAtNSeconds = partnerVestedLockedLiquidityBps + partnerPermanentLockedLiquidityBps + creatorVestedLockedLiquidityBps + creatorPermanentLockedLiquidityBps;
|
|
1517
|
+
return totalLockedLiquidityBpsAtNSeconds;
|
|
1518
|
+
}
|
|
1371
1519
|
|
|
1372
|
-
// src/helpers/
|
|
1520
|
+
// src/helpers/pda.ts
|
|
1373
1521
|
import { PublicKey as PublicKey5 } from "@solana/web3.js";
|
|
1374
1522
|
var SEED = Object.freeze({
|
|
1375
1523
|
POOL_AUTHORITY: "pool_authority",
|
|
@@ -1628,6 +1776,12 @@ function deriveBaseKeyForLocker(virtualPool) {
|
|
|
1628
1776
|
DYNAMIC_BONDING_CURVE_PROGRAM_ID
|
|
1629
1777
|
)[0];
|
|
1630
1778
|
}
|
|
1779
|
+
function deriveDammV2PositionVestingAccount(position) {
|
|
1780
|
+
return PublicKey5.findProgramAddressSync(
|
|
1781
|
+
[Buffer.from("position_vesting"), position.toBuffer()],
|
|
1782
|
+
DYNAMIC_BONDING_CURVE_PROGRAM_ID
|
|
1783
|
+
)[0];
|
|
1784
|
+
}
|
|
1631
1785
|
|
|
1632
1786
|
// src/helpers/validation.ts
|
|
1633
1787
|
import BN13 from "bn.js";
|
|
@@ -1893,7 +2047,7 @@ function getFeeNumeratorOnExponentialFeeScheduler(cliffFeeNumerator, reductionFa
|
|
|
1893
2047
|
if (period === 0) {
|
|
1894
2048
|
return cliffFeeNumerator;
|
|
1895
2049
|
}
|
|
1896
|
-
const basisPointMax = new BN8(
|
|
2050
|
+
const basisPointMax = new BN8(MAX_BASIS_POINT);
|
|
1897
2051
|
const ONE_Q642 = new BN8(1).shln(64);
|
|
1898
2052
|
const bps = SafeMath.div(SafeMath.shl(reductionFactor, 64), basisPointMax);
|
|
1899
2053
|
const base = SafeMath.sub(ONE_Q642, bps);
|
|
@@ -1979,7 +2133,7 @@ var FeeScheduler = class {
|
|
|
1979
2133
|
this.reductionFactor = reductionFactor;
|
|
1980
2134
|
this.feeSchedulerMode = feeSchedulerMode;
|
|
1981
2135
|
}
|
|
1982
|
-
validate(
|
|
2136
|
+
validate() {
|
|
1983
2137
|
return validateFeeScheduler(
|
|
1984
2138
|
this.numberOfPeriod,
|
|
1985
2139
|
this.periodFrequency,
|
|
@@ -2072,13 +2226,13 @@ function toNumerator(bps, feeDenominator) {
|
|
|
2072
2226
|
const numerator = mulDiv(
|
|
2073
2227
|
bps,
|
|
2074
2228
|
feeDenominator,
|
|
2075
|
-
new BN11(
|
|
2229
|
+
new BN11(MAX_BASIS_POINT),
|
|
2076
2230
|
1 /* Down */
|
|
2077
2231
|
);
|
|
2078
2232
|
return numerator;
|
|
2079
2233
|
} catch (error) {
|
|
2080
2234
|
throw new Error(
|
|
2081
|
-
|
|
2235
|
+
`Type cast failed or calculation overflow in toNumerator ${error}`
|
|
2082
2236
|
);
|
|
2083
2237
|
}
|
|
2084
2238
|
}
|
|
@@ -2168,14 +2322,14 @@ function getFeeOnAmount(tradeFeeNumerator, amount, poolFees, hasReferral) {
|
|
|
2168
2322
|
);
|
|
2169
2323
|
const protocolFee = mulDiv(
|
|
2170
2324
|
tradingFee,
|
|
2171
|
-
new BN11(
|
|
2325
|
+
new BN11(PROTOCOL_FEE_PERCENT),
|
|
2172
2326
|
new BN11(100),
|
|
2173
2327
|
1 /* Down */
|
|
2174
2328
|
);
|
|
2175
2329
|
const updatedTradingFee = SafeMath.sub(tradingFee, protocolFee);
|
|
2176
2330
|
const referralFee = hasReferral ? mulDiv(
|
|
2177
2331
|
protocolFee,
|
|
2178
|
-
new BN11(
|
|
2332
|
+
new BN11(HOST_FEE_PERCENT),
|
|
2179
2333
|
new BN11(100),
|
|
2180
2334
|
1 /* Down */
|
|
2181
2335
|
) : new BN11(0);
|
|
@@ -2210,14 +2364,14 @@ function getIncludedFeeAmount(tradeFeeNumerator, excludedFeeAmount) {
|
|
|
2210
2364
|
function splitFees(poolFees, feeAmount, hasReferral) {
|
|
2211
2365
|
const protocolFee = mulDiv(
|
|
2212
2366
|
feeAmount,
|
|
2213
|
-
new BN11(
|
|
2367
|
+
new BN11(PROTOCOL_FEE_PERCENT),
|
|
2214
2368
|
new BN11(100),
|
|
2215
2369
|
1 /* Down */
|
|
2216
2370
|
);
|
|
2217
2371
|
const tradingFee = SafeMath.sub(feeAmount, protocolFee);
|
|
2218
2372
|
const referralFee = hasReferral ? mulDiv(
|
|
2219
2373
|
protocolFee,
|
|
2220
|
-
new BN11(
|
|
2374
|
+
new BN11(HOST_FEE_PERCENT),
|
|
2221
2375
|
new BN11(100),
|
|
2222
2376
|
1 /* Down */
|
|
2223
2377
|
) : new BN11(0);
|
|
@@ -2472,6 +2626,13 @@ function calculateBaseToQuoteFromAmountIn(configState, currentSqrtPrice, amountI
|
|
|
2472
2626
|
amountLeft: new BN12(0)
|
|
2473
2627
|
};
|
|
2474
2628
|
}
|
|
2629
|
+
if (currentSqrtPrice.eq(configState.sqrtStartPrice)) {
|
|
2630
|
+
return {
|
|
2631
|
+
outputAmount: new BN12(0),
|
|
2632
|
+
nextSqrtPrice: currentSqrtPrice,
|
|
2633
|
+
amountLeft: amountIn
|
|
2634
|
+
};
|
|
2635
|
+
}
|
|
2475
2636
|
let totalOutputAmount = new BN12(0);
|
|
2476
2637
|
let currentSqrtPriceLocal = currentSqrtPrice;
|
|
2477
2638
|
let amountLeft = amountIn;
|
|
@@ -2524,12 +2685,24 @@ function calculateBaseToQuoteFromAmountIn(configState, currentSqrtPrice, amountI
|
|
|
2524
2685
|
}
|
|
2525
2686
|
}
|
|
2526
2687
|
if (!amountLeft.isZero()) {
|
|
2527
|
-
|
|
2688
|
+
let nextSqrtPrice = getNextSqrtPriceFromInput(
|
|
2528
2689
|
currentSqrtPriceLocal,
|
|
2529
2690
|
configState.curve[0].liquidity,
|
|
2530
2691
|
amountLeft,
|
|
2531
2692
|
true
|
|
2532
2693
|
);
|
|
2694
|
+
if (nextSqrtPrice.lt(configState.sqrtStartPrice)) {
|
|
2695
|
+
nextSqrtPrice = configState.sqrtStartPrice;
|
|
2696
|
+
const amountIn2 = getDeltaAmountBaseUnsigned(
|
|
2697
|
+
nextSqrtPrice,
|
|
2698
|
+
currentSqrtPriceLocal,
|
|
2699
|
+
configState.curve[0].liquidity,
|
|
2700
|
+
0 /* Up */
|
|
2701
|
+
);
|
|
2702
|
+
amountLeft = SafeMath.sub(amountLeft, amountIn2);
|
|
2703
|
+
} else {
|
|
2704
|
+
amountLeft = new BN12(0);
|
|
2705
|
+
}
|
|
2533
2706
|
const outputAmount = getDeltaAmountQuoteUnsigned(
|
|
2534
2707
|
nextSqrtPrice,
|
|
2535
2708
|
currentSqrtPriceLocal,
|
|
@@ -2540,9 +2713,9 @@ function calculateBaseToQuoteFromAmountIn(configState, currentSqrtPrice, amountI
|
|
|
2540
2713
|
currentSqrtPriceLocal = nextSqrtPrice;
|
|
2541
2714
|
}
|
|
2542
2715
|
return {
|
|
2716
|
+
amountLeft,
|
|
2543
2717
|
outputAmount: totalOutputAmount,
|
|
2544
|
-
nextSqrtPrice: currentSqrtPriceLocal
|
|
2545
|
-
amountLeft: new BN12(0)
|
|
2718
|
+
nextSqrtPrice: currentSqrtPriceLocal
|
|
2546
2719
|
};
|
|
2547
2720
|
}
|
|
2548
2721
|
function calculateQuoteToBaseFromAmountIn(configState, currentSqrtPrice, amountIn, stopSqrtPrice) {
|
|
@@ -3051,8 +3224,8 @@ function validateMigrationFeeOption(migrationFeeOption, migrationOption) {
|
|
|
3051
3224
|
function validateTokenDecimals(tokenDecimal) {
|
|
3052
3225
|
return tokenDecimal >= 6 /* SIX */ && tokenDecimal <= 9 /* NINE */;
|
|
3053
3226
|
}
|
|
3054
|
-
function validateLPPercentages(
|
|
3055
|
-
const totalLPPercentage =
|
|
3227
|
+
function validateLPPercentages(partnerLiquidityPercentage, partnerPermanentLockedLiquidityPercentage, creatorLiquidityPercentage, creatorPermanentLockedLiquidityPercentage, partnerVestingPercentage, creatorVestingPercentage) {
|
|
3228
|
+
const totalLPPercentage = partnerLiquidityPercentage + partnerPermanentLockedLiquidityPercentage + creatorLiquidityPercentage + creatorPermanentLockedLiquidityPercentage + partnerVestingPercentage + creatorVestingPercentage;
|
|
3056
3229
|
return totalLPPercentage === 100;
|
|
3057
3230
|
}
|
|
3058
3231
|
function validateCurve(curve, sqrtStartPrice) {
|
|
@@ -3112,6 +3285,35 @@ function validateTokenUpdateAuthorityOptions(option) {
|
|
|
3112
3285
|
4 /* PartnerUpdateAndMintAuthority */
|
|
3113
3286
|
].includes(option);
|
|
3114
3287
|
}
|
|
3288
|
+
function validatePoolCreationFee(poolCreationFee) {
|
|
3289
|
+
if (poolCreationFee.eq(new BN13(0))) {
|
|
3290
|
+
return true;
|
|
3291
|
+
}
|
|
3292
|
+
return poolCreationFee.gte(new BN13(MIN_POOL_CREATION_FEE)) && poolCreationFee.lte(new BN13(MAX_POOL_CREATION_FEE));
|
|
3293
|
+
}
|
|
3294
|
+
function validateLiquidityVestingInfo(vestingInfo) {
|
|
3295
|
+
const isZero = vestingInfo.vestingPercentage === 0 && vestingInfo.bpsPerPeriod === 0 && vestingInfo.numberOfPeriods === 0 && vestingInfo.cliffDurationFromMigrationTime === 0 && vestingInfo.frequency === 0;
|
|
3296
|
+
if (isZero) {
|
|
3297
|
+
return true;
|
|
3298
|
+
}
|
|
3299
|
+
if (vestingInfo.vestingPercentage < 0 || vestingInfo.vestingPercentage > 100) {
|
|
3300
|
+
return false;
|
|
3301
|
+
}
|
|
3302
|
+
if (vestingInfo.vestingPercentage > 0 && vestingInfo.frequency === 0) {
|
|
3303
|
+
return false;
|
|
3304
|
+
}
|
|
3305
|
+
return true;
|
|
3306
|
+
}
|
|
3307
|
+
function validateMinimumLockedLiquidity(partnerPermanentLockedLiquidityPercentage, creatorPermanentLockedLiquidityPercentage, partnerLiquidityVestingInfo, creatorLiquidityVestingInfo) {
|
|
3308
|
+
const lockedBpsAtDay1 = calculateLockedLiquidityBpsAtTime(
|
|
3309
|
+
partnerPermanentLockedLiquidityPercentage,
|
|
3310
|
+
creatorPermanentLockedLiquidityPercentage,
|
|
3311
|
+
partnerLiquidityVestingInfo,
|
|
3312
|
+
creatorLiquidityVestingInfo,
|
|
3313
|
+
SECONDS_PER_DAY
|
|
3314
|
+
);
|
|
3315
|
+
return lockedBpsAtDay1 >= MIN_LOCKED_LIQUIDITY_BPS;
|
|
3316
|
+
}
|
|
3115
3317
|
function validateMigratedPoolFee(migratedPoolFee, migrationOption, migrationFeeOption) {
|
|
3116
3318
|
const isEmpty = () => {
|
|
3117
3319
|
return migratedPoolFee.collectFeeMode === 0 && migratedPoolFee.dynamicFee === 0 && migratedPoolFee.poolFeeBps === 0;
|
|
@@ -3175,17 +3377,72 @@ function validateConfigParameters(configParam) {
|
|
|
3175
3377
|
if (!validateMigrationFee(configParam.migrationFee)) {
|
|
3176
3378
|
throw new Error("Invalid migration fee");
|
|
3177
3379
|
}
|
|
3380
|
+
if (configParam.creatorTradingFeePercentage < 0 || configParam.creatorTradingFeePercentage > 100) {
|
|
3381
|
+
throw new Error(
|
|
3382
|
+
"Creator trading fee percentage must be between 0 and 100"
|
|
3383
|
+
);
|
|
3384
|
+
}
|
|
3178
3385
|
if (!validateTokenDecimals(configParam.tokenDecimal)) {
|
|
3179
3386
|
throw new Error("Token decimal must be between 6 and 9");
|
|
3180
3387
|
}
|
|
3388
|
+
const partnerVestingPercentage = configParam.partnerLiquidityVestingInfo?.vestingPercentage ?? 0;
|
|
3389
|
+
const creatorVestingPercentage = configParam.creatorLiquidityVestingInfo?.vestingPercentage ?? 0;
|
|
3181
3390
|
if (!validateLPPercentages(
|
|
3182
|
-
configParam.
|
|
3183
|
-
configParam.
|
|
3184
|
-
configParam.
|
|
3185
|
-
configParam.
|
|
3391
|
+
configParam.partnerLiquidityPercentage,
|
|
3392
|
+
configParam.partnerPermanentLockedLiquidityPercentage,
|
|
3393
|
+
configParam.creatorLiquidityPercentage,
|
|
3394
|
+
configParam.creatorPermanentLockedLiquidityPercentage,
|
|
3395
|
+
partnerVestingPercentage,
|
|
3396
|
+
creatorVestingPercentage
|
|
3186
3397
|
)) {
|
|
3187
3398
|
throw new Error("Sum of LP percentages must equal 100");
|
|
3188
3399
|
}
|
|
3400
|
+
if (!validatePoolCreationFee(configParam.poolCreationFee)) {
|
|
3401
|
+
throw new Error(
|
|
3402
|
+
`Pool creation fee must be 0 or between ${MIN_POOL_CREATION_FEE} and ${MAX_POOL_CREATION_FEE} lamports`
|
|
3403
|
+
);
|
|
3404
|
+
}
|
|
3405
|
+
if (configParam.migrationOption === 0 /* MET_DAMM */) {
|
|
3406
|
+
const isPartnerVestingZero = !configParam.partnerLiquidityVestingInfo || configParam.partnerLiquidityVestingInfo.vestingPercentage === 0 && configParam.partnerLiquidityVestingInfo.bpsPerPeriod === 0 && configParam.partnerLiquidityVestingInfo.numberOfPeriods === 0 && configParam.partnerLiquidityVestingInfo.cliffDurationFromMigrationTime === 0 && configParam.partnerLiquidityVestingInfo.frequency === 0;
|
|
3407
|
+
const isCreatorVestingZero = !configParam.creatorLiquidityVestingInfo || configParam.creatorLiquidityVestingInfo.vestingPercentage === 0 && configParam.creatorLiquidityVestingInfo.bpsPerPeriod === 0 && configParam.creatorLiquidityVestingInfo.numberOfPeriods === 0 && configParam.creatorLiquidityVestingInfo.cliffDurationFromMigrationTime === 0 && configParam.creatorLiquidityVestingInfo.frequency === 0;
|
|
3408
|
+
if (!isPartnerVestingZero || !isCreatorVestingZero) {
|
|
3409
|
+
throw new Error(
|
|
3410
|
+
"Liquidity vesting is not supported for MeteoraDamm migration"
|
|
3411
|
+
);
|
|
3412
|
+
}
|
|
3413
|
+
} else if (configParam.migrationOption === 1 /* MET_DAMM_V2 */) {
|
|
3414
|
+
if (configParam.partnerLiquidityVestingInfo) {
|
|
3415
|
+
if (!validateLiquidityVestingInfo(
|
|
3416
|
+
configParam.partnerLiquidityVestingInfo
|
|
3417
|
+
)) {
|
|
3418
|
+
throw new Error("Invalid partner liquidity vesting info");
|
|
3419
|
+
}
|
|
3420
|
+
}
|
|
3421
|
+
if (configParam.creatorLiquidityVestingInfo) {
|
|
3422
|
+
if (!validateLiquidityVestingInfo(
|
|
3423
|
+
configParam.creatorLiquidityVestingInfo
|
|
3424
|
+
)) {
|
|
3425
|
+
throw new Error("Invalid creator liquidity vesting info");
|
|
3426
|
+
}
|
|
3427
|
+
}
|
|
3428
|
+
}
|
|
3429
|
+
if (!validateMinimumLockedLiquidity(
|
|
3430
|
+
configParam.partnerPermanentLockedLiquidityPercentage,
|
|
3431
|
+
configParam.creatorPermanentLockedLiquidityPercentage,
|
|
3432
|
+
configParam.partnerLiquidityVestingInfo,
|
|
3433
|
+
configParam.creatorLiquidityVestingInfo
|
|
3434
|
+
)) {
|
|
3435
|
+
const lockedBpsAtDay1 = calculateLockedLiquidityBpsAtTime(
|
|
3436
|
+
configParam.partnerPermanentLockedLiquidityPercentage,
|
|
3437
|
+
configParam.creatorPermanentLockedLiquidityPercentage,
|
|
3438
|
+
configParam.partnerLiquidityVestingInfo,
|
|
3439
|
+
configParam.creatorLiquidityVestingInfo,
|
|
3440
|
+
SECONDS_PER_DAY
|
|
3441
|
+
);
|
|
3442
|
+
throw new Error(
|
|
3443
|
+
`Invalid migration locked liquidity. At least ${MIN_LOCKED_LIQUIDITY_BPS} BPS (10%) must be locked at day 1. Current locked liquidity at day 1: ${lockedBpsAtDay1} BPS. Consider increasing permanent locked liquidity percentage or extending vesting duration/cliff.`
|
|
3444
|
+
);
|
|
3445
|
+
}
|
|
3189
3446
|
if (configParam.migrationQuoteThreshold.lte(new BN13(0))) {
|
|
3190
3447
|
throw new Error("Migration quote threshold must be greater than 0");
|
|
3191
3448
|
}
|
|
@@ -3215,7 +3472,7 @@ function validateConfigParameters(configParam) {
|
|
|
3215
3472
|
throw new Error("Invalid vesting parameters");
|
|
3216
3473
|
}
|
|
3217
3474
|
} catch (error) {
|
|
3218
|
-
throw new Error(
|
|
3475
|
+
throw new Error(`Invalid vesting parameters ${error}`);
|
|
3219
3476
|
}
|
|
3220
3477
|
}
|
|
3221
3478
|
if (configParam.tokenSupply) {
|
|
@@ -3280,7 +3537,7 @@ async function validateBalance(connection, owner, inputMint, amountIn, inputToke
|
|
|
3280
3537
|
}
|
|
3281
3538
|
} catch (error) {
|
|
3282
3539
|
throw new Error(
|
|
3283
|
-
`Failed to fetch token balance or token account doesn't exist`
|
|
3540
|
+
`Failed to fetch token balance or token account doesn't exist ${error}`
|
|
3284
3541
|
);
|
|
3285
3542
|
}
|
|
3286
3543
|
}
|
|
@@ -3317,26 +3574,30 @@ import BN14 from "bn.js";
|
|
|
3317
3574
|
function buildCurve(buildCurveParam) {
|
|
3318
3575
|
const {
|
|
3319
3576
|
totalTokenSupply,
|
|
3320
|
-
|
|
3321
|
-
migrationQuoteThreshold,
|
|
3322
|
-
migrationOption,
|
|
3577
|
+
tokenType,
|
|
3323
3578
|
tokenBaseDecimal,
|
|
3324
3579
|
tokenQuoteDecimal,
|
|
3580
|
+
tokenUpdateAuthority,
|
|
3581
|
+
lockedVestingParams,
|
|
3582
|
+
leftover,
|
|
3583
|
+
baseFeeParams,
|
|
3325
3584
|
dynamicFeeEnabled,
|
|
3326
3585
|
activationType,
|
|
3327
3586
|
collectFeeMode,
|
|
3328
|
-
migrationFeeOption,
|
|
3329
|
-
tokenType,
|
|
3330
|
-
partnerLpPercentage,
|
|
3331
|
-
creatorLpPercentage,
|
|
3332
|
-
partnerLockedLpPercentage,
|
|
3333
|
-
creatorLockedLpPercentage,
|
|
3334
3587
|
creatorTradingFeePercentage,
|
|
3335
|
-
|
|
3336
|
-
|
|
3588
|
+
poolCreationFee,
|
|
3589
|
+
migrationOption,
|
|
3590
|
+
migrationFeeOption,
|
|
3337
3591
|
migrationFee,
|
|
3338
|
-
|
|
3339
|
-
|
|
3592
|
+
partnerPermanentLockedLiquidityPercentage,
|
|
3593
|
+
partnerLiquidityPercentage,
|
|
3594
|
+
creatorPermanentLockedLiquidityPercentage,
|
|
3595
|
+
creatorLiquidityPercentage,
|
|
3596
|
+
partnerLiquidityVestingInfoParams,
|
|
3597
|
+
creatorLiquidityVestingInfoParams,
|
|
3598
|
+
migratedPoolFee,
|
|
3599
|
+
percentageSupplyOnMigration,
|
|
3600
|
+
migrationQuoteThreshold
|
|
3340
3601
|
} = buildCurveParam;
|
|
3341
3602
|
const baseFee = getBaseFeeParams(
|
|
3342
3603
|
baseFeeParams,
|
|
@@ -3349,7 +3610,7 @@ function buildCurve(buildCurveParam) {
|
|
|
3349
3610
|
cliffUnlockAmount,
|
|
3350
3611
|
totalVestingDuration,
|
|
3351
3612
|
cliffDurationFromMigrationTime
|
|
3352
|
-
} =
|
|
3613
|
+
} = lockedVestingParams;
|
|
3353
3614
|
const lockedVesting = getLockedVestingParams(
|
|
3354
3615
|
totalLockedVestingAmount,
|
|
3355
3616
|
numberOfVestingPeriod,
|
|
@@ -3358,6 +3619,40 @@ function buildCurve(buildCurveParam) {
|
|
|
3358
3619
|
cliffDurationFromMigrationTime,
|
|
3359
3620
|
tokenBaseDecimal
|
|
3360
3621
|
);
|
|
3622
|
+
const partnerVestingParams = partnerLiquidityVestingInfoParams ?? DEFAULT_LIQUIDITY_VESTING_INFO_PARAMS;
|
|
3623
|
+
const {
|
|
3624
|
+
vestingPercentage: partnerVestingPercentage,
|
|
3625
|
+
bpsPerPeriod: partnerBpsPerPeriod,
|
|
3626
|
+
numberOfPeriods: partnerNumberOfPeriods,
|
|
3627
|
+
cliffDurationFromMigrationTime: partnerCliffDurationFromMigrationTime,
|
|
3628
|
+
totalDuration: partnerTotalDuration
|
|
3629
|
+
} = partnerVestingParams;
|
|
3630
|
+
const partnerLiquidityVestingInfo = getLiquidityVestingInfoParams(
|
|
3631
|
+
partnerVestingPercentage,
|
|
3632
|
+
partnerBpsPerPeriod,
|
|
3633
|
+
partnerNumberOfPeriods,
|
|
3634
|
+
partnerCliffDurationFromMigrationTime,
|
|
3635
|
+
partnerTotalDuration
|
|
3636
|
+
);
|
|
3637
|
+
const creatorVestingParams = creatorLiquidityVestingInfoParams ?? DEFAULT_LIQUIDITY_VESTING_INFO_PARAMS;
|
|
3638
|
+
const {
|
|
3639
|
+
vestingPercentage: creatorVestingPercentage,
|
|
3640
|
+
bpsPerPeriod: creatorBpsPerPeriod,
|
|
3641
|
+
numberOfPeriods: creatorNumberOfPeriods,
|
|
3642
|
+
cliffDurationFromMigrationTime: creatorCliffDurationFromMigrationTime,
|
|
3643
|
+
totalDuration: creatorTotalDuration
|
|
3644
|
+
} = creatorVestingParams;
|
|
3645
|
+
const creatorLiquidityVestingInfo = getLiquidityVestingInfoParams(
|
|
3646
|
+
creatorVestingPercentage,
|
|
3647
|
+
creatorBpsPerPeriod,
|
|
3648
|
+
creatorNumberOfPeriods,
|
|
3649
|
+
creatorCliffDurationFromMigrationTime,
|
|
3650
|
+
creatorTotalDuration
|
|
3651
|
+
);
|
|
3652
|
+
const poolCreationFeeInLamports = convertToLamports(
|
|
3653
|
+
poolCreationFee,
|
|
3654
|
+
9 /* NINE */
|
|
3655
|
+
);
|
|
3361
3656
|
const migratedPoolFeeParams = getMigratedPoolFeeParams(
|
|
3362
3657
|
migrationOption,
|
|
3363
3658
|
migrationFeeOption,
|
|
@@ -3429,16 +3724,16 @@ function buildCurve(buildCurveParam) {
|
|
|
3429
3724
|
baseFeeParams.baseFeeMode === 2 /* RateLimiter */ ? baseFeeParams.rateLimiterParam.baseFeeBps : baseFeeParams.feeSchedulerParam.endingFeeBps
|
|
3430
3725
|
) : null
|
|
3431
3726
|
},
|
|
3432
|
-
activationType,
|
|
3433
3727
|
collectFeeMode,
|
|
3434
3728
|
migrationOption,
|
|
3729
|
+
activationType,
|
|
3435
3730
|
tokenType,
|
|
3436
3731
|
tokenDecimal: tokenBaseDecimal,
|
|
3732
|
+
partnerLiquidityPercentage,
|
|
3733
|
+
partnerPermanentLockedLiquidityPercentage,
|
|
3734
|
+
creatorLiquidityPercentage,
|
|
3735
|
+
creatorPermanentLockedLiquidityPercentage,
|
|
3437
3736
|
migrationQuoteThreshold: migrationQuoteThresholdInLamport,
|
|
3438
|
-
partnerLpPercentage,
|
|
3439
|
-
creatorLpPercentage,
|
|
3440
|
-
partnerLockedLpPercentage,
|
|
3441
|
-
creatorLockedLpPercentage,
|
|
3442
3737
|
sqrtStartPrice,
|
|
3443
3738
|
lockedVesting,
|
|
3444
3739
|
migrationFeeOption,
|
|
@@ -3454,6 +3749,9 @@ function buildCurve(buildCurveParam) {
|
|
|
3454
3749
|
dynamicFee: migratedPoolFeeParams.dynamicFee,
|
|
3455
3750
|
poolFeeBps: migratedPoolFeeParams.poolFeeBps
|
|
3456
3751
|
},
|
|
3752
|
+
poolCreationFee: poolCreationFeeInLamports,
|
|
3753
|
+
partnerLiquidityVestingInfo,
|
|
3754
|
+
creatorLiquidityVestingInfo,
|
|
3457
3755
|
padding: [],
|
|
3458
3756
|
curve
|
|
3459
3757
|
};
|
|
@@ -3461,12 +3759,13 @@ function buildCurve(buildCurveParam) {
|
|
|
3461
3759
|
}
|
|
3462
3760
|
function buildCurveWithMarketCap(buildCurveWithMarketCapParam) {
|
|
3463
3761
|
const {
|
|
3464
|
-
initialMarketCap,
|
|
3465
|
-
migrationMarketCap,
|
|
3466
3762
|
totalTokenSupply,
|
|
3467
3763
|
tokenBaseDecimal,
|
|
3764
|
+
lockedVestingParams,
|
|
3765
|
+
leftover,
|
|
3468
3766
|
migrationFee,
|
|
3469
|
-
|
|
3767
|
+
initialMarketCap,
|
|
3768
|
+
migrationMarketCap
|
|
3470
3769
|
} = buildCurveWithMarketCapParam;
|
|
3471
3770
|
const {
|
|
3472
3771
|
totalLockedVestingAmount,
|
|
@@ -3474,7 +3773,7 @@ function buildCurveWithMarketCap(buildCurveWithMarketCapParam) {
|
|
|
3474
3773
|
cliffUnlockAmount,
|
|
3475
3774
|
totalVestingDuration,
|
|
3476
3775
|
cliffDurationFromMigrationTime
|
|
3477
|
-
} =
|
|
3776
|
+
} = lockedVestingParams;
|
|
3478
3777
|
const lockedVesting = getLockedVestingParams(
|
|
3479
3778
|
totalLockedVestingAmount,
|
|
3480
3779
|
numberOfVestingPeriod,
|
|
@@ -3516,27 +3815,31 @@ function buildCurveWithMarketCap(buildCurveWithMarketCapParam) {
|
|
|
3516
3815
|
function buildCurveWithTwoSegments(buildCurveWithTwoSegmentsParam) {
|
|
3517
3816
|
const {
|
|
3518
3817
|
totalTokenSupply,
|
|
3519
|
-
|
|
3520
|
-
migrationMarketCap,
|
|
3521
|
-
percentageSupplyOnMigration,
|
|
3522
|
-
migrationOption,
|
|
3818
|
+
tokenType,
|
|
3523
3819
|
tokenBaseDecimal,
|
|
3524
3820
|
tokenQuoteDecimal,
|
|
3525
|
-
|
|
3526
|
-
collectFeeMode,
|
|
3821
|
+
tokenUpdateAuthority,
|
|
3527
3822
|
leftover,
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
creatorLpPercentage,
|
|
3531
|
-
partnerLockedLpPercentage,
|
|
3532
|
-
creatorLockedLpPercentage,
|
|
3533
|
-
activationType,
|
|
3823
|
+
lockedVestingParams,
|
|
3824
|
+
baseFeeParams,
|
|
3534
3825
|
dynamicFeeEnabled,
|
|
3826
|
+
activationType,
|
|
3827
|
+
collectFeeMode,
|
|
3828
|
+
creatorTradingFeePercentage,
|
|
3829
|
+
poolCreationFee,
|
|
3830
|
+
migrationOption,
|
|
3535
3831
|
migrationFeeOption,
|
|
3536
3832
|
migrationFee,
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3833
|
+
partnerPermanentLockedLiquidityPercentage,
|
|
3834
|
+
partnerLiquidityPercentage,
|
|
3835
|
+
creatorPermanentLockedLiquidityPercentage,
|
|
3836
|
+
creatorLiquidityPercentage,
|
|
3837
|
+
partnerLiquidityVestingInfoParams,
|
|
3838
|
+
creatorLiquidityVestingInfoParams,
|
|
3839
|
+
migratedPoolFee,
|
|
3840
|
+
initialMarketCap,
|
|
3841
|
+
migrationMarketCap,
|
|
3842
|
+
percentageSupplyOnMigration
|
|
3540
3843
|
} = buildCurveWithTwoSegmentsParam;
|
|
3541
3844
|
const baseFee = getBaseFeeParams(
|
|
3542
3845
|
baseFeeParams,
|
|
@@ -3549,7 +3852,7 @@ function buildCurveWithTwoSegments(buildCurveWithTwoSegmentsParam) {
|
|
|
3549
3852
|
cliffUnlockAmount,
|
|
3550
3853
|
totalVestingDuration,
|
|
3551
3854
|
cliffDurationFromMigrationTime
|
|
3552
|
-
} =
|
|
3855
|
+
} = lockedVestingParams;
|
|
3553
3856
|
const lockedVesting = getLockedVestingParams(
|
|
3554
3857
|
totalLockedVestingAmount,
|
|
3555
3858
|
numberOfVestingPeriod,
|
|
@@ -3558,6 +3861,40 @@ function buildCurveWithTwoSegments(buildCurveWithTwoSegmentsParam) {
|
|
|
3558
3861
|
cliffDurationFromMigrationTime,
|
|
3559
3862
|
tokenBaseDecimal
|
|
3560
3863
|
);
|
|
3864
|
+
const partnerVestingParams = partnerLiquidityVestingInfoParams ?? DEFAULT_LIQUIDITY_VESTING_INFO_PARAMS;
|
|
3865
|
+
const {
|
|
3866
|
+
vestingPercentage: partnerVestingPercentage,
|
|
3867
|
+
bpsPerPeriod: partnerBpsPerPeriod,
|
|
3868
|
+
numberOfPeriods: partnerNumberOfPeriods,
|
|
3869
|
+
cliffDurationFromMigrationTime: partnerCliffDurationFromMigrationTime,
|
|
3870
|
+
totalDuration: partnerTotalDuration
|
|
3871
|
+
} = partnerVestingParams;
|
|
3872
|
+
const partnerLiquidityVestingInfo = getLiquidityVestingInfoParams(
|
|
3873
|
+
partnerVestingPercentage,
|
|
3874
|
+
partnerBpsPerPeriod,
|
|
3875
|
+
partnerNumberOfPeriods,
|
|
3876
|
+
partnerCliffDurationFromMigrationTime,
|
|
3877
|
+
partnerTotalDuration
|
|
3878
|
+
);
|
|
3879
|
+
const creatorVestingParams = creatorLiquidityVestingInfoParams ?? DEFAULT_LIQUIDITY_VESTING_INFO_PARAMS;
|
|
3880
|
+
const {
|
|
3881
|
+
vestingPercentage: creatorVestingPercentage,
|
|
3882
|
+
bpsPerPeriod: creatorBpsPerPeriod,
|
|
3883
|
+
numberOfPeriods: creatorNumberOfPeriods,
|
|
3884
|
+
cliffDurationFromMigrationTime: creatorCliffDurationFromMigrationTime,
|
|
3885
|
+
totalDuration: creatorTotalDuration
|
|
3886
|
+
} = creatorVestingParams;
|
|
3887
|
+
const creatorLiquidityVestingInfo = getLiquidityVestingInfoParams(
|
|
3888
|
+
creatorVestingPercentage,
|
|
3889
|
+
creatorBpsPerPeriod,
|
|
3890
|
+
creatorNumberOfPeriods,
|
|
3891
|
+
creatorCliffDurationFromMigrationTime,
|
|
3892
|
+
creatorTotalDuration
|
|
3893
|
+
);
|
|
3894
|
+
const poolCreationFeeInLamports = convertToLamports(
|
|
3895
|
+
poolCreationFee,
|
|
3896
|
+
9 /* NINE */
|
|
3897
|
+
);
|
|
3561
3898
|
const migratedPoolFeeParams = getMigratedPoolFeeParams(
|
|
3562
3899
|
migrationOption,
|
|
3563
3900
|
migrationFeeOption,
|
|
@@ -3660,10 +3997,10 @@ function buildCurveWithTwoSegments(buildCurveWithTwoSegmentsParam) {
|
|
|
3660
3997
|
tokenType,
|
|
3661
3998
|
tokenDecimal: tokenBaseDecimal,
|
|
3662
3999
|
migrationQuoteThreshold: migrationQuoteThresholdInLamport,
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
|
|
4000
|
+
partnerLiquidityPercentage,
|
|
4001
|
+
partnerPermanentLockedLiquidityPercentage,
|
|
4002
|
+
creatorLiquidityPercentage,
|
|
4003
|
+
creatorPermanentLockedLiquidityPercentage,
|
|
3667
4004
|
sqrtStartPrice,
|
|
3668
4005
|
lockedVesting,
|
|
3669
4006
|
migrationFeeOption,
|
|
@@ -3677,6 +4014,9 @@ function buildCurveWithTwoSegments(buildCurveWithTwoSegmentsParam) {
|
|
|
3677
4014
|
dynamicFee: migratedPoolFeeParams.dynamicFee,
|
|
3678
4015
|
poolFeeBps: migratedPoolFeeParams.poolFeeBps
|
|
3679
4016
|
},
|
|
4017
|
+
poolCreationFee: poolCreationFeeInLamports,
|
|
4018
|
+
partnerLiquidityVestingInfo,
|
|
4019
|
+
creatorLiquidityVestingInfo,
|
|
3680
4020
|
padding: [],
|
|
3681
4021
|
curve,
|
|
3682
4022
|
tokenUpdateAuthority,
|
|
@@ -3687,28 +4027,32 @@ function buildCurveWithTwoSegments(buildCurveWithTwoSegmentsParam) {
|
|
|
3687
4027
|
function buildCurveWithMidPrice(buildCurveWithMidPriceParam) {
|
|
3688
4028
|
const {
|
|
3689
4029
|
totalTokenSupply,
|
|
3690
|
-
|
|
3691
|
-
migrationMarketCap,
|
|
3692
|
-
midPrice,
|
|
3693
|
-
percentageSupplyOnMigration,
|
|
3694
|
-
migrationOption,
|
|
4030
|
+
tokenType,
|
|
3695
4031
|
tokenBaseDecimal,
|
|
3696
4032
|
tokenQuoteDecimal,
|
|
3697
|
-
|
|
3698
|
-
|
|
4033
|
+
tokenUpdateAuthority,
|
|
4034
|
+
lockedVestingParams,
|
|
3699
4035
|
leftover,
|
|
3700
|
-
|
|
3701
|
-
partnerLpPercentage,
|
|
3702
|
-
creatorLpPercentage,
|
|
3703
|
-
partnerLockedLpPercentage,
|
|
3704
|
-
creatorLockedLpPercentage,
|
|
3705
|
-
activationType,
|
|
4036
|
+
baseFeeParams,
|
|
3706
4037
|
dynamicFeeEnabled,
|
|
4038
|
+
activationType,
|
|
4039
|
+
collectFeeMode,
|
|
4040
|
+
creatorTradingFeePercentage,
|
|
4041
|
+
poolCreationFee,
|
|
4042
|
+
migrationOption,
|
|
3707
4043
|
migrationFeeOption,
|
|
3708
4044
|
migrationFee,
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
4045
|
+
partnerPermanentLockedLiquidityPercentage,
|
|
4046
|
+
partnerLiquidityPercentage,
|
|
4047
|
+
creatorPermanentLockedLiquidityPercentage,
|
|
4048
|
+
creatorLiquidityPercentage,
|
|
4049
|
+
partnerLiquidityVestingInfoParams,
|
|
4050
|
+
creatorLiquidityVestingInfoParams,
|
|
4051
|
+
migratedPoolFee,
|
|
4052
|
+
initialMarketCap,
|
|
4053
|
+
migrationMarketCap,
|
|
4054
|
+
midPrice,
|
|
4055
|
+
percentageSupplyOnMigration
|
|
3712
4056
|
} = buildCurveWithMidPriceParam;
|
|
3713
4057
|
const baseFee = getBaseFeeParams(
|
|
3714
4058
|
baseFeeParams,
|
|
@@ -3721,7 +4065,7 @@ function buildCurveWithMidPrice(buildCurveWithMidPriceParam) {
|
|
|
3721
4065
|
cliffUnlockAmount,
|
|
3722
4066
|
totalVestingDuration,
|
|
3723
4067
|
cliffDurationFromMigrationTime
|
|
3724
|
-
} =
|
|
4068
|
+
} = lockedVestingParams;
|
|
3725
4069
|
const lockedVesting = getLockedVestingParams(
|
|
3726
4070
|
totalLockedVestingAmount,
|
|
3727
4071
|
numberOfVestingPeriod,
|
|
@@ -3730,6 +4074,40 @@ function buildCurveWithMidPrice(buildCurveWithMidPriceParam) {
|
|
|
3730
4074
|
cliffDurationFromMigrationTime,
|
|
3731
4075
|
tokenBaseDecimal
|
|
3732
4076
|
);
|
|
4077
|
+
const partnerVestingParams = partnerLiquidityVestingInfoParams ?? DEFAULT_LIQUIDITY_VESTING_INFO_PARAMS;
|
|
4078
|
+
const {
|
|
4079
|
+
vestingPercentage: partnerVestingPercentage,
|
|
4080
|
+
bpsPerPeriod: partnerBpsPerPeriod,
|
|
4081
|
+
numberOfPeriods: partnerNumberOfPeriods,
|
|
4082
|
+
cliffDurationFromMigrationTime: partnerCliffDurationFromMigrationTime,
|
|
4083
|
+
totalDuration: partnerTotalDuration
|
|
4084
|
+
} = partnerVestingParams;
|
|
4085
|
+
const partnerLiquidityVestingInfo = getLiquidityVestingInfoParams(
|
|
4086
|
+
partnerVestingPercentage,
|
|
4087
|
+
partnerBpsPerPeriod,
|
|
4088
|
+
partnerNumberOfPeriods,
|
|
4089
|
+
partnerCliffDurationFromMigrationTime,
|
|
4090
|
+
partnerTotalDuration
|
|
4091
|
+
);
|
|
4092
|
+
const creatorVestingParams = creatorLiquidityVestingInfoParams ?? DEFAULT_LIQUIDITY_VESTING_INFO_PARAMS;
|
|
4093
|
+
const {
|
|
4094
|
+
vestingPercentage: creatorVestingPercentage,
|
|
4095
|
+
bpsPerPeriod: creatorBpsPerPeriod,
|
|
4096
|
+
numberOfPeriods: creatorNumberOfPeriods,
|
|
4097
|
+
cliffDurationFromMigrationTime: creatorCliffDurationFromMigrationTime,
|
|
4098
|
+
totalDuration: creatorTotalDuration
|
|
4099
|
+
} = creatorVestingParams;
|
|
4100
|
+
const creatorLiquidityVestingInfo = getLiquidityVestingInfoParams(
|
|
4101
|
+
creatorVestingPercentage,
|
|
4102
|
+
creatorBpsPerPeriod,
|
|
4103
|
+
creatorNumberOfPeriods,
|
|
4104
|
+
creatorCliffDurationFromMigrationTime,
|
|
4105
|
+
creatorTotalDuration
|
|
4106
|
+
);
|
|
4107
|
+
const poolCreationFeeInLamports = convertToLamports(
|
|
4108
|
+
poolCreationFee,
|
|
4109
|
+
9 /* NINE */
|
|
4110
|
+
);
|
|
3733
4111
|
const migratedPoolFeeParams = getMigratedPoolFeeParams(
|
|
3734
4112
|
migrationOption,
|
|
3735
4113
|
migrationFeeOption,
|
|
@@ -3819,10 +4197,10 @@ function buildCurveWithMidPrice(buildCurveWithMidPriceParam) {
|
|
|
3819
4197
|
tokenType,
|
|
3820
4198
|
tokenDecimal: tokenBaseDecimal,
|
|
3821
4199
|
migrationQuoteThreshold: migrationQuoteThresholdInLamport,
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
4200
|
+
partnerLiquidityPercentage,
|
|
4201
|
+
partnerPermanentLockedLiquidityPercentage,
|
|
4202
|
+
creatorLiquidityPercentage,
|
|
4203
|
+
creatorPermanentLockedLiquidityPercentage,
|
|
3826
4204
|
sqrtStartPrice,
|
|
3827
4205
|
lockedVesting,
|
|
3828
4206
|
migrationFeeOption,
|
|
@@ -3836,6 +4214,9 @@ function buildCurveWithMidPrice(buildCurveWithMidPriceParam) {
|
|
|
3836
4214
|
dynamicFee: migratedPoolFeeParams.dynamicFee,
|
|
3837
4215
|
poolFeeBps: migratedPoolFeeParams.poolFeeBps
|
|
3838
4216
|
},
|
|
4217
|
+
poolCreationFee: poolCreationFeeInLamports,
|
|
4218
|
+
partnerLiquidityVestingInfo,
|
|
4219
|
+
creatorLiquidityVestingInfo,
|
|
3839
4220
|
padding: [],
|
|
3840
4221
|
curve,
|
|
3841
4222
|
tokenUpdateAuthority,
|
|
@@ -3846,27 +4227,31 @@ function buildCurveWithMidPrice(buildCurveWithMidPriceParam) {
|
|
|
3846
4227
|
function buildCurveWithLiquidityWeights(buildCurveWithLiquidityWeightsParam) {
|
|
3847
4228
|
const {
|
|
3848
4229
|
totalTokenSupply,
|
|
3849
|
-
|
|
4230
|
+
tokenType,
|
|
3850
4231
|
tokenBaseDecimal,
|
|
3851
4232
|
tokenQuoteDecimal,
|
|
4233
|
+
tokenUpdateAuthority,
|
|
4234
|
+
lockedVestingParams,
|
|
4235
|
+
leftover,
|
|
4236
|
+
baseFeeParams,
|
|
3852
4237
|
dynamicFeeEnabled,
|
|
3853
4238
|
activationType,
|
|
3854
4239
|
collectFeeMode,
|
|
3855
|
-
migrationFeeOption,
|
|
3856
|
-
tokenType,
|
|
3857
|
-
partnerLpPercentage,
|
|
3858
|
-
creatorLpPercentage,
|
|
3859
|
-
partnerLockedLpPercentage,
|
|
3860
|
-
creatorLockedLpPercentage,
|
|
3861
4240
|
creatorTradingFeePercentage,
|
|
3862
|
-
|
|
4241
|
+
poolCreationFee,
|
|
4242
|
+
migrationOption,
|
|
4243
|
+
migrationFeeOption,
|
|
4244
|
+
migrationFee,
|
|
4245
|
+
partnerPermanentLockedLiquidityPercentage,
|
|
4246
|
+
partnerLiquidityPercentage,
|
|
4247
|
+
creatorPermanentLockedLiquidityPercentage,
|
|
4248
|
+
creatorLiquidityPercentage,
|
|
4249
|
+
partnerLiquidityVestingInfoParams,
|
|
4250
|
+
creatorLiquidityVestingInfoParams,
|
|
4251
|
+
migratedPoolFee,
|
|
3863
4252
|
initialMarketCap,
|
|
3864
4253
|
migrationMarketCap,
|
|
3865
|
-
liquidityWeights
|
|
3866
|
-
migrationFee,
|
|
3867
|
-
tokenUpdateAuthority,
|
|
3868
|
-
baseFeeParams,
|
|
3869
|
-
migratedPoolFee
|
|
4254
|
+
liquidityWeights
|
|
3870
4255
|
} = buildCurveWithLiquidityWeightsParam;
|
|
3871
4256
|
const baseFee = getBaseFeeParams(
|
|
3872
4257
|
baseFeeParams,
|
|
@@ -3879,7 +4264,7 @@ function buildCurveWithLiquidityWeights(buildCurveWithLiquidityWeightsParam) {
|
|
|
3879
4264
|
cliffUnlockAmount,
|
|
3880
4265
|
totalVestingDuration,
|
|
3881
4266
|
cliffDurationFromMigrationTime
|
|
3882
|
-
} =
|
|
4267
|
+
} = lockedVestingParams;
|
|
3883
4268
|
const lockedVesting = getLockedVestingParams(
|
|
3884
4269
|
totalLockedVestingAmount,
|
|
3885
4270
|
numberOfVestingPeriod,
|
|
@@ -3888,6 +4273,40 @@ function buildCurveWithLiquidityWeights(buildCurveWithLiquidityWeightsParam) {
|
|
|
3888
4273
|
cliffDurationFromMigrationTime,
|
|
3889
4274
|
tokenBaseDecimal
|
|
3890
4275
|
);
|
|
4276
|
+
const partnerVestingParams = partnerLiquidityVestingInfoParams ?? DEFAULT_LIQUIDITY_VESTING_INFO_PARAMS;
|
|
4277
|
+
const {
|
|
4278
|
+
vestingPercentage: partnerVestingPercentage,
|
|
4279
|
+
bpsPerPeriod: partnerBpsPerPeriod,
|
|
4280
|
+
numberOfPeriods: partnerNumberOfPeriods,
|
|
4281
|
+
cliffDurationFromMigrationTime: partnerCliffDurationFromMigrationTime,
|
|
4282
|
+
totalDuration: partnerTotalDuration
|
|
4283
|
+
} = partnerVestingParams;
|
|
4284
|
+
const partnerLiquidityVestingInfo = getLiquidityVestingInfoParams(
|
|
4285
|
+
partnerVestingPercentage,
|
|
4286
|
+
partnerBpsPerPeriod,
|
|
4287
|
+
partnerNumberOfPeriods,
|
|
4288
|
+
partnerCliffDurationFromMigrationTime,
|
|
4289
|
+
partnerTotalDuration
|
|
4290
|
+
);
|
|
4291
|
+
const creatorVestingParams = creatorLiquidityVestingInfoParams ?? DEFAULT_LIQUIDITY_VESTING_INFO_PARAMS;
|
|
4292
|
+
const {
|
|
4293
|
+
vestingPercentage: creatorVestingPercentage,
|
|
4294
|
+
bpsPerPeriod: creatorBpsPerPeriod,
|
|
4295
|
+
numberOfPeriods: creatorNumberOfPeriods,
|
|
4296
|
+
cliffDurationFromMigrationTime: creatorCliffDurationFromMigrationTime,
|
|
4297
|
+
totalDuration: creatorTotalDuration
|
|
4298
|
+
} = creatorVestingParams;
|
|
4299
|
+
const creatorLiquidityVestingInfo = getLiquidityVestingInfoParams(
|
|
4300
|
+
creatorVestingPercentage,
|
|
4301
|
+
creatorBpsPerPeriod,
|
|
4302
|
+
creatorNumberOfPeriods,
|
|
4303
|
+
creatorCliffDurationFromMigrationTime,
|
|
4304
|
+
creatorTotalDuration
|
|
4305
|
+
);
|
|
4306
|
+
const poolCreationFeeInLamports = convertToLamports(
|
|
4307
|
+
poolCreationFee,
|
|
4308
|
+
9 /* NINE */
|
|
4309
|
+
);
|
|
3891
4310
|
const migratedPoolFeeParams = getMigratedPoolFeeParams(
|
|
3892
4311
|
migrationOption,
|
|
3893
4312
|
migrationFeeOption,
|
|
@@ -3991,10 +4410,10 @@ function buildCurveWithLiquidityWeights(buildCurveWithLiquidityWeightsParam) {
|
|
|
3991
4410
|
tokenType,
|
|
3992
4411
|
tokenDecimal: tokenBaseDecimal,
|
|
3993
4412
|
migrationQuoteThreshold: migrationQuoteThresholdInLamport,
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
|
|
3997
|
-
|
|
4413
|
+
partnerLiquidityPercentage,
|
|
4414
|
+
partnerPermanentLockedLiquidityPercentage,
|
|
4415
|
+
creatorLiquidityPercentage,
|
|
4416
|
+
creatorPermanentLockedLiquidityPercentage,
|
|
3998
4417
|
sqrtStartPrice: pMin,
|
|
3999
4418
|
lockedVesting,
|
|
4000
4419
|
migrationFeeOption,
|
|
@@ -4008,6 +4427,9 @@ function buildCurveWithLiquidityWeights(buildCurveWithLiquidityWeightsParam) {
|
|
|
4008
4427
|
dynamicFee: migratedPoolFeeParams.dynamicFee,
|
|
4009
4428
|
poolFeeBps: migratedPoolFeeParams.poolFeeBps
|
|
4010
4429
|
},
|
|
4430
|
+
poolCreationFee: poolCreationFeeInLamports,
|
|
4431
|
+
partnerLiquidityVestingInfo,
|
|
4432
|
+
creatorLiquidityVestingInfo,
|
|
4011
4433
|
padding: [],
|
|
4012
4434
|
curve,
|
|
4013
4435
|
migrationFee,
|
|
@@ -4018,25 +4440,29 @@ function buildCurveWithLiquidityWeights(buildCurveWithLiquidityWeightsParam) {
|
|
|
4018
4440
|
function buildCurveWithCustomSqrtPrices(buildCurveWithCustomSqrtPricesParam) {
|
|
4019
4441
|
const {
|
|
4020
4442
|
totalTokenSupply,
|
|
4021
|
-
|
|
4443
|
+
tokenType,
|
|
4022
4444
|
tokenBaseDecimal,
|
|
4023
4445
|
tokenQuoteDecimal,
|
|
4446
|
+
tokenUpdateAuthority,
|
|
4447
|
+
lockedVestingParams,
|
|
4448
|
+
leftover,
|
|
4449
|
+
baseFeeParams,
|
|
4024
4450
|
dynamicFeeEnabled,
|
|
4025
4451
|
activationType,
|
|
4026
4452
|
collectFeeMode,
|
|
4027
|
-
migrationFeeOption,
|
|
4028
|
-
tokenType,
|
|
4029
|
-
partnerLpPercentage,
|
|
4030
|
-
creatorLpPercentage,
|
|
4031
|
-
partnerLockedLpPercentage,
|
|
4032
|
-
creatorLockedLpPercentage,
|
|
4033
4453
|
creatorTradingFeePercentage,
|
|
4034
|
-
|
|
4035
|
-
|
|
4454
|
+
poolCreationFee,
|
|
4455
|
+
migrationOption,
|
|
4456
|
+
migrationFeeOption,
|
|
4036
4457
|
migrationFee,
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4458
|
+
partnerPermanentLockedLiquidityPercentage,
|
|
4459
|
+
partnerLiquidityPercentage,
|
|
4460
|
+
creatorPermanentLockedLiquidityPercentage,
|
|
4461
|
+
creatorLiquidityPercentage,
|
|
4462
|
+
partnerLiquidityVestingInfoParams,
|
|
4463
|
+
creatorLiquidityVestingInfoParams,
|
|
4464
|
+
migratedPoolFee,
|
|
4465
|
+
sqrtPrices
|
|
4040
4466
|
} = buildCurveWithCustomSqrtPricesParam;
|
|
4041
4467
|
let { liquidityWeights } = buildCurveWithCustomSqrtPricesParam;
|
|
4042
4468
|
if (sqrtPrices.length < 2) {
|
|
@@ -4066,7 +4492,7 @@ function buildCurveWithCustomSqrtPrices(buildCurveWithCustomSqrtPricesParam) {
|
|
|
4066
4492
|
cliffUnlockAmount,
|
|
4067
4493
|
totalVestingDuration,
|
|
4068
4494
|
cliffDurationFromMigrationTime
|
|
4069
|
-
} =
|
|
4495
|
+
} = lockedVestingParams;
|
|
4070
4496
|
const lockedVesting = getLockedVestingParams(
|
|
4071
4497
|
totalLockedVestingAmount,
|
|
4072
4498
|
numberOfVestingPeriod,
|
|
@@ -4075,6 +4501,40 @@ function buildCurveWithCustomSqrtPrices(buildCurveWithCustomSqrtPricesParam) {
|
|
|
4075
4501
|
cliffDurationFromMigrationTime,
|
|
4076
4502
|
tokenBaseDecimal
|
|
4077
4503
|
);
|
|
4504
|
+
const partnerVestingParams = partnerLiquidityVestingInfoParams ?? DEFAULT_LIQUIDITY_VESTING_INFO_PARAMS;
|
|
4505
|
+
const {
|
|
4506
|
+
vestingPercentage: partnerVestingPercentage,
|
|
4507
|
+
bpsPerPeriod: partnerBpsPerPeriod,
|
|
4508
|
+
numberOfPeriods: partnerNumberOfPeriods,
|
|
4509
|
+
cliffDurationFromMigrationTime: partnerCliffDurationFromMigrationTime,
|
|
4510
|
+
totalDuration: partnerTotalDuration
|
|
4511
|
+
} = partnerVestingParams;
|
|
4512
|
+
const partnerLiquidityVestingInfo = getLiquidityVestingInfoParams(
|
|
4513
|
+
partnerVestingPercentage,
|
|
4514
|
+
partnerBpsPerPeriod,
|
|
4515
|
+
partnerNumberOfPeriods,
|
|
4516
|
+
partnerCliffDurationFromMigrationTime,
|
|
4517
|
+
partnerTotalDuration
|
|
4518
|
+
);
|
|
4519
|
+
const creatorVestingParams = creatorLiquidityVestingInfoParams ?? DEFAULT_LIQUIDITY_VESTING_INFO_PARAMS;
|
|
4520
|
+
const {
|
|
4521
|
+
vestingPercentage: creatorVestingPercentage,
|
|
4522
|
+
bpsPerPeriod: creatorBpsPerPeriod,
|
|
4523
|
+
numberOfPeriods: creatorNumberOfPeriods,
|
|
4524
|
+
cliffDurationFromMigrationTime: creatorCliffDurationFromMigrationTime,
|
|
4525
|
+
totalDuration: creatorTotalDuration
|
|
4526
|
+
} = creatorVestingParams;
|
|
4527
|
+
const creatorLiquidityVestingInfo = getLiquidityVestingInfoParams(
|
|
4528
|
+
creatorVestingPercentage,
|
|
4529
|
+
creatorBpsPerPeriod,
|
|
4530
|
+
creatorNumberOfPeriods,
|
|
4531
|
+
creatorCliffDurationFromMigrationTime,
|
|
4532
|
+
creatorTotalDuration
|
|
4533
|
+
);
|
|
4534
|
+
const poolCreationFeeInLamports = convertToLamports(
|
|
4535
|
+
poolCreationFee,
|
|
4536
|
+
9 /* NINE */
|
|
4537
|
+
);
|
|
4078
4538
|
const migratedPoolFeeParams = getMigratedPoolFeeParams(
|
|
4079
4539
|
migrationOption,
|
|
4080
4540
|
migrationFeeOption,
|
|
@@ -4157,10 +4617,10 @@ function buildCurveWithCustomSqrtPrices(buildCurveWithCustomSqrtPricesParam) {
|
|
|
4157
4617
|
tokenType,
|
|
4158
4618
|
tokenDecimal: tokenBaseDecimal,
|
|
4159
4619
|
migrationQuoteThreshold: migrationQuoteThresholdInLamport,
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
|
|
4620
|
+
partnerLiquidityPercentage,
|
|
4621
|
+
partnerPermanentLockedLiquidityPercentage,
|
|
4622
|
+
creatorLiquidityPercentage,
|
|
4623
|
+
creatorPermanentLockedLiquidityPercentage,
|
|
4164
4624
|
sqrtStartPrice: pMin,
|
|
4165
4625
|
lockedVesting,
|
|
4166
4626
|
migrationFeeOption,
|
|
@@ -4174,6 +4634,9 @@ function buildCurveWithCustomSqrtPrices(buildCurveWithCustomSqrtPricesParam) {
|
|
|
4174
4634
|
dynamicFee: migratedPoolFeeParams.dynamicFee,
|
|
4175
4635
|
poolFeeBps: migratedPoolFeeParams.poolFeeBps
|
|
4176
4636
|
},
|
|
4637
|
+
poolCreationFee: poolCreationFeeInLamports,
|
|
4638
|
+
partnerLiquidityVestingInfo,
|
|
4639
|
+
creatorLiquidityVestingInfo,
|
|
4177
4640
|
padding: [],
|
|
4178
4641
|
curve,
|
|
4179
4642
|
migrationFee,
|
|
@@ -4190,7 +4653,7 @@ var idl_default = {
|
|
|
4190
4653
|
address: "dbcij3LWUppWqq96dh6gJWwBifmcGfLSB5D4DuSMaqN",
|
|
4191
4654
|
metadata: {
|
|
4192
4655
|
name: "dynamic_bonding_curve",
|
|
4193
|
-
version: "0.1.
|
|
4656
|
+
version: "0.1.8",
|
|
4194
4657
|
spec: "0.1.0",
|
|
4195
4658
|
description: "Created with Anchor"
|
|
4196
4659
|
},
|
|
@@ -4267,10 +4730,7 @@ var idl_default = {
|
|
|
4267
4730
|
},
|
|
4268
4731
|
{
|
|
4269
4732
|
name: "creator",
|
|
4270
|
-
signer: true
|
|
4271
|
-
relations: [
|
|
4272
|
-
"pool"
|
|
4273
|
-
]
|
|
4733
|
+
signer: true
|
|
4274
4734
|
},
|
|
4275
4735
|
{
|
|
4276
4736
|
name: "token_base_program",
|
|
@@ -4329,16 +4789,16 @@ var idl_default = {
|
|
|
4329
4789
|
]
|
|
4330
4790
|
},
|
|
4331
4791
|
{
|
|
4332
|
-
name: "
|
|
4792
|
+
name: "claim_legacy_pool_creation_fee",
|
|
4333
4793
|
discriminator: [
|
|
4334
|
-
|
|
4335
|
-
|
|
4336
|
-
|
|
4337
|
-
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4794
|
+
96,
|
|
4795
|
+
11,
|
|
4796
|
+
187,
|
|
4797
|
+
225,
|
|
4798
|
+
54,
|
|
4799
|
+
117,
|
|
4800
|
+
161,
|
|
4801
|
+
134
|
|
4342
4802
|
],
|
|
4343
4803
|
accounts: [
|
|
4344
4804
|
{
|
|
@@ -4352,14 +4812,11 @@ var idl_default = {
|
|
|
4352
4812
|
]
|
|
4353
4813
|
},
|
|
4354
4814
|
{
|
|
4355
|
-
name: "
|
|
4815
|
+
name: "signer",
|
|
4356
4816
|
docs: [
|
|
4357
4817
|
"Operator"
|
|
4358
4818
|
],
|
|
4359
|
-
signer: true
|
|
4360
|
-
relations: [
|
|
4361
|
-
"claim_fee_operator"
|
|
4362
|
-
]
|
|
4819
|
+
signer: true
|
|
4363
4820
|
},
|
|
4364
4821
|
{
|
|
4365
4822
|
name: "treasury",
|
|
@@ -4405,6 +4862,72 @@ var idl_default = {
|
|
|
4405
4862
|
],
|
|
4406
4863
|
args: []
|
|
4407
4864
|
},
|
|
4865
|
+
{
|
|
4866
|
+
name: "claim_partner_pool_creation_fee",
|
|
4867
|
+
discriminator: [
|
|
4868
|
+
250,
|
|
4869
|
+
238,
|
|
4870
|
+
26,
|
|
4871
|
+
4,
|
|
4872
|
+
139,
|
|
4873
|
+
10,
|
|
4874
|
+
101,
|
|
4875
|
+
248
|
|
4876
|
+
],
|
|
4877
|
+
accounts: [
|
|
4878
|
+
{
|
|
4879
|
+
name: "config",
|
|
4880
|
+
relations: [
|
|
4881
|
+
"pool"
|
|
4882
|
+
]
|
|
4883
|
+
},
|
|
4884
|
+
{
|
|
4885
|
+
name: "pool",
|
|
4886
|
+
writable: true
|
|
4887
|
+
},
|
|
4888
|
+
{
|
|
4889
|
+
name: "fee_claimer",
|
|
4890
|
+
signer: true
|
|
4891
|
+
},
|
|
4892
|
+
{
|
|
4893
|
+
name: "fee_receiver",
|
|
4894
|
+
writable: true
|
|
4895
|
+
},
|
|
4896
|
+
{
|
|
4897
|
+
name: "event_authority",
|
|
4898
|
+
pda: {
|
|
4899
|
+
seeds: [
|
|
4900
|
+
{
|
|
4901
|
+
kind: "const",
|
|
4902
|
+
value: [
|
|
4903
|
+
95,
|
|
4904
|
+
95,
|
|
4905
|
+
101,
|
|
4906
|
+
118,
|
|
4907
|
+
101,
|
|
4908
|
+
110,
|
|
4909
|
+
116,
|
|
4910
|
+
95,
|
|
4911
|
+
97,
|
|
4912
|
+
117,
|
|
4913
|
+
116,
|
|
4914
|
+
104,
|
|
4915
|
+
111,
|
|
4916
|
+
114,
|
|
4917
|
+
105,
|
|
4918
|
+
116,
|
|
4919
|
+
121
|
|
4920
|
+
]
|
|
4921
|
+
}
|
|
4922
|
+
]
|
|
4923
|
+
}
|
|
4924
|
+
},
|
|
4925
|
+
{
|
|
4926
|
+
name: "program"
|
|
4927
|
+
}
|
|
4928
|
+
],
|
|
4929
|
+
args: []
|
|
4930
|
+
},
|
|
4408
4931
|
{
|
|
4409
4932
|
name: "claim_protocol_fee",
|
|
4410
4933
|
discriminator: [
|
|
@@ -4663,14 +5186,11 @@ var idl_default = {
|
|
|
4663
5186
|
]
|
|
4664
5187
|
},
|
|
4665
5188
|
{
|
|
4666
|
-
name: "
|
|
5189
|
+
name: "signer",
|
|
4667
5190
|
docs: [
|
|
4668
|
-
"
|
|
5191
|
+
"Signer"
|
|
4669
5192
|
],
|
|
4670
|
-
signer: true
|
|
4671
|
-
relations: [
|
|
4672
|
-
"claim_fee_operator"
|
|
4673
|
-
]
|
|
5193
|
+
signer: true
|
|
4674
5194
|
},
|
|
4675
5195
|
{
|
|
4676
5196
|
name: "token_base_program",
|
|
@@ -4719,6 +5239,82 @@ var idl_default = {
|
|
|
4719
5239
|
],
|
|
4720
5240
|
args: []
|
|
4721
5241
|
},
|
|
5242
|
+
{
|
|
5243
|
+
name: "claim_protocol_pool_creation_fee",
|
|
5244
|
+
discriminator: [
|
|
5245
|
+
114,
|
|
5246
|
+
205,
|
|
5247
|
+
83,
|
|
5248
|
+
188,
|
|
5249
|
+
240,
|
|
5250
|
+
153,
|
|
5251
|
+
25,
|
|
5252
|
+
54
|
|
5253
|
+
],
|
|
5254
|
+
accounts: [
|
|
5255
|
+
{
|
|
5256
|
+
name: "config",
|
|
5257
|
+
relations: [
|
|
5258
|
+
"pool"
|
|
5259
|
+
]
|
|
5260
|
+
},
|
|
5261
|
+
{
|
|
5262
|
+
name: "pool",
|
|
5263
|
+
writable: true
|
|
5264
|
+
},
|
|
5265
|
+
{
|
|
5266
|
+
name: "claim_fee_operator",
|
|
5267
|
+
docs: [
|
|
5268
|
+
"Claim fee operator"
|
|
5269
|
+
]
|
|
5270
|
+
},
|
|
5271
|
+
{
|
|
5272
|
+
name: "signer",
|
|
5273
|
+
docs: [
|
|
5274
|
+
"Operator"
|
|
5275
|
+
],
|
|
5276
|
+
signer: true
|
|
5277
|
+
},
|
|
5278
|
+
{
|
|
5279
|
+
name: "treasury",
|
|
5280
|
+
writable: true,
|
|
5281
|
+
address: "4EWqcx3aNZmMetCnxwLYwyNjan6XLGp3Ca2W316vrSjv"
|
|
5282
|
+
},
|
|
5283
|
+
{
|
|
5284
|
+
name: "event_authority",
|
|
5285
|
+
pda: {
|
|
5286
|
+
seeds: [
|
|
5287
|
+
{
|
|
5288
|
+
kind: "const",
|
|
5289
|
+
value: [
|
|
5290
|
+
95,
|
|
5291
|
+
95,
|
|
5292
|
+
101,
|
|
5293
|
+
118,
|
|
5294
|
+
101,
|
|
5295
|
+
110,
|
|
5296
|
+
116,
|
|
5297
|
+
95,
|
|
5298
|
+
97,
|
|
5299
|
+
117,
|
|
5300
|
+
116,
|
|
5301
|
+
104,
|
|
5302
|
+
111,
|
|
5303
|
+
114,
|
|
5304
|
+
105,
|
|
5305
|
+
116,
|
|
5306
|
+
121
|
|
5307
|
+
]
|
|
5308
|
+
}
|
|
5309
|
+
]
|
|
5310
|
+
}
|
|
5311
|
+
},
|
|
5312
|
+
{
|
|
5313
|
+
name: "program"
|
|
5314
|
+
}
|
|
5315
|
+
],
|
|
5316
|
+
args: []
|
|
5317
|
+
},
|
|
4722
5318
|
{
|
|
4723
5319
|
name: "claim_trading_fee",
|
|
4724
5320
|
discriminator: [
|
|
@@ -4800,10 +5396,7 @@ var idl_default = {
|
|
|
4800
5396
|
},
|
|
4801
5397
|
{
|
|
4802
5398
|
name: "fee_claimer",
|
|
4803
|
-
signer: true
|
|
4804
|
-
relations: [
|
|
4805
|
-
"config"
|
|
4806
|
-
]
|
|
5399
|
+
signer: true
|
|
4807
5400
|
},
|
|
4808
5401
|
{
|
|
4809
5402
|
name: "token_base_program",
|
|
@@ -4862,16 +5455,16 @@ var idl_default = {
|
|
|
4862
5455
|
]
|
|
4863
5456
|
},
|
|
4864
5457
|
{
|
|
4865
|
-
name: "
|
|
5458
|
+
name: "close_claim_protocol_fee_operator",
|
|
4866
5459
|
discriminator: [
|
|
4867
|
-
|
|
4868
|
-
|
|
4869
|
-
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
|
|
4873
|
-
|
|
4874
|
-
|
|
5460
|
+
8,
|
|
5461
|
+
41,
|
|
5462
|
+
87,
|
|
5463
|
+
35,
|
|
5464
|
+
80,
|
|
5465
|
+
48,
|
|
5466
|
+
121,
|
|
5467
|
+
26
|
|
4875
5468
|
],
|
|
4876
5469
|
accounts: [
|
|
4877
5470
|
{
|
|
@@ -4883,7 +5476,7 @@ var idl_default = {
|
|
|
4883
5476
|
writable: true
|
|
4884
5477
|
},
|
|
4885
5478
|
{
|
|
4886
|
-
name: "
|
|
5479
|
+
name: "signer",
|
|
4887
5480
|
signer: true
|
|
4888
5481
|
},
|
|
4889
5482
|
{
|
|
@@ -4922,19 +5515,16 @@ var idl_default = {
|
|
|
4922
5515
|
args: []
|
|
4923
5516
|
},
|
|
4924
5517
|
{
|
|
4925
|
-
name: "
|
|
4926
|
-
docs: [
|
|
4927
|
-
"ADMIN FUNCTIONS_ ///"
|
|
4928
|
-
],
|
|
5518
|
+
name: "create_claim_protocol_fee_operator",
|
|
4929
5519
|
discriminator: [
|
|
4930
|
-
|
|
4931
|
-
|
|
4932
|
-
|
|
4933
|
-
|
|
4934
|
-
|
|
4935
|
-
|
|
4936
|
-
|
|
4937
|
-
|
|
5520
|
+
51,
|
|
5521
|
+
19,
|
|
5522
|
+
150,
|
|
5523
|
+
252,
|
|
5524
|
+
105,
|
|
5525
|
+
157,
|
|
5526
|
+
48,
|
|
5527
|
+
91
|
|
4938
5528
|
],
|
|
4939
5529
|
accounts: [
|
|
4940
5530
|
{
|
|
@@ -4969,7 +5559,11 @@ var idl_default = {
|
|
|
4969
5559
|
name: "operator"
|
|
4970
5560
|
},
|
|
4971
5561
|
{
|
|
4972
|
-
name: "
|
|
5562
|
+
name: "signer",
|
|
5563
|
+
signer: true
|
|
5564
|
+
},
|
|
5565
|
+
{
|
|
5566
|
+
name: "payer",
|
|
4973
5567
|
writable: true,
|
|
4974
5568
|
signer: true
|
|
4975
5569
|
},
|
|
@@ -5392,10 +5986,7 @@ var idl_default = {
|
|
|
5392
5986
|
},
|
|
5393
5987
|
{
|
|
5394
5988
|
name: "creator",
|
|
5395
|
-
signer: true
|
|
5396
|
-
relations: [
|
|
5397
|
-
"virtual_pool"
|
|
5398
|
-
]
|
|
5989
|
+
signer: true
|
|
5399
5990
|
},
|
|
5400
5991
|
{
|
|
5401
5992
|
name: "payer",
|
|
@@ -5511,10 +6102,7 @@ var idl_default = {
|
|
|
5511
6102
|
},
|
|
5512
6103
|
{
|
|
5513
6104
|
name: "creator",
|
|
5514
|
-
signer: true
|
|
5515
|
-
relations: [
|
|
5516
|
-
"virtual_pool"
|
|
5517
|
-
]
|
|
6105
|
+
signer: true
|
|
5518
6106
|
},
|
|
5519
6107
|
{
|
|
5520
6108
|
name: "token_quote_program",
|
|
@@ -6549,7 +7137,8 @@ var idl_default = {
|
|
|
6549
7137
|
},
|
|
6550
7138
|
{
|
|
6551
7139
|
name: "first_position_nft_mint",
|
|
6552
|
-
writable: true
|
|
7140
|
+
writable: true,
|
|
7141
|
+
signer: true
|
|
6553
7142
|
},
|
|
6554
7143
|
{
|
|
6555
7144
|
name: "first_position_nft_account",
|
|
@@ -6562,6 +7151,7 @@ var idl_default = {
|
|
|
6562
7151
|
{
|
|
6563
7152
|
name: "second_position_nft_mint",
|
|
6564
7153
|
writable: true,
|
|
7154
|
+
signer: true,
|
|
6565
7155
|
optional: true
|
|
6566
7156
|
},
|
|
6567
7157
|
{
|
|
@@ -6849,10 +7439,7 @@ var idl_default = {
|
|
|
6849
7439
|
},
|
|
6850
7440
|
{
|
|
6851
7441
|
name: "fee_claimer",
|
|
6852
|
-
signer: true
|
|
6853
|
-
relations: [
|
|
6854
|
-
"config"
|
|
6855
|
-
]
|
|
7442
|
+
signer: true
|
|
6856
7443
|
},
|
|
6857
7444
|
{
|
|
6858
7445
|
name: "token_quote_program",
|
|
@@ -7034,6 +7621,19 @@ var idl_default = {
|
|
|
7034
7621
|
"config"
|
|
7035
7622
|
]
|
|
7036
7623
|
},
|
|
7624
|
+
{
|
|
7625
|
+
name: "claim_fee_operator",
|
|
7626
|
+
docs: [
|
|
7627
|
+
"Claim fee operator"
|
|
7628
|
+
]
|
|
7629
|
+
},
|
|
7630
|
+
{
|
|
7631
|
+
name: "signer",
|
|
7632
|
+
docs: [
|
|
7633
|
+
"Signer"
|
|
7634
|
+
],
|
|
7635
|
+
signer: true
|
|
7636
|
+
},
|
|
7037
7637
|
{
|
|
7038
7638
|
name: "token_quote_program",
|
|
7039
7639
|
docs: [
|
|
@@ -7403,10 +8003,7 @@ var idl_default = {
|
|
|
7403
8003
|
},
|
|
7404
8004
|
{
|
|
7405
8005
|
name: "creator",
|
|
7406
|
-
signer: true
|
|
7407
|
-
relations: [
|
|
7408
|
-
"virtual_pool"
|
|
7409
|
-
]
|
|
8006
|
+
signer: true
|
|
7410
8007
|
},
|
|
7411
8008
|
{
|
|
7412
8009
|
name: "new_creator"
|
|
@@ -7427,51 +8024,21 @@ var idl_default = {
|
|
|
7427
8024
|
116,
|
|
7428
8025
|
95,
|
|
7429
8026
|
97,
|
|
7430
|
-
117,
|
|
7431
|
-
116,
|
|
7432
|
-
104,
|
|
7433
|
-
111,
|
|
7434
|
-
114,
|
|
7435
|
-
105,
|
|
7436
|
-
116,
|
|
7437
|
-
121
|
|
7438
|
-
]
|
|
7439
|
-
}
|
|
7440
|
-
]
|
|
7441
|
-
}
|
|
7442
|
-
},
|
|
7443
|
-
{
|
|
7444
|
-
name: "program"
|
|
7445
|
-
}
|
|
7446
|
-
],
|
|
7447
|
-
args: []
|
|
7448
|
-
},
|
|
7449
|
-
{
|
|
7450
|
-
name: "withdraw_lamports_from_pool_authority",
|
|
7451
|
-
discriminator: [
|
|
7452
|
-
20,
|
|
7453
|
-
185,
|
|
7454
|
-
242,
|
|
7455
|
-
240,
|
|
7456
|
-
129,
|
|
7457
|
-
24,
|
|
7458
|
-
212,
|
|
7459
|
-
194
|
|
7460
|
-
],
|
|
7461
|
-
accounts: [
|
|
7462
|
-
{
|
|
7463
|
-
name: "pool_authority",
|
|
7464
|
-
writable: true,
|
|
7465
|
-
address: "FhVo3mqL8PW5pH5U2CN4XE33DokiyZnUwuGpH2hmHLuM"
|
|
7466
|
-
},
|
|
7467
|
-
{
|
|
7468
|
-
name: "receiver",
|
|
7469
|
-
writable: true,
|
|
7470
|
-
address: "4EWqcx3aNZmMetCnxwLYwyNjan6XLGp3Ca2W316vrSjv"
|
|
8027
|
+
117,
|
|
8028
|
+
116,
|
|
8029
|
+
104,
|
|
8030
|
+
111,
|
|
8031
|
+
114,
|
|
8032
|
+
105,
|
|
8033
|
+
116,
|
|
8034
|
+
121
|
|
8035
|
+
]
|
|
8036
|
+
}
|
|
8037
|
+
]
|
|
8038
|
+
}
|
|
7471
8039
|
},
|
|
7472
8040
|
{
|
|
7473
|
-
name: "
|
|
7474
|
-
address: "11111111111111111111111111111111"
|
|
8041
|
+
name: "program"
|
|
7475
8042
|
}
|
|
7476
8043
|
],
|
|
7477
8044
|
args: []
|
|
@@ -7999,6 +8566,19 @@ var idl_default = {
|
|
|
7999
8566
|
37
|
|
8000
8567
|
]
|
|
8001
8568
|
},
|
|
8569
|
+
{
|
|
8570
|
+
name: "EvtPartnerClaimPoolCreationFee",
|
|
8571
|
+
discriminator: [
|
|
8572
|
+
174,
|
|
8573
|
+
223,
|
|
8574
|
+
44,
|
|
8575
|
+
150,
|
|
8576
|
+
145,
|
|
8577
|
+
98,
|
|
8578
|
+
89,
|
|
8579
|
+
195
|
|
8580
|
+
]
|
|
8581
|
+
},
|
|
8002
8582
|
{
|
|
8003
8583
|
name: "EvtPartnerMetadata",
|
|
8004
8584
|
discriminator: [
|
|
@@ -8385,6 +8965,31 @@ var idl_default = {
|
|
|
8385
8965
|
code: 6050,
|
|
8386
8966
|
name: "AccountInvariantViolation",
|
|
8387
8967
|
msg: "Account invariant violation"
|
|
8968
|
+
},
|
|
8969
|
+
{
|
|
8970
|
+
code: 6051,
|
|
8971
|
+
name: "InvalidPoolCreationFee",
|
|
8972
|
+
msg: "Invalid pool creation fee"
|
|
8973
|
+
},
|
|
8974
|
+
{
|
|
8975
|
+
code: 6052,
|
|
8976
|
+
name: "PoolCreationFeeHasBeenClaimed",
|
|
8977
|
+
msg: "Pool creation fee has been claimed"
|
|
8978
|
+
},
|
|
8979
|
+
{
|
|
8980
|
+
code: 6053,
|
|
8981
|
+
name: "Unauthorized",
|
|
8982
|
+
msg: "Not permit to do this action"
|
|
8983
|
+
},
|
|
8984
|
+
{
|
|
8985
|
+
code: 6054,
|
|
8986
|
+
name: "ZeroPoolCreationFee",
|
|
8987
|
+
msg: "Pool creation fee is zero"
|
|
8988
|
+
},
|
|
8989
|
+
{
|
|
8990
|
+
code: 6055,
|
|
8991
|
+
name: "InvalidMigrationLockedLiquidity",
|
|
8992
|
+
msg: "Invalid migration locked liquidity"
|
|
8388
8993
|
}
|
|
8389
8994
|
],
|
|
8390
8995
|
types: [
|
|
@@ -8570,19 +9175,19 @@ var idl_default = {
|
|
|
8570
9175
|
type: "u8"
|
|
8571
9176
|
},
|
|
8572
9177
|
{
|
|
8573
|
-
name: "
|
|
9178
|
+
name: "partner_liquidity_percentage",
|
|
8574
9179
|
type: "u8"
|
|
8575
9180
|
},
|
|
8576
9181
|
{
|
|
8577
|
-
name: "
|
|
9182
|
+
name: "partner_permanent_locked_liquidity_percentage",
|
|
8578
9183
|
type: "u8"
|
|
8579
9184
|
},
|
|
8580
9185
|
{
|
|
8581
|
-
name: "
|
|
9186
|
+
name: "creator_liquidity_percentage",
|
|
8582
9187
|
type: "u8"
|
|
8583
9188
|
},
|
|
8584
9189
|
{
|
|
8585
|
-
name: "
|
|
9190
|
+
name: "creator_permanent_locked_liquidity_percentage",
|
|
8586
9191
|
type: "u8"
|
|
8587
9192
|
},
|
|
8588
9193
|
{
|
|
@@ -8639,6 +9244,29 @@ var idl_default = {
|
|
|
8639
9244
|
}
|
|
8640
9245
|
}
|
|
8641
9246
|
},
|
|
9247
|
+
{
|
|
9248
|
+
name: "pool_creation_fee",
|
|
9249
|
+
docs: [
|
|
9250
|
+
"pool creation fee in SOL lamports value"
|
|
9251
|
+
],
|
|
9252
|
+
type: "u64"
|
|
9253
|
+
},
|
|
9254
|
+
{
|
|
9255
|
+
name: "partner_liquidity_vesting_info",
|
|
9256
|
+
type: {
|
|
9257
|
+
defined: {
|
|
9258
|
+
name: "LiquidityVestingInfoParams"
|
|
9259
|
+
}
|
|
9260
|
+
}
|
|
9261
|
+
},
|
|
9262
|
+
{
|
|
9263
|
+
name: "creator_liquidity_vesting_info",
|
|
9264
|
+
type: {
|
|
9265
|
+
defined: {
|
|
9266
|
+
name: "LiquidityVestingInfoParams"
|
|
9267
|
+
}
|
|
9268
|
+
}
|
|
9269
|
+
},
|
|
8642
9270
|
{
|
|
8643
9271
|
name: "padding",
|
|
8644
9272
|
docs: [
|
|
@@ -8646,8 +9274,8 @@ var idl_default = {
|
|
|
8646
9274
|
],
|
|
8647
9275
|
type: {
|
|
8648
9276
|
array: [
|
|
8649
|
-
"
|
|
8650
|
-
|
|
9277
|
+
"u8",
|
|
9278
|
+
22
|
|
8651
9279
|
]
|
|
8652
9280
|
}
|
|
8653
9281
|
},
|
|
@@ -8850,7 +9478,7 @@ var idl_default = {
|
|
|
8850
9478
|
type: "pubkey"
|
|
8851
9479
|
},
|
|
8852
9480
|
{
|
|
8853
|
-
name: "
|
|
9481
|
+
name: "receiver",
|
|
8854
9482
|
type: "pubkey"
|
|
8855
9483
|
},
|
|
8856
9484
|
{
|
|
@@ -8987,19 +9615,19 @@ var idl_default = {
|
|
|
8987
9615
|
type: "u8"
|
|
8988
9616
|
},
|
|
8989
9617
|
{
|
|
8990
|
-
name: "
|
|
9618
|
+
name: "partner_permanent_locked_liquidity_percentage",
|
|
8991
9619
|
type: "u8"
|
|
8992
9620
|
},
|
|
8993
9621
|
{
|
|
8994
|
-
name: "
|
|
9622
|
+
name: "partner_liquidity_percentage",
|
|
8995
9623
|
type: "u8"
|
|
8996
9624
|
},
|
|
8997
9625
|
{
|
|
8998
|
-
name: "
|
|
9626
|
+
name: "creator_permanent_locked_liquidity_percentage",
|
|
8999
9627
|
type: "u8"
|
|
9000
9628
|
},
|
|
9001
9629
|
{
|
|
9002
|
-
name: "
|
|
9630
|
+
name: "creator_liquidity_percentage",
|
|
9003
9631
|
type: "u8"
|
|
9004
9632
|
},
|
|
9005
9633
|
{
|
|
@@ -9171,6 +9799,26 @@ var idl_default = {
|
|
|
9171
9799
|
]
|
|
9172
9800
|
}
|
|
9173
9801
|
},
|
|
9802
|
+
{
|
|
9803
|
+
name: "EvtPartnerClaimPoolCreationFee",
|
|
9804
|
+
type: {
|
|
9805
|
+
kind: "struct",
|
|
9806
|
+
fields: [
|
|
9807
|
+
{
|
|
9808
|
+
name: "pool",
|
|
9809
|
+
type: "pubkey"
|
|
9810
|
+
},
|
|
9811
|
+
{
|
|
9812
|
+
name: "partner",
|
|
9813
|
+
type: "pubkey"
|
|
9814
|
+
},
|
|
9815
|
+
{
|
|
9816
|
+
name: "creation_fee",
|
|
9817
|
+
type: "u64"
|
|
9818
|
+
}
|
|
9819
|
+
]
|
|
9820
|
+
}
|
|
9821
|
+
},
|
|
9174
9822
|
{
|
|
9175
9823
|
name: "EvtPartnerMetadata",
|
|
9176
9824
|
docs: [
|
|
@@ -9473,6 +10121,79 @@ var idl_default = {
|
|
|
9473
10121
|
]
|
|
9474
10122
|
}
|
|
9475
10123
|
},
|
|
10124
|
+
{
|
|
10125
|
+
name: "LiquidityVestingInfo",
|
|
10126
|
+
serialization: "bytemuck",
|
|
10127
|
+
repr: {
|
|
10128
|
+
kind: "c"
|
|
10129
|
+
},
|
|
10130
|
+
type: {
|
|
10131
|
+
kind: "struct",
|
|
10132
|
+
fields: [
|
|
10133
|
+
{
|
|
10134
|
+
name: "is_initialized",
|
|
10135
|
+
type: "u8"
|
|
10136
|
+
},
|
|
10137
|
+
{
|
|
10138
|
+
name: "vesting_percentage",
|
|
10139
|
+
type: "u8"
|
|
10140
|
+
},
|
|
10141
|
+
{
|
|
10142
|
+
name: "_padding",
|
|
10143
|
+
type: {
|
|
10144
|
+
array: [
|
|
10145
|
+
"u8",
|
|
10146
|
+
2
|
|
10147
|
+
]
|
|
10148
|
+
}
|
|
10149
|
+
},
|
|
10150
|
+
{
|
|
10151
|
+
name: "bps_per_period",
|
|
10152
|
+
type: "u16"
|
|
10153
|
+
},
|
|
10154
|
+
{
|
|
10155
|
+
name: "number_of_periods",
|
|
10156
|
+
type: "u16"
|
|
10157
|
+
},
|
|
10158
|
+
{
|
|
10159
|
+
name: "frequency",
|
|
10160
|
+
type: "u32"
|
|
10161
|
+
},
|
|
10162
|
+
{
|
|
10163
|
+
name: "cliff_duration_from_migration_time",
|
|
10164
|
+
type: "u32"
|
|
10165
|
+
}
|
|
10166
|
+
]
|
|
10167
|
+
}
|
|
10168
|
+
},
|
|
10169
|
+
{
|
|
10170
|
+
name: "LiquidityVestingInfoParams",
|
|
10171
|
+
type: {
|
|
10172
|
+
kind: "struct",
|
|
10173
|
+
fields: [
|
|
10174
|
+
{
|
|
10175
|
+
name: "vesting_percentage",
|
|
10176
|
+
type: "u8"
|
|
10177
|
+
},
|
|
10178
|
+
{
|
|
10179
|
+
name: "bps_per_period",
|
|
10180
|
+
type: "u16"
|
|
10181
|
+
},
|
|
10182
|
+
{
|
|
10183
|
+
name: "number_of_periods",
|
|
10184
|
+
type: "u16"
|
|
10185
|
+
},
|
|
10186
|
+
{
|
|
10187
|
+
name: "cliff_duration_from_migration_time",
|
|
10188
|
+
type: "u32"
|
|
10189
|
+
},
|
|
10190
|
+
{
|
|
10191
|
+
name: "frequency",
|
|
10192
|
+
type: "u32"
|
|
10193
|
+
}
|
|
10194
|
+
]
|
|
10195
|
+
}
|
|
10196
|
+
},
|
|
9476
10197
|
{
|
|
9477
10198
|
name: "LockEscrow",
|
|
9478
10199
|
docs: [
|
|
@@ -9603,7 +10324,7 @@ var idl_default = {
|
|
|
9603
10324
|
{
|
|
9604
10325
|
name: "padding_0",
|
|
9605
10326
|
docs: [
|
|
9606
|
-
"!!! BE CAREFUL to use
|
|
10327
|
+
"!!! BE CAREFUL to use tombstone field, previous is pool creator"
|
|
9607
10328
|
],
|
|
9608
10329
|
type: {
|
|
9609
10330
|
array: [
|
|
@@ -9627,30 +10348,30 @@ var idl_default = {
|
|
|
9627
10348
|
type: "pubkey"
|
|
9628
10349
|
},
|
|
9629
10350
|
{
|
|
9630
|
-
name: "
|
|
10351
|
+
name: "partner_locked_liquidity",
|
|
9631
10352
|
docs: [
|
|
9632
|
-
"partner locked
|
|
10353
|
+
"partner locked liquidity"
|
|
9633
10354
|
],
|
|
9634
10355
|
type: "u64"
|
|
9635
10356
|
},
|
|
9636
10357
|
{
|
|
9637
|
-
name: "
|
|
10358
|
+
name: "partner_liquidity",
|
|
9638
10359
|
docs: [
|
|
9639
|
-
"partner
|
|
10360
|
+
"partner liquidity"
|
|
9640
10361
|
],
|
|
9641
10362
|
type: "u64"
|
|
9642
10363
|
},
|
|
9643
10364
|
{
|
|
9644
|
-
name: "
|
|
10365
|
+
name: "creator_locked_liquidity",
|
|
9645
10366
|
docs: [
|
|
9646
|
-
"creator locked
|
|
10367
|
+
"creator locked liquidity"
|
|
9647
10368
|
],
|
|
9648
10369
|
type: "u64"
|
|
9649
10370
|
},
|
|
9650
10371
|
{
|
|
9651
|
-
name: "
|
|
10372
|
+
name: "creator_liquidity",
|
|
9652
10373
|
docs: [
|
|
9653
|
-
"creator
|
|
10374
|
+
"creator liquidity"
|
|
9654
10375
|
],
|
|
9655
10376
|
type: "u64"
|
|
9656
10377
|
},
|
|
@@ -9664,28 +10385,28 @@ var idl_default = {
|
|
|
9664
10385
|
{
|
|
9665
10386
|
name: "creator_locked_status",
|
|
9666
10387
|
docs: [
|
|
9667
|
-
"flag to check whether
|
|
10388
|
+
"flag to check whether liquidity token is locked for creator"
|
|
9668
10389
|
],
|
|
9669
10390
|
type: "u8"
|
|
9670
10391
|
},
|
|
9671
10392
|
{
|
|
9672
10393
|
name: "partner_locked_status",
|
|
9673
10394
|
docs: [
|
|
9674
|
-
"flag to check whether
|
|
10395
|
+
"flag to check whether liquidity token is locked for partner"
|
|
9675
10396
|
],
|
|
9676
10397
|
type: "u8"
|
|
9677
10398
|
},
|
|
9678
10399
|
{
|
|
9679
10400
|
name: "creator_claim_status",
|
|
9680
10401
|
docs: [
|
|
9681
|
-
"flag to check whether creator has claimed
|
|
10402
|
+
"flag to check whether creator has claimed liquidity token"
|
|
9682
10403
|
],
|
|
9683
10404
|
type: "u8"
|
|
9684
10405
|
},
|
|
9685
10406
|
{
|
|
9686
10407
|
name: "partner_claim_status",
|
|
9687
10408
|
docs: [
|
|
9688
|
-
"flag to check whether partner has claimed
|
|
10409
|
+
"flag to check whether partner has claimed liquidity token"
|
|
9689
10410
|
],
|
|
9690
10411
|
type: "u8"
|
|
9691
10412
|
},
|
|
@@ -9832,6 +10553,41 @@ var idl_default = {
|
|
|
9832
10553
|
}
|
|
9833
10554
|
}
|
|
9834
10555
|
},
|
|
10556
|
+
{
|
|
10557
|
+
name: "partner_liquidity_vesting_info",
|
|
10558
|
+
type: {
|
|
10559
|
+
defined: {
|
|
10560
|
+
name: "LiquidityVestingInfo"
|
|
10561
|
+
}
|
|
10562
|
+
}
|
|
10563
|
+
},
|
|
10564
|
+
{
|
|
10565
|
+
name: "creator_liquidity_vesting_info",
|
|
10566
|
+
type: {
|
|
10567
|
+
defined: {
|
|
10568
|
+
name: "LiquidityVestingInfo"
|
|
10569
|
+
}
|
|
10570
|
+
}
|
|
10571
|
+
},
|
|
10572
|
+
{
|
|
10573
|
+
name: "padding_0",
|
|
10574
|
+
docs: [
|
|
10575
|
+
"Padding for future use"
|
|
10576
|
+
],
|
|
10577
|
+
type: {
|
|
10578
|
+
array: [
|
|
10579
|
+
"u8",
|
|
10580
|
+
14
|
|
10581
|
+
]
|
|
10582
|
+
}
|
|
10583
|
+
},
|
|
10584
|
+
{
|
|
10585
|
+
name: "padding_1",
|
|
10586
|
+
docs: [
|
|
10587
|
+
"Previously was protocol and referral fee percent. Beware of tombstone."
|
|
10588
|
+
],
|
|
10589
|
+
type: "u16"
|
|
10590
|
+
},
|
|
9835
10591
|
{
|
|
9836
10592
|
name: "collect_fee_mode",
|
|
9837
10593
|
docs: [
|
|
@@ -9882,30 +10638,30 @@ var idl_default = {
|
|
|
9882
10638
|
type: "u8"
|
|
9883
10639
|
},
|
|
9884
10640
|
{
|
|
9885
|
-
name: "
|
|
10641
|
+
name: "partner_permanent_locked_liquidity_percentage",
|
|
9886
10642
|
docs: [
|
|
9887
|
-
"partner locked
|
|
10643
|
+
"partner locked liquidity percentage"
|
|
9888
10644
|
],
|
|
9889
10645
|
type: "u8"
|
|
9890
10646
|
},
|
|
9891
10647
|
{
|
|
9892
|
-
name: "
|
|
10648
|
+
name: "partner_liquidity_percentage",
|
|
9893
10649
|
docs: [
|
|
9894
|
-
"partner
|
|
10650
|
+
"partner liquidity percentage"
|
|
9895
10651
|
],
|
|
9896
10652
|
type: "u8"
|
|
9897
10653
|
},
|
|
9898
10654
|
{
|
|
9899
|
-
name: "
|
|
10655
|
+
name: "creator_permanent_locked_liquidity_percentage",
|
|
9900
10656
|
docs: [
|
|
9901
10657
|
"creator post migration fee percentage"
|
|
9902
10658
|
],
|
|
9903
10659
|
type: "u8"
|
|
9904
10660
|
},
|
|
9905
10661
|
{
|
|
9906
|
-
name: "
|
|
10662
|
+
name: "creator_liquidity_percentage",
|
|
9907
10663
|
docs: [
|
|
9908
|
-
"creator
|
|
10664
|
+
"creator liquidity percentage"
|
|
9909
10665
|
],
|
|
9910
10666
|
type: "u8"
|
|
9911
10667
|
},
|
|
@@ -9952,10 +10708,7 @@ var idl_default = {
|
|
|
9952
10708
|
type: "u8"
|
|
9953
10709
|
},
|
|
9954
10710
|
{
|
|
9955
|
-
name: "
|
|
9956
|
-
docs: [
|
|
9957
|
-
"padding 0"
|
|
9958
|
-
],
|
|
10711
|
+
name: "padding_2",
|
|
9959
10712
|
type: {
|
|
9960
10713
|
array: [
|
|
9961
10714
|
"u8",
|
|
@@ -10045,10 +10798,17 @@ var idl_default = {
|
|
|
10045
10798
|
type: {
|
|
10046
10799
|
array: [
|
|
10047
10800
|
"u8",
|
|
10048
|
-
|
|
10801
|
+
4
|
|
10049
10802
|
]
|
|
10050
10803
|
}
|
|
10051
10804
|
},
|
|
10805
|
+
{
|
|
10806
|
+
name: "pool_creation_fee",
|
|
10807
|
+
docs: [
|
|
10808
|
+
"pool creation fee in lamports value"
|
|
10809
|
+
],
|
|
10810
|
+
type: "u64"
|
|
10811
|
+
},
|
|
10052
10812
|
{
|
|
10053
10813
|
name: "_padding_2",
|
|
10054
10814
|
docs: [
|
|
@@ -10168,32 +10928,6 @@ var idl_default = {
|
|
|
10168
10928
|
name: "DynamicFeeConfig"
|
|
10169
10929
|
}
|
|
10170
10930
|
}
|
|
10171
|
-
},
|
|
10172
|
-
{
|
|
10173
|
-
name: "padding_0",
|
|
10174
|
-
type: {
|
|
10175
|
-
array: [
|
|
10176
|
-
"u64",
|
|
10177
|
-
5
|
|
10178
|
-
]
|
|
10179
|
-
}
|
|
10180
|
-
},
|
|
10181
|
-
{
|
|
10182
|
-
name: "padding_1",
|
|
10183
|
-
type: {
|
|
10184
|
-
array: [
|
|
10185
|
-
"u8",
|
|
10186
|
-
6
|
|
10187
|
-
]
|
|
10188
|
-
}
|
|
10189
|
-
},
|
|
10190
|
-
{
|
|
10191
|
-
name: "protocol_fee_percent",
|
|
10192
|
-
type: "u8"
|
|
10193
|
-
},
|
|
10194
|
-
{
|
|
10195
|
-
name: "referral_fee_percent",
|
|
10196
|
-
type: "u8"
|
|
10197
10931
|
}
|
|
10198
10932
|
]
|
|
10199
10933
|
}
|
|
@@ -10569,16 +11303,29 @@ var idl_default = {
|
|
|
10569
11303
|
],
|
|
10570
11304
|
type: "u64"
|
|
10571
11305
|
},
|
|
11306
|
+
{
|
|
11307
|
+
name: "legacy_creation_fee_bits",
|
|
11308
|
+
docs: [
|
|
11309
|
+
"legacy creation fee bits, we dont use this now"
|
|
11310
|
+
],
|
|
11311
|
+
type: "u8"
|
|
11312
|
+
},
|
|
10572
11313
|
{
|
|
10573
11314
|
name: "creation_fee_bits",
|
|
11315
|
+
docs: [
|
|
11316
|
+
"pool creation fee claim status"
|
|
11317
|
+
],
|
|
10574
11318
|
type: "u8"
|
|
10575
11319
|
},
|
|
10576
11320
|
{
|
|
10577
11321
|
name: "_padding_0",
|
|
11322
|
+
docs: [
|
|
11323
|
+
"Padding for further use"
|
|
11324
|
+
],
|
|
10578
11325
|
type: {
|
|
10579
11326
|
array: [
|
|
10580
11327
|
"u8",
|
|
10581
|
-
|
|
11328
|
+
6
|
|
10582
11329
|
]
|
|
10583
11330
|
}
|
|
10584
11331
|
},
|
|
@@ -24864,6 +25611,25 @@ var MigrationService = class extends DynamicBondingCurveProgram {
|
|
|
24864
25611
|
);
|
|
24865
25612
|
const tokenBaseProgram = poolConfigState.tokenType == 0 ? TOKEN_PROGRAM_ID3 : TOKEN_2022_PROGRAM_ID2;
|
|
24866
25613
|
const tokenQuoteProgram = poolConfigState.quoteTokenFlag == 0 ? TOKEN_PROGRAM_ID3 : TOKEN_2022_PROGRAM_ID2;
|
|
25614
|
+
const firstPositionVestingAddress = deriveDammV2PositionVestingAccount(firstPosition);
|
|
25615
|
+
const secondPositionVestingAddress = deriveDammV2PositionVestingAccount(secondPosition);
|
|
25616
|
+
const remainingAccounts = [
|
|
25617
|
+
{
|
|
25618
|
+
isSigner: false,
|
|
25619
|
+
isWritable: false,
|
|
25620
|
+
pubkey: dammConfig
|
|
25621
|
+
},
|
|
25622
|
+
{
|
|
25623
|
+
isSigner: false,
|
|
25624
|
+
isWritable: true,
|
|
25625
|
+
pubkey: firstPositionVestingAddress
|
|
25626
|
+
},
|
|
25627
|
+
{
|
|
25628
|
+
isSigner: false,
|
|
25629
|
+
isWritable: true,
|
|
25630
|
+
pubkey: secondPositionVestingAddress
|
|
25631
|
+
}
|
|
25632
|
+
];
|
|
24867
25633
|
const tx = await this.program.methods.migrationDammV2().accountsStrict({
|
|
24868
25634
|
virtualPool,
|
|
24869
25635
|
migrationMetadata,
|
|
@@ -24890,15 +25656,9 @@ var MigrationService = class extends DynamicBondingCurveProgram {
|
|
|
24890
25656
|
token2022Program: TOKEN_2022_PROGRAM_ID2,
|
|
24891
25657
|
systemProgram: SystemProgram3.programId,
|
|
24892
25658
|
dammEventAuthority
|
|
24893
|
-
}).remainingAccounts(
|
|
24894
|
-
{
|
|
24895
|
-
isSigner: false,
|
|
24896
|
-
isWritable: false,
|
|
24897
|
-
pubkey: dammConfig
|
|
24898
|
-
}
|
|
24899
|
-
]).transaction();
|
|
25659
|
+
}).remainingAccounts(remainingAccounts).transaction();
|
|
24900
25660
|
const modifyComputeUnits = ComputeBudgetProgram.setComputeUnitLimit({
|
|
24901
|
-
units:
|
|
25661
|
+
units: 6e5
|
|
24902
25662
|
});
|
|
24903
25663
|
tx.add(modifyComputeUnits);
|
|
24904
25664
|
return {
|
|
@@ -25349,6 +26109,33 @@ var PartnerService = class extends DynamicBondingCurveProgram {
|
|
|
25349
26109
|
}).preInstructions(preInstructions).postInstructions(postInstructions).transaction();
|
|
25350
26110
|
return transaction;
|
|
25351
26111
|
}
|
|
26112
|
+
/**
|
|
26113
|
+
* Claim partner pool creation fee
|
|
26114
|
+
* @param params - The claim partner pool creation fee parameters
|
|
26115
|
+
* @returns A claim partner pool creation fee transaction
|
|
26116
|
+
*/
|
|
26117
|
+
async claimPartnerPoolCreationFee(params) {
|
|
26118
|
+
const { virtualPool, feeReceiver } = params;
|
|
26119
|
+
const virtualPoolState = await this.state.getPool(virtualPool);
|
|
26120
|
+
if (!virtualPoolState) {
|
|
26121
|
+
throw new Error(`Pool not found: ${virtualPool.toString()}`);
|
|
26122
|
+
}
|
|
26123
|
+
const config = virtualPoolState.config;
|
|
26124
|
+
const configState = await this.state.getPoolConfig(
|
|
26125
|
+
virtualPoolState.config
|
|
26126
|
+
);
|
|
26127
|
+
if (!configState) {
|
|
26128
|
+
throw new Error(`Pool config not found for virtual pool`);
|
|
26129
|
+
}
|
|
26130
|
+
const feeClaimer = configState.feeClaimer;
|
|
26131
|
+
const transaction = await this.program.methods.claimPartnerPoolCreationFee().accountsPartial({
|
|
26132
|
+
config,
|
|
26133
|
+
pool: virtualPool,
|
|
26134
|
+
feeClaimer,
|
|
26135
|
+
feeReceiver
|
|
26136
|
+
}).transaction();
|
|
26137
|
+
return transaction;
|
|
26138
|
+
}
|
|
25352
26139
|
};
|
|
25353
26140
|
|
|
25354
26141
|
// src/services/pool.ts
|
|
@@ -26690,7 +27477,6 @@ var DynamicBondingCurveClient = class _DynamicBondingCurveClient {
|
|
|
26690
27477
|
export {
|
|
26691
27478
|
ActivationType,
|
|
26692
27479
|
BASE_ADDRESS,
|
|
26693
|
-
BASIS_POINT_MAX,
|
|
26694
27480
|
BIN_STEP_BPS_DEFAULT,
|
|
26695
27481
|
BIN_STEP_BPS_U128_DEFAULT,
|
|
26696
27482
|
BaseFeeMode,
|
|
@@ -26700,6 +27486,7 @@ export {
|
|
|
26700
27486
|
DAMM_V1_PROGRAM_ID,
|
|
26701
27487
|
DAMM_V2_MIGRATION_FEE_ADDRESS,
|
|
26702
27488
|
DAMM_V2_PROGRAM_ID,
|
|
27489
|
+
DEFAULT_LIQUIDITY_VESTING_INFO_PARAMS,
|
|
26703
27490
|
DYNAMIC_BONDING_CURVE_PROGRAM_ID,
|
|
26704
27491
|
DYNAMIC_FEE_DECAY_PERIOD_DEFAULT,
|
|
26705
27492
|
DYNAMIC_FEE_FILTER_PERIOD_DEFAULT,
|
|
@@ -26713,39 +27500,44 @@ export {
|
|
|
26713
27500
|
FEE_DENOMINATOR,
|
|
26714
27501
|
FeeRateLimiter,
|
|
26715
27502
|
FeeScheduler,
|
|
27503
|
+
HOST_FEE_PERCENT,
|
|
26716
27504
|
LOCKER_PROGRAM_ID,
|
|
27505
|
+
MAX_BASIS_POINT,
|
|
26717
27506
|
MAX_CREATOR_MIGRATION_FEE_PERCENTAGE,
|
|
26718
27507
|
MAX_CURVE_POINT,
|
|
26719
|
-
MAX_DYNAMIC_FEE_PERCENTAGE,
|
|
26720
27508
|
MAX_FEE_BPS,
|
|
26721
27509
|
MAX_FEE_NUMERATOR,
|
|
27510
|
+
MAX_LOCK_DURATION_IN_SECONDS,
|
|
26722
27511
|
MAX_MIGRATED_POOL_FEE_BPS,
|
|
26723
27512
|
MAX_MIGRATION_FEE_PERCENTAGE,
|
|
26724
|
-
|
|
27513
|
+
MAX_POOL_CREATION_FEE,
|
|
27514
|
+
MAX_PRICE_CHANGE_PERCENTAGE_DEFAULT,
|
|
26725
27515
|
MAX_RATE_LIMITER_DURATION_IN_SECONDS,
|
|
26726
27516
|
MAX_RATE_LIMITER_DURATION_IN_SLOTS,
|
|
26727
27517
|
MAX_SQRT_PRICE,
|
|
26728
27518
|
METAPLEX_PROGRAM_ID,
|
|
26729
27519
|
MIN_FEE_BPS,
|
|
26730
27520
|
MIN_FEE_NUMERATOR,
|
|
27521
|
+
MIN_LOCKED_LIQUIDITY_BPS,
|
|
26731
27522
|
MIN_MIGRATED_POOL_FEE_BPS,
|
|
27523
|
+
MIN_POOL_CREATION_FEE,
|
|
26732
27524
|
MIN_SQRT_PRICE,
|
|
26733
27525
|
MigrationFeeOption,
|
|
26734
27526
|
MigrationOption,
|
|
26735
27527
|
MigrationService,
|
|
26736
27528
|
OFFSET,
|
|
26737
27529
|
ONE_Q64,
|
|
26738
|
-
|
|
27530
|
+
PROTOCOL_FEE_PERCENT,
|
|
27531
|
+
PROTOCOL_POOL_CREATION_FEE_PERCENT,
|
|
26739
27532
|
PartnerService,
|
|
26740
27533
|
PoolService,
|
|
26741
27534
|
RESOLUTION,
|
|
26742
27535
|
Rounding,
|
|
26743
|
-
|
|
27536
|
+
SECONDS_PER_DAY,
|
|
26744
27537
|
SWAP_BUFFER_PERCENTAGE,
|
|
26745
27538
|
SafeMath,
|
|
26746
27539
|
StateService,
|
|
26747
27540
|
SwapMode,
|
|
26748
|
-
TIMESTAMP_DURATION,
|
|
26749
27541
|
TokenDecimal,
|
|
26750
27542
|
TokenType,
|
|
26751
27543
|
TokenUpdateAuthorityOption,
|
|
@@ -26765,6 +27557,7 @@ export {
|
|
|
26765
27557
|
calculateBaseToQuoteFromAmountIn,
|
|
26766
27558
|
calculateBaseToQuoteFromAmountOut,
|
|
26767
27559
|
calculateFeeSchedulerEndingBaseFeeBps,
|
|
27560
|
+
calculateLockedLiquidityBpsAtTime,
|
|
26768
27561
|
calculateQuoteToBaseFromAmountIn,
|
|
26769
27562
|
calculateQuoteToBaseFromAmountOut,
|
|
26770
27563
|
checkRateLimiterApplied,
|
|
@@ -26793,6 +27586,7 @@ export {
|
|
|
26793
27586
|
deriveDammV2MigrationMetadataAddress,
|
|
26794
27587
|
deriveDammV2PoolAddress,
|
|
26795
27588
|
deriveDammV2PoolAuthority,
|
|
27589
|
+
deriveDammV2PositionVestingAccount,
|
|
26796
27590
|
deriveDammV2TokenVaultAddress,
|
|
26797
27591
|
deriveDbcEventAuthority,
|
|
26798
27592
|
deriveDbcPoolAddress,
|
|
@@ -26844,6 +27638,7 @@ export {
|
|
|
26844
27638
|
getInitialLiquidityFromDeltaBase,
|
|
26845
27639
|
getInitialLiquidityFromDeltaQuote,
|
|
26846
27640
|
getLiquidity,
|
|
27641
|
+
getLiquidityVestingInfoParams,
|
|
26847
27642
|
getLockedVestingParams,
|
|
26848
27643
|
getMaxBaseFeeNumerator,
|
|
26849
27644
|
getMaxIndex,
|
|
@@ -26887,6 +27682,7 @@ export {
|
|
|
26887
27682
|
getTotalVestingAmount,
|
|
26888
27683
|
getTwoCurve,
|
|
26889
27684
|
getVariableFeeNumerator,
|
|
27685
|
+
getVestingLockedLiquidityBpsAtNSeconds,
|
|
26890
27686
|
isDefaultLockedVesting,
|
|
26891
27687
|
isDynamicFeeEnabled,
|
|
26892
27688
|
isNativeSol,
|
|
@@ -26915,10 +27711,13 @@ export {
|
|
|
26915
27711
|
validateFeeRateLimiter,
|
|
26916
27712
|
validateFeeScheduler,
|
|
26917
27713
|
validateLPPercentages,
|
|
27714
|
+
validateLiquidityVestingInfo,
|
|
26918
27715
|
validateMigratedPoolFee,
|
|
26919
27716
|
validateMigrationAndTokenType,
|
|
26920
27717
|
validateMigrationFee,
|
|
26921
27718
|
validateMigrationFeeOption,
|
|
27719
|
+
validateMinimumLockedLiquidity,
|
|
27720
|
+
validatePoolCreationFee,
|
|
26922
27721
|
validatePoolFees,
|
|
26923
27722
|
validateSwapAmount,
|
|
26924
27723
|
validateTokenDecimals,
|