@floorlaunchpad/sdk 0.6.0 → 0.8.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.
Files changed (125) hide show
  1. package/CHANGELOG.md +279 -0
  2. package/README.md +12 -1
  3. package/dist/abi/evm-event-names.js +7 -0
  4. package/dist/abi/evm.gen.js +81 -2
  5. package/dist/abi/functions.gen.js +135 -1
  6. package/dist/abi/solana.gen.js +64 -0
  7. package/dist/client/solana/index.js +25 -6
  8. package/dist/config/generated.js +803 -26374
  9. package/dist/errors.js +21 -2
  10. package/dist/events/types.gen.js +1 -1
  11. package/dist/evm/chains.js +80 -0
  12. package/dist/evm/floor/abi.gen.js +115 -0
  13. package/dist/evm/floor/calls.js +5 -0
  14. package/dist/evm/squid.js +21 -5
  15. package/dist/evm/venues.js +302 -0
  16. package/dist/generated/interface.gen.js +93 -44
  17. package/dist/index.js +7 -0
  18. package/dist/indexer/bodies.js +288 -5
  19. package/dist/indexer/client.js +17 -1
  20. package/dist/indexer/contract.js +141 -15
  21. package/dist/indexer/paths.js +80 -7
  22. package/dist/indexer/read.js +25 -3
  23. package/dist/indexer/stream.js +2 -2
  24. package/dist/math/v2/book.js +24 -7
  25. package/dist/math/v2/create.js +1 -1
  26. package/dist/math/v2/escrow.js +205 -0
  27. package/dist/math/v2/fees.js +30 -4
  28. package/dist/math/v2/milestones.js +1 -1
  29. package/dist/math/v2/office.js +110 -0
  30. package/dist/math/v2/receipt.js +3 -3
  31. package/dist/math/v2/relay.js +263 -96
  32. package/dist/math/v2/rows.js +17 -0
  33. package/dist/math/v2/team.js +42 -1
  34. package/dist/math/v2/trade.js +3 -1
  35. package/dist/reprice.js +88 -0
  36. package/dist/route/quote.js +16 -0
  37. package/dist/scaledUi.js +113 -0
  38. package/dist/solana/floor/accounts.js +38 -5
  39. package/dist/solana/floor/events.js +62 -1
  40. package/dist/solana/floor/instructions.js +39 -1
  41. package/dist/solana/floor/program.js +3 -0
  42. package/dist/stockRefresh.js +99 -0
  43. package/dist/ton/consts.generated.js +2 -2
  44. package/dist/ton/gas.js +3 -3
  45. package/dist/v2/claims.js +28 -5
  46. package/dist/v2/devbuy.js +28 -3
  47. package/dist/v2/events.js +2 -0
  48. package/dist/v2/evm.js +183 -5
  49. package/dist/v2/layouts.js +102 -2
  50. package/dist/v2/office-events.js +127 -0
  51. package/dist/v2/office-evm.js +68 -0
  52. package/dist/v2/office-read.js +182 -0
  53. package/dist/v2/office-solana.js +134 -0
  54. package/dist/v2/office-trade.js +73 -0
  55. package/dist/v2/route-alt.js +1 -0
  56. package/dist/v2/route.js +1 -1
  57. package/dist/v2/solana.js +224 -5
  58. package/dist/v2/solanaSettle.js +2 -0
  59. package/dist/v2/tx/evm.js +66 -2
  60. package/dist/v2/tx/solana.js +3 -3
  61. package/dist/v2/types.js +4 -0
  62. package/docs/aggregator.md +19 -0
  63. package/docs/cursor-pages.md +9 -3
  64. package/docs/ton.md +1 -1
  65. package/examples/floor-line.html +1 -1
  66. package/package.json +26 -1
  67. package/src/abi/evm-event-names.ts +7 -0
  68. package/src/abi/evm.gen.ts +81 -2
  69. package/src/abi/functions.gen.ts +135 -1
  70. package/src/abi/solana.gen.ts +64 -0
  71. package/src/client/solana/index.ts +25 -6
  72. package/src/config/generated.ts +803 -26374
  73. package/src/errors.ts +21 -2
  74. package/src/events/types.gen.ts +458 -1
  75. package/src/evm/chains.ts +89 -0
  76. package/src/evm/floor/abi.gen.ts +115 -0
  77. package/src/evm/floor/calls.ts +5 -0
  78. package/src/evm/squid.ts +22 -6
  79. package/src/evm/venues.ts +340 -0
  80. package/src/generated/interface.gen.ts +93 -44
  81. package/src/index.ts +7 -0
  82. package/src/indexer/bodies.ts +308 -5
  83. package/src/indexer/client.ts +31 -4
  84. package/src/indexer/contract.ts +148 -17
  85. package/src/indexer/paths.ts +139 -7
  86. package/src/indexer/read.ts +27 -5
  87. package/src/indexer/stream.ts +4 -4
  88. package/src/math/v2/book.ts +23 -7
  89. package/src/math/v2/create.ts +1 -1
  90. package/src/math/v2/escrow.ts +213 -0
  91. package/src/math/v2/fees.ts +30 -4
  92. package/src/math/v2/milestones.ts +1 -1
  93. package/src/math/v2/office.ts +114 -0
  94. package/src/math/v2/receipt.ts +7 -3
  95. package/src/math/v2/relay.ts +269 -96
  96. package/src/math/v2/rows.ts +17 -0
  97. package/src/math/v2/team.ts +42 -1
  98. package/src/math/v2/trade.ts +3 -1
  99. package/src/reprice.ts +121 -0
  100. package/src/route/quote.ts +16 -0
  101. package/src/scaledUi.ts +123 -0
  102. package/src/solana/floor/accounts.ts +38 -5
  103. package/src/solana/floor/events.ts +63 -2
  104. package/src/solana/floor/instructions.ts +39 -1
  105. package/src/solana/floor/program.ts +3 -0
  106. package/src/stockRefresh.ts +131 -0
  107. package/src/ton/consts.generated.ts +2 -2
  108. package/src/ton/gas.ts +3 -3
  109. package/src/v2/claims.ts +34 -5
  110. package/src/v2/devbuy.ts +38 -3
  111. package/src/v2/events.ts +3 -1
  112. package/src/v2/evm.ts +209 -5
  113. package/src/v2/layouts.ts +102 -2
  114. package/src/v2/office-events.ts +133 -0
  115. package/src/v2/office-evm.ts +76 -0
  116. package/src/v2/office-read.ts +264 -0
  117. package/src/v2/office-solana.ts +159 -0
  118. package/src/v2/office-trade.ts +96 -0
  119. package/src/v2/route-alt.ts +1 -0
  120. package/src/v2/route.ts +1 -1
  121. package/src/v2/solana.ts +235 -5
  122. package/src/v2/solanaSettle.ts +2 -0
  123. package/src/v2/tx/evm.ts +66 -2
  124. package/src/v2/tx/solana.ts +5 -3
  125. package/src/v2/types.ts +76 -1
