@flaunch/sdk 0.7.0 → 0.8.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 +8 -8
- package/dist/abi/AnyPositionManager.d.ts +1922 -0
- package/dist/abi/AnyPositionManager.d.ts.map +1 -0
- package/dist/abi/FeeEscrow.d.ts +282 -0
- package/dist/abi/FeeEscrow.d.ts.map +1 -0
- package/dist/abi/ReferralEscrow.d.ts +321 -0
- package/dist/abi/ReferralEscrow.d.ts.map +1 -0
- package/dist/abi/index.cjs +10989 -1717
- package/dist/abi/index.cjs.map +1 -1
- package/dist/abi/index.d.ts +18 -0
- package/dist/abi/index.d.ts.map +1 -1
- package/dist/abi/index.js +10972 -1718
- package/dist/abi/index.js.map +1 -1
- package/dist/addresses/index.cjs +16 -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.ts +3 -0
- package/dist/addresses.d.ts.map +1 -1
- package/dist/clients/AnyPositionManagerClient.d.ts +87 -0
- package/dist/clients/AnyPositionManagerClient.d.ts.map +1 -0
- package/dist/clients/FairLaunchClient.d.ts +3 -0
- package/dist/clients/FairLaunchClient.d.ts.map +1 -1
- package/dist/clients/FeeEscrowClient.d.ts +39 -0
- package/dist/clients/FeeEscrowClient.d.ts.map +1 -0
- package/dist/clients/FlaunchPositionManagerClient.d.ts +12 -0
- package/dist/clients/FlaunchPositionManagerClient.d.ts.map +1 -1
- package/dist/clients/InitialPriceClient.d.ts +4 -0
- package/dist/clients/InitialPriceClient.d.ts.map +1 -1
- package/dist/clients/MemecoinClient.d.ts +5 -0
- package/dist/clients/MemecoinClient.d.ts.map +1 -1
- package/dist/clients/QuoterClient.d.ts +6 -6
- package/dist/clients/QuoterClient.d.ts.map +1 -1
- package/dist/clients/ReferralEscrowClient.d.ts +40 -0
- package/dist/clients/ReferralEscrowClient.d.ts.map +1 -0
- package/dist/hooks/index.cjs +2 -2
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.js +2 -2
- package/dist/hooks/index.js.map +1 -1
- package/dist/index.cjs.js +2863 -395
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +2863 -417
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/sdk/FlaunchSDK.d.ts +136 -90
- package/dist/sdk/FlaunchSDK.d.ts.map +1 -1
- package/dist/sdk/drift.d.ts +21 -0
- package/dist/sdk/drift.d.ts.map +1 -0
- package/dist/types.d.ts +9 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/universalRouter.d.ts +2 -2
- package/dist/utils/universalRouter.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -5315,6 +5315,7 @@ const sourceId = 5; // goerli
|
|
|
5315
5315
|
testnet: true,
|
|
5316
5316
|
});
|
|
5317
5317
|
|
|
5318
|
+
// doesn't use FeeEscrow
|
|
5318
5319
|
const FlaunchPositionManagerAddress = {
|
|
5319
5320
|
[base.id]: "0x51Bba15255406Cfe7099a42183302640ba7dAFDC",
|
|
5320
5321
|
[baseSepolia.id]: "0x9A7059cA00dA92843906Cb4bCa1D005cE848AFdC",
|
|
@@ -5323,6 +5324,18 @@ const FlaunchPositionManagerV1_1Address = {
|
|
|
5323
5324
|
[base.id]: "0xf785bb58059fab6fb19bdda2cb9078d9e546efdc",
|
|
5324
5325
|
[baseSepolia.id]: "0x24347e0dd16357059abfc1b321df354873552fdc",
|
|
5325
5326
|
};
|
|
5327
|
+
const AnyPositionManagerAddress = {
|
|
5328
|
+
[base.id]: "0x69a96de474521f7c6c0be3ea0498e5cf2f0565dc",
|
|
5329
|
+
[baseSepolia.id]: "0xe999c5676b0e0f83292074441292f4b3b11d65dc",
|
|
5330
|
+
};
|
|
5331
|
+
const FeeEscrowAddress = {
|
|
5332
|
+
[base.id]: "0x72e6f7948b1B1A343B477F39aAbd2E35E6D27dde",
|
|
5333
|
+
[baseSepolia.id]: "0x73E27908b7d35A9251a54799A8ef4C17e4ED9FF9",
|
|
5334
|
+
};
|
|
5335
|
+
const ReferralEscrowAddress = {
|
|
5336
|
+
[base.id]: "0xBD39c7Be6D98BD1a3e4Ad482baF99d738947fE55",
|
|
5337
|
+
[baseSepolia.id]: "0x0651cadC51b6a13CB3465C134A22154a2b633779",
|
|
5338
|
+
};
|
|
5326
5339
|
const FLETHAddress = {
|
|
5327
5340
|
[base.id]: "0x000000000D564D5be76f7f0d28fE52605afC7Cf8",
|
|
5328
5341
|
[baseSepolia.id]: "0x79FC52701cD4BE6f9Ba9aDC94c207DE37e3314eb",
|
|
@@ -7384,9 +7397,7 @@ const ETH = viem.zeroAddress;
|
|
|
7384
7397
|
const ethToMemecoin = (params) => {
|
|
7385
7398
|
const flETH = FLETHAddress[params.chainId];
|
|
7386
7399
|
const flETHHooks = FLETHHooksAddress[params.chainId];
|
|
7387
|
-
const flaunchHooks = params.
|
|
7388
|
-
? FlaunchPositionManagerAddress[params.chainId]
|
|
7389
|
-
: FlaunchPositionManagerV1_1Address[params.chainId];
|
|
7400
|
+
const flaunchHooks = params.positionManagerAddress;
|
|
7390
7401
|
// Determine actions based on swapType
|
|
7391
7402
|
const v4Actions = ("0x" +
|
|
7392
7403
|
(params.swapType === "EXACT_IN"
|
|
@@ -7521,9 +7532,7 @@ const ethToMemecoin = (params) => {
|
|
|
7521
7532
|
const memecoinToEthWithPermit2 = (params) => {
|
|
7522
7533
|
const flETH = FLETHAddress[params.chainId];
|
|
7523
7534
|
const flETHHooks = FLETHHooksAddress[params.chainId];
|
|
7524
|
-
const flaunchHooks = params.
|
|
7525
|
-
? FlaunchPositionManagerAddress[params.chainId]
|
|
7526
|
-
: FlaunchPositionManagerV1_1Address[params.chainId];
|
|
7535
|
+
const flaunchHooks = params.positionManagerAddress;
|
|
7527
7536
|
const v4Actions = ("0x" +
|
|
7528
7537
|
V4Actions.SWAP_EXACT_IN +
|
|
7529
7538
|
V4Actions.SETTLE_ALL +
|
|
@@ -7971,6 +7980,13 @@ class ReadInitialPrice {
|
|
|
7971
7980
|
_initialPriceParams: params.initialPriceParams,
|
|
7972
7981
|
});
|
|
7973
7982
|
}
|
|
7983
|
+
getSqrtPriceX96(params) {
|
|
7984
|
+
return this.contract.read("getSqrtPriceX96", {
|
|
7985
|
+
_flipped: !params.isFLETHZero,
|
|
7986
|
+
_initialPriceParams: params.initialPriceParams,
|
|
7987
|
+
0: viem.zeroAddress, // sender
|
|
7988
|
+
});
|
|
7989
|
+
}
|
|
7974
7990
|
}
|
|
7975
7991
|
|
|
7976
7992
|
class ReadFlaunchPositionManager {
|
|
@@ -7991,6 +8007,16 @@ class ReadFlaunchPositionManager {
|
|
|
7991
8007
|
});
|
|
7992
8008
|
return poolKey.tickSpacing !== 0;
|
|
7993
8009
|
}
|
|
8010
|
+
/**
|
|
8011
|
+
* Gets the ETH balance for the creator to claim
|
|
8012
|
+
* @param creator - The address of the creator to check
|
|
8013
|
+
* @returns The balance of the creator
|
|
8014
|
+
*/
|
|
8015
|
+
creatorBalance(creator) {
|
|
8016
|
+
return this.contract.read("balances", {
|
|
8017
|
+
_recipient: creator,
|
|
8018
|
+
});
|
|
8019
|
+
}
|
|
7994
8020
|
async getFlaunchingFee(params) {
|
|
7995
8021
|
const readInitialPrice = new ReadInitialPrice(await this.contract.read("initialPrice"), this.drift);
|
|
7996
8022
|
const flaunchingFee = await readInitialPrice.getFlaunchingFee(params);
|
|
@@ -8188,6 +8214,78 @@ class ReadFlaunchPositionManager {
|
|
|
8188
8214
|
};
|
|
8189
8215
|
}
|
|
8190
8216
|
}
|
|
8217
|
+
class ReadWriteFlaunchPositionManager extends ReadFlaunchPositionManager {
|
|
8218
|
+
constructor(address, drift$1 = drift.createDrift()) {
|
|
8219
|
+
super(address, drift$1);
|
|
8220
|
+
}
|
|
8221
|
+
async flaunch({ name, symbol, tokenUri, fairLaunchPercent, initialMarketCapUSD, creator, creatorFeeAllocationPercent, flaunchAt, }) {
|
|
8222
|
+
const initialMCapInUSDCWei = viem.parseUnits(initialMarketCapUSD.toString(), 6);
|
|
8223
|
+
const initialPriceParams = viem.encodeAbiParameters([
|
|
8224
|
+
{
|
|
8225
|
+
type: "uint256",
|
|
8226
|
+
},
|
|
8227
|
+
], [initialMCapInUSDCWei]);
|
|
8228
|
+
const fairLaunchInBps = BigInt(fairLaunchPercent * 100);
|
|
8229
|
+
const creatorFeeAllocationInBps = creatorFeeAllocationPercent * 100;
|
|
8230
|
+
let sender = viem.zeroAddress;
|
|
8231
|
+
if (this.drift.adapter.getSignerAddress) {
|
|
8232
|
+
sender = await this.drift.adapter.getSignerAddress();
|
|
8233
|
+
}
|
|
8234
|
+
const flaunchingFee = await this.getFlaunchingFee({
|
|
8235
|
+
sender,
|
|
8236
|
+
initialPriceParams,
|
|
8237
|
+
slippagePercent: 5,
|
|
8238
|
+
});
|
|
8239
|
+
return this.contract.write("flaunch", {
|
|
8240
|
+
_params: {
|
|
8241
|
+
name,
|
|
8242
|
+
symbol,
|
|
8243
|
+
tokenUri,
|
|
8244
|
+
initialTokenFairLaunch: (this.TOTAL_SUPPLY * fairLaunchInBps) / 10000n,
|
|
8245
|
+
premineAmount: 0n,
|
|
8246
|
+
creator,
|
|
8247
|
+
creatorFeeAllocation: creatorFeeAllocationInBps,
|
|
8248
|
+
flaunchAt: flaunchAt ?? 0n,
|
|
8249
|
+
initialPriceParams,
|
|
8250
|
+
feeCalculatorParams: "0x",
|
|
8251
|
+
},
|
|
8252
|
+
}, {
|
|
8253
|
+
value: flaunchingFee,
|
|
8254
|
+
onMined: async () => {
|
|
8255
|
+
if (this.pollPoolCreatedNow) {
|
|
8256
|
+
await this.pollPoolCreatedNow();
|
|
8257
|
+
}
|
|
8258
|
+
},
|
|
8259
|
+
});
|
|
8260
|
+
}
|
|
8261
|
+
async flaunchIPFS({ name, symbol, fairLaunchPercent, initialMarketCapUSD, creator, creatorFeeAllocationPercent, flaunchAt, metadata, pinataConfig, }) {
|
|
8262
|
+
const tokenUri = await generateTokenUri(name, {
|
|
8263
|
+
metadata,
|
|
8264
|
+
pinataConfig,
|
|
8265
|
+
});
|
|
8266
|
+
return this.flaunch({
|
|
8267
|
+
name,
|
|
8268
|
+
symbol,
|
|
8269
|
+
tokenUri,
|
|
8270
|
+
fairLaunchPercent,
|
|
8271
|
+
initialMarketCapUSD,
|
|
8272
|
+
creator,
|
|
8273
|
+
creatorFeeAllocationPercent,
|
|
8274
|
+
flaunchAt,
|
|
8275
|
+
});
|
|
8276
|
+
}
|
|
8277
|
+
/**
|
|
8278
|
+
* Withdraws the creator's share of the revenue
|
|
8279
|
+
* @param recipient - The address to withdraw the revenue to
|
|
8280
|
+
* @returns Transaction response
|
|
8281
|
+
*/
|
|
8282
|
+
withdrawFees(recipient) {
|
|
8283
|
+
return this.contract.write("withdrawFees", {
|
|
8284
|
+
_recipient: recipient,
|
|
8285
|
+
_unwrap: true,
|
|
8286
|
+
});
|
|
8287
|
+
}
|
|
8288
|
+
}
|
|
8191
8289
|
|
|
8192
8290
|
const bytes32ToUint256 = (value) => {
|
|
8193
8291
|
return viem.hexToBigInt(value);
|
|
@@ -9501,6 +9599,9 @@ class ReadFairLaunch {
|
|
|
9501
9599
|
address,
|
|
9502
9600
|
});
|
|
9503
9601
|
}
|
|
9602
|
+
fairLaunchDuration({ poolId }) {
|
|
9603
|
+
return 30 * 60; // 30 minutes
|
|
9604
|
+
}
|
|
9504
9605
|
/**
|
|
9505
9606
|
* Gets information about a fair launch for a specific pool
|
|
9506
9607
|
* @param poolId - The ID of the pool
|
|
@@ -9980,137 +10081,6 @@ class ReadBidWall {
|
|
|
9980
10081
|
}
|
|
9981
10082
|
}
|
|
9982
10083
|
|
|
9983
|
-
const FastFlaunchZapAbi = [
|
|
9984
|
-
{
|
|
9985
|
-
inputs: [
|
|
9986
|
-
{
|
|
9987
|
-
internalType: "contract PositionManager",
|
|
9988
|
-
name: "_positionManager",
|
|
9989
|
-
type: "address",
|
|
9990
|
-
},
|
|
9991
|
-
],
|
|
9992
|
-
stateMutability: "nonpayable",
|
|
9993
|
-
type: "constructor",
|
|
9994
|
-
},
|
|
9995
|
-
{
|
|
9996
|
-
inputs: [],
|
|
9997
|
-
name: "CREATOR_FEE_ALLOCATION",
|
|
9998
|
-
outputs: [{ internalType: "uint24", name: "", type: "uint24" }],
|
|
9999
|
-
stateMutability: "view",
|
|
10000
|
-
type: "function",
|
|
10001
|
-
},
|
|
10002
|
-
{
|
|
10003
|
-
inputs: [],
|
|
10004
|
-
name: "FAIR_LAUNCH_SUPPLY",
|
|
10005
|
-
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
10006
|
-
stateMutability: "view",
|
|
10007
|
-
type: "function",
|
|
10008
|
-
},
|
|
10009
|
-
{
|
|
10010
|
-
inputs: [],
|
|
10011
|
-
name: "USDC_MARKET_CAP",
|
|
10012
|
-
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
10013
|
-
stateMutability: "view",
|
|
10014
|
-
type: "function",
|
|
10015
|
-
},
|
|
10016
|
-
{
|
|
10017
|
-
inputs: [
|
|
10018
|
-
{
|
|
10019
|
-
components: [
|
|
10020
|
-
{ internalType: "string", name: "name", type: "string" },
|
|
10021
|
-
{ internalType: "string", name: "symbol", type: "string" },
|
|
10022
|
-
{ internalType: "string", name: "tokenUri", type: "string" },
|
|
10023
|
-
{ internalType: "address", name: "creator", type: "address" },
|
|
10024
|
-
],
|
|
10025
|
-
internalType: "struct FastFlaunchZap.FastFlaunchParams",
|
|
10026
|
-
name: "_params",
|
|
10027
|
-
type: "tuple",
|
|
10028
|
-
},
|
|
10029
|
-
],
|
|
10030
|
-
name: "flaunch",
|
|
10031
|
-
outputs: [{ internalType: "address", name: "memecoin_", type: "address" }],
|
|
10032
|
-
stateMutability: "nonpayable",
|
|
10033
|
-
type: "function",
|
|
10034
|
-
},
|
|
10035
|
-
{
|
|
10036
|
-
inputs: [],
|
|
10037
|
-
name: "positionManager",
|
|
10038
|
-
outputs: [
|
|
10039
|
-
{ internalType: "contract PositionManager", name: "", type: "address" },
|
|
10040
|
-
],
|
|
10041
|
-
stateMutability: "view",
|
|
10042
|
-
type: "function",
|
|
10043
|
-
},
|
|
10044
|
-
];
|
|
10045
|
-
|
|
10046
|
-
/**
|
|
10047
|
-
* Base client for interacting with the FastFlaunchZap contract in read-only mode
|
|
10048
|
-
* Provides basic contract initialization
|
|
10049
|
-
*/
|
|
10050
|
-
class ReadFastFlaunchZap {
|
|
10051
|
-
/**
|
|
10052
|
-
* Creates a new ReadFastFlaunchZap instance
|
|
10053
|
-
* @param address - The address of the FastFlaunchZap contract
|
|
10054
|
-
* @param drift - Optional drift instance for contract interactions (creates new instance if not provided)
|
|
10055
|
-
* @throws Error if address is not provided
|
|
10056
|
-
*/
|
|
10057
|
-
constructor(address, drift$1 = drift.createDrift()) {
|
|
10058
|
-
if (!address) {
|
|
10059
|
-
throw new Error("Address is required");
|
|
10060
|
-
}
|
|
10061
|
-
this.contract = drift$1.contract({
|
|
10062
|
-
abi: FastFlaunchZapAbi,
|
|
10063
|
-
address,
|
|
10064
|
-
});
|
|
10065
|
-
}
|
|
10066
|
-
}
|
|
10067
|
-
/**
|
|
10068
|
-
* Extended client for interacting with the FastFlaunchZap contract with write capabilities
|
|
10069
|
-
* Provides methods to create new fast flaunches with direct URI or IPFS metadata
|
|
10070
|
-
*/
|
|
10071
|
-
class ReadWriteFastFlaunchZap extends ReadFastFlaunchZap {
|
|
10072
|
-
/**
|
|
10073
|
-
* Creates a new ReadWriteFastFlaunchZap instance
|
|
10074
|
-
* @param address - The address of the FastFlaunchZap contract
|
|
10075
|
-
* @param drift - Optional drift instance for contract interactions (creates new instance if not provided)
|
|
10076
|
-
*/
|
|
10077
|
-
constructor(address, drift$1 = drift.createDrift()) {
|
|
10078
|
-
super(address, drift$1);
|
|
10079
|
-
}
|
|
10080
|
-
/**
|
|
10081
|
-
* Creates a new fast flaunch with direct token URI
|
|
10082
|
-
* @param params - Parameters for the fast flaunch including name, symbol, tokenUri, and creator
|
|
10083
|
-
* @returns Transaction response for the flaunch creation
|
|
10084
|
-
*/
|
|
10085
|
-
fastFlaunch({ name, symbol, tokenUri, creator }) {
|
|
10086
|
-
return this.contract.write("flaunch", {
|
|
10087
|
-
_params: {
|
|
10088
|
-
name,
|
|
10089
|
-
symbol,
|
|
10090
|
-
tokenUri,
|
|
10091
|
-
creator,
|
|
10092
|
-
},
|
|
10093
|
-
});
|
|
10094
|
-
}
|
|
10095
|
-
/**
|
|
10096
|
-
* Creates a new fast flaunch with metadata stored on IPFS
|
|
10097
|
-
* @param params - Parameters for the fast flaunch including name, symbol, creator, metadata, and Pinata config
|
|
10098
|
-
* @returns Promise resolving to the transaction response for the flaunch creation
|
|
10099
|
-
*/
|
|
10100
|
-
async fastFlaunchIPFS({ name, symbol, creator, metadata, pinataConfig, }) {
|
|
10101
|
-
const tokenUri = await generateTokenUri(name, {
|
|
10102
|
-
metadata,
|
|
10103
|
-
pinataConfig,
|
|
10104
|
-
});
|
|
10105
|
-
return this.fastFlaunch({
|
|
10106
|
-
name,
|
|
10107
|
-
symbol,
|
|
10108
|
-
tokenUri,
|
|
10109
|
-
creator,
|
|
10110
|
-
});
|
|
10111
|
-
}
|
|
10112
|
-
}
|
|
10113
|
-
|
|
10114
10084
|
const FlaunchZapAbi = [
|
|
10115
10085
|
{
|
|
10116
10086
|
inputs: [
|
|
@@ -12292,7 +12262,7 @@ class ReadWriteFlaunchZap extends ReadFlaunchZap {
|
|
|
12292
12262
|
depositData: "0x",
|
|
12293
12263
|
},
|
|
12294
12264
|
_whitelistParams: {
|
|
12295
|
-
merkleRoot:
|
|
12265
|
+
merkleRoot: viem.zeroHash,
|
|
12296
12266
|
merkleIPFSHash: "",
|
|
12297
12267
|
maxTokens: 0n,
|
|
12298
12268
|
},
|
|
@@ -12300,7 +12270,7 @@ class ReadWriteFlaunchZap extends ReadFlaunchZap {
|
|
|
12300
12270
|
airdropIndex: 0n,
|
|
12301
12271
|
airdropAmount: 0n,
|
|
12302
12272
|
airdropEndTime: 0n,
|
|
12303
|
-
merkleRoot:
|
|
12273
|
+
merkleRoot: viem.zeroHash,
|
|
12304
12274
|
merkleIPFSHash: "",
|
|
12305
12275
|
},
|
|
12306
12276
|
}, {
|
|
@@ -12368,7 +12338,7 @@ class ReadWriteFlaunchZap extends ReadFlaunchZap {
|
|
|
12368
12338
|
depositData: "0x",
|
|
12369
12339
|
},
|
|
12370
12340
|
_whitelistParams: {
|
|
12371
|
-
merkleRoot:
|
|
12341
|
+
merkleRoot: viem.zeroHash,
|
|
12372
12342
|
merkleIPFSHash: "",
|
|
12373
12343
|
maxTokens: 0n,
|
|
12374
12344
|
},
|
|
@@ -12376,7 +12346,7 @@ class ReadWriteFlaunchZap extends ReadFlaunchZap {
|
|
|
12376
12346
|
airdropIndex: 0n,
|
|
12377
12347
|
airdropAmount: 0n,
|
|
12378
12348
|
airdropEndTime: 0n,
|
|
12379
|
-
merkleRoot:
|
|
12349
|
+
merkleRoot: viem.zeroHash,
|
|
12380
12350
|
merkleIPFSHash: "",
|
|
12381
12351
|
},
|
|
12382
12352
|
}, {
|
|
@@ -13581,6 +13551,13 @@ class ReadMemecoin {
|
|
|
13581
13551
|
tokenURI() {
|
|
13582
13552
|
return this.contract.read("tokenURI");
|
|
13583
13553
|
}
|
|
13554
|
+
/**
|
|
13555
|
+
* Gets the total supply of the token
|
|
13556
|
+
* @returns Promise<bigint> - The total supply
|
|
13557
|
+
*/
|
|
13558
|
+
totalSupply() {
|
|
13559
|
+
return this.contract.read("totalSupply");
|
|
13560
|
+
}
|
|
13584
13561
|
/**
|
|
13585
13562
|
* Gets the token balance of a specific user
|
|
13586
13563
|
* @param user - The address of the user to check
|
|
@@ -13963,10 +13940,10 @@ class ReadQuoter {
|
|
|
13963
13940
|
* Gets a quote for selling an exact amount of tokens for ETH
|
|
13964
13941
|
* @param coinAddress - The address of the token to sell
|
|
13965
13942
|
* @param amountIn - The exact amount of tokens to sell
|
|
13966
|
-
* @param
|
|
13943
|
+
* @param positionManagerAddress - The address of the position manager to use
|
|
13967
13944
|
* @returns Promise<bigint> - The expected amount of ETH to receive
|
|
13968
13945
|
*/
|
|
13969
|
-
async getSellQuoteExactInput(coinAddress, amountIn,
|
|
13946
|
+
async getSellQuoteExactInput(coinAddress, amountIn, positionManagerAddress) {
|
|
13970
13947
|
const res = await this.contract.simulateWrite("quoteExactInput", {
|
|
13971
13948
|
params: {
|
|
13972
13949
|
exactAmount: amountIn,
|
|
@@ -13975,9 +13952,7 @@ class ReadQuoter {
|
|
|
13975
13952
|
{
|
|
13976
13953
|
fee: 0,
|
|
13977
13954
|
tickSpacing: 60,
|
|
13978
|
-
hooks:
|
|
13979
|
-
? FlaunchPositionManagerAddress[this.chainId]
|
|
13980
|
-
: FlaunchPositionManagerV1_1Address[this.chainId],
|
|
13955
|
+
hooks: positionManagerAddress,
|
|
13981
13956
|
hookData: "0x",
|
|
13982
13957
|
intermediateCurrency: FLETHAddress[this.chainId],
|
|
13983
13958
|
},
|
|
@@ -13997,10 +13972,10 @@ class ReadQuoter {
|
|
|
13997
13972
|
* Gets a quote for buying tokens with an exact amount of ETH
|
|
13998
13973
|
* @param coinAddress - The address of the token to buy
|
|
13999
13974
|
* @param ethIn - The exact amount of ETH to spend
|
|
14000
|
-
* @param
|
|
13975
|
+
* @param positionManagerAddress - The address of the position manager to use
|
|
14001
13976
|
* @returns Promise<bigint> - The expected amount of tokens to receive
|
|
14002
13977
|
*/
|
|
14003
|
-
async getBuyQuoteExactInput(coinAddress, ethIn,
|
|
13978
|
+
async getBuyQuoteExactInput(coinAddress, ethIn, positionManagerAddress) {
|
|
14004
13979
|
const res = await this.contract.simulateWrite("quoteExactInput", {
|
|
14005
13980
|
params: {
|
|
14006
13981
|
exactAmount: ethIn,
|
|
@@ -14016,9 +13991,7 @@ class ReadQuoter {
|
|
|
14016
13991
|
{
|
|
14017
13992
|
fee: 0,
|
|
14018
13993
|
tickSpacing: 60,
|
|
14019
|
-
hooks:
|
|
14020
|
-
? FlaunchPositionManagerAddress[this.chainId]
|
|
14021
|
-
: FlaunchPositionManagerV1_1Address[this.chainId],
|
|
13994
|
+
hooks: positionManagerAddress,
|
|
14022
13995
|
hookData: "0x",
|
|
14023
13996
|
intermediateCurrency: coinAddress,
|
|
14024
13997
|
},
|
|
@@ -14031,10 +14004,10 @@ class ReadQuoter {
|
|
|
14031
14004
|
* Gets a quote for buying an exact amount of tokens with ETH
|
|
14032
14005
|
* @param coinAddress - The address of the token to buy
|
|
14033
14006
|
* @param coinOut - The exact amount of tokens to receive
|
|
14034
|
-
* @param
|
|
14007
|
+
* @param positionManagerAddress - The address of the position manager to use
|
|
14035
14008
|
* @returns Promise<bigint> - The required amount of ETH to spend
|
|
14036
14009
|
*/
|
|
14037
|
-
async getBuyQuoteExactOutput(coinAddress, coinOut,
|
|
14010
|
+
async getBuyQuoteExactOutput(coinAddress, coinOut, positionManagerAddress) {
|
|
14038
14011
|
const res = await this.contract.simulateWrite("quoteExactOutput", {
|
|
14039
14012
|
params: {
|
|
14040
14013
|
path: [
|
|
@@ -14049,9 +14022,7 @@ class ReadQuoter {
|
|
|
14049
14022
|
intermediateCurrency: FLETHAddress[this.chainId],
|
|
14050
14023
|
fee: 0,
|
|
14051
14024
|
tickSpacing: 60,
|
|
14052
|
-
hooks:
|
|
14053
|
-
? FlaunchPositionManagerAddress[this.chainId]
|
|
14054
|
-
: FlaunchPositionManagerV1_1Address[this.chainId],
|
|
14025
|
+
hooks: positionManagerAddress,
|
|
14055
14026
|
hookData: "0x",
|
|
14056
14027
|
},
|
|
14057
14028
|
],
|
|
@@ -14654,31 +14625,2343 @@ class ReadWritePermit2 extends ReadPermit2 {
|
|
|
14654
14625
|
}
|
|
14655
14626
|
}
|
|
14656
14627
|
|
|
14657
|
-
const
|
|
14628
|
+
const AnyPositionManagerAbi = [
|
|
14658
14629
|
{
|
|
14659
14630
|
inputs: [
|
|
14660
|
-
{
|
|
14661
|
-
|
|
14662
|
-
|
|
14631
|
+
{
|
|
14632
|
+
components: [
|
|
14633
|
+
{ internalType: "address", name: "nativeToken", type: "address" },
|
|
14634
|
+
{
|
|
14635
|
+
internalType: "contract IPoolManager",
|
|
14636
|
+
name: "poolManager",
|
|
14637
|
+
type: "address",
|
|
14638
|
+
},
|
|
14639
|
+
{
|
|
14640
|
+
components: [
|
|
14641
|
+
{ internalType: "uint24", name: "swapFee", type: "uint24" },
|
|
14642
|
+
{ internalType: "uint24", name: "referrer", type: "uint24" },
|
|
14643
|
+
{ internalType: "uint24", name: "protocol", type: "uint24" },
|
|
14644
|
+
{ internalType: "bool", name: "active", type: "bool" },
|
|
14645
|
+
],
|
|
14646
|
+
internalType: "struct FeeDistributor.FeeDistribution",
|
|
14647
|
+
name: "feeDistribution",
|
|
14648
|
+
type: "tuple",
|
|
14649
|
+
},
|
|
14650
|
+
{
|
|
14651
|
+
internalType: "contract IInitialPrice",
|
|
14652
|
+
name: "initialPrice",
|
|
14653
|
+
type: "address",
|
|
14654
|
+
},
|
|
14655
|
+
{ internalType: "address", name: "protocolOwner", type: "address" },
|
|
14656
|
+
{
|
|
14657
|
+
internalType: "address",
|
|
14658
|
+
name: "protocolFeeRecipient",
|
|
14659
|
+
type: "address",
|
|
14660
|
+
},
|
|
14661
|
+
{ internalType: "address", name: "flayGovernance", type: "address" },
|
|
14662
|
+
{ internalType: "address", name: "feeEscrow", type: "address" },
|
|
14663
|
+
{
|
|
14664
|
+
internalType: "contract FeeExemptions",
|
|
14665
|
+
name: "feeExemptions",
|
|
14666
|
+
type: "address",
|
|
14667
|
+
},
|
|
14668
|
+
{
|
|
14669
|
+
internalType: "contract TreasuryActionManager",
|
|
14670
|
+
name: "actionManager",
|
|
14671
|
+
type: "address",
|
|
14672
|
+
},
|
|
14673
|
+
{ internalType: "address", name: "bidWall", type: "address" },
|
|
14674
|
+
],
|
|
14675
|
+
internalType: "struct AnyPositionManager.ConstructorParams",
|
|
14676
|
+
name: "params",
|
|
14677
|
+
type: "tuple",
|
|
14678
|
+
},
|
|
14663
14679
|
],
|
|
14664
14680
|
stateMutability: "nonpayable",
|
|
14665
14681
|
type: "constructor",
|
|
14666
14682
|
},
|
|
14667
|
-
{ inputs: [], name: "
|
|
14668
|
-
{
|
|
14669
|
-
inputs: [
|
|
14670
|
-
{ internalType: "address", name: "account", type: "address" },
|
|
14671
|
-
{ internalType: "bytes32", name: "neededRole", type: "bytes32" },
|
|
14672
|
-
],
|
|
14673
|
-
name: "AccessControlUnauthorizedAccount",
|
|
14674
|
-
type: "error",
|
|
14675
|
-
},
|
|
14683
|
+
{ inputs: [], name: "AlreadyFlaunched", type: "error" },
|
|
14676
14684
|
{ inputs: [], name: "AlreadyInitialized", type: "error" },
|
|
14685
|
+
{ inputs: [], name: "CallerIsNotBidWall", type: "error" },
|
|
14677
14686
|
{ inputs: [], name: "CallerIsNotCreator", type: "error" },
|
|
14678
|
-
{
|
|
14679
|
-
|
|
14680
|
-
|
|
14681
|
-
|
|
14687
|
+
{
|
|
14688
|
+
inputs: [{ internalType: "address", name: "_caller", type: "address" }],
|
|
14689
|
+
name: "CallerNotCreator",
|
|
14690
|
+
type: "error",
|
|
14691
|
+
},
|
|
14692
|
+
{ inputs: [], name: "CannotBeInitializedDirectly", type: "error" },
|
|
14693
|
+
{ inputs: [], name: "HookNotImplemented", type: "error" },
|
|
14694
|
+
{ inputs: [], name: "InvalidPool", type: "error" },
|
|
14695
|
+
{ inputs: [], name: "LockFailure", type: "error" },
|
|
14696
|
+
{ inputs: [], name: "NewOwnerIsZeroAddress", type: "error" },
|
|
14697
|
+
{ inputs: [], name: "NoHandoverRequest", type: "error" },
|
|
14698
|
+
{ inputs: [], name: "NotPoolManager", type: "error" },
|
|
14699
|
+
{ inputs: [], name: "NotSelf", type: "error" },
|
|
14700
|
+
{ inputs: [], name: "ProtocolFeeInvalid", type: "error" },
|
|
14701
|
+
{ inputs: [], name: "RecipientZeroAddress", type: "error" },
|
|
14702
|
+
{ inputs: [], name: "ReferrerFeeInvalid", type: "error" },
|
|
14703
|
+
{ inputs: [], name: "SwapFeeInvalid", type: "error" },
|
|
14704
|
+
{ inputs: [], name: "Unauthorized", type: "error" },
|
|
14705
|
+
{
|
|
14706
|
+
inputs: [{ internalType: "PoolId", name: "_poolId", type: "bytes32" }],
|
|
14707
|
+
name: "UnknownPool",
|
|
14708
|
+
type: "error",
|
|
14709
|
+
},
|
|
14710
|
+
{
|
|
14711
|
+
anonymous: false,
|
|
14712
|
+
inputs: [
|
|
14713
|
+
{
|
|
14714
|
+
indexed: true,
|
|
14715
|
+
internalType: "PoolId",
|
|
14716
|
+
name: "_poolId",
|
|
14717
|
+
type: "bytes32",
|
|
14718
|
+
},
|
|
14719
|
+
{
|
|
14720
|
+
indexed: false,
|
|
14721
|
+
internalType: "uint24",
|
|
14722
|
+
name: "_allocation",
|
|
14723
|
+
type: "uint24",
|
|
14724
|
+
},
|
|
14725
|
+
],
|
|
14726
|
+
name: "CreatorFeeAllocationUpdated",
|
|
14727
|
+
type: "event",
|
|
14728
|
+
},
|
|
14729
|
+
{
|
|
14730
|
+
anonymous: false,
|
|
14731
|
+
inputs: [
|
|
14732
|
+
{
|
|
14733
|
+
indexed: false,
|
|
14734
|
+
internalType: "address",
|
|
14735
|
+
name: "_feeCalculator",
|
|
14736
|
+
type: "address",
|
|
14737
|
+
},
|
|
14738
|
+
],
|
|
14739
|
+
name: "FairLaunchFeeCalculatorUpdated",
|
|
14740
|
+
type: "event",
|
|
14741
|
+
},
|
|
14742
|
+
{
|
|
14743
|
+
anonymous: false,
|
|
14744
|
+
inputs: [
|
|
14745
|
+
{
|
|
14746
|
+
indexed: false,
|
|
14747
|
+
internalType: "address",
|
|
14748
|
+
name: "_feeCalculator",
|
|
14749
|
+
type: "address",
|
|
14750
|
+
},
|
|
14751
|
+
],
|
|
14752
|
+
name: "FeeCalculatorUpdated",
|
|
14753
|
+
type: "event",
|
|
14754
|
+
},
|
|
14755
|
+
{
|
|
14756
|
+
anonymous: false,
|
|
14757
|
+
inputs: [
|
|
14758
|
+
{
|
|
14759
|
+
components: [
|
|
14760
|
+
{ internalType: "uint24", name: "swapFee", type: "uint24" },
|
|
14761
|
+
{ internalType: "uint24", name: "referrer", type: "uint24" },
|
|
14762
|
+
{ internalType: "uint24", name: "protocol", type: "uint24" },
|
|
14763
|
+
{ internalType: "bool", name: "active", type: "bool" },
|
|
14764
|
+
],
|
|
14765
|
+
indexed: false,
|
|
14766
|
+
internalType: "struct FeeDistributor.FeeDistribution",
|
|
14767
|
+
name: "_feeDistribution",
|
|
14768
|
+
type: "tuple",
|
|
14769
|
+
},
|
|
14770
|
+
],
|
|
14771
|
+
name: "FeeDistributionUpdated",
|
|
14772
|
+
type: "event",
|
|
14773
|
+
},
|
|
14774
|
+
{
|
|
14775
|
+
anonymous: false,
|
|
14776
|
+
inputs: [
|
|
14777
|
+
{ indexed: true, internalType: "bytes32", name: "id", type: "bytes32" },
|
|
14778
|
+
{
|
|
14779
|
+
indexed: true,
|
|
14780
|
+
internalType: "address",
|
|
14781
|
+
name: "sender",
|
|
14782
|
+
type: "address",
|
|
14783
|
+
},
|
|
14784
|
+
{
|
|
14785
|
+
indexed: false,
|
|
14786
|
+
internalType: "uint128",
|
|
14787
|
+
name: "feeAmount0",
|
|
14788
|
+
type: "uint128",
|
|
14789
|
+
},
|
|
14790
|
+
{
|
|
14791
|
+
indexed: false,
|
|
14792
|
+
internalType: "uint128",
|
|
14793
|
+
name: "feeAmount1",
|
|
14794
|
+
type: "uint128",
|
|
14795
|
+
},
|
|
14796
|
+
],
|
|
14797
|
+
name: "HookFee",
|
|
14798
|
+
type: "event",
|
|
14799
|
+
},
|
|
14800
|
+
{
|
|
14801
|
+
anonymous: false,
|
|
14802
|
+
inputs: [
|
|
14803
|
+
{ indexed: true, internalType: "bytes32", name: "id", type: "bytes32" },
|
|
14804
|
+
{
|
|
14805
|
+
indexed: true,
|
|
14806
|
+
internalType: "address",
|
|
14807
|
+
name: "sender",
|
|
14808
|
+
type: "address",
|
|
14809
|
+
},
|
|
14810
|
+
{
|
|
14811
|
+
indexed: false,
|
|
14812
|
+
internalType: "int128",
|
|
14813
|
+
name: "amount0",
|
|
14814
|
+
type: "int128",
|
|
14815
|
+
},
|
|
14816
|
+
{
|
|
14817
|
+
indexed: false,
|
|
14818
|
+
internalType: "int128",
|
|
14819
|
+
name: "amount1",
|
|
14820
|
+
type: "int128",
|
|
14821
|
+
},
|
|
14822
|
+
{
|
|
14823
|
+
indexed: false,
|
|
14824
|
+
internalType: "uint128",
|
|
14825
|
+
name: "hookLPfeeAmount0",
|
|
14826
|
+
type: "uint128",
|
|
14827
|
+
},
|
|
14828
|
+
{
|
|
14829
|
+
indexed: false,
|
|
14830
|
+
internalType: "uint128",
|
|
14831
|
+
name: "hookLPfeeAmount1",
|
|
14832
|
+
type: "uint128",
|
|
14833
|
+
},
|
|
14834
|
+
],
|
|
14835
|
+
name: "HookSwap",
|
|
14836
|
+
type: "event",
|
|
14837
|
+
},
|
|
14838
|
+
{
|
|
14839
|
+
anonymous: false,
|
|
14840
|
+
inputs: [
|
|
14841
|
+
{
|
|
14842
|
+
indexed: false,
|
|
14843
|
+
internalType: "address",
|
|
14844
|
+
name: "_initialPrice",
|
|
14845
|
+
type: "address",
|
|
14846
|
+
},
|
|
14847
|
+
],
|
|
14848
|
+
name: "InitialPriceUpdated",
|
|
14849
|
+
type: "event",
|
|
14850
|
+
},
|
|
14851
|
+
{
|
|
14852
|
+
anonymous: false,
|
|
14853
|
+
inputs: [
|
|
14854
|
+
{
|
|
14855
|
+
indexed: false,
|
|
14856
|
+
internalType: "address",
|
|
14857
|
+
name: "_memecoin",
|
|
14858
|
+
type: "address",
|
|
14859
|
+
},
|
|
14860
|
+
{
|
|
14861
|
+
indexed: false,
|
|
14862
|
+
internalType: "address",
|
|
14863
|
+
name: "_creator",
|
|
14864
|
+
type: "address",
|
|
14865
|
+
},
|
|
14866
|
+
],
|
|
14867
|
+
name: "MemecoinApproved",
|
|
14868
|
+
type: "event",
|
|
14869
|
+
},
|
|
14870
|
+
{
|
|
14871
|
+
anonymous: false,
|
|
14872
|
+
inputs: [
|
|
14873
|
+
{
|
|
14874
|
+
indexed: true,
|
|
14875
|
+
internalType: "address",
|
|
14876
|
+
name: "pendingOwner",
|
|
14877
|
+
type: "address",
|
|
14878
|
+
},
|
|
14879
|
+
],
|
|
14880
|
+
name: "OwnershipHandoverCanceled",
|
|
14881
|
+
type: "event",
|
|
14882
|
+
},
|
|
14883
|
+
{
|
|
14884
|
+
anonymous: false,
|
|
14885
|
+
inputs: [
|
|
14886
|
+
{
|
|
14887
|
+
indexed: true,
|
|
14888
|
+
internalType: "address",
|
|
14889
|
+
name: "pendingOwner",
|
|
14890
|
+
type: "address",
|
|
14891
|
+
},
|
|
14892
|
+
],
|
|
14893
|
+
name: "OwnershipHandoverRequested",
|
|
14894
|
+
type: "event",
|
|
14895
|
+
},
|
|
14896
|
+
{
|
|
14897
|
+
anonymous: false,
|
|
14898
|
+
inputs: [
|
|
14899
|
+
{
|
|
14900
|
+
indexed: true,
|
|
14901
|
+
internalType: "address",
|
|
14902
|
+
name: "oldOwner",
|
|
14903
|
+
type: "address",
|
|
14904
|
+
},
|
|
14905
|
+
{
|
|
14906
|
+
indexed: true,
|
|
14907
|
+
internalType: "address",
|
|
14908
|
+
name: "newOwner",
|
|
14909
|
+
type: "address",
|
|
14910
|
+
},
|
|
14911
|
+
],
|
|
14912
|
+
name: "OwnershipTransferred",
|
|
14913
|
+
type: "event",
|
|
14914
|
+
},
|
|
14915
|
+
{
|
|
14916
|
+
anonymous: false,
|
|
14917
|
+
inputs: [
|
|
14918
|
+
{
|
|
14919
|
+
indexed: true,
|
|
14920
|
+
internalType: "PoolId",
|
|
14921
|
+
name: "_poolId",
|
|
14922
|
+
type: "bytes32",
|
|
14923
|
+
},
|
|
14924
|
+
{
|
|
14925
|
+
indexed: false,
|
|
14926
|
+
internalType: "address",
|
|
14927
|
+
name: "_memecoin",
|
|
14928
|
+
type: "address",
|
|
14929
|
+
},
|
|
14930
|
+
{
|
|
14931
|
+
indexed: false,
|
|
14932
|
+
internalType: "address",
|
|
14933
|
+
name: "_memecoinTreasury",
|
|
14934
|
+
type: "address",
|
|
14935
|
+
},
|
|
14936
|
+
{
|
|
14937
|
+
indexed: false,
|
|
14938
|
+
internalType: "uint256",
|
|
14939
|
+
name: "_tokenId",
|
|
14940
|
+
type: "uint256",
|
|
14941
|
+
},
|
|
14942
|
+
{
|
|
14943
|
+
indexed: false,
|
|
14944
|
+
internalType: "bool",
|
|
14945
|
+
name: "_currencyFlipped",
|
|
14946
|
+
type: "bool",
|
|
14947
|
+
},
|
|
14948
|
+
{
|
|
14949
|
+
components: [
|
|
14950
|
+
{ internalType: "address", name: "memecoin", type: "address" },
|
|
14951
|
+
{ internalType: "address", name: "creator", type: "address" },
|
|
14952
|
+
{
|
|
14953
|
+
internalType: "uint24",
|
|
14954
|
+
name: "creatorFeeAllocation",
|
|
14955
|
+
type: "uint24",
|
|
14956
|
+
},
|
|
14957
|
+
{ internalType: "bytes", name: "initialPriceParams", type: "bytes" },
|
|
14958
|
+
{ internalType: "bytes", name: "feeCalculatorParams", type: "bytes" },
|
|
14959
|
+
],
|
|
14960
|
+
indexed: false,
|
|
14961
|
+
internalType: "struct AnyPositionManager.FlaunchParams",
|
|
14962
|
+
name: "_params",
|
|
14963
|
+
type: "tuple",
|
|
14964
|
+
},
|
|
14965
|
+
],
|
|
14966
|
+
name: "PoolCreated",
|
|
14967
|
+
type: "event",
|
|
14968
|
+
},
|
|
14969
|
+
{
|
|
14970
|
+
anonymous: false,
|
|
14971
|
+
inputs: [
|
|
14972
|
+
{
|
|
14973
|
+
indexed: true,
|
|
14974
|
+
internalType: "PoolId",
|
|
14975
|
+
name: "_poolId",
|
|
14976
|
+
type: "bytes32",
|
|
14977
|
+
},
|
|
14978
|
+
{
|
|
14979
|
+
components: [
|
|
14980
|
+
{ internalType: "uint24", name: "swapFee", type: "uint24" },
|
|
14981
|
+
{ internalType: "uint24", name: "referrer", type: "uint24" },
|
|
14982
|
+
{ internalType: "uint24", name: "protocol", type: "uint24" },
|
|
14983
|
+
{ internalType: "bool", name: "active", type: "bool" },
|
|
14984
|
+
],
|
|
14985
|
+
indexed: false,
|
|
14986
|
+
internalType: "struct FeeDistributor.FeeDistribution",
|
|
14987
|
+
name: "_feeDistribution",
|
|
14988
|
+
type: "tuple",
|
|
14989
|
+
},
|
|
14990
|
+
],
|
|
14991
|
+
name: "PoolFeeDistributionUpdated",
|
|
14992
|
+
type: "event",
|
|
14993
|
+
},
|
|
14994
|
+
{
|
|
14995
|
+
anonymous: false,
|
|
14996
|
+
inputs: [
|
|
14997
|
+
{
|
|
14998
|
+
indexed: true,
|
|
14999
|
+
internalType: "PoolId",
|
|
15000
|
+
name: "_poolId",
|
|
15001
|
+
type: "bytes32",
|
|
15002
|
+
},
|
|
15003
|
+
{
|
|
15004
|
+
indexed: false,
|
|
15005
|
+
internalType: "uint256",
|
|
15006
|
+
name: "_donateAmount",
|
|
15007
|
+
type: "uint256",
|
|
15008
|
+
},
|
|
15009
|
+
{
|
|
15010
|
+
indexed: false,
|
|
15011
|
+
internalType: "uint256",
|
|
15012
|
+
name: "_creatorAmount",
|
|
15013
|
+
type: "uint256",
|
|
15014
|
+
},
|
|
15015
|
+
{
|
|
15016
|
+
indexed: false,
|
|
15017
|
+
internalType: "uint256",
|
|
15018
|
+
name: "_bidWallAmount",
|
|
15019
|
+
type: "uint256",
|
|
15020
|
+
},
|
|
15021
|
+
{
|
|
15022
|
+
indexed: false,
|
|
15023
|
+
internalType: "uint256",
|
|
15024
|
+
name: "_governanceAmount",
|
|
15025
|
+
type: "uint256",
|
|
15026
|
+
},
|
|
15027
|
+
{
|
|
15028
|
+
indexed: false,
|
|
15029
|
+
internalType: "uint256",
|
|
15030
|
+
name: "_protocolAmount",
|
|
15031
|
+
type: "uint256",
|
|
15032
|
+
},
|
|
15033
|
+
],
|
|
15034
|
+
name: "PoolFeesDistributed",
|
|
15035
|
+
type: "event",
|
|
15036
|
+
},
|
|
15037
|
+
{
|
|
15038
|
+
anonymous: false,
|
|
15039
|
+
inputs: [
|
|
15040
|
+
{
|
|
15041
|
+
indexed: true,
|
|
15042
|
+
internalType: "PoolId",
|
|
15043
|
+
name: "_poolId",
|
|
15044
|
+
type: "bytes32",
|
|
15045
|
+
},
|
|
15046
|
+
{
|
|
15047
|
+
indexed: false,
|
|
15048
|
+
internalType: "uint256",
|
|
15049
|
+
name: "_amount0",
|
|
15050
|
+
type: "uint256",
|
|
15051
|
+
},
|
|
15052
|
+
{
|
|
15053
|
+
indexed: false,
|
|
15054
|
+
internalType: "uint256",
|
|
15055
|
+
name: "_amount1",
|
|
15056
|
+
type: "uint256",
|
|
15057
|
+
},
|
|
15058
|
+
],
|
|
15059
|
+
name: "PoolFeesReceived",
|
|
15060
|
+
type: "event",
|
|
15061
|
+
},
|
|
15062
|
+
{
|
|
15063
|
+
anonymous: false,
|
|
15064
|
+
inputs: [
|
|
15065
|
+
{
|
|
15066
|
+
indexed: true,
|
|
15067
|
+
internalType: "PoolId",
|
|
15068
|
+
name: "_poolId",
|
|
15069
|
+
type: "bytes32",
|
|
15070
|
+
},
|
|
15071
|
+
{
|
|
15072
|
+
indexed: false,
|
|
15073
|
+
internalType: "bool",
|
|
15074
|
+
name: "zeroForOne",
|
|
15075
|
+
type: "bool",
|
|
15076
|
+
},
|
|
15077
|
+
{
|
|
15078
|
+
indexed: false,
|
|
15079
|
+
internalType: "uint256",
|
|
15080
|
+
name: "_amount0",
|
|
15081
|
+
type: "uint256",
|
|
15082
|
+
},
|
|
15083
|
+
{
|
|
15084
|
+
indexed: false,
|
|
15085
|
+
internalType: "uint256",
|
|
15086
|
+
name: "_amount1",
|
|
15087
|
+
type: "uint256",
|
|
15088
|
+
},
|
|
15089
|
+
],
|
|
15090
|
+
name: "PoolFeesSwapped",
|
|
15091
|
+
type: "event",
|
|
15092
|
+
},
|
|
15093
|
+
{
|
|
15094
|
+
anonymous: false,
|
|
15095
|
+
inputs: [
|
|
15096
|
+
{
|
|
15097
|
+
indexed: true,
|
|
15098
|
+
internalType: "PoolId",
|
|
15099
|
+
name: "_poolId",
|
|
15100
|
+
type: "bytes32",
|
|
15101
|
+
},
|
|
15102
|
+
{
|
|
15103
|
+
indexed: false,
|
|
15104
|
+
internalType: "uint160",
|
|
15105
|
+
name: "_sqrtPriceX96",
|
|
15106
|
+
type: "uint160",
|
|
15107
|
+
},
|
|
15108
|
+
{ indexed: false, internalType: "int24", name: "_tick", type: "int24" },
|
|
15109
|
+
{
|
|
15110
|
+
indexed: false,
|
|
15111
|
+
internalType: "uint24",
|
|
15112
|
+
name: "_protocolFee",
|
|
15113
|
+
type: "uint24",
|
|
15114
|
+
},
|
|
15115
|
+
{
|
|
15116
|
+
indexed: false,
|
|
15117
|
+
internalType: "uint24",
|
|
15118
|
+
name: "_swapFee",
|
|
15119
|
+
type: "uint24",
|
|
15120
|
+
},
|
|
15121
|
+
{
|
|
15122
|
+
indexed: false,
|
|
15123
|
+
internalType: "uint128",
|
|
15124
|
+
name: "_liquidity",
|
|
15125
|
+
type: "uint128",
|
|
15126
|
+
},
|
|
15127
|
+
],
|
|
15128
|
+
name: "PoolStateUpdated",
|
|
15129
|
+
type: "event",
|
|
15130
|
+
},
|
|
15131
|
+
{
|
|
15132
|
+
anonymous: false,
|
|
15133
|
+
inputs: [
|
|
15134
|
+
{
|
|
15135
|
+
indexed: true,
|
|
15136
|
+
internalType: "PoolId",
|
|
15137
|
+
name: "poolId",
|
|
15138
|
+
type: "bytes32",
|
|
15139
|
+
},
|
|
15140
|
+
{
|
|
15141
|
+
indexed: false,
|
|
15142
|
+
internalType: "int256",
|
|
15143
|
+
name: "flAmount0",
|
|
15144
|
+
type: "int256",
|
|
15145
|
+
},
|
|
15146
|
+
{
|
|
15147
|
+
indexed: false,
|
|
15148
|
+
internalType: "int256",
|
|
15149
|
+
name: "flAmount1",
|
|
15150
|
+
type: "int256",
|
|
15151
|
+
},
|
|
15152
|
+
{
|
|
15153
|
+
indexed: false,
|
|
15154
|
+
internalType: "int256",
|
|
15155
|
+
name: "flFee0",
|
|
15156
|
+
type: "int256",
|
|
15157
|
+
},
|
|
15158
|
+
{
|
|
15159
|
+
indexed: false,
|
|
15160
|
+
internalType: "int256",
|
|
15161
|
+
name: "flFee1",
|
|
15162
|
+
type: "int256",
|
|
15163
|
+
},
|
|
15164
|
+
{
|
|
15165
|
+
indexed: false,
|
|
15166
|
+
internalType: "int256",
|
|
15167
|
+
name: "ispAmount0",
|
|
15168
|
+
type: "int256",
|
|
15169
|
+
},
|
|
15170
|
+
{
|
|
15171
|
+
indexed: false,
|
|
15172
|
+
internalType: "int256",
|
|
15173
|
+
name: "ispAmount1",
|
|
15174
|
+
type: "int256",
|
|
15175
|
+
},
|
|
15176
|
+
{
|
|
15177
|
+
indexed: false,
|
|
15178
|
+
internalType: "int256",
|
|
15179
|
+
name: "ispFee0",
|
|
15180
|
+
type: "int256",
|
|
15181
|
+
},
|
|
15182
|
+
{
|
|
15183
|
+
indexed: false,
|
|
15184
|
+
internalType: "int256",
|
|
15185
|
+
name: "ispFee1",
|
|
15186
|
+
type: "int256",
|
|
15187
|
+
},
|
|
15188
|
+
{
|
|
15189
|
+
indexed: false,
|
|
15190
|
+
internalType: "int256",
|
|
15191
|
+
name: "uniAmount0",
|
|
15192
|
+
type: "int256",
|
|
15193
|
+
},
|
|
15194
|
+
{
|
|
15195
|
+
indexed: false,
|
|
15196
|
+
internalType: "int256",
|
|
15197
|
+
name: "uniAmount1",
|
|
15198
|
+
type: "int256",
|
|
15199
|
+
},
|
|
15200
|
+
{
|
|
15201
|
+
indexed: false,
|
|
15202
|
+
internalType: "int256",
|
|
15203
|
+
name: "uniFee0",
|
|
15204
|
+
type: "int256",
|
|
15205
|
+
},
|
|
15206
|
+
{
|
|
15207
|
+
indexed: false,
|
|
15208
|
+
internalType: "int256",
|
|
15209
|
+
name: "uniFee1",
|
|
15210
|
+
type: "int256",
|
|
15211
|
+
},
|
|
15212
|
+
],
|
|
15213
|
+
name: "PoolSwap",
|
|
15214
|
+
type: "event",
|
|
15215
|
+
},
|
|
15216
|
+
{
|
|
15217
|
+
anonymous: false,
|
|
15218
|
+
inputs: [
|
|
15219
|
+
{
|
|
15220
|
+
indexed: false,
|
|
15221
|
+
internalType: "address",
|
|
15222
|
+
name: "_referralEscrow",
|
|
15223
|
+
type: "address",
|
|
15224
|
+
},
|
|
15225
|
+
],
|
|
15226
|
+
name: "ReferralEscrowUpdated",
|
|
15227
|
+
type: "event",
|
|
15228
|
+
},
|
|
15229
|
+
{
|
|
15230
|
+
anonymous: false,
|
|
15231
|
+
inputs: [
|
|
15232
|
+
{
|
|
15233
|
+
indexed: true,
|
|
15234
|
+
internalType: "PoolId",
|
|
15235
|
+
name: "_poolId",
|
|
15236
|
+
type: "bytes32",
|
|
15237
|
+
},
|
|
15238
|
+
{
|
|
15239
|
+
indexed: false,
|
|
15240
|
+
internalType: "address",
|
|
15241
|
+
name: "_recipient",
|
|
15242
|
+
type: "address",
|
|
15243
|
+
},
|
|
15244
|
+
{
|
|
15245
|
+
indexed: false,
|
|
15246
|
+
internalType: "address",
|
|
15247
|
+
name: "_token",
|
|
15248
|
+
type: "address",
|
|
15249
|
+
},
|
|
15250
|
+
{
|
|
15251
|
+
indexed: false,
|
|
15252
|
+
internalType: "uint256",
|
|
15253
|
+
name: "_amount",
|
|
15254
|
+
type: "uint256",
|
|
15255
|
+
},
|
|
15256
|
+
],
|
|
15257
|
+
name: "ReferrerFeePaid",
|
|
15258
|
+
type: "event",
|
|
15259
|
+
},
|
|
15260
|
+
{
|
|
15261
|
+
inputs: [],
|
|
15262
|
+
name: "MAX_PROTOCOL_ALLOCATION",
|
|
15263
|
+
outputs: [{ internalType: "uint24", name: "", type: "uint24" }],
|
|
15264
|
+
stateMutability: "view",
|
|
15265
|
+
type: "function",
|
|
15266
|
+
},
|
|
15267
|
+
{
|
|
15268
|
+
inputs: [],
|
|
15269
|
+
name: "MIN_DISTRIBUTE_THRESHOLD",
|
|
15270
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
15271
|
+
stateMutability: "view",
|
|
15272
|
+
type: "function",
|
|
15273
|
+
},
|
|
15274
|
+
{
|
|
15275
|
+
inputs: [],
|
|
15276
|
+
name: "actionManager",
|
|
15277
|
+
outputs: [
|
|
15278
|
+
{
|
|
15279
|
+
internalType: "contract TreasuryActionManager",
|
|
15280
|
+
name: "",
|
|
15281
|
+
type: "address",
|
|
15282
|
+
},
|
|
15283
|
+
],
|
|
15284
|
+
stateMutability: "view",
|
|
15285
|
+
type: "function",
|
|
15286
|
+
},
|
|
15287
|
+
{
|
|
15288
|
+
inputs: [
|
|
15289
|
+
{ internalType: "address", name: "_sender", type: "address" },
|
|
15290
|
+
{
|
|
15291
|
+
components: [
|
|
15292
|
+
{ internalType: "Currency", name: "currency0", type: "address" },
|
|
15293
|
+
{ internalType: "Currency", name: "currency1", type: "address" },
|
|
15294
|
+
{ internalType: "uint24", name: "fee", type: "uint24" },
|
|
15295
|
+
{ internalType: "int24", name: "tickSpacing", type: "int24" },
|
|
15296
|
+
{ internalType: "contract IHooks", name: "hooks", type: "address" },
|
|
15297
|
+
],
|
|
15298
|
+
internalType: "struct PoolKey",
|
|
15299
|
+
name: "_key",
|
|
15300
|
+
type: "tuple",
|
|
15301
|
+
},
|
|
15302
|
+
{
|
|
15303
|
+
components: [
|
|
15304
|
+
{ internalType: "int24", name: "tickLower", type: "int24" },
|
|
15305
|
+
{ internalType: "int24", name: "tickUpper", type: "int24" },
|
|
15306
|
+
{ internalType: "int256", name: "liquidityDelta", type: "int256" },
|
|
15307
|
+
{ internalType: "bytes32", name: "salt", type: "bytes32" },
|
|
15308
|
+
],
|
|
15309
|
+
internalType: "struct IPoolManager.ModifyLiquidityParams",
|
|
15310
|
+
name: "",
|
|
15311
|
+
type: "tuple",
|
|
15312
|
+
},
|
|
15313
|
+
{ internalType: "BalanceDelta", name: "_delta", type: "int256" },
|
|
15314
|
+
{ internalType: "BalanceDelta", name: "_feesAccrued", type: "int256" },
|
|
15315
|
+
{ internalType: "bytes", name: "", type: "bytes" },
|
|
15316
|
+
],
|
|
15317
|
+
name: "afterAddLiquidity",
|
|
15318
|
+
outputs: [
|
|
15319
|
+
{ internalType: "bytes4", name: "selector_", type: "bytes4" },
|
|
15320
|
+
{ internalType: "BalanceDelta", name: "", type: "int256" },
|
|
15321
|
+
],
|
|
15322
|
+
stateMutability: "nonpayable",
|
|
15323
|
+
type: "function",
|
|
15324
|
+
},
|
|
15325
|
+
{
|
|
15326
|
+
inputs: [
|
|
15327
|
+
{ internalType: "address", name: "_sender", type: "address" },
|
|
15328
|
+
{
|
|
15329
|
+
components: [
|
|
15330
|
+
{ internalType: "Currency", name: "currency0", type: "address" },
|
|
15331
|
+
{ internalType: "Currency", name: "currency1", type: "address" },
|
|
15332
|
+
{ internalType: "uint24", name: "fee", type: "uint24" },
|
|
15333
|
+
{ internalType: "int24", name: "tickSpacing", type: "int24" },
|
|
15334
|
+
{ internalType: "contract IHooks", name: "hooks", type: "address" },
|
|
15335
|
+
],
|
|
15336
|
+
internalType: "struct PoolKey",
|
|
15337
|
+
name: "_key",
|
|
15338
|
+
type: "tuple",
|
|
15339
|
+
},
|
|
15340
|
+
{ internalType: "uint256", name: "_amount0", type: "uint256" },
|
|
15341
|
+
{ internalType: "uint256", name: "_amount1", type: "uint256" },
|
|
15342
|
+
{ internalType: "bytes", name: "", type: "bytes" },
|
|
15343
|
+
],
|
|
15344
|
+
name: "afterDonate",
|
|
15345
|
+
outputs: [{ internalType: "bytes4", name: "selector_", type: "bytes4" }],
|
|
15346
|
+
stateMutability: "nonpayable",
|
|
15347
|
+
type: "function",
|
|
15348
|
+
},
|
|
15349
|
+
{
|
|
15350
|
+
inputs: [
|
|
15351
|
+
{ internalType: "address", name: "", type: "address" },
|
|
15352
|
+
{
|
|
15353
|
+
components: [
|
|
15354
|
+
{ internalType: "Currency", name: "currency0", type: "address" },
|
|
15355
|
+
{ internalType: "Currency", name: "currency1", type: "address" },
|
|
15356
|
+
{ internalType: "uint24", name: "fee", type: "uint24" },
|
|
15357
|
+
{ internalType: "int24", name: "tickSpacing", type: "int24" },
|
|
15358
|
+
{ internalType: "contract IHooks", name: "hooks", type: "address" },
|
|
15359
|
+
],
|
|
15360
|
+
internalType: "struct PoolKey",
|
|
15361
|
+
name: "",
|
|
15362
|
+
type: "tuple",
|
|
15363
|
+
},
|
|
15364
|
+
{ internalType: "uint160", name: "", type: "uint160" },
|
|
15365
|
+
{ internalType: "int24", name: "", type: "int24" },
|
|
15366
|
+
],
|
|
15367
|
+
name: "afterInitialize",
|
|
15368
|
+
outputs: [{ internalType: "bytes4", name: "", type: "bytes4" }],
|
|
15369
|
+
stateMutability: "nonpayable",
|
|
15370
|
+
type: "function",
|
|
15371
|
+
},
|
|
15372
|
+
{
|
|
15373
|
+
inputs: [
|
|
15374
|
+
{ internalType: "address", name: "_sender", type: "address" },
|
|
15375
|
+
{
|
|
15376
|
+
components: [
|
|
15377
|
+
{ internalType: "Currency", name: "currency0", type: "address" },
|
|
15378
|
+
{ internalType: "Currency", name: "currency1", type: "address" },
|
|
15379
|
+
{ internalType: "uint24", name: "fee", type: "uint24" },
|
|
15380
|
+
{ internalType: "int24", name: "tickSpacing", type: "int24" },
|
|
15381
|
+
{ internalType: "contract IHooks", name: "hooks", type: "address" },
|
|
15382
|
+
],
|
|
15383
|
+
internalType: "struct PoolKey",
|
|
15384
|
+
name: "_key",
|
|
15385
|
+
type: "tuple",
|
|
15386
|
+
},
|
|
15387
|
+
{
|
|
15388
|
+
components: [
|
|
15389
|
+
{ internalType: "int24", name: "tickLower", type: "int24" },
|
|
15390
|
+
{ internalType: "int24", name: "tickUpper", type: "int24" },
|
|
15391
|
+
{ internalType: "int256", name: "liquidityDelta", type: "int256" },
|
|
15392
|
+
{ internalType: "bytes32", name: "salt", type: "bytes32" },
|
|
15393
|
+
],
|
|
15394
|
+
internalType: "struct IPoolManager.ModifyLiquidityParams",
|
|
15395
|
+
name: "",
|
|
15396
|
+
type: "tuple",
|
|
15397
|
+
},
|
|
15398
|
+
{ internalType: "BalanceDelta", name: "_delta", type: "int256" },
|
|
15399
|
+
{ internalType: "BalanceDelta", name: "_feesAccrued", type: "int256" },
|
|
15400
|
+
{ internalType: "bytes", name: "", type: "bytes" },
|
|
15401
|
+
],
|
|
15402
|
+
name: "afterRemoveLiquidity",
|
|
15403
|
+
outputs: [
|
|
15404
|
+
{ internalType: "bytes4", name: "selector_", type: "bytes4" },
|
|
15405
|
+
{ internalType: "BalanceDelta", name: "", type: "int256" },
|
|
15406
|
+
],
|
|
15407
|
+
stateMutability: "nonpayable",
|
|
15408
|
+
type: "function",
|
|
15409
|
+
},
|
|
15410
|
+
{
|
|
15411
|
+
inputs: [
|
|
15412
|
+
{ internalType: "address", name: "_sender", type: "address" },
|
|
15413
|
+
{
|
|
15414
|
+
components: [
|
|
15415
|
+
{ internalType: "Currency", name: "currency0", type: "address" },
|
|
15416
|
+
{ internalType: "Currency", name: "currency1", type: "address" },
|
|
15417
|
+
{ internalType: "uint24", name: "fee", type: "uint24" },
|
|
15418
|
+
{ internalType: "int24", name: "tickSpacing", type: "int24" },
|
|
15419
|
+
{ internalType: "contract IHooks", name: "hooks", type: "address" },
|
|
15420
|
+
],
|
|
15421
|
+
internalType: "struct PoolKey",
|
|
15422
|
+
name: "_key",
|
|
15423
|
+
type: "tuple",
|
|
15424
|
+
},
|
|
15425
|
+
{
|
|
15426
|
+
components: [
|
|
15427
|
+
{ internalType: "bool", name: "zeroForOne", type: "bool" },
|
|
15428
|
+
{ internalType: "int256", name: "amountSpecified", type: "int256" },
|
|
15429
|
+
{
|
|
15430
|
+
internalType: "uint160",
|
|
15431
|
+
name: "sqrtPriceLimitX96",
|
|
15432
|
+
type: "uint160",
|
|
15433
|
+
},
|
|
15434
|
+
],
|
|
15435
|
+
internalType: "struct IPoolManager.SwapParams",
|
|
15436
|
+
name: "_params",
|
|
15437
|
+
type: "tuple",
|
|
15438
|
+
},
|
|
15439
|
+
{ internalType: "BalanceDelta", name: "_delta", type: "int256" },
|
|
15440
|
+
{ internalType: "bytes", name: "_hookData", type: "bytes" },
|
|
15441
|
+
],
|
|
15442
|
+
name: "afterSwap",
|
|
15443
|
+
outputs: [
|
|
15444
|
+
{ internalType: "bytes4", name: "selector_", type: "bytes4" },
|
|
15445
|
+
{ internalType: "int128", name: "hookDeltaUnspecified_", type: "int128" },
|
|
15446
|
+
],
|
|
15447
|
+
stateMutability: "nonpayable",
|
|
15448
|
+
type: "function",
|
|
15449
|
+
},
|
|
15450
|
+
{
|
|
15451
|
+
inputs: [
|
|
15452
|
+
{ internalType: "address", name: "_memecoin", type: "address" },
|
|
15453
|
+
{ internalType: "address", name: "_creator", type: "address" },
|
|
15454
|
+
],
|
|
15455
|
+
name: "approveMemecoin",
|
|
15456
|
+
outputs: [],
|
|
15457
|
+
stateMutability: "nonpayable",
|
|
15458
|
+
type: "function",
|
|
15459
|
+
},
|
|
15460
|
+
{
|
|
15461
|
+
inputs: [{ internalType: "address", name: "_memecoin", type: "address" }],
|
|
15462
|
+
name: "approvedMemecoinToCreator",
|
|
15463
|
+
outputs: [{ internalType: "address", name: "_creator", type: "address" }],
|
|
15464
|
+
stateMutability: "view",
|
|
15465
|
+
type: "function",
|
|
15466
|
+
},
|
|
15467
|
+
{
|
|
15468
|
+
inputs: [
|
|
15469
|
+
{ internalType: "address", name: "", type: "address" },
|
|
15470
|
+
{
|
|
15471
|
+
components: [
|
|
15472
|
+
{ internalType: "Currency", name: "currency0", type: "address" },
|
|
15473
|
+
{ internalType: "Currency", name: "currency1", type: "address" },
|
|
15474
|
+
{ internalType: "uint24", name: "fee", type: "uint24" },
|
|
15475
|
+
{ internalType: "int24", name: "tickSpacing", type: "int24" },
|
|
15476
|
+
{ internalType: "contract IHooks", name: "hooks", type: "address" },
|
|
15477
|
+
],
|
|
15478
|
+
internalType: "struct PoolKey",
|
|
15479
|
+
name: "",
|
|
15480
|
+
type: "tuple",
|
|
15481
|
+
},
|
|
15482
|
+
{
|
|
15483
|
+
components: [
|
|
15484
|
+
{ internalType: "int24", name: "tickLower", type: "int24" },
|
|
15485
|
+
{ internalType: "int24", name: "tickUpper", type: "int24" },
|
|
15486
|
+
{ internalType: "int256", name: "liquidityDelta", type: "int256" },
|
|
15487
|
+
{ internalType: "bytes32", name: "salt", type: "bytes32" },
|
|
15488
|
+
],
|
|
15489
|
+
internalType: "struct IPoolManager.ModifyLiquidityParams",
|
|
15490
|
+
name: "",
|
|
15491
|
+
type: "tuple",
|
|
15492
|
+
},
|
|
15493
|
+
{ internalType: "bytes", name: "", type: "bytes" },
|
|
15494
|
+
],
|
|
15495
|
+
name: "beforeAddLiquidity",
|
|
15496
|
+
outputs: [{ internalType: "bytes4", name: "", type: "bytes4" }],
|
|
15497
|
+
stateMutability: "nonpayable",
|
|
15498
|
+
type: "function",
|
|
15499
|
+
},
|
|
15500
|
+
{
|
|
15501
|
+
inputs: [
|
|
15502
|
+
{ internalType: "address", name: "", type: "address" },
|
|
15503
|
+
{
|
|
15504
|
+
components: [
|
|
15505
|
+
{ internalType: "Currency", name: "currency0", type: "address" },
|
|
15506
|
+
{ internalType: "Currency", name: "currency1", type: "address" },
|
|
15507
|
+
{ internalType: "uint24", name: "fee", type: "uint24" },
|
|
15508
|
+
{ internalType: "int24", name: "tickSpacing", type: "int24" },
|
|
15509
|
+
{ internalType: "contract IHooks", name: "hooks", type: "address" },
|
|
15510
|
+
],
|
|
15511
|
+
internalType: "struct PoolKey",
|
|
15512
|
+
name: "",
|
|
15513
|
+
type: "tuple",
|
|
15514
|
+
},
|
|
15515
|
+
{ internalType: "uint256", name: "", type: "uint256" },
|
|
15516
|
+
{ internalType: "uint256", name: "", type: "uint256" },
|
|
15517
|
+
{ internalType: "bytes", name: "", type: "bytes" },
|
|
15518
|
+
],
|
|
15519
|
+
name: "beforeDonate",
|
|
15520
|
+
outputs: [{ internalType: "bytes4", name: "", type: "bytes4" }],
|
|
15521
|
+
stateMutability: "nonpayable",
|
|
15522
|
+
type: "function",
|
|
15523
|
+
},
|
|
15524
|
+
{
|
|
15525
|
+
inputs: [
|
|
15526
|
+
{ internalType: "address", name: "", type: "address" },
|
|
15527
|
+
{
|
|
15528
|
+
components: [
|
|
15529
|
+
{ internalType: "Currency", name: "currency0", type: "address" },
|
|
15530
|
+
{ internalType: "Currency", name: "currency1", type: "address" },
|
|
15531
|
+
{ internalType: "uint24", name: "fee", type: "uint24" },
|
|
15532
|
+
{ internalType: "int24", name: "tickSpacing", type: "int24" },
|
|
15533
|
+
{ internalType: "contract IHooks", name: "hooks", type: "address" },
|
|
15534
|
+
],
|
|
15535
|
+
internalType: "struct PoolKey",
|
|
15536
|
+
name: "",
|
|
15537
|
+
type: "tuple",
|
|
15538
|
+
},
|
|
15539
|
+
{ internalType: "uint160", name: "", type: "uint160" },
|
|
15540
|
+
],
|
|
15541
|
+
name: "beforeInitialize",
|
|
15542
|
+
outputs: [{ internalType: "bytes4", name: "", type: "bytes4" }],
|
|
15543
|
+
stateMutability: "view",
|
|
15544
|
+
type: "function",
|
|
15545
|
+
},
|
|
15546
|
+
{
|
|
15547
|
+
inputs: [
|
|
15548
|
+
{ internalType: "address", name: "", type: "address" },
|
|
15549
|
+
{
|
|
15550
|
+
components: [
|
|
15551
|
+
{ internalType: "Currency", name: "currency0", type: "address" },
|
|
15552
|
+
{ internalType: "Currency", name: "currency1", type: "address" },
|
|
15553
|
+
{ internalType: "uint24", name: "fee", type: "uint24" },
|
|
15554
|
+
{ internalType: "int24", name: "tickSpacing", type: "int24" },
|
|
15555
|
+
{ internalType: "contract IHooks", name: "hooks", type: "address" },
|
|
15556
|
+
],
|
|
15557
|
+
internalType: "struct PoolKey",
|
|
15558
|
+
name: "",
|
|
15559
|
+
type: "tuple",
|
|
15560
|
+
},
|
|
15561
|
+
{
|
|
15562
|
+
components: [
|
|
15563
|
+
{ internalType: "int24", name: "tickLower", type: "int24" },
|
|
15564
|
+
{ internalType: "int24", name: "tickUpper", type: "int24" },
|
|
15565
|
+
{ internalType: "int256", name: "liquidityDelta", type: "int256" },
|
|
15566
|
+
{ internalType: "bytes32", name: "salt", type: "bytes32" },
|
|
15567
|
+
],
|
|
15568
|
+
internalType: "struct IPoolManager.ModifyLiquidityParams",
|
|
15569
|
+
name: "",
|
|
15570
|
+
type: "tuple",
|
|
15571
|
+
},
|
|
15572
|
+
{ internalType: "bytes", name: "", type: "bytes" },
|
|
15573
|
+
],
|
|
15574
|
+
name: "beforeRemoveLiquidity",
|
|
15575
|
+
outputs: [{ internalType: "bytes4", name: "", type: "bytes4" }],
|
|
15576
|
+
stateMutability: "nonpayable",
|
|
15577
|
+
type: "function",
|
|
15578
|
+
},
|
|
15579
|
+
{
|
|
15580
|
+
inputs: [
|
|
15581
|
+
{ internalType: "address", name: "_sender", type: "address" },
|
|
15582
|
+
{
|
|
15583
|
+
components: [
|
|
15584
|
+
{ internalType: "Currency", name: "currency0", type: "address" },
|
|
15585
|
+
{ internalType: "Currency", name: "currency1", type: "address" },
|
|
15586
|
+
{ internalType: "uint24", name: "fee", type: "uint24" },
|
|
15587
|
+
{ internalType: "int24", name: "tickSpacing", type: "int24" },
|
|
15588
|
+
{ internalType: "contract IHooks", name: "hooks", type: "address" },
|
|
15589
|
+
],
|
|
15590
|
+
internalType: "struct PoolKey",
|
|
15591
|
+
name: "_key",
|
|
15592
|
+
type: "tuple",
|
|
15593
|
+
},
|
|
15594
|
+
{
|
|
15595
|
+
components: [
|
|
15596
|
+
{ internalType: "bool", name: "zeroForOne", type: "bool" },
|
|
15597
|
+
{ internalType: "int256", name: "amountSpecified", type: "int256" },
|
|
15598
|
+
{
|
|
15599
|
+
internalType: "uint160",
|
|
15600
|
+
name: "sqrtPriceLimitX96",
|
|
15601
|
+
type: "uint160",
|
|
15602
|
+
},
|
|
15603
|
+
],
|
|
15604
|
+
internalType: "struct IPoolManager.SwapParams",
|
|
15605
|
+
name: "_params",
|
|
15606
|
+
type: "tuple",
|
|
15607
|
+
},
|
|
15608
|
+
{ internalType: "bytes", name: "_hookData", type: "bytes" },
|
|
15609
|
+
],
|
|
15610
|
+
name: "beforeSwap",
|
|
15611
|
+
outputs: [
|
|
15612
|
+
{ internalType: "bytes4", name: "selector_", type: "bytes4" },
|
|
15613
|
+
{
|
|
15614
|
+
internalType: "BeforeSwapDelta",
|
|
15615
|
+
name: "beforeSwapDelta_",
|
|
15616
|
+
type: "int256",
|
|
15617
|
+
},
|
|
15618
|
+
{ internalType: "uint24", name: "", type: "uint24" },
|
|
15619
|
+
],
|
|
15620
|
+
stateMutability: "nonpayable",
|
|
15621
|
+
type: "function",
|
|
15622
|
+
},
|
|
15623
|
+
{
|
|
15624
|
+
inputs: [],
|
|
15625
|
+
name: "bidWall",
|
|
15626
|
+
outputs: [{ internalType: "contract BidWall", name: "", type: "address" }],
|
|
15627
|
+
stateMutability: "view",
|
|
15628
|
+
type: "function",
|
|
15629
|
+
},
|
|
15630
|
+
{
|
|
15631
|
+
inputs: [],
|
|
15632
|
+
name: "cancelOwnershipHandover",
|
|
15633
|
+
outputs: [],
|
|
15634
|
+
stateMutability: "payable",
|
|
15635
|
+
type: "function",
|
|
15636
|
+
},
|
|
15637
|
+
{
|
|
15638
|
+
inputs: [
|
|
15639
|
+
{
|
|
15640
|
+
components: [
|
|
15641
|
+
{ internalType: "Currency", name: "currency0", type: "address" },
|
|
15642
|
+
{ internalType: "Currency", name: "currency1", type: "address" },
|
|
15643
|
+
{ internalType: "uint24", name: "fee", type: "uint24" },
|
|
15644
|
+
{ internalType: "int24", name: "tickSpacing", type: "int24" },
|
|
15645
|
+
{ internalType: "contract IHooks", name: "hooks", type: "address" },
|
|
15646
|
+
],
|
|
15647
|
+
internalType: "struct PoolKey",
|
|
15648
|
+
name: "_key",
|
|
15649
|
+
type: "tuple",
|
|
15650
|
+
},
|
|
15651
|
+
],
|
|
15652
|
+
name: "closeBidWall",
|
|
15653
|
+
outputs: [],
|
|
15654
|
+
stateMutability: "nonpayable",
|
|
15655
|
+
type: "function",
|
|
15656
|
+
},
|
|
15657
|
+
{
|
|
15658
|
+
inputs: [
|
|
15659
|
+
{ internalType: "address", name: "pendingOwner", type: "address" },
|
|
15660
|
+
],
|
|
15661
|
+
name: "completeOwnershipHandover",
|
|
15662
|
+
outputs: [],
|
|
15663
|
+
stateMutability: "payable",
|
|
15664
|
+
type: "function",
|
|
15665
|
+
},
|
|
15666
|
+
{
|
|
15667
|
+
inputs: [],
|
|
15668
|
+
name: "fairLaunchFeeCalculator",
|
|
15669
|
+
outputs: [
|
|
15670
|
+
{ internalType: "contract IFeeCalculator", name: "", type: "address" },
|
|
15671
|
+
],
|
|
15672
|
+
stateMutability: "view",
|
|
15673
|
+
type: "function",
|
|
15674
|
+
},
|
|
15675
|
+
{
|
|
15676
|
+
inputs: [],
|
|
15677
|
+
name: "feeCalculator",
|
|
15678
|
+
outputs: [
|
|
15679
|
+
{ internalType: "contract IFeeCalculator", name: "", type: "address" },
|
|
15680
|
+
],
|
|
15681
|
+
stateMutability: "view",
|
|
15682
|
+
type: "function",
|
|
15683
|
+
},
|
|
15684
|
+
{
|
|
15685
|
+
inputs: [],
|
|
15686
|
+
name: "feeEscrow",
|
|
15687
|
+
outputs: [
|
|
15688
|
+
{ internalType: "contract FeeEscrow", name: "", type: "address" },
|
|
15689
|
+
],
|
|
15690
|
+
stateMutability: "view",
|
|
15691
|
+
type: "function",
|
|
15692
|
+
},
|
|
15693
|
+
{
|
|
15694
|
+
inputs: [],
|
|
15695
|
+
name: "feeExemptions",
|
|
15696
|
+
outputs: [
|
|
15697
|
+
{ internalType: "contract FeeExemptions", name: "", type: "address" },
|
|
15698
|
+
],
|
|
15699
|
+
stateMutability: "view",
|
|
15700
|
+
type: "function",
|
|
15701
|
+
},
|
|
15702
|
+
{
|
|
15703
|
+
inputs: [
|
|
15704
|
+
{ internalType: "PoolId", name: "_poolId", type: "bytes32" },
|
|
15705
|
+
{ internalType: "uint256", name: "_amount", type: "uint256" },
|
|
15706
|
+
],
|
|
15707
|
+
name: "feeSplit",
|
|
15708
|
+
outputs: [
|
|
15709
|
+
{ internalType: "uint256", name: "bidWall_", type: "uint256" },
|
|
15710
|
+
{ internalType: "uint256", name: "creator_", type: "uint256" },
|
|
15711
|
+
{ internalType: "uint256", name: "protocol_", type: "uint256" },
|
|
15712
|
+
],
|
|
15713
|
+
stateMutability: "view",
|
|
15714
|
+
type: "function",
|
|
15715
|
+
},
|
|
15716
|
+
{
|
|
15717
|
+
inputs: [
|
|
15718
|
+
{
|
|
15719
|
+
components: [
|
|
15720
|
+
{ internalType: "address", name: "memecoin", type: "address" },
|
|
15721
|
+
{ internalType: "address", name: "creator", type: "address" },
|
|
15722
|
+
{
|
|
15723
|
+
internalType: "uint24",
|
|
15724
|
+
name: "creatorFeeAllocation",
|
|
15725
|
+
type: "uint24",
|
|
15726
|
+
},
|
|
15727
|
+
{ internalType: "bytes", name: "initialPriceParams", type: "bytes" },
|
|
15728
|
+
{ internalType: "bytes", name: "feeCalculatorParams", type: "bytes" },
|
|
15729
|
+
],
|
|
15730
|
+
internalType: "struct AnyPositionManager.FlaunchParams",
|
|
15731
|
+
name: "_params",
|
|
15732
|
+
type: "tuple",
|
|
15733
|
+
},
|
|
15734
|
+
],
|
|
15735
|
+
name: "flaunch",
|
|
15736
|
+
outputs: [],
|
|
15737
|
+
stateMutability: "nonpayable",
|
|
15738
|
+
type: "function",
|
|
15739
|
+
},
|
|
15740
|
+
{
|
|
15741
|
+
inputs: [],
|
|
15742
|
+
name: "flaunchContract",
|
|
15743
|
+
outputs: [
|
|
15744
|
+
{ internalType: "contract IAnyFlaunch", name: "", type: "address" },
|
|
15745
|
+
],
|
|
15746
|
+
stateMutability: "view",
|
|
15747
|
+
type: "function",
|
|
15748
|
+
},
|
|
15749
|
+
{
|
|
15750
|
+
inputs: [],
|
|
15751
|
+
name: "flayGovernance",
|
|
15752
|
+
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
15753
|
+
stateMutability: "view",
|
|
15754
|
+
type: "function",
|
|
15755
|
+
},
|
|
15756
|
+
{
|
|
15757
|
+
inputs: [{ internalType: "bool", name: "_isFairLaunch", type: "bool" }],
|
|
15758
|
+
name: "getFeeCalculator",
|
|
15759
|
+
outputs: [
|
|
15760
|
+
{ internalType: "contract IFeeCalculator", name: "", type: "address" },
|
|
15761
|
+
],
|
|
15762
|
+
stateMutability: "view",
|
|
15763
|
+
type: "function",
|
|
15764
|
+
},
|
|
15765
|
+
{
|
|
15766
|
+
inputs: [
|
|
15767
|
+
{ internalType: "bytes", name: "_initialPriceParams", type: "bytes" },
|
|
15768
|
+
],
|
|
15769
|
+
name: "getFlaunchingMarketCap",
|
|
15770
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
15771
|
+
stateMutability: "view",
|
|
15772
|
+
type: "function",
|
|
15773
|
+
},
|
|
15774
|
+
{
|
|
15775
|
+
inputs: [],
|
|
15776
|
+
name: "getHookPermissions",
|
|
15777
|
+
outputs: [
|
|
15778
|
+
{
|
|
15779
|
+
components: [
|
|
15780
|
+
{ internalType: "bool", name: "beforeInitialize", type: "bool" },
|
|
15781
|
+
{ internalType: "bool", name: "afterInitialize", type: "bool" },
|
|
15782
|
+
{ internalType: "bool", name: "beforeAddLiquidity", type: "bool" },
|
|
15783
|
+
{ internalType: "bool", name: "afterAddLiquidity", type: "bool" },
|
|
15784
|
+
{ internalType: "bool", name: "beforeRemoveLiquidity", type: "bool" },
|
|
15785
|
+
{ internalType: "bool", name: "afterRemoveLiquidity", type: "bool" },
|
|
15786
|
+
{ internalType: "bool", name: "beforeSwap", type: "bool" },
|
|
15787
|
+
{ internalType: "bool", name: "afterSwap", type: "bool" },
|
|
15788
|
+
{ internalType: "bool", name: "beforeDonate", type: "bool" },
|
|
15789
|
+
{ internalType: "bool", name: "afterDonate", type: "bool" },
|
|
15790
|
+
{ internalType: "bool", name: "beforeSwapReturnDelta", type: "bool" },
|
|
15791
|
+
{ internalType: "bool", name: "afterSwapReturnDelta", type: "bool" },
|
|
15792
|
+
{
|
|
15793
|
+
internalType: "bool",
|
|
15794
|
+
name: "afterAddLiquidityReturnDelta",
|
|
15795
|
+
type: "bool",
|
|
15796
|
+
},
|
|
15797
|
+
{
|
|
15798
|
+
internalType: "bool",
|
|
15799
|
+
name: "afterRemoveLiquidityReturnDelta",
|
|
15800
|
+
type: "bool",
|
|
15801
|
+
},
|
|
15802
|
+
],
|
|
15803
|
+
internalType: "struct Hooks.Permissions",
|
|
15804
|
+
name: "",
|
|
15805
|
+
type: "tuple",
|
|
15806
|
+
},
|
|
15807
|
+
],
|
|
15808
|
+
stateMutability: "pure",
|
|
15809
|
+
type: "function",
|
|
15810
|
+
},
|
|
15811
|
+
{
|
|
15812
|
+
inputs: [{ internalType: "PoolId", name: "_poolId", type: "bytes32" }],
|
|
15813
|
+
name: "getPoolFeeDistribution",
|
|
15814
|
+
outputs: [
|
|
15815
|
+
{
|
|
15816
|
+
components: [
|
|
15817
|
+
{ internalType: "uint24", name: "swapFee", type: "uint24" },
|
|
15818
|
+
{ internalType: "uint24", name: "referrer", type: "uint24" },
|
|
15819
|
+
{ internalType: "uint24", name: "protocol", type: "uint24" },
|
|
15820
|
+
{ internalType: "bool", name: "active", type: "bool" },
|
|
15821
|
+
],
|
|
15822
|
+
internalType: "struct FeeDistributor.FeeDistribution",
|
|
15823
|
+
name: "feeDistribution_",
|
|
15824
|
+
type: "tuple",
|
|
15825
|
+
},
|
|
15826
|
+
],
|
|
15827
|
+
stateMutability: "view",
|
|
15828
|
+
type: "function",
|
|
15829
|
+
},
|
|
15830
|
+
{
|
|
15831
|
+
inputs: [],
|
|
15832
|
+
name: "initialPrice",
|
|
15833
|
+
outputs: [
|
|
15834
|
+
{ internalType: "contract IInitialPrice", name: "", type: "address" },
|
|
15835
|
+
],
|
|
15836
|
+
stateMutability: "view",
|
|
15837
|
+
type: "function",
|
|
15838
|
+
},
|
|
15839
|
+
{
|
|
15840
|
+
inputs: [],
|
|
15841
|
+
name: "nativeToken",
|
|
15842
|
+
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
15843
|
+
stateMutability: "view",
|
|
15844
|
+
type: "function",
|
|
15845
|
+
},
|
|
15846
|
+
{
|
|
15847
|
+
inputs: [],
|
|
15848
|
+
name: "notifier",
|
|
15849
|
+
outputs: [{ internalType: "contract Notifier", name: "", type: "address" }],
|
|
15850
|
+
stateMutability: "view",
|
|
15851
|
+
type: "function",
|
|
15852
|
+
},
|
|
15853
|
+
{
|
|
15854
|
+
inputs: [],
|
|
15855
|
+
name: "owner",
|
|
15856
|
+
outputs: [{ internalType: "address", name: "result", type: "address" }],
|
|
15857
|
+
stateMutability: "view",
|
|
15858
|
+
type: "function",
|
|
15859
|
+
},
|
|
15860
|
+
{
|
|
15861
|
+
inputs: [
|
|
15862
|
+
{ internalType: "address", name: "pendingOwner", type: "address" },
|
|
15863
|
+
],
|
|
15864
|
+
name: "ownershipHandoverExpiresAt",
|
|
15865
|
+
outputs: [{ internalType: "uint256", name: "result", type: "uint256" }],
|
|
15866
|
+
stateMutability: "view",
|
|
15867
|
+
type: "function",
|
|
15868
|
+
},
|
|
15869
|
+
{
|
|
15870
|
+
inputs: [
|
|
15871
|
+
{
|
|
15872
|
+
components: [
|
|
15873
|
+
{ internalType: "Currency", name: "currency0", type: "address" },
|
|
15874
|
+
{ internalType: "Currency", name: "currency1", type: "address" },
|
|
15875
|
+
{ internalType: "uint24", name: "fee", type: "uint24" },
|
|
15876
|
+
{ internalType: "int24", name: "tickSpacing", type: "int24" },
|
|
15877
|
+
{ internalType: "contract IHooks", name: "hooks", type: "address" },
|
|
15878
|
+
],
|
|
15879
|
+
internalType: "struct PoolKey",
|
|
15880
|
+
name: "_poolKey",
|
|
15881
|
+
type: "tuple",
|
|
15882
|
+
},
|
|
15883
|
+
],
|
|
15884
|
+
name: "poolFees",
|
|
15885
|
+
outputs: [
|
|
15886
|
+
{
|
|
15887
|
+
components: [
|
|
15888
|
+
{ internalType: "uint256", name: "amount0", type: "uint256" },
|
|
15889
|
+
{ internalType: "uint256", name: "amount1", type: "uint256" },
|
|
15890
|
+
],
|
|
15891
|
+
internalType: "struct InternalSwapPool.ClaimableFees",
|
|
15892
|
+
name: "",
|
|
15893
|
+
type: "tuple",
|
|
15894
|
+
},
|
|
15895
|
+
],
|
|
15896
|
+
stateMutability: "view",
|
|
15897
|
+
type: "function",
|
|
15898
|
+
},
|
|
15899
|
+
{
|
|
15900
|
+
inputs: [{ internalType: "address", name: "_token", type: "address" }],
|
|
15901
|
+
name: "poolKey",
|
|
15902
|
+
outputs: [
|
|
15903
|
+
{
|
|
15904
|
+
components: [
|
|
15905
|
+
{ internalType: "Currency", name: "currency0", type: "address" },
|
|
15906
|
+
{ internalType: "Currency", name: "currency1", type: "address" },
|
|
15907
|
+
{ internalType: "uint24", name: "fee", type: "uint24" },
|
|
15908
|
+
{ internalType: "int24", name: "tickSpacing", type: "int24" },
|
|
15909
|
+
{ internalType: "contract IHooks", name: "hooks", type: "address" },
|
|
15910
|
+
],
|
|
15911
|
+
internalType: "struct PoolKey",
|
|
15912
|
+
name: "",
|
|
15913
|
+
type: "tuple",
|
|
15914
|
+
},
|
|
15915
|
+
],
|
|
15916
|
+
stateMutability: "view",
|
|
15917
|
+
type: "function",
|
|
15918
|
+
},
|
|
15919
|
+
{
|
|
15920
|
+
inputs: [],
|
|
15921
|
+
name: "poolManager",
|
|
15922
|
+
outputs: [
|
|
15923
|
+
{ internalType: "contract IPoolManager", name: "", type: "address" },
|
|
15924
|
+
],
|
|
15925
|
+
stateMutability: "view",
|
|
15926
|
+
type: "function",
|
|
15927
|
+
},
|
|
15928
|
+
{
|
|
15929
|
+
inputs: [],
|
|
15930
|
+
name: "referralEscrow",
|
|
15931
|
+
outputs: [
|
|
15932
|
+
{ internalType: "contract ReferralEscrow", name: "", type: "address" },
|
|
15933
|
+
],
|
|
15934
|
+
stateMutability: "view",
|
|
15935
|
+
type: "function",
|
|
15936
|
+
},
|
|
15937
|
+
{
|
|
15938
|
+
inputs: [],
|
|
15939
|
+
name: "renounceOwnership",
|
|
15940
|
+
outputs: [],
|
|
15941
|
+
stateMutability: "payable",
|
|
15942
|
+
type: "function",
|
|
15943
|
+
},
|
|
15944
|
+
{
|
|
15945
|
+
inputs: [],
|
|
15946
|
+
name: "requestOwnershipHandover",
|
|
15947
|
+
outputs: [],
|
|
15948
|
+
stateMutability: "payable",
|
|
15949
|
+
type: "function",
|
|
15950
|
+
},
|
|
15951
|
+
{
|
|
15952
|
+
inputs: [
|
|
15953
|
+
{
|
|
15954
|
+
internalType: "contract IFeeCalculator",
|
|
15955
|
+
name: "_feeCalculator",
|
|
15956
|
+
type: "address",
|
|
15957
|
+
},
|
|
15958
|
+
],
|
|
15959
|
+
name: "setFairLaunchFeeCalculator",
|
|
15960
|
+
outputs: [],
|
|
15961
|
+
stateMutability: "nonpayable",
|
|
15962
|
+
type: "function",
|
|
15963
|
+
},
|
|
15964
|
+
{
|
|
15965
|
+
inputs: [
|
|
15966
|
+
{
|
|
15967
|
+
internalType: "contract IFeeCalculator",
|
|
15968
|
+
name: "_feeCalculator",
|
|
15969
|
+
type: "address",
|
|
15970
|
+
},
|
|
15971
|
+
],
|
|
15972
|
+
name: "setFeeCalculator",
|
|
15973
|
+
outputs: [],
|
|
15974
|
+
stateMutability: "nonpayable",
|
|
15975
|
+
type: "function",
|
|
15976
|
+
},
|
|
15977
|
+
{
|
|
15978
|
+
inputs: [
|
|
15979
|
+
{
|
|
15980
|
+
components: [
|
|
15981
|
+
{ internalType: "uint24", name: "swapFee", type: "uint24" },
|
|
15982
|
+
{ internalType: "uint24", name: "referrer", type: "uint24" },
|
|
15983
|
+
{ internalType: "uint24", name: "protocol", type: "uint24" },
|
|
15984
|
+
{ internalType: "bool", name: "active", type: "bool" },
|
|
15985
|
+
],
|
|
15986
|
+
internalType: "struct FeeDistributor.FeeDistribution",
|
|
15987
|
+
name: "_feeDistribution",
|
|
15988
|
+
type: "tuple",
|
|
15989
|
+
},
|
|
15990
|
+
],
|
|
15991
|
+
name: "setFeeDistribution",
|
|
15992
|
+
outputs: [],
|
|
15993
|
+
stateMutability: "nonpayable",
|
|
15994
|
+
type: "function",
|
|
15995
|
+
},
|
|
15996
|
+
{
|
|
15997
|
+
inputs: [
|
|
15998
|
+
{ internalType: "address", name: "_flaunchContract", type: "address" },
|
|
15999
|
+
],
|
|
16000
|
+
name: "setFlaunch",
|
|
16001
|
+
outputs: [],
|
|
16002
|
+
stateMutability: "nonpayable",
|
|
16003
|
+
type: "function",
|
|
16004
|
+
},
|
|
16005
|
+
{
|
|
16006
|
+
inputs: [
|
|
16007
|
+
{ internalType: "address", name: "_initialPrice", type: "address" },
|
|
16008
|
+
],
|
|
16009
|
+
name: "setInitialPrice",
|
|
16010
|
+
outputs: [],
|
|
16011
|
+
stateMutability: "nonpayable",
|
|
16012
|
+
type: "function",
|
|
16013
|
+
},
|
|
16014
|
+
{
|
|
16015
|
+
inputs: [
|
|
16016
|
+
{ internalType: "PoolId", name: "_poolId", type: "bytes32" },
|
|
16017
|
+
{
|
|
16018
|
+
components: [
|
|
16019
|
+
{ internalType: "uint24", name: "swapFee", type: "uint24" },
|
|
16020
|
+
{ internalType: "uint24", name: "referrer", type: "uint24" },
|
|
16021
|
+
{ internalType: "uint24", name: "protocol", type: "uint24" },
|
|
16022
|
+
{ internalType: "bool", name: "active", type: "bool" },
|
|
16023
|
+
],
|
|
16024
|
+
internalType: "struct FeeDistributor.FeeDistribution",
|
|
16025
|
+
name: "_feeDistribution",
|
|
16026
|
+
type: "tuple",
|
|
16027
|
+
},
|
|
16028
|
+
],
|
|
16029
|
+
name: "setPoolFeeDistribution",
|
|
16030
|
+
outputs: [],
|
|
16031
|
+
stateMutability: "nonpayable",
|
|
16032
|
+
type: "function",
|
|
16033
|
+
},
|
|
16034
|
+
{
|
|
16035
|
+
inputs: [{ internalType: "uint24", name: "_protocol", type: "uint24" }],
|
|
16036
|
+
name: "setProtocolFeeDistribution",
|
|
16037
|
+
outputs: [],
|
|
16038
|
+
stateMutability: "nonpayable",
|
|
16039
|
+
type: "function",
|
|
16040
|
+
},
|
|
16041
|
+
{
|
|
16042
|
+
inputs: [
|
|
16043
|
+
{
|
|
16044
|
+
internalType: "address payable",
|
|
16045
|
+
name: "_referralEscrow",
|
|
16046
|
+
type: "address",
|
|
16047
|
+
},
|
|
16048
|
+
],
|
|
16049
|
+
name: "setReferralEscrow",
|
|
16050
|
+
outputs: [],
|
|
16051
|
+
stateMutability: "nonpayable",
|
|
16052
|
+
type: "function",
|
|
16053
|
+
},
|
|
16054
|
+
{
|
|
16055
|
+
inputs: [{ internalType: "address", name: "newOwner", type: "address" }],
|
|
16056
|
+
name: "transferOwnership",
|
|
16057
|
+
outputs: [],
|
|
16058
|
+
stateMutability: "payable",
|
|
16059
|
+
type: "function",
|
|
16060
|
+
},
|
|
16061
|
+
{
|
|
16062
|
+
inputs: [{ internalType: "bytes", name: "data", type: "bytes" }],
|
|
16063
|
+
name: "unlockCallback",
|
|
16064
|
+
outputs: [{ internalType: "bytes", name: "", type: "bytes" }],
|
|
16065
|
+
stateMutability: "nonpayable",
|
|
16066
|
+
type: "function",
|
|
16067
|
+
},
|
|
16068
|
+
{ stateMutability: "payable", type: "receive" },
|
|
16069
|
+
];
|
|
16070
|
+
|
|
16071
|
+
class ReadAnyPositionManager {
|
|
16072
|
+
constructor(address, drift$1 = drift.createDrift()) {
|
|
16073
|
+
this.TOTAL_SUPPLY = 100n * 10n ** 27n; // 100 Billion tokens in wei
|
|
16074
|
+
this.drift = drift$1;
|
|
16075
|
+
if (!address) {
|
|
16076
|
+
throw new Error("Address is required");
|
|
16077
|
+
}
|
|
16078
|
+
this.contract = drift$1.contract({
|
|
16079
|
+
abi: AnyPositionManagerAbi,
|
|
16080
|
+
address,
|
|
16081
|
+
});
|
|
16082
|
+
}
|
|
16083
|
+
async isValidCoin(coinAddress) {
|
|
16084
|
+
const poolKey = await this.contract.read("poolKey", {
|
|
16085
|
+
_token: coinAddress,
|
|
16086
|
+
});
|
|
16087
|
+
return poolKey.tickSpacing !== 0;
|
|
16088
|
+
}
|
|
16089
|
+
async getFlaunchingFee(params) {
|
|
16090
|
+
return 0n;
|
|
16091
|
+
}
|
|
16092
|
+
async watchPoolCreated({ onPoolCreated, startBlockNumber, }) {
|
|
16093
|
+
let intervalId;
|
|
16094
|
+
if (startBlockNumber !== undefined) {
|
|
16095
|
+
onPoolCreated({
|
|
16096
|
+
logs: [],
|
|
16097
|
+
isFetchingFromStart: true,
|
|
16098
|
+
});
|
|
16099
|
+
}
|
|
16100
|
+
let lastBlockNumber = startBlockNumber
|
|
16101
|
+
? startBlockNumber - 1n
|
|
16102
|
+
: await this.drift.getBlockNumber();
|
|
16103
|
+
const pollEvents = async () => {
|
|
16104
|
+
try {
|
|
16105
|
+
const currentBlockNumber = await this.drift.getBlockNumber();
|
|
16106
|
+
if (currentBlockNumber > lastBlockNumber) {
|
|
16107
|
+
const _logs = await this.contract.getEvents("PoolCreated", {
|
|
16108
|
+
fromBlock: lastBlockNumber + 1n,
|
|
16109
|
+
toBlock: currentBlockNumber,
|
|
16110
|
+
});
|
|
16111
|
+
// Get timestamps for each log
|
|
16112
|
+
const logsWithTimestamps = await Promise.all([..._logs].reverse().map(async (log) => {
|
|
16113
|
+
const block = await this.drift.getBlock(log.blockNumber);
|
|
16114
|
+
return {
|
|
16115
|
+
...log,
|
|
16116
|
+
timestamp: Number(block?.timestamp) * 1000, // convert to ms for js
|
|
16117
|
+
};
|
|
16118
|
+
}));
|
|
16119
|
+
if (logsWithTimestamps.length > 0) {
|
|
16120
|
+
onPoolCreated({
|
|
16121
|
+
logs: logsWithTimestamps,
|
|
16122
|
+
isFetchingFromStart: false,
|
|
16123
|
+
});
|
|
16124
|
+
}
|
|
16125
|
+
else {
|
|
16126
|
+
onPoolCreated({
|
|
16127
|
+
logs: [],
|
|
16128
|
+
isFetchingFromStart: false,
|
|
16129
|
+
});
|
|
16130
|
+
}
|
|
16131
|
+
lastBlockNumber = currentBlockNumber;
|
|
16132
|
+
}
|
|
16133
|
+
}
|
|
16134
|
+
catch (error) {
|
|
16135
|
+
console.error("Error polling events:", error);
|
|
16136
|
+
}
|
|
16137
|
+
};
|
|
16138
|
+
intervalId = setInterval(pollEvents, 5000);
|
|
16139
|
+
this.pollPoolCreatedNow = pollEvents;
|
|
16140
|
+
// Return both cleanup function and immediate poll function
|
|
16141
|
+
return {
|
|
16142
|
+
cleanup: () => {
|
|
16143
|
+
if (intervalId) {
|
|
16144
|
+
clearInterval(intervalId);
|
|
16145
|
+
}
|
|
16146
|
+
// Clear the pollNow function when cleaning up
|
|
16147
|
+
this.pollPoolCreatedNow = undefined;
|
|
16148
|
+
},
|
|
16149
|
+
pollPoolCreatedNow: pollEvents,
|
|
16150
|
+
};
|
|
16151
|
+
}
|
|
16152
|
+
async watchPoolSwap({ onPoolSwap, flETHIsCurrencyZero, startBlockNumber, filterByPoolId, }) {
|
|
16153
|
+
let intervalId;
|
|
16154
|
+
if (startBlockNumber !== undefined) {
|
|
16155
|
+
onPoolSwap({
|
|
16156
|
+
logs: [],
|
|
16157
|
+
isFetchingFromStart: true,
|
|
16158
|
+
});
|
|
16159
|
+
}
|
|
16160
|
+
let lastBlockNumber = startBlockNumber
|
|
16161
|
+
? startBlockNumber - 1n
|
|
16162
|
+
: await this.drift.getBlockNumber();
|
|
16163
|
+
const pollEvents = async () => {
|
|
16164
|
+
try {
|
|
16165
|
+
const currentBlockNumber = await this.drift.getBlockNumber();
|
|
16166
|
+
if (currentBlockNumber > lastBlockNumber) {
|
|
16167
|
+
const _logs = await this.contract.getEvents("PoolSwap", {
|
|
16168
|
+
fromBlock: lastBlockNumber + 1n,
|
|
16169
|
+
toBlock: currentBlockNumber,
|
|
16170
|
+
filter: {
|
|
16171
|
+
poolId: filterByPoolId,
|
|
16172
|
+
},
|
|
16173
|
+
});
|
|
16174
|
+
// Get timestamps for each log
|
|
16175
|
+
const logsWithTimestamps = await Promise.all([..._logs].reverse().map(async (log) => {
|
|
16176
|
+
const block = await this.drift.getBlock(log.blockNumber);
|
|
16177
|
+
const timestamp = Number(block?.timestamp) * 1000; // convert to ms for js
|
|
16178
|
+
if (flETHIsCurrencyZero === undefined) {
|
|
16179
|
+
return {
|
|
16180
|
+
...log,
|
|
16181
|
+
timestamp,
|
|
16182
|
+
};
|
|
16183
|
+
}
|
|
16184
|
+
const { flAmount0, flAmount1, flFee0, flFee1, ispAmount0, ispAmount1, ispFee0, ispFee1, uniAmount0, uniAmount1, uniFee0, uniFee1, } = log.args;
|
|
16185
|
+
const currency0Delta = flAmount0 + ispAmount0 + uniAmount0;
|
|
16186
|
+
const currency1Delta = flAmount1 + ispAmount1 + uniAmount1;
|
|
16187
|
+
const currency0Fees = flFee0 + ispFee0 + uniFee0;
|
|
16188
|
+
const currency1Fees = flFee1 + ispFee1 + uniFee1;
|
|
16189
|
+
let feesIsInFLETH;
|
|
16190
|
+
let swapType;
|
|
16191
|
+
if (flETHIsCurrencyZero) {
|
|
16192
|
+
swapType = currency0Delta < 0 ? "BUY" : "SELL";
|
|
16193
|
+
feesIsInFLETH = currency0Fees < 0;
|
|
16194
|
+
}
|
|
16195
|
+
else {
|
|
16196
|
+
swapType = currency1Delta < 0 ? "BUY" : "SELL";
|
|
16197
|
+
feesIsInFLETH = currency1Fees < 0;
|
|
16198
|
+
}
|
|
16199
|
+
const absCurrency0Delta = currency0Delta < 0 ? -currency0Delta : currency0Delta;
|
|
16200
|
+
const absCurrency1Delta = currency1Delta < 0 ? -currency1Delta : currency1Delta;
|
|
16201
|
+
const absCurrency0Fees = currency0Fees < 0 ? -currency0Fees : currency0Fees;
|
|
16202
|
+
const absCurrency1Fees = currency1Fees < 0 ? -currency1Fees : currency1Fees;
|
|
16203
|
+
const fees = {
|
|
16204
|
+
isInFLETH: feesIsInFLETH,
|
|
16205
|
+
amount: flETHIsCurrencyZero
|
|
16206
|
+
? feesIsInFLETH
|
|
16207
|
+
? absCurrency0Fees
|
|
16208
|
+
: absCurrency1Fees
|
|
16209
|
+
: feesIsInFLETH
|
|
16210
|
+
? absCurrency1Fees
|
|
16211
|
+
: absCurrency0Fees,
|
|
16212
|
+
};
|
|
16213
|
+
if (swapType === "BUY") {
|
|
16214
|
+
return {
|
|
16215
|
+
...log,
|
|
16216
|
+
timestamp,
|
|
16217
|
+
type: swapType,
|
|
16218
|
+
delta: {
|
|
16219
|
+
coinsBought: flETHIsCurrencyZero
|
|
16220
|
+
? absCurrency1Delta - (!fees.isInFLETH ? fees.amount : 0n)
|
|
16221
|
+
: absCurrency0Delta -
|
|
16222
|
+
(!fees.isInFLETH ? fees.amount : 0n),
|
|
16223
|
+
flETHSold: flETHIsCurrencyZero
|
|
16224
|
+
? absCurrency0Delta - (fees.isInFLETH ? fees.amount : 0n)
|
|
16225
|
+
: absCurrency1Delta - (fees.isInFLETH ? fees.amount : 0n),
|
|
16226
|
+
fees,
|
|
16227
|
+
},
|
|
16228
|
+
};
|
|
16229
|
+
}
|
|
16230
|
+
else {
|
|
16231
|
+
return {
|
|
16232
|
+
...log,
|
|
16233
|
+
timestamp,
|
|
16234
|
+
type: swapType,
|
|
16235
|
+
delta: {
|
|
16236
|
+
coinsSold: flETHIsCurrencyZero
|
|
16237
|
+
? absCurrency1Delta - (!fees.isInFLETH ? fees.amount : 0n)
|
|
16238
|
+
: absCurrency0Delta -
|
|
16239
|
+
(!fees.isInFLETH ? fees.amount : 0n),
|
|
16240
|
+
flETHBought: flETHIsCurrencyZero
|
|
16241
|
+
? absCurrency0Delta - (fees.isInFLETH ? fees.amount : 0n)
|
|
16242
|
+
: absCurrency1Delta - (fees.isInFLETH ? fees.amount : 0n),
|
|
16243
|
+
fees,
|
|
16244
|
+
},
|
|
16245
|
+
};
|
|
16246
|
+
}
|
|
16247
|
+
}));
|
|
16248
|
+
if (logsWithTimestamps.length > 0) {
|
|
16249
|
+
onPoolSwap({
|
|
16250
|
+
logs: logsWithTimestamps,
|
|
16251
|
+
isFetchingFromStart: false,
|
|
16252
|
+
});
|
|
16253
|
+
}
|
|
16254
|
+
else {
|
|
16255
|
+
onPoolSwap({
|
|
16256
|
+
logs: [],
|
|
16257
|
+
isFetchingFromStart: false,
|
|
16258
|
+
});
|
|
16259
|
+
}
|
|
16260
|
+
lastBlockNumber = currentBlockNumber;
|
|
16261
|
+
}
|
|
16262
|
+
}
|
|
16263
|
+
catch (error) {
|
|
16264
|
+
console.error("Error polling events:", error);
|
|
16265
|
+
}
|
|
16266
|
+
};
|
|
16267
|
+
intervalId = setInterval(pollEvents, 5000);
|
|
16268
|
+
this.pollPoolSwapNow = pollEvents;
|
|
16269
|
+
// Return both cleanup function and immediate poll function
|
|
16270
|
+
return {
|
|
16271
|
+
cleanup: () => {
|
|
16272
|
+
if (intervalId) {
|
|
16273
|
+
clearInterval(intervalId);
|
|
16274
|
+
}
|
|
16275
|
+
// Clear the pollNow function when cleaning up
|
|
16276
|
+
this.pollPoolSwapNow = undefined;
|
|
16277
|
+
},
|
|
16278
|
+
pollPoolSwapNow: pollEvents,
|
|
16279
|
+
};
|
|
16280
|
+
}
|
|
16281
|
+
}
|
|
16282
|
+
class ReadWriteAnyPositionManager extends ReadAnyPositionManager {
|
|
16283
|
+
constructor(address, drift$1 = drift.createDrift()) {
|
|
16284
|
+
super(address, drift$1);
|
|
16285
|
+
}
|
|
16286
|
+
async flaunch({ memecoin, initialMarketCapUSD, creator, creatorFeeAllocationPercent, }) {
|
|
16287
|
+
const initialMCapInUSDCWei = viem.parseUnits(initialMarketCapUSD.toString(), 6);
|
|
16288
|
+
const initialPriceParams = viem.encodeAbiParameters([
|
|
16289
|
+
{
|
|
16290
|
+
type: "uint256",
|
|
16291
|
+
},
|
|
16292
|
+
], [initialMCapInUSDCWei]);
|
|
16293
|
+
const creatorFeeAllocationInBps = creatorFeeAllocationPercent * 100;
|
|
16294
|
+
return this.contract.write("flaunch", {
|
|
16295
|
+
_params: {
|
|
16296
|
+
memecoin,
|
|
16297
|
+
creator,
|
|
16298
|
+
creatorFeeAllocation: creatorFeeAllocationInBps,
|
|
16299
|
+
initialPriceParams,
|
|
16300
|
+
feeCalculatorParams: "0x",
|
|
16301
|
+
},
|
|
16302
|
+
}, {
|
|
16303
|
+
onMined: async () => {
|
|
16304
|
+
if (this.pollPoolCreatedNow) {
|
|
16305
|
+
await this.pollPoolCreatedNow();
|
|
16306
|
+
}
|
|
16307
|
+
},
|
|
16308
|
+
});
|
|
16309
|
+
}
|
|
16310
|
+
}
|
|
16311
|
+
|
|
16312
|
+
const FeeEscrowAbi = [
|
|
16313
|
+
{
|
|
16314
|
+
inputs: [
|
|
16315
|
+
{ internalType: "address", name: "_nativeToken", type: "address" },
|
|
16316
|
+
{ internalType: "address", name: "_indexer", type: "address" },
|
|
16317
|
+
],
|
|
16318
|
+
stateMutability: "nonpayable",
|
|
16319
|
+
type: "constructor",
|
|
16320
|
+
},
|
|
16321
|
+
{ inputs: [], name: "AlreadyInitialized", type: "error" },
|
|
16322
|
+
{ inputs: [], name: "InvalidRecipient", type: "error" },
|
|
16323
|
+
{ inputs: [], name: "NewOwnerIsZeroAddress", type: "error" },
|
|
16324
|
+
{ inputs: [], name: "NoHandoverRequest", type: "error" },
|
|
16325
|
+
{ inputs: [], name: "PoolIdNotIndexed", type: "error" },
|
|
16326
|
+
{ inputs: [], name: "RecipientZeroAddress", type: "error" },
|
|
16327
|
+
{ inputs: [], name: "Unauthorized", type: "error" },
|
|
16328
|
+
{
|
|
16329
|
+
anonymous: false,
|
|
16330
|
+
inputs: [
|
|
16331
|
+
{
|
|
16332
|
+
indexed: true,
|
|
16333
|
+
internalType: "PoolId",
|
|
16334
|
+
name: "_poolId",
|
|
16335
|
+
type: "bytes32",
|
|
16336
|
+
},
|
|
16337
|
+
{
|
|
16338
|
+
indexed: false,
|
|
16339
|
+
internalType: "address",
|
|
16340
|
+
name: "_payee",
|
|
16341
|
+
type: "address",
|
|
16342
|
+
},
|
|
16343
|
+
{
|
|
16344
|
+
indexed: false,
|
|
16345
|
+
internalType: "address",
|
|
16346
|
+
name: "_token",
|
|
16347
|
+
type: "address",
|
|
16348
|
+
},
|
|
16349
|
+
{
|
|
16350
|
+
indexed: false,
|
|
16351
|
+
internalType: "uint256",
|
|
16352
|
+
name: "_amount",
|
|
16353
|
+
type: "uint256",
|
|
16354
|
+
},
|
|
16355
|
+
],
|
|
16356
|
+
name: "Deposit",
|
|
16357
|
+
type: "event",
|
|
16358
|
+
},
|
|
16359
|
+
{
|
|
16360
|
+
anonymous: false,
|
|
16361
|
+
inputs: [
|
|
16362
|
+
{
|
|
16363
|
+
indexed: true,
|
|
16364
|
+
internalType: "address",
|
|
16365
|
+
name: "pendingOwner",
|
|
16366
|
+
type: "address",
|
|
16367
|
+
},
|
|
16368
|
+
],
|
|
16369
|
+
name: "OwnershipHandoverCanceled",
|
|
16370
|
+
type: "event",
|
|
16371
|
+
},
|
|
16372
|
+
{
|
|
16373
|
+
anonymous: false,
|
|
16374
|
+
inputs: [
|
|
16375
|
+
{
|
|
16376
|
+
indexed: true,
|
|
16377
|
+
internalType: "address",
|
|
16378
|
+
name: "pendingOwner",
|
|
16379
|
+
type: "address",
|
|
16380
|
+
},
|
|
16381
|
+
],
|
|
16382
|
+
name: "OwnershipHandoverRequested",
|
|
16383
|
+
type: "event",
|
|
16384
|
+
},
|
|
16385
|
+
{
|
|
16386
|
+
anonymous: false,
|
|
16387
|
+
inputs: [
|
|
16388
|
+
{
|
|
16389
|
+
indexed: true,
|
|
16390
|
+
internalType: "address",
|
|
16391
|
+
name: "oldOwner",
|
|
16392
|
+
type: "address",
|
|
16393
|
+
},
|
|
16394
|
+
{
|
|
16395
|
+
indexed: true,
|
|
16396
|
+
internalType: "address",
|
|
16397
|
+
name: "newOwner",
|
|
16398
|
+
type: "address",
|
|
16399
|
+
},
|
|
16400
|
+
],
|
|
16401
|
+
name: "OwnershipTransferred",
|
|
16402
|
+
type: "event",
|
|
16403
|
+
},
|
|
16404
|
+
{
|
|
16405
|
+
anonymous: false,
|
|
16406
|
+
inputs: [
|
|
16407
|
+
{
|
|
16408
|
+
indexed: false,
|
|
16409
|
+
internalType: "address",
|
|
16410
|
+
name: "_sender",
|
|
16411
|
+
type: "address",
|
|
16412
|
+
},
|
|
16413
|
+
{
|
|
16414
|
+
indexed: false,
|
|
16415
|
+
internalType: "address",
|
|
16416
|
+
name: "_recipient",
|
|
16417
|
+
type: "address",
|
|
16418
|
+
},
|
|
16419
|
+
{
|
|
16420
|
+
indexed: false,
|
|
16421
|
+
internalType: "address",
|
|
16422
|
+
name: "_token",
|
|
16423
|
+
type: "address",
|
|
16424
|
+
},
|
|
16425
|
+
{
|
|
16426
|
+
indexed: false,
|
|
16427
|
+
internalType: "uint256",
|
|
16428
|
+
name: "_amount",
|
|
16429
|
+
type: "uint256",
|
|
16430
|
+
},
|
|
16431
|
+
],
|
|
16432
|
+
name: "Withdrawal",
|
|
16433
|
+
type: "event",
|
|
16434
|
+
},
|
|
16435
|
+
{
|
|
16436
|
+
inputs: [
|
|
16437
|
+
{ internalType: "PoolId", name: "_poolId", type: "bytes32" },
|
|
16438
|
+
{ internalType: "address", name: "_recipient", type: "address" },
|
|
16439
|
+
{ internalType: "uint256", name: "_amount", type: "uint256" },
|
|
16440
|
+
],
|
|
16441
|
+
name: "allocateFees",
|
|
16442
|
+
outputs: [],
|
|
16443
|
+
stateMutability: "nonpayable",
|
|
16444
|
+
type: "function",
|
|
16445
|
+
},
|
|
16446
|
+
{
|
|
16447
|
+
inputs: [{ internalType: "address", name: "_recipient", type: "address" }],
|
|
16448
|
+
name: "balances",
|
|
16449
|
+
outputs: [{ internalType: "uint256", name: "_amount", type: "uint256" }],
|
|
16450
|
+
stateMutability: "view",
|
|
16451
|
+
type: "function",
|
|
16452
|
+
},
|
|
16453
|
+
{
|
|
16454
|
+
inputs: [],
|
|
16455
|
+
name: "cancelOwnershipHandover",
|
|
16456
|
+
outputs: [],
|
|
16457
|
+
stateMutability: "payable",
|
|
16458
|
+
type: "function",
|
|
16459
|
+
},
|
|
16460
|
+
{
|
|
16461
|
+
inputs: [
|
|
16462
|
+
{ internalType: "address", name: "pendingOwner", type: "address" },
|
|
16463
|
+
],
|
|
16464
|
+
name: "completeOwnershipHandover",
|
|
16465
|
+
outputs: [],
|
|
16466
|
+
stateMutability: "payable",
|
|
16467
|
+
type: "function",
|
|
16468
|
+
},
|
|
16469
|
+
{
|
|
16470
|
+
inputs: [],
|
|
16471
|
+
name: "indexer",
|
|
16472
|
+
outputs: [
|
|
16473
|
+
{ internalType: "contract IndexerSubscriber", name: "", type: "address" },
|
|
16474
|
+
],
|
|
16475
|
+
stateMutability: "view",
|
|
16476
|
+
type: "function",
|
|
16477
|
+
},
|
|
16478
|
+
{
|
|
16479
|
+
inputs: [],
|
|
16480
|
+
name: "nativeToken",
|
|
16481
|
+
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
16482
|
+
stateMutability: "view",
|
|
16483
|
+
type: "function",
|
|
16484
|
+
},
|
|
16485
|
+
{
|
|
16486
|
+
inputs: [],
|
|
16487
|
+
name: "owner",
|
|
16488
|
+
outputs: [{ internalType: "address", name: "result", type: "address" }],
|
|
16489
|
+
stateMutability: "view",
|
|
16490
|
+
type: "function",
|
|
16491
|
+
},
|
|
16492
|
+
{
|
|
16493
|
+
inputs: [
|
|
16494
|
+
{ internalType: "address", name: "pendingOwner", type: "address" },
|
|
16495
|
+
],
|
|
16496
|
+
name: "ownershipHandoverExpiresAt",
|
|
16497
|
+
outputs: [{ internalType: "uint256", name: "result", type: "uint256" }],
|
|
16498
|
+
stateMutability: "view",
|
|
16499
|
+
type: "function",
|
|
16500
|
+
},
|
|
16501
|
+
{
|
|
16502
|
+
inputs: [],
|
|
16503
|
+
name: "renounceOwnership",
|
|
16504
|
+
outputs: [],
|
|
16505
|
+
stateMutability: "payable",
|
|
16506
|
+
type: "function",
|
|
16507
|
+
},
|
|
16508
|
+
{
|
|
16509
|
+
inputs: [],
|
|
16510
|
+
name: "requestOwnershipHandover",
|
|
16511
|
+
outputs: [],
|
|
16512
|
+
stateMutability: "payable",
|
|
16513
|
+
type: "function",
|
|
16514
|
+
},
|
|
16515
|
+
{
|
|
16516
|
+
inputs: [{ internalType: "address", name: "_indexer", type: "address" }],
|
|
16517
|
+
name: "setIndexer",
|
|
16518
|
+
outputs: [],
|
|
16519
|
+
stateMutability: "nonpayable",
|
|
16520
|
+
type: "function",
|
|
16521
|
+
},
|
|
16522
|
+
{
|
|
16523
|
+
inputs: [{ internalType: "PoolId", name: "_poolId", type: "bytes32" }],
|
|
16524
|
+
name: "totalFeesAllocated",
|
|
16525
|
+
outputs: [{ internalType: "uint256", name: "_amount", type: "uint256" }],
|
|
16526
|
+
stateMutability: "view",
|
|
16527
|
+
type: "function",
|
|
16528
|
+
},
|
|
16529
|
+
{
|
|
16530
|
+
inputs: [{ internalType: "address", name: "newOwner", type: "address" }],
|
|
16531
|
+
name: "transferOwnership",
|
|
16532
|
+
outputs: [],
|
|
16533
|
+
stateMutability: "payable",
|
|
16534
|
+
type: "function",
|
|
16535
|
+
},
|
|
16536
|
+
{
|
|
16537
|
+
inputs: [
|
|
16538
|
+
{ internalType: "address", name: "_recipient", type: "address" },
|
|
16539
|
+
{ internalType: "bool", name: "_unwrap", type: "bool" },
|
|
16540
|
+
],
|
|
16541
|
+
name: "withdrawFees",
|
|
16542
|
+
outputs: [],
|
|
16543
|
+
stateMutability: "nonpayable",
|
|
16544
|
+
type: "function",
|
|
16545
|
+
},
|
|
16546
|
+
{ stateMutability: "payable", type: "receive" },
|
|
16547
|
+
];
|
|
16548
|
+
|
|
16549
|
+
/**
|
|
16550
|
+
* Client for interacting with the FeeEscrow contract in read-only mode
|
|
16551
|
+
* Provides methods to query fee balances and withdraw fees
|
|
16552
|
+
*/
|
|
16553
|
+
class ReadFeeEscrow {
|
|
16554
|
+
/**
|
|
16555
|
+
* Creates a new ReadFeeEscrow instance
|
|
16556
|
+
* @param address - The address of the FeeEscrow contract
|
|
16557
|
+
* @param drift - Optional drift instance for contract interactions (creates new instance if not provided)
|
|
16558
|
+
* @throws Error if address is not provided
|
|
16559
|
+
*/
|
|
16560
|
+
constructor(address, drift$1 = drift.createDrift()) {
|
|
16561
|
+
if (!address) {
|
|
16562
|
+
throw new Error("Address is required");
|
|
16563
|
+
}
|
|
16564
|
+
this.contract = drift$1.contract({
|
|
16565
|
+
abi: FeeEscrowAbi,
|
|
16566
|
+
address,
|
|
16567
|
+
});
|
|
16568
|
+
}
|
|
16569
|
+
/**
|
|
16570
|
+
* Gets the claimable balance of fees for a creator
|
|
16571
|
+
* @param creator - The address of the creator to check
|
|
16572
|
+
* @returns Promise<bigint> - The claimable balance of fees
|
|
16573
|
+
*/
|
|
16574
|
+
balances(creator) {
|
|
16575
|
+
return this.contract.read("balances", {
|
|
16576
|
+
_recipient: creator,
|
|
16577
|
+
});
|
|
16578
|
+
}
|
|
16579
|
+
}
|
|
16580
|
+
/**
|
|
16581
|
+
* Extended client for interacting with the FeeEscrow contract with write capabilities
|
|
16582
|
+
* Provides methods to withdraw fees
|
|
16583
|
+
*/
|
|
16584
|
+
class ReadWriteFeeEscrow extends ReadFeeEscrow {
|
|
16585
|
+
constructor(address, drift$1 = drift.createDrift()) {
|
|
16586
|
+
super(address, drift$1);
|
|
16587
|
+
}
|
|
16588
|
+
/**
|
|
16589
|
+
* Withdraws fees as ETH to a recipient
|
|
16590
|
+
* @param recipient - The address to receive the fees
|
|
16591
|
+
* @param unwrap - Whether to unwrap the native token before sending
|
|
16592
|
+
* @returns Promise<void>
|
|
16593
|
+
*/
|
|
16594
|
+
withdrawFees(recipient) {
|
|
16595
|
+
return this.contract.write("withdrawFees", {
|
|
16596
|
+
_recipient: recipient,
|
|
16597
|
+
_unwrap: true,
|
|
16598
|
+
});
|
|
16599
|
+
}
|
|
16600
|
+
}
|
|
16601
|
+
|
|
16602
|
+
const ReferralEscrowAbi = [
|
|
16603
|
+
{
|
|
16604
|
+
inputs: [
|
|
16605
|
+
{ internalType: "address", name: "_nativeToken", type: "address" },
|
|
16606
|
+
{ internalType: "address", name: "_positionManager", type: "address" },
|
|
16607
|
+
],
|
|
16608
|
+
stateMutability: "nonpayable",
|
|
16609
|
+
type: "constructor",
|
|
16610
|
+
},
|
|
16611
|
+
{ inputs: [], name: "AlreadyInitialized", type: "error" },
|
|
16612
|
+
{ inputs: [], name: "MismatchedTokensAndLimits", type: "error" },
|
|
16613
|
+
{ inputs: [], name: "NewOwnerIsZeroAddress", type: "error" },
|
|
16614
|
+
{ inputs: [], name: "NoHandoverRequest", type: "error" },
|
|
16615
|
+
{ inputs: [], name: "Unauthorized", type: "error" },
|
|
16616
|
+
{
|
|
16617
|
+
anonymous: false,
|
|
16618
|
+
inputs: [
|
|
16619
|
+
{
|
|
16620
|
+
indexed: true,
|
|
16621
|
+
internalType: "address",
|
|
16622
|
+
name: "pendingOwner",
|
|
16623
|
+
type: "address",
|
|
16624
|
+
},
|
|
16625
|
+
],
|
|
16626
|
+
name: "OwnershipHandoverCanceled",
|
|
16627
|
+
type: "event",
|
|
16628
|
+
},
|
|
16629
|
+
{
|
|
16630
|
+
anonymous: false,
|
|
16631
|
+
inputs: [
|
|
16632
|
+
{
|
|
16633
|
+
indexed: true,
|
|
16634
|
+
internalType: "address",
|
|
16635
|
+
name: "pendingOwner",
|
|
16636
|
+
type: "address",
|
|
16637
|
+
},
|
|
16638
|
+
],
|
|
16639
|
+
name: "OwnershipHandoverRequested",
|
|
16640
|
+
type: "event",
|
|
16641
|
+
},
|
|
16642
|
+
{
|
|
16643
|
+
anonymous: false,
|
|
16644
|
+
inputs: [
|
|
16645
|
+
{
|
|
16646
|
+
indexed: true,
|
|
16647
|
+
internalType: "address",
|
|
16648
|
+
name: "oldOwner",
|
|
16649
|
+
type: "address",
|
|
16650
|
+
},
|
|
16651
|
+
{
|
|
16652
|
+
indexed: true,
|
|
16653
|
+
internalType: "address",
|
|
16654
|
+
name: "newOwner",
|
|
16655
|
+
type: "address",
|
|
16656
|
+
},
|
|
16657
|
+
],
|
|
16658
|
+
name: "OwnershipTransferred",
|
|
16659
|
+
type: "event",
|
|
16660
|
+
},
|
|
16661
|
+
{
|
|
16662
|
+
anonymous: false,
|
|
16663
|
+
inputs: [
|
|
16664
|
+
{
|
|
16665
|
+
indexed: true,
|
|
16666
|
+
internalType: "PoolId",
|
|
16667
|
+
name: "_poolId",
|
|
16668
|
+
type: "bytes32",
|
|
16669
|
+
},
|
|
16670
|
+
{
|
|
16671
|
+
indexed: true,
|
|
16672
|
+
internalType: "address",
|
|
16673
|
+
name: "_user",
|
|
16674
|
+
type: "address",
|
|
16675
|
+
},
|
|
16676
|
+
{
|
|
16677
|
+
indexed: true,
|
|
16678
|
+
internalType: "address",
|
|
16679
|
+
name: "_token",
|
|
16680
|
+
type: "address",
|
|
16681
|
+
},
|
|
16682
|
+
{
|
|
16683
|
+
indexed: false,
|
|
16684
|
+
internalType: "uint256",
|
|
16685
|
+
name: "_amount",
|
|
16686
|
+
type: "uint256",
|
|
16687
|
+
},
|
|
16688
|
+
],
|
|
16689
|
+
name: "TokensAssigned",
|
|
16690
|
+
type: "event",
|
|
16691
|
+
},
|
|
16692
|
+
{
|
|
16693
|
+
anonymous: false,
|
|
16694
|
+
inputs: [
|
|
16695
|
+
{
|
|
16696
|
+
indexed: true,
|
|
16697
|
+
internalType: "address",
|
|
16698
|
+
name: "_user",
|
|
16699
|
+
type: "address",
|
|
16700
|
+
},
|
|
16701
|
+
{
|
|
16702
|
+
indexed: false,
|
|
16703
|
+
internalType: "address",
|
|
16704
|
+
name: "_recipient",
|
|
16705
|
+
type: "address",
|
|
16706
|
+
},
|
|
16707
|
+
{
|
|
16708
|
+
indexed: true,
|
|
16709
|
+
internalType: "address",
|
|
16710
|
+
name: "_token",
|
|
16711
|
+
type: "address",
|
|
16712
|
+
},
|
|
16713
|
+
{
|
|
16714
|
+
indexed: false,
|
|
16715
|
+
internalType: "uint256",
|
|
16716
|
+
name: "_amount",
|
|
16717
|
+
type: "uint256",
|
|
16718
|
+
},
|
|
16719
|
+
],
|
|
16720
|
+
name: "TokensClaimed",
|
|
16721
|
+
type: "event",
|
|
16722
|
+
},
|
|
16723
|
+
{
|
|
16724
|
+
anonymous: false,
|
|
16725
|
+
inputs: [
|
|
16726
|
+
{
|
|
16727
|
+
indexed: true,
|
|
16728
|
+
internalType: "address",
|
|
16729
|
+
name: "_user",
|
|
16730
|
+
type: "address",
|
|
16731
|
+
},
|
|
16732
|
+
{
|
|
16733
|
+
indexed: true,
|
|
16734
|
+
internalType: "address",
|
|
16735
|
+
name: "_token",
|
|
16736
|
+
type: "address",
|
|
16737
|
+
},
|
|
16738
|
+
{
|
|
16739
|
+
indexed: false,
|
|
16740
|
+
internalType: "uint256",
|
|
16741
|
+
name: "_tokenIn",
|
|
16742
|
+
type: "uint256",
|
|
16743
|
+
},
|
|
16744
|
+
{
|
|
16745
|
+
indexed: false,
|
|
16746
|
+
internalType: "uint256",
|
|
16747
|
+
name: "_ethOut",
|
|
16748
|
+
type: "uint256",
|
|
16749
|
+
},
|
|
16750
|
+
],
|
|
16751
|
+
name: "TokensSwapped",
|
|
16752
|
+
type: "event",
|
|
16753
|
+
},
|
|
16754
|
+
{
|
|
16755
|
+
inputs: [
|
|
16756
|
+
{ internalType: "address", name: "_user", type: "address" },
|
|
16757
|
+
{ internalType: "address", name: "_token", type: "address" },
|
|
16758
|
+
],
|
|
16759
|
+
name: "allocations",
|
|
16760
|
+
outputs: [{ internalType: "uint256", name: "_amount", type: "uint256" }],
|
|
16761
|
+
stateMutability: "view",
|
|
16762
|
+
type: "function",
|
|
16763
|
+
},
|
|
16764
|
+
{
|
|
16765
|
+
inputs: [
|
|
16766
|
+
{ internalType: "PoolId", name: "_poolId", type: "bytes32" },
|
|
16767
|
+
{ internalType: "address", name: "_user", type: "address" },
|
|
16768
|
+
{ internalType: "address", name: "_token", type: "address" },
|
|
16769
|
+
{ internalType: "uint256", name: "_amount", type: "uint256" },
|
|
16770
|
+
],
|
|
16771
|
+
name: "assignTokens",
|
|
16772
|
+
outputs: [],
|
|
16773
|
+
stateMutability: "nonpayable",
|
|
16774
|
+
type: "function",
|
|
16775
|
+
},
|
|
16776
|
+
{
|
|
16777
|
+
inputs: [],
|
|
16778
|
+
name: "cancelOwnershipHandover",
|
|
16779
|
+
outputs: [],
|
|
16780
|
+
stateMutability: "payable",
|
|
16781
|
+
type: "function",
|
|
16782
|
+
},
|
|
16783
|
+
{
|
|
16784
|
+
inputs: [
|
|
16785
|
+
{ internalType: "address[]", name: "_tokens", type: "address[]" },
|
|
16786
|
+
{
|
|
16787
|
+
internalType: "uint160[]",
|
|
16788
|
+
name: "_sqrtPriceX96Limits",
|
|
16789
|
+
type: "uint160[]",
|
|
16790
|
+
},
|
|
16791
|
+
{ internalType: "address payable", name: "_recipient", type: "address" },
|
|
16792
|
+
],
|
|
16793
|
+
name: "claimAndSwap",
|
|
16794
|
+
outputs: [],
|
|
16795
|
+
stateMutability: "nonpayable",
|
|
16796
|
+
type: "function",
|
|
16797
|
+
},
|
|
16798
|
+
{
|
|
16799
|
+
inputs: [
|
|
16800
|
+
{ internalType: "address[]", name: "_tokens", type: "address[]" },
|
|
16801
|
+
{ internalType: "address payable", name: "_recipient", type: "address" },
|
|
16802
|
+
],
|
|
16803
|
+
name: "claimTokens",
|
|
16804
|
+
outputs: [],
|
|
16805
|
+
stateMutability: "nonpayable",
|
|
16806
|
+
type: "function",
|
|
16807
|
+
},
|
|
16808
|
+
{
|
|
16809
|
+
inputs: [
|
|
16810
|
+
{ internalType: "address", name: "pendingOwner", type: "address" },
|
|
16811
|
+
],
|
|
16812
|
+
name: "completeOwnershipHandover",
|
|
16813
|
+
outputs: [],
|
|
16814
|
+
stateMutability: "payable",
|
|
16815
|
+
type: "function",
|
|
16816
|
+
},
|
|
16817
|
+
{
|
|
16818
|
+
inputs: [],
|
|
16819
|
+
name: "nativeToken",
|
|
16820
|
+
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
16821
|
+
stateMutability: "view",
|
|
16822
|
+
type: "function",
|
|
16823
|
+
},
|
|
16824
|
+
{
|
|
16825
|
+
inputs: [],
|
|
16826
|
+
name: "owner",
|
|
16827
|
+
outputs: [{ internalType: "address", name: "result", type: "address" }],
|
|
16828
|
+
stateMutability: "view",
|
|
16829
|
+
type: "function",
|
|
16830
|
+
},
|
|
16831
|
+
{
|
|
16832
|
+
inputs: [
|
|
16833
|
+
{ internalType: "address", name: "pendingOwner", type: "address" },
|
|
16834
|
+
],
|
|
16835
|
+
name: "ownershipHandoverExpiresAt",
|
|
16836
|
+
outputs: [{ internalType: "uint256", name: "result", type: "uint256" }],
|
|
16837
|
+
stateMutability: "view",
|
|
16838
|
+
type: "function",
|
|
16839
|
+
},
|
|
16840
|
+
{
|
|
16841
|
+
inputs: [],
|
|
16842
|
+
name: "poolSwap",
|
|
16843
|
+
outputs: [{ internalType: "contract PoolSwap", name: "", type: "address" }],
|
|
16844
|
+
stateMutability: "view",
|
|
16845
|
+
type: "function",
|
|
16846
|
+
},
|
|
16847
|
+
{
|
|
16848
|
+
inputs: [],
|
|
16849
|
+
name: "positionManager",
|
|
16850
|
+
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
16851
|
+
stateMutability: "view",
|
|
16852
|
+
type: "function",
|
|
16853
|
+
},
|
|
16854
|
+
{
|
|
16855
|
+
inputs: [],
|
|
16856
|
+
name: "renounceOwnership",
|
|
16857
|
+
outputs: [],
|
|
16858
|
+
stateMutability: "payable",
|
|
16859
|
+
type: "function",
|
|
16860
|
+
},
|
|
16861
|
+
{
|
|
16862
|
+
inputs: [],
|
|
16863
|
+
name: "requestOwnershipHandover",
|
|
16864
|
+
outputs: [],
|
|
16865
|
+
stateMutability: "payable",
|
|
16866
|
+
type: "function",
|
|
16867
|
+
},
|
|
16868
|
+
{
|
|
16869
|
+
inputs: [{ internalType: "address", name: "_poolSwap", type: "address" }],
|
|
16870
|
+
name: "setPoolSwap",
|
|
16871
|
+
outputs: [],
|
|
16872
|
+
stateMutability: "nonpayable",
|
|
16873
|
+
type: "function",
|
|
16874
|
+
},
|
|
16875
|
+
{
|
|
16876
|
+
inputs: [{ internalType: "address", name: "newOwner", type: "address" }],
|
|
16877
|
+
name: "transferOwnership",
|
|
16878
|
+
outputs: [],
|
|
16879
|
+
stateMutability: "payable",
|
|
16880
|
+
type: "function",
|
|
16881
|
+
},
|
|
16882
|
+
{ stateMutability: "payable", type: "receive" },
|
|
16883
|
+
];
|
|
16884
|
+
|
|
16885
|
+
/**
|
|
16886
|
+
* Client for interacting with the ReferralEscrow contract in read-only mode
|
|
16887
|
+
* Provides methods to query token allocations
|
|
16888
|
+
*/
|
|
16889
|
+
class ReadReferralEscrow {
|
|
16890
|
+
/**
|
|
16891
|
+
* Creates a new ReadReferralEscrow instance
|
|
16892
|
+
* @param address - The address of the ReferralEscrow contract
|
|
16893
|
+
* @param drift - Optional drift instance for contract interactions (creates new instance if not provided)
|
|
16894
|
+
* @throws Error if address is not provided
|
|
16895
|
+
*/
|
|
16896
|
+
constructor(address, drift$1 = drift.createDrift()) {
|
|
16897
|
+
if (!address) {
|
|
16898
|
+
throw new Error("Address is required");
|
|
16899
|
+
}
|
|
16900
|
+
this.contract = drift$1.contract({
|
|
16901
|
+
abi: ReferralEscrowAbi,
|
|
16902
|
+
address,
|
|
16903
|
+
});
|
|
16904
|
+
}
|
|
16905
|
+
/**
|
|
16906
|
+
* Gets the token allocation for a specific user and token
|
|
16907
|
+
* @param user - The address of the user to check
|
|
16908
|
+
* @param token - The address of the token
|
|
16909
|
+
* @returns Promise<bigint> - The allocated token amount
|
|
16910
|
+
*/
|
|
16911
|
+
allocations(user, token) {
|
|
16912
|
+
return this.contract.read("allocations", {
|
|
16913
|
+
_user: user,
|
|
16914
|
+
_token: token,
|
|
16915
|
+
});
|
|
16916
|
+
}
|
|
16917
|
+
}
|
|
16918
|
+
/**
|
|
16919
|
+
* Extended client for interacting with the ReferralEscrow contract with write capabilities
|
|
16920
|
+
* Provides methods to claim tokens
|
|
16921
|
+
*/
|
|
16922
|
+
class ReadWriteReferralEscrow extends ReadReferralEscrow {
|
|
16923
|
+
constructor(address, drift$1 = drift.createDrift()) {
|
|
16924
|
+
super(address, drift$1);
|
|
16925
|
+
}
|
|
16926
|
+
/**
|
|
16927
|
+
* Claims tokens for a recipient
|
|
16928
|
+
* @param tokens - Array of token addresses to claim
|
|
16929
|
+
* @param recipient - The address to receive the claimed tokens
|
|
16930
|
+
* @returns Promise<void>
|
|
16931
|
+
*/
|
|
16932
|
+
claimTokens(tokens, recipient) {
|
|
16933
|
+
return this.contract.write("claimTokens", {
|
|
16934
|
+
_tokens: tokens,
|
|
16935
|
+
_recipient: recipient,
|
|
16936
|
+
});
|
|
16937
|
+
}
|
|
16938
|
+
}
|
|
16939
|
+
|
|
16940
|
+
const BidWallV1_1Abi = [
|
|
16941
|
+
{
|
|
16942
|
+
inputs: [
|
|
16943
|
+
{ internalType: "address", name: "_nativeToken", type: "address" },
|
|
16944
|
+
{ internalType: "address", name: "_poolManager", type: "address" },
|
|
16945
|
+
{ internalType: "address", name: "_protocolOwner", type: "address" },
|
|
16946
|
+
],
|
|
16947
|
+
stateMutability: "nonpayable",
|
|
16948
|
+
type: "constructor",
|
|
16949
|
+
},
|
|
16950
|
+
{ inputs: [], name: "AccessControlBadConfirmation", type: "error" },
|
|
16951
|
+
{
|
|
16952
|
+
inputs: [
|
|
16953
|
+
{ internalType: "address", name: "account", type: "address" },
|
|
16954
|
+
{ internalType: "bytes32", name: "neededRole", type: "bytes32" },
|
|
16955
|
+
],
|
|
16956
|
+
name: "AccessControlUnauthorizedAccount",
|
|
16957
|
+
type: "error",
|
|
16958
|
+
},
|
|
16959
|
+
{ inputs: [], name: "AlreadyInitialized", type: "error" },
|
|
16960
|
+
{ inputs: [], name: "CallerIsNotCreator", type: "error" },
|
|
16961
|
+
{ inputs: [], name: "NewOwnerIsZeroAddress", type: "error" },
|
|
16962
|
+
{ inputs: [], name: "NoHandoverRequest", type: "error" },
|
|
16963
|
+
{ inputs: [], name: "NotPositionManager", type: "error" },
|
|
16964
|
+
{ inputs: [], name: "Unauthorized", type: "error" },
|
|
14682
16965
|
{
|
|
14683
16966
|
anonymous: false,
|
|
14684
16967
|
inputs: [
|
|
@@ -17919,6 +20202,17 @@ class ReadWriteRevenueManager extends ReadRevenueManager {
|
|
|
17919
20202
|
}
|
|
17920
20203
|
}
|
|
17921
20204
|
|
|
20205
|
+
/**
|
|
20206
|
+
* Enumeration of Flaunch contract versions
|
|
20207
|
+
*/
|
|
20208
|
+
exports.FlaunchVersion = void 0;
|
|
20209
|
+
(function (FlaunchVersion) {
|
|
20210
|
+
FlaunchVersion["V1"] = "V1";
|
|
20211
|
+
FlaunchVersion["V1_1"] = "V1_1";
|
|
20212
|
+
FlaunchVersion["V1_1_1"] = "V1_1_1";
|
|
20213
|
+
FlaunchVersion["ANY"] = "ANY";
|
|
20214
|
+
})(exports.FlaunchVersion || (exports.FlaunchVersion = {}));
|
|
20215
|
+
|
|
17922
20216
|
// our min/max tick range that is valid for the tick spacing (60)
|
|
17923
20217
|
const TickFinder = {
|
|
17924
20218
|
MIN_TICK: -887220,
|
|
@@ -18015,6 +20309,69 @@ const chainIdToChain = {
|
|
|
18015
20309
|
[baseSepolia.id]: baseSepolia,
|
|
18016
20310
|
};
|
|
18017
20311
|
|
|
20312
|
+
const FastFlaunchZapAbi = [
|
|
20313
|
+
{
|
|
20314
|
+
inputs: [
|
|
20315
|
+
{
|
|
20316
|
+
internalType: "contract PositionManager",
|
|
20317
|
+
name: "_positionManager",
|
|
20318
|
+
type: "address",
|
|
20319
|
+
},
|
|
20320
|
+
],
|
|
20321
|
+
stateMutability: "nonpayable",
|
|
20322
|
+
type: "constructor",
|
|
20323
|
+
},
|
|
20324
|
+
{
|
|
20325
|
+
inputs: [],
|
|
20326
|
+
name: "CREATOR_FEE_ALLOCATION",
|
|
20327
|
+
outputs: [{ internalType: "uint24", name: "", type: "uint24" }],
|
|
20328
|
+
stateMutability: "view",
|
|
20329
|
+
type: "function",
|
|
20330
|
+
},
|
|
20331
|
+
{
|
|
20332
|
+
inputs: [],
|
|
20333
|
+
name: "FAIR_LAUNCH_SUPPLY",
|
|
20334
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
20335
|
+
stateMutability: "view",
|
|
20336
|
+
type: "function",
|
|
20337
|
+
},
|
|
20338
|
+
{
|
|
20339
|
+
inputs: [],
|
|
20340
|
+
name: "USDC_MARKET_CAP",
|
|
20341
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
20342
|
+
stateMutability: "view",
|
|
20343
|
+
type: "function",
|
|
20344
|
+
},
|
|
20345
|
+
{
|
|
20346
|
+
inputs: [
|
|
20347
|
+
{
|
|
20348
|
+
components: [
|
|
20349
|
+
{ internalType: "string", name: "name", type: "string" },
|
|
20350
|
+
{ internalType: "string", name: "symbol", type: "string" },
|
|
20351
|
+
{ internalType: "string", name: "tokenUri", type: "string" },
|
|
20352
|
+
{ internalType: "address", name: "creator", type: "address" },
|
|
20353
|
+
],
|
|
20354
|
+
internalType: "struct FastFlaunchZap.FastFlaunchParams",
|
|
20355
|
+
name: "_params",
|
|
20356
|
+
type: "tuple",
|
|
20357
|
+
},
|
|
20358
|
+
],
|
|
20359
|
+
name: "flaunch",
|
|
20360
|
+
outputs: [{ internalType: "address", name: "memecoin_", type: "address" }],
|
|
20361
|
+
stateMutability: "nonpayable",
|
|
20362
|
+
type: "function",
|
|
20363
|
+
},
|
|
20364
|
+
{
|
|
20365
|
+
inputs: [],
|
|
20366
|
+
name: "positionManager",
|
|
20367
|
+
outputs: [
|
|
20368
|
+
{ internalType: "contract PositionManager", name: "", type: "address" },
|
|
20369
|
+
],
|
|
20370
|
+
stateMutability: "view",
|
|
20371
|
+
type: "function",
|
|
20372
|
+
},
|
|
20373
|
+
];
|
|
20374
|
+
|
|
18018
20375
|
/**
|
|
18019
20376
|
* Base class for interacting with Flaunch protocol in read-only mode
|
|
18020
20377
|
*/
|
|
@@ -18026,6 +20383,9 @@ class ReadFlaunchSDK {
|
|
|
18026
20383
|
this.resolveIPFS = resolveIPFS;
|
|
18027
20384
|
this.readPositionManager = new ReadFlaunchPositionManager(FlaunchPositionManagerAddress[this.chainId], drift$1);
|
|
18028
20385
|
this.readPositionManagerV1_1 = new ReadFlaunchPositionManagerV1_1(FlaunchPositionManagerV1_1Address[this.chainId], drift$1);
|
|
20386
|
+
this.readAnyPositionManager = new ReadAnyPositionManager(AnyPositionManagerAddress[this.chainId], drift$1);
|
|
20387
|
+
this.readFeeEscrow = new ReadFeeEscrow(FeeEscrowAddress[this.chainId], drift$1);
|
|
20388
|
+
this.readReferralEscrow = new ReadReferralEscrow(ReferralEscrowAddress[this.chainId], drift$1);
|
|
18029
20389
|
this.readFlaunchZap = new ReadFlaunchZap(this.chainId, FlaunchZapAddress[this.chainId], drift$1);
|
|
18030
20390
|
this.readPoolManager = new ReadPoolManager(PoolManagerAddress[this.chainId], drift$1);
|
|
18031
20391
|
this.readStateView = new ReadStateView(StateViewAddress[this.chainId], drift$1);
|
|
@@ -18039,21 +20399,89 @@ class ReadFlaunchSDK {
|
|
|
18039
20399
|
this.readPermit2 = new ReadPermit2(Permit2Address[this.chainId], drift$1);
|
|
18040
20400
|
}
|
|
18041
20401
|
/**
|
|
18042
|
-
* Checks if a given coin address is a valid Flaunch coin (
|
|
20402
|
+
* Checks if a given coin address is a valid Flaunch coin (supports all versions)
|
|
18043
20403
|
* @param coinAddress - The address of the coin to check
|
|
18044
20404
|
* @returns Promise<boolean> - True if the coin is valid, false otherwise
|
|
18045
20405
|
*/
|
|
18046
20406
|
async isValidCoin(coinAddress) {
|
|
18047
20407
|
return ((await this.readPositionManagerV1_1.isValidCoin(coinAddress)) ||
|
|
18048
|
-
(await this.readPositionManager.isValidCoin(coinAddress))
|
|
20408
|
+
(await this.readPositionManager.isValidCoin(coinAddress)) ||
|
|
20409
|
+
(await this.readAnyPositionManager.isValidCoin(coinAddress)));
|
|
18049
20410
|
}
|
|
18050
20411
|
/**
|
|
18051
|
-
*
|
|
20412
|
+
* Determines the version of a Flaunch coin
|
|
18052
20413
|
* @param coinAddress - The address of the coin to check
|
|
18053
|
-
* @returns Promise<
|
|
20414
|
+
* @returns Promise<FlaunchVersion> - The version of the coin
|
|
20415
|
+
*/
|
|
20416
|
+
async getCoinVersion(coinAddress) {
|
|
20417
|
+
if (await this.readPositionManager.isValidCoin(coinAddress)) {
|
|
20418
|
+
return exports.FlaunchVersion.V1;
|
|
20419
|
+
}
|
|
20420
|
+
else if (await this.readPositionManagerV1_1.isValidCoin(coinAddress)) {
|
|
20421
|
+
return exports.FlaunchVersion.V1_1;
|
|
20422
|
+
}
|
|
20423
|
+
else if (await this.readAnyPositionManager.isValidCoin(coinAddress)) {
|
|
20424
|
+
return exports.FlaunchVersion.ANY;
|
|
20425
|
+
}
|
|
20426
|
+
throw new Error(`Unknown coin version for address: ${coinAddress}`);
|
|
20427
|
+
}
|
|
20428
|
+
// TODO: update these get functions to support V1.1.1 and new AnyPositionManager
|
|
20429
|
+
/**
|
|
20430
|
+
* Gets the position manager address for a given version
|
|
20431
|
+
* @param version - The version to get the position manager address for
|
|
20432
|
+
*/
|
|
20433
|
+
getPositionManager(version) {
|
|
20434
|
+
switch (version) {
|
|
20435
|
+
case exports.FlaunchVersion.V1:
|
|
20436
|
+
return this.readPositionManager;
|
|
20437
|
+
case exports.FlaunchVersion.V1_1:
|
|
20438
|
+
return this.readPositionManagerV1_1;
|
|
20439
|
+
case exports.FlaunchVersion.ANY:
|
|
20440
|
+
return this.readAnyPositionManager;
|
|
20441
|
+
default:
|
|
20442
|
+
return this.readPositionManagerV1_1;
|
|
20443
|
+
}
|
|
20444
|
+
}
|
|
20445
|
+
/**
|
|
20446
|
+
* Gets the fair launch address for a given version
|
|
20447
|
+
* @param version - The version to get the fair launch address for
|
|
20448
|
+
*/
|
|
20449
|
+
getFairLaunch(version) {
|
|
20450
|
+
switch (version) {
|
|
20451
|
+
case exports.FlaunchVersion.V1:
|
|
20452
|
+
return this.readFairLaunch;
|
|
20453
|
+
case exports.FlaunchVersion.V1_1:
|
|
20454
|
+
return this.readFairLaunchV1_1;
|
|
20455
|
+
case exports.FlaunchVersion.ANY:
|
|
20456
|
+
return this.readFairLaunchV1_1;
|
|
20457
|
+
default:
|
|
20458
|
+
return this.readFairLaunchV1_1;
|
|
20459
|
+
}
|
|
20460
|
+
}
|
|
20461
|
+
/**
|
|
20462
|
+
* Gets the bid wall address for a given version
|
|
20463
|
+
* @param version - The version to get the bid wall address for
|
|
18054
20464
|
*/
|
|
18055
|
-
|
|
18056
|
-
|
|
20465
|
+
getBidWall(version) {
|
|
20466
|
+
switch (version) {
|
|
20467
|
+
case exports.FlaunchVersion.V1:
|
|
20468
|
+
return this.readBidWall;
|
|
20469
|
+
case exports.FlaunchVersion.V1_1:
|
|
20470
|
+
return this.readBidWallV1_1;
|
|
20471
|
+
case exports.FlaunchVersion.ANY:
|
|
20472
|
+
return this.readBidWallV1_1;
|
|
20473
|
+
default:
|
|
20474
|
+
return this.readBidWallV1_1;
|
|
20475
|
+
}
|
|
20476
|
+
}
|
|
20477
|
+
getPositionManagerAddress(version) {
|
|
20478
|
+
return this.getPositionManager(version).contract.address;
|
|
20479
|
+
}
|
|
20480
|
+
getFairLaunchAddress(version) {
|
|
20481
|
+
return this.getFairLaunch(version).contract.address;
|
|
20482
|
+
}
|
|
20483
|
+
getBidWallAddress(version) {
|
|
20484
|
+
return this.getBidWall(version).contract.address;
|
|
18057
20485
|
}
|
|
18058
20486
|
/**
|
|
18059
20487
|
* Retrieves metadata for a given Flaunch coin
|
|
@@ -18177,69 +20605,45 @@ class ReadFlaunchSDK {
|
|
|
18177
20605
|
return processedResults;
|
|
18178
20606
|
}
|
|
18179
20607
|
/**
|
|
18180
|
-
* Watches for pool creation events
|
|
18181
|
-
* @param params - Parameters for watching pool creation
|
|
18182
|
-
* @returns Subscription to pool creation events
|
|
18183
|
-
*/
|
|
18184
|
-
watchPoolCreatedV1(params) {
|
|
18185
|
-
return this.readPositionManager.watchPoolCreated(params);
|
|
18186
|
-
}
|
|
18187
|
-
/**
|
|
18188
|
-
* Watches for pool creation events on V1.1 contracts
|
|
20608
|
+
* Watches for pool creation events
|
|
18189
20609
|
* @param params - Parameters for watching pool creation
|
|
20610
|
+
* @param version - Version of Flaunch to use (defaults to V1_1)
|
|
18190
20611
|
* @returns Subscription to pool creation events
|
|
18191
20612
|
*/
|
|
18192
|
-
watchPoolCreated(params) {
|
|
18193
|
-
return
|
|
18194
|
-
|
|
18195
|
-
|
|
18196
|
-
* Polls for current pool creation events on V1 contracts
|
|
18197
|
-
* @returns Current pool creation events or undefined if polling is not available
|
|
18198
|
-
*/
|
|
18199
|
-
pollPoolCreatedNowV1() {
|
|
18200
|
-
const poll = this.readPositionManager.pollPoolCreatedNow;
|
|
18201
|
-
if (!poll) {
|
|
18202
|
-
return undefined;
|
|
18203
|
-
}
|
|
18204
|
-
return poll();
|
|
20613
|
+
watchPoolCreated(params, version = exports.FlaunchVersion.V1_1) {
|
|
20614
|
+
return version === exports.FlaunchVersion.V1
|
|
20615
|
+
? this.readPositionManager.watchPoolCreated(params)
|
|
20616
|
+
: this.readPositionManagerV1_1.watchPoolCreated(params);
|
|
18205
20617
|
}
|
|
18206
20618
|
/**
|
|
18207
|
-
* Polls for current pool creation events
|
|
20619
|
+
* Polls for current pool creation events
|
|
20620
|
+
* @param version - Version of Flaunch to use (defaults to V1_1)
|
|
18208
20621
|
* @returns Current pool creation events or undefined if polling is not available
|
|
18209
20622
|
*/
|
|
18210
|
-
pollPoolCreatedNow() {
|
|
18211
|
-
const
|
|
20623
|
+
pollPoolCreatedNow(version = exports.FlaunchVersion.V1_1) {
|
|
20624
|
+
const positionManager = version === exports.FlaunchVersion.V1
|
|
20625
|
+
? this.readPositionManager
|
|
20626
|
+
: this.readPositionManagerV1_1;
|
|
20627
|
+
const poll = positionManager.pollPoolCreatedNow;
|
|
18212
20628
|
if (!poll) {
|
|
18213
20629
|
return undefined;
|
|
18214
20630
|
}
|
|
18215
20631
|
return poll();
|
|
18216
20632
|
}
|
|
18217
20633
|
/**
|
|
18218
|
-
* Watches for pool swap events
|
|
18219
|
-
* @param params - Parameters for watching pool swaps including optional coin filter
|
|
18220
|
-
* @returns Subscription to pool swap events
|
|
18221
|
-
*/
|
|
18222
|
-
async watchPoolSwapV1(params) {
|
|
18223
|
-
return this.readPositionManager.watchPoolSwap({
|
|
18224
|
-
...params,
|
|
18225
|
-
filterByPoolId: params.filterByCoin
|
|
18226
|
-
? await this.poolId(params.filterByCoin, true)
|
|
18227
|
-
: undefined,
|
|
18228
|
-
flETHIsCurrencyZero: params.filterByCoin
|
|
18229
|
-
? this.flETHIsCurrencyZero(params.filterByCoin)
|
|
18230
|
-
: undefined,
|
|
18231
|
-
});
|
|
18232
|
-
}
|
|
18233
|
-
/**
|
|
18234
|
-
* Watches for pool swap events on V1.1 contracts
|
|
20634
|
+
* Watches for pool swap events
|
|
18235
20635
|
* @param params - Parameters for watching pool swaps including optional coin filter
|
|
20636
|
+
* @param version - Version of Flaunch to use (defaults to V1_1)
|
|
18236
20637
|
* @returns Subscription to pool swap events
|
|
18237
20638
|
*/
|
|
18238
|
-
async watchPoolSwap(params) {
|
|
18239
|
-
|
|
20639
|
+
async watchPoolSwap(params, version = exports.FlaunchVersion.V1_1) {
|
|
20640
|
+
const positionManager = version === exports.FlaunchVersion.V1
|
|
20641
|
+
? this.readPositionManager
|
|
20642
|
+
: this.readPositionManagerV1_1;
|
|
20643
|
+
return positionManager.watchPoolSwap({
|
|
18240
20644
|
...params,
|
|
18241
20645
|
filterByPoolId: params.filterByCoin
|
|
18242
|
-
? await this.poolId(params.filterByCoin)
|
|
20646
|
+
? await this.poolId(params.filterByCoin, version)
|
|
18243
20647
|
: undefined,
|
|
18244
20648
|
flETHIsCurrencyZero: params.filterByCoin
|
|
18245
20649
|
? this.flETHIsCurrencyZero(params.filterByCoin)
|
|
@@ -18247,22 +20651,15 @@ class ReadFlaunchSDK {
|
|
|
18247
20651
|
});
|
|
18248
20652
|
}
|
|
18249
20653
|
/**
|
|
18250
|
-
* Polls for current pool swap events
|
|
18251
|
-
* @
|
|
18252
|
-
*/
|
|
18253
|
-
pollPoolSwapNowV1() {
|
|
18254
|
-
const poll = this.readPositionManager.pollPoolSwapNow;
|
|
18255
|
-
if (!poll) {
|
|
18256
|
-
return undefined;
|
|
18257
|
-
}
|
|
18258
|
-
return poll();
|
|
18259
|
-
}
|
|
18260
|
-
/**
|
|
18261
|
-
* Polls for current pool swap events on V1.1 contracts
|
|
20654
|
+
* Polls for current pool swap events
|
|
20655
|
+
* @param version - Version of Flaunch to use (defaults to V1_1)
|
|
18262
20656
|
* @returns Current pool swap events or undefined if polling is not available
|
|
18263
20657
|
*/
|
|
18264
|
-
pollPoolSwapNow() {
|
|
18265
|
-
const
|
|
20658
|
+
pollPoolSwapNow(version = exports.FlaunchVersion.V1_1) {
|
|
20659
|
+
const positionManager = version === exports.FlaunchVersion.V1
|
|
20660
|
+
? this.readPositionManager
|
|
20661
|
+
: this.readPositionManagerV1_1;
|
|
20662
|
+
const poll = positionManager.pollPoolSwapNow;
|
|
18266
20663
|
if (!poll) {
|
|
18267
20664
|
return undefined;
|
|
18268
20665
|
}
|
|
@@ -18279,29 +20676,25 @@ class ReadFlaunchSDK {
|
|
|
18279
20676
|
/**
|
|
18280
20677
|
* Gets the current tick for a given coin's pool
|
|
18281
20678
|
* @param coinAddress - The address of the coin
|
|
18282
|
-
* @param
|
|
20679
|
+
* @param version - Optional specific version to use. If not provided, will be determined automatically
|
|
18283
20680
|
* @returns Promise<number> - The current tick of the pool
|
|
18284
20681
|
*/
|
|
18285
|
-
async currentTick(coinAddress,
|
|
18286
|
-
|
|
18287
|
-
|
|
18288
|
-
}
|
|
18289
|
-
const poolId = await this.poolId(coinAddress, isV1Coin);
|
|
20682
|
+
async currentTick(coinAddress, version) {
|
|
20683
|
+
const coinVersion = version || (await this.getCoinVersion(coinAddress));
|
|
20684
|
+
const poolId = await this.poolId(coinAddress, coinVersion);
|
|
18290
20685
|
const poolState = await this.readStateView.poolSlot0({ poolId });
|
|
18291
20686
|
return poolState.tick;
|
|
18292
20687
|
}
|
|
18293
20688
|
/**
|
|
18294
20689
|
* Calculates the coin price in ETH based on the current tick
|
|
18295
20690
|
* @param coinAddress - The address of the coin
|
|
18296
|
-
* @param
|
|
20691
|
+
* @param version - Optional specific version to use. If not provided, will be determined automatically
|
|
18297
20692
|
* @returns Promise<string> - The price of the coin in ETH with 18 decimals precision
|
|
18298
20693
|
*/
|
|
18299
|
-
async coinPriceInETH(coinAddress,
|
|
18300
|
-
|
|
18301
|
-
isV1Coin = await this.isV1Coin(coinAddress);
|
|
18302
|
-
}
|
|
20694
|
+
async coinPriceInETH(coinAddress, version) {
|
|
20695
|
+
const coinVersion = version || (await this.getCoinVersion(coinAddress));
|
|
18303
20696
|
const isFLETHZero = this.flETHIsCurrencyZero(coinAddress);
|
|
18304
|
-
const currentTick = await this.currentTick(coinAddress,
|
|
20697
|
+
const currentTick = await this.currentTick(coinAddress, coinVersion);
|
|
18305
20698
|
const price = Math.pow(1.0001, currentTick);
|
|
18306
20699
|
let ethPerCoin = 0;
|
|
18307
20700
|
if (isFLETHZero) {
|
|
@@ -18312,6 +20705,27 @@ class ReadFlaunchSDK {
|
|
|
18312
20705
|
}
|
|
18313
20706
|
return ethPerCoin.toFixed(18);
|
|
18314
20707
|
}
|
|
20708
|
+
/**
|
|
20709
|
+
* Calculates the coin price in USD based on the current ETH/USDC price
|
|
20710
|
+
* @param coinAddress - The address of the coin
|
|
20711
|
+
* @param version - Optional specific version to use. If not provided, will be determined automatically
|
|
20712
|
+
* @returns Promise<string> - The price of the coin in USD with 2 decimal precision
|
|
20713
|
+
*/
|
|
20714
|
+
async coinPriceInUSD({ coinAddress, version, drift, }) {
|
|
20715
|
+
const coinVersion = version || (await this.getCoinVersion(coinAddress));
|
|
20716
|
+
const ethPerCoin = await this.coinPriceInETH(coinAddress, coinVersion);
|
|
20717
|
+
const ethPrice = await this.getETHUSDCPrice(drift);
|
|
20718
|
+
return (parseFloat(ethPerCoin) * ethPrice).toFixed(2);
|
|
20719
|
+
}
|
|
20720
|
+
async coinMarketCapInUSD({ coinAddress, version, drift, }) {
|
|
20721
|
+
const totalSupply = 100000000000; // 100 Billion tokens
|
|
20722
|
+
const priceInUSD = await this.coinPriceInUSD({
|
|
20723
|
+
coinAddress,
|
|
20724
|
+
version,
|
|
20725
|
+
drift,
|
|
20726
|
+
});
|
|
20727
|
+
return (parseFloat(priceInUSD) * totalSupply).toFixed(2);
|
|
20728
|
+
}
|
|
18315
20729
|
/**
|
|
18316
20730
|
* Gets the current ETH/USDC price
|
|
18317
20731
|
* @param drift - Optional drift instance to get price from Base Mainnet
|
|
@@ -18325,81 +20739,76 @@ class ReadFlaunchSDK {
|
|
|
18325
20739
|
}
|
|
18326
20740
|
return this.readQuoter.getETHUSDCPrice();
|
|
18327
20741
|
}
|
|
20742
|
+
async initialSqrtPriceX96(params) {
|
|
20743
|
+
const initialMCapInUSDCWei = viem.parseUnits(params.initialMarketCapUSD.toString(), 6);
|
|
20744
|
+
const initialPriceParams = viem.encodeAbiParameters([
|
|
20745
|
+
{
|
|
20746
|
+
type: "uint256",
|
|
20747
|
+
},
|
|
20748
|
+
], [initialMCapInUSDCWei]);
|
|
20749
|
+
const isFLETHZero = this.flETHIsCurrencyZero(params.coinAddress);
|
|
20750
|
+
const initialPrice = new ReadInitialPrice(await this.readPositionManagerV1_1.initialPrice(), this.drift);
|
|
20751
|
+
return initialPrice.getSqrtPriceX96({
|
|
20752
|
+
isFLETHZero,
|
|
20753
|
+
initialPriceParams,
|
|
20754
|
+
});
|
|
20755
|
+
}
|
|
18328
20756
|
/**
|
|
18329
20757
|
* Gets information about a fair launch for a given coin
|
|
18330
20758
|
* @param coinAddress - The address of the coin
|
|
18331
|
-
* @param
|
|
20759
|
+
* @param version - Optional specific version to use. If not provided, will be determined automatically
|
|
18332
20760
|
* @returns Fair launch information from the appropriate contract version
|
|
18333
20761
|
*/
|
|
18334
|
-
async fairLaunchInfo(coinAddress,
|
|
18335
|
-
|
|
18336
|
-
|
|
18337
|
-
}
|
|
18338
|
-
const poolId = await this.poolId(coinAddress, isV1Coin);
|
|
18339
|
-
return isV1Coin
|
|
18340
|
-
? this.readFairLaunch.fairLaunchInfo({ poolId })
|
|
18341
|
-
: this.readFairLaunchV1_1.fairLaunchInfo({ poolId });
|
|
20762
|
+
async fairLaunchInfo(coinAddress, version) {
|
|
20763
|
+
const coinVersion = version || (await this.getCoinVersion(coinAddress));
|
|
20764
|
+
const poolId = await this.poolId(coinAddress, coinVersion);
|
|
20765
|
+
return this.getFairLaunch(coinVersion).fairLaunchInfo({ poolId });
|
|
18342
20766
|
}
|
|
18343
20767
|
/**
|
|
18344
20768
|
* Checks if a fair launch is currently active for a given coin
|
|
18345
20769
|
* @param coinAddress - The address of the coin
|
|
18346
|
-
* @param
|
|
20770
|
+
* @param version - Optional specific version to use. If not provided, will be determined automatically
|
|
18347
20771
|
* @returns Promise<boolean> - True if fair launch is active, false otherwise
|
|
18348
20772
|
*/
|
|
18349
|
-
async isFairLaunchActive(coinAddress,
|
|
18350
|
-
|
|
18351
|
-
|
|
18352
|
-
}
|
|
18353
|
-
const poolId = await this.poolId(coinAddress, isV1Coin);
|
|
18354
|
-
return isV1Coin
|
|
18355
|
-
? this.readFairLaunch.isFairLaunchActive({ poolId })
|
|
18356
|
-
: this.readFairLaunchV1_1.isFairLaunchActive({ poolId });
|
|
20773
|
+
async isFairLaunchActive(coinAddress, version) {
|
|
20774
|
+
const coinVersion = version || (await this.getCoinVersion(coinAddress));
|
|
20775
|
+
const poolId = await this.poolId(coinAddress, coinVersion);
|
|
20776
|
+
return this.getFairLaunch(coinVersion).isFairLaunchActive({ poolId });
|
|
18357
20777
|
}
|
|
18358
20778
|
/**
|
|
18359
20779
|
* Gets the duration of a fair launch for a given coin
|
|
18360
20780
|
* @param coinAddress - The address of the coin
|
|
18361
|
-
* @param
|
|
20781
|
+
* @param version - Optional specific version to use. If not provided, will be determined automatically
|
|
18362
20782
|
* @returns Promise<number> - The duration in seconds (30 minutes for V1, variable for V1.1)
|
|
18363
20783
|
*/
|
|
18364
|
-
async fairLaunchDuration(coinAddress,
|
|
18365
|
-
|
|
18366
|
-
|
|
18367
|
-
}
|
|
18368
|
-
if (isV1Coin) {
|
|
18369
|
-
return 30 * 60; // 30 minutes
|
|
18370
|
-
}
|
|
18371
|
-
const poolId = await this.poolId(coinAddress, isV1Coin);
|
|
18372
|
-
return this.readFairLaunchV1_1.fairLaunchDuration({ poolId });
|
|
20784
|
+
async fairLaunchDuration(coinAddress, version) {
|
|
20785
|
+
const coinVersion = version || (await this.getCoinVersion(coinAddress));
|
|
20786
|
+
const poolId = await this.poolId(coinAddress, coinVersion);
|
|
20787
|
+
return this.getFairLaunch(coinVersion).fairLaunchDuration({ poolId });
|
|
18373
20788
|
}
|
|
18374
20789
|
/**
|
|
18375
20790
|
* Gets the initial tick for a fair launch
|
|
18376
20791
|
* @param coinAddress - The address of the coin
|
|
18377
|
-
* @param
|
|
20792
|
+
* @param version - Optional specific version to use. If not provided, will be determined automatically
|
|
18378
20793
|
* @returns Promise<number> - The initial tick value
|
|
18379
20794
|
*/
|
|
18380
|
-
async initialTick(coinAddress,
|
|
18381
|
-
|
|
18382
|
-
|
|
18383
|
-
}
|
|
18384
|
-
const poolId = await this.poolId(coinAddress, isV1Coin);
|
|
18385
|
-
const fairLaunchInfo = isV1Coin
|
|
18386
|
-
? await this.readFairLaunch.fairLaunchInfo({ poolId })
|
|
18387
|
-
: await this.readFairLaunchV1_1.fairLaunchInfo({ poolId });
|
|
20795
|
+
async initialTick(coinAddress, version) {
|
|
20796
|
+
const coinVersion = version || (await this.getCoinVersion(coinAddress));
|
|
20797
|
+
const poolId = await this.poolId(coinAddress, coinVersion);
|
|
20798
|
+
const fairLaunchInfo = await this.getFairLaunch(coinVersion).fairLaunchInfo({ poolId });
|
|
18388
20799
|
return fairLaunchInfo.initialTick;
|
|
18389
20800
|
}
|
|
18390
20801
|
/**
|
|
18391
20802
|
* Gets information about the ETH-only position in a fair launch
|
|
18392
20803
|
* @param coinAddress - The address of the coin
|
|
18393
|
-
* @param
|
|
20804
|
+
* @param version - Optional specific version to use. If not provided, will be determined automatically
|
|
18394
20805
|
* @returns Promise<{flETHAmount: bigint, coinAmount: bigint, tickLower: number, tickUpper: number}> - Position details
|
|
18395
20806
|
*/
|
|
18396
|
-
async fairLaunchETHOnlyPosition(coinAddress,
|
|
18397
|
-
|
|
18398
|
-
|
|
18399
|
-
|
|
18400
|
-
const
|
|
18401
|
-
const initialTick = await this.initialTick(coinAddress, isV1Coin);
|
|
18402
|
-
const currentTick = await this.currentTick(coinAddress, isV1Coin);
|
|
20807
|
+
async fairLaunchETHOnlyPosition(coinAddress, version) {
|
|
20808
|
+
const coinVersion = version || (await this.getCoinVersion(coinAddress));
|
|
20809
|
+
const poolId = await this.poolId(coinAddress, coinVersion);
|
|
20810
|
+
const initialTick = await this.initialTick(coinAddress, coinVersion);
|
|
20811
|
+
const currentTick = await this.currentTick(coinAddress, coinVersion);
|
|
18403
20812
|
const isFLETHZero = this.flETHIsCurrencyZero(coinAddress);
|
|
18404
20813
|
let tickLower;
|
|
18405
20814
|
let tickUpper;
|
|
@@ -18421,9 +20830,7 @@ class ReadFlaunchSDK {
|
|
|
18421
20830
|
}
|
|
18422
20831
|
const { liquidity } = await this.readStateView.positionInfo({
|
|
18423
20832
|
poolId,
|
|
18424
|
-
owner:
|
|
18425
|
-
? FairLaunchAddress[this.chainId]
|
|
18426
|
-
: FairLaunchV1_1Address[this.chainId],
|
|
20833
|
+
owner: this.getFairLaunchAddress(coinVersion),
|
|
18427
20834
|
tickLower,
|
|
18428
20835
|
tickUpper,
|
|
18429
20836
|
salt: "",
|
|
@@ -18442,16 +20849,14 @@ class ReadFlaunchSDK {
|
|
|
18442
20849
|
/**
|
|
18443
20850
|
* Gets information about the coin-only position in a fair launch
|
|
18444
20851
|
* @param coinAddress - The address of the coin
|
|
18445
|
-
* @param
|
|
20852
|
+
* @param version - Optional specific version to use. If not provided, will be determined automatically
|
|
18446
20853
|
* @returns Promise<{flETHAmount: bigint, coinAmount: bigint, tickLower: number, tickUpper: number}> - Position details
|
|
18447
20854
|
*/
|
|
18448
|
-
async fairLaunchCoinOnlyPosition(coinAddress,
|
|
18449
|
-
|
|
18450
|
-
|
|
18451
|
-
|
|
18452
|
-
const
|
|
18453
|
-
const initialTick = await this.initialTick(coinAddress, isV1Coin);
|
|
18454
|
-
const currentTick = await this.currentTick(coinAddress, isV1Coin);
|
|
20855
|
+
async fairLaunchCoinOnlyPosition(coinAddress, version) {
|
|
20856
|
+
const coinVersion = version || (await this.getCoinVersion(coinAddress));
|
|
20857
|
+
const poolId = await this.poolId(coinAddress, coinVersion);
|
|
20858
|
+
const initialTick = await this.initialTick(coinAddress, coinVersion);
|
|
20859
|
+
const currentTick = await this.currentTick(coinAddress, coinVersion);
|
|
18455
20860
|
const isFLETHZero = this.flETHIsCurrencyZero(coinAddress);
|
|
18456
20861
|
let tickLower;
|
|
18457
20862
|
let tickUpper;
|
|
@@ -18473,9 +20878,7 @@ class ReadFlaunchSDK {
|
|
|
18473
20878
|
}
|
|
18474
20879
|
const { liquidity } = await this.readStateView.positionInfo({
|
|
18475
20880
|
poolId,
|
|
18476
|
-
owner:
|
|
18477
|
-
? FairLaunchAddress[this.chainId]
|
|
18478
|
-
: FairLaunchV1_1Address[this.chainId],
|
|
20881
|
+
owner: this.getFairLaunchAddress(coinVersion),
|
|
18479
20882
|
tickLower,
|
|
18480
20883
|
tickUpper,
|
|
18481
20884
|
salt: "",
|
|
@@ -18494,21 +20897,15 @@ class ReadFlaunchSDK {
|
|
|
18494
20897
|
/**
|
|
18495
20898
|
* Gets information about the bid wall position for a coin
|
|
18496
20899
|
* @param coinAddress - The address of the coin
|
|
18497
|
-
* @param
|
|
20900
|
+
* @param version - Optional specific version to use. If not provided, will be determined automatically
|
|
18498
20901
|
* @returns Promise<{flETHAmount: bigint, coinAmount: bigint, pendingEth: bigint, tickLower: number, tickUpper: number}> - Bid wall position details
|
|
18499
20902
|
*/
|
|
18500
|
-
async bidWallPosition(coinAddress,
|
|
18501
|
-
|
|
18502
|
-
|
|
18503
|
-
}
|
|
18504
|
-
const poolId = await this.poolId(coinAddress, isV1Coin);
|
|
20903
|
+
async bidWallPosition(coinAddress, version) {
|
|
20904
|
+
const coinVersion = version || (await this.getCoinVersion(coinAddress));
|
|
20905
|
+
const poolId = await this.poolId(coinAddress, coinVersion);
|
|
18505
20906
|
const isFLETHZero = this.flETHIsCurrencyZero(coinAddress);
|
|
18506
|
-
const { amount0_: amount0, amount1_: amount1, pendingEth_: pendingEth, } =
|
|
18507
|
-
|
|
18508
|
-
: await this.readBidWallV1_1.position({ poolId });
|
|
18509
|
-
const { tickLower, tickUpper } = isV1Coin
|
|
18510
|
-
? await this.readBidWall.poolInfo({ poolId })
|
|
18511
|
-
: await this.readBidWallV1_1.poolInfo({ poolId });
|
|
20907
|
+
const { amount0_: amount0, amount1_: amount1, pendingEth_: pendingEth, } = await this.getBidWall(coinVersion).position({ poolId });
|
|
20908
|
+
const { tickLower, tickUpper } = await this.getBidWall(coinVersion).poolInfo({ poolId });
|
|
18512
20909
|
const [flETHAmount, coinAmount] = isFLETHZero
|
|
18513
20910
|
? [amount0, amount1]
|
|
18514
20911
|
: [amount1, amount0];
|
|
@@ -18520,6 +20917,29 @@ class ReadFlaunchSDK {
|
|
|
18520
20917
|
tickUpper,
|
|
18521
20918
|
};
|
|
18522
20919
|
}
|
|
20920
|
+
/**
|
|
20921
|
+
* Gets the ETH balance for the creator to claim
|
|
20922
|
+
* @param creator - The address of the creator to check
|
|
20923
|
+
* @param isV1 - Optional boolean to check the balance for V1. V1.1 & AnyPositionManager use the same FeeEscrow contract
|
|
20924
|
+
* @returns The balance of the creator
|
|
20925
|
+
*/
|
|
20926
|
+
creatorRevenue(creator, isV1) {
|
|
20927
|
+
if (isV1) {
|
|
20928
|
+
return this.readPositionManager.creatorBalance(creator);
|
|
20929
|
+
}
|
|
20930
|
+
else {
|
|
20931
|
+
return this.readFeeEscrow.balances(creator);
|
|
20932
|
+
}
|
|
20933
|
+
}
|
|
20934
|
+
/**
|
|
20935
|
+
* Gets the balance of a recipient for a given coin
|
|
20936
|
+
* @param recipient - The address of the recipient to check
|
|
20937
|
+
* @param coinAddress - The address of the coin
|
|
20938
|
+
* @returns Promise<bigint> - The balance of the recipient
|
|
20939
|
+
*/
|
|
20940
|
+
referralBalance(recipient, coinAddress) {
|
|
20941
|
+
return this.readReferralEscrow.allocations(recipient, coinAddress);
|
|
20942
|
+
}
|
|
18523
20943
|
/**
|
|
18524
20944
|
* Gets the claimable balance of ETH for the recipient from a revenue manager
|
|
18525
20945
|
* @param params - Parameters for checking the balance
|
|
@@ -18576,21 +20996,24 @@ class ReadFlaunchSDK {
|
|
|
18576
20996
|
/**
|
|
18577
20997
|
* Gets the pool ID for a given coin
|
|
18578
20998
|
* @param coinAddress - The address of the coin
|
|
18579
|
-
* @param
|
|
20999
|
+
* @param version - Optional specific version to use
|
|
18580
21000
|
* @returns Promise<string> - The pool ID
|
|
18581
21001
|
*/
|
|
18582
|
-
async poolId(coinAddress,
|
|
18583
|
-
|
|
18584
|
-
|
|
21002
|
+
async poolId(coinAddress, version) {
|
|
21003
|
+
let hookAddress;
|
|
21004
|
+
if (version) {
|
|
21005
|
+
hookAddress = this.getPositionManagerAddress(version);
|
|
21006
|
+
}
|
|
21007
|
+
else {
|
|
21008
|
+
const coinVersion = await this.getCoinVersion(coinAddress);
|
|
21009
|
+
hookAddress = this.getPositionManagerAddress(coinVersion);
|
|
18585
21010
|
}
|
|
18586
21011
|
return getPoolId(orderPoolKey({
|
|
18587
21012
|
currency0: FLETHAddress[this.chainId],
|
|
18588
21013
|
currency1: coinAddress,
|
|
18589
21014
|
fee: 0,
|
|
18590
21015
|
tickSpacing: 60,
|
|
18591
|
-
hooks:
|
|
18592
|
-
? FlaunchPositionManagerAddress[this.chainId]
|
|
18593
|
-
: FlaunchPositionManagerV1_1Address[this.chainId],
|
|
21016
|
+
hooks: hookAddress,
|
|
18594
21017
|
}));
|
|
18595
21018
|
}
|
|
18596
21019
|
/**
|
|
@@ -18637,40 +21060,34 @@ class ReadFlaunchSDK {
|
|
|
18637
21060
|
* Gets a quote for selling an exact amount of tokens for ETH
|
|
18638
21061
|
* @param coinAddress - The address of the token to sell
|
|
18639
21062
|
* @param amountIn - The exact amount of tokens to sell
|
|
18640
|
-
* @param
|
|
21063
|
+
* @param version - Optional specific version to use
|
|
18641
21064
|
* @returns Promise<bigint> - The expected amount of ETH to receive
|
|
18642
21065
|
*/
|
|
18643
|
-
async getSellQuoteExactInput(coinAddress, amountIn,
|
|
18644
|
-
|
|
18645
|
-
|
|
18646
|
-
}
|
|
18647
|
-
return this.readQuoter.getSellQuoteExactInput(coinAddress, amountIn, isV1Coin);
|
|
21066
|
+
async getSellQuoteExactInput(coinAddress, amountIn, version) {
|
|
21067
|
+
const coinVersion = version || (await this.getCoinVersion(coinAddress));
|
|
21068
|
+
return this.readQuoter.getSellQuoteExactInput(coinAddress, amountIn, this.getPositionManagerAddress(coinVersion));
|
|
18648
21069
|
}
|
|
18649
21070
|
/**
|
|
18650
21071
|
* Gets a quote for buying tokens with an exact amount of ETH
|
|
18651
21072
|
* @param coinAddress - The address of the token to buy
|
|
18652
21073
|
* @param ethIn - The exact amount of ETH to spend
|
|
18653
|
-
* @param
|
|
21074
|
+
* @param version - Optional specific version to use
|
|
18654
21075
|
* @returns Promise<bigint> - The expected amount of tokens to receive
|
|
18655
21076
|
*/
|
|
18656
|
-
async getBuyQuoteExactInput(coinAddress, amountIn,
|
|
18657
|
-
|
|
18658
|
-
|
|
18659
|
-
}
|
|
18660
|
-
return this.readQuoter.getBuyQuoteExactInput(coinAddress, amountIn, isV1Coin);
|
|
21077
|
+
async getBuyQuoteExactInput(coinAddress, amountIn, version) {
|
|
21078
|
+
const coinVersion = version || (await this.getCoinVersion(coinAddress));
|
|
21079
|
+
return this.readQuoter.getBuyQuoteExactInput(coinAddress, amountIn, this.getPositionManagerAddress(coinVersion));
|
|
18661
21080
|
}
|
|
18662
21081
|
/**
|
|
18663
21082
|
* Gets a quote for buying an exact amount of tokens with ETH
|
|
18664
21083
|
* @param coinAddress - The address of the token to buy
|
|
18665
21084
|
* @param coinOut - The exact amount of tokens to receive
|
|
18666
|
-
* @param
|
|
21085
|
+
* @param version - Optional specific version to use
|
|
18667
21086
|
* @returns Promise<bigint> - The required amount of ETH to spend
|
|
18668
21087
|
*/
|
|
18669
|
-
async getBuyQuoteExactOutput(coinAddress, amountOut,
|
|
18670
|
-
|
|
18671
|
-
|
|
18672
|
-
}
|
|
18673
|
-
return this.readQuoter.getBuyQuoteExactOutput(coinAddress, amountOut, isV1Coin);
|
|
21088
|
+
async getBuyQuoteExactOutput(coinAddress, amountOut, version) {
|
|
21089
|
+
const coinVersion = version || (await this.getCoinVersion(coinAddress));
|
|
21090
|
+
return this.readQuoter.getBuyQuoteExactOutput(coinAddress, amountOut, this.getPositionManagerAddress(coinVersion));
|
|
18674
21091
|
}
|
|
18675
21092
|
/**
|
|
18676
21093
|
* Determines if flETH is currency0 in the pool
|
|
@@ -18693,8 +21110,11 @@ class ReadFlaunchSDK {
|
|
|
18693
21110
|
class ReadWriteFlaunchSDK extends ReadFlaunchSDK {
|
|
18694
21111
|
constructor(chainId, drift$1 = drift.createDrift()) {
|
|
18695
21112
|
super(chainId, drift$1);
|
|
18696
|
-
this.
|
|
18697
|
-
this.
|
|
21113
|
+
this.readWritePositionManager = new ReadWriteFlaunchPositionManager(FlaunchPositionManagerAddress[this.chainId], drift$1);
|
|
21114
|
+
this.readWritePositionManagerV1_1 = new ReadWriteFlaunchPositionManagerV1_1(FlaunchPositionManagerV1_1Address[this.chainId], drift$1);
|
|
21115
|
+
this.readWriteAnyPositionManager = new ReadWriteAnyPositionManager(AnyPositionManagerAddress[this.chainId], drift$1);
|
|
21116
|
+
this.readWriteFeeEscrow = new ReadWriteFeeEscrow(FeeEscrowAddress[this.chainId], drift$1);
|
|
21117
|
+
this.readWriteReferralEscrow = new ReadWriteReferralEscrow(ReferralEscrowAddress[this.chainId], drift$1);
|
|
18698
21118
|
this.readWriteFlaunchZap = new ReadWriteFlaunchZap(this.chainId, FlaunchZapAddress[this.chainId], drift$1);
|
|
18699
21119
|
this.readWriteTreasuryManagerFactory = new ReadWriteTreasuryManagerFactory(this.chainId, TreasuryManagerFactoryAddress[this.chainId], drift$1);
|
|
18700
21120
|
this.readWritePermit2 = new ReadWritePermit2(Permit2Address[this.chainId], drift$1);
|
|
@@ -18731,7 +21151,7 @@ class ReadWriteFlaunchSDK extends ReadFlaunchSDK {
|
|
|
18731
21151
|
return event.args._manager;
|
|
18732
21152
|
}
|
|
18733
21153
|
/**
|
|
18734
|
-
* Creates a new Flaunch on
|
|
21154
|
+
* Creates a new Flaunch on the specified version
|
|
18735
21155
|
* @param params - Parameters for creating the Flaunch
|
|
18736
21156
|
* @returns Transaction response
|
|
18737
21157
|
*/
|
|
@@ -18739,37 +21159,13 @@ class ReadWriteFlaunchSDK extends ReadFlaunchSDK {
|
|
|
18739
21159
|
return this.readWriteFlaunchZap.flaunch(params);
|
|
18740
21160
|
}
|
|
18741
21161
|
/**
|
|
18742
|
-
* Creates a new Flaunch
|
|
21162
|
+
* Creates a new Flaunch with IPFS metadata and optional version specification
|
|
18743
21163
|
* @param params - Parameters for creating the Flaunch with IPFS data
|
|
18744
21164
|
* @returns Transaction response
|
|
18745
21165
|
*/
|
|
18746
21166
|
flaunchIPFS(params) {
|
|
18747
21167
|
return this.readWriteFlaunchZap.flaunchIPFS(params);
|
|
18748
21168
|
}
|
|
18749
|
-
/**
|
|
18750
|
-
* Creates a new fast Flaunch on V1.1
|
|
18751
|
-
* @param params - Parameters for creating the fast Flaunch
|
|
18752
|
-
* @throws Error if FastFlaunchZap is not deployed on the current chain
|
|
18753
|
-
* @returns Transaction response
|
|
18754
|
-
*/
|
|
18755
|
-
fastFlaunch(params) {
|
|
18756
|
-
if (this.readWriteFastFlaunchZap.contract.address === viem.zeroAddress) {
|
|
18757
|
-
throw new Error(`FastFlaunchZap is not deployed at chainId: ${this.chainId}`);
|
|
18758
|
-
}
|
|
18759
|
-
return this.readWriteFastFlaunchZap.fastFlaunch(params);
|
|
18760
|
-
}
|
|
18761
|
-
/**
|
|
18762
|
-
* Creates a new fast Flaunch on V1.1 with IPFS metadata
|
|
18763
|
-
* @param params - Parameters for creating the fast Flaunch with IPFS data
|
|
18764
|
-
* @throws Error if FastFlaunchZap is not deployed on the current chain
|
|
18765
|
-
* @returns Transaction response
|
|
18766
|
-
*/
|
|
18767
|
-
fastFlaunchIPFS(params) {
|
|
18768
|
-
if (this.readWriteFastFlaunchZap.contract.address === viem.zeroAddress) {
|
|
18769
|
-
throw new Error(`FastFlaunchZap is not deployed at chainId: ${this.chainId}`);
|
|
18770
|
-
}
|
|
18771
|
-
return this.readWriteFastFlaunchZap.fastFlaunchIPFS(params);
|
|
18772
|
-
}
|
|
18773
21169
|
/**
|
|
18774
21170
|
* Creates a new Flaunch with revenue manager configuration
|
|
18775
21171
|
* @param params - Parameters for creating the Flaunch with revenue manager
|
|
@@ -18794,6 +21190,14 @@ class ReadWriteFlaunchSDK extends ReadFlaunchSDK {
|
|
|
18794
21190
|
}
|
|
18795
21191
|
return this.readWriteFlaunchZap.flaunchIPFSWithRevenueManager(params);
|
|
18796
21192
|
}
|
|
21193
|
+
/**
|
|
21194
|
+
* Creates a new Flaunch with AnyPositionManager for external coins
|
|
21195
|
+
* @param params - Parameters for creating the Flaunch with AnyPositionManager
|
|
21196
|
+
* @returns Transaction response
|
|
21197
|
+
*/
|
|
21198
|
+
anyFlaunch(params) {
|
|
21199
|
+
return this.readWriteAnyPositionManager.flaunch(params);
|
|
21200
|
+
}
|
|
18797
21201
|
/**
|
|
18798
21202
|
* Gets the balance of a specific coin for the connected wallet
|
|
18799
21203
|
* @param coinAddress - The address of the coin to check
|
|
@@ -18808,13 +21212,11 @@ class ReadWriteFlaunchSDK extends ReadFlaunchSDK {
|
|
|
18808
21212
|
/**
|
|
18809
21213
|
* Buys a coin with ETH
|
|
18810
21214
|
* @param params - Parameters for buying the coin including amount, slippage, and referrer
|
|
18811
|
-
* @param
|
|
21215
|
+
* @param version - Optional specific version to use. If not provided, will determine automatically
|
|
18812
21216
|
* @returns Transaction response for the buy operation
|
|
18813
21217
|
*/
|
|
18814
|
-
async buyCoin(params,
|
|
18815
|
-
|
|
18816
|
-
isV1Coin = await this.isV1Coin(params.coinAddress);
|
|
18817
|
-
}
|
|
21218
|
+
async buyCoin(params, version) {
|
|
21219
|
+
const coinVersion = version || (await this.getCoinVersion(params.coinAddress));
|
|
18818
21220
|
const sender = await this.drift.getSignerAddress();
|
|
18819
21221
|
let amountIn;
|
|
18820
21222
|
let amountOutMin;
|
|
@@ -18824,7 +21226,8 @@ class ReadWriteFlaunchSDK extends ReadFlaunchSDK {
|
|
|
18824
21226
|
if (params.swapType === "EXACT_IN") {
|
|
18825
21227
|
amountIn = params.amountIn;
|
|
18826
21228
|
if (params.amountOutMin === undefined) {
|
|
18827
|
-
|
|
21229
|
+
// Currently only V1 and V1.1 are supported in the Quoter
|
|
21230
|
+
amountOutMin = getAmountWithSlippage(await this.readQuoter.getBuyQuoteExactInput(params.coinAddress, amountIn, this.getPositionManagerAddress(coinVersion)), (params.slippagePercent / 100).toFixed(18).toString(), params.swapType);
|
|
18828
21231
|
}
|
|
18829
21232
|
else {
|
|
18830
21233
|
amountOutMin = params.amountOutMin;
|
|
@@ -18833,12 +21236,14 @@ class ReadWriteFlaunchSDK extends ReadFlaunchSDK {
|
|
|
18833
21236
|
else {
|
|
18834
21237
|
amountOut = params.amountOut;
|
|
18835
21238
|
if (params.amountInMax === undefined) {
|
|
18836
|
-
|
|
21239
|
+
// Currently only V1 and V1.1 are supported in the Quoter
|
|
21240
|
+
amountInMax = getAmountWithSlippage(await this.readQuoter.getBuyQuoteExactOutput(params.coinAddress, amountOut, this.getPositionManagerAddress(coinVersion)), (params.slippagePercent / 100).toFixed(18).toString(), params.swapType);
|
|
18837
21241
|
}
|
|
18838
21242
|
else {
|
|
18839
21243
|
amountInMax = params.amountInMax;
|
|
18840
21244
|
}
|
|
18841
21245
|
}
|
|
21246
|
+
// When UniversalRouter supports isAny parameter, add it here
|
|
18842
21247
|
const { commands, inputs } = ethToMemecoin({
|
|
18843
21248
|
sender: sender,
|
|
18844
21249
|
memecoin: params.coinAddress,
|
|
@@ -18849,7 +21254,7 @@ class ReadWriteFlaunchSDK extends ReadFlaunchSDK {
|
|
|
18849
21254
|
amountOutMin: amountOutMin,
|
|
18850
21255
|
amountOut: amountOut,
|
|
18851
21256
|
amountInMax: amountInMax,
|
|
18852
|
-
|
|
21257
|
+
positionManagerAddress: this.getPositionManagerAddress(coinVersion),
|
|
18853
21258
|
});
|
|
18854
21259
|
return this.drift.adapter.write({
|
|
18855
21260
|
abi: UniversalRouterAbi,
|
|
@@ -18865,22 +21270,22 @@ class ReadWriteFlaunchSDK extends ReadFlaunchSDK {
|
|
|
18865
21270
|
/**
|
|
18866
21271
|
* Sells a coin for ETH
|
|
18867
21272
|
* @param params - Parameters for selling the coin including amount, slippage, permit data, and referrer
|
|
18868
|
-
* @param
|
|
21273
|
+
* @param version - Optional specific version to use. If not provided, will determine automatically
|
|
18869
21274
|
* @returns Transaction response for the sell operation
|
|
18870
21275
|
*/
|
|
18871
|
-
async sellCoin(params,
|
|
18872
|
-
|
|
18873
|
-
isV1Coin = await this.isV1Coin(params.coinAddress);
|
|
18874
|
-
}
|
|
21276
|
+
async sellCoin(params, version) {
|
|
21277
|
+
const coinVersion = version || (await this.getCoinVersion(params.coinAddress));
|
|
18875
21278
|
let ethOutMin;
|
|
18876
21279
|
await this.readQuoter.contract.cache.clear();
|
|
18877
21280
|
if (params.ethOutMin === undefined) {
|
|
18878
|
-
|
|
21281
|
+
// Currently only V1 and V1.1 are supported in the Quoter
|
|
21282
|
+
ethOutMin = getAmountWithSlippage(await this.readQuoter.getSellQuoteExactInput(params.coinAddress, params.amountIn, this.getPositionManagerAddress(coinVersion)), (params.slippagePercent / 100).toFixed(18).toString(), "EXACT_IN");
|
|
18879
21283
|
}
|
|
18880
21284
|
else {
|
|
18881
21285
|
ethOutMin = params.ethOutMin;
|
|
18882
21286
|
}
|
|
18883
21287
|
await this.readPermit2.contract.cache.clear();
|
|
21288
|
+
// When UniversalRouter supports isAny parameter, add it here
|
|
18884
21289
|
const { commands, inputs } = memecoinToEthWithPermit2({
|
|
18885
21290
|
chainId: this.chainId,
|
|
18886
21291
|
memecoin: params.coinAddress,
|
|
@@ -18889,7 +21294,7 @@ class ReadWriteFlaunchSDK extends ReadFlaunchSDK {
|
|
|
18889
21294
|
permitSingle: params.permitSingle,
|
|
18890
21295
|
signature: params.signature,
|
|
18891
21296
|
referrer: params.referrer ?? null,
|
|
18892
|
-
|
|
21297
|
+
positionManagerAddress: this.getPositionManagerAddress(coinVersion),
|
|
18893
21298
|
});
|
|
18894
21299
|
return this.drift.write({
|
|
18895
21300
|
abi: UniversalRouterAbi,
|
|
@@ -18930,6 +21335,31 @@ class ReadWriteFlaunchSDK extends ReadFlaunchSDK {
|
|
|
18930
21335
|
nonce,
|
|
18931
21336
|
};
|
|
18932
21337
|
}
|
|
21338
|
+
/**
|
|
21339
|
+
* Withdraws the creator's share of the revenue
|
|
21340
|
+
* @param params - Parameters for withdrawing the creator's share of the revenue
|
|
21341
|
+
* @param params.recipient - The address to withdraw the revenue to. Defaults to the connected wallet
|
|
21342
|
+
* @param params.isV1 - Optional boolean to withdraw from V1. V1.1 & AnyPositionManager use the same FeeEscrow contract
|
|
21343
|
+
* @returns Transaction response
|
|
21344
|
+
*/
|
|
21345
|
+
async withdrawCreatorRevenue(params) {
|
|
21346
|
+
const recipient = params.recipient ?? (await this.drift.getSignerAddress());
|
|
21347
|
+
if (params.isV1) {
|
|
21348
|
+
return this.readWritePositionManager.withdrawFees(recipient);
|
|
21349
|
+
}
|
|
21350
|
+
else {
|
|
21351
|
+
return this.readWriteFeeEscrow.withdrawFees(recipient);
|
|
21352
|
+
}
|
|
21353
|
+
}
|
|
21354
|
+
/**
|
|
21355
|
+
* Claims the referral balance for a given recipient
|
|
21356
|
+
* @param coins - The addresses of the coins to claim
|
|
21357
|
+
* @param recipient - The address of the recipient to claim the balance for
|
|
21358
|
+
* @returns Transaction response
|
|
21359
|
+
*/
|
|
21360
|
+
claimReferralBalance(coins, recipient) {
|
|
21361
|
+
return this.readWriteReferralEscrow.claimTokens(coins, recipient);
|
|
21362
|
+
}
|
|
18933
21363
|
/**
|
|
18934
21364
|
* Claims the protocol's share of the revenue
|
|
18935
21365
|
* @param params - Parameters for claiming the protocol's share of the revenue
|
|
@@ -18959,6 +21389,26 @@ class ReadWriteFlaunchSDK extends ReadFlaunchSDK {
|
|
|
18959
21389
|
}
|
|
18960
21390
|
}
|
|
18961
21391
|
|
|
21392
|
+
/**
|
|
21393
|
+
* Creates a Drift instance with the provided clients
|
|
21394
|
+
* @param params - Parameters for creating the Drift instance
|
|
21395
|
+
* @returns Drift instance configured with the appropriate clients
|
|
21396
|
+
* @throws Error if publicClient.chain is not configured
|
|
21397
|
+
*/
|
|
21398
|
+
function createDrift(params) {
|
|
21399
|
+
const { publicClient, walletClient } = params;
|
|
21400
|
+
if (!publicClient.chain) {
|
|
21401
|
+
throw new Error("publicClient must be configured with a chain");
|
|
21402
|
+
}
|
|
21403
|
+
return walletClient
|
|
21404
|
+
? drift.createDrift({
|
|
21405
|
+
adapter: driftViem.viemAdapter({ publicClient, walletClient }),
|
|
21406
|
+
})
|
|
21407
|
+
: drift.createDrift({
|
|
21408
|
+
adapter: driftViem.viemAdapter({ publicClient }),
|
|
21409
|
+
});
|
|
21410
|
+
}
|
|
21411
|
+
|
|
18962
21412
|
/**
|
|
18963
21413
|
* Creates a Flaunch SDK instance with the provided clients
|
|
18964
21414
|
* @param params - Parameters for creating the SDK
|
|
@@ -18973,12 +21423,8 @@ function createFlaunch(params) {
|
|
|
18973
21423
|
const chainId = publicClient.chain.id;
|
|
18974
21424
|
// Return appropriate SDK type based on whether walletClient is provided
|
|
18975
21425
|
return walletClient
|
|
18976
|
-
? new ReadWriteFlaunchSDK(chainId,
|
|
18977
|
-
|
|
18978
|
-
}))
|
|
18979
|
-
: new ReadFlaunchSDK(chainId, drift.createDrift({
|
|
18980
|
-
adapter: driftViem.viemAdapter({ publicClient }),
|
|
18981
|
-
}));
|
|
21426
|
+
? new ReadWriteFlaunchSDK(chainId, createDrift({ publicClient, walletClient }))
|
|
21427
|
+
: new ReadFlaunchSDK(chainId, createDrift({ publicClient }));
|
|
18982
21428
|
}
|
|
18983
21429
|
|
|
18984
21430
|
const FlaunchSDK = {
|
|
@@ -18986,39 +21432,61 @@ const FlaunchSDK = {
|
|
|
18986
21432
|
ReadWriteFlaunchSDK,
|
|
18987
21433
|
};
|
|
18988
21434
|
|
|
21435
|
+
exports.AnyPositionManagerAbi = AnyPositionManagerAbi;
|
|
21436
|
+
exports.AnyPositionManagerAddress = AnyPositionManagerAddress;
|
|
18989
21437
|
exports.BidWallAddress = BidWallAddress;
|
|
21438
|
+
exports.BidWallV1_1Abi = BidWallV1_1Abi;
|
|
18990
21439
|
exports.BidWallV1_1Address = BidWallV1_1Address;
|
|
21440
|
+
exports.BidwallAbi = BidwallAbi;
|
|
18991
21441
|
exports.FLETHAddress = FLETHAddress;
|
|
18992
21442
|
exports.FLETHHooksAddress = FLETHHooksAddress;
|
|
18993
21443
|
exports.FairLaunchAbi = FairLaunchAbi;
|
|
18994
21444
|
exports.FairLaunchAddress = FairLaunchAddress;
|
|
21445
|
+
exports.FairLaunchV1_1Abi = FairLaunchV1_1Abi;
|
|
18995
21446
|
exports.FairLaunchV1_1Address = FairLaunchV1_1Address;
|
|
18996
21447
|
exports.FastFlaunchZapAbi = FastFlaunchZapAbi;
|
|
18997
21448
|
exports.FastFlaunchZapAddress = FastFlaunchZapAddress;
|
|
21449
|
+
exports.FeeEscrowAbi = FeeEscrowAbi;
|
|
21450
|
+
exports.FeeEscrowAddress = FeeEscrowAddress;
|
|
21451
|
+
exports.FlaunchAbi = FlaunchAbi;
|
|
18998
21452
|
exports.FlaunchAddress = FlaunchAddress;
|
|
18999
21453
|
exports.FlaunchPositionManagerAbi = FlaunchPositionManagerAbi;
|
|
19000
21454
|
exports.FlaunchPositionManagerAddress = FlaunchPositionManagerAddress;
|
|
21455
|
+
exports.FlaunchPositionManagerV1_1Abi = FlaunchPositionManagerV1_1Abi;
|
|
19001
21456
|
exports.FlaunchPositionManagerV1_1Address = FlaunchPositionManagerV1_1Address;
|
|
19002
21457
|
exports.FlaunchSDK = FlaunchSDK;
|
|
21458
|
+
exports.FlaunchV1_1Abi = FlaunchV1_1Abi;
|
|
19003
21459
|
exports.FlaunchV1_1Address = FlaunchV1_1Address;
|
|
21460
|
+
exports.FlaunchZapAbi = FlaunchZapAbi;
|
|
19004
21461
|
exports.FlaunchZapAddress = FlaunchZapAddress;
|
|
21462
|
+
exports.InitialPriceAbi = InitialPriceAbi;
|
|
19005
21463
|
exports.MemecoinAbi = MemecoinAbi;
|
|
21464
|
+
exports.MulticallAbi = MulticallAbi;
|
|
21465
|
+
exports.Permit2Abi = Permit2Abi;
|
|
19006
21466
|
exports.Permit2Address = Permit2Address;
|
|
19007
21467
|
exports.PoolManagerAbi = PoolManagerAbi;
|
|
19008
21468
|
exports.PoolManagerAddress = PoolManagerAddress;
|
|
21469
|
+
exports.QuoterAbi = QuoterAbi;
|
|
19009
21470
|
exports.QuoterAddress = QuoterAddress;
|
|
19010
21471
|
exports.ReadFlaunchSDK = ReadFlaunchSDK;
|
|
19011
21472
|
exports.ReadWriteFlaunchSDK = ReadWriteFlaunchSDK;
|
|
21473
|
+
exports.ReferralEscrowAbi = ReferralEscrowAbi;
|
|
21474
|
+
exports.ReferralEscrowAddress = ReferralEscrowAddress;
|
|
21475
|
+
exports.RevenueManagerAbi = RevenueManagerAbi;
|
|
19012
21476
|
exports.RevenueManagerAddress = RevenueManagerAddress;
|
|
21477
|
+
exports.StateViewAbi = StateViewAbi;
|
|
19013
21478
|
exports.StateViewAddress = StateViewAddress;
|
|
19014
21479
|
exports.TICK_SPACING = TICK_SPACING;
|
|
19015
21480
|
exports.TickFinder = TickFinder;
|
|
21481
|
+
exports.TreasuryManagerFactoryAbi = TreasuryManagerFactoryAbi;
|
|
19016
21482
|
exports.TreasuryManagerFactoryAddress = TreasuryManagerFactoryAddress;
|
|
19017
21483
|
exports.USDCETHPoolKeys = USDCETHPoolKeys;
|
|
21484
|
+
exports.UniversalRouterAbi = UniversalRouterAbi;
|
|
19018
21485
|
exports.UniversalRouterAddress = UniversalRouterAddress;
|
|
19019
21486
|
exports.bytes32ToUint256 = bytes32ToUint256;
|
|
19020
21487
|
exports.calculateUnderlyingTokenBalances = calculateUnderlyingTokenBalances;
|
|
19021
21488
|
exports.chainIdToChain = chainIdToChain;
|
|
21489
|
+
exports.createDrift = createDrift;
|
|
19022
21490
|
exports.createFlaunch = createFlaunch;
|
|
19023
21491
|
exports.generateTokenUri = generateTokenUri;
|
|
19024
21492
|
exports.getPoolId = getPoolId;
|