@floorlaunchpad/sdk 0.4.1 → 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 +83 -18
- package/README.md +0 -2
- package/dist/abi/functions.gen.js +1 -1
- package/dist/config/generated.js +77 -0
- package/dist/evm/chains.js +1 -24
- package/dist/evm/router.js +1 -25
- package/dist/evm/squid.js +3 -3
- package/dist/index.js +1 -0
- package/dist/indexer/bodies.js +4 -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/evm.js +3 -1
- package/dist/v2/layouts.js +5 -1
- package/dist/v2/router.js +2 -2
- package/dist/v2/solanaSettle.js +2 -0
- package/docs/aggregator.md +0 -22
- package/docs/bot.md +0 -8
- package/docs/cursor-pages.md +0 -2
- package/docs/frontend.md +0 -2
- package/docs/ton.md +107 -0
- package/docs/wallet.md +0 -2
- package/examples/floor-line.html +1 -1
- package/package.json +6 -1
- package/src/abi/functions.gen.ts +1 -1
- package/src/config/generated.ts +77 -0
- package/src/evm/chains.ts +3 -28
- package/src/evm/router.ts +1 -26
- package/src/evm/squid.ts +3 -3
- package/src/index.ts +1 -0
- package/src/indexer/bodies.ts +4 -0
- 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/evm.ts +5 -1
- package/src/v2/layouts.ts +5 -1
- 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,33 +2,98 @@
|
|
|
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.
|
|
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
|
|
6
77
|
|
|
7
78
|
Fixed:
|
|
8
79
|
|
|
9
|
-
- `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; 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.
|
|
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.
|
|
10
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.
|
|
11
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).
|
|
12
|
-
- `buyHookNative` (the Squid postHook that buys through the zap with a bridged native coin) takes the launch's `quote` and, when it is an ERC-20, adds a third call that passes the zap's quote refund on to `user` (`FullTokenBalance quote.transfer(user, FULL)`). Before, the unspent quote the program paid back stayed on the multicall, where anyone could sweep it. `quote` is optional: absent or address(0) (a launch quoted in the native coin), the hook is the same two calls as 0.4.0, byte for byte, so a 0.4.0 call still compiles and encodes as before; pass the ERC-20 quote to get the refund call.
|
|
13
|
-
- `devBuyFromTrade` takes an optional `ctx.buyer`: the person a known zap's or router's own event proves for a buy through it. A buy through the zap or the router has the contract as the trade's `trader`, so a creator's or team member's buy through either was not named a dev buy; with `ctx.buyer` it is, and the returned `trader` is that person. The trade's recipient alone never names one (anyone can buy with the creator as recipient).
|
|
14
|
-
- `EVM_ERRORS` and `decodeEvmProgramError` now know five errors the v2 contracts revert with from their math libraries, which the contracts' ABI does not list: `PriceOrder()`, `ZeroLiquidity()`, `SqrtRange()`, `Zero()` and `VaultShareOutOfRange()`. Before, a revert with one of them decoded as unknown; now it decodes by its selector like any other EVM error.
|
|
15
|
-
- `zapSwapData` now refuses a route that names address(0) (the wrapped native stands for the native coin) or swaps a coin into itself (neither names a pool a router can trade).
|
|
16
86
|
|
|
17
87
|
Added:
|
|
18
88
|
|
|
19
|
-
-
|
|
20
|
-
-
|
|
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.
|
|
21
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.
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
- The Solana client's `claim` reads its launches side by side instead of one after another: the round trips no longer grow with the number of launches (5 launches: 15 round trips to 3). Same transaction, same refusals; the quote's fields still come from the last launch asked.
|
|
25
|
-
- FloorRouter addresses: `FLOOR_ROUTER_ADDRESSES` (per chain and zap slot), `floorRouter` on each `EVM_CHAINS` zap row, `FLOOR_ROUTER_DEPLOYER` and `floorRouterAddress(slot)`. One address per slot, the same on every chain that has it (7 routers over the 15 zap rows). The addresses are derived ahead of the routers' deploy, not read back from chain: each is usable only once it has code on that chain. A call to one with no code still succeeds and buys nothing, and a native-in buy's coin sent to it stays at that empty address and is lost. `floorRouterLive` and `assertFloorRouterLive` (`evm/router`) check the code through your `getCode` ("0x" or `undefined` is no code); check before you build a call to one, as `evmRouteCallV2` itself reads no chain.
|
|
26
|
-
|
|
27
|
-
Changed:
|
|
28
|
-
|
|
29
|
-
- Elysium is switched on: its chain registry row is no longer `v2DayOne: false`, so `v2DayOneChains()` now includes Elysium (eight EVM chains). Elysium is live at the same address as the other EVM chains.
|
|
30
|
-
|
|
31
|
-
Added (to carry the fixes; nothing removed or renamed): the type `ZapUrFork`, the constant `AERODROME_SLIPSTREAM_KEY`, the optional `ZapSwapParams` keys `input`, `output`, `router` and `urFork`, and the optional `urFork` on each `EVM_CHAINS` zap row.
|
|
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.
|
|
32
97
|
|
|
33
98
|
## 0.4.0
|
|
34
99
|
|
package/README.md
CHANGED
|
@@ -39,8 +39,6 @@ A launch's floor is the price the program's own money stands behind. Drawing it
|
|
|
39
39
|
|
|
40
40
|
The version follows semver. While the major number is 0, a minor bump (0.2 to 0.3) may rename or remove an export and a patch bump never does. The plan and the history are in [CHANGELOG.md](CHANGELOG.md).
|
|
41
41
|
|
|
42
|
-
0.4.1 adds, without renaming or removing anything: the deployed zap addresses (`FLOOR_ZAP_ADDRESSES`, `zap` on each zap row) and more `zapSwapData` routes ([aggregator.md](docs/aggregator.md)), batched indexer reads (`readLaunchLists`, `readCandlesMany`, [bot.md](docs/bot.md)), a batched EVM preset menu ([frontend.md](docs/frontend.md)), five more decoded EVM errors ([wallet.md](docs/wallet.md)) and an optional `ctx.buyer` for `devBuyFromTrade`.
|
|
43
|
-
|
|
44
42
|
**Fees in a quote.** A quote's `fees` has the five fee legs, each added on top of the trade, buys and sells alike: the
|
|
45
43
|
Backing Fee (`backing`), the Team Fee (`team`), the Platform fee (`platform`), the $FLOOR fee (`floor`) and the Holder Fee
|
|
46
44
|
(`holder`), with their `total`. Any leg can be 0. Before graduation a preset launch pays only the Platform fee and the
|
|
@@ -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]))" },
|
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
|
},
|
package/dist/evm/chains.js
CHANGED
|
@@ -60,28 +60,9 @@ export const FLOOR_ZAP_ADDRESSES
|
|
|
60
60
|
elysium: { "uniswap-ur": strict("0x56F22be922Ffc9e955169E0673D3Ae42B1151995") },
|
|
61
61
|
};
|
|
62
62
|
|
|
63
|
-
export const FLOOR_ROUTER_DEPLOYER = strict("0x3e70158e54E91d2984c0F3B66ce2cE730d1E0e11");
|
|
64
|
-
|
|
65
|
-
const ROUTER_PROXY_INITCODE = "0x67363d3d37363d34f03d5260086018f3";
|
|
66
|
-
|
|
67
|
-
function slotWord(slot ) {
|
|
68
|
-
const b = new TextEncoder().encode(slot);
|
|
69
|
-
if (b.length === 0 || b.length > 32) throw new RangeError(`a router slot is 1..32 bytes: ${JSON.stringify(slot)}`);
|
|
70
|
-
const w = new Uint8Array(32);
|
|
71
|
-
w.set(b);
|
|
72
|
-
return w;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export function floorRouterAddress(slot , deployer = FLOOR_ROUTER_DEPLOYER) {
|
|
76
|
-
const s = keccak256(encodeAbi(["string", "bytes32"], ["floor-router.v1.FloorRouter", bytesToHex(slotWord(slot))]));
|
|
77
|
-
const proxy = create2Address({ deployer, salt: s, initCode: ROUTER_PROXY_INITCODE });
|
|
78
|
-
|
|
79
|
-
return checksumAddress(bytesToHex(keccak256(hexToBytes("0xd694" + proxy.slice(2) + "01")).slice(12)));
|
|
80
|
-
}
|
|
81
|
-
|
|
82
63
|
function withBookedZaps(key , rows ) {
|
|
83
64
|
const book = FLOOR_ZAP_ADDRESSES[key];
|
|
84
|
-
return rows.map((row) => ({ ...row, zap: book[row.slot] ?? null
|
|
65
|
+
return rows.map((row) => ({ ...row, zap: book[row.slot] ?? null }));
|
|
85
66
|
}
|
|
86
67
|
|
|
87
68
|
const UNISWAP_UR = "uniswap-ur";
|
|
@@ -157,10 +138,6 @@ export const EVM_CHAINS = Object.fromEntries(
|
|
|
157
138
|
CHAIN_REGISTRY.flatMap((c) => (c.family === "evm" ? [[c.slug, { key: c.slug, chainId: c.chainId, name: c.label, nativeSymbol: c.native.symbol, ...ROUTES[c.slug], ...((c.v2DayOne ) === false ? { v2DayOne: false } : {}) }]] : [])),
|
|
158
139
|
) ;
|
|
159
140
|
|
|
160
|
-
export const FLOOR_ROUTER_ADDRESSES = Object.freeze(
|
|
161
|
-
Object.fromEntries(Object.values(EVM_CHAINS).map((c) => [c.key, Object.freeze(Object.fromEntries(c.zapRouters.map((r) => [r.slot, r.floorRouter])))])),
|
|
162
|
-
) ;
|
|
163
|
-
|
|
164
141
|
export const v2DayOneChains = () => Object.values(EVM_CHAINS).filter((c) => c.v2DayOne !== false);
|
|
165
142
|
export const chainById = (chainId ) => Object.values(EVM_CHAINS).find((c) => c.chainId === chainId) ?? null;
|
|
166
143
|
|
package/dist/evm/router.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { encodeFunctionData } from "./items.js";
|
|
4
4
|
import { deadlineArg } from "./floor/calls.js";
|
|
5
5
|
import { EVM_NATIVE, NoRouteError, coinKey } from "../route/graph.js";
|
|
6
|
-
import {
|
|
6
|
+
import { chainById } from "./chains.js";
|
|
7
7
|
|
|
8
8
|
const BUY = [
|
|
9
9
|
{ name: "path", type: "uint256[]" },
|
|
@@ -182,27 +182,3 @@ export function evmRouteCall(q , p
|
|
|
182
182
|
const b = { path: ids(buys), tokenIn: s.tokenOut, amountIn: 0n, swapData: "0x", minQuoteIn: 0n, minTokensOut: mins(buys), to: p.to, deadline: p.deadline };
|
|
183
183
|
return call(encodeRouterSwap(s, b, p.chainId), 0n);
|
|
184
184
|
}
|
|
185
|
-
|
|
186
|
-
export async function floorRouterLive(rpc , at ) {
|
|
187
|
-
const address = floorRouterAt(at);
|
|
188
|
-
const code = await rpc.getCode(address);
|
|
189
|
-
if (code === undefined) return false;
|
|
190
|
-
if (typeof code !== "string" || !/^0x([0-9a-fA-F]{2})*$/.test(code)) throw new TypeError(`getCode(${address}) returned ${String(code)}, not hex bytes`);
|
|
191
|
-
return code.length > 2;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
export async function assertFloorRouterLive(rpc , at ) {
|
|
195
|
-
const address = floorRouterAt(at);
|
|
196
|
-
if (!(await floorRouterLive(rpc, address))) throw new RangeError(`FloorRouter ${address} has no code on this chain yet: it is derived ahead of its deploy; do not send to it (a native coin sent to it is lost)`);
|
|
197
|
-
return address;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
function floorRouterAt(at ) {
|
|
201
|
-
if (typeof at === "string") {
|
|
202
|
-
if (!/^0x[0-9a-fA-F]{40}$/.test(at)) throw new RangeError(`a FloorRouter is a 20-byte address: ${at}`);
|
|
203
|
-
return at;
|
|
204
|
-
}
|
|
205
|
-
const row = EVM_CHAINS[at.chain]?.zapRouters.find((r) => r.slot === at.slot);
|
|
206
|
-
if (row === undefined) throw new RangeError(`no FloorRouter slot ${at.slot} on ${at.chain}`);
|
|
207
|
-
return row.floorRouter;
|
|
208
|
-
}
|
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,12 +65,12 @@ 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
|
-
const quote = lc(p.quote
|
|
73
|
+
const quote = lc(p.quote, "quote");
|
|
74
74
|
const calls = [
|
|
75
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
76
|
call(SQUID_CALL.FullNativeBalance, user, 0n, "0x", "0x", SQUID_GAS.passOn),
|
package/dist/index.js
CHANGED
|
@@ -87,6 +87,7 @@ export * as abi from "./abi/index.js";
|
|
|
87
87
|
export * as v2Press from "./v2/press.js";
|
|
88
88
|
export * as v2ReceiptTx from "./v2/receipt-tx.js";
|
|
89
89
|
export * as config from "./config/index.js";
|
|
90
|
+
export * as ton from "./ton/index.js";
|
|
90
91
|
export * as fixtures from "./fixtures.js";
|
|
91
92
|
export * as client from "./client/index.js";
|
|
92
93
|
export * as errors from "./errors.js";
|
package/dist/indexer/bodies.js
CHANGED
|
@@ -123,6 +123,10 @@ const LISTED_FIELDS = {
|
|
|
123
123
|
volume24hGross: nullable(big),
|
|
124
124
|
holders: int,
|
|
125
125
|
|
|
126
|
+
newHolders1h: optional(nullable(int)),
|
|
127
|
+
|
|
128
|
+
newHolders24h: optional(nullable(int)),
|
|
129
|
+
|
|
126
130
|
maxLossPpm: optional(nullable(int)),
|
|
127
131
|
|
|
128
132
|
backedPpm: nullable(int),
|
package/dist/math/v2/book.js
CHANGED
|
@@ -31,6 +31,10 @@ export const KIND_TAIL = 5;
|
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
34
38
|
const ov = (x ) => (x === null ? fail("Overflow") : x);
|
|
35
39
|
const u64 = (x ) => (x < 0n || x > U64_MAX ? fail("Overflow") : x);
|
|
36
40
|
const u128 = (x ) => (x < 0n || x > U128_MAX ? fail("Overflow") : x);
|
|
@@ -72,7 +76,7 @@ export function emptyBook(sqrtP , feePpm ) {
|
|
|
72
76
|
return {
|
|
73
77
|
sqrtP, sqrtF: 0n, sqrtLMax: 0n, floor: 0n, floorTokens: 0n, nBands: 0, nC: 0,
|
|
74
78
|
bandEdge: new Array(BIDS_MAX + 1).fill(0n), bandMoney: new Array(BIDS_MAX).fill(0n), bandTokens: new Array(BIDS_MAX).fill(0n),
|
|
75
|
-
bandF: new Array(BIDS_MAX).fill(0n), bandFClaim: new Array(BIDS_MAX).fill(0n), ckAtF: 0n, ckFloorTokens: 0n, feePpm: [...feePpm], feeStartPpm: [0, 0, 0, 0, 0], sqrtFeeA: 0n, sqrtFeeB: 0n, graduated: false, nRanges: 0, ranges: Array.from({ length: RANGES_MAX }, emptyRange),
|
|
79
|
+
bandF: new Array(BIDS_MAX).fill(0n), bandFClaim: new Array(BIDS_MAX).fill(0n), ckAtF: 0n, ckFloorTokens: 0n, kpot: true, kAtF: 0n, kFloorTokens: 0n, feePpm: [...feePpm], feeStartPpm: [0, 0, 0, 0, 0], sqrtFeeA: 0n, sqrtFeeB: 0n, graduated: false, nRanges: 0, ranges: Array.from({ length: RANGES_MAX }, emptyRange),
|
|
76
80
|
};
|
|
77
81
|
}
|
|
78
82
|
|
|
@@ -196,6 +200,21 @@ export const ckMoney = (b ) => sum(b.bandMoney, b.nBands) - sum(b.b
|
|
|
196
200
|
|
|
197
201
|
export const ckHeld = (b ) => sum(b.bandTokens, b.nBands) + b.ckFloorTokens;
|
|
198
202
|
|
|
203
|
+
export const kSeg = (b ) => (b.kpot && b.nBands === b.nC + 1 ? b.nC : null);
|
|
204
|
+
|
|
205
|
+
export const cMoney = (b ) => sum(b.bandMoney, b.nC) - sum(b.bandF, b.nC) + (b.ckAtF - b.kAtF);
|
|
206
|
+
|
|
207
|
+
export const kMoney = (b ) => ckMoney(b) - cMoney(b);
|
|
208
|
+
|
|
209
|
+
export const cHeld = (b ) => sum(b.bandTokens, b.nC) + (b.ckFloorTokens - b.kFloorTokens);
|
|
210
|
+
|
|
211
|
+
export const kHeld = (b ) => ckHeld(b) - cHeld(b);
|
|
212
|
+
|
|
213
|
+
export function kHolds(b ) {
|
|
214
|
+
const k = kSeg(b);
|
|
215
|
+
return k !== null && (b.bandTokens[k] > 0n || b.bandFClaim[k] > 0n);
|
|
216
|
+
}
|
|
217
|
+
|
|
199
218
|
const bidMoneySum = (b ) => b.floor + sum(b.bandMoney, b.nBands);
|
|
200
219
|
|
|
201
220
|
export const placeMoney = (b ) => {
|
|
@@ -259,6 +278,8 @@ export function checkBook(b ) {
|
|
|
259
278
|
}
|
|
260
279
|
}
|
|
261
280
|
if (b.ckAtF > b.floor || b.ckFloorTokens > b.floorTokens) fail("Overflow");
|
|
281
|
+
if (b.kAtF > b.ckAtF || b.kFloorTokens > b.ckFloorTokens) fail("Overflow");
|
|
282
|
+
if (b.kpot && b.nBands > b.nC + 1) fail("SqrtRange");
|
|
262
283
|
}
|
|
263
284
|
|
|
264
285
|
function flatUp(b ) {
|
|
@@ -343,6 +364,14 @@ function floorRebuy(b , take , cost ) {
|
|
|
343
364
|
if (xe > 0n) {
|
|
344
365
|
const back = (cost * xe) / x0;
|
|
345
366
|
const gone = min((take * xe + x0 - 1n) / x0, xe);
|
|
367
|
+
|
|
368
|
+
const xk = b.kFloorTokens;
|
|
369
|
+
if (xk > 0n) {
|
|
370
|
+
const backK = (back * xk) / xe;
|
|
371
|
+
const goneK = min(min((gone * xk + xe - 1n) / xe, xk), gone);
|
|
372
|
+
b.kAtF = u128(b.kAtF + backK);
|
|
373
|
+
b.kFloorTokens -= goneK;
|
|
374
|
+
}
|
|
346
375
|
b.ckAtF = u128(b.ckAtF + back);
|
|
347
376
|
b.ckFloorTokens -= gone;
|
|
348
377
|
}
|
|
@@ -534,12 +563,14 @@ export function walkDownAcc(b , tokens , acc , u = new
|
|
|
534
563
|
charge(b, acc, q);
|
|
535
564
|
if (fp.t === "floor") {
|
|
536
565
|
|
|
537
|
-
const ce = min(q, b.ckAtF);
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
566
|
+
const ce = min(q, b.ckAtF - b.kAtF);
|
|
567
|
+
const ke = min(q - ce, b.kAtF);
|
|
568
|
+
const xc = ce > 0n ? min(ov(flatTokensForMoney(s, ce, DOWN)), take) : 0n;
|
|
569
|
+
const xk = ke > 0n ? min(ov(flatTokensForMoney(s, ke, DOWN)), take - xc) : 0n;
|
|
570
|
+
b.ckAtF -= ce + ke;
|
|
571
|
+
b.kAtF -= ke;
|
|
572
|
+
b.ckFloorTokens = u64(b.ckFloorTokens + xc + xk);
|
|
573
|
+
b.kFloorTokens = u64(b.kFloorTokens + xk);
|
|
543
574
|
b.floor -= q;
|
|
544
575
|
b.floorTokens = u64(b.floorTokens + take);
|
|
545
576
|
w.fromF += q;
|
|
@@ -585,6 +616,8 @@ export function walkDownAcc(b , tokens , acc , u = new
|
|
|
585
616
|
|
|
586
617
|
b.floor = u128(b.floor + b.bandMoney[j]);
|
|
587
618
|
b.ckAtF = u128(b.ckAtF + b.bandMoney[j] - b.bandF[j]);
|
|
619
|
+
|
|
620
|
+
if (kSeg(b) === j) b.kAtF = u128(b.kAtF + b.bandMoney[j] - b.bandF[j]);
|
|
588
621
|
b.bandMoney[j] = 0n;
|
|
589
622
|
b.bandF[j] = 0n;
|
|
590
623
|
}
|
package/dist/math/v2/create.js
CHANGED
|
@@ -115,7 +115,7 @@ export function teamBuyV2(book , gross , max ) {
|
|
|
115
115
|
const take = gross < max ? gross : max;
|
|
116
116
|
if (take === 0n) {
|
|
117
117
|
return { gross, net: 0n, refund: gross, tokens: 0n, fees: [0n, 0n, 0n, 0n, 0n], fromResale: 0n, fromFirst: 0n, steps: 0, budgetHit: false, graduatedNow: false, sqrtBefore: book.sqrtP, sqrtAfter: book.sqrtP,
|
|
118
|
-
split: { dF: 0n, ckAdd: 0n, ckTake: 0n, ms: 0n, booked: [0n, 0n, 0n, 0n], sqrtFNew: 0n }, relay: { nC: 0, nK: 0, laidC: 0n, laidK: 0n, atF: 0n, kept: 0 } };
|
|
118
|
+
split: { dF: 0n, ckAdd: 0n, ckTake: 0n, cAdd: 0n, kAdd: 0n, cTake: 0n, kTake: 0n, ms: 0n, booked: [0n, 0n, 0n, 0n], sqrtFNew: 0n }, relay: { nC: 0, nK: 0, laidC: 0n, laidK: 0n, atF: 0n, kAtF: 0n, kept: 0 } };
|
|
119
119
|
}
|
|
120
120
|
const r = bookBuy(book, take, 0n);
|
|
121
121
|
return { ...r, refund: r.refund + gross - take, gross };
|