auctionflow-sdk 3.0.0 → 3.1.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/README.md CHANGED
@@ -217,10 +217,12 @@ await sdk.claim(tokenAddress);
217
217
  **Migration** pairs the auction's liquidity share of the raise with newly
218
218
  minted tokens and opens a 1% Uniswap v3 pool **at the auction's final price**,
219
219
  so there is no price jump to arbitrage. If someone initialised the pool
220
- beforehand at a different price, migration corrects it first. The position NFT
221
- stays in the auction contract forever, so the liquidity can never be pulled.
222
- Tokens Uniswap doesn't use are burned, and leftover funds are credited to the
223
- creator to `claim`.
220
+ beforehand below that price, migration raises it first; if above, the reserve's
221
+ funds go in at or below the final price and its tokens above the pool's price,
222
+ so neither can be traded against at a better price than the auction's. The
223
+ position NFT stays in the auction contract forever, so the liquidity can never
224
+ be pulled. Tokens Uniswap doesn't use are burned. Migration never pays the
225
+ creator: if Uniswap refuses the position, it reverts and can be retried.
224
226
 
225
227
  **Withdrawal** pays the creator everything not reserved for liquidity: with the
226
228
  default 50% share, half the raise. It works before or after migration.
@@ -277,7 +279,7 @@ Early buyers pay less; later buyers pay more.
277
279
  | `getMigration(auctionId)` | The pool address and position NFT id, or `null` before migration. |
278
280
  | `withdrawProceeds(auctionId)` | Pay the creator their share of the raise (what isn't reserved for liquidity). Creator-only, once. |
279
281
  | `collectFees(auctionId)` | Collect the pool's trading fees: the protocol's share accrues to the protocol and the rest is credited to the creator. Anyone may call. |
280
- | `claim(token)` | Withdraw everything credited to the connected account in `token`: a creator's share of pool fees, and any reserve migration couldn't place. |
282
+ | `claim(token)` | Withdraw everything credited to the connected account in `token`: a creator's share of pool fees. |
281
283
  | `getClaimable(token, account)` | How much of `token` is credited to `account`. |
282
284
  | `claimProtocolFees(token)` | Send the protocol's unclaimed fees in `token` to the fee recipient. Anyone may call. |
283
285
  | `getProtocolFees(token)` | The protocol's unclaimed fees in `token`. |
package/dist/index.d.mts CHANGED
@@ -183,7 +183,7 @@ declare class AuctionFlowSDK {
183
183
  collectFees(auctionId: bigint): Promise<Hash>;
184
184
  /**
185
185
  * Withdraw everything credited to the connected account in `token`: a
186
- * creator's share of pool fees, and any reserve migration couldn't place.
186
+ * creator's share of pool fees.
187
187
  */
188
188
  claim(token: Address): Promise<Hash>;
189
189
  /** Send the protocol's unclaimed fees in `token` to the fee recipient. Anyone may call it. */
@@ -208,6 +208,11 @@ declare const WETH_ADDRESSES: Record<SupportedChainId, Address>;
208
208
 
209
209
  /** Smallest share of the raise an auction may commit to Uniswap liquidity (20%). Mirrors TokenAuction.MIN_LIQUIDITY_BPS. */
210
210
  declare const MIN_LIQUIDITY_BPS = 2000;
211
+ /**
212
+ * Lowest base price a curve may start at, in payment units × 1e18 per whole
213
+ * token. Mirrors TokenAuction.MIN_BASE_PRICE.
214
+ */
215
+ declare const MIN_BASE_PRICE = 1000000n;
211
216
  /** Liquidity share the builder uses when none is given (50%). */
212
217
  declare const DEFAULT_LIQUIDITY_BPS = 5000;
213
218
 
@@ -1499,4 +1504,4 @@ declare const tokenAuctionAbi: readonly [{
1499
1504
  }];
1500
1505
  }];
1501
1506
 
