@flaunch/sdk 0.8.1 → 0.8.3-beta.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.
Files changed (50) hide show
  1. package/README.md +36 -0
  2. package/dist/abi/FlaunchZap.d.ts +106 -102
  3. package/dist/abi/FlaunchZap.d.ts.map +1 -1
  4. package/dist/abi/TokenImporter.d.ts +288 -0
  5. package/dist/abi/TokenImporter.d.ts.map +1 -0
  6. package/dist/abi/TreasuryManager.d.ts +106 -0
  7. package/dist/abi/TreasuryManager.d.ts.map +1 -0
  8. package/dist/abi/TreasuryManagerFactory.d.ts +268 -242
  9. package/dist/abi/TreasuryManagerFactory.d.ts.map +1 -1
  10. package/dist/abi/index.cjs +476 -322
  11. package/dist/abi/index.cjs.map +1 -1
  12. package/dist/abi/index.js +476 -322
  13. package/dist/abi/index.js.map +1 -1
  14. package/dist/addresses/index.cjs +58 -12
  15. package/dist/addresses/index.cjs.map +1 -1
  16. package/dist/addresses/index.js +50 -13
  17. package/dist/addresses/index.js.map +1 -1
  18. package/dist/addresses.d.ts +14 -1
  19. package/dist/addresses.d.ts.map +1 -1
  20. package/dist/clients/FlaunchZapClient.d.ts +15 -3
  21. package/dist/clients/FlaunchZapClient.d.ts.map +1 -1
  22. package/dist/clients/TokenImporter.d.ts +41 -0
  23. package/dist/clients/TokenImporter.d.ts.map +1 -0
  24. package/dist/clients/TreasuryManagerClient.d.ts +60 -0
  25. package/dist/clients/TreasuryManagerClient.d.ts.map +1 -0
  26. package/dist/clients/TreasuryManagerFactoryClient.d.ts +34 -7
  27. package/dist/clients/TreasuryManagerFactoryClient.d.ts.map +1 -1
  28. package/dist/helpers/index.cjs +61 -0
  29. package/dist/helpers/index.cjs.map +1 -1
  30. package/dist/helpers/index.d.ts +1 -0
  31. package/dist/helpers/index.d.ts.map +1 -1
  32. package/dist/helpers/index.js +62 -2
  33. package/dist/helpers/index.js.map +1 -1
  34. package/dist/helpers/permissions.d.ts +10 -0
  35. package/dist/helpers/permissions.d.ts.map +1 -0
  36. package/dist/index.cjs.js +1359 -377
  37. package/dist/index.cjs.js.map +1 -1
  38. package/dist/index.d.ts +1 -0
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/index.esm.js +1345 -379
  41. package/dist/index.esm.js.map +1 -1
  42. package/dist/index.umd.js +1 -1
  43. package/dist/index.umd.js.map +1 -1
  44. package/dist/sdk/FlaunchSDK.d.ts +97 -6
  45. package/dist/sdk/FlaunchSDK.d.ts.map +1 -1
  46. package/dist/types.d.ts +18 -0
  47. package/dist/types.d.ts.map +1 -1
  48. package/dist/utils/index.d.ts +4 -0
  49. package/dist/utils/index.d.ts.map +1 -0
  50. package/package.json +6 -1
package/dist/index.esm.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { createDrift as createDrift$1 } from '@delvtech/drift';
2
- import { zeroAddress, parseEther, encodeAbiParameters, maxUint256 as maxUint256$1, encodeFunctionData, maxUint160, maxUint48, parseUnits, hexToBigInt as hexToBigInt$1, pad as pad$1, keccak256 as keccak256$1, encodePacked, stringToHex as stringToHex$1, zeroHash, formatUnits as formatUnits$1, concat, toHex as toHex$1, createPublicClient, http } from 'viem';
2
+ import { zeroAddress, parseEther, encodeAbiParameters, maxUint256 as maxUint256$1, encodeFunctionData, maxUint160, maxUint48, parseUnits, hexToBigInt as hexToBigInt$1, pad as pad$1, keccak256 as keccak256$1, encodePacked, stringToHex as stringToHex$1, zeroHash, formatUnits as formatUnits$1, createPublicClient, http, concat, toHex as toHex$1, erc721Abi } from 'viem';
3
3
  import axios from 'axios';
4
4
  import { TickMath } from '@uniswap/v3-sdk';
5
5
  import { viemAdapter } from '@delvtech/drift-viem';
@@ -5307,7 +5307,7 @@ const sourceId = 5; // goerli
5307
5307
  testnet: true,
5308
5308
  });
5309
5309
 
