@boostxyz/sdk 2.1.1 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. package/dist/Actions/Action.cjs +1 -1
  2. package/dist/Actions/Action.cjs.map +1 -1
  3. package/dist/Actions/Action.d.ts +2 -1
  4. package/dist/Actions/Action.d.ts.map +1 -1
  5. package/dist/Actions/Action.js +14 -13
  6. package/dist/Actions/Action.js.map +1 -1
  7. package/dist/Actions/EventAction.cjs +1 -1
  8. package/dist/Actions/EventAction.cjs.map +1 -1
  9. package/dist/Actions/EventAction.d.ts.map +1 -1
  10. package/dist/Actions/EventAction.js +33 -33
  11. package/dist/Actions/EventAction.js.map +1 -1
  12. package/dist/AllowLists/AllowList.cjs +1 -1
  13. package/dist/AllowLists/AllowList.cjs.map +1 -1
  14. package/dist/AllowLists/AllowList.d.ts +2 -1
  15. package/dist/AllowLists/AllowList.d.ts.map +1 -1
  16. package/dist/AllowLists/AllowList.js +19 -18
  17. package/dist/AllowLists/AllowList.js.map +1 -1
  18. package/dist/AllowLists/SimpleAllowList.cjs +1 -1
  19. package/dist/AllowLists/SimpleAllowList.js +7 -7
  20. package/dist/AllowLists/SimpleDenyList.cjs +1 -1
  21. package/dist/AllowLists/SimpleDenyList.js +3 -3
  22. package/dist/Auth/PassthroughAuth.cjs +1 -1
  23. package/dist/Auth/PassthroughAuth.js +1 -1
  24. package/dist/BoostCore.cjs +2 -2
  25. package/dist/BoostCore.cjs.map +1 -1
  26. package/dist/BoostCore.d.ts +13 -4
  27. package/dist/BoostCore.d.ts.map +1 -1
  28. package/dist/BoostCore.js +58 -57
  29. package/dist/BoostCore.js.map +1 -1
  30. package/dist/BoostRegistry.cjs +1 -1
  31. package/dist/BoostRegistry.js +11 -11
  32. package/dist/{Budget-DpQgIZEx.js → Budget-B0q1S08L.js} +33 -32
  33. package/dist/{Budget-DpQgIZEx.js.map → Budget-B0q1S08L.js.map} +1 -1
  34. package/dist/{Budget-BxQMnsdx.cjs → Budget-BA_1sa1e.cjs} +2 -2
  35. package/dist/{Budget-BxQMnsdx.cjs.map → Budget-BA_1sa1e.cjs.map} +1 -1
  36. package/dist/Budgets/Budget.cjs +1 -1
  37. package/dist/Budgets/Budget.d.ts +2 -1
  38. package/dist/Budgets/Budget.d.ts.map +1 -1
  39. package/dist/Budgets/Budget.js +2 -2
  40. package/dist/Budgets/ManagedBudget.cjs +1 -1
  41. package/dist/Budgets/ManagedBudget.js +11 -11
  42. package/dist/Deployable/DeployableTarget.cjs +1 -1
  43. package/dist/Deployable/DeployableTarget.js +1 -1
  44. package/dist/Deployable/DeployableTargetWithRBAC.cjs +1 -1
  45. package/dist/Deployable/DeployableTargetWithRBAC.cjs.map +1 -1
  46. package/dist/Deployable/DeployableTargetWithRBAC.d.ts +158 -0
  47. package/dist/Deployable/DeployableTargetWithRBAC.d.ts.map +1 -1
  48. package/dist/Deployable/DeployableTargetWithRBAC.js +268 -31
  49. package/dist/Deployable/DeployableTargetWithRBAC.js.map +1 -1
  50. package/dist/Incentives/AllowListIncentive.cjs +1 -1
  51. package/dist/Incentives/AllowListIncentive.cjs.map +1 -1
  52. package/dist/Incentives/AllowListIncentive.js +27 -27
  53. package/dist/Incentives/AllowListIncentive.js.map +1 -1
  54. package/dist/Incentives/CGDAIncentive.cjs +1 -1
  55. package/dist/Incentives/CGDAIncentive.cjs.map +1 -1
  56. package/dist/Incentives/CGDAIncentive.js +9 -9
  57. package/dist/Incentives/CGDAIncentive.js.map +1 -1
  58. package/dist/Incentives/ERC20Incentive.cjs +1 -1
  59. package/dist/Incentives/ERC20Incentive.cjs.map +1 -1
  60. package/dist/Incentives/ERC20Incentive.js +30 -30
  61. package/dist/Incentives/ERC20Incentive.js.map +1 -1
  62. package/dist/Incentives/ERC20VariableCriteriaIncentive.cjs +1 -1
  63. package/dist/Incentives/ERC20VariableCriteriaIncentive.js +11 -11
  64. package/dist/Incentives/ERC20VariableIncentive.cjs +1 -1
  65. package/dist/Incentives/ERC20VariableIncentive.cjs.map +1 -1
  66. package/dist/Incentives/ERC20VariableIncentive.js +12 -12
  67. package/dist/Incentives/ERC20VariableIncentive.js.map +1 -1
  68. package/dist/Incentives/Incentive.cjs +1 -1
  69. package/dist/Incentives/Incentive.cjs.map +1 -1
  70. package/dist/Incentives/Incentive.d.ts +2 -1
  71. package/dist/Incentives/Incentive.d.ts.map +1 -1
  72. package/dist/Incentives/Incentive.js +29 -28
  73. package/dist/Incentives/Incentive.js.map +1 -1
  74. package/dist/Incentives/PointsIncentive.cjs +1 -1
  75. package/dist/Incentives/PointsIncentive.cjs.map +1 -1
  76. package/dist/Incentives/PointsIncentive.js +25 -25
  77. package/dist/Incentives/PointsIncentive.js.map +1 -1
  78. package/dist/{SimpleDenyList-CA24drhL.cjs → SimpleDenyList-DrQrJ14i.cjs} +2 -2
  79. package/dist/{SimpleDenyList-CA24drhL.cjs.map → SimpleDenyList-DrQrJ14i.cjs.map} +1 -1
  80. package/dist/{SimpleDenyList-UHgnaOb_.js → SimpleDenyList-DuCoaOlG.js} +9 -9
  81. package/dist/{SimpleDenyList-UHgnaOb_.js.map → SimpleDenyList-DuCoaOlG.js.map} +1 -1
  82. package/dist/Validators/LimitedSignerValidator.cjs +1 -1
  83. package/dist/Validators/LimitedSignerValidator.js +7 -7
  84. package/dist/Validators/SignerValidator.cjs +1 -1
  85. package/dist/Validators/SignerValidator.js +5 -5
  86. package/dist/Validators/Validator.cjs +1 -1
  87. package/dist/Validators/Validator.cjs.map +1 -1
  88. package/dist/Validators/Validator.d.ts +2 -1
  89. package/dist/Validators/Validator.d.ts.map +1 -1
  90. package/dist/Validators/Validator.js +22 -21
  91. package/dist/Validators/Validator.js.map +1 -1
  92. package/dist/deployments-BucJ-gwk.cjs +2 -0
  93. package/dist/deployments-BucJ-gwk.cjs.map +1 -0
  94. package/dist/deployments-CQu0bLhU.js +102 -0
  95. package/dist/deployments-CQu0bLhU.js.map +1 -0
  96. package/dist/deployments.json +77 -74
  97. package/dist/{generated-B0XfMfoq.js → generated-1ZT_mHJx.js} +673 -450
  98. package/dist/generated-1ZT_mHJx.js.map +1 -0
  99. package/dist/generated-CgBgbMNe.cjs +3 -0
  100. package/dist/generated-CgBgbMNe.cjs.map +1 -0
  101. package/dist/index.cjs +1 -1
  102. package/dist/index.js +3 -3
  103. package/package.json +2 -2
  104. package/src/Actions/Action.ts +3 -0
  105. package/src/Actions/EventAction.test.ts +49 -2
  106. package/src/Actions/EventAction.ts +12 -4
  107. package/src/AllowLists/AllowList.ts +3 -0
  108. package/src/BoostCore.ts +16 -11
  109. package/src/Budgets/Budget.ts +3 -0
  110. package/src/Deployable/DeployableTargetWithRBAC.test.ts +175 -0
  111. package/src/Deployable/DeployableTargetWithRBAC.ts +281 -0
  112. package/src/Incentives/AllowListIncentive.test.ts +48 -0
  113. package/src/Incentives/AllowListIncentive.ts +1 -1
  114. package/src/Incentives/CGDAIncentive.test.ts +50 -0
  115. package/src/Incentives/CGDAIncentive.ts +1 -1
  116. package/src/Incentives/ERC1155Incentive.ts +1 -1
  117. package/src/Incentives/ERC20Incentive.test.ts +49 -0
  118. package/src/Incentives/ERC20Incentive.ts +1 -1
  119. package/src/Incentives/ERC20VariableIncentive.test.ts +48 -0
  120. package/src/Incentives/ERC20VariableIncentive.ts +1 -1
  121. package/src/Incentives/Incentive.ts +3 -0
  122. package/src/Incentives/PointsIncentive.test.ts +51 -0
  123. package/src/Incentives/PointsIncentive.ts +1 -1
  124. package/src/Validators/Validator.ts +3 -0
  125. package/dist/deployments-BDumesUK.cjs +0 -2
  126. package/dist/deployments-BDumesUK.cjs.map +0 -1
  127. package/dist/deployments-DvYsMioW.js +0 -99
  128. package/dist/deployments-DvYsMioW.js.map +0 -1
  129. package/dist/generated-B0XfMfoq.js.map +0 -1
  130. package/dist/generated-pNKCp_Ez.cjs +0 -3
  131. package/dist/generated-pNKCp_Ez.cjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"AllowListIncentive.cjs","sources":["../../src/Incentives/AllowListIncentive.ts"],"sourcesContent":["import {\n allowListIncentiveAbi,\n readAllowListIncentiveAllowList,\n readAllowListIncentiveClaimed,\n readAllowListIncentiveClaims,\n readAllowListIncentiveIsClaimable,\n readAllowListIncentiveLimit,\n readAllowListIncentiveOwner,\n readAllowListIncentiveReward,\n simulateAllowListIncentiveClaim,\n writeAllowListIncentiveClaim,\n} from '@boostxyz/evm';\nimport { bytecode } from '@boostxyz/evm/artifacts/contracts/incentives/AllowListIncentive.sol/AllowListIncentive.json';\nimport {\n type Address,\n type ContractEventName,\n type Hex,\n encodeAbiParameters,\n zeroHash,\n} from 'viem';\nimport { AllowListIncentive as AllowListIncentiveBases } from '../../dist/deployments.json';\nimport { SimpleAllowList } from '../AllowLists/AllowList';\nimport type {\n DeployableOptions,\n GenericDeployableParams,\n} from '../Deployable/Deployable';\nimport { DeployableTarget } from '../Deployable/DeployableTarget';\nimport { type ClaimPayload, prepareClaimPayload } from '../claiming';\nimport {\n type GenericLog,\n type ReadParams,\n RegistryType,\n type WriteParams,\n} from '../utils';\n\nexport { allowListIncentiveAbi };\n\n/**\n * The object representation of a `AllowListIncentive.InitPayload`\n *\n * @export\n * @interface AllowListIncentivePayload\n * @typedef {AllowListIncentivePayload}\n */\nexport interface AllowListIncentivePayload {\n /**\n * The address to the allowlist to add claimers to.\n *\n * @type {Address}\n */\n allowList: Address;\n /**\n * The maximum number of claims that can be made (one per address)\n *\n * @type {bigint}\n */\n limit: bigint;\n}\n\n/**\n * A generic `viem.Log` event with support for `AllowListIncentive` event types.\n *\n * @export\n * @typedef {AllowListIncentiveLog}\n * @template {ContractEventName<\n * typeof allowListIncentiveAbi\n * >} [event=ContractEventName<typeof allowListIncentiveAbi>]\n */\nexport type AllowListIncentiveLog<\n event extends ContractEventName<\n typeof allowListIncentiveAbi\n > = ContractEventName<typeof allowListIncentiveAbi>,\n> = GenericLog<typeof allowListIncentiveAbi, event>;\n\n/**\n * An incentive implementation that grants the claimer a slot on an {SimpleAllowList}\n * In order for any claim to be successful:\n * - The claimer must not already be on the allow list; and\n * - The maximum number of claims must not have been reached; and\n * - This contract must be authorized to modify the allow list\n *\n * @export\n * @class AllowListIncentive\n * @typedef {AllowListIncentive}\n * @extends {DeployableTarget<AllowListIncentivePayload>}\n */\nexport class AllowListIncentive extends DeployableTarget<\n AllowListIncentivePayload,\n typeof allowListIncentiveAbi\n> {\n public override readonly abi = allowListIncentiveAbi;\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {Record<number, Address>}\n */\n public static override bases: Record<number, Address> = {\n 31337: import.meta.env.VITE_ALLOWLIST_INCENTIVE_BASE,\n ...(AllowListIncentiveBases as Record<number, Address>),\n };\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {RegistryType}\n */\n public static override registryType: RegistryType = RegistryType.INCENTIVE;\n\n /**\n * The owner of the allowList\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<Address>}\n */\n public async owner(params?: ReadParams) {\n return await readAllowListIncentiveOwner(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The number of claims that have been made\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async claims(params?: ReadParams) {\n return await readAllowListIncentiveClaims(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The reward amount issued for each claim\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async reward(params?: ReadParams) {\n return await readAllowListIncentiveReward(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Get the claim status for a user\n *\n * @public\n * @async\n * @param {Address} address\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>}\n */\n public async claimed(address: Address, params?: ReadParams) {\n return await readAllowListIncentiveClaimed(this._config, {\n address: this.assertValidAddress(),\n args: [address],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The {@link SimpleAllowList} contract\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<SimpleAllowList>}\n */\n public async allowList(params?: ReadParams): Promise<SimpleAllowList> {\n const address = await readAllowListIncentiveAllowList(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n return new SimpleAllowList(\n { config: this._config, account: this._account },\n address,\n );\n }\n\n /**\n * The maximum number of claims that can be made (one per address)\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async limit(params?: ReadParams) {\n return await readAllowListIncentiveLimit(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Claim a slot on the {@link SimpleAllowList}\n *\n * @public\n * @async\n * @param {Pick<ClaimPayload, 'target'>} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<true>} - return true if successful, otherwise revert\n */\n protected async claim(\n payload: Pick<ClaimPayload, 'target'>,\n params?: WriteParams,\n ) {\n return await this.awaitResult(this.claimRaw(payload, params));\n }\n\n /**\n * Claim a slot on the {@link SimpleAllowList}\n *\n * @public\n * @async\n * @param {Pick<ClaimPayload, 'target'>} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: boolean; }>} - return true if successful, otherwise revert\n */\n protected async claimRaw(\n payload: Pick<ClaimPayload, 'target'>,\n params?: WriteParams,\n ) {\n const { request, result } = await simulateAllowListIncentiveClaim(\n this._config,\n {\n address: this.assertValidAddress(),\n args: [prepareClaimPayload(payload)],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n },\n );\n const hash = await writeAllowListIncentiveClaim(this._config, request);\n return { hash, result };\n }\n\n /**\n * Check if an incentive is claimable\n *\n * @public\n * @async\n * @param {Pick<ClaimPayload, 'target'>} payload\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>} - True if the incentive is claimable based on the data payload\n */\n public async isClaimable(\n payload: Pick<ClaimPayload, 'target'>,\n params?: ReadParams,\n ) {\n return await readAllowListIncentiveIsClaimable(this._config, {\n address: this.assertValidAddress(),\n args: [prepareClaimPayload(payload)],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Check if an incentive can potentially be claimed by comparing limit and total claims. Does not take requesting user or underlying allowlist into account.\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>} - True if total claims is less than limit\n */\n public async canBeClaimed(params?: ReadParams) {\n return (await this.getRemainingClaimPotential(params)) > 0n;\n }\n\n /**\n * Check how many claims remain by comparing limit and total claims. Does not take requesting user or underlying allowlist into account.\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>} - True if total claims is less than limit\n */\n public async getRemainingClaimPotential(params?: ReadParams) {\n const [claims, limit] = await Promise.all([\n this.claims(params),\n this.limit(params),\n ]);\n return limit - claims;\n }\n\n /**\n * @inheritdoc\n *\n * @public\n * @param {?AllowListIncentivePayload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {GenericDeployableParams}\n */\n public override buildParameters(\n _payload?: AllowListIncentivePayload,\n _options?: DeployableOptions,\n ): GenericDeployableParams {\n const [payload, options] = this.validateDeploymentConfig(\n _payload,\n _options,\n );\n return {\n abi: allowListIncentiveAbi,\n bytecode: bytecode as Hex,\n args: [prepareAllowListIncentivePayload(payload)],\n ...this.optionallyAttachAccount(options.account),\n };\n }\n\n /**\n * Builds the claim data for the AllowListIncentive.\n *\n * @public\n * @returns {Hash} A `zeroHash`, as AllowListIncentive doesn't require specific claim data.\n * @description This function returns `zeroHash` because AllowListIncentive doesn't use any specific claim data.\n */\n public buildClaimData() {\n return zeroHash;\n }\n}\n\n/**\n * Given a {@link AllowListIncentivePayload}, properly encode a `AllowListIncentive.InitPayload` for use with {@link AllowListIncentive} initialization.\n *\n * @param {AllowListIncentivePayload} param0\n * @param {Address} param0.allowList - The address to the allowlist to add claimers to.\n * @param {bigint} param0.limit - The maximum number of claims that can be made (one per address)\n * @returns {Hex}\n */\nexport const prepareAllowListIncentivePayload = ({\n allowList,\n limit,\n}: AllowListIncentivePayload) => {\n return encodeAbiParameters(\n [\n { type: 'address', name: 'allowList' },\n { type: 'uint256', name: 'limit' },\n ],\n [allowList, limit],\n );\n};\n"],"names":["_AllowListIncentive","DeployableTarget","allowListIncentiveAbi","params","readAllowListIncentiveOwner","readAllowListIncentiveClaims","readAllowListIncentiveReward","address","readAllowListIncentiveClaimed","readAllowListIncentiveAllowList","SimpleAllowList","readAllowListIncentiveLimit","payload","request","result","simulateAllowListIncentiveClaim","prepareClaimPayload","writeAllowListIncentiveClaim","readAllowListIncentiveIsClaimable","claims","limit","_payload","_options","options","bytecode","prepareAllowListIncentivePayload","zeroHash","AllowListIncentiveBases","RegistryType","AllowListIncentive","allowList","encodeAbiParameters"],"mappings":"kzZAsFaA,EAAN,MAAMA,UAA2BC,EAAAA,gBAGtC,CAHK,aAAA,CAAA,MAAA,GAAA,SAAA,EAIL,KAAyB,IAAMC,GAAA,CA6B/B,MAAa,MAAMC,EAAqB,CAC/B,OAAA,MAAMC,EAAAA,GAA4B,KAAK,QAAS,CACrD,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAAC,EAEP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AWA,MAAa,YACXF,EACAT,EACA,CACO,OAAA,MAAMe,EAAAA,GAAkC,KAAK,QAAS,CAC3D,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAACF,sBAAoBJ,CAAO,CAAC,EAEnC,GAAIT,CAAA,CACL,CACH,CAUA,MAAa,aAAaA,EAAqB,CAC7C,OAAQ,MAAM,KAAK,2BAA2BA,CAAM,EAAK,EAC3D,CAUA,MAAa,2BAA2BA,EAAqB,CAC3D,KAAM,CAACgB,EAAQC,CAAK,EAAI,MAAM,QAAQ,IAAI,CACxC,KAAK,OAAOjB,CAAM,EAClB,KAAK,MAAMA,CAAM,CAAA,CAClB,EACD,OAAOiB,EAAQD,CACjB,CAUgB,gBACdE,EACAC,EACyB,CACzB,KAAM,CAACV,EAASW,CAAO,EAAI,KAAK,yBAC9BF,EACAC,CAAA,EAEK,MAAA,CACL,IAAKpB,EAAA,EACL,SAAAsB,EACA,KAAM,CAACC,EAAiCb,CAAO,CAAC,EAChD,GAAG,KAAK,wBAAwBW,EAAQ,OAAO,CAAA,CAEnD,CASO,gBAAiB,CACf,OAAAG,UACT,CACF,EApPE1B,EAAuB,MAAiC,CACtD,MAAO,OACP,GAAI2B,EAAA,kBAAA,EASN3B,EAAuB,aAA6B4B,EAAa,aAAA,UAvB5D,IAAMC,EAAN7B,EA0QA,MAAMyB,EAAmC,CAAC,CAC/C,UAAAK,EACA,MAAAV,CACF,IACSW,EAAA,oBACL,CACE,CAAE,KAAM,UAAW,KAAM,WAAY,EACrC,CAAE,KAAM,UAAW,KAAM,OAAQ,CACnC,EACA,CAACD,EAAWV,CAAK,CAAA"}
