@clawnch/clawncher-sdk 2.0.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 +331 -0
- package/dist/abis.d.ts +935 -0
- package/dist/abis.d.ts.map +1 -0
- package/dist/abis.js +486 -0
- package/dist/abis.js.map +1 -0
- package/dist/addresses.d.ts +45 -0
- package/dist/addresses.d.ts.map +1 -0
- package/dist/addresses.js +72 -0
- package/dist/addresses.js.map +1 -0
- package/dist/deployer.d.ts +255 -0
- package/dist/deployer.d.ts.map +1 -0
- package/dist/deployer.js +397 -0
- package/dist/deployer.js.map +1 -0
- package/dist/erc8004-types.d.ts +94 -0
- package/dist/erc8004-types.d.ts.map +1 -0
- package/dist/erc8004-types.js +8 -0
- package/dist/erc8004-types.js.map +1 -0
- package/dist/index.d.ts +192 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +340 -0
- package/dist/index.js.map +1 -0
- package/dist/molten-types.d.ts +282 -0
- package/dist/molten-types.d.ts.map +1 -0
- package/dist/molten-types.js +8 -0
- package/dist/molten-types.js.map +1 -0
- package/dist/molten.d.ts +336 -0
- package/dist/molten.d.ts.map +1 -0
- package/dist/molten.js +560 -0
- package/dist/molten.js.map +1 -0
- package/dist/reader.d.ts +248 -0
- package/dist/reader.d.ts.map +1 -0
- package/dist/reader.js +487 -0
- package/dist/reader.js.map +1 -0
- package/dist/types.d.ts +244 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/dist/vanity.d.ts +115 -0
- package/dist/vanity.d.ts.map +1 -0
- package/dist/vanity.js +166 -0
- package/dist/vanity.js.map +1 -0
- package/package.json +63 -0
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ClawnchDeployer - Direct contract interaction for Clawncher token deployment
|
|
3
|
+
*
|
|
4
|
+
* Deploy tokens on Base with Uniswap V4 liquidity pools.
|
|
5
|
+
*
|
|
6
|
+
* Fee structure:
|
|
7
|
+
* - 1% LP fee per swap
|
|
8
|
+
* - 80% to reward recipients (default: in token)
|
|
9
|
+
* - 20% protocol (Clawncher, in WETH)
|
|
10
|
+
* - MEV protection: 80% fee decaying to 5% over 30 seconds
|
|
11
|
+
*/
|
|
12
|
+
import { type WalletClient, type PublicClient, type Chain, type Account, type Transport, type Hash, type Address } from 'viem';
|
|
13
|
+
import { type NetworkName } from './addresses.js';
|
|
14
|
+
import { type VanityMineResult } from './vanity.js';
|
|
15
|
+
/**
|
|
16
|
+
* Fee preference for reward recipients
|
|
17
|
+
*/
|
|
18
|
+
export type FeePreference = 'Clawnch' | 'Paired' | 'Both';
|
|
19
|
+
/**
|
|
20
|
+
* Reward recipient configuration
|
|
21
|
+
*/
|
|
22
|
+
export interface RewardRecipient {
|
|
23
|
+
recipient: Address;
|
|
24
|
+
admin: Address;
|
|
25
|
+
/** Basis points (100 = 1%, max 10000 = 100%) */
|
|
26
|
+
bps: number;
|
|
27
|
+
/** Which token to receive fees in (default: 'Clawnch' = the Clawncher-launched token) */
|
|
28
|
+
feePreference?: FeePreference;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Vault configuration (optional)
|
|
32
|
+
*/
|
|
33
|
+
export interface VaultConfig {
|
|
34
|
+
/** Percentage of token supply for vault (1-90%) */
|
|
35
|
+
percentage: number;
|
|
36
|
+
/** Lockup duration in seconds (minimum 7 days = 604800) */
|
|
37
|
+
lockupDuration: number;
|
|
38
|
+
/** Vesting duration in seconds after lockup (0 = instant unlock after lockup) */
|
|
39
|
+
vestingDuration?: number;
|
|
40
|
+
/** Recipient who can claim after lockup */
|
|
41
|
+
recipient: Address;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* AirdropV2 configuration (optional)
|
|
45
|
+
*/
|
|
46
|
+
export interface AirdropConfig {
|
|
47
|
+
/** Percentage of token supply for airdrop (1-90%) */
|
|
48
|
+
percentage: number;
|
|
49
|
+
/** Admin who can update merkle root */
|
|
50
|
+
admin: Address;
|
|
51
|
+
/** Merkle root for claims (can be bytes32(0) initially) */
|
|
52
|
+
merkleRoot: `0x${string}`;
|
|
53
|
+
/** Lockup duration in seconds (minimum 1 day) */
|
|
54
|
+
lockupDuration: number;
|
|
55
|
+
/** Vesting duration in seconds (0 = instant) */
|
|
56
|
+
vestingDuration: number;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* DevBuy configuration (optional - buy tokens at launch with ETH)
|
|
60
|
+
* Tokens are transferred immediately to recipient (no vesting)
|
|
61
|
+
*/
|
|
62
|
+
export interface DevBuyConfig {
|
|
63
|
+
/** ETH amount to spend on dev buy */
|
|
64
|
+
ethAmount: bigint;
|
|
65
|
+
/** Recipient of purchased tokens */
|
|
66
|
+
recipient: Address;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Vested DevBuy configuration (optional - buy tokens at launch with vesting)
|
|
70
|
+
* Tokens are held in the VestedDevBuy contract and vest linearly after lockup
|
|
71
|
+
*/
|
|
72
|
+
export interface VestedDevBuyConfig {
|
|
73
|
+
/** ETH amount to spend on dev buy */
|
|
74
|
+
ethAmount: bigint;
|
|
75
|
+
/** Recipient who can claim tokens after vesting */
|
|
76
|
+
recipient: Address;
|
|
77
|
+
/** Lockup duration in seconds before any tokens can be claimed (minimum 7 days = 604800) */
|
|
78
|
+
lockupDuration: number;
|
|
79
|
+
/** Vesting duration in seconds after lockup (minimum 30 days = 2592000, maximum 365 days = 31536000) */
|
|
80
|
+
vestingDuration: number;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Token metadata
|
|
84
|
+
*/
|
|
85
|
+
export interface TokenMetadata {
|
|
86
|
+
description?: string;
|
|
87
|
+
socialMediaUrls?: Array<{
|
|
88
|
+
platform: string;
|
|
89
|
+
url: string;
|
|
90
|
+
}>;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Token context
|
|
94
|
+
*/
|
|
95
|
+
export interface TokenContext {
|
|
96
|
+
interface?: string;
|
|
97
|
+
platform?: string;
|
|
98
|
+
messageId?: string;
|
|
99
|
+
id?: string;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* MEV protection configuration
|
|
103
|
+
*/
|
|
104
|
+
export interface MevConfig {
|
|
105
|
+
/** Starting fee in pips (default 800000 = 80%) */
|
|
106
|
+
startingFee?: number;
|
|
107
|
+
/** Ending fee in pips (default 50000 = 5%) */
|
|
108
|
+
endingFee?: number;
|
|
109
|
+
/** Seconds for fee to decay (default 30) */
|
|
110
|
+
decaySeconds?: number;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Vanity address configuration
|
|
114
|
+
*/
|
|
115
|
+
export interface VanityConfig {
|
|
116
|
+
/** Whether to mine for a vanity address (default: true for 'ccc' prefix) */
|
|
117
|
+
enabled?: boolean;
|
|
118
|
+
/** Desired prefix (default: 'ccc' for 0xccc...) */
|
|
119
|
+
prefix?: string;
|
|
120
|
+
/** Maximum mining attempts (default: 10,000,000) */
|
|
121
|
+
maxAttempts?: number;
|
|
122
|
+
/** Progress callback */
|
|
123
|
+
onProgress?: (attempts: number, rate: number) => void;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Token deployment options
|
|
127
|
+
*/
|
|
128
|
+
export interface DeployOptions {
|
|
129
|
+
name: string;
|
|
130
|
+
symbol: string;
|
|
131
|
+
/** Address that can update token metadata */
|
|
132
|
+
tokenAdmin: Address;
|
|
133
|
+
/** Image URL for token */
|
|
134
|
+
image?: string;
|
|
135
|
+
/** Token metadata (description, social links) */
|
|
136
|
+
metadata?: TokenMetadata;
|
|
137
|
+
/** Deployment context */
|
|
138
|
+
context?: TokenContext;
|
|
139
|
+
/** Reward configuration (who receives LP fees) */
|
|
140
|
+
rewards: {
|
|
141
|
+
recipients: RewardRecipient[];
|
|
142
|
+
};
|
|
143
|
+
/** Optional vault allocation */
|
|
144
|
+
vault?: VaultConfig;
|
|
145
|
+
/** Optional airdrop allocation */
|
|
146
|
+
airdrop?: AirdropConfig;
|
|
147
|
+
/** Optional dev buy at launch (instant transfer) */
|
|
148
|
+
devBuy?: DevBuyConfig;
|
|
149
|
+
/** Optional vested dev buy at launch (with lockup + vesting) */
|
|
150
|
+
vestedDevBuy?: VestedDevBuyConfig;
|
|
151
|
+
/** Starting tick (default -196618 ≈ $0.00001) */
|
|
152
|
+
startingTick?: number;
|
|
153
|
+
/** Tick spacing (default 200) */
|
|
154
|
+
tickSpacing?: number;
|
|
155
|
+
/** MEV protection config */
|
|
156
|
+
mevConfig?: MevConfig;
|
|
157
|
+
/** LP fee in pips (default 10000 = 1%) */
|
|
158
|
+
lpFee?: number;
|
|
159
|
+
/** Vanity address configuration (default: enabled with 'ccc' prefix) */
|
|
160
|
+
vanity?: VanityConfig;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Deployment result
|
|
164
|
+
*/
|
|
165
|
+
export interface DeployResult {
|
|
166
|
+
/** Transaction hash (undefined if error) */
|
|
167
|
+
txHash: Hash | undefined;
|
|
168
|
+
/** Wait for transaction and get token address */
|
|
169
|
+
waitForTransaction: () => Promise<{
|
|
170
|
+
address: Address | undefined;
|
|
171
|
+
}>;
|
|
172
|
+
/** Error if deployment failed */
|
|
173
|
+
error: Error | undefined;
|
|
174
|
+
/** Vanity mining result (if vanity was enabled) */
|
|
175
|
+
vanityResult?: VanityMineResult;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Deployer configuration
|
|
179
|
+
*/
|
|
180
|
+
export interface DeployerConfig {
|
|
181
|
+
/** Wallet client for signing transactions */
|
|
182
|
+
wallet?: WalletClient<Transport, Chain, Account>;
|
|
183
|
+
/** Public client for reading chain data */
|
|
184
|
+
publicClient?: PublicClient;
|
|
185
|
+
/** Network to deploy on */
|
|
186
|
+
network: NetworkName;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* ClawnchDeployer - Deploy tokens on Base with Uniswap V4 pools
|
|
190
|
+
*
|
|
191
|
+
* @example
|
|
192
|
+
* ```typescript
|
|
193
|
+
* import { ClawnchDeployer } from '@clawnch/clawncher-sdk';
|
|
194
|
+
* import { createWalletClient, createPublicClient, http } from 'viem';
|
|
195
|
+
* import { privateKeyToAccount } from 'viem/accounts';
|
|
196
|
+
* import { baseSepolia } from 'viem/chains';
|
|
197
|
+
*
|
|
198
|
+
* const account = privateKeyToAccount('0x...');
|
|
199
|
+
* const wallet = createWalletClient({
|
|
200
|
+
* account,
|
|
201
|
+
* chain: baseSepolia,
|
|
202
|
+
* transport: http(),
|
|
203
|
+
* });
|
|
204
|
+
* const publicClient = createPublicClient({
|
|
205
|
+
* chain: baseSepolia,
|
|
206
|
+
* transport: http(),
|
|
207
|
+
* });
|
|
208
|
+
*
|
|
209
|
+
* const deployer = new ClawnchDeployer({
|
|
210
|
+
* wallet,
|
|
211
|
+
* publicClient,
|
|
212
|
+
* network: 'sepolia',
|
|
213
|
+
* });
|
|
214
|
+
*
|
|
215
|
+
* const result = await deployer.deploy({
|
|
216
|
+
* name: 'My Token',
|
|
217
|
+
* symbol: 'MYTKN',
|
|
218
|
+
* tokenAdmin: account.address,
|
|
219
|
+
* rewards: {
|
|
220
|
+
* recipients: [{
|
|
221
|
+
* recipient: account.address,
|
|
222
|
+
* admin: account.address,
|
|
223
|
+
* bps: 10000,
|
|
224
|
+
* feePreference: 'Paired',
|
|
225
|
+
* }],
|
|
226
|
+
* },
|
|
227
|
+
* });
|
|
228
|
+
*
|
|
229
|
+
* const { address } = await result.waitForTransaction();
|
|
230
|
+
* console.log('Token deployed:', address);
|
|
231
|
+
* ```
|
|
232
|
+
*/
|
|
233
|
+
export declare class ClawnchDeployer {
|
|
234
|
+
readonly wallet?: WalletClient<Transport, Chain, Account>;
|
|
235
|
+
readonly publicClient?: PublicClient;
|
|
236
|
+
readonly network: NetworkName;
|
|
237
|
+
constructor(config: DeployerConfig);
|
|
238
|
+
/**
|
|
239
|
+
* Get contract addresses for configured network
|
|
240
|
+
*/
|
|
241
|
+
getAddresses(): import("./addresses.js").NetworkAddresses;
|
|
242
|
+
/**
|
|
243
|
+
* Get the chain for the configured network
|
|
244
|
+
*/
|
|
245
|
+
getChain(): Chain;
|
|
246
|
+
/**
|
|
247
|
+
* Check if deployer is properly configured
|
|
248
|
+
*/
|
|
249
|
+
isConfigured(): boolean;
|
|
250
|
+
/**
|
|
251
|
+
* Deploy a new token
|
|
252
|
+
*/
|
|
253
|
+
deploy(options: DeployOptions): Promise<DeployResult>;
|
|
254
|
+
}
|
|
255
|
+
//# sourceMappingURL=deployer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deployer.d.ts","sourceRoot":"","sources":["../src/deployer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,KAAK,EACV,KAAK,OAAO,EACZ,KAAK,SAAS,EACd,KAAK,IAAI,EACT,KAAK,OAAO,EAOb,MAAM,MAAM,CAAC;AAGd,OAAO,EAAgB,KAAK,WAAW,EAAkB,MAAM,gBAAgB,CAAC;AAChF,OAAO,EAIL,KAAK,gBAAgB,EACtB,MAAM,aAAa,CAAC;AAErB;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,CAAC;AAE1D;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;IACf,gDAAgD;IAChD,GAAG,EAAE,MAAM,CAAC;IACZ,yFAAyF;IACzF,aAAa,CAAC,EAAE,aAAa,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,mDAAmD;IACnD,UAAU,EAAE,MAAM,CAAC;IACnB,2DAA2D;IAC3D,cAAc,EAAE,MAAM,CAAC;IACvB,iFAAiF;IACjF,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,2CAA2C;IAC3C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S,CAAC;IACzB,iDAAiD;IACjD,kBAAkB,EAAE,MAAM,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,GAAG,SAAS,CAAA;KAAE,CAAC,CAAC;IACpE,iCAAiC;IACjC,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC;IACzB,mDAAmD;IACnD,YAAY,CAAC,EAAE,gBAAgB,CAAC;CACjC;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,6CAA6C;IAC7C,MAAM,CAAC,EAAE,YAAY,CAAC,SAAS,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IACjD,2CAA2C;IAC3C,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,2BAA2B;IAC3B,OAAO,EAAE,WAAW,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,qBAAa,eAAe;IAC1B,QAAQ,CAAC,MAAM,CAAC,EAAE,YAAY,CAAC,SAAS,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IAC1D,QAAQ,CAAC,YAAY,CAAC,EAAE,YAAY,CAAC;IACrC,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;gBAElB,MAAM,EAAE,cAAc;IAUlC;;OAEG;IACH,YAAY;IAIZ;;OAEG;IACH,QAAQ,IAAI,KAAK;IAIjB;;OAEG;IACH,YAAY,IAAI,OAAO;IASvB;;OAEG;IACG,MAAM,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC;CAiX5D"}
|
package/dist/deployer.js
ADDED
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ClawnchDeployer - Direct contract interaction for Clawncher token deployment
|
|
3
|
+
*
|
|
4
|
+
* Deploy tokens on Base with Uniswap V4 liquidity pools.
|
|
5
|
+
*
|
|
6
|
+
* Fee structure:
|
|
7
|
+
* - 1% LP fee per swap
|
|
8
|
+
* - 80% to reward recipients (default: in token)
|
|
9
|
+
* - 20% protocol (Clawncher, in WETH)
|
|
10
|
+
* - MEV protection: 80% fee decaying to 5% over 30 seconds
|
|
11
|
+
*/
|
|
12
|
+
import { encodeAbiParameters, parseAbiParameters, keccak256, toHex, decodeEventLog, } from 'viem';
|
|
13
|
+
import { base, baseSepolia } from 'viem/chains';
|
|
14
|
+
import { ClawnchFactoryABI } from './abis.js';
|
|
15
|
+
import { getAddresses, isMainnetReady } from './addresses.js';
|
|
16
|
+
import { mineVanityAddress, computeInitCodeHash, DEFAULT_VANITY_PREFIX, } from './vanity.js';
|
|
17
|
+
/**
|
|
18
|
+
* ClawnchDeployer - Deploy tokens on Base with Uniswap V4 pools
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* import { ClawnchDeployer } from '@clawnch/clawncher-sdk';
|
|
23
|
+
* import { createWalletClient, createPublicClient, http } from 'viem';
|
|
24
|
+
* import { privateKeyToAccount } from 'viem/accounts';
|
|
25
|
+
* import { baseSepolia } from 'viem/chains';
|
|
26
|
+
*
|
|
27
|
+
* const account = privateKeyToAccount('0x...');
|
|
28
|
+
* const wallet = createWalletClient({
|
|
29
|
+
* account,
|
|
30
|
+
* chain: baseSepolia,
|
|
31
|
+
* transport: http(),
|
|
32
|
+
* });
|
|
33
|
+
* const publicClient = createPublicClient({
|
|
34
|
+
* chain: baseSepolia,
|
|
35
|
+
* transport: http(),
|
|
36
|
+
* });
|
|
37
|
+
*
|
|
38
|
+
* const deployer = new ClawnchDeployer({
|
|
39
|
+
* wallet,
|
|
40
|
+
* publicClient,
|
|
41
|
+
* network: 'sepolia',
|
|
42
|
+
* });
|
|
43
|
+
*
|
|
44
|
+
* const result = await deployer.deploy({
|
|
45
|
+
* name: 'My Token',
|
|
46
|
+
* symbol: 'MYTKN',
|
|
47
|
+
* tokenAdmin: account.address,
|
|
48
|
+
* rewards: {
|
|
49
|
+
* recipients: [{
|
|
50
|
+
* recipient: account.address,
|
|
51
|
+
* admin: account.address,
|
|
52
|
+
* bps: 10000,
|
|
53
|
+
* feePreference: 'Paired',
|
|
54
|
+
* }],
|
|
55
|
+
* },
|
|
56
|
+
* });
|
|
57
|
+
*
|
|
58
|
+
* const { address } = await result.waitForTransaction();
|
|
59
|
+
* console.log('Token deployed:', address);
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
export class ClawnchDeployer {
|
|
63
|
+
wallet;
|
|
64
|
+
publicClient;
|
|
65
|
+
network;
|
|
66
|
+
constructor(config) {
|
|
67
|
+
this.wallet = config.wallet;
|
|
68
|
+
this.publicClient = config.publicClient;
|
|
69
|
+
this.network = config.network;
|
|
70
|
+
if (config.network === 'mainnet' && !isMainnetReady()) {
|
|
71
|
+
console.warn('Warning: Mainnet contracts not yet deployed. Use sepolia for testing.');
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Get contract addresses for configured network
|
|
76
|
+
*/
|
|
77
|
+
getAddresses() {
|
|
78
|
+
return getAddresses(this.network);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Get the chain for the configured network
|
|
82
|
+
*/
|
|
83
|
+
getChain() {
|
|
84
|
+
return this.network === 'mainnet' ? base : baseSepolia;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Check if deployer is properly configured
|
|
88
|
+
*/
|
|
89
|
+
isConfigured() {
|
|
90
|
+
const addresses = this.getAddresses();
|
|
91
|
+
return !!(addresses.clawnch.factory &&
|
|
92
|
+
addresses.clawnch.factory !== '0x0000000000000000000000000000000000000000' &&
|
|
93
|
+
this.wallet);
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Deploy a new token
|
|
97
|
+
*/
|
|
98
|
+
async deploy(options) {
|
|
99
|
+
if (!this.wallet) {
|
|
100
|
+
return {
|
|
101
|
+
txHash: undefined,
|
|
102
|
+
waitForTransaction: async () => ({ address: undefined }),
|
|
103
|
+
error: new Error('Wallet not configured'),
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
const addresses = this.getAddresses();
|
|
107
|
+
const chain = this.getChain();
|
|
108
|
+
if (addresses.clawnch.factory === '0x0000000000000000000000000000000000000000') {
|
|
109
|
+
return {
|
|
110
|
+
txHash: undefined,
|
|
111
|
+
waitForTransaction: async () => ({ address: undefined }),
|
|
112
|
+
error: new Error(`Contracts not deployed on ${this.network}`),
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
try {
|
|
116
|
+
// Validate reward recipients
|
|
117
|
+
const totalBps = options.rewards.recipients.reduce((sum, r) => sum + r.bps, 0);
|
|
118
|
+
if (totalBps !== 10000) {
|
|
119
|
+
return {
|
|
120
|
+
txHash: undefined,
|
|
121
|
+
waitForTransaction: async () => ({ address: undefined }),
|
|
122
|
+
error: new Error(`Reward bps must sum to 10000, got ${totalBps}`),
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
// Serialize metadata/context (needed for init code hash)
|
|
126
|
+
const metadataJson = options.metadata ? JSON.stringify(options.metadata) : '';
|
|
127
|
+
const contextJson = options.context ? JSON.stringify(options.context) : '';
|
|
128
|
+
// Determine if vanity mining is enabled (default: true)
|
|
129
|
+
const vanityEnabled = options.vanity?.enabled !== false;
|
|
130
|
+
const vanityPrefix = options.vanity?.prefix ?? DEFAULT_VANITY_PREFIX;
|
|
131
|
+
let salt;
|
|
132
|
+
let vanityResult;
|
|
133
|
+
if (vanityEnabled) {
|
|
134
|
+
// Compute init code hash for this specific token
|
|
135
|
+
const initCodeHash = computeInitCodeHash({
|
|
136
|
+
name: options.name,
|
|
137
|
+
symbol: options.symbol,
|
|
138
|
+
maxSupply: 100000000000n * 10n ** 18n, // 100B with 18 decimals
|
|
139
|
+
admin: options.tokenAdmin,
|
|
140
|
+
image: options.image ?? '',
|
|
141
|
+
metadata: metadataJson,
|
|
142
|
+
context: contextJson,
|
|
143
|
+
initialSupplyChainId: BigInt(chain.id),
|
|
144
|
+
});
|
|
145
|
+
// Mine for vanity address
|
|
146
|
+
vanityResult = await mineVanityAddress({
|
|
147
|
+
factory: addresses.clawnch.factory,
|
|
148
|
+
tokenAdmin: options.tokenAdmin,
|
|
149
|
+
initCodeHash,
|
|
150
|
+
prefix: vanityPrefix,
|
|
151
|
+
maxAttempts: options.vanity?.maxAttempts,
|
|
152
|
+
onProgress: options.vanity?.onProgress,
|
|
153
|
+
});
|
|
154
|
+
salt = vanityResult.salt;
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
// Generate random salt (no vanity)
|
|
158
|
+
salt = keccak256(toHex(`${options.symbol}-${Date.now()}-${Math.random()}`));
|
|
159
|
+
}
|
|
160
|
+
// Build reward arrays
|
|
161
|
+
const rewardAdmins = options.rewards.recipients.map(r => r.admin);
|
|
162
|
+
const rewardRecipients = options.rewards.recipients.map(r => r.recipient);
|
|
163
|
+
const rewardBps = options.rewards.recipients.map(r => r.bps);
|
|
164
|
+
// Encode fee preferences (FeeIn enum: 0=Both, 1=Paired, 2=Clawnch)
|
|
165
|
+
// Default: Clawnch (receive fees in the launched token)
|
|
166
|
+
const feePreferences = options.rewards.recipients.map(r => {
|
|
167
|
+
switch (r.feePreference) {
|
|
168
|
+
case 'Both': return 0;
|
|
169
|
+
case 'Paired': return 1;
|
|
170
|
+
case 'Clawnch': return 2;
|
|
171
|
+
default: return 2; // Default to Clawnch (the token)
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
const lockerData = encodeAbiParameters(parseAbiParameters('(uint8[])'), [[feePreferences]]);
|
|
175
|
+
// Pool configuration
|
|
176
|
+
const startingTick = options.startingTick ?? -196618;
|
|
177
|
+
const tickSpacing = options.tickSpacing ?? 200;
|
|
178
|
+
const lpFee = options.lpFee ?? 10000; // 1% default
|
|
179
|
+
// Full tick range for liquidity
|
|
180
|
+
const tickLower = [-887200]; // MIN_TICK
|
|
181
|
+
const tickUpper = [887200]; // MAX_TICK
|
|
182
|
+
const positionBps = [10000]; // 100% in single position
|
|
183
|
+
// Pool data (fee config)
|
|
184
|
+
const poolData = encodeAbiParameters(parseAbiParameters('(address, bytes, bytes)'), [[
|
|
185
|
+
'0x0000000000000000000000000000000000000000', // no extension
|
|
186
|
+
'0x', // no extension data
|
|
187
|
+
encodeAbiParameters(parseAbiParameters('(uint24, uint24)'), [[lpFee, lpFee]]),
|
|
188
|
+
]]);
|
|
189
|
+
// MEV module data
|
|
190
|
+
const mevStartingFee = options.mevConfig?.startingFee ?? 800000;
|
|
191
|
+
const mevEndingFee = options.mevConfig?.endingFee ?? 50000;
|
|
192
|
+
const mevDecaySeconds = options.mevConfig?.decaySeconds ?? 30;
|
|
193
|
+
const mevModuleData = encodeAbiParameters(parseAbiParameters('(uint24, uint24, uint256)'), [[mevStartingFee, mevEndingFee, BigInt(mevDecaySeconds)]]);
|
|
194
|
+
// Build extension configs
|
|
195
|
+
const extensionConfigs = [];
|
|
196
|
+
let totalExtensionValue = 0n;
|
|
197
|
+
// Add vault extension if configured
|
|
198
|
+
if (options.vault && options.vault.percentage > 0) {
|
|
199
|
+
const vaultData = encodeAbiParameters(parseAbiParameters('(address, uint256, uint256)'), [[
|
|
200
|
+
options.vault.recipient,
|
|
201
|
+
BigInt(options.vault.lockupDuration),
|
|
202
|
+
BigInt(options.vault.vestingDuration ?? 0), // vesting duration after lockup
|
|
203
|
+
]]);
|
|
204
|
+
extensionConfigs.push({
|
|
205
|
+
extension: addresses.clawnch.vault,
|
|
206
|
+
msgValue: 0n,
|
|
207
|
+
extensionBps: options.vault.percentage * 100,
|
|
208
|
+
extensionData: vaultData,
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
// Add airdrop extension if configured
|
|
212
|
+
if (options.airdrop && options.airdrop.percentage > 0) {
|
|
213
|
+
const airdropData = encodeAbiParameters(parseAbiParameters('(address, bytes32, uint256, uint256)'), [[
|
|
214
|
+
options.airdrop.admin,
|
|
215
|
+
options.airdrop.merkleRoot,
|
|
216
|
+
BigInt(options.airdrop.lockupDuration),
|
|
217
|
+
BigInt(options.airdrop.vestingDuration),
|
|
218
|
+
]]);
|
|
219
|
+
extensionConfigs.push({
|
|
220
|
+
extension: addresses.clawnch.airdropV2,
|
|
221
|
+
msgValue: 0n,
|
|
222
|
+
extensionBps: options.airdrop.percentage * 100,
|
|
223
|
+
extensionData: airdropData,
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
// Add dev buy extension if configured
|
|
227
|
+
if (options.devBuy && options.devBuy.ethAmount > 0n) {
|
|
228
|
+
const emptyPoolKey = {
|
|
229
|
+
currency0: '0x0000000000000000000000000000000000000000',
|
|
230
|
+
currency1: '0x0000000000000000000000000000000000000000',
|
|
231
|
+
fee: 0,
|
|
232
|
+
tickSpacing: 0,
|
|
233
|
+
hooks: '0x0000000000000000000000000000000000000000',
|
|
234
|
+
};
|
|
235
|
+
const devBuyData = encodeAbiParameters(parseAbiParameters('((address, address, uint24, int24, address), uint128, address)'), [[
|
|
236
|
+
[
|
|
237
|
+
emptyPoolKey.currency0,
|
|
238
|
+
emptyPoolKey.currency1,
|
|
239
|
+
emptyPoolKey.fee,
|
|
240
|
+
emptyPoolKey.tickSpacing,
|
|
241
|
+
emptyPoolKey.hooks,
|
|
242
|
+
],
|
|
243
|
+
0n,
|
|
244
|
+
options.devBuy.recipient,
|
|
245
|
+
]]);
|
|
246
|
+
extensionConfigs.push({
|
|
247
|
+
extension: addresses.clawnch.devBuy,
|
|
248
|
+
msgValue: options.devBuy.ethAmount,
|
|
249
|
+
extensionBps: 0,
|
|
250
|
+
extensionData: devBuyData,
|
|
251
|
+
});
|
|
252
|
+
totalExtensionValue += options.devBuy.ethAmount;
|
|
253
|
+
}
|
|
254
|
+
// Add vested dev buy extension if configured
|
|
255
|
+
if (options.vestedDevBuy && options.vestedDevBuy.ethAmount > 0n) {
|
|
256
|
+
// Validate vesting parameters
|
|
257
|
+
const MIN_LOCKUP = 7 * 24 * 60 * 60; // 7 days
|
|
258
|
+
const MIN_VESTING = 30 * 24 * 60 * 60; // 30 days
|
|
259
|
+
const MAX_VESTING = 365 * 24 * 60 * 60; // 365 days
|
|
260
|
+
if (options.vestedDevBuy.lockupDuration < MIN_LOCKUP) {
|
|
261
|
+
return {
|
|
262
|
+
txHash: undefined,
|
|
263
|
+
waitForTransaction: async () => ({ address: undefined }),
|
|
264
|
+
error: new Error(`Lockup duration must be at least 7 days (${MIN_LOCKUP} seconds)`),
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
if (options.vestedDevBuy.vestingDuration < MIN_VESTING || options.vestedDevBuy.vestingDuration > MAX_VESTING) {
|
|
268
|
+
return {
|
|
269
|
+
txHash: undefined,
|
|
270
|
+
waitForTransaction: async () => ({ address: undefined }),
|
|
271
|
+
error: new Error(`Vesting duration must be between 30 and 365 days (${MIN_VESTING}-${MAX_VESTING} seconds)`),
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
if (addresses.clawnch.vestedDevBuy === '0x0000000000000000000000000000000000000000') {
|
|
275
|
+
return {
|
|
276
|
+
txHash: undefined,
|
|
277
|
+
waitForTransaction: async () => ({ address: undefined }),
|
|
278
|
+
error: new Error(`VestedDevBuy extension not deployed on ${this.network}`),
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
const emptyPoolKey = {
|
|
282
|
+
currency0: '0x0000000000000000000000000000000000000000',
|
|
283
|
+
currency1: '0x0000000000000000000000000000000000000000',
|
|
284
|
+
fee: 0,
|
|
285
|
+
tickSpacing: 0,
|
|
286
|
+
hooks: '0x0000000000000000000000000000000000000000',
|
|
287
|
+
};
|
|
288
|
+
// VestedDevBuyExtensionData: (PoolKey, uint128, address, uint256, uint256)
|
|
289
|
+
const vestedDevBuyData = encodeAbiParameters(parseAbiParameters('((address, address, uint24, int24, address), uint128, address, uint256, uint256)'), [[
|
|
290
|
+
[
|
|
291
|
+
emptyPoolKey.currency0,
|
|
292
|
+
emptyPoolKey.currency1,
|
|
293
|
+
emptyPoolKey.fee,
|
|
294
|
+
emptyPoolKey.tickSpacing,
|
|
295
|
+
emptyPoolKey.hooks,
|
|
296
|
+
],
|
|
297
|
+
0n, // pairedTokenAmountOutMinimum
|
|
298
|
+
options.vestedDevBuy.recipient,
|
|
299
|
+
BigInt(options.vestedDevBuy.lockupDuration),
|
|
300
|
+
BigInt(options.vestedDevBuy.vestingDuration),
|
|
301
|
+
]]);
|
|
302
|
+
extensionConfigs.push({
|
|
303
|
+
extension: addresses.clawnch.vestedDevBuy,
|
|
304
|
+
msgValue: options.vestedDevBuy.ethAmount,
|
|
305
|
+
extensionBps: 0,
|
|
306
|
+
extensionData: vestedDevBuyData,
|
|
307
|
+
});
|
|
308
|
+
totalExtensionValue += options.vestedDevBuy.ethAmount;
|
|
309
|
+
}
|
|
310
|
+
// Build deployment config
|
|
311
|
+
const deploymentConfig = {
|
|
312
|
+
tokenConfig: {
|
|
313
|
+
tokenAdmin: options.tokenAdmin,
|
|
314
|
+
name: options.name,
|
|
315
|
+
symbol: options.symbol,
|
|
316
|
+
salt,
|
|
317
|
+
image: options.image ?? '',
|
|
318
|
+
metadata: metadataJson,
|
|
319
|
+
context: contextJson,
|
|
320
|
+
originatingChainId: BigInt(chain.id),
|
|
321
|
+
},
|
|
322
|
+
poolConfig: {
|
|
323
|
+
hook: addresses.clawnch.hook,
|
|
324
|
+
pairedToken: addresses.infrastructure.weth,
|
|
325
|
+
tickIfToken0IsClawnch: startingTick,
|
|
326
|
+
tickSpacing,
|
|
327
|
+
poolData,
|
|
328
|
+
},
|
|
329
|
+
lockerConfig: {
|
|
330
|
+
locker: addresses.clawnch.locker,
|
|
331
|
+
rewardAdmins,
|
|
332
|
+
rewardRecipients,
|
|
333
|
+
rewardBps,
|
|
334
|
+
tickLower,
|
|
335
|
+
tickUpper,
|
|
336
|
+
positionBps,
|
|
337
|
+
lockerData,
|
|
338
|
+
},
|
|
339
|
+
mevModuleConfig: {
|
|
340
|
+
mevModule: addresses.clawnch.mevModule,
|
|
341
|
+
mevModuleData,
|
|
342
|
+
},
|
|
343
|
+
extensionConfigs,
|
|
344
|
+
};
|
|
345
|
+
// Send transaction
|
|
346
|
+
const txHash = await this.wallet.writeContract({
|
|
347
|
+
address: addresses.clawnch.factory,
|
|
348
|
+
abi: ClawnchFactoryABI,
|
|
349
|
+
functionName: 'deployToken',
|
|
350
|
+
args: [deploymentConfig],
|
|
351
|
+
chain,
|
|
352
|
+
value: totalExtensionValue,
|
|
353
|
+
});
|
|
354
|
+
return {
|
|
355
|
+
txHash,
|
|
356
|
+
waitForTransaction: async () => {
|
|
357
|
+
if (!this.publicClient) {
|
|
358
|
+
throw new Error('Public client not configured');
|
|
359
|
+
}
|
|
360
|
+
const receipt = await this.publicClient.waitForTransactionReceipt({
|
|
361
|
+
hash: txHash,
|
|
362
|
+
});
|
|
363
|
+
// Find TokenCreated event
|
|
364
|
+
for (const log of receipt.logs) {
|
|
365
|
+
try {
|
|
366
|
+
const decoded = decodeEventLog({
|
|
367
|
+
abi: ClawnchFactoryABI,
|
|
368
|
+
data: log.data,
|
|
369
|
+
topics: log.topics,
|
|
370
|
+
});
|
|
371
|
+
if (decoded.eventName === 'TokenCreated') {
|
|
372
|
+
return { address: decoded.args.tokenAddress };
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
catch {
|
|
376
|
+
// Not our event
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
if (receipt.status === 'success') {
|
|
380
|
+
console.warn('TokenCreated event not found, but transaction succeeded');
|
|
381
|
+
}
|
|
382
|
+
return { address: undefined };
|
|
383
|
+
},
|
|
384
|
+
error: undefined,
|
|
385
|
+
vanityResult,
|
|
386
|
+
};
|
|
387
|
+
}
|
|
388
|
+
catch (err) {
|
|
389
|
+
return {
|
|
390
|
+
txHash: undefined,
|
|
391
|
+
waitForTransaction: async () => ({ address: undefined }),
|
|
392
|
+
error: err instanceof Error ? err : new Error(String(err)),
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
//# sourceMappingURL=deployer.js.map
|
|
@@ -0,0 +1 @@
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