@floorlaunchpad/sdk 0.4.1 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +219 -18
- package/README.md +0 -2
- package/dist/abi/evm-event-names.js +7 -0
- package/dist/abi/evm.gen.js +6 -0
- package/dist/abi/functions.gen.js +49 -1
- package/dist/abi/solana.gen.js +5 -0
- package/dist/config/generated.js +77 -0
- package/dist/errors.js +2 -2
- package/dist/events/types.gen.js +1 -1
- package/dist/evm/chains.js +32 -24
- package/dist/evm/floor/calls.js +5 -0
- package/dist/evm/router.js +1 -25
- package/dist/evm/squid.js +3 -3
- package/dist/generated/interface.gen.js +48 -43
- package/dist/index.js +1 -0
- package/dist/indexer/bodies.js +137 -2
- package/dist/indexer/client.js +10 -1
- package/dist/indexer/contract.js +65 -6
- package/dist/indexer/paths.js +34 -7
- package/dist/indexer/read.js +12 -3
- package/dist/indexer/stream.js +2 -2
- package/dist/math/v2/book.js +40 -7
- package/dist/math/v2/create.js +1 -1
- package/dist/math/v2/fees.js +30 -4
- package/dist/math/v2/milestones.js +1 -1
- package/dist/math/v2/receipt.js +3 -3
- package/dist/math/v2/relay.js +201 -1
- package/dist/math/v2/rows.js +17 -0
- package/dist/math/v2/split.js +60 -15
- package/dist/math/v2/team.js +14 -1
- package/dist/math/v2/trade.js +16 -8
- package/dist/solana/floor/accounts.js +30 -3
- package/dist/solana/floor/events.js +6 -0
- package/dist/solana/floor/instructions.js +23 -1
- package/dist/solana/floor/program.js +3 -0
- package/dist/ton/addresses.js +36 -0
- package/dist/ton/book-check.js +23 -0
- package/dist/ton/book.js +119 -0
- package/dist/ton/cell.js +542 -0
- package/dist/ton/consts.generated.js +17 -0
- package/dist/ton/content.js +83 -0
- package/dist/ton/gas.js +198 -0
- package/dist/ton/governance.js +401 -0
- package/dist/ton/index.js +18 -0
- package/dist/ton/messages.js +340 -0
- package/dist/ton/ops.js +37 -0
- package/dist/ton/price.js +51 -0
- package/dist/ton/quote-entry.js +116 -0
- package/dist/ton/quote.js +25 -0
- package/dist/ton/reader.js +378 -0
- package/dist/ton/types.js +43 -0
- package/dist/ton/wallet.js +26 -0
- package/dist/v2/events.js +2 -0
- package/dist/v2/evm.js +8 -1
- package/dist/v2/layouts.js +7 -1
- package/dist/v2/router.js +2 -2
- package/dist/v2/solana.js +1 -1
- package/dist/v2/solanaSettle.js +2 -0
- package/dist/v2/tx/evm.js +15 -1
- package/docs/aggregator.md +0 -22
- package/docs/bot.md +0 -8
- package/docs/cursor-pages.md +9 -5
- package/docs/frontend.md +0 -2
- package/docs/ton.md +107 -0
- package/docs/wallet.md +0 -2
- package/examples/floor-line.html +1 -1
- package/package.json +6 -1
- package/src/abi/evm-event-names.ts +7 -0
- package/src/abi/evm.gen.ts +6 -0
- package/src/abi/functions.gen.ts +49 -1
- package/src/abi/solana.gen.ts +5 -0
- package/src/config/generated.ts +77 -0
- package/src/errors.ts +2 -2
- package/src/events/types.gen.ts +57 -1
- package/src/evm/chains.ts +34 -28
- package/src/evm/floor/calls.ts +5 -0
- package/src/evm/router.ts +1 -26
- package/src/evm/squid.ts +3 -3
- package/src/generated/interface.gen.ts +48 -43
- package/src/index.ts +1 -0
- package/src/indexer/bodies.ts +144 -2
- package/src/indexer/client.ts +17 -4
- package/src/indexer/contract.ts +66 -7
- package/src/indexer/paths.ts +62 -7
- package/src/indexer/read.ts +14 -5
- package/src/indexer/stream.ts +4 -4
- package/src/math/v2/book.ts +42 -7
- package/src/math/v2/create.ts +1 -1
- package/src/math/v2/fees.ts +30 -4
- package/src/math/v2/milestones.ts +1 -1
- package/src/math/v2/receipt.ts +7 -3
- package/src/math/v2/relay.ts +208 -1
- package/src/math/v2/rows.ts +17 -0
- package/src/math/v2/split.ts +70 -16
- package/src/math/v2/team.ts +14 -1
- package/src/math/v2/trade.ts +16 -8
- package/src/solana/floor/accounts.ts +30 -3
- package/src/solana/floor/events.ts +6 -0
- package/src/solana/floor/instructions.ts +23 -1
- package/src/solana/floor/program.ts +3 -0
- package/src/ton/addresses.ts +38 -0
- package/src/ton/book-check.ts +24 -0
- package/src/ton/book.ts +136 -0
- package/src/ton/cell.ts +547 -0
- package/src/ton/consts.generated.ts +17 -0
- package/src/ton/content.ts +97 -0
- package/src/ton/gas.ts +209 -0
- package/src/ton/governance.ts +452 -0
- package/src/ton/index.ts +18 -0
- package/src/ton/messages.ts +343 -0
- package/src/ton/ops.ts +37 -0
- package/src/ton/price.ts +54 -0
- package/src/ton/quote-entry.ts +138 -0
- package/src/ton/quote.ts +67 -0
- package/src/ton/reader.ts +420 -0
- package/src/ton/types.ts +201 -0
- package/src/ton/wallet.ts +30 -0
- package/src/v2/events.ts +3 -1
- package/src/v2/evm.ts +10 -1
- package/src/v2/layouts.ts +7 -1
- package/src/v2/router.ts +2 -2
- package/src/v2/solana.ts +1 -1
- package/src/v2/solanaSettle.ts +2 -0
- package/src/v2/tx/evm.ts +15 -1
- package/src/v2/types.ts +14 -1
package/dist/indexer/contract.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { unknown } from "./decode.js";
|
|
4
4
|
import * as B from "./bodies.js";
|
|
5
5
|
import * as P from "./partners.js";
|
|
6
|
-
import { CANDLES_MANY_IDS_MAX, CANDLES_MANY_LIMIT_DEFAULT, CANDLES_MANY_ROWS_MAX, FIRSTS_MAX, IDS_MAX, LAUNCH_LISTS_QUOTES_MAX, LAUNCH_LISTS_ROWS_MAX, INBOX_PAGE_DEFAULT, INBOX_PAGE_MAX, LAUNCHES_PAGE_DEFAULT, LAUNCHES_PAGE_MAX, LAUNCH_CURSOR_MAX, LAUNCH_SORTS, PRESET_FILTER_MAX, STREAM_STATE_MAX, WALLET_CURSOR_MAX, WALLET_PAGE_DEFAULT, WALLET_PAGE_MAX } from "./paths.js";
|
|
6
|
+
import { CANDLES_MANY_IDS_MAX, CANDLES_MANY_LIMIT_DEFAULT, CANDLES_MANY_ROWS_MAX, FIRSTS_MAX, POSITION_TOTALS_PAGE_MAX, TRADED_WALLETS_MAX, IDS_MAX, LAUNCH_LISTS_QUOTES_MAX, LAUNCH_LISTS_ROWS_MAX, INBOX_PAGE_DEFAULT, INBOX_PAGE_MAX, LAUNCHES_PAGE_DEFAULT, LAUNCHES_PAGE_MAX, LAUNCH_CURSOR_MAX, LAUNCH_SORTS, PEOPLE_PERSON_MAX, PRESET_FILTER_MAX, STREAM_STATE_MAX, WALLET_CURSOR_MAX, WALLET_PAGE_DEFAULT, WALLET_PAGE_MAX } from "./paths.js";
|
|
7
7
|
import { SEARCH_PAGE_DEFAULT, SEARCH_PAGE_MAX, SEARCH_Q_MAX } from "./search.js";
|
|
8
8
|
|
|
9
9
|
export const UNITS = {
|
|
@@ -102,6 +102,9 @@ export const INDEXER_CONTRACT = {
|
|
|
102
102
|
launch: { kind: "list", doc: "only these launches' frames (and their quote chains' relatives)" },
|
|
103
103
|
state: { kind: "list", doc: "state frames (the launch whole on each change) for these", max: STREAM_STATE_MAX },
|
|
104
104
|
lastEventId: { kind: "string", doc: "resume after this frame id (EventSource sends Last-Event-ID itself)" },
|
|
105
|
+
seat: { kind: "enum", doc: "relay: the site relay's seat (pipes are refused first)", values: ["relay"] },
|
|
106
|
+
compress: { kind: "bool", doc: "1: compress the stream (zstd, br or gzip as Accept-Encoding allows; relay seats by default)" },
|
|
107
|
+
refs: { kind: "bool", doc: "1: the trade frames carry `refs` (who a trade credited) when a referrer was credited" },
|
|
105
108
|
},
|
|
106
109
|
body: unknown,
|
|
107
110
|
}),
|
|
@@ -204,7 +207,8 @@ export const INDEXER_CONTRACT = {
|
|
|
204
207
|
traders: site({ pattern: "/floor-amm/launches/<launch>/traders", v2: true, query: { window: WINDOW, limit: LIMIT(100, 500) }, page: limit(100, 500), errors: [...LAUNCH_ERR, "bad_query"], body: B.LAUNCH_TRADERS }),
|
|
205
208
|
quoteChain: site({ pattern: "/floor-amm/launches/<launch>/chain", v2: true, errors: LAUNCH_ERR, body: B.QUOTE_CHAIN }),
|
|
206
209
|
devTrades: site({ pattern: "/floor-amm/launches/<launch>/dev", v2: true, query: { limit: LIMIT(100, 500) }, page: limit(100, 500), errors: [...LAUNCH_ERR, "bad_query"], body: B.DEV_TRADES }),
|
|
207
|
-
|
|
210
|
+
|
|
211
|
+
burns: site({ pattern: "/floor-amm/launches/<launch>/burns", v2: true, query: { limit: LIMIT(100, 500), before: BEFORE, wallet: { kind: "string", doc: "only this wallet's burns (EVM case-blind; not a wallet on the chain: 400)" } }, page: cursor(100, 500), errors: [...LAUNCH_ERR, "bad_query"], body: B.BURNS }),
|
|
208
212
|
launchLocks: site({ pattern: "/floor-amm/launches/<launch>/locks", v2: true, errors: LAUNCH_ERR, body: B.LAUNCH_LOCKS }),
|
|
209
213
|
marks: site({
|
|
210
214
|
pattern: "/floor-amm/launches/<launch>/marks",
|
|
@@ -215,6 +219,39 @@ export const INDEXER_CONTRACT = {
|
|
|
215
219
|
body: B.MARKS,
|
|
216
220
|
}),
|
|
217
221
|
price: site({ pattern: "/floor-amm/launches/<launch>/price", v2: true, errors: LAUNCH_ERR, body: B.PRICE }),
|
|
222
|
+
|
|
223
|
+
raiseSeries: site({
|
|
224
|
+
pattern: "/floor-amm/launches/<launch>/raise-series",
|
|
225
|
+
v2: true,
|
|
226
|
+
query: {
|
|
227
|
+
step: { kind: "enum", doc: "the grid in seconds", values: B.RAISE_STEPS.map(String), required: true },
|
|
228
|
+
from: { kind: "unix", doc: "the grid's left edge (absent: the launch's open)" },
|
|
229
|
+
to: { kind: "unix", doc: "the right edge (absent: the indexed head's time; never before the last fill)" },
|
|
230
|
+
},
|
|
231
|
+
page: { kind: "range", from: "from", to: "to", span: { interval: "step", max: B.RT_POINTS_MAX, seconds: true } },
|
|
232
|
+
errors: [...LAUNCH_ERR, "bad_query"],
|
|
233
|
+
body: B.RAISE_SERIES,
|
|
234
|
+
}),
|
|
235
|
+
floorSteps: site({
|
|
236
|
+
pattern: "/floor-amm/launches/<launch>/floor-steps",
|
|
237
|
+
v2: true,
|
|
238
|
+
query: {
|
|
239
|
+
from: { kind: "unix", doc: "the window's start (absent: the graduation, else the open)" },
|
|
240
|
+
to: { kind: "unix", doc: "the slices' right edge (absent: the indexed head's time; never before the last step)" },
|
|
241
|
+
points: { kind: "int", doc: "the slices (the last step of each is kept)", min: 1, max: B.RT_POINTS_MAX, default: B.RT_POINTS_MAX },
|
|
242
|
+
},
|
|
243
|
+
page: { kind: "range", from: "from", to: "to" },
|
|
244
|
+
errors: [...LAUNCH_ERR, "bad_query"],
|
|
245
|
+
body: B.FLOOR_STEPS,
|
|
246
|
+
}),
|
|
247
|
+
|
|
248
|
+
launchTraded: site({
|
|
249
|
+
pattern: "/floor-amm/launches/<launch>/traded",
|
|
250
|
+
v2: true,
|
|
251
|
+
query: { wallets: { kind: "list", doc: "the wallets asked, answered in this order", required: true, min: 1, max: TRADED_WALLETS_MAX } },
|
|
252
|
+
errors: [...LAUNCH_ERR, "bad_query"],
|
|
253
|
+
body: B.LAUNCH_TRADED,
|
|
254
|
+
}),
|
|
218
255
|
highs: site({
|
|
219
256
|
pattern: "/floor-amm/launches/<launch>/highs",
|
|
220
257
|
v2: true,
|
|
@@ -289,6 +326,19 @@ export const INDEXER_CONTRACT = {
|
|
|
289
326
|
|
|
290
327
|
positions: site({ pattern: "/floor-amm/wallets/<wallet>/positions", v2: true, query: WALLET_PAGE_KEYS("opaque, launch create order"), page: WALLET_PAGE, errors: WALLET_ERR, body: B.POSITIONS }),
|
|
291
328
|
|
|
329
|
+
positionTotals: site({
|
|
330
|
+
pattern: "/floor-amm/wallets/<wallet>/position-totals",
|
|
331
|
+
v2: true,
|
|
332
|
+
query: {
|
|
333
|
+
launch: { kind: "string", doc: "only this launch's row (an id or its token)" },
|
|
334
|
+
limit: { kind: "int", doc: "launches a page (without launch)", min: 1, max: POSITION_TOTALS_PAGE_MAX, default: POSITION_TOTALS_PAGE_MAX },
|
|
335
|
+
cursor: { kind: "string", doc: "a page's next (opaque, launch create order)", max: WALLET_CURSOR_MAX, without: ["launch"] },
|
|
336
|
+
},
|
|
337
|
+
page: { kind: "keyset", limit: { default: POSITION_TOTALS_PAGE_MAX, max: POSITION_TOTALS_PAGE_MAX }, cursor: "cursor", next: "next", optIn: true },
|
|
338
|
+
errors: [...WALLET_ERR, "unknown_launch"],
|
|
339
|
+
body: B.POSITION_TOTALS,
|
|
340
|
+
}),
|
|
341
|
+
|
|
292
342
|
inbox: site({
|
|
293
343
|
pattern: "/floor-amm/wallets/<wallet>/inbox",
|
|
294
344
|
v2: true,
|
|
@@ -302,7 +352,14 @@ export const INDEXER_CONTRACT = {
|
|
|
302
352
|
firsts: site({ pattern: "/floor-amm/wallets/<wallet>/firsts", errors: WALLET_ERR, body: B.FIRSTS }),
|
|
303
353
|
firstsMany: site({ pattern: "/floor-amm/wallets/firsts", query: { wallets: { kind: "list", doc: "the wallets", required: true, min: 1, max: FIRSTS_MAX } }, errors: WALLET_ERR, body: B.FIRSTS_MANY }),
|
|
304
354
|
claimView: site({ pattern: "/floor-amm/claims/<wallet>", query: WALLET_PAGE_KEYS("a page's next: the last row key (l:<launch>, r:<account>, p:<traderRef>, o:<quote>), string order"), page: WALLET_PAGE, errors: [...WALLET_ERR, "bad_query", "no_reader"], body: B.CLAIM_VIEW }),
|
|
305
|
-
|
|
355
|
+
|
|
356
|
+
people: site({
|
|
357
|
+
pattern: "/floor-amm/referrals/<wallet>/people",
|
|
358
|
+
query: { ...WALLET_PAGE_KEYS("opaque, referred wallet order"), person: { kind: "list", doc: "only these referred wallets' rows (distinct; no next)", min: 1, max: PEOPLE_PERSON_MAX, without: ["limit", "cursor"] } },
|
|
359
|
+
page: WALLET_PAGE,
|
|
360
|
+
errors: WALLET_ERR,
|
|
361
|
+
body: B.PEOPLE,
|
|
362
|
+
}),
|
|
306
363
|
roles: site({ pattern: "/floor-amm/roles/<wallet>", query: WALLET_PAGE_KEYS("opaque, a page of launches in create order"), page: WALLET_PAGE, errors: WALLET_ERR, body: B.ROLES }),
|
|
307
364
|
|
|
308
365
|
handlePlaces: site({
|
|
@@ -443,6 +500,7 @@ export function queryRefusal(name , q )
|
|
|
443
500
|
}
|
|
444
501
|
case "list": {
|
|
445
502
|
const parts = raw.split(",").filter((s) => s !== "");
|
|
503
|
+
if (k.min !== undefined && parts.length < k.min) return `at least ${k.min} ${key}`;
|
|
446
504
|
if (k.max !== undefined && parts.length > k.max) return `at most ${k.max} ${key}`;
|
|
447
505
|
const it = k.item;
|
|
448
506
|
if (it !== undefined && parts.some((x) => !DIGITS.test(x) || Number(x) < it.min || Number(x) > it.max)) return `each ${key} must be an integer ${it.min}..${it.max}`;
|
|
@@ -483,7 +541,7 @@ const ROWS_PRODUCT =
|
|
|
483
541
|
candlesMany: { list: "ids", max: CANDLES_MANY_ROWS_MAX },
|
|
484
542
|
};
|
|
485
543
|
|
|
486
|
-
const TABLE_REQUIRED = new Set (["search", "launchLists", "candlesMany"]);
|
|
544
|
+
const TABLE_REQUIRED = new Set (["search", "launchLists", "candlesMany", "raiseSeries", "launchTraded"]);
|
|
487
545
|
|
|
488
546
|
const BOOLS = { true: true, false: false, 1: true, 0: false };
|
|
489
547
|
|
|
@@ -502,7 +560,8 @@ export function queryBool(name , q , key )
|
|
|
502
560
|
export function spanRefusal(name , q , toDefault ) {
|
|
503
561
|
const p = INDEXER_CONTRACT[name].page;
|
|
504
562
|
if (p.kind !== "range" || p.span === undefined) return null;
|
|
505
|
-
const
|
|
563
|
+
const key = queryArg(name, q, p.span.interval) ?? "";
|
|
564
|
+
const sec = p.span.seconds === true ? (DIGITS.test(key) && Number(key) > 0 ? Number(key) : undefined) : (B.CANDLE_INTERVAL_SECS )[key];
|
|
506
565
|
const fromRaw = q.get(p.from), toRaw = q.get(p.to);
|
|
507
566
|
if (sec === undefined || fromRaw === null || !DIGITS.test(fromRaw)) return null;
|
|
508
567
|
const to = toRaw === null ? toDefault : DIGITS.test(toRaw) ? Number(toRaw) : undefined;
|
|
@@ -510,5 +569,5 @@ export function spanRefusal(name , q , toDefault
|
|
|
510
569
|
const from = Number(fromRaw);
|
|
511
570
|
if (from > to) return null;
|
|
512
571
|
const bucket = (t ) => Math.floor(t / sec) * sec;
|
|
513
|
-
return (bucket(to) - bucket(from)) / sec + 1 > p.span.max ? `the range spans more than ${p.span.max} candles` : null;
|
|
572
|
+
return (bucket(to) - bucket(from)) / sec + 1 > p.span.max ? `the range spans more than ${p.span.max} ${p.span.seconds === true ? "points" : "candles"}` : null;
|
|
514
573
|
}
|
package/dist/indexer/paths.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
export const INDEXER_ROUTES = {
|
|
4
4
|
head: { pattern: "/floor-amm/head", keys: [] },
|
|
5
5
|
latestBlock: { pattern: "/floor-amm/latest-block", keys: [] },
|
|
6
|
-
stream: { pattern: "/floor-amm/stream", keys: ["launch", "state", "lastEventId"] },
|
|
6
|
+
stream: { pattern: "/floor-amm/stream", keys: ["launch", "state", "lastEventId", "seat", "compress", "refs"] },
|
|
7
7
|
quotes: { pattern: "/floor-amm/quotes", keys: [] },
|
|
8
8
|
summary: { pattern: "/floor-amm/summary", keys: [] },
|
|
9
9
|
floorRouted: { pattern: "/floor-amm/floor-routed", keys: ["limit", "cursor"] },
|
|
@@ -23,10 +23,13 @@ export const INDEXER_ROUTES = {
|
|
|
23
23
|
traders: { pattern: "/floor-amm/launches/<launch>/traders", keys: ["window", "limit"] },
|
|
24
24
|
quoteChain: { pattern: "/floor-amm/launches/<launch>/chain", keys: [] },
|
|
25
25
|
devTrades: { pattern: "/floor-amm/launches/<launch>/dev", keys: ["limit"] },
|
|
26
|
-
burns: { pattern: "/floor-amm/launches/<launch>/burns", keys: ["limit", "before"] },
|
|
26
|
+
burns: { pattern: "/floor-amm/launches/<launch>/burns", keys: ["limit", "before", "wallet"] },
|
|
27
27
|
launchLocks: { pattern: "/floor-amm/launches/<launch>/locks", keys: [] },
|
|
28
28
|
marks: { pattern: "/floor-amm/launches/<launch>/marks", keys: ["limit", "before"] },
|
|
29
29
|
price: { pattern: "/floor-amm/launches/<launch>/price", keys: [] },
|
|
30
|
+
raiseSeries: { pattern: "/floor-amm/launches/<launch>/raise-series", keys: ["step", "from", "to"] },
|
|
31
|
+
floorSteps: { pattern: "/floor-amm/launches/<launch>/floor-steps", keys: ["from", "to", "points"] },
|
|
32
|
+
launchTraded: { pattern: "/floor-amm/launches/<launch>/traded", keys: ["wallets"] },
|
|
30
33
|
highs: { pattern: "/floor-amm/launches/<launch>/highs", keys: ["atLeast", "limit"] },
|
|
31
34
|
candleBundle: { pattern: "/floor-amm/launches/<launch>/candle-bundle", keys: ["intervals", "limit"] },
|
|
32
35
|
candles: { pattern: "/floor-amm/candles", keys: ["launch", "interval", "from", "to", "before", "limit"] },
|
|
@@ -35,20 +38,21 @@ export const INDEXER_ROUTES = {
|
|
|
35
38
|
tonActivity: { pattern: "/floor-amm/wallets/<wallet>/ton-activity", keys: ["limit", "before"] },
|
|
36
39
|
tonOutcome: { pattern: "/floor-amm/wallets/<wallet>/ton-outcome", keys: ["queryId"] },
|
|
37
40
|
positions: { pattern: "/floor-amm/wallets/<wallet>/positions", keys: ["limit", "cursor"] },
|
|
41
|
+
positionTotals: { pattern: "/floor-amm/wallets/<wallet>/position-totals", keys: ["launch", "limit", "cursor"] },
|
|
38
42
|
inbox: { pattern: "/floor-amm/wallets/<wallet>/inbox", keys: ["limit", "before"] },
|
|
39
43
|
walletLocks: { pattern: "/floor-amm/wallets/<wallet>/locks", keys: ["limit", "cursor"] },
|
|
40
44
|
claimHistory: { pattern: "/floor-amm/wallets/<wallet>/claims", keys: ["limit", "cursor"] },
|
|
41
45
|
firsts: { pattern: "/floor-amm/wallets/<wallet>/firsts", keys: [] },
|
|
42
46
|
firstsMany: { pattern: "/floor-amm/wallets/firsts", keys: ["wallets"] },
|
|
43
47
|
claimView: { pattern: "/floor-amm/claims/<wallet>", keys: ["limit", "cursor"] },
|
|
44
|
-
people: { pattern: "/floor-amm/referrals/<wallet>/people", keys: ["limit", "cursor"] },
|
|
48
|
+
people: { pattern: "/floor-amm/referrals/<wallet>/people", keys: ["limit", "cursor", "person"] },
|
|
45
49
|
roles: { pattern: "/floor-amm/roles/<wallet>", keys: ["limit", "cursor"] },
|
|
46
50
|
handlePlaces: { pattern: "/floor-amm/handles/<handle>/places", keys: ["limit", "cursor"] },
|
|
47
51
|
traderBoard: { pattern: "/floor-amm/leaderboards/traders", keys: ["window", "limit"] },
|
|
48
52
|
launcherBoard: { pattern: "/floor-amm/leaderboards/launchers", keys: ["limit"] },
|
|
49
53
|
} ;
|
|
50
54
|
|
|
51
|
-
export const LAUNCH_SORTS = ["created", "newest", "volume1h", "volume24h", "volume7d", "volume", "marketCap", "liquidity", "backed", "trades24h", "holders", "change1h", "change24h", "lastTrade", "nearFloor", "trending", "
|
|
55
|
+
export const LAUNCH_SORTS = ["created", "newest", "volume1h", "volume24h", "volume7d", "volume", "marketCap", "liquidity", "backed", "trades24h", "holders", "change1h", "change24h", "lastTrade", "nearFloor", "trending", "holdersChange24h", "standingVolume", "standingMarketCap", "standingBacked", "maxloss"] ;
|
|
52
56
|
|
|
53
57
|
export const IDS_MAX = 100;
|
|
54
58
|
|
|
@@ -78,8 +82,14 @@ export const PRESET_FILTER_MAX = 16;
|
|
|
78
82
|
|
|
79
83
|
export const FIRSTS_MAX = 100;
|
|
80
84
|
|
|
85
|
+
export const TRADED_WALLETS_MAX = 100;
|
|
86
|
+
|
|
87
|
+
export const POSITION_TOTALS_PAGE_MAX = 100;
|
|
88
|
+
|
|
81
89
|
export const STREAM_STATE_MAX = 16;
|
|
82
90
|
|
|
91
|
+
export const PEOPLE_PERSON_MAX = 8;
|
|
92
|
+
|
|
83
93
|
export function query(q ) {
|
|
84
94
|
const p = new URLSearchParams();
|
|
85
95
|
for (const [k, v] of Object.entries(q)) {
|
|
@@ -110,7 +120,7 @@ export const indexerPath = {
|
|
|
110
120
|
latestBlock: () => "/floor-amm/latest-block",
|
|
111
121
|
stream: (q = {}) => {
|
|
112
122
|
if ((q.state?.length ?? 0) > STREAM_STATE_MAX) throw new RangeError(`at most ${STREAM_STATE_MAX} state ids`);
|
|
113
|
-
return `/floor-amm/stream${query({ launch: q.launch?.length ? q.launch : undefined, state: q.state?.length ? q.state : undefined, lastEventId: q.lastEventId })}`;
|
|
123
|
+
return `/floor-amm/stream${query({ launch: q.launch?.length ? q.launch : undefined, state: q.state?.length ? q.state : undefined, lastEventId: q.lastEventId, seat: q.seat, compress: q.compress === true ? 1 : undefined, refs: q.refs === true ? 1 : undefined })}`;
|
|
114
124
|
},
|
|
115
125
|
quotes: () => "/floor-amm/quotes",
|
|
116
126
|
summary: () => "/floor-amm/summary",
|
|
@@ -147,10 +157,18 @@ export const indexerPath = {
|
|
|
147
157
|
traders: (id , q = {}) => launchPath(id, `/traders${query({ window: q.window, limit: q.limit })}`),
|
|
148
158
|
quoteChain: (id ) => launchPath(id, "/chain"),
|
|
149
159
|
devTrades: (id , q = {}) => launchPath(id, `/dev${query({ limit: q.limit })}`),
|
|
150
|
-
|
|
160
|
+
|
|
161
|
+
burns: (id , q = {}) => launchPath(id, `/burns${query({ limit: q.limit, before: q.before, wallet: q.wallet })}`),
|
|
151
162
|
launchLocks: (id ) => launchPath(id, "/locks"),
|
|
152
163
|
marks: (id , q = {}) => launchPath(id, `/marks${query({ limit: q.limit, before: q.before })}`),
|
|
153
164
|
price: (id ) => launchPath(id, "/price"),
|
|
165
|
+
raiseSeries: (id , q ) => launchPath(id, `/raise-series${query({ step: q.step, from: q.from, to: q.to })}`),
|
|
166
|
+
floorSteps: (id , q = {}) => launchPath(id, `/floor-steps${query({ from: q.from, to: q.to, points: q.points })}`),
|
|
167
|
+
|
|
168
|
+
launchTraded: (id , wallets ) => {
|
|
169
|
+
if (wallets.length === 0 || wallets.length > TRADED_WALLETS_MAX) throw new RangeError(`1..${TRADED_WALLETS_MAX} wallets`);
|
|
170
|
+
return launchPath(id, `/traded${query({ wallets })}`);
|
|
171
|
+
},
|
|
154
172
|
|
|
155
173
|
highs: (id , q = {}) => launchPath(id, `/highs${query({ atLeast: q.atLeast === undefined ? undefined : String(q.atLeast), limit: q.limit })}`),
|
|
156
174
|
|
|
@@ -170,6 +188,7 @@ export const indexerPath = {
|
|
|
170
188
|
tonOutcome: (w , queryId ) => walletPath(w, `/ton-outcome${query({ queryId: String(queryId) })}`),
|
|
171
189
|
|
|
172
190
|
positions: (w , q = {}) => walletPath(w, `/positions${query({ limit: q.limit, cursor: q.cursor })}`),
|
|
191
|
+
positionTotals: (w , q = {}) => walletPath(w, `/position-totals${query({ launch: q.launch, limit: q.limit, cursor: q.cursor })}`),
|
|
173
192
|
|
|
174
193
|
inbox: (w , q = {}) => walletPath(w, `/inbox${query({ limit: q.limit, before: q.before })}`),
|
|
175
194
|
walletLocks: (w , q = {}) => walletPath(w, `/locks${query({ limit: q.limit, cursor: q.cursor })}`),
|
|
@@ -182,7 +201,15 @@ export const indexerPath = {
|
|
|
182
201
|
},
|
|
183
202
|
claimView: (w , q = {}) => `/floor-amm/claims/${seg(w)}${query({ limit: q.limit, cursor: q.cursor })}`,
|
|
184
203
|
|
|
185
|
-
people: (w , q
|
|
204
|
+
people: (w , q = {}) => {
|
|
205
|
+
if (q.person !== undefined) {
|
|
206
|
+
|
|
207
|
+
const canon = q.person.map((w) => (/^0x[0-9a-fA-F]{40}$/.test(w) ? w.toLowerCase() : w));
|
|
208
|
+
if (q.person.length < 1 || q.person.length > PEOPLE_PERSON_MAX || new Set(canon).size !== canon.length) throw new RangeError(`1..${PEOPLE_PERSON_MAX} distinct person wallets`);
|
|
209
|
+
if (q.limit !== undefined || q.cursor !== undefined) throw new RangeError("person cannot be given with limit / cursor");
|
|
210
|
+
}
|
|
211
|
+
return `/floor-amm/referrals/${seg(w)}/people${query({ limit: q.limit, cursor: q.cursor, person: q.person })}`;
|
|
212
|
+
},
|
|
186
213
|
|
|
187
214
|
roles: (w , q = {}) => `/floor-amm/roles/${seg(w)}${query({ limit: q.limit, cursor: q.cursor })}`,
|
|
188
215
|
handlePlaces: (handle , q = {}) => `/floor-amm/handles/${seg(handle)}/places${query({ limit: q.limit, cursor: q.cursor })}`,
|
package/dist/indexer/read.js
CHANGED
|
@@ -9,7 +9,7 @@ import { errorCode } from "./contract.js";
|
|
|
9
9
|
export * from "./bodies.js";
|
|
10
10
|
export { ShapeError, decode } from "./decode.js";
|
|
11
11
|
|
|
12
|
-
export { FIRSTS_MAX, IDS_MAX, INDEXER_ROUTES, LAUNCHES_PAGE_DEFAULT, LAUNCHES_PAGE_MAX, LAUNCH_CURSOR_MAX, LAUNCH_SORTS, PRESET_FILTER_MAX, STREAM_STATE_MAX, INBOX_PAGE_DEFAULT, INBOX_PAGE_MAX, WALLET_CURSOR_MAX, WALLET_PAGE_DEFAULT, WALLET_PAGE_MAX, indexerPath, query } from "./paths.js";
|
|
12
|
+
export { FIRSTS_MAX, POSITION_TOTALS_PAGE_MAX, TRADED_WALLETS_MAX, IDS_MAX, INDEXER_ROUTES, LAUNCHES_PAGE_DEFAULT, LAUNCHES_PAGE_MAX, LAUNCH_CURSOR_MAX, LAUNCH_SORTS, PEOPLE_PERSON_MAX, PRESET_FILTER_MAX, STREAM_STATE_MAX, INBOX_PAGE_DEFAULT, INBOX_PAGE_MAX, WALLET_CURSOR_MAX, WALLET_PAGE_DEFAULT, WALLET_PAGE_MAX, indexerPath, query } from "./paths.js";
|
|
13
13
|
export { ADDRESS_PREFIX_MIN, SEARCH_PAGE_DEFAULT, SEARCH_PAGE_MAX, SEARCH_PARITY_CORPUS, SEARCH_Q_MAX, SEARCH_SUBSTRING_MIN, searchFold, searchNeedle, searchNeedles, searchServed, searchServedTier, searchTier, searchTierFolded } from "./search.js";
|
|
14
14
|
|
|
15
15
|
export * from "./partners.js";
|
|
@@ -87,12 +87,21 @@ export const readTraders = (get , id , q
|
|
|
87
87
|
export const readQuoteChain = (get , id ) => readRoute(get, indexerPath.quoteChain(id), B.QUOTE_CHAIN);
|
|
88
88
|
|
|
89
89
|
export const readDevTrades = (get , id , q = {}) => readRoute(get, indexerPath.devTrades(id, q), B.DEV_TRADES);
|
|
90
|
-
|
|
90
|
+
|
|
91
|
+
export const readBurns = (get , id , q = {}) => readRoute(get, indexerPath.burns(id, q), B.BURNS);
|
|
91
92
|
export const readLaunchLocks = (get , id ) => readRoute(get, indexerPath.launchLocks(id), B.LAUNCH_LOCKS);
|
|
92
93
|
|
|
93
94
|
export const readMarks = (get , id , q = {}) => readRoute(get, indexerPath.marks(id, q), B.MARKS);
|
|
94
95
|
export const readPrice = (get , id ) => readRoute(get, indexerPath.price(id), B.PRICE);
|
|
95
96
|
|
|
97
|
+
export const readRaiseSeries = (get , id , q ) => readRoute(get, indexerPath.raiseSeries(id, q), B.RAISE_SERIES);
|
|
98
|
+
|
|
99
|
+
export const readFloorSteps = (get , id , q = {}) => readRoute(get, indexerPath.floorSteps(id, q), B.FLOOR_STEPS);
|
|
100
|
+
|
|
101
|
+
export const readLaunchTraded = (get , id , wallets ) => readRoute(get, indexerPath.launchTraded(id, wallets), B.LAUNCH_TRADED);
|
|
102
|
+
|
|
103
|
+
export const readPositionTotals = (get , wallet , q = {}) => readRoute(get, indexerPath.positionTotals(wallet, q), B.POSITION_TOTALS);
|
|
104
|
+
|
|
96
105
|
export const readCandles = (get , q ) => readRoute(get, indexerPath.candles(q), B.CANDLES);
|
|
97
106
|
|
|
98
107
|
export const readCandlesMany = (get , q ) => readRoute(get, indexerPath.candlesMany(q), B.CANDLES_MANY);
|
|
@@ -112,7 +121,7 @@ export const readClaimView = (get , wallet , q = {})
|
|
|
112
121
|
export const readFirsts = (get , wallet ) => readRoute(get, indexerPath.firsts(wallet), B.FIRSTS);
|
|
113
122
|
|
|
114
123
|
export const readFirstsMany = (get , wallets ) => readRoute(get, indexerPath.firstsMany(wallets), B.FIRSTS_MANY);
|
|
115
|
-
export const readPeople = (get , wallet , q
|
|
124
|
+
export const readPeople = (get , wallet , q = {}) => readRoute(get, indexerPath.people(wallet, q), B.PEOPLE);
|
|
116
125
|
export const readRoles = (get , wallet , q = {}) => readRoute(get, indexerPath.roles(wallet, q), B.ROLES);
|
|
117
126
|
|
|
118
127
|
export const readHandlePlaces = (get , handle , q = {}) => readRoute(get, indexerPath.handlePlaces(handle, q), B.HANDLE_PLACES);
|
package/dist/indexer/stream.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
3
|
import { decode, int, nullable, object, optional, str, unknown } from "./decode.js";
|
|
4
|
-
import { HEAD, LIVE_LAUNCH,
|
|
4
|
+
import { HEAD, LIVE_LAUNCH, STREAM_TRADE } from "./bodies.js";
|
|
5
5
|
|
|
6
6
|
import { indexerPath } from "./paths.js";
|
|
7
7
|
|
|
@@ -24,7 +24,7 @@ export function decodeStreamFrame(event , data , id )
|
|
|
24
24
|
return { event, data: decode(HEAD_SEEN, data) };
|
|
25
25
|
case "trade":
|
|
26
26
|
if (id === undefined) return null;
|
|
27
|
-
return { event, id, data: decode(
|
|
27
|
+
return { event, id, data: decode(STREAM_TRADE, data) };
|
|
28
28
|
case "launch": {
|
|
29
29
|
const d = data ;
|
|
30
30
|
if (d !== null && typeof d === "object" && d.gone === true) return { event: "launchGone", data: { launch: str(d.launch, "launch"), gone: true } };
|
package/dist/math/v2/book.js
CHANGED
|
@@ -31,6 +31,10 @@ export const KIND_TAIL = 5;
|
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
34
38
|
const ov = (x ) => (x === null ? fail("Overflow") : x);
|
|
35
39
|
const u64 = (x ) => (x < 0n || x > U64_MAX ? fail("Overflow") : x);
|
|
36
40
|
const u128 = (x ) => (x < 0n || x > U128_MAX ? fail("Overflow") : x);
|
|
@@ -72,7 +76,7 @@ export function emptyBook(sqrtP , feePpm ) {
|
|
|
72
76
|
return {
|
|
73
77
|
sqrtP, sqrtF: 0n, sqrtLMax: 0n, floor: 0n, floorTokens: 0n, nBands: 0, nC: 0,
|
|
74
78
|
bandEdge: new Array(BIDS_MAX + 1).fill(0n), bandMoney: new Array(BIDS_MAX).fill(0n), bandTokens: new Array(BIDS_MAX).fill(0n),
|
|
75
|
-
bandF: new Array(BIDS_MAX).fill(0n), bandFClaim: new Array(BIDS_MAX).fill(0n), ckAtF: 0n, ckFloorTokens: 0n, feePpm: [...feePpm], feeStartPpm: [0, 0, 0, 0, 0], sqrtFeeA: 0n, sqrtFeeB: 0n, graduated: false, nRanges: 0, ranges: Array.from({ length: RANGES_MAX }, emptyRange),
|
|
79
|
+
bandF: new Array(BIDS_MAX).fill(0n), bandFClaim: new Array(BIDS_MAX).fill(0n), ckAtF: 0n, ckFloorTokens: 0n, kpot: true, kAtF: 0n, kFloorTokens: 0n, feePpm: [...feePpm], feeStartPpm: [0, 0, 0, 0, 0], sqrtFeeA: 0n, sqrtFeeB: 0n, graduated: false, nRanges: 0, ranges: Array.from({ length: RANGES_MAX }, emptyRange),
|
|
76
80
|
};
|
|
77
81
|
}
|
|
78
82
|
|
|
@@ -196,6 +200,21 @@ export const ckMoney = (b ) => sum(b.bandMoney, b.nBands) - sum(b.b
|
|
|
196
200
|
|
|
197
201
|
export const ckHeld = (b ) => sum(b.bandTokens, b.nBands) + b.ckFloorTokens;
|
|
198
202
|
|
|
203
|
+
export const kSeg = (b ) => (b.kpot && b.nBands === b.nC + 1 ? b.nC : null);
|
|
204
|
+
|
|
205
|
+
export const cMoney = (b ) => sum(b.bandMoney, b.nC) - sum(b.bandF, b.nC) + (b.ckAtF - b.kAtF);
|
|
206
|
+
|
|
207
|
+
export const kMoney = (b ) => ckMoney(b) - cMoney(b);
|
|
208
|
+
|
|
209
|
+
export const cHeld = (b ) => sum(b.bandTokens, b.nC) + (b.ckFloorTokens - b.kFloorTokens);
|
|
210
|
+
|
|
211
|
+
export const kHeld = (b ) => ckHeld(b) - cHeld(b);
|
|
212
|
+
|
|
213
|
+
export function kHolds(b ) {
|
|
214
|
+
const k = kSeg(b);
|
|
215
|
+
return k !== null && (b.bandTokens[k] > 0n || b.bandFClaim[k] > 0n);
|
|
216
|
+
}
|
|
217
|
+
|
|
199
218
|
const bidMoneySum = (b ) => b.floor + sum(b.bandMoney, b.nBands);
|
|
200
219
|
|
|
201
220
|
export const placeMoney = (b ) => {
|
|
@@ -259,6 +278,8 @@ export function checkBook(b ) {
|
|
|
259
278
|
}
|
|
260
279
|
}
|
|
261
280
|
if (b.ckAtF > b.floor || b.ckFloorTokens > b.floorTokens) fail("Overflow");
|
|
281
|
+
if (b.kAtF > b.ckAtF || b.kFloorTokens > b.ckFloorTokens) fail("Overflow");
|
|
282
|
+
if (b.kpot && b.nBands > b.nC + 1) fail("SqrtRange");
|
|
262
283
|
}
|
|
263
284
|
|
|
264
285
|
function flatUp(b ) {
|
|
@@ -343,6 +364,14 @@ function floorRebuy(b , take , cost ) {
|
|
|
343
364
|
if (xe > 0n) {
|
|
344
365
|
const back = (cost * xe) / x0;
|
|
345
366
|
const gone = min((take * xe + x0 - 1n) / x0, xe);
|
|
367
|
+
|
|
368
|
+
const xk = b.kFloorTokens;
|
|
369
|
+
if (xk > 0n) {
|
|
370
|
+
const backK = (back * xk) / xe;
|
|
371
|
+
const goneK = min(min((gone * xk + xe - 1n) / xe, xk), gone);
|
|
372
|
+
b.kAtF = u128(b.kAtF + backK);
|
|
373
|
+
b.kFloorTokens -= goneK;
|
|
374
|
+
}
|
|
346
375
|
b.ckAtF = u128(b.ckAtF + back);
|
|
347
376
|
b.ckFloorTokens -= gone;
|
|
348
377
|
}
|
|
@@ -534,12 +563,14 @@ export function walkDownAcc(b , tokens , acc , u = new
|
|
|
534
563
|
charge(b, acc, q);
|
|
535
564
|
if (fp.t === "floor") {
|
|
536
565
|
|
|
537
|
-
const ce = min(q, b.ckAtF);
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
566
|
+
const ce = min(q, b.ckAtF - b.kAtF);
|
|
567
|
+
const ke = min(q - ce, b.kAtF);
|
|
568
|
+
const xc = ce > 0n ? min(ov(flatTokensForMoney(s, ce, DOWN)), take) : 0n;
|
|
569
|
+
const xk = ke > 0n ? min(ov(flatTokensForMoney(s, ke, DOWN)), take - xc) : 0n;
|
|
570
|
+
b.ckAtF -= ce + ke;
|
|
571
|
+
b.kAtF -= ke;
|
|
572
|
+
b.ckFloorTokens = u64(b.ckFloorTokens + xc + xk);
|
|
573
|
+
b.kFloorTokens = u64(b.kFloorTokens + xk);
|
|
543
574
|
b.floor -= q;
|
|
544
575
|
b.floorTokens = u64(b.floorTokens + take);
|
|
545
576
|
w.fromF += q;
|
|
@@ -585,6 +616,8 @@ export function walkDownAcc(b , tokens , acc , u = new
|
|
|
585
616
|
|
|
586
617
|
b.floor = u128(b.floor + b.bandMoney[j]);
|
|
587
618
|
b.ckAtF = u128(b.ckAtF + b.bandMoney[j] - b.bandF[j]);
|
|
619
|
+
|
|
620
|
+
if (kSeg(b) === j) b.kAtF = u128(b.kAtF + b.bandMoney[j] - b.bandF[j]);
|
|
588
621
|
b.bandMoney[j] = 0n;
|
|
589
622
|
b.bandF[j] = 0n;
|
|
590
623
|
}
|
package/dist/math/v2/create.js
CHANGED
|
@@ -115,7 +115,7 @@ export function teamBuyV2(book , gross , max ) {
|
|
|
115
115
|
const take = gross < max ? gross : max;
|
|
116
116
|
if (take === 0n) {
|
|
117
117
|
return { gross, net: 0n, refund: gross, tokens: 0n, fees: [0n, 0n, 0n, 0n, 0n], fromResale: 0n, fromFirst: 0n, steps: 0, budgetHit: false, graduatedNow: false, sqrtBefore: book.sqrtP, sqrtAfter: book.sqrtP,
|
|
118
|
-
split: { dF: 0n, ckAdd: 0n, ckTake: 0n, ms: 0n, booked: [0n, 0n, 0n, 0n], sqrtFNew: 0n }, relay: { nC: 0, nK: 0, laidC: 0n, laidK: 0n, atF: 0n, kept: 0 } };
|
|
118
|
+
split: { dF: 0n, ckAdd: 0n, ckTake: 0n, cAdd: 0n, kAdd: 0n, cTake: 0n, kTake: 0n, ms: 0n, booked: [0n, 0n, 0n, 0n], sqrtFNew: 0n }, relay: { nC: 0, nK: 0, laidC: 0n, laidK: 0n, atF: 0n, kAtF: 0n, kept: 0 } };
|
|
119
119
|
}
|
|
120
120
|
const r = bookBuy(book, take, 0n);
|
|
121
121
|
return { ...r, refund: r.refund + gross - take, gross };
|
package/dist/math/v2/fees.js
CHANGED
|
@@ -101,9 +101,28 @@ export function netFromGross(gross , ppm ) {
|
|
|
101
101
|
return net;
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
export const TRADER_REF_BPS = [
|
|
104
|
+
export const TRADER_REF_BPS = [2_400, 420, 180];
|
|
105
105
|
|
|
106
|
-
export const CREATOR_REF_BPS = [
|
|
106
|
+
export const CREATOR_REF_BPS = [800, 140, 60];
|
|
107
|
+
|
|
108
|
+
export const TRADER_REF_OG_BPS = [4_000, 700, 300];
|
|
109
|
+
|
|
110
|
+
export const CREATOR_REF_OG_BPS = [2_400, 420, 180];
|
|
111
|
+
|
|
112
|
+
export const OG_WINDOW_SECS = 15_811_200n;
|
|
113
|
+
|
|
114
|
+
export const OG_MAX = 100;
|
|
115
|
+
const OG_U64_MAX = (1n << 64n) - 1n;
|
|
116
|
+
|
|
117
|
+
export const ogUntil = (from ) => (from === 0n ? 0n : from + OG_WINDOW_SECS > OG_U64_MAX ? OG_U64_MAX : from + OG_WINDOW_SECS);
|
|
118
|
+
|
|
119
|
+
export const ogLive = (until , now ) => now < until;
|
|
120
|
+
|
|
121
|
+
export const ogLaunch = (from , until , createdAt , now ) =>
|
|
122
|
+
from !== 0n && from <= createdAt && createdAt < until && now < until;
|
|
123
|
+
|
|
124
|
+
export const tierBps = (bps , ogBps , og ) =>
|
|
125
|
+
[0, 1, 2].map((i) => (og[i] ? ogBps[i] : bps[i] ));
|
|
107
126
|
|
|
108
127
|
export function slices(fee , present , bps ) {
|
|
109
128
|
const out = [0n, 0n, 0n];
|
|
@@ -117,5 +136,12 @@ export function slices(fee , present , bps
|
|
|
117
136
|
}
|
|
118
137
|
return [out, left];
|
|
119
138
|
}
|
|
120
|
-
|
|
121
|
-
|
|
139
|
+
const NO_OG = [false, false, false];
|
|
140
|
+
|
|
141
|
+
export const platformLegsOg = (platform , traderPresent , og ) =>
|
|
142
|
+
slices(platform, traderPresent, tierBps(TRADER_REF_BPS, TRADER_REF_OG_BPS, og));
|
|
143
|
+
|
|
144
|
+
export const creatorLegsOg = (creator , creatorPresent , og ) =>
|
|
145
|
+
slices(creator, creatorPresent, tierBps(CREATOR_REF_BPS, CREATOR_REF_OG_BPS, og));
|
|
146
|
+
export const platformLegs = (platform , traderPresent ) => platformLegsOg(platform, traderPresent, NO_OG);
|
|
147
|
+
export const creatorLegs = (creator , creatorPresent ) => creatorLegsOg(creator, creatorPresent, NO_OG);
|
|
@@ -21,7 +21,7 @@ export function splitByRow(amount , platformBps , floorBps
|
|
|
21
21
|
|
|
22
22
|
export function teamSplit(amount , levelsPresent ) {
|
|
23
23
|
const tenth = amount / 10n;
|
|
24
|
-
const w = [
|
|
24
|
+
const w = [80n, 14n, 6n];
|
|
25
25
|
const referrers = [0n, 0n, 0n];
|
|
26
26
|
let paid = 0n;
|
|
27
27
|
for (let i = 0; i < 3; i++) {
|
package/dist/math/v2/receipt.js
CHANGED
|
@@ -5,7 +5,7 @@ import { MAX_WALK_STEPS, ckMoney, cloneBook } from "./book.js";
|
|
|
5
5
|
import { bestBidPriceX64V2, dexLiquidityV2, nextBuyPriceX64, stackViewV2 } from "./display.js";
|
|
6
6
|
|
|
7
7
|
import { FEE_LEGS, LEG_BACKING, LEG_FLOOR, LEG_HOLDER, LEG_PLATFORM, LEG_TEAM, feeTotal } from "./fees.js";
|
|
8
|
-
import {
|
|
8
|
+
import { creatorLegsOgV2, platformLegsOgV2, splitMembersV2 } from "./team.js";
|
|
9
9
|
import { bookBuy, bookSell } from "./trade.js";
|
|
10
10
|
|
|
11
11
|
import { U64_MAX, U128_MAX } from "./wide.js";
|
|
@@ -71,8 +71,8 @@ export function feePartsV2(fees , opts = {})
|
|
|
71
71
|
const none = [false, false, false];
|
|
72
72
|
const team = fees[LEG_TEAM];
|
|
73
73
|
const platform = fees[LEG_PLATFORM];
|
|
74
|
-
const [teamCreatorRefs, teamRest] =
|
|
75
|
-
const [platformTraderRefs, platformBucket] =
|
|
74
|
+
const [teamCreatorRefs, teamRest] = creatorLegsOgV2(team, opts.creatorRefs ?? none, opts.creatorOg ?? none);
|
|
75
|
+
const [platformTraderRefs, platformBucket] = platformLegsOgV2(platform, opts.traderRefs ?? none, opts.traderOg ?? none);
|
|
76
76
|
const w = opts.slotWeights;
|
|
77
77
|
const split = w !== undefined && w.some((x) => x !== 0);
|
|
78
78
|
const [teamMembers, teamDust] = split ? splitMembersV2(teamRest, w) : [Array(w?.length ?? 10).fill(0n) , 0n];
|