5310
- // doesn't use FeeEscrow
5310
+ // only old V1.0: doesn't use FeeEscrow
5311
5311
  const FlaunchPositionManagerAddress = {
5312
5312
  [base.id]: "0x51Bba15255406Cfe7099a42183302640ba7dAFDC",
5313
5313
  [baseSepolia.id]: "0x9A7059cA00dA92843906Cb4bCa1D005cE848AFdC",
@@ -5317,10 +5317,45 @@ const FlaunchPositionManagerV1_1Address = {
5317
5317
  [baseSepolia.id]: "0x24347e0dd16357059abfc1b321df354873552fdc",
5318
5318
  };
5319
5319
  const AnyPositionManagerAddress = {
5320
- // TODO: update with actual address
5321
- [base.id]: zeroAddress,
5320
+ [base.id]: "0x8DC3b85e1dc1C846ebf3971179a751896842e5dC",
5322
5321
  [baseSepolia.id]: "0xB4A535B9D35851972736495CC52FBfDaCF32e5dc",
5323
5322
  };
5323
+ /** Verifiers */
5324
+ const TokenImporterAddress = {
5325
+ [base.id]: "0xb47af90ae61bc916ea4b4bacffae4570e7435842",
5326
+ [baseSepolia.id]: "0xb4955a396ef07c124a59164c30d63e96a103a98b",
5327
+ };
5328
+ const ClankerWorldVerifierAddress = {
5329
+ [base.id]: "0xf6ddfcb093be0cd0c015590cb6c5127d9ff2a20b",
5330
+ [baseSepolia.id]: "0x2874f9a30348acaaad55d74b0bec9c18f04b471a",
5331
+ };
5332
+ const DopplerVerifierAddress = {
5333
+ [base.id]: "0xedd66b080b8e9425c39d349a3fb69f480580f993",
5334
+ [baseSepolia.id]: "0x6428b5C4da36ecB070aBdcB5E1939244A3cC7fb5",
5335
+ };
5336
+ const VirtualsVerifierAddress = {
5337
+ [base.id]: "0x06a089fa231aca48d2aa77365123ad9aca43d3a4",
5338
+ [baseSepolia.id]: "0x6582d2bc6a7eba3b40bdf46b3868fc7ec2ff96ec",
5339
+ };
5340
+ const WhitelistVerifierAddress = {
5341
+ [base.id]: "0x7a04367563a65db574d6b7d084fdbcf4a570c5a6",
5342
+ [baseSepolia.id]: "0xfde5b79e3e2814edd5f91e8694ae400954d9cfaa",
5343
+ };
5344
+ const ZoraVerifierAddress = {
5345
+ [base.id]: "0x656047fd43d2c3a121f2ef859d7171d7dd59f8b9",
5346
+ [baseSepolia.id]: "0x05a5763e9199b88bb591c6b112d0424b2cd7a99e",
5347
+ };
5348
+ /** ======== */
5349
+ /** Permissions */
5350
+ const ClosedPermissionsAddress = {
5351
+ [base.id]: "0x0000000000000000000000000000000000000000", // TODO: add mainnet address
5352
+ [baseSepolia.id]: "0x551aeD820CAfaca2f9cD1C637AAc076D05a03AC2",
5353
+ };
5354
+ const WhitelistedPermissionsAddress = {
5355
+ [base.id]: "0x0000000000000000000000000000000000000000", // TODO: add mainnet address
5356
+ [baseSepolia.id]: "0xe8691E8f576A98c41EBB5E984207d4F51386621f",
5357
+ };
5358
+ /** =========== */
5324
5359
  const FeeEscrowAddress = {
5325
5360
  [base.id]: "0x72e6f7948b1B1A343B477F39aAbd2E35E6D27dde",
5326
5361
  [baseSepolia.id]: "0x73E27908b7d35A9251a54799A8ef4C17e4ED9FF9",
@@ -5356,8 +5391,7 @@ const FlaunchV1_1Address = {
5356
5391
  [baseSepolia.id]: "0x96be8ff5e244294a34bfa507a39190dc7a839baa",
5357
5392
  };
5358
5393
  const AnyFlaunchAddress = {
5359
- // FIXME: update with actual address
5360
- [base.id]: zeroAddress,
5394
+ [base.id]: "0xc5B2E8F197407263F4B62a35C71bFc394ecF95D5",
5361
5395
  [baseSepolia.id]: "0x67Ee6C83956a75f67bD3Fc8Ca4080D95a145c7C9",
5362
5396
  };
5363
5397
  const BidWallAddress = {
@@ -5370,8 +5404,7 @@ const BidWallV1_1Address = {
5370
5404
  [baseSepolia.id]: "0x6f2fa01a05ff8b6efbfefd91a3b85aaf19265a00",
5371
5405
  };
5372
5406
  const AnyBidWallAddress = {
5373
- // FIXME: update with actual address
5374
- [base.id]: zeroAddress,
5407
+ [base.id]: "0x2154c604df568A5285284D1c4918DC98C39240df",
5375
5408
  [baseSepolia.id]: "0xcfF222eA42E43F46A98755db237E4c9C2CA9B772",
5376
5409
  };
5377
5410
  const FastFlaunchZapAddress = {
@@ -5379,8 +5412,12 @@ const FastFlaunchZapAddress = {
5379
5412
  [baseSepolia.id]: "0x821d9f6075e7971cc71c379081de9d532f5f9957",
5380
5413
  };
5381
5414
  const FlaunchZapAddress = {
5382
- [base.id]: "0xfa9e8528ee95eb109bffd1a2d59cb95b300a672a",
5383
- [baseSepolia.id]: "0xb2f5d987de90e026b61805e60b6002d367461474",
5415
+ [base.id]: "0xfa9e8528ee95eb109bffd1a2d59cb95b300a672a", // TODO: update mainnet address with permissions param
5416
+ [baseSepolia.id]: "0x9AE92E5ad16822F9723be29E58B6019B7fA765c5",
5417
+ };
5418
+ const TreasuryManagerFactoryAddress = {
5419
+ [base.id]: "0x48af8b28DDC5e5A86c4906212fc35Fa808CA8763", // TODO: update mainnet address with permissions param
5420
+ [baseSepolia.id]: "0xb22779fcDB2a1199E6592e0D4BE29A0C8c626246",
5384
5421
  };
5385
5422
  const RevenueManagerAddress = {
5386
5423
  [base.id]: "0x712fa8ddc7347b4b6b029aa21710f365cd02d898",
@@ -5390,9 +5427,9 @@ const AddressFeeSplitManagerAddress = {
5390
5427
  [base.id]: "0x6baa4ec493a9698dc7388c0f290e29ea3d149f99",
5391
5428
  [baseSepolia.id]: "0xf72dcdee692c188de6b14c6213e849982e04069b",
5392
5429
  };
5393
- const TreasuryManagerFactoryAddress = {
5394
- [base.id]: "0x48af8b28DDC5e5A86c4906212fc35Fa808CA8763",
5395
- [baseSepolia.id]: "0xd2f3c6185e06925dcbe794c6574315b2202e9ccd",
5430
+ const StakingManagerAddress = {
5431
+ [base.id]: "0x0000000000000000000000000000000000000000", // TODO: update mainnet address
5432
+ [baseSepolia.id]: "0x4a59dBAd29981A39BE597081f7f5071843552158",
5396
5433
  };
5397
5434
  const PoolManagerAddress = {
5398
5435
  [base.id]: "0x498581fF718922c3f8e6A244956aF099B2652b2b",
@@ -10780,237 +10817,387 @@ class AnyBidWall {
10780
10817
 
10781
10818
  const FlaunchZapAbi = [
10782
10819
  {
10820
+ type: "constructor",
10783
10821
  inputs: [
10784
10822
  {
10785
- internalType: "contract PositionManager",
10786
10823
  name: "_positionManager",
10787
10824
  type: "address",
10825
+ internalType: "contract PositionManager",
10788
10826
  },
10789
10827
  {
10790
- internalType: "contract Flaunch",
10791
10828
  name: "_flaunchContract",
10792
10829
  type: "address",
10830
+ internalType: "contract Flaunch",
10831
+ },
10832
+ {
10833
+ name: "_flETH",
10834
+ type: "address",
10835
+ internalType: "contract IFLETH",
10836
+ },
10837
+ {
10838
+ name: "_poolSwap",
10839
+ type: "address",
10840
+ internalType: "contract PoolSwap",
10793
10841
  },
10794
- { internalType: "contract IFLETH", name: "_flETH", type: "address" },
10795
- { internalType: "contract PoolSwap", name: "_poolSwap", type: "address" },
10796
10842
  {
10797
- internalType: "contract ITreasuryManagerFactory",
10798
10843
  name: "_treasuryManagerFactory",
10799
10844
  type: "address",
10845
+ internalType: "contract ITreasuryManagerFactory",
10800
10846
  },
10801
10847
  {
10802
- internalType: "contract IMerkleAirdrop",
10803
10848
  name: "_merkleAirdrop",
10804
10849
  type: "address",
10850
+ internalType: "contract IMerkleAirdrop",
10805
10851
  },
10806
10852
  {
10807
- internalType: "contract WhitelistFairLaunch",
10808
10853
  name: "_whitelistFairLaunch",
10809
10854
  type: "address",
10855
+ internalType: "contract WhitelistFairLaunch",
10810
10856
  },
10811
10857
  ],
10812
10858
  stateMutability: "nonpayable",
10813
- type: "constructor",
10814
10859
  },
10815
- { inputs: [], name: "CreatorCannotBeZero", type: "error" },
10816
- { inputs: [], name: "InsufficientMemecoinsForAirdrop", type: "error" },
10860
+ { type: "receive", stateMutability: "payable" },
10817
10861
  {
10862
+ type: "function",
10863
+ name: "calculateFee",
10818
10864
  inputs: [
10819
- { internalType: "uint256", name: "_premineAmount", type: "uint256" },
10820
- { internalType: "uint256", name: "_slippage", type: "uint256" },
10821
- { internalType: "bytes", name: "_initialPriceParams", type: "bytes" },
10865
+ {
10866
+ name: "_premineAmount",
10867
+ type: "uint256",
10868
+ internalType: "uint256",
10869
+ },
10870
+ { name: "_slippage", type: "uint256", internalType: "uint256" },
10871
+ {
10872
+ name: "_initialPriceParams",
10873
+ type: "bytes",
10874
+ internalType: "bytes",
10875
+ },
10822
10876
  ],
10823
- name: "calculateFee",
10824
10877
  outputs: [
10825
- { internalType: "uint256", name: "ethRequired_", type: "uint256" },
10878
+ { name: "ethRequired_", type: "uint256", internalType: "uint256" },
10826
10879
  ],
10827
10880
  stateMutability: "view",
10828
- type: "function",
10829
10881
  },
10830
10882
  {
10831
- inputs: [],
10883
+ type: "function",
10832
10884
  name: "flETH",
10833
- outputs: [{ internalType: "contract IFLETH", name: "", type: "address" }],
10885
+ inputs: [],
10886
+ outputs: [{ name: "", type: "address", internalType: "contract IFLETH" }],
10834
10887
  stateMutability: "view",
10835
- type: "function",
10836
10888
  },
10837
10889
  {
10890
+ type: "function",
10891
+ name: "flaunch",
10838
10892
  inputs: [
10839
10893
  {
10894
+ name: "_flaunchParams",
10895
+ type: "tuple",
10896
+ internalType: "struct PositionManager.FlaunchParams",
10840
10897
  components: [
10841
- { internalType: "string", name: "name", type: "string" },
10842
- { internalType: "string", name: "symbol", type: "string" },
10843
- { internalType: "string", name: "tokenUri", type: "string" },
10898
+ { name: "name", type: "string", internalType: "string" },
10899
+ { name: "symbol", type: "string", internalType: "string" },
10900
+ { name: "tokenUri", type: "string", internalType: "string" },
10844
10901
  {
10845
- internalType: "uint256",
10846
10902
  name: "initialTokenFairLaunch",
10847
10903
  type: "uint256",
10904
+ internalType: "uint256",
10848
10905
  },
10849
10906
  {
10850
- internalType: "uint256",
10851
10907
  name: "fairLaunchDuration",
10852
10908
  type: "uint256",
10909
+ internalType: "uint256",
10853
10910
  },
10854
- { internalType: "uint256", name: "premineAmount", type: "uint256" },
10855
- { internalType: "address", name: "creator", type: "address" },
10856
10911
  {
10857
- internalType: "uint24",
10912
+ name: "premineAmount",
10913
+ type: "uint256",
10914
+ internalType: "uint256",
10915
+ },
10916
+ { name: "creator", type: "address", internalType: "address" },
10917
+ {
10858
10918
  name: "creatorFeeAllocation",
10859
10919
  type: "uint24",
10920
+ internalType: "uint24",
10921
+ },
10922
+ {
10923
+ name: "flaunchAt",
10924
+ type: "uint256",
10925
+ internalType: "uint256",
10926
+ },
10927
+ {
10928
+ name: "initialPriceParams",
10929
+ type: "bytes",
10930
+ internalType: "bytes",
10931
+ },
10932
+ {
10933
+ name: "feeCalculatorParams",
10934
+ type: "bytes",
10935
+ internalType: "bytes",
10860
10936
  },
10861
- { internalType: "uint256", name: "flaunchAt", type: "uint256" },
10862
- { internalType: "bytes", name: "initialPriceParams", type: "bytes" },
10863
- { internalType: "bytes", name: "feeCalculatorParams", type: "bytes" },
10864
10937
  ],
10865
- internalType: "struct PositionManager.FlaunchParams",
10866
- name: "_flaunchParams",
10867
- type: "tuple",
10868
10938
  },
10869
10939
  ],
10870
- name: "flaunch",
10871
10940
  outputs: [
10872
- { internalType: "address", name: "memecoin_", type: "address" },
10873
- { internalType: "uint256", name: "ethSpent_", type: "uint256" },
10874
- { internalType: "address", name: "", type: "address" },
10941
+ { name: "memecoin_", type: "address", internalType: "address" },
10942
+ { name: "ethSpent_", type: "uint256", internalType: "uint256" },
10943
+ { name: "", type: "address", internalType: "address" },
10875
10944
  ],
10876
10945
  stateMutability: "payable",
10877
- type: "function",
10878
10946
  },
10879
10947
  {
10948
+ type: "function",
10949
+ name: "flaunch",
10880
10950
  inputs: [
10881
10951
  {
10952
+ name: "_flaunchParams",
10953
+ type: "tuple",
10954
+ internalType: "struct PositionManager.FlaunchParams",
10882
10955
  components: [
10883
- { internalType: "string", name: "name", type: "string" },
10884
- { internalType: "string", name: "symbol", type: "string" },
10885
- { internalType: "string", name: "tokenUri", type: "string" },
10956
+ { name: "name", type: "string", internalType: "string" },
10957
+ { name: "symbol", type: "string", internalType: "string" },
10958
+ { name: "tokenUri", type: "string", internalType: "string" },
10886
10959
  {
10887
- internalType: "uint256",
10888
10960
  name: "initialTokenFairLaunch",
10889
10961
  type: "uint256",
10962
+ internalType: "uint256",
10890
10963
  },
10891
10964
  {
10892
- internalType: "uint256",
10893
10965
  name: "fairLaunchDuration",
10894
10966
  type: "uint256",
10967
+ internalType: "uint256",
10895
10968
  },
10896
- { internalType: "uint256", name: "premineAmount", type: "uint256" },
10897
- { internalType: "address", name: "creator", type: "address" },
10898
10969
  {
10899
- internalType: "uint24",
10970
+ name: "premineAmount",
10971
+ type: "uint256",
10972
+ internalType: "uint256",
10973
+ },
10974
+ { name: "creator", type: "address", internalType: "address" },
10975
+ {
10900
10976
  name: "creatorFeeAllocation",
10901
10977
  type: "uint24",
10978
+ internalType: "uint24",
10979
+ },
10980
+ {
10981
+ name: "flaunchAt",
10982
+ type: "uint256",
10983
+ internalType: "uint256",
10984
+ },
10985
+ {
10986
+ name: "initialPriceParams",
10987
+ type: "bytes",
10988
+ internalType: "bytes",
10989
+ },
10990
+ {
10991
+ name: "feeCalculatorParams",
10992
+ type: "bytes",
10993
+ internalType: "bytes",
10902
10994
  },
10903
- { internalType: "uint256", name: "flaunchAt", type: "uint256" },
10904
- { internalType: "bytes", name: "initialPriceParams", type: "bytes" },
10905
- { internalType: "bytes", name: "feeCalculatorParams", type: "bytes" },
10906
10995
  ],
10907
- internalType: "struct PositionManager.FlaunchParams",
10908
- name: "_flaunchParams",
10909
- type: "tuple",
10910
10996
  },
10911
10997
  {
10912
- components: [
10913
- { internalType: "bytes32", name: "merkleRoot", type: "bytes32" },
10914
- { internalType: "string", name: "merkleIPFSHash", type: "string" },
10915
- { internalType: "uint256", name: "maxTokens", type: "uint256" },
10916
- ],
10917
- internalType: "struct FlaunchZap.WhitelistParams",
10918
10998
  name: "_whitelistParams",
10919
10999
  type: "tuple",
10920
- },
10921
- {
11000
+ internalType: "struct FlaunchZap.WhitelistParams",
10922
11001
  components: [
10923
- { internalType: "uint256", name: "airdropIndex", type: "uint256" },
10924
- { internalType: "uint256", name: "airdropAmount", type: "uint256" },
10925
- { internalType: "uint256", name: "airdropEndTime", type: "uint256" },
10926
- { internalType: "bytes32", name: "merkleRoot", type: "bytes32" },
10927
- { internalType: "string", name: "merkleIPFSHash", type: "string" },
11002
+ {
11003
+ name: "merkleRoot",
11004
+ type: "bytes32",
11005
+ internalType: "bytes32",
11006
+ },
11007
+ {
11008
+ name: "merkleIPFSHash",
11009
+ type: "string",
11010
+ internalType: "string",
11011
+ },
11012
+ {
11013
+ name: "maxTokens",
11014
+ type: "uint256",
11015
+ internalType: "uint256",
11016
+ },
10928
11017
  ],
10929
- internalType: "struct FlaunchZap.AirdropParams",
10930
- name: "_airdropParams",
10931
- type: "tuple",
10932
11018
  },
10933
11019
  {
11020
+ name: "_airdropParams",
11021
+ type: "tuple",
11022
+ internalType: "struct FlaunchZap.AirdropParams",
10934
11023
  components: [
10935
- { internalType: "address", name: "manager", type: "address" },
10936
- { internalType: "bytes", name: "initializeData", type: "bytes" },
10937
- { internalType: "bytes", name: "depositData", type: "bytes" },
11024
+ {
11025
+ name: "airdropIndex",
11026
+ type: "uint256",
11027
+ internalType: "uint256",
11028
+ },
11029
+ {
11030
+ name: "airdropAmount",
11031
+ type: "uint256",
11032
+ internalType: "uint256",
11033
+ },
11034
+ {
11035
+ name: "airdropEndTime",
11036
+ type: "uint256",
11037
+ internalType: "uint256",
11038
+ },
11039
+ {
11040
+ name: "merkleRoot",
11041
+ type: "bytes32",
11042
+ internalType: "bytes32",
11043
+ },
11044
+ {
11045
+ name: "merkleIPFSHash",
11046
+ type: "string",
11047
+ internalType: "string",
11048
+ },
10938
11049
  ],
10939
- internalType: "struct FlaunchZap.TreasuryManagerParams",
11050
+ },
11051
+ {
10940
11052
  name: "_treasuryManagerParams",
10941
11053
  type: "tuple",
11054
+ internalType: "struct FlaunchZap.TreasuryManagerParams",
11055
+ components: [
11056
+ { name: "manager", type: "address", internalType: "address" },
11057
+ {
11058
+ name: "permissions",
11059
+ type: "address",
11060
+ internalType: "address",
11061
+ },
11062
+ {
11063
+ name: "initializeData",
11064
+ type: "bytes",
11065
+ internalType: "bytes",
11066
+ },
11067
+ { name: "depositData", type: "bytes", internalType: "bytes" },
11068
+ ],
10942
11069
  },
10943
11070
  ],
10944
- name: "flaunch",
10945
11071
  outputs: [
10946
- { internalType: "address", name: "memecoin_", type: "address" },
10947
- { internalType: "uint256", name: "ethSpent_", type: "uint256" },
10948
- { internalType: "address", name: "deployedManager_", type: "address" },
11072
+ { name: "memecoin_", type: "address", internalType: "address" },
11073
+ { name: "ethSpent_", type: "uint256", internalType: "uint256" },
11074
+ {
11075
+ name: "deployedManager_",
11076
+ type: "address",
11077
+ internalType: "address",
11078
+ },
10949
11079
  ],
10950
11080
  stateMutability: "payable",
10951
- type: "function",
10952
11081
  },
10953
11082
  {
10954
- inputs: [],
11083
+ type: "function",
10955
11084
  name: "flaunchContract",
10956
- outputs: [{ internalType: "contract Flaunch", name: "", type: "address" }],
11085
+ inputs: [],
11086
+ outputs: [{ name: "", type: "address", internalType: "contract Flaunch" }],
10957
11087
  stateMutability: "view",
10958
- type: "function",
10959
11088
  },
10960
11089
  {
10961
- inputs: [],
11090
+ type: "function",
10962
11091
  name: "merkleAirdrop",
11092
+ inputs: [],
10963
11093
  outputs: [
10964
- { internalType: "contract IMerkleAirdrop", name: "", type: "address" },
11094
+ {
11095
+ name: "",
11096
+ type: "address",
11097
+ internalType: "contract IMerkleAirdrop",
11098
+ },
10965
11099
  ],
10966
11100
  stateMutability: "view",
10967
- type: "function",
10968
11101
  },
10969
11102
  {
10970
- inputs: [],
11103
+ type: "function",
10971
11104
  name: "poolSwap",
10972
- outputs: [{ internalType: "contract PoolSwap", name: "", type: "address" }],
11105
+ inputs: [],
11106
+ outputs: [{ name: "", type: "address", internalType: "contract PoolSwap" }],
10973
11107
  stateMutability: "view",
10974
- type: "function",
10975
11108
  },
10976
11109
  {
10977
- inputs: [],
11110
+ type: "function",
10978
11111
  name: "positionManager",
11112
+ inputs: [],
10979
11113
  outputs: [
10980
- { internalType: "contract PositionManager", name: "", type: "address" },
11114
+ {
11115
+ name: "",
11116
+ type: "address",
11117
+ internalType: "contract PositionManager",
11118
+ },
10981
11119
  ],
10982
11120
  stateMutability: "view",
10983
- type: "function",
10984
11121
  },
10985
11122
  {
10986
- inputs: [],
11123
+ type: "function",
10987
11124
  name: "treasuryManagerFactory",
11125
+ inputs: [],
10988
11126
  outputs: [
10989
11127
  {
10990
- internalType: "contract ITreasuryManagerFactory",
10991
11128
  name: "",
10992
11129
  type: "address",
11130
+ internalType: "contract ITreasuryManagerFactory",
10993
11131
  },
10994
11132
  ],
10995
11133
  stateMutability: "view",
10996
- type: "function",
10997
11134
  },
10998
11135
  {
10999
- inputs: [],
11136
+ type: "function",
11000
11137
  name: "whitelistFairLaunch",
11138
+ inputs: [],
11001
11139
  outputs: [
11002
11140
  {
11003
- internalType: "contract WhitelistFairLaunch",
11004
11141
  name: "",
11005
11142
  type: "address",
11143
+ internalType: "contract WhitelistFairLaunch",
11006
11144
  },
11007
11145
  ],
11008
11146
  stateMutability: "view",
11009
- type: "function",
11010
11147
  },
11011
- { stateMutability: "payable", type: "receive" },
11148
+ { type: "error", name: "CreatorCannotBeZero", inputs: [] },
11149
+ { type: "error", name: "InsufficientMemecoinsForAirdrop", inputs: [] },
11012
11150
  ];
11013
11151
 
11152
+ /**
11153
+ * Enumeration of Flaunch contract versions
11154
+ */
11155
+ var FlaunchVersion;
11156
+ (function (FlaunchVersion) {
11157
+ FlaunchVersion["V1"] = "V1";
11158
+ FlaunchVersion["V1_1"] = "V1_1";
11159
+ FlaunchVersion["V1_1_1"] = "V1_1_1";
11160
+ FlaunchVersion["ANY"] = "ANY";
11161
+ })(FlaunchVersion || (FlaunchVersion = {}));
11162
+ /**
11163
+ * Enumeration of Verifiers for TokenImporter
11164
+ */
11165
+ var Verifier;
11166
+ (function (Verifier) {
11167
+ Verifier["CLANKER"] = "clanker";
11168
+ Verifier["DOPPLER"] = "doppler";
11169
+ Verifier["VIRTUALS"] = "virtuals";
11170
+ Verifier["WHITELIST"] = "whitelist";
11171
+ Verifier["ZORA"] = "zora";
11172
+ })(Verifier || (Verifier = {}));
11173
+ /**
11174
+ * Enumeration of Permissions for TreasuryManagers. Defaults to OPEN.
11175
+ */
11176
+ var Permissions;
11177
+ (function (Permissions) {
11178
+ Permissions["OPEN"] = "open";
11179
+ Permissions["CLOSED"] = "closed";
11180
+ Permissions["WHITELISTED"] = "whitelisted";
11181
+ })(Permissions || (Permissions = {}));
11182
+
11183
+ /**
11184
+ * Maps a Permissions enum value to its corresponding contract address
11185
+ * @param permissions - The permissions enum value
11186
+ * @param chainId - The chain ID to get the address for
11187
+ * @returns The corresponding permissions contract address
11188
+ */
11189
+ function getPermissionsAddress(permissions, chainId) {
11190
+ switch (permissions) {
11191
+ case Permissions.CLOSED:
11192
+ return ClosedPermissionsAddress[chainId];
11193
+ case Permissions.WHITELISTED:
11194
+ return WhitelistedPermissionsAddress[chainId];
11195
+ case Permissions.OPEN:
11196
+ default:
11197
+ return zeroAddress;
11198
+ }
11199
+ }
11200
+
11014
11201
  const FlaunchPositionManagerV1_1Abi = [
11015
11202
  {
11016
11203
  inputs: [
@@ -12931,6 +13118,19 @@ class ReadWriteFlaunchZap extends ReadFlaunchZap {
12931
13118
  initialPriceParams,
12932
13119
  slippagePercent: 5,
12933
13120
  });
13121
+ const _treasuryManagerParams = params.treasuryManagerParams
13122
+ ? {
13123
+ manager: params.treasuryManagerParams.manager ?? zeroAddress,
13124
+ permissions: params.treasuryManagerParams.permissions ?? Permissions.OPEN,
13125
+ initializeData: params.treasuryManagerParams.initializeData ?? "0x",
13126
+ depositData: params.treasuryManagerParams.depositData ?? "0x",
13127
+ }
13128
+ : {
13129
+ manager: zeroAddress,
13130
+ permissions: Permissions.OPEN,
13131
+ initializeData: "0x",
13132
+ depositData: "0x",
13133
+ };
12934
13134
  return this.contract.write("flaunch", {
12935
13135
  _flaunchParams: {
12936
13136
  name: params.name,
@@ -12946,9 +13146,8 @@ class ReadWriteFlaunchZap extends ReadFlaunchZap {
12946
13146
  feeCalculatorParams: "0x",
12947
13147
  },
12948
13148
  _treasuryManagerParams: {
12949
- manager: zeroAddress,
12950
- initializeData: "0x",
12951
- depositData: "0x",
13149
+ ..._treasuryManagerParams,
13150
+ permissions: getPermissionsAddress(_treasuryManagerParams.permissions, this.chainId),
12952
13151
  },
12953
13152
  _whitelistParams: {
12954
13153
  merkleRoot: zeroHash,
@@ -13023,6 +13222,7 @@ class ReadWriteFlaunchZap extends ReadFlaunchZap {
13023
13222
  },
13024
13223
  _treasuryManagerParams: {
13025
13224
  manager: params.revenueManagerInstanceAddress,
13225
+ permissions: getPermissionsAddress(params.treasuryManagerParams?.permissions ?? Permissions.OPEN, this.chainId),
13026
13226
  initializeData: "0x",
13027
13227
  depositData: "0x",
13028
13228
  },
@@ -13140,6 +13340,7 @@ class ReadWriteFlaunchZap extends ReadFlaunchZap {
13140
13340
  },
13141
13341
  _treasuryManagerParams: {
13142
13342
  manager: AddressFeeSplitManagerAddress[this.chainId],
13343
+ permissions: getPermissionsAddress(params.treasuryManagerParams?.permissions ?? Permissions.OPEN, this.chainId),
13143
13344
  initializeData,
13144
13345
  depositData: "0x",
13145
13346
  },
@@ -17107,6 +17308,360 @@ class ReadWriteAnyPositionManager extends ReadAnyPositionManager {
17107
17308
  }
17108
17309
  }
17109
17310
 
17311
+ const TokenImporterAbi = [
17312
+ {
17313
+ type: "constructor",
17314
+ inputs: [
17315
+ {
17316
+ name: "_anyPositionManager",
17317
+ type: "address",
17318
+ internalType: "address payable",
17319
+ },
17320
+ ],
17321
+ stateMutability: "nonpayable",
17322
+ },
17323
+ {
17324
+ type: "function",
17325
+ name: "addVerifier",
17326
+ inputs: [{ name: "_verifier", type: "address", internalType: "address" }],
17327
+ outputs: [],
17328
+ stateMutability: "nonpayable",
17329
+ },
17330
+ {
17331
+ type: "function",
17332
+ name: "anyPositionManager",
17333
+ inputs: [],
17334
+ outputs: [
17335
+ {
17336
+ name: "",
17337
+ type: "address",
17338
+ internalType: "contract AnyPositionManager",
17339
+ },
17340
+ ],
17341
+ stateMutability: "view",
17342
+ },
17343
+ {
17344
+ type: "function",
17345
+ name: "cancelOwnershipHandover",
17346
+ inputs: [],
17347
+ outputs: [],
17348
+ stateMutability: "payable",
17349
+ },
17350
+ {
17351
+ type: "function",
17352
+ name: "completeOwnershipHandover",
17353
+ inputs: [
17354
+ { name: "pendingOwner", type: "address", internalType: "address" },
17355
+ ],
17356
+ outputs: [],
17357
+ stateMutability: "payable",
17358
+ },
17359
+ {
17360
+ type: "function",
17361
+ name: "getAllVerifiers",
17362
+ inputs: [],
17363
+ outputs: [
17364
+ {
17365
+ name: "verifiers_",
17366
+ type: "address[]",
17367
+ internalType: "address[]",
17368
+ },
17369
+ ],
17370
+ stateMutability: "view",
17371
+ },
17372
+ {
17373
+ type: "function",
17374
+ name: "initialize",
17375
+ inputs: [
17376
+ { name: "_memecoin", type: "address", internalType: "address" },
17377
+ {
17378
+ name: "_creatorFeeAllocation",
17379
+ type: "uint24",
17380
+ internalType: "uint24",
17381
+ },
17382
+ {
17383
+ name: "_initialMarketCap",
17384
+ type: "uint256",
17385
+ internalType: "uint256",
17386
+ },
17387
+ { name: "_verifier", type: "address", internalType: "address" },
17388
+ ],
17389
+ outputs: [],
17390
+ stateMutability: "nonpayable",
17391
+ },
17392
+ {
17393
+ type: "function",
17394
+ name: "initialize",
17395
+ inputs: [
17396
+ { name: "_memecoin", type: "address", internalType: "address" },
17397
+ {
17398
+ name: "_creatorFeeAllocation",
17399
+ type: "uint24",
17400
+ internalType: "uint24",
17401
+ },
17402
+ {
17403
+ name: "_initialMarketCap",
17404
+ type: "uint256",
17405
+ internalType: "uint256",
17406
+ },
17407
+ ],
17408
+ outputs: [],
17409
+ stateMutability: "nonpayable",
17410
+ },
17411
+ {
17412
+ type: "function",
17413
+ name: "owner",
17414
+ inputs: [],
17415
+ outputs: [{ name: "result", type: "address", internalType: "address" }],
17416
+ stateMutability: "view",
17417
+ },
17418
+ {
17419
+ type: "function",
17420
+ name: "ownershipHandoverExpiresAt",
17421
+ inputs: [
17422
+ { name: "pendingOwner", type: "address", internalType: "address" },
17423
+ ],
17424
+ outputs: [{ name: "result", type: "uint256", internalType: "uint256" }],
17425
+ stateMutability: "view",
17426
+ },
17427
+ {
17428
+ type: "function",
17429
+ name: "removeVerifier",
17430
+ inputs: [{ name: "_verifier", type: "address", internalType: "address" }],
17431
+ outputs: [],
17432
+ stateMutability: "nonpayable",
17433
+ },
17434
+ {
17435
+ type: "function",
17436
+ name: "renounceOwnership",
17437
+ inputs: [],
17438
+ outputs: [],
17439
+ stateMutability: "payable",
17440
+ },
17441
+ {
17442
+ type: "function",
17443
+ name: "requestOwnershipHandover",
17444
+ inputs: [],
17445
+ outputs: [],
17446
+ stateMutability: "payable",
17447
+ },
17448
+ {
17449
+ type: "function",
17450
+ name: "setAnyPositionManager",
17451
+ inputs: [
17452
+ {
17453
+ name: "_anyPositionManager",
17454
+ type: "address",
17455
+ internalType: "address payable",
17456
+ },
17457
+ ],
17458
+ outputs: [],
17459
+ stateMutability: "nonpayable",
17460
+ },
17461
+ {
17462
+ type: "function",
17463
+ name: "transferOwnership",
17464
+ inputs: [{ name: "newOwner", type: "address", internalType: "address" }],
17465
+ outputs: [],
17466
+ stateMutability: "payable",
17467
+ },
17468
+ {
17469
+ type: "function",
17470
+ name: "verifyMemecoin",
17471
+ inputs: [{ name: "_memecoin", type: "address", internalType: "address" }],
17472
+ outputs: [{ name: "verifier_", type: "address", internalType: "address" }],
17473
+ stateMutability: "view",
17474
+ },
17475
+ {
17476
+ type: "event",
17477
+ name: "AnyPositionManagerSet",
17478
+ inputs: [
17479
+ {
17480
+ name: "_anyPositionManager",
17481
+ type: "address",
17482
+ indexed: true,
17483
+ internalType: "address",
17484
+ },
17485
+ ],
17486
+ anonymous: false,
17487
+ },
17488
+ {
17489
+ type: "event",
17490
+ name: "OwnershipHandoverCanceled",
17491
+ inputs: [
17492
+ {
17493
+ name: "pendingOwner",
17494
+ type: "address",
17495
+ indexed: true,
17496
+ internalType: "address",
17497
+ },
17498
+ ],
17499
+ anonymous: false,
17500
+ },
17501
+ {
17502
+ type: "event",
17503
+ name: "OwnershipHandoverRequested",
17504
+ inputs: [
17505
+ {
17506
+ name: "pendingOwner",
17507
+ type: "address",
17508
+ indexed: true,
17509
+ internalType: "address",
17510
+ },
17511
+ ],
17512
+ anonymous: false,
17513
+ },
17514
+ {
17515
+ type: "event",
17516
+ name: "OwnershipTransferred",
17517
+ inputs: [
17518
+ {
17519
+ name: "oldOwner",
17520
+ type: "address",
17521
+ indexed: true,
17522
+ internalType: "address",
17523
+ },
17524
+ {
17525
+ name: "newOwner",
17526
+ type: "address",
17527
+ indexed: true,
17528
+ internalType: "address",
17529
+ },
17530
+ ],
17531
+ anonymous: false,
17532
+ },
17533
+ {
17534
+ type: "event",
17535
+ name: "TokenImported",
17536
+ inputs: [
17537
+ {
17538
+ name: "_memecoin",
17539
+ type: "address",
17540
+ indexed: true,
17541
+ internalType: "address",
17542
+ },
17543
+ {
17544
+ name: "_verifier",
17545
+ type: "address",
17546
+ indexed: true,
17547
+ internalType: "address",
17548
+ },
17549
+ ],
17550
+ anonymous: false,
17551
+ },
17552
+ {
17553
+ type: "event",
17554
+ name: "VerifierAdded",
17555
+ inputs: [
17556
+ {
17557
+ name: "_verifier",
17558
+ type: "address",
17559
+ indexed: true,
17560
+ internalType: "address",
17561
+ },
17562
+ ],
17563
+ anonymous: false,
17564
+ },
17565
+ {
17566
+ type: "event",
17567
+ name: "VerifierRemoved",
17568
+ inputs: [
17569
+ {
17570
+ name: "_verifier",
17571
+ type: "address",
17572
+ indexed: true,
17573
+ internalType: "address",
17574
+ },
17575
+ ],
17576
+ anonymous: false,
17577
+ },
17578
+ { type: "error", name: "AlreadyInitialized", inputs: [] },
17579
+ { type: "error", name: "InvalidMemecoin", inputs: [] },
17580
+ { type: "error", name: "NewOwnerIsZeroAddress", inputs: [] },
17581
+ { type: "error", name: "NoHandoverRequest", inputs: [] },
17582
+ { type: "error", name: "Unauthorized", inputs: [] },
17583
+ { type: "error", name: "VerifierAlreadyAdded", inputs: [] },
17584
+ { type: "error", name: "VerifierNotAdded", inputs: [] },
17585
+ { type: "error", name: "ZeroAddress", inputs: [] },
17586
+ ];
17587
+
17588
+ /**
17589
+ * Base client for interacting with the TokenImporter contract in read-only mode
17590
+ * Provides basic contract initialization
17591
+ */
17592
+ class ReadTokenImporter {
17593
+ constructor(chainId, address, drift = createDrift$1()) {
17594
+ this.chainId = chainId;
17595
+ this.drift = drift;
17596
+ this.contract = drift.contract({
17597
+ abi: TokenImporterAbi,
17598
+ address,
17599
+ });
17600
+ }
17601
+ /**
17602
+ * Verifies if a memecoin is valid for importing
17603
+ * @param memecoin - The address of the memecoin to import
17604
+ * @returns Promise<{ isValid: boolean; verifier: Address }> - The result of the verification
17605
+ */
17606
+ async verifyMemecoin(memecoin) {
17607
+ const verifier = await this.contract.read("verifyMemecoin", {
17608
+ _memecoin: memecoin,
17609
+ });
17610
+ return {
17611
+ isValid: verifier !== zeroAddress,
17612
+ verifier,
17613
+ };
17614
+ }
17615
+ /**
17616
+ * Returns the address of a verifier
17617
+ */
17618
+ verifierAddress(verifier) {
17619
+ switch (verifier) {
17620
+ case Verifier.CLANKER:
17621
+ return ClankerWorldVerifierAddress[this.chainId];
17622
+ case Verifier.DOPPLER:
17623
+ return DopplerVerifierAddress[this.chainId];
17624
+ case Verifier.VIRTUALS:
17625
+ return VirtualsVerifierAddress[this.chainId];
17626
+ case Verifier.WHITELIST:
17627
+ return WhitelistVerifierAddress[this.chainId];
17628
+ case Verifier.ZORA:
17629
+ return ZoraVerifierAddress[this.chainId];
17630
+ default:
17631
+ throw new Error(`Unknown verifier: ${verifier}`);
17632
+ }
17633
+ }
17634
+ }
17635
+ /**
17636
+ * Extended client for interacting with the TokenImporter contract with write capabilities
17637
+ */
17638
+ class ReadWriteTokenImporter extends ReadTokenImporter {
17639
+ constructor(chainId, address, drift = createDrift$1()) {
17640
+ super(chainId, address, drift);
17641
+ }
17642
+ initialize({ memecoin, creatorFeeAllocationPercent, initialMarketCapUSD, verifier, }) {
17643
+ const initialMCapInUSDCWei = parseUnits(initialMarketCapUSD.toString(), 6);
17644
+ const creatorFeeAllocationInBps = creatorFeeAllocationPercent * 100;
17645
+ // if the verifier is known then use that to save on gas
17646
+ if (verifier) {
17647
+ const verifierAddress = this.verifierAddress(verifier);
17648
+ return this.contract.write("initialize", {
17649
+ _memecoin: memecoin,
17650
+ _creatorFeeAllocation: creatorFeeAllocationInBps,
17651
+ _initialMarketCap: initialMCapInUSDCWei,
17652
+ _verifier: verifierAddress,
17653
+ });
17654
+ }
17655
+ else {
17656
+ return this.contract.write("initialize", {
17657
+ _memecoin: memecoin,
17658
+ _creatorFeeAllocation: creatorFeeAllocationInBps,
17659
+ _initialMarketCap: initialMCapInUSDCWei,
17660
+ });
17661
+ }
17662
+ }
17663
+ }
17664
+
17110
17665
  const FeeEscrowAbi = [
17111
17666
  {
17112
17667
  inputs: [
@@ -19442,388 +19997,446 @@ class ReadFlaunchV1_1 {
19442
19997
 
19443
19998
  const TreasuryManagerFactoryAbi = [
19444
19999
  {
19445
- inputs: [
19446
- { internalType: "address", name: "_protocolOwner", type: "address" },
19447
- { internalType: "address", name: "_feeEscrow", type: "address" },
19448
- ],
19449
- stateMutability: "nonpayable",
19450
20000
  type: "constructor",
19451
- },
19452
- { inputs: [], name: "AccessControlBadConfirmation", type: "error" },
19453
- {
19454
- inputs: [
19455
- { internalType: "address", name: "account", type: "address" },
19456
- { internalType: "bytes32", name: "neededRole", type: "bytes32" },
19457
- ],
19458
- name: "AccessControlUnauthorizedAccount",
19459
- type: "error",
19460
- },
19461
- { inputs: [], name: "AlreadyInitialized", type: "error" },
19462
- { inputs: [], name: "NewOwnerIsZeroAddress", type: "error" },
19463
- { inputs: [], name: "NoHandoverRequest", type: "error" },
19464
- { inputs: [], name: "Unauthorized", type: "error" },
19465
- { inputs: [], name: "UnknownManagerImplemention", type: "error" },
19466
- {
19467
- anonymous: false,
19468
20001
  inputs: [
19469
20002
  {
19470
- indexed: true,
19471
- internalType: "address",
19472
- name: "_manager",
20003
+ name: "_protocolOwner",
19473
20004
  type: "address",
19474
- },
19475
- {
19476
- indexed: true,
19477
20005
  internalType: "address",
19478
- name: "_managerImplementation",
19479
- type: "address",
19480
20006
  },
20007
+ { name: "_feeEscrow", type: "address", internalType: "address" },
19481
20008
  ],
19482
- name: "ManagerDeployed",
19483
- type: "event",
20009
+ stateMutability: "nonpayable",
19484
20010
  },
19485
20011
  {
19486
- anonymous: false,
19487
- inputs: [
19488
- {
19489
- indexed: true,
19490
- internalType: "address",
19491
- name: "_managerImplementation",
19492
- type: "address",
19493
- },
19494
- ],
19495
- name: "ManagerImplementationApproved",
19496
- type: "event",
20012
+ type: "function",
20013
+ name: "DEFAULT_ADMIN_ROLE",
20014
+ inputs: [],
20015
+ outputs: [{ name: "", type: "bytes32", internalType: "bytes32" }],
20016
+ stateMutability: "view",
19497
20017
  },
19498
20018
  {
19499
- anonymous: false,
20019
+ type: "function",
20020
+ name: "approveManager",
19500
20021
  inputs: [
19501
20022
  {
19502
- indexed: true,
19503
- internalType: "address",
19504
20023
  name: "_managerImplementation",
19505
20024
  type: "address",
19506
- },
19507
- ],
19508
- name: "ManagerImplementationUnapproved",
19509
- type: "event",
19510
- },
19511
- {
19512
- anonymous: false,
19513
- inputs: [
19514
- {
19515
- indexed: true,
19516
20025
  internalType: "address",
19517
- name: "pendingOwner",
19518
- type: "address",
19519
20026
  },
19520
20027
  ],
19521
- name: "OwnershipHandoverCanceled",
19522
- type: "event",
20028
+ outputs: [],
20029
+ stateMutability: "nonpayable",
19523
20030
  },
19524
20031
  {
19525
- anonymous: false,
20032
+ type: "function",
20033
+ name: "approvedManagerImplementation",
19526
20034
  inputs: [
19527
20035
  {
19528
- indexed: true,
19529
- internalType: "address",
19530
- name: "pendingOwner",
20036
+ name: "_managerImplementation",
19531
20037
  type: "address",
19532
- },
19533
- ],
19534
- name: "OwnershipHandoverRequested",
19535
- type: "event",
19536
- },
19537
- {
19538
- anonymous: false,
19539
- inputs: [
19540
- {
19541
- indexed: true,
19542
20038
  internalType: "address",
19543
- name: "oldOwner",
19544
- type: "address",
19545
- },
19546
- {
19547
- indexed: true,
19548
- internalType: "address",
19549
- name: "newOwner",
19550
- type: "address",
19551
- },
19552
- ],
19553
- name: "OwnershipTransferred",
19554
- type: "event",
19555
- },
19556
- {
19557
- anonymous: false,
19558
- inputs: [
19559
- { indexed: true, internalType: "bytes32", name: "role", type: "bytes32" },
19560
- {
19561
- indexed: true,
19562
- internalType: "bytes32",
19563
- name: "previousAdminRole",
19564
- type: "bytes32",
19565
- },
19566
- {
19567
- indexed: true,
19568
- internalType: "bytes32",
19569
- name: "newAdminRole",
19570
- type: "bytes32",
19571
20039
  },
19572
20040
  ],
19573
- name: "RoleAdminChanged",
19574
- type: "event",
20041
+ outputs: [{ name: "_approved", type: "bool", internalType: "bool" }],
20042
+ stateMutability: "view",
19575
20043
  },
19576
20044
  {
19577
- anonymous: false,
19578
- inputs: [
19579
- { indexed: true, internalType: "bytes32", name: "role", type: "bytes32" },
19580
- {
19581
- indexed: true,
19582
- internalType: "address",
19583
- name: "account",
19584
- type: "address",
19585
- },
19586
- {
19587
- indexed: true,
19588
- internalType: "address",
19589
- name: "sender",
19590
- type: "address",
19591
- },
19592
- ],
19593
- name: "RoleGranted",
19594
- type: "event",
20045
+ type: "function",
20046
+ name: "cancelOwnershipHandover",
20047
+ inputs: [],
20048
+ outputs: [],
20049
+ stateMutability: "payable",
19595
20050
  },
19596
20051
  {
19597
- anonymous: false,
20052
+ type: "function",
20053
+ name: "completeOwnershipHandover",
19598
20054
  inputs: [
19599
- { indexed: true, internalType: "bytes32", name: "role", type: "bytes32" },
19600
- {
19601
- indexed: true,
19602
- internalType: "address",
19603
- name: "account",
19604
- type: "address",
19605
- },
19606
- {
19607
- indexed: true,
19608
- internalType: "address",
19609
- name: "sender",
19610
- type: "address",
19611
- },
20055
+ { name: "pendingOwner", type: "address", internalType: "address" },
19612
20056
  ],
19613
- name: "RoleRevoked",
19614
- type: "event",
20057
+ outputs: [],
20058
+ stateMutability: "payable",
19615
20059
  },
19616
20060
  {
19617
- inputs: [],
19618
- name: "DEFAULT_ADMIN_ROLE",
19619
- outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
19620
- stateMutability: "view",
19621
20061
  type: "function",
19622
- },
19623
- {
20062
+ name: "deployAndInitializeManager",
19624
20063
  inputs: [
19625
20064
  {
19626
- internalType: "address",
19627
20065
  name: "_managerImplementation",
19628
20066
  type: "address",
20067
+ internalType: "address",
19629
20068
  },
20069
+ { name: "_owner", type: "address", internalType: "address" },
20070
+ { name: "_data", type: "bytes", internalType: "bytes" },
19630
20071
  ],
19631
- name: "approveManager",
19632
- outputs: [],
19633
- stateMutability: "nonpayable",
19634
- type: "function",
19635
- },
19636
- {
19637
- inputs: [
20072
+ outputs: [
19638
20073
  {
19639
- internalType: "address",
19640
- name: "_managerImplementation",
20074
+ name: "manager_",
19641
20075
  type: "address",
20076
+ internalType: "address payable",
19642
20077
  },
19643
20078
  ],
19644
- name: "approvedManagerImplementation",
19645
- outputs: [{ internalType: "bool", name: "_approved", type: "bool" }],
19646
- stateMutability: "view",
19647
- type: "function",
20079
+ stateMutability: "nonpayable",
19648
20080
  },
19649
20081
  {
19650
- inputs: [],
19651
- name: "cancelOwnershipHandover",
19652
- outputs: [],
19653
- stateMutability: "payable",
19654
20082
  type: "function",
19655
- },
19656
- {
19657
- inputs: [
19658
- { internalType: "address", name: "pendingOwner", type: "address" },
19659
- ],
19660
- name: "completeOwnershipHandover",
19661
- outputs: [],
19662
- stateMutability: "payable",
19663
- type: "function",
19664
- },
19665
- {
20083
+ name: "deployAndInitializeManager",
19666
20084
  inputs: [
19667
20085
  {
19668
- internalType: "address",
19669
20086
  name: "_managerImplementation",
19670
20087
  type: "address",
20088
+ internalType: "address",
19671
20089
  },
19672
- { internalType: "address", name: "_owner", type: "address" },
19673
- { internalType: "bytes", name: "_data", type: "bytes" },
20090
+ { name: "_owner", type: "address", internalType: "address" },
20091
+ { name: "_data", type: "bytes", internalType: "bytes" },
20092
+ { name: "_permissions", type: "address", internalType: "address" },
19674
20093
  ],
19675
- name: "deployAndInitializeManager",
19676
20094
  outputs: [
19677
- { internalType: "address payable", name: "manager_", type: "address" },
20095
+ {
20096
+ name: "manager_",
20097
+ type: "address",
20098
+ internalType: "address payable",
20099
+ },
19678
20100
  ],
19679
20101
  stateMutability: "nonpayable",
19680
- type: "function",
19681
20102
  },
19682
20103
  {
20104
+ type: "function",
20105
+ name: "deployManager",
19683
20106
  inputs: [
19684
20107
  {
19685
- internalType: "address",
19686
20108
  name: "_managerImplementation",
19687
20109
  type: "address",
20110
+ internalType: "address",
19688
20111
  },
19689
20112
  ],
19690
- name: "deployManager",
19691
20113
  outputs: [
19692
- { internalType: "address payable", name: "manager_", type: "address" },
20114
+ {
20115
+ name: "manager_",
20116
+ type: "address",
20117
+ internalType: "address payable",
20118
+ },
19693
20119
  ],
19694
20120
  stateMutability: "nonpayable",
19695
- type: "function",
19696
20121
  },
19697
20122
  {
19698
- inputs: [],
20123
+ type: "function",
19699
20124
  name: "feeEscrow",
20125
+ inputs: [],
19700
20126
  outputs: [
19701
- { internalType: "contract IFeeEscrow", name: "", type: "address" },
20127
+ { name: "", type: "address", internalType: "contract IFeeEscrow" },
19702
20128
  ],
19703
20129
  stateMutability: "view",
19704
- type: "function",
19705
20130
  },
19706
20131
  {
19707
- inputs: [{ internalType: "bytes32", name: "role", type: "bytes32" }],
20132
+ type: "function",
19708
20133
  name: "getRoleAdmin",
19709
- outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
20134
+ inputs: [{ name: "role", type: "bytes32", internalType: "bytes32" }],
20135
+ outputs: [{ name: "", type: "bytes32", internalType: "bytes32" }],
19710
20136
  stateMutability: "view",
19711
- type: "function",
19712
20137
  },
19713
20138
  {
20139
+ type: "function",
20140
+ name: "grantRole",
19714
20141
  inputs: [
19715
- { internalType: "bytes32", name: "role", type: "bytes32" },
19716
- { internalType: "address", name: "account", type: "address" },
20142
+ { name: "role", type: "bytes32", internalType: "bytes32" },
20143
+ { name: "account", type: "address", internalType: "address" },
19717
20144
  ],
19718
- name: "grantRole",
19719
20145
  outputs: [],
19720
20146
  stateMutability: "nonpayable",
19721
- type: "function",
19722
20147
  },
19723
20148
  {
20149
+ type: "function",
20150
+ name: "hasRole",
19724
20151
  inputs: [
19725
- { internalType: "bytes32", name: "role", type: "bytes32" },
19726
- { internalType: "address", name: "account", type: "address" },
20152
+ { name: "role", type: "bytes32", internalType: "bytes32" },
20153
+ { name: "account", type: "address", internalType: "address" },
19727
20154
  ],
19728
- name: "hasRole",
19729
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
20155
+ outputs: [{ name: "", type: "bool", internalType: "bool" }],
19730
20156
  stateMutability: "view",
19731
- type: "function",
19732
20157
  },
19733
20158
  {
19734
- inputs: [{ internalType: "address", name: "_manager", type: "address" }],
20159
+ type: "function",
19735
20160
  name: "managerImplementation",
20161
+ inputs: [{ name: "_manager", type: "address", internalType: "address" }],
19736
20162
  outputs: [
19737
20163
  {
19738
- internalType: "address",
19739
20164
  name: "_managerImplementation",
19740
20165
  type: "address",
20166
+ internalType: "address",
19741
20167
  },
19742
20168
  ],
19743
20169
  stateMutability: "view",
19744
- type: "function",
19745
20170
  },
19746
20171
  {
19747
- inputs: [],
20172
+ type: "function",
19748
20173
  name: "owner",
19749
- outputs: [{ internalType: "address", name: "result", type: "address" }],
20174
+ inputs: [],
20175
+ outputs: [{ name: "result", type: "address", internalType: "address" }],
19750
20176
  stateMutability: "view",
19751
- type: "function",
19752
20177
  },
19753
20178
  {
20179
+ type: "function",
20180
+ name: "ownershipHandoverExpiresAt",
19754
20181
  inputs: [
19755
- { internalType: "address", name: "pendingOwner", type: "address" },
20182
+ { name: "pendingOwner", type: "address", internalType: "address" },
19756
20183
  ],
19757
- name: "ownershipHandoverExpiresAt",
19758
- outputs: [{ internalType: "uint256", name: "result", type: "uint256" }],
20184
+ outputs: [{ name: "result", type: "uint256", internalType: "uint256" }],
19759
20185
  stateMutability: "view",
19760
- type: "function",
19761
20186
  },
19762
20187
  {
19763
- inputs: [],
20188
+ type: "function",
19764
20189
  name: "renounceOwnership",
20190
+ inputs: [],
19765
20191
  outputs: [],
19766
20192
  stateMutability: "payable",
19767
- type: "function",
19768
20193
  },
19769
20194
  {
20195
+ type: "function",
20196
+ name: "renounceRole",
19770
20197
  inputs: [
19771
- { internalType: "bytes32", name: "role", type: "bytes32" },
19772
- { internalType: "address", name: "callerConfirmation", type: "address" },
20198
+ { name: "role", type: "bytes32", internalType: "bytes32" },
20199
+ {
20200
+ name: "callerConfirmation",
20201
+ type: "address",
20202
+ internalType: "address",
20203
+ },
19773
20204
  ],
19774
- name: "renounceRole",
19775
20205
  outputs: [],
19776
20206
  stateMutability: "nonpayable",
19777
- type: "function",
19778
20207
  },
19779
20208
  {
19780
- inputs: [],
20209
+ type: "function",
19781
20210
  name: "requestOwnershipHandover",
20211
+ inputs: [],
19782
20212
  outputs: [],
19783
20213
  stateMutability: "payable",
19784
- type: "function",
19785
20214
  },
19786
20215
  {
20216
+ type: "function",
20217
+ name: "revokeRole",
19787
20218
  inputs: [
19788
- { internalType: "bytes32", name: "role", type: "bytes32" },
19789
- { internalType: "address", name: "account", type: "address" },
20219
+ { name: "role", type: "bytes32", internalType: "bytes32" },
20220
+ { name: "account", type: "address", internalType: "address" },
19790
20221
  ],
19791
- name: "revokeRole",
19792
20222
  outputs: [],
19793
20223
  stateMutability: "nonpayable",
19794
- type: "function",
19795
20224
  },
19796
20225
  {
19797
- inputs: [{ internalType: "bytes4", name: "interfaceId", type: "bytes4" }],
20226
+ type: "function",
19798
20227
  name: "supportsInterface",
19799
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
20228
+ inputs: [{ name: "interfaceId", type: "bytes4", internalType: "bytes4" }],
20229
+ outputs: [{ name: "", type: "bool", internalType: "bool" }],
19800
20230
  stateMutability: "view",
19801
- type: "function",
19802
20231
  },
19803
20232
  {
19804
- inputs: [{ internalType: "address", name: "newOwner", type: "address" }],
20233
+ type: "function",
19805
20234
  name: "transferOwnership",
20235
+ inputs: [{ name: "newOwner", type: "address", internalType: "address" }],
19806
20236
  outputs: [],
19807
20237
  stateMutability: "payable",
19808
- type: "function",
19809
20238
  },
19810
20239
  {
20240
+ type: "function",
20241
+ name: "unapproveManager",
19811
20242
  inputs: [
19812
20243
  {
19813
- internalType: "address",
19814
20244
  name: "_managerImplementation",
19815
20245
  type: "address",
20246
+ internalType: "address",
19816
20247
  },
19817
20248
  ],
19818
- name: "unapproveManager",
19819
20249
  outputs: [],
19820
20250
  stateMutability: "nonpayable",
19821
- type: "function",
19822
20251
  },
20252
+ {
20253
+ type: "event",
20254
+ name: "ManagerDeployed",
20255
+ inputs: [
20256
+ {
20257
+ name: "_manager",
20258
+ type: "address",
20259
+ indexed: true,
20260
+ internalType: "address",
20261
+ },
20262
+ {
20263
+ name: "_managerImplementation",
20264
+ type: "address",
20265
+ indexed: true,
20266
+ internalType: "address",
20267
+ },
20268
+ ],
20269
+ anonymous: false,
20270
+ },
20271
+ {
20272
+ type: "event",
20273
+ name: "ManagerImplementationApproved",
20274
+ inputs: [
20275
+ {
20276
+ name: "_managerImplementation",
20277
+ type: "address",
20278
+ indexed: true,
20279
+ internalType: "address",
20280
+ },
20281
+ ],
20282
+ anonymous: false,
20283
+ },
20284
+ {
20285
+ type: "event",
20286
+ name: "ManagerImplementationUnapproved",
20287
+ inputs: [
20288
+ {
20289
+ name: "_managerImplementation",
20290
+ type: "address",
20291
+ indexed: true,
20292
+ internalType: "address",
20293
+ },
20294
+ ],
20295
+ anonymous: false,
20296
+ },
20297
+ {
20298
+ type: "event",
20299
+ name: "OwnershipHandoverCanceled",
20300
+ inputs: [
20301
+ {
20302
+ name: "pendingOwner",
20303
+ type: "address",
20304
+ indexed: true,
20305
+ internalType: "address",
20306
+ },
20307
+ ],
20308
+ anonymous: false,
20309
+ },
20310
+ {
20311
+ type: "event",
20312
+ name: "OwnershipHandoverRequested",
20313
+ inputs: [
20314
+ {
20315
+ name: "pendingOwner",
20316
+ type: "address",
20317
+ indexed: true,
20318
+ internalType: "address",
20319
+ },
20320
+ ],
20321
+ anonymous: false,
20322
+ },
20323
+ {
20324
+ type: "event",
20325
+ name: "OwnershipTransferred",
20326
+ inputs: [
20327
+ {
20328
+ name: "oldOwner",
20329
+ type: "address",
20330
+ indexed: true,
20331
+ internalType: "address",
20332
+ },
20333
+ {
20334
+ name: "newOwner",
20335
+ type: "address",
20336
+ indexed: true,
20337
+ internalType: "address",
20338
+ },
20339
+ ],
20340
+ anonymous: false,
20341
+ },
20342
+ {
20343
+ type: "event",
20344
+ name: "RoleAdminChanged",
20345
+ inputs: [
20346
+ {
20347
+ name: "role",
20348
+ type: "bytes32",
20349
+ indexed: true,
20350
+ internalType: "bytes32",
20351
+ },
20352
+ {
20353
+ name: "previousAdminRole",
20354
+ type: "bytes32",
20355
+ indexed: true,
20356
+ internalType: "bytes32",
20357
+ },
20358
+ {
20359
+ name: "newAdminRole",
20360
+ type: "bytes32",
20361
+ indexed: true,
20362
+ internalType: "bytes32",
20363
+ },
20364
+ ],
20365
+ anonymous: false,
20366
+ },
20367
+ {
20368
+ type: "event",
20369
+ name: "RoleGranted",
20370
+ inputs: [
20371
+ {
20372
+ name: "role",
20373
+ type: "bytes32",
20374
+ indexed: true,
20375
+ internalType: "bytes32",
20376
+ },
20377
+ {
20378
+ name: "account",
20379
+ type: "address",
20380
+ indexed: true,
20381
+ internalType: "address",
20382
+ },
20383
+ {
20384
+ name: "sender",
20385
+ type: "address",
20386
+ indexed: true,
20387
+ internalType: "address",
20388
+ },
20389
+ ],
20390
+ anonymous: false,
20391
+ },
20392
+ {
20393
+ type: "event",
20394
+ name: "RoleRevoked",
20395
+ inputs: [
20396
+ {
20397
+ name: "role",
20398
+ type: "bytes32",
20399
+ indexed: true,
20400
+ internalType: "bytes32",
20401
+ },
20402
+ {
20403
+ name: "account",
20404
+ type: "address",
20405
+ indexed: true,
20406
+ internalType: "address",
20407
+ },
20408
+ {
20409
+ name: "sender",
20410
+ type: "address",
20411
+ indexed: true,
20412
+ internalType: "address",
20413
+ },
20414
+ ],
20415
+ anonymous: false,
20416
+ },
20417
+ { type: "error", name: "AccessControlBadConfirmation", inputs: [] },
20418
+ {
20419
+ type: "error",
20420
+ name: "AccessControlUnauthorizedAccount",
20421
+ inputs: [
20422
+ { name: "account", type: "address", internalType: "address" },
20423
+ { name: "neededRole", type: "bytes32", internalType: "bytes32" },
20424
+ ],
20425
+ },
20426
+ { type: "error", name: "AlreadyInitialized", inputs: [] },
20427
+ { type: "error", name: "NewOwnerIsZeroAddress", inputs: [] },
20428
+ { type: "error", name: "NoHandoverRequest", inputs: [] },
20429
+ { type: "error", name: "Unauthorized", inputs: [] },
20430
+ { type: "error", name: "UnknownManagerImplemention", inputs: [] },
19823
20431
  ];
19824
20432
 
20433
+ const chainIdToChain = {
20434
+ [base.id]: base,
20435
+ [baseSepolia.id]: baseSepolia,
20436
+ };
20437
+
19825
20438
  class ReadTreasuryManagerFactory {
19826
- constructor(address, drift = createDrift$1()) {
20439
+ constructor(chainId, address, drift = createDrift$1()) {
19827
20440
  if (!address) {
19828
20441
  throw new Error("Address is required");
19829
20442
  }
@@ -19831,21 +20444,46 @@ class ReadTreasuryManagerFactory {
19831
20444
  abi: TreasuryManagerFactoryAbi,
19832
20445
  address,
19833
20446
  });
20447
+ this.chainId = chainId;
20448
+ }
20449
+ async getManagerDeployedAddressFromTx(hash) {
20450
+ // Create a public client to get the transaction receipt with logs
20451
+ const publicClient = createPublicClient({
20452
+ chain: chainIdToChain[this.chainId],
20453
+ transport: http(),
20454
+ });
20455
+ // Wait for transaction receipt
20456
+ const receipt = await publicClient.waitForTransactionReceipt({ hash });
20457
+ // Get the logs from the receipt and find the ManagerDeployed event
20458
+ const events = await publicClient.getContractEvents({
20459
+ address: this.contract.address,
20460
+ abi: TreasuryManagerFactoryAbi,
20461
+ eventName: "ManagerDeployed",
20462
+ fromBlock: receipt.blockNumber,
20463
+ toBlock: receipt.blockNumber,
20464
+ });
20465
+ // Find the event from our transaction
20466
+ const event = events.find((e) => e.transactionHash === hash);
20467
+ if (!event) {
20468
+ throw new Error("ManagerDeployed event not found in transaction logs");
20469
+ }
20470
+ return event.args._manager;
19834
20471
  }
19835
20472
  }
19836
20473
  class ReadWriteTreasuryManagerFactory extends ReadTreasuryManagerFactory {
19837
20474
  constructor(chainId, address, drift = createDrift$1()) {
19838
- super(address, drift);
19839
- this.chainId = chainId;
20475
+ super(chainId, address, drift);
19840
20476
  }
19841
20477
  /**
19842
20478
  * Deploys a new revenue manager
19843
20479
  * @param params - Parameters for deploying the revenue manager
19844
20480
  * @param params.protocolRecipient - The address of the protocol recipient
19845
20481
  * @param params.protocolFeePercent - The percentage of the protocol fee
20482
+ * @param params.permissions - The permissions for the revenue manager
19846
20483
  * @returns Transaction response
19847
20484
  */
19848
20485
  deployRevenueManager(params) {
20486
+ const permissionsAddress = getPermissionsAddress(params.permissions ?? Permissions.OPEN, this.chainId);
19849
20487
  return this.contract.write("deployAndInitializeManager", {
19850
20488
  _managerImplementation: RevenueManagerAddress[this.chainId],
19851
20489
  _owner: params.protocolRecipient,
@@ -19863,6 +20501,48 @@ class ReadWriteTreasuryManagerFactory extends ReadTreasuryManagerFactory {
19863
20501
  protocolFee: BigInt(params.protocolFeePercent * 100), // Convert percentage to basis points
19864
20502
  },
19865
20503
  ]),
20504
+ _permissions: permissionsAddress,
20505
+ });
20506
+ }
20507
+ /**
20508
+ * Deploys a new staking manager
20509
+ * @param params - Parameters for deploying the staking manager
20510
+ * @param params.managerOwner - The address of the manager owner
20511
+ * @param params.stakingToken - The address of the token to be staked
20512
+ * @param params.minEscrowDuration - The minimum duration (in seconds) that the creator's NFT is locked for
20513
+ * @param params.minStakeDuration - The minimum duration (in seconds) that the user's tokens are locked for
20514
+ * @param params.creatorSharePercent - The % share that a creator will earn from their token
20515
+ * @param params.ownerSharePercent - The % share that the manager owner will earn from their token
20516
+ * @param params.permissions - The permissions for the staking manager
20517
+ * @returns Transaction response
20518
+ */
20519
+ deployStakingManager(params) {
20520
+ const permissionsAddress = getPermissionsAddress(params.permissions ?? Permissions.OPEN, this.chainId);
20521
+ const VALID_SHARE_TOTAL = 10000000n; // 5 decimals as BigInt
20522
+ return this.contract.write("deployAndInitializeManager", {
20523
+ _managerImplementation: StakingManagerAddress[this.chainId],
20524
+ _owner: params.managerOwner,
20525
+ _data: encodeAbiParameters([
20526
+ {
20527
+ type: "tuple",
20528
+ components: [
20529
+ { type: "address", name: "stakingToken" },
20530
+ { type: "uint256", name: "minEscrowDuration" },
20531
+ { type: "uint256", name: "minStakeDuration" },
20532
+ { type: "uint256", name: "creatorShare" },
20533
+ { type: "uint256", name: "ownerShare" },
20534
+ ],
20535
+ },
20536
+ ], [
20537
+ {
20538
+ stakingToken: params.stakingToken,
20539
+ minEscrowDuration: params.minEscrowDuration,
20540
+ minStakeDuration: params.minStakeDuration,
20541
+ creatorShare: (BigInt(params.creatorSharePercent) * VALID_SHARE_TOTAL) / 100n,
20542
+ ownerShare: (BigInt(params.ownerSharePercent) * VALID_SHARE_TOTAL) / 100n,
20543
+ },
20544
+ ]),
20545
+ _permissions: permissionsAddress,
19866
20546
  });
19867
20547
  }
19868
20548
  }
@@ -21000,16 +21680,184 @@ class ReadWriteRevenueManager extends ReadRevenueManager {
21000
21680
  }
21001
21681
  }
21002
21682
 
21683
+ const TreasuryManagerAbi = [
21684
+ {
21685
+ type: "function",
21686
+ name: "deposit",
21687
+ inputs: [
21688
+ {
21689
+ name: "_flaunchToken",
21690
+ type: "tuple",
21691
+ internalType: "struct ITreasuryManager.FlaunchToken",
21692
+ components: [
21693
+ {
21694
+ name: "flaunch",
21695
+ type: "address",
21696
+ internalType: "contract Flaunch",
21697
+ },
21698
+ { name: "tokenId", type: "uint256", internalType: "uint256" },
21699
+ ],
21700
+ },
21701
+ { name: "_creator", type: "address", internalType: "address" },
21702
+ { name: "_data", type: "bytes", internalType: "bytes" },
21703
+ ],
21704
+ outputs: [],
21705
+ stateMutability: "nonpayable",
21706
+ },
21707
+ {
21708
+ type: "function",
21709
+ name: "initialize",
21710
+ inputs: [
21711
+ { name: "_owner", type: "address", internalType: "address" },
21712
+ { name: "_data", type: "bytes", internalType: "bytes" },
21713
+ ],
21714
+ outputs: [],
21715
+ stateMutability: "nonpayable",
21716
+ },
21717
+ {
21718
+ type: "function",
21719
+ name: "managerOwner",
21720
+ inputs: [],
21721
+ outputs: [{ name: "", type: "address", internalType: "address" }],
21722
+ stateMutability: "view",
21723
+ },
21724
+ {
21725
+ type: "function",
21726
+ name: "permissions",
21727
+ inputs: [],
21728
+ outputs: [
21729
+ {
21730
+ name: "",
21731
+ type: "address",
21732
+ internalType: "contract IManagerPermissions",
21733
+ },
21734
+ ],
21735
+ stateMutability: "view",
21736
+ },
21737
+ {
21738
+ type: "function",
21739
+ name: "rescue",
21740
+ inputs: [
21741
+ {
21742
+ name: "_flaunchToken",
21743
+ type: "tuple",
21744
+ internalType: "struct ITreasuryManager.FlaunchToken",
21745
+ components: [
21746
+ {
21747
+ name: "flaunch",
21748
+ type: "address",
21749
+ internalType: "contract Flaunch",
21750
+ },
21751
+ { name: "tokenId", type: "uint256", internalType: "uint256" },
21752
+ ],
21753
+ },
21754
+ { name: "_recipient", type: "address", internalType: "address" },
21755
+ ],
21756
+ outputs: [],
21757
+ stateMutability: "nonpayable",
21758
+ },
21759
+ {
21760
+ type: "function",
21761
+ name: "setPermissions",
21762
+ inputs: [
21763
+ { name: "_permissions", type: "address", internalType: "address" },
21764
+ ],
21765
+ outputs: [],
21766
+ stateMutability: "nonpayable",
21767
+ },
21768
+ {
21769
+ type: "function",
21770
+ name: "transferManagerOwnership",
21771
+ inputs: [
21772
+ {
21773
+ name: "_newManagerOwner",
21774
+ type: "address",
21775
+ internalType: "address",
21776
+ },
21777
+ ],
21778
+ outputs: [],
21779
+ stateMutability: "nonpayable",
21780
+ },
21781
+ ];
21782
+
21003
21783
  /**
21004
- * Enumeration of Flaunch contract versions
21784
+ * Client for interacting with the TreasuryManager contract in read-only mode
21785
+ * Provides methods to query permissions and manager owner
21005
21786
  */
21006
- var FlaunchVersion;
21007
- (function (FlaunchVersion) {
21008
- FlaunchVersion["V1"] = "V1";
21009
- FlaunchVersion["V1_1"] = "V1_1";
21010
- FlaunchVersion["V1_1_1"] = "V1_1_1";
21011
- FlaunchVersion["ANY"] = "ANY";
21012
- })(FlaunchVersion || (FlaunchVersion = {}));
21787
+ class ReadTreasuryManager {
21788
+ /**
21789
+ * Creates a new ReadTreasuryManager instance
21790
+ * @param address - The address of the TreasuryManager contract
21791
+ * @param drift - Optional drift instance for contract interactions (creates new instance if not provided)
21792
+ * @throws Error if address is not provided
21793
+ */
21794
+ constructor(address, drift = createDrift$1()) {
21795
+ if (!address) {
21796
+ throw new Error("Address is required");
21797
+ }
21798
+ this.contract = drift.contract({
21799
+ abi: TreasuryManagerAbi,
21800
+ address,
21801
+ });
21802
+ }
21803
+ /**
21804
+ * Gets the permissions contract address
21805
+ * @returns Promise<Address> - The address of the permissions contract
21806
+ */
21807
+ permissions() {
21808
+ return this.contract.read("permissions");
21809
+ }
21810
+ /**
21811
+ * Gets the manager owner address
21812
+ * @returns Promise<Address> - The address of the manager owner
21813
+ */
21814
+ managerOwner() {
21815
+ return this.contract.read("managerOwner");
21816
+ }
21817
+ }
21818
+ /**
21819
+ * Extended client for interacting with the TreasuryManager contract with write capabilities
21820
+ * Provides methods to deposit tokens, set permissions, and transfer ownership
21821
+ */
21822
+ class ReadWriteTreasuryManager extends ReadTreasuryManager {
21823
+ constructor(address, drift = createDrift$1()) {
21824
+ super(address, drift);
21825
+ }
21826
+ /**
21827
+ * Deposits a flaunch token to the treasury
21828
+ * @param flaunchToken - The flaunch token to deposit
21829
+ * @param creator - The address of the creator
21830
+ * @param data - Additional data for the deposit
21831
+ * @returns Promise<void>
21832
+ */
21833
+ deposit(flaunchToken, creator, data) {
21834
+ return this.contract.write("deposit", {
21835
+ _flaunchToken: flaunchToken,
21836
+ _creator: creator,
21837
+ _data: data,
21838
+ });
21839
+ }
21840
+ /**
21841
+ * Sets the permissions contract address
21842
+ * @param permissions - The address of the new permissions contract
21843
+ * @returns Promise<void>
21844
+ */
21845
+ setPermissions(permissions) {
21846
+ return this.contract.write("setPermissions", {
21847
+ _permissions: permissions,
21848
+ });
21849
+ }
21850
+ /**
21851
+ * Transfers the manager ownership to a new address
21852
+ * @param newManagerOwner - The address of the new manager owner
21853
+ * @returns Promise<void>
21854
+ */
21855
+ transferManagerOwnership(newManagerOwner) {
21856
+ return this.contract.write("transferManagerOwnership", {
21857
+ _newManagerOwner: newManagerOwner,
21858
+ });
21859
+ }
21860
+ }
21013
21861
 
21014
21862
  // our min/max tick range that is valid for the tick spacing (60)
21015
21863
  const TickFinder = {
@@ -21102,11 +21950,6 @@ const calculateUnderlyingTokenBalances = (liquidity, tickLower, tickUpper, tickC
21102
21950
  return { amount0, amount1 };
21103
21951
  };
21104
21952
 
21105
- const chainIdToChain = {
21106
- [base.id]: base,
21107
- [baseSepolia.id]: baseSepolia,
21108
- };
21109
-
21110
21953
  const FastFlaunchZapAbi = [
21111
21954
  {
21112
21955
  inputs: [
@@ -21182,6 +22025,7 @@ class ReadFlaunchSDK {
21182
22025
  this.readPositionManager = new ReadFlaunchPositionManager(FlaunchPositionManagerAddress[this.chainId], drift);
21183
22026
  this.readPositionManagerV1_1 = new ReadFlaunchPositionManagerV1_1(FlaunchPositionManagerV1_1Address[this.chainId], drift);
21184
22027
  this.readAnyPositionManager = new ReadAnyPositionManager(AnyPositionManagerAddress[this.chainId], drift);
22028
+ this.readTokenImporter = new ReadTokenImporter(this.chainId, TokenImporterAddress[this.chainId], drift);
21185
22029
  this.readFeeEscrow = new ReadFeeEscrow(FeeEscrowAddress[this.chainId], drift);
21186
22030
  this.readReferralEscrow = new ReadReferralEscrow(ReferralEscrowAddress[this.chainId], drift);
21187
22031
  this.readFlaunchZap = new ReadFlaunchZap(this.chainId, FlaunchZapAddress[this.chainId], drift);
@@ -21224,7 +22068,7 @@ class ReadFlaunchSDK {
21224
22068
  }
21225
22069
  throw new Error(`Unknown coin version for address: ${coinAddress}`);
21226
22070
  }
21227
- // TODO: update these get functions to support V1.1.1 and new AnyPositionManager
22071
+ // TODO: update these get functions to support V1.1.1
21228
22072
  /**
21229
22073
  * Gets the position manager address for a given version
21230
22074
  * @param version - The version to get the position manager address for
@@ -21273,6 +22117,22 @@ class ReadFlaunchSDK {
21273
22117
  return this.readBidWallV1_1;
21274
22118
  }
21275
22119
  }
22120
+ /**
22121
+ * Gets the flaunch contract address for a given version
22122
+ * @param version - The version to get the flaunch contract address for
22123
+ */
22124
+ getFlaunchAddress(version) {
22125
+ switch (version) {
22126
+ case FlaunchVersion.V1:
22127
+ return this.readFlaunch.contract.address;
22128
+ case FlaunchVersion.V1_1:
22129
+ return this.readFlaunchV1_1.contract.address;
22130
+ case FlaunchVersion.ANY:
22131
+ return this.readFlaunchV1_1.contract.address;
22132
+ default:
22133
+ return this.readFlaunchV1_1.contract.address;
22134
+ }
22135
+ }
21276
22136
  getPositionManagerAddress(version) {
21277
22137
  return this.getPositionManager(version).contract.address;
21278
22138
  }
@@ -21792,6 +22652,22 @@ class ReadFlaunchSDK {
21792
22652
  const readRevenueManager = new ReadRevenueManager(params.revenueManagerAddress, this.drift);
21793
22653
  return readRevenueManager.allTokensInManager(params.sortByDesc);
21794
22654
  }
22655
+ /**
22656
+ * Gets treasury manager information including owner and permissions
22657
+ * @param treasuryManagerAddress - The address of the treasury manager
22658
+ * @returns Promise<{managerOwner: Address, permissions: Address}> - Treasury manager owner and permissions contract addresses
22659
+ */
22660
+ async treasuryManagerInfo(treasuryManagerAddress) {
22661
+ const readTreasuryManager = new ReadTreasuryManager(treasuryManagerAddress, this.drift);
22662
+ const [managerOwner, permissions] = await Promise.all([
22663
+ readTreasuryManager.managerOwner(),
22664
+ readTreasuryManager.permissions(),
22665
+ ]);
22666
+ return {
22667
+ managerOwner,
22668
+ permissions,
22669
+ };
22670
+ }
21795
22671
  /**
21796
22672
  * Gets the pool ID for a given coin
21797
22673
  * @param coinAddress - The address of the coin
@@ -21919,6 +22795,30 @@ class ReadFlaunchSDK {
21919
22795
  const positionManager = this.getPositionManager(params.version);
21920
22796
  return positionManager.parseSwapTx(params.txHash, params.flETHIsCurrencyZero);
21921
22797
  }
22798
+ /**
22799
+ * Verifies if a memecoin is valid for importing
22800
+ * @param memecoin - The address of the memecoin to import
22801
+ * @returns Promise<{ isValid: boolean; verifier: Address }> - The result of the verification
22802
+ */
22803
+ tokenImporterVerifyMemecoin(memecoin) {
22804
+ return this.readTokenImporter.verifyMemecoin(memecoin);
22805
+ }
22806
+ /**
22807
+ * Checks if an operator is approved for all flaunch tokens of an owner
22808
+ * @param version - The flaunch version to determine the correct contract address
22809
+ * @param owner - The owner address to check
22810
+ * @param operator - The operator address to check
22811
+ * @returns Promise<boolean> - True if operator is approved for all tokens
22812
+ */
22813
+ async isFlaunchTokenApprovedForAll(version, owner, operator) {
22814
+ const flaunchAddress = this.getFlaunchAddress(version);
22815
+ return this.drift.read({
22816
+ abi: erc721Abi,
22817
+ address: flaunchAddress,
22818
+ fn: "isApprovedForAll",
22819
+ args: { owner, operator },
22820
+ });
22821
+ }
21922
22822
  }
21923
22823
  class ReadWriteFlaunchSDK extends ReadFlaunchSDK {
21924
22824
  constructor(chainId, drift = createDrift$1()) {
@@ -21926,6 +22826,7 @@ class ReadWriteFlaunchSDK extends ReadFlaunchSDK {
21926
22826
  this.readWritePositionManager = new ReadWriteFlaunchPositionManager(FlaunchPositionManagerAddress[this.chainId], drift);
21927
22827
  this.readWritePositionManagerV1_1 = new ReadWriteFlaunchPositionManagerV1_1(FlaunchPositionManagerV1_1Address[this.chainId], drift);
21928
22828
  this.readWriteAnyPositionManager = new ReadWriteAnyPositionManager(AnyPositionManagerAddress[this.chainId], drift);
22829
+ this.readWriteTokenImporter = new ReadWriteTokenImporter(this.chainId, TokenImporterAddress[this.chainId], drift);
21929
22830
  this.readWriteFeeEscrow = new ReadWriteFeeEscrow(FeeEscrowAddress[this.chainId], drift);
21930
22831
  this.readWriteReferralEscrow = new ReadWriteReferralEscrow(ReferralEscrowAddress[this.chainId], drift);
21931
22832
  this.readWriteFlaunchZap = new ReadWriteFlaunchZap(this.chainId, FlaunchZapAddress[this.chainId], drift);
@@ -21937,31 +22838,28 @@ class ReadWriteFlaunchSDK extends ReadFlaunchSDK {
21937
22838
  * @param params - Parameters for deploying the revenue manager
21938
22839
  * @param params.protocolRecipient - The address of the protocol recipient
21939
22840
  * @param params.protocolFeePercent - The percentage of the protocol fee
22841
+ * @param params.permissions - The permissions for the revenue manager
21940
22842
  * @returns Address of the deployed revenue manager
21941
22843
  */
21942
22844
  async deployRevenueManager(params) {
21943
22845
  const hash = await this.readWriteTreasuryManagerFactory.deployRevenueManager(params);
21944
- // Create a public client to get the transaction receipt with logs
21945
- const publicClient = createPublicClient({
21946
- chain: chainIdToChain[this.chainId],
21947
- transport: http(),
21948
- });
21949
- // Wait for transaction receipt
21950
- const receipt = await publicClient.waitForTransactionReceipt({ hash });
21951
- // Get the logs from the receipt and find the ManagerDeployed event
21952
- const events = await publicClient.getContractEvents({
21953
- address: this.readWriteTreasuryManagerFactory.contract.address,
21954
- abi: TreasuryManagerFactoryAbi,
21955
- eventName: "ManagerDeployed",
21956
- fromBlock: receipt.blockNumber,
21957
- toBlock: receipt.blockNumber,
21958
- });
21959
- // Find the event from our transaction
21960
- const event = events.find((e) => e.transactionHash === hash);
21961
- if (!event) {
21962
- throw new Error("ManagerDeployed event not found in transaction logs");
21963
- }
21964
- return event.args._manager;
22846
+ return await this.readWriteTreasuryManagerFactory.getManagerDeployedAddressFromTx(hash);
22847
+ }
22848
+ /**
22849
+ * Deploys a new staking manager
22850
+ * @param params - Parameters for deploying the staking manager
22851
+ * @param params.managerOwner - The address of the manager owner
22852
+ * @param params.stakingToken - The address of the token to be staked
22853
+ * @param params.minEscrowDuration - The minimum duration (in seconds) that the creator's NFT is locked for
22854
+ * @param params.minStakeDuration - The minimum duration (in seconds) that the user's tokens are locked for
22855
+ * @param params.creatorSharePercent - The % share that a creator will earn from their token
22856
+ * @param params.ownerSharePercent - The % share that the manager owner will earn from their token
22857
+ * @param params.permissions - The permissions for the staking manager
22858
+ * @returns Address of the deployed staking manager
22859
+ */
22860
+ async deployStakingManager(params) {
22861
+ const hash = await this.readWriteTreasuryManagerFactory.deployStakingManager(params);
22862
+ return await this.readWriteTreasuryManagerFactory.getManagerDeployedAddressFromTx(hash);
21965
22863
  }
21966
22864
  /**
21967
22865
  * Creates a new Flaunch on the specified version
@@ -22216,6 +23114,74 @@ class ReadWriteFlaunchSDK extends ReadFlaunchSDK {
22216
23114
  const readWriteRevenueManager = new ReadWriteRevenueManager(params.revenueManagerAddress, this.drift);
22217
23115
  return readWriteRevenueManager.creatorClaimForTokens(params.flaunchTokens);
22218
23116
  }
23117
+ /**
23118
+ * Sets the permissions contract address for a treasury manager
23119
+ * @param treasuryManagerAddress - The address of the treasury manager
23120
+ * @param permissions - The permissions enum value to set
23121
+ * @returns Transaction response
23122
+ */
23123
+ treasuryManagerSetPermissions(treasuryManagerAddress, permissions) {
23124
+ const readWriteTreasuryManager = new ReadWriteTreasuryManager(treasuryManagerAddress, this.drift);
23125
+ const permissionsAddress = getPermissionsAddress(permissions, this.chainId);
23126
+ return readWriteTreasuryManager.setPermissions(permissionsAddress);
23127
+ }
23128
+ /**
23129
+ * Transfers the ownership of a treasury manager to a new address
23130
+ * @param treasuryManagerAddress - The address of the treasury manager
23131
+ * @param newManagerOwner - The address of the new manager owner
23132
+ * @returns Transaction response
23133
+ */
23134
+ treasuryManagerTransferOwnership(treasuryManagerAddress, newManagerOwner) {
23135
+ const readWriteTreasuryManager = new ReadWriteTreasuryManager(treasuryManagerAddress, this.drift);
23136
+ return readWriteTreasuryManager.transferManagerOwnership(newManagerOwner);
23137
+ }
23138
+ /**
23139
+ * Sets approval for all flaunch tokens to an operator
23140
+ * @param version - The flaunch version to determine the correct contract address
23141
+ * @param operator - The operator address to approve/revoke
23142
+ * @param approved - Whether to approve or revoke approval
23143
+ * @returns Transaction response
23144
+ */
23145
+ async setFlaunchTokenApprovalForAll(version, operator, approved) {
23146
+ const flaunchAddress = this.getFlaunchAddress(version);
23147
+ return this.drift.write({
23148
+ abi: erc721Abi,
23149
+ address: flaunchAddress,
23150
+ fn: "setApprovalForAll",
23151
+ args: { operator, approved },
23152
+ });
23153
+ }
23154
+ /**
23155
+ * Adds an existing flaunch token to a treasury manager. NFT approval must be given prior to calling this function.
23156
+ * @param treasuryManagerAddress - The address of the treasury manager
23157
+ * @param version - The flaunch version to determine the correct contract address
23158
+ * @param tokenId - The token ID to deposit
23159
+ * @param creator - Optional creator address. If not provided, uses the connected wallet address
23160
+ * @param data - Optional additional data for the deposit (defaults to empty bytes)
23161
+ * @returns Transaction response
23162
+ */
23163
+ async addToTreasuryManager(treasuryManagerAddress, version, tokenId, creator, data = "0x") {
23164
+ const readWriteTreasuryManager = new ReadWriteTreasuryManager(treasuryManagerAddress, this.drift);
23165
+ // Get the flaunch contract address based on version
23166
+ const flaunchAddress = this.getFlaunchAddress(version);
23167
+ const flaunchToken = {
23168
+ flaunch: flaunchAddress,
23169
+ tokenId,
23170
+ };
23171
+ const creatorAddress = creator ?? (await this.drift.getSignerAddress());
23172
+ return readWriteTreasuryManager.deposit(flaunchToken, creatorAddress, data);
23173
+ }
23174
+ /**
23175
+ * Imports a memecoin into the TokenImporter
23176
+ * @param params.memecoin - The address of the memecoin to import
23177
+ * @param params.creatorFeeAllocationPercent - The creator fee allocation percentage
23178
+ * @param params.initialMarketCapUSD - The initial market cap in USD
23179
+ * @param params.verifier - Optional verifier to use for importing the memecoin
23180
+ * @returns Transaction response
23181
+ */
23182
+ importMemecoin(params) {
23183
+ return this.readWriteTokenImporter.initialize(params);
23184
+ }
22219
23185
  }
22220
23186
 
22221
23187
  /**
@@ -22261,5 +23227,5 @@ const FlaunchSDK = {
22261
23227
  ReadWriteFlaunchSDK,
22262
23228
  };
22263
23229
 
22264
- export { AddressFeeSplitManagerAddress, AnyBidWallAddress, AnyFlaunchAddress, AnyPositionManagerAbi, AnyPositionManagerAddress, BidWallAddress, BidWallV1_1Abi, BidWallV1_1Address, BidwallAbi, FLETHAddress, FLETHHooksAddress, FairLaunchAbi, FairLaunchAddress, FairLaunchV1_1Abi, FairLaunchV1_1Address, FastFlaunchZapAbi, FastFlaunchZapAddress, FeeEscrowAbi, FeeEscrowAddress, FlaunchAbi, FlaunchAddress, FlaunchPositionManagerAbi, FlaunchPositionManagerAddress, FlaunchPositionManagerV1_1Abi, FlaunchPositionManagerV1_1Address, FlaunchSDK, FlaunchV1_1Abi, FlaunchV1_1Address, FlaunchVersion, FlaunchZapAbi, FlaunchZapAddress, InitialPriceAbi, MemecoinAbi, MulticallAbi, Permit2Abi, Permit2Address, PoolManagerAbi, PoolManagerAddress, QuoterAbi, QuoterAddress, ReadFlaunchSDK, ReadWriteFlaunchSDK, ReferralEscrowAbi, ReferralEscrowAddress, RevenueManagerAbi, RevenueManagerAddress, StateViewAbi, StateViewAddress, TICK_SPACING, TickFinder, TreasuryManagerFactoryAbi, TreasuryManagerFactoryAddress, USDCETHPoolKeys, UniversalRouterAbi, UniversalRouterAddress, bytes32ToUint256, calculateUnderlyingTokenBalances, chainIdToChain, createDrift, createFlaunch, generateTokenUri, getPoolId, getSqrtPriceX96FromTick, getValidTick, orderPoolKey, parseSwapData, resolveIPFS, uint256ToBytes32, uploadFileToIPFS, uploadImageToIPFS, uploadJsonToIPFS };
23230
+ export { AddressFeeSplitManagerAddress, AnyBidWallAddress, AnyFlaunchAddress, AnyPositionManagerAbi, AnyPositionManagerAddress, BidWallAddress, BidWallV1_1Abi, BidWallV1_1Address, BidwallAbi, ClankerWorldVerifierAddress, ClosedPermissionsAddress, DopplerVerifierAddress, FLETHAddress, FLETHHooksAddress, FairLaunchAbi, FairLaunchAddress, FairLaunchV1_1Abi, FairLaunchV1_1Address, FastFlaunchZapAbi, FastFlaunchZapAddress, FeeEscrowAbi, FeeEscrowAddress, FlaunchAbi, FlaunchAddress, FlaunchPositionManagerAbi, FlaunchPositionManagerAddress, FlaunchPositionManagerV1_1Abi, FlaunchPositionManagerV1_1Address, FlaunchSDK, FlaunchV1_1Abi, FlaunchV1_1Address, FlaunchVersion, FlaunchZapAbi, FlaunchZapAddress, InitialPriceAbi, MemecoinAbi, MulticallAbi, PERMIT_DETAILS, PERMIT_TYPES, Permissions, Permit2Abi, Permit2Address, PoolManagerAbi, PoolManagerAddress, QuoterAbi, QuoterAddress, ReadFlaunchSDK, ReadWriteFlaunchSDK, ReferralEscrowAbi, ReferralEscrowAddress, RevenueManagerAbi, RevenueManagerAddress, StakingManagerAddress, StateViewAbi, StateViewAddress, TICK_SPACING, TickFinder, TokenImporterAddress, TreasuryManagerFactoryAbi, TreasuryManagerFactoryAddress, USDCETHPoolKeys, UniversalRouterAbi, UniversalRouterAddress, Verifier, VirtualsVerifierAddress, WhitelistVerifierAddress, WhitelistedPermissionsAddress, ZoraVerifierAddress, bytes32ToUint256, calculateUnderlyingTokenBalances, chainIdToChain, createDrift, createFlaunch, ethToMemecoin, generateTokenUri, getAmountWithSlippage, getPermissionsAddress, getPermit2TypedData, getPoolId, getSqrtPriceX96FromTick, getValidTick, memecoinToEthWithPermit2, orderPoolKey, parseSwapData, resolveIPFS, uint256ToBytes32, uploadFileToIPFS, uploadImageToIPFS, uploadJsonToIPFS };
22265
23231
  //# sourceMappingURL=index.esm.js.map