1
+ {"version":3,"file":"AllowListIncentive.cjs","sources":["../../src/Incentives/AllowListIncentive.ts"],"sourcesContent":["import {\n allowListIncentiveAbi,\n readAllowListIncentiveAllowList,\n readAllowListIncentiveClaimed,\n readAllowListIncentiveClaims,\n readAllowListIncentiveIsClaimable,\n readAllowListIncentiveLimit,\n readAllowListIncentiveOwner,\n readAllowListIncentiveReward,\n simulateAllowListIncentiveClaim,\n writeAllowListIncentiveClaim,\n} from '@boostxyz/evm';\nimport { bytecode } from '@boostxyz/evm/artifacts/contracts/incentives/AllowListIncentive.sol/AllowListIncentive.json';\nimport {\n type Address,\n type ContractEventName,\n type Hex,\n encodeAbiParameters,\n zeroHash,\n} from 'viem';\nimport { AllowListIncentive as AllowListIncentiveBases } from '../../dist/deployments.json';\nimport { SimpleAllowList } from '../AllowLists/AllowList';\nimport type {\n DeployableOptions,\n GenericDeployableParams,\n} from '../Deployable/Deployable';\nimport { DeployableTarget } from '../Deployable/DeployableTarget';\nimport { type ClaimPayload, prepareClaimPayload } from '../claiming';\nimport {\n type GenericLog,\n type ReadParams,\n RegistryType,\n type WriteParams,\n} from '../utils';\n\nexport { allowListIncentiveAbi };\n\n/**\n * The object representation of a `AllowListIncentive.InitPayload`\n *\n * @export\n * @interface AllowListIncentivePayload\n * @typedef {AllowListIncentivePayload}\n */\nexport interface AllowListIncentivePayload {\n /**\n * The address to the allowlist to add claimers to.\n *\n * @type {Address}\n */\n allowList: Address;\n /**\n * The maximum number of claims that can be made (one per address)\n *\n * @type {bigint}\n */\n limit: bigint;\n}\n\n/**\n * A generic `viem.Log` event with support for `AllowListIncentive` event types.\n *\n * @export\n * @typedef {AllowListIncentiveLog}\n * @template {ContractEventName<\n * typeof allowListIncentiveAbi\n * >} [event=ContractEventName<typeof allowListIncentiveAbi>]\n */\nexport type AllowListIncentiveLog<\n event extends ContractEventName<\n typeof allowListIncentiveAbi\n > = ContractEventName<typeof allowListIncentiveAbi>,\n> = GenericLog<typeof allowListIncentiveAbi, event>;\n\n/**\n * An incentive implementation that grants the claimer a slot on an {SimpleAllowList}\n * In order for any claim to be successful:\n * - The claimer must not already be on the allow list; and\n * - The maximum number of claims must not have been reached; and\n * - This contract must be authorized to modify the allow list\n *\n * @export\n * @class AllowListIncentive\n * @typedef {AllowListIncentive}\n * @extends {DeployableTarget<AllowListIncentivePayload>}\n */\nexport class AllowListIncentive extends DeployableTarget<\n AllowListIncentivePayload,\n typeof allowListIncentiveAbi\n> {\n public override readonly abi = allowListIncentiveAbi;\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {Record<number, Address>}\n */\n public static override bases: Record<number, Address> = {\n 31337: import.meta.env.VITE_ALLOWLIST_INCENTIVE_BASE,\n ...(AllowListIncentiveBases as Record<number, Address>),\n };\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {RegistryType}\n */\n public static override registryType: RegistryType = RegistryType.INCENTIVE;\n\n /**\n * The owner of the allowList\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<Address>}\n */\n public async owner(params?: ReadParams) {\n return await readAllowListIncentiveOwner(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The number of claims that have been made\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async claims(params?: ReadParams) {\n return await readAllowListIncentiveClaims(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The reward amount issued for each claim\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async reward(params?: ReadParams) {\n return await readAllowListIncentiveReward(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Get the claim status for a user\n *\n * @public\n * @async\n * @param {Address} address\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>}\n */\n public async claimed(address: Address, params?: ReadParams) {\n return await readAllowListIncentiveClaimed(this._config, {\n address: this.assertValidAddress(),\n args: [address],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The {@link SimpleAllowList} contract\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<SimpleAllowList>}\n */\n public async allowList(params?: ReadParams): Promise<SimpleAllowList> {\n const address = await readAllowListIncentiveAllowList(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n return new SimpleAllowList(\n { config: this._config, account: this._account },\n address,\n );\n }\n\n /**\n * The maximum number of claims that can be made (one per address)\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async limit(params?: ReadParams) {\n return await readAllowListIncentiveLimit(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Claim a slot on the {@link SimpleAllowList}\n *\n * @public\n * @async\n * @param {Pick<ClaimPayload, 'target'>} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<true>} - return true if successful, otherwise revert\n */\n protected async claim(\n payload: Pick<ClaimPayload, 'target'>,\n params?: WriteParams,\n ) {\n return await this.awaitResult(this.claimRaw(payload, params));\n }\n\n /**\n * Claim a slot on the {@link SimpleAllowList}\n *\n * @public\n * @async\n * @param {Pick<ClaimPayload, 'target'>} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: boolean; }>} - return true if successful, otherwise revert\n */\n protected async claimRaw(\n payload: Pick<ClaimPayload, 'target'>,\n params?: WriteParams,\n ) {\n const { request, result } = await simulateAllowListIncentiveClaim(\n this._config,\n {\n address: this.assertValidAddress(),\n args: [prepareClaimPayload(payload)],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n },\n );\n const hash = await writeAllowListIncentiveClaim(this._config, request);\n return { hash, result };\n }\n\n /**\n * Check if an incentive is claimable\n *\n * @public\n * @async\n * @param {Pick<ClaimPayload, 'target'>} payload\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>} - True if the incentive is claimable based on the data payload\n */\n public async isClaimable(\n payload: Pick<ClaimPayload, 'target'>,\n params?: ReadParams,\n ) {\n return await readAllowListIncentiveIsClaimable(this._config, {\n address: this.assertValidAddress(),\n args: [payload.target, '0x'],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Check if an incentive can potentially be claimed by comparing limit and total claims. Does not take requesting user or underlying allowlist into account.\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>} - True if total claims is less than limit\n */\n public async canBeClaimed(params?: ReadParams) {\n return (await this.getRemainingClaimPotential(params)) > 0n;\n }\n\n /**\n * Check how many claims remain by comparing limit and total claims. Does not take requesting user or underlying allowlist into account.\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>} - True if total claims is less than limit\n */\n public async getRemainingClaimPotential(params?: ReadParams) {\n const [claims, limit] = await Promise.all([\n this.claims(params),\n this.limit(params),\n ]);\n return limit - claims;\n }\n\n /**\n * @inheritdoc\n *\n * @public\n * @param {?AllowListIncentivePayload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {GenericDeployableParams}\n */\n public override buildParameters(\n _payload?: AllowListIncentivePayload,\n _options?: DeployableOptions,\n ): GenericDeployableParams {\n const [payload, options] = this.validateDeploymentConfig(\n _payload,\n _options,\n );\n return {\n abi: allowListIncentiveAbi,\n bytecode: bytecode as Hex,\n args: [prepareAllowListIncentivePayload(payload)],\n ...this.optionallyAttachAccount(options.account),\n };\n }\n\n /**\n * Builds the claim data for the AllowListIncentive.\n *\n * @public\n * @returns {Hash} A `zeroHash`, as AllowListIncentive doesn't require specific claim data.\n * @description This function returns `zeroHash` because AllowListIncentive doesn't use any specific claim data.\n */\n public buildClaimData() {\n return zeroHash;\n }\n}\n\n/**\n * Given a {@link AllowListIncentivePayload}, properly encode a `AllowListIncentive.InitPayload` for use with {@link AllowListIncentive} initialization.\n *\n * @param {AllowListIncentivePayload} param0\n * @param {Address} param0.allowList - The address to the allowlist to add claimers to.\n * @param {bigint} param0.limit - The maximum number of claims that can be made (one per address)\n * @returns {Hex}\n */\nexport const prepareAllowListIncentivePayload = ({\n allowList,\n limit,\n}: AllowListIncentivePayload) => {\n return encodeAbiParameters(\n [\n { type: 'address', name: 'allowList' },\n { type: 'uint256', name: 'limit' },\n ],\n [allowList, limit],\n );\n};\n"],"names":["_AllowListIncentive","DeployableTarget","allowListIncentiveAbi","params","readAllowListIncentiveOwner","readAllowListIncentiveClaims","readAllowListIncentiveReward","address","readAllowListIncentiveClaimed","readAllowListIncentiveAllowList","SimpleAllowList","readAllowListIncentiveLimit","payload","request","result","simulateAllowListIncentiveClaim","prepareClaimPayload","writeAllowListIncentiveClaim","readAllowListIncentiveIsClaimable","claims","limit","_payload","_options","options","bytecode","prepareAllowListIncentivePayload","zeroHash","AllowListIncentiveBases","RegistryType","AllowListIncentive","allowList","encodeAbiParameters"],"mappings":"kzZAsFaA,EAAN,MAAMA,UAA2BC,EAAAA,gBAGtC,CAHK,aAAA,CAAA,MAAA,GAAA,SAAA,EAIL,KAAyB,IAAMC,GAAA,CA6B/B,MAAa,MAAMC,EAAqB,CAC/B,OAAA,MAAMC,EAAAA,GAA4B,KAAK,QAAS,CACrD,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAAC,EAEP,GAAID,CAAA,CACL,CACH,CAUA,MAAa,OAAOA,EAAqB,CAChC,OAAA,MAAME,EAAAA,GAA6B,KAAK,QAAS,CACtD,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAAC,EAEP,GAAIF,CAAA,CACL,CACH,CAUA,MAAa,OAAOA,EAAqB,CAChC,OAAA,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Q,MAAM,KAAK,2BAA2BA,CAAM,EAAK,EAC3D,CAUA,MAAa,2BAA2BA,EAAqB,CAC3D,KAAM,CAACgB,EAAQC,CAAK,EAAI,MAAM,QAAQ,IAAI,CACxC,KAAK,OAAOjB,CAAM,EAClB,KAAK,MAAMA,CAAM,CAAA,CAClB,EACD,OAAOiB,EAAQD,CACjB,CAUgB,gBACdE,EACAC,EACyB,CACzB,KAAM,CAACV,EAASW,CAAO,EAAI,KAAK,yBAC9BF,EACAC,CAAA,EAEK,MAAA,CACL,IAAKpB,EAAA,EACL,SAAAsB,EACA,KAAM,CAACC,EAAiCb,CAAO,CAAC,EAChD,GAAG,KAAK,wBAAwBW,EAAQ,OAAO,CAAA,CAEnD,CASO,gBAAiB,CACf,OAAAG,UACT,CACF,EApPE1B,EAAuB,MAAiC,CACtD,MAAO,OACP,GAAI2B,EAAA,kBAAA,EASN3B,EAAuB,aAA6B4B,EAAa,aAAA,UAvB5D,IAAMC,EAAN7B,EA0QA,MAAMyB,EAAmC,CAAC,CAC/C,UAAAK,EACA,MAAAV,CACF,IACSW,EAAA,oBACL,CACE,CAAE,KAAM,UAAW,KAAM,WAAY,EACrC,CAAE,KAAM,UAAW,KAAM,OAAQ,CACnC,EACA,CAACD,EAAWV,CAAK,CAAA"}
@@ -1,13 +1,13 @@
1
- import { z as c, a5 as r, a6 as n, a7 as o, a8 as l, a9 as m, aa as h, ab as u, ac as g, ad as p } from "../generated-B0XfMfoq.js";
2
- import { zeroHash as y, encodeAbiParameters as w } from "viem";
3
- import { A } from "../deployments-DvYsMioW.js";
1
+ import { z as c, ai as i, aj as r, ak as n, al as o, am as l, an as m, ao as h, ap as u, aq as g } from "../generated-1ZT_mHJx.js";
2
+ import { zeroHash as p, encodeAbiParameters as y } from "viem";
3
+ import { A as w } from "../deployments-CQu0bLhU.js";
4
4
  import "@wagmi/core";
5
- import { SimpleAllowList as V } from "../AllowLists/SimpleAllowList.js";
6
- import "../SimpleDenyList-UHgnaOb_.js";
7
- import { DeployableTarget as _ } from "../Deployable/DeployableTarget.js";
8
- import { prepareClaimPayload as s } from "../claiming.js";
5
+ import { SimpleAllowList as A } from "../AllowLists/SimpleAllowList.js";
6
+ import "../SimpleDenyList-DuCoaOlG.js";
7
+ import { DeployableTarget as V } from "../Deployable/DeployableTarget.js";
8
+ import { prepareClaimPayload as _ } from "../claiming.js";
9
9
  import { RegistryType as C } from "../utils.js";
