@floorlaunchpad/sdk 0.4.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +93 -0
- package/dist/abi/evm.gen.js +5 -0
- package/dist/abi/functions.gen.js +1 -1
- package/dist/client/solana/index.js +13 -8
- package/dist/config/generated.js +78 -1
- package/dist/config/registry.gen.js +1 -1
- package/dist/evm/chains.js +56 -18
- package/dist/evm/squid.js +10 -10
- package/dist/evm/zap.js +148 -35
- package/dist/index.js +1 -0
- package/dist/indexer/bodies.js +9 -0
- package/dist/indexer/client.js +2 -0
- package/dist/indexer/contract.js +48 -2
- package/dist/indexer/paths.js +26 -0
- package/dist/indexer/read.js +3 -0
- package/dist/math/v2/book.js +40 -7
- package/dist/math/v2/create.js +1 -1
- package/dist/math/v2/relay.js +201 -1
- package/dist/math/v2/split.js +60 -15
- package/dist/math/v2/trade.js +16 -8
- package/dist/ton/addresses.js +36 -0
- package/dist/ton/book-check.js +23 -0
- package/dist/ton/book.js +119 -0
- package/dist/ton/cell.js +542 -0
- package/dist/ton/consts.generated.js +17 -0
- package/dist/ton/content.js +83 -0
- package/dist/ton/gas.js +198 -0
- package/dist/ton/governance.js +401 -0
- package/dist/ton/index.js +18 -0
- package/dist/ton/messages.js +340 -0
- package/dist/ton/ops.js +37 -0
- package/dist/ton/price.js +51 -0
- package/dist/ton/quote-entry.js +116 -0
- package/dist/ton/quote.js +25 -0
- package/dist/ton/reader.js +378 -0
- package/dist/ton/types.js +43 -0
- package/dist/ton/wallet.js +26 -0
- package/dist/v2/devbuy.js +6 -4
- package/dist/v2/evm.js +3 -1
- package/dist/v2/layouts.js +5 -1
- package/dist/v2/presetRowEvm.js +21 -2
- package/dist/v2/router.js +2 -2
- package/dist/v2/solanaSettle.js +2 -0
- package/docs/ton.md +107 -0
- package/examples/floor-line.html +1 -1
- package/package.json +6 -1
- package/src/abi/evm.gen.ts +5 -0
- package/src/abi/functions.gen.ts +1 -1
- package/src/client/solana/index.ts +13 -8
- package/src/config/generated.ts +78 -1
- package/src/config/registry.gen.ts +1 -1
- package/src/evm/chains.ts +63 -17
- package/src/evm/squid.ts +10 -10
- package/src/evm/zap.ts +185 -36
- package/src/index.ts +1 -0
- package/src/indexer/bodies.ts +11 -0
- package/src/indexer/client.ts +5 -1
- package/src/indexer/contract.ts +48 -2
- package/src/indexer/paths.ts +47 -0
- package/src/indexer/read.ts +5 -2
- package/src/math/v2/book.ts +42 -7
- package/src/math/v2/create.ts +1 -1
- package/src/math/v2/relay.ts +208 -1
- package/src/math/v2/split.ts +70 -16
- package/src/math/v2/trade.ts +16 -8
- package/src/ton/addresses.ts +38 -0
- package/src/ton/book-check.ts +24 -0
- package/src/ton/book.ts +136 -0
- package/src/ton/cell.ts +547 -0
- package/src/ton/consts.generated.ts +17 -0
- package/src/ton/content.ts +97 -0
- package/src/ton/gas.ts +209 -0
- package/src/ton/governance.ts +452 -0
- package/src/ton/index.ts +18 -0
- package/src/ton/messages.ts +343 -0
- package/src/ton/ops.ts +37 -0
- package/src/ton/price.ts +54 -0
- package/src/ton/quote-entry.ts +138 -0
- package/src/ton/quote.ts +67 -0
- package/src/ton/reader.ts +420 -0
- package/src/ton/types.ts +201 -0
- package/src/ton/wallet.ts +30 -0
- package/src/v2/devbuy.ts +6 -4
- package/src/v2/evm.ts +5 -1
- package/src/v2/layouts.ts +5 -1
- package/src/v2/presetRowEvm.ts +21 -2
- package/src/v2/router.ts +2 -2
- package/src/v2/solanaSettle.ts +2 -0
- package/src/v2/types.ts +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,99 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to `@floorlaunchpad/sdk`. The version follows semver; while the major number is 0, a minor bump may rename or remove an export and a patch bump never does.
|
|
4
4
|
|
|
5
|
+
## 0.6.0
|
|
6
|
+
|
|
7
|
+
The Cushion's bid is now two pots, C and K, each with its own money and its own tokens. This version quotes a launch on a
|
|
8
|
+
program that runs the two pots. ⚠ Use it only against a chain whose program has been upgraded to the two pots; 0.4.3 and
|
|
9
|
+
older quote the one-pot program (see "Which version to use" below). 0.5.0 was never published: its entries (below) ship
|
|
10
|
+
in this version.
|
|
11
|
+
|
|
12
|
+
What changed in the program, for an integrator:
|
|
13
|
+
|
|
14
|
+
- Two pots under the price. C (the Cushion) is re-laid after every trade from the price down, as the mirror of the ask,
|
|
15
|
+
with C's money only. K is ONE constant-product piece from C's bottom down to the floor price `f`. While K holds no
|
|
16
|
+
tokens it is re-shaped to `[f, C's bottom]` with all its money; once a sell walks into it, it moves only along its own
|
|
17
|
+
curve until a buy takes back all its tokens. While K holds tokens, any C money waits at `f`; C is never laid over K.
|
|
18
|
+
- The sell path is C, then K (sliding down to `f`), then F's flat bid at `f`. `fromC`, `fromK` and `fromF` on a sell keep
|
|
19
|
+
their meaning.
|
|
20
|
+
- New money is split between the pots by the launch row's `c_share_bps` (5,000 on every row today: half each). Each pot
|
|
21
|
+
has its own target (`T_C = ceil(T × c_share_bps ÷ 10,000)`, `T_K = T − T_C`, `T` the one C + K target of before); the
|
|
22
|
+
share for C rounds up; a pot at its target passes the rest of its part to the other pot; the rest goes on as before. The
|
|
23
|
+
money above a piece's Marketcap Milestone cap is split the same way.
|
|
24
|
+
- F's top-up takes half from each pot: first this buy's C and K parts, half each (the half for C rounds up; a part short of
|
|
25
|
+
its half passes the rest to the other), then this buy's Marketcap Milestones, then C's and K's pots, half each.
|
|
26
|
+
- Resale: what a buy pays for tokens a pot holds returns to that pot (`f` to F, the premium to the pot). The money parked
|
|
27
|
+
at `f` is kept per pot.
|
|
28
|
+
- A launch created before the program upgrade moves to the two pots on its first trade after it: C's pot from its C
|
|
29
|
+
segments' money, K's from its K segments', the money parked at `f` half each (the half for C rounds up), F's backing in
|
|
30
|
+
those segments back to F, tokens held before the upgrade resell into C. Then the normal re-lay runs. Nothing else is
|
|
31
|
+
needed; trading never pauses.
|
|
32
|
+
- Reads that keep their meaning: vault and bid money (`vaultV2`, `dexLiquidityV2`, an indexer's `bidMoney`) are F + C + K;
|
|
33
|
+
`ckMoney`, `ckHeld` and a receipt's `cushion` are C + K; `Book.ckAtF` / `ckFloorTokens` are the money and tokens parked
|
|
34
|
+
at `f` for both pots together.
|
|
35
|
+
|
|
36
|
+
Added:
|
|
37
|
+
|
|
38
|
+
- Reads per pot on a `Book`: `cMoney`, `kMoney`, `cHeld`, `kHeld`, `kHolds` (K holds tokens) and `kSeg` (K's segment
|
|
39
|
+
index, or null).
|
|
40
|
+
- `Book.kpot` (true once the book runs two pots), `Book.kAtF` and `Book.kFloorTokens` (K's part of the money and tokens
|
|
41
|
+
parked at `f`; C's part is `ckAtF − kAtF`, `ckFloorTokens − kFloorTokens`).
|
|
42
|
+
- The split's per-pot amounts: `Split.cAdd`, `kAdd`, `cTake`, `kTake` (their sums are `ckAdd`, `ckTake`, as before), and
|
|
43
|
+
`Relay.kAtF`.
|
|
44
|
+
- `Pots`, `relayPots`, `kpotUpgrade` (the first-trade move of a pre-upgrade book; `buy` / `sell` run it themselves on a
|
|
45
|
+
book whose `kpot` is false), `shareSplit` and `potsSplit`.
|
|
46
|
+
|
|
47
|
+
Changed (breaking for code that builds these types itself):
|
|
48
|
+
|
|
49
|
+
- `Book` has the three new required fields above. A `Book` built by hand needs them (`kpot: true`, `kAtF: 0n`,
|
|
50
|
+
`kFloorTokens: 0n` for a new launch); the SDK's decoders fill them.
|
|
51
|
+
- `SplitIn.ck0` is replaced by `c0` and `k0` (C's and K's money before the buy).
|
|
52
|
+
- Solana `LaunchV2` (`v2Layouts`, `LaunchV2` type): the last 32 bytes, `book_hash` (never written; zero on every launch),
|
|
53
|
+
are now `k_at_f` (u64, offset 5984), `k_floor_tokens` (u64, 5992), `kpot` (u8, 6000) and `pad_end` (15 bytes). The
|
|
54
|
+
account's size (6,016 bytes) and every other offset are unchanged; no instruction's account list changes. The type
|
|
55
|
+
loses `bookHash` and gains `kAtF`, `kFloorTokens`, `kpot`, `padEnd`. `kpot` 0 is a launch not yet moved to two pots.
|
|
56
|
+
- EVM `launchBook` (`v2Evm`): the returned struct gains `uint128 kAtF`, `uint64 kFloorTokens` and `bool kpot`, appended
|
|
57
|
+
after its last field (the selector is unchanged). Storage only appends.
|
|
58
|
+
|
|
59
|
+
TON: the `@floorlaunchpad/sdk/ton` module (from the 0.5.0 entries) is in this package and its math runs the two pots, but
|
|
60
|
+
no TON program is deployed: the TON chain row has `v2DayOne` false and `tonFactoryAddress` null, `dayOneChains()` leaves
|
|
61
|
+
it out, `TON_MAINNET.placeholder` is true and `ton.tonChainOf()` with no book throws `TonBookError` ("placeholder (no
|
|
62
|
+
deploy yet)"), so no TON address or quote can be built from the built-in constants. `CHAINS` and `CHAIN_SLUGS` still
|
|
63
|
+
list the TON row as data: a caller that shows chains filters on `v2DayOne` (or uses `dayOneChains()`). TON is wired and
|
|
64
|
+
switched off until its factory is deployed and the constants are regenerated.
|
|
65
|
+
|
|
66
|
+
Which version to use:
|
|
67
|
+
|
|
68
|
+
- Against an upgraded program use 0.6.0. A book read before its first trade after the upgrade (`kpot` false) is quoted as
|
|
69
|
+
that trade will run it: the SDK moves it to two pots first, as the program does.
|
|
70
|
+
- 0.6.0 against a program NOT yet upgraded: on Solana the bytes it reads as `kpot` are zero, so it quotes the two-pot move
|
|
71
|
+
the old program never makes, and its quotes do not match the trade; on EVM the `launchBook` view returns the shorter
|
|
72
|
+
struct and the decode fails. Do not use it there.
|
|
73
|
+
- 0.4.3 or older against an upgraded program reads `book_hash` / the shorter struct and quotes the one-pot bid: buys
|
|
74
|
+
that reach the split and sells below the price are mis-quoted. Move to 0.6.0 when the program on your chain is upgraded.
|
|
75
|
+
|
|
76
|
+
## 0.5.0
|
|
77
|
+
|
|
78
|
+
Fixed:
|
|
79
|
+
|
|
80
|
+
- `zapSwapData` appends `SWEEP(address(0), MSG_SENDER, 0)` to a native-input Universal Router swap (Uniswap, Aerodrome, Pancake and Ramses forks, V2 / V3 and v4). A Squid hook forwards the whole bridged amount as the zap's value, the plan spent only `amountIn`, and the surplus stayed on the router for anyone to sweep (ZR-2); it now returns to the zap, which refunds it. Token-in and native-out routes, and every non-Universal-Router family, encode the same bytes as before.
|
|
81
|
+
- `buyHookNative` (the Squid hook) passes the zap's quote refund on to the user. The zap refunds what the buy did not spend in the native coin and, for a launch quoted in an ERC-20, in that quote; the hook passed on only the native refund, so the quote refund stayed on the multicall. It now takes `quote` (the launch's quote coin, required; address(0) for a native quote) and, for an ERC-20 quote, adds a `transfer` of the multicall's whole quote balance to the user.
|
|
82
|
+
- `devBuyFromTrade` credits a buy through FloorZap or FloorRouter to the person that contract's own event names. Such a trade's `trader` is the contract; the new optional `ctx.buyer` (the sender a known zap's `Zapped` or router's `Bought` event proves in the same transaction, with sender = recipient) is the person matched against the creator and the Team Slot. The trade's recipient alone never counts.
|
|
83
|
+
- The EVM error table (`EVM_ERRORS`, and so `decodeEvmProgramError`) names the errors a v2 contract reverts with from its math libraries: `PriceOrder()`, `ZeroLiquidity()`, `SqrtRange()`, `Zero()` and `VaultShareOutOfRange()`. The contracts' ABI omits them, so such a revert decoded to no name.
|
|
84
|
+
- `zapSwapData` encodes a zap whose input is an ERC-20 (`buyWithToken`) and whose output is the native coin (a launch quoted in the native coin). Before, every route began with `WRAP_ETH` (or a native-only call) and paid the router's output in its wrapped form, so an ERC-20 → native-coin zap through a Universal Router, a V3 SwapRouter, SwapRouter02 or Algebra router reverted (`QuoteShort`; measured on forks of every zap row). New optional params: `input` ("native", the default, or "token"), `output` ("token", the default, or "native": the router unwraps and pays the zap, which accepts the native coin only from its router), and `router` (a SwapRouter v1 native output is paid to the router, then unwrapped). The defaults encode the same bytes as before.
|
|
85
|
+
- The Universal Router forks' swap input: `urFork` ("uniswap", the default, "aerodrome", "pancake" or "ramses"; each fork row in `EVM_CHAINS` names its own as `urFork`). Aerodrome's router reads a sixth `bool isUni` (sent false: its Slipstream pools, each key `0x100000 | tickSpacing`, `AERODROME_SLIPSTREAM_KEY`); PancakeSwap's and Ramses' read five fields. Before, every fork got Uniswap's sixth `uint256[]`, which Aerodrome's router reads as `isUni = true` and routes through Uniswap's pools instead of its own. A V2 leg through a fork's router is refused (its input is its own).
|
|
86
|
+
|
|
87
|
+
Added:
|
|
88
|
+
|
|
89
|
+
- TON: the `@floorlaunchpad/sdk/ton` module is in the published package (the `./ton` export): message builders for a wallet, the program's `get` methods as quotes (`simBuy`, `simSell`), the launch's jetton content (`src/ton/content.ts`: what `get_jetton_data` publishes, the uri / image derived from the factory's `metadata_base`, and the token data JSON body), the generated TON constants (`src/ton/consts.generated.ts`) and `docs/ton.md`. TON is not deployed yet, so its chain row stays off until the factory is live.
|
|
90
|
+
- Indexer (TON): a launch's developer buys are walked by the TON follower and served through the v2 routes and views (the TON fix of the unbounded-routes batch).
|
|
91
|
+
- Indexer: the launch rows gain `newHolders1h` and `newHolders24h` (`LISTED_FIELDS`: the `launches`, `launches/<id>` and `search` rows; not `launches/<id>/state` or the stream's frames): the current holders that first held within the hour / the 24 h to the indexed head, null with no head. `newHolders24h` is the number `sort=newHolders24h` ranks by. Both are optional in the decoder, so an indexer without them still decodes.
|
|
92
|
+
- HyperEVM stock quotes (EQX): the config now lists the stock quotes of HyperEVM, in `deploy/config/quotes/hyperevm.json` and the generated config, as it lists Elysium's.
|
|
93
|
+
- Elysium's zap row: `EVM_CHAINS.elysium.zapRouters` holds Uniswap's Universal Router 2.1.2 (`0xA13f7611115752DEB2B13813BDDE16A5073e4b45`, slot `uniswap-ur`, as the contracts' zap config lists it), and `wrappedNative` is WHYPE (`0xbA876237B0F021A6c6D852d6c26E107997cC5E81`, 18 decimals). Elysium's depth is in Uniswap v4 only (native HYPE / USDC pools), so its zap routes through the v4 route below, never through WRAP_ETH.
|
|
94
|
+
- `zapSwapData` encodes Uniswap v4 through the Universal Router: one pool, exact in, given as `route.v4` (`ZapV4Pool`: fee, tick spacing, hooks, hook data) with `route.tokens` = [currency in, currency out] and `V4_NATIVE` (address(0)) for the native coin. The calldata is `V4_SWAP` with `SWAP_EXACT_IN_SINGLE`, `SETTLE` (paid by the router: the zap pays an ERC-20 input to it first; a native input rides as the call's value) and `TAKE`; a native output is taken to the router and then swept to the zap (`SWEEP`, at the same minimum), since the zap accepts the native coin only from its router. New beside it: `v4PoolKey` (the sorted pool key and the swap's direction), the type `V4PoolKey`, and the constants `UR_V4_SWAP`, `V4_SWAP_EXACT_IN_SINGLE`, `V4_SETTLE`, `V4_TAKE`, `V4_OPEN_DELTA` and `V4_NATIVE`. A route without `v4` encodes as before.
|
|
95
|
+
- The deployed FloorZap instances: `FLOOR_ZAP_ADDRESSES` (per chain, per zap slot) and a `zap` field on each `EVM_CHAINS` zap row (the instance, or null where that slot is not deployed). 14 instances on Ethereum, Base, BNB Chain, Arbitrum, HyperEVM, Robinhood Chain and Arc, each read back on chain, and Elysium's `uniswap-ur` instance (`0x56F22be922Ffc9e955169E0673D3Ae42B1151995`).
|
|
96
|
+
- Batched reads. The indexer client gains `launchLists` (`/floor-amm/launch-lists`: one list per quote coin, each with its own cursor, in one request) and `candlesMany` (`/floor-amm/candles/many`: many launches' newest candles at one interval in one request). `readPresetMenuEvmV2` reads the preset rows through one Multicall3 `aggregate3` call per 100 ids (`PRESET_MENU_BATCH`), was one call per id; `opts.multicall: null` keeps one call per id for a chain without Multicall3, and a failed row throws.
|
|
97
|
+
|
|
5
98
|
## 0.4.0
|
|
6
99
|
|
|
7
100
|
Removed:
|
package/dist/abi/evm.gen.js
CHANGED
|
@@ -97,6 +97,7 @@ export const EVM_ERRORS = [
|
|
|
97
97
|
{ chain: "evm", name: "PresetDisabled", message: "PresetDisabled", code: null, selector: "0x5518d9cd", signature: "PresetDisabled()" },
|
|
98
98
|
{ chain: "evm", name: "PresetIdNotNext", message: "PresetIdNotNext", code: null, selector: "0x9b5a5243", signature: "PresetIdNotNext()" },
|
|
99
99
|
{ chain: "evm", name: "PresetInvalid", message: "PresetInvalid", code: null, selector: "0x46f63096", signature: "PresetInvalid()" },
|
|
100
|
+
{ chain: "evm", name: "PriceOrder", message: "PriceOrder", code: null, selector: "0x6b2c148b", signature: "PriceOrder()" },
|
|
100
101
|
{ chain: "evm", name: "QuoteDisabled", message: "QuoteDisabled", code: null, selector: "0x31ccdc5d", signature: "QuoteDisabled()" },
|
|
101
102
|
{ chain: "evm", name: "QuoteListed", message: "QuoteListed", code: null, selector: "0xe6faf0c2", signature: "QuoteListed()" },
|
|
102
103
|
{ chain: "evm", name: "QuoteNotListed", message: "QuoteNotListed", code: null, selector: "0x06ff137a", signature: "QuoteNotListed()" },
|
|
@@ -111,6 +112,7 @@ export const EVM_ERRORS = [
|
|
|
111
112
|
{ chain: "evm", name: "SafeERC20FailedOperation", message: "SafeERC20FailedOperation", code: null, selector: "0x5274afe7", signature: "SafeERC20FailedOperation(address)" },
|
|
112
113
|
{ chain: "evm", name: "SellTooLarge", message: "SellTooLarge", code: null, selector: "0x8e4d208f", signature: "SellTooLarge()" },
|
|
113
114
|
{ chain: "evm", name: "SlippageExceeded", message: "SlippageExceeded", code: null, selector: "0x8199f5f3", signature: "SlippageExceeded()" },
|
|
115
|
+
{ chain: "evm", name: "SqrtRange", message: "SqrtRange", code: null, selector: "0x1e523888", signature: "SqrtRange()" },
|
|
114
116
|
{ chain: "evm", name: "StringsInsufficientHexLength", message: "StringsInsufficientHexLength", code: null, selector: "0xe22e27eb", signature: "StringsInsufficientHexLength(uint256,uint256)" },
|
|
115
117
|
{ chain: "evm", name: "SwapDataNotEmpty", message: "SwapDataNotEmpty", code: null, selector: "0x8821f518", signature: "SwapDataNotEmpty()" },
|
|
116
118
|
{ chain: "evm", name: "SwapFailed", message: "SwapFailed", code: null, selector: "0xff9fa595", signature: "SwapFailed(bytes)" },
|
|
@@ -126,5 +128,8 @@ export const EVM_ERRORS = [
|
|
|
126
128
|
{ chain: "evm", name: "UnknownLaunch", message: "UnknownLaunch", code: null, selector: "0xf6806bf8", signature: "UnknownLaunch()" },
|
|
127
129
|
{ chain: "evm", name: "UUPSUnauthorizedCallContext", message: "UUPSUnauthorizedCallContext", code: null, selector: "0xe07c8dba", signature: "UUPSUnauthorizedCallContext()" },
|
|
128
130
|
{ chain: "evm", name: "UUPSUnsupportedProxiableUUID", message: "UUPSUnsupportedProxiableUUID", code: null, selector: "0xaa1d49a4", signature: "UUPSUnsupportedProxiableUUID(bytes32)" },
|
|
131
|
+
{ chain: "evm", name: "VaultShareOutOfRange", message: "VaultShareOutOfRange", code: null, selector: "0xdb8df2d8", signature: "VaultShareOutOfRange()" },
|
|
132
|
+
{ chain: "evm", name: "Zero", message: "Zero", code: null, selector: "0xf4560403", signature: "Zero()" },
|
|
129
133
|
{ chain: "evm", name: "ZeroAddress", message: "ZeroAddress", code: null, selector: "0xd92e233d", signature: "ZeroAddress()" },
|
|
134
|
+
{ chain: "evm", name: "ZeroLiquidity", message: "ZeroLiquidity", code: null, selector: "0x10074548", signature: "ZeroLiquidity()" },
|
|
130
135
|
];
|
|
@@ -109,7 +109,7 @@ export const FLOOR_AMM_V2_FUNCTIONS = [
|
|
|
109
109
|
{ module: "floorAmmViewsV2", name: "bidMoney", signature: "bidMoney(uint256)", selector: "0x8e403c51", outputs: "(uint256)" },
|
|
110
110
|
{ module: "floorAmmViewsV2", name: "circulatingOf", signature: "circulatingOf(uint256)", selector: "0x72812fcf", outputs: "(uint256,uint256,uint256)" },
|
|
111
111
|
{ module: "floorAmmViewsV2", name: "holderBook", signature: "holderBook(uint256)", selector: "0xf5d23b14", outputs: "((uint128,uint64,uint64,uint128,uint128))" },
|
|
112
|
-
{ module: "floorAmmViewsV2", name: "launchBook", signature: "launchBook(uint256)", selector: "0x926310f1", outputs: "((uint128,uint128,uint128,uint128[],uint8,(uint128,uint128,uint64,uint64,uint64,uint128,uint16,uint16,uint8,uint8)[48],uint128,uint64,uint64[],uint128[],uint8,uint8,uint128[],uint128[],uint128,uint64,bool,uint32[5]))" },
|
|
112
|
+
{ module: "floorAmmViewsV2", name: "launchBook", signature: "launchBook(uint256)", selector: "0x926310f1", outputs: "((uint128,uint128,uint128,uint128[],uint8,(uint128,uint128,uint64,uint64,uint64,uint128,uint16,uint16,uint8,uint8)[48],uint128,uint64,uint64[],uint128[],uint8,uint8,uint128[],uint128[],uint128,uint64,bool,uint32[5],uint128,uint64,bool))" },
|
|
113
113
|
{ module: "floorAmmViewsV2", name: "launchCount", signature: "launchCount()", selector: "0x27cca59f", outputs: "(uint256)" },
|
|
114
114
|
{ module: "floorAmmViewsV2", name: "launchFeeCurve", signature: "launchFeeCurve(uint256)", selector: "0xc598083f", outputs: "((uint32[5],uint128,uint128))" },
|
|
115
115
|
{ module: "floorAmmViewsV2", name: "launchMilestones", signature: "launchMilestones(uint256)", selector: "0x2414ccf1", outputs: "((uint128[4],uint128[4]))" },
|
|
@@ -227,19 +227,24 @@ export function createSolanaClient(opts )
|
|
|
227
227
|
|
|
228
228
|
claim: (p ) => guard(async () => {
|
|
229
229
|
const tok = (p.types & (CLAIM_TEAM_BUY | CLAIM_SHARE_BOUGHT)) !== 0;
|
|
230
|
-
const launches = [];
|
|
231
230
|
let qtp = null;
|
|
232
231
|
let qIsLaunch = false;
|
|
233
|
-
|
|
232
|
+
|
|
233
|
+
const read = await Promise.all(p.launches.map(async (mint) => {
|
|
234
234
|
const { address, l } = await launchOf(mint);
|
|
235
235
|
if (l.quoteMint !== p.quote) throw bad(`launch ${mint} trades in ${l.quoteMint}, not ${p.quote}`);
|
|
236
|
-
qtp = l.quoteTokenProgram;
|
|
237
|
-
qIsLaunch = await quoteIsLaunchOf(l);
|
|
238
236
|
const slot = teamSlotPda(address, pid)[0];
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
237
|
+
const [isLaunch, slotAcc] = await Promise.all([quoteIsLaunchOf(l), get(slot)]);
|
|
238
|
+
return { mint, address, l, slot, isLaunch, slotAcc };
|
|
239
|
+
}));
|
|
240
|
+
const launches = read.map(({ address, l, slot, slotAcc }) => ({
|
|
241
|
+
launch: address, quoteVault: l.quoteVault, teamSlot: slotAcc !== null ? slot : null, baseMint: l.baseMint,
|
|
242
|
+
...(tok ? { teamBuy: { baseMint: l.baseMint, tokenVault: l.tokenVault, walletBase: associatedTokenAddress(p.wallet, l.baseMint, TOKEN_2022_PROGRAM_ID) } } : {}),
|
|
243
|
+
}));
|
|
244
|
+
const last = read.at(-1);
|
|
245
|
+
if (last !== undefined) {
|
|
246
|
+
qtp = last.l.quoteTokenProgram;
|
|
247
|
+
qIsLaunch = last.isLaunch;
|
|
243
248
|
}
|
|
244
249
|
if (qtp === null) {
|
|
245
250
|
const m = await get(p.quote);
|
package/dist/config/generated.js
CHANGED
|
@@ -27113,6 +27113,83 @@ export const CHAIN_ROWS = [
|
|
|
27113
27113
|
"address": "0xfd6f06d323f6cb08ee9eeb2d201e9ec0e9112c88",
|
|
27114
27114
|
"decimals": 18,
|
|
27115
27115
|
"kind": "stock"
|
|
27116
|
+
},
|
|
27117
|
+
{
|
|
27118
|
+
"symbol": "EQQQQ",
|
|
27119
|
+
"name": "EQX Tokenized QQQ",
|
|
27120
|
+
"address": "0x095cca17f0619596115eA09bbE1D80431685Ba1A",
|
|
27121
|
+
"decimals": 8,
|
|
27122
|
+
"kind": "stock"
|
|
27123
|
+
},
|
|
27124
|
+
{
|
|
27125
|
+
"symbol": "EQSPY",
|
|
27126
|
+
"name": "EQX Tokenized SPY",
|
|
27127
|
+
"address": "0x07A76acCed707De999A54D39aFF62A2d7ac4CC81",
|
|
27128
|
+
"decimals": 8,
|
|
27129
|
+
"kind": "stock"
|
|
27130
|
+
},
|
|
27131
|
+
{
|
|
27132
|
+
"symbol": "EQNVDA",
|
|
27133
|
+
"name": "EQX Tokenized NVDA",
|
|
27134
|
+
"address": "0xA23aFe6Bd466BdB806a83AfDDA76F644FC4347CF",
|
|
27135
|
+
"decimals": 8,
|
|
27136
|
+
"kind": "stock"
|
|
27137
|
+
},
|
|
27138
|
+
{
|
|
27139
|
+
"symbol": "EQTSLA",
|
|
27140
|
+
"name": "EQX Tokenized TSLA",
|
|
27141
|
+
"address": "0x883DAd2Aa97175c0D1569E1de61204ac47b2b8fb",
|
|
27142
|
+
"decimals": 8,
|
|
27143
|
+
"kind": "stock"
|
|
27144
|
+
},
|
|
27145
|
+
{
|
|
27146
|
+
"symbol": "EQAAPL",
|
|
27147
|
+
"name": "EQX Tokenized AAPL",
|
|
27148
|
+
"address": "0x15d82780780Ca72570818f91587B752562D655bc",
|
|
27149
|
+
"decimals": 8,
|
|
27150
|
+
"kind": "stock"
|
|
27151
|
+
},
|
|
27152
|
+
{
|
|
27153
|
+
"symbol": "EQGOOG",
|
|
27154
|
+
"name": "EQX Tokenized GOOGL",
|
|
27155
|
+
"address": "0x4720b40C89Ff3A74C6bE8eA34Cf40FaE5eacEd79",
|
|
27156
|
+
"decimals": 8,
|
|
27157
|
+
"kind": "stock"
|
|
27158
|
+
},
|
|
27159
|
+
{
|
|
27160
|
+
"symbol": "EQMETA",
|
|
27161
|
+
"name": "EQX Tokenized META",
|
|
27162
|
+
"address": "0xF5c6190d9178097563372a4acA15D52Ec24F129A",
|
|
27163
|
+
"decimals": 8,
|
|
27164
|
+
"kind": "stock"
|
|
27165
|
+
},
|
|
27166
|
+
{
|
|
27167
|
+
"symbol": "EQMSFT",
|
|
27168
|
+
"name": "EQX Tokenized MSFT",
|
|
27169
|
+
"address": "0xca911A8ae21baAf9CDec0baa45259c64Ec8AE59E",
|
|
27170
|
+
"decimals": 8,
|
|
27171
|
+
"kind": "stock"
|
|
27172
|
+
},
|
|
27173
|
+
{
|
|
27174
|
+
"symbol": "EQAMZN",
|
|
27175
|
+
"name": "EQX Tokenized AMZN",
|
|
27176
|
+
"address": "0x582C6ADd0eb720EA1c2e2019fF9b7c21Fe99288F",
|
|
27177
|
+
"decimals": 8,
|
|
27178
|
+
"kind": "stock"
|
|
27179
|
+
},
|
|
27180
|
+
{
|
|
27181
|
+
"symbol": "EQMU",
|
|
27182
|
+
"name": "EQX Tokenized MU",
|
|
27183
|
+
"address": "0x9164Fd5f67FE4188Ff79675182183512bC37d66D",
|
|
27184
|
+
"decimals": 8,
|
|
27185
|
+
"kind": "stock"
|
|
27186
|
+
},
|
|
27187
|
+
{
|
|
27188
|
+
"symbol": "EQSPCX",
|
|
27189
|
+
"name": "EQX Tokenized SPCX",
|
|
27190
|
+
"address": "0xF115FF708A795cD0E06531Dec57ed716138bE8BD",
|
|
27191
|
+
"decimals": 8,
|
|
27192
|
+
"kind": "stock"
|
|
27116
27193
|
}
|
|
27117
27194
|
]
|
|
27118
27195
|
},
|
|
@@ -27120,7 +27197,7 @@ export const CHAIN_ROWS = [
|
|
|
27120
27197
|
"name": "elysium",
|
|
27121
27198
|
"label": "Elysium",
|
|
27122
27199
|
"family": "evm",
|
|
27123
|
-
"v2DayOne":
|
|
27200
|
+
"v2DayOne": true,
|
|
27124
27201
|
"chainId": 99901,
|
|
27125
27202
|
"native": "HYPE",
|
|
27126
27203
|
"nativeName": "Hype",
|
package/dist/evm/chains.js
CHANGED
|
@@ -10,8 +10,6 @@ import { CHAIN_REGISTRY, EVM_CHAIN_SLUGS } from "../config/registry.gen.js";
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
13
|
function strict(a ) {
|
|
16
14
|
const c = checksumAddress(a);
|
|
17
15
|
const body = a.slice(2);
|
|
@@ -19,79 +17,119 @@ function strict(a ) {
|
|
|
19
17
|
return c;
|
|
20
18
|
}
|
|
21
19
|
|
|
22
|
-
const
|
|
20
|
+
const UR_FORK_OF_SLOT = { "aerodrome-ur": "aerodrome", "pancake-ur": "pancake", "ramses-ur": "ramses" };
|
|
21
|
+
function urForkOf(slot ) {
|
|
22
|
+
const f = UR_FORK_OF_SLOT[slot];
|
|
23
|
+
if (!f) throw new RangeError(`the UR fork row ${slot} names no fork`);
|
|
24
|
+
return f;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const r = (slot , amm , router , family , confidence , optional = false, forkEncoding = false) => ({
|
|
23
28
|
slot,
|
|
24
29
|
amm,
|
|
25
30
|
router: strict(router),
|
|
26
31
|
family,
|
|
27
32
|
confidence,
|
|
28
33
|
optional,
|
|
29
|
-
...(forkEncoding ? { forkEncoding } : {}),
|
|
34
|
+
...(forkEncoding ? { forkEncoding, urFork: urForkOf(slot) } : {}),
|
|
30
35
|
});
|
|
31
36
|
|
|
37
|
+
export const FLOOR_ZAP_ADDRESSES = {
|
|
38
|
+
ethereum: { "uniswap-ur": strict("0x56F22be922Ffc9e955169E0673D3Ae42B1151995") },
|
|
39
|
+
base: {
|
|
40
|
+
"aerodrome-ur": strict("0xD8329A195F26c27A911B5CE697B11947984dc0d1"),
|
|
41
|
+
"uniswap-ur": strict("0x56F22be922Ffc9e955169E0673D3Ae42B1151995"),
|
|
42
|
+
"pancake-ur": strict("0xE4335AaC829a788bb6988A372edfe3Cda41B0931"),
|
|
43
|
+
},
|
|
44
|
+
bsc: {
|
|
45
|
+
"pancake-ur": strict("0xE4335AaC829a788bb6988A372edfe3Cda41B0931"),
|
|
46
|
+
"uniswap-ur": strict("0x56F22be922Ffc9e955169E0673D3Ae42B1151995"),
|
|
47
|
+
},
|
|
48
|
+
arbitrum: { "uniswap-ur": strict("0x56F22be922Ffc9e955169E0673D3Ae42B1151995") },
|
|
49
|
+
hyperevm: {
|
|
50
|
+
prjx: strict("0x02E658B2B205F76850Cf6d584477A58cD797e46a"),
|
|
51
|
+
nest: strict("0x93aC608AA016271BBB92924C3838a0b550c34ce1"),
|
|
52
|
+
"ramses-ur": strict("0x4b22d4b3F104D76aB92A2CA4E5E4A08A27F18f52"),
|
|
53
|
+
hyperswap: strict("0x782DB7e687E16Bfe00C9a0CE41A76A7cC507566F"),
|
|
54
|
+
},
|
|
55
|
+
robinhood: {
|
|
56
|
+
"uniswap-ur": strict("0x56F22be922Ffc9e955169E0673D3Ae42B1151995"),
|
|
57
|
+
"ramses-ur": strict("0x4b22d4b3F104D76aB92A2CA4E5E4A08A27F18f52"),
|
|
58
|
+
},
|
|
59
|
+
arc: { "uniswap-ur": strict("0x56F22be922Ffc9e955169E0673D3Ae42B1151995") },
|
|
60
|
+
elysium: { "uniswap-ur": strict("0x56F22be922Ffc9e955169E0673D3Ae42B1151995") },
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
function withBookedZaps(key , rows ) {
|
|
64
|
+
const book = FLOOR_ZAP_ADDRESSES[key];
|
|
65
|
+
return rows.map((row) => ({ ...row, zap: book[row.slot] ?? null }));
|
|
66
|
+
}
|
|
67
|
+
|
|
32
68
|
const UNISWAP_UR = "uniswap-ur";
|
|
33
69
|
|
|
34
70
|
const ROUTES = {
|
|
35
71
|
ethereum: {
|
|
36
72
|
wrappedNative: strict("0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"),
|
|
37
|
-
zapRouters: [r(UNISWAP_UR, "Uniswap v2/v3/v4", "0x4C82D1fBFe28C977cBB58D8C7FF8FCF9F70a2cCA", "uniswap-ur", "HIGH")],
|
|
73
|
+
zapRouters: withBookedZaps("ethereum", [r(UNISWAP_UR, "Uniswap v2/v3/v4", "0x4C82D1fBFe28C977cBB58D8C7FF8FCF9F70a2cCA", "uniswap-ur", "HIGH")]),
|
|
38
74
|
notes: [],
|
|
39
75
|
},
|
|
40
76
|
base: {
|
|
41
77
|
wrappedNative: strict("0x4200000000000000000000000000000000000006"),
|
|
42
|
-
zapRouters: [
|
|
78
|
+
zapRouters: withBookedZaps("base", [
|
|
43
79
|
r("aerodrome-ur", "Aerodrome V1 + Slipstream", "0xC5b6786D7B64767D775877b0B6A319AD946B11B5", "uniswap-ur", "HIGH", false, true),
|
|
44
80
|
r(UNISWAP_UR, "Uniswap v2/v3/v4", "0xFdf682F51FE81Aa4898F0AE2163d8A55c127fbC7", "uniswap-ur", "HIGH"),
|
|
45
81
|
r("pancake-ur", "PancakeSwap V3 / Infinity", "0xd9C500DfF816a1Da21A48A732d3498Bf09dc9AEB", "uniswap-ur", "HIGH", true, true),
|
|
46
|
-
],
|
|
82
|
+
]),
|
|
47
83
|
notes: [],
|
|
48
84
|
},
|
|
49
85
|
bsc: {
|
|
50
86
|
wrappedNative: strict("0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"),
|
|
51
|
-
zapRouters: [
|
|
87
|
+
zapRouters: withBookedZaps("bsc", [
|
|
52
88
|
r("pancake-ur", "PancakeSwap V2 / V3 / Infinity", "0xd9C500DfF816a1Da21A48A732d3498Bf09dc9AEB", "uniswap-ur", "HIGH", false, true),
|
|
53
89
|
r(UNISWAP_UR, "Uniswap v2/v3/v4", "0x8B844f885672f333Bc0042cB669255f93a4C1E6b", "uniswap-ur", "HIGH"),
|
|
54
|
-
],
|
|
90
|
+
]),
|
|
55
91
|
notes: ["⚠ 0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD is Uniswap's UR v1.2, NOT PancakeSwap's: never use it as Pancake's."],
|
|
56
92
|
},
|
|
57
93
|
arbitrum: {
|
|
58
94
|
wrappedNative: strict("0x82aF49447D8a07e3bd95BD0d56f35241523fBab1"),
|
|
59
|
-
zapRouters: [r(UNISWAP_UR, "Uniswap v2/v3/v4", "0x8B844f885672f333Bc0042cB669255f93a4C1E6b", "uniswap-ur", "HIGH")],
|
|
95
|
+
zapRouters: withBookedZaps("arbitrum", [r(UNISWAP_UR, "Uniswap v2/v3/v4", "0x8B844f885672f333Bc0042cB669255f93a4C1E6b", "uniswap-ur", "HIGH")]),
|
|
60
96
|
notes: [],
|
|
61
97
|
},
|
|
62
98
|
hyperevm: {
|
|
63
99
|
maxFloorHops: 2,
|
|
64
100
|
wrappedNative: strict("0x5555555555555555555555555555555555555555"),
|
|
65
|
-
zapRouters: [
|
|
101
|
+
zapRouters: withBookedZaps("hyperevm", [
|
|
66
102
|
r("prjx", "Project X", "0x1EbDFC75FfE3ba3de61E7138a3E8706aC841Af9B", "v3-router", "MEDIUM–HIGH"),
|
|
67
103
|
r("nest", "nest (CL)", "0xaA26B8e5Cadd04430c32787eCC3AA325e99681e9", "algebra", "HIGH"),
|
|
68
104
|
r("ramses-ur", "Ramses CL V2", "0xc43b33b5DF826A48DAE764817647824ED4f476a7", "uniswap-ur", "MEDIUM", false, true),
|
|
69
105
|
r("hyperswap", "HyperSwap V3", "0x6D99e7f6747AF2cDbB5164b6DD50e40D4fDe1e77", "v3-router02", "HIGH", true),
|
|
70
|
-
],
|
|
106
|
+
]),
|
|
71
107
|
notes: ["⚠ Small blocks cap a transaction at 3M gas: a buy that graduates a launch may need a big block."],
|
|
72
108
|
},
|
|
73
109
|
robinhood: {
|
|
74
110
|
wrappedNative: strict("0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73"),
|
|
75
|
-
zapRouters: [
|
|
111
|
+
zapRouters: withBookedZaps("robinhood", [
|
|
76
112
|
r(UNISWAP_UR, "Uniswap v2/v3/v4 (+ Fables v4 pools)", "0x8876789976dEcBfCbBbe364623C63652db8C0904", "uniswap-ur", "HIGH"),
|
|
77
113
|
r("ramses-ur", "Ramses", "0xbFbb2BCBc9dfFA029C27A249ae9BE031E1d83b1C", "uniswap-ur", "HIGH", true, true),
|
|
78
|
-
],
|
|
114
|
+
]),
|
|
79
115
|
notes: [],
|
|
80
116
|
},
|
|
81
117
|
arc: {
|
|
82
118
|
wrappedNative: null,
|
|
83
|
-
zapRouters: [r(UNISWAP_UR, "Uniswap v4 (native-USDC pools)", "0x4fcA4a51Ab4F23A7447b3284fBd7D73289A89Fb1", "uniswap-ur", "HIGH")],
|
|
119
|
+
zapRouters: withBookedZaps("arc", [r(UNISWAP_UR, "Uniswap v4 (native-USDC pools)", "0x4fcA4a51Ab4F23A7447b3284fBd7D73289A89Fb1", "uniswap-ur", "HIGH")]),
|
|
84
120
|
notes: [
|
|
85
121
|
"⚠ The native coin is USDC (18 dp at the EVM level; its ERC-20 view 0x3600000000000000000000000000000000000000 has 6 dp and no deposit()).",
|
|
86
122
|
"⚠ No WETH9: WRAP_ETH does not apply; only v4 pools in address(0) take the native coin. The zap is for third-token quotes only.",
|
|
87
123
|
],
|
|
88
124
|
},
|
|
89
125
|
elysium: {
|
|
90
|
-
|
|
91
|
-
|
|
126
|
+
|
|
127
|
+
wrappedNative: strict("0xbA876237B0F021A6c6D852d6c26E107997cC5E81"),
|
|
128
|
+
|
|
129
|
+
zapRouters: withBookedZaps("elysium", [r(UNISWAP_UR, "Uniswap v4 (native HYPE / USDC pools)", "0xA13f7611115752DEB2B13813BDDE16A5073e4b45", "uniswap-ur", "HIGH")]),
|
|
92
130
|
notes: [
|
|
93
131
|
"⚠ Arbitrum Orbit on HyperEVM: in a contract block.number is HyperEVM's block; the receipt's block is Elysium's.",
|
|
94
|
-
"⚠
|
|
132
|
+
"⚠ Depth is Uniswap v4 only (native HYPE / USDC pools, no hooks): route the zap through V4_SWAP (route.v4), never WRAP_ETH; the v3 and V2 pools hold no depth.",
|
|
95
133
|
],
|
|
96
134
|
},
|
|
97
135
|
};
|
package/dist/evm/squid.js
CHANGED
|
@@ -19,7 +19,7 @@ export class SquidHookError extends Error {
|
|
|
19
19
|
|
|
20
20
|
export const SQUID_TOKEN_SCALE = 10n ** 12n;
|
|
21
21
|
|
|
22
|
-
export const SQUID_GAS = { transfer: 65_000, buy:
|
|
22
|
+
export const SQUID_GAS = { transfer: 65_000, buy: 1_100_000, sell: 850_000, zapBuy: 1_300_000, passOn: 30_000 } ;
|
|
23
23
|
|
|
24
24
|
const ZERO = "0x" + "0".repeat(40);
|
|
25
25
|
const lc = (a , what ) => {
|
|
@@ -65,19 +65,19 @@ export function buyHookErc20(p
|
|
|
65
65
|
};
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
export function buyHookNative(p
|
|
68
|
+
export function buyHookNative(p ) {
|
|
69
69
|
checkCommon(p);
|
|
70
70
|
const user = checkUser(p);
|
|
71
71
|
if (p.minQuoteIn <= 0n || p.minTokensOut <= 0n) throw new SquidHookError("NO_MINIMUM", "minQuoteIn and minTokensOut must be > 0");
|
|
72
72
|
const zap = lc(p.zap, "zap");
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
};
|
|
73
|
+
const quote = lc(p.quote, "quote");
|
|
74
|
+
const calls = [
|
|
75
|
+
call(SQUID_CALL.FullNativeBalance, zap, 0n, bytesToHex(encodeCall("buyWithEth(uint256,bytes,uint256,uint256,address,uint256)", [p.launchId, p.swapData, p.minQuoteIn, p.minTokensOut, user, p.deadline])), "0x", SQUID_GAS.zapBuy),
|
|
76
|
+
call(SQUID_CALL.FullNativeBalance, user, 0n, "0x", "0x", SQUID_GAS.passOn),
|
|
77
|
+
];
|
|
78
|
+
|
|
79
|
+
if (quote !== ZERO) calls.push(call(SQUID_CALL.FullTokenBalance, quote, 0n, bytesToHex(encodeCall("transfer(address,uint256)", [user, SQUID_FULL])), bytesToHex(encodeAbi(["address", "uint256"], [quote, 1n])), SQUID_GAS.transfer));
|
|
80
|
+
return { provider: "FLOOR", description: "Buy a FLOOR launch token with the native coin", calls };
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
export function sellHook(p ) {
|