@boostxyz/sdk 0.0.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +674 -0
- package/README.md +7 -0
- package/dist/Actions/Action.cjs +2 -0
- package/dist/Actions/Action.cjs.map +1 -0
- package/dist/Actions/Action.d.ts +31 -0
- package/dist/Actions/Action.d.ts.map +1 -0
- package/dist/Actions/Action.js +29 -0
- package/dist/Actions/Action.js.map +1 -0
- package/dist/Actions/ContractAction.d.ts +370 -0
- package/dist/Actions/ContractAction.d.ts.map +1 -0
- package/dist/Actions/ERC721MintAction.d.ts +513 -0
- package/dist/Actions/ERC721MintAction.d.ts.map +1 -0
- package/dist/Actions/EventAction.cjs +2 -0
- package/dist/Actions/EventAction.cjs.map +1 -0
- package/dist/Actions/EventAction.d.ts +694 -0
- package/dist/Actions/EventAction.d.ts.map +1 -0
- package/dist/Actions/EventAction.js +491 -0
- package/dist/Actions/EventAction.js.map +1 -0
- package/dist/AllowLists/AllowList.cjs +2 -0
- package/dist/AllowLists/AllowList.cjs.map +1 -0
- package/dist/AllowLists/AllowList.d.ts +32 -0
- package/dist/AllowLists/AllowList.d.ts.map +1 -0
- package/dist/AllowLists/AllowList.js +30 -0
- package/dist/AllowLists/AllowList.js.map +1 -0
- package/dist/AllowLists/SimpleAllowList.cjs +2 -0
- package/dist/AllowLists/SimpleAllowList.cjs.map +1 -0
- package/dist/AllowLists/SimpleAllowList.d.ts +481 -0
- package/dist/AllowLists/SimpleAllowList.d.ts.map +1 -0
- package/dist/AllowLists/SimpleAllowList.js +154 -0
- package/dist/AllowLists/SimpleAllowList.js.map +1 -0
- package/dist/AllowLists/SimpleDenyList.cjs +2 -0
- package/dist/AllowLists/SimpleDenyList.cjs.map +1 -0
- package/dist/AllowLists/SimpleDenyList.d.ts +335 -0
- package/dist/AllowLists/SimpleDenyList.d.ts.map +1 -0
- package/dist/AllowLists/SimpleDenyList.js +115 -0
- package/dist/AllowLists/SimpleDenyList.js.map +1 -0
- package/dist/Auth/Auth.cjs +2 -0
- package/dist/Auth/Auth.cjs.map +1 -0
- package/dist/Auth/Auth.d.ts +10 -0
- package/dist/Auth/Auth.d.ts.map +1 -0
- package/dist/Auth/Auth.js +5 -0
- package/dist/Auth/Auth.js.map +1 -0
- package/dist/Auth/PassthroughAuth.cjs +2 -0
- package/dist/Auth/PassthroughAuth.cjs.map +1 -0
- package/dist/Auth/PassthroughAuth.d.ts +51 -0
- package/dist/Auth/PassthroughAuth.d.ts.map +1 -0
- package/dist/Auth/PassthroughAuth.js +39 -0
- package/dist/Auth/PassthroughAuth.js.map +1 -0
- package/dist/Boost.cjs +2 -0
- package/dist/Boost.cjs.map +1 -0
- package/dist/Boost.d.ts +234 -0
- package/dist/Boost.d.ts.map +1 -0
- package/dist/Boost.js +162 -0
- package/dist/Boost.js.map +1 -0
- package/dist/BoostCore.cjs +3 -0
- package/dist/BoostCore.cjs.map +1 -0
- package/dist/BoostCore.d.ts +498 -0
- package/dist/BoostCore.d.ts.map +1 -0
- package/dist/BoostCore.js +1153 -0
- package/dist/BoostCore.js.map +1 -0
- package/dist/BoostRegistry.cjs +2 -0
- package/dist/BoostRegistry.cjs.map +1 -0
- package/dist/BoostRegistry.d.ts +243 -0
- package/dist/BoostRegistry.d.ts.map +1 -0
- package/dist/BoostRegistry.js +262 -0
- package/dist/BoostRegistry.js.map +1 -0
- package/dist/Budgets/Budget.cjs +2 -0
- package/dist/Budgets/Budget.cjs.map +1 -0
- package/dist/Budgets/Budget.d.ts +31 -0
- package/dist/Budgets/Budget.d.ts.map +1 -0
- package/dist/Budgets/Budget.js +29 -0
- package/dist/Budgets/Budget.js.map +1 -0
- package/dist/Budgets/ManagedBudget.cjs +2 -0
- package/dist/Budgets/ManagedBudget.cjs.map +1 -0
- package/dist/Budgets/ManagedBudget.d.ts +1103 -0
- package/dist/Budgets/ManagedBudget.d.ts.map +1 -0
- package/dist/Budgets/ManagedBudget.js +516 -0
- package/dist/Budgets/ManagedBudget.js.map +1 -0
- package/dist/Budgets/SimpleBudget.d.ts +824 -0
- package/dist/Budgets/SimpleBudget.d.ts.map +1 -0
- package/dist/Budgets/VestingBudget.d.ts +778 -0
- package/dist/Budgets/VestingBudget.d.ts.map +1 -0
- package/dist/Deployable/Contract.cjs +2 -0
- package/dist/Deployable/Contract.cjs.map +1 -0
- package/dist/Deployable/Contract.d.ts +125 -0
- package/dist/Deployable/Contract.d.ts.map +1 -0
- package/dist/Deployable/Contract.js +150 -0
- package/dist/Deployable/Contract.js.map +1 -0
- package/dist/Deployable/Deployable.cjs +2 -0
- package/dist/Deployable/Deployable.cjs.map +1 -0
- package/dist/Deployable/Deployable.d.ts +161 -0
- package/dist/Deployable/Deployable.d.ts.map +1 -0
- package/dist/Deployable/Deployable.js +131 -0
- package/dist/Deployable/Deployable.js.map +1 -0
- package/dist/Deployable/DeployableTarget.cjs +2 -0
- package/dist/Deployable/DeployableTarget.cjs.map +1 -0
- package/dist/Deployable/DeployableTarget.d.ts +116 -0
- package/dist/Deployable/DeployableTarget.d.ts.map +1 -0
- package/dist/Deployable/DeployableTarget.js +132 -0
- package/dist/Deployable/DeployableTarget.js.map +1 -0
- package/dist/Incentives/AllowListIncentive.cjs +2 -0
- package/dist/Incentives/AllowListIncentive.cjs.map +1 -0
- package/dist/Incentives/AllowListIncentive.d.ts +513 -0
- package/dist/Incentives/AllowListIncentive.d.ts.map +1 -0
- package/dist/Incentives/AllowListIncentive.js +201 -0
- package/dist/Incentives/AllowListIncentive.js.map +1 -0
- package/dist/Incentives/CGDAIncentive.cjs +2 -0
- package/dist/Incentives/CGDAIncentive.cjs.map +1 -0
- package/dist/Incentives/CGDAIncentive.d.ts +644 -0
- package/dist/Incentives/CGDAIncentive.d.ts.map +1 -0
- package/dist/Incentives/CGDAIncentive.js +271 -0
- package/dist/Incentives/CGDAIncentive.js.map +1 -0
- package/dist/Incentives/ERC1155Incentive.d.ts +713 -0
- package/dist/Incentives/ERC1155Incentive.d.ts.map +1 -0
- package/dist/Incentives/ERC20Incentive.cjs +2 -0
- package/dist/Incentives/ERC20Incentive.cjs.map +1 -0
- package/dist/Incentives/ERC20Incentive.d.ts +666 -0
- package/dist/Incentives/ERC20Incentive.d.ts.map +1 -0
- package/dist/Incentives/ERC20Incentive.js +312 -0
- package/dist/Incentives/ERC20Incentive.js.map +1 -0
- package/dist/Incentives/ERC20VariableIncentive.d.ts +582 -0
- package/dist/Incentives/ERC20VariableIncentive.d.ts.map +1 -0
- package/dist/Incentives/Incentive.cjs +2 -0
- package/dist/Incentives/Incentive.cjs.map +1 -0
- package/dist/Incentives/Incentive.d.ts +36 -0
- package/dist/Incentives/Incentive.d.ts.map +1 -0
- package/dist/Incentives/Incentive.js +299 -0
- package/dist/Incentives/Incentive.js.map +1 -0
- package/dist/Incentives/PointsIncentive.cjs +2 -0
- package/dist/Incentives/PointsIncentive.cjs.map +1 -0
- package/dist/Incentives/PointsIncentive.d.ts +659 -0
- package/dist/Incentives/PointsIncentive.d.ts.map +1 -0
- package/dist/Incentives/PointsIncentive.js +215 -0
- package/dist/Incentives/PointsIncentive.js.map +1 -0
- package/dist/Validators/SignerValidator.cjs +2 -0
- package/dist/Validators/SignerValidator.cjs.map +1 -0
- package/dist/Validators/SignerValidator.d.ts +745 -0
- package/dist/Validators/SignerValidator.d.ts.map +1 -0
- package/dist/Validators/SignerValidator.js +293 -0
- package/dist/Validators/SignerValidator.js.map +1 -0
- package/dist/Validators/Validator.cjs +2 -0
- package/dist/Validators/Validator.cjs.map +1 -0
- package/dist/Validators/Validator.d.ts +31 -0
- package/dist/Validators/Validator.d.ts.map +1 -0
- package/dist/Validators/Validator.js +27 -0
- package/dist/Validators/Validator.js.map +1 -0
- package/dist/claiming.cjs +2 -0
- package/dist/claiming.cjs.map +1 -0
- package/dist/claiming.d.ts +43 -0
- package/dist/claiming.d.ts.map +1 -0
- package/dist/claiming.js +17 -0
- package/dist/claiming.js.map +1 -0
- package/dist/componentInterfaces-CKCBwG16.cjs +2 -0
- package/dist/componentInterfaces-CKCBwG16.cjs.map +1 -0
- package/dist/componentInterfaces-DYkaxBda.js +13 -0
- package/dist/componentInterfaces-DYkaxBda.js.map +1 -0
- package/dist/errors.cjs +2 -0
- package/dist/errors.cjs.map +1 -0
- package/dist/errors.d.ts +441 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +262 -0
- package/dist/errors.js.map +1 -0
- package/dist/generated-BDeDiaCK.js +4625 -0
- package/dist/generated-BDeDiaCK.js.map +1 -0
- package/dist/generated-wKBNvm48.cjs +3 -0
- package/dist/generated-wKBNvm48.cjs.map +1 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +113 -0
- package/dist/index.js.map +1 -0
- package/dist/transfers.cjs +2 -0
- package/dist/transfers.cjs.map +1 -0
- package/dist/transfers.d.ts +198 -0
- package/dist/transfers.d.ts.map +1 -0
- package/dist/transfers.js +84 -0
- package/dist/transfers.js.map +1 -0
- package/dist/utils.cjs +2 -0
- package/dist/utils.cjs.map +1 -0
- package/dist/utils.d.ts +116 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +30 -0
- package/dist/utils.js.map +1 -0
- package/package.json +211 -0
- package/src/Actions/Action.test.ts +75 -0
- package/src/Actions/Action.ts +61 -0
- package/src/Actions/ContractAction.test.ts +197 -0
- package/src/Actions/ContractAction.ts +301 -0
- package/src/Actions/ERC721MintAction.test.ts +112 -0
- package/src/Actions/ERC721MintAction.ts +292 -0
- package/src/Actions/EventAction.test.ts +205 -0
- package/src/Actions/EventAction.ts +811 -0
- package/src/AllowLists/AllowList.test.ts +64 -0
- package/src/AllowLists/AllowList.ts +60 -0
- package/src/AllowLists/SimpleAllowList.test.ts +52 -0
- package/src/AllowLists/SimpleAllowList.ts +284 -0
- package/src/AllowLists/SimpleDenyList.test.ts +52 -0
- package/src/AllowLists/SimpleDenyList.ts +227 -0
- package/src/Auth/Auth.ts +11 -0
- package/src/Auth/PassthroughAuth.test.ts +12 -0
- package/src/Auth/PassthroughAuth.ts +80 -0
- package/src/Boost.ts +290 -0
- package/src/BoostCore.test.ts +773 -0
- package/src/BoostCore.ts +1261 -0
- package/src/BoostRegistry.ts +467 -0
- package/src/Budgets/Budget.test.ts +27 -0
- package/src/Budgets/Budget.ts +61 -0
- package/src/Budgets/ManagedBudget.test.ts +154 -0
- package/src/Budgets/ManagedBudget.ts +796 -0
- package/src/Budgets/SimpleBudget.test.ts +152 -0
- package/src/Budgets/SimpleBudget.ts +564 -0
- package/src/Budgets/VestingBudget.test.ts +123 -0
- package/src/Budgets/VestingBudget.ts +602 -0
- package/src/Deployable/Contract.ts +229 -0
- package/src/Deployable/Deployable.ts +250 -0
- package/src/Deployable/DeployableTarget.ts +223 -0
- package/src/Incentives/AllowListIncentive.test.ts +143 -0
- package/src/Incentives/AllowListIncentive.ts +334 -0
- package/src/Incentives/CGDAIncentive.test.ts +132 -0
- package/src/Incentives/CGDAIncentive.ts +468 -0
- package/src/Incentives/ERC1155Incentive.test.ts +87 -0
- package/src/Incentives/ERC1155Incentive.ts +466 -0
- package/src/Incentives/ERC20Incentive.test.ts +130 -0
- package/src/Incentives/ERC20Incentive.ts +482 -0
- package/src/Incentives/ERC20VariableIncentive.test.ts +136 -0
- package/src/Incentives/ERC20VariableIncentive.ts +420 -0
- package/src/Incentives/Incentive.test.ts +92 -0
- package/src/Incentives/Incentive.ts +85 -0
- package/src/Incentives/PointsIncentive.test.ts +139 -0
- package/src/Incentives/PointsIncentive.ts +365 -0
- package/src/Validators/SignerValidator.test.ts +159 -0
- package/src/Validators/SignerValidator.ts +681 -0
- package/src/Validators/Validator.test.ts +21 -0
- package/src/Validators/Validator.ts +55 -0
- package/src/claiming.ts +56 -0
- package/src/errors.ts +542 -0
- package/src/index.test.ts +40 -0
- package/src/index.ts +53 -0
- package/src/transfers.ts +284 -0
- package/src/utils.test.ts +44 -0
- package/src/utils.ts +198 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Incentive.cjs","sources":["../../src/Incentives/ERC20VariableIncentive.ts","../../src/Incentives/Incentive.ts"],"sourcesContent":["import {\n erc20VariableIncentiveAbi,\n readErc20VariableIncentiveAsset,\n readErc20VariableIncentiveClaimed,\n readErc20VariableIncentiveClaims,\n readErc20VariableIncentiveCurrentReward,\n readErc20VariableIncentiveIsClaimable,\n readErc20VariableIncentiveLimit,\n readErc20VariableIncentiveOwner,\n readErc20VariableIncentiveReward,\n readErc20VariableIncentiveTotalClaimed,\n simulateErc20VariableIncentiveClaim,\n simulateErc20VariableIncentiveClawback,\n writeErc20VariableIncentiveClaim,\n writeErc20VariableIncentiveClawback,\n} from '@boostxyz/evm';\nimport { bytecode } from '@boostxyz/evm/artifacts/contracts/incentives/ERC20VariableIncentive.sol/ERC20VariableIncentive.json';\nimport {\n type Address,\n type ContractEventName,\n type Hex,\n encodeAbiParameters,\n} from 'viem';\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 { erc20VariableIncentiveAbi };\n/**\n * The object representation of a `ERC20VariableIncentivePayload.InitPayload`\n *\n * @export\n * @interface ERC20VariableIncentivePayload\n * @typedef {ERC20VariableIncentivePayload}\n */\nexport interface ERC20VariableIncentivePayload {\n /**\n * The address of the incentivized asset.\n *\n * @type {Address}\n */\n asset: Address;\n /**\n * The amount of the asset to distribute.\n *\n * @type {bigint}\n */\n reward: bigint;\n /**\n * How many times can this incentive be claimed.\n *\n * @type {bigint}\n */\n limit: bigint;\n}\n\n/**\n * A generic `viem.Log` event with support for `ERC20VariableIncentive` event types.\n *\n * @export\n * @typedef {ERC20VariableIncentiveLog}\n * @template {ContractEventName<typeof erc20VariableIncentiveAbi>} [event=ContractEventName<\n * typeof erc20VariableIncentiveAbi\n * >]\n */\nexport type ERC20VariableIncentiveLog<\n event extends ContractEventName<\n typeof erc20VariableIncentiveAbi\n > = ContractEventName<typeof erc20VariableIncentiveAbi>,\n> = GenericLog<typeof erc20VariableIncentiveAbi, event>;\n\n/**\n * A simple ERC20 incentive implementation that allows claiming of tokens\n *\n * @export\n * @class ERC20VariableIncentive\n * @typedef {ERC20VariableIncentive}\n * @extends {DeployableTarget<ERC20VariableIncentivePayload>}\n */\nexport class ERC20VariableIncentive extends DeployableTarget<\n ERC20VariableIncentivePayload,\n typeof erc20VariableIncentiveAbi\n> {\n public override readonly abi = erc20VariableIncentiveAbi;\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {Address}\n */\n public static override base: Address = import.meta.env\n .VITE_ERC20_VARIABLE_INCENTIVE_BASE;\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 incentive\n *\n * @public\n * @async\n * @param {?ReadParams<typeof erc20VariableIncentiveAbi, 'owner'>} [params]\n * @returns {unknown}\n */\n public async owner(\n params?: ReadParams<typeof erc20VariableIncentiveAbi, 'owner'>,\n ) {\n return await readErc20VariableIncentiveOwner(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 current reward\n *\n * @public\n * @async\n * @param {?ReadParams<typeof erc20VariableIncentiveAbi, 'currentReward'>} [params]\n * @returns {Promise<bigint>} - The current reward\n */\n public async totalClaimed(\n params?: ReadParams<typeof erc20VariableIncentiveAbi, 'totalClaimed'>,\n ) {\n return await readErc20VariableIncentiveTotalClaimed(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 current reward\n *\n * @public\n * @async\n * @param {?ReadParams<typeof erc20VariableIncentiveAbi, 'currentReward'>} [params]\n * @returns {Promise<bigint>} - The current reward\n */\n public async currentReward(\n params?: ReadParams<typeof erc20VariableIncentiveAbi, 'currentReward'>,\n ) {\n return await readErc20VariableIncentiveCurrentReward(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<typeof erc20VariableIncentiveAbi, 'claims'>} [params]\n * @returns {Promise<bigint>}\n */\n public async claims(\n params?: ReadParams<typeof erc20VariableIncentiveAbi, 'claims'>,\n ) {\n return await readErc20VariableIncentiveClaims(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 * A mapping of address to claim status\n *\n * @public\n * @async\n * @param {Address} address\n * @param {?ReadParams<typeof erc20VariableIncentiveAbi, 'claimed'>} [params]\n * @returns {Promise<boolean>}\n */\n public async claimed(\n address: Address,\n params?: ReadParams<typeof erc20VariableIncentiveAbi, 'claimed'>,\n ) {\n return await readErc20VariableIncentiveClaimed(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 address of the ERC20-like token\n *\n * @public\n * @async\n * @param {?ReadParams<typeof erc20VariableIncentiveAbi, 'asset'>} [params]\n * @returns {Promise<Address>}\n */\n public async asset(\n params?: ReadParams<typeof erc20VariableIncentiveAbi, 'asset'>,\n ) {\n return await readErc20VariableIncentiveAsset(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 reward amount issued for each claim\n *\n * @public\n * @async\n * @param {?ReadParams<typeof erc20VariableIncentiveAbi, 'reward'>} [params]\n * @returns {Promise<bigint>}\n */\n public async reward(\n params?: ReadParams<typeof erc20VariableIncentiveAbi, 'reward'>,\n ) {\n return await readErc20VariableIncentiveReward(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 limit (max claims, or max entries for raffles)\n *\n * @public\n * @async\n * @param {?ReadParams<typeof erc20VariableIncentiveAbi, 'limit'>} [params]\n * @returns {unknown}\n */\n public async limit(\n params?: ReadParams<typeof erc20VariableIncentiveAbi, 'limit'>,\n ) {\n return await readErc20VariableIncentiveLimit(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<typeof erc20VariableIncentiveAbi, 'claim'>} [params]\n * @returns {Promise<boolean>} - Returns true if successfully claimed\n */\n protected async claim(\n payload: ClaimPayload,\n params?: WriteParams<typeof erc20VariableIncentiveAbi, 'claim'>,\n ) {\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<typeof erc20VariableIncentiveAbi, 'claim'>} [params]\n * @returns {Promise<boolean>} - Returns true if successfully claimed\n */\n protected async claimRaw(\n payload: ClaimPayload,\n params?: WriteParams<typeof erc20VariableIncentiveAbi, 'claim'>,\n ) {\n const { request, result } = await simulateErc20VariableIncentiveClaim(\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 writeErc20VariableIncentiveClaim(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<typeof erc20VariableIncentiveAbi, 'clawback'>} [params]\n * @returns {Promise<boolean>} - True if the assets were successfully clawbacked\n */\n public async clawback(\n payload: ClaimPayload,\n params?: WriteParams<typeof erc20VariableIncentiveAbi, 'clawback'>,\n ) {\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<typeof erc20VariableIncentiveAbi, 'clawback'>} [params]\n * @returns {Promise<boolean>} - True if the assets were successfully clawbacked\n */\n public async clawbackRaw(\n payload: ClaimPayload,\n params?: WriteParams<typeof erc20VariableIncentiveAbi, 'clawback'>,\n ) {\n const { request, result } = await simulateErc20VariableIncentiveClawback(\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 writeErc20VariableIncentiveClawback(\n this._config,\n request,\n );\n return { hash, result };\n }\n\n /**\n * Check if an incentive is claimable. For the POOL strategy, the `bytes data` portion of the payload ignored. The recipient must not have already claimed the incentive.\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?ReadParams<typeof erc20VariableIncentiveAbi, 'isClaimable'>} [params]\n * @returns {unknown} = True if the incentive is claimable based on the data payload\n */\n public async isClaimable(\n payload: ClaimPayload,\n params?: ReadParams<typeof erc20VariableIncentiveAbi, 'isClaimable'>,\n ) {\n return await readErc20VariableIncentiveIsClaimable(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 * @inheritdoc\n *\n * @public\n * @param {?ERC20VariableIncentivePayload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {GenericDeployableParams}\n */\n public override buildParameters(\n _payload?: ERC20VariableIncentivePayload,\n _options?: DeployableOptions,\n ): GenericDeployableParams {\n const [payload, options] = this.validateDeploymentConfig(\n _payload,\n _options,\n );\n return {\n abi: erc20VariableIncentiveAbi,\n bytecode: bytecode as Hex,\n args: [prepareERC20VariableIncentivePayload(payload)],\n ...this.optionallyAttachAccount(options.account),\n };\n }\n}\n\n/**\n * Given a {@link ERC20VariableIncentivePayload}, properly encode a ` ERC20VariableIncentive.InitPayload` for use with {@link ERC20VariableIncentive} initialization.\n *\n * @param {ERC20VariableIncentivePayload} param0\n * @param {Address} param0.asset - The address of the incentivized asset.\n * @param {bigint} param0.reward - The amount of the asset to distribute.\n * @param {bigint} param0.limit - How many times can this incentive be claimed.\n * @returns {*}\n */\nexport function prepareERC20VariableIncentivePayload({\n asset,\n reward,\n limit,\n}: ERC20VariableIncentivePayload) {\n return encodeAbiParameters(\n [\n { type: 'address', name: 'asset' },\n { type: 'uint256', name: 'reward' },\n { type: 'uint256', name: 'limit' },\n ],\n [asset, reward, limit],\n );\n}\n","import { aIncentiveAbi } from '@boostxyz/evm';\nimport {\n AAllowListIncentive,\n ACGDAIncentive,\n AERC20Incentive,\n AERC20VariableIncentive,\n APointsIncentive,\n} from '@boostxyz/evm/deploys/componentInterfaces.json';\nimport { readContract } from '@wagmi/core';\nimport type { Address, Hex } from 'viem';\nimport type { DeployableOptions } from '../Deployable/Deployable';\nimport { InvalidComponentInterfaceError } from '../errors';\nimport { AllowListIncentive } from './AllowListIncentive';\nimport { CGDAIncentive } from './CGDAIncentive';\nimport { ERC20Incentive } from './ERC20Incentive';\nimport { ERC20VariableIncentive } from './ERC20VariableIncentive';\n// import { ERC1155Incentive } from './ERC1155Incentive';\nimport { PointsIncentive } from './PointsIncentive';\n\nexport {\n AllowListIncentive,\n CGDAIncentive,\n // ERC1155Incentive,\n ERC20Incentive,\n PointsIncentive,\n ERC20VariableIncentive,\n};\n\n/**\n * A union type representing all valid protocol Incentive implementations\n *\n * @export\n * @typedef {Incentive}\n */\nexport type Incentive =\n | AllowListIncentive\n | CGDAIncentive\n | ERC20Incentive\n // | ERC1155Incentive\n | PointsIncentive\n | ERC20VariableIncentive;\n\n/**\n * A map of Incentive component interfaces to their constructors.\n *\n * @type {{ \"0xc5b24b8e\": typeof PointsIncentive; \"0x8c901437\": typeof ERC20Incentive; \"0x0a466e6f\": typeof AllowListIncentive; \"0xa39e44d9\": typeof CGDAIncentive; \"0x6060409d\": typeof ERC20VariableIncentive }}\n */\nexport const IncentiveByComponentInterface = {\n [APointsIncentive as Hex]: PointsIncentive,\n [AERC20Incentive as Hex]: ERC20Incentive,\n // TODO: figure out why evm generates bad bytes4 here\n ['0x0a466e6f']: AllowListIncentive,\n // [APointsIncentive as Hex]: ERC1155Incentive,\n [ACGDAIncentive as Hex]: CGDAIncentive,\n [AERC20VariableIncentive as Hex]: ERC20VariableIncentive,\n};\n\n/**\n * A function that will read a contract's component interface using `getComponentInterface` and return the correct instantiated instance.\n *\n * @export\n * @async\n * @param {DeployableOptions} options\n * @param {Address} address\n * @returns {unknown}\n * @throws {@link InvalidComponentInterfaceError}\n */\nexport async function incentiveFromAddress(\n options: DeployableOptions,\n address: Address,\n) {\n const interfaceId = (await readContract(options.config, {\n abi: aIncentiveAbi,\n functionName: 'getComponentInterface',\n address,\n })) as keyof typeof IncentiveByComponentInterface;\n const Ctor = IncentiveByComponentInterface[interfaceId];\n if (!Ctor) {\n throw new InvalidComponentInterfaceError(\n Object.keys(IncentiveByComponentInterface) as Hex[],\n interfaceId as Hex,\n );\n }\n return new Ctor(options, address);\n}\n"],"names":["_ERC20VariableIncentive","DeployableTarget","erc20VariableIncentiveAbi","params","readErc20VariableIncentiveOwner","readErc20VariableIncentiveTotalClaimed","readErc20VariableIncentiveCurrentReward","readErc20VariableIncentiveClaims","address","readErc20VariableIncentiveClaimed","readErc20VariableIncentiveAsset","readErc20VariableIncentiveReward","readErc20VariableIncentiveLimit","payload","request","result","simulateErc20VariableIncentiveClaim","prepareClaimPayload","writeErc20VariableIncentiveClaim","simulateErc20VariableIncentiveClawback","writeErc20VariableIncentiveClawback","readErc20VariableIncentiveIsClaimable","_payload","_options","options","bytecode","prepareERC20VariableIncentivePayload","RegistryType","ERC20VariableIncentive","asset","reward","limit","encodeAbiParameters","IncentiveByComponentInterface","APointsIncentive","PointsIncentive","AERC20Incentive","ERC20Incentive","AllowListIncentive","ACGDAIncentive","CGDAIncentive","AERC20VariableIncentive","incentiveFromAddress","interfaceId","readContract","aIncentiveAbi","Ctor","InvalidComponentInterfaceError"],"mappings":"s3dAwFaA,EAAN,MAAMA,UAA+BC,EAAAA,gBAG1C,CAHK,aAAA,CAAA,MAAA,GAAA,SAAA,EAIL,KAAyB,IAAMC,GAAA,CA2B/B,MAAa,MACXC,EACA,CACO,OAAA,MAAMC,EAAAA,GAAgC,KAAK,QAAS,CACzD,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAAC,EAEP,GAAID,CAAA,CACL,CACH,CAUA,MAAa,aACXA,EACA,CACO,OAAA,MAAME,EAAAA,GAAuC,KAAK,QAAS,CAChE,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAAC,EAEP,GAAIF,CAAA,CACL,CACH,CAUA,MAAa,cACXA,EACA,CACO,OAAA,MAAMG,EAAAA,GAAwC,KAAK,QAAS,CACjE,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAAC,EAEP,GAAIH,CAAA,CACL,CACH,CAUA,MAAa,OACXA,EACA,CACO,OAAA,MAAMI,EAAAA,GAAiC,KAAK,QAAS,CAC1D,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAAC,EAEP,GAAIJ,CAAA,CACL,CACH,CAWA,MAAa,QACX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MAAM,IAAIC,EAAA,+BACR,OAAO,KAAKd,CAA6B,EACzCU,CAAA,EAGG,OAAA,IAAIG,EAAKtB,EAAShB,CAAO,CAClC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Address } from 'viem';
|
|
2
|
+
import type { DeployableOptions } from '../Deployable/Deployable';
|
|
3
|
+
import { AllowListIncentive } from './AllowListIncentive';
|
|
4
|
+
import { CGDAIncentive } from './CGDAIncentive';
|
|
5
|
+
import { ERC20Incentive } from './ERC20Incentive';
|
|
6
|
+
import { ERC20VariableIncentive } from './ERC20VariableIncentive';
|
|
7
|
+
import { PointsIncentive } from './PointsIncentive';
|
|
8
|
+
export { AllowListIncentive, CGDAIncentive, ERC20Incentive, PointsIncentive, ERC20VariableIncentive, };
|
|
9
|
+
/**
|
|
10
|
+
* A union type representing all valid protocol Incentive implementations
|
|
11
|
+
*
|
|
12
|
+
* @export
|
|
13
|
+
* @typedef {Incentive}
|
|
14
|
+
*/
|
|
15
|
+
export type Incentive = AllowListIncentive | CGDAIncentive | ERC20Incentive | PointsIncentive | ERC20VariableIncentive;
|
|
16
|
+
/**
|
|
17
|
+
* A map of Incentive component interfaces to their constructors.
|
|
18
|
+
*
|
|
19
|
+
* @type {{ "0xc5b24b8e": typeof PointsIncentive; "0x8c901437": typeof ERC20Incentive; "0x0a466e6f": typeof AllowListIncentive; "0xa39e44d9": typeof CGDAIncentive; "0x6060409d": typeof ERC20VariableIncentive }}
|
|
20
|
+
*/
|
|
21
|
+
export declare const IncentiveByComponentInterface: {
|
|
22
|
+
[x: string]: typeof AllowListIncentive | typeof CGDAIncentive | typeof ERC20Incentive | typeof ERC20VariableIncentive | typeof PointsIncentive;
|
|
23
|
+
"0x0a466e6f": typeof AllowListIncentive;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* A function that will read a contract's component interface using `getComponentInterface` and return the correct instantiated instance.
|
|
27
|
+
*
|
|
28
|
+
* @export
|
|
29
|
+
* @async
|
|
30
|
+
* @param {DeployableOptions} options
|
|
31
|
+
* @param {Address} address
|
|
32
|
+
* @returns {unknown}
|
|
33
|
+
* @throws {@link InvalidComponentInterfaceError}
|
|
34
|
+
*/
|
|
35
|
+
export declare function incentiveFromAddress(options: DeployableOptions, address: Address): Promise<AllowListIncentive | CGDAIncentive | ERC20Incentive | ERC20VariableIncentive | PointsIncentive>;
|
|
36
|
+
//# sourceMappingURL=Incentive.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Incentive.d.ts","sourceRoot":"","sources":["../../src/Incentives/Incentive.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,OAAO,EAAO,MAAM,MAAM,CAAC;AACzC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAElE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EACL,kBAAkB,EAClB,aAAa,EAEb,cAAc,EACd,eAAe,EACf,sBAAsB,GACvB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GACjB,kBAAkB,GAClB,aAAa,GACb,cAAc,GAEd,eAAe,GACf,sBAAsB,CAAC;AAE3B;;;;GAIG;AACH,eAAO,MAAM,6BAA6B;;;CAQzC,CAAC;AAEF;;;;;;;;;GASG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,iBAAiB,EAC1B,OAAO,EAAE,OAAO,2GAejB"}
|
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
import { a_ as r, a$ as o, b0 as h, b1 as m, b2 as l, b3 as u, b4 as w, b5 as p, b6 as y, b7 as g, b8 as A, b9 as C, ba as I, bb as _, bc as V } from "../generated-BDeDiaCK.js";
|
|
2
|
+
import { e as v, f as R, g as D, h as P } from "../componentInterfaces-DYkaxBda.js";
|
|
3
|
+
import { readContract as x } from "@wagmi/core";
|
|
4
|
+
import { InvalidComponentInterfaceError as k } from "../errors.js";
|
|
5
|
+
import { AllowListIncentive as E } from "./AllowListIncentive.js";
|
|
6
|
+
import { CGDAIncentive as N } from "./CGDAIncentive.js";
|
|
7
|
+
import { ERC20Incentive as T } from "./ERC20Incentive.js";
|
|
8
|
+
import { encodeAbiParameters as B } from "viem";
|
|
9
|
+
import { DeployableTarget as G } from "../Deployable/DeployableTarget.js";
|
|
10
|
+
import { prepareClaimPayload as s } from "../claiming.js";
|
|
11
|
+
import { RegistryType as q } from "../utils.js";
|
|
12
|
+
import { PointsIncentive as j } from "./PointsIncentive.js";
|
|
13
|
+
const F = "0x6080604052348015600e575f80fd5b50601b601f60201b60201c565b60b0565b5f602c608760201b60201c565b90508054600181161560455763f92ee8a95f526004601cfd5b8160c01c808260011c146082578060011b8355806020527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602080a15b505050565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffbf6011325f1b905090565b611c07806100bd5f395ff3fe608060405260043610610129575f3560e01c8063715018a6116100aa578063d54ad2a11161006e578063d54ad2a11461039b578063db09da12146103c5578063dcc59b6f14610401578063f04e283e1461042b578063f2fde38b14610447578063fee81cf41461046357610129565b8063715018a6146102c55780638da5cb5b146102cf578063a4d66daf146102f9578063bb1757cf14610323578063c884ef831461035f57610129565b806338d52e0f116100f157806338d52e0f146101f1578063439fab911461021b578063474f5a44146102435780634e7165a21461027f57806354d1f13d146102bb57610129565b806301ffc9a71461012d57806307621eca14610169578063228cb7331461019357806325692962146101bd57806328d6183b146101c7575b5f80fd5b348015610138575f80fd5b50610153600480360381019061014e9190611115565b61049f565b604051610160919061115a565b60405180910390f35b348015610174575f80fd5b5061017d610518565b60405161018a919061118b565b60405180910390f35b34801561019e575f80fd5b506101a7610521565b6040516101b4919061118b565b60405180910390f35b6101c5610527565b005b3480156101d2575f80fd5b506101db610578565b6040516101e891906111b3565b60405180910390f35b3480156101fc575f80fd5b5061020561059f565b604051610212919061120b565b60405180910390f35b348015610226575f80fd5b50610241600480360381019061023c9190611285565b6105c4565b005b34801561024e575f80fd5b5061026960048036038101906102649190611285565b610780565b604051610276919061115a565b60405180910390f35b34801561028a575f80fd5b506102a560048036038101906102a09190611285565b6108c1565b6040516102b29190611340565b60405180910390f35b6102c3610992565b005b6102cd6109cb565b005b3480156102da575f80fd5b506102e36109de565b6040516102f0919061120b565b60405180910390f35b348015610304575f80fd5b5061030d610a06565b60405161031a919061118b565b60405180910390f35b34801561032e575f80fd5b506103496004803603810190610344919061138a565b610a0c565b604051610356919061115a565b60405180910390f35b34801561036a575f80fd5b50610385600480360381019061038091906113e7565b610c04565b604051610392919061115a565b60405180910390f35b3480156103a6575f80fd5b506103af610c21565b6040516103bc919061118b565b60405180910390f35b3480156103d0575f80fd5b506103eb60048036038101906103e6919061138a565b610c27565b6040516103f8919061115a565b60405180910390f35b34801561040c575f80fd5b50610415610c3a565b604051610422919061118b565b60405180910390f35b610445600480360381019061044091906113e7565b610c3f565b005b610461600480360381019061045c91906113e7565b610c7d565b005b34801561046e575f80fd5b50610489600480360381019061048491906113e7565b610ca6565b604051610496919061118b565b60405180910390f35b5f7f6060409d000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610511575061051082610cbf565b5b9050919050565b5f600154905090565b60015481565b5f610530610d38565b67ffffffffffffffff164201905063389a75e1600c52335f52806020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d5f80a250565b5f7f6060409d00000000000000000000000000000000000000000000000000000000905090565b60035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b5f6105cd610d42565b905080546003825580156105ff5760018160011c14303b106105f65763f92ee8a95f526004601cfd5b818160ff1b1b91505b5061060933610d6b565b5f8383810190610619919061151d565b90505f815f015190505f826020015190505f836040015190505f810361066b576040517ff92ee8a900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f610695308573ffffffffffffffffffffffffffffffffffffffff16610e4190919063ffffffff16565b9050818110156106e357845f015181836040517f5c54305e0000000000000000000000000000000000000000000000000000000081526004016106da93929190611548565b60405180910390fd5b8360035f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555082600181905550816004819055505f60058190555061074133610d6b565b5050505050801561077b576002815560016020527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602080a15b505050565b5f610789610e74565b5f83838101906107999190611696565b90505f81602001518060200190518101906107b491906116f1565b90508060045f8282546107c79190611749565b9250508190555061081d825f01518260035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610eab9092919063ffffffff16565b815f015173ffffffffffffffffffffffffffffffffffffffff167f9ad2e7a4af16dceda9cce4274b2f59c328d8c012eb0e15eb5e1e73b7d8f264d360035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16845f015184604051602001610891939291906117e1565b6040516020818303038152906040526040516108ad9190611340565b60405180910390a260019250505092915050565b60605f805f85858101906108d59190611858565b9250925092506040518060800160405280600160028111156108fa576108f96118a8565b5b81526020018473ffffffffffffffffffffffffffffffffffffffff1681526020013073ffffffffffffffffffffffffffffffffffffffff16815260200160405180602001604052808481525060405160200161095691906118fe565b6040516020818303038152906040528152506040516020016109789190611a14565b604051602081830303815290604052935050505092915050565b63389a75e1600c52335f525f6020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c925f80a2565b6109d3610e74565b6109dc5f610ef4565b565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff7487392754905090565b60045481565b5f610a15610e74565b5f8383810190610a259190611ab9565b90505f8160200151806020019051810190610a4091906116f1565b90505f610a4c87610fba565b610a82576040517f6247a84e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f60015403610a9357819050610ab7565b670de0b6b3a764000082600154610aaa9190611b00565b610ab49190611b6e565b90505b60045481600554610ac89190611b9e565b1115610b00576040517f360e42e100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8060055f828254610b119190611b9e565b92505081905550610b64878260035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610eab9092919063ffffffff16565b8673ffffffffffffffffffffffffffffffffffffffff167f9ad2e7a4af16dceda9cce4274b2f59c328d8c012eb0e15eb5e1e73b7d8f264d360035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff168984604051602001610bd2939291906117e1565b604051602081830303815290604052604051610bee9190611340565b60405180910390a2600193505050509392505050565b6002602052805f5260405f205f915054906101000a900460ff1681565b60055481565b5f610c3184610fba565b90509392505050565b5f5481565b610c47610e74565b63389a75e1600c52805f526020600c208054421115610c6d57636f5e88185f526004601cfd5b5f815550610c7a81610ef4565b50565b610c85610e74565b8060601b610c9a57637448fbae5f526004601cfd5b610ca381610ef4565b50565b5f63389a75e1600c52815f526020600c20549050919050565b5f7f5970a689000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610d315750610d3082610fc9565b5b9050919050565b5f6202a300905090565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffbf6011325f1b905090565b610d73611042565b15610deb577fffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927805415610dad57630dc149f05f526004601cfd5b8160601b60601c9150811560ff1b82178155815f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a350610e3e565b8060601b60601c9050807fffffffffffffffffffffffffffffffffffffffffffffffffffffffff7487392755805f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a35b50565b5f816014526f70a082310000000000000000000000005f5260208060246010865afa601f3d111660205102905092915050565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927543314610ea9576382b429005f526004601cfd5b565b81601452806034526fa9059cbb0000000000000000000000005f5260205f604460105f875af13d1560015f51141716610eeb576390b8ec185f526004601cfd5b5f603452505050565b610efc611042565b15610f61577fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739278160601b60601c91508181547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3811560ff1b8217815550610fb7565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739278160601b60601c91508181547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3818155505b50565b5f600454600554109050919050565b5f7f6ab67a0d000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061103b575061103a82611046565b5b9050919050565b5f90565b5f7f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b5f604051905090565b5f80fd5b5f80fd5b5f7fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b6110f4816110c0565b81146110fe575f80fd5b50565b5f8135905061110f816110eb565b92915050565b5f6020828403121561112a576111296110b8565b5b5f61113784828501611101565b91505092915050565b5f8115159050919050565b61115481611140565b82525050565b5f60208201905061116d5f83018461114b565b92915050565b5f819050919050565b61118581611173565b82525050565b5f60208201905061119e5f83018461117c565b92915050565b6111ad816110c0565b82525050565b5f6020820190506111c65f8301846111a4565b92915050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6111f5826111cc565b9050919050565b611205816111eb565b82525050565b5f60208201905061121e5f8301846111fc565b92915050565b5f80fd5b5f80fd5b5f80fd5b5f8083601f84011261124557611244611224565b5b8235905067ffffffffffffffff81111561126257611261611228565b5b60208301915083600182028301111561127e5761127d61122c565b5b9250929050565b5f806020838503121561129b5761129a6110b8565b5b5f83013567ffffffffffffffff8111156112b8576112b76110bc565b5b6112c485828601611230565b92509250509250929050565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f611312826112d0565b61131c81856112da565b935061132c8185602086016112ea565b611335816112f8565b840191505092915050565b5f6020820190508181035f8301526113588184611308565b905092915050565b611369816111eb565b8114611373575f80fd5b50565b5f8135905061138481611360565b92915050565b5f805f604084860312156113a1576113a06110b8565b5b5f6113ae86828701611376565b935050602084013567ffffffffffffffff8111156113cf576113ce6110bc565b5b6113db86828701611230565b92509250509250925092565b5f602082840312156113fc576113fb6110b8565b5b5f61140984828501611376565b91505092915050565b5f80fd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b61144c826112f8565b810181811067ffffffffffffffff8211171561146b5761146a611416565b5b80604052505050565b5f61147d6110af565b90506114898282611443565b919050565b5f80fd5b61149b81611173565b81146114a5575f80fd5b50565b5f813590506114b681611492565b92915050565b5f606082840312156114d1576114d0611412565b5b6114db6060611474565b90505f6114ea84828501611376565b5f8301525060206114fd848285016114a8565b6020830152506040611511848285016114a8565b60408301525092915050565b5f60608284031215611532576115316110b8565b5b5f61153f848285016114bc565b91505092915050565b5f60608201905061155b5f8301866111fc565b611568602083018561117c565b611575604083018461117c565b949350505050565b5f80fd5b5f67ffffffffffffffff82111561159b5761159a611416565b5b6115a4826112f8565b9050602081019050919050565b828183375f83830152505050565b5f6115d16115cc84611581565b611474565b9050828152602081018484840111156115ed576115ec61157d565b5b6115f88482856115b1565b509392505050565b5f82601f83011261161457611613611224565b5b81356116248482602086016115bf565b91505092915050565b5f6040828403121561164257611641611412565b5b61164c6040611474565b90505f61165b84828501611376565b5f83015250602082013567ffffffffffffffff81111561167e5761167d61148e565b5b61168a84828501611600565b60208301525092915050565b5f602082840312156116ab576116aa6110b8565b5b5f82013567ffffffffffffffff8111156116c8576116c76110bc565b5b6116d48482850161162d565b91505092915050565b5f815190506116eb81611492565b92915050565b5f60208284031215611706576117056110b8565b5b5f611713848285016116dd565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f61175382611173565b915061175e83611173565b92508282039050818111156117765761177561171c565b5b92915050565b5f8160601b9050919050565b5f6117928261177c565b9050919050565b5f6117a382611788565b9050919050565b6117bb6117b6826111eb565b611799565b82525050565b5f819050919050565b6117db6117d682611173565b6117c1565b82525050565b5f6117ec82866117aa565b6014820191506117fc82856117aa565b60148201915061180c82846117ca565b602082019150819050949350505050565b5f611827826111cc565b9050919050565b6118378161181d565b8114611841575f80fd5b50565b5f813590506118528161182e565b92915050565b5f805f6060848603121561186f5761186e6110b8565b5b5f61187c86828701611844565b935050602061188d868287016114a8565b925050604061189e868287016114a8565b9150509250925092565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffd5b6118de81611173565b82525050565b602082015f8201516118f85f8501826118d5565b50505050565b5f6020820190506119115f8301846118e4565b92915050565b60038110611928576119276118a8565b5b50565b5f81905061193882611917565b919050565b5f6119478261192b565b9050919050565b6119578161193d565b82525050565b611966816111eb565b82525050565b5f82825260208201905092915050565b5f611986826112d0565b611990818561196c565b93506119a08185602086016112ea565b6119a9816112f8565b840191505092915050565b5f608083015f8301516119c95f86018261194e565b5060208301516119dc602086018261195d565b5060408301516119ef604086018261195d565b5060608301518482036060860152611a07828261197c565b9150508091505092915050565b5f6020820190508181035f830152611a2c81846119b4565b905092915050565b5f60408284031215611a4957611a48611412565b5b611a536040611474565b90505f82013567ffffffffffffffff811115611a7257611a7161148e565b5b611a7e84828501611600565b5f83015250602082013567ffffffffffffffff811115611aa157611aa061148e565b5b611aad84828501611600565b60208301525092915050565b5f60208284031215611ace57611acd6110b8565b5b5f82013567ffffffffffffffff811115611aeb57611aea6110bc565b5b611af784828501611a34565b91505092915050565b5f611b0a82611173565b9150611b1583611173565b9250828202611b2381611173565b91508282048414831517611b3a57611b3961171c565b5b5092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f611b7882611173565b9150611b8383611173565b925082611b9357611b92611b41565b5b828204905092915050565b5f611ba882611173565b9150611bb383611173565b9250828201905080821115611bcb57611bca61171c565b5b9291505056fea2646970667358221220a9439a260a68f54e27503ba4a35d38eead0eee9484d16611fb206387bc2ede8564736f6c634300081a0033", c = class c extends G {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments), this.abi = r;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The owner of the incentive
|
|
19
|
+
*
|
|
20
|
+
* @public
|
|
21
|
+
* @async
|
|
22
|
+
* @param {?ReadParams<typeof erc20VariableIncentiveAbi, 'owner'>} [params]
|
|
23
|
+
* @returns {unknown}
|
|
24
|
+
*/
|
|
25
|
+
async owner(f) {
|
|
26
|
+
return await o(this._config, {
|
|
27
|
+
address: this.assertValidAddress(),
|
|
28
|
+
args: [],
|
|
29
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
30
|
+
...f
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The current reward
|
|
35
|
+
*
|
|
36
|
+
* @public
|
|
37
|
+
* @async
|
|
38
|
+
* @param {?ReadParams<typeof erc20VariableIncentiveAbi, 'currentReward'>} [params]
|
|
39
|
+
* @returns {Promise<bigint>} - The current reward
|
|
40
|
+
*/
|
|
41
|
+
async totalClaimed(f) {
|
|
42
|
+
return await h(this._config, {
|
|
43
|
+
address: this.assertValidAddress(),
|
|
44
|
+
args: [],
|
|
45
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
46
|
+
...f
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* The current reward
|
|
51
|
+
*
|
|
52
|
+
* @public
|
|
53
|
+
* @async
|
|
54
|
+
* @param {?ReadParams<typeof erc20VariableIncentiveAbi, 'currentReward'>} [params]
|
|
55
|
+
* @returns {Promise<bigint>} - The current reward
|
|
56
|
+
*/
|
|
57
|
+
async currentReward(f) {
|
|
58
|
+
return await m(this._config, {
|
|
59
|
+
address: this.assertValidAddress(),
|
|
60
|
+
args: [],
|
|
61
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
62
|
+
...f
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* The number of claims that have been made
|
|
67
|
+
*
|
|
68
|
+
* @public
|
|
69
|
+
* @async
|
|
70
|
+
* @param {?ReadParams<typeof erc20VariableIncentiveAbi, 'claims'>} [params]
|
|
71
|
+
* @returns {Promise<bigint>}
|
|
72
|
+
*/
|
|
73
|
+
async claims(f) {
|
|
74
|
+
return await l(this._config, {
|
|
75
|
+
address: this.assertValidAddress(),
|
|
76
|
+
args: [],
|
|
77
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
78
|
+
...f
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* A mapping of address to claim status
|
|
83
|
+
*
|
|
84
|
+
* @public
|
|
85
|
+
* @async
|
|
86
|
+
* @param {Address} address
|
|
87
|
+
* @param {?ReadParams<typeof erc20VariableIncentiveAbi, 'claimed'>} [params]
|
|
88
|
+
* @returns {Promise<boolean>}
|
|
89
|
+
*/
|
|
90
|
+
async claimed(f, b) {
|
|
91
|
+
return await u(this._config, {
|
|
92
|
+
address: this.assertValidAddress(),
|
|
93
|
+
args: [f],
|
|
94
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
95
|
+
...b
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* The address of the ERC20-like token
|
|
100
|
+
*
|
|
101
|
+
* @public
|
|
102
|
+
* @async
|
|
103
|
+
* @param {?ReadParams<typeof erc20VariableIncentiveAbi, 'asset'>} [params]
|
|
104
|
+
* @returns {Promise<Address>}
|
|
105
|
+
*/
|
|
106
|
+
async asset(f) {
|
|
107
|
+
return await w(this._config, {
|
|
108
|
+
address: this.assertValidAddress(),
|
|
109
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
110
|
+
...f
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* The reward amount issued for each claim
|
|
115
|
+
*
|
|
116
|
+
* @public
|
|
117
|
+
* @async
|
|
118
|
+
* @param {?ReadParams<typeof erc20VariableIncentiveAbi, 'reward'>} [params]
|
|
119
|
+
* @returns {Promise<bigint>}
|
|
120
|
+
*/
|
|
121
|
+
async reward(f) {
|
|
122
|
+
return await p(this._config, {
|
|
123
|
+
address: this.assertValidAddress(),
|
|
124
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
125
|
+
...f
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* The limit (max claims, or max entries for raffles)
|
|
130
|
+
*
|
|
131
|
+
* @public
|
|
132
|
+
* @async
|
|
133
|
+
* @param {?ReadParams<typeof erc20VariableIncentiveAbi, 'limit'>} [params]
|
|
134
|
+
* @returns {unknown}
|
|
135
|
+
*/
|
|
136
|
+
async limit(f) {
|
|
137
|
+
return await y(this._config, {
|
|
138
|
+
address: this.assertValidAddress(),
|
|
139
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
140
|
+
...f
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Claim the incentive
|
|
145
|
+
*
|
|
146
|
+
* @public
|
|
147
|
+
* @async
|
|
148
|
+
* @param {ClaimPayload} payload
|
|
149
|
+
* @param {?WriteParams<typeof erc20VariableIncentiveAbi, 'claim'>} [params]
|
|
150
|
+
* @returns {Promise<boolean>} - Returns true if successfully claimed
|
|
151
|
+
*/
|
|
152
|
+
async claim(f, b) {
|
|
153
|
+
return await this.awaitResult(this.claimRaw(f, b));
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Claim the incentive
|
|
157
|
+
*
|
|
158
|
+
* @public
|
|
159
|
+
* @async
|
|
160
|
+
* @param {ClaimPayload} payload
|
|
161
|
+
* @param {?WriteParams<typeof erc20VariableIncentiveAbi, 'claim'>} [params]
|
|
162
|
+
* @returns {Promise<boolean>} - Returns true if successfully claimed
|
|
163
|
+
*/
|
|
164
|
+
async claimRaw(f, b) {
|
|
165
|
+
const { request: a, result: e } = await g(
|
|
166
|
+
this._config,
|
|
167
|
+
{
|
|
168
|
+
address: this.assertValidAddress(),
|
|
169
|
+
args: [s(f)],
|
|
170
|
+
...this.optionallyAttachAccount(),
|
|
171
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
172
|
+
...b
|
|
173
|
+
}
|
|
174
|
+
);
|
|
175
|
+
return { hash: await A(this._config, a), result: e };
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Clawback assets from the incentive
|
|
179
|
+
*
|
|
180
|
+
* @public
|
|
181
|
+
* @async
|
|
182
|
+
* @param {ClaimPayload} payload
|
|
183
|
+
* @param {?WriteParams<typeof erc20VariableIncentiveAbi, 'clawback'>} [params]
|
|
184
|
+
* @returns {Promise<boolean>} - True if the assets were successfully clawbacked
|
|
185
|
+
*/
|
|
186
|
+
async clawback(f, b) {
|
|
187
|
+
return await this.awaitResult(this.clawbackRaw(f, b));
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Clawback assets from the incentive
|
|
191
|
+
*
|
|
192
|
+
* @public
|
|
193
|
+
* @async
|
|
194
|
+
* @param {ClaimPayload} payload
|
|
195
|
+
* @param {?WriteParams<typeof erc20VariableIncentiveAbi, 'clawback'>} [params]
|
|
196
|
+
* @returns {Promise<boolean>} - True if the assets were successfully clawbacked
|
|
197
|
+
*/
|
|
198
|
+
async clawbackRaw(f, b) {
|
|
199
|
+
const { request: a, result: e } = await C(
|
|
200
|
+
this._config,
|
|
201
|
+
{
|
|
202
|
+
address: this.assertValidAddress(),
|
|
203
|
+
args: [s(f)],
|
|
204
|
+
...this.optionallyAttachAccount(),
|
|
205
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
206
|
+
...b
|
|
207
|
+
}
|
|
208
|
+
);
|
|
209
|
+
return { hash: await I(
|
|
210
|
+
this._config,
|
|
211
|
+
a
|
|
212
|
+
), result: e };
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Check if an incentive is claimable. For the POOL strategy, the `bytes data` portion of the payload ignored. The recipient must not have already claimed the incentive.
|
|
216
|
+
*
|
|
217
|
+
* @public
|
|
218
|
+
* @async
|
|
219
|
+
* @param {ClaimPayload} payload
|
|
220
|
+
* @param {?ReadParams<typeof erc20VariableIncentiveAbi, 'isClaimable'>} [params]
|
|
221
|
+
* @returns {unknown} = True if the incentive is claimable based on the data payload
|
|
222
|
+
*/
|
|
223
|
+
async isClaimable(f, b) {
|
|
224
|
+
return await _(this._config, {
|
|
225
|
+
address: this.assertValidAddress(),
|
|
226
|
+
args: [s(f)],
|
|
227
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
228
|
+
...b
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* @inheritdoc
|
|
233
|
+
*
|
|
234
|
+
* @public
|
|
235
|
+
* @param {?ERC20VariableIncentivePayload} [_payload]
|
|
236
|
+
* @param {?DeployableOptions} [_options]
|
|
237
|
+
* @returns {GenericDeployableParams}
|
|
238
|
+
*/
|
|
239
|
+
buildParameters(f, b) {
|
|
240
|
+
const [a, e] = this.validateDeploymentConfig(
|
|
241
|
+
f,
|
|
242
|
+
b
|
|
243
|
+
);
|
|
244
|
+
return {
|
|
245
|
+
abi: r,
|
|
246
|
+
bytecode: F,
|
|
247
|
+
args: [L(a)],
|
|
248
|
+
...this.optionallyAttachAccount(e.account)
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
c.base = "0x08AC38DB2f723Db15fa8Cd6c7Bb12C5dA5743875", c.registryType = q.INCENTIVE;
|
|
253
|
+
let t = c;
|
|
254
|
+
function L({
|
|
255
|
+
asset: d,
|
|
256
|
+
reward: f,
|
|
257
|
+
limit: b
|
|
258
|
+
}) {
|
|
259
|
+
return B(
|
|
260
|
+
[
|
|
261
|
+
{ type: "address", name: "asset" },
|
|
262
|
+
{ type: "uint256", name: "reward" },
|
|
263
|
+
{ type: "uint256", name: "limit" }
|
|
264
|
+
],
|
|
265
|
+
[d, f, b]
|
|
266
|
+
);
|
|
267
|
+
}
|
|
268
|
+
const i = {
|
|
269
|
+
[v]: j,
|
|
270
|
+
[R]: T,
|
|
271
|
+
// TODO: figure out why evm generates bad bytes4 here
|
|
272
|
+
"0x0a466e6f": E,
|
|
273
|
+
// [APointsIncentive as Hex]: ERC1155Incentive,
|
|
274
|
+
[D]: N,
|
|
275
|
+
[P]: t
|
|
276
|
+
};
|
|
277
|
+
async function W(d, f) {
|
|
278
|
+
const b = await x(d.config, {
|
|
279
|
+
abi: V,
|
|
280
|
+
functionName: "getComponentInterface",
|
|
281
|
+
address: f
|
|
282
|
+
}), a = i[b];
|
|
283
|
+
if (!a)
|
|
284
|
+
throw new k(
|
|
285
|
+
Object.keys(i),
|
|
286
|
+
b
|
|
287
|
+
);
|
|
288
|
+
return new a(d, f);
|
|
289
|
+
}
|
|
290
|
+
export {
|
|
291
|
+
E as AllowListIncentive,
|
|
292
|
+
N as CGDAIncentive,
|
|
293
|
+
T as ERC20Incentive,
|
|
294
|
+
t as ERC20VariableIncentive,
|
|
295
|
+
i as IncentiveByComponentInterface,
|
|
296
|
+
j as PointsIncentive,
|
|
297
|
+
W as incentiveFromAddress
|
|
298
|
+
};
|
|
299
|
+
//# sourceMappingURL=Incentive.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Incentive.js","sources":["../../src/Incentives/ERC20VariableIncentive.ts","../../src/Incentives/Incentive.ts"],"sourcesContent":["import {\n erc20VariableIncentiveAbi,\n readErc20VariableIncentiveAsset,\n readErc20VariableIncentiveClaimed,\n readErc20VariableIncentiveClaims,\n readErc20VariableIncentiveCurrentReward,\n readErc20VariableIncentiveIsClaimable,\n readErc20VariableIncentiveLimit,\n readErc20VariableIncentiveOwner,\n readErc20VariableIncentiveReward,\n readErc20VariableIncentiveTotalClaimed,\n simulateErc20VariableIncentiveClaim,\n simulateErc20VariableIncentiveClawback,\n writeErc20VariableIncentiveClaim,\n writeErc20VariableIncentiveClawback,\n} from '@boostxyz/evm';\nimport { bytecode } from '@boostxyz/evm/artifacts/contracts/incentives/ERC20VariableIncentive.sol/ERC20VariableIncentive.json';\nimport {\n type Address,\n type ContractEventName,\n type Hex,\n encodeAbiParameters,\n} from 'viem';\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 { erc20VariableIncentiveAbi };\n/**\n * The object representation of a `ERC20VariableIncentivePayload.InitPayload`\n *\n * @export\n * @interface ERC20VariableIncentivePayload\n * @typedef {ERC20VariableIncentivePayload}\n */\nexport interface ERC20VariableIncentivePayload {\n /**\n * The address of the incentivized asset.\n *\n * @type {Address}\n */\n asset: Address;\n /**\n * The amount of the asset to distribute.\n *\n * @type {bigint}\n */\n reward: bigint;\n /**\n * How many times can this incentive be claimed.\n *\n * @type {bigint}\n */\n limit: bigint;\n}\n\n/**\n * A generic `viem.Log` event with support for `ERC20VariableIncentive` event types.\n *\n * @export\n * @typedef {ERC20VariableIncentiveLog}\n * @template {ContractEventName<typeof erc20VariableIncentiveAbi>} [event=ContractEventName<\n * typeof erc20VariableIncentiveAbi\n * >]\n */\nexport type ERC20VariableIncentiveLog<\n event extends ContractEventName<\n typeof erc20VariableIncentiveAbi\n > = ContractEventName<typeof erc20VariableIncentiveAbi>,\n> = GenericLog<typeof erc20VariableIncentiveAbi, event>;\n\n/**\n * A simple ERC20 incentive implementation that allows claiming of tokens\n *\n * @export\n * @class ERC20VariableIncentive\n * @typedef {ERC20VariableIncentive}\n * @extends {DeployableTarget<ERC20VariableIncentivePayload>}\n */\nexport class ERC20VariableIncentive extends DeployableTarget<\n ERC20VariableIncentivePayload,\n typeof erc20VariableIncentiveAbi\n> {\n public override readonly abi = erc20VariableIncentiveAbi;\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {Address}\n */\n public static override base: Address = import.meta.env\n .VITE_ERC20_VARIABLE_INCENTIVE_BASE;\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 incentive\n *\n * @public\n * @async\n * @param {?ReadParams<typeof erc20VariableIncentiveAbi, 'owner'>} [params]\n * @returns {unknown}\n */\n public async owner(\n params?: ReadParams<typeof erc20VariableIncentiveAbi, 'owner'>,\n ) {\n return await readErc20VariableIncentiveOwner(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 current reward\n *\n * @public\n * @async\n * @param {?ReadParams<typeof erc20VariableIncentiveAbi, 'currentReward'>} [params]\n * @returns {Promise<bigint>} - The current reward\n */\n public async totalClaimed(\n params?: ReadParams<typeof erc20VariableIncentiveAbi, 'totalClaimed'>,\n ) {\n return await readErc20VariableIncentiveTotalClaimed(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 current reward\n *\n * @public\n * @async\n * @param {?ReadParams<typeof erc20VariableIncentiveAbi, 'currentReward'>} [params]\n * @returns {Promise<bigint>} - The current reward\n */\n public async currentReward(\n params?: ReadParams<typeof erc20VariableIncentiveAbi, 'currentReward'>,\n ) {\n return await readErc20VariableIncentiveCurrentReward(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<typeof erc20VariableIncentiveAbi, 'claims'>} [params]\n * @returns {Promise<bigint>}\n */\n public async claims(\n params?: ReadParams<typeof erc20VariableIncentiveAbi, 'claims'>,\n ) {\n return await readErc20VariableIncentiveClaims(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 * A mapping of address to claim status\n *\n * @public\n * @async\n * @param {Address} address\n * @param {?ReadParams<typeof erc20VariableIncentiveAbi, 'claimed'>} [params]\n * @returns {Promise<boolean>}\n */\n public async claimed(\n address: Address,\n params?: ReadParams<typeof erc20VariableIncentiveAbi, 'claimed'>,\n ) {\n return await readErc20VariableIncentiveClaimed(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 address of the ERC20-like token\n *\n * @public\n * @async\n * @param {?ReadParams<typeof erc20VariableIncentiveAbi, 'asset'>} [params]\n * @returns {Promise<Address>}\n */\n public async asset(\n params?: ReadParams<typeof erc20VariableIncentiveAbi, 'asset'>,\n ) {\n return await readErc20VariableIncentiveAsset(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 reward amount issued for each claim\n *\n * @public\n * @async\n * @param {?ReadParams<typeof erc20VariableIncentiveAbi, 'reward'>} [params]\n * @returns {Promise<bigint>}\n */\n public async reward(\n params?: ReadParams<typeof erc20VariableIncentiveAbi, 'reward'>,\n ) {\n return await readErc20VariableIncentiveReward(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 limit (max claims, or max entries for raffles)\n *\n * @public\n * @async\n * @param {?ReadParams<typeof erc20VariableIncentiveAbi, 'limit'>} [params]\n * @returns {unknown}\n */\n public async limit(\n params?: ReadParams<typeof erc20VariableIncentiveAbi, 'limit'>,\n ) {\n return await readErc20VariableIncentiveLimit(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<typeof erc20VariableIncentiveAbi, 'claim'>} [params]\n * @returns {Promise<boolean>} - Returns true if successfully claimed\n */\n protected async claim(\n payload: ClaimPayload,\n params?: WriteParams<typeof erc20VariableIncentiveAbi, 'claim'>,\n ) {\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<typeof erc20VariableIncentiveAbi, 'claim'>} [params]\n * @returns {Promise<boolean>} - Returns true if successfully claimed\n */\n protected async claimRaw(\n payload: ClaimPayload,\n params?: WriteParams<typeof erc20VariableIncentiveAbi, 'claim'>,\n ) {\n const { request, result } = await simulateErc20VariableIncentiveClaim(\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 writeErc20VariableIncentiveClaim(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<typeof erc20VariableIncentiveAbi, 'clawback'>} [params]\n * @returns {Promise<boolean>} - True if the assets were successfully clawbacked\n */\n public async clawback(\n payload: ClaimPayload,\n params?: WriteParams<typeof erc20VariableIncentiveAbi, 'clawback'>,\n ) {\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<typeof erc20VariableIncentiveAbi, 'clawback'>} [params]\n * @returns {Promise<boolean>} - True if the assets were successfully clawbacked\n */\n public async clawbackRaw(\n payload: ClaimPayload,\n params?: WriteParams<typeof erc20VariableIncentiveAbi, 'clawback'>,\n ) {\n const { request, result } = await simulateErc20VariableIncentiveClawback(\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 writeErc20VariableIncentiveClawback(\n this._config,\n request,\n );\n return { hash, result };\n }\n\n /**\n * Check if an incentive is claimable. For the POOL strategy, the `bytes data` portion of the payload ignored. The recipient must not have already claimed the incentive.\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?ReadParams<typeof erc20VariableIncentiveAbi, 'isClaimable'>} [params]\n * @returns {unknown} = True if the incentive is claimable based on the data payload\n */\n public async isClaimable(\n payload: ClaimPayload,\n params?: ReadParams<typeof erc20VariableIncentiveAbi, 'isClaimable'>,\n ) {\n return await readErc20VariableIncentiveIsClaimable(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 * @inheritdoc\n *\n * @public\n * @param {?ERC20VariableIncentivePayload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {GenericDeployableParams}\n */\n public override buildParameters(\n _payload?: ERC20VariableIncentivePayload,\n _options?: DeployableOptions,\n ): GenericDeployableParams {\n const [payload, options] = this.validateDeploymentConfig(\n _payload,\n _options,\n );\n return {\n abi: erc20VariableIncentiveAbi,\n bytecode: bytecode as Hex,\n args: [prepareERC20VariableIncentivePayload(payload)],\n ...this.optionallyAttachAccount(options.account),\n };\n }\n}\n\n/**\n * Given a {@link ERC20VariableIncentivePayload}, properly encode a ` ERC20VariableIncentive.InitPayload` for use with {@link ERC20VariableIncentive} initialization.\n *\n * @param {ERC20VariableIncentivePayload} param0\n * @param {Address} param0.asset - The address of the incentivized asset.\n * @param {bigint} param0.reward - The amount of the asset to distribute.\n * @param {bigint} param0.limit - How many times can this incentive be claimed.\n * @returns {*}\n */\nexport function prepareERC20VariableIncentivePayload({\n asset,\n reward,\n limit,\n}: ERC20VariableIncentivePayload) {\n return encodeAbiParameters(\n [\n { type: 'address', name: 'asset' },\n { type: 'uint256', name: 'reward' },\n { type: 'uint256', name: 'limit' },\n ],\n [asset, reward, limit],\n );\n}\n","import { aIncentiveAbi } from '@boostxyz/evm';\nimport {\n AAllowListIncentive,\n ACGDAIncentive,\n AERC20Incentive,\n AERC20VariableIncentive,\n APointsIncentive,\n} from '@boostxyz/evm/deploys/componentInterfaces.json';\nimport { readContract } from '@wagmi/core';\nimport type { Address, Hex } from 'viem';\nimport type { DeployableOptions } from '../Deployable/Deployable';\nimport { InvalidComponentInterfaceError } from '../errors';\nimport { AllowListIncentive } from './AllowListIncentive';\nimport { CGDAIncentive } from './CGDAIncentive';\nimport { ERC20Incentive } from './ERC20Incentive';\nimport { ERC20VariableIncentive } from './ERC20VariableIncentive';\n// import { ERC1155Incentive } from './ERC1155Incentive';\nimport { PointsIncentive } from './PointsIncentive';\n\nexport {\n AllowListIncentive,\n CGDAIncentive,\n // ERC1155Incentive,\n ERC20Incentive,\n PointsIncentive,\n ERC20VariableIncentive,\n};\n\n/**\n * A union type representing all valid protocol Incentive implementations\n *\n * @export\n * @typedef {Incentive}\n */\nexport type Incentive =\n | AllowListIncentive\n | CGDAIncentive\n | ERC20Incentive\n // | ERC1155Incentive\n | PointsIncentive\n | ERC20VariableIncentive;\n\n/**\n * A map of Incentive component interfaces to their constructors.\n *\n * @type {{ \"0xc5b24b8e\": typeof PointsIncentive; \"0x8c901437\": typeof ERC20Incentive; \"0x0a466e6f\": typeof AllowListIncentive; \"0xa39e44d9\": typeof CGDAIncentive; \"0x6060409d\": typeof ERC20VariableIncentive }}\n */\nexport const IncentiveByComponentInterface = {\n [APointsIncentive as Hex]: PointsIncentive,\n [AERC20Incentive as Hex]: ERC20Incentive,\n // TODO: figure out why evm generates bad bytes4 here\n ['0x0a466e6f']: AllowListIncentive,\n // [APointsIncentive as Hex]: ERC1155Incentive,\n [ACGDAIncentive as Hex]: CGDAIncentive,\n [AERC20VariableIncentive as Hex]: ERC20VariableIncentive,\n};\n\n/**\n * A function that will read a contract's component interface using `getComponentInterface` and return the correct instantiated instance.\n *\n * @export\n * @async\n * @param {DeployableOptions} options\n * @param {Address} address\n * @returns {unknown}\n * @throws {@link InvalidComponentInterfaceError}\n */\nexport async function incentiveFromAddress(\n options: DeployableOptions,\n address: Address,\n) {\n const interfaceId = (await readContract(options.config, {\n abi: aIncentiveAbi,\n functionName: 'getComponentInterface',\n address,\n })) as keyof typeof IncentiveByComponentInterface;\n const Ctor = IncentiveByComponentInterface[interfaceId];\n if (!Ctor) {\n throw new InvalidComponentInterfaceError(\n Object.keys(IncentiveByComponentInterface) as Hex[],\n interfaceId as Hex,\n );\n }\n return new Ctor(options, address);\n}\n"],"names":["_ERC20VariableIncentive","DeployableTarget","erc20VariableIncentiveAbi","params","readErc20VariableIncentiveOwner","readErc20VariableIncentiveTotalClaimed","readErc20VariableIncentiveCurrentReward","readErc20VariableIncentiveClaims","address","readErc20VariableIncentiveClaimed","readErc20VariableIncentiveAsset","readErc20VariableIncentiveReward","readErc20VariableIncentiveLimit","payload","request","result","simulateErc20VariableIncentiveClaim","prepareClaimPayload","writeErc20VariableIncentiveClaim","simulateErc20VariableIncentiveClawback","writeErc20VariableIncentiveClawback","readErc20VariableIncentiveIsClaimable","_payload","_options","options","bytecode","prepareERC20VariableIncentivePayload","RegistryType","ERC20VariableIncentive","asset","reward","limit","encodeAbiParameters","IncentiveByComponentInterface","APointsIncentive","PointsIncentive","AERC20Incentive","ERC20Incentive","AllowListIncentive","ACGDAIncentive","CGDAIncentive","AERC20VariableIncentive","incentiveFromAddress","interfaceId","readContract","aIncentiveAbi","Ctor","InvalidComponentInterfaceError"],"mappings":";;;;;;;;;;;;w5cAwFaA,IAAN,MAAMA,UAA+BC,EAG1C;AAAA,EAHK,cAAA;AAAA,UAAA,GAAA,SAAA,GAIL,KAAyB,MAAMC;AAAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA2B/B,MAAa,MACXC,GACA;AACO,WAAA,MAAMC,EAAgC,KAAK,SAAS;AAAA,MACzD,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,aACXA,GACA;AACO,WAAA,MAAME,EAAuC,KAAK,SAAS;AAAA,MAChE,SAAS,KAAK,mB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B,CAACC,CAA8B,GAAGb;AACpC;AAYsB,eAAAc,EACpBlB,GACAhB,GACA;AACA,QAAMmC,IAAe,MAAMC,EAAapB,EAAQ,QAAQ;AAAA,IACtD,KAAKqB;AAAAA,IACL,cAAc;AAAA,IACd,SAAArC;AAAA,EAAA,CACD,GACKsC,IAAOb,EAA8BU,CAAW;AACtD,MAAI,CAACG;AACH,UAAM,IAAIC;AAAA,MACR,OAAO,KAAKd,CAA6B;AAAA,MACzCU;AAAA,IAAA;AAGG,SAAA,IAAIG,EAAKtB,GAAShB,CAAO;AAClC;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("../generated-wKBNvm48.cjs"),n=require("viem"),l=require("../Deployable/DeployableTarget.cjs"),t=require("../claiming.cjs"),o=require("../utils.cjs"),u="0x6080604052348015600e575f80fd5b50601b601f60201b60201c565b60b0565b5f602c608760201b60201c565b90508054600181161560455763f92ee8a95f526004601cfd5b8160c01c808260011c146082578060011b8355806020527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602080a15b505050565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffbf6011325f1b905090565b611b05806100bd5f395ff3fe60806040526004361061019b575f3560e01c8063514e62fc116100eb578063c884ef8311610089578063ea3d508a11610063578063ea3d508a1461057b578063f04e283e146105a5578063f2fde38b146105c1578063fee81cf4146105dd5761019b565b8063c884ef83146104d9578063db09da1214610515578063dcc59b6f146105515761019b565b80638da5cb5b116100c55780638da5cb5b1461041f578063a270a73714610449578063a4d66daf14610473578063bb1757cf1461049d5761019b565b8063514e62fc146103cf57806354d1f13d1461040b578063715018a6146104155761019b565b80632569296211610158578063439fab9111610132578063439fab9114610313578063474f5a441461033b5780634a4ee7b1146103775780634e7165a2146103935761019b565b806325692962146102a357806328d6183b146102ad5780632de94807146102d75761019b565b806301ffc9a71461019f57806307621eca146101db578063183a4f6e146102055780631c10893f146102215780631cd64df41461023d578063228cb73314610279575b5f80fd5b3480156101aa575f80fd5b506101c560048036038101906101c0919061139a565b610619565b6040516101d291906113df565b60405180910390f35b3480156101e6575f80fd5b506101ef610692565b6040516101fc9190611410565b60405180910390f35b61021f600480360381019061021a9190611453565b61069b565b005b61023b600480360381019061023691906114d8565b6106a8565b005b348015610248575f80fd5b50610263600480360381019061025e91906114d8565b6106be565b60405161027091906113df565b60405180910390f35b348015610284575f80fd5b5061028d6106d4565b60405161029a9190611410565b60405180910390f35b6102ab6106da565b005b3480156102b8575f80fd5b506102c161072b565b6040516102ce9190611525565b60405180910390f35b3480156102e2575f80fd5b506102fd60048036038101906102f8919061153e565b610752565b60405161030a9190611410565b60405180910390f35b34801561031e575f80fd5b50610339600480360381019061033491906115ca565b61076b565b005b348015610346575f80fd5b50610361600480360381019061035c91906115ca565b6108c3565b60405161036e91906113df565b60405180910390f35b610391600480360381019061038c91906114d8565b6108f6565b005b34801561039e575f80fd5b506103b960048036038101906103b491906115ca565b61090c565b6040516103c69190611685565b60405180910390f35b3480156103da575f80fd5b506103f560048036038101906103f091906114d8565b610963565b60405161040291906113df565b60405180910390f35b61041361097a565b005b61041d6109b3565b005b34801561042a575f80fd5b506104336109c6565b60405161044091906116b4565b60405180910390f35b348015610454575f80fd5b5061045d6109ee565b60405161046a91906116b4565b60405180910390f35b34801561047e575f80fd5b50610487610a13565b6040516104949190611410565b60405180910390f35b3480156104a8575f80fd5b506104c360048036038101906104be91906116cd565b610a19565b6040516104d091906113df565b60405180910390f35b3480156104e4575f80fd5b506104ff60048036038101906104fa919061153e565b610e30565b60405161050c91906113df565b60405180910390f35b348015610520575f80fd5b5061053b600480360381019061053691906116cd565b610e4d565b60405161054891906113df565b60405180910390f35b34801561055c575f80fd5b50610565610e60565b6040516105729190611410565b60405180910390f35b348015610586575f80fd5b5061058f610e65565b60405161059c9190611525565b60405180910390f35b6105bf60048036038101906105ba919061153e565b610e77565b005b6105db60048036038101906105d6919061153e565b610eb5565b005b3480156105e8575f80fd5b5061060360048036038101906105fe919061153e565b610ede565b6040516106109190611410565b60405180910390f35b5f7fc5b24b8e000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061068b575061068a82610ef7565b5b9050919050565b5f600154905090565b6106a53382610f70565b50565b6106b0610f7f565b6106ba8282610fb6565b5050565b5f81826106ca85610752565b1614905092915050565b60015481565b5f6106e3610fc6565b67ffffffffffffffff164201905063389a75e1600c52335f52806020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d5f80a250565b5f7fc5b24b8e00000000000000000000000000000000000000000000000000000000905090565b5f638b78c6d8600c52815f526020600c20549050919050565b5f610774610fd0565b905080546003825580156107a65760018160011c14303b1061079d5763f92ee8a95f526004601cfd5b818160ff1b1b91505b505f83838101906107b7919061181b565b90505f816040015114806107ce57505f8160600151145b15610805576040517ff92ee8a900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b805f015160035f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550806020015160055f6101000a81548163ffffffff021916908360e01c02179055508060400151600181905550806060015160048190555061088833610ff9565b5080156108be576002815560016020527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602080a15b505050565b5f6040517fd623472500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6108fe610f7f565b6109088282610f70565b5050565b60605f67ffffffffffffffff8111156109285761092761172e565b5b6040519080825280601f01601f19166020018201604052801561095a5781602001600182028036833780820191505090505b50905092915050565b5f808261096f85610752565b161415905092915050565b63389a75e1600c52335f525f6020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c925f80a2565b6109bb610f7f565b6109c45f6110cf565b565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff7487392754905090565b60035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60045481565b5f610a22610f7f565b5f60035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690503073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610aa7573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610acb919061185a565b73ffffffffffffffffffffffffffffffffffffffff1614158015610b6e5750600115158173ffffffffffffffffffffffffffffffffffffffff1663514e62fc3060026040518363ffffffff1660e01b8152600401610b2a9291906118c7565b602060405180830381865afa158015610b45573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b699190611918565b151514155b15610ba5576040517f82b4290000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610bae85611195565b610be4576040517f6247a84e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f80815480929190610bf590611970565b9190505550600160025f8773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff0219169083151502179055505f60035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660055f9054906101000a900460e01b87600154604051602401610cac9291906119b7565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051610d169190611a18565b5f604051808303815f865af19150503d805f8114610d4f576040519150601f19603f3d011682016040523d82523d5f602084013e610d54565b606091505b5050905080610d8f576040517f360e42e100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8573ffffffffffffffffffffffffffffffffffffffff167f9ad2e7a4af16dceda9cce4274b2f59c328d8c012eb0e15eb5e1e73b7d8f264d360035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1688600154604051602001610dff93929190611a93565b604051602081830303815290604052604051610e1b9190611685565b60405180910390a26001925050509392505050565b6002602052805f5260405f205f915054906101000a900460ff1681565b5f610e5784611195565b90509392505050565b5f5481565b60055f9054906101000a900460e01b81565b610e7f610f7f565b63389a75e1600c52805f526020600c208054421115610ea557636f5e88185f526004601cfd5b5f815550610eb2816110cf565b50565b610ebd610f7f565b8060601b610ed257637448fbae5f526004601cfd5b610edb816110cf565b50565b5f63389a75e1600c52815f526020600c20549050919050565b5f7f5970a689000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610f695750610f68826111f6565b5b9050919050565b610f7b82825f61126f565b5050565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927543314610fb4576382b429005f526004601cfd5b565b610fc28282600161126f565b5050565b5f6202a300905090565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffbf6011325f1b905090565b6110016112c7565b15611079577fffffffffffffffffffffffffffffffffffffffffffffffffffffffff7487392780541561103b57630dc149f05f526004601cfd5b8160601b60601c9150811560ff1b82178155815f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3506110cc565b8060601b60601c9050807fffffffffffffffffffffffffffffffffffffffffffffffffffffffff7487392755805f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a35b50565b6110d76112c7565b1561113c577fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739278160601b60601c91508181547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3811560ff1b8217815550611192565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739278160601b60601c91508181547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3818155505b50565b5f60025f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff161580156111ef57506004545f54105b9050919050565b5f7f6ab67a0d000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806112685750611267826112cb565b5b9050919050565b638b78c6d8600c52825f526020600c2080548381178361129157848216821890505b80835580600c5160601c7f715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe265f80a3505050505050565b5f90565b5f7f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b5f604051905090565b5f80fd5b5f80fd5b5f7fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b61137981611345565b8114611383575f80fd5b50565b5f8135905061139481611370565b92915050565b5f602082840312156113af576113ae61133d565b5b5f6113bc84828501611386565b91505092915050565b5f8115159050919050565b6113d9816113c5565b82525050565b5f6020820190506113f25f8301846113d0565b92915050565b5f819050919050565b61140a816113f8565b82525050565b5f6020820190506114235f830184611401565b92915050565b611432816113f8565b811461143c575f80fd5b50565b5f8135905061144d81611429565b92915050565b5f602082840312156114685761146761133d565b5b5f6114758482850161143f565b91505092915050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6114a78261147e565b9050919050565b6114b78161149d565b81146114c1575f80fd5b50565b5f813590506114d2816114ae565b92915050565b5f80604083850312156114ee576114ed61133d565b5b5f6114fb858286016114c4565b925050602061150c8582860161143f565b9150509250929050565b61151f81611345565b82525050565b5f6020820190506115385f830184611516565b92915050565b5f602082840312156115535761155261133d565b5b5f611560848285016114c4565b91505092915050565b5f80fd5b5f80fd5b5f80fd5b5f8083601f84011261158a57611589611569565b5b8235905067ffffffffffffffff8111156115a7576115a661156d565b5b6020830191508360018202830111156115c3576115c2611571565b5b9250929050565b5f80602083850312156115e0576115df61133d565b5b5f83013567ffffffffffffffff8111156115fd576115fc611341565b5b61160985828601611575565b92509250509250929050565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f61165782611615565b611661818561161f565b935061167181856020860161162f565b61167a8161163d565b840191505092915050565b5f6020820190508181035f83015261169d818461164d565b905092915050565b6116ae8161149d565b82525050565b5f6020820190506116c75f8301846116a5565b92915050565b5f805f604084860312156116e4576116e361133d565b5b5f6116f1868287016114c4565b935050602084013567ffffffffffffffff81111561171257611711611341565b5b61171e86828701611575565b92509250509250925092565b5f80fd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6117648261163d565b810181811067ffffffffffffffff821117156117835761178261172e565b5b80604052505050565b5f611795611334565b90506117a1828261175b565b919050565b5f608082840312156117bb576117ba61172a565b5b6117c5608061178c565b90505f6117d4848285016114c4565b5f8301525060206117e784828501611386565b60208301525060406117fb8482850161143f565b604083015250606061180f8482850161143f565b60608301525092915050565b5f608082840312156118305761182f61133d565b5b5f61183d848285016117a6565b91505092915050565b5f81519050611854816114ae565b92915050565b5f6020828403121561186f5761186e61133d565b5b5f61187c84828501611846565b91505092915050565b5f819050919050565b5f819050919050565b5f6118b16118ac6118a784611885565b61188e565b6113f8565b9050919050565b6118c181611897565b82525050565b5f6040820190506118da5f8301856116a5565b6118e760208301846118b8565b9392505050565b6118f7816113c5565b8114611901575f80fd5b50565b5f81519050611912816118ee565b92915050565b5f6020828403121561192d5761192c61133d565b5b5f61193a84828501611904565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f61197a826113f8565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036119ac576119ab611943565b5b600182019050919050565b5f6040820190506119ca5f8301856116a5565b6119d76020830184611401565b9392505050565b5f81905092915050565b5f6119f282611615565b6119fc81856119de565b9350611a0c81856020860161162f565b80840191505092915050565b5f611a2382846119e8565b915081905092915050565b5f8160601b9050919050565b5f611a4482611a2e565b9050919050565b5f611a5582611a3a565b9050919050565b611a6d611a688261149d565b611a4b565b82525050565b5f819050919050565b611a8d611a88826113f8565b611a73565b82525050565b5f611a9e8286611a5c565b601482019150611aae8285611a5c565b601482019150611abe8284611a7c565b60208201915081905094935050505056fea264697066735822122088b34e24fbec910ced058a6b3dffdf327035d99da64bab74d2addc3e9026fe9864736f6c634300081a0033",d=class d extends l.DeployableTarget{constructor(){super(...arguments),this.abi=b.l}async claims(f){return await b.A5(this._config,{address:this.assertValidAddress(),args:[],...f})}async currentReward(f){return await b.h5(this._config,{address:this.assertValidAddress(),args:[],...f})}async reward(f){return await b.x5(this._config,{address:this.assertValidAddress(),args:[],...f})}async claimed(f,a){return await b.I5(this._config,{address:this.assertValidAddress(),args:[f],...a})}async venue(f){return await b._5(this._config,{address:this.assertValidAddress(),...f})}async limit(f){return await b.E5(this._config,{address:this.assertValidAddress(),...f})}async selector(f){return await b.H5(this._config,{address:this.assertValidAddress(),...f})}async claim(f,a){return await this.awaitResult(this.claimRaw(f,a))}async claimRaw(f,a){const{request:e,result:c}=await b.J5(this._config,{address:this.assertValidAddress(),args:[t.prepareClaimPayload(f)],...this.optionallyAttachAccount(),...a});return{hash:await b.k5(this._config,e),result:c}}async isClaimable(f,a){return await b.C5(this._config,{address:this.assertValidAddress(),args:[t.prepareClaimPayload(f)],...a})}buildParameters(f,a){const[e,c]=this.validateDeploymentConfig(f,a);return{abi:b.l,bytecode:u,args:[r(e)],...this.optionallyAttachAccount(c.account)}}};d.base="0xcE8f0F83afea8514287bcb74cf82F40A7Acc6e95",d.registryType=o.RegistryType.INCENTIVE;let s=d;const r=({venue:i,selector:f,reward:a,limit:e})=>n.encodeAbiParameters([{type:"address",name:"venue"},{type:"bytes4",name:"selector"},{type:"uint256",name:"reward"},{type:"uint256",name:"limit"}],[i,f,a,e]);exports.pointsIncentiveAbi=b.l;exports.PointsIncentive=s;exports.preparePointsIncentivePayload=r;
|
|
2
|
+
//# sourceMappingURL=PointsIncentive.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PointsIncentive.cjs","sources":["../../src/Incentives/PointsIncentive.ts"],"sourcesContent":["import {\n pointsIncentiveAbi,\n readPointsIncentiveClaimed,\n readPointsIncentiveClaims,\n readPointsIncentiveCurrentReward,\n readPointsIncentiveIsClaimable,\n readPointsIncentiveLimit,\n readPointsIncentiveReward,\n readPointsIncentiveSelector,\n readPointsIncentiveVenue,\n simulatePointsIncentiveClaim,\n writePointsIncentiveClaim,\n} from '@boostxyz/evm';\nimport { bytecode } from '@boostxyz/evm/artifacts/contracts/incentives/PointsIncentive.sol/PointsIncentive.json';\nimport {\n type Address,\n type ContractEventName,\n type Hex,\n encodeAbiParameters,\n} from 'viem';\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 { pointsIncentiveAbi };\n\n/**\n * The object representation of a `PointsIncentive.InitPayload`\n *\n * @export\n * @interface PointsIncentivePayload\n * @typedef {PointsIncentivePayload}\n */\nexport interface PointsIncentivePayload {\n /**\n * The address of the points contract\n *\n * @type {Address}\n */\n venue: Address;\n /**\n * The selector for the issuance function on the points contract\n *\n * @type {Hex}\n */\n selector: Hex;\n /**\n * The reward amount issued for each claim\n *\n * @type {bigint}\n */\n reward: bigint;\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 `PointsIncentive` event types.\n *\n * @export\n * @typedef {PointsIncentiveLog}\n * @template {ContractEventName<\n * typeof pointsIncentiveAbi\n * >} [event=ContractEventName<typeof pointsIncentiveAbi>]\n */\nexport type PointsIncentiveLog<\n event extends ContractEventName<\n typeof pointsIncentiveAbi\n > = ContractEventName<typeof pointsIncentiveAbi>,\n> = GenericLog<typeof pointsIncentiveAbi, event>;\n\n/**\n * A simple on-chain points incentive implementation that allows claiming of soulbound tokens.\n *\n * In order for any claim to be successful:\n * - The claimer must not have already claimed the incentive; and\n * - The maximum number of claims must not have been reached; and\n * - This contract must be authorized to operate the points contract's issuance function\n *\n * @export\n * @class PointsIncentive\n * @typedef {PointsIncentive}\n * @extends {DeployableTarget<PointsIncentivePayload>}\n */\nexport class PointsIncentive extends DeployableTarget<\n PointsIncentivePayload,\n typeof pointsIncentiveAbi\n> {\n public override readonly abi = pointsIncentiveAbi;\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {Address}\n */\n public static override base: Address = import.meta.env\n .VITE_POINTS_INCENTIVE_BASE;\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {RegistryType}\n */\n public static override registryType: RegistryType = RegistryType.INCENTIVE;\n\n /**\n * The number of claims that have been made\n *\n * @public\n * @async\n * @param {?ReadParams<typeof erc20IncentiveAbi, 'claims'>} [params]\n * @returns {Promise<bigint>}\n */\n public async claims(\n params?: ReadParams<typeof pointsIncentiveAbi, 'claims'>,\n ) {\n return await readPointsIncentiveClaims(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 current reward\n *\n * @public\n * @async\n * @param {?ReadParams<typeof erc20IncentiveAbi, 'currentReward'>} [params]\n * @returns {Promise<bigint>} - The current reward\n */\n public async currentReward(\n params?: ReadParams<typeof pointsIncentiveAbi, 'currentReward'>,\n ) {\n return await readPointsIncentiveCurrentReward(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<typeof pointsIncentiveAbi, 'reward'>} [params]\n * @returns {unknown}\n */\n public async reward(\n params?: ReadParams<typeof pointsIncentiveAbi, 'reward'>,\n ) {\n return await readPointsIncentiveReward(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 * A mapping of address to claim status\n *\n * @public\n * @async\n * @param {Address} address\n * @param {?ReadParams<typeof pointsIncentiveAbi, 'claimed'>} [params]\n * @returns {unknown}\n */\n public async claimed(\n address: Address,\n params?: ReadParams<typeof pointsIncentiveAbi, 'claimed'>,\n ) {\n return await readPointsIncentiveClaimed(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 address of the points contract\n *\n * @public\n * @async\n * @param {?ReadParams<typeof pointsIncentiveAbi, 'venue'>} [params]\n * @returns {unknown}\n */\n public async venue(params?: ReadParams<typeof pointsIncentiveAbi, 'venue'>) {\n return await readPointsIncentiveVenue(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 maximum number of claims that can be made (one per address)\n *\n * @public\n * @async\n * @param {?ReadParams<typeof pointsIncentiveAbi, 'limit'>} [params]\n * @returns {Promise<bigint>}\n */\n public async limit(params?: ReadParams<typeof pointsIncentiveAbi, 'limit'>) {\n return await readPointsIncentiveLimit(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 selector for the issuance function on the points contract\n *\n * @public\n * @async\n * @param {?ReadParams<typeof pointsIncentiveAbi, 'selector'>} [params]\n * @returns {Promise<Hex>}\n */\n public async selector(\n params?: ReadParams<typeof pointsIncentiveAbi, 'selector'>,\n ) {\n return await readPointsIncentiveSelector(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<typeof pointsIncentiveAbi, 'claim'>} [params]\n * @returns {Promise<boolean>} - True if the incentive was successfully claimed\n */\n protected async claim(\n payload: ClaimPayload,\n params?: WriteParams<typeof pointsIncentiveAbi, 'claim'>,\n ) {\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<typeof pointsIncentiveAbi, 'claim'>} [params]\n * @returns {Promise<boolean>} - True if the incentive was successfully claimed\n */\n protected async claimRaw(\n payload: ClaimPayload,\n params?: WriteParams<typeof pointsIncentiveAbi, 'claim'>,\n ) {\n const { request, result } = await simulatePointsIncentiveClaim(\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 writePointsIncentiveClaim(this._config, request);\n return { hash, result };\n }\n\n /**\n * Check if an incentive is claimable.\n * For the POOL strategy, the `bytes data` portion of the payload ignored.\n * The recipient must not have already claimed the incentive.\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?ReadParams<typeof pointsIncentiveAbi, 'isClaimable'>} [params]\n * @returns {Promise<boolean>} - True if the incentive is claimable based on the data payload\n */\n public async isClaimable(\n payload: ClaimPayload,\n params?: ReadParams<typeof pointsIncentiveAbi, 'isClaimable'>,\n ) {\n return await readPointsIncentiveIsClaimable(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 * @inheritdoc\n *\n * @public\n * @param {?PointsIncentivePayload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {GenericDeployableParams}\n */\n public override buildParameters(\n _payload?: PointsIncentivePayload,\n _options?: DeployableOptions,\n ): GenericDeployableParams {\n const [payload, options] = this.validateDeploymentConfig(\n _payload,\n _options,\n );\n return {\n abi: pointsIncentiveAbi,\n bytecode: bytecode as Hex,\n args: [preparePointsIncentivePayload(payload)],\n ...this.optionallyAttachAccount(options.account),\n };\n }\n}\n\n/**\n * Given a {@link PointsIncentivePayload}, properly encode a `PointsIncentive.InitPayload` for use with {@link PointsIncentive} initialization.\n *\n * @param {PointsIncentivePayload} param0\n * @param {Address} param0.venue - The address of the points contract\n * @param {Hex} param0.selector - The selector for the issuance function on the points contract\n * @param {bigint} param0.reward - The reward amount issued for each claim\n * @param {bigint} param0.limit - The maximum number of claims that can be made (one per address)\n * @returns {*}\n */\nexport const preparePointsIncentivePayload = ({\n venue,\n selector,\n reward,\n limit,\n}: PointsIncentivePayload) => {\n return encodeAbiParameters(\n [\n { type: 'address', name: 'venue' },\n { type: 'bytes4', name: 'selector' },\n { type: 'uint256', name: 'reward' },\n { type: 'uint256', name: 'limit' },\n ],\n [venue, selector, reward, limit],\n );\n};\n"],"names":["_PointsIncentive","DeployableTarget","pointsIncentiveAbi","params","readPointsIncentiveClaims","readPointsIncentiveCurrentReward","readPointsIncentiveReward","address","readPointsIncentiveClaimed","readPointsIncentiveVenue","readPointsIncentiveLimit","readPointsIncentiveSelector","payload","request","result","simulatePointsIncentiveClaim","prepareClaimPayload","writePointsIncentiveClaim","readPointsIncentiveIsClaimable","_payload","_options","options","bytecode","preparePointsIncentivePayload","RegistryType","PointsIncentive","venue","selector","reward","limit","encodeAbiParameters"],"mappings":"iocAiGaA,EAAN,MAAMA,UAAwBC,EAAAA,gBAGnC,CAHK,aAAA,CAAA,MAAA,GAAA,SAAA,EAIL,KAAyB,IAAMC,GAAA,CA2B/B,MAAa,OACXC,EACA,CACO,OAAA,MAAMC,EAAAA,GAA0B,KAAK,QAAS,CACnD,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAAC,EAEP,GAAID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