10
- const P = "0x6080604052348015600e575f80fd5b50601b601f60201b60201c565b60b0565b5f602c608760201b60201c565b90508054600181161560455763f92ee8a95f526004601cfd5b8160c01c808260011c146082578060011b8355806020527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602080a15b505050565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffbf6011325f1b905090565b61180b806100bd5f395ff3fe608060405260043610610129575f3560e01c8063715018a6116100aa578063c884ef831161006e578063c884ef831461038a578063db09da12146103c6578063dcc59b6f14610402578063f04e283e1461042c578063f2fde38b14610448578063fee81cf41461046457610129565b8063715018a6146102c657806387b9d25c146102d05780638da5cb5b146102fa578063a4d66daf14610324578063bb1757cf1461034e57610129565b806338d52e0f116100f157806338d52e0f146101f1578063439fab911461021b578063474f5a44146102435780634e7165a21461028057806354d1f13d146102bc57610129565b806301ffc9a71461012d57806307621eca14610169578063228cb7331461019357806325692962146101bd57806328d6183b146101c7575b5f80fd5b348015610138575f80fd5b50610153600480360381019061014e9190610ffc565b6104a0565b6040516101609190611041565b60405180910390f35b348015610174575f80fd5b5061017d610519565b60405161018a9190611072565b60405180910390f35b34801561019e575f80fd5b506101a7610521565b6040516101b49190611072565b60405180910390f35b6101c5610526565b005b3480156101d2575f80fd5b506101db610577565b6040516101e8919061109a565b60405180910390f35b3480156101fc575f80fd5b5061020561059e565b60405161021291906110f2565b60405180910390f35b348015610226575f80fd5b50610241600480360381019061023c919061116c565b6105b9565b005b34801561024e575f80fd5b506102696004803603810190610264919061116c565b610699565b6040516102779291906111b7565b60405180910390f35b34801561028b575f80fd5b506102a660048036038101906102a1919061116c565b6106cd565b6040516102b3919061124e565b60405180910390f35b6102c4610724565b005b6102ce61075d565b005b3480156102db575f80fd5b506102e4610770565b6040516102f191906112c9565b60405180910390f35b348015610305575f80fd5b5061030e610795565b60405161031b91906110f2565b60405180910390f35b34801561032f575f80fd5b506103386107bd565b6040516103459190611072565b60405180910390f35b348015610359575f80fd5b50610374600480360381019061036f919061130c565b6107c3565b6040516103819190611041565b60405180910390f35b348015610395575f80fd5b506103b060048036038101906103ab9190611369565b610969565b6040516103bd9190611041565b60405180910390f35b3480156103d1575f80fd5b506103ec60048036038101906103e7919061130c565b610986565b6040516103f99190611041565b60405180910390f35b34801561040d575f80fd5b50610416610a8c565b6040516104239190611072565b60405180910390f35b61044660048036038101906104419190611369565b610a92565b005b610462600480360381019061045d9190611369565b610ad0565b005b34801561046f575f80fd5b5061048a60048036038101906104859190611369565b610af9565b6040516104979190611072565b60405180910390f35b5f7fc2c281ec000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610512575061051182610b12565b5b9050919050565b5f8054905090565b5f5481565b5f61052f610b8b565b67ffffffffffffffff164201905063389a75e1600c52335f52806020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d5f80a250565b5f7fc2c281ec00000000000000000000000000000000000000000000000000000000905090565b5f73deaddeaddeaddeaddeaddeaddeaddeaddeaddead905090565b5f6105c2610b95565b905080546003825580156105f45760018160011c14303b106105eb5763f92ee8a95f526004601cfd5b818160ff1b1b91505b505f838381019061060591906114c2565b905061061033610bbe565b805f015160015f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508060200151600281905550508015610694576002815560016020527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602080a15b505050565b5f806040517fd623472500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60605f67ffffffffffffffff8111156106e9576106e8611398565b5b6040519080825280601f01601f19166020018201604052801561071b5781602001600182028036833780820191505090505b50905092915050565b63389a75e1600c52335f525f6020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c925f80a2565b610765610c94565b61076e5f610ccb565b565b60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff7487392754905090565b60025481565b5f6107cc610c94565b60025460045f8154809291906107e19061151a565b91905055101580610838575060035f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff165b1561086f576040517f6247a84e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600160035f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff0219169083151502179055505f806108cf86610d91565b9150915060015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16633abb060483836040518363ffffffff1660e01b815260040161092f9291906116cf565b5f604051808303815f87803b158015610946575f80fd5b505af1158015610958573d5f803e3d5ffd5b505050506001925050509392505050565b6003602052805f5260405f205f915054906101000a900460ff1681565b5f6002546004541080156109e1575060035f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff16155b8015610a83575060015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e3f756de856040518263ffffffff1660e01b8152600401610a429190611727565b602060405180830381865afa158015610a5d573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a81919061177d565b155b90509392505050565b60045481565b610a9a610c94565b63389a75e1600c52805f526020600c208054421115610ac057636f5e88185f526004601cfd5b5f815550610acd81610ccb565b50565b610ad8610c94565b8060601b610aed57637448fbae5f526004601cfd5b610af681610ccb565b50565b5f63389a75e1600c52815f526020600c20549050919050565b5f7fa9216705000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610b845750610b8382610eb0565b5b9050919050565b5f6202a300905090565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffbf6011325f1b905090565b610bc6610f29565b15610c3e577fffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927805415610c0057630dc149f05f526004601cfd5b8160601b60601c9150811560ff1b82178155815f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a350610c91565b8060601b60601c9050807fffffffffffffffffffffffffffffffffffffffffffffffffffffffff7487392755805f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a35b50565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927543314610cc9576382b429005f526004601cfd5b565b610cd3610f29565b15610d38577fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739278160601b60601c91508181547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3811560ff1b8217815550610d8e565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739278160601b60601c91508181547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3818155505b50565b6060805f600167ffffffffffffffff811115610db057610daf611398565b5b604051908082528060200260200182016040528015610dde5781602001602082028036833780820191505090505b5090505f600167ffffffffffffffff811115610dfd57610dfc611398565b5b604051908082528060200260200182016040528015610e2b5781602001602082028036833780820191505090505b50905084825f81518110610e4257610e416117a8565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506001815f81518110610e9157610e906117a8565b5b6020026020010190151590811515815250508181935093505050915091565b5f7f6ab67a0d000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610f225750610f2182610f2d565b5b9050919050565b5f90565b5f7f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b5f604051905090565b5f80fd5b5f80fd5b5f7fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b610fdb81610fa7565b8114610fe5575f80fd5b50565b5f81359050610ff681610fd2565b92915050565b5f6020828403121561101157611010610f9f565b5b5f61101e84828501610fe8565b91505092915050565b5f8115159050919050565b61103b81611027565b82525050565b5f6020820190506110545f830184611032565b92915050565b5f819050919050565b61106c8161105a565b82525050565b5f6020820190506110855f830184611063565b92915050565b61109481610fa7565b82525050565b5f6020820190506110ad5f83018461108b565b92915050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6110dc826110b3565b9050919050565b6110ec816110d2565b82525050565b5f6020820190506111055f8301846110e3565b92915050565b5f80fd5b5f80fd5b5f80fd5b5f8083601f84011261112c5761112b61110b565b5b8235905067ffffffffffffffff8111156111495761114861110f565b5b60208301915083600182028301111561116557611164611113565b5b9250929050565b5f806020838503121561118257611181610f9f565b5b5f83013567ffffffffffffffff81111561119f5761119e610fa3565b5b6111ab85828601611117565b92509250509250929050565b5f6040820190506111ca5f830185611063565b6111d760208301846110e3565b9392505050565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f611220826111de565b61122a81856111e8565b935061123a8185602086016111f8565b61124381611206565b840191505092915050565b5f6020820190508181035f8301526112668184611216565b905092915050565b5f819050919050565b5f61129161128c611287846110b3565b61126e565b6110b3565b9050919050565b5f6112a282611277565b9050919050565b5f6112b382611298565b9050919050565b6112c3816112a9565b82525050565b5f6020820190506112dc5f8301846112ba565b92915050565b6112eb816110d2565b81146112f5575f80fd5b50565b5f81359050611306816112e2565b92915050565b5f805f6040848603121561132357611322610f9f565b5b5f611330868287016112f8565b935050602084013567ffffffffffffffff81111561135157611350610fa3565b5b61135d86828701611117565b92509250509250925092565b5f6020828403121561137e5761137d610f9f565b5b5f61138b848285016112f8565b91505092915050565b5f80fd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6113ce82611206565b810181811067ffffffffffffffff821117156113ed576113ec611398565b5b80604052505050565b5f6113ff610f96565b905061140b82826113c5565b919050565b5f61141a826110d2565b9050919050565b61142a81611410565b8114611434575f80fd5b50565b5f8135905061144581611421565b92915050565b6114548161105a565b811461145e575f80fd5b50565b5f8135905061146f8161144b565b92915050565b5f6040828403121561148a57611489611394565b5b61149460406113f6565b90505f6114a384828501611437565b5f8301525060206114b684828501611461565b60208301525092915050565b5f604082840312156114d7576114d6610f9f565b5b5f6114e484828501611475565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f6115248261105a565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203611556576115556114ed565b5b600182019050919050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b611593816110d2565b82525050565b5f6115a4838361158a565b60208301905092915050565b5f602082019050919050565b5f6115c682611561565b6115d0818561156b565b93506115db8361157b565b805f5b8381101561160b5781516115f28882611599565b97506115fd836115b0565b9250506001810190506115de565b5085935050505092915050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b61164a81611027565b82525050565b5f61165b8383611641565b60208301905092915050565b5f602082019050919050565b5f61167d82611618565b6116878185611622565b935061169283611632565b805f5b838110156116c25781516116a98882611650565b97506116b483611667565b925050600181019050611695565b5085935050505092915050565b5f6040820190508181035f8301526116e781856115bc565b905081810360208301526116fb8184611673565b90509392505050565b50565b5f6117125f836111e8565b915061171d82611704565b5f82019050919050565b5f60408201905061173a5f8301846110e3565b818103602083015261174b81611707565b905092915050565b61175c81611027565b8114611766575f80fd5b50565b5f8151905061177781611753565b92915050565b5f6020828403121561179257611791610f9f565b5b5f61179f84828501611769565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffdfea2646970667358221220935f4f4158c09791d7426626cfe654f31510f1ebb6755c8cb47532588b8661bf64736f6c634300081a0033", e = class e extends _ {
10
+ const P = "0x6080604052348015600e575f80fd5b50601b601f60201b60201c565b60b0565b5f602c608760201b60201c565b90508054600181161560455763f92ee8a95f526004601cfd5b8160c01c808260011c146082578060011b8355806020527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602080a15b505050565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffbf6011325f1b905090565b61180b806100bd5f395ff3fe608060405260043610610129575f3560e01c8063715018a6116100aa578063c884ef831161006e578063c884ef831461038a578063db09da12146103c6578063dcc59b6f14610402578063f04e283e1461042c578063f2fde38b14610448578063fee81cf41461046457610129565b8063715018a6146102c657806387b9d25c146102d05780638da5cb5b146102fa578063a4d66daf14610324578063bb1757cf1461034e57610129565b806338d52e0f116100f157806338d52e0f146101f1578063439fab911461021b578063474f5a44146102435780634e7165a21461028057806354d1f13d146102bc57610129565b806301ffc9a71461012d57806307621eca14610169578063228cb7331461019357806325692962146101bd57806328d6183b146101c7575b5f80fd5b348015610138575f80fd5b50610153600480360381019061014e9190610ffc565b6104a0565b6040516101609190611041565b60405180910390f35b348015610174575f80fd5b5061017d610519565b60405161018a9190611072565b60405180910390f35b34801561019e575f80fd5b506101a7610521565b6040516101b49190611072565b60405180910390f35b6101c5610526565b005b3480156101d2575f80fd5b506101db610577565b6040516101e8919061109a565b60405180910390f35b3480156101fc575f80fd5b5061020561059e565b60405161021291906110f2565b60405180910390f35b348015610226575f80fd5b50610241600480360381019061023c919061116c565b6105b9565b005b34801561024e575f80fd5b506102696004803603810190610264919061116c565b610699565b6040516102779291906111b7565b60405180910390f35b34801561028b575f80fd5b506102a660048036038101906102a1919061116c565b6106cd565b6040516102b3919061124e565b60405180910390f35b6102c4610724565b005b6102ce61075d565b005b3480156102db575f80fd5b506102e4610770565b6040516102f191906112c9565b60405180910390f35b348015610305575f80fd5b5061030e610795565b60405161031b91906110f2565b60405180910390f35b34801561032f575f80fd5b506103386107bd565b6040516103459190611072565b60405180910390f35b348015610359575f80fd5b50610374600480360381019061036f919061130c565b6107c3565b6040516103819190611041565b60405180910390f35b348015610395575f80fd5b506103b060048036038101906103ab9190611369565b610969565b6040516103bd9190611041565b60405180910390f35b3480156103d1575f80fd5b506103ec60048036038101906103e7919061130c565b610986565b6040516103f99190611041565b60405180910390f35b34801561040d575f80fd5b50610416610a8c565b6040516104239190611072565b60405180910390f35b61044660048036038101906104419190611369565b610a92565b005b610462600480360381019061045d9190611369565b610ad0565b005b34801561046f575f80fd5b5061048a60048036038101906104859190611369565b610af9565b6040516104979190611072565b60405180910390f35b5f7fc2c281ec000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610512575061051182610b12565b5b9050919050565b5f8054905090565b5f5481565b5f61052f610b8b565b67ffffffffffffffff164201905063389a75e1600c52335f52806020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d5f80a250565b5f7fc2c281ec00000000000000000000000000000000000000000000000000000000905090565b5f73deaddeaddeaddeaddeaddeaddeaddeaddeaddead905090565b5f6105c2610b95565b905080546003825580156105f45760018160011c14303b106105eb5763f92ee8a95f526004601cfd5b818160ff1b1b91505b505f838381019061060591906114c2565b905061061033610bbe565b805f015160015f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508060200151600281905550508015610694576002815560016020527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602080a15b505050565b5f806040517fd623472500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60605f67ffffffffffffffff8111156106e9576106e8611398565b5b6040519080825280601f01601f19166020018201604052801561071b5781602001600182028036833780820191505090505b50905092915050565b63389a75e1600c52335f525f6020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c925f80a2565b610765610c94565b61076e5f610ccb565b565b60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff7487392754905090565b60025481565b5f6107cc610c94565b60025460045f8154809291906107e19061151a565b91905055101580610838575060035f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff165b1561086f576040517f6247a84e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600160035f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff0219169083151502179055505f806108cf86610d91565b9150915060015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16633abb060483836040518363ffffffff1660e01b815260040161092f9291906116cf565b5f604051808303815f87803b158015610946575f80fd5b505af1158015610958573d5f803e3d5ffd5b505050506001925050509392505050565b6003602052805f5260405f205f915054906101000a900460ff1681565b5f6002546004541080156109e1575060035f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff16155b8015610a83575060015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e3f756de856040518263ffffffff1660e01b8152600401610a429190611727565b602060405180830381865afa158015610a5d573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a81919061177d565b155b90509392505050565b60045481565b610a9a610c94565b63389a75e1600c52805f526020600c208054421115610ac057636f5e88185f526004601cfd5b5f815550610acd81610ccb565b50565b610ad8610c94565b8060601b610aed57637448fbae5f526004601cfd5b610af681610ccb565b50565b5f63389a75e1600c52815f526020600c20549050919050565b5f7fa9216705000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610b845750610b8382610eb0565b5b9050919050565b5f6202a300905090565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffbf6011325f1b905090565b610bc6610f29565b15610c3e577fffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927805415610c0057630dc149f05f526004601cfd5b8160601b60601c9150811560ff1b82178155815f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a350610c91565b8060601b60601c9050807fffffffffffffffffffffffffffffffffffffffffffffffffffffffff7487392755805f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a35b50565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927543314610cc9576382b429005f526004601cfd5b565b610cd3610f29565b15610d38577fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739278160601b60601c91508181547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3811560ff1b8217815550610d8e565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739278160601b60601c91508181547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3818155505b50565b6060805f600167ffffffffffffffff811115610db057610daf611398565b5b604051908082528060200260200182016040528015610dde5781602001602082028036833780820191505090505b5090505f600167ffffffffffffffff811115610dfd57610dfc611398565b5b604051908082528060200260200182016040528015610e2b5781602001602082028036833780820191505090505b50905084825f81518110610e4257610e416117a8565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506001815f81518110610e9157610e906117a8565b5b6020026020010190151590811515815250508181935093505050915091565b5f7f6ab67a0d000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610f225750610f2182610f2d565b5b9050919050565b5f90565b5f7f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b5f604051905090565b5f80fd5b5f80fd5b5f7fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b610fdb81610fa7565b8114610fe5575f80fd5b50565b5f81359050610ff681610fd2565b92915050565b5f6020828403121561101157611010610f9f565b5b5f61101e84828501610fe8565b91505092915050565b5f8115159050919050565b61103b81611027565b82525050565b5f6020820190506110545f830184611032565b92915050565b5f819050919050565b61106c8161105a565b82525050565b5f6020820190506110855f830184611063565b92915050565b61109481610fa7565b82525050565b5f6020820190506110ad5f83018461108b565b92915050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6110dc826110b3565b9050919050565b6110ec816110d2565b82525050565b5f6020820190506111055f8301846110e3565b92915050565b5f80fd5b5f80fd5b5f80fd5b5f8083601f84011261112c5761112b61110b565b5b8235905067ffffffffffffffff8111156111495761114861110f565b5b60208301915083600182028301111561116557611164611113565b5b9250929050565b5f806020838503121561118257611181610f9f565b5b5f83013567ffffffffffffffff81111561119f5761119e610fa3565b5b6111ab85828601611117565b92509250509250929050565b5f6040820190506111ca5f830185611063565b6111d760208301846110e3565b9392505050565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f611220826111de565b61122a81856111e8565b935061123a8185602086016111f8565b61124381611206565b840191505092915050565b5f6020820190508181035f8301526112668184611216565b905092915050565b5f819050919050565b5f61129161128c611287846110b3565b61126e565b6110b3565b9050919050565b5f6112a282611277565b9050919050565b5f6112b382611298565b9050919050565b6112c3816112a9565b82525050565b5f6020820190506112dc5f8301846112ba565b92915050565b6112eb816110d2565b81146112f5575f80fd5b50565b5f81359050611306816112e2565b92915050565b5f805f6040848603121561132357611322610f9f565b5b5f611330868287016112f8565b935050602084013567ffffffffffffffff81111561135157611350610fa3565b5b61135d86828701611117565b92509250509250925092565b5f6020828403121561137e5761137d610f9f565b5b5f61138b848285016112f8565b91505092915050565b5f80fd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6113ce82611206565b810181811067ffffffffffffffff821117156113ed576113ec611398565b5b80604052505050565b5f6113ff610f96565b905061140b82826113c5565b919050565b5f61141a826110d2565b9050919050565b61142a81611410565b8114611434575f80fd5b50565b5f8135905061144581611421565b92915050565b6114548161105a565b811461145e575f80fd5b50565b5f8135905061146f8161144b565b92915050565b5f6040828403121561148a57611489611394565b5b61149460406113f6565b90505f6114a384828501611437565b5f8301525060206114b684828501611461565b60208301525092915050565b5f604082840312156114d7576114d6610f9f565b5b5f6114e484828501611475565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f6115248261105a565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203611556576115556114ed565b5b600182019050919050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b611593816110d2565b82525050565b5f6115a4838361158a565b60208301905092915050565b5f602082019050919050565b5f6115c682611561565b6115d0818561156b565b93506115db8361157b565b805f5b8381101561160b5781516115f28882611599565b97506115fd836115b0565b9250506001810190506115de565b5085935050505092915050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b61164a81611027565b82525050565b5f61165b8383611641565b60208301905092915050565b5f602082019050919050565b5f61167d82611618565b6116878185611622565b935061169283611632565b805f5b838110156116c25781516116a98882611650565b97506116b483611667565b925050600181019050611695565b5085935050505092915050565b5f6040820190508181035f8301526116e781856115bc565b905081810360208301526116fb8184611673565b90509392505050565b50565b5f6117125f836111e8565b915061171d82611704565b5f82019050919050565b5f60408201905061173a5f8301846110e3565b818103602083015261174b81611707565b905092915050565b61175c81611027565b8114611766575f80fd5b50565b5f8151905061177781611753565b92915050565b5f6020828403121561179257611791610f9f565b5b5f61179f84828501611769565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffdfea2646970667358221220935f4f4158c09791d7426626cfe654f31510f1ebb6755c8cb47532588b8661bf64736f6c634300081a0033", e = class e extends V {
11
11
  constructor() {
12
12
  super(...arguments), this.abi = c;
13
13
  }
@@ -20,7 +20,7 @@ const P = "0x6080604052348015600e575f80fd5b50601b601f60201b60201c565b60b0565b5f6
20
20
  * @returns {Promise<Address>}
21
21
  */
22
22
  async owner(f) {
23
- return await r(this._config, {
23
+ return await i(this._config, {
24
24
  address: this.assertValidAddress(),
25
25
  args: [],
26
26
  // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
@@ -36,7 +36,7 @@ const P = "0x6080604052348015600e575f80fd5b50601b601f60201b60201c565b60b0565b5f6
36
36
  * @returns {Promise<bigint>}
37
37
  */
38
38
  async claims(f) {
39
- return await n(this._config, {
39
+ return await r(this._config, {
40
40
  address: this.assertValidAddress(),
41
41
  args: [],
42
42
  // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
@@ -52,7 +52,7 @@ const P = "0x6080604052348015600e575f80fd5b50601b601f60201b60201c565b60b0565b5f6
52
52
  * @returns {Promise<bigint>}
53
53
  */
54
54
  async reward(f) {
55
- return await o(this._config, {
55
+ return await n(this._config, {
56
56
  address: this.assertValidAddress(),
57
57
  args: [],
58
58
  // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
@@ -69,7 +69,7 @@ const P = "0x6080604052348015600e575f80fd5b50601b601f60201b60201c565b60b0565b5f6
69
69
  * @returns {Promise<boolean>}
70
70
  */
71
71
  async claimed(f, b) {
72
- return await l(this._config, {
72
+ return await o(this._config, {
73
73
  address: this.assertValidAddress(),
74
74
  args: [f],
75
75
  // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
@@ -85,12 +85,12 @@ const P = "0x6080604052348015600e575f80fd5b50601b601f60201b60201c565b60b0565b5f6
85
85
  * @returns {Promise<SimpleAllowList>}
86
86
  */
87
87
  async allowList(f) {
88
- const b = await m(this._config, {
88
+ const b = await l(this._config, {
89
89
  address: this.assertValidAddress(),
90
90
  // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
91
91
  ...f
92
92
  });
93
- return new V(
93
+ return new A(
94
94
  { config: this._config, account: this._account },
95
95
  b
96
96
  );
@@ -104,7 +104,7 @@ const P = "0x6080604052348015600e575f80fd5b50601b601f60201b60201c565b60b0565b5f6
104
104
  * @returns {Promise<bigint>}
105
105
  */
106
106
  async limit(f) {
107
- return await h(this._config, {
107
+ return await m(this._config, {
108
108
  address: this.assertValidAddress(),
109
109
  // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
110
110
  ...f
@@ -132,17 +132,17 @@ const P = "0x6080604052348015600e575f80fd5b50601b601f60201b60201c565b60b0565b5f6
132
132
  * @returns {Promise<{ hash: `0x${string}`; result: boolean; }>} - return true if successful, otherwise revert
133
133
  */
134
134
  async claimRaw(f, b) {
135
- const { request: a, result: d } = await u(
135
+ const { request: a, result: d } = await h(
136
136
  this._config,
137
137
  {
138
138
  address: this.assertValidAddress(),
139
- args: [s(f)],
139
+ args: [_(f)],
140
140
  ...this.optionallyAttachAccount(),
141
141
  // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
142
142
  ...b
143
143
  }
144
144
  );
145
- return { hash: await g(this._config, a), result: d };
145
+ return { hash: await u(this._config, a), result: d };
146
146
  }
147
147
  /**
148
148
  * Check if an incentive is claimable
@@ -154,9 +154,9 @@ const P = "0x6080604052348015600e575f80fd5b50601b601f60201b60201c565b60b0565b5f6
154
154
  * @returns {Promise<boolean>} - True if the incentive is claimable based on the data payload
155
155
  */
156
156
  async isClaimable(f, b) {
157
- return await p(this._config, {
157
+ return await g(this._config, {
158
158
  address: this.assertValidAddress(),
159
- args: [s(f)],
159
+ args: [f.target, "0x"],
160
160
  // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
161
161
  ...b
162
162
  });
@@ -215,26 +215,26 @@ const P = "0x6080604052348015600e575f80fd5b50601b601f60201b60201c565b60b0565b5f6
215
215
  * @description This function returns `zeroHash` because AllowListIncentive doesn't use any specific claim data.
216
216
  */
217
217
  buildClaimData() {
218
- return y;
218
+ return p;
219
219
  }
220
220
  };
221
221
  e.bases = {
222
222
  31337: void 0,
223
- ...A
223
+ ...w
224
224
  }, e.registryType = C.INCENTIVE;
225
- let t = e;
225
+ let s = e;
226
226
  const R = ({
227
- allowList: i,
227
+ allowList: t,
228
228
  limit: f
229
- }) => w(
229
+ }) => y(
230
230
  [
231
231
  { type: "address", name: "allowList" },
232
232
  { type: "uint256", name: "limit" }
233
233
  ],
234
- [i, f]
234
+ [t, f]
235
235
  );
236
236
  export {
237
- t as AllowListIncentive,
237
+ s as AllowListIncentive,
238
238
  c as allowListIncentiveAbi,
239
239
  R as prepareAllowListIncentivePayload
240
240
  };
@@ -1 +1 @@
1
- {"version":3,"file":"AllowListIncentive.js","sources":["../../src/Incentives/AllowListIncentive.ts"],"sourcesContent":["import {\n allowListIncentiveAbi,\n readAllowListIncentiveAllowList,\n readAllowListIncentiveClaimed,\n readAllowListIncentiveClaims,\n readAllowListIncentiveIsClaimable,\n readAllowListIncentiveLimit,\n readAllowListIncentiveOwner,\n readAllowListIncentiveReward,\n simulateAllowListIncentiveClaim,\n writeAllowListIncentiveClaim,\n} from '@boostxyz/evm';\nimport { bytecode } from '@boostxyz/evm/artifacts/contracts/incentives/AllowListIncentive.sol/AllowListIncentive.json';\nimport {\n type Address,\n type ContractEventName,\n type Hex,\n encodeAbiParameters,\n zeroHash,\n} from 'viem';\nimport { AllowListIncentive as AllowListIncentiveBases } from '../../dist/deployments.json';\nimport { SimpleAllowList } from '../AllowLists/AllowList';\nimport type {\n DeployableOptions,\n GenericDeployableParams,\n} from '../Deployable/Deployable';\nimport { DeployableTarget } from '../Deployable/DeployableTarget';\nimport { type ClaimPayload, prepareClaimPayload } from '../claiming';\nimport {\n type GenericLog,\n type ReadParams,\n RegistryType,\n type WriteParams,\n} from '../utils';\n\nexport { allowListIncentiveAbi };\n\n/**\n * The object representation of a `AllowListIncentive.InitPayload`\n *\n * @export\n * @interface AllowListIncentivePayload\n * @typedef {AllowListIncentivePayload}\n */\nexport interface AllowListIncentivePayload {\n /**\n * The address to the allowlist to add claimers to.\n *\n * @type {Address}\n */\n allowList: Address;\n /**\n * The maximum number of claims that can be made (one per address)\n *\n * @type {bigint}\n */\n limit: bigint;\n}\n\n/**\n * A generic `viem.Log` event with support for `AllowListIncentive` event types.\n *\n * @export\n * @typedef {AllowListIncentiveLog}\n * @template {ContractEventName<\n * typeof allowListIncentiveAbi\n * >} [event=ContractEventName<typeof allowListIncentiveAbi>]\n */\nexport type AllowListIncentiveLog<\n event extends ContractEventName<\n typeof allowListIncentiveAbi\n > = ContractEventName<typeof allowListIncentiveAbi>,\n> = GenericLog<typeof allowListIncentiveAbi, event>;\n\n/**\n * An incentive implementation that grants the claimer a slot on an {SimpleAllowList}\n * In order for any claim to be successful:\n * - The claimer must not already be on the allow list; and\n * - The maximum number of claims must not have been reached; and\n * - This contract must be authorized to modify the allow list\n *\n * @export\n * @class AllowListIncentive\n * @typedef {AllowListIncentive}\n * @extends {DeployableTarget<AllowListIncentivePayload>}\n */\nexport class AllowListIncentive extends DeployableTarget<\n AllowListIncentivePayload,\n typeof allowListIncentiveAbi\n> {\n public override readonly abi = allowListIncentiveAbi;\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {Record<number, Address>}\n */\n public static override bases: Record<number, Address> = {\n 31337: import.meta.env.VITE_ALLOWLIST_INCENTIVE_BASE,\n ...(AllowListIncentiveBases as Record<number, Address>),\n };\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {RegistryType}\n */\n public static override registryType: RegistryType = RegistryType.INCENTIVE;\n\n /**\n * The owner of the allowList\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<Address>}\n */\n public async owner(params?: ReadParams) {\n return await readAllowListIncentiveOwner(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The number of claims that have been made\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async claims(params?: ReadParams) {\n return await readAllowListIncentiveClaims(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The reward amount issued for each claim\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async reward(params?: ReadParams) {\n return await readAllowListIncentiveReward(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Get the claim status for a user\n *\n * @public\n * @async\n * @param {Address} address\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>}\n */\n public async claimed(address: Address, params?: ReadParams) {\n return await readAllowListIncentiveClaimed(this._config, {\n address: this.assertValidAddress(),\n args: [address],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The {@link SimpleAllowList} contract\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<SimpleAllowList>}\n */\n public async allowList(params?: ReadParams): Promise<SimpleAllowList> {\n const address = await readAllowListIncentiveAllowList(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n return new SimpleAllowList(\n { config: this._config, account: this._account },\n address,\n );\n }\n\n /**\n * The maximum number of claims that can be made (one per address)\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async limit(params?: ReadParams) {\n return await readAllowListIncentiveLimit(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Claim a slot on the {@link SimpleAllowList}\n *\n * @public\n * @async\n * @param {Pick<ClaimPayload, 'target'>} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<true>} - return true if successful, otherwise revert\n */\n protected async claim(\n payload: Pick<ClaimPayload, 'target'>,\n params?: WriteParams,\n ) {\n return await this.awaitResult(this.claimRaw(payload, params));\n }\n\n /**\n * Claim a slot on the {@link SimpleAllowList}\n *\n * @public\n * @async\n * @param {Pick<ClaimPayload, 'target'>} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: boolean; }>} - return true if successful, otherwise revert\n */\n protected async claimRaw(\n payload: Pick<ClaimPayload, 'target'>,\n params?: WriteParams,\n ) {\n const { request, result } = await simulateAllowListIncentiveClaim(\n this._config,\n {\n address: this.assertValidAddress(),\n args: [prepareClaimPayload(payload)],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n },\n );\n const hash = await writeAllowListIncentiveClaim(this._config, request);\n return { hash, result };\n }\n\n /**\n * Check if an incentive is claimable\n *\n * @public\n * @async\n * @param {Pick<ClaimPayload, 'target'>} payload\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>} - True if the incentive is claimable based on the data payload\n */\n public async isClaimable(\n payload: Pick<ClaimPayload, 'target'>,\n params?: ReadParams,\n ) {\n return await readAllowListIncentiveIsClaimable(this._config, {\n address: this.assertValidAddress(),\n args: [prepareClaimPayload(payload)],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Check if an incentive can potentially be claimed by comparing limit and total claims. Does not take requesting user or underlying allowlist into account.\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>} - True if total claims is less than limit\n */\n public async canBeClaimed(params?: ReadParams) {\n return (await this.getRemainingClaimPotential(params)) > 0n;\n }\n\n /**\n * Check how many claims remain by comparing limit and total claims. Does not take requesting user or underlying allowlist into account.\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>} - True if total claims is less than limit\n */\n public async getRemainingClaimPotential(params?: ReadParams) {\n const [claims, limit] = await Promise.all([\n this.claims(params),\n this.limit(params),\n ]);\n return limit - claims;\n }\n\n /**\n * @inheritdoc\n *\n * @public\n * @param {?AllowListIncentivePayload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {GenericDeployableParams}\n */\n public override buildParameters(\n _payload?: AllowListIncentivePayload,\n _options?: DeployableOptions,\n ): GenericDeployableParams {\n const [payload, options] = this.validateDeploymentConfig(\n _payload,\n _options,\n );\n return {\n abi: allowListIncentiveAbi,\n bytecode: bytecode as Hex,\n args: [prepareAllowListIncentivePayload(payload)],\n ...this.optionallyAttachAccount(options.account),\n };\n }\n\n /**\n * Builds the claim data for the AllowListIncentive.\n *\n * @public\n * @returns {Hash} A `zeroHash`, as AllowListIncentive doesn't require specific claim data.\n * @description This function returns `zeroHash` because AllowListIncentive doesn't use any specific claim data.\n */\n public buildClaimData() {\n return zeroHash;\n }\n}\n\n/**\n * Given a {@link AllowListIncentivePayload}, properly encode a `AllowListIncentive.InitPayload` for use with {@link AllowListIncentive} initialization.\n *\n * @param {AllowListIncentivePayload} param0\n * @param {Address} param0.allowList - The address to the allowlist to add claimers to.\n * @param {bigint} param0.limit - The maximum number of claims that can be made (one per address)\n * @returns {Hex}\n */\nexport const prepareAllowListIncentivePayload = ({\n allowList,\n limit,\n}: AllowListIncentivePayload) => {\n return encodeAbiParameters(\n [\n { type: 'address', name: 'allowList' },\n { type: 'uint256', name: 'limit' },\n ],\n [allowList, limit],\n );\n};\n"],"names":["_AllowListIncentive","DeployableTarget","allowListIncentiveAbi","params","readAllowListIncentiveOwner","readAllowListIncentiveClaims","readAllowListIncentiveReward","address","readAllowListIncentiveClaimed","readAllowListIncentiveAllowList","SimpleAllowList","readAllowListIncentiveLimit","payload","request","result","simulateAllowListIncentiveClaim","prepareClaimPayload","writeAllowListIncentiveClaim","readAllowListIncentiveIsClaimable","claims","limit","_payload","_options","options","bytecode","prepareAllowListIncentivePayload","zeroHash","AllowListIncentiveBases","RegistryType","AllowListIncentive","allowList","encodeAbiParameters"],"mappings":";;;;;;;;;g6YAsFaA,IAAN,MAAMA,UAA2BC,EAGtC;AAAA,EAHK,cAAA;AAAA,UAAA,GAAA,SAAA,GAIL,KAAyB,MAAMC;AAAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA6B/B,MAAa,MAAMC,GAAqB;AAC/B,WAAA,MAAMC,EAA4B,KAAK,SAAS;AAAA,MACrD,SAAS,KAAK,mBAAmB;AAAA,MACjC,MAAM,CAAC;AAAA;AAAA,MAEP,GAAID;AAAA,IAAA,CACL;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,MAAa,OAAOA,GAAqB;AAChC,WAAA,MAAME,EAA6B,KAAK,SAAS;AAAA,MACtD,SAAS,KAAK,mBAAmB;AAAA,MACjC,MAAM,CAAC;AAAA;AAAA,MAEP,GAAIF;AAAA,IAAA,CACL;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,MAAa,OAAOA,GAAqB;AAChC,WAAA,MAAMG,EAA6B,KAAK,SAAS;AAAA,MACtD,SAAS,KAAK,mBAAmB;AAAA,MACjC,MAAM,CAAC;AAAA;AAAA,MAEP,GAAIH;AAAA,IAAA,CACL;AAAA,EACH;AAAA;AAA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,GAAI2B;AAAA,GASN3B,EAAuB,eAA6B4B,EAAa;AAvB5D,IAAMC,IAAN7B;AA0QA,MAAMyB,IAAmC,CAAC;AAAA,EAC/C,WAAAK;AAAA,EACA,OAAAV;AACF,MACSW;AAAA,EACL;AAAA,IACE,EAAE,MAAM,WAAW,MAAM,YAAY;AAAA,IACrC,EAAE,MAAM,WAAW,MAAM,QAAQ;AAAA,EACnC;AAAA,EACA,CAACD,GAAWV,CAAK;AAAA;"}
1
+ {"version":3,"file":"AllowListIncentive.js","sources":["../../src/Incentives/AllowListIncentive.ts"],"sourcesContent":["import {\n allowListIncentiveAbi,\n readAllowListIncentiveAllowList,\n readAllowListIncentiveClaimed,\n readAllowListIncentiveClaims,\n readAllowListIncentiveIsClaimable,\n readAllowListIncentiveLimit,\n readAllowListIncentiveOwner,\n readAllowListIncentiveReward,\n simulateAllowListIncentiveClaim,\n writeAllowListIncentiveClaim,\n} from '@boostxyz/evm';\nimport { bytecode } from '@boostxyz/evm/artifacts/contracts/incentives/AllowListIncentive.sol/AllowListIncentive.json';\nimport {\n type Address,\n type ContractEventName,\n type Hex,\n encodeAbiParameters,\n zeroHash,\n} from 'viem';\nimport { AllowListIncentive as AllowListIncentiveBases } from '../../dist/deployments.json';\nimport { SimpleAllowList } from '../AllowLists/AllowList';\nimport type {\n DeployableOptions,\n GenericDeployableParams,\n} from '../Deployable/Deployable';\nimport { DeployableTarget } from '../Deployable/DeployableTarget';\nimport { type ClaimPayload, prepareClaimPayload } from '../claiming';\nimport {\n type GenericLog,\n type ReadParams,\n RegistryType,\n type WriteParams,\n} from '../utils';\n\nexport { allowListIncentiveAbi };\n\n/**\n * The object representation of a `AllowListIncentive.InitPayload`\n *\n * @export\n * @interface AllowListIncentivePayload\n * @typedef {AllowListIncentivePayload}\n */\nexport interface AllowListIncentivePayload {\n /**\n * The address to the allowlist to add claimers to.\n *\n * @type {Address}\n */\n allowList: Address;\n /**\n * The maximum number of claims that can be made (one per address)\n *\n * @type {bigint}\n */\n limit: bigint;\n}\n\n/**\n * A generic `viem.Log` event with support for `AllowListIncentive` event types.\n *\n * @export\n * @typedef {AllowListIncentiveLog}\n * @template {ContractEventName<\n * typeof allowListIncentiveAbi\n * >} [event=ContractEventName<typeof allowListIncentiveAbi>]\n */\nexport type AllowListIncentiveLog<\n event extends ContractEventName<\n typeof allowListIncentiveAbi\n > = ContractEventName<typeof allowListIncentiveAbi>,\n> = GenericLog<typeof allowListIncentiveAbi, event>;\n\n/**\n * An incentive implementation that grants the claimer a slot on an {SimpleAllowList}\n * In order for any claim to be successful:\n * - The claimer must not already be on the allow list; and\n * - The maximum number of claims must not have been reached; and\n * - This contract must be authorized to modify the allow list\n *\n * @export\n * @class AllowListIncentive\n * @typedef {AllowListIncentive}\n * @extends {DeployableTarget<AllowListIncentivePayload>}\n */\nexport class AllowListIncentive extends DeployableTarget<\n AllowListIncentivePayload,\n typeof allowListIncentiveAbi\n> {\n public override readonly abi = allowListIncentiveAbi;\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {Record<number, Address>}\n */\n public static override bases: Record<number, Address> = {\n 31337: import.meta.env.VITE_ALLOWLIST_INCENTIVE_BASE,\n ...(AllowListIncentiveBases as Record<number, Address>),\n };\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {RegistryType}\n */\n public static override registryType: RegistryType = RegistryType.INCENTIVE;\n\n /**\n * The owner of the allowList\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<Address>}\n */\n public async owner(params?: ReadParams) {\n return await readAllowListIncentiveOwner(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The number of claims that have been made\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async claims(params?: ReadParams) {\n return await readAllowListIncentiveClaims(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The reward amount issued for each claim\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async reward(params?: ReadParams) {\n return await readAllowListIncentiveReward(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Get the claim status for a user\n *\n * @public\n * @async\n * @param {Address} address\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>}\n */\n public async claimed(address: Address, params?: ReadParams) {\n return await readAllowListIncentiveClaimed(this._config, {\n address: this.assertValidAddress(),\n args: [address],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The {@link SimpleAllowList} contract\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<SimpleAllowList>}\n */\n public async allowList(params?: ReadParams): Promise<SimpleAllowList> {\n const address = await readAllowListIncentiveAllowList(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n return new SimpleAllowList(\n { config: this._config, account: this._account },\n address,\n );\n }\n\n /**\n * The maximum number of claims that can be made (one per address)\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async limit(params?: ReadParams) {\n return await readAllowListIncentiveLimit(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Claim a slot on the {@link SimpleAllowList}\n *\n * @public\n * @async\n * @param {Pick<ClaimPayload, 'target'>} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<true>} - return true if successful, otherwise revert\n */\n protected async claim(\n payload: Pick<ClaimPayload, 'target'>,\n params?: WriteParams,\n ) {\n return await this.awaitResult(this.claimRaw(payload, params));\n }\n\n /**\n * Claim a slot on the {@link SimpleAllowList}\n *\n * @public\n * @async\n * @param {Pick<ClaimPayload, 'target'>} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: boolean; }>} - return true if successful, otherwise revert\n */\n protected async claimRaw(\n payload: Pick<ClaimPayload, 'target'>,\n params?: WriteParams,\n ) {\n const { request, result } = await simulateAllowListIncentiveClaim(\n this._config,\n {\n address: this.assertValidAddress(),\n args: [prepareClaimPayload(payload)],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n },\n );\n const hash = await writeAllowListIncentiveClaim(this._config, request);\n return { hash, result };\n }\n\n /**\n * Check if an incentive is claimable\n *\n * @public\n * @async\n * @param {Pick<ClaimPayload, 'target'>} payload\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>} - True if the incentive is claimable based on the data payload\n */\n public async isClaimable(\n payload: Pick<ClaimPayload, 'target'>,\n params?: ReadParams,\n ) {\n return await readAllowListIncentiveIsClaimable(this._config, {\n address: this.assertValidAddress(),\n args: [payload.target, '0x'],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Check if an incentive can potentially be claimed by comparing limit and total claims. Does not take requesting user or underlying allowlist into account.\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>} - True if total claims is less than limit\n */\n public async canBeClaimed(params?: ReadParams) {\n return (await this.getRemainingClaimPotential(params)) > 0n;\n }\n\n /**\n * Check how many claims remain by comparing limit and total claims. Does not take requesting user or underlying allowlist into account.\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>} - True if total claims is less than limit\n */\n public async getRemainingClaimPotential(params?: ReadParams) {\n const [claims, limit] = await Promise.all([\n this.claims(params),\n this.limit(params),\n ]);\n return limit - claims;\n }\n\n /**\n * @inheritdoc\n *\n * @public\n * @param {?AllowListIncentivePayload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {GenericDeployableParams}\n */\n public override buildParameters(\n _payload?: AllowListIncentivePayload,\n _options?: DeployableOptions,\n ): GenericDeployableParams {\n const [payload, options] = this.validateDeploymentConfig(\n _payload,\n _options,\n );\n return {\n abi: allowListIncentiveAbi,\n bytecode: bytecode as Hex,\n args: [prepareAllowListIncentivePayload(payload)],\n ...this.optionallyAttachAccount(options.account),\n };\n }\n\n /**\n * Builds the claim data for the AllowListIncentive.\n *\n * @public\n * @returns {Hash} A `zeroHash`, as AllowListIncentive doesn't require specific claim data.\n * @description This function returns `zeroHash` because AllowListIncentive doesn't use any specific claim data.\n */\n public buildClaimData() {\n return zeroHash;\n }\n}\n\n/**\n * Given a {@link AllowListIncentivePayload}, properly encode a `AllowListIncentive.InitPayload` for use with {@link AllowListIncentive} initialization.\n *\n * @param {AllowListIncentivePayload} param0\n * @param {Address} param0.allowList - The address to the allowlist to add claimers to.\n * @param {bigint} param0.limit - The maximum number of claims that can be made (one per address)\n * @returns {Hex}\n */\nexport const prepareAllowListIncentivePayload = ({\n allowList,\n limit,\n}: AllowListIncentivePayload) => {\n return encodeAbiParameters(\n [\n { type: 'address', name: 'allowList' },\n { type: 'uint256', name: 'limit' },\n ],\n [allowList, limit],\n );\n};\n"],"names":["_AllowListIncentive","DeployableTarget","allowListIncentiveAbi","params","readAllowListIncentiveOwner","readAllowListIncentiveClaims","readAllowListIncentiveReward","address","readAllowListIncentiveClaimed","readAllowListIncentiveAllowList","SimpleAllowList","readAllowListIncentiveLimit","payload","request","result","simulateAllowListIncentiveClaim","prepareClaimPayload","writeAllowListIncentiveClaim","readAllowListIncentiveIsClaimable","claims","limit","_payload","_options","options","bytecode","prepareAllowListIncentivePayload","zeroHash","AllowListIncentiveBases","RegistryType","AllowListIncentive","allowList","encodeAbiParameters"],"mappings":";;;;;;;;;g6YAsFaA,IAAN,MAAMA,UAA2BC,EAGtC;AAAA,EAHK,cAAA;AAAA,UAAA,GAAA,SAAA,GAIL,KAAyB,MAAMC;AAAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA6B/B,MAAa,MAAMC,GAAqB;AAC/B,WAAA,MAAMC,EAA4B,KAAK,SAAS;AAAA,MACrD,SAAS,KAAK,mBAAmB;AAAA,MACjC,MAAM,CAAC;AAAA;AAAA,MAEP,GAAID;AAAA,IAAA,CACL;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,MAAa,OAAOA,GAAqB;AAChC,WAAA,MAAME,EAA6B,KAAK,SAAS;AAAA,MACtD,SAAS,KAAK,mBAAmB;AAAA,MACjC,MAAM,CAAC;AAAA;AAAA,MAEP,GAAIF;AAAA,IAAA,CACL;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,MAAa,OAAOA,GAAqB;AAChC,WAAA,MAAMG,EAA6B,KAAK,SAAS;AAAA,MACtD,SAAS,KAAK,mBAAmB;AAAA,MACjC,MAAM,CAAC;AAAA;AAAA,MAEP,GAAIH;AAAA,IAAA,CACL;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,MAAa,QAAQI,GAAkBJ,GAAqB;AACnD,WAAA,MAAMK,EAA8B,KAAK,SAAS;AAAA,MACvD,SAAS,KAAK,mBAAmB;AAAA,MACjC,MAAM,CAACD,CAAO;AAAA;AAAA,MAEd,GAAIJ;AAAA,IAAA,CACL;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,MAAa,UAAUA,GAA+C;AACpE,U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perty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../generated-pNKCp_Ez.cjs"),r=require("viem"),u=require("../deployments-BDumesUK.cjs"),h=require("../Deployable/DeployableTarget.cjs"),s=require("../claiming.cjs"),n=require("../utils.cjs"),w="0x6080604052348015600e575f80fd5b50601b601f60201b60201c565b60b0565b5f602c608760201b60201c565b90508054600181161560455763f92ee8a95f526004601cfd5b8160c01c808260011c146082578060011b8355806020527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602080a15b505050565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffbf6011325f1b905090565b6127e1806100bd5f395ff3fe6080604052600436106101ed575f3560e01c806354d1f13d1161010c578063c884ef831161009f578063ec87621c1161006e578063ec87621c1461069d578063f04e283e146106c7578063f2fde38b146106e3578063fe9fbb80146106ff578063fee81cf41461073b576101ed565b8063c884ef83146105d3578063db09da121461060f578063dcc213611461064b578063dcc59b6f14610673576101ed565b80638da5cb5b116100db5780638da5cb5b1461051b578063bb1757cf14610545578063be4994f814610581578063c78da39a146105a9576101ed565b806354d1f13d146104b0578063715018a6146104ba57806375b238fc146104c457806375ef18d0146104ee576101ed565b80632de9480711610184578063474f5a4411610153578063474f5a44146103df5780634a4ee7b11461041c5780634e7165a214610438578063514e62fc14610474576101ed565b80632de948071461032957806338d52e0f146103655780634359d28a1461038f578063439fab91146103b7576101ed565b80631cd64df4116101c05780631cd64df41461028f578063228cb733146102cb57806325692962146102f557806328d6183b146102ff576101ed565b806301ffc9a7146101f157806307621eca1461022d578063183a4f6e146102575780631c10893f14610273575b5f80fd5b3480156101fc575f80fd5b5061021760048036038101906102129190611a38565b610777565b6040516102249190611a7d565b60405180910390f35b348015610238575f80fd5b506102416107f0565b60405161024e9190611aae565b60405180910390f35b610271600480360381019061026c9190611af1565b610899565b005b61028d60048036038101906102889190611b76565b6108a6565b005b34801561029a575f80fd5b506102b560048036038101906102b09190611b76565b6108bc565b6040516102c29190611a7d565b60405180910390f35b3480156102d6575f80fd5b506102df6108d2565b6040516102ec9190611aae565b60405180910390f35b6102fd6108d7565b005b34801561030a575f80fd5b50610313610928565b6040516103209190611bc3565b60405180910390f35b348015610334575f80fd5b5061034f600480360381019061034a9190611bdc565b61094f565b60405161035c9190611aae565b60405180910390f35b348015610370575f80fd5b50610379610968565b6040516103869190611c16565b60405180910390f35b34801561039a575f80fd5b506103b560048036038101906103b09190611ce5565b61098d565b005b3480156103c2575f80fd5b506103dd60048036038101906103d89190611db8565b610a9b565b005b3480156103ea575f80fd5b5061040560048036038101906104009190611db8565b610cce565b604051610413929190611e03565b60405180910390f35b61043660048036038101906104319190611b76565b610e20565b005b348015610443575f80fd5b5061045e60048036038101906104599190611db8565b610e36565b60405161046b9190611e9a565b60405180910390f35b34801561047f575f80fd5b5061049a60048036038101906104959190611b76565b610f06565b6040516104a79190611a7d565b60405180910390f35b6104b8610f1d565b005b6104c2610f56565b005b3480156104cf575f80fd5b506104d8610f69565b6040516104e59190611aae565b60405180910390f35b3480156104f9575f80fd5b50610502610f6e565b6040516105129493929190611eba565b60405180910390f35b348015610526575f80fd5b5061052f610f8b565b60405161053c9190611c16565b60405180910390f35b348015610550575f80fd5b5061056b60048036038101906105669190611efd565b610fb3565b6040516105789190611a7d565b60405180910390f35b34801561058c575f80fd5b506105a760048036038101906105a29190611faf565b61119e565b005b3480156105b4575f80fd5b506105bd611254565b6040516105ca9190611aae565b60405180910390f35b3480156105de575f80fd5b506105f960048036038101906105f49190611bdc565b61125a565b6040516106069190611a7d565b60405180910390f35b34801561061a575f80fd5b5061063560048036038101906106309190611efd565b611277565b6040516106429190611a7d565b60405180910390f35b348015610656575f80fd5b50610671600480360381019061066c9190611faf565b61128a565b005b34801561067e575f80fd5b50610687611340565b6040516106949190611aae565b60405180910390f35b3480156106a8575f80fd5b506106b1611346565b6040516106be9190611aae565b60405180910390f35b6106e160048036038101906106dc9190611bdc565b61134b565b005b6106fd60048036038101906106f89190611bdc565b611389565b005b34801561070a575f80fd5b5061072560048036038101906107209190611bdc565b6113b2565b6040516107329190611a7d565b60405180910390f35b348015610746575f80fd5b50610761600480360381019061075c9190611bdc565b611405565b60405161076e9190611aae565b60405180910390f35b5f7f53cf8555000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806107e957506107e88261141e565b5b9050919050565b5f80600280015442610802919061205a565b90505f61084f3060075f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661149790919063ffffffff16565b90505f610e1060026001015484610866919061208d565b61087091906120fb565b600260030154610880919061212b565b905081811161088f5780610891565b815b935050505090565b6108a333826114ca565b50565b6108ae6114d9565b6108b88282611510565b5050565b5f81826108c88561094f565b1614905092915050565b5f5481565b5f6108e0611520565b67ffffffffffffffff164201905063389a75e1600c52335f52806020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d5f80a250565b5f7f53cf855500000000000000000000000000000000000000000000000000000000905090565b5f638b78c6d8600c52815f526020600c20549050919050565b60075f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60026109988161152a565b8282905085859050146109d7576040517fff633a3800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5b85859050811015610a93575f8484838181106109f8576109f761215e565b5b9050602002016020810190610a0d91906121b5565b90506001151581151503610a5257610a4d878784818110610a3157610a3061215e565b5b9050602002016020810190610a469190611bdc565b6001611510565b610a85565b610a84878784818110610a6857610a6761215e565b5b9050602002016020810190610a7d9190611bdc565b60016114ca565b5b5080806001019150506109d9565b505050505050565b5f610aa461155f565b90508054600382558015610ad65760018160011c14303b10610acd5763f92ee8a95f526004601cfd5b818160ff1b1b91505b505f8383810190610ae791906122e9565b90505f610b1630835f015173ffffffffffffffffffffffffffffffffffffffff1661149790919063ffffffff16565b90508160800151811015610b6c57815f01518183608001516040517f5c54305e000000000000000000000000000000000000000000000000000000008152600401610b6393929190612314565b60405180910390fd5b5f82602001511480610b8157505f8260400151145b80610b8f57505f8260600151145b80610ba1575081602001518260800151105b15610bd8576040517ff92ee8a900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b815f015160075f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060405180608001604052808360400151815260200183606001518152602001428152602001836020015181525060025f820151815f01556020820151816001015560408201518160020155606082015181600301559050508160800151600681905550610c8733611588565b610c9233600161165e565b50508015610cc9576002815560016020527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602080a15b505050565b5f806001610cdb8161169f565b5f8585810190610ceb9190612462565b90505f8160200151806020019051810190610d0691906124bd565b9050610d57825f01518260075f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166116c69092919063ffffffff16565b815f015173ffffffffffffffffffffffffffffffffffffffff167f9ad2e7a4af16dceda9cce4274b2f59c328d8c012eb0e15eb5e1e73b7d8f264d360075f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16845f015184604051602001610dcb9392919061254d565b604051602081830303815290604052604051610de79190611e9a565b60405180910390a28060075f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16945094505050509250929050565b610e286114d9565b610e3282826114ca565b5050565b60605f8383810190610e4891906122e9565b9050604051806080016040528060016002811115610e6957610e68612589565b5b8152602001825f015173ffffffffffffffffffffffffffffffffffffffff1681526020013073ffffffffffffffffffffffffffffffffffffffff16815260200160405180602001604052808460800151815250604051602001610ecc91906125df565b604051602081830303815290604052815250604051602001610eee91906126f5565b60405160208183030381529060405291505092915050565b5f8082610f128561094f565b161415905092915050565b63389a75e1600c52335f525f6020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c925f80a2565b610f5e6114d9565b610f675f61170f565b565b600281565b6002805f0154908060010154908060020154908060030154905084565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff7487392754905090565b5f610fbc6114d9565b610fc5846117d5565b61100657836040517f4139d81d000000000000000000000000000000000000000000000000000000008152600401610ffd9190612738565b60405180910390fd5b6001805f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff02191690831515021790555060085f81548092919061106c90612764565b91905055505f61107a6107f0565b905042600280018190555060025f0154811161109a5760025f01546110ab565b60025f0154816110aa919061205a565b5b600260030181905550611100858260075f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166116c69092919063ffffffff16565b8473ffffffffffffffffffffffffffffffffffffffff167f9ad2e7a4af16dceda9cce4274b2f59c328d8c012eb0e15eb5e1e73b7d8f264d360075f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16878460405160200161116e9392919061254d565b60405160208183030381529060405260405161118a9190611e9a565b60405180910390a260019150509392505050565b60026111a98161152a565b8282905085859050146111e8576040517fff633a3800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5b8585905081101561124c5761123f86868381811061120b5761120a61215e565b5b90506020020160208101906112209190611bdc565b8585848181106112335761123261215e565b5b90506020020135611510565b80806001019150506111ea565b505050505050565b60065481565b6001602052805f5260405f205f915054906101000a900460ff1681565b5f611281846117d5565b90509392505050565b60026112958161152a565b8282905085859050146112d4576040517fff633a3800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5b858590508110156113385761132b8686838181106112f7576112f661215e565b5b905060200201602081019061130c9190611bdc565b85858481811061131f5761131e61215e565b5b905060200201356114ca565b80806001019150506112d6565b505050505050565b60085481565b600181565b6113536114d9565b63389a75e1600c52805f526020600c20805442111561137957636f5e88185f526004601cfd5b5f8155506113868161170f565b50565b6113916114d9565b8060601b6113a657637448fbae5f526004601cfd5b6113af8161170f565b50565b5f8173ffffffffffffffffffffffffffffffffffffffff166113d2610f8b565b73ffffffffffffffffffffffffffffffffffffffff1614806113fe57506113fd826002600117610f06565b5b9050919050565b5f63389a75e1600c52815f526020600c20549050919050565b5f7fa9216705000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480611490575061148f82611894565b5b9050919050565b5f816014526f70a082310000000000000000000000005f5260208060246010865afa601f3d111660205102905092915050565b6114d582825f61190d565b5050565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff7487392754331461150e576382b429005f526004601cfd5b565b61151c8282600161190d565b5050565b5f6202a300905090565b638b78c6d81954331461155c57638b78c6d8600c52335f52806020600c20541661155b576382b429005f526004601cfd5b5b50565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffbf6011325f1b905090565b611590611965565b15611608577fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739278054156115ca57630dc149f05f526004601cfd5b8160601b60601c9150811560ff1b82178155815f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a35061165b565b8060601b60601c9050807fffffffffffffffffffffffffffffffffffffffffffffffffffffffff7487392755805f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a35b50565b638b78c6d8600c52815f52806020600c205580600c5160601c7f715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe265f80a35050565b638b78c6d8600c52335f52806020600c2054166116c3576382b429005f526004601cfd5b50565b81601452806034526fa9059cbb0000000000000000000000005f5260205f604460105f875af13d1560015f51141716611706576390b8ec185f526004601cfd5b5f603452505050565b611717611965565b1561177c577fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739278160601b60601c91508181547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3811560ff1b82178155506117d2565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739278160601b60601c91508181547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3818155505b50565b5f806117df6107f0565b90505f811180156118395750806118363060075f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661149790919063ffffffff16565b10155b801561188c575060015f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff16155b915050919050565b5f7f6ab67a0d000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480611906575061190582611969565b5b9050919050565b638b78c6d8600c52825f526020600c2080548381178361192f57848216821890505b80835580600c5160601c7f715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe265f80a3505050505050565b5f90565b5f7f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b5f604051905090565b5f80fd5b5f80fd5b5f7fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b611a17816119e3565b8114611a21575f80fd5b50565b5f81359050611a3281611a0e565b92915050565b5f60208284031215611a4d57611a4c6119db565b5b5f611a5a84828501611a24565b91505092915050565b5f8115159050919050565b611a7781611a63565b82525050565b5f602082019050611a905f830184611a6e565b92915050565b5f819050919050565b611aa881611a96565b82525050565b5f602082019050611ac15f830184611a9f565b92915050565b611ad081611a96565b8114611ada575f80fd5b50565b5f81359050611aeb81611ac7565b92915050565b5f60208284031215611b0657611b056119db565b5b5f611b1384828501611add565b91505092915050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f611b4582611b1c565b9050919050565b611b5581611b3b565b8114611b5f575f80fd5b50565b5f81359050611b7081611b4c565b92915050565b5f8060408385031215611b8c57611b8b6119db565b5b5f611b9985828601611b62565b9250506020611baa85828601611add565b9150509250929050565b611bbd816119e3565b82525050565b5f602082019050611bd65f830184611bb4565b92915050565b5f60208284031215611bf157611bf06119db565b5b5f611bfe84828501611b62565b91505092915050565b611c1081611b3b565b82525050565b5f602082019050611c295f830184611c07565b92915050565b5f80fd5b5f80fd5b5f80fd5b5f8083601f840112611c5057611c4f611c2f565b5b8235905067ffffffffffffffff811115611c6d57611c6c611c33565b5b602083019150836020820283011115611c8957611c88611c37565b5b9250929050565b5f8083601f840112611ca557611ca4611c2f565b5b8235905067ffffffffffffffff811115611cc257611cc1611c33565b5b602083019150836020820283011115611cde57611cdd611c37565b5b9250929050565b5f805f8060408587031215611cfd57611cfc6119db565b5b5f85013567ffffffffffffffff811115611d1a57611d196119df565b5b611d2687828801611c3b565b9450945050602085013567ffffffffffffffff811115611d4957611d486119df565b5b611d5587828801611c90565b925092505092959194509250565b5f8083601f840112611d7857611d77611c2f565b5b8235905067ffffffffffffffff811115611d9557611d94611c33565b5b602083019150836001820283011115611db157611db0611c37565b5b9250929050565b5f8060208385031215611dce57611dcd6119db565b5b5f83013567ffffffffffffffff811115611deb57611dea6119df565b5b611df785828601611d63565b92509250509250929050565b5f604082019050611e165f830185611a9f565b611e236020830184611c07565b9392505050565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f611e6c82611e2a565b611e768185611e34565b9350611e86818560208601611e44565b611e8f81611e52565b840191505092915050565b5f6020820190508181035f830152611eb28184611e62565b905092915050565b5f608082019050611ecd5f830187611a9f565b611eda6020830186611a9f565b611ee76040830185611a9f565b611ef46060830184611a9f565b95945050505050565b5f805f60408486031215611f1457611f136119db565b5b5f611f2186828701611b62565b935050602084013567ffffffffffffffff811115611f4257611f416119df565b5b611f4e86828701611d63565b92509250509250925092565b5f8083601f840112611f6f57611f6e611c2f565b5b8235905067ffffffffffffffff811115611f8c57611f8b611c33565b5b602083019150836020820283011115611fa857611fa7611c37565b5b9250929050565b5f805f8060408587031215611fc757611fc66119db565b5b5f85013567ffffffffffffffff811115611fe457611fe36119df565b5b611ff087828801611c3b565b9450945050602085013567ffffffffffffffff811115612013576120126119df565b5b61201f87828801611f5a565b925092505092959194509250565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f61206482611a96565b915061206f83611a96565b92508282039050818111156120875761208661202d565b5b92915050565b5f61209782611a96565b91506120a283611a96565b92508282026120b081611a96565b915082820484148315176120c7576120c661202d565b5b5092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f61210582611a96565b915061211083611a96565b9250826121205761211f6120ce565b5b828204905092915050565b5f61213582611a96565b915061214083611a96565b92508282019050808211156121585761215761202d565b5b92915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b61219481611a63565b811461219e575f80fd5b50565b5f813590506121af8161218b565b92915050565b5f602082840312156121ca576121c96119db565b5b5f6121d7848285016121a1565b91505092915050565b5f80fd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b61221a82611e52565b810181811067ffffffffffffffff82111715612239576122386121e4565b5b80604052505050565b5f61224b6119d2565b90506122578282612211565b919050565b5f80fd5b5f60a08284031215612275576122746121e0565b5b61227f60a0612242565b90505f61228e84828501611b62565b5f8301525060206122a184828501611add565b60208301525060406122b584828501611add565b60408301525060606122c984828501611add565b60608301525060806122dd84828501611add565b60808301525092915050565b5f60a082840312156122fe576122fd6119db565b5b5f61230b84828501612260565b91505092915050565b5f6060820190506123275f830186611c07565b6123346020830185611a9f565b6123416040830184611a9f565b949350505050565b5f80fd5b5f67ffffffffffffffff821115612367576123666121e4565b5b61237082611e52565b9050602081019050919050565b828183375f83830152505050565b5f61239d6123988461234d565b612242565b9050828152602081018484840111156123b9576123b8612349565b5b6123c484828561237d565b509392505050565b5f82601f8301126123e0576123df611c2f565b5b81356123f084826020860161238b565b91505092915050565b5f6040828403121561240e5761240d6121e0565b5b6124186040612242565b90505f61242784828501611b62565b5f83015250602082013567ffffffffffffffff81111561244a5761244961225c565b5b612456848285016123cc565b60208301525092915050565b5f60208284031215612477576124766119db565b5b5f82013567ffffffffffffffff811115612494576124936119df565b5b6124a0848285016123f9565b91505092915050565b5f815190506124b781611ac7565b92915050565b5f602082840312156124d2576124d16119db565b5b5f6124df848285016124a9565b91505092915050565b5f8160601b9050919050565b5f6124fe826124e8565b9050919050565b5f61250f826124f4565b9050919050565b61252761252282611b3b565b612505565b82525050565b5f819050919050565b61254761254282611a96565b61252d565b82525050565b5f6125588286612516565b6014820191506125688285612516565b6014820191506125788284612536565b602082019150819050949350505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffd5b6125bf81611a96565b82525050565b602082015f8201516125d95f8501826125b6565b50505050565b5f6020820190506125f25f8301846125c5565b92915050565b6003811061260957612608612589565b5b50565b5f819050612619826125f8565b919050565b5f6126288261260c565b9050919050565b6126388161261e565b82525050565b61264781611b3b565b82525050565b5f82825260208201905092915050565b5f61266782611e2a565b612671818561264d565b9350612681818560208601611e44565b61268a81611e52565b840191505092915050565b5f608083015f8301516126aa5f86018261262f565b5060208301516126bd602086018261263e565b5060408301516126d0604086018261263e565b50606083015184820360608601526126e8828261265d565b9150508091505092915050565b5f6020820190508181035f83015261270d8184612695565b905092915050565b50565b5f6127235f83611e34565b915061272e82612715565b5f82019050919050565b5f60408201905061274b5f830184611c07565b818103602083015261275c81612718565b905092915050565b5f61276e82611a96565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036127a05761279f61202d565b5b60018201905091905056fea264697066735822122032a0f80ce305faf6ce99031f2dace67ca68969c5c50f184662e2f869aaaa447964736f6c634300081a0033",c=class c extends h.DeployableTarget{constructor(){super(...arguments),this.abi=a.w}async owner(f){return await a.Zv(this._config,{address:this.assertValidAddress(),args:[],...f})}async claims(f){return await a._v(this._config,{address:this.assertValidAddress(),args:[],...f})}async reward(f){return await a.Qv(this._config,{address:this.assertValidAddress(),args:[],...f})}async claimed(f,b){return await a.kv(this._config,{address:this.assertValidAddress(),args:[f],...b})}async asset(f){return await a.Fv(this._config,{address:this.assertValidAddress(),...f})}async cgdaParams(f){const[b,e,d,t]=await a.Lv(this._config,{address:this.assertValidAddress(),...f});return{rewardDecay:b,rewardBoost:e,lastClaimTime:d,currentReward:t}}async totalBudget(f){return await a.Xv(this._config,{address:this.assertValidAddress(),...f})}async claim(f,b){return await this.awaitResult(this.claimRaw(f,b))}async claimRaw(f,b){const{request:e,result:d}=await a.fw(this._config,{address:this.assertValidAddress(),args:[s.prepareClaimPayload(f)],...this.optionallyAttachAccount(),...b});return{hash:await a.tw(this._config,e),result:d}}async clawback(f,b){return await this.awaitResult(this.clawbackRaw(f,b))}async clawbackRaw(f,b){const{request:e,result:d}=await a.vw(this._config,{address:this.assertValidAddress(),args:[s.prepareClaimPayload(f)],...this.optionallyAttachAccount(),...b});return{hash:await a.nw(this._config,e),result:d}}async isClaimable(f,b){return await a.Wv(this._config,{address:this.assertValidAddress(),args:[s.prepareClaimPayload(f)],...b})}async canBeClaimed(f){return await this.getRemainingClaimPotential(f)>0n}async getRemainingClaimPotential(f){const[b,e]=await Promise.all([this.currentReward(f),n.getErc20Balance(this._config,await this.asset(),this.assertValidAddress(),f)]);return e-b}async currentReward(f){return await a.Dv(this._config,{address:this.assertValidAddress(),...f})}async getTotalBudget(f){var b;return((b=this.payload)==null?void 0:b.totalBudget)!==void 0?this.payload.totalBudget:await this.totalBudget(f)}buildParameters(f,b){const[e,d]=this.validateDeploymentConfig(f,b);return{abi:a.w,bytecode:w,args:[l(e)],...this.optionallyAttachAccount(d.account)}}buildClawbackData(f){return r.encodeAbiParameters([{type:"uint256"}],[f])}buildClaimData(){return r.zeroHash}};c.bases={31337:void 0,...u.CGDAIncentive},c.registryType=n.RegistryType.INCENTIVE;let i=c;function l({asset:o,initialReward:f,rewardDecay:b,rewardBoost:e,totalBudget:d}){return r.encodeAbiParameters([{type:"address",name:"asset"},{type:"uint256",name:"initialReward"},{type:"uint256",name:"rewardDecay"},{type:"uint256",name:"rewardBoost"},{type:"uint256",name:"totalBudget"}],[o,f,b,e,d])}exports.cgdaIncentiveAbi=a.w;exports.CGDAIncentive=i;exports.prepareCGDAIncentivePayload=l;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../generated-CgBgbMNe.cjs"),s=require("viem"),u=require("../deployments-BucJ-gwk.cjs"),h=require("../Deployable/DeployableTarget.cjs"),i=require("../claiming.cjs"),n=require("../utils.cjs"),g="0x6080604052348015600e575f80fd5b50601b601f60201b60201c565b60b0565b5f602c608760201b60201c565b90508054600181161560455763f92ee8a95f526004601cfd5b8160c01c808260011c146082578060011b8355806020527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602080a15b505050565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffbf6011325f1b905090565b6127e1806100bd5f395ff3fe6080604052600436106101ed575f3560e01c806354d1f13d1161010c578063c884ef831161009f578063ec87621c1161006e578063ec87621c1461069d578063f04e283e146106c7578063f2fde38b146106e3578063fe9fbb80146106ff578063fee81cf41461073b576101ed565b8063c884ef83146105d3578063db09da121461060f578063dcc213611461064b578063dcc59b6f14610673576101ed565b80638da5cb5b116100db5780638da5cb5b1461051b578063bb1757cf14610545578063be4994f814610581578063c78da39a146105a9576101ed565b806354d1f13d146104b0578063715018a6146104ba57806375b238fc146104c457806375ef18d0146104ee576101ed565b80632de9480711610184578063474f5a4411610153578063474f5a44146103df5780634a4ee7b11461041c5780634e7165a214610438578063514e62fc14610474576101ed565b80632de948071461032957806338d52e0f146103655780634359d28a1461038f578063439fab91146103b7576101ed565b80631cd64df4116101c05780631cd64df41461028f578063228cb733146102cb57806325692962146102f557806328d6183b146102ff576101ed565b806301ffc9a7146101f157806307621eca1461022d578063183a4f6e146102575780631c10893f14610273575b5f80fd5b3480156101fc575f80fd5b5061021760048036038101906102129190611a38565b610777565b6040516102249190611a7d565b60405180910390f35b348015610238575f80fd5b506102416107f0565b60405161024e9190611aae565b60405180910390f35b610271600480360381019061026c9190611af1565b610899565b005b61028d60048036038101906102889190611b76565b6108a6565b005b34801561029a575f80fd5b506102b560048036038101906102b09190611b76565b6108bc565b6040516102c29190611a7d565b60405180910390f35b3480156102d6575f80fd5b506102df6108d2565b6040516102ec9190611aae565b60405180910390f35b6102fd6108d7565b005b34801561030a575f80fd5b50610313610928565b6040516103209190611bc3565b60405180910390f35b348015610334575f80fd5b5061034f600480360381019061034a9190611bdc565b61094f565b60405161035c9190611aae565b60405180910390f35b348015610370575f80fd5b50610379610968565b6040516103869190611c16565b60405180910390f35b34801561039a575f80fd5b506103b560048036038101906103b09190611ce5565b61098d565b005b3480156103c2575f80fd5b506103dd60048036038101906103d89190611db8565b610a9b565b005b3480156103ea575f80fd5b5061040560048036038101906104009190611db8565b610cce565b604051610413929190611e03565b60405180910390f35b61043660048036038101906104319190611b76565b610e20565b005b348015610443575f80fd5b5061045e60048036038101906104599190611db8565b610e36565b60405161046b9190611e9a565b60405180910390f35b34801561047f575f80fd5b5061049a60048036038101906104959190611b76565b610f06565b6040516104a79190611a7d565b60405180910390f35b6104b8610f1d565b005b6104c2610f56565b005b3480156104cf575f80fd5b506104d8610f69565b6040516104e59190611aae565b60405180910390f35b3480156104f9575f80fd5b50610502610f6e565b6040516105129493929190611eba565b60405180910390f35b348015610526575f80fd5b5061052f610f8b565b60405161053c9190611c16565b60405180910390f35b348015610550575f80fd5b5061056b60048036038101906105669190611efd565b610fb3565b6040516105789190611a7d565b60405180910390f35b34801561058c575f80fd5b506105a760048036038101906105a29190611faf565b61119e565b005b3480156105b4575f80fd5b506105bd611254565b6040516105ca9190611aae565b60405180910390f35b3480156105de575f80fd5b506105f960048036038101906105f49190611bdc565b61125a565b6040516106069190611a7d565b60405180910390f35b34801561061a575f80fd5b5061063560048036038101906106309190611efd565b611277565b6040516106429190611a7d565b60405180910390f35b348015610656575f80fd5b50610671600480360381019061066c9190611faf565b61128a565b005b34801561067e575f80fd5b50610687611340565b6040516106949190611aae565b60405180910390f35b3480156106a8575f80fd5b506106b1611346565b6040516106be9190611aae565b60405180910390f35b6106e160048036038101906106dc9190611bdc565b61134b565b005b6106fd60048036038101906106f89190611bdc565b611389565b005b34801561070a575f80fd5b5061072560048036038101906107209190611bdc565b6113b2565b6040516107329190611a7d565b60405180910390f35b348015610746575f80fd5b50610761600480360381019061075c9190611bdc565b611405565b60405161076e9190611aae565b60405180910390f35b5f7f53cf8555000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806107e957506107e88261141e565b5b9050919050565b5f80600280015442610802919061205a565b90505f61084f3060075f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661149790919063ffffffff16565b90505f610e1060026001015484610866919061208d565b61087091906120fb565b600260030154610880919061212b565b905081811161088f5780610891565b815b935050505090565b6108a333826114ca565b50565b6108ae6114d9565b6108b88282611510565b5050565b5f81826108c88561094f565b1614905092915050565b5f5481565b5f6108e0611520565b67ffffffffffffffff164201905063389a75e1600c52335f52806020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d5f80a250565b5f7f53cf855500000000000000000000000000000000000000000000000000000000905090565b5f638b78c6d8600c52815f526020600c20549050919050565b60075f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60026109988161152a565b8282905085859050146109d7576040517fff633a3800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5b85859050811015610a93575f8484838181106109f8576109f761215e565b5b9050602002016020810190610a0d91906121b5565b90506001151581151503610a5257610a4d878784818110610a3157610a3061215e565b5b9050602002016020810190610a469190611bdc565b6001611510565b610a85565b610a84878784818110610a6857610a6761215e565b5b9050602002016020810190610a7d9190611bdc565b60016114ca565b5b5080806001019150506109d9565b505050505050565b5f610aa461155f565b90508054600382558015610ad65760018160011c14303b10610acd5763f92ee8a95f526004601cfd5b818160ff1b1b91505b505f8383810190610ae791906122e9565b90505f610b1630835f015173ffffffffffffffffffffffffffffffffffffffff1661149790919063ffffffff16565b90508160800151811015610b6c57815f01518183608001516040517f5c54305e000000000000000000000000000000000000000000000000000000008152600401610b6393929190612314565b60405180910390fd5b5f82602001511480610b8157505f8260400151145b80610b8f57505f8260600151145b80610ba1575081602001518260800151105b15610bd8576040517ff92ee8a900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b815f015160075f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060405180608001604052808360400151815260200183606001518152602001428152602001836020015181525060025f820151815f01556020820151816001015560408201518160020155606082015181600301559050508160800151600681905550610c8733611588565b610c9233600161165e565b50508015610cc9576002815560016020527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602080a15b505050565b5f806001610cdb8161169f565b5f8585810190610ceb9190612462565b90505f8160200151806020019051810190610d0691906124bd565b9050610d57825f01518260075f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166116c69092919063ffffffff16565b815f015173ffffffffffffffffffffffffffffffffffffffff167f9ad2e7a4af16dceda9cce4274b2f59c328d8c012eb0e15eb5e1e73b7d8f264d360075f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16845f015184604051602001610dcb9392919061254d565b604051602081830303815290604052604051610de79190611e9a565b60405180910390a28060075f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16945094505050509250929050565b610e286114d9565b610e3282826114ca565b5050565b60605f8383810190610e4891906122e9565b9050604051806080016040528060016002811115610e6957610e68612589565b5b8152602001825f015173ffffffffffffffffffffffffffffffffffffffff1681526020013073ffffffffffffffffffffffffffffffffffffffff16815260200160405180602001604052808460800151815250604051602001610ecc91906125df565b604051602081830303815290604052815250604051602001610eee91906126f5565b60405160208183030381529060405291505092915050565b5f8082610f128561094f565b161415905092915050565b63389a75e1600c52335f525f6020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c925f80a2565b610f5e6114d9565b610f675f61170f565b565b600281565b6002805f0154908060010154908060020154908060030154905084565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff7487392754905090565b5f610fbc6114d9565b610fc5846117d5565b61100657836040517f4139d81d000000000000000000000000000000000000000000000000000000008152600401610ffd9190612738565b60405180910390fd5b6001805f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff02191690831515021790555060085f81548092919061106c90612764565b91905055505f61107a6107f0565b905042600280018190555060025f0154811161109a5760025f01546110ab565b60025f0154816110aa919061205a565b5b600260030181905550611100858260075f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166116c69092919063ffffffff16565b8473ffffffffffffffffffffffffffffffffffffffff167f9ad2e7a4af16dceda9cce4274b2f59c328d8c012eb0e15eb5e1e73b7d8f264d360075f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16878460405160200161116e9392919061254d565b60405160208183030381529060405260405161118a9190611e9a565b60405180910390a260019150509392505050565b60026111a98161152a565b8282905085859050146111e8576040517fff633a3800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5b8585905081101561124c5761123f86868381811061120b5761120a61215e565b5b90506020020160208101906112209190611bdc565b8585848181106112335761123261215e565b5b90506020020135611510565b80806001019150506111ea565b505050505050565b60065481565b6001602052805f5260405f205f915054906101000a900460ff1681565b5f611281846117d5565b90509392505050565b60026112958161152a565b8282905085859050146112d4576040517fff633a3800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5b858590508110156113385761132b8686838181106112f7576112f661215e565b5b905060200201602081019061130c9190611bdc565b85858481811061131f5761131e61215e565b5b905060200201356114ca565b80806001019150506112d6565b505050505050565b60085481565b600181565b6113536114d9565b63389a75e1600c52805f526020600c20805442111561137957636f5e88185f526004601cfd5b5f8155506113868161170f565b50565b6113916114d9565b8060601b6113a657637448fbae5f526004601cfd5b6113af8161170f565b50565b5f8173ffffffffffffffffffffffffffffffffffffffff166113d2610f8b565b73ffffffffffffffffffffffffffffffffffffffff1614806113fe57506113fd826002600117610f06565b5b9050919050565b5f63389a75e1600c52815f526020600c20549050919050565b5f7fa9216705000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480611490575061148f82611894565b5b9050919050565b5f816014526f70a082310000000000000000000000005f5260208060246010865afa601f3d111660205102905092915050565b6114d582825f61190d565b5050565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff7487392754331461150e576382b429005f526004601cfd5b565b61151c8282600161190d565b5050565b5f6202a300905090565b638b78c6d81954331461155c57638b78c6d8600c52335f52806020600c20541661155b576382b429005f526004601cfd5b5b50565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffbf6011325f1b905090565b611590611965565b15611608577fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739278054156115ca57630dc149f05f526004601cfd5b8160601b60601c9150811560ff1b82178155815f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a35061165b565b8060601b60601c9050807fffffffffffffffffffffffffffffffffffffffffffffffffffffffff7487392755805f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a35b50565b638b78c6d8600c52815f52806020600c205580600c5160601c7f715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe265f80a35050565b638b78c6d8600c52335f52806020600c2054166116c3576382b429005f526004601cfd5b50565b81601452806034526fa9059cbb0000000000000000000000005f5260205f604460105f875af13d1560015f51141716611706576390b8ec185f526004601cfd5b5f603452505050565b611717611965565b1561177c577fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739278160601b60601c91508181547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3811560ff1b82178155506117d2565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739278160601b60601c91508181547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3818155505b50565b5f806117df6107f0565b90505f811180156118395750806118363060075f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661149790919063ffffffff16565b10155b801561188c575060015f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff16155b915050919050565b5f7f6ab67a0d000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480611906575061190582611969565b5b9050919050565b638b78c6d8600c52825f526020600c2080548381178361192f57848216821890505b80835580600c5160601c7f715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe265f80a3505050505050565b5f90565b5f7f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b5f604051905090565b5f80fd5b5f80fd5b5f7fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b611a17816119e3565b8114611a21575f80fd5b50565b5f81359050611a3281611a0e565b92915050565b5f60208284031215611a4d57611a4c6119db565b5b5f611a5a84828501611a24565b91505092915050565b5f8115159050919050565b611a7781611a63565b82525050565b5f602082019050611a905f830184611a6e565b92915050565b5f819050919050565b611aa881611a96565b82525050565b5f602082019050611ac15f830184611a9f565b92915050565b611ad081611a96565b8114611ada575f80fd5b50565b5f81359050611aeb81611ac7565b92915050565b5f60208284031215611b0657611b056119db565b5b5f611b1384828501611add565b91505092915050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f611b4582611b1c565b9050919050565b611b5581611b3b565b8114611b5f575f80fd5b50565b5f81359050611b7081611b4c565b92915050565b5f8060408385031215611b8c57611b8b6119db565b5b5f611b9985828601611b62565b9250506020611baa85828601611add565b9150509250929050565b611bbd816119e3565b82525050565b5f602082019050611bd65f830184611bb4565b92915050565b5f60208284031215611bf157611bf06119db565b5b5f611bfe84828501611b62565b91505092915050565b611c1081611b3b565b82525050565b5f602082019050611c295f830184611c07565b92915050565b5f80fd5b5f80fd5b5f80fd5b5f8083601f840112611c5057611c4f611c2f565b5b8235905067ffffffffffffffff811115611c6d57611c6c611c33565b5b602083019150836020820283011115611c8957611c88611c37565b5b9250929050565b5f8083601f840112611ca557611ca4611c2f565b5b8235905067ffffffffffffffff811115611cc257611cc1611c33565b5b602083019150836020820283011115611cde57611cdd611c37565b5b9250929050565b5f805f8060408587031215611cfd57611cfc6119db565b5b5f85013567ffffffffffffffff811115611d1a57611d196119df565b5b611d2687828801611c3b565b9450945050602085013567ffffffffffffffff811115611d4957611d486119df565b5b611d5587828801611c90565b925092505092959194509250565b5f8083601f840112611d7857611d77611c2f565b5b8235905067ffffffffffffffff811115611d9557611d94611c33565b5b602083019150836001820283011115611db157611db0611c37565b5b9250929050565b5f8060208385031215611dce57611dcd6119db565b5b5f83013567ffffffffffffffff811115611deb57611dea6119df565b5b611df785828601611d63565b92509250509250929050565b5f604082019050611e165f830185611a9f565b611e236020830184611c07565b9392505050565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f611e6c82611e2a565b611e768185611e34565b9350611e86818560208601611e44565b611e8f81611e52565b840191505092915050565b5f6020820190508181035f830152611eb28184611e62565b905092915050565b5f608082019050611ecd5f830187611a9f565b611eda6020830186611a9f565b611ee76040830185611a9f565b611ef46060830184611a9f565b95945050505050565b5f805f60408486031215611f1457611f136119db565b5b5f611f2186828701611b62565b935050602084013567ffffffffffffffff811115611f4257611f416119df565b5b611f4e86828701611d63565b92509250509250925092565b5f8083601f840112611f6f57611f6e611c2f565b5b8235905067ffffffffffffffff811115611f8c57611f8b611c33565b5b602083019150836020820283011115611fa857611fa7611c37565b5b9250929050565b5f805f8060408587031215611fc757611fc66119db565b5b5f85013567ffffffffffffffff811115611fe457611fe36119df565b5b611ff087828801611c3b565b9450945050602085013567ffffffffffffffff811115612013576120126119df565b5b61201f87828801611f5a565b925092505092959194509250565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f61206482611a96565b915061206f83611a96565b92508282039050818111156120875761208661202d565b5b92915050565b5f61209782611a96565b91506120a283611a96565b92508282026120b081611a96565b915082820484148315176120c7576120c661202d565b5b5092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f61210582611a96565b915061211083611a96565b9250826121205761211f6120ce565b5b828204905092915050565b5f61213582611a96565b915061214083611a96565b92508282019050808211156121585761215761202d565b5b92915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b61219481611a63565b811461219e575f80fd5b50565b5f813590506121af8161218b565b92915050565b5f602082840312156121ca576121c96119db565b5b5f6121d7848285016121a1565b91505092915050565b5f80fd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b61221a82611e52565b810181811067ffffffffffffffff82111715612239576122386121e4565b5b80604052505050565b5f61224b6119d2565b90506122578282612211565b919050565b5f80fd5b5f60a08284031215612275576122746121e0565b5b61227f60a0612242565b90505f61228e84828501611b62565b5f8301525060206122a184828501611add565b60208301525060406122b584828501611add565b60408301525060606122c984828501611add565b60608301525060806122dd84828501611add565b60808301525092915050565b5f60a082840312156122fe576122fd6119db565b5b5f61230b84828501612260565b91505092915050565b5f6060820190506123275f830186611c07565b6123346020830185611a9f565b6123416040830184611a9f565b949350505050565b5f80fd5b5f67ffffffffffffffff821115612367576123666121e4565b5b61237082611e52565b9050602081019050919050565b828183375f83830152505050565b5f61239d6123988461234d565b612242565b9050828152602081018484840111156123b9576123b8612349565b5b6123c484828561237d565b509392505050565b5f82601f8301126123e0576123df611c2f565b5b81356123f084826020860161238b565b91505092915050565b5f6040828403121561240e5761240d6121e0565b5b6124186040612242565b90505f61242784828501611b62565b5f83015250602082013567ffffffffffffffff81111561244a5761244961225c565b5b612456848285016123cc565b60208301525092915050565b5f60208284031215612477576124766119db565b5b5f82013567ffffffffffffffff811115612494576124936119df565b5b6124a0848285016123f9565b91505092915050565b5f815190506124b781611ac7565b92915050565b5f602082840312156124d2576124d16119db565b5b5f6124df848285016124a9565b91505092915050565b5f8160601b9050919050565b5f6124fe826124e8565b9050919050565b5f61250f826124f4565b9050919050565b61252761252282611b3b565b612505565b82525050565b5f819050919050565b61254761254282611a96565b61252d565b82525050565b5f6125588286612516565b6014820191506125688285612516565b6014820191506125788284612536565b602082019150819050949350505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffd5b6125bf81611a96565b82525050565b602082015f8201516125d95f8501826125b6565b50505050565b5f6020820190506125f25f8301846125c5565b92915050565b6003811061260957612608612589565b5b50565b5f819050612619826125f8565b919050565b5f6126288261260c565b9050919050565b6126388161261e565b82525050565b61264781611b3b565b82525050565b5f82825260208201905092915050565b5f61266782611e2a565b612671818561264d565b9350612681818560208601611e44565b61268a81611e52565b840191505092915050565b5f608083015f8301516126aa5f86018261262f565b5060208301516126bd602086018261263e565b5060408301516126d0604086018261263e565b50606083015184820360608601526126e8828261265d565b9150508091505092915050565b5f6020820190508181035f83015261270d8184612695565b905092915050565b50565b5f6127235f83611e34565b915061272e82612715565b5f82019050919050565b5f60408201905061274b5f830184611c07565b818103602083015261275c81612718565b905092915050565b5f61276e82611a96565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036127a05761279f61202d565b5b60018201905091905056fea264697066735822122032a0f80ce305faf6ce99031f2dace67ca68969c5c50f184662e2f869aaaa447964736f6c634300081a0033",c=class c extends h.DeployableTarget{constructor(){super(...arguments),this.abi=a.w}async owner(f){return await a.Zv(this._config,{address:this.assertValidAddress(),args:[],...f})}async claims(f){return await a._v(this._config,{address:this.assertValidAddress(),args:[],...f})}async reward(f){return await a.Qv(this._config,{address:this.assertValidAddress(),args:[],...f})}async claimed(f,b){return await a.kv(this._config,{address:this.assertValidAddress(),args:[f],...b})}async asset(f){return await a.Fv(this._config,{address:this.assertValidAddress(),...f})}async cgdaParams(f){const[b,e,d,t]=await a.Lv(this._config,{address:this.assertValidAddress(),...f});return{rewardDecay:b,rewardBoost:e,lastClaimTime:d,currentReward:t}}async totalBudget(f){return await a.Xv(this._config,{address:this.assertValidAddress(),...f})}async claim(f,b){return await this.awaitResult(this.claimRaw(f,b))}async claimRaw(f,b){const{request:e,result:d}=await a.fw(this._config,{address:this.assertValidAddress(),args:[i.prepareClaimPayload(f)],...this.optionallyAttachAccount(),...b});return{hash:await a.tw(this._config,e),result:d}}async clawback(f,b){return await this.awaitResult(this.clawbackRaw(f,b))}async clawbackRaw(f,b){const{request:e,result:d}=await a.vw(this._config,{address:this.assertValidAddress(),args:[i.prepareClaimPayload(f)],...this.optionallyAttachAccount(),...b});return{hash:await a.nw(this._config,e),result:d}}async isClaimable(f,b){return await a.Wv(this._config,{address:this.assertValidAddress(),args:[f.target,f.data],...b})}async canBeClaimed(f){return await this.getRemainingClaimPotential(f)>0n}async getRemainingClaimPotential(f){const[b,e]=await Promise.all([this.currentReward(f),n.getErc20Balance(this._config,await this.asset(),this.assertValidAddress(),f)]);return e-b}async currentReward(f){return await a.Dv(this._config,{address:this.assertValidAddress(),...f})}async getTotalBudget(f){var b;return((b=this.payload)==null?void 0:b.totalBudget)!==void 0?this.payload.totalBudget:await this.totalBudget(f)}buildParameters(f,b){const[e,d]=this.validateDeploymentConfig(f,b);return{abi:a.w,bytecode:g,args:[o(e)],...this.optionallyAttachAccount(d.account)}}buildClawbackData(f){return s.encodeAbiParameters([{type:"uint256"}],[f])}buildClaimData(){return s.zeroHash}};c.bases={31337:void 0,...u.CGDAIncentive},c.registryType=n.RegistryType.INCENTIVE;let r=c;function o({asset:l,initialReward:f,rewardDecay:b,rewardBoost:e,totalBudget:d}){return s.encodeAbiParameters([{type:"address",name:"asset"},{type:"uint256",name:"initialReward"},{type:"uint256",name:"rewardDecay"},{type:"uint256",name:"rewardBoost"},{type:"uint256",name:"totalBudget"}],[l,f,b,e,d])}exports.cgdaIncentiveAbi=a.w;exports.CGDAIncentive=r;exports.prepareCGDAIncentivePayload=o;
2
2
  //# sourceMappingURL=CGDAIncentive.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"CGDAIncentive.cjs","sources":["../../src/Incentives/CGDAIncentive.ts"],"sourcesContent":["import {\n cgdaIncentiveAbi,\n readCgdaIncentiveAsset,\n readCgdaIncentiveCgdaParams,\n readCgdaIncentiveClaimed,\n readCgdaIncentiveClaims,\n readCgdaIncentiveCurrentReward,\n readCgdaIncentiveIsClaimable,\n readCgdaIncentiveOwner,\n readCgdaIncentiveReward,\n readCgdaIncentiveTotalBudget,\n simulateCgdaIncentiveClaim,\n simulateCgdaIncentiveClawback,\n writeCgdaIncentiveClaim,\n writeCgdaIncentiveClawback,\n} from '@boostxyz/evm';\nimport { bytecode } from '@boostxyz/evm/artifacts/contracts/incentives/CGDAIncentive.sol/CGDAIncentive.json';\nimport {\n type Address,\n type ContractEventName,\n type Hex,\n encodeAbiParameters,\n zeroHash,\n} from 'viem';\nimport { CGDAIncentive as CGDAIncentiveBases } from '../../dist/deployments.json';\nimport type {\n DeployableOptions,\n GenericDeployableParams,\n} from '../Deployable/Deployable';\nimport { DeployableTarget } from '../Deployable/DeployableTarget';\nimport { type ClaimPayload, prepareClaimPayload } from '../claiming';\nimport {\n type GenericLog,\n type ReadParams,\n RegistryType,\n type WriteParams,\n getErc20Balance,\n} from '../utils';\n\nexport { cgdaIncentiveAbi };\n\n/**\n * The object representation of a `CGDAIncentive.InitPayload`\n *\n * @export\n * @interface CGDAIncentivePayload\n * @typedef {CGDAIncentivePayload}\n */\nexport interface CGDAIncentivePayload {\n /**\n * The address of the ERC20-like token\n *\n * @type {Address}\n */\n asset: Address;\n /**\n * The initial reward amount\n *\n * @type {bigint}\n */\n initialReward: bigint;\n /**\n * The amount to subtract from the current reward after each claim\n *\n * @type {bigint}\n */\n rewardDecay: bigint;\n /**\n * The amount by which the reward increases for each hour without a claim (continuous linear increase)\n *\n * @type {bigint}\n */\n rewardBoost: bigint;\n /**\n * The total budget for the incentive\n *\n * @type {bigint}\n */\n totalBudget: bigint;\n /**\n * The entity that can `clawback` funds\n *\n * @type {Address}\n */\n manager: Address;\n}\n\n/**\n * The configuration parameters for the CGDAIncentive\n *\n * @export\n * @interface CGDAParameters\n * @typedef {CGDAParameters}\n */\nexport interface CGDAParameters {\n /**\n * The amount to subtract from the current reward after each claim\n *\n * @type {bigint}\n */\n rewardDecay: bigint;\n /**\n * The amount by which the reward increases for each hour without a claim (continuous linear increase)\n *\n * @type {bigint}\n */\n rewardBoost: bigint;\n /**\n * The timestamp of the last claim\n *\n * @type {bigint}\n */\n lastClaimTime: bigint;\n /**\n * The current reward amount\n *\n * @type {bigint}\n */\n currentReward: bigint;\n}\n\n/**\n * A generic `viem.Log` event with support for `CGDAIncentive` event types.\n *\n * @export\n * @typedef {CGDAIncentiveLog}\n * @template {ContractEventName<typeof cgdaIncentiveAbi>} [event=ContractEventName<\n * typeof cgdaIncentiveAbi\n * >]\n */\nexport type CGDAIncentiveLog<\n event extends ContractEventName<typeof cgdaIncentiveAbi> = ContractEventName<\n typeof cgdaIncentiveAbi\n >,\n> = GenericLog<typeof cgdaIncentiveAbi, event>;\n\n/**\n * Continuous Gradual Dutch Auction Incentive.\n * An CGDA incentive implementation with reward amounts adjusting dynamically based on claim volume.\n *\n * @export\n * @class CGDAIncentive\n * @typedef {CGDAIncentive}\n * @extends {DeployableTarget<CGDAIncentivePayload>}\n */\nexport class CGDAIncentive extends DeployableTarget<\n CGDAIncentivePayload,\n typeof cgdaIncentiveAbi\n> {\n public override readonly abi = cgdaIncentiveAbi;\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {Record<number, Address>}\n */\n public static override bases: Record<number, Address> = {\n 31337: import.meta.env.VITE_CGDA_INCENTIVE_BASE,\n ...(CGDAIncentiveBases as Record<number, Address>),\n };\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {RegistryType}\n */\n public static override registryType: RegistryType = RegistryType.INCENTIVE;\n\n /**\n * The incentive's owner.\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<Address>}\n */\n public async owner(params?: ReadParams) {\n return await readCgdaIncentiveOwner(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The number of claims that have been made\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async claims(params?: ReadParams) {\n return await readCgdaIncentiveClaims(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The reward amount issued for each claim\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async reward(params?: ReadParams) {\n return await readCgdaIncentiveReward(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Get the claim status for a user\n *\n * @public\n * @async\n * @param {Address} address\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>}\n */\n public async claimed(address: Address, params?: ReadParams) {\n return await readCgdaIncentiveClaimed(this._config, {\n address: this.assertValidAddress(),\n args: [address],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The CGDA-like token used for the incentive\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<Address>}\n */\n public async asset(params?: ReadParams) {\n return await readCgdaIncentiveAsset(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The configuration parameters for the CGDAIncentive\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<CGDAParameters>}\n */\n public async cgdaParams(params?: ReadParams): Promise<CGDAParameters> {\n const [rewardDecay, rewardBoost, lastClaimTime, currentReward] =\n await readCgdaIncentiveCgdaParams(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n return {\n rewardDecay,\n rewardBoost,\n lastClaimTime,\n currentReward,\n };\n }\n\n /**\n * The total budget of the incentive\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async totalBudget(params?: ReadParams) {\n return await readCgdaIncentiveTotalBudget(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Claim the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<boolean>} - Returns true if successfully claimed\n */\n protected async claim(payload: ClaimPayload, params?: WriteParams) {\n return await this.awaitResult(this.claimRaw(payload, params));\n }\n\n /**\n * Claim the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<boolean>} - Returns true if successfully claimed\n */\n protected async claimRaw(payload: ClaimPayload, params?: WriteParams) {\n const { request, result } = await simulateCgdaIncentiveClaim(this._config, {\n address: this.assertValidAddress(),\n args: [prepareClaimPayload(payload)],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n const hash = await writeCgdaIncentiveClaim(this._config, request);\n return { hash, result };\n }\n\n /**\n * Clawback assets from the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<boolean>} - True if the assets were successfully clawbacked\n */\n public async clawback(payload: ClaimPayload, params?: WriteParams) {\n return await this.awaitResult(this.clawbackRaw(payload, params));\n }\n\n /**\n * Clawback assets from the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<boolean>} - True if the assets were successfully clawbacked\n */\n public async clawbackRaw(payload: ClaimPayload, params?: WriteParams) {\n const { request, result } = await simulateCgdaIncentiveClawback(\n this._config,\n {\n address: this.assertValidAddress(),\n args: [prepareClaimPayload(payload)],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n },\n );\n const hash = await writeCgdaIncentiveClawback(this._config, request);\n return { hash, result };\n }\n\n /**\n * Check if an incentive is claimable\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>} - True if the incentive is claimable based on the data payload\n */\n public async isClaimable(payload: ClaimPayload, params?: ReadParams) {\n return await readCgdaIncentiveIsClaimable(this._config, {\n address: this.assertValidAddress(),\n args: [prepareClaimPayload(payload)],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Check if any claims remain by comparing the incentive's balance against the current reward. Does not take requesting user's elligibility into account.\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>} - True if asset balance minus current reward is greater than 0\n */\n public async canBeClaimed(params?: ReadParams) {\n return (await this.getRemainingClaimPotential(params)) > 0n;\n }\n\n /**\n * Check how many claims remain by comparing the incentive's balance against the current reward. Does not take requesting user's elligibility into account.\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>} - Asset balance minus current reward\n */\n public async getRemainingClaimPotential(params?: ReadParams) {\n const [currentReward, currentBalance] = await Promise.all([\n this.currentReward(params),\n getErc20Balance(\n this._config,\n await this.asset(),\n this.assertValidAddress(),\n params,\n ),\n ]);\n return currentBalance - currentReward;\n }\n\n /**\n * Calculates the current reward based on the time since the last claim.\n * The reward is calculated based on the time since the last claim, the available budget, and the reward parameters. It increases linearly over time in the absence of claims, with each hour adding `rewardBoost` to the current reward, up to the available budget.\n * For example, if there is one claim in the first hour, then no claims for three hours, the claimable reward would be `initialReward - rewardDecay + (rewardBoost * 3)`\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>} - The current reward\n */\n public async currentReward(params?: ReadParams) {\n return await readCgdaIncentiveCurrentReward(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Get the maximum amount that can be claimed by this incentive. Useful when used in conjunction with `BoostCore.calculateProtocolFee`\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>} = Return a bigint representing that maximum amount that can be distributed by this incentive.\n */\n public async getTotalBudget(params?: ReadParams) {\n if (this.payload?.totalBudget !== undefined) {\n return this.payload.totalBudget;\n }\n return await this.totalBudget(params);\n }\n\n /**\n * @inheritdoc\n *\n * @public\n * @param {?CGDAIncentivePayload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {GenericDeployableParams}\n */\n public override buildParameters(\n _payload?: CGDAIncentivePayload,\n _options?: DeployableOptions,\n ): GenericDeployableParams {\n const [payload, options] = this.validateDeploymentConfig(\n _payload,\n _options,\n );\n return {\n abi: cgdaIncentiveAbi,\n bytecode: bytecode as Hex,\n args: [prepareCGDAIncentivePayload(payload)],\n ...this.optionallyAttachAccount(options.account),\n };\n }\n\n /**\n * Encodes an amount to clawback from the incentive\n *\n * @public\n * @param {bigint} amount - How much of the asset to clawback\n * @returns {Hex} - Returns an encoded uint256\n */\n public buildClawbackData(amount: bigint) {\n return encodeAbiParameters([{ type: 'uint256' }], [amount]);\n }\n\n /**\n * Builds the claim data for the CGDAIncentive.\n *\n * @public\n * @returns {Hash} A `zeroHash`, as CGDAIncentive doesn't require specific claim data.\n * @description This function returns `zeroHash` because CGDAIncentive doesn't use any specific claim data.\n */\n public buildClaimData() {\n return zeroHash;\n }\n}\n\n/**\n * Given a {@link CGDAIncentivePayload}, properly encode a `CGDAIncentive.InitPayload` for use with {@link CGDAIncentive} initialization.\n *\n * @param {CGDAIncentivePayload} param0\n * @param {Address} param0.asset - The address of the ERC20-like token\n * @param {bigint} param0.initialReward - The initial reward amount\n * @param {bigint} param0.rewardDecay - The amount to subtract from the current reward after each claim\n * @param {bigint} param0.rewardBoost - The amount by which the reward increases for each hour without a claim (continuous linear increase)\n * @param {bigint} param0.totalBudget - The total budget for the incentive\n * @returns {Hex}\n */\nexport function prepareCGDAIncentivePayload({\n asset,\n initialReward,\n rewardDecay,\n rewardBoost,\n totalBudget,\n}: CGDAIncentivePayload) {\n return encodeAbiParameters(\n [\n { type: 'address', name: 'asset' },\n { type: 'uint256', name: 'initialReward' },\n { type: 'uint256', name: 'rewardDecay' },\n { type: 'uint256', name: 'rewardBoost' },\n { type: 'uint256', name: 'totalBudget' },\n ],\n [asset, initialReward, rewardDecay, rewardBoost, totalBudget],\n );\n}\n"],"names":["_CGDAIncentive","DeployableTarget","cgdaIncentiveAbi","params","readCgdaIncentiveOwner","readCgdaIncentiveClaims","readCgdaIncentiveReward","address","readCgdaIncentiveClaimed","readCgdaIncentiveAsset","rewardDecay","rewardBoost","lastClaimTime","currentReward","readCgdaIncentiveCgdaParams","readCgdaIncentiveTotalBudget","payload","request","result","simulateCgdaIncentiveClaim","prepareClaimPayload","writeCgdaIncentiveClaim","simulateCgdaIncentiveClawback","writeCgdaIncentiveClawback","readCgdaIncentiveIsClaimable","currentBalance","getErc20Balance","readCgdaIncentiveCurrentReward","_a","_payload","_options","options","bytecode","prepareCGDAIncentivePayload","amount","encodeAbiParameters","zeroHash","CGDAIncentiveBases","RegistryType","CGDAIncentive","asset","initialReward","totalBudget"],"mappings":"kmpBAiJaA,EAAN,MAAMA,UAAsBC,EAAAA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DAIncentive.ts"],"sourcesContent":["import {\n cgdaIncentiveAbi,\n readCgdaIncentiveAsset,\n readCgdaIncentiveCgdaParams,\n readCgdaIncentiveClaimed,\n readCgdaIncentiveClaims,\n readCgdaIncentiveCurrentReward,\n readCgdaIncentiveIsClaimable,\n readCgdaIncentiveOwner,\n readCgdaIncentiveReward,\n readCgdaIncentiveTotalBudget,\n simulateCgdaIncentiveClaim,\n simulateCgdaIncentiveClawback,\n writeCgdaIncentiveClaim,\n writeCgdaIncentiveClawback,\n} from '@boostxyz/evm';\nimport { bytecode } from '@boostxyz/evm/artifacts/contracts/incentives/CGDAIncentive.sol/CGDAIncentive.json';\nimport {\n type Address,\n type ContractEventName,\n type Hex,\n encodeAbiParameters,\n zeroHash,\n} from 'viem';\nimport { CGDAIncentive as CGDAIncentiveBases } from '../../dist/deployments.json';\nimport type {\n DeployableOptions,\n GenericDeployableParams,\n} from '../Deployable/Deployable';\nimport { DeployableTarget } from '../Deployable/DeployableTarget';\nimport { type ClaimPayload, prepareClaimPayload } from '../claiming';\nimport {\n type GenericLog,\n type ReadParams,\n RegistryType,\n type WriteParams,\n getErc20Balance,\n} from '../utils';\n\nexport { cgdaIncentiveAbi };\n\n/**\n * The object representation of a `CGDAIncentive.InitPayload`\n *\n * @export\n * @interface CGDAIncentivePayload\n * @typedef {CGDAIncentivePayload}\n */\nexport interface CGDAIncentivePayload {\n /**\n * The address of the ERC20-like token\n *\n * @type {Address}\n */\n asset: Address;\n /**\n * The initial reward amount\n *\n * @type {bigint}\n */\n initialReward: bigint;\n /**\n * The amount to subtract from the current reward after each claim\n *\n * @type {bigint}\n */\n rewardDecay: bigint;\n /**\n * The amount by which the reward increases for each hour without a claim (continuous linear increase)\n *\n * @type {bigint}\n */\n rewardBoost: bigint;\n /**\n * The total budget for the incentive\n *\n * @type {bigint}\n */\n totalBudget: bigint;\n /**\n * The entity that can `clawback` funds\n *\n * @type {Address}\n */\n manager: Address;\n}\n\n/**\n * The configuration parameters for the CGDAIncentive\n *\n * @export\n * @interface CGDAParameters\n * @typedef {CGDAParameters}\n */\nexport interface CGDAParameters {\n /**\n * The amount to subtract from the current reward after each claim\n *\n * @type {bigint}\n */\n rewardDecay: bigint;\n /**\n * The amount by which the reward increases for each hour without a claim (continuous linear increase)\n *\n * @type {bigint}\n */\n rewardBoost: bigint;\n /**\n * The timestamp of the last claim\n *\n * @type {bigint}\n */\n lastClaimTime: bigint;\n /**\n * The current reward amount\n *\n * @type {bigint}\n */\n currentReward: bigint;\n}\n\n/**\n * A generic `viem.Log` event with support for `CGDAIncentive` event types.\n *\n * @export\n * @typedef {CGDAIncentiveLog}\n * @template {ContractEventName<typeof cgdaIncentiveAbi>} [event=ContractEventName<\n * typeof cgdaIncentiveAbi\n * >]\n */\nexport type CGDAIncentiveLog<\n event extends ContractEventName<typeof cgdaIncentiveAbi> = ContractEventName<\n typeof cgdaIncentiveAbi\n >,\n> = GenericLog<typeof cgdaIncentiveAbi, event>;\n\n/**\n * Continuous Gradual Dutch Auction Incentive.\n * An CGDA incentive implementation with reward amounts adjusting dynamically based on claim volume.\n *\n * @export\n * @class CGDAIncentive\n * @typedef {CGDAIncentive}\n * @extends {DeployableTarget<CGDAIncentivePayload>}\n */\nexport class CGDAIncentive extends DeployableTarget<\n CGDAIncentivePayload,\n typeof cgdaIncentiveAbi\n> {\n public override readonly abi = cgdaIncentiveAbi;\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {Record<number, Address>}\n */\n public static override bases: Record<number, Address> = {\n 31337: import.meta.env.VITE_CGDA_INCENTIVE_BASE,\n ...(CGDAIncentiveBases as Record<number, Address>),\n };\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {RegistryType}\n */\n public static override registryType: RegistryType = RegistryType.INCENTIVE;\n\n /**\n * The incentive's owner.\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<Address>}\n */\n public async owner(params?: ReadParams) {\n return await readCgdaIncentiveOwner(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The number of claims that have been made\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async claims(params?: ReadParams) {\n return await readCgdaIncentiveClaims(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The reward amount issued for each claim\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async reward(params?: ReadParams) {\n return await readCgdaIncentiveReward(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Get the claim status for a user\n *\n * @public\n * @async\n * @param {Address} address\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>}\n */\n public async claimed(address: Address, params?: ReadParams) {\n return await readCgdaIncentiveClaimed(this._config, {\n address: this.assertValidAddress(),\n args: [address],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The CGDA-like token used for the incentive\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<Address>}\n */\n public async asset(params?: ReadParams) {\n return await readCgdaIncentiveAsset(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The configuration parameters for the CGDAIncentive\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<CGDAParameters>}\n */\n public async cgdaParams(params?: ReadParams): Promise<CGDAParameters> {\n const [rewardDecay, rewardBoost, lastClaimTime, currentReward] =\n await readCgdaIncentiveCgdaParams(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n return {\n rewardDecay,\n rewardBoost,\n lastClaimTime,\n currentReward,\n };\n }\n\n /**\n * The total budget of the incentive\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async totalBudget(params?: ReadParams) {\n return await readCgdaIncentiveTotalBudget(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Claim the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<boolean>} - Returns true if successfully claimed\n */\n protected async claim(payload: ClaimPayload, params?: WriteParams) {\n return await this.awaitResult(this.claimRaw(payload, params));\n }\n\n /**\n * Claim the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<boolean>} - Returns true if successfully claimed\n */\n protected async claimRaw(payload: ClaimPayload, params?: WriteParams) {\n const { request, result } = await simulateCgdaIncentiveClaim(this._config, {\n address: this.assertValidAddress(),\n args: [prepareClaimPayload(payload)],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n const hash = await writeCgdaIncentiveClaim(this._config, request);\n return { hash, result };\n }\n\n /**\n * Clawback assets from the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<boolean>} - True if the assets were successfully clawbacked\n */\n public async clawback(payload: ClaimPayload, params?: WriteParams) {\n return await this.awaitResult(this.clawbackRaw(payload, params));\n }\n\n /**\n * Clawback assets from the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<boolean>} - True if the assets were successfully clawbacked\n */\n public async clawbackRaw(payload: ClaimPayload, params?: WriteParams) {\n const { request, result } = await simulateCgdaIncentiveClawback(\n this._config,\n {\n address: this.assertValidAddress(),\n args: [prepareClaimPayload(payload)],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n },\n );\n const hash = await writeCgdaIncentiveClawback(this._config, request);\n return { hash, result };\n }\n\n /**\n * Check if an incentive is claimable\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>} - True if the incentive is claimable based on the data payload\n */\n public async isClaimable(payload: ClaimPayload, params?: ReadParams) {\n return await readCgdaIncentiveIsClaimable(this._config, {\n address: this.assertValidAddress(),\n args: [payload.target, payload.data],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Check if any claims remain by comparing the incentive's balance against the current reward. Does not take requesting user's elligibility into account.\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>} - True if asset balance minus current reward is greater than 0\n */\n public async canBeClaimed(params?: ReadParams) {\n return (await this.getRemainingClaimPotential(params)) > 0n;\n }\n\n /**\n * Check how many claims remain by comparing the incentive's balance against the current reward. Does not take requesting user's elligibility into account.\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>} - Asset balance minus current reward\n */\n public async getRemainingClaimPotential(params?: ReadParams) {\n const [currentReward, currentBalance] = await Promise.all([\n this.currentReward(params),\n getErc20Balance(\n this._config,\n await this.asset(),\n this.assertValidAddress(),\n params,\n ),\n ]);\n return currentBalance - currentReward;\n }\n\n /**\n * Calculates the current reward based on the time since the last claim.\n * The reward is calculated based on the time since the last claim, the available budget, and the reward parameters. It increases linearly over time in the absence of claims, with each hour adding `rewardBoost` to the current reward, up to the available budget.\n * For example, if there is one claim in the first hour, then no claims for three hours, the claimable reward would be `initialReward - rewardDecay + (rewardBoost * 3)`\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>} - The current reward\n */\n public async currentReward(params?: ReadParams) {\n return await readCgdaIncentiveCurrentReward(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Get the maximum amount that can be claimed by this incentive. Useful when used in conjunction with `BoostCore.calculateProtocolFee`\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>} = Return a bigint representing that maximum amount that can be distributed by this incentive.\n */\n public async getTotalBudget(params?: ReadParams) {\n if (this.payload?.totalBudget !== undefined) {\n return this.payload.totalBudget;\n }\n return await this.totalBudget(params);\n }\n\n /**\n * @inheritdoc\n *\n * @public\n * @param {?CGDAIncentivePayload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {GenericDeployableParams}\n */\n public override buildParameters(\n _payload?: CGDAIncentivePayload,\n _options?: DeployableOptions,\n ): GenericDeployableParams {\n const [payload, options] = this.validateDeploymentConfig(\n _payload,\n _options,\n );\n return {\n abi: cgdaIncentiveAbi,\n bytecode: bytecode as Hex,\n args: [prepareCGDAIncentivePayload(payload)],\n ...this.optionallyAttachAccount(options.account),\n };\n }\n\n /**\n * Encodes an amount to clawback from the incentive\n *\n * @public\n * @param {bigint} amount - How much of the asset to clawback\n * @returns {Hex} - Returns an encoded uint256\n */\n public buildClawbackData(amount: bigint) {\n return encodeAbiParameters([{ type: 'uint256' }], [amount]);\n }\n\n /**\n * Builds the claim data for the CGDAIncentive.\n *\n * @public\n * @returns {Hash} A `zeroHash`, as CGDAIncentive doesn't require specific claim data.\n * @description This function returns `zeroHash` because CGDAIncentive doesn't use any specific claim data.\n */\n public buildClaimData() {\n return zeroHash;\n }\n}\n\n/**\n * Given a {@link CGDAIncentivePayload}, properly encode a `CGDAIncentive.InitPayload` for use with {@link CGDAIncentive} initialization.\n *\n * @param {CGDAIncentivePayload} param0\n * @param {Address} param0.asset - The address of the ERC20-like token\n * @param {bigint} param0.initialReward - The initial reward amount\n * @param {bigint} param0.rewardDecay - The amount to subtract from the current reward after each claim\n * @param {bigint} param0.rewardBoost - The amount by which the reward increases for each hour without a claim (continuous linear increase)\n * @param {bigint} param0.totalBudget - The total budget for the incentive\n * @returns {Hex}\n */\nexport function prepareCGDAIncentivePayload({\n asset,\n initialReward,\n rewardDecay,\n rewardBoost,\n totalBudget,\n}: CGDAIncentivePayload) {\n return encodeAbiParameters(\n [\n { type: 'address', name: 'asset' },\n { type: 'uint256', name: 'initialReward' },\n { type: 'uint256', name: 'rewardDecay' },\n { type: 'uint256', name: 'rewardBoost' },\n { type: 'uint256', name: 'totalBudget' },\n ],\n [asset, initialReward, rewardDecay, rewardBoost, totalBudget],\n );\n}\n"],"names":["_CGDAIncentive","DeployableTarget","cgdaIncentiveAbi","params","readCgdaIncentiveOwner","readCgdaIncentiveClaims","readCgdaIncentiveReward","address","readCgdaIncentiveClaimed","readCgdaIncentiveAsset","rewardDecay","rewardBoost","lastClaimTime","currentReward","readCgdaIncentiveCgdaParams","readCgdaIncentiveTotalBudget","payload","request","result","simulateCgdaIncentiveClaim","prepareClaimPayload","writeCgdaIncentiveClaim","simulateCgdaIncentiveClawback","writeCgdaIncentiveClawback","readCgdaIncentiveIsClaimable","currentBalance","getErc20Balance","readCgdaIncentiveCurrentReward","_a","_payload","_options","options","bytecode","prepareCGDAIncentivePayload","amount","encodeAbiParameters","zeroHash","CGDAIncentiveBases","RegistryType","CGDAIncentive","asset","initialReward","totalBudget"],"mappings":"kmpBAiJaA,EAAN,MAAMA,UAAsBC,EAAAA,gBAGjC,CAHK,aAAA,CAAA,MAAA,GAAA,SAAA,EAIL,KAAyB,IAAMC,GAAA,CA6B/B,MAAa,MAAMC,EAAqB,CAC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