@ubi.fun/sdk 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -0
- package/dist/abi/DividendVault.d.cts +670 -0
- package/dist/abi/DividendVault.d.ts +671 -0
- package/dist/abi/DividendVault.d.ts.map +1 -0
- package/dist/abi/HolderShareFeeCalculator.d.cts +287 -0
- package/dist/abi/HolderShareFeeCalculator.d.ts +288 -0
- package/dist/abi/HolderShareFeeCalculator.d.ts.map +1 -0
- package/dist/abi/IndexerSubscriber.d.cts +221 -0
- package/dist/abi/IndexerSubscriber.d.ts +222 -0
- package/dist/abi/IndexerSubscriber.d.ts.map +1 -0
- package/dist/abi/MemecoinDividends.d.cts +1021 -0
- package/dist/abi/MemecoinDividends.d.ts +1022 -0
- package/dist/abi/MemecoinDividends.d.ts.map +1 -0
- package/dist/abi/index.cjs +6447 -3585
- package/dist/abi/index.cjs.map +1 -1
- package/dist/abi/index.d.cts +4 -0
- package/dist/abi/index.d.ts +4 -0
- package/dist/abi/index.d.ts.map +1 -1
- package/dist/abi/index.js +6444 -3586
- package/dist/abi/index.js.map +1 -1
- package/dist/addresses/index.cjs +17 -0
- package/dist/addresses/index.cjs.map +1 -1
- package/dist/addresses/index.js +14 -1
- package/dist/addresses/index.js.map +1 -1
- package/dist/addresses.d.cts +25 -0
- package/dist/addresses.d.ts +25 -0
- package/dist/addresses.d.ts.map +1 -1
- package/dist/clients/DividendVaultClient.d.cts +32 -0
- package/dist/clients/DividendVaultClient.d.ts +33 -0
- package/dist/clients/DividendVaultClient.d.ts.map +1 -0
- package/dist/clients/FlaunchPositionManagerClient.d.cts +18 -0
- package/dist/clients/FlaunchPositionManagerClient.d.ts +18 -0
- package/dist/clients/FlaunchPositionManagerClient.d.ts.map +1 -1
- package/dist/clients/FlaunchZapClient.d.cts +41 -0
- package/dist/clients/FlaunchZapClient.d.ts +41 -0
- package/dist/clients/FlaunchZapClient.d.ts.map +1 -1
- package/dist/clients/IndexerSubscriberClient.d.cts +46 -0
- package/dist/clients/IndexerSubscriberClient.d.ts +47 -0
- package/dist/clients/IndexerSubscriberClient.d.ts.map +1 -0
- package/dist/clients/MemecoinDividendsClient.d.cts +23 -0
- package/dist/clients/MemecoinDividendsClient.d.ts +24 -0
- package/dist/clients/MemecoinDividendsClient.d.ts.map +1 -0
- package/dist/helpers/index.cjs.map +1 -1
- package/dist/helpers/index.js.map +1 -1
- package/dist/index.cjs +11710 -8366
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11687 -8368
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +1 -1
- package/dist/index.umd.cjs.map +1 -1
- package/dist/sdk/FlaunchSDK.d.cts +47 -1
- package/dist/sdk/FlaunchSDK.d.ts +47 -1
- package/dist/sdk/FlaunchSDK.d.ts.map +1 -1
- package/dist/utils/creatorVaults.d.cts +64 -0
- package/dist/utils/creatorVaults.d.ts +65 -0
- package/dist/utils/creatorVaults.d.ts.map +1 -0
- package/dist/utils/index.cjs +64 -0
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.cts +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +55 -2
- package/dist/utils/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { Drift, ReadWriteAdapter, type Address } from "@delvtech/drift";
|
|
2
2
|
import { type PublicClient, Hex } from "viem";
|
|
3
|
+
import { ReadIndexerSubscriber } from "../clients/IndexerSubscriberClient.cjs";
|
|
3
4
|
import { ReadFlaunchPositionManager, WatchPoolCreatedParams, WatchPoolSwapParams as WatchPoolSwapParamsPositionManager, BuySwapLog, SellSwapLog, BaseSwapLog } from "../clients/FlaunchPositionManagerClient.cjs";
|
|
4
5
|
import { ReadPoolManager, PositionInfoParams } from "../clients/PoolManagerClient.cjs";
|
|
5
6
|
import { ReadFairLaunch } from "../clients/FairLaunchClient.cjs";
|
|
6
7
|
import { ReadBidWall } from "../clients/BidWallClient.cjs";
|
|
7
|
-
import { ReadFlaunchZap, ReadWriteFlaunchZap, FlaunchParams, FlaunchIPFSParams, FlaunchWithSplitManagerParams, FlaunchWithSplitManagerIPFSParams } from "../clients/FlaunchZapClient.cjs";
|
|
8
|
+
import { ReadFlaunchZap, ReadWriteFlaunchZap, FlaunchParams, FlaunchIPFSParams, FlaunchWithSplitManagerParams, FlaunchWithSplitManagerIPFSParams, FlaunchWithVaultParams, FlaunchWithVaultIPFSParams } from "../clients/FlaunchZapClient.cjs";
|
|
8
9
|
import { ReadFlaunch } from "../clients/FlaunchClient.cjs";
|
|
9
10
|
import { ReadQuoter } from "../clients/QuoterClient.cjs";
|
|
10
11
|
import { ReadFeeEscrow, ReadWriteFeeEscrow } from "../clients/FeeEscrowClient.cjs";
|
|
@@ -48,6 +49,7 @@ export declare class ReadFlaunchSDK {
|
|
|
48
49
|
readonly readQuoter: ReadQuoter;
|
|
49
50
|
readonly readXHandleClaims: ReadXHandleClaims;
|
|
50
51
|
readonly readUbiPool: ReadUniversalRewardsDistributor;
|
|
52
|
+
readonly readIndexerSubscriber: ReadIndexerSubscriber;
|
|
51
53
|
resolveIPFS: (value: string) => string;
|
|
52
54
|
constructor(chainId: number, drift?: Drift, publicClient?: PublicClient);
|
|
53
55
|
/**
|
|
@@ -374,6 +376,29 @@ export declare class ReadFlaunchSDK {
|
|
|
374
376
|
formattedTotalSupplyInDecimals: number;
|
|
375
377
|
}>;
|
|
376
378
|
isFlaunchTokenApprovedForAll(owner: Address, operator: Address): Promise<boolean>;
|
|
379
|
+
/**
|
|
380
|
+
* The coin's creator vault, when it has one: its creator NFT sits in a
|
|
381
|
+
* clone of the approved DividendVault (factory record) that holds this very
|
|
382
|
+
* coin. Undefined for coins without one and on chains without creator vaults.
|
|
383
|
+
* @param coinAddress - The coin address
|
|
384
|
+
*/
|
|
385
|
+
getCreatorVault(coinAddress: Address): Promise<{
|
|
386
|
+
vault: Address;
|
|
387
|
+
/** Share of the creator's earnings paid to holders, in percent. */
|
|
388
|
+
holderSharePercent: number;
|
|
389
|
+
renounced: boolean;
|
|
390
|
+
managerOwner: Address;
|
|
391
|
+
} | undefined>;
|
|
392
|
+
/**
|
|
393
|
+
* A holder's dividends on a creator vault coin, in 6-decimal USDC.
|
|
394
|
+
* @param coinAddress - The coin address
|
|
395
|
+
* @param holder - The holder
|
|
396
|
+
*/
|
|
397
|
+
dividendsOf(coinAddress: Address, holder: Address): Promise<{
|
|
398
|
+
withdrawable: bigint;
|
|
399
|
+
dripping: bigint;
|
|
400
|
+
distributed: bigint;
|
|
401
|
+
}>;
|
|
377
402
|
}
|
|
378
403
|
export declare class ReadWriteFlaunchSDK extends ReadFlaunchSDK {
|
|
379
404
|
drift: Drift<ReadWriteAdapter>;
|
|
@@ -405,6 +430,27 @@ export declare class ReadWriteFlaunchSDK extends ReadFlaunchSDK {
|
|
|
405
430
|
* @returns Transaction response
|
|
406
431
|
*/
|
|
407
432
|
flaunchIPFSWithSplitManager(params: FlaunchWithSplitManagerIPFSParams): Promise<`0x${string}`>;
|
|
433
|
+
/**
|
|
434
|
+
* Launches a coin whose creator NFT goes into a creator vault: holders earn
|
|
435
|
+
* a share of the creator's earnings in USDC and the trading fee is chosen
|
|
436
|
+
* (1.5-5%). Required for every launch once creator vaults are live.
|
|
437
|
+
* @param params - Parameters for the launch
|
|
438
|
+
* @returns Transaction response
|
|
439
|
+
*/
|
|
440
|
+
flaunchWithVault(params: FlaunchWithVaultParams): Promise<`0x${string}`>;
|
|
441
|
+
/** {@link flaunchWithVault}, pinning the token metadata first. */
|
|
442
|
+
flaunchIPFSWithVault(params: FlaunchWithVaultIPFSParams): Promise<`0x${string}`>;
|
|
443
|
+
/** ubi.fun-branded alias of {@link flaunchWithVault}. */
|
|
444
|
+
createUBIWithVault(params: FlaunchWithVaultParams): Promise<`0x${string}`>;
|
|
445
|
+
/** ubi.fun-branded alias of {@link flaunchIPFSWithVault}. */
|
|
446
|
+
createUBIIPFSWithVault(params: FlaunchWithVaultIPFSParams): Promise<`0x${string}`>;
|
|
447
|
+
/** Withdraws the connected wallet's dividends from a creator vault coin. */
|
|
448
|
+
withdrawDividends(coinAddress: Address): Promise<`0x${string}`>;
|
|
449
|
+
/** Harvests a creator vault coin's fees into its vault (anyone can). */
|
|
450
|
+
harvestCreatorVault(coinAddress: Address): Promise<`0x${string}`>;
|
|
451
|
+
/** Claims the connected wallet's creator credit from a creator vault coin. */
|
|
452
|
+
claimCreatorVault(coinAddress: Address): Promise<`0x${string}`>;
|
|
453
|
+
private requireCreatorVault;
|
|
408
454
|
/** ubi.fun-branded alias of {@link flaunch}. */
|
|
409
455
|
createUBI(params: FlaunchParams): Promise<`0x${string}`>;
|
|
410
456
|
/** ubi.fun-branded alias of {@link flaunchIPFS}. */
|
package/dist/sdk/FlaunchSDK.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { Drift, ReadWriteAdapter, type Address } from "@delvtech/drift";
|
|
2
2
|
import { type PublicClient, Hex } from "viem";
|
|
3
|
+
import { ReadIndexerSubscriber } from "../clients/IndexerSubscriberClient.js";
|
|
3
4
|
import { ReadFlaunchPositionManager, WatchPoolCreatedParams, WatchPoolSwapParams as WatchPoolSwapParamsPositionManager, BuySwapLog, SellSwapLog, BaseSwapLog } from "../clients/FlaunchPositionManagerClient.js";
|
|
4
5
|
import { ReadPoolManager, PositionInfoParams } from "../clients/PoolManagerClient.js";
|
|
5
6
|
import { ReadFairLaunch } from "../clients/FairLaunchClient.js";
|
|
6
7
|
import { ReadBidWall } from "../clients/BidWallClient.js";
|
|
7
|
-
import { ReadFlaunchZap, ReadWriteFlaunchZap, FlaunchParams, FlaunchIPFSParams, FlaunchWithSplitManagerParams, FlaunchWithSplitManagerIPFSParams } from "../clients/FlaunchZapClient.js";
|
|
8
|
+
import { ReadFlaunchZap, ReadWriteFlaunchZap, FlaunchParams, FlaunchIPFSParams, FlaunchWithSplitManagerParams, FlaunchWithSplitManagerIPFSParams, FlaunchWithVaultParams, FlaunchWithVaultIPFSParams } from "../clients/FlaunchZapClient.js";
|
|
8
9
|
import { ReadFlaunch } from "../clients/FlaunchClient.js";
|
|
9
10
|
import { ReadQuoter } from "../clients/QuoterClient.js";
|
|
10
11
|
import { ReadFeeEscrow, ReadWriteFeeEscrow } from "../clients/FeeEscrowClient.js";
|
|
@@ -48,6 +49,7 @@ export declare class ReadFlaunchSDK {
|
|
|
48
49
|
readonly readQuoter: ReadQuoter;
|
|
49
50
|
readonly readXHandleClaims: ReadXHandleClaims;
|
|
50
51
|
readonly readUbiPool: ReadUniversalRewardsDistributor;
|
|
52
|
+
readonly readIndexerSubscriber: ReadIndexerSubscriber;
|
|
51
53
|
resolveIPFS: (value: string) => string;
|
|
52
54
|
constructor(chainId: number, drift?: Drift, publicClient?: PublicClient);
|
|
53
55
|
/**
|
|
@@ -374,6 +376,29 @@ export declare class ReadFlaunchSDK {
|
|
|
374
376
|
formattedTotalSupplyInDecimals: number;
|
|
375
377
|
}>;
|
|
376
378
|
isFlaunchTokenApprovedForAll(owner: Address, operator: Address): Promise<boolean>;
|
|
379
|
+
/**
|
|
380
|
+
* The coin's creator vault, when it has one: its creator NFT sits in a
|
|
381
|
+
* clone of the approved DividendVault (factory record) that holds this very
|
|
382
|
+
* coin. Undefined for coins without one and on chains without creator vaults.
|
|
383
|
+
* @param coinAddress - The coin address
|
|
384
|
+
*/
|
|
385
|
+
getCreatorVault(coinAddress: Address): Promise<{
|
|
386
|
+
vault: Address;
|
|
387
|
+
/** Share of the creator's earnings paid to holders, in percent. */
|
|
388
|
+
holderSharePercent: number;
|
|
389
|
+
renounced: boolean;
|
|
390
|
+
managerOwner: Address;
|
|
391
|
+
} | undefined>;
|
|
392
|
+
/**
|
|
393
|
+
* A holder's dividends on a creator vault coin, in 6-decimal USDC.
|
|
394
|
+
* @param coinAddress - The coin address
|
|
395
|
+
* @param holder - The holder
|
|
396
|
+
*/
|
|
397
|
+
dividendsOf(coinAddress: Address, holder: Address): Promise<{
|
|
398
|
+
withdrawable: bigint;
|
|
399
|
+
dripping: bigint;
|
|
400
|
+
distributed: bigint;
|
|
401
|
+
}>;
|
|
377
402
|
}
|
|
378
403
|
export declare class ReadWriteFlaunchSDK extends ReadFlaunchSDK {
|
|
379
404
|
drift: Drift<ReadWriteAdapter>;
|
|
@@ -405,6 +430,27 @@ export declare class ReadWriteFlaunchSDK extends ReadFlaunchSDK {
|
|
|
405
430
|
* @returns Transaction response
|
|
406
431
|
*/
|
|
407
432
|
flaunchIPFSWithSplitManager(params: FlaunchWithSplitManagerIPFSParams): Promise<`0x${string}`>;
|
|
433
|
+
/**
|
|
434
|
+
* Launches a coin whose creator NFT goes into a creator vault: holders earn
|
|
435
|
+
* a share of the creator's earnings in USDC and the trading fee is chosen
|
|
436
|
+
* (1.5-5%). Required for every launch once creator vaults are live.
|
|
437
|
+
* @param params - Parameters for the launch
|
|
438
|
+
* @returns Transaction response
|
|
439
|
+
*/
|
|
440
|
+
flaunchWithVault(params: FlaunchWithVaultParams): Promise<`0x${string}`>;
|
|
441
|
+
/** {@link flaunchWithVault}, pinning the token metadata first. */
|
|
442
|
+
flaunchIPFSWithVault(params: FlaunchWithVaultIPFSParams): Promise<`0x${string}`>;
|
|
443
|
+
/** ubi.fun-branded alias of {@link flaunchWithVault}. */
|
|
444
|
+
createUBIWithVault(params: FlaunchWithVaultParams): Promise<`0x${string}`>;
|
|
445
|
+
/** ubi.fun-branded alias of {@link flaunchIPFSWithVault}. */
|
|
446
|
+
createUBIIPFSWithVault(params: FlaunchWithVaultIPFSParams): Promise<`0x${string}`>;
|
|
447
|
+
/** Withdraws the connected wallet's dividends from a creator vault coin. */
|
|
448
|
+
withdrawDividends(coinAddress: Address): Promise<`0x${string}`>;
|
|
449
|
+
/** Harvests a creator vault coin's fees into its vault (anyone can). */
|
|
450
|
+
harvestCreatorVault(coinAddress: Address): Promise<`0x${string}`>;
|
|
451
|
+
/** Claims the connected wallet's creator credit from a creator vault coin. */
|
|
452
|
+
claimCreatorVault(coinAddress: Address): Promise<`0x${string}`>;
|
|
453
|
+
private requireCreatorVault;
|
|
408
454
|
/** ubi.fun-branded alias of {@link flaunch}. */
|
|
409
455
|
createUBI(params: FlaunchParams): Promise<`0x${string}`>;
|
|
410
456
|
/** ubi.fun-branded alias of {@link flaunchIPFS}. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FlaunchSDK.d.ts","sourceRoot":"","sources":["../../src/sdk/FlaunchSDK.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,EACL,gBAAgB,EAChB,KAAK,OAAO,EACb,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,KAAK,YAAY,EACjB,GAAG,
|
|
1
|
+
{"version":3,"file":"FlaunchSDK.d.ts","sourceRoot":"","sources":["../../src/sdk/FlaunchSDK.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,EACL,gBAAgB,EAChB,KAAK,OAAO,EACb,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,KAAK,YAAY,EACjB,GAAG,EAQJ,MAAM,MAAM,CAAC;AAsBd,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EACL,0BAA0B,EAC1B,sBAAsB,EACtB,mBAAmB,IAAI,kCAAkC,EACzD,UAAU,EACV,WAAW,EACX,WAAW,EACZ,MAAM,yCAAyC,CAAC;AACjD,OAAO,EACL,eAAe,EACf,kBAAkB,EACnB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,aAAa,EACb,iBAAiB,EACjB,6BAA6B,EAC7B,iCAAiC,EACjC,sBAAsB,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Q,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO;IASlE;;;;;;;;OAQG;IACG,oBAAoB,CACxB,sBAAsB,EAAE,OAAO,EAC/B,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,OAAO,EACjB,IAAI,GAAE,KAAK,MAAM,EAAS;CAgB7B"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { type Address, type Hex } from "viem";
|
|
2
|
+
/**
|
|
3
|
+
* Creator vault rules, mirrored from the contracts (and the ubi.fun app):
|
|
4
|
+
* HolderShareFeeCalculator fees are FeeDistributor units (100_00 = 100%),
|
|
5
|
+
* DividendVault shares are SHARE_DENOMINATOR units (100_00 = 100%).
|
|
6
|
+
*/
|
|
7
|
+
export declare const VAULT_MIN_FEE = 150;
|
|
8
|
+
export declare const VAULT_MAX_FEE = 500;
|
|
9
|
+
export declare const VAULT_MIN_HOLDER_SHARE = 1667;
|
|
10
|
+
export declare const VAULT_SHARE_DENOMINATOR = 10000;
|
|
11
|
+
/** The calculator only registers launches whose creator side is 90% or more. */
|
|
12
|
+
export declare const VAULT_MIN_CREATOR_ALLOCATION_PERCENT = 90;
|
|
13
|
+
/** DividendVault.MAX_RECIPIENTS is 5, and the creator always takes one of them. */
|
|
14
|
+
export declare const VAULT_MAX_SPLIT_RECEIVERS = 4;
|
|
15
|
+
/**
|
|
16
|
+
* `feeCalculatorParams` for a launch WITHOUT a vault: a fee of 0. With no fee
|
|
17
|
+
* calculator set the PositionManager never reads them; the vault calculator
|
|
18
|
+
* refuses them (`FeeOutOfRange(0)`), so a launch without a vault that lands
|
|
19
|
+
* after activation reverts instead of creating a token that can never trade.
|
|
20
|
+
*/
|
|
21
|
+
export declare const NO_VAULT_FEE_CALCULATOR_PARAMS: Hex;
|
|
22
|
+
/** `feeCalculatorParams` registering a vault launch at `fee` (FeeDistributor units). */
|
|
23
|
+
export declare function vaultFeeCalculatorParams(fee: number): Hex;
|
|
24
|
+
/** Basis points of a percent with at most two decimals, at least 1; throws otherwise. */
|
|
25
|
+
export declare function percentToVaultBps(percent: number, label: string): number;
|
|
26
|
+
/**
|
|
27
|
+
* DividendVault initialize data: `abi.encode(holderShare, recipients, shares)`.
|
|
28
|
+
* Receivers come first and the creator last with the remainder (the vault pays
|
|
29
|
+
* rounding dust to the last recipient), so shares always sum to exactly 100_00.
|
|
30
|
+
*/
|
|
31
|
+
export declare function encodeVaultInitializeData(params: {
|
|
32
|
+
holderShare: number;
|
|
33
|
+
receivers: {
|
|
34
|
+
address: Address;
|
|
35
|
+
bps: number;
|
|
36
|
+
}[];
|
|
37
|
+
creator: Address;
|
|
38
|
+
}): Hex;
|
|
39
|
+
/** What a launch must look like under the calculators set on-chain right now. */
|
|
40
|
+
export interface LaunchCalculatorState {
|
|
41
|
+
/** The vault calculator is live: every launch must attach its DividendVault. */
|
|
42
|
+
vault: boolean;
|
|
43
|
+
/** `feeCalculatorParams` for a launch without a vault in this state. */
|
|
44
|
+
noVaultParams: Hex;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Classifies the PositionManager's two calculator slots. The vault flow is live
|
|
48
|
+
* when this SDK knows the vault and calculator and that calculator is the one
|
|
49
|
+
* set. A launch without a vault sends the no-vault marker while no calculator
|
|
50
|
+
* is set or when the SDK cannot place what is set (fail closed), and empty
|
|
51
|
+
* params only beside a calculator that is certainly not the vault one.
|
|
52
|
+
*/
|
|
53
|
+
export declare function launchCalculatorState(params: {
|
|
54
|
+
standard: Address;
|
|
55
|
+
fairLaunch: Address;
|
|
56
|
+
vaultCalculator?: Address;
|
|
57
|
+
vaultImplementation?: Address;
|
|
58
|
+
/**
|
|
59
|
+
* TreasuryManagerFactory approval of the vault implementation: the zap only
|
|
60
|
+
* clones an approved one, and would hand the creator NFT to an unapproved
|
|
61
|
+
* implementation itself (no clone, a token that can never trade).
|
|
62
|
+
*/
|
|
63
|
+
vaultApproved?: boolean;
|
|
64
|
+
}): LaunchCalculatorState;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { type Address, type Hex } from "viem";
|
|
2
|
+
/**
|
|
3
|
+
* Creator vault rules, mirrored from the contracts (and the ubi.fun app):
|
|
4
|
+
* HolderShareFeeCalculator fees are FeeDistributor units (100_00 = 100%),
|
|
5
|
+
* DividendVault shares are SHARE_DENOMINATOR units (100_00 = 100%).
|
|
6
|
+
*/
|
|
7
|
+
export declare const VAULT_MIN_FEE = 150;
|
|
8
|
+
export declare const VAULT_MAX_FEE = 500;
|
|
9
|
+
export declare const VAULT_MIN_HOLDER_SHARE = 1667;
|
|
10
|
+
export declare const VAULT_SHARE_DENOMINATOR = 10000;
|
|
11
|
+
/** The calculator only registers launches whose creator side is 90% or more. */
|
|
12
|
+
export declare const VAULT_MIN_CREATOR_ALLOCATION_PERCENT = 90;
|
|
13
|
+
/** DividendVault.MAX_RECIPIENTS is 5, and the creator always takes one of them. */
|
|
14
|
+
export declare const VAULT_MAX_SPLIT_RECEIVERS = 4;
|
|
15
|
+
/**
|
|
16
|
+
* `feeCalculatorParams` for a launch WITHOUT a vault: a fee of 0. With no fee
|
|
17
|
+
* calculator set the PositionManager never reads them; the vault calculator
|
|
18
|
+
* refuses them (`FeeOutOfRange(0)`), so a launch without a vault that lands
|
|
19
|
+
* after activation reverts instead of creating a token that can never trade.
|
|
20
|
+
*/
|
|
21
|
+
export declare const NO_VAULT_FEE_CALCULATOR_PARAMS: Hex;
|
|
22
|
+
/** `feeCalculatorParams` registering a vault launch at `fee` (FeeDistributor units). */
|
|
23
|
+
export declare function vaultFeeCalculatorParams(fee: number): Hex;
|
|
24
|
+
/** Basis points of a percent with at most two decimals, at least 1; throws otherwise. */
|
|
25
|
+
export declare function percentToVaultBps(percent: number, label: string): number;
|
|
26
|
+
/**
|
|
27
|
+
* DividendVault initialize data: `abi.encode(holderShare, recipients, shares)`.
|
|
28
|
+
* Receivers come first and the creator last with the remainder (the vault pays
|
|
29
|
+
* rounding dust to the last recipient), so shares always sum to exactly 100_00.
|
|
30
|
+
*/
|
|
31
|
+
export declare function encodeVaultInitializeData(params: {
|
|
32
|
+
holderShare: number;
|
|
33
|
+
receivers: {
|
|
34
|
+
address: Address;
|
|
35
|
+
bps: number;
|
|
36
|
+
}[];
|
|
37
|
+
creator: Address;
|
|
38
|
+
}): Hex;
|
|
39
|
+
/** What a launch must look like under the calculators set on-chain right now. */
|
|
40
|
+
export interface LaunchCalculatorState {
|
|
41
|
+
/** The vault calculator is live: every launch must attach its DividendVault. */
|
|
42
|
+
vault: boolean;
|
|
43
|
+
/** `feeCalculatorParams` for a launch without a vault in this state. */
|
|
44
|
+
noVaultParams: Hex;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Classifies the PositionManager's two calculator slots. The vault flow is live
|
|
48
|
+
* when this SDK knows the vault and calculator and that calculator is the one
|
|
49
|
+
* set. A launch without a vault sends the no-vault marker while no calculator
|
|
50
|
+
* is set or when the SDK cannot place what is set (fail closed), and empty
|
|
51
|
+
* params only beside a calculator that is certainly not the vault one.
|
|
52
|
+
*/
|
|
53
|
+
export declare function launchCalculatorState(params: {
|
|
54
|
+
standard: Address;
|
|
55
|
+
fairLaunch: Address;
|
|
56
|
+
vaultCalculator?: Address;
|
|
57
|
+
vaultImplementation?: Address;
|
|
58
|
+
/**
|
|
59
|
+
* TreasuryManagerFactory approval of the vault implementation: the zap only
|
|
60
|
+
* clones an approved one, and would hand the creator NFT to an unapproved
|
|
61
|
+
* implementation itself (no clone, a token that can never trade).
|
|
62
|
+
*/
|
|
63
|
+
vaultApproved?: boolean;
|
|
64
|
+
}): LaunchCalculatorState;
|
|
65
|
+
//# sourceMappingURL=creatorVaults.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"creatorVaults.d.ts","sourceRoot":"","sources":["../../src/utils/creatorVaults.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuC,KAAK,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,MAAM,CAAC;AAEnF;;;;GAIG;AACH,eAAO,MAA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IN_SQRT_PRICE ? limit : MIN_SQRT_PRICE : limit < MAX_SQRT_PRICE ? limit : MAX_SQRT_PRICE;
|
|
430
430
|
}
|
|
431
431
|
|
|
432
|
+
const VAULT_MIN_FEE = 150;
|
|
433
|
+
const VAULT_MAX_FEE = 500;
|
|
434
|
+
const VAULT_MIN_HOLDER_SHARE = 1667;
|
|
435
|
+
const VAULT_SHARE_DENOMINATOR = 1e4;
|
|
436
|
+
const VAULT_MIN_CREATOR_ALLOCATION_PERCENT = 90;
|
|
437
|
+
const VAULT_MAX_SPLIT_RECEIVERS = 4;
|
|
438
|
+
const NO_VAULT_FEE_CALCULATOR_PARAMS = viem.encodeAbiParameters(
|
|
439
|
+
[{ type: "uint256" }],
|
|
440
|
+
[0n]
|
|
441
|
+
);
|
|
442
|
+
function vaultFeeCalculatorParams(fee) {
|
|
443
|
+
return viem.encodeAbiParameters([{ type: "uint256" }], [BigInt(fee)]);
|
|
444
|
+
}
|
|
445
|
+
function percentToVaultBps(percent, label) {
|
|
446
|
+
const bps = Math.round(percent * 100);
|
|
447
|
+
if (!Number.isFinite(percent) || bps < 1 || Math.abs(bps - percent * 100) > 1e-6) {
|
|
448
|
+
throw new Error(
|
|
449
|
+
`${label} must be a positive percent with at most 2 decimals, got ${percent}`
|
|
450
|
+
);
|
|
451
|
+
}
|
|
452
|
+
return bps;
|
|
453
|
+
}
|
|
454
|
+
function encodeVaultInitializeData(params) {
|
|
455
|
+
const total = params.receivers.reduce((sum, receiver) => sum + receiver.bps, 0);
|
|
456
|
+
if (total >= VAULT_SHARE_DENOMINATOR) {
|
|
457
|
+
throw new Error("splitReceivers total 100% or more; the creator must keep a share");
|
|
458
|
+
}
|
|
459
|
+
return viem.encodeAbiParameters(
|
|
460
|
+
[{ type: "uint256" }, { type: "address[]" }, { type: "uint256[]" }],
|
|
461
|
+
[
|
|
462
|
+
BigInt(params.holderShare),
|
|
463
|
+
[...params.receivers.map((receiver) => receiver.address), params.creator],
|
|
464
|
+
[
|
|
465
|
+
...params.receivers.map((receiver) => BigInt(receiver.bps)),
|
|
466
|
+
BigInt(VAULT_SHARE_DENOMINATOR - total)
|
|
467
|
+
]
|
|
468
|
+
]
|
|
469
|
+
);
|
|
470
|
+
}
|
|
471
|
+
function launchCalculatorState(params) {
|
|
472
|
+
const zero = "0x0000000000000000000000000000000000000000";
|
|
473
|
+
const { standard, fairLaunch, vaultCalculator, vaultImplementation, vaultApproved } = params;
|
|
474
|
+
const isZero = (address) => viem.isAddressEqual(address, zero);
|
|
475
|
+
const isOurs = (address) => vaultCalculator !== void 0 && viem.isAddressEqual(address, vaultCalculator);
|
|
476
|
+
if (vaultImplementation && vaultApproved === true && isOurs(standard) && (isZero(fairLaunch) || isOurs(fairLaunch))) {
|
|
477
|
+
return { vault: true, noVaultParams: NO_VAULT_FEE_CALCULATOR_PARAMS };
|
|
478
|
+
}
|
|
479
|
+
if (vaultCalculator && !(isZero(standard) && isZero(fairLaunch)) && !isOurs(standard) && !isOurs(fairLaunch)) {
|
|
480
|
+
return { vault: false, noVaultParams: "0x" };
|
|
481
|
+
}
|
|
482
|
+
return { vault: false, noVaultParams: NO_VAULT_FEE_CALCULATOR_PARAMS };
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
exports.NO_VAULT_FEE_CALCULATOR_PARAMS = NO_VAULT_FEE_CALCULATOR_PARAMS;
|
|
432
486
|
exports.Q192 = Q192;
|
|
433
487
|
exports.Q96 = Q96;
|
|
434
488
|
exports.TICK_SPACING = TICK_SPACING;
|
|
435
489
|
exports.TickFinder = TickFinder;
|
|
490
|
+
exports.VAULT_MAX_FEE = VAULT_MAX_FEE;
|
|
491
|
+
exports.VAULT_MAX_SPLIT_RECEIVERS = VAULT_MAX_SPLIT_RECEIVERS;
|
|
492
|
+
exports.VAULT_MIN_CREATOR_ALLOCATION_PERCENT = VAULT_MIN_CREATOR_ALLOCATION_PERCENT;
|
|
493
|
+
exports.VAULT_MIN_FEE = VAULT_MIN_FEE;
|
|
494
|
+
exports.VAULT_MIN_HOLDER_SHARE = VAULT_MIN_HOLDER_SHARE;
|
|
495
|
+
exports.VAULT_SHARE_DENOMINATOR = VAULT_SHARE_DENOMINATOR;
|
|
436
496
|
exports.calculateUnderlyingTokenBalances = calculateUnderlyingTokenBalances;
|
|
437
497
|
exports.coinPoolKey = coinPoolKey;
|
|
498
|
+
exports.encodeVaultInitializeData = encodeVaultInitializeData;
|
|
438
499
|
exports.expectedEndSqrtPriceX96 = expectedEndSqrtPriceX96;
|
|
439
500
|
exports.getAmountWithSlippage = getAmountWithSlippage;
|
|
440
501
|
exports.getAmountsForLiquidity = getAmountsForLiquidity;
|
|
@@ -443,13 +504,16 @@ exports.getNearestUsableTick = getNearestUsableTick;
|
|
|
443
504
|
exports.getPoolId = getPoolId;
|
|
444
505
|
exports.getSqrtPriceX96FromTick = getSqrtPriceX96FromTick;
|
|
445
506
|
exports.getValidTick = getValidTick;
|
|
507
|
+
exports.launchCalculatorState = launchCalculatorState;
|
|
446
508
|
exports.maxLiquidityForAmount0Precise = maxLiquidityForAmount0Precise;
|
|
447
509
|
exports.maxLiquidityForAmount1 = maxLiquidityForAmount1;
|
|
448
510
|
exports.orderPoolKey = orderPoolKey;
|
|
449
511
|
exports.parseSwapData = parseSwapData;
|
|
512
|
+
exports.percentToVaultBps = percentToVaultBps;
|
|
450
513
|
exports.priceRatioToTick = priceRatioToTick;
|
|
451
514
|
exports.referrerHookData = referrerHookData;
|
|
452
515
|
exports.sqrtPriceLimit = sqrtPriceLimit;
|
|
453
516
|
exports.swapDirection = swapDirection;
|
|
454
517
|
exports.usdcIsCurrencyZero = usdcIsCurrencyZero;
|
|
518
|
+
exports.vaultFeeCalculatorParams = vaultFeeCalculatorParams;
|
|
455
519
|
//# sourceMappingURL=index.cjs.map
|