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