1502
- export { AUCTION_ADDRESSES, AuctionBuilder, type AuctionConfig, type AuctionData, AuctionFlowSDK, AuctionState, type BuyQuote, DEFAULT_LIQUIDITY_BPS, DEFAULT_SLIPPAGE_BPS, type LaunchPreset, MIN_LIQUIDITY_BPS, type MigrationInfo, PRICE_SCALE, type SellQuote, type SupportedChainId, type TransactionResult, USDC_ADDRESSES, WETH_ADDRESSES, applySellSlippage, applySlippage, calculateBuyCost, calculateBuyQuote, calculateSellProceeds, fillPurchase, formatCurvePrice, maxBuyable, parseCurvePrice, spotPrice, tokenAuctionAbi };
1507
+ export { AUCTION_ADDRESSES, AuctionBuilder, type AuctionConfig, type AuctionData, AuctionFlowSDK, AuctionState, type BuyQuote, DEFAULT_LIQUIDITY_BPS, DEFAULT_SLIPPAGE_BPS, type LaunchPreset, MIN_BASE_PRICE, MIN_LIQUIDITY_BPS, type MigrationInfo, PRICE_SCALE, type SellQuote, type SupportedChainId, type TransactionResult, USDC_ADDRESSES, WETH_ADDRESSES, applySellSlippage, applySlippage, calculateBuyCost, calculateBuyQuote, calculateSellProceeds, fillPurchase, formatCurvePrice, maxBuyable, parseCurvePrice, spotPrice, tokenAuctionAbi };
package/dist/index.d.ts CHANGED
@@ -183,7 +183,7 @@ declare class AuctionFlowSDK {
183
183
  collectFees(auctionId: bigint): Promise<Hash>;
184
184
  /**
185
185
  * Withdraw everything credited to the connected account in `token`: a
186
- * creator's share of pool fees, and any reserve migration couldn't place.
186
+ * creator's share of pool fees.
187
187
  */
188
188
  claim(token: Address): Promise<Hash>;
189
189
  /** Send the protocol's unclaimed fees in `token` to the fee recipient. Anyone may call it. */
@@ -208,6 +208,11 @@ declare const WETH_ADDRESSES: Record<SupportedChainId, Address>;
208
208
 
209
209
  /** Smallest share of the raise an auction may commit to Uniswap liquidity (20%). Mirrors TokenAuction.MIN_LIQUIDITY_BPS. */
210
210
  declare const MIN_LIQUIDITY_BPS = 2000;
211
+ /**
212
+ * Lowest base price a curve may start at, in payment units × 1e18 per whole
213
+ * token. Mirrors TokenAuction.MIN_BASE_PRICE.
214
+ */
215
+ declare const MIN_BASE_PRICE = 1000000n;
211
216
  /** Liquidity share the builder uses when none is given (50%). */
212
217
  declare const DEFAULT_LIQUIDITY_BPS = 5000;
213
218
 
@@ -1499,4 +1504,4 @@ declare const tokenAuctionAbi: readonly [{
1499
1504
  }];
1500
1505
  }];
1501
1506
 
