@boostxyz/sdk 7.1.0 → 7.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"ERC20PeggedVariableCriteriaIncentiveV2.js","sources":["../../src/Incentives/ERC20PeggedVariableCriteriaIncentiveV2.ts"],"sourcesContent":["import {\n erc20PeggedVariableCriteriaIncentiveV2Abi,\n readErc20PeggedVariableCriteriaIncentiveV2Asset,\n readErc20PeggedVariableCriteriaIncentiveV2Claimed,\n readErc20PeggedVariableCriteriaIncentiveV2Claims,\n readErc20PeggedVariableCriteriaIncentiveV2CurrentReward,\n readErc20PeggedVariableCriteriaIncentiveV2GetIncentiveCriteria,\n readErc20PeggedVariableCriteriaIncentiveV2GetMaxReward,\n readErc20PeggedVariableCriteriaIncentiveV2GetPeg,\n readErc20PeggedVariableCriteriaIncentiveV2IsClaimable,\n readErc20PeggedVariableCriteriaIncentiveV2Limit,\n readErc20PeggedVariableCriteriaIncentiveV2Owner,\n readErc20PeggedVariableCriteriaIncentiveV2Peg,\n readErc20PeggedVariableCriteriaIncentiveV2Reward,\n readErc20PeggedVariableCriteriaIncentiveV2TotalClaimed,\n simulateErc20PeggedVariableCriteriaIncentiveV2Claim,\n simulateErc20PeggedVariableCriteriaIncentiveV2Clawback,\n writeErc20PeggedVariableCriteriaIncentiveV2Claim,\n writeErc20PeggedVariableCriteriaIncentiveV2Clawback,\n} from '@boostxyz/evm';\nimport { bytecode } from '@boostxyz/evm/artifacts/contracts/incentives/ERC20PeggedVariableCriteriaIncentiveV2.sol/ERC20PeggedVariableCriteriaIncentiveV2.json';\nimport { getTransaction, getTransactionReceipt } from '@wagmi/core';\nimport type { AbiEvent } from 'abitype';\nimport {\n type AbiFunction,\n type Address,\n type ContractEventName,\n type Hex,\n decodeAbiParameters,\n decodeFunctionData,\n encodeAbiParameters,\n parseEther,\n parseEventLogs,\n zeroAddress,\n zeroHash,\n} from 'viem';\nimport { ERC20PeggedVariableCriteriaIncentiveV2 as ERC20PeggedVariableCriteriaIncentiveV2Bases } from '../../dist/deployments.json';\nimport { SignatureType } from '../Actions/EventAction';\nimport type {\n DeployableOptions,\n GenericDeployableParams,\n} from '../Deployable/Deployable';\nimport { DeployableTarget } from '../Deployable/DeployableTarget';\nimport { type ClaimPayload, prepareClaimPayload } from '../claiming';\nimport {\n DecodedArgsError,\n IncentiveCriteriaNotFoundError,\n InvalidCriteriaTypeError,\n NoMatchingLogsError,\n} from '../errors';\nimport {\n CheatCodes,\n type GenericLog,\n type ReadParams,\n RegistryType,\n type WriteParams,\n} from '../utils';\nimport type {\n GetIncentiveScalarV2Params,\n IncentiveCriteriaV2,\n} from './ERC20VariableCriteriaIncentiveV2';\n\nexport { erc20PeggedVariableCriteriaIncentiveV2Abi };\n\n/**\n * The object representation of a `Erc20PeggedVariableCriteriaIncentiveV2.InitPayload`\n *\n * @export\n * @interface Erc20PeggedVariableCriteriaIncentiveV2\n * @typedef {Erc20PeggedVariableCriteriaIncentiveV2}\n */\nexport interface ERC20PeggedVariableCriteriaIncentiveV2Payload {\n /**\n * The address of the incentivized asset.\n *\n * @type {Address}\n */\n asset: Address;\n /**\n * The peg to normalize to.\n *\n * @type {Address}\n */\n peg: Address;\n /**\n * The amount of the asset to distribute.\n *\n * @type {bigint}\n */\n reward: bigint;\n /**\n * Total spend for the incentive.\n *\n * @type {bigint}\n */\n limit: bigint;\n /**\n * Maximum reward each claim is elligible for.\n *\n * @type {bigint}\n */\n maxReward: bigint;\n /**\n * (Optional) The address of the entity that can managed the incentive.\n *\n * @type {Address}\n * @optional\n */\n manager?: Address;\n /**\n * The criteria for the incentive that determines how the reward is distributed.\n *\n * @type {IncentiveCriteria}\n */\n criteria: IncentiveCriteriaV2;\n}\n\n/**\n * A generic `viem.Log` event with support for `Erc20PeggedVariableCriteriaIncentiveV2` event types.\n *\n * @export\n * @typedef {Erc20PeggedVariableCriteriaIncentiveV2Log}\n * @template {ContractEventName<typeof erc20PeggedVariableCriteriaIncentiveV2Abi>} [event=ContractEventName<\n * typeof erc20PeggedVariableCriteriaIncentiveV2Abi\n * >]\n */\nexport type Erc20PeggedVariableCriteriaIncentiveV2Log<\n event extends ContractEventName<\n typeof erc20PeggedVariableCriteriaIncentiveV2Abi\n > = ContractEventName<typeof erc20PeggedVariableCriteriaIncentiveV2Abi>,\n> = GenericLog<typeof erc20PeggedVariableCriteriaIncentiveV2Abi, event>;\n\n/**\n * A simple ERC20 incentive implementation that allows claiming of tokens\n *\n * @export\n * @class Erc20PeggedVariableCriteriaIncentive\n * @typedef {ERC20PeggedVariableCriteriaIncentiveV2}\n * @extends {DeployableTarget<ERC20PeggedVariableCriteriaIncentiveV2>}\n */\nexport class ERC20PeggedVariableCriteriaIncentiveV2 extends DeployableTarget<\n ERC20PeggedVariableCriteriaIncentiveV2Payload,\n typeof erc20PeggedVariableCriteriaIncentiveV2Abi\n> {\n public override readonly abi = erc20PeggedVariableCriteriaIncentiveV2Abi;\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {Record<number, Address>}\n */\n public static override bases: Record<number, Address> = {\n 31337: import.meta.env\n .VITE_ERC20_PEGGED_VARIABLE_CRITERIA_INCENTIVE_V2_BASE,\n ...(ERC20PeggedVariableCriteriaIncentiveV2Bases as Record<number, Address>),\n };\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {RegistryType}\n */\n public static override registryType: RegistryType = RegistryType.INCENTIVE;\n\n /**\n * The owner of the incentive\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<Address>}\n */\n public async owner(params?: ReadParams) {\n return await readErc20PeggedVariableCriteriaIncentiveV2Owner(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 * Calculates the current reward based on the time since the last claim. The reward is calculated based on the time since the last claim, the available budget, and the reward parameters. It increases linearly over time in the absence of claims, with each hour adding `rewardBoost` to the current reward, up to the available budget. For example, if there is one claim in the first hour, then no claims for three hours, the claimable reward would be `initialReward - rewardDecay + (rewardBoost * 3)`\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>} - The current reward\n */\n public async currentReward(params?: ReadParams) {\n return await readErc20PeggedVariableCriteriaIncentiveV2CurrentReward(\n this._config,\n {\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 /**\n * Retrieves the maximum reward amount per claim.\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>} The maximum reward amount per claim\n */\n public async getMaxReward(params?: ReadParams): Promise<bigint> {\n const maxReward =\n await readErc20PeggedVariableCriteriaIncentiveV2GetMaxReward(\n this._config,\n {\n ...params,\n address: this.assertValidAddress(),\n },\n );\n\n return maxReward;\n }\n\n /**\n * Fetches the incentive scalar from a transaction hash\n *\n * @param {GetIncentiveScalarParams} params\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n * @throws {InvalidCriteriaTypeError | NoMatchingLogsError | DecodedArgsError}\n */\n public async getIncentiveScalar(\n { chainId, hash, knownSignatures }: GetIncentiveScalarV2Params,\n params?: ReadParams,\n ): Promise<bigint> {\n const criteria = await this.getIncentiveCriteria(params);\n if (criteria.criteriaType === SignatureType.EVENT) {\n const transactionReceipt = await getTransactionReceipt(this._config, {\n chainId,\n hash,\n });\n if (criteria.fieldIndex === CheatCodes.GAS_REBATE_INCENTIVE) {\n const totalCost =\n transactionReceipt.gasUsed * transactionReceipt.effectiveGasPrice + // Normal gas cost\n (transactionReceipt.blobGasUsed ?? 0n) *\n (transactionReceipt.blobGasPrice ?? 0n); // Blob gas cost - account for potential undefined values\n return totalCost;\n }\n const logs = transactionReceipt.logs;\n\n if (logs.length === 0) {\n throw new NoMatchingLogsError(\n `No logs found for event signature ${criteria.signature}`,\n );\n }\n\n // Decode the event log\n try {\n // Decode function data\n const eventAbi = knownSignatures[criteria.signature] as AbiEvent;\n const decodedEvents = parseEventLogs({\n abi: [eventAbi],\n logs,\n });\n if (decodedEvents == undefined || decodedEvents.length === 0) {\n throw new NoMatchingLogsError(\n `No logs found for event signature ${criteria.signature}`,\n );\n }\n const scalarValue = (decodedEvents[0]?.args as string[])[\n criteria.fieldIndex\n ];\n\n if (scalarValue === undefined) {\n throw new DecodedArgsError(\n `Decoded argument at index ${criteria.fieldIndex} is undefined`,\n );\n }\n return BigInt(scalarValue);\n } catch (e) {\n throw new DecodedArgsError(\n `Failed to decode event log for signature ${criteria.signature}: ${(e as Error).message}`,\n );\n }\n } else if (criteria.criteriaType === SignatureType.FUNC) {\n // Fetch the transaction data\n const transaction = await getTransaction(this._config, {\n chainId,\n hash,\n });\n try {\n // Decode function data\n const func = knownSignatures[criteria.signature] as AbiFunction;\n const decodedFunction = decodeFunctionData({\n abi: [func],\n data: transaction.input,\n });\n const scalarValue = decodedFunction.args[criteria.fieldIndex] as string;\n if (scalarValue === undefined || scalarValue === null) {\n throw new DecodedArgsError(\n `Decoded argument at index ${criteria.fieldIndex} is undefined`,\n );\n }\n return BigInt(scalarValue);\n } catch (e) {\n throw new DecodedArgsError(\n `Failed to decode function data for signature ${criteria.signature}: ${(e as Error).message}`,\n );\n }\n } else {\n throw new InvalidCriteriaTypeError(\n `Invalid criteria type ${criteria.criteriaType}`,\n );\n }\n }\n\n /**\n * The number of claims that have been made\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async claims(params?: ReadParams) {\n return await readErc20PeggedVariableCriteriaIncentiveV2Claims(\n this._config,\n {\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 /**\n * The total amount of rewards claimed\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async totalClaimed(params?: ReadParams) {\n return await readErc20PeggedVariableCriteriaIncentiveV2TotalClaimed(\n this._config,\n {\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 /**\n * A mapping of address to claim status\n *\n * @public\n * @async\n * @param {Address} address\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>}\n */\n public async claimed(address: Address, params?: ReadParams) {\n return await readErc20PeggedVariableCriteriaIncentiveV2Claimed(\n this._config,\n {\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 /**\n * The address of the ERC20-like token\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<Address>}\n */\n public async asset(params?: ReadParams) {\n return await readErc20PeggedVariableCriteriaIncentiveV2Asset(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 address of the pegged ERC20-like token\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<Address>}\n */\n public async peg(params?: ReadParams) {\n return await readErc20PeggedVariableCriteriaIncentiveV2Peg(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} [params]\n * @returns {Promise<bigint>}\n */\n public async reward(params?: ReadParams) {\n return await readErc20PeggedVariableCriteriaIncentiveV2Reward(\n this._config,\n {\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 /**\n * The limit (max possible rewards payout in reward token)\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async limit(params?: ReadParams) {\n return await readErc20PeggedVariableCriteriaIncentiveV2Limit(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Claim the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<boolean>} - Returns true if successfully claimed\n */\n protected async claim(payload: ClaimPayload, params?: WriteParams) {\n return await this.awaitResult(this.claimRaw(payload, params));\n }\n\n /**\n * Claim the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: boolean; }>} - Returns true if successfully claimed\n */\n protected async claimRaw(payload: ClaimPayload, params?: WriteParams) {\n const { request, result } =\n await simulateErc20PeggedVariableCriteriaIncentiveV2Claim(this._config, {\n address: this.assertValidAddress(),\n args: [prepareClaimPayload(payload)],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n const hash = await writeErc20PeggedVariableCriteriaIncentiveV2Claim(\n this._config,\n request,\n );\n return { hash, result };\n }\n\n /**\n * Clawback assets from the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<boolean>} - True if the assets were successfully clawbacked\n */\n public async clawback(payload: ClaimPayload, params?: WriteParams) {\n return await this.awaitResult(this.clawbackRaw(payload, params));\n }\n\n /**\n * Clawback assets from the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: boolean; }>} - True if the assets were successfully clawbacked\n */\n public async clawbackRaw(payload: ClaimPayload, params?: WriteParams) {\n const { request, result } =\n await simulateErc20PeggedVariableCriteriaIncentiveV2Clawback(\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 writeErc20PeggedVariableCriteriaIncentiveV2Clawback(\n this._config,\n request,\n );\n return { hash, result };\n }\n\n /**\n * Check if an incentive is claimable.\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>} = True if the incentive is claimable based on the data payload\n */\n public async isClaimable(payload: ClaimPayload, params?: ReadParams) {\n return await readErc20PeggedVariableCriteriaIncentiveV2IsClaimable(\n this._config,\n {\n address: this.assertValidAddress(),\n args: [payload.target, payload.data],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n },\n );\n }\n\n /**\n * read the peg token for the incentive.\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<Address>} = The address of the token the reward is pegged to\n */\n public async getPeg(params?: ReadParams) {\n return await readErc20PeggedVariableCriteriaIncentiveV2GetPeg(\n this._config,\n {\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 /**\n * Get the maximum amount that can be claimed by this incentive. Useful when used in conjunction with `BoostCore.calculateProtocolFee`\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>} = Return a bigint representing that maximum amount that can be distributed by this incentive.\n */\n public async getTotalBudget(params?: ReadParams) {\n return await this.limit(params);\n }\n\n /**\n * Check if any claims remain by comparing the incentive's total claims against its limit. Does not take requesting user's elligibility into account.\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>} - True if total claims is less than limit\n */\n public async canBeClaimed(params?: ReadParams) {\n return (await this.getRemainingClaimPotential(params)) > 0n;\n }\n\n /**\n * Check how many claims remain by comparing the incentive's total claims against its limit. Does not take requesting user's elligibility into account.\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>} - True if total claims is less than limit\n */\n public async getRemainingClaimPotential(params?: ReadParams) {\n const [totalClaimed, limit] = await Promise.all([\n this.totalClaimed(params),\n this.limit(params),\n ]);\n return limit - totalClaimed;\n }\n\n /**\n *Functions from the ERC20VariableIncentive contract\n */\n\n /**\n * Fetches the IncentiveCriteria struct from the contract\n *\n * @param {?ReadParams} [params]\n * @returns {Promise<IncentiveCriteria>} Incentive criteria structure\n * @throws {IncentiveCriteriaNotFoundError}\n */\n public async getIncentiveCriteria(\n params?: ReadParams,\n ): Promise<IncentiveCriteriaV2> {\n try {\n const criteria =\n await readErc20PeggedVariableCriteriaIncentiveV2GetIncentiveCriteria(\n this._config,\n {\n ...params,\n address: this.assertValidAddress(),\n },\n );\n\n return criteria;\n } catch (e) {\n throw new IncentiveCriteriaNotFoundError(e as Error);\n }\n }\n\n /**\n * Generates a top-up payload for the ERC20PeggedIncentive contract by incrementing\n * the existing `limit` field by `netAmount`. The entire payload is then re-encoded\n * via `prepareERC20PeggedIncentivePayload(...)`.\n *\n * @public\n * @param {bigint} netAmount - The additional limit to add to this incentive.\n * @returns {Hex} The ABI-encoded payload with the updated `limit`.\n */\n public async getTopupPayload(netAmount: bigint): Promise<Hex> {\n return prepareERC20PeggedVariableCriteriaIncentiveV2Payload({\n asset: (await this.asset()) ?? zeroAddress,\n peg: this.payload?.peg ?? zeroAddress,\n reward: this.payload?.reward ?? 0n,\n limit: netAmount,\n maxReward: this.payload?.maxReward ?? 0n,\n manager: this.payload?.manager ?? zeroAddress,\n criteria: this.payload?.criteria ?? {\n criteriaType: 0,\n signature: zeroHash,\n fieldIndex: 0,\n targetContract: zeroAddress,\n valueType: 0,\n },\n });\n }\n\n /**\n * @inheritdoc\n *\n * @public\n * @param {?ERC20PeggedVariableCriteriaIncentiveV2Payload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {GenericDeployableParams}\n */\n public override buildParameters(\n _payload?: ERC20PeggedVariableCriteriaIncentiveV2Payload,\n _options?: DeployableOptions,\n ): GenericDeployableParams {\n const [payload, options] = this.validateDeploymentConfig(\n _payload,\n _options,\n );\n return {\n abi: erc20PeggedVariableCriteriaIncentiveV2Abi,\n bytecode: bytecode as Hex,\n args: [prepareERC20PeggedVariableCriteriaIncentiveV2Payload(payload)],\n ...this.optionallyAttachAccount(options.account),\n };\n }\n\n /**\n * Encodes an amount to clawback from the incentive\n *\n * @public\n * @param {bigint} amount - How much of the asset to clawback\n * @returns {Hex} - Returns an encoded uint256\n */\n public buildClawbackData(amount: bigint) {\n return encodeAbiParameters([{ type: 'uint256' }], [amount]);\n }\n\n /**\n * Builds the claim data for the ERC20PeggedVariableCriteriaIncentivePayload.\n *\n * @public\n * @param {bigint} signedAmount\n * @returns {Hash} Returns the encoded claim data\n * @description This function returns the encoded claim data for the ERC20PeggedVariableCriteriaIncentiveV2Payload.\n */\n public buildClaimData(signedAmount: bigint) {\n return encodeAbiParameters(\n [{ type: 'uint256', name: 'signedAmount' }],\n [signedAmount],\n );\n }\n\n /**\n * Decodes claim data for the ERC20PeggedVariableCriteriaIncentiveV2, returning the claim amount.\n * Useful when deriving amount claimed from logs.\n *\n * @public\n * @param {Hex} claimData\n * @returns {Promise<bigint>} Returns the reward amount from a claim data payload\n */\n public async decodeClaimData(claimData: Hex) {\n const boostClaimData = decodeAbiParameters(\n [\n {\n type: 'tuple',\n name: 'BoostClaimData',\n components: [\n { type: 'bytes', name: 'validatorData' },\n { type: 'bytes', name: 'incentiveData' },\n ],\n },\n ],\n claimData,\n );\n const signedAmount = decodeAbiParameters(\n [{ type: 'uint256' }],\n boostClaimData[0].incentiveData,\n )[0];\n let claimAmount = signedAmount;\n const [reward, maxReward] = await Promise.all([\n this.reward(),\n this.getMaxReward(),\n ]);\n\n if (reward === 0n) {\n return claimAmount;\n } else {\n claimAmount = (reward * signedAmount) / parseEther('1');\n }\n\n if (maxReward !== 0n && claimAmount > maxReward) {\n claimAmount = maxReward;\n }\n\n return claimAmount;\n }\n\n /**\n * Decodes claim data for the ERC20PeggedVariableCriteriaIncentiveV2, returning the claim amount.\n * Useful when deriving amount claimed from logs.\n * Use this function instead of `decodeClaimData` if you have reward details.\n *\n * @public\n * @param {Hex} claimData\n * @param {bigint} [reward]\n * @param {bigint} [maxReward]\n * @returns {BigInt} Returns the reward amount from a claim data payload\n */\n public decodeClaimDataWithRewardDetails(\n claimData: Hex,\n reward: bigint,\n maxReward: bigint,\n ) {\n const boostClaimData = decodeAbiParameters(\n [\n {\n type: 'tuple',\n name: 'BoostClaimData',\n components: [\n { type: 'bytes', name: 'validatorData' },\n { type: 'bytes', name: 'incentiveData' },\n ],\n },\n ],\n claimData,\n );\n const signedAmount = decodeAbiParameters(\n [{ type: 'uint256' }],\n boostClaimData[0].incentiveData,\n )[0];\n let claimAmount = signedAmount;\n\n if (reward === 0n) {\n return claimAmount;\n } else {\n claimAmount = (reward * signedAmount) / parseEther('1');\n }\n\n if (maxReward !== 0n && claimAmount > maxReward) {\n claimAmount = maxReward;\n }\n\n return claimAmount;\n }\n}\n\n/**\n * Given a {@link ERC20PeggedVariableCriteriaIncentiveV2Payload}, properly encode a `ERC20PeggedVariableCriteriaIncentiveV2Payload.InitPayload` for use with {@link ERC20PeggedVariableCriteriaIncentiveV2Payload} initialization.\n *\n * @param {ERC20PeggedVariableCriteriaIncentiveV2Payload} param0\n * @param {Address} param0.asset - The address of the incentivized asset.\n * @param {Address} param0.peg - The peg to normalize to.\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 * @param {Address} [param0.manager=zeroAddress] - The entity that can manage the incentive.\n * @param {IncentiveCriteria} param0.criteria - The incentive criteria for reward distribution.\n * @returns {Hex}\n */\nexport function prepareERC20PeggedVariableCriteriaIncentiveV2Payload({\n asset,\n peg,\n reward,\n limit,\n maxReward = 0n,\n manager = zeroAddress,\n criteria,\n}: ERC20PeggedVariableCriteriaIncentiveV2Payload) {\n return encodeAbiParameters(\n [\n {\n type: 'tuple',\n name: 'initPayloadExtended',\n components: [\n { type: 'address', name: 'asset' },\n { type: 'address', name: 'peg' },\n { type: 'uint256', name: 'reward' },\n { type: 'uint256', name: 'limit' },\n { type: 'address', name: 'manager' },\n { type: 'uint256', name: 'maxReward' },\n {\n type: 'tuple',\n name: 'criteria',\n components: [\n { type: 'uint8', name: 'criteriaType' },\n { type: 'bytes32', name: 'signature' },\n { type: 'uint8', name: 'fieldIndex' },\n { type: 'address', name: 'targetContract' },\n { type: 'uint8', name: 'valueType' },\n ],\n },\n ],\n },\n ],\n [\n {\n asset,\n peg,\n reward,\n limit,\n manager,\n maxReward,\n criteria: {\n criteriaType: criteria.criteriaType,\n signature: criteria.signature,\n fieldIndex: criteria.fieldIndex,\n targetContract: criteria.targetContract,\n valueType: criteria.valueType,\n },\n },\n ],\n );\n}\n"],"names":["_ERC20PeggedVariableCriteriaIncentiveV2","DeployableTarget","erc20PeggedVariableCriteriaIncentiveV2Abi","params","readErc20PeggedVariableCriteriaIncentiveV2Owner","readErc20PeggedVariableCriteriaIncentiveV2CurrentReward","readErc20PeggedVariableCriteriaIncentiveV2GetMaxReward","chainId","hash","knownSignatures","criteria","SignatureType","transactionReceipt","getTransactionReceipt","CheatCodes","logs","NoMatchingLogsError","eventAbi","decodedEvents","parseEventLogs","scalarValue","_a","DecodedArgsError","e","transaction","getTransaction","func","decodeFunctionData","InvalidCriteriaTypeError","readErc20PeggedVariableCriteriaIncentiveV2Claims","readErc20PeggedVariableCriteriaIncentiveV2TotalClaimed","address","readErc20PeggedVariableCriteriaIncentiveV2Claimed","readErc20PeggedVariableCriteriaIncentiveV2Asset","readErc20PeggedVariableCriteriaIncentiveV2Peg","readErc20PeggedVariableCriteriaIncentiveV2Reward","readErc20PeggedVariableCriteriaIncentiveV2Limit","payload","request","result","simulateErc20PeggedVariableCriteriaIncentiveV2Claim","prepareClaimPayload","writeErc20PeggedVariableCriteriaIncentiveV2Claim","simulateErc20PeggedVariableCriteriaIncentiveV2Clawback","writeErc20PeggedVariableCriteriaIncentiveV2Clawback","readErc20PeggedVariableCriteriaIncentiveV2IsClaimable","readErc20PeggedVariableCriteriaIncentiveV2GetPeg","totalClaimed","limit","readErc20PeggedVariableCriteriaIncentiveV2GetIncentiveCriteria","IncentiveCriteriaNotFoundError","netAmount","prepareERC20PeggedVariableCriteriaIncentiveV2Payload","zeroAddress","_b","_c","_d","_e","zeroHash","_payload","_options","options","bytecode","amount","encodeAbiParameters","signedAmount","claimData","boostClaimData","decodeAbiParameters","claimAmount","reward","maxReward","parseEther","ERC20PeggedVariableCriteriaIncentiveV2Bases","RegistryType","ERC20PeggedVariableCriteriaIncentiveV2","asset","peg","manager"],"mappings":";;;;;;;;;spjBA4IaA,IAAN,MAAMA,UAA+CC,EAG1D;AAAA,EAHK,cAAA;AAAA,UAAA,GAAA,SAAA,GAIL,KAAyB,MAAMC;AAAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA8B/B,MAAa,MAAMC,GAAqB;AAC/B,WAAA,MAAMC,EAAgD,KAAK,SAAS;AAAA,MACzE,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,cAAcA,GAAqB;AAC9C,WAAO,MAAME;AAAAA,MACX,KAAK;AAAA,MACL;AAAA,QACE,SAAS,KAAK,mBAAmB;AAAA,QACjC,MAAM,CAAC;AAAA;AAAA,QAEP,GAAIF;AAAA,MACN;AAAA,IAAA;AAAA,EAEJ;A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,UAAU;AAAA,UACR,cAAc7D,EAAS;AAAA,UACvB,WAAWA,EAAS;AAAA,UACpB,YAAYA,EAAS;AAAA,UACrB,gBAAgBA,EAAS;AAAA,UACzB,WAAWA,EAAS;AAAA,QACtB;AAAA,MACF;AAAA,IACF;AAAA,EAAA;AAEJ;"}
1
+ {"version":3,"file":"ERC20PeggedVariableCriteriaIncentiveV2.js","sources":["../../src/Incentives/ERC20PeggedVariableCriteriaIncentiveV2.ts"],"sourcesContent":["import {\n erc20PeggedVariableCriteriaIncentiveV2Abi,\n readErc20PeggedVariableCriteriaIncentiveV2Asset,\n readErc20PeggedVariableCriteriaIncentiveV2Claimed,\n readErc20PeggedVariableCriteriaIncentiveV2Claims,\n readErc20PeggedVariableCriteriaIncentiveV2CurrentReward,\n readErc20PeggedVariableCriteriaIncentiveV2GetIncentiveCriteria,\n readErc20PeggedVariableCriteriaIncentiveV2GetMaxReward,\n readErc20PeggedVariableCriteriaIncentiveV2GetPeg,\n readErc20PeggedVariableCriteriaIncentiveV2IsClaimable,\n readErc20PeggedVariableCriteriaIncentiveV2Limit,\n readErc20PeggedVariableCriteriaIncentiveV2Owner,\n readErc20PeggedVariableCriteriaIncentiveV2Peg,\n readErc20PeggedVariableCriteriaIncentiveV2Reward,\n readErc20PeggedVariableCriteriaIncentiveV2TotalClaimed,\n simulateErc20PeggedVariableCriteriaIncentiveV2Claim,\n simulateErc20PeggedVariableCriteriaIncentiveV2Clawback,\n writeErc20PeggedVariableCriteriaIncentiveV2Claim,\n writeErc20PeggedVariableCriteriaIncentiveV2Clawback,\n} from '@boostxyz/evm';\nimport { bytecode } from '@boostxyz/evm/artifacts/contracts/incentives/ERC20PeggedVariableCriteriaIncentiveV2.sol/ERC20PeggedVariableCriteriaIncentiveV2.json';\nimport { getTransaction, getTransactionReceipt } from '@wagmi/core';\nimport type { AbiEvent } from 'abitype';\nimport {\n type AbiFunction,\n type Address,\n type ContractEventName,\n type Hex,\n decodeAbiParameters,\n decodeFunctionData,\n encodeAbiParameters,\n parseEther,\n parseEventLogs,\n zeroAddress,\n zeroHash,\n} from 'viem';\nimport { ERC20PeggedVariableCriteriaIncentiveV2 as ERC20PeggedVariableCriteriaIncentiveV2Bases } from '../../dist/deployments.json';\nimport {\n SignatureType,\n decodeAndReorderLogArgs,\n getScalarValueFromTuple,\n isCriteriaFieldIndexTuple,\n} from '../Actions/EventAction';\nimport type {\n DeployableOptions,\n GenericDeployableParams,\n} from '../Deployable/Deployable';\nimport { DeployableTarget } from '../Deployable/DeployableTarget';\nimport { type ClaimPayload, prepareClaimPayload } from '../claiming';\nimport {\n DecodedArgsError,\n IncentiveCriteriaNotFoundError,\n InvalidCriteriaTypeError,\n NoMatchingLogsError,\n} from '../errors';\nimport {\n CheatCodes,\n type GenericLog,\n type ReadParams,\n RegistryType,\n type WriteParams,\n} from '../utils';\nimport type {\n GetIncentiveScalarV2Params,\n IncentiveCriteriaV2,\n} from './ERC20VariableCriteriaIncentiveV2';\n\nexport { erc20PeggedVariableCriteriaIncentiveV2Abi };\n\n/**\n * The object representation of a `Erc20PeggedVariableCriteriaIncentiveV2.InitPayload`\n *\n * @export\n * @interface Erc20PeggedVariableCriteriaIncentiveV2\n * @typedef {Erc20PeggedVariableCriteriaIncentiveV2}\n */\nexport interface ERC20PeggedVariableCriteriaIncentiveV2Payload {\n /**\n * The address of the incentivized asset.\n *\n * @type {Address}\n */\n asset: Address;\n /**\n * The peg to normalize to.\n *\n * @type {Address}\n */\n peg: Address;\n /**\n * The amount of the asset to distribute.\n *\n * @type {bigint}\n */\n reward: bigint;\n /**\n * Total spend for the incentive.\n *\n * @type {bigint}\n */\n limit: bigint;\n /**\n * Maximum reward each claim is elligible for.\n *\n * @type {bigint}\n */\n maxReward: bigint;\n /**\n * (Optional) The address of the entity that can managed the incentive.\n *\n * @type {Address}\n * @optional\n */\n manager?: Address;\n /**\n * The criteria for the incentive that determines how the reward is distributed.\n *\n * @type {IncentiveCriteria}\n */\n criteria: IncentiveCriteriaV2;\n}\n\n/**\n * A generic `viem.Log` event with support for `Erc20PeggedVariableCriteriaIncentiveV2` event types.\n *\n * @export\n * @typedef {Erc20PeggedVariableCriteriaIncentiveV2Log}\n * @template {ContractEventName<typeof erc20PeggedVariableCriteriaIncentiveV2Abi>} [event=ContractEventName<\n * typeof erc20PeggedVariableCriteriaIncentiveV2Abi\n * >]\n */\nexport type Erc20PeggedVariableCriteriaIncentiveV2Log<\n event extends ContractEventName<\n typeof erc20PeggedVariableCriteriaIncentiveV2Abi\n > = ContractEventName<typeof erc20PeggedVariableCriteriaIncentiveV2Abi>,\n> = GenericLog<typeof erc20PeggedVariableCriteriaIncentiveV2Abi, event>;\n\n/**\n * A simple ERC20 incentive implementation that allows claiming of tokens\n *\n * @export\n * @class Erc20PeggedVariableCriteriaIncentive\n * @typedef {ERC20PeggedVariableCriteriaIncentiveV2}\n * @extends {DeployableTarget<ERC20PeggedVariableCriteriaIncentiveV2>}\n */\nexport class ERC20PeggedVariableCriteriaIncentiveV2 extends DeployableTarget<\n ERC20PeggedVariableCriteriaIncentiveV2Payload,\n typeof erc20PeggedVariableCriteriaIncentiveV2Abi\n> {\n public override readonly abi = erc20PeggedVariableCriteriaIncentiveV2Abi;\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {Record<number, Address>}\n */\n public static override bases: Record<number, Address> = {\n 31337: import.meta.env\n .VITE_ERC20_PEGGED_VARIABLE_CRITERIA_INCENTIVE_V2_BASE,\n ...(ERC20PeggedVariableCriteriaIncentiveV2Bases as Record<number, Address>),\n };\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {RegistryType}\n */\n public static override registryType: RegistryType = RegistryType.INCENTIVE;\n\n /**\n * The owner of the incentive\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<Address>}\n */\n public async owner(params?: ReadParams) {\n return await readErc20PeggedVariableCriteriaIncentiveV2Owner(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 * Calculates the current reward based on the time since the last claim. The reward is calculated based on the time since the last claim, the available budget, and the reward parameters. It increases linearly over time in the absence of claims, with each hour adding `rewardBoost` to the current reward, up to the available budget. For example, if there is one claim in the first hour, then no claims for three hours, the claimable reward would be `initialReward - rewardDecay + (rewardBoost * 3)`\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>} - The current reward\n */\n public async currentReward(params?: ReadParams) {\n return await readErc20PeggedVariableCriteriaIncentiveV2CurrentReward(\n this._config,\n {\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 /**\n * Retrieves the maximum reward amount per claim.\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>} The maximum reward amount per claim\n */\n public async getMaxReward(params?: ReadParams): Promise<bigint> {\n const maxReward =\n await readErc20PeggedVariableCriteriaIncentiveV2GetMaxReward(\n this._config,\n {\n ...params,\n address: this.assertValidAddress(),\n },\n );\n\n return maxReward;\n }\n\n /**\n * Fetches the incentive scalar from a transaction hash\n *\n * @param {GetIncentiveScalarParams} params\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n * @throws {InvalidCriteriaTypeError | NoMatchingLogsError | DecodedArgsError}\n */\n public async getIncentiveScalar(\n { chainId, hash, knownSignatures, logs }: GetIncentiveScalarV2Params,\n params?: ReadParams,\n ): Promise<bigint> {\n const criteria = await this.getIncentiveCriteria(params);\n if (criteria.criteriaType === SignatureType.EVENT) {\n const eventAbi = knownSignatures[criteria.signature] as AbiEvent;\n\n if (criteria.fieldIndex === CheatCodes.GAS_REBATE_INCENTIVE) {\n const transactionReceipt = await getTransactionReceipt(this._config, {\n chainId,\n hash,\n });\n const totalCost =\n transactionReceipt.gasUsed * transactionReceipt.effectiveGasPrice + // Normal gas cost\n (transactionReceipt.blobGasUsed ?? 0n) *\n (transactionReceipt.blobGasPrice ?? 0n); // Blob gas cost - account for potential undefined values\n return totalCost;\n }\n\n // if logs are provided, use them to extract the scalar\n if (logs && logs.length > 0) {\n try {\n // only check logs that match the criteria signature\n const signatureMatchingLogs = logs\n .filter((log) => log.topics && log.topics[0] === criteria.signature)\n .map((log) => decodeAndReorderLogArgs(eventAbi, log));\n\n if (signatureMatchingLogs.length > 0) {\n for (const log of signatureMatchingLogs) {\n if (isCriteriaFieldIndexTuple(criteria.fieldIndex)) {\n return getScalarValueFromTuple(\n log.args as unknown[],\n criteria.fieldIndex,\n );\n }\n const scalarValue = log.args\n ? (log.args as string[])[criteria.fieldIndex]\n : undefined;\n if (scalarValue !== undefined) {\n return BigInt(scalarValue);\n }\n }\n }\n } catch (e) {\n throw new DecodedArgsError(\n `An error occurred while extracting scalar from logs: ${(e as Error).message}`,\n );\n }\n }\n\n const transactionReceipt = await getTransactionReceipt(this._config, {\n chainId,\n hash,\n });\n const receiptLogs = transactionReceipt.logs;\n\n if (receiptLogs.length === 0) {\n throw new NoMatchingLogsError(\n `No logs found for event signature ${criteria.signature}`,\n );\n }\n\n // Decode the event log\n try {\n const eventAbi = knownSignatures[criteria.signature] as AbiEvent;\n const decodedEvents = parseEventLogs({\n abi: [eventAbi],\n logs: receiptLogs,\n });\n if (decodedEvents == undefined || decodedEvents.length === 0) {\n throw new NoMatchingLogsError(\n `No logs found for event signature ${criteria.signature}`,\n );\n }\n\n if (isCriteriaFieldIndexTuple(criteria.fieldIndex)) {\n return getScalarValueFromTuple(\n decodedEvents[0]?.args as unknown[],\n criteria.fieldIndex,\n );\n }\n\n const scalarValue =\n decodedEvents[0] && decodedEvents[0].args\n ? (decodedEvents[0].args as string[])[criteria.fieldIndex]\n : undefined;\n if (scalarValue === undefined) {\n throw new DecodedArgsError(\n `Decoded argument at index ${criteria.fieldIndex} is undefined`,\n );\n }\n return BigInt(scalarValue);\n } catch (e) {\n throw new DecodedArgsError(\n `Failed to decode event log for signature ${criteria.signature}: ${(e as Error).message}`,\n );\n }\n } else if (criteria.criteriaType === SignatureType.FUNC) {\n // Fetch the transaction data\n const transaction = await getTransaction(this._config, {\n chainId,\n hash,\n });\n try {\n // Decode function data\n const func = knownSignatures[criteria.signature] as AbiFunction;\n const decodedFunction = decodeFunctionData({\n abi: [func],\n data: transaction.input,\n });\n\n if (isCriteriaFieldIndexTuple(criteria.fieldIndex)) {\n return getScalarValueFromTuple(\n decodedFunction.args as unknown[],\n criteria.fieldIndex,\n );\n }\n\n const scalarValue = decodedFunction.args[criteria.fieldIndex] as string;\n if (scalarValue === undefined || scalarValue === null) {\n throw new DecodedArgsError(\n `Decoded argument at index ${criteria.fieldIndex} is undefined`,\n );\n }\n return BigInt(scalarValue);\n } catch (e) {\n throw new DecodedArgsError(\n `Failed to decode function data for signature ${criteria.signature}: ${(e as Error).message}`,\n );\n }\n } else {\n throw new InvalidCriteriaTypeError(\n `Invalid criteria type ${criteria.criteriaType}`,\n );\n }\n }\n\n /**\n * The number of claims that have been made\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async claims(params?: ReadParams) {\n return await readErc20PeggedVariableCriteriaIncentiveV2Claims(\n this._config,\n {\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 /**\n * The total amount of rewards claimed\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async totalClaimed(params?: ReadParams) {\n return await readErc20PeggedVariableCriteriaIncentiveV2TotalClaimed(\n this._config,\n {\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 /**\n * A mapping of address to claim status\n *\n * @public\n * @async\n * @param {Address} address\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>}\n */\n public async claimed(address: Address, params?: ReadParams) {\n return await readErc20PeggedVariableCriteriaIncentiveV2Claimed(\n this._config,\n {\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 /**\n * The address of the ERC20-like token\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<Address>}\n */\n public async asset(params?: ReadParams) {\n return await readErc20PeggedVariableCriteriaIncentiveV2Asset(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 address of the pegged ERC20-like token\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<Address>}\n */\n public async peg(params?: ReadParams) {\n return await readErc20PeggedVariableCriteriaIncentiveV2Peg(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} [params]\n * @returns {Promise<bigint>}\n */\n public async reward(params?: ReadParams) {\n return await readErc20PeggedVariableCriteriaIncentiveV2Reward(\n this._config,\n {\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 /**\n * The limit (max possible rewards payout in reward token)\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async limit(params?: ReadParams) {\n return await readErc20PeggedVariableCriteriaIncentiveV2Limit(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Claim the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<boolean>} - Returns true if successfully claimed\n */\n protected async claim(payload: ClaimPayload, params?: WriteParams) {\n return await this.awaitResult(this.claimRaw(payload, params));\n }\n\n /**\n * Claim the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: boolean; }>} - Returns true if successfully claimed\n */\n protected async claimRaw(payload: ClaimPayload, params?: WriteParams) {\n const { request, result } =\n await simulateErc20PeggedVariableCriteriaIncentiveV2Claim(this._config, {\n address: this.assertValidAddress(),\n args: [prepareClaimPayload(payload)],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n const hash = await writeErc20PeggedVariableCriteriaIncentiveV2Claim(\n this._config,\n request,\n );\n return { hash, result };\n }\n\n /**\n * Clawback assets from the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<boolean>} - True if the assets were successfully clawbacked\n */\n public async clawback(payload: ClaimPayload, params?: WriteParams) {\n return await this.awaitResult(this.clawbackRaw(payload, params));\n }\n\n /**\n * Clawback assets from the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: boolean; }>} - True if the assets were successfully clawbacked\n */\n public async clawbackRaw(payload: ClaimPayload, params?: WriteParams) {\n const { request, result } =\n await simulateErc20PeggedVariableCriteriaIncentiveV2Clawback(\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 writeErc20PeggedVariableCriteriaIncentiveV2Clawback(\n this._config,\n request,\n );\n return { hash, result };\n }\n\n /**\n * Check if an incentive is claimable.\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>} = True if the incentive is claimable based on the data payload\n */\n public async isClaimable(payload: ClaimPayload, params?: ReadParams) {\n return await readErc20PeggedVariableCriteriaIncentiveV2IsClaimable(\n this._config,\n {\n address: this.assertValidAddress(),\n args: [payload.target, payload.data],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n },\n );\n }\n\n /**\n * read the peg token for the incentive.\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<Address>} = The address of the token the reward is pegged to\n */\n public async getPeg(params?: ReadParams) {\n return await readErc20PeggedVariableCriteriaIncentiveV2GetPeg(\n this._config,\n {\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 /**\n * Get the maximum amount that can be claimed by this incentive. Useful when used in conjunction with `BoostCore.calculateProtocolFee`\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>} = Return a bigint representing that maximum amount that can be distributed by this incentive.\n */\n public async getTotalBudget(params?: ReadParams) {\n return await this.limit(params);\n }\n\n /**\n * Check if any claims remain by comparing the incentive's total claims against its limit. Does not take requesting user's elligibility into account.\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>} - True if total claims is less than limit\n */\n public async canBeClaimed(params?: ReadParams) {\n return (await this.getRemainingClaimPotential(params)) > 0n;\n }\n\n /**\n * Check how many claims remain by comparing the incentive's total claims against its limit. Does not take requesting user's elligibility into account.\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>} - True if total claims is less than limit\n */\n public async getRemainingClaimPotential(params?: ReadParams) {\n const [totalClaimed, limit] = await Promise.all([\n this.totalClaimed(params),\n this.limit(params),\n ]);\n return limit - totalClaimed;\n }\n\n /**\n *Functions from the ERC20VariableIncentive contract\n */\n\n /**\n * Fetches the IncentiveCriteria struct from the contract\n *\n * @param {?ReadParams} [params]\n * @returns {Promise<IncentiveCriteria>} Incentive criteria structure\n * @throws {IncentiveCriteriaNotFoundError}\n */\n public async getIncentiveCriteria(\n params?: ReadParams,\n ): Promise<IncentiveCriteriaV2> {\n try {\n const criteria =\n await readErc20PeggedVariableCriteriaIncentiveV2GetIncentiveCriteria(\n this._config,\n {\n ...params,\n address: this.assertValidAddress(),\n },\n );\n\n return criteria;\n } catch (e) {\n throw new IncentiveCriteriaNotFoundError(e as Error);\n }\n }\n\n /**\n * Generates a top-up payload for the ERC20PeggedIncentive contract by incrementing\n * the existing `limit` field by `netAmount`. The entire payload is then re-encoded\n * via `prepareERC20PeggedIncentivePayload(...)`.\n *\n * @public\n * @param {bigint} netAmount - The additional limit to add to this incentive.\n * @returns {Hex} The ABI-encoded payload with the updated `limit`.\n */\n public async getTopupPayload(netAmount: bigint): Promise<Hex> {\n return prepareERC20PeggedVariableCriteriaIncentiveV2Payload({\n asset: (await this.asset()) ?? zeroAddress,\n peg: this.payload?.peg ?? zeroAddress,\n reward: this.payload?.reward ?? 0n,\n limit: netAmount,\n maxReward: this.payload?.maxReward ?? 0n,\n manager: this.payload?.manager ?? zeroAddress,\n criteria: this.payload?.criteria ?? {\n criteriaType: 0,\n signature: zeroHash,\n fieldIndex: 0,\n targetContract: zeroAddress,\n valueType: 0,\n },\n });\n }\n\n /**\n * @inheritdoc\n *\n * @public\n * @param {?ERC20PeggedVariableCriteriaIncentiveV2Payload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {GenericDeployableParams}\n */\n public override buildParameters(\n _payload?: ERC20PeggedVariableCriteriaIncentiveV2Payload,\n _options?: DeployableOptions,\n ): GenericDeployableParams {\n const [payload, options] = this.validateDeploymentConfig(\n _payload,\n _options,\n );\n return {\n abi: erc20PeggedVariableCriteriaIncentiveV2Abi,\n bytecode: bytecode as Hex,\n args: [prepareERC20PeggedVariableCriteriaIncentiveV2Payload(payload)],\n ...this.optionallyAttachAccount(options.account),\n };\n }\n\n /**\n * Encodes an amount to clawback from the incentive\n *\n * @public\n * @param {bigint} amount - How much of the asset to clawback\n * @returns {Hex} - Returns an encoded uint256\n */\n public buildClawbackData(amount: bigint) {\n return encodeAbiParameters([{ type: 'uint256' }], [amount]);\n }\n\n /**\n * Builds the claim data for the ERC20PeggedVariableCriteriaIncentivePayload.\n *\n * @public\n * @param {bigint} signedAmount\n * @returns {Hash} Returns the encoded claim data\n * @description This function returns the encoded claim data for the ERC20PeggedVariableCriteriaIncentiveV2Payload.\n */\n public buildClaimData(signedAmount: bigint) {\n return encodeAbiParameters(\n [{ type: 'uint256', name: 'signedAmount' }],\n [signedAmount],\n );\n }\n\n /**\n * Decodes claim data for the ERC20PeggedVariableCriteriaIncentiveV2, returning the claim amount.\n * Useful when deriving amount claimed from logs.\n *\n * @public\n * @param {Hex} claimData\n * @returns {Promise<bigint>} Returns the reward amount from a claim data payload\n */\n public async decodeClaimData(claimData: Hex) {\n const boostClaimData = decodeAbiParameters(\n [\n {\n type: 'tuple',\n name: 'BoostClaimData',\n components: [\n { type: 'bytes', name: 'validatorData' },\n { type: 'bytes', name: 'incentiveData' },\n ],\n },\n ],\n claimData,\n );\n const signedAmount = decodeAbiParameters(\n [{ type: 'uint256' }],\n boostClaimData[0].incentiveData,\n )[0];\n let claimAmount = signedAmount;\n const [reward, maxReward] = await Promise.all([\n this.reward(),\n this.getMaxReward(),\n ]);\n\n if (reward === 0n) {\n return claimAmount;\n } else {\n claimAmount = (reward * signedAmount) / parseEther('1');\n }\n\n if (maxReward !== 0n && claimAmount > maxReward) {\n claimAmount = maxReward;\n }\n\n return claimAmount;\n }\n\n /**\n * Decodes claim data for the ERC20PeggedVariableCriteriaIncentiveV2, returning the claim amount.\n * Useful when deriving amount claimed from logs.\n * Use this function instead of `decodeClaimData` if you have reward details.\n *\n * @public\n * @param {Hex} claimData\n * @param {bigint} [reward]\n * @param {bigint} [maxReward]\n * @returns {BigInt} Returns the reward amount from a claim data payload\n */\n public decodeClaimDataWithRewardDetails(\n claimData: Hex,\n reward: bigint,\n maxReward: bigint,\n ) {\n const boostClaimData = decodeAbiParameters(\n [\n {\n type: 'tuple',\n name: 'BoostClaimData',\n components: [\n { type: 'bytes', name: 'validatorData' },\n { type: 'bytes', name: 'incentiveData' },\n ],\n },\n ],\n claimData,\n );\n const signedAmount = decodeAbiParameters(\n [{ type: 'uint256' }],\n boostClaimData[0].incentiveData,\n )[0];\n let claimAmount = signedAmount;\n\n if (reward === 0n) {\n return claimAmount;\n } else {\n claimAmount = (reward * signedAmount) / parseEther('1');\n }\n\n if (maxReward !== 0n && claimAmount > maxReward) {\n claimAmount = maxReward;\n }\n\n return claimAmount;\n }\n}\n\n/**\n * Given a {@link ERC20PeggedVariableCriteriaIncentiveV2Payload}, properly encode a `ERC20PeggedVariableCriteriaIncentiveV2Payload.InitPayload` for use with {@link ERC20PeggedVariableCriteriaIncentiveV2Payload} initialization.\n *\n * @param {ERC20PeggedVariableCriteriaIncentiveV2Payload} param0\n * @param {Address} param0.asset - The address of the incentivized asset.\n * @param {Address} param0.peg - The peg to normalize to.\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 * @param {Address} [param0.manager=zeroAddress] - The entity that can manage the incentive.\n * @param {IncentiveCriteria} param0.criteria - The incentive criteria for reward distribution.\n * @returns {Hex}\n */\nexport function prepareERC20PeggedVariableCriteriaIncentiveV2Payload({\n asset,\n peg,\n reward,\n limit,\n maxReward = 0n,\n manager = zeroAddress,\n criteria,\n}: ERC20PeggedVariableCriteriaIncentiveV2Payload) {\n return encodeAbiParameters(\n [\n {\n type: 'tuple',\n name: 'initPayloadExtended',\n components: [\n { type: 'address', name: 'asset' },\n { type: 'address', name: 'peg' },\n { type: 'uint256', name: 'reward' },\n { type: 'uint256', name: 'limit' },\n { type: 'address', name: 'manager' },\n { type: 'uint256', name: 'maxReward' },\n {\n type: 'tuple',\n name: 'criteria',\n components: [\n { type: 'uint8', name: 'criteriaType' },\n { type: 'bytes32', name: 'signature' },\n { type: 'uint8', name: 'fieldIndex' },\n { type: 'address', name: 'targetContract' },\n { type: 'uint8', name: 'valueType' },\n ],\n },\n ],\n },\n ],\n [\n {\n asset,\n peg,\n reward,\n limit,\n manager,\n maxReward,\n criteria: {\n criteriaType: criteria.criteriaType,\n signature: criteria.signature,\n fieldIndex: criteria.fieldIndex,\n targetContract: criteria.targetContract,\n valueType: criteria.valueType,\n },\n },\n ],\n );\n}\n"],"names":["_ERC20PeggedVariableCriteriaIncentiveV2","DeployableTarget","erc20PeggedVariableCriteriaIncentiveV2Abi","params","readErc20PeggedVariableCriteriaIncentiveV2Owner","readErc20PeggedVariableCriteriaIncentiveV2CurrentReward","readErc20PeggedVariableCriteriaIncentiveV2GetMaxReward","chainId","hash","knownSignatures","logs","criteria","SignatureType","eventAbi","CheatCodes","transactionReceipt","getTransactionReceipt","signatureMatchingLogs","log","decodeAndReorderLogArgs","isCriteriaFieldIndexTuple","getScalarValueFromTuple","scalarValue","e","DecodedArgsError","receiptLogs","NoMatchingLogsError","decodedEvents","parseEventLogs","_a","transaction","getTransaction","func","decodedFunction","decodeFunctionData","InvalidCriteriaTypeError","readErc20PeggedVariableCriteriaIncentiveV2Claims","readErc20PeggedVariableCriteriaIncentiveV2TotalClaimed","address","readErc20PeggedVariableCriteriaIncentiveV2Claimed","readErc20PeggedVariableCriteriaIncentiveV2Asset","readErc20PeggedVariableCriteriaIncentiveV2Peg","readErc20PeggedVariableCriteriaIncentiveV2Reward","readErc20PeggedVariableCriteriaIncentiveV2Limit","payload","request","result","simulateErc20PeggedVariableCriteriaIncentiveV2Claim","prepareClaimPayload","writeErc20PeggedVariableCriteriaIncentiveV2Claim","simulateErc20PeggedVariableCriteriaIncentiveV2Clawback","writeErc20PeggedVariableCriteriaIncentiveV2Clawback","readErc20PeggedVariableCriteriaIncentiveV2IsClaimable","readErc20PeggedVariableCriteriaIncentiveV2GetPeg","totalClaimed","limit","readErc20PeggedVariableCriteriaIncentiveV2GetIncentiveCriteria","IncentiveCriteriaNotFoundError","netAmount","prepareERC20PeggedVariableCriteriaIncentiveV2Payload","zeroAddress","_b","_c","_d","_e","zeroHash","_payload","_options","options","bytecode","amount","encodeAbiParameters","signedAmount","claimData","boostClaimData","decodeAbiParameters","claimAmount","reward","maxReward","parseEther","ERC20PeggedVariableCriteriaIncentiveV2Bases","RegistryType","ERC20PeggedVariableCriteriaIncentiveV2","asset","peg","manager"],"mappings":";;;;;;;;;upjBAiJaA,IAAN,MAAMA,UAA+CC,EAG1D;AAAA,EAHK,cAAA;AAAA,UAAA,GAAA,SAAA,GAIL,KAAyB,MAAMC;AAAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA8B/B,MAAa,MAAMC,GAAqB;AAC/B,WAAA,MAAMC,EAAgD,KAAK,SAAS;AAAA,MACzE,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,cAAcA,GAAqB;AAC9C,WAAO,MAAME;AAAAA,MACX,KAAK;AAAA,MACL;AAAA,QACE,SAAS,KAAK,mBAAmB;AAAA,QACjC,MAAM,CAAC;AAAA;AAAA,QAEP,GAAIF;AAAA,MACN;AAAA,IAAA;AAAA,EAEJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,MAAa,aAAaA,GAAsC;AAUvD,WARL,MAAMG;AAAAA,MACJ,KAAK;AAAA,MACL;AAAA,QACE,GAAGH;AAAA,QACH,SAAS,KAAK,mBAAmB;AAAA,MACnC;AAAA,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,GAAkD;AACzC,SAAA4D;AAAA,IACL;AAAA,MACE;AAAA,QACE,MAAM;AAAA,QACN,MAAM;AAAA,QACN,YAAY;AAAA,UACV,EAAE,MAAM,WAAW,MAAM,QAAQ;AAAA,UACjC,EAAE,MAAM,WAAW,MAAM,MAAM;AAAA,UAC/B,EAAE,MAAM,WAAW,MAAM,SAAS;AAAA,UAClC,EAAE,MAAM,WAAW,MAAM,QAAQ;AAAA,UACjC,EAAE,MAAM,WAAW,MAAM,UAAU;AAAA,UACnC,EAAE,MAAM,WAAW,MAAM,YAAY;AAAA,UACrC;AAAA,YACE,MAAM;AAAA,YACN,MAAM;AAAA,YACN,YAAY;AAAA,cACV,EAAE,MAAM,SAAS,MAAM,eAAe;AAAA,cACtC,EAAE,MAAM,WAAW,MAAM,YAAY;AAAA,cACrC,EAAE,MAAM,SAAS,MAAM,aAAa;AAAA,cACpC,EAAE,MAAM,WAAW,MAAM,iBAAiB;AAAA,cAC1C,EAAE,MAAM,SAAS,MAAM,YAAY;AAAA,YACrC;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,IACA;AAAA,MACE;AAAA,QACE,OAAAY;AAAA,QACA,KAAAC;AAAA,QACA,QAAAP;AAAA,QACA,OAAAtB;AAAA,QACA,SAAA8B;AAAA,QACA,WAAAP;AAAA,QACA,UAAU;AAAA,UACR,cAAcnE,EAAS;AAAA,UACvB,WAAWA,EAAS;AAAA,UACpB,YAAYA,EAAS;AAAA,UACrB,gBAAgBA,EAAS;AAAA,UACzB,WAAWA,EAAS;AAAA,QACtB;AAAA,MACF;AAAA,IACF;AAAA,EAAA;AAEJ;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("../generated-C_JEoLDO.cjs"),m=require("@wagmi/core"),t=require("viem"),C=require("../deployments-Dk-Z1L2X.cjs"),l=require("../Actions/EventAction.cjs"),c=require("../errors.cjs"),v=require("../utils.cjs"),E=require("./ERC20VariableIncentive.cjs"),I="0x6080604052348015600e575f80fd5b5060156019565b607c565b63409feecd198054600181161560365763f92ee8a95f526004601cfd5b6001600160401b03808260011c146077578060011b8355806020527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602080a15b505050565b6121a3806100895f395ff3fe608060405260043610610277575f3560e01c8063715018a61161014b578063c884ef83116100c6578063ec87621c1161007c578063f2fde38b11610062578063f2fde38b1461071f578063fe9fbb8014610732578063fee81cf414610751575f80fd5b8063ec87621c146106f8578063f04e283e1461070c575f80fd5b8063db09da12116100ac578063db09da12146106a5578063dcc21361146106c4578063dcc59b6f146106e3575f80fd5b8063c884ef8314610662578063d54ad2a114610690575f80fd5b8063a4d66daf1161011b578063bb1757cf11610101578063bb1757cf14610610578063be4994f81461062f578063c213f3f91461064e575f80fd5b8063a4d66daf146105da578063a871ced2146105ef575f80fd5b8063715018a61461053857806375b238fc1461054057806377548687146105545780638da5cb5b146105c2575f80fd5b806330db555f116101f55780634a4ee7b1116101ab578063514e62fc11610191578063514e62fc146104e657806354d1f13d1461051b57806366a78e6c14610523575f80fd5b80634a4ee7b1146104a75780634e7165a2146104ba575f80fd5b80634359d28a116101db5780634359d28a14610420578063439fab911461043f578063474f5a441461045e575f80fd5b806330db555f146103b057806338d52e0f146103cf575f80fd5b80631cd64df41161024a5780632569296211610230578063256929621461033d57806328d6183b146103455780632de948071461037f575f80fd5b80631cd64df4146102f4578063228cb73314610329575f80fd5b806301ffc9a71461027b57806307621eca146102af578063183a4f6e146102cc5780631c10893f146102e1575b5f80fd5b348015610286575f80fd5b5061029a6102953660046118d1565b610782565b60405190151581526020015b60405180910390f35b3480156102ba575f80fd5b505f545b6040519081526020016102a6565b6102df6102da366004611917565b6107dd565b005b6102df6102ef36600461194f565b6107ea565b3480156102ff575f80fd5b5061029a61030e36600461194f565b638b78c6d8600c9081525f9290925260209091205481161490565b348015610334575f80fd5b506102be5f5481565b6102df610800565b348015610350575f80fd5b506040517f52b8e45c0000000000000000000000000000000000000000000000000000000081526020016102a6565b34801561038a575f80fd5b506102be610399366004611979565b638b78c6d8600c9081525f91909152602090205490565b3480156103bb575f80fd5b506102df6103ca366004611917565b61084d565b3480156103da575f80fd5b506003546103fb9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016102a6565b34801561042b575f80fd5b506102df61043a3660046119dc565b610909565b34801561044a575f80fd5b506102df610459366004611a86565b610a03565b348015610469575f80fd5b5061047d610478366004611a86565b610d4c565b6040805192835273ffffffffffffffffffffffffffffffffffffffff9091166020830152016102a6565b6102df6104b536600461194f565b610eae565b3480156104c5575f80fd5b506104d96104d4366004611a86565b610ec0565b6040516102a69190611b11565b3480156104f1575f80fd5b5061029a61050036600461194f565b638b78c6d8600c9081525f9290925260209091205416151590565b6102df610fa9565b34801561052e575f80fd5b506102be60065481565b6102df610fe2565b34801561054b575f80fd5b506102be600281565b34801561055f575f80fd5b506007546008546009546105b19260ff90811692918082169173ffffffffffffffffffffffffffffffffffffffff61010083041691750100000000000000000000000000000000000000000090041685565b6040516102a6959493929190611b60565b3480156105cd575f80fd5b50638b78c6d819546103fb565b3480156105e5575f80fd5b506102be60025481565b3480156105fa575f80fd5b50610603610ff5565b6040516102a69190611c13565b34801561061b575f80fd5b5061029a61062a366004611c21565b6110db565b34801561063a575f80fd5b506102df6106493660046119dc565b61130c565b348015610659575f80fd5b506006546102be565b34801561066d575f80fd5b5061029a61067c366004611979565b60016020525f908152604090205460ff1681565b34801561069b575f80fd5b506102be60055481565b3480156106b0575f80fd5b5061029a6106bf366004611c21565b6113aa565b3480156106cf575f80fd5b506102df6106de3660046119dc565b6113c0565b3480156106ee575f80fd5b506102be60045481565b348015610703575f80fd5b506102be600181565b6102df61071a366004611979565b61145e565b6102df61072d366004611979565b611498565b34801561073d575f80fd5b5061029a61074c366004611979565b6114be565b34801561075c575f80fd5b506102be61076b366004611979565b63389a75e1600c9081525f91909152602090205490565b5f7fffffffff0000000000000000000000000000000000000000000000000000000082167f52b8e45c0000000000000000000000000000000000000000000000000000000014806107d757506107d78261151d565b92915050565b6107e73382611572565b50565b6107f261157d565b6107fc8282611597565b5050565b5f6202a30067ffffffffffffffff164201905063389a75e1600c52335f52806020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d5f80a250565b6001610858816115a3565b815f03610891576040517ff92ee8a900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6003546108b69073ffffffffffffffffffffffffffffffffffffffff163330856115d4565b8160025f8282546108c79190611c9f565b909155505060408051338152602081018490527fa64c2da41decbd538f8629e54c8fa0b7362c9102b691386a0fb6a1797454e9c6910160405180910390a15050565b6002610914816115a3565b83821461094d576040517fff633a3800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5b848110156109fb575f84848381811061096a5761096a611cb2565b905060200201602081019061097f9190611cdf565b90508015156001036109c1576109bc8787848181106109a0576109a0611cb2565b90506020020160208101906109b59190611979565b6001611597565b6109f2565b6109f28787848181106109d6576109d6611cb2565b90506020020160208101906109eb9190611979565b6001611572565b5060010161094f565b505050505050565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffbf6011328054600382558015610a545760018160011c14303b10610a4b5763f92ee8a95f526004601cfd5b818160ff1b1b91505b505f610a6283850185611d93565b805160208201516040830151606084015160808501519495509293919290915f839003610abb576040517ff92ee8a900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f610adc73ffffffffffffffffffffffffffffffffffffffff871630611636565b905083811015610b455786516040517f5c54305e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9091166004820152602481018290526044810185905260640160405180910390fd5b600380547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff88161790555f8581556002859055600684905560055581516007805484929082907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660018381811115610bd657610bd6611b23565b021790555060208201516001808301919091556040830151600283018054606086015173ffffffffffffffffffffffffffffffffffffffff16610100027fffffffffffffffffffffff00000000000000000000000000000000000000000090911660ff90931692909217919091178082556080850151927fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff909116907501000000000000000000000000000000000000000000908490811115610c9b57610c9b611b23565b0217905550905050610cac33611669565b610cb73360016116b1565b8573ffffffffffffffffffffffffffffffffffffffff167f99f3346dc2b5f4a8773b860bf7951f6bcb1a5ff787cfd080496e347c1ad5807986868686604051610d039493929190611e7b565b60405180910390a2505050505050508015610d47576002815560016020527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602080a15b505050565b5f806001610d59816115a3565b5f610d6685870187611f50565b90505f8160200151806020019051810190610d819190611fcf565b90508060025f828254610d949190611fe6565b90915550508151600354610dc19173ffffffffffffffffffffffffffffffffffffffff90911690836116f2565b81516003546040517fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606092831b811660208301529183901b90911660348201526048810183905273ffffffffffffffffffffffffffffffffffffffff909116907f9ad2e7a4af16dceda9cce4274b2f59c328d8c012eb0e15eb5e1e73b7d8f264d390606801604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815290829052610e7f91611b11565b60405180910390a260035490945073ffffffffffffffffffffffffffffffffffffffff16925050509250929050565b610eb661157d565b6107fc8282611572565b60605f80610ed084860186611ff9565b9250509150604051806080016040528060016002811115610ef357610ef3611b23565b81526020018373ffffffffffffffffffffffffffffffffffffffff1681526020013073ffffffffffffffffffffffffffffffffffffffff168152602001604051806020016040528084815250604051602001610f529151815260200190565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152918152915251610f90919060200161202b565b6040516020818303038152906040529250505092915050565b63389a75e1600c52335f525f6020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c925f80a2565b610fea61157d565b610ff35f611745565b565b6040805160a0810182525f808252602082018190529181018290526060810182905260808101919091526040805160a0810190915260078054829060ff16600181111561104457611044611b23565b600181111561105557611055611b23565b81526001828101546020830152600283015460ff808216604085015273ffffffffffffffffffffffffffffffffffffffff6101008304166060850152608090930192750100000000000000000000000000000000000000000090910416908111156110c2576110c2611b23565b60018111156110d3576110d3611b23565b905250919050565b5f6110e461157d565b5f6110f1838501856120a1565b90505f816020015180602001905181019061110c9190611fcf565b90505f61111c6002546005541090565b611152576040517f6247a84e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f545f03611161575080611184565b670de0b6b3a7640000825f54611177919061211e565b6111819190612135565b90505b60065415801590611196575060065481115b156111a057506006545b600254816005546111b19190611c9f565b11156111e9576040517f360e42e100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8060055f8282546111fa9190611c9f565b92505081905550600160045f8282546112139190611c9f565b909155505060035461123c9073ffffffffffffffffffffffffffffffffffffffff1688836116f2565b6003546040517fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606092831b811660208301529189901b90911660348201526048810182905273ffffffffffffffffffffffffffffffffffffffff8816907f9ad2e7a4af16dceda9cce4274b2f59c328d8c012eb0e15eb5e1e73b7d8f264d390606801604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290526112f791611b11565b60405180910390a25060019695505050505050565b6002611317816115a3565b838214611350576040517fff633a3800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5b848110156109fb576113a286868381811061136f5761136f611cb2565b90506020020160208101906113849190611979565b85858481811061139657611396611cb2565b90506020020135611597565b600101611352565b5f6113b86002546005541090565b949350505050565b60026113cb816115a3565b838214611404576040517fff633a3800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5b848110156109fb5761145686868381811061142357611423611cb2565b90506020020160208101906114389190611979565b85858481811061144a5761144a611cb2565b90506020020135611572565b600101611406565b61146661157d565b63389a75e1600c52805f526020600c20805442111561148c57636f5e88185f526004601cfd5b5f90556107e781611745565b6114a061157d565b8060601b6114b557637448fbae5f526004601cfd5b6107e781611745565b5f8173ffffffffffffffffffffffffffffffffffffffff166114e3638b78c6d8195490565b73ffffffffffffffffffffffffffffffffffffffff1614806107d75750638b78c6d8600c9081525f839052602090205460031615156107d7565b5f7fffffffff0000000000000000000000000000000000000000000000000000000082167f903181110000000000000000000000000000000000000000000000000000000014806107d757506107d78261178f565b6107fc82825f6117e4565b638b78c6d819543314610ff3576382b429005f526004601cfd5b6107fc828260016117e4565b638b78c6d8195433146107e757638b78c6d8600c52335f52806020600c2054166107e7576382b429005f526004601cfd5b60405181606052826040528360601b602c526f23b872dd000000000000000000000000600c5260205f6064601c5f895af18060015f51141661162857803d873b15171061162857637939f4245f526004601cfd5b505f60605260405250505050565b5f816014526f70a082310000000000000000000000005f5260208060246010865afa601f3d111660205102905092915050565b73ffffffffffffffffffffffffffffffffffffffff16638b78c6d819819055805f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08180a350565b638b78c6d8600c52815f52806020600c205580600c5160601c7f715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe265f80a35050565b81601452806034526fa9059cbb0000000000000000000000005f5260205f604460105f875af18060015f51141661173b57803d853b15171061173b576390b8ec185f526004601cfd5b505f603452505050565b638b78c6d819805473ffffffffffffffffffffffffffffffffffffffff9092169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a355565b5f7fffffffff0000000000000000000000000000000000000000000000000000000082167fa92167050000000000000000000000000000000000000000000000000000000014806107d757506107d78261183b565b638b78c6d8600c52825f526020600c20805483811783611805575080841681185b80835580600c5160601c7f715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe265f80a3505050505050565b5f7fffffffff0000000000000000000000000000000000000000000000000000000082167f6ab67a0d0000000000000000000000000000000000000000000000000000000014806107d757507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316146107d7565b5f602082840312156118e1575f80fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114611910575f80fd5b9392505050565b5f60208284031215611927575f80fd5b5035919050565b73ffffffffffffffffffffffffffffffffffffffff811681146107e7575f80fd5b5f8060408385031215611960575f80fd5b823561196b8161192e565b946020939093013593505050565b5f60208284031215611989575f80fd5b81356119108161192e565b5f8083601f8401126119a4575f80fd5b50813567ffffffffffffffff8111156119bb575f80fd5b6020830191508360208260051b85010111156119d5575f80fd5b9250929050565b5f805f80604085870312156119ef575f80fd5b843567ffffffffffffffff811115611a05575f80fd5b611a1187828801611994565b909550935050602085013567ffffffffffffffff811115611a30575f80fd5b611a3c87828801611994565b95989497509550505050565b5f8083601f840112611a58575f80fd5b50813567ffffffffffffffff811115611a6f575f80fd5b6020830191508360208285010111156119d5575f80fd5b5f8060208385031215611a97575f80fd5b823567ffffffffffffffff811115611aad575f80fd5b611ab985828601611a48565b90969095509350505050565b5f81518084528060208401602086015e5f6020828601015260207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011685010191505092915050565b602081525f6119106020830184611ac5565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffd5b600281106107e7576107e7611b23565b60a08101611b6d87611b50565b86825285602083015260ff8516604083015273ffffffffffffffffffffffffffffffffffffffff84166060830152611ba483611b50565b8260808301529695505050505050565b8051611bbf81611b50565b808352506020810151602083015260ff604082015116604083015273ffffffffffffffffffffffffffffffffffffffff60608201511660608301526080810151611c0881611b50565b806080840152505050565b60a081016107d78284611bb4565b5f805f60408486031215611c33575f80fd5b8335611c3e8161192e565b9250602084013567ffffffffffffffff811115611c59575f80fd5b611c6586828701611a48565b9497909650939450505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b808201808211156107d7576107d7611c72565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f60208284031215611cef575f80fd5b81358015158114611910575f80fd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b60405160a0810167ffffffffffffffff81118282101715611d4e57611d4e611cfe565b60405290565b6040805190810167ffffffffffffffff81118282101715611d4e57611d4e611cfe565b600281106107e7575f80fd5b8035611d8e81611d77565b919050565b5f81830361012081128015611da6575f80fd5b50611daf611d2b565b8335611dba8161192e565b815260208481013590820152604080850135908201526060808501359082015260a07fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8083011215611e09575f80fd5b611e11611d2b565b91506080840135611e2181611d77565b825260a0840135602083015260c084013560ff81168114611e40575f80fd5b604083015260e0840135611e538161192e565b6060830152611e656101008501611d83565b6080830152816080820152809250505092915050565b84815260208101849052604081018390526101008101611e9e6060830184611bb4565b95945050505050565b5f82601f830112611eb6575f80fd5b813567ffffffffffffffff811115611ed057611ed0611cfe565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810167ffffffffffffffff81118282101715611f1d57611f1d611cfe565b604052818152838201602001851015611f34575f80fd5b816020850160208301375f918101602001919091529392505050565b5f60208284031215611f60575f80fd5b813567ffffffffffffffff811115611f76575f80fd5b820160408185031215611f87575f80fd5b611f8f611d54565b8135611f9a8161192e565b8152602082013567ffffffffffffffff811115611fb5575f80fd5b611fc186828501611ea7565b602083015250949350505050565b5f60208284031215611fdf575f80fd5b5051919050565b818103818111156107d7576107d7611c72565b5f805f6060848603121561200b575f80fd5b83356120168161192e565b95602085013595506040909401359392505050565b602081525f82516003811061204257612042611b23565b8060208401525073ffffffffffffffffffffffffffffffffffffffff602084015116604083015273ffffffffffffffffffffffffffffffffffffffff604084015116606083015260608301516080808401526113b860a0840182611ac5565b5f602082840312156120b1575f80fd5b813567ffffffffffffffff8111156120c7575f80fd5b8201604081850312156120d8575f80fd5b6120e0611d54565b813567ffffffffffffffff8111156120f6575f80fd5b61210286828501611ea7565b825250602082013567ffffffffffffffff811115611fb5575f80fd5b80820281158282048414176107d7576107d7611c72565b5f82612168577f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b50049056fea26469706673582212207116aaa186a239a48bef990e22553b4fb13a51ab4a37e95e74ae15e63a94b2e764736f6c634300081a0033",p=class p extends E.ERC20VariableIncentive{constructor(){super(...arguments),this.abi=u.m}async getIncentiveCriteria(e){try{return await u.IV(this._config,{...e,address:this.assertValidAddress()})}catch(a){throw new c.IncentiveCriteriaNotFoundError(a)}}async decodeClaimData(e){const a=t.decodeAbiParameters([{type:"tuple",name:"BoostClaimData",components:[{type:"bytes",name:"validatorData"},{type:"bytes",name:"incentiveData"}]}],e),d=t.decodeAbiParameters([{type:"uint256"}],a[0].incentiveData)[0];let b=d;const[f,i]=await Promise.all([this.reward(),this.getMaxReward()]);return f===0n||(b=f*d/t.parseEther("1"),i!==0n&&b>i&&(b=i)),b}async getMaxReward(e){return await u.AV(this._config,{...e,address:this.assertValidAddress()})}async getIncentiveScalar({chainId:e,hash:a,knownSignatures:d},b){var i;const f=await this.getIncentiveCriteria(b);if(f.criteriaType===l.SignatureType.EVENT){const r=await m.getTransactionReceipt(this._config,{chainId:e,hash:a});if(f.fieldIndex===v.CheatCodes.GAS_REBATE_INCENTIVE)return r.gasUsed*r.effectiveGasPrice+(r.blobGasUsed??0n)*(r.blobGasPrice??0n);const s=r.logs;if(s.length===0)throw new c.NoMatchingLogsError(`No logs found for event signature ${f.signature}`);try{const o=d[f.signature],n=t.parseEventLogs({abi:[o],logs:s});if(n==null||n.length===0)throw new c.NoMatchingLogsError(`No logs found for event signature ${f.signature}`);const y=((i=n[0])==null?void 0:i.args)[f.fieldIndex];if(y===void 0)throw new c.DecodedArgsError(`Decoded argument at index ${f.fieldIndex} is undefined`);return BigInt(y)}catch(o){throw new c.DecodedArgsError(`Failed to decode event log for signature ${f.signature}: ${o.message}`)}}else if(f.criteriaType===l.SignatureType.FUNC){const r=await m.getTransaction(this._config,{chainId:e,hash:a});try{const s=d[f.signature],n=t.decodeFunctionData({abi:[s],data:r.input}).args[f.fieldIndex];if(n==null)throw new c.DecodedArgsError(`Decoded argument at index ${f.fieldIndex} is undefined`);return BigInt(n)}catch(s){throw new c.DecodedArgsError(`Failed to decode function data for signature ${f.signature}: ${s.message}`)}}else throw new c.InvalidCriteriaTypeError(`Invalid criteria type ${f.criteriaType}`)}buildParameters(e,a){const[d,b]=this.validateDeploymentConfig(e,a);return{abi:u.m,bytecode:I,args:[h(d)],...this.optionallyAttachAccount(b.account)}}};p.bases={31337:void 0,...C.ERC20VariableCriteriaIncentiveV2};let g=p;function T(){return{criteriaType:l.SignatureType.EVENT,signature:t.zeroHash,fieldIndex:v.CheatCodes.GAS_REBATE_INCENTIVE,targetContract:t.zeroAddress,valueType:l.ValueType.WAD}}function h({asset:w,reward:e,limit:a,maxReward:d=0n,criteria:b}){return t.encodeAbiParameters([{type:"tuple",name:"initPayloadExtended",components:[{type:"address",name:"asset"},{type:"uint256",name:"reward"},{type:"uint256",name:"limit"},{type:"uint256",name:"maxReward"},{type:"tuple",name:"criteria",components:[{type:"uint8",name:"criteriaType"},{type:"bytes32",name:"signature"},{type:"uint8",name:"fieldIndex"},{type:"address",name:"targetContract"},{type:"uint8",name:"valueType"}]}]}],[{asset:w,reward:e,limit:a,maxReward:d,criteria:{criteriaType:b.criteriaType,signature:b.signature,fieldIndex:b.fieldIndex,targetContract:b.targetContract,valueType:b.valueType}}])}exports.erc20VariableCriteriaIncentiveV2Abi=u.m;exports.ERC20VariableCriteriaIncentiveV2=g;exports.gasRebateIncentiveCriteriaV2=T;exports.prepareERC20VariableCriteriaIncentiveV2Payload=h;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("../generated-C_JEoLDO.cjs"),y=require("@wagmi/core"),n=require("viem"),T=require("../deployments-Dk-Z1L2X.cjs"),t=require("../Actions/EventAction.cjs"),i=require("../errors.cjs"),h=require("../utils.cjs"),x=require("./ERC20VariableIncentive.cjs"),E="0x6080604052348015600e575f80fd5b5060156019565b607c565b63409feecd198054600181161560365763f92ee8a95f526004601cfd5b6001600160401b03808260011c146077578060011b8355806020527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602080a15b505050565b6121a3806100895f395ff3fe608060405260043610610277575f3560e01c8063715018a61161014b578063c884ef83116100c6578063ec87621c1161007c578063f2fde38b11610062578063f2fde38b1461071f578063fe9fbb8014610732578063fee81cf414610751575f80fd5b8063ec87621c146106f8578063f04e283e1461070c575f80fd5b8063db09da12116100ac578063db09da12146106a5578063dcc21361146106c4578063dcc59b6f146106e3575f80fd5b8063c884ef8314610662578063d54ad2a114610690575f80fd5b8063a4d66daf1161011b578063bb1757cf11610101578063bb1757cf14610610578063be4994f81461062f578063c213f3f91461064e575f80fd5b8063a4d66daf146105da578063a871ced2146105ef575f80fd5b8063715018a61461053857806375b238fc1461054057806377548687146105545780638da5cb5b146105c2575f80fd5b806330db555f116101f55780634a4ee7b1116101ab578063514e62fc11610191578063514e62fc146104e657806354d1f13d1461051b57806366a78e6c14610523575f80fd5b80634a4ee7b1146104a75780634e7165a2146104ba575f80fd5b80634359d28a116101db5780634359d28a14610420578063439fab911461043f578063474f5a441461045e575f80fd5b806330db555f146103b057806338d52e0f146103cf575f80fd5b80631cd64df41161024a5780632569296211610230578063256929621461033d57806328d6183b146103455780632de948071461037f575f80fd5b80631cd64df4146102f4578063228cb73314610329575f80fd5b806301ffc9a71461027b57806307621eca146102af578063183a4f6e146102cc5780631c10893f146102e1575b5f80fd5b348015610286575f80fd5b5061029a6102953660046118d1565b610782565b60405190151581526020015b60405180910390f35b3480156102ba575f80fd5b505f545b6040519081526020016102a6565b6102df6102da366004611917565b6107dd565b005b6102df6102ef36600461194f565b6107ea565b3480156102ff575f80fd5b5061029a61030e36600461194f565b638b78c6d8600c9081525f9290925260209091205481161490565b348015610334575f80fd5b506102be5f5481565b6102df610800565b348015610350575f80fd5b506040517f52b8e45c0000000000000000000000000000000000000000000000000000000081526020016102a6565b34801561038a575f80fd5b506102be610399366004611979565b638b78c6d8600c9081525f91909152602090205490565b3480156103bb575f80fd5b506102df6103ca366004611917565b61084d565b3480156103da575f80fd5b506003546103fb9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016102a6565b34801561042b575f80fd5b506102df61043a3660046119dc565b610909565b34801561044a575f80fd5b506102df610459366004611a86565b610a03565b348015610469575f80fd5b5061047d610478366004611a86565b610d4c565b6040805192835273ffffffffffffffffffffffffffffffffffffffff9091166020830152016102a6565b6102df6104b536600461194f565b610eae565b3480156104c5575f80fd5b506104d96104d4366004611a86565b610ec0565b6040516102a69190611b11565b3480156104f1575f80fd5b5061029a61050036600461194f565b638b78c6d8600c9081525f9290925260209091205416151590565b6102df610fa9565b34801561052e575f80fd5b506102be60065481565b6102df610fe2565b34801561054b575f80fd5b506102be600281565b34801561055f575f80fd5b506007546008546009546105b19260ff90811692918082169173ffffffffffffffffffffffffffffffffffffffff61010083041691750100000000000000000000000000000000000000000090041685565b6040516102a6959493929190611b60565b3480156105cd575f80fd5b50638b78c6d819546103fb565b3480156105e5575f80fd5b506102be60025481565b3480156105fa575f80fd5b50610603610ff5565b6040516102a69190611c13565b34801561061b575f80fd5b5061029a61062a366004611c21565b6110db565b34801561063a575f80fd5b506102df6106493660046119dc565b61130c565b348015610659575f80fd5b506006546102be565b34801561066d575f80fd5b5061029a61067c366004611979565b60016020525f908152604090205460ff1681565b34801561069b575f80fd5b506102be60055481565b3480156106b0575f80fd5b5061029a6106bf366004611c21565b6113aa565b3480156106cf575f80fd5b506102df6106de3660046119dc565b6113c0565b3480156106ee575f80fd5b506102be60045481565b348015610703575f80fd5b506102be600181565b6102df61071a366004611979565b61145e565b6102df61072d366004611979565b611498565b34801561073d575f80fd5b5061029a61074c366004611979565b6114be565b34801561075c575f80fd5b506102be61076b366004611979565b63389a75e1600c9081525f91909152602090205490565b5f7fffffffff0000000000000000000000000000000000000000000000000000000082167f52b8e45c0000000000000000000000000000000000000000000000000000000014806107d757506107d78261151d565b92915050565b6107e73382611572565b50565b6107f261157d565b6107fc8282611597565b5050565b5f6202a30067ffffffffffffffff164201905063389a75e1600c52335f52806020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d5f80a250565b6001610858816115a3565b815f03610891576040517ff92ee8a900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6003546108b69073ffffffffffffffffffffffffffffffffffffffff163330856115d4565b8160025f8282546108c79190611c9f565b909155505060408051338152602081018490527fa64c2da41decbd538f8629e54c8fa0b7362c9102b691386a0fb6a1797454e9c6910160405180910390a15050565b6002610914816115a3565b83821461094d576040517fff633a3800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5b848110156109fb575f84848381811061096a5761096a611cb2565b905060200201602081019061097f9190611cdf565b90508015156001036109c1576109bc8787848181106109a0576109a0611cb2565b90506020020160208101906109b59190611979565b6001611597565b6109f2565b6109f28787848181106109d6576109d6611cb2565b90506020020160208101906109eb9190611979565b6001611572565b5060010161094f565b505050505050565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffbf6011328054600382558015610a545760018160011c14303b10610a4b5763f92ee8a95f526004601cfd5b818160ff1b1b91505b505f610a6283850185611d93565b805160208201516040830151606084015160808501519495509293919290915f839003610abb576040517ff92ee8a900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f610adc73ffffffffffffffffffffffffffffffffffffffff871630611636565b905083811015610b455786516040517f5c54305e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9091166004820152602481018290526044810185905260640160405180910390fd5b600380547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff88161790555f8581556002859055600684905560055581516007805484929082907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660018381811115610bd657610bd6611b23565b021790555060208201516001808301919091556040830151600283018054606086015173ffffffffffffffffffffffffffffffffffffffff16610100027fffffffffffffffffffffff00000000000000000000000000000000000000000090911660ff90931692909217919091178082556080850151927fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff909116907501000000000000000000000000000000000000000000908490811115610c9b57610c9b611b23565b0217905550905050610cac33611669565b610cb73360016116b1565b8573ffffffffffffffffffffffffffffffffffffffff167f99f3346dc2b5f4a8773b860bf7951f6bcb1a5ff787cfd080496e347c1ad5807986868686604051610d039493929190611e7b565b60405180910390a2505050505050508015610d47576002815560016020527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602080a15b505050565b5f806001610d59816115a3565b5f610d6685870187611f50565b90505f8160200151806020019051810190610d819190611fcf565b90508060025f828254610d949190611fe6565b90915550508151600354610dc19173ffffffffffffffffffffffffffffffffffffffff90911690836116f2565b81516003546040517fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606092831b811660208301529183901b90911660348201526048810183905273ffffffffffffffffffffffffffffffffffffffff909116907f9ad2e7a4af16dceda9cce4274b2f59c328d8c012eb0e15eb5e1e73b7d8f264d390606801604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815290829052610e7f91611b11565b60405180910390a260035490945073ffffffffffffffffffffffffffffffffffffffff16925050509250929050565b610eb661157d565b6107fc8282611572565b60605f80610ed084860186611ff9565b9250509150604051806080016040528060016002811115610ef357610ef3611b23565b81526020018373ffffffffffffffffffffffffffffffffffffffff1681526020013073ffffffffffffffffffffffffffffffffffffffff168152602001604051806020016040528084815250604051602001610f529151815260200190565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152918152915251610f90919060200161202b565b6040516020818303038152906040529250505092915050565b63389a75e1600c52335f525f6020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c925f80a2565b610fea61157d565b610ff35f611745565b565b6040805160a0810182525f808252602082018190529181018290526060810182905260808101919091526040805160a0810190915260078054829060ff16600181111561104457611044611b23565b600181111561105557611055611b23565b81526001828101546020830152600283015460ff808216604085015273ffffffffffffffffffffffffffffffffffffffff6101008304166060850152608090930192750100000000000000000000000000000000000000000090910416908111156110c2576110c2611b23565b60018111156110d3576110d3611b23565b905250919050565b5f6110e461157d565b5f6110f1838501856120a1565b90505f816020015180602001905181019061110c9190611fcf565b90505f61111c6002546005541090565b611152576040517f6247a84e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f545f03611161575080611184565b670de0b6b3a7640000825f54611177919061211e565b6111819190612135565b90505b60065415801590611196575060065481115b156111a057506006545b600254816005546111b19190611c9f565b11156111e9576040517f360e42e100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8060055f8282546111fa9190611c9f565b92505081905550600160045f8282546112139190611c9f565b909155505060035461123c9073ffffffffffffffffffffffffffffffffffffffff1688836116f2565b6003546040517fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606092831b811660208301529189901b90911660348201526048810182905273ffffffffffffffffffffffffffffffffffffffff8816907f9ad2e7a4af16dceda9cce4274b2f59c328d8c012eb0e15eb5e1e73b7d8f264d390606801604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290526112f791611b11565b60405180910390a25060019695505050505050565b6002611317816115a3565b838214611350576040517fff633a3800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5b848110156109fb576113a286868381811061136f5761136f611cb2565b90506020020160208101906113849190611979565b85858481811061139657611396611cb2565b90506020020135611597565b600101611352565b5f6113b86002546005541090565b949350505050565b60026113cb816115a3565b838214611404576040517fff633a3800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5b848110156109fb5761145686868381811061142357611423611cb2565b90506020020160208101906114389190611979565b85858481811061144a5761144a611cb2565b90506020020135611572565b600101611406565b61146661157d565b63389a75e1600c52805f526020600c20805442111561148c57636f5e88185f526004601cfd5b5f90556107e781611745565b6114a061157d565b8060601b6114b557637448fbae5f526004601cfd5b6107e781611745565b5f8173ffffffffffffffffffffffffffffffffffffffff166114e3638b78c6d8195490565b73ffffffffffffffffffffffffffffffffffffffff1614806107d75750638b78c6d8600c9081525f839052602090205460031615156107d7565b5f7fffffffff0000000000000000000000000000000000000000000000000000000082167f903181110000000000000000000000000000000000000000000000000000000014806107d757506107d78261178f565b6107fc82825f6117e4565b638b78c6d819543314610ff3576382b429005f526004601cfd5b6107fc828260016117e4565b638b78c6d8195433146107e757638b78c6d8600c52335f52806020600c2054166107e7576382b429005f526004601cfd5b60405181606052826040528360601b602c526f23b872dd000000000000000000000000600c5260205f6064601c5f895af18060015f51141661162857803d873b15171061162857637939f4245f526004601cfd5b505f60605260405250505050565b5f816014526f70a082310000000000000000000000005f5260208060246010865afa601f3d111660205102905092915050565b73ffffffffffffffffffffffffffffffffffffffff16638b78c6d819819055805f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08180a350565b638b78c6d8600c52815f52806020600c205580600c5160601c7f715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe265f80a35050565b81601452806034526fa9059cbb0000000000000000000000005f5260205f604460105f875af18060015f51141661173b57803d853b15171061173b576390b8ec185f526004601cfd5b505f603452505050565b638b78c6d819805473ffffffffffffffffffffffffffffffffffffffff9092169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a355565b5f7fffffffff0000000000000000000000000000000000000000000000000000000082167fa92167050000000000000000000000000000000000000000000000000000000014806107d757506107d78261183b565b638b78c6d8600c52825f526020600c20805483811783611805575080841681185b80835580600c5160601c7f715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe265f80a3505050505050565b5f7fffffffff0000000000000000000000000000000000000000000000000000000082167f6ab67a0d0000000000000000000000000000000000000000000000000000000014806107d757507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316146107d7565b5f602082840312156118e1575f80fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114611910575f80fd5b9392505050565b5f60208284031215611927575f80fd5b5035919050565b73ffffffffffffffffffffffffffffffffffffffff811681146107e7575f80fd5b5f8060408385031215611960575f80fd5b823561196b8161192e565b946020939093013593505050565b5f60208284031215611989575f80fd5b81356119108161192e565b5f8083601f8401126119a4575f80fd5b50813567ffffffffffffffff8111156119bb575f80fd5b6020830191508360208260051b85010111156119d5575f80fd5b9250929050565b5f805f80604085870312156119ef575f80fd5b843567ffffffffffffffff811115611a05575f80fd5b611a1187828801611994565b909550935050602085013567ffffffffffffffff811115611a30575f80fd5b611a3c87828801611994565b95989497509550505050565b5f8083601f840112611a58575f80fd5b50813567ffffffffffffffff811115611a6f575f80fd5b6020830191508360208285010111156119d5575f80fd5b5f8060208385031215611a97575f80fd5b823567ffffffffffffffff811115611aad575f80fd5b611ab985828601611a48565b90969095509350505050565b5f81518084528060208401602086015e5f6020828601015260207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011685010191505092915050565b602081525f6119106020830184611ac5565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffd5b600281106107e7576107e7611b23565b60a08101611b6d87611b50565b86825285602083015260ff8516604083015273ffffffffffffffffffffffffffffffffffffffff84166060830152611ba483611b50565b8260808301529695505050505050565b8051611bbf81611b50565b808352506020810151602083015260ff604082015116604083015273ffffffffffffffffffffffffffffffffffffffff60608201511660608301526080810151611c0881611b50565b806080840152505050565b60a081016107d78284611bb4565b5f805f60408486031215611c33575f80fd5b8335611c3e8161192e565b9250602084013567ffffffffffffffff811115611c59575f80fd5b611c6586828701611a48565b9497909650939450505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b808201808211156107d7576107d7611c72565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f60208284031215611cef575f80fd5b81358015158114611910575f80fd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b60405160a0810167ffffffffffffffff81118282101715611d4e57611d4e611cfe565b60405290565b6040805190810167ffffffffffffffff81118282101715611d4e57611d4e611cfe565b600281106107e7575f80fd5b8035611d8e81611d77565b919050565b5f81830361012081128015611da6575f80fd5b50611daf611d2b565b8335611dba8161192e565b815260208481013590820152604080850135908201526060808501359082015260a07fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8083011215611e09575f80fd5b611e11611d2b565b91506080840135611e2181611d77565b825260a0840135602083015260c084013560ff81168114611e40575f80fd5b604083015260e0840135611e538161192e565b6060830152611e656101008501611d83565b6080830152816080820152809250505092915050565b84815260208101849052604081018390526101008101611e9e6060830184611bb4565b95945050505050565b5f82601f830112611eb6575f80fd5b813567ffffffffffffffff811115611ed057611ed0611cfe565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810167ffffffffffffffff81118282101715611f1d57611f1d611cfe565b604052818152838201602001851015611f34575f80fd5b816020850160208301375f918101602001919091529392505050565b5f60208284031215611f60575f80fd5b813567ffffffffffffffff811115611f76575f80fd5b820160408185031215611f87575f80fd5b611f8f611d54565b8135611f9a8161192e565b8152602082013567ffffffffffffffff811115611fb5575f80fd5b611fc186828501611ea7565b602083015250949350505050565b5f60208284031215611fdf575f80fd5b5051919050565b818103818111156107d7576107d7611c72565b5f805f6060848603121561200b575f80fd5b83356120168161192e565b95602085013595506040909401359392505050565b602081525f82516003811061204257612042611b23565b8060208401525073ffffffffffffffffffffffffffffffffffffffff602084015116604083015273ffffffffffffffffffffffffffffffffffffffff604084015116606083015260608301516080808401526113b860a0840182611ac5565b5f602082840312156120b1575f80fd5b813567ffffffffffffffff8111156120c7575f80fd5b8201604081850312156120d8575f80fd5b6120e0611d54565b813567ffffffffffffffff8111156120f6575f80fd5b61210286828501611ea7565b825250602082013567ffffffffffffffff811115611fb5575f80fd5b80820281158282048414176107d7576107d7611c72565b5f82612168577f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b50049056fea26469706673582212207116aaa186a239a48bef990e22553b4fb13a51ab4a37e95e74ae15e63a94b2e764736f6c634300081a0033",v=class v extends x.ERC20VariableIncentive{constructor(){super(...arguments),this.abi=l.m}async getIncentiveCriteria(d){try{return await l.IV(this._config,{...d,address:this.assertValidAddress()})}catch(c){throw new i.IncentiveCriteriaNotFoundError(c)}}async decodeClaimData(d){const c=n.decodeAbiParameters([{type:"tuple",name:"BoostClaimData",components:[{type:"bytes",name:"validatorData"},{type:"bytes",name:"incentiveData"}]}],d),r=n.decodeAbiParameters([{type:"uint256"}],c[0].incentiveData)[0];let e=r;const[u,f]=await Promise.all([this.reward(),this.getMaxReward()]);return u===0n||(e=u*r/n.parseEther("1"),f!==0n&&e>f&&(e=f)),e}async getMaxReward(d){return await l.AV(this._config,{...d,address:this.assertValidAddress()})}async getIncentiveScalar({chainId:d,hash:c,knownSignatures:r,logs:e},u){var I;const f=await this.getIncentiveCriteria(u);if(f.criteriaType===t.SignatureType.EVENT){const p=r[f.signature];if(f.fieldIndex===h.CheatCodes.GAS_REBATE_INCENTIVE){const b=await y.getTransactionReceipt(this._config,{chainId:d,hash:c});return b.gasUsed*b.effectiveGasPrice+(b.blobGasUsed??0n)*(b.blobGasPrice??0n)}if(e&&e.length>0)try{const b=e.filter(a=>a.topics&&a.topics[0]===f.signature).map(a=>t.decodeAndReorderLogArgs(p,a));if(b.length>0)for(const a of b){if(t.isCriteriaFieldIndexTuple(f.fieldIndex))return t.getScalarValueFromTuple(a.args,f.fieldIndex);const o=a.args?a.args[f.fieldIndex]:void 0;if(o!==void 0)return BigInt(o)}}catch(b){throw new i.DecodedArgsError(`An error occurred while extracting scalar from logs: ${b.message}`)}const s=(await y.getTransactionReceipt(this._config,{chainId:d,hash:c})).logs;if(s.length===0)throw new i.NoMatchingLogsError(`No logs found for event signature ${f.signature}`);try{const b=r[f.signature],a=n.parseEventLogs({abi:[b],logs:s});if(a==null||a.length===0)throw new i.NoMatchingLogsError(`No logs found for event signature ${f.signature}`);if(t.isCriteriaFieldIndexTuple(f.fieldIndex))return t.getScalarValueFromTuple((I=a[0])==null?void 0:I.args,f.fieldIndex);const o=a[0]&&a[0].args?a[0].args[f.fieldIndex]:void 0;if(o===void 0)throw new i.DecodedArgsError(`Decoded argument at index ${f.fieldIndex} is undefined`);return BigInt(o)}catch(b){throw new i.DecodedArgsError(`Failed to decode event log for signature ${f.signature}: ${b.message}`)}}else if(f.criteriaType===t.SignatureType.FUNC){const p=await y.getTransaction(this._config,{chainId:d,hash:c});try{const g=r[f.signature],s=n.decodeFunctionData({abi:[g],data:p.input});if(t.isCriteriaFieldIndexTuple(f.fieldIndex))return t.getScalarValueFromTuple(s.args,f.fieldIndex);const b=s.args[f.fieldIndex];if(b==null)throw new i.DecodedArgsError(`Decoded argument at index ${f.fieldIndex} is undefined`);return BigInt(b)}catch(g){throw new i.DecodedArgsError(`Failed to decode function data for signature ${f.signature}: ${g.message}`)}}else throw new i.InvalidCriteriaTypeError(`Invalid criteria type ${f.criteriaType}`)}buildParameters(d,c){const[r,e]=this.validateDeploymentConfig(d,c);return{abi:l.m,bytecode:E,args:[w(r)],...this.optionallyAttachAccount(e.account)}}};v.bases={31337:void 0,...T.ERC20VariableCriteriaIncentiveV2};let m=v;function A(){return{criteriaType:t.SignatureType.EVENT,signature:n.zeroHash,fieldIndex:h.CheatCodes.GAS_REBATE_INCENTIVE,targetContract:n.zeroAddress,valueType:t.ValueType.WAD}}function w({asset:C,reward:d,limit:c,maxReward:r=0n,criteria:e}){return n.encodeAbiParameters([{type:"tuple",name:"initPayloadExtended",components:[{type:"address",name:"asset"},{type:"uint256",name:"reward"},{type:"uint256",name:"limit"},{type:"uint256",name:"maxReward"},{type:"tuple",name:"criteria",components:[{type:"uint8",name:"criteriaType"},{type:"bytes32",name:"signature"},{type:"uint8",name:"fieldIndex"},{type:"address",name:"targetContract"},{type:"uint8",name:"valueType"}]}]}],[{asset:C,reward:d,limit:c,maxReward:r,criteria:{criteriaType:e.criteriaType,signature:e.signature,fieldIndex:e.fieldIndex,targetContract:e.targetContract,valueType:e.valueType}}])}exports.erc20VariableCriteriaIncentiveV2Abi=l.m;exports.ERC20VariableCriteriaIncentiveV2=m;exports.gasRebateIncentiveCriteriaV2=A;exports.prepareERC20VariableCriteriaIncentiveV2Payload=w;
2
2
  //# sourceMappingURL=ERC20VariableCriteriaIncentiveV2.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ERC20VariableCriteriaIncentiveV2.cjs","sources":["../../src/Incentives/ERC20VariableCriteriaIncentiveV2.ts"],"sourcesContent":["import {\n erc20VariableCriteriaIncentiveV2Abi,\n readErc20VariableCriteriaIncentiveV2GetIncentiveCriteria,\n readErc20VariableCriteriaIncentiveV2GetMaxReward,\n} from '@boostxyz/evm';\nimport { bytecode } from '@boostxyz/evm/artifacts/contracts/incentives/ERC20VariableCriteriaIncentiveV2.sol/ERC20VariableCriteriaIncentiveV2.json';\nimport { getTransaction, getTransactionReceipt } from '@wagmi/core';\nimport {\n type AbiEvent,\n type AbiFunction,\n type Address,\n type Hex,\n decodeAbiParameters,\n decodeFunctionData,\n encodeAbiParameters,\n parseEther,\n parseEventLogs,\n zeroAddress,\n zeroHash,\n} from 'viem';\nimport { ERC20VariableCriteriaIncentiveV2 as ERC20VariableCriteriaIncentiveV2Bases } from '../../dist/deployments.json';\nimport { SignatureType, ValueType } from '../Actions/EventAction';\nimport type {\n DeployableOptions,\n GenericDeployableParams,\n} from '../Deployable/Deployable';\nimport {\n DecodedArgsError,\n IncentiveCriteriaNotFoundError,\n InvalidCriteriaTypeError,\n NoMatchingLogsError,\n} from '../errors';\nimport { CheatCodes, type ReadParams } from '../utils';\nimport { ERC20VariableIncentive } from './ERC20VariableIncentive';\n\nexport { erc20VariableCriteriaIncentiveV2Abi };\n\nexport interface ERC20VariableCriteriaIncentiveV2Payload {\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 as reward.\n *\n * @type {bigint}\n */\n reward: bigint;\n /**\n * The total spending limit of the asset that will be distributed.\n *\n * @type {bigint}\n */\n limit: bigint;\n /**\n * The total amount claimable in a single claim or maximum per-action reward.\n *\n * @type {bigint}\n * @optional\n */\n maxReward?: bigint;\n /**\n * The criteria for the incentive that determines how the reward is distributed.\n *\n * @type {IncentiveCriteria}\n */\n criteria: IncentiveCriteriaV2;\n}\n\nexport interface IncentiveCriteriaV2 {\n /**\n * The type of criteria used, either function signature or event signature.\n *\n * @type {SignatureType}\n */\n criteriaType: SignatureType;\n /**\n * The function or event signature used for criteria matching.\n *\n * @type {Hex}\n */\n signature: Hex;\n /**\n * The index of the field from where the scalar value is extracted.\n *\n * @type {number}\n */\n fieldIndex: number;\n /**\n * The address of the contract where the event/function is called/emitted.\n *\n * @type {Address}\n */\n targetContract: Address;\n /**\n * The type of value used for the scalar value (RAW or WAD).\n * - RAW: Raw integer value (e.g., NFT quantity)\n * - WAD: Value with 18 decimals (e.g., token amount)\n *\n * @type {ValueType}\n */\n valueType: ValueType;\n}\n\nexport interface ReadIncentiveCriteriaV2Params extends ReadParams {}\n\nexport interface GetIncentiveScalarV2Params {\n chainId: number;\n hash: Hex;\n knownSignatures: Record<Hex, AbiFunction | AbiEvent>;\n}\n\n/**\n * Extended ERC20 Variable Criteria Incentive class that fetches incentive criteria and scalar\n *\n * @export\n * @class ERC20VariableCriteriaIncentive\n * @typedef {ERC20VariableCriteriaIncentiveV2}\n * @extends {ERC20VariableIncentive<ERC20VariableCriteriaIncentiveV2Payload, typeof erc20VariableCriteriaIncentiveV2Abi>}\n */\nexport class ERC20VariableCriteriaIncentiveV2 extends ERC20VariableIncentive<\n ERC20VariableCriteriaIncentiveV2Payload,\n typeof erc20VariableCriteriaIncentiveV2Abi,\n Promise<bigint>\n> {\n //@ts-expect-error instantiated correctly\n public override readonly abi = erc20VariableCriteriaIncentiveV2Abi;\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {Record<number, Address>}\n */\n public static override bases: Record<number, Address> = {\n 31337: import.meta.env.VITE_ERC20_VARIABLE_CRITERIA_INCENTIVE_V2_BASE,\n ...(ERC20VariableCriteriaIncentiveV2Bases as Record<number, Address>),\n };\n\n /**\n *Functions from the ERC20VariableIncentive contract\n */\n\n /**\n * Fetches the IncentiveCriteria struct from the contract\n *\n * @param {?ReadParams} [params]\n * @returns {Promise<IncentiveCriteria>} Incentive criteria structure\n * @throws {IncentiveCriteriaNotFoundError}\n */\n public async getIncentiveCriteria(\n params?: ReadParams,\n ): Promise<IncentiveCriteriaV2> {\n try {\n const criteria =\n await readErc20VariableCriteriaIncentiveV2GetIncentiveCriteria(\n this._config,\n {\n ...params,\n address: this.assertValidAddress(),\n },\n );\n\n return criteria;\n } catch (e) {\n throw new IncentiveCriteriaNotFoundError(e as Error);\n }\n }\n\n /**\n * Decodes claim data for the ERC20VariableCriteriaIncentiveV2, returning the claim amount.\n * Useful when deriving amount claimed from logs.\n *\n * @public\n * @param {Hex} claimData\n * @returns {Promise<bigint>} Returns the reward amount from a claim data payload\n */\n public override async decodeClaimData(claimData: Hex) {\n const boostClaimData = decodeAbiParameters(\n [\n {\n type: 'tuple',\n name: 'BoostClaimData',\n components: [\n { type: 'bytes', name: 'validatorData' },\n { type: 'bytes', name: 'incentiveData' },\n ],\n },\n ],\n claimData,\n );\n const signedAmount = decodeAbiParameters(\n [{ type: 'uint256' }],\n boostClaimData[0].incentiveData,\n )[0];\n let claimAmount = signedAmount;\n const [reward, maxReward] = await Promise.all([\n this.reward(),\n this.getMaxReward(),\n ]);\n\n if (reward === 0n) {\n return claimAmount;\n } else {\n claimAmount = (reward * signedAmount) / parseEther('1');\n }\n\n if (maxReward !== 0n && claimAmount > maxReward) {\n claimAmount = maxReward;\n }\n\n return claimAmount;\n }\n\n /**\n * Fetches the IncentiveCriteria struct from the contract\n *\n * @param {?ReadParams} [params]\n * @returns {Promise<IncentiveCriteria>} Incentive criteria structure\n * @throws {IncentiveCriteriaNotFoundError}\n */\n public async getMaxReward(params?: ReadParams): Promise<bigint> {\n const maxReward = await readErc20VariableCriteriaIncentiveV2GetMaxReward(\n this._config,\n {\n ...params,\n address: this.assertValidAddress(),\n },\n );\n\n return maxReward;\n }\n\n /**\n * Fetches the incentive scalar from a transaction hash\n *\n * @param {GetIncentiveScalarParams} params\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n * @throws {InvalidCriteriaTypeError | NoMatchingLogsError | DecodedArgsError}\n */\n public async getIncentiveScalar(\n { chainId, hash, knownSignatures }: GetIncentiveScalarV2Params,\n params?: ReadParams,\n ): Promise<bigint> {\n const criteria = await this.getIncentiveCriteria(params);\n if (criteria.criteriaType === SignatureType.EVENT) {\n const transactionReceipt = await getTransactionReceipt(this._config, {\n chainId,\n hash,\n });\n if (criteria.fieldIndex === CheatCodes.GAS_REBATE_INCENTIVE) {\n const totalCost =\n transactionReceipt.gasUsed * transactionReceipt.effectiveGasPrice + // Normal gas cost\n (transactionReceipt.blobGasUsed ?? 0n) *\n (transactionReceipt.blobGasPrice ?? 0n); // Blob gas cost - account for potential undefined values\n return totalCost;\n }\n const logs = transactionReceipt.logs;\n\n if (logs.length === 0) {\n throw new NoMatchingLogsError(\n `No logs found for event signature ${criteria.signature}`,\n );\n }\n\n // Decode the event log\n try {\n // Decode function data\n const eventAbi = knownSignatures[criteria.signature] as AbiEvent;\n const decodedEvents = parseEventLogs({\n abi: [eventAbi],\n logs,\n });\n if (decodedEvents == undefined || decodedEvents.length === 0) {\n throw new NoMatchingLogsError(\n `No logs found for event signature ${criteria.signature}`,\n );\n }\n const scalarValue = (decodedEvents[0]?.args as string[])[\n criteria.fieldIndex\n ];\n\n if (scalarValue === undefined) {\n throw new DecodedArgsError(\n `Decoded argument at index ${criteria.fieldIndex} is undefined`,\n );\n }\n return BigInt(scalarValue);\n } catch (e) {\n throw new DecodedArgsError(\n `Failed to decode event log for signature ${criteria.signature}: ${(e as Error).message}`,\n );\n }\n } else if (criteria.criteriaType === SignatureType.FUNC) {\n // Fetch the transaction data\n const transaction = await getTransaction(this._config, {\n chainId,\n hash,\n });\n try {\n // Decode function data\n const func = knownSignatures[criteria.signature] as AbiFunction;\n const decodedFunction = decodeFunctionData({\n abi: [func],\n data: transaction.input,\n });\n const scalarValue = decodedFunction.args[criteria.fieldIndex] as string;\n if (scalarValue === undefined || scalarValue === null) {\n throw new DecodedArgsError(\n `Decoded argument at index ${criteria.fieldIndex} is undefined`,\n );\n }\n return BigInt(scalarValue);\n } catch (e) {\n throw new DecodedArgsError(\n `Failed to decode function data for signature ${criteria.signature}: ${(e as Error).message}`,\n );\n }\n } else {\n throw new InvalidCriteriaTypeError(\n `Invalid criteria type ${criteria.criteriaType}`,\n );\n }\n }\n\n /**\n * @inheritdoc\n *\n * @public\n * @param {?ERC20VariableCriteriaIncentiveV2Payload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {GenericDeployableParams}\n */\n public override buildParameters(\n _payload?: ERC20VariableCriteriaIncentiveV2Payload,\n _options?: DeployableOptions,\n ): GenericDeployableParams {\n const [payload, options] = this.validateDeploymentConfig(\n _payload,\n _options,\n );\n return {\n abi: erc20VariableCriteriaIncentiveV2Abi,\n bytecode: bytecode as Hex,\n args: [prepareERC20VariableCriteriaIncentiveV2Payload(payload)],\n ...this.optionallyAttachAccount(options.account),\n };\n }\n}\n\n/**\n * Creates an IncentiveCriteria object representing a gas rebate incentive.\n * This object defines a variable incentive criteria where the criteria will be the gas spent.\n *\n * The criteria uses a signatureType of EVENT, with a special `fieldIndex` of 255 (using CheatCodes enum), which indicates\n * that the entire gas cost of the transaction will be used as the scalar value. If you don't want to\n * rebate the entire gas cost, you can use a reward value on the incentive..\n *\n * - `criteriaType`: EVENT, indicating it's based on event logs.\n * - `signature`: A zeroed signature (0x0000...0000), matching any event.\n * - `fieldIndex`: 255, indicating the use of transaction gas cost using CheatCodes enum.\n * - `targetContract`: A zeroed address (0x0000...0000), applicable to any contract.\n *\n * @returns {IncentiveCriteria} Returns an IncentiveCriteria object for a gas rebate.\n *\n * @example\n * const incentive = gasRebateIncentiveCriteria();\n * const actionPayload = {\n * criteria: incentive,\n * asset: \"0xAssetAddress\",\n * reward: 0, // Set to zero to rebate the entire gas cost\n * limit: BigInt(1000) // This is the total spend limit for the incentive\n * };\n * deployIncentive(actionPayload);\n */\nexport function gasRebateIncentiveCriteriaV2(): IncentiveCriteriaV2 {\n return {\n criteriaType: SignatureType.EVENT,\n signature: zeroHash,\n fieldIndex: CheatCodes.GAS_REBATE_INCENTIVE,\n targetContract: zeroAddress,\n valueType: ValueType.WAD,\n };\n}\n\n/**\n *\n *\n * @param {InitPayloadExtended} param0\n * @param {Address} param0.asset - The address of the ERC20 asset to incentivize.\n * @param {bigint} param0.reward - The reward amount to distribute per action.\n * @param {bigint} param0.limit - The total limit of the asset distribution.\n * @param {bigint} param0.maxReward - The maximum value claimable from a single completion.\n * @param {IncentiveCriteria} param0.criteria - The incentive criteria for reward distribution.\n * @returns {Hex}\n */\nexport function prepareERC20VariableCriteriaIncentiveV2Payload({\n asset,\n reward,\n limit,\n maxReward = 0n,\n criteria,\n}: ERC20VariableCriteriaIncentiveV2Payload) {\n return encodeAbiParameters(\n [\n {\n type: 'tuple',\n name: 'initPayloadExtended',\n components: [\n { type: 'address', name: 'asset' },\n { type: 'uint256', name: 'reward' },\n { type: 'uint256', name: 'limit' },\n { type: 'uint256', name: 'maxReward' },\n {\n type: 'tuple',\n name: 'criteria',\n components: [\n { type: 'uint8', name: 'criteriaType' },\n { type: 'bytes32', name: 'signature' },\n { type: 'uint8', name: 'fieldIndex' },\n { type: 'address', name: 'targetContract' },\n { type: 'uint8', name: 'valueType' },\n ],\n },\n ],\n },\n ],\n [\n {\n asset: asset,\n reward: reward,\n limit: limit,\n maxReward: maxReward,\n criteria: {\n criteriaType: criteria.criteriaType,\n signature: criteria.signature,\n fieldIndex: criteria.fieldIndex,\n targetContract: criteria.targetContract,\n valueType: criteria.valueType,\n },\n },\n ],\n );\n}\n"],"names":["_ERC20VariableCriteriaIncentiveV2","ERC20VariableIncentive","erc20VariableCriteriaIncentiveV2Abi","params","readErc20VariableCriteriaIncentiveV2GetIncentiveCriteria","e","IncentiveCriteriaNotFoundError","claimData","boostClaimData","decodeAbiParameters","signedAmount","claimAmount","reward","maxReward","parseEther","readErc20VariableCriteriaIncentiveV2GetMaxReward","chainId","hash","knownSignatures","criteria","SignatureType","transactionReceipt","getTransactionReceipt","CheatCodes","logs","NoMatchingLogsError","eventAbi","decodedEvents","parseEventLogs","scalarValue","_a","DecodedArgsError","transaction","getTransaction","func","decodeFunctionData","InvalidCriteriaTypeError","_payload","_options","payload","options","bytecode","prepareERC20VariableCriteriaIncentiveV2Payload","ERC20VariableCriteriaIncentiveV2Bases","ERC20VariableCriteriaIncentiveV2","gasRebateIncentiveCriteriaV2","zeroHash","zeroAddress","ValueType","asset","limit","encodeAbiParameters"],"mappings":"u7iBA0HaA,EAAN,MAAMA,UAAyCC,EAAAA,sBAIpD,CAJK,aAAA,CAAA,MAAA,GAAA,SAAA,EAML,KAAyB,IAAMC,GAAA,CAwB/B,MAAa,qBACXC,EAC8B,CAC1B,GAAA,CAUK,OARL,MAAMC,EAAA,GACJ,KAAK,QACL,CACE,GAAGD,EACH,QAAS,KAAK,mBAAmB,CACnC,CAAA,QAIGE,EAAG,CACJ,MAAA,IAAIC,EAAAA,+BAA+BD,CAAU,CACrD,CACF,CAUA,MAAsB,gBAAgBE,EAAgB,CACpD,MAAMC,EAAiBC,EAAA,oBACrB,CACE,CACE,KAAM,QACN,KAAM,iBACN,WAAY,CACV,CAAE,KAAM,QAAS,KAAM,eAAgB,EACvC,CAAE,KAAM,QAAS,KAAM,eAAgB,CACzC,CACF,CACF,EACAF,CAAA,EAEIG,EAAeD,EAAA,oBACnB,CAAC,CAAE,KAAM,UAAW,EACpBD,EAAe,CAAC,EAAE,eAClB,CAAC,EACH,IAAIG,EAAcD,EAClB,KAAM,CAACE,EAAQC,CAAS,EAAI,MAAM,QAAQ,IAAI,CAC5C,KAAK,OAAO,EACZ,KAAK,aAAa,CAAA,CACnB,EAED,OAAID,IAAW,KAGED,EAAAC,EAASF,EAAgBI,EAAA,WAAW,GAAG,EAGpDD,IAAc,IAAMF,EAAcE,IACtBF,EAAAE,IAGTF,CACT,CASA,MAAa,aAAaR,EAAsC,CASvD,OARW,MAAMY,EAAA,GACtB,KAAK,QACL,CACE,GAAGZ,EACH,QAAS,KAAK,mBAAmB,CACnC,CAAA,CAIJ,CAUA,M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AAE,KAAM,UAAW,KAAM,WAAY,EACrC,CAAE,KAAM,QAAS,KAAM,YAAa,EACpC,CAAE,KAAM,UAAW,KAAM,gBAAiB,EAC1C,CAAE,KAAM,QAAS,KAAM,WAAY,CACrC,CACF,CACF,CACF,CACF,EACA,CACE,CACE,MAAAF,EACA,OAAArC,EACA,MAAAsC,EACA,UAAArC,EACA,SAAU,CACR,aAAcM,EAAS,aACvB,UAAWA,EAAS,UACpB,WAAYA,EAAS,WACrB,eAAgBA,EAAS,eACzB,UAAWA,EAAS,SACtB,CACF,CACF,CAAA,CAEJ"}
1
+ {"version":3,"file":"ERC20VariableCriteriaIncentiveV2.cjs","sources":["../../src/Incentives/ERC20VariableCriteriaIncentiveV2.ts"],"sourcesContent":["import {\n erc20VariableCriteriaIncentiveV2Abi,\n readErc20VariableCriteriaIncentiveV2GetIncentiveCriteria,\n readErc20VariableCriteriaIncentiveV2GetMaxReward,\n} from '@boostxyz/evm';\nimport { bytecode } from '@boostxyz/evm/artifacts/contracts/incentives/ERC20VariableCriteriaIncentiveV2.sol/ERC20VariableCriteriaIncentiveV2.json';\nimport { getTransaction, getTransactionReceipt } from '@wagmi/core';\nimport {\n type AbiEvent,\n type AbiFunction,\n type Address,\n type GetLogsReturnType,\n type Hex,\n decodeAbiParameters,\n decodeFunctionData,\n encodeAbiParameters,\n parseEther,\n parseEventLogs,\n zeroAddress,\n zeroHash,\n} from 'viem';\nimport { ERC20VariableCriteriaIncentiveV2 as ERC20VariableCriteriaIncentiveV2Bases } from '../../dist/deployments.json';\nimport {\n SignatureType,\n ValueType,\n decodeAndReorderLogArgs,\n getScalarValueFromTuple,\n isCriteriaFieldIndexTuple,\n} from '../Actions/EventAction';\nimport type {\n DeployableOptions,\n GenericDeployableParams,\n} from '../Deployable/Deployable';\nimport {\n DecodedArgsError,\n IncentiveCriteriaNotFoundError,\n InvalidCriteriaTypeError,\n NoMatchingLogsError,\n} from '../errors';\nimport { CheatCodes, type ReadParams } from '../utils';\nimport { ERC20VariableIncentive } from './ERC20VariableIncentive';\n\nexport { erc20VariableCriteriaIncentiveV2Abi };\n\nexport interface ERC20VariableCriteriaIncentiveV2Payload {\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 as reward.\n *\n * @type {bigint}\n */\n reward: bigint;\n /**\n * The total spending limit of the asset that will be distributed.\n *\n * @type {bigint}\n */\n limit: bigint;\n /**\n * The total amount claimable in a single claim or maximum per-action reward.\n *\n * @type {bigint}\n * @optional\n */\n maxReward?: bigint;\n /**\n * The criteria for the incentive that determines how the reward is distributed.\n *\n * @type {IncentiveCriteria}\n */\n criteria: IncentiveCriteriaV2;\n}\n\nexport interface IncentiveCriteriaV2 {\n /**\n * The type of criteria used, either function signature or event signature.\n *\n * @type {SignatureType}\n */\n criteriaType: SignatureType;\n /**\n * The function or event signature used for criteria matching.\n *\n * @type {Hex}\n */\n signature: Hex;\n /**\n * The index of the field from where the scalar value is extracted.\n *\n * @type {number}\n */\n fieldIndex: number;\n /**\n * The address of the contract where the event/function is called/emitted.\n *\n * @type {Address}\n */\n targetContract: Address;\n /**\n * The type of value used for the scalar value (RAW or WAD).\n * - RAW: Raw integer value (e.g., NFT quantity)\n * - WAD: Value with 18 decimals (e.g., token amount)\n *\n * @type {ValueType}\n */\n valueType: ValueType;\n}\n\nexport interface ReadIncentiveCriteriaV2Params extends ReadParams {}\n\nexport interface GetIncentiveScalarV2Params {\n chainId: number;\n hash: Hex;\n knownSignatures: Record<Hex, AbiFunction | AbiEvent>;\n logs?: GetLogsReturnType<AbiEvent, AbiEvent[], true>;\n}\n\n/**\n * Extended ERC20 Variable Criteria Incentive class that fetches incentive criteria and scalar\n *\n * @export\n * @class ERC20VariableCriteriaIncentive\n * @typedef {ERC20VariableCriteriaIncentiveV2}\n * @extends {ERC20VariableIncentive<ERC20VariableCriteriaIncentiveV2Payload, typeof erc20VariableCriteriaIncentiveV2Abi>}\n */\nexport class ERC20VariableCriteriaIncentiveV2 extends ERC20VariableIncentive<\n ERC20VariableCriteriaIncentiveV2Payload,\n typeof erc20VariableCriteriaIncentiveV2Abi,\n Promise<bigint>\n> {\n //@ts-expect-error instantiated correctly\n public override readonly abi = erc20VariableCriteriaIncentiveV2Abi;\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {Record<number, Address>}\n */\n public static override bases: Record<number, Address> = {\n 31337: import.meta.env.VITE_ERC20_VARIABLE_CRITERIA_INCENTIVE_V2_BASE,\n ...(ERC20VariableCriteriaIncentiveV2Bases as Record<number, Address>),\n };\n\n /**\n *Functions from the ERC20VariableIncentive contract\n */\n\n /**\n * Fetches the IncentiveCriteria struct from the contract\n *\n * @param {?ReadParams} [params]\n * @returns {Promise<IncentiveCriteria>} Incentive criteria structure\n * @throws {IncentiveCriteriaNotFoundError}\n */\n public async getIncentiveCriteria(\n params?: ReadParams,\n ): Promise<IncentiveCriteriaV2> {\n try {\n const criteria =\n await readErc20VariableCriteriaIncentiveV2GetIncentiveCriteria(\n this._config,\n {\n ...params,\n address: this.assertValidAddress(),\n },\n );\n\n return criteria;\n } catch (e) {\n throw new IncentiveCriteriaNotFoundError(e as Error);\n }\n }\n\n /**\n * Decodes claim data for the ERC20VariableCriteriaIncentiveV2, returning the claim amount.\n * Useful when deriving amount claimed from logs.\n *\n * @public\n * @param {Hex} claimData\n * @returns {Promise<bigint>} Returns the reward amount from a claim data payload\n */\n public override async decodeClaimData(claimData: Hex) {\n const boostClaimData = decodeAbiParameters(\n [\n {\n type: 'tuple',\n name: 'BoostClaimData',\n components: [\n { type: 'bytes', name: 'validatorData' },\n { type: 'bytes', name: 'incentiveData' },\n ],\n },\n ],\n claimData,\n );\n const signedAmount = decodeAbiParameters(\n [{ type: 'uint256' }],\n boostClaimData[0].incentiveData,\n )[0];\n let claimAmount = signedAmount;\n const [reward, maxReward] = await Promise.all([\n this.reward(),\n this.getMaxReward(),\n ]);\n\n if (reward === 0n) {\n return claimAmount;\n } else {\n claimAmount = (reward * signedAmount) / parseEther('1');\n }\n\n if (maxReward !== 0n && claimAmount > maxReward) {\n claimAmount = maxReward;\n }\n\n return claimAmount;\n }\n\n /**\n * Fetches the IncentiveCriteria struct from the contract\n *\n * @param {?ReadParams} [params]\n * @returns {Promise<IncentiveCriteria>} Incentive criteria structure\n * @throws {IncentiveCriteriaNotFoundError}\n */\n public async getMaxReward(params?: ReadParams): Promise<bigint> {\n const maxReward = await readErc20VariableCriteriaIncentiveV2GetMaxReward(\n this._config,\n {\n ...params,\n address: this.assertValidAddress(),\n },\n );\n\n return maxReward;\n }\n\n /**\n * Fetches the incentive scalar from a transaction hash\n *\n * @param {GetIncentiveScalarParams} params\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n * @throws {InvalidCriteriaTypeError | NoMatchingLogsError | DecodedArgsError}\n */\n public async getIncentiveScalar(\n { chainId, hash, knownSignatures, logs }: GetIncentiveScalarV2Params,\n params?: ReadParams,\n ): Promise<bigint> {\n const criteria = await this.getIncentiveCriteria(params);\n if (criteria.criteriaType === SignatureType.EVENT) {\n const eventAbi = knownSignatures[criteria.signature] as AbiEvent;\n\n if (criteria.fieldIndex === CheatCodes.GAS_REBATE_INCENTIVE) {\n const transactionReceipt = await getTransactionReceipt(this._config, {\n chainId,\n hash,\n });\n const totalCost =\n transactionReceipt.gasUsed * transactionReceipt.effectiveGasPrice + // Normal gas cost\n (transactionReceipt.blobGasUsed ?? 0n) *\n (transactionReceipt.blobGasPrice ?? 0n); // Blob gas cost - account for potential undefined values\n return totalCost;\n }\n\n // if logs are provided, use them to extract the scalar\n if (logs && logs.length > 0) {\n try {\n // only check logs that match the criteria signature\n const signatureMatchingLogs = logs\n .filter((log) => log.topics && log.topics[0] === criteria.signature)\n .map((log) => decodeAndReorderLogArgs(eventAbi, log));\n\n if (signatureMatchingLogs.length > 0) {\n for (const log of signatureMatchingLogs) {\n if (isCriteriaFieldIndexTuple(criteria.fieldIndex)) {\n return getScalarValueFromTuple(\n log.args as unknown[],\n criteria.fieldIndex,\n );\n }\n const scalarValue = log.args\n ? (log.args as string[])[criteria.fieldIndex]\n : undefined;\n if (scalarValue !== undefined) {\n return BigInt(scalarValue);\n }\n }\n }\n } catch (e) {\n throw new DecodedArgsError(\n `An error occurred while extracting scalar from logs: ${(e as Error).message}`,\n );\n }\n }\n\n const transactionReceipt = await getTransactionReceipt(this._config, {\n chainId,\n hash,\n });\n const receiptLogs = transactionReceipt.logs;\n\n if (receiptLogs.length === 0) {\n throw new NoMatchingLogsError(\n `No logs found for event signature ${criteria.signature}`,\n );\n }\n\n // Decode the event log\n try {\n const eventAbi = knownSignatures[criteria.signature] as AbiEvent;\n const decodedEvents = parseEventLogs({\n abi: [eventAbi],\n logs: receiptLogs,\n });\n if (decodedEvents == undefined || decodedEvents.length === 0) {\n throw new NoMatchingLogsError(\n `No logs found for event signature ${criteria.signature}`,\n );\n }\n\n if (isCriteriaFieldIndexTuple(criteria.fieldIndex)) {\n return getScalarValueFromTuple(\n decodedEvents[0]?.args as unknown[],\n criteria.fieldIndex,\n );\n }\n\n const scalarValue =\n decodedEvents[0] && decodedEvents[0].args\n ? (decodedEvents[0].args as string[])[criteria.fieldIndex]\n : undefined;\n if (scalarValue === undefined) {\n throw new DecodedArgsError(\n `Decoded argument at index ${criteria.fieldIndex} is undefined`,\n );\n }\n return BigInt(scalarValue);\n } catch (e) {\n throw new DecodedArgsError(\n `Failed to decode event log for signature ${criteria.signature}: ${(e as Error).message}`,\n );\n }\n } else if (criteria.criteriaType === SignatureType.FUNC) {\n // Fetch the transaction data\n const transaction = await getTransaction(this._config, {\n chainId,\n hash,\n });\n try {\n // Decode function data\n const func = knownSignatures[criteria.signature] as AbiFunction;\n const decodedFunction = decodeFunctionData({\n abi: [func],\n data: transaction.input,\n });\n\n if (isCriteriaFieldIndexTuple(criteria.fieldIndex)) {\n return getScalarValueFromTuple(\n decodedFunction.args as unknown[],\n criteria.fieldIndex,\n );\n }\n\n const scalarValue = decodedFunction.args[criteria.fieldIndex] as string;\n if (scalarValue === undefined || scalarValue === null) {\n throw new DecodedArgsError(\n `Decoded argument at index ${criteria.fieldIndex} is undefined`,\n );\n }\n return BigInt(scalarValue);\n } catch (e) {\n throw new DecodedArgsError(\n `Failed to decode function data for signature ${criteria.signature}: ${(e as Error).message}`,\n );\n }\n } else {\n throw new InvalidCriteriaTypeError(\n `Invalid criteria type ${criteria.criteriaType}`,\n );\n }\n }\n\n /**\n * @inheritdoc\n *\n * @public\n * @param {?ERC20VariableCriteriaIncentiveV2Payload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {GenericDeployableParams}\n */\n public override buildParameters(\n _payload?: ERC20VariableCriteriaIncentiveV2Payload,\n _options?: DeployableOptions,\n ): GenericDeployableParams {\n const [payload, options] = this.validateDeploymentConfig(\n _payload,\n _options,\n );\n return {\n abi: erc20VariableCriteriaIncentiveV2Abi,\n bytecode: bytecode as Hex,\n args: [prepareERC20VariableCriteriaIncentiveV2Payload(payload)],\n ...this.optionallyAttachAccount(options.account),\n };\n }\n}\n\n/**\n * Creates an IncentiveCriteria object representing a gas rebate incentive.\n * This object defines a variable incentive criteria where the criteria will be the gas spent.\n *\n * The criteria uses a signatureType of EVENT, with a special `fieldIndex` of 255 (using CheatCodes enum), which indicates\n * that the entire gas cost of the transaction will be used as the scalar value. If you don't want to\n * rebate the entire gas cost, you can use a reward value on the incentive..\n *\n * - `criteriaType`: EVENT, indicating it's based on event logs.\n * - `signature`: A zeroed signature (0x0000...0000), matching any event.\n * - `fieldIndex`: 255, indicating the use of transaction gas cost using CheatCodes enum.\n * - `targetContract`: A zeroed address (0x0000...0000), applicable to any contract.\n *\n * @returns {IncentiveCriteria} Returns an IncentiveCriteria object for a gas rebate.\n *\n * @example\n * const incentive = gasRebateIncentiveCriteria();\n * const actionPayload = {\n * criteria: incentive,\n * asset: \"0xAssetAddress\",\n * reward: 0, // Set to zero to rebate the entire gas cost\n * limit: BigInt(1000) // This is the total spend limit for the incentive\n * };\n * deployIncentive(actionPayload);\n */\nexport function gasRebateIncentiveCriteriaV2(): IncentiveCriteriaV2 {\n return {\n criteriaType: SignatureType.EVENT,\n signature: zeroHash,\n fieldIndex: CheatCodes.GAS_REBATE_INCENTIVE,\n targetContract: zeroAddress,\n valueType: ValueType.WAD,\n };\n}\n\n/**\n *\n *\n * @param {InitPayloadExtended} param0\n * @param {Address} param0.asset - The address of the ERC20 asset to incentivize.\n * @param {bigint} param0.reward - The reward amount to distribute per action.\n * @param {bigint} param0.limit - The total limit of the asset distribution.\n * @param {bigint} param0.maxReward - The maximum value claimable from a single completion.\n * @param {IncentiveCriteria} param0.criteria - The incentive criteria for reward distribution.\n * @returns {Hex}\n */\nexport function prepareERC20VariableCriteriaIncentiveV2Payload({\n asset,\n reward,\n limit,\n maxReward = 0n,\n criteria,\n}: ERC20VariableCriteriaIncentiveV2Payload) {\n return encodeAbiParameters(\n [\n {\n type: 'tuple',\n name: 'initPayloadExtended',\n components: [\n { type: 'address', name: 'asset' },\n { type: 'uint256', name: 'reward' },\n { type: 'uint256', name: 'limit' },\n { type: 'uint256', name: 'maxReward' },\n {\n type: 'tuple',\n name: 'criteria',\n components: [\n { type: 'uint8', name: 'criteriaType' },\n { type: 'bytes32', name: 'signature' },\n { type: 'uint8', name: 'fieldIndex' },\n { type: 'address', name: 'targetContract' },\n { type: 'uint8', name: 'valueType' },\n ],\n },\n ],\n },\n ],\n [\n {\n asset: asset,\n reward: reward,\n limit: limit,\n maxReward: maxReward,\n criteria: {\n criteriaType: criteria.criteriaType,\n signature: criteria.signature,\n fieldIndex: criteria.fieldIndex,\n targetContract: criteria.targetContract,\n valueType: criteria.valueType,\n },\n },\n ],\n );\n}\n"],"names":["_ERC20VariableCriteriaIncentiveV2","ERC20VariableIncentive","erc20VariableCriteriaIncentiveV2Abi","params","readErc20VariableCriteriaIncentiveV2GetIncentiveCriteria","e","IncentiveCriteriaNotFoundError","claimData","boostClaimData","decodeAbiParameters","signedAmount","claimAmount","reward","maxReward","parseEther","readErc20VariableCriteriaIncentiveV2GetMaxReward","chainId","hash","knownSignatures","logs","criteria","SignatureType","eventAbi","CheatCodes","transactionReceipt","getTransactionReceipt","signatureMatchingLogs","log","decodeAndReorderLogArgs","isCriteriaFieldIndexTuple","getScalarValueFromTuple","scalarValue","DecodedArgsError","receiptLogs","NoMatchingLogsError","decodedEvents","parseEventLogs","_a","transaction","getTransaction","func","decodedFunction","decodeFunctionData","InvalidCriteriaTypeError","_payload","_options","payload","options","bytecode","prepareERC20VariableCriteriaIncentiveV2Payload","ERC20VariableCriteriaIncentiveV2Bases","ERC20VariableCriteriaIncentiveV2","gasRebateIncentiveCriteriaV2","zeroHash","zeroAddress","ValueType","asset","limit","encodeAbiParameters"],"mappings":"u7iBAkIaA,EAAN,MAAMA,UAAyCC,EAAAA,sBAIpD,CAJK,aAAA,CAAA,MAAA,GAAA,SAAA,EAML,KAAyB,IAAMC,GAAA,CAwB/B,MAAa,qBACXC,EAC8B,CAC1B,GAAA,CAUK,OARL,MAAMC,EAAA,GACJ,KAAK,QACL,CACE,GAAGD,EACH,QAAS,KAAK,mBAAmB,CACnC,CAAA,QAIGE,EAAG,CACJ,MAAA,IAAIC,EAAAA,+BAA+BD,CAAU,CACrD,CACF,CAUA,MAAsB,gBAAgBE,EAAgB,CACpD,MAAMC,EAAiBC,EAAA,oBACrB,CACE,CACE,KAAM,QACN,KAAM,iBACN,WAAY,CACV,CAAE,KAAM,QAAS,KAAM,eAAgB,EACvC,CAAE,KAAM,QAAS,KAAM,eAAgB,CACzC,CACF,CACF,EACAF,CAAA,EAEIG,EAAeD,EAAA,oBACnB,CAAC,CAAE,KAAM,UAAW,EACpBD,EAAe,CAAC,EAAE,eAClB,CAAC,EACH,IAAIG,EAAcD,EAClB,KAAM,CAACE,EAAQC,CAAS,EAAI,MAAM,QAAQ,IAAI,CAC5C,KAAK,OAAO,EACZ,KAAK,aAAa,CAAA,CACnB,EAED,OAAID,IAAW,KAGED,EAAAC,EAASF,EAAgBI,EAAA,WAAW,GAAG,EAGpDD,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C1C,CAAE,KAAM,QAAS,KAAM,WAAY,CACrC,CACF,CACF,CACF,CACF,EACA,CACE,CACE,MAAAF,EACA,OAAA5C,EACA,MAAA6C,EACA,UAAA5C,EACA,SAAU,CACR,aAAcO,EAAS,aACvB,UAAWA,EAAS,UACpB,WAAYA,EAAS,WACrB,eAAgBA,EAAS,eACzB,UAAWA,EAAS,SACtB,CACF,CACF,CAAA,CAEJ"}
@@ -1,5 +1,5 @@
1
1
  import { erc20VariableCriteriaIncentiveV2Abi } from '@boostxyz/evm';
2
- import { type AbiEvent, type AbiFunction, type Address, type Hex } from 'viem';
2
+ import { type AbiEvent, type AbiFunction, type Address, type GetLogsReturnType, type Hex } from 'viem';
3
3
  import { SignatureType, ValueType } from '../Actions/EventAction';
4
4
  import type { DeployableOptions, GenericDeployableParams } from '../Deployable/Deployable';
5
5
  import { type ReadParams } from '../utils';
@@ -78,6 +78,7 @@ export interface GetIncentiveScalarV2Params {
78
78
  chainId: number;
79
79
  hash: Hex;
80
80
  knownSignatures: Record<Hex, AbiFunction | AbiEvent>;
81
+ logs?: GetLogsReturnType<AbiEvent, AbiEvent[], true>;
81
82
  }
82
83
  /**
83
84
  * Extended ERC20 Variable Criteria Incentive class that fetches incentive criteria and scalar
@@ -851,7 +852,7 @@ export declare class ERC20VariableCriteriaIncentiveV2 extends ERC20VariableIncen
851
852
  * @returns {Promise<bigint>}
852
853
  * @throws {InvalidCriteriaTypeError | NoMatchingLogsError | DecodedArgsError}
853
854
  */
854
- getIncentiveScalar({ chainId, hash, knownSignatures }: GetIncentiveScalarV2Params, params?: ReadParams): Promise<bigint>;
855
+ getIncentiveScalar({ chainId, hash, knownSignatures, logs }: GetIncentiveScalarV2Params, params?: ReadParams): Promise<bigint>;
855
856
  /**
856
857
  * @inheritdoc
857
858
  *
@@ -1 +1 @@
1
- {"version":3,"file":"ERC20VariableCriteriaIncentiveV2.d.ts","sourceRoot":"","sources":["../../src/Incentives/ERC20VariableCriteriaIncentiveV2.ts"],"names":[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AMG;IACU,YAAY,CAAC,MAAM,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC;IAY/D;;;;;;;OAOG;IACU,kBAAkB,CAC7B,EAAE,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,EAAE,0BAA0B,EAC9D,MAAM,CAAC,EAAE,UAAU,GAClB,OAAO,CAAC,MAAM,CAAC;IAkFlB;;;;;;;OAOG;IACa,eAAe,CAC7B,QAAQ,CAAC,EAAE,uCAAuC,EAClD,QAAQ,CAAC,EAAE,iBAAiB,GAC3B,uBAAuB;CAY3B;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,4BAA4B,IAAI,mBAAmB,CAQlE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,8CAA8C,CAAC,EAC7D,KAAK,EACL,MAAM,EACN,KAAK,EACL,SAAc,EACd,QAAQ,GACT,EAAE,uCAAuC,iBAyCzC"}
1
+ {"version":3,"file":"ERC20VariableCriteriaIncentiveV2.d.ts","sourceRoot":"","sources":["../../src/Incentives/ERC20VariableCriteriaIncentiveV2.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mCAAmC,EAGpC,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,iBAAiB,EACtB,KAAK,GAAG,EAQT,MAAM,MAAM,CAAC;AAEd,OAAO,EACL,aAAa,EACb,SAAS,EAIV,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EACV,iBAAiB,EACjB,uBAAuB,EACxB,MAAM,0BAA0B,CAAC;AAOlC,OAAO,EAAc,KAAK,UAAU,EAAE,MAAM,UAAU,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,OAAO,EAAE,mCAAmC,EAAE,CAAC;AAE/C,MAAM,WAAW,uCAAuC;IACtD;;;;OAIG;IACH,KAAK,EAAE,OAAO,CAAC;IACf;;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