@@ -0,0 +1,302 @@
1
+
2
+
3
+ import { bytesToHex, checksumAddress, decodeAbi, encodeAbi, encodeCall } from "./abi.js";
4
+ import { chainById } from "./chains.js";
5
+ import { AERODROME_SLIPSTREAM_KEY, UR_ADDRESS_THIS, UR_MSG_SENDER, UR_UNWRAP_WETH, UR_V3_SWAP_EXACT_IN, UR_WRAP_ETH, V4_NATIVE, v3Path, v4PoolKey, zapSwapData } from "./zap.js";
6
+
7
+ import { EVM_NATIVE, coinKey } from "../route/graph.js";
8
+
9
+ export const DEX_FAMILY = { v2: 1, v3: 2, universal: 3, solidly: 4, algebra: 5 } ;
10
+
11
+ const SLOT_OF = {
12
+ uniswap: "uniswap-ur", aerodrome: "aerodrome-ur", pancake: "pancake-ur", "project-x": "prjx", nest: "nest", ramses: "ramses-ur", hyperswap: "hyperswap",
13
+ };
14
+ const FEES_UNI = [100, 500, 3000, 10000] ;
15
+ const FEES_PANCAKE = [100, 500, 2500, 10000] ;
16
+ const WETH_OP = "0x4200000000000000000000000000000000000006";
17
+ const WHYPE = "0x5555555555555555555555555555555555555555";
18
+
19
+ const routerOf = (chainId , venue ) => {
20
+ const r = chainById(chainId)?.zapRouters.find((z) => z.slot === SLOT_OF[venue]);
21
+ if (!r) throw new Error(`no router row ${venue} on ${chainId}`);
22
+ return checksumAddress(r.router);
23
+ };
24
+ const wethOf = (chainId ) => checksumAddress(chainById(chainId)?.wrappedNative ?? WETH_OP);
25
+
26
+ export const UNISWAP_V3_QUOTER = Object.freeze({
27
+ 1: "0x61fFE014bA17989E743c5F6cB21bF9697530B21e",
28
+ 8453: "0x3d4e44Eb1374240CE5F1B871ab261CD16335B76a",
29
+ 56: "0x78D78E420Da98ad378D7799bE8f4AF69033EB077",
30
+ 42161: "0x61fFE014bA17989E743c5F6cB21bF9697530B21e",
31
+ 4663: "0x33e885eD0Ec9bF04EcfB19341582aADCb4c8A9E7",
32
+ 5042: "0x7DfD4F31be6814D2906BDE155c3e1B146EAc1468",
33
+ 99901: "0x204FAca1764B154221e35c0d20aBb3c525710498",
34
+ });
35
+
36
+ export const UNISWAP_V3_FEES = Object.freeze([...FEES_UNI]);
37
+
38
+ function leg(chainId , venue , l ) {
39
+ return Object.freeze({ chainId, venue, router: routerOf(chainId, venue), ...l, quoter: checksumAddress(l.quoter) });
40
+ }
41
+ const uniswap = (chainId ) =>
42
+ leg(chainId, "uniswap", { quoter: UNISWAP_V3_QUOTER[chainId], quoteKind: "fee", legKind: "ur", weth: wethOf(chainId), keys: FEES_UNI, urTail: "minHop" });
43
+ const pancake = (chainId , weth ) =>
44
+ leg(chainId, "pancake", { quoter: "0xB048Bbc1Ee6b733FFfCFb9e9CeF7375518e25997", quoteKind: "fee", legKind: "ur", weth: checksumAddress(weth), keys: FEES_PANCAKE, urTail: "none" });
45
+ const ramsesKeys = [1, 5, 10, 50, 100, 200];
46
+
47
+ export const VENUE_LEGS = Object.freeze({
48
+ 1: [uniswap(1)],
49
+ 8453: [
50
+ leg(8453, "aerodrome", { quoter: "0x254cF9E1E6e233aa1AC962CB9B05b2cfeAaE15b0", quoteKind: "tick", legKind: "ur", weth: checksumAddress(WETH_OP), keys: [1, 10, 50, 100, 200, 2000], urTail: "isUni", pathKey: (ts) => AERODROME_SLIPSTREAM_KEY | ts }),
51
+ uniswap(8453),
52
+ pancake(8453, WETH_OP),
53
+ ],
54
+ 56: [pancake(56, "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"), uniswap(56)],
55
+ 42161: [uniswap(42161)],
56
+ 999: [
57
+ leg(999, "project-x", { quoter: "0x239F11a7A3E08f2B8110D4CA9F6B95d4c8865258", quoteKind: "fee", legKind: "v3-router", weth: checksumAddress(WHYPE), keys: FEES_UNI }),
58
+ leg(999, "hyperswap", { quoter: "0x03A918028f22D9E1473B7959C927AD7425A45C7C", quoteKind: "fee", legKind: "router02", weth: checksumAddress(WHYPE), keys: FEES_UNI }),
59
+ leg(999, "nest", { quoter: "0xBea20609A4772311c5b81F814Cd4f9ECaEF5DFAd", quoteKind: "algebra", legKind: "algebra", weth: checksumAddress(WHYPE), keys: [0] }),
60
+ leg(999, "ramses", { quoter: "0x403Bf94fe505cA0F0b1563C350B57dCeC8303ECd", quoteKind: "tick", legKind: "ur", weth: checksumAddress(WHYPE), keys: ramsesKeys, urTail: "none" }),
61
+ ],
62
+ 4663: [
63
+ uniswap(4663),
64
+ leg(4663, "ramses", { quoter: "0x4730e03EB4a58A5e20244062D5f9A99bCf5770a6", quoteKind: "tick", legKind: "ur", weth: checksumAddress("0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73"), keys: ramsesKeys, urTail: "none" }),
65
+ ],
66
+
67
+ 99901: [
68
+ leg(99901, "uniswap", { quoter: "0x379F556c5a748BD7Cc9baF0F7A344094Ac1814f5", quoteKind: "v4", legKind: "ur-v4", weth: checksumAddress(V4_NATIVE), keys: [3000, 10000], v4TickOf: { 3000: 60, 10000: 200 } }),
69
+ ],
70
+
71
+ 5042: [
72
+ leg(5042, "uniswap", { quoter: "0x7DfD4F31be6814D2906BDE155c3e1B146EAc1468", quoteKind: "fee", legKind: "ur", weth: null, nativeView: { token: checksumAddress("0x3600000000000000000000000000000000000000"), scale: 10n ** 12n }, keys: FEES_UNI, urTail: "minHop" }),
73
+ ],
74
+ });
75
+
76
+ export function venueLegOf(chainId , router ) {
77
+ return (VENUE_LEGS[chainId] ?? []).find((l) => l.router.toLowerCase() === router.toLowerCase()) ?? null;
78
+ }
79
+
80
+ const FAMILY_OF_LEG = { ur: DEX_FAMILY.universal, "ur-v4": DEX_FAMILY.universal, "v3-router": DEX_FAMILY.v3, router02: DEX_FAMILY.v3, algebra: DEX_FAMILY.algebra };
81
+
82
+ export const WIRED_DEX_FAMILIES = Object.freeze([DEX_FAMILY.v2, DEX_FAMILY.universal, DEX_FAMILY.v3, DEX_FAMILY.algebra]);
83
+ export const dexFamilyWired = (family ) => WIRED_DEX_FAMILIES.includes(family);
84
+
85
+ export const wiredLegOf = (chainId , family , dex ) => {
86
+ const l = venueLegOf(chainId, dex);
87
+ return l !== null && FAMILY_OF_LEG[l.legKind] === family ? l : null;
88
+ };
89
+
90
+ export const dexLegWired = (chainId , family , dex ) =>
91
+ family === DEX_FAMILY.v2 || (dexFamilyWired(family) && wiredLegOf(chainId, family, dex) !== null);
92
+
93
+ export const legTokenOf = (l , native , token ) =>
94
+ native ? (l.weth ?? (l.nativeView ).token) : checksumAddress(token);
95
+
96
+ const QUOTE_SIG = {
97
+ fee: "quoteExactInputSingle((address,address,uint256,uint24,uint160))",
98
+ tick: "quoteExactInputSingle((address,address,uint256,int24,uint160))",
99
+ algebra: "quoteExactInputSingle((address,address,uint256,uint160))",
100
+ v4: "quoteExactInputSingle(((address,address,uint24,int24,address),bool,uint128,bytes))",
101
+ };
102
+
103
+ const v4PoolAt = (l , key ) => {
104
+ const tickSpacing = l.v4TickOf?.[key];
105
+ return tickSpacing === undefined ? null : { fee: key, tickSpacing };
106
+ };
107
+
108
+ const firstWord = (hex ) => {
109
+ const h = hex.startsWith("0x") ? hex.slice(2) : hex;
110
+ if (h.length < 64) return null;
111
+ const out = BigInt("0x" + h.slice(0, 64));
112
+ return out > 0n ? out : null;
113
+ };
114
+
115
+ async function quoteAt(reads , l , tokenIn , tokenOut , amountIn , key ) {
116
+ try {
117
+ let data ;
118
+ if (l.quoteKind === "v4") {
119
+ const pool = v4PoolAt(l, key);
120
+ if (pool === null || amountIn >= 1n << 128n) return null;
121
+ const { key: k, zeroForOne } = v4PoolKey(tokenIn, tokenOut, pool);
122
+ data = bytesToHex(encodeCall(QUOTE_SIG.v4, [[[k.currency0, k.currency1, BigInt(k.fee), BigInt(k.tickSpacing), k.hooks], zeroForOne, amountIn, "0x"]]));
123
+ } else {
124
+ const tail = l.quoteKind === "algebra" ? [] : [BigInt(key)];
125
+ data = bytesToHex(encodeCall(QUOTE_SIG[l.quoteKind], [[tokenIn, tokenOut, amountIn, ...tail, 0n]]));
126
+ }
127
+ return firstWord(await reads.simulate({ to: l.quoter, data }));
128
+ } catch {
129
+ return null;
130
+ }
131
+ }
132
+
133
+ export async function bestVenueHop(reads , l , a ) {
134
+ if (a.fromNative && a.toNative) return null;
135
+ const tokenIn = legTokenOf(l, a.fromNative, a.from);
136
+ const tokenOut = legTokenOf(l, a.toNative, a.to);
137
+ if (tokenIn === tokenOut) return null;
138
+ const scale = l.nativeView?.scale ?? 1n;
139
+ if (a.fromNative && a.amountIn % scale !== 0n) return null;
140
+ const amountIn = a.fromNative ? a.amountIn / scale : a.amountIn;
141
+ if (amountIn <= 0n) return null;
142
+ const outs = await Promise.all(l.keys.map(async (key) => ({ key, out: await quoteAt(reads, l, tokenIn, tokenOut, amountIn, key) })));
143
+ let best = null;
144
+ for (const o of outs) if (o.out !== null && (best === null || o.out > best.out)) best = { key: o.key, out: o.out };
145
+ return best === null ? null : { key: best.key, out: a.toNative ? best.out * scale : best.out };
146
+ }
147
+
148
+ const UR_EXECUTE = "execute(bytes,bytes[],uint256)";
149
+ const SWAP_HEAD = ["address", "uint256", "uint256", "bytes", "bool"];
150
+ const cmdsHex = (cs ) => "0x" + cs.map((c) => c.toString(16).padStart(2, "0")).join("");
151
+ const enc = (types , values ) => bytesToHex(encodeAbi(types, values ));
152
+ const call = (sig , values ) => bytesToHex(encodeCall(sig, values ));
153
+
154
+ const V3_SWAP = "exactInputSingle((address,address,uint24,address,uint256,uint256,uint256,uint160))";
155
+ const R02_SWAP = "exactInputSingle((address,address,uint24,address,uint256,uint256,uint160))";
156
+ const ALG_SWAP = "exactInputSingle((address,address,address,uint256,uint256,uint256,uint160))";
157
+
158
+ export function venueLegData(l , a ) {
159
+ if (a.amountIn <= 0n || a.minOut <= 0n) throw new RangeError("a leg needs an amount and a minimum");
160
+ if (a.fromNative && a.toNative) throw new RangeError("a leg swaps the coin into itself");
161
+ const tokenIn = legTokenOf(l, a.fromNative, a.from);
162
+ const tokenOut = legTokenOf(l, a.toNative, a.to);
163
+ if (tokenIn === tokenOut) throw new RangeError("a leg swaps a coin into itself");
164
+ if (!l.keys.includes(a.key)) throw new RangeError("a leg at a key its venue does not ask");
165
+ const recipient = checksumAddress(a.recipient);
166
+ if (l.legKind === "ur-v4") {
167
+
168
+ const pool = v4PoolAt(l, a.key);
169
+ if (pool === null) throw new RangeError("a v4 leg at a key with no pool");
170
+ return zapSwapData({ family: "uniswap-ur", route: { tokens: [tokenIn, tokenOut], v4: pool }, amountIn: a.amountIn, minQuoteOut: a.minOut, zap: recipient, deadline: a.deadline });
171
+ }
172
+ if (l.legKind === "ur") {
173
+ const scale = l.nativeView?.scale ?? 1n;
174
+ if (a.fromNative && a.amountIn % scale !== 0n) throw new RangeError("a native amount the view cannot carry");
175
+ const amountIn = a.fromNative ? a.amountIn / scale : a.amountIn;
176
+
177
+ const minOut = a.toNative && l.nativeView ? (a.minOut + scale - 1n) / scale : a.minOut;
178
+ const wrap = l.weth !== null;
179
+ const path = v3Path([tokenIn, tokenOut], [(l.pathKey ?? ((k ) => k))(a.key)]);
180
+ const swapTo = a.toNative && wrap ? UR_ADDRESS_THIS : UR_MSG_SENDER;
181
+ const head = [swapTo, amountIn, minOut, path, false];
182
+ const swap = l.urTail === "minHop" ? enc([...SWAP_HEAD, "uint256[]"], [...head, []]) : l.urTail === "isUni" ? enc([...SWAP_HEAD, "bool"], [...head, false]) : enc(SWAP_HEAD, head);
183
+ const cmds = [];
184
+ const inputs = [];
185
+ if (a.fromNative && wrap) { cmds.push(UR_WRAP_ETH); inputs.push(enc(["address", "uint256"], [UR_ADDRESS_THIS, amountIn])); }
186
+ cmds.push(UR_V3_SWAP_EXACT_IN); inputs.push(swap);
187
+ if (a.toNative && wrap) { cmds.push(UR_UNWRAP_WETH); inputs.push(enc(["address", "uint256"], [UR_MSG_SENDER, minOut])); }
188
+ return call(UR_EXECUTE, [cmdsHex(cmds), inputs, a.deadline]);
189
+ }
190
+
191
+ if (l.legKind === "algebra") {
192
+ const swap = (to ) => call(ALG_SWAP, [[tokenIn, tokenOut, to, a.deadline, a.amountIn, a.minOut, 0n]]);
193
+ if (!a.toNative) return swap(recipient);
194
+
195
+ return call("multicall(bytes[])", [[swap(V4_NATIVE), call("unwrapWNativeToken(uint256,address)", [a.minOut, recipient])]]);
196
+ }
197
+ if (l.legKind === "v3-router") {
198
+ const swap = (to ) => call(V3_SWAP, [[tokenIn, tokenOut, BigInt(a.key), to, a.deadline, a.amountIn, a.minOut, 0n]]);
199
+ if (!a.toNative) return swap(recipient);
200
+ return call("multicall(bytes[])", [[swap(l.router), call("unwrapWETH9(uint256,address)", [a.minOut, recipient])]]);
201
+ }
202
+ const swap = (to ) => call(R02_SWAP, [[tokenIn, tokenOut, BigInt(a.key), to, a.amountIn, a.minOut, 0n]]);
203
+ const calls = a.toNative ? [swap(UR_ADDRESS_THIS), call("unwrapWETH9(uint256,address)", [a.minOut, recipient])] : [swap(recipient)];
204
+ return call("multicall(uint256,bytes[])", [a.deadline, calls]);
205
+ }
206
+
207
+ export function uniswapLegData(top , a ) {
208
+ if (a.amountIn <= 0n || a.minOut <= 0n) throw new RangeError("a Uniswap leg needs an amount and a minimum");
209
+ if (a.nativeIn && a.nativeOut) throw new RangeError("a Uniswap leg swaps the coin into itself");
210
+ const tokenIn = a.nativeIn ? checksumAddress(top.weth) : checksumAddress(a.tokenIn);
211
+ const tokenOut = a.nativeOut ? checksumAddress(top.weth) : checksumAddress(a.tokenOut);
212
+ if (tokenIn === tokenOut) throw new RangeError("a Uniswap leg swaps a coin into itself");
213
+ const swapTo = a.nativeOut ? UR_ADDRESS_THIS : UR_MSG_SENDER;
214
+ const swap = enc([...SWAP_HEAD, "uint256[]"], [swapTo, a.amountIn, a.minOut, v3Path([tokenIn, tokenOut], [a.fee]), false, []]);
215
+ const cmds = [];
216
+ const inputs = [];
217
+ if (a.nativeIn) { cmds.push(UR_WRAP_ETH); inputs.push(enc(["address", "uint256"], [UR_ADDRESS_THIS, a.amountIn])); }
218
+ cmds.push(UR_V3_SWAP_EXACT_IN); inputs.push(swap);
219
+ if (a.nativeOut) { cmds.push(UR_UNWRAP_WETH); inputs.push(enc(["address", "uint256"], [UR_MSG_SENDER, a.minOut])); }
220
+ return call(UR_EXECUTE, [cmdsHex(cmds), inputs, a.deadline]);
221
+ }
222
+
223
+ export const isDexEdgeRaw = (raw ) =>
224
+ typeof raw === "object" && raw !== null && (raw ).provider === "dex";
225
+
226
+ const isNative = (coin ) => coinKey(coin) === EVM_NATIVE;
227
+
228
+ export function legMinOut(out , slippageBps ) {
229
+ const m = (out * BigInt(10_000 - slippageBps)) / 10_000n;
230
+ return m > 0n ? m : 1n;
231
+ }
232
+
233
+ const WETH_CACHE = new WeakMap ();
234
+
235
+ function v2WethOf(reads , dex ) {
236
+ let m = WETH_CACHE.get(reads);
237
+ if (m === undefined) { m = new Map(); WETH_CACHE.set(reads, m); }
238
+ const k = dex.toLowerCase();
239
+ let hit = m.get(k);
240
+ if (hit === undefined) {
241
+ hit = reads.call({ to: dex, data: call("WETH()", []) }).then((h) => checksumAddress(decodeAbi(["address"], h)[0] ));
242
+ m.set(k, hit);
243
+ const mm = m;
244
+ hit.catch(() => { mm.delete(k); });
245
+ }
246
+ return hit;
247
+ }
248
+
249
+ async function v2PathOf(reads , dex , from , to ) {
250
+ const weth = isNative(from) || isNative(to) ? await v2WethOf(reads, dex) : null;
251
+ const tok = (c ) => (isNative(c) ? (weth ) : checksumAddress(c));
252
+ const path = [tok(from), tok(to)];
253
+ if (path[0] === path[1]) throw new RangeError("the edge leg swaps a coin into itself");
254
+ return path;
255
+ }
256
+
257
+ function v2EdgeQuoter(reads , dex ) {
258
+ return async (req) => {
259
+ const path = await v2PathOf(reads, dex, req.from, req.to);
260
+ const amounts = decodeAbi(["uint256[]"], await reads.call({ to: dex, data: call("getAmountsOut(uint256,address[])", [req.amountIn, path]) }))[0] ;
261
+ const out = amounts[amounts.length - 1] ?? 0n;
262
+ if (amounts.length !== path.length || amounts[0] !== req.amountIn || out <= 0n) throw new RangeError("no edge route");
263
+ const raw = { provider: "dex", family: DEX_FAMILY.v2, dex, path, from: req.from, to: req.to };
264
+ return { inAmount: req.amountIn, outAmount: out, minOut: legMinOut(out, req.slippageBps), raw };
265
+ };
266
+ }
267
+
268
+ function venueEdgeQuoter(reads , row ) {
269
+ return async (req) => {
270
+ const l = wiredLegOf(row.chainId, row.family, row.router);
271
+ if (l === null) throw new RangeError("no edge route");
272
+ const fromNative = isNative(req.from), toNative = isNative(req.to);
273
+ const path = [legTokenOf(l, fromNative, req.from), legTokenOf(l, toNative, req.to)];
274
+ if (path[0] === path[1]) throw new RangeError("the edge leg swaps a coin into itself");
275
+ const hop = await bestVenueHop(reads, l, { fromNative, from: path[0], toNative, to: path[1], amountIn: req.amountIn });
276
+ if (hop === null) throw new RangeError("no edge route");
277
+ const raw = { provider: "dex", family: row.family, dex: l.router, path, from: req.from, to: req.to, chainId: row.chainId, key: hop.key };
278
+ return { inAmount: req.amountIn, outAmount: hop.out, minOut: legMinOut(hop.out, req.slippageBps), raw };
279
+ };
280
+ }
281
+
282
+ export function dexEdgeQuoter(row , reads ) {
283
+ return row.family === DEX_FAMILY.v2 ? v2EdgeQuoter(reads, row.router) : venueEdgeQuoter(reads, row);
284
+ }
285
+
286
+ const V2_ETH_FOR_TOKENS = "swapExactETHForTokens(uint256,address[],address,uint256)";
287
+ const V2_TOKENS_FOR_TOKENS = "swapExactTokensForTokens(uint256,uint256,address[],address,uint256)";
288
+ const V2_TOKENS_FOR_ETH = "swapExactTokensForETH(uint256,uint256,address[],address,uint256)";
289
+
290
+ export function dexSwapData(raw , p ) {
291
+ if (!isDexEdgeRaw(raw) || !dexFamilyWired(raw.family)) throw new RangeError("edge build refused");
292
+ if (p.amountIn <= 0n || p.minOut <= 0n) throw new RangeError("edge build refused");
293
+ if (raw.family !== DEX_FAMILY.v2) {
294
+ const l = raw.chainId === undefined ? null : wiredLegOf(raw.chainId, raw.family, raw.dex);
295
+ if (l === null || raw.key === undefined || raw.path.length !== 2) throw new RangeError("edge build refused");
296
+ return venueLegData(l, { fromNative: isNative(raw.from), from: raw.path[0], toNative: isNative(raw.to), to: raw.path[1], key: raw.key, amountIn: p.amountIn, minOut: p.minOut, recipient: p.recipient, deadline: p.deadline });
297
+ }
298
+ const path = [...raw.path];
299
+ if (isNative(raw.from)) return call(V2_ETH_FOR_TOKENS, [p.minOut, path, p.recipient, p.deadline]);
300
+ if (isNative(raw.to)) return call(V2_TOKENS_FOR_ETH, [p.amountIn, p.minOut, path, p.recipient, p.deadline]);
301
+ return call(V2_TOKENS_FOR_TOKENS, [p.amountIn, p.minOut, path, p.recipient, p.deadline]);
302
+ }
@@ -11,17 +11,17 @@ export const CLAIM_KNOWN_MASKS = {"solana":{"claim":143,"claimWideV1":399,"v2":9
11
11
   
12
12
 
13
13
  export const EVM_FUNCTION_SELECTORS = [
14
- { name: "acceptAuthority", signature: "acceptAuthority()", selector: "0x1580798f", sources: ["floorAmm"] },
15
- { name: "accounted", signature: "accounted(address)", selector: "0xee1a56ce", sources: ["floorAmm"] },
14
+ { name: "acceptAuthority", signature: "acceptAuthority()", selector: "0x1580798f", sources: ["floorAmm","floorAmmGovV2"] },
15
+ { name: "accounted", signature: "accounted(address)", selector: "0xee1a56ce", sources: ["floorAmm","floorAmmGovV2"] },
16
16
  { name: "addPreset", signature: "addPreset(uint8,bytes)", selector: "0xb88257b1", sources: ["floorAmm"] },
17
- { name: "addQuote", signature: "addQuote(address,uint256,uint256)", selector: "0x488c664b", sources: ["floorAmm"] },
17
+ { name: "addQuote", signature: "addQuote(address,uint256,uint256)", selector: "0x488c664b", sources: ["floorAmm","floorAmmGovV2"] },
18
18
  { name: "addReward", signature: "addReward(uint256)", selector: "0x74de4ec4", sources: ["floorTokenIndexed"] },
19
19
  { name: "allowance", signature: "allowance(address,address)", selector: "0xdd62ed3e", sources: ["floorToken","floorTokenIndexed"] },
20
20
  { name: "approve", signature: "approve(address,uint256)", selector: "0x095ea7b3", sources: ["floorToken","floorTokenIndexed"] },
21
- { name: "authority", signature: "authority()", selector: "0xbf7e214f", sources: ["floorAmm"] },
21
+ { name: "authority", signature: "authority()", selector: "0xbf7e214f", sources: ["floorAmm","floorAmmGovV2"] },
22
22
  { name: "balanceOf", signature: "balanceOf(address)", selector: "0x70a08231", sources: ["floorToken","floorTokenIndexed"] },
23
23
  { name: "bidMoney", signature: "bidMoney(uint256)", selector: "0x8e403c51", sources: ["floorAmmViewsV2"] },
24
- { name: "bindHandle", signature: "bindHandle(bytes32,address,address[],uint256,bytes,bytes)", selector: "0xcea3463e", sources: ["floorAmm"] },
24
+ { name: "bindHandle", signature: "bindHandle(bytes32,address,address[],uint256,bytes,bytes)", selector: "0xcea3463e", sources: ["floorAmm","floorAmmGovV2"] },
25
25
  { name: "bookEngine", signature: "bookEngine()", selector: "0x72148c77", sources: ["floorAmmV2"] },
26
26
  { name: "bookState", signature: "bookState()", selector: "0x2c14e3f2", sources: ["floorTokenIndexed"] },
27
27
  { name: "bookTotals", signature: "bookTotals()", selector: "0xbffc2073", sources: ["floorTokenIndexed"] },
@@ -29,32 +29,49 @@ export const EVM_FUNCTION_SELECTORS = [
29
29
  { name: "burnFrom", signature: "burnFrom(address,uint256)", selector: "0x79cc6790", sources: ["floorToken","floorTokenIndexed"] },
30
30
  { name: "burnTeamV2", signature: "burnTeamV2(uint256,uint8,uint256)", selector: "0x2f7bf11b", sources: ["floorAmmClaimsV2"] },
31
31
  { name: "buy", signature: "buy(uint256,uint256,uint256,address,uint256)", selector: "0x102d8c79", sources: ["floorAmm","floorAmmV2"] },
32
+ { name: "buyFor", signature: "buyFor(uint256,uint256,uint256,address,uint256,address)", selector: "0x67105875", sources: ["floorAmm","floorAmmV2"] },
32
33
  { name: "buyFromBalance", signature: "buyFromBalance(uint256,uint256,address,address,uint256)", selector: "0x5f9f56d2", sources: ["floorAmm","floorAmmV2"] },
34
+ { name: "buyFromBalanceFor", signature: "buyFromBalanceFor(uint256,uint256,address,address,uint256,address)", selector: "0xbb6cda49", sources: ["floorAmm","floorAmmV2"] },
33
35
  { name: "buyWithEth", signature: "buyWithEth(uint256,bytes,uint256,uint256,address,uint256)", selector: "0xef8772c4", sources: ["floorZap"] },
34
36
  { name: "buyWithToken", signature: "buyWithToken(uint256,address,uint256,bytes,uint256,uint256,address,uint256)", selector: "0x9fd30605", sources: ["floorZap"] },
35
37
  { name: "checkPreset", signature: "checkPreset(bytes)", selector: "0x6337513e", sources: ["floorAmm"] },
36
38
  { name: "circulatingOf", signature: "circulatingOf(uint256)", selector: "0x72812fcf", sources: ["floorAmmViewsV2"] },
37
39
  { name: "claim", signature: "claim(address,uint256,uint256[],address[])", selector: "0xa461a90d", sources: ["floorAmm","floorAmmClaimsV2"] },
38
- { name: "claimPayoutTo", signature: "claimPayoutTo(address,address)", selector: "0xc14ab75d", sources: ["floorAmm"] },
39
- { name: "clearTraderRef", signature: "clearTraderRef(address)", selector: "0x53550430", sources: ["floorAmm"] },
40
+ { name: "claimPayoutTo", signature: "claimPayoutTo(address,address)", selector: "0xc14ab75d", sources: ["floorAmm","floorAmmGovV2"] },
41
+ { name: "clearTraderRef", signature: "clearTraderRef(address)", selector: "0x53550430", sources: ["floorAmm","floorAmmGovV2"] },
40
42
  { name: "createBookEngine", signature: "createBookEngine()", selector: "0x0fdf26a7", sources: ["floorAmmCreateV2"] },
41
43
  { name: "createLaunch", signature: "createLaunch((uint8,address,string,string,uint256,uint256,bool,bytes32,uint256,uint16))", selector: "0x25b62f18", sources: ["floorAmm","floorAmmCreateV2"] },
42
- { name: "createPaused", signature: "createPaused()", selector: "0xbac7b497", sources: ["floorAmm"] },
44
+ { name: "createPaused", signature: "createPaused()", selector: "0xbac7b497", sources: ["floorAmm","floorAmmGovV2"] },
43
45
  { name: "creditBacking", signature: "creditBacking(uint256,uint256)", selector: "0x1f341504", sources: ["floorAmmV2"] },
46
+ { name: "creditPlatform", signature: "creditPlatform(uint256,uint256,bytes32)", selector: "0x93fe58a2", sources: ["floorAmm","floorAmmV2"] },
44
47
  { name: "DEAD", signature: "DEAD()", selector: "0x03fd2a45", sources: ["floorTokenIndexed"] },
48
+ { name: "dealEscrowArm", signature: "dealEscrowArm(bytes32,uint8)", selector: "0x3fe96415", sources: ["floorAmm","floorAmmClaimsV2"] },
49
+ { name: "dealEscrowArmV3", signature: "dealEscrowArmV3(bytes32,uint8)", selector: "0x32037a0e", sources: ["floorAmm","floorAmmClaimsV2"] },
50
+ { name: "dealEscrowCancel", signature: "dealEscrowCancel(bytes32)", selector: "0x16d11c50", sources: ["floorAmm","floorAmmViewsV2"] },
51
+ { name: "dealEscrowMarketCap", signature: "dealEscrowMarketCap(uint256)", selector: "0x96cefeb9", sources: ["floorAmm","floorAmmViewsV2"] },
52
+ { name: "dealEscrowObject", signature: "dealEscrowObject(bytes32,uint8)", selector: "0xd8071cc0", sources: ["floorAmm","floorAmmViewsV2"] },
53
+ { name: "dealEscrowOf", signature: "dealEscrowOf(bytes32)", selector: "0x2a144918", sources: ["floorAmm","floorAmmViewsV2"] },
54
+ { name: "dealEscrowOpen", signature: "dealEscrowOpen(uint256,address,bytes32,bool,uint256[],uint256[],int64)", selector: "0xe279a5e8", sources: ["floorAmm","floorAmmClaimsV2"] },
55
+ { name: "dealEscrowOpenV3", signature: "dealEscrowOpenV3(uint256,address,bytes32,bool,(uint8[],uint256[],uint256[],uint8,address,uint16,int64))", selector: "0xa1330ee1", sources: ["floorAmm","floorAmmClaimsV2"] },
56
+ { name: "dealEscrowRefund", signature: "dealEscrowRefund(bytes32)", selector: "0x947a9b41", sources: ["floorAmm","floorAmmClaimsV2"] },
57
+ { name: "dealEscrowRelease", signature: "dealEscrowRelease(bytes32,uint8)", selector: "0xcd129e2e", sources: ["floorAmm","floorAmmClaimsV2"] },
58
+ { name: "dealEscrowReleaseV3", signature: "dealEscrowReleaseV3(bytes32,uint8)", selector: "0xb25894ac", sources: ["floorAmm","floorAmmClaimsV2"] },
59
+ { name: "dealEscrowSubmitProof", signature: "dealEscrowSubmitProof(bytes32,uint8,bytes32)", selector: "0x236f5ea6", sources: ["floorAmm","floorAmmViewsV2"] },
60
+ { name: "dealEscrowV3Of", signature: "dealEscrowV3Of(bytes32)", selector: "0xaffbc4bb", sources: ["floorAmm","floorAmmViewsV2"] },
61
+ { name: "dealFeeCapBps", signature: "dealFeeCapBps()", selector: "0xfd066b8a", sources: ["floorAmm","floorAmmGovV2"] },
45
62
  { name: "decimals", signature: "decimals()", selector: "0x313ce567", sources: ["floorToken","floorTokenIndexed"] },
46
63
  { name: "decodeRow", signature: "decodeRow(bytes)", selector: "0x8fff698d", sources: ["floorAmmCreateV2"] },
47
64
  { name: "deletePreset", signature: "deletePreset(uint8)", selector: "0xb2d0d2a5", sources: ["floorAmm"] },
48
65
  { name: "DOMAIN_SEPARATOR", signature: "DOMAIN_SEPARATOR()", selector: "0x3644e515", sources: ["floorToken","floorTokenIndexed"] },
49
66
  { name: "eip712Domain", signature: "eip712Domain()", selector: "0x84b0196e", sources: ["floorTokenIndexed"] },
50
67
  { name: "floorAmm", signature: "floorAmm()", selector: "0x78164d52", sources: ["floorZap"] },
51
- { name: "floorTokenAccrued", signature: "floorTokenAccrued(address)", selector: "0xf3a261f9", sources: ["floorAmm"] },
52
- { name: "handleOwed", signature: "handleOwed(bytes32,address)", selector: "0xaad2ed5c", sources: ["floorAmm"] },
53
- { name: "handleWallet", signature: "handleWallet(bytes32)", selector: "0xc6da686d", sources: ["floorAmm"] },
68
+ { name: "floorTokenAccrued", signature: "floorTokenAccrued(address)", selector: "0xf3a261f9", sources: ["floorAmm","floorAmmGovV2"] },
69
+ { name: "handleOwed", signature: "handleOwed(bytes32,address)", selector: "0xaad2ed5c", sources: ["floorAmm","floorAmmGovV2"] },
70
+ { name: "handleWallet", signature: "handleWallet(bytes32)", selector: "0xc6da686d", sources: ["floorAmm","floorAmmGovV2"] },
54
71
  { name: "holderBook", signature: "holderBook(uint256)", selector: "0xf5d23b14", sources: ["floorAmmViewsV2"] },
55
- { name: "holderBucket", signature: "holderBucket(address)", selector: "0x088806d0", sources: ["floorAmm"] },
56
- { name: "holderDest", signature: "holderDest()", selector: "0x84a6263a", sources: ["floorAmm"] },
57
- { name: "initialize", signature: "initialize(address,address,address,address)", selector: "0xf8c8765e", sources: ["floorAmm"] },
72
+ { name: "holderBucket", signature: "holderBucket(address)", selector: "0x088806d0", sources: ["floorAmm","floorAmmGovV2"] },
73
+ { name: "holderDest", signature: "holderDest()", selector: "0x84a6263a", sources: ["floorAmm","floorAmmGovV2"] },
74
+ { name: "initialize", signature: "initialize(address,address,address,address)", selector: "0xf8c8765e", sources: ["floorAmm","floorAmmGovV2"] },
58
75
  { name: "initialize", signature: "initialize(string,string,uint256)", selector: "0xb119490e", sources: ["floorTokenIndexed"] },
59
76
  { name: "launchBook", signature: "launchBook(uint256)", selector: "0x926310f1", sources: ["floorAmmViewsV2"] },
60
77
  { name: "launchCount", signature: "launchCount()", selector: "0x27cca59f", sources: ["floorAmm","floorAmmViewsV2"] },
@@ -66,56 +83,85 @@ export const EVM_FUNCTION_SELECTORS = [
66
83
  { name: "launchQuote", signature: "launchQuote(uint256)", selector: "0x98032919", sources: ["floorAmm","floorAmmViewsV2"] },
67
84
  { name: "launchState", signature: "launchState(uint256)", selector: "0xac3307e8", sources: ["floorAmm","floorAmmViewsV2"] },
68
85
  { name: "launchToken", signature: "launchToken(uint256)", selector: "0x6a19197b", sources: ["floorAmm","floorAmmViewsV2"] },
69
- { name: "metadataBase", signature: "metadataBase()", selector: "0x65b973c3", sources: ["floorAmm"] },
86
+ { name: "metadataBase", signature: "metadataBase()", selector: "0x65b973c3", sources: ["floorAmm","floorAmmGovV2"] },
70
87
  { name: "metadataURI", signature: "metadataURI()", selector: "0x03ee438c", sources: ["floorToken","floorTokenIndexed"] },
71
- { name: "moveHandleOwed", signature: "moveHandleOwed(bytes32,address[])", selector: "0xc43594a1", sources: ["floorAmm"] },
88
+ { name: "moveHandleOwed", signature: "moveHandleOwed(bytes32,address[])", selector: "0xc43594a1", sources: ["floorAmm","floorAmmGovV2"] },
72
89
  { name: "name", signature: "name()", selector: "0x06fdde03", sources: ["floorToken","floorTokenIndexed"] },
73
- { name: "NATIVE", signature: "NATIVE()", selector: "0xa0cf0aea", sources: ["floorAmm"] },
74
- { name: "nativeCreateFee", signature: "nativeCreateFee()", selector: "0x10b51e45", sources: ["floorAmm"] },
75
- { name: "nextModule", signature: "nextModule()", selector: "0xf85abfc7", sources: ["floorAmmV2","floorAmmViewsV2","floorAmmCreateV2","floorAmmClaimsV2"] },
90
+ { name: "NATIVE", signature: "NATIVE()", selector: "0xa0cf0aea", sources: ["floorAmm","floorAmmGovV2"] },
91
+ { name: "nativeCreateFee", signature: "nativeCreateFee()", selector: "0x10b51e45", sources: ["floorAmm","floorAmmGovV2"] },
92
+ { name: "nextModule", signature: "nextModule()", selector: "0xf85abfc7", sources: ["floorAmmV2","floorAmmViewsV2","floorAmmCreateV2","floorAmmClaimsV2","floorAmmOfficeV2"] },
76
93
  { name: "nextPresetId", signature: "nextPresetId()", selector: "0xc8a768e6", sources: ["floorAmm"] },
77
94
  { name: "nonces", signature: "nonces(address)", selector: "0x7ecebe00", sources: ["floorToken","floorTokenIndexed"] },
78
95
  { name: "noteBurn", signature: "noteBurn(uint256)", selector: "0x6db7cd01", sources: ["floorAmmCreateV2"] },
79
96
  { name: "noteDead", signature: "noteDead(uint256)", selector: "0xbdf3b0de", sources: ["floorAmmCreateV2"] },
97
+ { name: "noteMove", signature: "noteMove(address,address,uint256,uint256,uint256)", selector: "0xe6b761ea", sources: ["floorAmmV2"] },
98
+ { name: "officeAcceptController", signature: "officeAcceptController(bytes32)", selector: "0x94a408e4", sources: ["floorAmm","floorAmmOfficeV2"] },
99
+ { name: "officeAcceptMerge", signature: "officeAcceptMerge(bytes32,bytes32,address)", selector: "0x5b134957", sources: ["floorAmm","floorAmmOfficeV2"] },
100
+ { name: "officeAddMember", signature: "officeAddMember(bytes32,address)", selector: "0xe65ac3d9", sources: ["floorAmm","floorAmmOfficeV2"] },
101
+ { name: "officeBuy", signature: "officeBuy(bytes32,uint256,uint256,uint256)", selector: "0xad7e22ec", sources: ["floorAmm","floorAmmOfficeV2"] },
102
+ { name: "officeCancelMerge", signature: "officeCancelMerge(bytes32)", selector: "0x009048f9", sources: ["floorAmm","floorAmmOfficeV2"] },
103
+ { name: "officeDeposit", signature: "officeDeposit(bytes32,uint256)", selector: "0x303a9f22", sources: ["floorAmm","floorAmmOfficeV2"] },
104
+ { name: "officeLeave", signature: "officeLeave(bytes32)", selector: "0xa3c22110", sources: ["floorAmm","floorAmmOfficeV2"] },
105
+ { name: "officeMemberOf", signature: "officeMemberOf(bytes32,address)", selector: "0x17883590", sources: ["floorAmm","floorAmmOfficeV2"] },
106
+ { name: "officeMergeStep", signature: "officeMergeStep(bytes32)", selector: "0x8c2973f8", sources: ["floorAmm","floorAmmOfficeV2"] },
107
+ { name: "officeOf", signature: "officeOf(bytes32)", selector: "0x525c1680", sources: ["floorAmm","floorAmmOfficeV2"] },
108
+ { name: "officeOpen", signature: "officeOpen(bytes32,address)", selector: "0x749cd130", sources: ["floorAmm","floorAmmOfficeV2"] },
109
+ { name: "officeProposeController", signature: "officeProposeController(bytes32,address)", selector: "0x7dc27095", sources: ["floorAmm","floorAmmOfficeV2"] },
110
+ { name: "officeProposeMerge", signature: "officeProposeMerge(bytes32,bytes32,address)", selector: "0x95660c91", sources: ["floorAmm","floorAmmOfficeV2"] },
111
+ { name: "officeRemoveMember", signature: "officeRemoveMember(bytes32,address)", selector: "0xf1b0f92d", sources: ["floorAmm","floorAmmOfficeV2"] },
112
+ { name: "officeSell", signature: "officeSell(bytes32,uint256,address,uint256,uint256)", selector: "0x6b8325c5", sources: ["floorAmm","floorAmmOfficeV2"] },
113
+ { name: "officeSetShare", signature: "officeSetShare(bytes32,address,uint16)", selector: "0x1569850a", sources: ["floorAmm","floorAmmOfficeV2"] },
114
+ { name: "officeValue", signature: "officeValue(bytes32)", selector: "0x7f2683e3", sources: ["floorAmm","floorAmmOfficeV2"] },
115
+ { name: "ogCount", signature: "ogCount()", selector: "0x9457990a", sources: ["floorAmmGovV2"] },
116
+ { name: "ogUserOf", signature: "ogUserOf(address)", selector: "0x6df29e2f", sources: ["floorAmmGovV2"] },
80
117
  { name: "optedIn", signature: "optedIn(address)", selector: "0x4824b8fd", sources: ["floorTokenIndexed"] },
81
118
  { name: "optIn", signature: "optIn()", selector: "0x5b48684e", sources: ["floorTokenIndexed"] },
82
- { name: "owedOf", signature: "owedOf(address,address)", selector: "0xfacba08d", sources: ["floorAmm"] },
83
- { name: "owedOfMany", signature: "owedOfMany(address,address[])", selector: "0xa1efa4ba", sources: ["floorAmm"] },
119
+ { name: "owedOf", signature: "owedOf(address,address)", selector: "0xfacba08d", sources: ["floorAmm","floorAmmGovV2"] },
120
+ { name: "owedOfMany", signature: "owedOfMany(address,address[])", selector: "0xa1efa4ba", sources: ["floorAmm","floorAmmGovV2"] },
84
121
  { name: "owedV2", signature: "owedV2(address,uint256[],address[])", selector: "0xdd3ee1ef", sources: ["floorAmmViewsV2"] },
85
122
  { name: "pairIdOf", signature: "pairIdOf(uint256)", selector: "0x83a74ea3", sources: ["floorAmmViewsV2"] },
86
- { name: "payoutOwed", signature: "payoutOwed(address,address)", selector: "0xae3f9120", sources: ["floorAmm"] },
87
- { name: "pendingAuthority", signature: "pendingAuthority()", selector: "0xfabb94bb", sources: ["floorAmm"] },
123
+ { name: "payoutOwed", signature: "payoutOwed(address,address)", selector: "0xae3f9120", sources: ["floorAmm","floorAmmGovV2"] },
124
+ { name: "pendingAuthority", signature: "pendingAuthority()", selector: "0xfabb94bb", sources: ["floorAmm","floorAmmGovV2"] },
88
125
  { name: "permit", signature: "permit(address,address,uint256,uint256,uint8,bytes32,bytes32)", selector: "0xd505accf", sources: ["floorToken","floorTokenIndexed"] },
89
- { name: "platformOwed", signature: "platformOwed(address)", selector: "0x240b9586", sources: ["floorAmm"] },
126
+ { name: "platformOwed", signature: "platformOwed(address)", selector: "0x240b9586", sources: ["floorAmm","floorAmmGovV2"] },
90
127
  { name: "positionOf", signature: "positionOf(address)", selector: "0xfd2d39c5", sources: ["floorTokenIndexed"] },
91
128
  { name: "predictToken", signature: "predictToken(address,bytes32)", selector: "0x486e36c8", sources: ["floorAmm","floorAmmCreateV2"] },
92
129
  { name: "presetRow", signature: "presetRow(uint8)", selector: "0xa0c15861", sources: ["floorAmm"] },
93
- { name: "priceUpdater", signature: "priceUpdater()", selector: "0xfc612a8d", sources: ["floorAmm"] },
130
+ { name: "priceUpdater", signature: "priceUpdater()", selector: "0xfc612a8d", sources: ["floorAmm","floorAmmGovV2"] },
94
131
  { name: "program", signature: "program()", selector: "0xc860ebc6", sources: ["floorToken","floorTokenIndexed"] },
95
132
  { name: "proxiableUUID", signature: "proxiableUUID()", selector: "0x52d1902d", sources: ["floorAmmV2"] },
96
133
  { name: "quoteBuy", signature: "quoteBuy(uint256,uint256,address)", selector: "0xec7a34c9", sources: ["floorAmm","floorAmmV2"] },
97
- { name: "quoteEntry", signature: "quoteEntry(address)", selector: "0x77665076", sources: ["floorAmm"] },
98
- { name: "quoteRisk", signature: "quoteRisk(address)", selector: "0x1461d14e", sources: ["floorAmm"] },
99
- { name: "quotes", signature: "quotes()", selector: "0xd6a5d7db", sources: ["floorAmm"] },
134
+ { name: "quoteEntry", signature: "quoteEntry(address)", selector: "0x77665076", sources: ["floorAmm","floorAmmGovV2"] },
135
+ { name: "quoteRisk", signature: "quoteRisk(address)", selector: "0x1461d14e", sources: ["floorAmm","floorAmmGovV2"] },
136
+ { name: "quotes", signature: "quotes()", selector: "0xd6a5d7db", sources: ["floorAmm","floorAmmGovV2"] },
100
137
  { name: "quoteSell", signature: "quoteSell(uint256,uint256,address)", selector: "0x0cff08d1", sources: ["floorAmm","floorAmmV2"] },
101
- { name: "referralAuthority", signature: "referralAuthority()", selector: "0x2fe0a99a", sources: ["floorAmm"] },
138
+ { name: "referralAuthority", signature: "referralAuthority()", selector: "0x2fe0a99a", sources: ["floorAmm","floorAmmGovV2"] },
139
+ { name: "refVolume", signature: "refVolume(uint256,address)", selector: "0xe6a32581", sources: ["floorAmm","floorAmmViewsV2"] },
140
+ { name: "relayBook", signature: "relayBook(uint256)", selector: "0xd1f6ab70", sources: ["floorAmmV2"] },
141
+ { name: "relayBooks", signature: "relayBooks(uint256,uint256)", selector: "0xcf90be94", sources: ["floorAmmV2"] },
102
142
  { name: "releaseSkipped", signature: "releaseSkipped(address)", selector: "0x215fa9eb", sources: ["floorTokenIndexed"] },
143
+ { name: "revokeOgUser", signature: "revokeOgUser(address)", selector: "0x52e52ecc", sources: ["floorAmmGovV2"] },
144
+ { name: "roomOf", signature: "roomOf()", selector: "0x7a0be43c", sources: ["floorAmmV2"] },
103
145
  { name: "router", signature: "router()", selector: "0xf887ea40", sources: ["floorZap"] },
146
+ { name: "routerDeployer", signature: "routerDeployer()", selector: "0xe8381015", sources: ["floorAmm","floorAmmV2"] },
104
147
  { name: "sell", signature: "sell(uint256,uint256,uint256,address,uint256)", selector: "0xbadb999b", sources: ["floorAmm","floorAmmV2"] },
105
148
  { name: "sellFromBalance", signature: "sellFromBalance(uint256,uint256,address,uint256)", selector: "0x611b00a8", sources: ["floorAmm","floorAmmV2"] },
149
+ { name: "sellFromBalanceFor", signature: "sellFromBalanceFor(uint256,uint256,address,uint256,address)", selector: "0x54590af6", sources: ["floorAmm","floorAmmV2"] },
106
150
  { name: "sellWithPermit", signature: "sellWithPermit(uint256,uint256,uint256,address,uint256,uint256,uint8,bytes32,bytes32)", selector: "0x2ab030d3", sources: ["floorAmm","floorAmmV2"] },
107
- { name: "setCreatePaused", signature: "setCreatePaused(bool)", selector: "0x83bcec85", sources: ["floorAmm"] },
108
- { name: "setHolderDest", signature: "setHolderDest(address)", selector: "0x6ad3e66d", sources: ["floorAmm"] },
109
- { name: "setMetadataBase", signature: "setMetadataBase(string)", selector: "0xd3811c0f", sources: ["floorAmm"] },
110
- { name: "setNativeCreateFee", signature: "setNativeCreateFee(uint256)", selector: "0xa4433667", sources: ["floorAmm"] },
151
+ { name: "setCreatePaused", signature: "setCreatePaused(bool)", selector: "0x83bcec85", sources: ["floorAmm","floorAmmGovV2"] },
152
+ { name: "setDealFeeCap", signature: "setDealFeeCap(uint16)", selector: "0x041a4410", sources: ["floorAmm","floorAmmGovV2"] },
153
+ { name: "setHolderDest", signature: "setHolderDest(address)", selector: "0x6ad3e66d", sources: ["floorAmm","floorAmmGovV2"] },
154
+ { name: "setMetadataBase", signature: "setMetadataBase(string)", selector: "0xd3811c0f", sources: ["floorAmm","floorAmmGovV2"] },
155
+ { name: "setNativeCreateFee", signature: "setNativeCreateFee(uint256)", selector: "0xa4433667", sources: ["floorAmm","floorAmmGovV2"] },
156
+ { name: "setOgUser", signature: "setOgUser(address,uint256,bytes)", selector: "0x02cb4469", sources: ["floorAmmGovV2"] },
111
157
  { name: "setPresetEnabled", signature: "setPresetEnabled(uint8,bool)", selector: "0x673fb9a9", sources: ["floorAmm"] },
112
- { name: "setPriceUpdater", signature: "setPriceUpdater(address)", selector: "0x97c4a5f3", sources: ["floorAmm"] },
113
- { name: "setQuoteCap", signature: "setQuoteCap(address,uint128)", selector: "0x42adf398", sources: ["floorAmm"] },
114
- { name: "setQuotePrice", signature: "setQuotePrice(address,uint256)", selector: "0x3857ed9e", sources: ["floorAmm"] },
115
- { name: "setReferralAuthority", signature: "setReferralAuthority(address)", selector: "0x46325d7a", sources: ["floorAmm"] },
116
- { name: "setTimelock", signature: "setTimelock(address)", selector: "0xbdacb303", sources: ["floorAmm"] },
117
- { name: "setTraderRef", signature: "setTraderRef(address,address[3],uint256,bytes,bytes)", selector: "0xd7426758", sources: ["floorAmm"] },
118
- { name: "setTreasury", signature: "setTreasury(address)", selector: "0xf0f44260", sources: ["floorAmm"] },
158
+ { name: "setPriceUpdater", signature: "setPriceUpdater(address)", selector: "0x97c4a5f3", sources: ["floorAmm","floorAmmGovV2"] },
159
+ { name: "setQuoteCap", signature: "setQuoteCap(address,uint128)", selector: "0x42adf398", sources: ["floorAmm","floorAmmGovV2"] },
160
+ { name: "setQuotePrice", signature: "setQuotePrice(address,uint256)", selector: "0x3857ed9e", sources: ["floorAmm","floorAmmGovV2"] },
161
+ { name: "setReferralAuthority", signature: "setReferralAuthority(address)", selector: "0x46325d7a", sources: ["floorAmm","floorAmmGovV2"] },
162
+ { name: "setTimelock", signature: "setTimelock(address)", selector: "0xbdacb303", sources: ["floorAmm","floorAmmGovV2"] },
163
+ { name: "setTraderRef", signature: "setTraderRef(address,address[3],uint256,bytes,bytes)", selector: "0xd7426758", sources: ["floorAmm","floorAmmGovV2"] },
164
+ { name: "setTreasury", signature: "setTreasury(address)", selector: "0xf0f44260", sources: ["floorAmm","floorAmmGovV2"] },
119
165
  { name: "simBuy", signature: "simBuy(uint256,uint256,address)", selector: "0xf69acbed", sources: ["floorAmmV2"] },
120
166
  { name: "simSell", signature: "simSell(uint256,uint256,address)", selector: "0xd3536ecd", sources: ["floorAmmV2"] },
121
167
  { name: "symbol", signature: "symbol()", selector: "0x95d89b41", sources: ["floorToken","floorTokenIndexed"] },
@@ -124,20 +170,23 @@ export const EVM_FUNCTION_SELECTORS = [
124
170
  { name: "teamShareBuyAndClaim", signature: "teamShareBuyAndClaim(uint256,uint256,uint256,uint256)", selector: "0xc7f1048c", sources: ["floorAmmViewsV2"] },
125
171
  { name: "teamShareOf", signature: "teamShareOf(uint256,address)", selector: "0xb2280af2", sources: ["floorAmm","floorAmmViewsV2"] },
126
172
  { name: "teamSlotAdd", signature: "teamSlotAdd(uint256,bytes32,uint8,uint256,bool)", selector: "0xd5402e81", sources: ["floorAmm","floorAmmClaimsV2"] },
173
+ { name: "teamSlotAddDeal", signature: "teamSlotAddDeal(uint256,bytes32,uint8,uint256,uint16)", selector: "0xed6c1829", sources: ["floorAmm","floorAmmClaimsV2"] },
174
+ { name: "teamSlotAddDealV3", signature: "teamSlotAddDealV3(uint256,bytes32,uint8,uint256,uint16,address,uint16)", selector: "0x883baaa4", sources: ["floorAmm","floorAmmClaimsV2"] },
175
+ { name: "teamSlotAgencyOf", signature: "teamSlotAgencyOf(uint256,uint8)", selector: "0x1764d99f", sources: ["floorAmm","floorAmmViewsV2"] },
127
176
  { name: "teamSlotOf", signature: "teamSlotOf(uint256)", selector: "0x8744aded", sources: ["floorAmmViewsV2"] },
128
- { name: "timelock", signature: "timelock()", selector: "0xd33219b4", sources: ["floorAmm"] },
177
+ { name: "timelock", signature: "timelock()", selector: "0xd33219b4", sources: ["floorAmm","floorAmmGovV2"] },
129
178
  { name: "TOKEN_SCALE", signature: "TOKEN_SCALE()", selector: "0xcae07d2a", sources: ["floorTokenIndexed"] },
130
179
  { name: "tokenImplV2", signature: "tokenImplV2()", selector: "0x01b9b386", sources: ["floorAmmCreateV2"] },
131
180
  { name: "TOTAL_SUPPLY", signature: "TOTAL_SUPPLY()", selector: "0x902d55a5", sources: ["floorTokenIndexed"] },
132
181
  { name: "totalSupply", signature: "totalSupply()", selector: "0x18160ddd", sources: ["floorToken","floorTokenIndexed"] },
133
182
  { name: "traderRef", signature: "traderRef(address)", selector: "0xcfc18291", sources: ["floorAmm","floorAmmViewsV2"] },
134
183
  { name: "transfer", signature: "transfer(address,uint256)", selector: "0xa9059cbb", sources: ["floorToken","floorTokenIndexed"] },
135
- { name: "transferAuthority", signature: "transferAuthority(address)", selector: "0x3078db6c", sources: ["floorAmm"] },
184
+ { name: "transferAuthority", signature: "transferAuthority(address)", selector: "0x3078db6c", sources: ["floorAmm","floorAmmGovV2"] },
136
185
  { name: "transferFrom", signature: "transferFrom(address,address,uint256)", selector: "0x23b872dd", sources: ["floorToken","floorTokenIndexed"] },
137
- { name: "treasury", signature: "treasury()", selector: "0x61d027b3", sources: ["floorAmm"] },
186
+ { name: "treasury", signature: "treasury()", selector: "0x61d027b3", sources: ["floorAmm","floorAmmGovV2"] },
138
187
  { name: "unlockCreatorBuy", signature: "unlockCreatorBuy(uint256)", selector: "0xf03d6d5e", sources: ["floorAmm","floorAmmClaimsV2"] },
139
188
  { name: "updatePreset", signature: "updatePreset(uint8,bytes)", selector: "0x005d9e72", sources: ["floorAmm"] },
140
- { name: "updateQuote", signature: "updateQuote(address,bool,uint256,uint256)", selector: "0x21593d6e", sources: ["floorAmm"] },
189
+ { name: "updateQuote", signature: "updateQuote(address,bool,uint256,uint256)", selector: "0x21593d6e", sources: ["floorAmm","floorAmmGovV2"] },
141
190
  { name: "UPGRADE_INTERFACE_VERSION", signature: "UPGRADE_INTERFACE_VERSION()", selector: "0xad3cb1cc", sources: ["floorAmmV2"] },
142
191
  { name: "upgradeToAndCall", signature: "upgradeToAndCall(address,bytes)", selector: "0x4f1ef286", sources: ["floorAmmV2"] },
143
192
  { name: "withdrawHolder", signature: "withdrawHolder(address,uint256)", selector: "0xfb90c8bf", sources: ["floorAmm","floorAmmCreateV2"] },
package/dist/index.js CHANGED
@@ -19,11 +19,15 @@ export * as solanaTx from "./solana/tx.js";
19
19
  export * as solanaAlt from "./solana/alt.js";
20
20
  export * as handle from "./handle.js";
21
21
  export * as burn from "./burn.js";
22
+ export * as scaledUi from "./scaledUi.js";
23
+ export * as stockRefresh from "./stockRefresh.js";
24
+ export * as reprice from "./reprice.js";
22
25
  export * as evmKeccak from "./evm/keccak.js";
23
26
  export * as evmAbi from "./evm/abi.js";
24
27
  export * as evmItems from "./evm/items.js";
25
28
  export * as evmZap from "./evm/zap.js";
26
29
  export * as evmRouter from "./evm/router.js";
30
+ export * as evmVenues from "./evm/venues.js";
27
31
  export * as evmChains from "./evm/chains.js";
28
32
  export * as evmMulticall from "./evm/multicall.js";
29
33
  export * as evmFloorAbiGen from "./evm/floor/abi.gen.js";
@@ -66,6 +70,7 @@ export * as mathV2Error from "./math/v2/error.js";
66
70
  export * as mathV2Holders from "./math/v2/holders.js";
67
71
  export * as mathV2Milestones from "./math/v2/milestones.js";
68
72
  export * as mathV2Rows from "./math/v2/rows.js";
73
+ export * as mathV2Escrow from "./math/v2/escrow.js";
69
74
  export * as mathV2Circulating from "./math/v2/circulating.js";
70
75
  export * as mathV2Ask from "./math/v2/ask.js";
71
76
  export * as mathV2Feasibility from "./math/v2/feasibility.js";
@@ -92,3 +97,5 @@ export * as fixtures from "./fixtures.js";
92
97
  export * as client from "./client/index.js";
93
98
  export * as errors from "./errors.js";
94
99
  export * as generated from "./generated/index.js";
100
+ export * as v2OfficeRead from "./v2/office-read.js";
101
+ export * as v2OfficeTrade from "./v2/office-trade.js";