1502
- export { AUCTION_ADDRESSES, AuctionBuilder, type AuctionConfig, type AuctionData, AuctionFlowSDK, AuctionState, type BuyQuote, DEFAULT_LIQUIDITY_BPS, DEFAULT_SLIPPAGE_BPS, type LaunchPreset, MIN_LIQUIDITY_BPS, type MigrationInfo, PRICE_SCALE, type SellQuote, type SupportedChainId, type TransactionResult, USDC_ADDRESSES, WETH_ADDRESSES, applySellSlippage, applySlippage, calculateBuyCost, calculateBuyQuote, calculateSellProceeds, fillPurchase, formatCurvePrice, maxBuyable, parseCurvePrice, spotPrice, tokenAuctionAbi };
1507
+ export { AUCTION_ADDRESSES, AuctionBuilder, type AuctionConfig, type AuctionData, AuctionFlowSDK, AuctionState, type BuyQuote, DEFAULT_LIQUIDITY_BPS, DEFAULT_SLIPPAGE_BPS, type LaunchPreset, MIN_BASE_PRICE, MIN_LIQUIDITY_BPS, type MigrationInfo, PRICE_SCALE, type SellQuote, type SupportedChainId, type TransactionResult, USDC_ADDRESSES, WETH_ADDRESSES, applySellSlippage, applySlippage, calculateBuyCost, calculateBuyQuote, calculateSellProceeds, fillPurchase, formatCurvePrice, maxBuyable, parseCurvePrice, spotPrice, tokenAuctionAbi };
package/dist/index.js CHANGED
@@ -26,6 +26,7 @@ __export(index_exports, {
26
26
  AuctionState: () => AuctionState,
27
27
  DEFAULT_LIQUIDITY_BPS: () => DEFAULT_LIQUIDITY_BPS,
28
28
  DEFAULT_SLIPPAGE_BPS: () => DEFAULT_SLIPPAGE_BPS,
29
+ MIN_BASE_PRICE: () => MIN_BASE_PRICE,
29
30
  MIN_LIQUIDITY_BPS: () => MIN_LIQUIDITY_BPS,
30
31
  PRICE_SCALE: () => PRICE_SCALE,
31
32
  USDC_ADDRESSES: () => USDC_ADDRESSES,
@@ -49,6 +50,7 @@ var import_viem2 = require("viem");
49
50
 
50
51
  // src/constants/protocol.ts
51
52
  var MIN_LIQUIDITY_BPS = 2e3;
53
+ var MIN_BASE_PRICE = 1000000n;
52
54
  var DEFAULT_LIQUIDITY_BPS = 5e3;
53
55
 
54
56
  // src/builders/auction-builder.ts
@@ -106,7 +108,7 @@ var AuctionBuilder = class {
106
108
  }
107
109
  const config = { liquidityBps: BigInt(DEFAULT_LIQUIDITY_BPS), ...this.config };
108
110
  if (config.maxSupply <= 0n) throw new Error("maxSupply must be greater than 0");
109
- if (config.basePrice <= 0n) throw new Error("basePrice must be greater than 0");
111
+ if (config.basePrice < MIN_BASE_PRICE) throw new Error(`basePrice must be at least ${MIN_BASE_PRICE}`);
110
112
  if (config.slope < 0n) throw new Error("slope must not be negative");
111
113
  if (config.maxRaise <= 0n) throw new Error("maxRaise must be greater than 0");
112
114
  const liquidityBps = config.liquidityBps;
@@ -119,7 +121,7 @@ var AuctionBuilder = class {
119
121
 
120
122
  // src/constants/addresses.ts
121
123
  var AUCTION_ADDRESSES = {
122
- 84532: "0x990a04ffe0d49356321271629889fa0413ad1bdc",
124
+ 84532: "0xad786651dcf1405bf636ce7dcdc9c8afbab420c2",
123
125
  8453: "0x0000000000000000000000000000000000000000"
124
126
  // not yet deployed
125
127
  };
@@ -2023,7 +2025,7 @@ var AuctionFlowSDK = class {
2023
2025
  }
2024
2026
  /**
2025
2027
  * Withdraw everything credited to the connected account in `token`: a
2026
- * creator's share of pool fees, and any reserve migration couldn't place.
2028
+ * creator's share of pool fees.
2027
2029
  */
2028
2030
  async claim(token) {
2029
2031
  return this.write("claim", [token]);
@@ -2182,6 +2184,7 @@ var AuctionState = /* @__PURE__ */ ((AuctionState2) => {
2182
2184
  AuctionState,
2183
2185
  DEFAULT_LIQUIDITY_BPS,
2184
2186
  DEFAULT_SLIPPAGE_BPS,
2187
+ MIN_BASE_PRICE,
2185
2188
  MIN_LIQUIDITY_BPS,
2186
2189
  PRICE_SCALE,
2187
2190
  USDC_ADDRESSES,