@peddles/sdk 0.2.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/CLAUDE_PROMPT.md +159 -0
- package/LICENSE +21 -0
- package/README.md +186 -0
- package/dist/abis.d.ts +19 -0
- package/dist/abis.d.ts.map +1 -0
- package/dist/abis.generated.d.ts +2029 -0
- package/dist/abis.generated.d.ts.map +1 -0
- package/dist/abis.generated.js +2723 -0
- package/dist/abis.generated.js.map +1 -0
- package/dist/abis.js +19 -0
- package/dist/abis.js.map +1 -0
- package/dist/artDex.d.ts +937 -0
- package/dist/artDex.d.ts.map +1 -0
- package/dist/artDex.js +155 -0
- package/dist/artDex.js.map +1 -0
- package/dist/client.d.ts +10 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +2 -0
- package/dist/client.js.map +1 -0
- package/dist/clog.d.ts +75 -0
- package/dist/clog.d.ts.map +1 -0
- package/dist/clog.js +91 -0
- package/dist/clog.js.map +1 -0
- package/dist/clogInflow.d.ts +136 -0
- package/dist/clogInflow.d.ts.map +1 -0
- package/dist/clogInflow.js +177 -0
- package/dist/clogInflow.js.map +1 -0
- package/dist/deployments.d.ts +30 -0
- package/dist/deployments.d.ts.map +1 -0
- package/dist/deployments.generated.d.ts +92 -0
- package/dist/deployments.generated.d.ts.map +1 -0
- package/dist/deployments.generated.js +93 -0
- package/dist/deployments.generated.js.map +1 -0
- package/dist/deployments.js +52 -0
- package/dist/deployments.js.map +1 -0
- package/dist/feeSplit.d.ts +54 -0
- package/dist/feeSplit.d.ts.map +1 -0
- package/dist/feeSplit.js +69 -0
- package/dist/feeSplit.js.map +1 -0
- package/dist/feeTerms.d.ts +46 -0
- package/dist/feeTerms.d.ts.map +1 -0
- package/dist/feeTerms.js +80 -0
- package/dist/feeTerms.js.map +1 -0
- package/dist/index.d.ts +102 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +108 -0
- package/dist/index.js.map +1 -0
- package/dist/launch/abi.generated.d.ts +2667 -0
- package/dist/launch/abi.generated.d.ts.map +1 -0
- package/dist/launch/abi.generated.js +2472 -0
- package/dist/launch/abi.generated.js.map +1 -0
- package/dist/launch/addresses.d.ts +24 -0
- package/dist/launch/addresses.d.ts.map +1 -0
- package/dist/launch/addresses.js +35 -0
- package/dist/launch/addresses.js.map +1 -0
- package/dist/launch/feeTerms.d.ts +52 -0
- package/dist/launch/feeTerms.d.ts.map +1 -0
- package/dist/launch/feeTerms.js +72 -0
- package/dist/launch/feeTerms.js.map +1 -0
- package/dist/launch/index.d.ts +33 -0
- package/dist/launch/index.d.ts.map +1 -0
- package/dist/launch/index.js +24 -0
- package/dist/launch/index.js.map +1 -0
- package/dist/launch/revert.d.ts +23 -0
- package/dist/launch/revert.d.ts.map +1 -0
- package/dist/launch/revert.js +169 -0
- package/dist/launch/revert.js.map +1 -0
- package/dist/launch/salt.d.ts +90 -0
- package/dist/launch/salt.d.ts.map +1 -0
- package/dist/launch/salt.js +153 -0
- package/dist/launch/salt.js.map +1 -0
- package/dist/launch/stockCall.d.ts +122 -0
- package/dist/launch/stockCall.d.ts.map +1 -0
- package/dist/launch/stockCall.js +144 -0
- package/dist/launch/stockCall.js.map +1 -0
- package/dist/launch/tickMath.d.ts +39 -0
- package/dist/launch/tickMath.d.ts.map +1 -0
- package/dist/launch/tickMath.js +109 -0
- package/dist/launch/tickMath.js.map +1 -0
- package/dist/launch/variants.d.ts +64 -0
- package/dist/launch/variants.d.ts.map +1 -0
- package/dist/launch/variants.js +131 -0
- package/dist/launch/variants.js.map +1 -0
- package/dist/launch/wethCall.d.ts +133 -0
- package/dist/launch/wethCall.d.ts.map +1 -0
- package/dist/launch/wethCall.js +173 -0
- package/dist/launch/wethCall.js.map +1 -0
- package/dist/launch/wethPlan.d.ts +71 -0
- package/dist/launch/wethPlan.d.ts.map +1 -0
- package/dist/launch/wethPlan.js +146 -0
- package/dist/launch/wethPlan.js.map +1 -0
- package/dist/perps/abi.generated.d.ts +794 -0
- package/dist/perps/abi.generated.d.ts.map +1 -0
- package/dist/perps/abi.generated.js +738 -0
- package/dist/perps/abi.generated.js.map +1 -0
- package/dist/perps/index.d.ts +160 -0
- package/dist/perps/index.d.ts.map +1 -0
- package/dist/perps/index.js +147 -0
- package/dist/perps/index.js.map +1 -0
- package/package.json +105 -0
- package/src/abis.generated.ts +2738 -0
- package/src/abis.ts +35 -0
- package/src/artDex.ts +254 -0
- package/src/client.ts +10 -0
- package/src/clog.ts +171 -0
- package/src/clogInflow.ts +217 -0
- package/src/deployments.generated.ts +98 -0
- package/src/deployments.ts +60 -0
- package/src/feeSplit.ts +76 -0
- package/src/feeTerms.ts +137 -0
- package/src/index.ts +233 -0
- package/src/launch/abi.generated.ts +2481 -0
- package/src/launch/addresses.ts +58 -0
- package/src/launch/feeTerms.ts +93 -0
- package/src/launch/index.ts +93 -0
- package/src/launch/revert.ts +188 -0
- package/src/launch/salt.ts +216 -0
- package/src/launch/stockCall.ts +223 -0
- package/src/launch/tickMath.ts +139 -0
- package/src/launch/variants.ts +183 -0
- package/src/launch/wethCall.ts +240 -0
- package/src/launch/wethPlan.ts +257 -0
- package/src/perps/abi.generated.ts +741 -0
- package/src/perps/index.ts +263 -0
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What share of the money buyers put in a clog routes to the creator.
|
|
3
|
+
*
|
|
4
|
+
* A clog allocation is a share of SUPPLY, but it is sold into the pool buyers are
|
|
5
|
+
* buying from, so it captures a far larger share of the money coming in. That
|
|
6
|
+
* second number is the one a buyer is accepting, and it must be stated wherever
|
|
7
|
+
* the allocation is. This module derives it; nothing here is a lookup table.
|
|
8
|
+
*
|
|
9
|
+
* Pure: no imports, bigint only, no floating point at any step. Every step is
|
|
10
|
+
* exact rational arithmetic, so the result is a fraction `num / den`; the only
|
|
11
|
+
* rounding is in `clogInflowShareBps`, once, at the end.
|
|
12
|
+
*
|
|
13
|
+
* SINGLE SOURCE OF TRUTH. `apps/web/src/features/launch/clogInflow.ts` carries a
|
|
14
|
+
* copy (the web app does not depend on this package). `__tests__/clogInflow.test.ts`
|
|
15
|
+
* imports that copy and holds the two to identical fractions over a grid, so a
|
|
16
|
+
* change to one without the other fails the SDK's tests.
|
|
17
|
+
*
|
|
18
|
+
* ── THE MODEL ───────────────────────────────────────────────────────────────
|
|
19
|
+
* Pure buy flow — nobody but the clog ever sells. That is the most favourable
|
|
20
|
+
* case for the design: any real selling makes the clog sell into a weaker pool.
|
|
21
|
+
*
|
|
22
|
+
* The pool. A Peddles launch opens a single-sided position from the launch
|
|
23
|
+
* price upward holding the liquidity share `x0 = supply - clog`. For such a
|
|
24
|
+
* position, token reserve `x` and quote `y` satisfy
|
|
25
|
+
*
|
|
26
|
+
* x · (y + x0·p0) = x0² · p0 (a constant product, k)
|
|
27
|
+
*
|
|
28
|
+
* i.e. constant product against a virtual quote reserve `x0·p0`. Write
|
|
29
|
+
* `q = y + x0·p0`, so `q0 = x0·p0` and `k = x0·q0`.
|
|
30
|
+
*
|
|
31
|
+
* One round. Buyers spend `B` (a buy never changes k): q ← q + B
|
|
32
|
+
* then the clog sells `s = min(slice, remaining)` tokens:
|
|
33
|
+
*
|
|
34
|
+
* q ← k · q / (k + s · q) (x ← x + s, q = k / x)
|
|
35
|
+
*
|
|
36
|
+
* Rounds repeat until the clog is empty. After `n` rounds buyers have put in
|
|
37
|
+
* `n·B`, and the pool holds `q_n − q0` of it; everything else was paid out to
|
|
38
|
+
* the creator. So, exactly:
|
|
39
|
+
*
|
|
40
|
+
* share of inflows = 1 − (q_n − q0) / (n · B)
|
|
41
|
+
*
|
|
42
|
+
* Buy flow per round — THE ONE ASSUMPTION. `B = flowMultiple × slice × p0`:
|
|
43
|
+
* buyers spend between releases `flowMultiple` times what a slice was worth at
|
|
44
|
+
* the launch price. Default `CLOG_MODEL_FLOW_MULTIPLE` (100).
|
|
45
|
+
*
|
|
46
|
+
* p0 cancels. Measuring quote in units of `p0` makes every term an integer
|
|
47
|
+
* count of tokens (`q0 = x0`, `k = x0²`, `B = flowMultiple × slice`), so the
|
|
48
|
+
* result depends only on (supply, clog, slice) and the flow multiple — never
|
|
49
|
+
* on the launch price, which is why it can be stated before the pool exists.
|
|
50
|
+
*
|
|
51
|
+
* The floor. A single-sided position holds no quote below its launch price, so
|
|
52
|
+
* a release can never take the price under `p0`. If a round's sale would, the
|
|
53
|
+
* model does not apply and the functions return null rather than a number from
|
|
54
|
+
* a pool that cannot exist. At flowMultiple = 100 this cannot happen anywhere
|
|
55
|
+
* in the range the factory accepts (clog ≤ `PeddlesFactoryV20.CLOG_BPS_MAX`,
|
|
56
|
+
* 25%): a round starts at `q ≥ q0`, its buys take at least `x0·B / (x0 + B)`
|
|
57
|
+
* tokens out of the pool, and a sale `s ≤ clog` fits back under the floor
|
|
58
|
+
* whenever `99·x0 ≥ 100·s` — true for every `x0 ≥ 75%` and `s ≤ 25%`.
|
|
59
|
+
*
|
|
60
|
+
* ── REFERENCE ───────────────────────────────────────────────────────────────
|
|
61
|
+
* With slices of 1% of supply (`CLOG_TABLE_SLICE_BPS`) and flowMultiple = 100
|
|
62
|
+
* this reproduces the policy table in CLAUDE.md at its 0.1% resolution
|
|
63
|
+
* (5% → 16.5%, 10% → 37.1%, 15% → 54.6%, 25% → 75.0%). A launch type's real
|
|
64
|
+
* slice is smaller — the live Sepolia Clog type sells 5% in 0.25% slices, which
|
|
65
|
+
* is ≈14.2% — so pass the slice the chain reports, never the table's.
|
|
66
|
+
*/
|
|
67
|
+
/**
|
|
68
|
+
* Buyer spend between two clog releases, as a multiple of what one slice was
|
|
69
|
+
* worth at the launch price. The one assumption in the model; see the header.
|
|
70
|
+
*/
|
|
71
|
+
export const CLOG_MODEL_FLOW_MULTIPLE = 100n;
|
|
72
|
+
/** The slice (1% of supply) at which the model reproduces the CLAUDE.md policy table. */
|
|
73
|
+
export const CLOG_TABLE_SLICE_BPS = 100n;
|
|
74
|
+
/** More rounds than any registrable launch type can need (25% in 1-unit slices of 10,000). */
|
|
75
|
+
const MAX_ROUNDS = 100000n;
|
|
76
|
+
const BPS = 10000n;
|
|
77
|
+
/**
|
|
78
|
+
* The share of buyer money a clog routes to the creator, as an exact fraction,
|
|
79
|
+
* or null when the model does not apply (a malformed input, or a release that
|
|
80
|
+
* would breach the floor). A zero clog captures nothing:
|
|
81
|
+
* `{ num: 0n, den: 1n, releases: 0n }`.
|
|
82
|
+
*/
|
|
83
|
+
export function clogShareOfInflows(input) {
|
|
84
|
+
const { supply, clog, slice } = input;
|
|
85
|
+
const flowMultiple = input.flowMultiple ?? CLOG_MODEL_FLOW_MULTIPLE;
|
|
86
|
+
if (supply <= 0n || clog < 0n || clog >= supply)
|
|
87
|
+
return null;
|
|
88
|
+
if (clog === 0n)
|
|
89
|
+
return { num: 0n, den: 1n, releases: 0n };
|
|
90
|
+
if (slice <= 0n || flowMultiple <= 0n)
|
|
91
|
+
return null;
|
|
92
|
+
const x0 = supply - clog;
|
|
93
|
+
const k = x0 * x0; // q0 = x0 in units of p0
|
|
94
|
+
const buy = flowMultiple * slice;
|
|
95
|
+
// q = qn / qd, kept as an unreduced exact fraction.
|
|
96
|
+
let qn = x0;
|
|
97
|
+
let qd = 1n;
|
|
98
|
+
let remaining = clog;
|
|
99
|
+
let rounds = 0n;
|
|
100
|
+
while (remaining > 0n) {
|
|
101
|
+
if (rounds >= MAX_ROUNDS)
|
|
102
|
+
return null;
|
|
103
|
+
rounds += 1n;
|
|
104
|
+
// Buyers spend: q ← q + B.
|
|
105
|
+
qn += buy * qd;
|
|
106
|
+
// The clog sells s tokens: q ← k·q / (k + s·q).
|
|
107
|
+
const sold = remaining < slice ? remaining : slice;
|
|
108
|
+
const nextN = k * qn;
|
|
109
|
+
const nextD = k * qd + sold * qn;
|
|
110
|
+
// Floor: q must not fall below q0 (= x0), i.e. nextN / nextD ≥ x0.
|
|
111
|
+
if (nextN < x0 * nextD)
|
|
112
|
+
return null;
|
|
113
|
+
// Left unreduced. The fraction almost never reduces, and a gcd on numbers
|
|
114
|
+
// that grow a few dozen bits per round is what makes a 2,500-round type slow.
|
|
115
|
+
qn = nextN;
|
|
116
|
+
qd = nextD;
|
|
117
|
+
remaining -= sold;
|
|
118
|
+
}
|
|
119
|
+
// share = 1 − (q − q0) / (n·B) = (n·B·qd − (qn − x0·qd)) / (n·B·qd)
|
|
120
|
+
const inflow = rounds * buy;
|
|
121
|
+
const den = inflow * qd;
|
|
122
|
+
const num = den - (qn - x0 * qd);
|
|
123
|
+
return { num, den, releases: rounds };
|
|
124
|
+
}
|
|
125
|
+
/** The same model, stated in basis points of supply — the unit a launch type declares. */
|
|
126
|
+
export function clogShareOfInflowsFromBps(clogBps, sliceBps, flowMultiple = CLOG_MODEL_FLOW_MULTIPLE) {
|
|
127
|
+
return clogShareOfInflows({ supply: BPS, clog: clogBps, slice: sliceBps, flowMultiple });
|
|
128
|
+
}
|
|
129
|
+
/** `num / den` scaled by `unit`, rounded half up. `num ≥ 0`, `den > 0`. */
|
|
130
|
+
function roundHalfUp(num, den, unit) {
|
|
131
|
+
return (num * unit * 2n + den) / (den * 2n);
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Share of inflows, in basis points, for a clog of `clogBps` of supply sold in
|
|
135
|
+
* slices of `sliceBps` of supply.
|
|
136
|
+
*
|
|
137
|
+
* Pass the launch type's own `clogSliceBps` (from `getVariantAllocation`), not
|
|
138
|
+
* the policy table's 1%: the slice moves the answer (5% in 1% slices is 1649 bps;
|
|
139
|
+
* in the live 0.25% slices it is 1417 bps).
|
|
140
|
+
*
|
|
141
|
+
* @param clogBps Clog allocation, bps of total supply.
|
|
142
|
+
* @param sliceBps Per-release cap, bps of total supply.
|
|
143
|
+
* @param flowMultiple Buyer spend between releases, in slices at the launch
|
|
144
|
+
* price. The model's one assumption; defaults to
|
|
145
|
+
* `CLOG_MODEL_FLOW_MULTIPLE` (100).
|
|
146
|
+
* @returns Nearest basis point, rounded half up — the only rounding in the model
|
|
147
|
+
* (use `clogShareOfInflows` for the exact fraction) — or null when the
|
|
148
|
+
* model does not apply.
|
|
149
|
+
*/
|
|
150
|
+
export function clogInflowShareBps(clogBps, sliceBps, flowMultiple = CLOG_MODEL_FLOW_MULTIPLE) {
|
|
151
|
+
const share = clogShareOfInflowsFromBps(clogBps, sliceBps, flowMultiple);
|
|
152
|
+
return share === null ? null : roundHalfUp(share.num, share.den, BPS);
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* What share of INFLOWS a clog routes to the creator, given its share of supply —
|
|
156
|
+
* AT THE POLICY TABLE'S 1% SLICE AND 0.1% RESOLUTION.
|
|
157
|
+
*
|
|
158
|
+
* @deprecated Kept for existing callers. It answers for the CLAUDE.md table's
|
|
159
|
+
* assumed slice, not for any real launch type's, so it overstates the live Sepolia
|
|
160
|
+
* Clog type (5%: 1650 here vs 1417 at its real 0.25% slice). Use
|
|
161
|
+
* `clogInflowShareBps(clogBps, allocation.clogSliceBps)`.
|
|
162
|
+
*
|
|
163
|
+
* Output is unchanged for the four table rows (500 → 1650, 1000 → 3710,
|
|
164
|
+
* 1500 → 5460, 2500 → 7500). It is now derived from the model rather than looked
|
|
165
|
+
* up, so any integer clog in [0, 10000) returns a value (a multiple of 10) where
|
|
166
|
+
* it used to return null; non-integer or out-of-range input still returns null.
|
|
167
|
+
*/
|
|
168
|
+
export function inflowShareBps(clogBps) {
|
|
169
|
+
if (!Number.isSafeInteger(clogBps))
|
|
170
|
+
return null;
|
|
171
|
+
const share = clogShareOfInflowsFromBps(BigInt(clogBps), CLOG_TABLE_SLICE_BPS);
|
|
172
|
+
if (share === null)
|
|
173
|
+
return null;
|
|
174
|
+
// Table resolution is 0.1% = 10 bps: round once at that resolution, then restate in bps.
|
|
175
|
+
return Number(roundHalfUp(share.num, share.den, BPS / 10n) * 10n);
|
|
176
|
+
}
|
|
177
|
+
//# sourceMappingURL=clogInflow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clogInflow.js","sourceRoot":"","sources":["../src/clogInflow.ts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,CAAC;AAC9C,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,kBAAkB,CAChC,OAAe,EACf,QAAgB,EAChB,eAAuB,wBAAwB;IAE/C,MAAM,KAAK,GAAG,yBAAyB,CAAC,OAAO,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC;IACzE,OAAO,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AACxE,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,cAAc,CAAC,OAAe;IAC5C,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC;QAAE,OAAO,IAAI,CAAC;IAChD,MAAM,KAAK,GAAG,yBAAyB,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,oBAAoB,CAAC,CAAC;IAC/E,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAChC,yFAAyF;IACzF,OAAO,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC;AACpE,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { DEPLOYMENTS, type KnownChainId, type ContractName } from './deployments.generated.js';
|
|
2
|
+
export { DEPLOYMENTS };
|
|
3
|
+
export type { KnownChainId, ContractName };
|
|
4
|
+
/** Thrown when the SDK is asked about a chain it ships no address book for. */
|
|
5
|
+
export declare class UnknownChainError extends Error {
|
|
6
|
+
readonly chainId: number;
|
|
7
|
+
constructor(chainId: number);
|
|
8
|
+
}
|
|
9
|
+
/** Thrown when a chain is known but does not carry the contract being asked for. */
|
|
10
|
+
export declare class UnknownContractError extends Error {
|
|
11
|
+
constructor(chainId: number, name: string);
|
|
12
|
+
}
|
|
13
|
+
export declare function isKnownChain(chainId: number): chainId is KnownChainId;
|
|
14
|
+
/**
|
|
15
|
+
* The address book for one chain.
|
|
16
|
+
*
|
|
17
|
+
* FAILS CLOSED, ALWAYS. An unknown chain throws rather than returning a default
|
|
18
|
+
* or an empty map, and a missing contract throws rather than returning
|
|
19
|
+
* `undefined` or the zero address. Both of those alternatives look like a
|
|
20
|
+
* working call right up until a transaction is signed against nothing.
|
|
21
|
+
*
|
|
22
|
+
* This is not hypothetical in this codebase: every address changed in a single
|
|
23
|
+
* redeploy, and one stale copy of this list had the API quoting a launchpad that
|
|
24
|
+
* no longer existed — an error that surfaced as "neither leg is a launched coin"
|
|
25
|
+
* rather than as a missing address.
|
|
26
|
+
*/
|
|
27
|
+
export declare function deploymentFor(chainId: number): Readonly<Record<string, `0x${string}`>>;
|
|
28
|
+
/** One address, or a throw. Never a default, never the zero address. */
|
|
29
|
+
export declare function addressOf(chainId: number, name: string): `0x${string}`;
|
|
30
|
+
//# sourceMappingURL=deployments.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deployments.d.ts","sourceRoot":"","sources":["../src/deployments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,YAAY,EAAE,KAAK,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE/F,OAAO,EAAE,WAAW,EAAE,CAAC;AACvB,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,CAAC;AAE3C,+EAA+E;AAC/E,qBAAa,iBAAkB,SAAQ,KAAK;IAC1C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;gBACb,OAAO,EAAE,MAAM;CAS5B;AAED,oFAAoF;AACpF,qBAAa,oBAAqB,SAAQ,KAAK;gBACjC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;CAO1C;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,IAAI,YAAY,CAErE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,MAAM,EAAE,CAAC,CAAC,CAGtF;AAED,wEAAwE;AACxE,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,KAAK,MAAM,EAAE,CAMtE"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/** Every Peddles contract address the SDK knows, by chain id. */
|
|
2
|
+
export declare const DEPLOYMENTS: {
|
|
3
|
+
readonly 4663: {
|
|
4
|
+
readonly PeddlesClogVaultFactory: "0x1d2142699F1D818203738226240C605243a39b9e";
|
|
5
|
+
readonly PeddlesFactoryV20: "0x51336A94B55Ad82D1099Dc82b27b151eDFfc1978";
|
|
6
|
+
readonly PeddlesFeeForwarder: "0xc572A003d0Ab529da670a42177Fc583b03D5b026";
|
|
7
|
+
readonly PeddlesFeeHook: "0xfe055282E3cD471A8b2cd922d31E75ECd3bBc0CC";
|
|
8
|
+
readonly PeddlesHandleLauncher: "0x3720ca29D87E692000Ca71C56a56a3BA05B00CD1";
|
|
9
|
+
readonly PeddlesHandlePotFactory: "0x2b5881c79a83C9EB17C67354F6737f3c9A120DE2";
|
|
10
|
+
readonly PeddlesHolderRewardsFactory: "0xB22d6D7B1eC296AA79cbFf4ABE4992A726BE1978";
|
|
11
|
+
readonly PeddlesLaunchOrchestratorV20: "0x81213e2cE27f03714143152aE5cf5c94094f1978";
|
|
12
|
+
readonly PeddlesLiquidityActivationManager: "0xBE8d8999b53c5E5249feBafe5f505221F3e41978";
|
|
13
|
+
readonly PeddlesNFTBondingGraduationOrchestratorV20: "0x6C5032DeDCc78b92b370C86a2aA0EA3AD0D71978";
|
|
14
|
+
readonly PeddlesNFTFactory: "0x2e0029BeDCBb2f211Fd17EeBA8f40657cF6A1978";
|
|
15
|
+
readonly PeddlesNftFeeDistributorFactory: "0x3081d5E69b7D12A330C9594C175F88EB77f31978";
|
|
16
|
+
readonly PeddlesNftLiquidityReserve: "0x367F626775E22818C369BB3a276E3e9Fbc201978";
|
|
17
|
+
readonly PeddlesNFTMarketplace: "0xC0374a0776449fE60dD1653C6421bEB41e911978";
|
|
18
|
+
readonly PeddlesNftStockGraduationOrchestrator: "0x3DAd8D2B78C8a71f01600FDecA0b17af5F961978";
|
|
19
|
+
readonly PeddlesPerpFactory: "0xCFA648281759C406E921F736c86ece2a9c4D1Fca";
|
|
20
|
+
readonly PeddlesPerpHookDeployer: "0x3ab1848069cE7d19CD62ffB645292146cDd0139F";
|
|
21
|
+
readonly PeddlesPerpTreasury: "0x2C322f48B2dD97f6c5050eDF5F349C7f70126dB5";
|
|
22
|
+
readonly PeddlesRouteSwapRouter: "0xA4858047F9c7359CC0d9071598BFA74187739d8D";
|
|
23
|
+
readonly PeddlesStockLaunchpad: "0x4b7Aa977eA4B95D9859D73e6bc922ecF2F881978";
|
|
24
|
+
readonly PeddlesStockSwapRouter: "0x5A934c5eE47daa3b4562f9Dc9224bB00e9191978";
|
|
25
|
+
readonly PeddlesStockVaultFactory: "0xa565E57046B51C4C1144b837A1871FF89c141978";
|
|
26
|
+
readonly PeddlesTransferValidator: "0x2ADA0EA86925b5EbA1CF7B75e0d606C89b1B1978";
|
|
27
|
+
readonly PeddlesV4LiquidityExecutor: "0xAB23BD1234AB1BCa48a97aB8e2baaFAaE7A21978";
|
|
28
|
+
readonly PeddlesV4SwapRouter: "0xDd1F65380C9f7283A61FC489DCAceA352ee31978";
|
|
29
|
+
readonly PeddlesVaultFactoryV20: "0xe6EE48916F87DD8E8Cab9D100a5E9717aE731978";
|
|
30
|
+
readonly PeddlesVaultRegistry: "0xd322A44c4600dfDcF399Ceb7a32869e83d561978";
|
|
31
|
+
};
|
|
32
|
+
readonly 8453: {
|
|
33
|
+
readonly PeddlesClogVaultFactory: "0x8563Aeec8C63d53BC8dfbE56FF9134a7b1e80503";
|
|
34
|
+
readonly PeddlesFactoryV20: "0x90bD4d38F621529b4aD6480c221075B7317b1978";
|
|
35
|
+
readonly PeddlesFeeForwarder: "0x77886951f19458B2FC27D4373553001A620264D3";
|
|
36
|
+
readonly PeddlesFeeHook: "0xAB8E39207718f519865D6f0d52eFB31b231D40cc";
|
|
37
|
+
readonly PeddlesFlywheel: "0x2E9366BF81d0D0ebA905927B55d3Fa3008891978";
|
|
38
|
+
readonly PeddlesHandleLauncher: "0x265f0653aA62B30Fab11d0718D12CedE7965d7C4";
|
|
39
|
+
readonly PeddlesHandlePotFactory: "0xC2575Cc3Eb3934C826Fa33FC9BA2e6DA8186D725";
|
|
40
|
+
readonly PeddlesHolderRewardsFactory: "0xE4A89dCb02211409b50CEFd9B570E67dA2aD1978";
|
|
41
|
+
readonly PeddlesLaunchOrchestratorV20: "0x7e7E62B41E447B6526E89D0AAAd7Cac9FB9f1978";
|
|
42
|
+
readonly PeddlesLiquidityActivationManager: "0xa8bfd83d21eec43F9a984C6B13a31Ce1df191978";
|
|
43
|
+
readonly PeddlesNFTBondingGraduationOrchestratorV20: "0xB7bB0f25B1AE59adcAa2787C68cd50296d2B1978";
|
|
44
|
+
readonly PeddlesNFTFactory: "0xd111413B91b0E31865464658071099779e2C1978";
|
|
45
|
+
readonly PeddlesNftFeeDistributorFactory: "0x9B0c155e7248706860c9707c2a8f41A0a2281978";
|
|
46
|
+
readonly PeddlesNftLiquidityReserve: "0x444C34FF8503eA088a36792659D7c34D7F931978";
|
|
47
|
+
readonly PeddlesNFTMarketplace: "0x5362a7DE96E8b3474Aef1a0fE6F6e2427Bd81978";
|
|
48
|
+
readonly PeddlesNftStockGraduationOrchestrator: "0xD6d41a5029EC7F78886C135A71A9c85e96781978";
|
|
49
|
+
readonly PeddlesPerpFactory: "0x71a8EF2288fFdB3b1d546C33a16F0d4104E11488";
|
|
50
|
+
readonly PeddlesPerpHookDeployer: "0x9122dAd755B6F8c1DB5F2B7c494580169fB327F2";
|
|
51
|
+
readonly PeddlesPerpTreasury: "0xDB77eA86006E530D25789F2cf2aeB7bd2C7c3745";
|
|
52
|
+
readonly PeddlesRouteSwapRouter: "0x8f04A804Ba989d38A68D93eb8679d3a967f2b079";
|
|
53
|
+
readonly PeddlesStockLaunchpad: "0x680805FBd0D6225d0bE4E12A2B73b2Ed83a31978";
|
|
54
|
+
readonly PeddlesStockSwapRouter: "0xd150B1E102493e4F35A1e95DdA80948C0e581978";
|
|
55
|
+
readonly PeddlesStockVaultFactory: "0x5EF74DFc6Dfd9e5dAb314Df5747AC4E117e41978";
|
|
56
|
+
readonly PeddlesToken: "0xCF2Be52981b5BD563C268a0e2b17D50B53e21978";
|
|
57
|
+
readonly PeddlesTransferValidator: "0xD1390f3E4741963A7eEd1E53163a1B09c97e1978";
|
|
58
|
+
readonly PeddlesV4LiquidityExecutor: "0x4Ca94531420F0e4f5a612475c8c4E35E9c8d1978";
|
|
59
|
+
readonly PeddlesV4SwapRouter: "0xbf7A709cBf71b303B856126D3aEb5051a07c1978";
|
|
60
|
+
readonly PeddlesVaultFactoryV20: "0xD4fe62B8cd5a7e07fF09D6D1151fA5BC8A771978";
|
|
61
|
+
readonly PeddlesVaultRegistry: "0xb390c4A83D8B308b378250a59F273A7c9aDF1978";
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* The perp launchpad on each chain that has one (from contracts/deployments/<chainId>-perp.json).
|
|
66
|
+
* `baseCandidates` are the bases the deploy whitelisted — CANDIDATES only: whether a base is
|
|
67
|
+
* allowed, and on what curve, is read live from `PeddlesPerpFactory.bases(base)`.
|
|
68
|
+
*/
|
|
69
|
+
export declare const PERP_DEPLOYMENTS: {
|
|
70
|
+
readonly 4663: {
|
|
71
|
+
readonly PeddlesPerpFactory: "0xCFA648281759C406E921F736c86ece2a9c4D1Fca";
|
|
72
|
+
readonly PeddlesPerpHookDeployer: "0x3ab1848069cE7d19CD62ffB645292146cDd0139F";
|
|
73
|
+
readonly PeddlesPerpTreasury: "0x2C322f48B2dD97f6c5050eDF5F349C7f70126dB5";
|
|
74
|
+
readonly hookCodePointer: "0xf97907D6AA1Ae3D3Ec3247eEfA998C8D6BE78605";
|
|
75
|
+
readonly baseCandidates: {
|
|
76
|
+
readonly WETH: "0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73";
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
readonly 8453: {
|
|
80
|
+
readonly PeddlesPerpFactory: "0x71a8EF2288fFdB3b1d546C33a16F0d4104E11488";
|
|
81
|
+
readonly PeddlesPerpHookDeployer: "0x9122dAd755B6F8c1DB5F2B7c494580169fB327F2";
|
|
82
|
+
readonly PeddlesPerpTreasury: "0xDB77eA86006E530D25789F2cf2aeB7bd2C7c3745";
|
|
83
|
+
readonly hookCodePointer: "0xDAE55090fF0ffb81E3da33C79950DF7Ef78379aA";
|
|
84
|
+
readonly baseCandidates: {
|
|
85
|
+
readonly WETH: "0x4200000000000000000000000000000000000006";
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
export type KnownChainId = keyof typeof DEPLOYMENTS;
|
|
90
|
+
export type PerpChainId = keyof typeof PERP_DEPLOYMENTS;
|
|
91
|
+
export type ContractName<C extends KnownChainId = KnownChainId> = keyof (typeof DEPLOYMENTS)[C];
|
|
92
|
+
//# sourceMappingURL=deployments.generated.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deployments.generated.d.ts","sourceRoot":"","sources":["../src/deployments.generated.ts"],"names":[],"mappings":"AAKA,iEAAiE;AACjE,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6Dd,CAAC;AAEX;;;;GAIG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;CAmBnB,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,MAAM,OAAO,WAAW,CAAC;AACpD,MAAM,MAAM,WAAW,GAAG,MAAM,OAAO,gBAAgB,CAAC;AACxD,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,YAAY,GAAG,YAAY,IAAI,MAAM,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
// GENERATED FILE — DO NOT EDIT.
|
|
2
|
+
// Written by script/generate-deployments.mjs from contracts/deployments/<chainId>.json
|
|
3
|
+
// and <chainId>-perp.json.
|
|
4
|
+
// Re-run it after any deploy and commit the result.
|
|
5
|
+
/** Every Peddles contract address the SDK knows, by chain id. */
|
|
6
|
+
export const DEPLOYMENTS = {
|
|
7
|
+
4663: {
|
|
8
|
+
PeddlesClogVaultFactory: '0x1d2142699F1D818203738226240C605243a39b9e',
|
|
9
|
+
PeddlesFactoryV20: '0x51336A94B55Ad82D1099Dc82b27b151eDFfc1978',
|
|
10
|
+
PeddlesFeeForwarder: '0xc572A003d0Ab529da670a42177Fc583b03D5b026',
|
|
11
|
+
PeddlesFeeHook: '0xfe055282E3cD471A8b2cd922d31E75ECd3bBc0CC',
|
|
12
|
+
PeddlesHandleLauncher: '0x3720ca29D87E692000Ca71C56a56a3BA05B00CD1',
|
|
13
|
+
PeddlesHandlePotFactory: '0x2b5881c79a83C9EB17C67354F6737f3c9A120DE2',
|
|
14
|
+
PeddlesHolderRewardsFactory: '0xB22d6D7B1eC296AA79cbFf4ABE4992A726BE1978',
|
|
15
|
+
PeddlesLaunchOrchestratorV20: '0x81213e2cE27f03714143152aE5cf5c94094f1978',
|
|
16
|
+
PeddlesLiquidityActivationManager: '0xBE8d8999b53c5E5249feBafe5f505221F3e41978',
|
|
17
|
+
PeddlesNFTBondingGraduationOrchestratorV20: '0x6C5032DeDCc78b92b370C86a2aA0EA3AD0D71978',
|
|
18
|
+
PeddlesNFTFactory: '0x2e0029BeDCBb2f211Fd17EeBA8f40657cF6A1978',
|
|
19
|
+
PeddlesNftFeeDistributorFactory: '0x3081d5E69b7D12A330C9594C175F88EB77f31978',
|
|
20
|
+
PeddlesNftLiquidityReserve: '0x367F626775E22818C369BB3a276E3e9Fbc201978',
|
|
21
|
+
PeddlesNFTMarketplace: '0xC0374a0776449fE60dD1653C6421bEB41e911978',
|
|
22
|
+
PeddlesNftStockGraduationOrchestrator: '0x3DAd8D2B78C8a71f01600FDecA0b17af5F961978',
|
|
23
|
+
PeddlesPerpFactory: '0xCFA648281759C406E921F736c86ece2a9c4D1Fca',
|
|
24
|
+
PeddlesPerpHookDeployer: '0x3ab1848069cE7d19CD62ffB645292146cDd0139F',
|
|
25
|
+
PeddlesPerpTreasury: '0x2C322f48B2dD97f6c5050eDF5F349C7f70126dB5',
|
|
26
|
+
PeddlesRouteSwapRouter: '0xA4858047F9c7359CC0d9071598BFA74187739d8D',
|
|
27
|
+
PeddlesStockLaunchpad: '0x4b7Aa977eA4B95D9859D73e6bc922ecF2F881978',
|
|
28
|
+
PeddlesStockSwapRouter: '0x5A934c5eE47daa3b4562f9Dc9224bB00e9191978',
|
|
29
|
+
PeddlesStockVaultFactory: '0xa565E57046B51C4C1144b837A1871FF89c141978',
|
|
30
|
+
PeddlesTransferValidator: '0x2ADA0EA86925b5EbA1CF7B75e0d606C89b1B1978',
|
|
31
|
+
PeddlesV4LiquidityExecutor: '0xAB23BD1234AB1BCa48a97aB8e2baaFAaE7A21978',
|
|
32
|
+
PeddlesV4SwapRouter: '0xDd1F65380C9f7283A61FC489DCAceA352ee31978',
|
|
33
|
+
PeddlesVaultFactoryV20: '0xe6EE48916F87DD8E8Cab9D100a5E9717aE731978',
|
|
34
|
+
PeddlesVaultRegistry: '0xd322A44c4600dfDcF399Ceb7a32869e83d561978',
|
|
35
|
+
},
|
|
36
|
+
8453: {
|
|
37
|
+
PeddlesClogVaultFactory: '0x8563Aeec8C63d53BC8dfbE56FF9134a7b1e80503',
|
|
38
|
+
PeddlesFactoryV20: '0x90bD4d38F621529b4aD6480c221075B7317b1978',
|
|
39
|
+
PeddlesFeeForwarder: '0x77886951f19458B2FC27D4373553001A620264D3',
|
|
40
|
+
PeddlesFeeHook: '0xAB8E39207718f519865D6f0d52eFB31b231D40cc',
|
|
41
|
+
PeddlesFlywheel: '0x2E9366BF81d0D0ebA905927B55d3Fa3008891978',
|
|
42
|
+
PeddlesHandleLauncher: '0x265f0653aA62B30Fab11d0718D12CedE7965d7C4',
|
|
43
|
+
PeddlesHandlePotFactory: '0xC2575Cc3Eb3934C826Fa33FC9BA2e6DA8186D725',
|
|
44
|
+
PeddlesHolderRewardsFactory: '0xE4A89dCb02211409b50CEFd9B570E67dA2aD1978',
|
|
45
|
+
PeddlesLaunchOrchestratorV20: '0x7e7E62B41E447B6526E89D0AAAd7Cac9FB9f1978',
|
|
46
|
+
PeddlesLiquidityActivationManager: '0xa8bfd83d21eec43F9a984C6B13a31Ce1df191978',
|
|
47
|
+
PeddlesNFTBondingGraduationOrchestratorV20: '0xB7bB0f25B1AE59adcAa2787C68cd50296d2B1978',
|
|
48
|
+
PeddlesNFTFactory: '0xd111413B91b0E31865464658071099779e2C1978',
|
|
49
|
+
PeddlesNftFeeDistributorFactory: '0x9B0c155e7248706860c9707c2a8f41A0a2281978',
|
|
50
|
+
PeddlesNftLiquidityReserve: '0x444C34FF8503eA088a36792659D7c34D7F931978',
|
|
51
|
+
PeddlesNFTMarketplace: '0x5362a7DE96E8b3474Aef1a0fE6F6e2427Bd81978',
|
|
52
|
+
PeddlesNftStockGraduationOrchestrator: '0xD6d41a5029EC7F78886C135A71A9c85e96781978',
|
|
53
|
+
PeddlesPerpFactory: '0x71a8EF2288fFdB3b1d546C33a16F0d4104E11488',
|
|
54
|
+
PeddlesPerpHookDeployer: '0x9122dAd755B6F8c1DB5F2B7c494580169fB327F2',
|
|
55
|
+
PeddlesPerpTreasury: '0xDB77eA86006E530D25789F2cf2aeB7bd2C7c3745',
|
|
56
|
+
PeddlesRouteSwapRouter: '0x8f04A804Ba989d38A68D93eb8679d3a967f2b079',
|
|
57
|
+
PeddlesStockLaunchpad: '0x680805FBd0D6225d0bE4E12A2B73b2Ed83a31978',
|
|
58
|
+
PeddlesStockSwapRouter: '0xd150B1E102493e4F35A1e95DdA80948C0e581978',
|
|
59
|
+
PeddlesStockVaultFactory: '0x5EF74DFc6Dfd9e5dAb314Df5747AC4E117e41978',
|
|
60
|
+
PeddlesToken: '0xCF2Be52981b5BD563C268a0e2b17D50B53e21978',
|
|
61
|
+
PeddlesTransferValidator: '0xD1390f3E4741963A7eEd1E53163a1B09c97e1978',
|
|
62
|
+
PeddlesV4LiquidityExecutor: '0x4Ca94531420F0e4f5a612475c8c4E35E9c8d1978',
|
|
63
|
+
PeddlesV4SwapRouter: '0xbf7A709cBf71b303B856126D3aEb5051a07c1978',
|
|
64
|
+
PeddlesVaultFactoryV20: '0xD4fe62B8cd5a7e07fF09D6D1151fA5BC8A771978',
|
|
65
|
+
PeddlesVaultRegistry: '0xb390c4A83D8B308b378250a59F273A7c9aDF1978',
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* The perp launchpad on each chain that has one (from contracts/deployments/<chainId>-perp.json).
|
|
70
|
+
* `baseCandidates` are the bases the deploy whitelisted — CANDIDATES only: whether a base is
|
|
71
|
+
* allowed, and on what curve, is read live from `PeddlesPerpFactory.bases(base)`.
|
|
72
|
+
*/
|
|
73
|
+
export const PERP_DEPLOYMENTS = {
|
|
74
|
+
4663: {
|
|
75
|
+
PeddlesPerpFactory: '0xCFA648281759C406E921F736c86ece2a9c4D1Fca',
|
|
76
|
+
PeddlesPerpHookDeployer: '0x3ab1848069cE7d19CD62ffB645292146cDd0139F',
|
|
77
|
+
PeddlesPerpTreasury: '0x2C322f48B2dD97f6c5050eDF5F349C7f70126dB5',
|
|
78
|
+
hookCodePointer: '0xf97907D6AA1Ae3D3Ec3247eEfA998C8D6BE78605',
|
|
79
|
+
baseCandidates: {
|
|
80
|
+
WETH: '0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73',
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
8453: {
|
|
84
|
+
PeddlesPerpFactory: '0x71a8EF2288fFdB3b1d546C33a16F0d4104E11488',
|
|
85
|
+
PeddlesPerpHookDeployer: '0x9122dAd755B6F8c1DB5F2B7c494580169fB327F2',
|
|
86
|
+
PeddlesPerpTreasury: '0xDB77eA86006E530D25789F2cf2aeB7bd2C7c3745',
|
|
87
|
+
hookCodePointer: '0xDAE55090fF0ffb81E3da33C79950DF7Ef78379aA',
|
|
88
|
+
baseCandidates: {
|
|
89
|
+
WETH: '0x4200000000000000000000000000000000000006',
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
//# sourceMappingURL=deployments.generated.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deployments.generated.js","sourceRoot":"","sources":["../src/deployments.generated.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uFAAuF;AACvF,2BAA2B;AAC3B,oDAAoD;AAEpD,iEAAiE;AACjE,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,IAAI,EAAE;QACJ,uBAAuB,EAAE,4CAA4C;QACrE,iBAAiB,EAAE,4CAA4C;QAC/D,mBAAmB,EAAE,4CAA4C;QACjE,cAAc,EAAE,4CAA4C;QAC5D,qBAAqB,EAAE,4CAA4C;QACnE,uBAAuB,EAAE,4CAA4C;QACrE,2BAA2B,EAAE,4CAA4C;QACzE,4BAA4B,EAAE,4CAA4C;QAC1E,iCAAiC,EAAE,4CAA4C;QAC/E,0CAA0C,EAAE,4CAA4C;QACxF,iBAAiB,EAAE,4CAA4C;QAC/D,+BAA+B,EAAE,4CAA4C;QAC7E,0BAA0B,EAAE,4CAA4C;QACxE,qBAAqB,EAAE,4CAA4C;QACnE,qCAAqC,EAAE,4CAA4C;QACnF,kBAAkB,EAAE,4CAA4C;QAChE,uBAAuB,EAAE,4CAA4C;QACrE,mBAAmB,EAAE,4CAA4C;QACjE,sBAAsB,EAAE,4CAA4C;QACpE,qBAAqB,EAAE,4CAA4C;QACnE,sBAAsB,EAAE,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EAAE,4CAA4C;QAC7D,cAAc,EAAE;YACd,IAAI,EAAE,4CAA4C;SACnD;KACF;IACD,IAAI,EAAE;QACJ,kBAAkB,EAAE,4CAA4C;QAChE,uBAAuB,EAAE,4CAA4C;QACrE,mBAAmB,EAAE,4CAA4C;QACjE,eAAe,EAAE,4CAA4C;QAC7D,cAAc,EAAE;YACd,IAAI,EAAE,4CAA4C;SACnD;KACF;CACO,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { DEPLOYMENTS } from './deployments.generated.js';
|
|
2
|
+
export { DEPLOYMENTS };
|
|
3
|
+
/** Thrown when the SDK is asked about a chain it ships no address book for. */
|
|
4
|
+
export class UnknownChainError extends Error {
|
|
5
|
+
chainId;
|
|
6
|
+
constructor(chainId) {
|
|
7
|
+
super(`Peddles SDK has no deployment for chain ${chainId}. ` +
|
|
8
|
+
`Known chains: ${Object.keys(DEPLOYMENTS).join(', ')}. ` +
|
|
9
|
+
`Pass an explicit address map if you are pointing at a private deployment.`);
|
|
10
|
+
this.name = 'UnknownChainError';
|
|
11
|
+
this.chainId = chainId;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
/** Thrown when a chain is known but does not carry the contract being asked for. */
|
|
15
|
+
export class UnknownContractError extends Error {
|
|
16
|
+
constructor(chainId, name) {
|
|
17
|
+
super(`Peddles SDK has no address for ${name} on chain ${chainId}. ` +
|
|
18
|
+
`That deployment may predate the contract.`);
|
|
19
|
+
this.name = 'UnknownContractError';
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export function isKnownChain(chainId) {
|
|
23
|
+
return Object.prototype.hasOwnProperty.call(DEPLOYMENTS, chainId);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The address book for one chain.
|
|
27
|
+
*
|
|
28
|
+
* FAILS CLOSED, ALWAYS. An unknown chain throws rather than returning a default
|
|
29
|
+
* or an empty map, and a missing contract throws rather than returning
|
|
30
|
+
* `undefined` or the zero address. Both of those alternatives look like a
|
|
31
|
+
* working call right up until a transaction is signed against nothing.
|
|
32
|
+
*
|
|
33
|
+
* This is not hypothetical in this codebase: every address changed in a single
|
|
34
|
+
* redeploy, and one stale copy of this list had the API quoting a launchpad that
|
|
35
|
+
* no longer existed — an error that surfaced as "neither leg is a launched coin"
|
|
36
|
+
* rather than as a missing address.
|
|
37
|
+
*/
|
|
38
|
+
export function deploymentFor(chainId) {
|
|
39
|
+
if (!isKnownChain(chainId))
|
|
40
|
+
throw new UnknownChainError(chainId);
|
|
41
|
+
return DEPLOYMENTS[chainId];
|
|
42
|
+
}
|
|
43
|
+
/** One address, or a throw. Never a default, never the zero address. */
|
|
44
|
+
export function addressOf(chainId, name) {
|
|
45
|
+
const book = deploymentFor(chainId);
|
|
46
|
+
// Own properties only: `book['constructor']` would otherwise return a function.
|
|
47
|
+
const found = Object.prototype.hasOwnProperty.call(book, name) ? book[name] : undefined;
|
|
48
|
+
if (!found || /^0x0{40}$/.test(found))
|
|
49
|
+
throw new UnknownContractError(chainId, name);
|
|
50
|
+
return found;
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=deployments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deployments.js","sourceRoot":"","sources":["../src/deployments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAwC,MAAM,4BAA4B,CAAC;AAE/F,OAAO,EAAE,WAAW,EAAE,CAAC;AAGvB,+EAA+E;AAC/E,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IACjC,OAAO,CAAS;IACzB,YAAY,OAAe;QACzB,KAAK,CACH,2CAA2C,OAAO,IAAI;YACpD,iBAAiB,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI;YACxD,2EAA2E,CAC9E,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;QAChC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CACF;AAED,oFAAoF;AACpF,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IAC7C,YAAY,OAAe,EAAE,IAAY;QACvC,KAAK,CACH,kCAAkC,IAAI,aAAa,OAAO,IAAI;YAC5D,2CAA2C,CAC9C,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;IACrC,CAAC;CACF;AAED,MAAM,UAAU,YAAY,CAAC,OAAe;IAC1C,OAAO,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;AACpE,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,aAAa,CAAC,OAAe;IAC3C,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC;QAAE,MAAM,IAAI,iBAAiB,CAAC,OAAO,CAAC,CAAC;IACjE,OAAO,WAAW,CAAC,OAAO,CAA4C,CAAC;AACzE,CAAC;AAED,wEAAwE;AACxE,MAAM,UAAU,SAAS,CAAC,OAAe,EAAE,IAAY;IACrD,MAAM,IAAI,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;IACpC,gFAAgF;IAChF,MAAM,KAAK,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACxF,IAAI,CAAC,KAAK,IAAI,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,MAAM,IAAI,oBAAoB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IACrF,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How one charged fee divides — the exact arithmetic `PeddlesFeeHook._book` runs.
|
|
3
|
+
*
|
|
4
|
+
* IMPORT-FREE on purpose, like `clogInflow.ts`: it is pure bigint maths with no
|
|
5
|
+
* runtime, so a UI, an indexer or a test can use it without pulling in viem.
|
|
6
|
+
*
|
|
7
|
+
* THE MODEL (fixed at launch, never changed afterwards):
|
|
8
|
+
*
|
|
9
|
+
* creatorTaxBps the ALL-IN rate a trader pays, 100..1000 (1%..10%)
|
|
10
|
+
* excessToCreatorBps the creator's share of everything ABOVE the two fixed
|
|
11
|
+
* 0.50% legs, 0..10000; the rest of that excess is holders'
|
|
12
|
+
*
|
|
13
|
+
* platform = fee × 50 / creatorTaxBps (floored)
|
|
14
|
+
* creatorBase = fee × 50 / creatorTaxBps (floored)
|
|
15
|
+
* excess = fee − platform − creatorBase
|
|
16
|
+
* creator = creatorBase + excess × excessToCreatorBps / 10000 (floored)
|
|
17
|
+
* holders = fee − platform − creator (the remainder)
|
|
18
|
+
*
|
|
19
|
+
* Every floor lands its dust with holders, so `platform + creator + holders`
|
|
20
|
+
* equals `fee` exactly; at `excessToCreatorBps == 10000` the holder leg is 0.
|
|
21
|
+
*
|
|
22
|
+
* `fee` is what the hook CHARGED, in the pool's quote asset. It is not the trade
|
|
23
|
+
* size: the hook charges `gross × creatorTaxBps / 10000` (floored) on an exact-in
|
|
24
|
+
* trade and grosses up an exact-out one. During a pool's opening window the hook
|
|
25
|
+
* uses a different, fixed split (½ liquidity / ¼ creator / ¼ platform) that this
|
|
26
|
+
* function does not model.
|
|
27
|
+
*/
|
|
28
|
+
/** `PeddlesFeeHook.PLATFORM_FEE_BPS`. */
|
|
29
|
+
export declare const PLATFORM_FEE_BPS = 50;
|
|
30
|
+
/** `PeddlesFeeHook.CREATOR_FEE_BPS`. */
|
|
31
|
+
export declare const CREATOR_FEE_BPS = 50;
|
|
32
|
+
/** `PeddlesFeeHook.MIN_CREATOR_TAX_BPS` — the two fixed legs added together. */
|
|
33
|
+
export declare const MIN_CREATOR_TAX_BPS: number;
|
|
34
|
+
/** `PeddlesFeeHook.MAX_CREATOR_TAX_BPS`. */
|
|
35
|
+
export declare const MAX_CREATOR_TAX_BPS = 1000;
|
|
36
|
+
/** Basis-point denominator. */
|
|
37
|
+
export declare const BPS = 10000;
|
|
38
|
+
/** `PeddlesFeeHook.MAX_FEE_AMOUNT` — the largest fee one accrual can represent (int128 max). */
|
|
39
|
+
export declare const MAX_FEE_AMOUNT: bigint;
|
|
40
|
+
/** One fee, divided. Base units of the pool's quote asset. */
|
|
41
|
+
export interface FeeSplit {
|
|
42
|
+
readonly platform: bigint;
|
|
43
|
+
readonly creator: bigint;
|
|
44
|
+
readonly holders: bigint;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Divide a charged fee between platform, creator and holders.
|
|
48
|
+
*
|
|
49
|
+
* Throws `RangeError` for terms `registerPool` would refuse, and for a fee the
|
|
50
|
+
* hook would not charge at all (negative, or above `MAX_FEE_AMOUNT`). Returning a
|
|
51
|
+
* split for either would describe a charge that cannot happen.
|
|
52
|
+
*/
|
|
53
|
+
export declare function feeSplit(creatorTaxBps: number, excessToCreatorBps: number, fee: bigint): FeeSplit;
|
|
54
|
+
//# sourceMappingURL=feeSplit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feeSplit.d.ts","sourceRoot":"","sources":["../src/feeSplit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,yCAAyC;AACzC,eAAO,MAAM,gBAAgB,KAAK,CAAC;AACnC,wCAAwC;AACxC,eAAO,MAAM,eAAe,KAAK,CAAC;AAClC,gFAAgF;AAChF,eAAO,MAAM,mBAAmB,QAAqC,CAAC;AACtE,4CAA4C;AAC5C,eAAO,MAAM,mBAAmB,OAAO,CAAC;AACxC,+BAA+B;AAC/B,eAAO,MAAM,GAAG,QAAS,CAAC;AAC1B,gGAAgG;AAChG,eAAO,MAAM,cAAc,QAAoB,CAAC;AAEhD,8DAA8D;AAC9D,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAQD;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,aAAa,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,QAAQ,CAcjG"}
|
package/dist/feeSplit.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How one charged fee divides — the exact arithmetic `PeddlesFeeHook._book` runs.
|
|
3
|
+
*
|
|
4
|
+
* IMPORT-FREE on purpose, like `clogInflow.ts`: it is pure bigint maths with no
|
|
5
|
+
* runtime, so a UI, an indexer or a test can use it without pulling in viem.
|
|
6
|
+
*
|
|
7
|
+
* THE MODEL (fixed at launch, never changed afterwards):
|
|
8
|
+
*
|
|
9
|
+
* creatorTaxBps the ALL-IN rate a trader pays, 100..1000 (1%..10%)
|
|
10
|
+
* excessToCreatorBps the creator's share of everything ABOVE the two fixed
|
|
11
|
+
* 0.50% legs, 0..10000; the rest of that excess is holders'
|
|
12
|
+
*
|
|
13
|
+
* platform = fee × 50 / creatorTaxBps (floored)
|
|
14
|
+
* creatorBase = fee × 50 / creatorTaxBps (floored)
|
|
15
|
+
* excess = fee − platform − creatorBase
|
|
16
|
+
* creator = creatorBase + excess × excessToCreatorBps / 10000 (floored)
|
|
17
|
+
* holders = fee − platform − creator (the remainder)
|
|
18
|
+
*
|
|
19
|
+
* Every floor lands its dust with holders, so `platform + creator + holders`
|
|
20
|
+
* equals `fee` exactly; at `excessToCreatorBps == 10000` the holder leg is 0.
|
|
21
|
+
*
|
|
22
|
+
* `fee` is what the hook CHARGED, in the pool's quote asset. It is not the trade
|
|
23
|
+
* size: the hook charges `gross × creatorTaxBps / 10000` (floored) on an exact-in
|
|
24
|
+
* trade and grosses up an exact-out one. During a pool's opening window the hook
|
|
25
|
+
* uses a different, fixed split (½ liquidity / ¼ creator / ¼ platform) that this
|
|
26
|
+
* function does not model.
|
|
27
|
+
*/
|
|
28
|
+
/** `PeddlesFeeHook.PLATFORM_FEE_BPS`. */
|
|
29
|
+
export const PLATFORM_FEE_BPS = 50;
|
|
30
|
+
/** `PeddlesFeeHook.CREATOR_FEE_BPS`. */
|
|
31
|
+
export const CREATOR_FEE_BPS = 50;
|
|
32
|
+
/** `PeddlesFeeHook.MIN_CREATOR_TAX_BPS` — the two fixed legs added together. */
|
|
33
|
+
export const MIN_CREATOR_TAX_BPS = PLATFORM_FEE_BPS + CREATOR_FEE_BPS;
|
|
34
|
+
/** `PeddlesFeeHook.MAX_CREATOR_TAX_BPS`. */
|
|
35
|
+
export const MAX_CREATOR_TAX_BPS = 1000;
|
|
36
|
+
/** Basis-point denominator. */
|
|
37
|
+
export const BPS = 10_000;
|
|
38
|
+
/** `PeddlesFeeHook.MAX_FEE_AMOUNT` — the largest fee one accrual can represent (int128 max). */
|
|
39
|
+
export const MAX_FEE_AMOUNT = (1n << 127n) - 1n;
|
|
40
|
+
function assertBps(label, value, min, max) {
|
|
41
|
+
if (!Number.isInteger(value) || value < min || value > max) {
|
|
42
|
+
throw new RangeError(`${label} must be an integer in [${min}, ${max}], got ${String(value)}`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Divide a charged fee between platform, creator and holders.
|
|
47
|
+
*
|
|
48
|
+
* Throws `RangeError` for terms `registerPool` would refuse, and for a fee the
|
|
49
|
+
* hook would not charge at all (negative, or above `MAX_FEE_AMOUNT`). Returning a
|
|
50
|
+
* split for either would describe a charge that cannot happen.
|
|
51
|
+
*/
|
|
52
|
+
export function feeSplit(creatorTaxBps, excessToCreatorBps, fee) {
|
|
53
|
+
assertBps('creatorTaxBps', creatorTaxBps, MIN_CREATOR_TAX_BPS, MAX_CREATOR_TAX_BPS);
|
|
54
|
+
assertBps('excessToCreatorBps', excessToCreatorBps, 0, BPS);
|
|
55
|
+
if (typeof fee !== 'bigint')
|
|
56
|
+
throw new TypeError('fee must be a bigint in base units');
|
|
57
|
+
if (fee < 0n)
|
|
58
|
+
throw new RangeError(`fee must not be negative, got ${fee}`);
|
|
59
|
+
if (fee > MAX_FEE_AMOUNT)
|
|
60
|
+
throw new RangeError(`fee ${fee} exceeds MAX_FEE_AMOUNT; the hook charges nothing`);
|
|
61
|
+
const total = BigInt(creatorTaxBps);
|
|
62
|
+
const platform = (fee * BigInt(PLATFORM_FEE_BPS)) / total;
|
|
63
|
+
const creatorBase = (fee * BigInt(CREATOR_FEE_BPS)) / total;
|
|
64
|
+
const excess = fee - platform - creatorBase;
|
|
65
|
+
const creator = creatorBase + (excess * BigInt(excessToCreatorBps)) / BigInt(BPS);
|
|
66
|
+
const holders = fee - platform - creator;
|
|
67
|
+
return { platform, creator, holders };
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=feeSplit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feeSplit.js","sourceRoot":"","sources":["../src/feeSplit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,yCAAyC;AACzC,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,CAAC;AACnC,wCAAwC;AACxC,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,CAAC;AAClC,gFAAgF;AAChF,MAAM,CAAC,MAAM,mBAAmB,GAAG,gBAAgB,GAAG,eAAe,CAAC;AACtE,4CAA4C;AAC5C,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC;AACxC,+BAA+B;AAC/B,MAAM,CAAC,MAAM,GAAG,GAAG,MAAM,CAAC;AAC1B,gGAAgG;AAChG,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,EAAE,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;AAShD,SAAS,SAAS,CAAC,KAAa,EAAE,KAAa,EAAE,GAAW,EAAE,GAAW;IACvE,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,GAAG,IA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